def get_transfers(self):
        """Does a GET request to /transfers.

        Gets all transfers

        Returns:
            ListTransfers: Response from the API. 

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """

        # Prepare query URL
        _url_path = '/transfers'
        _query_builder = Configuration.base_uri
        _query_builder += _url_path
        _query_url = APIHelper.clean_url(_query_builder)

        # Prepare headers
        _headers = {'accept': 'application/json'}

        # Prepare and execute request
        _request = self.http_client.get(_query_url, headers=_headers)
        BasicAuth.apply(_request)
        _context = self.execute_request(_request)
        self.validate_response(_context)

        # Return appropriate type
        return APIHelper.json_deserialize(_context.response.raw_body,
                                          ListTransfers.from_dictionary)
예제 #2
0
    def get_customers(self,
                      name=None,
                      document=None,
                      page=1,
                      size=10,
                      email=None,
                      code=None):
        """Does a GET request to /customers.

        Get all Customers

        Args:
            name (string, optional): Name of the Customer
            document (string, optional): Document of the Customer
            page (int, optional): Current page the the search
            size (int, optional): Quantity pages of the search
            email (string, optional): Customer's email
            code (string, optional): Customer's code

        Returns:
            ListCustomersResponse: Response from the API. 

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """

        # Prepare query URL
        _url_path = '/customers'
        _query_builder = Configuration.base_uri
        _query_builder += _url_path
        _query_parameters = {
            'name': name,
            'document': document,
            'page': page,
            'size': size,
            'email': email,
            'Code': code
        }
        _query_builder = APIHelper.append_url_with_query_parameters(_query_builder,
            _query_parameters, Configuration.array_serialization)
        _query_url = APIHelper.clean_url(_query_builder)

        # Prepare headers
        _headers = {
            'accept': 'application/json'
        }

        # Prepare and execute request
        _request = self.http_client.get(_query_url, headers=_headers)
        BasicAuth.apply(_request)
        _context = self.execute_request(_request)
        self.validate_response(_context)

        # Return appropriate type
        return APIHelper.json_deserialize(_context.response.raw_body, ListCustomersResponse.from_dictionary)
예제 #3
0
    def create_invoice(self,
                       subscription_id,
                       cycle_id,
                       request=None,
                       idempotency_key=None):
        """Does a POST request to /subscriptions/{subscription_id}/cycles/{cycle_id}/pay.

        Create an Invoice

        Args:
            subscription_id (string): Subscription Id
            cycle_id (string): Cycle Id
            request (CreateInvoiceRequest, optional): TODO: type description
                here. Example: 
            idempotency_key (string, optional): TODO: type description here.
                Example: 

        Returns:
            GetInvoiceResponse: Response from the API. 

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """

        # Prepare query URL
        _url_path = '/subscriptions/{subscription_id}/cycles/{cycle_id}/pay'
        _url_path = APIHelper.append_url_with_template_parameters(
            _url_path, {
                'subscription_id': subscription_id,
                'cycle_id': cycle_id
            })
        _query_builder = Configuration.base_uri
        _query_builder += _url_path
        _query_url = APIHelper.clean_url(_query_builder)

        # Prepare headers
        _headers = {
            'accept': 'application/json',
            'content-type': 'application/json; charset=utf-8',
            'idempotency-key': idempotency_key
        }

        # Prepare and execute request
        _request = self.http_client.post(
            _query_url,
            headers=_headers,
            parameters=APIHelper.json_serialize(request))
        BasicAuth.apply(_request)
        _context = self.execute_request(_request)
        self.validate_response(_context)

        # Return appropriate type
        return APIHelper.json_deserialize(_context.response.raw_body,
                                          GetInvoiceResponse.from_dictionary)
예제 #4
0
    def update_plan_item(self,
                         plan_id,
                         plan_item_id,
                         body,
                         idempotency_key=None):
        """Does a PUT request to /plans/{plan_id}/items/{plan_item_id}.

        Updates a plan item

        Args:
            plan_id (string): Plan id
            plan_item_id (string): Plan item id
            body (UpdatePlanItemRequest): Request for updating the plan item
            idempotency_key (string, optional): TODO: type description here.
                Example: 

        Returns:
            GetPlanItemResponse: Response from the API. 

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """

        # Prepare query URL
        _url_path = '/plans/{plan_id}/items/{plan_item_id}'
        _url_path = APIHelper.append_url_with_template_parameters(
            _url_path, {
                'plan_id': plan_id,
                'plan_item_id': plan_item_id
            })
        _query_builder = Configuration.base_uri
        _query_builder += _url_path
        _query_url = APIHelper.clean_url(_query_builder)

        # Prepare headers
        _headers = {
            'accept': 'application/json',
            'content-type': 'application/json; charset=utf-8',
            'idempotency-key': idempotency_key
        }

        # Prepare and execute request
        _request = self.http_client.put(
            _query_url,
            headers=_headers,
            parameters=APIHelper.json_serialize(body))
        BasicAuth.apply(_request)
        _context = self.execute_request(_request)
        self.validate_response(_context)

        # Return appropriate type
        return APIHelper.json_deserialize(_context.response.raw_body,
                                          GetPlanItemResponse.from_dictionary)
    def get_charges_summary(self,
                            status,
                            created_since=None,
                            created_until=None):
        """Does a GET request to /charges/summary.

        TODO: type endpoint description here.

        Args:
            status (string): TODO: type description here. Example: 
            created_since (datetime, optional): TODO: type description here.
                Example: 
            created_until (datetime, optional): TODO: type description here.
                Example: 

        Returns:
            GetChargesSummaryResponse: Response from the API. 

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """

        # Prepare query URL
        _url_path = '/charges/summary'
        _query_builder = Configuration.base_uri
        _query_builder += _url_path
        _query_parameters = {
            'status':
            status,
            'created_since':
            APIHelper.when_defined(APIHelper.RFC3339DateTime, created_since),
            'created_until':
            APIHelper.when_defined(APIHelper.RFC3339DateTime, created_until)
        }
        _query_builder = APIHelper.append_url_with_query_parameters(
            _query_builder, _query_parameters,
            Configuration.array_serialization)
        _query_url = APIHelper.clean_url(_query_builder)

        # Prepare headers
        _headers = {'accept': 'application/json'}

        # Prepare and execute request
        _request = self.http_client.get(_query_url, headers=_headers)
        BasicAuth.apply(_request)
        _context = self.execute_request(_request)
        self.validate_response(_context)

        # Return appropriate type
        return APIHelper.json_deserialize(
            _context.response.raw_body,
            GetChargesSummaryResponse.from_dictionary)
    def update_charge_payment_method(self,
                                     charge_id,
                                     request,
                                     idempotency_key=None):
        """Does a PATCH request to /charges/{charge_id}/payment-method.

        Updates a charge's payment method

        Args:
            charge_id (string): Charge id
            request (UpdateChargePaymentMethodRequest): Request for updating
                the payment method from a charge
            idempotency_key (string, optional): TODO: type description here.
                Example: 

        Returns:
            GetChargeResponse: Response from the API. 

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """

        # Prepare query URL
        _url_path = '/charges/{charge_id}/payment-method'
        _url_path = APIHelper.append_url_with_template_parameters(
            _url_path, {'charge_id': charge_id})
        _query_builder = Configuration.base_uri
        _query_builder += _url_path
        _query_url = APIHelper.clean_url(_query_builder)

        # Prepare headers
        _headers = {
            'accept': 'application/json',
            'content-type': 'application/json; charset=utf-8',
            'idempotency-key': idempotency_key
        }

        # Prepare and execute request
        _request = self.http_client.patch(
            _query_url,
            headers=_headers,
            parameters=APIHelper.json_serialize(request))
        BasicAuth.apply(_request)
        _context = self.execute_request(_request)
        self.validate_response(_context)

        # Return appropriate type
        return APIHelper.json_deserialize(_context.response.raw_body,
                                          GetChargeResponse.from_dictionary)
예제 #7
0
    def update_recipient_transfer_settings(self,
                                           recipient_id,
                                           request,
                                           idempotency_key=None):
        """Does a PATCH request to /recipients/{recipient_id}/transfer-settings.

        TODO: type endpoint description here.

        Args:
            recipient_id (string): Recipient Identificator
            request (UpdateTransferSettingsRequest): TODO: type description
                here. Example: 
            idempotency_key (string, optional): TODO: type description here.
                Example: 

        Returns:
            GetRecipientResponse: Response from the API. 

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """

        # Prepare query URL
        _url_path = '/recipients/{recipient_id}/transfer-settings'
        _url_path = APIHelper.append_url_with_template_parameters(
            _url_path, {'recipient_id': recipient_id})
        _query_builder = Configuration.base_uri
        _query_builder += _url_path
        _query_url = APIHelper.clean_url(_query_builder)

        # Prepare headers
        _headers = {
            'accept': 'application/json',
            'content-type': 'application/json; charset=utf-8',
            'idempotency-key': idempotency_key
        }

        # Prepare and execute request
        _request = self.http_client.patch(
            _query_url,
            headers=_headers,
            parameters=APIHelper.json_serialize(request))
        BasicAuth.apply(_request)
        _context = self.execute_request(_request)
        self.validate_response(_context)

        # Return appropriate type
        return APIHelper.json_deserialize(_context.response.raw_body,
                                          GetRecipientResponse.from_dictionary)
예제 #8
0
    def get_cards(self,
                  customer_id,
                  page=None,
                  size=None):
        """Does a GET request to /customers/{customer_id}/cards.

        Get all cards from a customer

        Args:
            customer_id (string): Customer Id
            page (int, optional): Page number
            size (int, optional): Page size

        Returns:
            ListCardsResponse: Response from the API. 

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """

        # Prepare query URL
        _url_path = '/customers/{customer_id}/cards'
        _url_path = APIHelper.append_url_with_template_parameters(_url_path, { 
            'customer_id': customer_id
        })
        _query_builder = Configuration.base_uri
        _query_builder += _url_path
        _query_parameters = {
            'page': page,
            'size': size
        }
        _query_builder = APIHelper.append_url_with_query_parameters(_query_builder,
            _query_parameters, Configuration.array_serialization)
        _query_url = APIHelper.clean_url(_query_builder)

        # Prepare headers
        _headers = {
            'accept': 'application/json'
        }

        # Prepare and execute request
        _request = self.http_client.get(_query_url, headers=_headers)
        BasicAuth.apply(_request)
        _context = self.execute_request(_request)
        self.validate_response(_context)

        # Return appropriate type
        return APIHelper.json_deserialize(_context.response.raw_body, ListCardsResponse.from_dictionary)
    def get_anticipation_limits(self,
                                recipient_id,
                                timeframe,
                                payment_date):
        """Does a GET request to /recipients/{recipient_id}/anticipation_limits.

        Gets the anticipation limits for a recipient

        Args:
            recipient_id (string): Recipient id
            timeframe (string): Timeframe
            payment_date (datetime): Anticipation payment date

        Returns:
            GetAnticipationLimitResponse: Response from the API. 

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """

        # Prepare query URL
        _url_path = '/recipients/{recipient_id}/anticipation_limits'
        _url_path = APIHelper.append_url_with_template_parameters(_url_path, { 
            'recipient_id': recipient_id
        })
        _query_builder = Configuration.base_uri
        _query_builder += _url_path
        _query_parameters = {
            'timeframe': timeframe,
            'payment_date': APIHelper.when_defined(APIHelper.RFC3339DateTime, payment_date)
        }
        _query_builder = APIHelper.append_url_with_query_parameters(_query_builder,
            _query_parameters, Configuration.array_serialization)
        _query_url = APIHelper.clean_url(_query_builder)

        # Prepare headers
        _headers = {
            'accept': 'application/json'
        }

        # Prepare and execute request
        _request = self.http_client.get(_query_url, headers=_headers)
        BasicAuth.apply(_request)
        _context = self.execute_request(_request)
        self.validate_response(_context)

        # Return appropriate type
        return APIHelper.json_deserialize(_context.response.raw_body, GetAnticipationLimitResponse.from_dictionary)
예제 #10
0
    def renew_card(self,
                   customer_id,
                   card_id,
                   idempotency_key=None):
        """Does a POST request to /customers/{customer_id}/cards/{card_id}/renew.

        Renew a card

        Args:
            customer_id (string): Customer id
            card_id (string): Card Id
            idempotency_key (string, optional): TODO: type description here.
                Example: 

        Returns:
            GetCardResponse: Response from the API. 

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """

        # Prepare query URL
        _url_path = '/customers/{customer_id}/cards/{card_id}/renew'
        _url_path = APIHelper.append_url_with_template_parameters(_url_path, { 
            'customer_id': customer_id,
            'card_id': card_id
        })
        _query_builder = Configuration.base_uri
        _query_builder += _url_path
        _query_url = APIHelper.clean_url(_query_builder)

        # Prepare headers
        _headers = {
            'accept': 'application/json',
            'idempotency-key': idempotency_key
        }

        # Prepare and execute request
        _request = self.http_client.post(_query_url, headers=_headers)
        BasicAuth.apply(_request)
        _context = self.execute_request(_request)
        self.validate_response(_context)

        # Return appropriate type
        return APIHelper.json_deserialize(_context.response.raw_body, GetCardResponse.from_dictionary)
예제 #11
0
    def delete_order_item(self, order_id, item_id, idempotency_key=None):
        """Does a DELETE request to /orders/{orderId}/items/{itemId}.

        TODO: type endpoint description here.

        Args:
            order_id (string): Order Id
            item_id (string): Item Id
            idempotency_key (string, optional): TODO: type description here.
                Example: 

        Returns:
            GetOrderItemResponse: Response from the API. 

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """

        # Prepare query URL
        _url_path = '/orders/{orderId}/items/{itemId}'
        _url_path = APIHelper.append_url_with_template_parameters(
            _url_path, {
                'orderId': order_id,
                'itemId': item_id
            })
        _query_builder = Configuration.base_uri
        _query_builder += _url_path
        _query_url = APIHelper.clean_url(_query_builder)

        # Prepare headers
        _headers = {
            'accept': 'application/json',
            'idempotency-key': idempotency_key
        }

        # Prepare and execute request
        _request = self.http_client.delete(_query_url, headers=_headers)
        BasicAuth.apply(_request)
        _context = self.execute_request(_request)
        self.validate_response(_context)

        # Return appropriate type
        return APIHelper.json_deserialize(_context.response.raw_body,
                                          GetOrderItemResponse.from_dictionary)
    def create_charge(self, request, idempotency_key=None):
        """Does a POST request to /Charges.

        Creates a new charge

        Args:
            request (CreateChargeRequest): Request for creating a charge
            idempotency_key (string, optional): TODO: type description here.
                Example: 

        Returns:
            GetChargeResponse: Response from the API. 

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """

        # Prepare query URL
        _url_path = '/Charges'
        _query_builder = Configuration.base_uri
        _query_builder += _url_path
        _query_url = APIHelper.clean_url(_query_builder)

        # Prepare headers
        _headers = {
            'accept': 'application/json',
            'content-type': 'application/json; charset=utf-8',
            'idempotency-key': idempotency_key
        }

        # Prepare and execute request
        _request = self.http_client.post(
            _query_url,
            headers=_headers,
            parameters=APIHelper.json_serialize(request))
        BasicAuth.apply(_request)
        _context = self.execute_request(_request)
        self.validate_response(_context)

        # Return appropriate type
        return APIHelper.json_deserialize(_context.response.raw_body,
                                          GetChargeResponse.from_dictionary)
    def get_withdraw_by_id(self,
                           recipient_id,
                           withdrawal_id):
        """Does a GET request to /recipients/{recipient_id}/withdrawals/{withdrawal_id}.

        TODO: type endpoint description here.

        Args:
            recipient_id (string): TODO: type description here. Example: 
            withdrawal_id (string): TODO: type description here. Example: 

        Returns:
            GetWithdrawResponse: Response from the API. 

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """

        # Prepare query URL
        _url_path = '/recipients/{recipient_id}/withdrawals/{withdrawal_id}'
        _url_path = APIHelper.append_url_with_template_parameters(_url_path, { 
            'recipient_id': recipient_id,
            'withdrawal_id': withdrawal_id
        })
        _query_builder = Configuration.base_uri
        _query_builder += _url_path
        _query_url = APIHelper.clean_url(_query_builder)

        # Prepare headers
        _headers = {
            'accept': 'application/json'
        }

        # Prepare and execute request
        _request = self.http_client.get(_query_url, headers=_headers)
        BasicAuth.apply(_request)
        _context = self.execute_request(_request)
        self.validate_response(_context)

        # Return appropriate type
        return APIHelper.json_deserialize(_context.response.raw_body, GetWithdrawResponse.from_dictionary)
예제 #14
0
    def get_address(self,
                    customer_id,
                    address_id):
        """Does a GET request to /customers/{customer_id}/addresses/{address_id}.

        Get a customer's address

        Args:
            customer_id (string): Customer id
            address_id (string): Address Id

        Returns:
            GetAddressResponse: Response from the API. 

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """

        # Prepare query URL
        _url_path = '/customers/{customer_id}/addresses/{address_id}'
        _url_path = APIHelper.append_url_with_template_parameters(_url_path, { 
            'customer_id': customer_id,
            'address_id': address_id
        })
        _query_builder = Configuration.base_uri
        _query_builder += _url_path
        _query_url = APIHelper.clean_url(_query_builder)

        # Prepare headers
        _headers = {
            'accept': 'application/json'
        }

        # Prepare and execute request
        _request = self.http_client.get(_query_url, headers=_headers)
        BasicAuth.apply(_request)
        _context = self.execute_request(_request)
        self.validate_response(_context)

        # Return appropriate type
        return APIHelper.json_deserialize(_context.response.raw_body, GetAddressResponse.from_dictionary)
    def create_transfer(self, request):
        """Does a POST request to /transfers/recipients.

        TODO: type endpoint description here.

        Args:
            request (CreateTransfer): TODO: type description here. Example: 

        Returns:
            GetTransfer: Response from the API. 

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """

        # Prepare query URL
        _url_path = '/transfers/recipients'
        _query_builder = Configuration.base_uri
        _query_builder += _url_path
        _query_url = APIHelper.clean_url(_query_builder)

        # Prepare headers
        _headers = {
            'accept': 'application/json',
            'content-type': 'application/json; charset=utf-8'
        }

        # Prepare and execute request
        _request = self.http_client.post(
            _query_url,
            headers=_headers,
            parameters=APIHelper.json_serialize(request))
        BasicAuth.apply(_request)
        _context = self.execute_request(_request)
        self.validate_response(_context)

        # Return appropriate type
        return APIHelper.json_deserialize(_context.response.raw_body,
                                          GetTransfer.from_dictionary)
    def get_recipient_by_code(self, code):
        """Does a GET request to /recipients/code/{code}.

        Retrieves recipient information

        Args:
            code (string): Recipient code

        Returns:
            GetRecipientResponse: Response from the API. 

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """

        # Prepare query URL
        _url_path = '/recipients/code/{code}'
        _url_path = APIHelper.append_url_with_template_parameters(
            _url_path, {'code': code})
        _query_builder = Configuration.base_uri
        _query_builder += _url_path
        _query_url = APIHelper.clean_url(_query_builder)

        # Prepare headers
        _headers = {'accept': 'application/json'}

        # Prepare and execute request
        _request = self.http_client.get(_query_url, headers=_headers)
        BasicAuth.apply(_request)
        _context = self.execute_request(_request)
        self.validate_response(_context)

        # Return appropriate type
        return APIHelper.json_deserialize(_context.response.raw_body,
                                          GetRecipientResponse.from_dictionary)
    def get_charges(self,
                    page=None,
                    size=None,
                    code=None,
                    status=None,
                    payment_method=None,
                    customer_id=None,
                    order_id=None,
                    created_since=None,
                    created_until=None):
        """Does a GET request to /charges.

        Lists all charges

        Args:
            page (int, optional): Page number
            size (int, optional): Page size
            code (string, optional): Filter for charge's code
            status (string, optional): Filter for charge's status
            payment_method (string, optional): Filter for charge's payment
                method
            customer_id (string, optional): Filter for charge's customer id
            order_id (string, optional): Filter for charge's order id
            created_since (datetime, optional): Filter for the beginning of
                the range for charge's creation
            created_until (datetime, optional): Filter for the end of the
                range for charge's creation

        Returns:
            ListChargesResponse: Response from the API. 

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """

        # Prepare query URL
        _url_path = '/charges'
        _query_builder = Configuration.base_uri
        _query_builder += _url_path
        _query_parameters = {
            'page':
            page,
            'size':
            size,
            'code':
            code,
            'status':
            status,
            'payment_method':
            payment_method,
            'customer_id':
            customer_id,
            'order_id':
            order_id,
            'created_since':
            APIHelper.when_defined(APIHelper.RFC3339DateTime, created_since),
            'created_until':
            APIHelper.when_defined(APIHelper.RFC3339DateTime, created_until)
        }
        _query_builder = APIHelper.append_url_with_query_parameters(
            _query_builder, _query_parameters,
            Configuration.array_serialization)
        _query_url = APIHelper.clean_url(_query_builder)

        # Prepare headers
        _headers = {'accept': 'application/json'}

        # Prepare and execute request
        _request = self.http_client.get(_query_url, headers=_headers)
        BasicAuth.apply(_request)
        _context = self.execute_request(_request)
        self.validate_response(_context)

        # Return appropriate type
        return APIHelper.json_deserialize(_context.response.raw_body,
                                          ListChargesResponse.from_dictionary)
예제 #18
0
    def get_plans(self,
                  page=None,
                  size=None,
                  name=None,
                  status=None,
                  billing_type=None,
                  created_since=None,
                  created_until=None):
        """Does a GET request to /plans.

        Gets all plans

        Args:
            page (int, optional): Page number
            size (int, optional): Page size
            name (string, optional): Filter for Plan's name
            status (string, optional): Filter for Plan's status
            billing_type (string, optional): Filter for plan's billing type
            created_since (datetime, optional): Filter for plan's creation
                date start range
            created_until (datetime, optional): Filter for plan's creation
                date end range

        Returns:
            ListPlansResponse: Response from the API. 

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """

        # Prepare query URL
        _url_path = '/plans'
        _query_builder = Configuration.base_uri
        _query_builder += _url_path
        _query_parameters = {
            'page':
            page,
            'size':
            size,
            'name':
            name,
            'status':
            status,
            'billing_type':
            billing_type,
            'created_since':
            APIHelper.when_defined(APIHelper.RFC3339DateTime, created_since),
            'created_until':
            APIHelper.when_defined(APIHelper.RFC3339DateTime, created_until)
        }
        _query_builder = APIHelper.append_url_with_query_parameters(
            _query_builder, _query_parameters,
            Configuration.array_serialization)
        _query_url = APIHelper.clean_url(_query_builder)

        # Prepare headers
        _headers = {'accept': 'application/json'}

        # Prepare and execute request
        _request = self.http_client.get(_query_url, headers=_headers)
        BasicAuth.apply(_request)
        _context = self.execute_request(_request)
        self.validate_response(_context)

        # Return appropriate type
        return APIHelper.json_deserialize(_context.response.raw_body,
                                          ListPlansResponse.from_dictionary)
예제 #19
0
    def get_sellers(self,
                    page=None,
                    size=None,
                    name=None,
                    document=None,
                    code=None,
                    status=None,
                    mtype=None,
                    created_since=None,
                    created_until=None):
        """Does a GET request to /sellers.

        TODO: type endpoint description here.

        Args:
            page (int, optional): Page number
            size (int, optional): Page size
            name (string, optional): TODO: type description here. Example: 
            document (string, optional): TODO: type description here. Example:
                            code (string, optional): TODO: type description here. Example: 
            status (string, optional): TODO: type description here. Example: 
            mtype (string, optional): TODO: type description here. Example: 
            created_since (datetime, optional): TODO: type description here.
                Example: 
            created_until (datetime, optional): TODO: type description here.
                Example: 

        Returns:
            ListSellerResponse: Response from the API. 

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """

        # Prepare query URL
        _url_path = '/sellers'
        _query_builder = Configuration.base_uri
        _query_builder += _url_path
        _query_parameters = {
            'page':
            page,
            'size':
            size,
            'name':
            name,
            'document':
            document,
            'code':
            code,
            'status':
            status,
            'type':
            mtype,
            'created_Since':
            APIHelper.when_defined(APIHelper.RFC3339DateTime, created_since),
            'created_Until':
            APIHelper.when_defined(APIHelper.RFC3339DateTime, created_until)
        }
        _query_builder = APIHelper.append_url_with_query_parameters(
            _query_builder, _query_parameters,
            Configuration.array_serialization)
        _query_url = APIHelper.clean_url(_query_builder)

        # Prepare headers
        _headers = {'accept': 'application/json'}

        # Prepare and execute request
        _request = self.http_client.get(_query_url, headers=_headers)
        BasicAuth.apply(_request)
        _context = self.execute_request(_request)
        self.validate_response(_context)

        # Return appropriate type
        return APIHelper.json_deserialize(_context.response.raw_body,
                                          ListSellerResponse.from_dictionary)
예제 #20
0
    def get_anticipations(self,
                          recipient_id,
                          page=None,
                          size=None,
                          status=None,
                          timeframe=None,
                          payment_date_since=None,
                          payment_date_until=None,
                          created_since=None,
                          created_until=None):
        """Does a GET request to /recipients/{recipient_id}/anticipations.

        Retrieves a paginated list of anticipations from a recipient

        Args:
            recipient_id (string): Recipient id
            page (int, optional): Page number
            size (int, optional): Page size
            status (string, optional): Filter for anticipation status
            timeframe (string, optional): Filter for anticipation timeframe
            payment_date_since (datetime, optional): Filter for start range
                for anticipation payment date
            payment_date_until (datetime, optional): Filter for end range for
                anticipation payment date
            created_since (datetime, optional): Filter for start range for
                anticipation creation date
            created_until (datetime, optional): Filter for end range for
                anticipation creation date

        Returns:
            ListAnticipationResponse: Response from the API. 

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """

        # Prepare query URL
        _url_path = '/recipients/{recipient_id}/anticipations'
        _url_path = APIHelper.append_url_with_template_parameters(
            _url_path, {'recipient_id': recipient_id})
        _query_builder = Configuration.base_uri
        _query_builder += _url_path
        _query_parameters = {
            'page':
            page,
            'size':
            size,
            'status':
            status,
            'timeframe':
            timeframe,
            'payment_date_since':
            APIHelper.when_defined(APIHelper.RFC3339DateTime,
                                   payment_date_since),
            'payment_date_until':
            APIHelper.when_defined(APIHelper.RFC3339DateTime,
                                   payment_date_until),
            'created_since':
            APIHelper.when_defined(APIHelper.RFC3339DateTime, created_since),
            'created_until':
            APIHelper.when_defined(APIHelper.RFC3339DateTime, created_until)
        }
        _query_builder = APIHelper.append_url_with_query_parameters(
            _query_builder, _query_parameters,
            Configuration.array_serialization)
        _query_url = APIHelper.clean_url(_query_builder)

        # Prepare headers
        _headers = {'accept': 'application/json'}

        # Prepare and execute request
        _request = self.http_client.get(_query_url, headers=_headers)
        BasicAuth.apply(_request)
        _context = self.execute_request(_request)
        self.validate_response(_context)

        # Return appropriate type
        return APIHelper.json_deserialize(
            _context.response.raw_body,
            ListAnticipationResponse.from_dictionary)