diff --git a/README.md b/README.md index d266a37..0dfb9c6 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,7 @@ To run the file within your test project, right click on your Python file inside ## Initialize the API Client -**_Note:_** Documentation for the client can be found [here.](https://www.github.com/pagarme/pagarme-python-sdk/tree/6.8.9/doc/client.md) +**_Note:_** Documentation for the client can be found [here.](https://www.github.com/pagarme/pagarme-python-sdk/tree/6.8.10/doc/client.md) The following parameters are configurable for the API Client: @@ -85,7 +85,7 @@ The following parameters are configurable for the API Client: | `backoff_factor` | `float` | A backoff factor to apply between attempts after the second try.
**Default: 2** | | `retry_statuses` | `Array of int` | The http statuses on which retry is to be done.
**Default: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524]** | | `retry_methods` | `Array of string` | The http methods on which retry is to be done.
**Default: ['GET', 'PUT']** | -| `basic_auth_credentials` | [`BasicAuthCredentials`](https://www.github.com/pagarme/pagarme-python-sdk/tree/6.8.9/doc/$a/https://www.github.com/pagarme/pagarme-python-sdk/tree/6.8.9/basic-authentication.md) | The credential object for Basic Authentication | +| `basic_auth_credentials` | [`BasicAuthCredentials`](https://www.github.com/pagarme/pagarme-python-sdk/tree/6.8.10/doc/$a/https://www.github.com/pagarme/pagarme-python-sdk/tree/6.8.10/basic-authentication.md) | The credential object for Basic Authentication | The API client can be initialized as follows: @@ -104,7 +104,7 @@ client = PagarmeapisdkClient( This API uses the following authentication schemes. -* [`httpBasic (Basic Authentication)`](https://www.github.com/pagarme/pagarme-python-sdk/tree/6.8.9/doc/$a/https://www.github.com/pagarme/pagarme-python-sdk/tree/6.8.9/basic-authentication.md) +* [`httpBasic (Basic Authentication)`](https://www.github.com/pagarme/pagarme-python-sdk/tree/6.8.10/doc/$a/https://www.github.com/pagarme/pagarme-python-sdk/tree/6.8.10/basic-authentication.md) ## API Errors @@ -112,31 +112,31 @@ Here is the list of errors that the API might throw. | HTTP Status Code | Error Description | Exception Class | | --- | --- | --- | -| 400 | Invalid request | [`ErrorException`](https://www.github.com/pagarme/pagarme-python-sdk/tree/6.8.9/doc/models/error-exception.md) | -| 401 | Invalid API key | [`ErrorException`](https://www.github.com/pagarme/pagarme-python-sdk/tree/6.8.9/doc/models/error-exception.md) | -| 404 | An informed resource was not found | [`ErrorException`](https://www.github.com/pagarme/pagarme-python-sdk/tree/6.8.9/doc/models/error-exception.md) | -| 412 | Business validation error | [`ErrorException`](https://www.github.com/pagarme/pagarme-python-sdk/tree/6.8.9/doc/models/error-exception.md) | -| 422 | Contract validation error | [`ErrorException`](https://www.github.com/pagarme/pagarme-python-sdk/tree/6.8.9/doc/models/error-exception.md) | -| 500 | Internal server error | [`ErrorException`](https://www.github.com/pagarme/pagarme-python-sdk/tree/6.8.9/doc/models/error-exception.md) | +| 400 | Invalid request | [`ErrorException`](https://www.github.com/pagarme/pagarme-python-sdk/tree/6.8.10/doc/models/error-exception.md) | +| 401 | Invalid API key | [`ErrorException`](https://www.github.com/pagarme/pagarme-python-sdk/tree/6.8.10/doc/models/error-exception.md) | +| 404 | An informed resource was not found | [`ErrorException`](https://www.github.com/pagarme/pagarme-python-sdk/tree/6.8.10/doc/models/error-exception.md) | +| 412 | Business validation error | [`ErrorException`](https://www.github.com/pagarme/pagarme-python-sdk/tree/6.8.10/doc/models/error-exception.md) | +| 422 | Contract validation error | [`ErrorException`](https://www.github.com/pagarme/pagarme-python-sdk/tree/6.8.10/doc/models/error-exception.md) | +| 500 | Internal server error | [`ErrorException`](https://www.github.com/pagarme/pagarme-python-sdk/tree/6.8.10/doc/models/error-exception.md) | ## List of APIs -* [Subscriptions](https://www.github.com/pagarme/pagarme-python-sdk/tree/6.8.9/doc/controllers/subscriptions.md) -* [Orders](https://www.github.com/pagarme/pagarme-python-sdk/tree/6.8.9/doc/controllers/orders.md) -* [Plans](https://www.github.com/pagarme/pagarme-python-sdk/tree/6.8.9/doc/controllers/plans.md) -* [Invoices](https://www.github.com/pagarme/pagarme-python-sdk/tree/6.8.9/doc/controllers/invoices.md) -* [Customers](https://www.github.com/pagarme/pagarme-python-sdk/tree/6.8.9/doc/controllers/customers.md) -* [Charges](https://www.github.com/pagarme/pagarme-python-sdk/tree/6.8.9/doc/controllers/charges.md) -* [Recipients](https://www.github.com/pagarme/pagarme-python-sdk/tree/6.8.9/doc/controllers/recipients.md) -* [Tokens](https://www.github.com/pagarme/pagarme-python-sdk/tree/6.8.9/doc/controllers/tokens.md) -* [Transactions](https://www.github.com/pagarme/pagarme-python-sdk/tree/6.8.9/doc/controllers/transactions.md) -* [Transfers](https://www.github.com/pagarme/pagarme-python-sdk/tree/6.8.9/doc/controllers/transfers.md) -* [Payables](https://www.github.com/pagarme/pagarme-python-sdk/tree/6.8.9/doc/controllers/payables.md) -* [Balance Operations](https://www.github.com/pagarme/pagarme-python-sdk/tree/6.8.9/doc/controllers/balance-operations.md) +* [Subscriptions](https://www.github.com/pagarme/pagarme-python-sdk/tree/6.8.10/doc/controllers/subscriptions.md) +* [Orders](https://www.github.com/pagarme/pagarme-python-sdk/tree/6.8.10/doc/controllers/orders.md) +* [Plans](https://www.github.com/pagarme/pagarme-python-sdk/tree/6.8.10/doc/controllers/plans.md) +* [Invoices](https://www.github.com/pagarme/pagarme-python-sdk/tree/6.8.10/doc/controllers/invoices.md) +* [Customers](https://www.github.com/pagarme/pagarme-python-sdk/tree/6.8.10/doc/controllers/customers.md) +* [Charges](https://www.github.com/pagarme/pagarme-python-sdk/tree/6.8.10/doc/controllers/charges.md) +* [Recipients](https://www.github.com/pagarme/pagarme-python-sdk/tree/6.8.10/doc/controllers/recipients.md) +* [Tokens](https://www.github.com/pagarme/pagarme-python-sdk/tree/6.8.10/doc/controllers/tokens.md) +* [Transactions](https://www.github.com/pagarme/pagarme-python-sdk/tree/6.8.10/doc/controllers/transactions.md) +* [Transfers](https://www.github.com/pagarme/pagarme-python-sdk/tree/6.8.10/doc/controllers/transfers.md) +* [Payables](https://www.github.com/pagarme/pagarme-python-sdk/tree/6.8.10/doc/controllers/payables.md) +* [Balance Operations](https://www.github.com/pagarme/pagarme-python-sdk/tree/6.8.10/doc/controllers/balance-operations.md) ## Classes Documentation -* [Utility Classes](https://www.github.com/pagarme/pagarme-python-sdk/tree/6.8.9/doc/utility-classes.md) -* [HttpResponse](https://www.github.com/pagarme/pagarme-python-sdk/tree/6.8.9/doc/http-response.md) -* [HttpRequest](https://www.github.com/pagarme/pagarme-python-sdk/tree/6.8.9/doc/http-request.md) +* [Utility Classes](https://www.github.com/pagarme/pagarme-python-sdk/tree/6.8.10/doc/utility-classes.md) +* [HttpResponse](https://www.github.com/pagarme/pagarme-python-sdk/tree/6.8.10/doc/http-response.md) +* [HttpRequest](https://www.github.com/pagarme/pagarme-python-sdk/tree/6.8.10/doc/http-request.md) diff --git a/doc/controllers/balance-operations.md b/doc/controllers/balance-operations.md index d152cef..ce9bd44 100644 --- a/doc/controllers/balance-operations.md +++ b/doc/controllers/balance-operations.md @@ -10,64 +10,64 @@ balance_operations_controller = client.balance_operations ## Methods -* [Get Balance Operations](../../doc/controllers/balance-operations.md#get-balance-operations) -* [Get Balance Operation by Id](../../doc/controllers/balance-operations.md#get-balance-operation-by-id) +* [Get Balance Operation by Id](../../doc/controllers/balance-operations.md#get-balance-operation-by-id) +* [Get Balance Operations](../../doc/controllers/balance-operations.md#get-balance-operations) -# Get Balance Operations +# Get Balance Operation by Id ```python -def get_balance_operations(self, - status=None, - created_since=None, - created_until=None, - recipient_id=None) +def get_balance_operation_by_id(self, + id) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `status` | `str` | Query, Optional | - | -| `created_since` | `datetime` | Query, Optional | - | -| `created_until` | `datetime` | Query, Optional | - | -| `recipient_id` | `str` | Query, Optional | - | +| `id` | `long\|int` | Template, Required | - | ## Response Type -[`ListBalanceOperationResponse`](../../doc/models/list-balance-operation-response.md) +[`GetBalanceOperationResponse`](../../doc/models/get-balance-operation-response.md) ## Example Usage ```python -result = balance_operations_controller.get_balance_operations() +id = 112 + +result = balance_operations_controller.get_balance_operation_by_id(id) print(result) ``` -# Get Balance Operation by Id +# Get Balance Operations ```python -def get_balance_operation_by_id(self, - id) +def get_balance_operations(self, + status=None, + created_since=None, + created_until=None, + recipient_id=None) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `id` | `long\|int` | Template, Required | - | +| `status` | `str` | Query, Optional | - | +| `created_since` | `datetime` | Query, Optional | - | +| `created_until` | `datetime` | Query, Optional | - | +| `recipient_id` | `str` | Query, Optional | - | ## Response Type -[`GetBalanceOperationResponse`](../../doc/models/get-balance-operation-response.md) +[`ListBalanceOperationResponse`](../../doc/models/list-balance-operation-response.md) ## Example Usage ```python -id = 112 - -result = balance_operations_controller.get_balance_operation_by_id(id) +result = balance_operations_controller.get_balance_operations() print(result) ``` diff --git a/doc/controllers/charges.md b/doc/controllers/charges.md index dbbb14c..d2b9f55 100644 --- a/doc/controllers/charges.md +++ b/doc/controllers/charges.md @@ -11,18 +11,18 @@ charges_controller = client.charges ## Methods * [Update Charge Metadata](../../doc/controllers/charges.md#update-charge-metadata) -* [Update Charge Payment Method](../../doc/controllers/charges.md#update-charge-payment-method) -* [Get Charge Transactions](../../doc/controllers/charges.md#get-charge-transactions) -* [Update Charge Due Date](../../doc/controllers/charges.md#update-charge-due-date) -* [Get Charges](../../doc/controllers/charges.md#get-charges) * [Capture Charge](../../doc/controllers/charges.md#capture-charge) -* [Update Charge Card](../../doc/controllers/charges.md#update-charge-card) * [Get Charge](../../doc/controllers/charges.md#get-charge) +* [Confirm Payment](../../doc/controllers/charges.md#confirm-payment) +* [Get Charge Transactions](../../doc/controllers/charges.md#get-charge-transactions) +* [Update Charge Card](../../doc/controllers/charges.md#update-charge-card) +* [Create Charge](../../doc/controllers/charges.md#create-charge) +* [Update Charge Payment Method](../../doc/controllers/charges.md#update-charge-payment-method) +* [Update Charge Due Date](../../doc/controllers/charges.md#update-charge-due-date) * [Get Charges Summary](../../doc/controllers/charges.md#get-charges-summary) * [Retry Charge](../../doc/controllers/charges.md#retry-charge) -* [Cancel Charge](../../doc/controllers/charges.md#cancel-charge) -* [Create Charge](../../doc/controllers/charges.md#create-charge) -* [Confirm Payment](../../doc/controllers/charges.md#confirm-payment) +* [Get Charges](../../doc/controllers/charges.md#get-charges) +* [Cancel Charge](../../doc/controllers/charges.md#cancel-charge) # Update Charge Metadata @@ -67,15 +67,15 @@ print(result) ``` -# Update Charge Payment Method +# Capture Charge -Updates a charge's payment method +Captures a charge ```python -def update_charge_payment_method(self, - charge_id, - request, - idempotency_key=None) +def capture_charge(self, + charge_id, + request=None, + idempotency_key=None) ``` ## Parameters @@ -83,7 +83,7 @@ def update_charge_payment_method(self, | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `charge_id` | `str` | Template, Required | Charge id | -| `request` | [`UpdateChargePaymentMethodRequest`](../../doc/models/update-charge-payment-method-request.md) | Body, Required | Request for updating the payment method from a charge | +| `request` | [`CreateCaptureChargeRequest`](../../doc/models/create-capture-charge-request.md) | Body, Optional | Request for capturing a charge | | `idempotency_key` | `str` | Header, Optional | - | ## Response Type @@ -95,107 +95,55 @@ def update_charge_payment_method(self, ```python charge_id = 'charge_id8' -request = UpdateChargePaymentMethodRequest( - update_subscription=False, - payment_method='payment_method4', - credit_card=CreateCreditCardPaymentRequest( - installments=1, - capture=True, - recurrency_cycle='"first" or "subsequent"' - ), - debit_card=CreateDebitCardPaymentRequest(), - boleto=CreateBoletoPaymentRequest( - retries=226, - instructions='instructions2', - billing_address=CreateAddressRequest( - street='street8', - number='number4', - zip_code='zip_code2', - neighborhood='neighborhood4', - city='city2', - state='state6', - country='country2', - complement='complement6', - line_1='line_18', - line_2='line_26' - ), - document_number='document_number6', - statement_descriptor='statement_descriptor0' - ), - voucher=CreateVoucherPaymentRequest( - recurrency_cycle='"first" or "subsequent"' - ), - cash=CreateCashPaymentRequest( - description='description0', - confirm=False - ), - bank_transfer=CreateBankTransferPaymentRequest( - bank='bank0', - retries=236 - ), - private_label=CreatePrivateLabelPaymentRequest( - installments=1, - capture=True, - recurrency_cycle='"first" or "subsequent"' - ) -) - -result = charges_controller.update_charge_payment_method( - charge_id, - request -) +result = charges_controller.capture_charge(charge_id) print(result) ``` -# Get Charge Transactions +# Get Charge + +Get a charge from its id ```python -def get_charge_transactions(self, - charge_id, - page=None, - size=None) +def get_charge(self, + charge_id) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `charge_id` | `str` | Template, Required | Charge Id | -| `page` | `int` | Query, Optional | Page number | -| `size` | `int` | Query, Optional | Page size | +| `charge_id` | `str` | Template, Required | Charge id | ## Response Type -[`ListChargeTransactionsResponse`](../../doc/models/list-charge-transactions-response.md) +[`GetChargeResponse`](../../doc/models/get-charge-response.md) ## Example Usage ```python charge_id = 'charge_id8' -result = charges_controller.get_charge_transactions(charge_id) +result = charges_controller.get_charge(charge_id) print(result) ``` -# Update Charge Due Date - -Updates the due date from a charge +# Confirm Payment ```python -def update_charge_due_date(self, - charge_id, - request, - idempotency_key=None) +def confirm_payment(self, + charge_id, + request=None, + idempotency_key=None) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `charge_id` | `str` | Template, Required | Charge Id | -| `request` | [`UpdateChargeDueDateRequest`](../../doc/models/update-charge-due-date-request.md) | Body, Required | Request for updating the due date | +| `charge_id` | `str` | Template, Required | - | +| `request` | [`CreateConfirmPaymentRequest`](../../doc/models/create-confirm-payment-request.md) | Body, Optional | Request for confirm payment | | `idempotency_key` | `str` | Header, Optional | - | ## Response Type @@ -207,68 +155,51 @@ def update_charge_due_date(self, ```python charge_id = 'charge_id8' -request = UpdateChargeDueDateRequest() - -result = charges_controller.update_charge_due_date( - charge_id, - request -) +result = charges_controller.confirm_payment(charge_id) print(result) ``` -# Get Charges - -Lists all charges +# Get Charge Transactions ```python -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) +def get_charge_transactions(self, + charge_id, + page=None, + size=None) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | +| `charge_id` | `str` | Template, Required | Charge Id | | `page` | `int` | Query, Optional | Page number | | `size` | `int` | Query, Optional | Page size | -| `code` | `str` | Query, Optional | Filter for charge's code | -| `status` | `str` | Query, Optional | Filter for charge's status | -| `payment_method` | `str` | Query, Optional | Filter for charge's payment method | -| `customer_id` | `str` | Query, Optional | Filter for charge's customer id | -| `order_id` | `str` | Query, Optional | Filter for charge's order id | -| `created_since` | `datetime` | Query, Optional | Filter for the beginning of the range for charge's creation | -| `created_until` | `datetime` | Query, Optional | Filter for the end of the range for charge's creation | ## Response Type -[`ListChargesResponse`](../../doc/models/list-charges-response.md) +[`ListChargeTransactionsResponse`](../../doc/models/list-charge-transactions-response.md) ## Example Usage ```python -result = charges_controller.get_charges() +charge_id = 'charge_id8' + +result = charges_controller.get_charge_transactions(charge_id) print(result) ``` -# Capture Charge +# Update Charge Card -Captures a charge +Updates the card from a charge ```python -def capture_charge(self, - charge_id, - request=None, - idempotency_key=None) +def update_charge_card(self, + charge_id, + request, + idempotency_key=None) ``` ## Parameters @@ -276,7 +207,7 @@ def capture_charge(self, | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `charge_id` | `str` | Template, Required | Charge id | -| `request` | [`CreateCaptureChargeRequest`](../../doc/models/create-capture-charge-request.md) | Body, Optional | Request for capturing a charge | +| `request` | [`UpdateChargeCardRequest`](../../doc/models/update-charge-card-request.md) | Body, Required | Request for updating a charge's card | | `idempotency_key` | `str` | Header, Optional | - | ## Response Type @@ -288,20 +219,69 @@ def capture_charge(self, ```python charge_id = 'charge_id8' -result = charges_controller.capture_charge(charge_id) +request = UpdateChargeCardRequest( + update_subscription=False, + card_id='card_id2', + card=CreateCardRequest( + mtype='credit' + ), + recurrence=False +) + +result = charges_controller.update_charge_card( + charge_id, + request +) print(result) ``` -# Update Charge Card +# Create Charge -Updates the card from a charge +Creates a new charge ```python -def update_charge_card(self, - charge_id, - request, - idempotency_key=None) +def create_charge(self, + request, + idempotency_key=None) +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `request` | [`CreateChargeRequest`](../../doc/models/create-charge-request.md) | Body, Required | Request for creating a charge | +| `idempotency_key` | `str` | Header, Optional | - | + +## Response Type + +[`GetChargeResponse`](../../doc/models/get-charge-response.md) + +## Example Usage + +```python +request = CreateChargeRequest( + amount=242, + payment=CreatePaymentRequest( + payment_method='payment_method4' + ), + order_id='order_id0' +) + +result = charges_controller.create_charge(request) +print(result) +``` + + +# Update Charge Payment Method + +Updates a charge's payment method + +```python +def update_charge_payment_method(self, + charge_id, + request, + idempotency_key=None) ``` ## Parameters @@ -309,7 +289,7 @@ def update_charge_card(self, | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `charge_id` | `str` | Template, Required | Charge id | -| `request` | [`UpdateChargeCardRequest`](../../doc/models/update-charge-card-request.md) | Body, Required | Request for updating a charge's card | +| `request` | [`UpdateChargePaymentMethodRequest`](../../doc/models/update-charge-payment-method-request.md) | Body, Required | Request for updating the payment method from a charge | | `idempotency_key` | `str` | Header, Optional | - | ## Response Type @@ -321,16 +301,52 @@ def update_charge_card(self, ```python charge_id = 'charge_id8' -request = UpdateChargeCardRequest( +request = UpdateChargePaymentMethodRequest( update_subscription=False, - card_id='card_id2', - card=CreateCardRequest( - mtype='credit' + payment_method='payment_method4', + credit_card=CreateCreditCardPaymentRequest( + installments=1, + capture=True, + recurrency_cycle='"first" or "subsequent"' ), - recurrence=False + debit_card=CreateDebitCardPaymentRequest(), + boleto=CreateBoletoPaymentRequest( + retries=226, + instructions='instructions2', + billing_address=CreateAddressRequest( + street='street8', + number='number4', + zip_code='zip_code2', + neighborhood='neighborhood4', + city='city2', + state='state6', + country='country2', + complement='complement6', + line_1='line_18', + line_2='line_26' + ), + document_number='document_number6', + statement_descriptor='statement_descriptor0' + ), + voucher=CreateVoucherPaymentRequest( + recurrency_cycle='"first" or "subsequent"' + ), + cash=CreateCashPaymentRequest( + description='description0', + confirm=False + ), + bank_transfer=CreateBankTransferPaymentRequest( + bank='bank0', + retries=236 + ), + private_label=CreatePrivateLabelPaymentRequest( + installments=1, + capture=True, + recurrency_cycle='"first" or "subsequent"' + ) ) -result = charges_controller.update_charge_card( +result = charges_controller.update_charge_payment_method( charge_id, request ) @@ -338,20 +354,24 @@ print(result) ``` -# Get Charge +# Update Charge Due Date -Get a charge from its id +Updates the due date from a charge ```python -def get_charge(self, - charge_id) +def update_charge_due_date(self, + charge_id, + request, + idempotency_key=None) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `charge_id` | `str` | Template, Required | Charge id | +| `charge_id` | `str` | Template, Required | Charge Id | +| `request` | [`UpdateChargeDueDateRequest`](../../doc/models/update-charge-due-date-request.md) | Body, Required | Request for updating the due date | +| `idempotency_key` | `str` | Header, Optional | - | ## Response Type @@ -362,7 +382,12 @@ def get_charge(self, ```python charge_id = 'charge_id8' -result = charges_controller.get_charge(charge_id) +request = UpdateChargeDueDateRequest() + +result = charges_controller.update_charge_due_date( + charge_id, + request +) print(result) ``` @@ -429,46 +454,57 @@ print(result) ``` -# Cancel Charge +# Get Charges -Cancel a charge +Lists all charges ```python -def cancel_charge(self, - charge_id, - request=None, - idempotency_key=None) +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) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `charge_id` | `str` | Template, Required | Charge id | -| `request` | [`CreateCancelChargeRequest`](../../doc/models/create-cancel-charge-request.md) | Body, Optional | Request for cancelling a charge | -| `idempotency_key` | `str` | Header, Optional | - | +| `page` | `int` | Query, Optional | Page number | +| `size` | `int` | Query, Optional | Page size | +| `code` | `str` | Query, Optional | Filter for charge's code | +| `status` | `str` | Query, Optional | Filter for charge's status | +| `payment_method` | `str` | Query, Optional | Filter for charge's payment method | +| `customer_id` | `str` | Query, Optional | Filter for charge's customer id | +| `order_id` | `str` | Query, Optional | Filter for charge's order id | +| `created_since` | `datetime` | Query, Optional | Filter for the beginning of the range for charge's creation | +| `created_until` | `datetime` | Query, Optional | Filter for the end of the range for charge's creation | ## Response Type -[`GetChargeResponse`](../../doc/models/get-charge-response.md) +[`ListChargesResponse`](../../doc/models/list-charges-response.md) ## Example Usage ```python -charge_id = 'charge_id8' - -result = charges_controller.cancel_charge(charge_id) +result = charges_controller.get_charges() print(result) ``` -# Create Charge +# Cancel Charge -Creates a new charge +Cancel a charge ```python -def create_charge(self, - request, +def cancel_charge(self, + charge_id, + request=None, idempotency_key=None) ``` @@ -476,44 +512,8 @@ def create_charge(self, | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `request` | [`CreateChargeRequest`](../../doc/models/create-charge-request.md) | Body, Required | Request for creating a charge | -| `idempotency_key` | `str` | Header, Optional | - | - -## Response Type - -[`GetChargeResponse`](../../doc/models/get-charge-response.md) - -## Example Usage - -```python -request = CreateChargeRequest( - amount=242, - payment=CreatePaymentRequest( - payment_method='payment_method4' - ), - order_id='order_id0' -) - -result = charges_controller.create_charge(request) -print(result) -``` - - -# Confirm Payment - -```python -def confirm_payment(self, - charge_id, - request=None, - idempotency_key=None) -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `charge_id` | `str` | Template, Required | - | -| `request` | [`CreateConfirmPaymentRequest`](../../doc/models/create-confirm-payment-request.md) | Body, Optional | Request for confirm payment | +| `charge_id` | `str` | Template, Required | Charge id | +| `request` | [`CreateCancelChargeRequest`](../../doc/models/create-cancel-charge-request.md) | Body, Optional | Request for cancelling a charge | | `idempotency_key` | `str` | Header, Optional | - | ## Response Type @@ -525,7 +525,7 @@ def confirm_payment(self, ```python charge_id = 'charge_id8' -result = charges_controller.confirm_payment(charge_id) +result = charges_controller.cancel_charge(charge_id) print(result) ``` diff --git a/doc/controllers/customers.md b/doc/controllers/customers.md index 9bba072..e1fe97e 100644 --- a/doc/controllers/customers.md +++ b/doc/controllers/customers.md @@ -10,27 +10,76 @@ customers_controller = client.customers ## Methods +* [Create Address](../../doc/controllers/customers.md#create-address) * [Update Card](../../doc/controllers/customers.md#update-card) -* [Update Address](../../doc/controllers/customers.md#update-address) * [Delete Access Token](../../doc/controllers/customers.md#delete-access-token) * [Create Customer](../../doc/controllers/customers.md#create-customer) -* [Create Address](../../doc/controllers/customers.md#create-address) * [Delete Access Tokens](../../doc/controllers/customers.md#delete-access-tokens) +* [Update Address](../../doc/controllers/customers.md#update-address) * [Get Address](../../doc/controllers/customers.md#get-address) * [Delete Address](../../doc/controllers/customers.md#delete-address) -* [Create Card](../../doc/controllers/customers.md#create-card) * [Get Customers](../../doc/controllers/customers.md#get-customers) +* [Get Access Tokens](../../doc/controllers/customers.md#get-access-tokens) +* [Delete Card](../../doc/controllers/customers.md#delete-card) +* [Get Card](../../doc/controllers/customers.md#get-card) +* [Create Card](../../doc/controllers/customers.md#create-card) +* [Get Access Token](../../doc/controllers/customers.md#get-access-token) +* [Get Addresses](../../doc/controllers/customers.md#get-addresses) * [Update Customer](../../doc/controllers/customers.md#update-customer) * [Create Access Token](../../doc/controllers/customers.md#create-access-token) -* [Get Access Tokens](../../doc/controllers/customers.md#get-access-tokens) * [Get Cards](../../doc/controllers/customers.md#get-cards) * [Renew Card](../../doc/controllers/customers.md#renew-card) -* [Get Access Token](../../doc/controllers/customers.md#get-access-token) * [Update Customer Metadata](../../doc/controllers/customers.md#update-customer-metadata) -* [Delete Card](../../doc/controllers/customers.md#delete-card) -* [Get Addresses](../../doc/controllers/customers.md#get-addresses) -* [Get Customer](../../doc/controllers/customers.md#get-customer) -* [Get Card](../../doc/controllers/customers.md#get-card) +* [Get Customer](../../doc/controllers/customers.md#get-customer) + + +# Create Address + +Creates a new address for a customer + +```python +def create_address(self, + customer_id, + request, + idempotency_key=None) +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `customer_id` | `str` | Template, Required | Customer Id | +| `request` | [`CreateAddressRequest`](../../doc/models/create-address-request.md) | Body, Required | Request for creating an address | +| `idempotency_key` | `str` | Header, Optional | - | + +## Response Type + +[`GetAddressResponse`](../../doc/models/get-address-response.md) + +## Example Usage + +```python +customer_id = 'customer_id8' + +request = CreateAddressRequest( + street='street6', + number='number4', + zip_code='zip_code0', + neighborhood='neighborhood2', + city='city6', + state='state2', + country='country0', + complement='complement2', + line_1='line_10', + line_2='line_24' +) + +result = customers_controller.create_address( + customer_id, + request +) +print(result) +``` # Update Card @@ -96,56 +145,6 @@ print(result) ``` -# Update Address - -Updates an address - -```python -def update_address(self, - customer_id, - address_id, - request, - idempotency_key=None) -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `customer_id` | `str` | Template, Required | Customer Id | -| `address_id` | `str` | Template, Required | Address Id | -| `request` | [`UpdateAddressRequest`](../../doc/models/update-address-request.md) | Body, Required | Request for updating an address | -| `idempotency_key` | `str` | Header, Optional | - | - -## Response Type - -[`GetAddressResponse`](../../doc/models/get-address-response.md) - -## Example Usage - -```python -customer_id = 'customer_id8' - -address_id = 'address_id0' - -request = UpdateAddressRequest( - number='number4', - complement='complement2', - metadata={ - 'key0': 'metadata3' - }, - line_2='line_24' -) - -result = customers_controller.update_address( - customer_id, - address_id, - request -) -print(result) -``` - - # Delete Access Token Delete a customer's access token @@ -237,15 +236,13 @@ print(result) ``` -# Create Address +# Delete Access Tokens -Creates a new address for a customer +Delete a Customer's access tokens ```python -def create_address(self, - customer_id, - request, - idempotency_key=None) +def delete_access_tokens(self, + customer_id) ``` ## Parameters @@ -253,46 +250,31 @@ def create_address(self, | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `customer_id` | `str` | Template, Required | Customer Id | -| `request` | [`CreateAddressRequest`](../../doc/models/create-address-request.md) | Body, Required | Request for creating an address | -| `idempotency_key` | `str` | Header, Optional | - | ## Response Type -[`GetAddressResponse`](../../doc/models/get-address-response.md) +[`ListAccessTokensResponse`](../../doc/models/list-access-tokens-response.md) ## Example Usage ```python customer_id = 'customer_id8' -request = CreateAddressRequest( - street='street6', - number='number4', - zip_code='zip_code0', - neighborhood='neighborhood2', - city='city6', - state='state2', - country='country0', - complement='complement2', - line_1='line_10', - line_2='line_24' -) - -result = customers_controller.create_address( - customer_id, - request -) +result = customers_controller.delete_access_tokens(customer_id) print(result) ``` -# Delete Access Tokens +# Update Address -Delete a Customer's access tokens +Updates an address ```python -def delete_access_tokens(self, - customer_id) +def update_address(self, + customer_id, + address_id, + request, + idempotency_key=None) ``` ## Parameters @@ -300,17 +282,35 @@ def delete_access_tokens(self, | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `customer_id` | `str` | Template, Required | Customer Id | +| `address_id` | `str` | Template, Required | Address Id | +| `request` | [`UpdateAddressRequest`](../../doc/models/update-address-request.md) | Body, Required | Request for updating an address | +| `idempotency_key` | `str` | Header, Optional | - | ## Response Type -[`ListAccessTokensResponse`](../../doc/models/list-access-tokens-response.md) +[`GetAddressResponse`](../../doc/models/get-address-response.md) ## Example Usage ```python customer_id = 'customer_id8' -result = customers_controller.delete_access_tokens(customer_id) +address_id = 'address_id0' + +request = UpdateAddressRequest( + number='number4', + complement='complement2', + metadata={ + 'key0': 'metadata3' + }, + line_2='line_24' +) + +result = customers_controller.update_address( + customer_id, + address_id, + request +) print(result) ``` @@ -389,46 +389,6 @@ print(result) ``` -# Create Card - -Creates a new card for a customer - -```python -def create_card(self, - customer_id, - request, - idempotency_key=None) -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `customer_id` | `str` | Template, Required | Customer id | -| `request` | [`CreateCardRequest`](../../doc/models/create-card-request.md) | Body, Required | Request for creating a card | -| `idempotency_key` | `str` | Header, Optional | - | - -## Response Type - -[`GetCardResponse`](../../doc/models/get-card-response.md) - -## Example Usage - -```python -customer_id = 'customer_id8' - -request = CreateCardRequest( - mtype='credit' -) - -result = customers_controller.create_card( - customer_id, - request -) -print(result) -``` - - # Get Customers Get all Customers @@ -473,239 +433,239 @@ print(result) ``` -# Update Customer +# Get Access Tokens -Updates a customer +Get all access tokens from a customer ```python -def update_customer(self, - customer_id, - request, - idempotency_key=None) +def get_access_tokens(self, + customer_id, + page=None, + size=None) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `customer_id` | `str` | Template, Required | Customer id | -| `request` | [`UpdateCustomerRequest`](../../doc/models/update-customer-request.md) | Body, Required | Request for updating a customer | -| `idempotency_key` | `str` | Header, Optional | - | +| `customer_id` | `str` | Template, Required | Customer Id | +| `page` | `int` | Query, Optional | Page number | +| `size` | `int` | Query, Optional | Page size | ## Response Type -[`GetCustomerResponse`](../../doc/models/get-customer-response.md) +[`ListAccessTokensResponse`](../../doc/models/list-access-tokens-response.md) ## Example Usage ```python customer_id = 'customer_id8' -request = UpdateCustomerRequest() - -result = customers_controller.update_customer( - customer_id, - request -) +result = customers_controller.get_access_tokens(customer_id) print(result) ``` -# Create Access Token +# Delete Card -Creates a access token for a customer +Delete a customer's card ```python -def create_access_token(self, - customer_id, - request, - idempotency_key=None) -``` - -## Parameters +def delete_card(self, + customer_id, + card_id, + idempotency_key=None) +``` + +## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `customer_id` | `str` | Template, Required | Customer Id | -| `request` | [`CreateAccessTokenRequest`](../../doc/models/create-access-token-request.md) | Body, Required | Request for creating a access token | +| `card_id` | `str` | Template, Required | Card Id | | `idempotency_key` | `str` | Header, Optional | - | ## Response Type -[`GetAccessTokenResponse`](../../doc/models/get-access-token-response.md) +[`GetCardResponse`](../../doc/models/get-card-response.md) ## Example Usage ```python customer_id = 'customer_id8' -request = CreateAccessTokenRequest() +card_id = 'card_id4' -result = customers_controller.create_access_token( +result = customers_controller.delete_card( customer_id, - request + card_id ) print(result) ``` -# Get Access Tokens +# Get Card -Get all access tokens from a customer +Get a customer's card ```python -def get_access_tokens(self, - customer_id, - page=None, - size=None) +def get_card(self, + customer_id, + card_id) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `customer_id` | `str` | Template, Required | Customer Id | -| `page` | `int` | Query, Optional | Page number | -| `size` | `int` | Query, Optional | Page size | +| `customer_id` | `str` | Template, Required | Customer id | +| `card_id` | `str` | Template, Required | Card id | ## Response Type -[`ListAccessTokensResponse`](../../doc/models/list-access-tokens-response.md) +[`GetCardResponse`](../../doc/models/get-card-response.md) ## Example Usage ```python customer_id = 'customer_id8' -result = customers_controller.get_access_tokens(customer_id) +card_id = 'card_id4' + +result = customers_controller.get_card( + customer_id, + card_id +) print(result) ``` -# Get Cards +# Create Card -Get all cards from a customer +Creates a new card for a customer ```python -def get_cards(self, - customer_id, - page=None, - size=None) +def create_card(self, + customer_id, + request, + idempotency_key=None) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `customer_id` | `str` | Template, Required | Customer Id | -| `page` | `int` | Query, Optional | Page number | -| `size` | `int` | Query, Optional | Page size | +| `customer_id` | `str` | Template, Required | Customer id | +| `request` | [`CreateCardRequest`](../../doc/models/create-card-request.md) | Body, Required | Request for creating a card | +| `idempotency_key` | `str` | Header, Optional | - | ## Response Type -[`ListCardsResponse`](../../doc/models/list-cards-response.md) +[`GetCardResponse`](../../doc/models/get-card-response.md) ## Example Usage ```python customer_id = 'customer_id8' -result = customers_controller.get_cards(customer_id) +request = CreateCardRequest( + mtype='credit' +) + +result = customers_controller.create_card( + customer_id, + request +) print(result) ``` -# Renew Card +# Get Access Token -Renew a card +Get a Customer's access token ```python -def renew_card(self, - customer_id, - card_id, - idempotency_key=None) +def get_access_token(self, + customer_id, + token_id) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `customer_id` | `str` | Template, Required | Customer id | -| `card_id` | `str` | Template, Required | Card Id | -| `idempotency_key` | `str` | Header, Optional | - | +| `customer_id` | `str` | Template, Required | Customer Id | +| `token_id` | `str` | Template, Required | Token Id | ## Response Type -[`GetCardResponse`](../../doc/models/get-card-response.md) +[`GetAccessTokenResponse`](../../doc/models/get-access-token-response.md) ## Example Usage ```python customer_id = 'customer_id8' -card_id = 'card_id4' +token_id = 'token_id6' -result = customers_controller.renew_card( +result = customers_controller.get_access_token( customer_id, - card_id + token_id ) print(result) ``` -# Get Access Token +# Get Addresses -Get a Customer's access token +Gets all adressess from a customer ```python -def get_access_token(self, - customer_id, - token_id) +def get_addresses(self, + customer_id, + page=None, + size=None) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `customer_id` | `str` | Template, Required | Customer Id | -| `token_id` | `str` | Template, Required | Token Id | +| `customer_id` | `str` | Template, Required | Customer id | +| `page` | `int` | Query, Optional | Page number | +| `size` | `int` | Query, Optional | Page size | ## Response Type -[`GetAccessTokenResponse`](../../doc/models/get-access-token-response.md) +[`ListAddressesResponse`](../../doc/models/list-addresses-response.md) ## Example Usage ```python customer_id = 'customer_id8' -token_id = 'token_id6' - -result = customers_controller.get_access_token( - customer_id, - token_id -) +result = customers_controller.get_addresses(customer_id) print(result) ``` -# Update Customer Metadata +# Update Customer -Updates the metadata a customer +Updates a customer ```python -def update_customer_metadata(self, - customer_id, - request, - idempotency_key=None) +def update_customer(self, + customer_id, + request, + idempotency_key=None) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `customer_id` | `str` | Template, Required | The customer id | -| `request` | [`UpdateMetadataRequest`](../../doc/models/update-metadata-request.md) | Body, Required | Request for updating the customer metadata | +| `customer_id` | `str` | Template, Required | Customer id | +| `request` | [`UpdateCustomerRequest`](../../doc/models/update-customer-request.md) | Body, Required | Request for updating a customer | | `idempotency_key` | `str` | Header, Optional | - | ## Response Type @@ -717,13 +677,9 @@ def update_customer_metadata(self, ```python customer_id = 'customer_id8' -request = UpdateMetadataRequest( - metadata={ - 'key0': 'metadata3' - } -) +request = UpdateCustomerRequest() -result = customers_controller.update_customer_metadata( +result = customers_controller.update_customer( customer_id, request ) @@ -731,15 +687,15 @@ print(result) ``` -# Delete Card +# Create Access Token -Delete a customer's card +Creates a access token for a customer ```python -def delete_card(self, - customer_id, - card_id, - idempotency_key=None) +def create_access_token(self, + customer_id, + request, + idempotency_key=None) ``` ## Parameters @@ -747,122 +703,166 @@ def delete_card(self, | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `customer_id` | `str` | Template, Required | Customer Id | -| `card_id` | `str` | Template, Required | Card Id | +| `request` | [`CreateAccessTokenRequest`](../../doc/models/create-access-token-request.md) | Body, Required | Request for creating a access token | | `idempotency_key` | `str` | Header, Optional | - | ## Response Type -[`GetCardResponse`](../../doc/models/get-card-response.md) +[`GetAccessTokenResponse`](../../doc/models/get-access-token-response.md) ## Example Usage ```python customer_id = 'customer_id8' -card_id = 'card_id4' +request = CreateAccessTokenRequest() -result = customers_controller.delete_card( +result = customers_controller.create_access_token( customer_id, - card_id + request ) print(result) ``` -# Get Addresses +# Get Cards -Gets all adressess from a customer +Get all cards from a customer ```python -def get_addresses(self, - customer_id, - page=None, - size=None) +def get_cards(self, + customer_id, + page=None, + size=None) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `customer_id` | `str` | Template, Required | Customer id | +| `customer_id` | `str` | Template, Required | Customer Id | | `page` | `int` | Query, Optional | Page number | | `size` | `int` | Query, Optional | Page size | ## Response Type -[`ListAddressesResponse`](../../doc/models/list-addresses-response.md) +[`ListCardsResponse`](../../doc/models/list-cards-response.md) ## Example Usage ```python customer_id = 'customer_id8' -result = customers_controller.get_addresses(customer_id) +result = customers_controller.get_cards(customer_id) print(result) ``` -# Get Customer +# Renew Card -Get a customer +Renew a card ```python -def get_customer(self, - customer_id) +def renew_card(self, + customer_id, + card_id, + idempotency_key=None) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `customer_id` | `str` | Template, Required | Customer Id | +| `customer_id` | `str` | Template, Required | Customer id | +| `card_id` | `str` | Template, Required | Card Id | +| `idempotency_key` | `str` | Header, Optional | - | ## Response Type -[`GetCustomerResponse`](../../doc/models/get-customer-response.md) +[`GetCardResponse`](../../doc/models/get-card-response.md) ## Example Usage ```python customer_id = 'customer_id8' -result = customers_controller.get_customer(customer_id) +card_id = 'card_id4' + +result = customers_controller.renew_card( + customer_id, + card_id +) print(result) ``` -# Get Card +# Update Customer Metadata -Get a customer's card +Updates the metadata a customer ```python -def get_card(self, - customer_id, - card_id) +def update_customer_metadata(self, + customer_id, + request, + idempotency_key=None) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `customer_id` | `str` | Template, Required | Customer id | -| `card_id` | `str` | Template, Required | Card id | +| `customer_id` | `str` | Template, Required | The customer id | +| `request` | [`UpdateMetadataRequest`](../../doc/models/update-metadata-request.md) | Body, Required | Request for updating the customer metadata | +| `idempotency_key` | `str` | Header, Optional | - | ## Response Type -[`GetCardResponse`](../../doc/models/get-card-response.md) +[`GetCustomerResponse`](../../doc/models/get-customer-response.md) ## Example Usage ```python customer_id = 'customer_id8' -card_id = 'card_id4' +request = UpdateMetadataRequest( + metadata={ + 'key0': 'metadata3' + } +) -result = customers_controller.get_card( +result = customers_controller.update_customer_metadata( customer_id, - card_id + request ) print(result) ``` + +# Get Customer + +Get a customer + +```python +def get_customer(self, + customer_id) +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `customer_id` | `str` | Template, Required | Customer Id | + +## Response Type + +[`GetCustomerResponse`](../../doc/models/get-customer-response.md) + +## Example Usage + +```python +customer_id = 'customer_id8' + +result = customers_controller.get_customer(customer_id) +print(result) +``` + diff --git a/doc/controllers/invoices.md b/doc/controllers/invoices.md index b235beb..21d4f56 100644 --- a/doc/controllers/invoices.md +++ b/doc/controllers/invoices.md @@ -10,69 +10,78 @@ invoices_controller = client.invoices ## Methods +* [Get Invoices](../../doc/controllers/invoices.md#get-invoices) +* [Cancel Invoice](../../doc/controllers/invoices.md#cancel-invoice) +* [Update Invoice Status](../../doc/controllers/invoices.md#update-invoice-status) * [Update Invoice Metadata](../../doc/controllers/invoices.md#update-invoice-metadata) * [Get Partial Invoice](../../doc/controllers/invoices.md#get-partial-invoice) -* [Cancel Invoice](../../doc/controllers/invoices.md#cancel-invoice) * [Create Invoice](../../doc/controllers/invoices.md#create-invoice) -* [Get Invoices](../../doc/controllers/invoices.md#get-invoices) -* [Get Invoice](../../doc/controllers/invoices.md#get-invoice) -* [Update Invoice Status](../../doc/controllers/invoices.md#update-invoice-status) +* [Get Invoice](../../doc/controllers/invoices.md#get-invoice) -# Update Invoice Metadata +# Get Invoices -Updates the metadata from an invoice +Gets all invoices ```python -def update_invoice_metadata(self, - invoice_id, - request, - idempotency_key=None) +def get_invoices(self, + page=None, + size=None, + code=None, + customer_id=None, + subscription_id=None, + created_since=None, + created_until=None, + status=None, + due_since=None, + due_until=None, + customer_document=None) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `invoice_id` | `str` | Template, Required | The invoice id | -| `request` | [`UpdateMetadataRequest`](../../doc/models/update-metadata-request.md) | Body, Required | Request for updating the invoice metadata | -| `idempotency_key` | `str` | Header, Optional | - | +| `page` | `int` | Query, Optional | Page number | +| `size` | `int` | Query, Optional | Page size | +| `code` | `str` | Query, Optional | Filter for Invoice's code | +| `customer_id` | `str` | Query, Optional | Filter for Invoice's customer id | +| `subscription_id` | `str` | Query, Optional | Filter for Invoice's subscription id | +| `created_since` | `datetime` | Query, Optional | Filter for Invoice's creation date start range | +| `created_until` | `datetime` | Query, Optional | Filter for Invoices creation date end range | +| `status` | `str` | Query, Optional | Filter for Invoice's status | +| `due_since` | `datetime` | Query, Optional | Filter for Invoice's due date start range | +| `due_until` | `datetime` | Query, Optional | Filter for Invoice's due date end range | +| `customer_document` | `str` | Query, Optional | - | ## Response Type -[`GetInvoiceResponse`](../../doc/models/get-invoice-response.md) +[`ListInvoicesResponse`](../../doc/models/list-invoices-response.md) ## Example Usage ```python -invoice_id = 'invoice_id0' - -request = UpdateMetadataRequest( - metadata={ - 'key0': 'metadata3' - } -) - -result = invoices_controller.update_invoice_metadata( - invoice_id, - request -) +result = invoices_controller.get_invoices() print(result) ``` -# Get Partial Invoice +# Cancel Invoice + +Cancels an invoice ```python -def get_partial_invoice(self, - subscription_id) +def cancel_invoice(self, + invoice_id, + idempotency_key=None) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `str` | Template, Required | Subscription Id | +| `invoice_id` | `str` | Template, Required | Invoice id | +| `idempotency_key` | `str` | Header, Optional | - | ## Response Type @@ -81,28 +90,30 @@ def get_partial_invoice(self, ## Example Usage ```python -subscription_id = 'subscription_id0' +invoice_id = 'invoice_id0' -result = invoices_controller.get_partial_invoice(subscription_id) +result = invoices_controller.cancel_invoice(invoice_id) print(result) ``` -# Cancel Invoice +# Update Invoice Status -Cancels an invoice +Updates the status from an invoice ```python -def cancel_invoice(self, - invoice_id, - idempotency_key=None) +def update_invoice_status(self, + invoice_id, + request, + idempotency_key=None) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `invoice_id` | `str` | Template, Required | Invoice id | +| `invoice_id` | `str` | Template, Required | Invoice Id | +| `request` | [`UpdateInvoiceStatusRequest`](../../doc/models/update-invoice-status-request.md) | Body, Required | Request for updating an invoice's status | | `idempotency_key` | `str` | Header, Optional | - | ## Response Type @@ -114,30 +125,35 @@ def cancel_invoice(self, ```python invoice_id = 'invoice_id0' -result = invoices_controller.cancel_invoice(invoice_id) +request = UpdateInvoiceStatusRequest( + status='status8' +) + +result = invoices_controller.update_invoice_status( + invoice_id, + request +) print(result) ``` -# Create Invoice +# Update Invoice Metadata -Create an Invoice +Updates the metadata from an invoice ```python -def create_invoice(self, - subscription_id, - cycle_id, - request=None, - idempotency_key=None) +def update_invoice_metadata(self, + invoice_id, + request, + idempotency_key=None) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `str` | Template, Required | Subscription Id | -| `cycle_id` | `str` | Template, Required | Cycle Id | -| `request` | [`CreateInvoiceRequest`](../../doc/models/create-invoice-request.md) | Body, Optional | - | +| `invoice_id` | `str` | Template, Required | The invoice id | +| `request` | [`UpdateMetadataRequest`](../../doc/models/update-metadata-request.md) | Body, Required | Request for updating the invoice metadata | | `idempotency_key` | `str` | Header, Optional | - | ## Response Type @@ -147,79 +163,69 @@ def create_invoice(self, ## Example Usage ```python -subscription_id = 'subscription_id0' +invoice_id = 'invoice_id0' -cycle_id = 'cycle_id6' +request = UpdateMetadataRequest( + metadata={ + 'key0': 'metadata3' + } +) -result = invoices_controller.create_invoice( - subscription_id, - cycle_id +result = invoices_controller.update_invoice_metadata( + invoice_id, + request ) print(result) ``` -# Get Invoices - -Gets all invoices +# Get Partial Invoice ```python -def get_invoices(self, - page=None, - size=None, - code=None, - customer_id=None, - subscription_id=None, - created_since=None, - created_until=None, - status=None, - due_since=None, - due_until=None, - customer_document=None) +def get_partial_invoice(self, + subscription_id) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `page` | `int` | Query, Optional | Page number | -| `size` | `int` | Query, Optional | Page size | -| `code` | `str` | Query, Optional | Filter for Invoice's code | -| `customer_id` | `str` | Query, Optional | Filter for Invoice's customer id | -| `subscription_id` | `str` | Query, Optional | Filter for Invoice's subscription id | -| `created_since` | `datetime` | Query, Optional | Filter for Invoice's creation date start range | -| `created_until` | `datetime` | Query, Optional | Filter for Invoices creation date end range | -| `status` | `str` | Query, Optional | Filter for Invoice's status | -| `due_since` | `datetime` | Query, Optional | Filter for Invoice's due date start range | -| `due_until` | `datetime` | Query, Optional | Filter for Invoice's due date end range | -| `customer_document` | `str` | Query, Optional | - | +| `subscription_id` | `str` | Template, Required | Subscription Id | ## Response Type -[`ListInvoicesResponse`](../../doc/models/list-invoices-response.md) +[`GetInvoiceResponse`](../../doc/models/get-invoice-response.md) ## Example Usage ```python -result = invoices_controller.get_invoices() +subscription_id = 'subscription_id0' + +result = invoices_controller.get_partial_invoice(subscription_id) print(result) ``` -# Get Invoice +# Create Invoice -Gets an invoice +Create an Invoice ```python -def get_invoice(self, - invoice_id) +def create_invoice(self, + subscription_id, + cycle_id, + request=None, + idempotency_key=None) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `invoice_id` | `str` | Template, Required | Invoice Id | +| `subscription_id` | `str` | Template, Required | Subscription Id | +| `cycle_id` | `str` | Template, Required | Cycle Id | +| `request` | [`CreateInvoiceRequest`](../../doc/models/create-invoice-request.md) | Body, Optional | - | +| `idempotency_key` | `str` | Header, Optional | - | ## Response Type @@ -228,22 +234,25 @@ def get_invoice(self, ## Example Usage ```python -invoice_id = 'invoice_id0' +subscription_id = 'subscription_id0' -result = invoices_controller.get_invoice(invoice_id) +cycle_id = 'cycle_id6' + +result = invoices_controller.create_invoice( + subscription_id, + cycle_id +) print(result) ``` -# Update Invoice Status +# Get Invoice -Updates the status from an invoice +Gets an invoice ```python -def update_invoice_status(self, - invoice_id, - request, - idempotency_key=None) +def get_invoice(self, + invoice_id) ``` ## Parameters @@ -251,8 +260,6 @@ def update_invoice_status(self, | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `invoice_id` | `str` | Template, Required | Invoice Id | -| `request` | [`UpdateInvoiceStatusRequest`](../../doc/models/update-invoice-status-request.md) | Body, Required | Request for updating an invoice's status | -| `idempotency_key` | `str` | Header, Optional | - | ## Response Type @@ -263,14 +270,7 @@ def update_invoice_status(self, ```python invoice_id = 'invoice_id0' -request = UpdateInvoiceStatusRequest( - status='status8' -) - -result = invoices_controller.update_invoice_status( - invoice_id, - request -) +result = invoices_controller.get_invoice(invoice_id) print(result) ``` diff --git a/doc/controllers/orders.md b/doc/controllers/orders.md index adfc7ac..696c0ee 100644 --- a/doc/controllers/orders.md +++ b/doc/controllers/orders.md @@ -10,65 +10,53 @@ orders_controller = client.orders ## Methods -* [Get Orders](../../doc/controllers/orders.md#get-orders) -* [Update Order Item](../../doc/controllers/orders.md#update-order-item) * [Delete All Order Items](../../doc/controllers/orders.md#delete-all-order-items) +* [Get Order Item](../../doc/controllers/orders.md#get-order-item) +* [Update Order Metadata](../../doc/controllers/orders.md#update-order-metadata) * [Delete Order Item](../../doc/controllers/orders.md#delete-order-item) +* [Get Order](../../doc/controllers/orders.md#get-order) +* [Get Orders](../../doc/controllers/orders.md#get-orders) +* [Update Order Item](../../doc/controllers/orders.md#update-order-item) * [Close Order](../../doc/controllers/orders.md#close-order) * [Create Order](../../doc/controllers/orders.md#create-order) -* [Create Order Item](../../doc/controllers/orders.md#create-order-item) -* [Get Order Item](../../doc/controllers/orders.md#get-order-item) -* [Update Order Metadata](../../doc/controllers/orders.md#update-order-metadata) -* [Get Order](../../doc/controllers/orders.md#get-order) +* [Create Order Item](../../doc/controllers/orders.md#create-order-item) -# Get Orders - -Gets all orders +# Delete All Order Items ```python -def get_orders(self, - page=None, - size=None, - code=None, - status=None, - created_since=None, - created_until=None, - customer_id=None) +def delete_all_order_items(self, + order_id, + idempotency_key=None) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `page` | `int` | Query, Optional | Page number | -| `size` | `int` | Query, Optional | Page size | -| `code` | `str` | Query, Optional | Filter for order's code | -| `status` | `str` | Query, Optional | Filter for order's status | -| `created_since` | `datetime` | Query, Optional | Filter for order's creation date start range | -| `created_until` | `datetime` | Query, Optional | Filter for order's creation date end range | -| `customer_id` | `str` | Query, Optional | Filter for order's customer id | +| `order_id` | `str` | Template, Required | Order Id | +| `idempotency_key` | `str` | Header, Optional | - | ## Response Type -[`ListOrderResponse`](../../doc/models/list-order-response.md) +[`GetOrderResponse`](../../doc/models/get-order-response.md) ## Example Usage ```python -result = orders_controller.get_orders() +order_id = 'orderId2' + +result = orders_controller.delete_all_order_items(order_id) print(result) ``` -# Update Order Item +# Get Order Item ```python -def update_order_item(self, - order_id, - item_id, - request, - idempotency_key=None) +def get_order_item(self, + order_id, + item_id) ``` ## Parameters @@ -77,8 +65,6 @@ def update_order_item(self, | --- | --- | --- | --- | | `order_id` | `str` | Template, Required | Order Id | | `item_id` | `str` | Template, Required | Item Id | -| `request` | [`UpdateOrderItemRequest`](../../doc/models/update-order-item-request.md) | Body, Required | Item Model | -| `idempotency_key` | `str` | Header, Optional | - | ## Response Type @@ -91,35 +77,31 @@ order_id = 'orderId2' item_id = 'itemId8' -request = UpdateOrderItemRequest( - amount=242, - description='description6', - quantity=100, - category='category4' -) - -result = orders_controller.update_order_item( +result = orders_controller.get_order_item( order_id, - item_id, - request + item_id ) print(result) ``` -# Delete All Order Items +# Update Order Metadata + +Updates the metadata from an order ```python -def delete_all_order_items(self, - order_id, - idempotency_key=None) +def update_order_metadata(self, + order_id, + request, + idempotency_key=None) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `order_id` | `str` | Template, Required | Order Id | +| `order_id` | `str` | Template, Required | The order id | +| `request` | [`UpdateMetadataRequest`](../../doc/models/update-metadata-request.md) | Body, Required | Request for updating the order metadata | | `idempotency_key` | `str` | Header, Optional | - | ## Response Type @@ -129,9 +111,18 @@ def delete_all_order_items(self, ## Example Usage ```python -order_id = 'orderId2' +order_id = 'order_id6' -result = orders_controller.delete_all_order_items(order_id) +request = UpdateMetadataRequest( + metadata={ + 'key0': 'metadata3' + } +) + +result = orders_controller.update_order_metadata( + order_id, + request +) print(result) ``` @@ -172,6 +163,120 @@ print(result) ``` +# Get Order + +Gets an order + +```python +def get_order(self, + order_id) +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `order_id` | `str` | Template, Required | Order id | + +## Response Type + +[`GetOrderResponse`](../../doc/models/get-order-response.md) + +## Example Usage + +```python +order_id = 'order_id6' + +result = orders_controller.get_order(order_id) +print(result) +``` + + +# Get Orders + +Gets all orders + +```python +def get_orders(self, + page=None, + size=None, + code=None, + status=None, + created_since=None, + created_until=None, + customer_id=None) +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `page` | `int` | Query, Optional | Page number | +| `size` | `int` | Query, Optional | Page size | +| `code` | `str` | Query, Optional | Filter for order's code | +| `status` | `str` | Query, Optional | Filter for order's status | +| `created_since` | `datetime` | Query, Optional | Filter for order's creation date start range | +| `created_until` | `datetime` | Query, Optional | Filter for order's creation date end range | +| `customer_id` | `str` | Query, Optional | Filter for order's customer id | + +## Response Type + +[`ListOrderResponse`](../../doc/models/list-order-response.md) + +## Example Usage + +```python +result = orders_controller.get_orders() +print(result) +``` + + +# Update Order Item + +```python +def update_order_item(self, + order_id, + item_id, + request, + idempotency_key=None) +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `order_id` | `str` | Template, Required | Order Id | +| `item_id` | `str` | Template, Required | Item Id | +| `request` | [`UpdateOrderItemRequest`](../../doc/models/update-order-item-request.md) | Body, Required | Item Model | +| `idempotency_key` | `str` | Header, Optional | - | + +## Response Type + +[`GetOrderItemResponse`](../../doc/models/get-order-item-response.md) + +## Example Usage + +```python +order_id = 'orderId2' + +item_id = 'itemId8' + +request = UpdateOrderItemRequest( + amount=242, + description='description6', + quantity=100, + category='category4' +) + +result = orders_controller.update_order_item( + order_id, + item_id, + request +) +print(result) +``` + + # Close Order ```python @@ -320,108 +425,3 @@ result = orders_controller.create_order_item( print(result) ``` - -# Get Order Item - -```python -def get_order_item(self, - order_id, - item_id) -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `order_id` | `str` | Template, Required | Order Id | -| `item_id` | `str` | Template, Required | Item Id | - -## Response Type - -[`GetOrderItemResponse`](../../doc/models/get-order-item-response.md) - -## Example Usage - -```python -order_id = 'orderId2' - -item_id = 'itemId8' - -result = orders_controller.get_order_item( - order_id, - item_id -) -print(result) -``` - - -# Update Order Metadata - -Updates the metadata from an order - -```python -def update_order_metadata(self, - order_id, - request, - idempotency_key=None) -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `order_id` | `str` | Template, Required | The order id | -| `request` | [`UpdateMetadataRequest`](../../doc/models/update-metadata-request.md) | Body, Required | Request for updating the order metadata | -| `idempotency_key` | `str` | Header, Optional | - | - -## Response Type - -[`GetOrderResponse`](../../doc/models/get-order-response.md) - -## Example Usage - -```python -order_id = 'order_id6' - -request = UpdateMetadataRequest( - metadata={ - 'key0': 'metadata3' - } -) - -result = orders_controller.update_order_metadata( - order_id, - request -) -print(result) -``` - - -# Get Order - -Gets an order - -```python -def get_order(self, - order_id) -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `order_id` | `str` | Template, Required | Order id | - -## Response Type - -[`GetOrderResponse`](../../doc/models/get-order-response.md) - -## Example Usage - -```python -order_id = 'order_id6' - -result = orders_controller.get_order(order_id) -print(result) -``` - diff --git a/doc/controllers/plans.md b/doc/controllers/plans.md index c3d205a..4c47f85 100644 --- a/doc/controllers/plans.md +++ b/doc/controllers/plans.md @@ -11,15 +11,15 @@ plans_controller = client.plans ## Methods * [Get Plan](../../doc/controllers/plans.md#get-plan) -* [Delete Plan](../../doc/controllers/plans.md#delete-plan) +* [Delete Plan Item](../../doc/controllers/plans.md#delete-plan-item) * [Update Plan Metadata](../../doc/controllers/plans.md#update-plan-metadata) -* [Update Plan Item](../../doc/controllers/plans.md#update-plan-item) -* [Create Plan Item](../../doc/controllers/plans.md#create-plan-item) -* [Get Plan Item](../../doc/controllers/plans.md#get-plan-item) * [Create Plan](../../doc/controllers/plans.md#create-plan) -* [Delete Plan Item](../../doc/controllers/plans.md#delete-plan-item) +* [Update Plan](../../doc/controllers/plans.md#update-plan) +* [Delete Plan](../../doc/controllers/plans.md#delete-plan) * [Get Plans](../../doc/controllers/plans.md#get-plans) -* [Update Plan](../../doc/controllers/plans.md#update-plan) +* [Update Plan Item](../../doc/controllers/plans.md#update-plan-item) +* [Create Plan Item](../../doc/controllers/plans.md#create-plan-item) +* [Get Plan Item](../../doc/controllers/plans.md#get-plan-item) # Get Plan @@ -51,14 +51,15 @@ print(result) ``` -# Delete Plan +# Delete Plan Item -Deletes a plan +Removes an item from a plan ```python -def delete_plan(self, - plan_id, - idempotency_key=None) +def delete_plan_item(self, + plan_id, + plan_item_id, + idempotency_key=None) ``` ## Parameters @@ -66,18 +67,24 @@ def delete_plan(self, | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `plan_id` | `str` | Template, Required | Plan id | +| `plan_item_id` | `str` | Template, Required | Plan item id | | `idempotency_key` | `str` | Header, Optional | - | ## Response Type -[`GetPlanResponse`](../../doc/models/get-plan-response.md) +[`GetPlanItemResponse`](../../doc/models/get-plan-item-response.md) ## Example Usage ```python plan_id = 'plan_id8' -result = plans_controller.delete_plan(plan_id) +plan_item_id = 'plan_item_id0' + +result = plans_controller.delete_plan_item( + plan_id, + plan_item_id +) print(result) ``` @@ -124,71 +131,82 @@ print(result) ``` -# Update Plan Item +# Create Plan -Updates a plan item +Creates a new plan ```python -def update_plan_item(self, - plan_id, - plan_item_id, - body, - idempotency_key=None) +def create_plan(self, + body, + idempotency_key=None) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `plan_id` | `str` | Template, Required | Plan id | -| `plan_item_id` | `str` | Template, Required | Plan item id | -| `body` | [`UpdatePlanItemRequest`](../../doc/models/update-plan-item-request.md) | Body, Required | Request for updating the plan item | +| `body` | [`CreatePlanRequest`](../../doc/models/create-plan-request.md) | Body, Required | Request for creating a plan | | `idempotency_key` | `str` | Header, Optional | - | ## Response Type -[`GetPlanItemResponse`](../../doc/models/get-plan-item-response.md) +[`GetPlanResponse`](../../doc/models/get-plan-response.md) ## Example Usage ```python -plan_id = 'plan_id8' - -plan_item_id = 'plan_item_id0' - -body = UpdatePlanItemRequest( +body = CreatePlanRequest( name='name6', description='description4', - status='status2', - pricing_scheme=UpdatePricingSchemeRequest( - scheme_type='scheme_type8', - price_brackets=[ - UpdatePriceBracketRequest( - start_quantity=144, - price=174 - ) - ] - ) + statement_descriptor='statement_descriptor6', + items=[ + CreatePlanItemRequest( + name='name8', + pricing_scheme=CreatePricingSchemeRequest( + scheme_type='scheme_type8' + ), + id='id8', + description='description2' + ) + ], + shippable=False, + payment_methods=[ + 'payment_methods9' + ], + installments=[ + 207 + ], + currency='currency6', + interval='interval6', + interval_count=170, + billing_days=[ + 201, + 200 + ], + billing_type='billing_type0', + pricing_scheme=CreatePricingSchemeRequest( + scheme_type='scheme_type8' + ), + metadata={ + 'key0': 'metadata7', + 'key1': 'metadata8' + } ) -result = plans_controller.update_plan_item( - plan_id, - plan_item_id, - body -) +result = plans_controller.create_plan(body) print(result) ``` -# Create Plan Item +# Update Plan -Adds a new item to a plan +Updates a plan ```python -def create_plan_item(self, - plan_id, - request, - idempotency_key=None) +def update_plan(self, + plan_id, + request, + idempotency_key=None) ``` ## Parameters @@ -196,28 +214,46 @@ def create_plan_item(self, | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `plan_id` | `str` | Template, Required | Plan id | -| `request` | [`CreatePlanItemRequest`](../../doc/models/create-plan-item-request.md) | Body, Required | Request for creating a plan item | +| `request` | [`UpdatePlanRequest`](../../doc/models/update-plan-request.md) | Body, Required | Request for updating a plan | | `idempotency_key` | `str` | Header, Optional | - | ## Response Type -[`GetPlanItemResponse`](../../doc/models/get-plan-item-response.md) +[`GetPlanResponse`](../../doc/models/get-plan-response.md) ## Example Usage ```python plan_id = 'plan_id8' -request = CreatePlanItemRequest( +request = UpdatePlanRequest( name='name6', - pricing_scheme=CreatePricingSchemeRequest( - scheme_type='scheme_type8' - ), - id='id6', - description='description6' + description='description6', + installments=[ + 151, + 152 + ], + statement_descriptor='statement_descriptor6', + currency='currency6', + interval='interval4', + interval_count=114, + payment_methods=[ + 'payment_methods1', + 'payment_methods0', + 'payment_methods9' + ], + billing_type='billing_type0', + status='status8', + shippable=False, + billing_days=[ + 115 + ], + metadata={ + 'key0': 'metadata3' + } ) -result = plans_controller.create_plan_item( +result = plans_controller.update_plan( plan_id, request ) @@ -225,14 +261,14 @@ print(result) ``` -# Get Plan Item +# Delete Plan -Gets a plan item +Deletes a plan ```python -def get_plan_item(self, - plan_id, - plan_item_id) +def delete_plan(self, + plan_id, + idempotency_key=None) ``` ## Parameters @@ -240,102 +276,70 @@ def get_plan_item(self, | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `plan_id` | `str` | Template, Required | Plan id | -| `plan_item_id` | `str` | Template, Required | Plan item id | +| `idempotency_key` | `str` | Header, Optional | - | ## Response Type -[`GetPlanItemResponse`](../../doc/models/get-plan-item-response.md) +[`GetPlanResponse`](../../doc/models/get-plan-response.md) ## Example Usage ```python plan_id = 'plan_id8' -plan_item_id = 'plan_item_id0' - -result = plans_controller.get_plan_item( - plan_id, - plan_item_id -) +result = plans_controller.delete_plan(plan_id) print(result) ``` -# Create Plan +# Get Plans -Creates a new plan +Gets all plans ```python -def create_plan(self, - body, - idempotency_key=None) +def get_plans(self, + page=None, + size=None, + name=None, + status=None, + billing_type=None, + created_since=None, + created_until=None) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `body` | [`CreatePlanRequest`](../../doc/models/create-plan-request.md) | Body, Required | Request for creating a plan | -| `idempotency_key` | `str` | Header, Optional | - | +| `page` | `int` | Query, Optional | Page number | +| `size` | `int` | Query, Optional | Page size | +| `name` | `str` | Query, Optional | Filter for Plan's name | +| `status` | `str` | Query, Optional | Filter for Plan's status | +| `billing_type` | `str` | Query, Optional | Filter for plan's billing type | +| `created_since` | `datetime` | Query, Optional | Filter for plan's creation date start range | +| `created_until` | `datetime` | Query, Optional | Filter for plan's creation date end range | ## Response Type -[`GetPlanResponse`](../../doc/models/get-plan-response.md) +[`ListPlansResponse`](../../doc/models/list-plans-response.md) ## Example Usage ```python -body = CreatePlanRequest( - name='name6', - description='description4', - statement_descriptor='statement_descriptor6', - items=[ - CreatePlanItemRequest( - name='name8', - pricing_scheme=CreatePricingSchemeRequest( - scheme_type='scheme_type8' - ), - id='id8', - description='description2' - ) - ], - shippable=False, - payment_methods=[ - 'payment_methods9' - ], - installments=[ - 207 - ], - currency='currency6', - interval='interval6', - interval_count=170, - billing_days=[ - 201, - 200 - ], - billing_type='billing_type0', - pricing_scheme=CreatePricingSchemeRequest( - scheme_type='scheme_type8' - ), - metadata={ - 'key0': 'metadata7', - 'key1': 'metadata8' - } -) - -result = plans_controller.create_plan(body) +result = plans_controller.get_plans() print(result) ``` -# Delete Plan Item +# Update Plan Item -Removes an item from a plan +Updates a plan item ```python -def delete_plan_item(self, +def update_plan_item(self, plan_id, plan_item_id, + body, idempotency_key=None) ``` @@ -345,6 +349,7 @@ def delete_plan_item(self, | --- | --- | --- | --- | | `plan_id` | `str` | Template, Required | Plan id | | `plan_item_id` | `str` | Template, Required | Plan item id | +| `body` | [`UpdatePlanItemRequest`](../../doc/models/update-plan-item-request.md) | Body, Required | Request for updating the plan item | | `idempotency_key` | `str` | Header, Optional | - | ## Response Type @@ -358,62 +363,83 @@ plan_id = 'plan_id8' plan_item_id = 'plan_item_id0' -result = plans_controller.delete_plan_item( +body = UpdatePlanItemRequest( + name='name6', + description='description4', + status='status2', + pricing_scheme=UpdatePricingSchemeRequest( + scheme_type='scheme_type8', + price_brackets=[ + UpdatePriceBracketRequest( + start_quantity=144, + price=174 + ) + ] + ) +) + +result = plans_controller.update_plan_item( plan_id, - plan_item_id + plan_item_id, + body ) print(result) ``` -# Get Plans +# Create Plan Item -Gets all plans +Adds a new item to a plan ```python -def get_plans(self, - page=None, - size=None, - name=None, - status=None, - billing_type=None, - created_since=None, - created_until=None) +def create_plan_item(self, + plan_id, + request, + idempotency_key=None) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `page` | `int` | Query, Optional | Page number | -| `size` | `int` | Query, Optional | Page size | -| `name` | `str` | Query, Optional | Filter for Plan's name | -| `status` | `str` | Query, Optional | Filter for Plan's status | -| `billing_type` | `str` | Query, Optional | Filter for plan's billing type | -| `created_since` | `datetime` | Query, Optional | Filter for plan's creation date start range | -| `created_until` | `datetime` | Query, Optional | Filter for plan's creation date end range | +| `plan_id` | `str` | Template, Required | Plan id | +| `request` | [`CreatePlanItemRequest`](../../doc/models/create-plan-item-request.md) | Body, Required | Request for creating a plan item | +| `idempotency_key` | `str` | Header, Optional | - | ## Response Type -[`ListPlansResponse`](../../doc/models/list-plans-response.md) +[`GetPlanItemResponse`](../../doc/models/get-plan-item-response.md) ## Example Usage ```python -result = plans_controller.get_plans() +plan_id = 'plan_id8' + +request = CreatePlanItemRequest( + name='name6', + pricing_scheme=CreatePricingSchemeRequest( + scheme_type='scheme_type8' + ), + id='id6', + description='description6' +) + +result = plans_controller.create_plan_item( + plan_id, + request +) print(result) ``` -# Update Plan +# Get Plan Item -Updates a plan +Gets a plan item ```python -def update_plan(self, - plan_id, - request, - idempotency_key=None) +def get_plan_item(self, + plan_id, + plan_item_id) ``` ## Parameters @@ -421,48 +447,22 @@ def update_plan(self, | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `plan_id` | `str` | Template, Required | Plan id | -| `request` | [`UpdatePlanRequest`](../../doc/models/update-plan-request.md) | Body, Required | Request for updating a plan | -| `idempotency_key` | `str` | Header, Optional | - | +| `plan_item_id` | `str` | Template, Required | Plan item id | ## Response Type -[`GetPlanResponse`](../../doc/models/get-plan-response.md) +[`GetPlanItemResponse`](../../doc/models/get-plan-item-response.md) ## Example Usage ```python plan_id = 'plan_id8' -request = UpdatePlanRequest( - name='name6', - description='description6', - installments=[ - 151, - 152 - ], - statement_descriptor='statement_descriptor6', - currency='currency6', - interval='interval4', - interval_count=114, - payment_methods=[ - 'payment_methods1', - 'payment_methods0', - 'payment_methods9' - ], - billing_type='billing_type0', - status='status8', - shippable=False, - billing_days=[ - 115 - ], - metadata={ - 'key0': 'metadata3' - } -) +plan_item_id = 'plan_item_id0' -result = plans_controller.update_plan( +result = plans_controller.get_plan_item( plan_id, - request + plan_item_id ) print(result) ``` diff --git a/doc/controllers/recipients.md b/doc/controllers/recipients.md index cc739a2..0f20dcd 100644 --- a/doc/controllers/recipients.md +++ b/doc/controllers/recipients.md @@ -11,26 +11,26 @@ recipients_controller = client.recipients ## Methods * [Update Recipient](../../doc/controllers/recipients.md#update-recipient) -* [Create Anticipation](../../doc/controllers/recipients.md#create-anticipation) -* [Get Anticipation Limits](../../doc/controllers/recipients.md#get-anticipation-limits) -* [Get Recipients](../../doc/controllers/recipients.md#get-recipients) * [Get Withdraw by Id](../../doc/controllers/recipients.md#get-withdraw-by-id) +* [Get Recipient](../../doc/controllers/recipients.md#get-recipient) +* [Get Balance](../../doc/controllers/recipients.md#get-balance) +* [Get Recipients](../../doc/controllers/recipients.md#get-recipients) * [Update Recipient Default Bank Account](../../doc/controllers/recipients.md#update-recipient-default-bank-account) -* [Update Recipient Metadata](../../doc/controllers/recipients.md#update-recipient-metadata) * [Get Transfers](../../doc/controllers/recipients.md#get-transfers) * [Get Transfer](../../doc/controllers/recipients.md#get-transfer) * [Create Withdraw](../../doc/controllers/recipients.md#create-withdraw) -* [Update Automatic Anticipation Settings](../../doc/controllers/recipients.md#update-automatic-anticipation-settings) * [Get Anticipation](../../doc/controllers/recipients.md#get-anticipation) * [Update Recipient Transfer Settings](../../doc/controllers/recipients.md#update-recipient-transfer-settings) -* [Get Anticipations](../../doc/controllers/recipients.md#get-anticipations) -* [Get Recipient](../../doc/controllers/recipients.md#get-recipient) -* [Get Balance](../../doc/controllers/recipients.md#get-balance) -* [Get Withdrawals](../../doc/controllers/recipients.md#get-withdrawals) +* [Get Recipient by Code](../../doc/controllers/recipients.md#get-recipient-by-code) +* [Update Automatic Anticipation Settings](../../doc/controllers/recipients.md#update-automatic-anticipation-settings) * [Create Transfer](../../doc/controllers/recipients.md#create-transfer) * [Create Recipient](../../doc/controllers/recipients.md#create-recipient) -* [Get Recipient by Code](../../doc/controllers/recipients.md#get-recipient-by-code) * [Get Default Recipient](../../doc/controllers/recipients.md#get-default-recipient) +* [Create Anticipation](../../doc/controllers/recipients.md#create-anticipation) +* [Get Anticipation Limits](../../doc/controllers/recipients.md#get-anticipation-limits) +* [Update Recipient Metadata](../../doc/controllers/recipients.md#update-recipient-metadata) +* [Get Anticipations](../../doc/controllers/recipients.md#get-anticipations) +* [Get Withdrawals](../../doc/controllers/recipients.md#get-withdrawals) * [Create KYC Link](../../doc/controllers/recipients.md#create-kyc-link) @@ -81,148 +81,123 @@ print(result) ``` -# Create Anticipation - -Creates an anticipation +# Get Withdraw by Id ```python -def create_anticipation(self, - recipient_id, - request, - idempotency_key=None) +def get_withdraw_by_id(self, + recipient_id, + withdrawal_id) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `recipient_id` | `str` | Template, Required | Recipient id | -| `request` | [`CreateAnticipationRequest`](../../doc/models/create-anticipation-request.md) | Body, Required | Anticipation data | -| `idempotency_key` | `str` | Header, Optional | - | +| `recipient_id` | `str` | Template, Required | - | +| `withdrawal_id` | `str` | Template, Required | - | ## Response Type -[`GetAnticipationResponse`](../../doc/models/get-anticipation-response.md) +[`GetWithdrawResponse`](../../doc/models/get-withdraw-response.md) ## Example Usage ```python recipient_id = 'recipient_id0' -request = CreateAnticipationRequest( - amount=242, - timeframe='timeframe8', - payment_date=dateutil.parser.parse('2016-03-13T12:52:32.123Z') -) +withdrawal_id = 'withdrawal_id2' -result = recipients_controller.create_anticipation( +result = recipients_controller.get_withdraw_by_id( recipient_id, - request + withdrawal_id ) print(result) ``` -# Get Anticipation Limits +# Get Recipient -Gets the anticipation limits for a recipient +Retrieves recipient information ```python -def get_anticipation_limits(self, - recipient_id, - timeframe, - payment_date) +def get_recipient(self, + recipient_id) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `recipient_id` | `str` | Template, Required | Recipient id | -| `timeframe` | `str` | Query, Required | Timeframe | -| `payment_date` | `datetime` | Query, Required | Anticipation payment date | +| `recipient_id` | `str` | Template, Required | Recipiend id | ## Response Type -[`GetAnticipationLimitResponse`](../../doc/models/get-anticipation-limit-response.md) +[`GetRecipientResponse`](../../doc/models/get-recipient-response.md) ## Example Usage ```python recipient_id = 'recipient_id0' -timeframe = 'timeframe2' - -payment_date = dateutil.parser.parse('2016-03-13T12:52:32.123Z') - -result = recipients_controller.get_anticipation_limits( - recipient_id, - timeframe, - payment_date -) +result = recipients_controller.get_recipient(recipient_id) print(result) ``` -# Get Recipients +# Get Balance -Retrieves paginated recipients information +Get balance information for a recipient ```python -def get_recipients(self, - page=None, - size=None) +def get_balance(self, + recipient_id) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `page` | `int` | Query, Optional | Page number | -| `size` | `int` | Query, Optional | Page size | +| `recipient_id` | `str` | Template, Required | Recipient id | ## Response Type -[`ListRecipientResponse`](../../doc/models/list-recipient-response.md) +[`GetBalanceResponse`](../../doc/models/get-balance-response.md) ## Example Usage ```python -result = recipients_controller.get_recipients() +recipient_id = 'recipient_id0' + +result = recipients_controller.get_balance(recipient_id) print(result) ``` -# Get Withdraw by Id +# Get Recipients + +Retrieves paginated recipients information ```python -def get_withdraw_by_id(self, - recipient_id, - withdrawal_id) +def get_recipients(self, + page=None, + size=None) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `recipient_id` | `str` | Template, Required | - | -| `withdrawal_id` | `str` | Template, Required | - | +| `page` | `int` | Query, Optional | Page number | +| `size` | `int` | Query, Optional | Page size | ## Response Type -[`GetWithdrawResponse`](../../doc/models/get-withdraw-response.md) +[`ListRecipientResponse`](../../doc/models/list-recipient-response.md) ## Example Usage ```python -recipient_id = 'recipient_id0' - -withdrawal_id = 'withdrawal_id2' - -result = recipients_controller.get_withdraw_by_id( - recipient_id, - withdrawal_id -) +result = recipients_controller.get_recipients() print(result) ``` @@ -281,48 +256,6 @@ print(result) ``` -# Update Recipient Metadata - -Updates recipient metadata - -```python -def update_recipient_metadata(self, - recipient_id, - request, - idempotency_key=None) -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `recipient_id` | `str` | Template, Required | Recipient id | -| `request` | [`UpdateMetadataRequest`](../../doc/models/update-metadata-request.md) | Body, Required | Metadata | -| `idempotency_key` | `str` | Header, Optional | - | - -## Response Type - -[`GetRecipientResponse`](../../doc/models/get-recipient-response.md) - -## Example Usage - -```python -recipient_id = 'recipient_id0' - -request = UpdateMetadataRequest( - metadata={ - 'key0': 'metadata3' - } -) - -result = recipients_controller.update_recipient_metadata( - recipient_id, - request -) -print(result) -``` - - # Get Transfers Gets a paginated list of transfers for the recipient @@ -434,44 +367,6 @@ print(result) ``` -# Update Automatic Anticipation Settings - -Updates recipient metadata - -```python -def update_automatic_anticipation_settings(self, - recipient_id, - request, - idempotency_key=None) -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `recipient_id` | `str` | Template, Required | Recipient id | -| `request` | [`UpdateAutomaticAnticipationSettingsRequest`](../../doc/models/update-automatic-anticipation-settings-request.md) | Body, Required | Metadata | -| `idempotency_key` | `str` | Header, Optional | - | - -## Response Type - -[`GetRecipientResponse`](../../doc/models/get-recipient-response.md) - -## Example Usage - -```python -recipient_id = 'recipient_id0' - -request = UpdateAutomaticAnticipationSettingsRequest() - -result = recipients_controller.update_automatic_anticipation_settings( - recipient_id, - request -) -print(result) -``` - - # Get Anticipation Gets an anticipation @@ -548,65 +443,53 @@ print(result) ``` -# Get Anticipations +# Get Recipient by Code -Retrieves a paginated list of anticipations from a recipient +Retrieves recipient information ```python -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) +def get_recipient_by_code(self, + code) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `recipient_id` | `str` | Template, Required | Recipient id | -| `page` | `int` | Query, Optional | Page number | -| `size` | `int` | Query, Optional | Page size | -| `status` | `str` | Query, Optional | Filter for anticipation status | -| `timeframe` | `str` | Query, Optional | Filter for anticipation timeframe | -| `payment_date_since` | `datetime` | Query, Optional | Filter for start range for anticipation payment date | -| `payment_date_until` | `datetime` | Query, Optional | Filter for end range for anticipation payment date | -| `created_since` | `datetime` | Query, Optional | Filter for start range for anticipation creation date | -| `created_until` | `datetime` | Query, Optional | Filter for end range for anticipation creation date | +| `code` | `str` | Template, Required | Recipient code | ## Response Type -[`ListAnticipationResponse`](../../doc/models/list-anticipation-response.md) +[`GetRecipientResponse`](../../doc/models/get-recipient-response.md) ## Example Usage ```python -recipient_id = 'recipient_id0' +code = 'code8' -result = recipients_controller.get_anticipations(recipient_id) +result = recipients_controller.get_recipient_by_code(code) print(result) ``` -# Get Recipient +# Update Automatic Anticipation Settings -Retrieves recipient information +Updates recipient metadata ```python -def get_recipient(self, - recipient_id) +def update_automatic_anticipation_settings(self, + recipient_id, + request, + idempotency_key=None) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `recipient_id` | `str` | Template, Required | Recipiend id | +| `recipient_id` | `str` | Template, Required | Recipient id | +| `request` | [`UpdateAutomaticAnticipationSettingsRequest`](../../doc/models/update-automatic-anticipation-settings-request.md) | Body, Required | Metadata | +| `idempotency_key` | `str` | Header, Optional | - | ## Response Type @@ -617,115 +500,164 @@ def get_recipient(self, ```python recipient_id = 'recipient_id0' -result = recipients_controller.get_recipient(recipient_id) +request = UpdateAutomaticAnticipationSettingsRequest() + +result = recipients_controller.update_automatic_anticipation_settings( + recipient_id, + request +) print(result) ``` -# Get Balance +# Create Transfer -Get balance information for a recipient +Creates a transfer for a recipient ```python -def get_balance(self, - recipient_id) +def create_transfer(self, + recipient_id, + request, + idempotency_key=None) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `recipient_id` | `str` | Template, Required | Recipient id | +| `recipient_id` | `str` | Template, Required | Recipient Id | +| `request` | [`CreateTransferRequest`](../../doc/models/create-transfer-request.md) | Body, Required | Transfer data | +| `idempotency_key` | `str` | Header, Optional | - | ## Response Type -[`GetBalanceResponse`](../../doc/models/get-balance-response.md) +[`GetTransferResponse`](../../doc/models/get-transfer-response.md) ## Example Usage ```python recipient_id = 'recipient_id0' -result = recipients_controller.get_balance(recipient_id) +request = CreateTransferRequest( + amount=242, + metadata={ + 'key0': 'metadata3' + } +) + +result = recipients_controller.create_transfer( + recipient_id, + request +) print(result) ``` -# Get Withdrawals +# Create Recipient -Gets a paginated list of transfers for the recipient +Creates a new recipient ```python -def get_withdrawals(self, - recipient_id, - page=None, - size=None, - status=None, - created_since=None, - created_until=None) +def create_recipient(self, + request, + idempotency_key=None) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `recipient_id` | `str` | Template, Required | - | -| `page` | `int` | Query, Optional | - | -| `size` | `int` | Query, Optional | - | -| `status` | `str` | Query, Optional | - | -| `created_since` | `datetime` | Query, Optional | - | -| `created_until` | `datetime` | Query, Optional | - | +| `request` | [`CreateRecipientRequest`](../../doc/models/create-recipient-request.md) | Body, Required | Recipient data | +| `idempotency_key` | `str` | Header, Optional | - | ## Response Type -[`ListWithdrawals`](../../doc/models/list-withdrawals.md) +[`GetRecipientResponse`](../../doc/models/get-recipient-response.md) ## Example Usage ```python -recipient_id = 'recipient_id0' +request = CreateRecipientRequest( + default_bank_account=CreateBankAccountRequest( + holder_name='holder_name4', + holder_type='holder_type0', + holder_document='holder_document2', + bank='bank6', + branch_number='branch_number4', + account_number='account_number8', + account_check_digit='account_check_digit4', + mtype='type2', + metadata={ + 'key0': 'metadata5', + 'key1': 'metadata4', + 'key2': 'metadata3' + } + ), + metadata={ + 'key0': 'metadata3' + }, + code='code4', + payment_mode='bank_transfer' +) -result = recipients_controller.get_withdrawals(recipient_id) +result = recipients_controller.create_recipient(request) print(result) ``` -# Create Transfer +# Get Default Recipient -Creates a transfer for a recipient +```python +def get_default_recipient(self) +``` + +## Response Type + +[`GetRecipientResponse`](../../doc/models/get-recipient-response.md) + +## Example Usage ```python -def create_transfer(self, - recipient_id, - request, - idempotency_key=None) +result = recipients_controller.get_default_recipient() +print(result) +``` + + +# Create Anticipation + +Creates an anticipation + +```python +def create_anticipation(self, + recipient_id, + request, + idempotency_key=None) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `recipient_id` | `str` | Template, Required | Recipient Id | -| `request` | [`CreateTransferRequest`](../../doc/models/create-transfer-request.md) | Body, Required | Transfer data | +| `recipient_id` | `str` | Template, Required | Recipient id | +| `request` | [`CreateAnticipationRequest`](../../doc/models/create-anticipation-request.md) | Body, Required | Anticipation data | | `idempotency_key` | `str` | Header, Optional | - | ## Response Type -[`GetTransferResponse`](../../doc/models/get-transfer-response.md) +[`GetAnticipationResponse`](../../doc/models/get-anticipation-response.md) ## Example Usage ```python recipient_id = 'recipient_id0' -request = CreateTransferRequest( +request = CreateAnticipationRequest( amount=242, - metadata={ - 'key0': 'metadata3' - } + timeframe='timeframe8', + payment_date=dateutil.parser.parse('2016-03-13T12:52:32.123Z') ) -result = recipients_controller.create_transfer( +result = recipients_controller.create_anticipation( recipient_id, request ) @@ -733,21 +665,64 @@ print(result) ``` -# Create Recipient +# Get Anticipation Limits -Creates a new recipient +Gets the anticipation limits for a recipient ```python -def create_recipient(self, - request, - idempotency_key=None) +def get_anticipation_limits(self, + recipient_id, + timeframe, + payment_date) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `request` | [`CreateRecipientRequest`](../../doc/models/create-recipient-request.md) | Body, Required | Recipient data | +| `recipient_id` | `str` | Template, Required | Recipient id | +| `timeframe` | `str` | Query, Required | Timeframe | +| `payment_date` | `datetime` | Query, Required | Anticipation payment date | + +## Response Type + +[`GetAnticipationLimitResponse`](../../doc/models/get-anticipation-limit-response.md) + +## Example Usage + +```python +recipient_id = 'recipient_id0' + +timeframe = 'timeframe2' + +payment_date = dateutil.parser.parse('2016-03-13T12:52:32.123Z') + +result = recipients_controller.get_anticipation_limits( + recipient_id, + timeframe, + payment_date +) +print(result) +``` + + +# Update Recipient Metadata + +Updates recipient metadata + +```python +def update_recipient_metadata(self, + recipient_id, + request, + idempotency_key=None) +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `recipient_id` | `str` | Template, Required | Recipient id | +| `request` | [`UpdateMetadataRequest`](../../doc/models/update-metadata-request.md) | Body, Required | Metadata | | `idempotency_key` | `str` | Header, Optional | - | ## Response Type @@ -757,77 +732,102 @@ def create_recipient(self, ## Example Usage ```python -request = CreateRecipientRequest( - default_bank_account=CreateBankAccountRequest( - holder_name='holder_name4', - holder_type='holder_type0', - holder_document='holder_document2', - bank='bank6', - branch_number='branch_number4', - account_number='account_number8', - account_check_digit='account_check_digit4', - mtype='type2', - metadata={ - 'key0': 'metadata5', - 'key1': 'metadata4', - 'key2': 'metadata3' - } - ), +recipient_id = 'recipient_id0' + +request = UpdateMetadataRequest( metadata={ 'key0': 'metadata3' - }, - code='code4', - payment_mode='bank_transfer' + } ) -result = recipients_controller.create_recipient(request) +result = recipients_controller.update_recipient_metadata( + recipient_id, + request +) print(result) ``` -# Get Recipient by Code +# Get Anticipations -Retrieves recipient information +Retrieves a paginated list of anticipations from a recipient ```python -def get_recipient_by_code(self, - code) +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) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `code` | `str` | Template, Required | Recipient code | +| `recipient_id` | `str` | Template, Required | Recipient id | +| `page` | `int` | Query, Optional | Page number | +| `size` | `int` | Query, Optional | Page size | +| `status` | `str` | Query, Optional | Filter for anticipation status | +| `timeframe` | `str` | Query, Optional | Filter for anticipation timeframe | +| `payment_date_since` | `datetime` | Query, Optional | Filter for start range for anticipation payment date | +| `payment_date_until` | `datetime` | Query, Optional | Filter for end range for anticipation payment date | +| `created_since` | `datetime` | Query, Optional | Filter for start range for anticipation creation date | +| `created_until` | `datetime` | Query, Optional | Filter for end range for anticipation creation date | ## Response Type -[`GetRecipientResponse`](../../doc/models/get-recipient-response.md) +[`ListAnticipationResponse`](../../doc/models/list-anticipation-response.md) ## Example Usage ```python -code = 'code8' +recipient_id = 'recipient_id0' -result = recipients_controller.get_recipient_by_code(code) +result = recipients_controller.get_anticipations(recipient_id) print(result) ``` -# Get Default Recipient +# Get Withdrawals + +Gets a paginated list of transfers for the recipient ```python -def get_default_recipient(self) +def get_withdrawals(self, + recipient_id, + page=None, + size=None, + status=None, + created_since=None, + created_until=None) ``` +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `recipient_id` | `str` | Template, Required | - | +| `page` | `int` | Query, Optional | - | +| `size` | `int` | Query, Optional | - | +| `status` | `str` | Query, Optional | - | +| `created_since` | `datetime` | Query, Optional | - | +| `created_until` | `datetime` | Query, Optional | - | + ## Response Type -[`GetRecipientResponse`](../../doc/models/get-recipient-response.md) +[`ListWithdrawals`](../../doc/models/list-withdrawals.md) ## Example Usage ```python -result = recipients_controller.get_default_recipient() +recipient_id = 'recipient_id0' + +result = recipients_controller.get_withdrawals(recipient_id) print(result) ``` @@ -845,7 +845,7 @@ def create_kyc_link(self, | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `recipient_id` | `str` | Template, Required | - | +| `recipient_id` | `str` | Template, Required | Recipient id | ## Response Type diff --git a/doc/controllers/subscriptions.md b/doc/controllers/subscriptions.md index 61ec1b4..a7d836b 100644 --- a/doc/controllers/subscriptions.md +++ b/doc/controllers/subscriptions.md @@ -10,71 +10,42 @@ subscriptions_controller = client.subscriptions ## Methods -* [Renew Subscription](../../doc/controllers/subscriptions.md#renew-subscription) * [Update Subscription Card](../../doc/controllers/subscriptions.md#update-subscription-card) -* [Delete Usage](../../doc/controllers/subscriptions.md#delete-usage) * [Create Discount](../../doc/controllers/subscriptions.md#create-discount) -* [Create an Usage](../../doc/controllers/subscriptions.md#create-an-usage) -* [Update Current Cycle Status](../../doc/controllers/subscriptions.md#update-current-cycle-status) +* [Update Subscription Billing Date](../../doc/controllers/subscriptions.md#update-subscription-billing-date) +* [Update Subscription Start At](../../doc/controllers/subscriptions.md#update-subscription-start-at) +* [Get Subscription](../../doc/controllers/subscriptions.md#get-subscription) +* [Get Usages](../../doc/controllers/subscriptions.md#get-usages) +* [Update Latest Period End At](../../doc/controllers/subscriptions.md#update-latest-period-end-at) * [Delete Discount](../../doc/controllers/subscriptions.md#delete-discount) -* [Get Subscription Items](../../doc/controllers/subscriptions.md#get-subscription-items) * [Update Subscription Payment Method](../../doc/controllers/subscriptions.md#update-subscription-payment-method) +* [Cancel Subscription](../../doc/controllers/subscriptions.md#cancel-subscription) +* [Create Subscription](../../doc/controllers/subscriptions.md#create-subscription) +* [Update Subscription Affiliation Id](../../doc/controllers/subscriptions.md#update-subscription-affiliation-id) +* [Update Subscription Minium Price](../../doc/controllers/subscriptions.md#update-subscription-minium-price) +* [Get Subscription Cycle by Id](../../doc/controllers/subscriptions.md#get-subscription-cycle-by-id) +* [Get Usage Report](../../doc/controllers/subscriptions.md#get-usage-report) +* [Renew Subscription](../../doc/controllers/subscriptions.md#renew-subscription) +* [Delete Usage](../../doc/controllers/subscriptions.md#delete-usage) +* [Create an Usage](../../doc/controllers/subscriptions.md#create-an-usage) +* [Update Current Cycle Status](../../doc/controllers/subscriptions.md#update-current-cycle-status) * [Get Subscription Item](../../doc/controllers/subscriptions.md#get-subscription-item) +* [Get Increment by Id](../../doc/controllers/subscriptions.md#get-increment-by-id) +* [Delete Increment](../../doc/controllers/subscriptions.md#delete-increment) +* [Get Discounts](../../doc/controllers/subscriptions.md#get-discounts) +* [Update Subscription Due Days](../../doc/controllers/subscriptions.md#update-subscription-due-days) +* [Create Subscription Item](../../doc/controllers/subscriptions.md#create-subscription-item) +* [Update Split Subscription](../../doc/controllers/subscriptions.md#update-split-subscription) +* [Get Subscription Items](../../doc/controllers/subscriptions.md#get-subscription-items) * [Get Subscriptions](../../doc/controllers/subscriptions.md#get-subscriptions) -* [Cancel Subscription](../../doc/controllers/subscriptions.md#cancel-subscription) * [Create Increment](../../doc/controllers/subscriptions.md#create-increment) * [Create Usage](../../doc/controllers/subscriptions.md#create-usage) * [Get Discount by Id](../../doc/controllers/subscriptions.md#get-discount-by-id) -* [Create Subscription](../../doc/controllers/subscriptions.md#create-subscription) -* [Get Increment by Id](../../doc/controllers/subscriptions.md#get-increment-by-id) -* [Update Subscription Affiliation Id](../../doc/controllers/subscriptions.md#update-subscription-affiliation-id) * [Update Subscription Metadata](../../doc/controllers/subscriptions.md#update-subscription-metadata) -* [Delete Increment](../../doc/controllers/subscriptions.md#delete-increment) * [Get Subscription Cycles](../../doc/controllers/subscriptions.md#get-subscription-cycles) -* [Get Discounts](../../doc/controllers/subscriptions.md#get-discounts) -* [Update Subscription Billing Date](../../doc/controllers/subscriptions.md#update-subscription-billing-date) * [Delete Subscription Item](../../doc/controllers/subscriptions.md#delete-subscription-item) * [Get Increments](../../doc/controllers/subscriptions.md#get-increments) -* [Update Subscription Due Days](../../doc/controllers/subscriptions.md#update-subscription-due-days) -* [Update Subscription Start At](../../doc/controllers/subscriptions.md#update-subscription-start-at) -* [Update Subscription Item](../../doc/controllers/subscriptions.md#update-subscription-item) -* [Create Subscription Item](../../doc/controllers/subscriptions.md#create-subscription-item) -* [Get Subscription](../../doc/controllers/subscriptions.md#get-subscription) -* [Get Usages](../../doc/controllers/subscriptions.md#get-usages) -* [Update Latest Period End At](../../doc/controllers/subscriptions.md#update-latest-period-end-at) -* [Update Subscription Minium Price](../../doc/controllers/subscriptions.md#update-subscription-minium-price) -* [Get Subscription Cycle by Id](../../doc/controllers/subscriptions.md#get-subscription-cycle-by-id) -* [Get Usage Report](../../doc/controllers/subscriptions.md#get-usage-report) -* [Update Split Subscription](../../doc/controllers/subscriptions.md#update-split-subscription) - - -# Renew Subscription - -```python -def renew_subscription(self, - subscription_id, - idempotency_key=None) -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `subscription_id` | `str` | Template, Required | - | -| `idempotency_key` | `str` | Header, Optional | - | - -## Response Type - -[`GetPeriodResponse`](../../doc/models/get-period-response.md) - -## Example Usage - -```python -subscription_id = 'subscription_id0' - -result = subscriptions_controller.renew_subscription(subscription_id) -print(result) -``` +* [Update Subscription Item](../../doc/controllers/subscriptions.md#update-subscription-item) # Update Subscription Card @@ -120,49 +91,6 @@ print(result) ``` -# Delete Usage - -Deletes a usage - -```python -def delete_usage(self, - subscription_id, - item_id, - usage_id, - idempotency_key=None) -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `subscription_id` | `str` | Template, Required | The subscription id | -| `item_id` | `str` | Template, Required | The subscription item id | -| `usage_id` | `str` | Template, Required | The usage id | -| `idempotency_key` | `str` | Header, Optional | - | - -## Response Type - -[`GetUsageResponse`](../../doc/models/get-usage-response.md) - -## Example Usage - -```python -subscription_id = 'subscription_id0' - -item_id = 'item_id0' - -usage_id = 'usage_id0' - -result = subscriptions_controller.delete_usage( - subscription_id, - item_id, - usage_id -) -print(result) -``` - - # Create Discount Creates a discount @@ -205,75 +133,79 @@ print(result) ``` -# Create an Usage +# Update Subscription Billing Date -Create Usage +Updates the billing date from a subscription ```python -def create_an_usage(self, - subscription_id, - item_id, - idempotency_key=None) +def update_subscription_billing_date(self, + subscription_id, + request, + idempotency_key=None) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `str` | Template, Required | Subscription id | -| `item_id` | `str` | Template, Required | Item id | +| `subscription_id` | `str` | Template, Required | The subscription id | +| `request` | [`UpdateSubscriptionBillingDateRequest`](../../doc/models/update-subscription-billing-date-request.md) | Body, Required | Request for updating the subscription billing date | | `idempotency_key` | `str` | Header, Optional | - | ## Response Type -[`GetUsageResponse`](../../doc/models/get-usage-response.md) +[`GetSubscriptionResponse`](../../doc/models/get-subscription-response.md) ## Example Usage ```python subscription_id = 'subscription_id0' -item_id = 'item_id0' +request = UpdateSubscriptionBillingDateRequest( + next_billing_at=dateutil.parser.parse('2016-03-13T12:52:32.123Z') +) -result = subscriptions_controller.create_an_usage( +result = subscriptions_controller.update_subscription_billing_date( subscription_id, - item_id + request ) print(result) ``` -# Update Current Cycle Status +# Update Subscription Start At + +Updates the start at date from a subscription ```python -def update_current_cycle_status(self, - subscription_id, - request, - idempotency_key=None) +def update_subscription_start_at(self, + subscription_id, + request, + idempotency_key=None) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `str` | Template, Required | Subscription Id | -| `request` | [`UpdateCurrentCycleStatusRequest`](../../doc/models/update-current-cycle-status-request.md) | Body, Required | Request for updating the end date of the subscription current status | +| `subscription_id` | `str` | Template, Required | The subscription id | +| `request` | [`UpdateSubscriptionStartAtRequest`](../../doc/models/update-subscription-start-at-request.md) | Body, Required | Request for updating the subscription start date | | `idempotency_key` | `str` | Header, Optional | - | ## Response Type -`void` +[`GetSubscriptionResponse`](../../doc/models/get-subscription-response.md) ## Example Usage ```python subscription_id = 'subscription_id0' -request = UpdateCurrentCycleStatusRequest( - status='status8' +request = UpdateSubscriptionStartAtRequest( + start_at=dateutil.parser.parse('2016-03-13T12:52:32.123Z') ) -result = subscriptions_controller.update_current_cycle_status( +result = subscriptions_controller.update_subscription_start_at( subscription_id, request ) @@ -281,15 +213,13 @@ print(result) ``` -# Delete Discount +# Get Subscription -Deletes a discount +Gets a subscription ```python -def delete_discount(self, - subscription_id, - discount_id, - idempotency_key=None) +def get_subscription(self, + subscription_id) ``` ## Parameters @@ -297,43 +227,35 @@ def delete_discount(self, | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `subscription_id` | `str` | Template, Required | Subscription id | -| `discount_id` | `str` | Template, Required | Discount Id | -| `idempotency_key` | `str` | Header, Optional | - | ## Response Type -[`GetDiscountResponse`](../../doc/models/get-discount-response.md) +[`GetSubscriptionResponse`](../../doc/models/get-subscription-response.md) ## Example Usage ```python subscription_id = 'subscription_id0' -discount_id = 'discount_id8' - -result = subscriptions_controller.delete_discount( - subscription_id, - discount_id -) +result = subscriptions_controller.get_subscription(subscription_id) print(result) ``` -# Get Subscription Items +# Get Usages -Get Subscription Items +Lists all usages from a subscription item ```python -def get_subscription_items(self, - subscription_id, - page=None, - size=None, - name=None, - code=None, - status=None, - description=None, - created_since=None, - created_until=None) +def get_usages(self, + subscription_id, + item_id, + page=None, + size=None, + code=None, + group=None, + used_since=None, + used_until=None) ``` ## Parameters @@ -341,46 +263,48 @@ def get_subscription_items(self, | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `subscription_id` | `str` | Template, Required | The subscription id | +| `item_id` | `str` | Template, Required | The subscription item id | | `page` | `int` | Query, Optional | Page number | | `size` | `int` | Query, Optional | Page size | -| `name` | `str` | Query, Optional | The item name | | `code` | `str` | Query, Optional | Identification code in the client system | -| `status` | `str` | Query, Optional | The item statis | -| `description` | `str` | Query, Optional | The item description | -| `created_since` | `str` | Query, Optional | Filter for item's creation date start range | -| `created_until` | `str` | Query, Optional | Filter for item's creation date end range | +| `group` | `str` | Query, Optional | Identification group in the client system | +| `used_since` | `datetime` | Query, Optional | - | +| `used_until` | `datetime` | Query, Optional | - | ## Response Type -[`ListSubscriptionItemsResponse`](../../doc/models/list-subscription-items-response.md) +[`ListUsagesResponse`](../../doc/models/list-usages-response.md) ## Example Usage ```python subscription_id = 'subscription_id0' -result = subscriptions_controller.get_subscription_items(subscription_id) +item_id = 'item_id0' + +result = subscriptions_controller.get_usages( + subscription_id, + item_id +) print(result) ``` -# Update Subscription Payment Method - -Updates the payment method from a subscription +# Update Latest Period End At ```python -def update_subscription_payment_method(self, - subscription_id, - request, - idempotency_key=None) +def update_latest_period_end_at(self, + subscription_id, + request, + idempotency_key=None) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `str` | Template, Required | Subscription id | -| `request` | [`UpdateSubscriptionPaymentMethodRequest`](../../doc/models/update-subscription-payment-method-request.md) | Body, Required | Request for updating the paymentmethod from a subscription | +| `subscription_id` | `str` | Template, Required | - | +| `request` | [`UpdateCurrentCycleEndDateRequest`](../../doc/models/update-current-cycle-end-date-request.md) | Body, Required | Request for updating the end date of the current signature cycle | | `idempotency_key` | `str` | Header, Optional | - | ## Response Type @@ -392,15 +316,9 @@ def update_subscription_payment_method(self, ```python subscription_id = 'subscription_id0' -request = UpdateSubscriptionPaymentMethodRequest( - payment_method='payment_method4', - card_id='card_id2', - card=CreateCardRequest( - mtype='credit' - ) -) +request = UpdateCurrentCycleEndDateRequest() -result = subscriptions_controller.update_subscription_payment_method( +result = subscriptions_controller.update_latest_period_end_at( subscription_id, request ) @@ -408,87 +326,84 @@ print(result) ``` -# Get Subscription Item +# Delete Discount -Get Subscription Item +Deletes a discount ```python -def get_subscription_item(self, - subscription_id, - item_id) +def delete_discount(self, + subscription_id, + discount_id, + idempotency_key=None) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `str` | Template, Required | Subscription Id | -| `item_id` | `str` | Template, Required | Item id | +| `subscription_id` | `str` | Template, Required | Subscription id | +| `discount_id` | `str` | Template, Required | Discount Id | +| `idempotency_key` | `str` | Header, Optional | - | ## Response Type -[`GetSubscriptionItemResponse`](../../doc/models/get-subscription-item-response.md) +[`GetDiscountResponse`](../../doc/models/get-discount-response.md) ## Example Usage ```python subscription_id = 'subscription_id0' -item_id = 'item_id0' +discount_id = 'discount_id8' -result = subscriptions_controller.get_subscription_item( +result = subscriptions_controller.delete_discount( subscription_id, - item_id + discount_id ) print(result) ``` -# Get Subscriptions +# Update Subscription Payment Method -Gets all subscriptions +Updates the payment method from a subscription ```python -def get_subscriptions(self, - page=None, - size=None, - code=None, - billing_type=None, - customer_id=None, - plan_id=None, - card_id=None, - status=None, - next_billing_since=None, - next_billing_until=None, - created_since=None, - created_until=None) +def update_subscription_payment_method(self, + subscription_id, + request, + idempotency_key=None) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `page` | `int` | Query, Optional | Page number | -| `size` | `int` | Query, Optional | Page size | -| `code` | `str` | Query, Optional | Filter for subscription's code | -| `billing_type` | `str` | Query, Optional | Filter for subscription's billing type | -| `customer_id` | `str` | Query, Optional | Filter for subscription's customer id | -| `plan_id` | `str` | Query, Optional | Filter for subscription's plan id | -| `card_id` | `str` | Query, Optional | Filter for subscription's card id | -| `status` | `str` | Query, Optional | Filter for subscription's status | -| `next_billing_since` | `datetime` | Query, Optional | Filter for subscription's next billing date start range | -| `next_billing_until` | `datetime` | Query, Optional | Filter for subscription's next billing date end range | -| `created_since` | `datetime` | Query, Optional | Filter for subscription's creation date start range | -| `created_until` | `datetime` | Query, Optional | Filter for subscriptions creation date end range | +| `subscription_id` | `str` | Template, Required | Subscription id | +| `request` | [`UpdateSubscriptionPaymentMethodRequest`](../../doc/models/update-subscription-payment-method-request.md) | Body, Required | Request for updating the paymentmethod from a subscription | +| `idempotency_key` | `str` | Header, Optional | - | ## Response Type -[`ListSubscriptionsResponse`](../../doc/models/list-subscriptions-response.md) +[`GetSubscriptionResponse`](../../doc/models/get-subscription-response.md) ## Example Usage ```python -result = subscriptions_controller.get_subscriptions() +subscription_id = 'subscription_id0' + +request = UpdateSubscriptionPaymentMethodRequest( + payment_method='payment_method4', + card_id='card_id2', + card=CreateCardRequest( + mtype='credit' + ) +) + +result = subscriptions_controller.update_subscription_payment_method( + subscription_id, + request +) print(result) ``` @@ -533,129 +448,6 @@ print(result) ``` -# Create Increment - -Creates a increment - -```python -def create_increment(self, - subscription_id, - request, - idempotency_key=None) -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `subscription_id` | `str` | Template, Required | Subscription id | -| `request` | [`CreateIncrementRequest`](../../doc/models/create-increment-request.md) | Body, Required | Request for creating a increment | -| `idempotency_key` | `str` | Header, Optional | - | - -## Response Type - -[`GetIncrementResponse`](../../doc/models/get-increment-response.md) - -## Example Usage - -```python -subscription_id = 'subscription_id0' - -request = CreateIncrementRequest( - value=185.28, - increment_type='increment_type8', - item_id='item_id6' -) - -result = subscriptions_controller.create_increment( - subscription_id, - request -) -print(result) -``` - - -# Create Usage - -Creates a usage - -```python -def create_usage(self, - subscription_id, - item_id, - body, - idempotency_key=None) -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `subscription_id` | `str` | Template, Required | Subscription Id | -| `item_id` | `str` | Template, Required | Item id | -| `body` | [`CreateUsageRequest`](../../doc/models/create-usage-request.md) | Body, Required | Request for creating a usage | -| `idempotency_key` | `str` | Header, Optional | - | - -## Response Type - -[`GetUsageResponse`](../../doc/models/get-usage-response.md) - -## Example Usage - -```python -subscription_id = 'subscription_id0' - -item_id = 'item_id0' - -body = CreateUsageRequest( - quantity=156, - description='description4', - used_at=dateutil.parser.parse('2016-03-13T12:52:32.123Z') -) - -result = subscriptions_controller.create_usage( - subscription_id, - item_id, - body -) -print(result) -``` - - -# Get Discount by Id - -```python -def get_discount_by_id(self, - subscription_id, - discount_id) -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `subscription_id` | `str` | Template, Required | The subscription id | -| `discount_id` | `str` | Template, Required | - | - -## Response Type - -[`GetDiscountResponse`](../../doc/models/get-discount-response.md) - -## Example Usage - -```python -subscription_id = 'subscription_id0' - -discount_id = 'discountId0' - -result = subscriptions_controller.get_discount_by_id( - subscription_id, - discount_id -) -print(result) -``` - - # Create Subscription Creates a new subscription @@ -781,55 +573,61 @@ print(result) ``` -# Get Increment by Id +# Update Subscription Affiliation Id ```python -def get_increment_by_id(self, - subscription_id, - increment_id) +def update_subscription_affiliation_id(self, + subscription_id, + request, + idempotency_key=None) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `str` | Template, Required | The subscription Id | -| `increment_id` | `str` | Template, Required | The increment Id | +| `subscription_id` | `str` | Template, Required | - | +| `request` | [`UpdateSubscriptionAffiliationIdRequest`](../../doc/models/update-subscription-affiliation-id-request.md) | Body, Required | Request for updating a subscription affiliation id | +| `idempotency_key` | `str` | Header, Optional | - | ## Response Type -[`GetIncrementResponse`](../../doc/models/get-increment-response.md) +[`GetSubscriptionResponse`](../../doc/models/get-subscription-response.md) ## Example Usage ```python subscription_id = 'subscription_id0' -increment_id = 'increment_id8' +request = UpdateSubscriptionAffiliationIdRequest( + gateway_affiliation_id='gateway_affiliation_id2' +) -result = subscriptions_controller.get_increment_by_id( +result = subscriptions_controller.update_subscription_affiliation_id( subscription_id, - increment_id + request ) print(result) ``` -# Update Subscription Affiliation Id +# Update Subscription Minium Price + +Atualização do valor mínimo da assinatura ```python -def update_subscription_affiliation_id(self, - subscription_id, - request, - idempotency_key=None) +def update_subscription_minium_price(self, + subscription_id, + request, + idempotency_key=None) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `str` | Template, Required | - | -| `request` | [`UpdateSubscriptionAffiliationIdRequest`](../../doc/models/update-subscription-affiliation-id-request.md) | Body, Required | Request for updating a subscription affiliation id | +| `subscription_id` | `str` | Template, Required | Subscription Id | +| `request` | [`UpdateSubscriptionMinimumPriceRequest`](../../doc/models/update-subscription-minimum-price-request.md) | Body, Required | Request da requisição com o valor mínimo que será configurado | | `idempotency_key` | `str` | Header, Optional | - | ## Response Type @@ -841,11 +639,9 @@ def update_subscription_affiliation_id(self, ```python subscription_id = 'subscription_id0' -request = UpdateSubscriptionAffiliationIdRequest( - gateway_affiliation_id='gateway_affiliation_id2' -) +request = UpdateSubscriptionMinimumPriceRequest() -result = subscriptions_controller.update_subscription_affiliation_id( +result = subscriptions_controller.update_subscription_minium_price( subscription_id, request ) @@ -853,15 +649,12 @@ print(result) ``` -# Update Subscription Metadata - -Updates the metadata from a subscription +# Get Subscription Cycle by Id ```python -def update_subscription_metadata(self, +def get_subscription_cycle_by_id(self, subscription_id, - request, - idempotency_key=None) + cycle_id) ``` ## Parameters @@ -869,116 +662,100 @@ def update_subscription_metadata(self, | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `subscription_id` | `str` | Template, Required | The subscription id | -| `request` | [`UpdateMetadataRequest`](../../doc/models/update-metadata-request.md) | Body, Required | Request for updating the subscrption metadata | -| `idempotency_key` | `str` | Header, Optional | - | +| `cycle_id` | `str` | Template, Required | - | ## Response Type -[`GetSubscriptionResponse`](../../doc/models/get-subscription-response.md) +[`GetPeriodResponse`](../../doc/models/get-period-response.md) ## Example Usage ```python subscription_id = 'subscription_id0' -request = UpdateMetadataRequest( - metadata={ - 'key0': 'metadata3' - } -) +cycle_id = 'cycleId0' -result = subscriptions_controller.update_subscription_metadata( +result = subscriptions_controller.get_subscription_cycle_by_id( subscription_id, - request + cycle_id ) print(result) ``` -# Delete Increment - -Deletes a increment +# Get Usage Report ```python -def delete_increment(self, +def get_usage_report(self, subscription_id, - increment_id, - idempotency_key=None) + period_id) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `str` | Template, Required | Subscription id | -| `increment_id` | `str` | Template, Required | Increment id | -| `idempotency_key` | `str` | Header, Optional | - | +| `subscription_id` | `str` | Template, Required | The subscription Id | +| `period_id` | `str` | Template, Required | The period Id | ## Response Type -[`GetIncrementResponse`](../../doc/models/get-increment-response.md) +[`GetUsageReportResponse`](../../doc/models/get-usage-report-response.md) ## Example Usage ```python subscription_id = 'subscription_id0' -increment_id = 'increment_id8' +period_id = 'period_id0' -result = subscriptions_controller.delete_increment( +result = subscriptions_controller.get_usage_report( subscription_id, - increment_id + period_id ) print(result) ``` -# Get Subscription Cycles +# Renew Subscription ```python -def get_subscription_cycles(self, - subscription_id, - page, - size) +def renew_subscription(self, + subscription_id, + idempotency_key=None) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `str` | Template, Required | Subscription Id | -| `page` | `str` | Query, Required | Page number | -| `size` | `str` | Query, Required | Page size | +| `subscription_id` | `str` | Template, Required | - | +| `idempotency_key` | `str` | Header, Optional | - | ## Response Type -[`ListCyclesResponse`](../../doc/models/list-cycles-response.md) +[`GetPeriodResponse`](../../doc/models/get-period-response.md) ## Example Usage ```python subscription_id = 'subscription_id0' -page = 'page8' - -size = 'size0' - -result = subscriptions_controller.get_subscription_cycles( - subscription_id, - page, - size -) +result = subscriptions_controller.renew_subscription(subscription_id) print(result) ``` -# Get Discounts +# Delete Usage + +Deletes a usage ```python -def get_discounts(self, - subscription_id, - page, - size) +def delete_usage(self, + subscription_id, + item_id, + usage_id, + idempotency_key=None) ``` ## Parameters @@ -986,271 +763,290 @@ def get_discounts(self, | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `subscription_id` | `str` | Template, Required | The subscription id | -| `page` | `int` | Query, Required | Page number | -| `size` | `int` | Query, Required | Page size | +| `item_id` | `str` | Template, Required | The subscription item id | +| `usage_id` | `str` | Template, Required | The usage id | +| `idempotency_key` | `str` | Header, Optional | - | ## Response Type -[`ListDiscountsResponse`](../../doc/models/list-discounts-response.md) +[`GetUsageResponse`](../../doc/models/get-usage-response.md) ## Example Usage ```python subscription_id = 'subscription_id0' -page = 30 +item_id = 'item_id0' -size = 18 +usage_id = 'usage_id0' -result = subscriptions_controller.get_discounts( +result = subscriptions_controller.delete_usage( subscription_id, - page, - size + item_id, + usage_id ) print(result) ``` -# Update Subscription Billing Date +# Create an Usage -Updates the billing date from a subscription +Create Usage ```python -def update_subscription_billing_date(self, - subscription_id, - request, - idempotency_key=None) +def create_an_usage(self, + subscription_id, + item_id, + idempotency_key=None) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `str` | Template, Required | The subscription id | -| `request` | [`UpdateSubscriptionBillingDateRequest`](../../doc/models/update-subscription-billing-date-request.md) | Body, Required | Request for updating the subscription billing date | +| `subscription_id` | `str` | Template, Required | Subscription id | +| `item_id` | `str` | Template, Required | Item id | | `idempotency_key` | `str` | Header, Optional | - | ## Response Type -[`GetSubscriptionResponse`](../../doc/models/get-subscription-response.md) +[`GetUsageResponse`](../../doc/models/get-usage-response.md) ## Example Usage ```python subscription_id = 'subscription_id0' -request = UpdateSubscriptionBillingDateRequest( - next_billing_at=dateutil.parser.parse('2016-03-13T12:52:32.123Z') -) +item_id = 'item_id0' -result = subscriptions_controller.update_subscription_billing_date( +result = subscriptions_controller.create_an_usage( subscription_id, - request + item_id ) print(result) ``` -# Delete Subscription Item - -Deletes a subscription item +# Update Current Cycle Status ```python -def delete_subscription_item(self, - subscription_id, - subscription_item_id, - idempotency_key=None) +def update_current_cycle_status(self, + subscription_id, + request, + idempotency_key=None) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `str` | Template, Required | Subscription id | -| `subscription_item_id` | `str` | Template, Required | Subscription item id | +| `subscription_id` | `str` | Template, Required | Subscription Id | +| `request` | [`UpdateCurrentCycleStatusRequest`](../../doc/models/update-current-cycle-status-request.md) | Body, Required | Request for updating the end date of the subscription current status | | `idempotency_key` | `str` | Header, Optional | - | ## Response Type -[`GetSubscriptionItemResponse`](../../doc/models/get-subscription-item-response.md) +`void` ## Example Usage ```python subscription_id = 'subscription_id0' -subscription_item_id = 'subscription_item_id4' +request = UpdateCurrentCycleStatusRequest( + status='status8' +) -result = subscriptions_controller.delete_subscription_item( +result = subscriptions_controller.update_current_cycle_status( subscription_id, - subscription_item_id + request ) print(result) ``` -# Get Increments +# Get Subscription Item + +Get Subscription Item ```python -def get_increments(self, - subscription_id, - page=None, - size=None) +def get_subscription_item(self, + subscription_id, + item_id) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `str` | Template, Required | The subscription id | -| `page` | `int` | Query, Optional | Page number | -| `size` | `int` | Query, Optional | Page size | +| `subscription_id` | `str` | Template, Required | Subscription Id | +| `item_id` | `str` | Template, Required | Item id | ## Response Type -[`ListIncrementsResponse`](../../doc/models/list-increments-response.md) +[`GetSubscriptionItemResponse`](../../doc/models/get-subscription-item-response.md) ## Example Usage ```python subscription_id = 'subscription_id0' -result = subscriptions_controller.get_increments(subscription_id) +item_id = 'item_id0' + +result = subscriptions_controller.get_subscription_item( + subscription_id, + item_id +) print(result) ``` -# Update Subscription Due Days - -Updates the boleto due days from a subscription +# Get Increment by Id ```python -def update_subscription_due_days(self, - subscription_id, - request, - idempotency_key=None) +def get_increment_by_id(self, + subscription_id, + increment_id) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `str` | Template, Required | Subscription Id | -| `request` | [`UpdateSubscriptionDueDaysRequest`](../../doc/models/update-subscription-due-days-request.md) | Body, Required | - | -| `idempotency_key` | `str` | Header, Optional | - | +| `subscription_id` | `str` | Template, Required | The subscription Id | +| `increment_id` | `str` | Template, Required | The increment Id | ## Response Type -[`GetSubscriptionResponse`](../../doc/models/get-subscription-response.md) +[`GetIncrementResponse`](../../doc/models/get-increment-response.md) ## Example Usage ```python subscription_id = 'subscription_id0' -request = UpdateSubscriptionDueDaysRequest( - boleto_due_days=226 -) +increment_id = 'increment_id8' -result = subscriptions_controller.update_subscription_due_days( +result = subscriptions_controller.get_increment_by_id( subscription_id, - request + increment_id ) print(result) ``` -# Update Subscription Start At +# Delete Increment -Updates the start at date from a subscription +Deletes a increment ```python -def update_subscription_start_at(self, - subscription_id, - request, - idempotency_key=None) +def delete_increment(self, + subscription_id, + increment_id, + idempotency_key=None) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `str` | Template, Required | The subscription id | -| `request` | [`UpdateSubscriptionStartAtRequest`](../../doc/models/update-subscription-start-at-request.md) | Body, Required | Request for updating the subscription start date | +| `subscription_id` | `str` | Template, Required | Subscription id | +| `increment_id` | `str` | Template, Required | Increment id | | `idempotency_key` | `str` | Header, Optional | - | ## Response Type -[`GetSubscriptionResponse`](../../doc/models/get-subscription-response.md) +[`GetIncrementResponse`](../../doc/models/get-increment-response.md) ## Example Usage ```python subscription_id = 'subscription_id0' -request = UpdateSubscriptionStartAtRequest( - start_at=dateutil.parser.parse('2016-03-13T12:52:32.123Z') -) +increment_id = 'increment_id8' -result = subscriptions_controller.update_subscription_start_at( +result = subscriptions_controller.delete_increment( subscription_id, - request + increment_id ) print(result) ``` -# Update Subscription Item - -Updates a subscription item +# Get Discounts ```python -def update_subscription_item(self, - subscription_id, - item_id, - body, - idempotency_key=None) +def get_discounts(self, + subscription_id, + page, + size) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `str` | Template, Required | Subscription Id | -| `item_id` | `str` | Template, Required | Item id | -| `body` | [`UpdateSubscriptionItemRequest`](../../doc/models/update-subscription-item-request.md) | Body, Required | Request for updating a subscription item | -| `idempotency_key` | `str` | Header, Optional | - | +| `subscription_id` | `str` | Template, Required | The subscription id | +| `page` | `int` | Query, Required | Page number | +| `size` | `int` | Query, Required | Page size | ## Response Type -[`GetSubscriptionItemResponse`](../../doc/models/get-subscription-item-response.md) +[`ListDiscountsResponse`](../../doc/models/list-discounts-response.md) ## Example Usage ```python subscription_id = 'subscription_id0' -item_id = 'item_id0' +page = 30 -body = UpdateSubscriptionItemRequest( - description='description4', - status='status2', - pricing_scheme=UpdatePricingSchemeRequest( - scheme_type='scheme_type8', - price_brackets=[ - UpdatePriceBracketRequest( - start_quantity=144, - price=174 - ) - ] - ), - name='name6' -) +size = 18 -result = subscriptions_controller.update_subscription_item( +result = subscriptions_controller.get_discounts( subscription_id, - item_id, - body + page, + size +) +print(result) +``` + + +# Update Subscription Due Days + +Updates the boleto due days from a subscription + +```python +def update_subscription_due_days(self, + subscription_id, + request, + idempotency_key=None) +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `subscription_id` | `str` | Template, Required | Subscription Id | +| `request` | [`UpdateSubscriptionDueDaysRequest`](../../doc/models/update-subscription-due-days-request.md) | Body, Required | - | +| `idempotency_key` | `str` | Header, Optional | - | + +## Response Type + +[`GetSubscriptionResponse`](../../doc/models/get-subscription-response.md) + +## Example Usage + +```python +subscription_id = 'subscription_id0' + +request = UpdateSubscriptionDueDaysRequest( + boleto_due_days=226 +) + +result = subscriptions_controller.update_subscription_due_days( + subscription_id, + request ) print(result) ``` @@ -1309,20 +1105,20 @@ print(result) ``` -# Get Subscription - -Gets a subscription +# Update Split Subscription ```python -def get_subscription(self, - subscription_id) +def update_split_subscription(self, + id, + request) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `str` | Template, Required | Subscription id | +| `id` | `str` | Template, Required | Subscription's id | +| `request` | [`UpdateSubscriptionSplitRequest`](../../doc/models/update-subscription-split-request.md) | Body, Required | - | ## Response Type @@ -1331,27 +1127,42 @@ def get_subscription(self, ## Example Usage ```python -subscription_id = 'subscription_id0' +id = 'id0' -result = subscriptions_controller.get_subscription(subscription_id) +request = UpdateSubscriptionSplitRequest( + enabled=False, + rules=[ + CreateSplitRequest( + mtype='type2', + amount=118, + recipient_id='recipient_id2' + ) + ] +) + +result = subscriptions_controller.update_split_subscription( + id, + request +) print(result) ``` -# Get Usages +# Get Subscription Items -Lists all usages from a subscription item +Get Subscription Items ```python -def get_usages(self, - subscription_id, - item_id, - page=None, - size=None, - code=None, - group=None, - used_since=None, - used_until=None) +def get_subscription_items(self, + subscription_id, + page=None, + size=None, + name=None, + code=None, + status=None, + description=None, + created_since=None, + created_until=None) ``` ## Parameters @@ -1359,86 +1170,218 @@ def get_usages(self, | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `subscription_id` | `str` | Template, Required | The subscription id | -| `item_id` | `str` | Template, Required | The subscription item id | | `page` | `int` | Query, Optional | Page number | | `size` | `int` | Query, Optional | Page size | +| `name` | `str` | Query, Optional | The item name | | `code` | `str` | Query, Optional | Identification code in the client system | -| `group` | `str` | Query, Optional | Identification group in the client system | -| `used_since` | `datetime` | Query, Optional | - | -| `used_until` | `datetime` | Query, Optional | - | +| `status` | `str` | Query, Optional | The item statis | +| `description` | `str` | Query, Optional | The item description | +| `created_since` | `str` | Query, Optional | Filter for item's creation date start range | +| `created_until` | `str` | Query, Optional | Filter for item's creation date end range | ## Response Type -[`ListUsagesResponse`](../../doc/models/list-usages-response.md) +[`ListSubscriptionItemsResponse`](../../doc/models/list-subscription-items-response.md) ## Example Usage ```python subscription_id = 'subscription_id0' -item_id = 'item_id0' +result = subscriptions_controller.get_subscription_items(subscription_id) +print(result) +``` + + +# Get Subscriptions + +Gets all subscriptions + +```python +def get_subscriptions(self, + page=None, + size=None, + code=None, + billing_type=None, + customer_id=None, + plan_id=None, + card_id=None, + status=None, + next_billing_since=None, + next_billing_until=None, + created_since=None, + created_until=None) +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `page` | `int` | Query, Optional | Page number | +| `size` | `int` | Query, Optional | Page size | +| `code` | `str` | Query, Optional | Filter for subscription's code | +| `billing_type` | `str` | Query, Optional | Filter for subscription's billing type | +| `customer_id` | `str` | Query, Optional | Filter for subscription's customer id | +| `plan_id` | `str` | Query, Optional | Filter for subscription's plan id | +| `card_id` | `str` | Query, Optional | Filter for subscription's card id | +| `status` | `str` | Query, Optional | Filter for subscription's status | +| `next_billing_since` | `datetime` | Query, Optional | Filter for subscription's next billing date start range | +| `next_billing_until` | `datetime` | Query, Optional | Filter for subscription's next billing date end range | +| `created_since` | `datetime` | Query, Optional | Filter for subscription's creation date start range | +| `created_until` | `datetime` | Query, Optional | Filter for subscriptions creation date end range | + +## Response Type + +[`ListSubscriptionsResponse`](../../doc/models/list-subscriptions-response.md) + +## Example Usage + +```python +result = subscriptions_controller.get_subscriptions() +print(result) +``` + + +# Create Increment + +Creates a increment + +```python +def create_increment(self, + subscription_id, + request, + idempotency_key=None) +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `subscription_id` | `str` | Template, Required | Subscription id | +| `request` | [`CreateIncrementRequest`](../../doc/models/create-increment-request.md) | Body, Required | Request for creating a increment | +| `idempotency_key` | `str` | Header, Optional | - | + +## Response Type + +[`GetIncrementResponse`](../../doc/models/get-increment-response.md) + +## Example Usage + +```python +subscription_id = 'subscription_id0' -result = subscriptions_controller.get_usages( +request = CreateIncrementRequest( + value=185.28, + increment_type='increment_type8', + item_id='item_id6' +) + +result = subscriptions_controller.create_increment( subscription_id, - item_id + request ) print(result) ``` -# Update Latest Period End At +# Create Usage + +Creates a usage ```python -def update_latest_period_end_at(self, - subscription_id, - request, - idempotency_key=None) +def create_usage(self, + subscription_id, + item_id, + body, + idempotency_key=None) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `str` | Template, Required | - | -| `request` | [`UpdateCurrentCycleEndDateRequest`](../../doc/models/update-current-cycle-end-date-request.md) | Body, Required | Request for updating the end date of the current signature cycle | +| `subscription_id` | `str` | Template, Required | Subscription Id | +| `item_id` | `str` | Template, Required | Item id | +| `body` | [`CreateUsageRequest`](../../doc/models/create-usage-request.md) | Body, Required | Request for creating a usage | | `idempotency_key` | `str` | Header, Optional | - | ## Response Type -[`GetSubscriptionResponse`](../../doc/models/get-subscription-response.md) +[`GetUsageResponse`](../../doc/models/get-usage-response.md) ## Example Usage ```python subscription_id = 'subscription_id0' -request = UpdateCurrentCycleEndDateRequest() +item_id = 'item_id0' -result = subscriptions_controller.update_latest_period_end_at( +body = CreateUsageRequest( + quantity=156, + description='description4', + used_at=dateutil.parser.parse('2016-03-13T12:52:32.123Z') +) + +result = subscriptions_controller.create_usage( subscription_id, - request + item_id, + body ) print(result) ``` -# Update Subscription Minium Price +# Get Discount by Id -Atualização do valor mínimo da assinatura +```python +def get_discount_by_id(self, + subscription_id, + discount_id) +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `subscription_id` | `str` | Template, Required | The subscription id | +| `discount_id` | `str` | Template, Required | - | + +## Response Type + +[`GetDiscountResponse`](../../doc/models/get-discount-response.md) + +## Example Usage ```python -def update_subscription_minium_price(self, - subscription_id, - request, - idempotency_key=None) +subscription_id = 'subscription_id0' + +discount_id = 'discountId0' + +result = subscriptions_controller.get_discount_by_id( + subscription_id, + discount_id +) +print(result) +``` + + +# Update Subscription Metadata + +Updates the metadata from a subscription + +```python +def update_subscription_metadata(self, + subscription_id, + request, + idempotency_key=None) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `str` | Template, Required | Subscription Id | -| `request` | [`UpdateSubscriptionMinimumPriceRequest`](../../doc/models/update-subscription-minimum-price-request.md) | Body, Required | Request da requisição com o valor mínimo que será configurado | +| `subscription_id` | `str` | Template, Required | The subscription id | +| `request` | [`UpdateMetadataRequest`](../../doc/models/update-metadata-request.md) | Body, Required | Request for updating the subscrption metadata | | `idempotency_key` | `str` | Header, Optional | - | ## Response Type @@ -1450,9 +1393,13 @@ def update_subscription_minium_price(self, ```python subscription_id = 'subscription_id0' -request = UpdateSubscriptionMinimumPriceRequest() +request = UpdateMetadataRequest( + metadata={ + 'key0': 'metadata3' + } +) -result = subscriptions_controller.update_subscription_minium_price( +result = subscriptions_controller.update_subscription_metadata( subscription_id, request ) @@ -1460,112 +1407,165 @@ print(result) ``` -# Get Subscription Cycle by Id +# Get Subscription Cycles ```python -def get_subscription_cycle_by_id(self, - subscription_id, - cycle_id) +def get_subscription_cycles(self, + subscription_id, + page, + size) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `str` | Template, Required | The subscription id | -| `cycle_id` | `str` | Template, Required | - | +| `subscription_id` | `str` | Template, Required | Subscription Id | +| `page` | `str` | Query, Required | Page number | +| `size` | `str` | Query, Required | Page size | ## Response Type -[`GetPeriodResponse`](../../doc/models/get-period-response.md) +[`ListCyclesResponse`](../../doc/models/list-cycles-response.md) ## Example Usage ```python subscription_id = 'subscription_id0' -cycle_id = 'cycleId0' +page = 'page8' -result = subscriptions_controller.get_subscription_cycle_by_id( +size = 'size0' + +result = subscriptions_controller.get_subscription_cycles( subscription_id, - cycle_id + page, + size ) print(result) ``` -# Get Usage Report +# Delete Subscription Item + +Deletes a subscription item ```python -def get_usage_report(self, - subscription_id, - period_id) +def delete_subscription_item(self, + subscription_id, + subscription_item_id, + idempotency_key=None) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `str` | Template, Required | The subscription Id | -| `period_id` | `str` | Template, Required | The period Id | +| `subscription_id` | `str` | Template, Required | Subscription id | +| `subscription_item_id` | `str` | Template, Required | Subscription item id | +| `idempotency_key` | `str` | Header, Optional | - | ## Response Type -[`GetUsageReportResponse`](../../doc/models/get-usage-report-response.md) +[`GetSubscriptionItemResponse`](../../doc/models/get-subscription-item-response.md) ## Example Usage ```python subscription_id = 'subscription_id0' -period_id = 'period_id0' +subscription_item_id = 'subscription_item_id4' -result = subscriptions_controller.get_usage_report( +result = subscriptions_controller.delete_subscription_item( subscription_id, - period_id + subscription_item_id ) print(result) ``` -# Update Split Subscription +# Get Increments ```python -def update_split_subscription(self, - id, - request) +def get_increments(self, + subscription_id, + page=None, + size=None) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `id` | `str` | Template, Required | Subscription's id | -| `request` | [`UpdateSubscriptionSplitRequest`](../../doc/models/update-subscription-split-request.md) | Body, Required | - | +| `subscription_id` | `str` | Template, Required | The subscription id | +| `page` | `int` | Query, Optional | Page number | +| `size` | `int` | Query, Optional | Page size | ## Response Type -[`GetSubscriptionResponse`](../../doc/models/get-subscription-response.md) +[`ListIncrementsResponse`](../../doc/models/list-increments-response.md) ## Example Usage ```python -id = 'id0' +subscription_id = 'subscription_id0' -request = UpdateSubscriptionSplitRequest( - enabled=False, - rules=[ - CreateSplitRequest( - mtype='type2', - amount=118, - recipient_id='recipient_id2' - ) - ] +result = subscriptions_controller.get_increments(subscription_id) +print(result) +``` + + +# Update Subscription Item + +Updates a subscription item + +```python +def update_subscription_item(self, + subscription_id, + item_id, + body, + idempotency_key=None) +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `subscription_id` | `str` | Template, Required | Subscription Id | +| `item_id` | `str` | Template, Required | Item id | +| `body` | [`UpdateSubscriptionItemRequest`](../../doc/models/update-subscription-item-request.md) | Body, Required | Request for updating a subscription item | +| `idempotency_key` | `str` | Header, Optional | - | + +## Response Type + +[`GetSubscriptionItemResponse`](../../doc/models/get-subscription-item-response.md) + +## Example Usage + +```python +subscription_id = 'subscription_id0' + +item_id = 'item_id0' + +body = UpdateSubscriptionItemRequest( + description='description4', + status='status2', + pricing_scheme=UpdatePricingSchemeRequest( + scheme_type='scheme_type8', + price_brackets=[ + UpdatePriceBracketRequest( + start_quantity=144, + price=174 + ) + ] + ), + name='name6' ) -result = subscriptions_controller.update_split_subscription( - id, - request +result = subscriptions_controller.update_subscription_item( + subscription_id, + item_id, + body ) print(result) ``` diff --git a/doc/controllers/tokens.md b/doc/controllers/tokens.md index 12beef3..e1d5ab3 100644 --- a/doc/controllers/tokens.md +++ b/doc/controllers/tokens.md @@ -10,28 +10,28 @@ tokens_controller = client.tokens ## Methods -* [Create Token](../../doc/controllers/tokens.md#create-token) -* [Get Token](../../doc/controllers/tokens.md#get-token) +* [Get Token](../../doc/controllers/tokens.md#get-token) +* [Create Token](../../doc/controllers/tokens.md#create-token) -# Create Token +# Get Token + +Gets a token from its id :information_source: **Note** This endpoint does not require authentication. ```python -def create_token(self, - public_key, - request, - idempotency_key=None) +def get_token(self, + id, + public_key) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | +| `id` | `str` | Template, Required | Token id | | `public_key` | `str` | Template, Required | Public key | -| `request` | [`CreateTokenRequest`](../../doc/models/create-token-request.md) | Body, Required | Request for creating a token | -| `idempotency_key` | `str` | Header, Optional | - | ## Response Type @@ -40,47 +40,36 @@ def create_token(self, ## Example Usage ```python -public_key = 'public_key6' +id = 'id0' -request = CreateTokenRequest( - mtype='card', - card=CreateCardTokenRequest( - number='number6', - holder_name='holder_name2', - exp_month=228, - exp_year=68, - cvv='cvv4', - brand='brand0', - label='label6' - ) -) +public_key = 'public_key6' -result = tokens_controller.create_token( - public_key, - request +result = tokens_controller.get_token( + id, + public_key ) print(result) ``` -# Get Token - -Gets a token from its id +# Create Token :information_source: **Note** This endpoint does not require authentication. ```python -def get_token(self, - id, - public_key) +def create_token(self, + public_key, + request, + idempotency_key=None) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `id` | `str` | Template, Required | Token id | | `public_key` | `str` | Template, Required | Public key | +| `request` | [`CreateTokenRequest`](../../doc/models/create-token-request.md) | Body, Required | Request for creating a token | +| `idempotency_key` | `str` | Header, Optional | - | ## Response Type @@ -89,13 +78,24 @@ def get_token(self, ## Example Usage ```python -id = 'id0' - public_key = 'public_key6' -result = tokens_controller.get_token( - id, - public_key +request = CreateTokenRequest( + mtype='card', + card=CreateCardTokenRequest( + number='number6', + holder_name='holder_name2', + exp_month=228, + exp_year=68, + cvv='cvv4', + brand='brand0', + label='label6' + ) +) + +result = tokens_controller.create_token( + public_key, + request ) print(result) ``` diff --git a/doc/controllers/transfers.md b/doc/controllers/transfers.md index c5674cb..84c3e57 100644 --- a/doc/controllers/transfers.md +++ b/doc/controllers/transfers.md @@ -11,8 +11,8 @@ transfers_controller = client.transfers ## Methods * [Get Transfer by Id](../../doc/controllers/transfers.md#get-transfer-by-id) -* [Create Transfer](../../doc/controllers/transfers.md#create-transfer) -* [Get Transfers](../../doc/controllers/transfers.md#get-transfers) +* [Get Transfers](../../doc/controllers/transfers.md#get-transfers) +* [Create Transfer](../../doc/controllers/transfers.md#create-transfer) # Get Transfer by Id @@ -42,6 +42,26 @@ print(result) ``` +# Get Transfers + +Gets all transfers + +```python +def get_transfers(self) +``` + +## Response Type + +[`ListTransfers`](../../doc/models/list-transfers.md) + +## Example Usage + +```python +result = transfers_controller.get_transfers() +print(result) +``` + + # Create Transfer ```python @@ -72,23 +92,3 @@ result = transfers_controller.create_transfer(request) print(result) ``` - -# Get Transfers - -Gets all transfers - -```python -def get_transfers(self) -``` - -## Response Type - -[`ListTransfers`](../../doc/models/list-transfers.md) - -## Example Usage - -```python -result = transfers_controller.get_transfers() -print(result) -``` - diff --git a/doc/models/create-managing-partner-request.md b/doc/models/create-managing-partner-request.md index 1600995..cf59ad9 100644 --- a/doc/models/create-managing-partner-request.md +++ b/doc/models/create-managing-partner-request.md @@ -16,7 +16,7 @@ Managing Partner Request | `document` | `str` | Required | - | | `mother_name` | `str` | Optional | - | | `birthdate` | `str` | Required | - | -| `monthly_income` | `int` | Required | - | +| `monthly_income` | `long\|int` | Required | - | | `professional_occupation` | `str` | Required | - | | `self_declared_legal_representative` | `bool` | Required | - | | `address` | [`CreateRegisterInformationAddressRequest`](../../doc/models/create-register-information-address-request.md) | Required | - | diff --git a/doc/models/create-register-information-corporation-request.md b/doc/models/create-register-information-corporation-request.md index e0b4a83..cb09cc6 100644 --- a/doc/models/create-register-information-corporation-request.md +++ b/doc/models/create-register-information-corporation-request.md @@ -15,7 +15,7 @@ | --- | --- | --- | --- | | `company_name` | `str` | Required | - | | `trading_name` | `str` | Required | - | -| `annual_revenue` | `int` | Required | - | +| `annual_revenue` | `long\|int` | Required | - | | `corporation_type` | `str` | Optional | - | | `founding_date` | `str` | Optional | - | | `cnae` | `str` | Optional | - | diff --git a/doc/models/create-register-information-individual-request.md b/doc/models/create-register-information-individual-request.md index a19d5a1..7ab9e80 100644 --- a/doc/models/create-register-information-individual-request.md +++ b/doc/models/create-register-information-individual-request.md @@ -16,7 +16,7 @@ | `name` | `str` | Required | - | | `mother_name` | `str` | Optional | - | | `birthdate` | `str` | Required | - | -| `monthly_income` | `int` | Required | - | +| `monthly_income` | `long\|int` | Required | - | | `professional_occupation` | `str` | Required | - | | `address` | [`CreateRegisterInformationAddressRequest`](../../doc/models/create-register-information-address-request.md) | Required | - | diff --git a/pagarmeapisdk/controllers/balance_operations_controller.py b/pagarmeapisdk/controllers/balance_operations_controller.py index 698c663..874c006 100644 --- a/pagarmeapisdk/controllers/balance_operations_controller.py +++ b/pagarmeapisdk/controllers/balance_operations_controller.py @@ -15,8 +15,8 @@ from apimatic_core.types.parameter import Parameter from pagarmeapisdk.http.http_method_enum import HttpMethodEnum from apimatic_core.authentication.multiple.single_auth import Single -from pagarmeapisdk.models.list_balance_operation_response import ListBalanceOperationResponse from pagarmeapisdk.models.get_balance_operation_response import GetBalanceOperationResponse +from pagarmeapisdk.models.list_balance_operation_response import ListBalanceOperationResponse class BalanceOperationsController(BaseController): @@ -25,23 +25,17 @@ class BalanceOperationsController(BaseController): def __init__(self, config): super(BalanceOperationsController, self).__init__(config) - def get_balance_operations(self, - status=None, - created_since=None, - created_until=None, - recipient_id=None): - """Does a GET request to /balance/operations. + def get_balance_operation_by_id(self, + id): + """Does a GET request to /balance/operations/{id}. TODO: type endpoint description here. Args: - status (str, optional): TODO: type description here. - created_since (datetime, optional): TODO: type description here. - created_until (datetime, optional): TODO: type description here. - recipient_id (str, optional): TODO: type description here. + id (long|int): TODO: type description here. Returns: - ListBalanceOperationResponse: Response from the API. + GetBalanceOperationResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -53,20 +47,12 @@ def get_balance_operations(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/balance/operations') + .path('/balance/operations/{id}') .http_method(HttpMethodEnum.GET) - .query_param(Parameter() - .key('status') - .value(status)) - .query_param(Parameter() - .key('created_since') - .value(APIHelper.when_defined(APIHelper.RFC3339DateTime, created_since))) - .query_param(Parameter() - .key('created_until') - .value(APIHelper.when_defined(APIHelper.RFC3339DateTime, created_until))) - .query_param(Parameter() - .key('recipient_id') - .value(recipient_id)) + .template_param(Parameter() + .key('id') + .value(id) + .should_encode(True)) .header_param(Parameter() .key('accept') .value('application/json')) @@ -74,20 +60,26 @@ def get_balance_operations(self, ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) - .deserialize_into(ListBalanceOperationResponse.from_dictionary) + .deserialize_into(GetBalanceOperationResponse.from_dictionary) ).execute() - def get_balance_operation_by_id(self, - id): - """Does a GET request to /balance/operations/{id}. + def get_balance_operations(self, + status=None, + created_since=None, + created_until=None, + recipient_id=None): + """Does a GET request to /balance/operations. TODO: type endpoint description here. Args: - id (long|int): TODO: type description here. + status (str, optional): TODO: type description here. + created_since (datetime, optional): TODO: type description here. + created_until (datetime, optional): TODO: type description here. + recipient_id (str, optional): TODO: type description here. Returns: - GetBalanceOperationResponse: Response from the API. + ListBalanceOperationResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -99,12 +91,20 @@ def get_balance_operation_by_id(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/balance/operations/{id}') + .path('/balance/operations') .http_method(HttpMethodEnum.GET) - .template_param(Parameter() - .key('id') - .value(id) - .should_encode(True)) + .query_param(Parameter() + .key('status') + .value(status)) + .query_param(Parameter() + .key('created_since') + .value(APIHelper.when_defined(APIHelper.RFC3339DateTime, created_since))) + .query_param(Parameter() + .key('created_until') + .value(APIHelper.when_defined(APIHelper.RFC3339DateTime, created_until))) + .query_param(Parameter() + .key('recipient_id') + .value(recipient_id)) .header_param(Parameter() .key('accept') .value('application/json')) @@ -112,5 +112,5 @@ def get_balance_operation_by_id(self, ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) - .deserialize_into(GetBalanceOperationResponse.from_dictionary) + .deserialize_into(ListBalanceOperationResponse.from_dictionary) ).execute() diff --git a/pagarmeapisdk/controllers/charges_controller.py b/pagarmeapisdk/controllers/charges_controller.py index 7942dad..d26874b 100644 --- a/pagarmeapisdk/controllers/charges_controller.py +++ b/pagarmeapisdk/controllers/charges_controller.py @@ -17,8 +17,8 @@ from apimatic_core.authentication.multiple.single_auth import Single from pagarmeapisdk.models.get_charge_response import GetChargeResponse from pagarmeapisdk.models.list_charge_transactions_response import ListChargeTransactionsResponse -from pagarmeapisdk.models.list_charges_response import ListChargesResponse from pagarmeapisdk.models.get_charges_summary_response import GetChargesSummaryResponse +from pagarmeapisdk.models.list_charges_response import ListChargesResponse class ChargesController(BaseController): @@ -79,18 +79,18 @@ def update_charge_metadata(self, .deserialize_into(GetChargeResponse.from_dictionary) ).execute() - def update_charge_payment_method(self, - charge_id, - request, - idempotency_key=None): - """Does a PATCH request to /charges/{charge_id}/payment-method. + def capture_charge(self, + charge_id, + request=None, + idempotency_key=None): + """Does a POST request to /charges/{charge_id}/capture. - Updates a charge's payment method + Captures a charge Args: charge_id (str): Charge id - request (UpdateChargePaymentMethodRequest): Request for updating - the payment method from a charge + request (CreateCaptureChargeRequest, optional): Request for + capturing a charge idempotency_key (str, optional): TODO: type description here. Returns: @@ -106,8 +106,8 @@ def update_charge_payment_method(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/charges/{charge_id}/payment-method') - .http_method(HttpMethodEnum.PATCH) + .path('/charges/{charge_id}/capture') + .http_method(HttpMethodEnum.POST) .template_param(Parameter() .key('charge_id') .value(charge_id) @@ -131,21 +131,17 @@ def update_charge_payment_method(self, .deserialize_into(GetChargeResponse.from_dictionary) ).execute() - def get_charge_transactions(self, - charge_id, - page=None, - size=None): - """Does a GET request to /charges/{charge_id}/transactions. + def get_charge(self, + charge_id): + """Does a GET request to /charges/{charge_id}. - TODO: type endpoint description here. + Get a charge from its id Args: - charge_id (str): Charge Id - page (int, optional): Page number - size (int, optional): Page size + charge_id (str): Charge id Returns: - ListChargeTransactionsResponse: Response from the API. + GetChargeResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -157,18 +153,12 @@ def get_charge_transactions(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/charges/{charge_id}/transactions') + .path('/charges/{charge_id}') .http_method(HttpMethodEnum.GET) .template_param(Parameter() .key('charge_id') .value(charge_id) .should_encode(True)) - .query_param(Parameter() - .key('page') - .value(page)) - .query_param(Parameter() - .key('size') - .value(size)) .header_param(Parameter() .key('accept') .value('application/json')) @@ -176,21 +166,21 @@ def get_charge_transactions(self, ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) - .deserialize_into(ListChargeTransactionsResponse.from_dictionary) + .deserialize_into(GetChargeResponse.from_dictionary) ).execute() - def update_charge_due_date(self, - charge_id, - request, - idempotency_key=None): - """Does a PATCH request to /Charges/{charge_id}/due-date. + def confirm_payment(self, + charge_id, + request=None, + idempotency_key=None): + """Does a POST request to /charges/{charge_id}/confirm-payment. - Updates the due date from a charge + TODO: type endpoint description here. Args: - charge_id (str): Charge Id - request (UpdateChargeDueDateRequest): Request for updating the due - date + charge_id (str): TODO: type description here. + request (CreateConfirmPaymentRequest, optional): Request for + confirm payment idempotency_key (str, optional): TODO: type description here. Returns: @@ -206,8 +196,8 @@ def update_charge_due_date(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/Charges/{charge_id}/due-date') - .http_method(HttpMethodEnum.PATCH) + .path('/charges/{charge_id}/confirm-payment') + .http_method(HttpMethodEnum.POST) .template_param(Parameter() .key('charge_id') .value(charge_id) @@ -231,36 +221,21 @@ def update_charge_due_date(self, .deserialize_into(GetChargeResponse.from_dictionary) ).execute() - 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. + def get_charge_transactions(self, + charge_id, + page=None, + size=None): + """Does a GET request to /charges/{charge_id}/transactions. - Lists all charges + TODO: type endpoint description here. Args: + charge_id (str): Charge Id page (int, optional): Page number size (int, optional): Page size - code (str, optional): Filter for charge's code - status (str, optional): Filter for charge's status - payment_method (str, optional): Filter for charge's payment - method - customer_id (str, optional): Filter for charge's customer id - order_id (str, 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. + ListChargeTransactionsResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -272,35 +247,18 @@ def get_charges(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/charges') + .path('/charges/{charge_id}/transactions') .http_method(HttpMethodEnum.GET) + .template_param(Parameter() + .key('charge_id') + .value(charge_id) + .should_encode(True)) .query_param(Parameter() .key('page') .value(page)) .query_param(Parameter() .key('size') .value(size)) - .query_param(Parameter() - .key('code') - .value(code)) - .query_param(Parameter() - .key('status') - .value(status)) - .query_param(Parameter() - .key('payment_method') - .value(payment_method)) - .query_param(Parameter() - .key('customer_id') - .value(customer_id)) - .query_param(Parameter() - .key('order_id') - .value(order_id)) - .query_param(Parameter() - .key('created_since') - .value(APIHelper.when_defined(APIHelper.RFC3339DateTime, created_since))) - .query_param(Parameter() - .key('created_until') - .value(APIHelper.when_defined(APIHelper.RFC3339DateTime, created_until))) .header_param(Parameter() .key('accept') .value('application/json')) @@ -308,21 +266,21 @@ def get_charges(self, ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) - .deserialize_into(ListChargesResponse.from_dictionary) + .deserialize_into(ListChargeTransactionsResponse.from_dictionary) ).execute() - def capture_charge(self, - charge_id, - request=None, - idempotency_key=None): - """Does a POST request to /charges/{charge_id}/capture. + def update_charge_card(self, + charge_id, + request, + idempotency_key=None): + """Does a PATCH request to /charges/{charge_id}/card. - Captures a charge + Updates the card from a charge Args: charge_id (str): Charge id - request (CreateCaptureChargeRequest, optional): Request for - capturing a charge + request (UpdateChargeCardRequest): Request for updating a charge's + card idempotency_key (str, optional): TODO: type description here. Returns: @@ -338,8 +296,8 @@ def capture_charge(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/charges/{charge_id}/capture') - .http_method(HttpMethodEnum.POST) + .path('/charges/{charge_id}/card') + .http_method(HttpMethodEnum.PATCH) .template_param(Parameter() .key('charge_id') .value(charge_id) @@ -363,18 +321,63 @@ def capture_charge(self, .deserialize_into(GetChargeResponse.from_dictionary) ).execute() - def update_charge_card(self, - charge_id, - request, - idempotency_key=None): - """Does a PATCH request to /charges/{charge_id}/card. + def create_charge(self, + request, + idempotency_key=None): + """Does a POST request to /Charges. - Updates the card from a charge + Creates a new charge + + Args: + request (CreateChargeRequest): Request for creating a charge + idempotency_key (str, optional): TODO: type description here. + + 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. + + """ + + return super().new_api_call_builder.request( + RequestBuilder().server(Server.DEFAULT) + .path('/Charges') + .http_method(HttpMethodEnum.POST) + .body_param(Parameter() + .value(request)) + .header_param(Parameter() + .key('idempotency-key') + .value(idempotency_key)) + .header_param(Parameter() + .key('content-type') + .value('application/json; charset=utf-8')) + .header_param(Parameter() + .key('accept') + .value('application/json')) + .body_serializer(APIHelper.json_serialize) + .auth(Single('httpBasic')) + ).response( + ResponseHandler() + .deserializer(APIHelper.json_deserialize) + .deserialize_into(GetChargeResponse.from_dictionary) + ).execute() + + 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 (str): Charge id - request (UpdateChargeCardRequest): Request for updating a charge's - card + request (UpdateChargePaymentMethodRequest): Request for updating + the payment method from a charge idempotency_key (str, optional): TODO: type description here. Returns: @@ -390,7 +393,7 @@ def update_charge_card(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/charges/{charge_id}/card') + .path('/charges/{charge_id}/payment-method') .http_method(HttpMethodEnum.PATCH) .template_param(Parameter() .key('charge_id') @@ -415,14 +418,19 @@ def update_charge_card(self, .deserialize_into(GetChargeResponse.from_dictionary) ).execute() - def get_charge(self, - charge_id): - """Does a GET request to /charges/{charge_id}. + def update_charge_due_date(self, + charge_id, + request, + idempotency_key=None): + """Does a PATCH request to /Charges/{charge_id}/due-date. - Get a charge from its id + Updates the due date from a charge Args: - charge_id (str): Charge id + charge_id (str): Charge Id + request (UpdateChargeDueDateRequest): Request for updating the due + date + idempotency_key (str, optional): TODO: type description here. Returns: GetChargeResponse: Response from the API. @@ -437,15 +445,24 @@ def get_charge(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/charges/{charge_id}') - .http_method(HttpMethodEnum.GET) + .path('/Charges/{charge_id}/due-date') + .http_method(HttpMethodEnum.PATCH) .template_param(Parameter() .key('charge_id') .value(charge_id) .should_encode(True)) + .body_param(Parameter() + .value(request)) + .header_param(Parameter() + .key('idempotency-key') + .value(idempotency_key)) + .header_param(Parameter() + .key('content-type') + .value('application/json; charset=utf-8')) .header_param(Parameter() .key('accept') .value('application/json')) + .body_serializer(APIHelper.json_serialize) .auth(Single('httpBasic')) ).response( ResponseHandler() @@ -543,22 +560,36 @@ def retry_charge(self, .deserialize_into(GetChargeResponse.from_dictionary) ).execute() - def cancel_charge(self, - charge_id, - request=None, - idempotency_key=None): - """Does a DELETE request to /charges/{charge_id}. + 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. - Cancel a charge + Lists all charges Args: - charge_id (str): Charge id - request (CreateCancelChargeRequest, optional): Request for - cancelling a charge - idempotency_key (str, optional): TODO: type description here. + page (int, optional): Page number + size (int, optional): Page size + code (str, optional): Filter for charge's code + status (str, optional): Filter for charge's status + payment_method (str, optional): Filter for charge's payment + method + customer_id (str, optional): Filter for charge's customer id + order_id (str, 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: - GetChargeResponse: Response from the API. + ListChargesResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -570,88 +601,57 @@ def cancel_charge(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/charges/{charge_id}') - .http_method(HttpMethodEnum.DELETE) - .template_param(Parameter() - .key('charge_id') - .value(charge_id) - .should_encode(True)) - .body_param(Parameter() - .value(request)) - .header_param(Parameter() - .key('idempotency-key') - .value(idempotency_key)) - .header_param(Parameter() - .key('content-type') - .value('application/json; charset=utf-8')) + .path('/charges') + .http_method(HttpMethodEnum.GET) + .query_param(Parameter() + .key('page') + .value(page)) + .query_param(Parameter() + .key('size') + .value(size)) + .query_param(Parameter() + .key('code') + .value(code)) + .query_param(Parameter() + .key('status') + .value(status)) + .query_param(Parameter() + .key('payment_method') + .value(payment_method)) + .query_param(Parameter() + .key('customer_id') + .value(customer_id)) + .query_param(Parameter() + .key('order_id') + .value(order_id)) + .query_param(Parameter() + .key('created_since') + .value(APIHelper.when_defined(APIHelper.RFC3339DateTime, created_since))) + .query_param(Parameter() + .key('created_until') + .value(APIHelper.when_defined(APIHelper.RFC3339DateTime, created_until))) .header_param(Parameter() .key('accept') .value('application/json')) - .body_serializer(APIHelper.json_serialize) .auth(Single('httpBasic')) ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) - .deserialize_into(GetChargeResponse.from_dictionary) + .deserialize_into(ListChargesResponse.from_dictionary) ).execute() - def create_charge(self, - request, + def cancel_charge(self, + charge_id, + request=None, idempotency_key=None): - """Does a POST request to /Charges. - - Creates a new charge - - Args: - request (CreateChargeRequest): Request for creating a charge - idempotency_key (str, optional): TODO: type description here. - - 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. - - """ - - return super().new_api_call_builder.request( - RequestBuilder().server(Server.DEFAULT) - .path('/Charges') - .http_method(HttpMethodEnum.POST) - .body_param(Parameter() - .value(request)) - .header_param(Parameter() - .key('idempotency-key') - .value(idempotency_key)) - .header_param(Parameter() - .key('content-type') - .value('application/json; charset=utf-8')) - .header_param(Parameter() - .key('accept') - .value('application/json')) - .body_serializer(APIHelper.json_serialize) - .auth(Single('httpBasic')) - ).response( - ResponseHandler() - .deserializer(APIHelper.json_deserialize) - .deserialize_into(GetChargeResponse.from_dictionary) - ).execute() - - def confirm_payment(self, - charge_id, - request=None, - idempotency_key=None): - """Does a POST request to /charges/{charge_id}/confirm-payment. + """Does a DELETE request to /charges/{charge_id}. - TODO: type endpoint description here. + Cancel a charge Args: - charge_id (str): TODO: type description here. - request (CreateConfirmPaymentRequest, optional): Request for - confirm payment + charge_id (str): Charge id + request (CreateCancelChargeRequest, optional): Request for + cancelling a charge idempotency_key (str, optional): TODO: type description here. Returns: @@ -667,8 +667,8 @@ def confirm_payment(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/charges/{charge_id}/confirm-payment') - .http_method(HttpMethodEnum.POST) + .path('/charges/{charge_id}') + .http_method(HttpMethodEnum.DELETE) .template_param(Parameter() .key('charge_id') .value(charge_id) diff --git a/pagarmeapisdk/controllers/customers_controller.py b/pagarmeapisdk/controllers/customers_controller.py index ebfcfdd..abf8e97 100644 --- a/pagarmeapisdk/controllers/customers_controller.py +++ b/pagarmeapisdk/controllers/customers_controller.py @@ -15,14 +15,14 @@ from apimatic_core.types.parameter import Parameter from pagarmeapisdk.http.http_method_enum import HttpMethodEnum from apimatic_core.authentication.multiple.single_auth import Single -from pagarmeapisdk.models.get_card_response import GetCardResponse from pagarmeapisdk.models.get_address_response import GetAddressResponse +from pagarmeapisdk.models.get_card_response import GetCardResponse from pagarmeapisdk.models.get_access_token_response import GetAccessTokenResponse from pagarmeapisdk.models.get_customer_response import GetCustomerResponse from pagarmeapisdk.models.list_access_tokens_response import ListAccessTokensResponse from pagarmeapisdk.models.list_customers_response import ListCustomersResponse -from pagarmeapisdk.models.list_cards_response import ListCardsResponse from pagarmeapisdk.models.list_addresses_response import ListAddressesResponse +from pagarmeapisdk.models.list_cards_response import ListCardsResponse class CustomersController(BaseController): @@ -31,23 +31,21 @@ class CustomersController(BaseController): def __init__(self, config): super(CustomersController, self).__init__(config) - def update_card(self, - customer_id, - card_id, - request, - idempotency_key=None): - """Does a PUT request to /customers/{customer_id}/cards/{card_id}. + def create_address(self, + customer_id, + request, + idempotency_key=None): + """Does a POST request to /customers/{customer_id}/addresses. - Updates a card + Creates a new address for a customer Args: customer_id (str): Customer Id - card_id (str): Card id - request (UpdateCardRequest): Request for updating a card + request (CreateAddressRequest): Request for creating an address idempotency_key (str, optional): TODO: type description here. Returns: - GetCardResponse: Response from the API. + GetAddressResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -59,16 +57,12 @@ def update_card(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/customers/{customer_id}/cards/{card_id}') - .http_method(HttpMethodEnum.PUT) + .path('/customers/{customer_id}/addresses') + .http_method(HttpMethodEnum.POST) .template_param(Parameter() .key('customer_id') .value(customer_id) .should_encode(True)) - .template_param(Parameter() - .key('card_id') - .value(card_id) - .should_encode(True)) .body_param(Parameter() .value(request)) .header_param(Parameter() @@ -85,26 +79,26 @@ def update_card(self, ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) - .deserialize_into(GetCardResponse.from_dictionary) + .deserialize_into(GetAddressResponse.from_dictionary) ).execute() - def update_address(self, - customer_id, - address_id, - request, - idempotency_key=None): - """Does a PUT request to /customers/{customer_id}/addresses/{address_id}. + def update_card(self, + customer_id, + card_id, + request, + idempotency_key=None): + """Does a PUT request to /customers/{customer_id}/cards/{card_id}. - Updates an address + Updates a card Args: customer_id (str): Customer Id - address_id (str): Address Id - request (UpdateAddressRequest): Request for updating an address + card_id (str): Card id + request (UpdateCardRequest): Request for updating a card idempotency_key (str, optional): TODO: type description here. Returns: - GetAddressResponse: Response from the API. + GetCardResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -116,15 +110,15 @@ def update_address(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/customers/{customer_id}/addresses/{address_id}') + .path('/customers/{customer_id}/cards/{card_id}') .http_method(HttpMethodEnum.PUT) .template_param(Parameter() .key('customer_id') .value(customer_id) .should_encode(True)) .template_param(Parameter() - .key('address_id') - .value(address_id) + .key('card_id') + .value(card_id) .should_encode(True)) .body_param(Parameter() .value(request)) @@ -142,7 +136,7 @@ def update_address(self, ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) - .deserialize_into(GetAddressResponse.from_dictionary) + .deserialize_into(GetCardResponse.from_dictionary) ).execute() def delete_access_token(self, @@ -239,21 +233,17 @@ def create_customer(self, .deserialize_into(GetCustomerResponse.from_dictionary) ).execute() - def create_address(self, - customer_id, - request, - idempotency_key=None): - """Does a POST request to /customers/{customer_id}/addresses. + def delete_access_tokens(self, + customer_id): + """Does a GET request to /customers/{customer_id}/access-tokens/. - Creates a new address for a customer + Delete a Customer's access tokens Args: customer_id (str): Customer Id - request (CreateAddressRequest): Request for creating an address - idempotency_key (str, optional): TODO: type description here. Returns: - GetAddressResponse: Response from the API. + ListAccessTokensResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -265,42 +255,39 @@ def create_address(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/customers/{customer_id}/addresses') - .http_method(HttpMethodEnum.POST) + .path('/customers/{customer_id}/access-tokens/') + .http_method(HttpMethodEnum.GET) .template_param(Parameter() .key('customer_id') .value(customer_id) .should_encode(True)) - .body_param(Parameter() - .value(request)) - .header_param(Parameter() - .key('idempotency-key') - .value(idempotency_key)) - .header_param(Parameter() - .key('content-type') - .value('application/json; charset=utf-8')) .header_param(Parameter() .key('accept') .value('application/json')) - .body_serializer(APIHelper.json_serialize) .auth(Single('httpBasic')) ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) - .deserialize_into(GetAddressResponse.from_dictionary) + .deserialize_into(ListAccessTokensResponse.from_dictionary) ).execute() - def delete_access_tokens(self, - customer_id): - """Does a GET request to /customers/{customer_id}/access-tokens/. + def update_address(self, + customer_id, + address_id, + request, + idempotency_key=None): + """Does a PUT request to /customers/{customer_id}/addresses/{address_id}. - Delete a Customer's access tokens + Updates an address Args: customer_id (str): Customer Id + address_id (str): Address Id + request (UpdateAddressRequest): Request for updating an address + idempotency_key (str, optional): TODO: type description here. Returns: - ListAccessTokensResponse: Response from the API. + GetAddressResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -312,20 +299,33 @@ def delete_access_tokens(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/customers/{customer_id}/access-tokens/') - .http_method(HttpMethodEnum.GET) + .path('/customers/{customer_id}/addresses/{address_id}') + .http_method(HttpMethodEnum.PUT) .template_param(Parameter() .key('customer_id') .value(customer_id) .should_encode(True)) + .template_param(Parameter() + .key('address_id') + .value(address_id) + .should_encode(True)) + .body_param(Parameter() + .value(request)) + .header_param(Parameter() + .key('idempotency-key') + .value(idempotency_key)) + .header_param(Parameter() + .key('content-type') + .value('application/json; charset=utf-8')) .header_param(Parameter() .key('accept') .value('application/json')) + .body_serializer(APIHelper.json_serialize) .auth(Single('httpBasic')) ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) - .deserialize_into(ListAccessTokensResponse.from_dictionary) + .deserialize_into(GetAddressResponse.from_dictionary) ).execute() def get_address(self, @@ -421,57 +421,6 @@ def delete_address(self, .deserialize_into(GetAddressResponse.from_dictionary) ).execute() - def create_card(self, - customer_id, - request, - idempotency_key=None): - """Does a POST request to /customers/{customer_id}/cards. - - Creates a new card for a customer - - Args: - customer_id (str): Customer id - request (CreateCardRequest): Request for creating a card - idempotency_key (str, optional): TODO: type description here. - - 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. - - """ - - return super().new_api_call_builder.request( - RequestBuilder().server(Server.DEFAULT) - .path('/customers/{customer_id}/cards') - .http_method(HttpMethodEnum.POST) - .template_param(Parameter() - .key('customer_id') - .value(customer_id) - .should_encode(True)) - .body_param(Parameter() - .value(request)) - .header_param(Parameter() - .key('idempotency-key') - .value(idempotency_key)) - .header_param(Parameter() - .key('content-type') - .value('application/json; charset=utf-8')) - .header_param(Parameter() - .key('accept') - .value('application/json')) - .body_serializer(APIHelper.json_serialize) - .auth(Single('httpBasic')) - ).response( - ResponseHandler() - .deserializer(APIHelper.json_deserialize) - .deserialize_into(GetCardResponse.from_dictionary) - ).execute() - def get_customers(self, name=None, document=None, @@ -534,21 +483,21 @@ def get_customers(self, .deserialize_into(ListCustomersResponse.from_dictionary) ).execute() - def update_customer(self, - customer_id, - request, - idempotency_key=None): - """Does a PUT request to /customers/{customer_id}. + def get_access_tokens(self, + customer_id, + page=None, + size=None): + """Does a GET request to /customers/{customer_id}/access-tokens. - Updates a customer + Get all access tokens from a customer Args: - customer_id (str): Customer id - request (UpdateCustomerRequest): Request for updating a customer - idempotency_key (str, optional): TODO: type description here. + customer_id (str): Customer Id + page (int, optional): Page number + size (int, optional): Page size Returns: - GetCustomerResponse: Response from the API. + ListAccessTokensResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -560,47 +509,43 @@ def update_customer(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/customers/{customer_id}') - .http_method(HttpMethodEnum.PUT) + .path('/customers/{customer_id}/access-tokens') + .http_method(HttpMethodEnum.GET) .template_param(Parameter() .key('customer_id') .value(customer_id) .should_encode(True)) - .body_param(Parameter() - .value(request)) - .header_param(Parameter() - .key('idempotency-key') - .value(idempotency_key)) - .header_param(Parameter() - .key('content-type') - .value('application/json; charset=utf-8')) + .query_param(Parameter() + .key('page') + .value(page)) + .query_param(Parameter() + .key('size') + .value(size)) .header_param(Parameter() .key('accept') .value('application/json')) - .body_serializer(APIHelper.json_serialize) .auth(Single('httpBasic')) ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) - .deserialize_into(GetCustomerResponse.from_dictionary) + .deserialize_into(ListAccessTokensResponse.from_dictionary) ).execute() - def create_access_token(self, - customer_id, - request, - idempotency_key=None): - """Does a POST request to /customers/{customer_id}/access-tokens. + def delete_card(self, + customer_id, + card_id, + idempotency_key=None): + """Does a DELETE request to /customers/{customer_id}/cards/{card_id}. - Creates a access token for a customer + Delete a customer's card Args: customer_id (str): Customer Id - request (CreateAccessTokenRequest): Request for creating a access - token + card_id (str): Card Id idempotency_key (str, optional): TODO: type description here. Returns: - GetAccessTokenResponse: Response from the API. + GetCardResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -612,46 +557,42 @@ def create_access_token(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/customers/{customer_id}/access-tokens') - .http_method(HttpMethodEnum.POST) + .path('/customers/{customer_id}/cards/{card_id}') + .http_method(HttpMethodEnum.DELETE) .template_param(Parameter() .key('customer_id') .value(customer_id) .should_encode(True)) - .body_param(Parameter() - .value(request)) + .template_param(Parameter() + .key('card_id') + .value(card_id) + .should_encode(True)) .header_param(Parameter() .key('idempotency-key') .value(idempotency_key)) - .header_param(Parameter() - .key('content-type') - .value('application/json; charset=utf-8')) .header_param(Parameter() .key('accept') .value('application/json')) - .body_serializer(APIHelper.json_serialize) .auth(Single('httpBasic')) ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) - .deserialize_into(GetAccessTokenResponse.from_dictionary) + .deserialize_into(GetCardResponse.from_dictionary) ).execute() - def get_access_tokens(self, - customer_id, - page=None, - size=None): - """Does a GET request to /customers/{customer_id}/access-tokens. - - Get all access tokens from a customer + def get_card(self, + customer_id, + card_id): + """Does a GET request to /customers/{customer_id}/cards/{card_id}. + + Get a customer's card Args: - customer_id (str): Customer Id - page (int, optional): Page number - size (int, optional): Page size + customer_id (str): Customer id + card_id (str): Card id Returns: - ListAccessTokensResponse: Response from the API. + GetCardResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -663,18 +604,16 @@ def get_access_tokens(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/customers/{customer_id}/access-tokens') + .path('/customers/{customer_id}/cards/{card_id}') .http_method(HttpMethodEnum.GET) .template_param(Parameter() .key('customer_id') .value(customer_id) .should_encode(True)) - .query_param(Parameter() - .key('page') - .value(page)) - .query_param(Parameter() - .key('size') - .value(size)) + .template_param(Parameter() + .key('card_id') + .value(card_id) + .should_encode(True)) .header_param(Parameter() .key('accept') .value('application/json')) @@ -682,24 +621,24 @@ def get_access_tokens(self, ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) - .deserialize_into(ListAccessTokensResponse.from_dictionary) + .deserialize_into(GetCardResponse.from_dictionary) ).execute() - def get_cards(self, - customer_id, - page=None, - size=None): - """Does a GET request to /customers/{customer_id}/cards. + def create_card(self, + customer_id, + request, + idempotency_key=None): + """Does a POST request to /customers/{customer_id}/cards. - Get all cards from a customer + Creates a new card for a customer Args: - customer_id (str): Customer Id - page (int, optional): Page number - size (int, optional): Page size + customer_id (str): Customer id + request (CreateCardRequest): Request for creating a card + idempotency_key (str, optional): TODO: type description here. Returns: - ListCardsResponse: Response from the API. + GetCardResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -712,42 +651,43 @@ def get_cards(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) .path('/customers/{customer_id}/cards') - .http_method(HttpMethodEnum.GET) + .http_method(HttpMethodEnum.POST) .template_param(Parameter() .key('customer_id') .value(customer_id) .should_encode(True)) - .query_param(Parameter() - .key('page') - .value(page)) - .query_param(Parameter() - .key('size') - .value(size)) + .body_param(Parameter() + .value(request)) + .header_param(Parameter() + .key('idempotency-key') + .value(idempotency_key)) + .header_param(Parameter() + .key('content-type') + .value('application/json; charset=utf-8')) .header_param(Parameter() .key('accept') .value('application/json')) + .body_serializer(APIHelper.json_serialize) .auth(Single('httpBasic')) ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) - .deserialize_into(ListCardsResponse.from_dictionary) + .deserialize_into(GetCardResponse.from_dictionary) ).execute() - def renew_card(self, - customer_id, - card_id, - idempotency_key=None): - """Does a POST request to /customers/{customer_id}/cards/{card_id}/renew. + def get_access_token(self, + customer_id, + token_id): + """Does a GET request to /customers/{customer_id}/access-tokens/{token_id}. - Renew a card + Get a Customer's access token Args: - customer_id (str): Customer id - card_id (str): Card Id - idempotency_key (str, optional): TODO: type description here. + customer_id (str): Customer Id + token_id (str): Token Id Returns: - GetCardResponse: Response from the API. + GetAccessTokenResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -759,19 +699,16 @@ def renew_card(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/customers/{customer_id}/cards/{card_id}/renew') - .http_method(HttpMethodEnum.POST) + .path('/customers/{customer_id}/access-tokens/{token_id}') + .http_method(HttpMethodEnum.GET) .template_param(Parameter() .key('customer_id') .value(customer_id) .should_encode(True)) .template_param(Parameter() - .key('card_id') - .value(card_id) + .key('token_id') + .value(token_id) .should_encode(True)) - .header_param(Parameter() - .key('idempotency-key') - .value(idempotency_key)) .header_param(Parameter() .key('accept') .value('application/json')) @@ -779,22 +716,24 @@ def renew_card(self, ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) - .deserialize_into(GetCardResponse.from_dictionary) + .deserialize_into(GetAccessTokenResponse.from_dictionary) ).execute() - def get_access_token(self, - customer_id, - token_id): - """Does a GET request to /customers/{customer_id}/access-tokens/{token_id}. + def get_addresses(self, + customer_id, + page=None, + size=None): + """Does a GET request to /customers/{customer_id}/addresses. - Get a Customer's access token + Gets all adressess from a customer Args: - customer_id (str): Customer Id - token_id (str): Token Id + customer_id (str): Customer id + page (int, optional): Page number + size (int, optional): Page size Returns: - GetAccessTokenResponse: Response from the API. + ListAddressesResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -806,16 +745,18 @@ def get_access_token(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/customers/{customer_id}/access-tokens/{token_id}') + .path('/customers/{customer_id}/addresses') .http_method(HttpMethodEnum.GET) .template_param(Parameter() .key('customer_id') .value(customer_id) .should_encode(True)) - .template_param(Parameter() - .key('token_id') - .value(token_id) - .should_encode(True)) + .query_param(Parameter() + .key('page') + .value(page)) + .query_param(Parameter() + .key('size') + .value(size)) .header_param(Parameter() .key('accept') .value('application/json')) @@ -823,21 +764,20 @@ def get_access_token(self, ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) - .deserialize_into(GetAccessTokenResponse.from_dictionary) + .deserialize_into(ListAddressesResponse.from_dictionary) ).execute() - def update_customer_metadata(self, - customer_id, - request, - idempotency_key=None): - """Does a PATCH request to /Customers/{customer_id}/metadata. + def update_customer(self, + customer_id, + request, + idempotency_key=None): + """Does a PUT request to /customers/{customer_id}. - Updates the metadata a customer + Updates a customer Args: - customer_id (str): The customer id - request (UpdateMetadataRequest): Request for updating the customer - metadata + customer_id (str): Customer id + request (UpdateCustomerRequest): Request for updating a customer idempotency_key (str, optional): TODO: type description here. Returns: @@ -853,8 +793,8 @@ def update_customer_metadata(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/Customers/{customer_id}/metadata') - .http_method(HttpMethodEnum.PATCH) + .path('/customers/{customer_id}') + .http_method(HttpMethodEnum.PUT) .template_param(Parameter() .key('customer_id') .value(customer_id) @@ -878,21 +818,22 @@ def update_customer_metadata(self, .deserialize_into(GetCustomerResponse.from_dictionary) ).execute() - def delete_card(self, - customer_id, - card_id, - idempotency_key=None): - """Does a DELETE request to /customers/{customer_id}/cards/{card_id}. + def create_access_token(self, + customer_id, + request, + idempotency_key=None): + """Does a POST request to /customers/{customer_id}/access-tokens. - Delete a customer's card + Creates a access token for a customer Args: customer_id (str): Customer Id - card_id (str): Card Id + request (CreateAccessTokenRequest): Request for creating a access + token idempotency_key (str, optional): TODO: type description here. Returns: - GetCardResponse: Response from the API. + GetAccessTokenResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -904,44 +845,46 @@ def delete_card(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/customers/{customer_id}/cards/{card_id}') - .http_method(HttpMethodEnum.DELETE) + .path('/customers/{customer_id}/access-tokens') + .http_method(HttpMethodEnum.POST) .template_param(Parameter() .key('customer_id') .value(customer_id) .should_encode(True)) - .template_param(Parameter() - .key('card_id') - .value(card_id) - .should_encode(True)) + .body_param(Parameter() + .value(request)) .header_param(Parameter() .key('idempotency-key') .value(idempotency_key)) + .header_param(Parameter() + .key('content-type') + .value('application/json; charset=utf-8')) .header_param(Parameter() .key('accept') .value('application/json')) + .body_serializer(APIHelper.json_serialize) .auth(Single('httpBasic')) ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) - .deserialize_into(GetCardResponse.from_dictionary) + .deserialize_into(GetAccessTokenResponse.from_dictionary) ).execute() - def get_addresses(self, - customer_id, - page=None, - size=None): - """Does a GET request to /customers/{customer_id}/addresses. + def get_cards(self, + customer_id, + page=None, + size=None): + """Does a GET request to /customers/{customer_id}/cards. - Gets all adressess from a customer + Get all cards from a customer Args: - customer_id (str): Customer id + customer_id (str): Customer Id page (int, optional): Page number size (int, optional): Page size Returns: - ListAddressesResponse: Response from the API. + ListCardsResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -953,7 +896,7 @@ def get_addresses(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/customers/{customer_id}/addresses') + .path('/customers/{customer_id}/cards') .http_method(HttpMethodEnum.GET) .template_param(Parameter() .key('customer_id') @@ -972,17 +915,71 @@ def get_addresses(self, ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) - .deserialize_into(ListAddressesResponse.from_dictionary) + .deserialize_into(ListCardsResponse.from_dictionary) ).execute() - def get_customer(self, - customer_id): - """Does a GET request to /customers/{customer_id}. + def renew_card(self, + customer_id, + card_id, + idempotency_key=None): + """Does a POST request to /customers/{customer_id}/cards/{card_id}/renew. - Get a customer + Renew a card Args: - customer_id (str): Customer Id + customer_id (str): Customer id + card_id (str): Card Id + idempotency_key (str, optional): TODO: type description here. + + 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. + + """ + + return super().new_api_call_builder.request( + RequestBuilder().server(Server.DEFAULT) + .path('/customers/{customer_id}/cards/{card_id}/renew') + .http_method(HttpMethodEnum.POST) + .template_param(Parameter() + .key('customer_id') + .value(customer_id) + .should_encode(True)) + .template_param(Parameter() + .key('card_id') + .value(card_id) + .should_encode(True)) + .header_param(Parameter() + .key('idempotency-key') + .value(idempotency_key)) + .header_param(Parameter() + .key('accept') + .value('application/json')) + .auth(Single('httpBasic')) + ).response( + ResponseHandler() + .deserializer(APIHelper.json_deserialize) + .deserialize_into(GetCardResponse.from_dictionary) + ).execute() + + def update_customer_metadata(self, + customer_id, + request, + idempotency_key=None): + """Does a PATCH request to /Customers/{customer_id}/metadata. + + Updates the metadata a customer + + Args: + customer_id (str): The customer id + request (UpdateMetadataRequest): Request for updating the customer + metadata + idempotency_key (str, optional): TODO: type description here. Returns: GetCustomerResponse: Response from the API. @@ -997,15 +994,24 @@ def get_customer(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/customers/{customer_id}') - .http_method(HttpMethodEnum.GET) + .path('/Customers/{customer_id}/metadata') + .http_method(HttpMethodEnum.PATCH) .template_param(Parameter() .key('customer_id') .value(customer_id) .should_encode(True)) + .body_param(Parameter() + .value(request)) + .header_param(Parameter() + .key('idempotency-key') + .value(idempotency_key)) + .header_param(Parameter() + .key('content-type') + .value('application/json; charset=utf-8')) .header_param(Parameter() .key('accept') .value('application/json')) + .body_serializer(APIHelper.json_serialize) .auth(Single('httpBasic')) ).response( ResponseHandler() @@ -1013,19 +1019,17 @@ def get_customer(self, .deserialize_into(GetCustomerResponse.from_dictionary) ).execute() - def get_card(self, - customer_id, - card_id): - """Does a GET request to /customers/{customer_id}/cards/{card_id}. + def get_customer(self, + customer_id): + """Does a GET request to /customers/{customer_id}. - Get a customer's card + Get a customer Args: - customer_id (str): Customer id - card_id (str): Card id + customer_id (str): Customer Id Returns: - GetCardResponse: Response from the API. + GetCustomerResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -1037,16 +1041,12 @@ def get_card(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/customers/{customer_id}/cards/{card_id}') + .path('/customers/{customer_id}') .http_method(HttpMethodEnum.GET) .template_param(Parameter() .key('customer_id') .value(customer_id) .should_encode(True)) - .template_param(Parameter() - .key('card_id') - .value(card_id) - .should_encode(True)) .header_param(Parameter() .key('accept') .value('application/json')) @@ -1054,5 +1054,5 @@ def get_card(self, ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) - .deserialize_into(GetCardResponse.from_dictionary) + .deserialize_into(GetCustomerResponse.from_dictionary) ).execute() diff --git a/pagarmeapisdk/controllers/invoices_controller.py b/pagarmeapisdk/controllers/invoices_controller.py index 2cfc294..f0add21 100644 --- a/pagarmeapisdk/controllers/invoices_controller.py +++ b/pagarmeapisdk/controllers/invoices_controller.py @@ -15,8 +15,8 @@ from apimatic_core.types.parameter import Parameter from pagarmeapisdk.http.http_method_enum import HttpMethodEnum from apimatic_core.authentication.multiple.single_auth import Single -from pagarmeapisdk.models.get_invoice_response import GetInvoiceResponse from pagarmeapisdk.models.list_invoices_response import ListInvoicesResponse +from pagarmeapisdk.models.get_invoice_response import GetInvoiceResponse class InvoicesController(BaseController): @@ -25,22 +25,42 @@ class InvoicesController(BaseController): def __init__(self, config): super(InvoicesController, self).__init__(config) - def update_invoice_metadata(self, - invoice_id, - request, - idempotency_key=None): - """Does a PATCH request to /invoices/{invoice_id}/metadata. + def get_invoices(self, + page=None, + size=None, + code=None, + customer_id=None, + subscription_id=None, + created_since=None, + created_until=None, + status=None, + due_since=None, + due_until=None, + customer_document=None): + """Does a GET request to /invoices. - Updates the metadata from an invoice + Gets all invoices Args: - invoice_id (str): The invoice id - request (UpdateMetadataRequest): Request for updating the invoice - metadata - idempotency_key (str, optional): TODO: type description here. + page (int, optional): Page number + size (int, optional): Page size + code (str, optional): Filter for Invoice's code + customer_id (str, optional): Filter for Invoice's customer id + subscription_id (str, optional): Filter for Invoice's subscription + id + created_since (datetime, optional): Filter for Invoice's creation + date start range + created_until (datetime, optional): Filter for Invoices creation + date end range + status (str, optional): Filter for Invoice's status + due_since (datetime, optional): Filter for Invoice's due date + start range + due_until (datetime, optional): Filter for Invoice's due date end + range + customer_document (str, optional): TODO: type description here. Returns: - GetInvoiceResponse: Response from the API. + ListInvoicesResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -52,39 +72,61 @@ def update_invoice_metadata(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/invoices/{invoice_id}/metadata') - .http_method(HttpMethodEnum.PATCH) - .template_param(Parameter() - .key('invoice_id') - .value(invoice_id) - .should_encode(True)) - .body_param(Parameter() - .value(request)) - .header_param(Parameter() - .key('idempotency-key') - .value(idempotency_key)) - .header_param(Parameter() - .key('content-type') - .value('application/json; charset=utf-8')) + .path('/invoices') + .http_method(HttpMethodEnum.GET) + .query_param(Parameter() + .key('page') + .value(page)) + .query_param(Parameter() + .key('size') + .value(size)) + .query_param(Parameter() + .key('code') + .value(code)) + .query_param(Parameter() + .key('customer_id') + .value(customer_id)) + .query_param(Parameter() + .key('subscription_id') + .value(subscription_id)) + .query_param(Parameter() + .key('created_since') + .value(APIHelper.when_defined(APIHelper.RFC3339DateTime, created_since))) + .query_param(Parameter() + .key('created_until') + .value(APIHelper.when_defined(APIHelper.RFC3339DateTime, created_until))) + .query_param(Parameter() + .key('status') + .value(status)) + .query_param(Parameter() + .key('due_since') + .value(APIHelper.when_defined(APIHelper.RFC3339DateTime, due_since))) + .query_param(Parameter() + .key('due_until') + .value(APIHelper.when_defined(APIHelper.RFC3339DateTime, due_until))) + .query_param(Parameter() + .key('customer_document') + .value(customer_document)) .header_param(Parameter() .key('accept') .value('application/json')) - .body_serializer(APIHelper.json_serialize) .auth(Single('httpBasic')) ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) - .deserialize_into(GetInvoiceResponse.from_dictionary) + .deserialize_into(ListInvoicesResponse.from_dictionary) ).execute() - def get_partial_invoice(self, - subscription_id): - """Does a GET request to /subscriptions/{subscription_id}/partial-invoice. + def cancel_invoice(self, + invoice_id, + idempotency_key=None): + """Does a DELETE request to /invoices/{invoice_id}. - TODO: type endpoint description here. + Cancels an invoice Args: - subscription_id (str): Subscription Id + invoice_id (str): Invoice id + idempotency_key (str, optional): TODO: type description here. Returns: GetInvoiceResponse: Response from the API. @@ -99,12 +141,15 @@ def get_partial_invoice(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/subscriptions/{subscription_id}/partial-invoice') - .http_method(HttpMethodEnum.GET) + .path('/invoices/{invoice_id}') + .http_method(HttpMethodEnum.DELETE) .template_param(Parameter() - .key('subscription_id') - .value(subscription_id) + .key('invoice_id') + .value(invoice_id) .should_encode(True)) + .header_param(Parameter() + .key('idempotency-key') + .value(idempotency_key)) .header_param(Parameter() .key('accept') .value('application/json')) @@ -115,15 +160,18 @@ def get_partial_invoice(self, .deserialize_into(GetInvoiceResponse.from_dictionary) ).execute() - def cancel_invoice(self, - invoice_id, - idempotency_key=None): - """Does a DELETE request to /invoices/{invoice_id}. + def update_invoice_status(self, + invoice_id, + request, + idempotency_key=None): + """Does a PATCH request to /invoices/{invoice_id}/status. - Cancels an invoice + Updates the status from an invoice Args: - invoice_id (str): Invoice id + invoice_id (str): Invoice Id + request (UpdateInvoiceStatusRequest): Request for updating an + invoice's status idempotency_key (str, optional): TODO: type description here. Returns: @@ -139,18 +187,24 @@ def cancel_invoice(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/invoices/{invoice_id}') - .http_method(HttpMethodEnum.DELETE) + .path('/invoices/{invoice_id}/status') + .http_method(HttpMethodEnum.PATCH) .template_param(Parameter() .key('invoice_id') .value(invoice_id) .should_encode(True)) + .body_param(Parameter() + .value(request)) .header_param(Parameter() .key('idempotency-key') .value(idempotency_key)) + .header_param(Parameter() + .key('content-type') + .value('application/json; charset=utf-8')) .header_param(Parameter() .key('accept') .value('application/json')) + .body_serializer(APIHelper.json_serialize) .auth(Single('httpBasic')) ).response( ResponseHandler() @@ -158,20 +212,18 @@ def cancel_invoice(self, .deserialize_into(GetInvoiceResponse.from_dictionary) ).execute() - 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. + def update_invoice_metadata(self, + invoice_id, + request, + idempotency_key=None): + """Does a PATCH request to /invoices/{invoice_id}/metadata. - Create an Invoice + Updates the metadata from an invoice Args: - subscription_id (str): Subscription Id - cycle_id (str): Cycle Id - request (CreateInvoiceRequest, optional): TODO: type description - here. + invoice_id (str): The invoice id + request (UpdateMetadataRequest): Request for updating the invoice + metadata idempotency_key (str, optional): TODO: type description here. Returns: @@ -187,15 +239,11 @@ def create_invoice(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/subscriptions/{subscription_id}/cycles/{cycle_id}/pay') - .http_method(HttpMethodEnum.POST) - .template_param(Parameter() - .key('subscription_id') - .value(subscription_id) - .should_encode(True)) + .path('/invoices/{invoice_id}/metadata') + .http_method(HttpMethodEnum.PATCH) .template_param(Parameter() - .key('cycle_id') - .value(cycle_id) + .key('invoice_id') + .value(invoice_id) .should_encode(True)) .body_param(Parameter() .value(request)) @@ -216,42 +264,17 @@ def create_invoice(self, .deserialize_into(GetInvoiceResponse.from_dictionary) ).execute() - def get_invoices(self, - page=None, - size=None, - code=None, - customer_id=None, - subscription_id=None, - created_since=None, - created_until=None, - status=None, - due_since=None, - due_until=None, - customer_document=None): - """Does a GET request to /invoices. + def get_partial_invoice(self, + subscription_id): + """Does a GET request to /subscriptions/{subscription_id}/partial-invoice. - Gets all invoices + TODO: type endpoint description here. Args: - page (int, optional): Page number - size (int, optional): Page size - code (str, optional): Filter for Invoice's code - customer_id (str, optional): Filter for Invoice's customer id - subscription_id (str, optional): Filter for Invoice's subscription - id - created_since (datetime, optional): Filter for Invoice's creation - date start range - created_until (datetime, optional): Filter for Invoices creation - date end range - status (str, optional): Filter for Invoice's status - due_since (datetime, optional): Filter for Invoice's due date - start range - due_until (datetime, optional): Filter for Invoice's due date end - range - customer_document (str, optional): TODO: type description here. + subscription_id (str): Subscription Id Returns: - ListInvoicesResponse: Response from the API. + GetInvoiceResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -263,41 +286,12 @@ def get_invoices(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/invoices') + .path('/subscriptions/{subscription_id}/partial-invoice') .http_method(HttpMethodEnum.GET) - .query_param(Parameter() - .key('page') - .value(page)) - .query_param(Parameter() - .key('size') - .value(size)) - .query_param(Parameter() - .key('code') - .value(code)) - .query_param(Parameter() - .key('customer_id') - .value(customer_id)) - .query_param(Parameter() - .key('subscription_id') - .value(subscription_id)) - .query_param(Parameter() - .key('created_since') - .value(APIHelper.when_defined(APIHelper.RFC3339DateTime, created_since))) - .query_param(Parameter() - .key('created_until') - .value(APIHelper.when_defined(APIHelper.RFC3339DateTime, created_until))) - .query_param(Parameter() - .key('status') - .value(status)) - .query_param(Parameter() - .key('due_since') - .value(APIHelper.when_defined(APIHelper.RFC3339DateTime, due_since))) - .query_param(Parameter() - .key('due_until') - .value(APIHelper.when_defined(APIHelper.RFC3339DateTime, due_until))) - .query_param(Parameter() - .key('customer_document') - .value(customer_document)) + .template_param(Parameter() + .key('subscription_id') + .value(subscription_id) + .should_encode(True)) .header_param(Parameter() .key('accept') .value('application/json')) @@ -305,17 +299,24 @@ def get_invoices(self, ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) - .deserialize_into(ListInvoicesResponse.from_dictionary) + .deserialize_into(GetInvoiceResponse.from_dictionary) ).execute() - def get_invoice(self, - invoice_id): - """Does a GET request to /invoices/{invoice_id}. + 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. - Gets an invoice + Create an Invoice Args: - invoice_id (str): Invoice Id + subscription_id (str): Subscription Id + cycle_id (str): Cycle Id + request (CreateInvoiceRequest, optional): TODO: type description + here. + idempotency_key (str, optional): TODO: type description here. Returns: GetInvoiceResponse: Response from the API. @@ -330,15 +331,28 @@ def get_invoice(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/invoices/{invoice_id}') - .http_method(HttpMethodEnum.GET) + .path('/subscriptions/{subscription_id}/cycles/{cycle_id}/pay') + .http_method(HttpMethodEnum.POST) .template_param(Parameter() - .key('invoice_id') - .value(invoice_id) + .key('subscription_id') + .value(subscription_id) .should_encode(True)) + .template_param(Parameter() + .key('cycle_id') + .value(cycle_id) + .should_encode(True)) + .body_param(Parameter() + .value(request)) + .header_param(Parameter() + .key('idempotency-key') + .value(idempotency_key)) + .header_param(Parameter() + .key('content-type') + .value('application/json; charset=utf-8')) .header_param(Parameter() .key('accept') .value('application/json')) + .body_serializer(APIHelper.json_serialize) .auth(Single('httpBasic')) ).response( ResponseHandler() @@ -346,19 +360,14 @@ def get_invoice(self, .deserialize_into(GetInvoiceResponse.from_dictionary) ).execute() - def update_invoice_status(self, - invoice_id, - request, - idempotency_key=None): - """Does a PATCH request to /invoices/{invoice_id}/status. + def get_invoice(self, + invoice_id): + """Does a GET request to /invoices/{invoice_id}. - Updates the status from an invoice + Gets an invoice Args: invoice_id (str): Invoice Id - request (UpdateInvoiceStatusRequest): Request for updating an - invoice's status - idempotency_key (str, optional): TODO: type description here. Returns: GetInvoiceResponse: Response from the API. @@ -373,24 +382,15 @@ def update_invoice_status(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/invoices/{invoice_id}/status') - .http_method(HttpMethodEnum.PATCH) + .path('/invoices/{invoice_id}') + .http_method(HttpMethodEnum.GET) .template_param(Parameter() .key('invoice_id') .value(invoice_id) .should_encode(True)) - .body_param(Parameter() - .value(request)) - .header_param(Parameter() - .key('idempotency-key') - .value(idempotency_key)) - .header_param(Parameter() - .key('content-type') - .value('application/json; charset=utf-8')) .header_param(Parameter() .key('accept') .value('application/json')) - .body_serializer(APIHelper.json_serialize) .auth(Single('httpBasic')) ).response( ResponseHandler() diff --git a/pagarmeapisdk/controllers/orders_controller.py b/pagarmeapisdk/controllers/orders_controller.py index 2831802..c8c9336 100644 --- a/pagarmeapisdk/controllers/orders_controller.py +++ b/pagarmeapisdk/controllers/orders_controller.py @@ -15,9 +15,9 @@ from apimatic_core.types.parameter import Parameter from pagarmeapisdk.http.http_method_enum import HttpMethodEnum from apimatic_core.authentication.multiple.single_auth import Single -from pagarmeapisdk.models.list_order_response import ListOrderResponse -from pagarmeapisdk.models.get_order_item_response import GetOrderItemResponse from pagarmeapisdk.models.get_order_response import GetOrderResponse +from pagarmeapisdk.models.get_order_item_response import GetOrderItemResponse +from pagarmeapisdk.models.list_order_response import ListOrderResponse class OrdersController(BaseController): @@ -26,31 +26,19 @@ class OrdersController(BaseController): def __init__(self, config): super(OrdersController, self).__init__(config) - def get_orders(self, - page=None, - size=None, - code=None, - status=None, - created_since=None, - created_until=None, - customer_id=None): - """Does a GET request to /orders. + def delete_all_order_items(self, + order_id, + idempotency_key=None): + """Does a DELETE request to /orders/{orderId}/items. - Gets all orders + TODO: type endpoint description here. Args: - page (int, optional): Page number - size (int, optional): Page size - code (str, optional): Filter for order's code - status (str, optional): Filter for order's status - created_since (datetime, optional): Filter for order's creation - date start range - created_until (datetime, optional): Filter for order's creation - date end range - customer_id (str, optional): Filter for order's customer id + order_id (str): Order Id + idempotency_key (str, optional): TODO: type description here. Returns: - ListOrderResponse: Response from the API. + GetOrderResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -62,29 +50,15 @@ def get_orders(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/orders') - .http_method(HttpMethodEnum.GET) - .query_param(Parameter() - .key('page') - .value(page)) - .query_param(Parameter() - .key('size') - .value(size)) - .query_param(Parameter() - .key('code') - .value(code)) - .query_param(Parameter() - .key('status') - .value(status)) - .query_param(Parameter() - .key('created_since') - .value(APIHelper.when_defined(APIHelper.RFC3339DateTime, created_since))) - .query_param(Parameter() - .key('created_until') - .value(APIHelper.when_defined(APIHelper.RFC3339DateTime, created_until))) - .query_param(Parameter() - .key('customer_id') - .value(customer_id)) + .path('/orders/{orderId}/items') + .http_method(HttpMethodEnum.DELETE) + .template_param(Parameter() + .key('orderId') + .value(order_id) + .should_encode(True)) + .header_param(Parameter() + .key('idempotency-key') + .value(idempotency_key)) .header_param(Parameter() .key('accept') .value('application/json')) @@ -92,23 +66,19 @@ def get_orders(self, ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) - .deserialize_into(ListOrderResponse.from_dictionary) + .deserialize_into(GetOrderResponse.from_dictionary) ).execute() - def update_order_item(self, - order_id, - item_id, - request, - idempotency_key=None): - """Does a PUT request to /orders/{orderId}/items/{itemId}. + def get_order_item(self, + order_id, + item_id): + """Does a GET request to /orders/{orderId}/items/{itemId}. TODO: type endpoint description here. Args: order_id (str): Order Id item_id (str): Item Id - request (UpdateOrderItemRequest): Item Model - idempotency_key (str, optional): TODO: type description here. Returns: GetOrderItemResponse: Response from the API. @@ -124,7 +94,7 @@ def update_order_item(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) .path('/orders/{orderId}/items/{itemId}') - .http_method(HttpMethodEnum.PUT) + .http_method(HttpMethodEnum.GET) .template_param(Parameter() .key('orderId') .value(order_id) @@ -133,18 +103,9 @@ def update_order_item(self, .key('itemId') .value(item_id) .should_encode(True)) - .body_param(Parameter() - .value(request)) - .header_param(Parameter() - .key('idempotency-key') - .value(idempotency_key)) - .header_param(Parameter() - .key('content-type') - .value('application/json; charset=utf-8')) .header_param(Parameter() .key('accept') .value('application/json')) - .body_serializer(APIHelper.json_serialize) .auth(Single('httpBasic')) ).response( ResponseHandler() @@ -152,15 +113,18 @@ def update_order_item(self, .deserialize_into(GetOrderItemResponse.from_dictionary) ).execute() - def delete_all_order_items(self, - order_id, - idempotency_key=None): - """Does a DELETE request to /orders/{orderId}/items. + def update_order_metadata(self, + order_id, + request, + idempotency_key=None): + """Does a PATCH request to /Orders/{order_id}/metadata. - TODO: type endpoint description here. + Updates the metadata from an order Args: - order_id (str): Order Id + order_id (str): The order id + request (UpdateMetadataRequest): Request for updating the order + metadata idempotency_key (str, optional): TODO: type description here. Returns: @@ -176,18 +140,24 @@ def delete_all_order_items(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/orders/{orderId}/items') - .http_method(HttpMethodEnum.DELETE) + .path('/Orders/{order_id}/metadata') + .http_method(HttpMethodEnum.PATCH) .template_param(Parameter() - .key('orderId') + .key('order_id') .value(order_id) .should_encode(True)) + .body_param(Parameter() + .value(request)) .header_param(Parameter() .key('idempotency-key') .value(idempotency_key)) + .header_param(Parameter() + .key('content-type') + .value('application/json; charset=utf-8')) .header_param(Parameter() .key('accept') .value('application/json')) + .body_serializer(APIHelper.json_serialize) .auth(Single('httpBasic')) ).response( ResponseHandler() @@ -244,18 +214,14 @@ def delete_order_item(self, .deserialize_into(GetOrderItemResponse.from_dictionary) ).execute() - def close_order(self, - id, - request, - idempotency_key=None): - """Does a PATCH request to /orders/{id}/closed. + def get_order(self, + order_id): + """Does a GET request to /orders/{order_id}. - TODO: type endpoint description here. + Gets an order Args: - id (str): Order Id - request (UpdateOrderStatusRequest): Update Order Model - idempotency_key (str, optional): TODO: type description here. + order_id (str): Order id Returns: GetOrderResponse: Response from the API. @@ -270,24 +236,15 @@ def close_order(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/orders/{id}/closed') - .http_method(HttpMethodEnum.PATCH) + .path('/orders/{order_id}') + .http_method(HttpMethodEnum.GET) .template_param(Parameter() - .key('id') - .value(id) + .key('order_id') + .value(order_id) .should_encode(True)) - .body_param(Parameter() - .value(request)) - .header_param(Parameter() - .key('idempotency-key') - .value(idempotency_key)) - .header_param(Parameter() - .key('content-type') - .value('application/json; charset=utf-8')) .header_param(Parameter() .key('accept') .value('application/json')) - .body_serializer(APIHelper.json_serialize) .auth(Single('httpBasic')) ).response( ResponseHandler() @@ -295,19 +252,31 @@ def close_order(self, .deserialize_into(GetOrderResponse.from_dictionary) ).execute() - def create_order(self, - body, - idempotency_key=None): - """Does a POST request to /orders. + def get_orders(self, + page=None, + size=None, + code=None, + status=None, + created_since=None, + created_until=None, + customer_id=None): + """Does a GET request to /orders. - Creates a new Order + Gets all orders Args: - body (CreateOrderRequest): Request for creating an order - idempotency_key (str, optional): TODO: type description here. + page (int, optional): Page number + size (int, optional): Page size + code (str, optional): Filter for order's code + status (str, optional): Filter for order's status + created_since (datetime, optional): Filter for order's creation + date start range + created_until (datetime, optional): Filter for order's creation + date end range + customer_id (str, optional): Filter for order's customer id Returns: - GetOrderResponse: Response from the API. + ListOrderResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -320,37 +289,51 @@ def create_order(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) .path('/orders') - .http_method(HttpMethodEnum.POST) - .body_param(Parameter() - .value(body)) - .header_param(Parameter() - .key('idempotency-key') - .value(idempotency_key)) - .header_param(Parameter() - .key('content-type') - .value('application/json; charset=utf-8')) + .http_method(HttpMethodEnum.GET) + .query_param(Parameter() + .key('page') + .value(page)) + .query_param(Parameter() + .key('size') + .value(size)) + .query_param(Parameter() + .key('code') + .value(code)) + .query_param(Parameter() + .key('status') + .value(status)) + .query_param(Parameter() + .key('created_since') + .value(APIHelper.when_defined(APIHelper.RFC3339DateTime, created_since))) + .query_param(Parameter() + .key('created_until') + .value(APIHelper.when_defined(APIHelper.RFC3339DateTime, created_until))) + .query_param(Parameter() + .key('customer_id') + .value(customer_id)) .header_param(Parameter() .key('accept') .value('application/json')) - .body_serializer(APIHelper.json_serialize) .auth(Single('httpBasic')) ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) - .deserialize_into(GetOrderResponse.from_dictionary) + .deserialize_into(ListOrderResponse.from_dictionary) ).execute() - def create_order_item(self, + def update_order_item(self, order_id, + item_id, request, idempotency_key=None): - """Does a POST request to /orders/{orderId}/items. + """Does a PUT request to /orders/{orderId}/items/{itemId}. TODO: type endpoint description here. Args: order_id (str): Order Id - request (CreateOrderItemRequest): Order Item Model + item_id (str): Item Id + request (UpdateOrderItemRequest): Item Model idempotency_key (str, optional): TODO: type description here. Returns: @@ -366,12 +349,16 @@ def create_order_item(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/orders/{orderId}/items') - .http_method(HttpMethodEnum.POST) + .path('/orders/{orderId}/items/{itemId}') + .http_method(HttpMethodEnum.PUT) .template_param(Parameter() .key('orderId') .value(order_id) .should_encode(True)) + .template_param(Parameter() + .key('itemId') + .value(item_id) + .should_encode(True)) .body_param(Parameter() .value(request)) .header_param(Parameter() @@ -391,19 +378,21 @@ def create_order_item(self, .deserialize_into(GetOrderItemResponse.from_dictionary) ).execute() - def get_order_item(self, - order_id, - item_id): - """Does a GET request to /orders/{orderId}/items/{itemId}. + def close_order(self, + id, + request, + idempotency_key=None): + """Does a PATCH request to /orders/{id}/closed. TODO: type endpoint description here. Args: - order_id (str): Order Id - item_id (str): Item Id + id (str): Order Id + request (UpdateOrderStatusRequest): Update Order Model + idempotency_key (str, optional): TODO: type description here. Returns: - GetOrderItemResponse: Response from the API. + GetOrderResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -415,38 +404,40 @@ def get_order_item(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/orders/{orderId}/items/{itemId}') - .http_method(HttpMethodEnum.GET) - .template_param(Parameter() - .key('orderId') - .value(order_id) - .should_encode(True)) + .path('/orders/{id}/closed') + .http_method(HttpMethodEnum.PATCH) .template_param(Parameter() - .key('itemId') - .value(item_id) + .key('id') + .value(id) .should_encode(True)) + .body_param(Parameter() + .value(request)) + .header_param(Parameter() + .key('idempotency-key') + .value(idempotency_key)) + .header_param(Parameter() + .key('content-type') + .value('application/json; charset=utf-8')) .header_param(Parameter() .key('accept') .value('application/json')) + .body_serializer(APIHelper.json_serialize) .auth(Single('httpBasic')) ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) - .deserialize_into(GetOrderItemResponse.from_dictionary) + .deserialize_into(GetOrderResponse.from_dictionary) ).execute() - def update_order_metadata(self, - order_id, - request, - idempotency_key=None): - """Does a PATCH request to /Orders/{order_id}/metadata. + def create_order(self, + body, + idempotency_key=None): + """Does a POST request to /orders. - Updates the metadata from an order + Creates a new Order Args: - order_id (str): The order id - request (UpdateMetadataRequest): Request for updating the order - metadata + body (CreateOrderRequest): Request for creating an order idempotency_key (str, optional): TODO: type description here. Returns: @@ -462,14 +453,10 @@ def update_order_metadata(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/Orders/{order_id}/metadata') - .http_method(HttpMethodEnum.PATCH) - .template_param(Parameter() - .key('order_id') - .value(order_id) - .should_encode(True)) + .path('/orders') + .http_method(HttpMethodEnum.POST) .body_param(Parameter() - .value(request)) + .value(body)) .header_param(Parameter() .key('idempotency-key') .value(idempotency_key)) @@ -487,17 +474,21 @@ def update_order_metadata(self, .deserialize_into(GetOrderResponse.from_dictionary) ).execute() - def get_order(self, - order_id): - """Does a GET request to /orders/{order_id}. + def create_order_item(self, + order_id, + request, + idempotency_key=None): + """Does a POST request to /orders/{orderId}/items. - Gets an order + TODO: type endpoint description here. Args: - order_id (str): Order id + order_id (str): Order Id + request (CreateOrderItemRequest): Order Item Model + idempotency_key (str, optional): TODO: type description here. Returns: - GetOrderResponse: Response from the API. + GetOrderItemResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -509,18 +500,27 @@ def get_order(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/orders/{order_id}') - .http_method(HttpMethodEnum.GET) + .path('/orders/{orderId}/items') + .http_method(HttpMethodEnum.POST) .template_param(Parameter() - .key('order_id') + .key('orderId') .value(order_id) .should_encode(True)) + .body_param(Parameter() + .value(request)) + .header_param(Parameter() + .key('idempotency-key') + .value(idempotency_key)) + .header_param(Parameter() + .key('content-type') + .value('application/json; charset=utf-8')) .header_param(Parameter() .key('accept') .value('application/json')) + .body_serializer(APIHelper.json_serialize) .auth(Single('httpBasic')) ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) - .deserialize_into(GetOrderResponse.from_dictionary) + .deserialize_into(GetOrderItemResponse.from_dictionary) ).execute() diff --git a/pagarmeapisdk/controllers/plans_controller.py b/pagarmeapisdk/controllers/plans_controller.py index c84d1c6..ebb3bb2 100644 --- a/pagarmeapisdk/controllers/plans_controller.py +++ b/pagarmeapisdk/controllers/plans_controller.py @@ -64,19 +64,21 @@ def get_plan(self, .deserialize_into(GetPlanResponse.from_dictionary) ).execute() - def delete_plan(self, - plan_id, - idempotency_key=None): - """Does a DELETE request to /plans/{plan_id}. + def delete_plan_item(self, + plan_id, + plan_item_id, + idempotency_key=None): + """Does a DELETE request to /plans/{plan_id}/items/{plan_item_id}. - Deletes a plan + Removes an item from a plan Args: plan_id (str): Plan id + plan_item_id (str): Plan item id idempotency_key (str, optional): TODO: type description here. Returns: - GetPlanResponse: Response from the API. + GetPlanItemResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -88,12 +90,16 @@ def delete_plan(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/plans/{plan_id}') + .path('/plans/{plan_id}/items/{plan_item_id}') .http_method(HttpMethodEnum.DELETE) .template_param(Parameter() .key('plan_id') .value(plan_id) .should_encode(True)) + .template_param(Parameter() + .key('plan_item_id') + .value(plan_item_id) + .should_encode(True)) .header_param(Parameter() .key('idempotency-key') .value(idempotency_key)) @@ -104,7 +110,7 @@ def delete_plan(self, ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) - .deserialize_into(GetPlanResponse.from_dictionary) + .deserialize_into(GetPlanItemResponse.from_dictionary) ).execute() def update_plan_metadata(self, @@ -159,23 +165,19 @@ def update_plan_metadata(self, .deserialize_into(GetPlanResponse.from_dictionary) ).execute() - 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}. + def create_plan(self, + body, + idempotency_key=None): + """Does a POST request to /plans. - Updates a plan item + Creates a new plan Args: - plan_id (str): Plan id - plan_item_id (str): Plan item id - body (UpdatePlanItemRequest): Request for updating the plan item + body (CreatePlanRequest): Request for creating a plan idempotency_key (str, optional): TODO: type description here. Returns: - GetPlanItemResponse: Response from the API. + GetPlanResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -187,16 +189,8 @@ def update_plan_item(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/plans/{plan_id}/items/{plan_item_id}') - .http_method(HttpMethodEnum.PUT) - .template_param(Parameter() - .key('plan_id') - .value(plan_id) - .should_encode(True)) - .template_param(Parameter() - .key('plan_item_id') - .value(plan_item_id) - .should_encode(True)) + .path('/plans') + .http_method(HttpMethodEnum.POST) .body_param(Parameter() .value(body)) .header_param(Parameter() @@ -213,24 +207,24 @@ def update_plan_item(self, ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) - .deserialize_into(GetPlanItemResponse.from_dictionary) + .deserialize_into(GetPlanResponse.from_dictionary) ).execute() - def create_plan_item(self, - plan_id, - request, - idempotency_key=None): - """Does a POST request to /plans/{plan_id}/items. + def update_plan(self, + plan_id, + request, + idempotency_key=None): + """Does a PUT request to /plans/{plan_id}. - Adds a new item to a plan + Updates a plan Args: plan_id (str): Plan id - request (CreatePlanItemRequest): Request for creating a plan item + request (UpdatePlanRequest): Request for updating a plan idempotency_key (str, optional): TODO: type description here. Returns: - GetPlanItemResponse: Response from the API. + GetPlanResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -242,8 +236,8 @@ def create_plan_item(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/plans/{plan_id}/items') - .http_method(HttpMethodEnum.POST) + .path('/plans/{plan_id}') + .http_method(HttpMethodEnum.PUT) .template_param(Parameter() .key('plan_id') .value(plan_id) @@ -264,22 +258,22 @@ def create_plan_item(self, ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) - .deserialize_into(GetPlanItemResponse.from_dictionary) + .deserialize_into(GetPlanResponse.from_dictionary) ).execute() - def get_plan_item(self, - plan_id, - plan_item_id): - """Does a GET request to /plans/{plan_id}/items/{plan_item_id}. + def delete_plan(self, + plan_id, + idempotency_key=None): + """Does a DELETE request to /plans/{plan_id}. - Gets a plan item + Deletes a plan Args: plan_id (str): Plan id - plan_item_id (str): Plan item id + idempotency_key (str, optional): TODO: type description here. Returns: - GetPlanItemResponse: Response from the API. + GetPlanResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -291,16 +285,15 @@ def get_plan_item(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/plans/{plan_id}/items/{plan_item_id}') - .http_method(HttpMethodEnum.GET) + .path('/plans/{plan_id}') + .http_method(HttpMethodEnum.DELETE) .template_param(Parameter() .key('plan_id') .value(plan_id) .should_encode(True)) - .template_param(Parameter() - .key('plan_item_id') - .value(plan_item_id) - .should_encode(True)) + .header_param(Parameter() + .key('idempotency-key') + .value(idempotency_key)) .header_param(Parameter() .key('accept') .value('application/json')) @@ -308,22 +301,34 @@ def get_plan_item(self, ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) - .deserialize_into(GetPlanItemResponse.from_dictionary) + .deserialize_into(GetPlanResponse.from_dictionary) ).execute() - def create_plan(self, - body, - idempotency_key=None): - """Does a POST request to /plans. + 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. - Creates a new plan + Gets all plans Args: - body (CreatePlanRequest): Request for creating a plan - idempotency_key (str, optional): TODO: type description here. + page (int, optional): Page number + size (int, optional): Page size + name (str, optional): Filter for Plan's name + status (str, optional): Filter for Plan's status + billing_type (str, 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: - GetPlanResponse: Response from the API. + ListPlansResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -336,37 +341,51 @@ def create_plan(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) .path('/plans') - .http_method(HttpMethodEnum.POST) - .body_param(Parameter() - .value(body)) - .header_param(Parameter() - .key('idempotency-key') - .value(idempotency_key)) - .header_param(Parameter() - .key('content-type') - .value('application/json; charset=utf-8')) + .http_method(HttpMethodEnum.GET) + .query_param(Parameter() + .key('page') + .value(page)) + .query_param(Parameter() + .key('size') + .value(size)) + .query_param(Parameter() + .key('name') + .value(name)) + .query_param(Parameter() + .key('status') + .value(status)) + .query_param(Parameter() + .key('billing_type') + .value(billing_type)) + .query_param(Parameter() + .key('created_since') + .value(APIHelper.when_defined(APIHelper.RFC3339DateTime, created_since))) + .query_param(Parameter() + .key('created_until') + .value(APIHelper.when_defined(APIHelper.RFC3339DateTime, created_until))) .header_param(Parameter() .key('accept') .value('application/json')) - .body_serializer(APIHelper.json_serialize) .auth(Single('httpBasic')) ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) - .deserialize_into(GetPlanResponse.from_dictionary) + .deserialize_into(ListPlansResponse.from_dictionary) ).execute() - def delete_plan_item(self, + def update_plan_item(self, plan_id, plan_item_id, + body, idempotency_key=None): - """Does a DELETE request to /plans/{plan_id}/items/{plan_item_id}. + """Does a PUT request to /plans/{plan_id}/items/{plan_item_id}. - Removes an item from a plan + Updates a plan item Args: plan_id (str): Plan id plan_item_id (str): Plan item id + body (UpdatePlanItemRequest): Request for updating the plan item idempotency_key (str, optional): TODO: type description here. Returns: @@ -383,7 +402,7 @@ def delete_plan_item(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) .path('/plans/{plan_id}/items/{plan_item_id}') - .http_method(HttpMethodEnum.DELETE) + .http_method(HttpMethodEnum.PUT) .template_param(Parameter() .key('plan_id') .value(plan_id) @@ -392,12 +411,18 @@ def delete_plan_item(self, .key('plan_item_id') .value(plan_item_id) .should_encode(True)) + .body_param(Parameter() + .value(body)) .header_param(Parameter() .key('idempotency-key') .value(idempotency_key)) + .header_param(Parameter() + .key('content-type') + .value('application/json; charset=utf-8')) .header_param(Parameter() .key('accept') .value('application/json')) + .body_serializer(APIHelper.json_serialize) .auth(Single('httpBasic')) ).response( ResponseHandler() @@ -405,31 +430,21 @@ def delete_plan_item(self, .deserialize_into(GetPlanItemResponse.from_dictionary) ).execute() - 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. + def create_plan_item(self, + plan_id, + request, + idempotency_key=None): + """Does a POST request to /plans/{plan_id}/items. - Gets all plans + Adds a new item to a plan Args: - page (int, optional): Page number - size (int, optional): Page size - name (str, optional): Filter for Plan's name - status (str, optional): Filter for Plan's status - billing_type (str, 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 + plan_id (str): Plan id + request (CreatePlanItemRequest): Request for creating a plan item + idempotency_key (str, optional): TODO: type description here. Returns: - ListPlansResponse: Response from the API. + GetPlanItemResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -441,54 +456,44 @@ def get_plans(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/plans') - .http_method(HttpMethodEnum.GET) - .query_param(Parameter() - .key('page') - .value(page)) - .query_param(Parameter() - .key('size') - .value(size)) - .query_param(Parameter() - .key('name') - .value(name)) - .query_param(Parameter() - .key('status') - .value(status)) - .query_param(Parameter() - .key('billing_type') - .value(billing_type)) - .query_param(Parameter() - .key('created_since') - .value(APIHelper.when_defined(APIHelper.RFC3339DateTime, created_since))) - .query_param(Parameter() - .key('created_until') - .value(APIHelper.when_defined(APIHelper.RFC3339DateTime, created_until))) + .path('/plans/{plan_id}/items') + .http_method(HttpMethodEnum.POST) + .template_param(Parameter() + .key('plan_id') + .value(plan_id) + .should_encode(True)) + .body_param(Parameter() + .value(request)) + .header_param(Parameter() + .key('idempotency-key') + .value(idempotency_key)) + .header_param(Parameter() + .key('content-type') + .value('application/json; charset=utf-8')) .header_param(Parameter() .key('accept') .value('application/json')) + .body_serializer(APIHelper.json_serialize) .auth(Single('httpBasic')) ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) - .deserialize_into(ListPlansResponse.from_dictionary) + .deserialize_into(GetPlanItemResponse.from_dictionary) ).execute() - def update_plan(self, - plan_id, - request, - idempotency_key=None): - """Does a PUT request to /plans/{plan_id}. + def get_plan_item(self, + plan_id, + plan_item_id): + """Does a GET request to /plans/{plan_id}/items/{plan_item_id}. - Updates a plan + Gets a plan item Args: plan_id (str): Plan id - request (UpdatePlanRequest): Request for updating a plan - idempotency_key (str, optional): TODO: type description here. + plan_item_id (str): Plan item id Returns: - GetPlanResponse: Response from the API. + GetPlanItemResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -500,27 +505,22 @@ def update_plan(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/plans/{plan_id}') - .http_method(HttpMethodEnum.PUT) + .path('/plans/{plan_id}/items/{plan_item_id}') + .http_method(HttpMethodEnum.GET) .template_param(Parameter() .key('plan_id') .value(plan_id) .should_encode(True)) - .body_param(Parameter() - .value(request)) - .header_param(Parameter() - .key('idempotency-key') - .value(idempotency_key)) - .header_param(Parameter() - .key('content-type') - .value('application/json; charset=utf-8')) + .template_param(Parameter() + .key('plan_item_id') + .value(plan_item_id) + .should_encode(True)) .header_param(Parameter() .key('accept') .value('application/json')) - .body_serializer(APIHelper.json_serialize) .auth(Single('httpBasic')) ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) - .deserialize_into(GetPlanResponse.from_dictionary) + .deserialize_into(GetPlanItemResponse.from_dictionary) ).execute() diff --git a/pagarmeapisdk/controllers/recipients_controller.py b/pagarmeapisdk/controllers/recipients_controller.py index 99ed8dc..69fa0ce 100644 --- a/pagarmeapisdk/controllers/recipients_controller.py +++ b/pagarmeapisdk/controllers/recipients_controller.py @@ -16,14 +16,14 @@ from pagarmeapisdk.http.http_method_enum import HttpMethodEnum from apimatic_core.authentication.multiple.single_auth import Single from pagarmeapisdk.models.get_recipient_response import GetRecipientResponse -from pagarmeapisdk.models.get_anticipation_response import GetAnticipationResponse -from pagarmeapisdk.models.get_anticipation_limit_response import GetAnticipationLimitResponse -from pagarmeapisdk.models.list_recipient_response import ListRecipientResponse from pagarmeapisdk.models.get_withdraw_response import GetWithdrawResponse +from pagarmeapisdk.models.get_balance_response import GetBalanceResponse +from pagarmeapisdk.models.list_recipient_response import ListRecipientResponse from pagarmeapisdk.models.list_transfer_response import ListTransferResponse from pagarmeapisdk.models.get_transfer_response import GetTransferResponse +from pagarmeapisdk.models.get_anticipation_response import GetAnticipationResponse +from pagarmeapisdk.models.get_anticipation_limit_response import GetAnticipationLimitResponse from pagarmeapisdk.models.list_anticipation_response import ListAnticipationResponse -from pagarmeapisdk.models.get_balance_response import GetBalanceResponse from pagarmeapisdk.models.list_withdrawals import ListWithdrawals from pagarmeapisdk.models.create_kyc_link_response import CreateKYCLinkResponse @@ -85,21 +85,19 @@ def update_recipient(self, .deserialize_into(GetRecipientResponse.from_dictionary) ).execute() - def create_anticipation(self, - recipient_id, - request, - idempotency_key=None): - """Does a POST request to /recipients/{recipient_id}/anticipations. + def get_withdraw_by_id(self, + recipient_id, + withdrawal_id): + """Does a GET request to /recipients/{recipient_id}/withdrawals/{withdrawal_id}. - Creates an anticipation + TODO: type endpoint description here. Args: - recipient_id (str): Recipient id - request (CreateAnticipationRequest): Anticipation data - idempotency_key (str, optional): TODO: type description here. + recipient_id (str): TODO: type description here. + withdrawal_id (str): TODO: type description here. Returns: - GetAnticipationResponse: Response from the API. + GetWithdrawResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -111,46 +109,37 @@ def create_anticipation(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/recipients/{recipient_id}/anticipations') - .http_method(HttpMethodEnum.POST) + .path('/recipients/{recipient_id}/withdrawals/{withdrawal_id}') + .http_method(HttpMethodEnum.GET) .template_param(Parameter() .key('recipient_id') .value(recipient_id) .should_encode(True)) - .body_param(Parameter() - .value(request)) - .header_param(Parameter() - .key('idempotency-key') - .value(idempotency_key)) - .header_param(Parameter() - .key('content-type') - .value('application/json; charset=utf-8')) + .template_param(Parameter() + .key('withdrawal_id') + .value(withdrawal_id) + .should_encode(True)) .header_param(Parameter() .key('accept') .value('application/json')) - .body_serializer(APIHelper.json_serialize) .auth(Single('httpBasic')) ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) - .deserialize_into(GetAnticipationResponse.from_dictionary) + .deserialize_into(GetWithdrawResponse.from_dictionary) ).execute() - def get_anticipation_limits(self, - recipient_id, - timeframe, - payment_date): - """Does a GET request to /recipients/{recipient_id}/anticipation_limits. + def get_recipient(self, + recipient_id): + """Does a GET request to /recipients/{recipient_id}. - Gets the anticipation limits for a recipient + Retrieves recipient information Args: - recipient_id (str): Recipient id - timeframe (str): Timeframe - payment_date (datetime): Anticipation payment date + recipient_id (str): Recipiend id Returns: - GetAnticipationLimitResponse: Response from the API. + GetRecipientResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -162,18 +151,12 @@ def get_anticipation_limits(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/recipients/{recipient_id}/anticipation_limits') + .path('/recipients/{recipient_id}') .http_method(HttpMethodEnum.GET) .template_param(Parameter() .key('recipient_id') .value(recipient_id) .should_encode(True)) - .query_param(Parameter() - .key('timeframe') - .value(timeframe)) - .query_param(Parameter() - .key('payment_date') - .value(APIHelper.when_defined(APIHelper.RFC3339DateTime, payment_date))) .header_param(Parameter() .key('accept') .value('application/json')) @@ -181,22 +164,20 @@ def get_anticipation_limits(self, ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) - .deserialize_into(GetAnticipationLimitResponse.from_dictionary) + .deserialize_into(GetRecipientResponse.from_dictionary) ).execute() - def get_recipients(self, - page=None, - size=None): - """Does a GET request to /recipients. + def get_balance(self, + recipient_id): + """Does a GET request to /recipients/{recipient_id}/balance. - Retrieves paginated recipients information + Get balance information for a recipient Args: - page (int, optional): Page number - size (int, optional): Page size + recipient_id (str): Recipient id Returns: - ListRecipientResponse: Response from the API. + GetBalanceResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -208,14 +189,12 @@ def get_recipients(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/recipients') + .path('/recipients/{recipient_id}/balance') .http_method(HttpMethodEnum.GET) - .query_param(Parameter() - .key('page') - .value(page)) - .query_param(Parameter() - .key('size') - .value(size)) + .template_param(Parameter() + .key('recipient_id') + .value(recipient_id) + .should_encode(True)) .header_param(Parameter() .key('accept') .value('application/json')) @@ -223,22 +202,22 @@ def get_recipients(self, ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) - .deserialize_into(ListRecipientResponse.from_dictionary) + .deserialize_into(GetBalanceResponse.from_dictionary) ).execute() - def get_withdraw_by_id(self, - recipient_id, - withdrawal_id): - """Does a GET request to /recipients/{recipient_id}/withdrawals/{withdrawal_id}. + def get_recipients(self, + page=None, + size=None): + """Does a GET request to /recipients. - TODO: type endpoint description here. + Retrieves paginated recipients information Args: - recipient_id (str): TODO: type description here. - withdrawal_id (str): TODO: type description here. + page (int, optional): Page number + size (int, optional): Page size Returns: - GetWithdrawResponse: Response from the API. + ListRecipientResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -250,16 +229,14 @@ def get_withdraw_by_id(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/recipients/{recipient_id}/withdrawals/{withdrawal_id}') + .path('/recipients') .http_method(HttpMethodEnum.GET) - .template_param(Parameter() - .key('recipient_id') - .value(recipient_id) - .should_encode(True)) - .template_param(Parameter() - .key('withdrawal_id') - .value(withdrawal_id) - .should_encode(True)) + .query_param(Parameter() + .key('page') + .value(page)) + .query_param(Parameter() + .key('size') + .value(size)) .header_param(Parameter() .key('accept') .value('application/json')) @@ -267,7 +244,7 @@ def get_withdraw_by_id(self, ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) - .deserialize_into(GetWithdrawResponse.from_dictionary) + .deserialize_into(ListRecipientResponse.from_dictionary) ).execute() def update_recipient_default_bank_account(self, @@ -321,57 +298,6 @@ def update_recipient_default_bank_account(self, .deserialize_into(GetRecipientResponse.from_dictionary) ).execute() - def update_recipient_metadata(self, - recipient_id, - request, - idempotency_key=None): - """Does a PATCH request to /recipients/{recipient_id}/metadata. - - Updates recipient metadata - - Args: - recipient_id (str): Recipient id - request (UpdateMetadataRequest): Metadata - idempotency_key (str, optional): TODO: type description here. - - 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. - - """ - - return super().new_api_call_builder.request( - RequestBuilder().server(Server.DEFAULT) - .path('/recipients/{recipient_id}/metadata') - .http_method(HttpMethodEnum.PATCH) - .template_param(Parameter() - .key('recipient_id') - .value(recipient_id) - .should_encode(True)) - .body_param(Parameter() - .value(request)) - .header_param(Parameter() - .key('idempotency-key') - .value(idempotency_key)) - .header_param(Parameter() - .key('content-type') - .value('application/json; charset=utf-8')) - .header_param(Parameter() - .key('accept') - .value('application/json')) - .body_serializer(APIHelper.json_serialize) - .auth(Single('httpBasic')) - ).response( - ResponseHandler() - .deserializer(APIHelper.json_deserialize) - .deserialize_into(GetRecipientResponse.from_dictionary) - ).execute() - def get_transfers(self, recipient_id, page=None, @@ -527,57 +453,6 @@ def create_withdraw(self, .deserialize_into(GetWithdrawResponse.from_dictionary) ).execute() - def update_automatic_anticipation_settings(self, - recipient_id, - request, - idempotency_key=None): - """Does a PATCH request to /recipients/{recipient_id}/automatic-anticipation-settings. - - Updates recipient metadata - - Args: - recipient_id (str): Recipient id - request (UpdateAutomaticAnticipationSettingsRequest): Metadata - idempotency_key (str, optional): TODO: type description here. - - 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. - - """ - - return super().new_api_call_builder.request( - RequestBuilder().server(Server.DEFAULT) - .path('/recipients/{recipient_id}/automatic-anticipation-settings') - .http_method(HttpMethodEnum.PATCH) - .template_param(Parameter() - .key('recipient_id') - .value(recipient_id) - .should_encode(True)) - .body_param(Parameter() - .value(request)) - .header_param(Parameter() - .key('idempotency-key') - .value(idempotency_key)) - .header_param(Parameter() - .key('content-type') - .value('application/json; charset=utf-8')) - .header_param(Parameter() - .key('accept') - .value('application/json')) - .body_serializer(APIHelper.json_serialize) - .auth(Single('httpBasic')) - ).response( - ResponseHandler() - .deserializer(APIHelper.json_deserialize) - .deserialize_into(GetRecipientResponse.from_dictionary) - ).execute() - def get_anticipation(self, recipient_id, anticipation_id): @@ -674,37 +549,17 @@ def update_recipient_transfer_settings(self, .deserialize_into(GetRecipientResponse.from_dictionary) ).execute() - 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. + def get_recipient_by_code(self, + code): + """Does a GET request to /recipients/{code}. - Retrieves a paginated list of anticipations from a recipient + Retrieves recipient information Args: - recipient_id (str): Recipient id - page (int, optional): Page number - size (int, optional): Page size - status (str, optional): Filter for anticipation status - timeframe (str, 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 + code (str): Recipient code Returns: - ListAnticipationResponse: Response from the API. + GetRecipientResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -716,36 +571,12 @@ def get_anticipations(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/recipients/{recipient_id}/anticipations') + .path('/recipients/{code}') .http_method(HttpMethodEnum.GET) .template_param(Parameter() - .key('recipient_id') - .value(recipient_id) + .key('code') + .value(code) .should_encode(True)) - .query_param(Parameter() - .key('page') - .value(page)) - .query_param(Parameter() - .key('size') - .value(size)) - .query_param(Parameter() - .key('status') - .value(status)) - .query_param(Parameter() - .key('timeframe') - .value(timeframe)) - .query_param(Parameter() - .key('payment_date_since') - .value(APIHelper.when_defined(APIHelper.RFC3339DateTime, payment_date_since))) - .query_param(Parameter() - .key('payment_date_until') - .value(APIHelper.when_defined(APIHelper.RFC3339DateTime, payment_date_until))) - .query_param(Parameter() - .key('created_since') - .value(APIHelper.when_defined(APIHelper.RFC3339DateTime, created_since))) - .query_param(Parameter() - .key('created_until') - .value(APIHelper.when_defined(APIHelper.RFC3339DateTime, created_until))) .header_param(Parameter() .key('accept') .value('application/json')) @@ -753,17 +584,21 @@ def get_anticipations(self, ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) - .deserialize_into(ListAnticipationResponse.from_dictionary) + .deserialize_into(GetRecipientResponse.from_dictionary) ).execute() - def get_recipient(self, - recipient_id): - """Does a GET request to /recipients/{recipient_id}. + def update_automatic_anticipation_settings(self, + recipient_id, + request, + idempotency_key=None): + """Does a PATCH request to /recipients/{recipient_id}/automatic-anticipation-settings. - Retrieves recipient information + Updates recipient metadata Args: - recipient_id (str): Recipiend id + recipient_id (str): Recipient id + request (UpdateAutomaticAnticipationSettingsRequest): Metadata + idempotency_key (str, optional): TODO: type description here. Returns: GetRecipientResponse: Response from the API. @@ -778,15 +613,24 @@ def get_recipient(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/recipients/{recipient_id}') - .http_method(HttpMethodEnum.GET) + .path('/recipients/{recipient_id}/automatic-anticipation-settings') + .http_method(HttpMethodEnum.PATCH) .template_param(Parameter() .key('recipient_id') .value(recipient_id) .should_encode(True)) + .body_param(Parameter() + .value(request)) + .header_param(Parameter() + .key('idempotency-key') + .value(idempotency_key)) + .header_param(Parameter() + .key('content-type') + .value('application/json; charset=utf-8')) .header_param(Parameter() .key('accept') .value('application/json')) + .body_serializer(APIHelper.json_serialize) .auth(Single('httpBasic')) ).response( ResponseHandler() @@ -794,17 +638,21 @@ def get_recipient(self, .deserialize_into(GetRecipientResponse.from_dictionary) ).execute() - def get_balance(self, - recipient_id): - """Does a GET request to /recipients/{recipient_id}/balance. + def create_transfer(self, + recipient_id, + request, + idempotency_key=None): + """Does a POST request to /recipients/{recipient_id}/transfers. - Get balance information for a recipient + Creates a transfer for a recipient Args: - recipient_id (str): Recipient id + recipient_id (str): Recipient Id + request (CreateTransferRequest): Transfer data + idempotency_key (str, optional): TODO: type description here. Returns: - GetBalanceResponse: Response from the API. + GetTransferResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -816,43 +664,44 @@ def get_balance(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/recipients/{recipient_id}/balance') - .http_method(HttpMethodEnum.GET) + .path('/recipients/{recipient_id}/transfers') + .http_method(HttpMethodEnum.POST) .template_param(Parameter() .key('recipient_id') .value(recipient_id) .should_encode(True)) + .body_param(Parameter() + .value(request)) + .header_param(Parameter() + .key('idempotency-key') + .value(idempotency_key)) + .header_param(Parameter() + .key('content-type') + .value('application/json; charset=utf-8')) .header_param(Parameter() .key('accept') .value('application/json')) + .body_serializer(APIHelper.json_serialize) .auth(Single('httpBasic')) ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) - .deserialize_into(GetBalanceResponse.from_dictionary) + .deserialize_into(GetTransferResponse.from_dictionary) ).execute() - def get_withdrawals(self, - recipient_id, - page=None, - size=None, - status=None, - created_since=None, - created_until=None): - """Does a GET request to /recipients/{recipient_id}/withdrawals. + def create_recipient(self, + request, + idempotency_key=None): + """Does a POST request to /recipients. - Gets a paginated list of transfers for the recipient + Creates a new recipient Args: - recipient_id (str): TODO: type description here. - page (int, optional): TODO: type description here. - size (int, optional): TODO: type description here. - status (str, optional): TODO: type description here. - created_since (datetime, optional): TODO: type description here. - created_until (datetime, optional): TODO: type description here. + request (CreateRecipientRequest): Recipient data + idempotency_key (str, optional): TODO: type description here. Returns: - ListWithdrawals: Response from the API. + GetRecipientResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -864,27 +713,47 @@ def get_withdrawals(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/recipients/{recipient_id}/withdrawals') + .path('/recipients') + .http_method(HttpMethodEnum.POST) + .body_param(Parameter() + .value(request)) + .header_param(Parameter() + .key('idempotency-key') + .value(idempotency_key)) + .header_param(Parameter() + .key('content-type') + .value('application/json; charset=utf-8')) + .header_param(Parameter() + .key('accept') + .value('application/json')) + .body_serializer(APIHelper.json_serialize) + .auth(Single('httpBasic')) + ).response( + ResponseHandler() + .deserializer(APIHelper.json_deserialize) + .deserialize_into(GetRecipientResponse.from_dictionary) + ).execute() + + def get_default_recipient(self): + """Does a GET request to /recipients/default. + + TODO: type endpoint description here. + + 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. + + """ + + return super().new_api_call_builder.request( + RequestBuilder().server(Server.DEFAULT) + .path('/recipients/default') .http_method(HttpMethodEnum.GET) - .template_param(Parameter() - .key('recipient_id') - .value(recipient_id) - .should_encode(True)) - .query_param(Parameter() - .key('page') - .value(page)) - .query_param(Parameter() - .key('size') - .value(size)) - .query_param(Parameter() - .key('status') - .value(status)) - .query_param(Parameter() - .key('created_since') - .value(APIHelper.when_defined(APIHelper.RFC3339DateTime, created_since))) - .query_param(Parameter() - .key('created_until') - .value(APIHelper.when_defined(APIHelper.RFC3339DateTime, created_until))) .header_param(Parameter() .key('accept') .value('application/json')) @@ -892,24 +761,24 @@ def get_withdrawals(self, ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) - .deserialize_into(ListWithdrawals.from_dictionary) + .deserialize_into(GetRecipientResponse.from_dictionary) ).execute() - def create_transfer(self, - recipient_id, - request, - idempotency_key=None): - """Does a POST request to /recipients/{recipient_id}/transfers. + def create_anticipation(self, + recipient_id, + request, + idempotency_key=None): + """Does a POST request to /recipients/{recipient_id}/anticipations. - Creates a transfer for a recipient + Creates an anticipation Args: - recipient_id (str): Recipient Id - request (CreateTransferRequest): Transfer data + recipient_id (str): Recipient id + request (CreateAnticipationRequest): Anticipation data idempotency_key (str, optional): TODO: type description here. Returns: - GetTransferResponse: Response from the API. + GetAnticipationResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -921,7 +790,7 @@ def create_transfer(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/recipients/{recipient_id}/transfers') + .path('/recipients/{recipient_id}/anticipations') .http_method(HttpMethodEnum.POST) .template_param(Parameter() .key('recipient_id') @@ -943,18 +812,68 @@ def create_transfer(self, ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) - .deserialize_into(GetTransferResponse.from_dictionary) + .deserialize_into(GetAnticipationResponse.from_dictionary) ).execute() - def create_recipient(self, - request, - idempotency_key=None): - """Does a POST request to /recipients. + def get_anticipation_limits(self, + recipient_id, + timeframe, + payment_date): + """Does a GET request to /recipients/{recipient_id}/anticipation_limits. - Creates a new recipient + Gets the anticipation limits for a recipient Args: - request (CreateRecipientRequest): Recipient data + recipient_id (str): Recipient id + timeframe (str): 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. + + """ + + return super().new_api_call_builder.request( + RequestBuilder().server(Server.DEFAULT) + .path('/recipients/{recipient_id}/anticipation_limits') + .http_method(HttpMethodEnum.GET) + .template_param(Parameter() + .key('recipient_id') + .value(recipient_id) + .should_encode(True)) + .query_param(Parameter() + .key('timeframe') + .value(timeframe)) + .query_param(Parameter() + .key('payment_date') + .value(APIHelper.when_defined(APIHelper.RFC3339DateTime, payment_date))) + .header_param(Parameter() + .key('accept') + .value('application/json')) + .auth(Single('httpBasic')) + ).response( + ResponseHandler() + .deserializer(APIHelper.json_deserialize) + .deserialize_into(GetAnticipationLimitResponse.from_dictionary) + ).execute() + + def update_recipient_metadata(self, + recipient_id, + request, + idempotency_key=None): + """Does a PATCH request to /recipients/{recipient_id}/metadata. + + Updates recipient metadata + + Args: + recipient_id (str): Recipient id + request (UpdateMetadataRequest): Metadata idempotency_key (str, optional): TODO: type description here. Returns: @@ -970,8 +889,12 @@ def create_recipient(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/recipients') - .http_method(HttpMethodEnum.POST) + .path('/recipients/{recipient_id}/metadata') + .http_method(HttpMethodEnum.PATCH) + .template_param(Parameter() + .key('recipient_id') + .value(recipient_id) + .should_encode(True)) .body_param(Parameter() .value(request)) .header_param(Parameter() @@ -991,17 +914,37 @@ def create_recipient(self, .deserialize_into(GetRecipientResponse.from_dictionary) ).execute() - def get_recipient_by_code(self, - code): - """Does a GET request to /recipients/{code}. + 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 recipient information + Retrieves a paginated list of anticipations from a recipient Args: - code (str): Recipient code + recipient_id (str): Recipient id + page (int, optional): Page number + size (int, optional): Page size + status (str, optional): Filter for anticipation status + timeframe (str, 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: - GetRecipientResponse: Response from the API. + ListAnticipationResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -1013,12 +956,36 @@ def get_recipient_by_code(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/recipients/{code}') + .path('/recipients/{recipient_id}/anticipations') .http_method(HttpMethodEnum.GET) .template_param(Parameter() - .key('code') - .value(code) + .key('recipient_id') + .value(recipient_id) .should_encode(True)) + .query_param(Parameter() + .key('page') + .value(page)) + .query_param(Parameter() + .key('size') + .value(size)) + .query_param(Parameter() + .key('status') + .value(status)) + .query_param(Parameter() + .key('timeframe') + .value(timeframe)) + .query_param(Parameter() + .key('payment_date_since') + .value(APIHelper.when_defined(APIHelper.RFC3339DateTime, payment_date_since))) + .query_param(Parameter() + .key('payment_date_until') + .value(APIHelper.when_defined(APIHelper.RFC3339DateTime, payment_date_until))) + .query_param(Parameter() + .key('created_since') + .value(APIHelper.when_defined(APIHelper.RFC3339DateTime, created_since))) + .query_param(Parameter() + .key('created_until') + .value(APIHelper.when_defined(APIHelper.RFC3339DateTime, created_until))) .header_param(Parameter() .key('accept') .value('application/json')) @@ -1026,16 +993,30 @@ def get_recipient_by_code(self, ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) - .deserialize_into(GetRecipientResponse.from_dictionary) + .deserialize_into(ListAnticipationResponse.from_dictionary) ).execute() - def get_default_recipient(self): - """Does a GET request to /recipients/default. + def get_withdrawals(self, + recipient_id, + page=None, + size=None, + status=None, + created_since=None, + created_until=None): + """Does a GET request to /recipients/{recipient_id}/withdrawals. - TODO: type endpoint description here. + Gets a paginated list of transfers for the recipient + + Args: + recipient_id (str): TODO: type description here. + page (int, optional): TODO: type description here. + size (int, optional): TODO: type description here. + status (str, optional): TODO: type description here. + created_since (datetime, optional): TODO: type description here. + created_until (datetime, optional): TODO: type description here. Returns: - GetRecipientResponse: Response from the API. + ListWithdrawals: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -1047,8 +1028,27 @@ def get_default_recipient(self): return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/recipients/default') + .path('/recipients/{recipient_id}/withdrawals') .http_method(HttpMethodEnum.GET) + .template_param(Parameter() + .key('recipient_id') + .value(recipient_id) + .should_encode(True)) + .query_param(Parameter() + .key('page') + .value(page)) + .query_param(Parameter() + .key('size') + .value(size)) + .query_param(Parameter() + .key('status') + .value(status)) + .query_param(Parameter() + .key('created_since') + .value(APIHelper.when_defined(APIHelper.RFC3339DateTime, created_since))) + .query_param(Parameter() + .key('created_until') + .value(APIHelper.when_defined(APIHelper.RFC3339DateTime, created_until))) .header_param(Parameter() .key('accept') .value('application/json')) @@ -1056,7 +1056,7 @@ def get_default_recipient(self): ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) - .deserialize_into(GetRecipientResponse.from_dictionary) + .deserialize_into(ListWithdrawals.from_dictionary) ).execute() def create_kyc_link(self, @@ -1066,7 +1066,7 @@ def create_kyc_link(self, Create a KYC link Args: - recipient_id (str): TODO: type description here. + recipient_id (str): Recipient id Returns: CreateKYCLinkResponse: Response from the API. diff --git a/pagarmeapisdk/controllers/subscriptions_controller.py b/pagarmeapisdk/controllers/subscriptions_controller.py index de8dd62..953ad1c 100644 --- a/pagarmeapisdk/controllers/subscriptions_controller.py +++ b/pagarmeapisdk/controllers/subscriptions_controller.py @@ -15,19 +15,19 @@ from apimatic_core.types.parameter import Parameter from pagarmeapisdk.http.http_method_enum import HttpMethodEnum from apimatic_core.authentication.multiple.single_auth import Single -from pagarmeapisdk.models.get_period_response import GetPeriodResponse from pagarmeapisdk.models.get_subscription_response import GetSubscriptionResponse -from pagarmeapisdk.models.get_usage_response import GetUsageResponse from pagarmeapisdk.models.get_discount_response import GetDiscountResponse -from pagarmeapisdk.models.list_subscription_items_response import ListSubscriptionItemsResponse +from pagarmeapisdk.models.list_usages_response import ListUsagesResponse +from pagarmeapisdk.models.get_period_response import GetPeriodResponse +from pagarmeapisdk.models.get_usage_report_response import GetUsageReportResponse +from pagarmeapisdk.models.get_usage_response import GetUsageResponse from pagarmeapisdk.models.get_subscription_item_response import GetSubscriptionItemResponse -from pagarmeapisdk.models.list_subscriptions_response import ListSubscriptionsResponse from pagarmeapisdk.models.get_increment_response import GetIncrementResponse -from pagarmeapisdk.models.list_cycles_response import ListCyclesResponse from pagarmeapisdk.models.list_discounts_response import ListDiscountsResponse +from pagarmeapisdk.models.list_subscription_items_response import ListSubscriptionItemsResponse +from pagarmeapisdk.models.list_subscriptions_response import ListSubscriptionsResponse +from pagarmeapisdk.models.list_cycles_response import ListCyclesResponse from pagarmeapisdk.models.list_increments_response import ListIncrementsResponse -from pagarmeapisdk.models.list_usages_response import ListUsagesResponse -from pagarmeapisdk.models.get_usage_report_response import GetUsageReportResponse class SubscriptionsController(BaseController): @@ -36,19 +36,22 @@ class SubscriptionsController(BaseController): def __init__(self, config): super(SubscriptionsController, self).__init__(config) - def renew_subscription(self, - subscription_id, - idempotency_key=None): - """Does a POST request to /subscriptions/{subscription_id}/cycles. + def update_subscription_card(self, + subscription_id, + request, + idempotency_key=None): + """Does a PATCH request to /subscriptions/{subscription_id}/card. - TODO: type endpoint description here. + Updates the credit card from a subscription Args: - subscription_id (str): TODO: type description here. + subscription_id (str): Subscription id + request (UpdateSubscriptionCardRequest): Request for updating a + card idempotency_key (str, optional): TODO: type description here. Returns: - GetPeriodResponse: Response from the API. + GetSubscriptionResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -60,41 +63,46 @@ def renew_subscription(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/subscriptions/{subscription_id}/cycles') - .http_method(HttpMethodEnum.POST) + .path('/subscriptions/{subscription_id}/card') + .http_method(HttpMethodEnum.PATCH) .template_param(Parameter() .key('subscription_id') .value(subscription_id) .should_encode(True)) + .body_param(Parameter() + .value(request)) .header_param(Parameter() .key('idempotency-key') .value(idempotency_key)) + .header_param(Parameter() + .key('content-type') + .value('application/json; charset=utf-8')) .header_param(Parameter() .key('accept') .value('application/json')) + .body_serializer(APIHelper.json_serialize) .auth(Single('httpBasic')) ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) - .deserialize_into(GetPeriodResponse.from_dictionary) + .deserialize_into(GetSubscriptionResponse.from_dictionary) ).execute() - def update_subscription_card(self, - subscription_id, - request, - idempotency_key=None): - """Does a PATCH request to /subscriptions/{subscription_id}/card. + def create_discount(self, + subscription_id, + request, + idempotency_key=None): + """Does a POST request to /subscriptions/{subscription_id}/discounts. - Updates the credit card from a subscription + Creates a discount Args: subscription_id (str): Subscription id - request (UpdateSubscriptionCardRequest): Request for updating a - card + request (CreateDiscountRequest): Request for creating a discount idempotency_key (str, optional): TODO: type description here. Returns: - GetSubscriptionResponse: Response from the API. + GetDiscountResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -106,8 +114,8 @@ def update_subscription_card(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/subscriptions/{subscription_id}/card') - .http_method(HttpMethodEnum.PATCH) + .path('/subscriptions/{subscription_id}/discounts') + .http_method(HttpMethodEnum.POST) .template_param(Parameter() .key('subscription_id') .value(subscription_id) @@ -128,26 +136,25 @@ def update_subscription_card(self, ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) - .deserialize_into(GetSubscriptionResponse.from_dictionary) + .deserialize_into(GetDiscountResponse.from_dictionary) ).execute() - def delete_usage(self, - subscription_id, - item_id, - usage_id, - idempotency_key=None): - """Does a DELETE request to /subscriptions/{subscription_id}/items/{item_id}/usages/{usage_id}. + def update_subscription_billing_date(self, + subscription_id, + request, + idempotency_key=None): + """Does a PATCH request to /subscriptions/{subscription_id}/billing-date. - Deletes a usage + Updates the billing date from a subscription Args: subscription_id (str): The subscription id - item_id (str): The subscription item id - usage_id (str): The usage id + request (UpdateSubscriptionBillingDateRequest): Request for + updating the subscription billing date idempotency_key (str, optional): TODO: type description here. Returns: - GetUsageResponse: Response from the API. + GetSubscriptionResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -159,48 +166,47 @@ def delete_usage(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/subscriptions/{subscription_id}/items/{item_id}/usages/{usage_id}') - .http_method(HttpMethodEnum.DELETE) + .path('/subscriptions/{subscription_id}/billing-date') + .http_method(HttpMethodEnum.PATCH) .template_param(Parameter() .key('subscription_id') .value(subscription_id) .should_encode(True)) - .template_param(Parameter() - .key('item_id') - .value(item_id) - .should_encode(True)) - .template_param(Parameter() - .key('usage_id') - .value(usage_id) - .should_encode(True)) + .body_param(Parameter() + .value(request)) .header_param(Parameter() .key('idempotency-key') .value(idempotency_key)) + .header_param(Parameter() + .key('content-type') + .value('application/json; charset=utf-8')) .header_param(Parameter() .key('accept') .value('application/json')) + .body_serializer(APIHelper.json_serialize) .auth(Single('httpBasic')) ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) - .deserialize_into(GetUsageResponse.from_dictionary) + .deserialize_into(GetSubscriptionResponse.from_dictionary) ).execute() - def create_discount(self, - subscription_id, - request, - idempotency_key=None): - """Does a POST request to /subscriptions/{subscription_id}/discounts. + def update_subscription_start_at(self, + subscription_id, + request, + idempotency_key=None): + """Does a PATCH request to /subscriptions/{subscription_id}/start-at. - Creates a discount + Updates the start at date from a subscription Args: - subscription_id (str): Subscription id - request (CreateDiscountRequest): Request for creating a discount + subscription_id (str): The subscription id + request (UpdateSubscriptionStartAtRequest): Request for updating + the subscription start date idempotency_key (str, optional): TODO: type description here. Returns: - GetDiscountResponse: Response from the API. + GetSubscriptionResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -212,8 +218,8 @@ def create_discount(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/subscriptions/{subscription_id}/discounts') - .http_method(HttpMethodEnum.POST) + .path('/subscriptions/{subscription_id}/start-at') + .http_method(HttpMethodEnum.PATCH) .template_param(Parameter() .key('subscription_id') .value(subscription_id) @@ -234,24 +240,72 @@ def create_discount(self, ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) - .deserialize_into(GetDiscountResponse.from_dictionary) + .deserialize_into(GetSubscriptionResponse.from_dictionary) ).execute() - def create_an_usage(self, - subscription_id, - item_id, - idempotency_key=None): - """Does a POST request to /subscriptions/{subscription_id}/items/{item_id}/usages. + def get_subscription(self, + subscription_id): + """Does a GET request to /subscriptions/{subscription_id}. - Create Usage + Gets a subscription Args: subscription_id (str): Subscription id - item_id (str): Item id - idempotency_key (str, optional): TODO: type description here. Returns: - GetUsageResponse: Response from the API. + GetSubscriptionResponse: 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. + + """ + + return super().new_api_call_builder.request( + RequestBuilder().server(Server.DEFAULT) + .path('/subscriptions/{subscription_id}') + .http_method(HttpMethodEnum.GET) + .template_param(Parameter() + .key('subscription_id') + .value(subscription_id) + .should_encode(True)) + .header_param(Parameter() + .key('accept') + .value('application/json')) + .auth(Single('httpBasic')) + ).response( + ResponseHandler() + .deserializer(APIHelper.json_deserialize) + .deserialize_into(GetSubscriptionResponse.from_dictionary) + ).execute() + + def get_usages(self, + subscription_id, + item_id, + page=None, + size=None, + code=None, + group=None, + used_since=None, + used_until=None): + """Does a GET request to /subscriptions/{subscription_id}/items/{item_id}/usages. + + Lists all usages from a subscription item + + Args: + subscription_id (str): The subscription id + item_id (str): The subscription item id + page (int, optional): Page number + size (int, optional): Page size + code (str, optional): Identification code in the client system + group (str, optional): Identification group in the client system + used_since (datetime, optional): TODO: type description here. + used_until (datetime, optional): TODO: type description here. + + Returns: + ListUsagesResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -264,7 +318,7 @@ def create_an_usage(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) .path('/subscriptions/{subscription_id}/items/{item_id}/usages') - .http_method(HttpMethodEnum.POST) + .http_method(HttpMethodEnum.GET) .template_param(Parameter() .key('subscription_id') .value(subscription_id) @@ -273,9 +327,24 @@ def create_an_usage(self, .key('item_id') .value(item_id) .should_encode(True)) - .header_param(Parameter() - .key('idempotency-key') - .value(idempotency_key)) + .query_param(Parameter() + .key('page') + .value(page)) + .query_param(Parameter() + .key('size') + .value(size)) + .query_param(Parameter() + .key('code') + .value(code)) + .query_param(Parameter() + .key('group') + .value(group)) + .query_param(Parameter() + .key('used_since') + .value(APIHelper.when_defined(APIHelper.RFC3339DateTime, used_since))) + .query_param(Parameter() + .key('used_until') + .value(APIHelper.when_defined(APIHelper.RFC3339DateTime, used_until))) .header_param(Parameter() .key('accept') .value('application/json')) @@ -283,25 +352,25 @@ def create_an_usage(self, ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) - .deserialize_into(GetUsageResponse.from_dictionary) + .deserialize_into(ListUsagesResponse.from_dictionary) ).execute() - def update_current_cycle_status(self, + def update_latest_period_end_at(self, subscription_id, request, idempotency_key=None): - """Does a PATCH request to /subscriptions/{subscription_id}/cycle-status. + """Does a PATCH request to /subscriptions/{subscription_id}/periods/latest/end-at. TODO: type endpoint description here. Args: - subscription_id (str): Subscription Id - request (UpdateCurrentCycleStatusRequest): Request for updating - the end date of the subscription current status + subscription_id (str): TODO: type description here. + request (UpdateCurrentCycleEndDateRequest): Request for updating + the end date of the current signature cycle idempotency_key (str, optional): TODO: type description here. Returns: - void: Response from the API. + GetSubscriptionResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -313,7 +382,7 @@ def update_current_cycle_status(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/subscriptions/{subscription_id}/cycle-status') + .path('/subscriptions/{subscription_id}/periods/latest/end-at') .http_method(HttpMethodEnum.PATCH) .template_param(Parameter() .key('subscription_id') @@ -327,8 +396,15 @@ def update_current_cycle_status(self, .header_param(Parameter() .key('content-type') .value('application/json; charset=utf-8')) + .header_param(Parameter() + .key('accept') + .value('application/json')) .body_serializer(APIHelper.json_serialize) .auth(Single('httpBasic')) + ).response( + ResponseHandler() + .deserializer(APIHelper.json_deserialize) + .deserialize_into(GetSubscriptionResponse.from_dictionary) ).execute() def delete_discount(self, @@ -380,86 +456,6 @@ def delete_discount(self, .deserialize_into(GetDiscountResponse.from_dictionary) ).execute() - def get_subscription_items(self, - subscription_id, - page=None, - size=None, - name=None, - code=None, - status=None, - description=None, - created_since=None, - created_until=None): - """Does a GET request to /subscriptions/{subscription_id}/items. - - Get Subscription Items - - Args: - subscription_id (str): The subscription id - page (int, optional): Page number - size (int, optional): Page size - name (str, optional): The item name - code (str, optional): Identification code in the client system - status (str, optional): The item statis - description (str, optional): The item description - created_since (str, optional): Filter for item's creation date - start range - created_until (str, optional): Filter for item's creation date end - range - - Returns: - ListSubscriptionItemsResponse: 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. - - """ - - return super().new_api_call_builder.request( - RequestBuilder().server(Server.DEFAULT) - .path('/subscriptions/{subscription_id}/items') - .http_method(HttpMethodEnum.GET) - .template_param(Parameter() - .key('subscription_id') - .value(subscription_id) - .should_encode(True)) - .query_param(Parameter() - .key('page') - .value(page)) - .query_param(Parameter() - .key('size') - .value(size)) - .query_param(Parameter() - .key('name') - .value(name)) - .query_param(Parameter() - .key('code') - .value(code)) - .query_param(Parameter() - .key('status') - .value(status)) - .query_param(Parameter() - .key('description') - .value(description)) - .query_param(Parameter() - .key('created_since') - .value(created_since)) - .query_param(Parameter() - .key('created_until') - .value(created_until)) - .header_param(Parameter() - .key('accept') - .value('application/json')) - .auth(Single('httpBasic')) - ).response( - ResponseHandler() - .deserializer(APIHelper.json_deserialize) - .deserialize_into(ListSubscriptionItemsResponse.from_dictionary) - ).execute() - def update_subscription_payment_method(self, subscription_id, request, @@ -512,19 +508,22 @@ def update_subscription_payment_method(self, .deserialize_into(GetSubscriptionResponse.from_dictionary) ).execute() - def get_subscription_item(self, - subscription_id, - item_id): - """Does a GET request to /subscriptions/{subscription_id}/items/{item_id}. + def cancel_subscription(self, + subscription_id, + request=None, + idempotency_key=None): + """Does a DELETE request to /subscriptions/{subscription_id}. - Get Subscription Item + Cancels a subscription Args: - subscription_id (str): Subscription Id - item_id (str): Item id + subscription_id (str): Subscription id + request (CreateCancelSubscriptionRequest, optional): Request for + cancelling a subscription + idempotency_key (str, optional): TODO: type description here. Returns: - GetSubscriptionItemResponse: Response from the API. + GetSubscriptionResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -536,65 +535,45 @@ def get_subscription_item(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/subscriptions/{subscription_id}/items/{item_id}') - .http_method(HttpMethodEnum.GET) + .path('/subscriptions/{subscription_id}') + .http_method(HttpMethodEnum.DELETE) .template_param(Parameter() .key('subscription_id') .value(subscription_id) .should_encode(True)) - .template_param(Parameter() - .key('item_id') - .value(item_id) - .should_encode(True)) + .body_param(Parameter() + .value(request)) + .header_param(Parameter() + .key('idempotency-key') + .value(idempotency_key)) + .header_param(Parameter() + .key('content-type') + .value('application/json; charset=utf-8')) .header_param(Parameter() .key('accept') .value('application/json')) + .body_serializer(APIHelper.json_serialize) .auth(Single('httpBasic')) ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) - .deserialize_into(GetSubscriptionItemResponse.from_dictionary) + .deserialize_into(GetSubscriptionResponse.from_dictionary) ).execute() - def get_subscriptions(self, - page=None, - size=None, - code=None, - billing_type=None, - customer_id=None, - plan_id=None, - card_id=None, - status=None, - next_billing_since=None, - next_billing_until=None, - created_since=None, - created_until=None): - """Does a GET request to /subscriptions. + def create_subscription(self, + body, + idempotency_key=None): + """Does a POST request to /subscriptions. - Gets all subscriptions + Creates a new subscription Args: - page (int, optional): Page number - size (int, optional): Page size - code (str, optional): Filter for subscription's code - billing_type (str, optional): Filter for subscription's billing - type - customer_id (str, optional): Filter for subscription's customer - id - plan_id (str, optional): Filter for subscription's plan id - card_id (str, optional): Filter for subscription's card id - status (str, optional): Filter for subscription's status - next_billing_since (datetime, optional): Filter for subscription's - next billing date start range - next_billing_until (datetime, optional): Filter for subscription's - next billing date end range - created_since (datetime, optional): Filter for subscription's - creation date start range - created_until (datetime, optional): Filter for subscriptions - creation date end range + body (CreateSubscriptionRequest): Request for creating a + subscription + idempotency_key (str, optional): TODO: type description here. Returns: - ListSubscriptionsResponse: Response from the API. + GetSubscriptionResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -607,65 +586,38 @@ def get_subscriptions(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) .path('/subscriptions') - .http_method(HttpMethodEnum.GET) - .query_param(Parameter() - .key('page') - .value(page)) - .query_param(Parameter() - .key('size') - .value(size)) - .query_param(Parameter() - .key('code') - .value(code)) - .query_param(Parameter() - .key('billing_type') - .value(billing_type)) - .query_param(Parameter() - .key('customer_id') - .value(customer_id)) - .query_param(Parameter() - .key('plan_id') - .value(plan_id)) - .query_param(Parameter() - .key('card_id') - .value(card_id)) - .query_param(Parameter() - .key('status') - .value(status)) - .query_param(Parameter() - .key('next_billing_since') - .value(APIHelper.when_defined(APIHelper.RFC3339DateTime, next_billing_since))) - .query_param(Parameter() - .key('next_billing_until') - .value(APIHelper.when_defined(APIHelper.RFC3339DateTime, next_billing_until))) - .query_param(Parameter() - .key('created_since') - .value(APIHelper.when_defined(APIHelper.RFC3339DateTime, created_since))) - .query_param(Parameter() - .key('created_until') - .value(APIHelper.when_defined(APIHelper.RFC3339DateTime, created_until))) + .http_method(HttpMethodEnum.POST) + .body_param(Parameter() + .value(body)) + .header_param(Parameter() + .key('idempotency-key') + .value(idempotency_key)) + .header_param(Parameter() + .key('content-type') + .value('application/json; charset=utf-8')) .header_param(Parameter() .key('accept') .value('application/json')) + .body_serializer(APIHelper.json_serialize) .auth(Single('httpBasic')) ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) - .deserialize_into(ListSubscriptionsResponse.from_dictionary) + .deserialize_into(GetSubscriptionResponse.from_dictionary) ).execute() - def cancel_subscription(self, - subscription_id, - request=None, - idempotency_key=None): - """Does a DELETE request to /subscriptions/{subscription_id}. + def update_subscription_affiliation_id(self, + subscription_id, + request, + idempotency_key=None): + """Does a PATCH request to /subscriptions/{subscription_id}/gateway-affiliation-id. - Cancels a subscription + TODO: type endpoint description here. Args: - subscription_id (str): Subscription id - request (CreateCancelSubscriptionRequest, optional): Request for - cancelling a subscription + subscription_id (str): TODO: type description here. + request (UpdateSubscriptionAffiliationIdRequest): Request for + updating a subscription affiliation id idempotency_key (str, optional): TODO: type description here. Returns: @@ -681,8 +633,8 @@ def cancel_subscription(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/subscriptions/{subscription_id}') - .http_method(HttpMethodEnum.DELETE) + .path('/subscriptions/{subscription_id}/gateway-affiliation-id') + .http_method(HttpMethodEnum.PATCH) .template_param(Parameter() .key('subscription_id') .value(subscription_id) @@ -706,22 +658,22 @@ def cancel_subscription(self, .deserialize_into(GetSubscriptionResponse.from_dictionary) ).execute() - def create_increment(self, - subscription_id, - request, - idempotency_key=None): - """Does a POST request to /subscriptions/{subscription_id}/increments. + def update_subscription_minium_price(self, + subscription_id, + request, + idempotency_key=None): + """Does a PATCH request to /subscriptions/{subscription_id}/minimum_price. - Creates a increment + Atualização do valor mínimo da assinatura Args: - subscription_id (str): Subscription id - request (CreateIncrementRequest): Request for creating a - increment + subscription_id (str): Subscription Id + request (UpdateSubscriptionMinimumPriceRequest): Request da + requisição com o valor mínimo que será configurado idempotency_key (str, optional): TODO: type description here. Returns: - GetIncrementResponse: Response from the API. + GetSubscriptionResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -733,8 +685,8 @@ def create_increment(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/subscriptions/{subscription_id}/increments') - .http_method(HttpMethodEnum.POST) + .path('/subscriptions/{subscription_id}/minimum_price') + .http_method(HttpMethodEnum.PATCH) .template_param(Parameter() .key('subscription_id') .value(subscription_id) @@ -755,26 +707,22 @@ def create_increment(self, ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) - .deserialize_into(GetIncrementResponse.from_dictionary) + .deserialize_into(GetSubscriptionResponse.from_dictionary) ).execute() - def create_usage(self, - subscription_id, - item_id, - body, - idempotency_key=None): - """Does a POST request to /subscriptions/{subscription_id}/items/{item_id}/usages. + def get_subscription_cycle_by_id(self, + subscription_id, + cycle_id): + """Does a GET request to /subscriptions/{subscription_id}/cycles/{cycleId}. - Creates a usage + TODO: type endpoint description here. Args: - subscription_id (str): Subscription Id - item_id (str): Item id - body (CreateUsageRequest): Request for creating a usage - idempotency_key (str, optional): TODO: type description here. + subscription_id (str): The subscription id + cycle_id (str): TODO: type description here. Returns: - GetUsageResponse: Response from the API. + GetPeriodResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -786,48 +734,39 @@ def create_usage(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/subscriptions/{subscription_id}/items/{item_id}/usages') - .http_method(HttpMethodEnum.POST) + .path('/subscriptions/{subscription_id}/cycles/{cycleId}') + .http_method(HttpMethodEnum.GET) .template_param(Parameter() .key('subscription_id') .value(subscription_id) .should_encode(True)) .template_param(Parameter() - .key('item_id') - .value(item_id) + .key('cycleId') + .value(cycle_id) .should_encode(True)) - .body_param(Parameter() - .value(body)) - .header_param(Parameter() - .key('idempotency-key') - .value(idempotency_key)) - .header_param(Parameter() - .key('content-type') - .value('application/json; charset=utf-8')) .header_param(Parameter() .key('accept') .value('application/json')) - .body_serializer(APIHelper.json_serialize) .auth(Single('httpBasic')) ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) - .deserialize_into(GetUsageResponse.from_dictionary) + .deserialize_into(GetPeriodResponse.from_dictionary) ).execute() - def get_discount_by_id(self, - subscription_id, - discount_id): - """Does a GET request to /subscriptions/{subscription_id}/discounts/{discountId}. + def get_usage_report(self, + subscription_id, + period_id): + """Does a GET request to /subscriptions/{subscription_id}/periods/{period_id}/usages/report. TODO: type endpoint description here. Args: - subscription_id (str): The subscription id - discount_id (str): TODO: type description here. + subscription_id (str): The subscription Id + period_id (str): The period Id Returns: - GetDiscountResponse: Response from the API. + GetUsageReportResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -839,15 +778,15 @@ def get_discount_by_id(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/subscriptions/{subscription_id}/discounts/{discountId}') + .path('/subscriptions/{subscription_id}/periods/{period_id}/usages/report') .http_method(HttpMethodEnum.GET) .template_param(Parameter() .key('subscription_id') .value(subscription_id) .should_encode(True)) .template_param(Parameter() - .key('discountId') - .value(discount_id) + .key('period_id') + .value(period_id) .should_encode(True)) .header_param(Parameter() .key('accept') @@ -856,23 +795,22 @@ def get_discount_by_id(self, ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) - .deserialize_into(GetDiscountResponse.from_dictionary) + .deserialize_into(GetUsageReportResponse.from_dictionary) ).execute() - def create_subscription(self, - body, - idempotency_key=None): - """Does a POST request to /subscriptions. + def renew_subscription(self, + subscription_id, + idempotency_key=None): + """Does a POST request to /subscriptions/{subscription_id}/cycles. - Creates a new subscription + TODO: type endpoint description here. Args: - body (CreateSubscriptionRequest): Request for creating a - subscription + subscription_id (str): TODO: type description here. idempotency_key (str, optional): TODO: type description here. Returns: - GetSubscriptionResponse: Response from the API. + GetPeriodResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -884,40 +822,42 @@ def create_subscription(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/subscriptions') + .path('/subscriptions/{subscription_id}/cycles') .http_method(HttpMethodEnum.POST) - .body_param(Parameter() - .value(body)) + .template_param(Parameter() + .key('subscription_id') + .value(subscription_id) + .should_encode(True)) .header_param(Parameter() .key('idempotency-key') .value(idempotency_key)) - .header_param(Parameter() - .key('content-type') - .value('application/json; charset=utf-8')) .header_param(Parameter() .key('accept') .value('application/json')) - .body_serializer(APIHelper.json_serialize) .auth(Single('httpBasic')) ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) - .deserialize_into(GetSubscriptionResponse.from_dictionary) + .deserialize_into(GetPeriodResponse.from_dictionary) ).execute() - def get_increment_by_id(self, - subscription_id, - increment_id): - """Does a GET request to /subscriptions/{subscription_id}/increments/{increment_id}. + def delete_usage(self, + subscription_id, + item_id, + usage_id, + idempotency_key=None): + """Does a DELETE request to /subscriptions/{subscription_id}/items/{item_id}/usages/{usage_id}. - TODO: type endpoint description here. + Deletes a usage Args: - subscription_id (str): The subscription Id - increment_id (str): The increment Id + subscription_id (str): The subscription id + item_id (str): The subscription item id + usage_id (str): The usage id + idempotency_key (str, optional): TODO: type description here. Returns: - GetIncrementResponse: Response from the API. + GetUsageResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -929,16 +869,23 @@ def get_increment_by_id(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/subscriptions/{subscription_id}/increments/{increment_id}') - .http_method(HttpMethodEnum.GET) + .path('/subscriptions/{subscription_id}/items/{item_id}/usages/{usage_id}') + .http_method(HttpMethodEnum.DELETE) .template_param(Parameter() .key('subscription_id') .value(subscription_id) .should_encode(True)) .template_param(Parameter() - .key('increment_id') - .value(increment_id) + .key('item_id') + .value(item_id) + .should_encode(True)) + .template_param(Parameter() + .key('usage_id') + .value(usage_id) .should_encode(True)) + .header_param(Parameter() + .key('idempotency-key') + .value(idempotency_key)) .header_param(Parameter() .key('accept') .value('application/json')) @@ -946,25 +893,24 @@ def get_increment_by_id(self, ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) - .deserialize_into(GetIncrementResponse.from_dictionary) + .deserialize_into(GetUsageResponse.from_dictionary) ).execute() - def update_subscription_affiliation_id(self, - subscription_id, - request, - idempotency_key=None): - """Does a PATCH request to /subscriptions/{subscription_id}/gateway-affiliation-id. + def create_an_usage(self, + subscription_id, + item_id, + idempotency_key=None): + """Does a POST request to /subscriptions/{subscription_id}/items/{item_id}/usages. - TODO: type endpoint description here. + Create Usage Args: - subscription_id (str): TODO: type description here. - request (UpdateSubscriptionAffiliationIdRequest): Request for - updating a subscription affiliation id + subscription_id (str): Subscription id + item_id (str): Item id idempotency_key (str, optional): TODO: type description here. Returns: - GetSubscriptionResponse: Response from the API. + GetUsageResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -976,47 +922,45 @@ def update_subscription_affiliation_id(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/subscriptions/{subscription_id}/gateway-affiliation-id') - .http_method(HttpMethodEnum.PATCH) + .path('/subscriptions/{subscription_id}/items/{item_id}/usages') + .http_method(HttpMethodEnum.POST) .template_param(Parameter() .key('subscription_id') .value(subscription_id) .should_encode(True)) - .body_param(Parameter() - .value(request)) + .template_param(Parameter() + .key('item_id') + .value(item_id) + .should_encode(True)) .header_param(Parameter() .key('idempotency-key') .value(idempotency_key)) - .header_param(Parameter() - .key('content-type') - .value('application/json; charset=utf-8')) .header_param(Parameter() .key('accept') .value('application/json')) - .body_serializer(APIHelper.json_serialize) .auth(Single('httpBasic')) ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) - .deserialize_into(GetSubscriptionResponse.from_dictionary) + .deserialize_into(GetUsageResponse.from_dictionary) ).execute() - def update_subscription_metadata(self, - subscription_id, - request, - idempotency_key=None): - """Does a PATCH request to /Subscriptions/{subscription_id}/metadata. + def update_current_cycle_status(self, + subscription_id, + request, + idempotency_key=None): + """Does a PATCH request to /subscriptions/{subscription_id}/cycle-status. - Updates the metadata from a subscription + TODO: type endpoint description here. Args: - subscription_id (str): The subscription id - request (UpdateMetadataRequest): Request for updating the - subscrption metadata + subscription_id (str): Subscription Id + request (UpdateCurrentCycleStatusRequest): Request for updating + the end date of the subscription current status idempotency_key (str, optional): TODO: type description here. Returns: - GetSubscriptionResponse: Response from the API. + void: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -1028,7 +972,7 @@ def update_subscription_metadata(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/Subscriptions/{subscription_id}/metadata') + .path('/subscriptions/{subscription_id}/cycle-status') .http_method(HttpMethodEnum.PATCH) .template_param(Parameter() .key('subscription_id') @@ -1042,32 +986,23 @@ def update_subscription_metadata(self, .header_param(Parameter() .key('content-type') .value('application/json; charset=utf-8')) - .header_param(Parameter() - .key('accept') - .value('application/json')) .body_serializer(APIHelper.json_serialize) .auth(Single('httpBasic')) - ).response( - ResponseHandler() - .deserializer(APIHelper.json_deserialize) - .deserialize_into(GetSubscriptionResponse.from_dictionary) ).execute() - def delete_increment(self, - subscription_id, - increment_id, - idempotency_key=None): - """Does a DELETE request to /subscriptions/{subscription_id}/increments/{increment_id}. + def get_subscription_item(self, + subscription_id, + item_id): + """Does a GET request to /subscriptions/{subscription_id}/items/{item_id}. - Deletes a increment + Get Subscription Item Args: - subscription_id (str): Subscription id - increment_id (str): Increment id - idempotency_key (str, optional): TODO: type description here. + subscription_id (str): Subscription Id + item_id (str): Item id Returns: - GetIncrementResponse: Response from the API. + GetSubscriptionItemResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -1079,19 +1014,16 @@ def delete_increment(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/subscriptions/{subscription_id}/increments/{increment_id}') - .http_method(HttpMethodEnum.DELETE) + .path('/subscriptions/{subscription_id}/items/{item_id}') + .http_method(HttpMethodEnum.GET) .template_param(Parameter() .key('subscription_id') .value(subscription_id) .should_encode(True)) .template_param(Parameter() - .key('increment_id') - .value(increment_id) + .key('item_id') + .value(item_id) .should_encode(True)) - .header_param(Parameter() - .key('idempotency-key') - .value(idempotency_key)) .header_param(Parameter() .key('accept') .value('application/json')) @@ -1099,24 +1031,22 @@ def delete_increment(self, ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) - .deserialize_into(GetIncrementResponse.from_dictionary) + .deserialize_into(GetSubscriptionItemResponse.from_dictionary) ).execute() - def get_subscription_cycles(self, - subscription_id, - page, - size): - """Does a GET request to /subscriptions/{subscription_id}/cycles. + def get_increment_by_id(self, + subscription_id, + increment_id): + """Does a GET request to /subscriptions/{subscription_id}/increments/{increment_id}. TODO: type endpoint description here. Args: - subscription_id (str): Subscription Id - page (str): Page number - size (str): Page size + subscription_id (str): The subscription Id + increment_id (str): The increment Id Returns: - ListCyclesResponse: Response from the API. + GetIncrementResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -1128,18 +1058,16 @@ def get_subscription_cycles(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/subscriptions/{subscription_id}/cycles') + .path('/subscriptions/{subscription_id}/increments/{increment_id}') .http_method(HttpMethodEnum.GET) .template_param(Parameter() .key('subscription_id') .value(subscription_id) .should_encode(True)) - .query_param(Parameter() - .key('page') - .value(page)) - .query_param(Parameter() - .key('size') - .value(size)) + .template_param(Parameter() + .key('increment_id') + .value(increment_id) + .should_encode(True)) .header_param(Parameter() .key('accept') .value('application/json')) @@ -1147,24 +1075,24 @@ def get_subscription_cycles(self, ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) - .deserialize_into(ListCyclesResponse.from_dictionary) + .deserialize_into(GetIncrementResponse.from_dictionary) ).execute() - def get_discounts(self, - subscription_id, - page, - size): - """Does a GET request to /subscriptions/{subscription_id}/discounts/. + def delete_increment(self, + subscription_id, + increment_id, + idempotency_key=None): + """Does a DELETE request to /subscriptions/{subscription_id}/increments/{increment_id}. - TODO: type endpoint description here. + Deletes a increment Args: - subscription_id (str): The subscription id - page (int): Page number - size (int): Page size - + subscription_id (str): Subscription id + increment_id (str): Increment id + idempotency_key (str, optional): TODO: type description here. + Returns: - ListDiscountsResponse: Response from the API. + GetIncrementResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -1176,18 +1104,19 @@ def get_discounts(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/subscriptions/{subscription_id}/discounts/') - .http_method(HttpMethodEnum.GET) + .path('/subscriptions/{subscription_id}/increments/{increment_id}') + .http_method(HttpMethodEnum.DELETE) .template_param(Parameter() .key('subscription_id') .value(subscription_id) .should_encode(True)) - .query_param(Parameter() - .key('page') - .value(page)) - .query_param(Parameter() - .key('size') - .value(size)) + .template_param(Parameter() + .key('increment_id') + .value(increment_id) + .should_encode(True)) + .header_param(Parameter() + .key('idempotency-key') + .value(idempotency_key)) .header_param(Parameter() .key('accept') .value('application/json')) @@ -1195,25 +1124,24 @@ def get_discounts(self, ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) - .deserialize_into(ListDiscountsResponse.from_dictionary) + .deserialize_into(GetIncrementResponse.from_dictionary) ).execute() - def update_subscription_billing_date(self, - subscription_id, - request, - idempotency_key=None): - """Does a PATCH request to /subscriptions/{subscription_id}/billing-date. + def get_discounts(self, + subscription_id, + page, + size): + """Does a GET request to /subscriptions/{subscription_id}/discounts/. - Updates the billing date from a subscription + TODO: type endpoint description here. Args: subscription_id (str): The subscription id - request (UpdateSubscriptionBillingDateRequest): Request for - updating the subscription billing date - idempotency_key (str, optional): TODO: type description here. + page (int): Page number + size (int): Page size Returns: - GetSubscriptionResponse: Response from the API. + ListDiscountsResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -1225,46 +1153,44 @@ def update_subscription_billing_date(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/subscriptions/{subscription_id}/billing-date') - .http_method(HttpMethodEnum.PATCH) + .path('/subscriptions/{subscription_id}/discounts/') + .http_method(HttpMethodEnum.GET) .template_param(Parameter() .key('subscription_id') .value(subscription_id) .should_encode(True)) - .body_param(Parameter() - .value(request)) - .header_param(Parameter() - .key('idempotency-key') - .value(idempotency_key)) - .header_param(Parameter() - .key('content-type') - .value('application/json; charset=utf-8')) + .query_param(Parameter() + .key('page') + .value(page)) + .query_param(Parameter() + .key('size') + .value(size)) .header_param(Parameter() .key('accept') .value('application/json')) - .body_serializer(APIHelper.json_serialize) .auth(Single('httpBasic')) ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) - .deserialize_into(GetSubscriptionResponse.from_dictionary) + .deserialize_into(ListDiscountsResponse.from_dictionary) ).execute() - def delete_subscription_item(self, - subscription_id, - subscription_item_id, - idempotency_key=None): - """Does a DELETE request to /subscriptions/{subscription_id}/items/{subscription_item_id}. + def update_subscription_due_days(self, + subscription_id, + request, + idempotency_key=None): + """Does a PATCH request to /subscriptions/{subscription_id}/boleto-due-days. - Deletes a subscription item + Updates the boleto due days from a subscription Args: - subscription_id (str): Subscription id - subscription_item_id (str): Subscription item id + subscription_id (str): Subscription Id + request (UpdateSubscriptionDueDaysRequest): TODO: type description + here. idempotency_key (str, optional): TODO: type description here. Returns: - GetSubscriptionItemResponse: Response from the API. + GetSubscriptionResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -1276,44 +1202,47 @@ def delete_subscription_item(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/subscriptions/{subscription_id}/items/{subscription_item_id}') - .http_method(HttpMethodEnum.DELETE) + .path('/subscriptions/{subscription_id}/boleto-due-days') + .http_method(HttpMethodEnum.PATCH) .template_param(Parameter() .key('subscription_id') .value(subscription_id) .should_encode(True)) - .template_param(Parameter() - .key('subscription_item_id') - .value(subscription_item_id) - .should_encode(True)) + .body_param(Parameter() + .value(request)) .header_param(Parameter() .key('idempotency-key') .value(idempotency_key)) + .header_param(Parameter() + .key('content-type') + .value('application/json; charset=utf-8')) .header_param(Parameter() .key('accept') .value('application/json')) + .body_serializer(APIHelper.json_serialize) .auth(Single('httpBasic')) ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) - .deserialize_into(GetSubscriptionItemResponse.from_dictionary) + .deserialize_into(GetSubscriptionResponse.from_dictionary) ).execute() - def get_increments(self, - subscription_id, - page=None, - size=None): - """Does a GET request to /subscriptions/{subscription_id}/increments/. + def create_subscription_item(self, + subscription_id, + request, + idempotency_key=None): + """Does a POST request to /subscriptions/{subscription_id}/items. - TODO: type endpoint description here. + Creates a new Subscription item Args: - subscription_id (str): The subscription id - page (int, optional): Page number - size (int, optional): Page size + subscription_id (str): Subscription id + request (CreateSubscriptionItemRequest): Request for creating a + subscription item + idempotency_key (str, optional): TODO: type description here. Returns: - ListIncrementsResponse: Response from the API. + GetSubscriptionItemResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -1325,41 +1254,42 @@ def get_increments(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/subscriptions/{subscription_id}/increments/') - .http_method(HttpMethodEnum.GET) + .path('/subscriptions/{subscription_id}/items') + .http_method(HttpMethodEnum.POST) .template_param(Parameter() .key('subscription_id') .value(subscription_id) .should_encode(True)) - .query_param(Parameter() - .key('page') - .value(page)) - .query_param(Parameter() - .key('size') - .value(size)) + .body_param(Parameter() + .value(request)) + .header_param(Parameter() + .key('idempotency-key') + .value(idempotency_key)) + .header_param(Parameter() + .key('content-type') + .value('application/json; charset=utf-8')) .header_param(Parameter() .key('accept') .value('application/json')) + .body_serializer(APIHelper.json_serialize) .auth(Single('httpBasic')) ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) - .deserialize_into(ListIncrementsResponse.from_dictionary) + .deserialize_into(GetSubscriptionItemResponse.from_dictionary) ).execute() - def update_subscription_due_days(self, - subscription_id, - request, - idempotency_key=None): - """Does a PATCH request to /subscriptions/{subscription_id}/boleto-due-days. + def update_split_subscription(self, + id, + request): + """Does a PATCH request to /subscriptions/{id}/split. - Updates the boleto due days from a subscription + TODO: type endpoint description here. Args: - subscription_id (str): Subscription Id - request (UpdateSubscriptionDueDaysRequest): TODO: type description + id (str): Subscription's id + request (UpdateSubscriptionSplitRequest): TODO: type description here. - idempotency_key (str, optional): TODO: type description here. Returns: GetSubscriptionResponse: Response from the API. @@ -1374,17 +1304,14 @@ def update_subscription_due_days(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/subscriptions/{subscription_id}/boleto-due-days') + .path('/subscriptions/{id}/split') .http_method(HttpMethodEnum.PATCH) .template_param(Parameter() - .key('subscription_id') - .value(subscription_id) + .key('id') + .value(id) .should_encode(True)) .body_param(Parameter() .value(request)) - .header_param(Parameter() - .key('idempotency-key') - .value(idempotency_key)) .header_param(Parameter() .key('content-type') .value('application/json; charset=utf-8')) @@ -1399,22 +1326,35 @@ def update_subscription_due_days(self, .deserialize_into(GetSubscriptionResponse.from_dictionary) ).execute() - def update_subscription_start_at(self, - subscription_id, - request, - idempotency_key=None): - """Does a PATCH request to /subscriptions/{subscription_id}/start-at. + def get_subscription_items(self, + subscription_id, + page=None, + size=None, + name=None, + code=None, + status=None, + description=None, + created_since=None, + created_until=None): + """Does a GET request to /subscriptions/{subscription_id}/items. - Updates the start at date from a subscription + Get Subscription Items Args: subscription_id (str): The subscription id - request (UpdateSubscriptionStartAtRequest): Request for updating - the subscription start date - idempotency_key (str, optional): TODO: type description here. + page (int, optional): Page number + size (int, optional): Page size + name (str, optional): The item name + code (str, optional): Identification code in the client system + status (str, optional): The item statis + description (str, optional): The item description + created_since (str, optional): Filter for item's creation date + start range + created_until (str, optional): Filter for item's creation date end + range Returns: - GetSubscriptionResponse: Response from the API. + ListSubscriptionItemsResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -1426,49 +1366,85 @@ def update_subscription_start_at(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/subscriptions/{subscription_id}/start-at') - .http_method(HttpMethodEnum.PATCH) + .path('/subscriptions/{subscription_id}/items') + .http_method(HttpMethodEnum.GET) .template_param(Parameter() .key('subscription_id') .value(subscription_id) .should_encode(True)) - .body_param(Parameter() - .value(request)) - .header_param(Parameter() - .key('idempotency-key') - .value(idempotency_key)) - .header_param(Parameter() - .key('content-type') - .value('application/json; charset=utf-8')) + .query_param(Parameter() + .key('page') + .value(page)) + .query_param(Parameter() + .key('size') + .value(size)) + .query_param(Parameter() + .key('name') + .value(name)) + .query_param(Parameter() + .key('code') + .value(code)) + .query_param(Parameter() + .key('status') + .value(status)) + .query_param(Parameter() + .key('description') + .value(description)) + .query_param(Parameter() + .key('created_since') + .value(created_since)) + .query_param(Parameter() + .key('created_until') + .value(created_until)) .header_param(Parameter() .key('accept') .value('application/json')) - .body_serializer(APIHelper.json_serialize) .auth(Single('httpBasic')) ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) - .deserialize_into(GetSubscriptionResponse.from_dictionary) + .deserialize_into(ListSubscriptionItemsResponse.from_dictionary) ).execute() - def update_subscription_item(self, - subscription_id, - item_id, - body, - idempotency_key=None): - """Does a PUT request to /subscriptions/{subscription_id}/items/{item_id}. + def get_subscriptions(self, + page=None, + size=None, + code=None, + billing_type=None, + customer_id=None, + plan_id=None, + card_id=None, + status=None, + next_billing_since=None, + next_billing_until=None, + created_since=None, + created_until=None): + """Does a GET request to /subscriptions. - Updates a subscription item + Gets all subscriptions Args: - subscription_id (str): Subscription Id - item_id (str): Item id - body (UpdateSubscriptionItemRequest): Request for updating a - subscription item - idempotency_key (str, optional): TODO: type description here. + page (int, optional): Page number + size (int, optional): Page size + code (str, optional): Filter for subscription's code + billing_type (str, optional): Filter for subscription's billing + type + customer_id (str, optional): Filter for subscription's customer + id + plan_id (str, optional): Filter for subscription's plan id + card_id (str, optional): Filter for subscription's card id + status (str, optional): Filter for subscription's status + next_billing_since (datetime, optional): Filter for subscription's + next billing date start range + next_billing_until (datetime, optional): Filter for subscription's + next billing date end range + created_since (datetime, optional): Filter for subscription's + creation date start range + created_until (datetime, optional): Filter for subscriptions + creation date end range Returns: - GetSubscriptionItemResponse: Response from the API. + ListSubscriptionsResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -1480,51 +1456,70 @@ def update_subscription_item(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/subscriptions/{subscription_id}/items/{item_id}') - .http_method(HttpMethodEnum.PUT) - .template_param(Parameter() - .key('subscription_id') - .value(subscription_id) - .should_encode(True)) - .template_param(Parameter() - .key('item_id') - .value(item_id) - .should_encode(True)) - .body_param(Parameter() - .value(body)) - .header_param(Parameter() - .key('idempotency-key') - .value(idempotency_key)) - .header_param(Parameter() - .key('content-type') - .value('application/json; charset=utf-8')) + .path('/subscriptions') + .http_method(HttpMethodEnum.GET) + .query_param(Parameter() + .key('page') + .value(page)) + .query_param(Parameter() + .key('size') + .value(size)) + .query_param(Parameter() + .key('code') + .value(code)) + .query_param(Parameter() + .key('billing_type') + .value(billing_type)) + .query_param(Parameter() + .key('customer_id') + .value(customer_id)) + .query_param(Parameter() + .key('plan_id') + .value(plan_id)) + .query_param(Parameter() + .key('card_id') + .value(card_id)) + .query_param(Parameter() + .key('status') + .value(status)) + .query_param(Parameter() + .key('next_billing_since') + .value(APIHelper.when_defined(APIHelper.RFC3339DateTime, next_billing_since))) + .query_param(Parameter() + .key('next_billing_until') + .value(APIHelper.when_defined(APIHelper.RFC3339DateTime, next_billing_until))) + .query_param(Parameter() + .key('created_since') + .value(APIHelper.when_defined(APIHelper.RFC3339DateTime, created_since))) + .query_param(Parameter() + .key('created_until') + .value(APIHelper.when_defined(APIHelper.RFC3339DateTime, created_until))) .header_param(Parameter() .key('accept') .value('application/json')) - .body_serializer(APIHelper.json_serialize) .auth(Single('httpBasic')) ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) - .deserialize_into(GetSubscriptionItemResponse.from_dictionary) + .deserialize_into(ListSubscriptionsResponse.from_dictionary) ).execute() - def create_subscription_item(self, - subscription_id, - request, - idempotency_key=None): - """Does a POST request to /subscriptions/{subscription_id}/items. + def create_increment(self, + subscription_id, + request, + idempotency_key=None): + """Does a POST request to /subscriptions/{subscription_id}/increments. - Creates a new Subscription item + Creates a increment Args: subscription_id (str): Subscription id - request (CreateSubscriptionItemRequest): Request for creating a - subscription item + request (CreateIncrementRequest): Request for creating a + increment idempotency_key (str, optional): TODO: type description here. Returns: - GetSubscriptionItemResponse: Response from the API. + GetIncrementResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -1536,7 +1531,7 @@ def create_subscription_item(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/subscriptions/{subscription_id}/items') + .path('/subscriptions/{subscription_id}/increments') .http_method(HttpMethodEnum.POST) .template_param(Parameter() .key('subscription_id') @@ -1558,20 +1553,26 @@ def create_subscription_item(self, ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) - .deserialize_into(GetSubscriptionItemResponse.from_dictionary) + .deserialize_into(GetIncrementResponse.from_dictionary) ).execute() - def get_subscription(self, - subscription_id): - """Does a GET request to /subscriptions/{subscription_id}. + def create_usage(self, + subscription_id, + item_id, + body, + idempotency_key=None): + """Does a POST request to /subscriptions/{subscription_id}/items/{item_id}/usages. - Gets a subscription + Creates a usage Args: - subscription_id (str): Subscription id + subscription_id (str): Subscription Id + item_id (str): Item id + body (CreateUsageRequest): Request for creating a usage + idempotency_key (str, optional): TODO: type description here. Returns: - GetSubscriptionResponse: Response from the API. + GetUsageResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -1583,47 +1584,48 @@ def get_subscription(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/subscriptions/{subscription_id}') - .http_method(HttpMethodEnum.GET) + .path('/subscriptions/{subscription_id}/items/{item_id}/usages') + .http_method(HttpMethodEnum.POST) .template_param(Parameter() .key('subscription_id') .value(subscription_id) .should_encode(True)) + .template_param(Parameter() + .key('item_id') + .value(item_id) + .should_encode(True)) + .body_param(Parameter() + .value(body)) + .header_param(Parameter() + .key('idempotency-key') + .value(idempotency_key)) + .header_param(Parameter() + .key('content-type') + .value('application/json; charset=utf-8')) .header_param(Parameter() .key('accept') .value('application/json')) + .body_serializer(APIHelper.json_serialize) .auth(Single('httpBasic')) ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) - .deserialize_into(GetSubscriptionResponse.from_dictionary) + .deserialize_into(GetUsageResponse.from_dictionary) ).execute() - def get_usages(self, - subscription_id, - item_id, - page=None, - size=None, - code=None, - group=None, - used_since=None, - used_until=None): - """Does a GET request to /subscriptions/{subscription_id}/items/{item_id}/usages. + def get_discount_by_id(self, + subscription_id, + discount_id): + """Does a GET request to /subscriptions/{subscription_id}/discounts/{discountId}. - Lists all usages from a subscription item + TODO: type endpoint description here. Args: subscription_id (str): The subscription id - item_id (str): The subscription item id - page (int, optional): Page number - size (int, optional): Page size - code (str, optional): Identification code in the client system - group (str, optional): Identification group in the client system - used_since (datetime, optional): TODO: type description here. - used_until (datetime, optional): TODO: type description here. + discount_id (str): TODO: type description here. Returns: - ListUsagesResponse: Response from the API. + GetDiscountResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -1635,34 +1637,16 @@ def get_usages(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/subscriptions/{subscription_id}/items/{item_id}/usages') + .path('/subscriptions/{subscription_id}/discounts/{discountId}') .http_method(HttpMethodEnum.GET) .template_param(Parameter() .key('subscription_id') .value(subscription_id) .should_encode(True)) .template_param(Parameter() - .key('item_id') - .value(item_id) + .key('discountId') + .value(discount_id) .should_encode(True)) - .query_param(Parameter() - .key('page') - .value(page)) - .query_param(Parameter() - .key('size') - .value(size)) - .query_param(Parameter() - .key('code') - .value(code)) - .query_param(Parameter() - .key('group') - .value(group)) - .query_param(Parameter() - .key('used_since') - .value(APIHelper.when_defined(APIHelper.RFC3339DateTime, used_since))) - .query_param(Parameter() - .key('used_until') - .value(APIHelper.when_defined(APIHelper.RFC3339DateTime, used_until))) .header_param(Parameter() .key('accept') .value('application/json')) @@ -1670,21 +1654,21 @@ def get_usages(self, ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) - .deserialize_into(ListUsagesResponse.from_dictionary) + .deserialize_into(GetDiscountResponse.from_dictionary) ).execute() - def update_latest_period_end_at(self, - subscription_id, - request, - idempotency_key=None): - """Does a PATCH request to /subscriptions/{subscription_id}/periods/latest/end-at. + def update_subscription_metadata(self, + subscription_id, + request, + idempotency_key=None): + """Does a PATCH request to /Subscriptions/{subscription_id}/metadata. - TODO: type endpoint description here. + Updates the metadata from a subscription Args: - subscription_id (str): TODO: type description here. - request (UpdateCurrentCycleEndDateRequest): Request for updating - the end date of the current signature cycle + subscription_id (str): The subscription id + request (UpdateMetadataRequest): Request for updating the + subscrption metadata idempotency_key (str, optional): TODO: type description here. Returns: @@ -1700,7 +1684,7 @@ def update_latest_period_end_at(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/subscriptions/{subscription_id}/periods/latest/end-at') + .path('/Subscriptions/{subscription_id}/metadata') .http_method(HttpMethodEnum.PATCH) .template_param(Parameter() .key('subscription_id') @@ -1725,22 +1709,21 @@ def update_latest_period_end_at(self, .deserialize_into(GetSubscriptionResponse.from_dictionary) ).execute() - def update_subscription_minium_price(self, - subscription_id, - request, - idempotency_key=None): - """Does a PATCH request to /subscriptions/{subscription_id}/minimum_price. + def get_subscription_cycles(self, + subscription_id, + page, + size): + """Does a GET request to /subscriptions/{subscription_id}/cycles. - Atualização do valor mínimo da assinatura + TODO: type endpoint description here. Args: subscription_id (str): Subscription Id - request (UpdateSubscriptionMinimumPriceRequest): Request da - requisição com o valor mínimo que será configurado - idempotency_key (str, optional): TODO: type description here. + page (str): Page number + size (str): Page size Returns: - GetSubscriptionResponse: Response from the API. + ListCyclesResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -1752,44 +1735,43 @@ def update_subscription_minium_price(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/subscriptions/{subscription_id}/minimum_price') - .http_method(HttpMethodEnum.PATCH) + .path('/subscriptions/{subscription_id}/cycles') + .http_method(HttpMethodEnum.GET) .template_param(Parameter() .key('subscription_id') .value(subscription_id) .should_encode(True)) - .body_param(Parameter() - .value(request)) - .header_param(Parameter() - .key('idempotency-key') - .value(idempotency_key)) - .header_param(Parameter() - .key('content-type') - .value('application/json; charset=utf-8')) + .query_param(Parameter() + .key('page') + .value(page)) + .query_param(Parameter() + .key('size') + .value(size)) .header_param(Parameter() .key('accept') .value('application/json')) - .body_serializer(APIHelper.json_serialize) .auth(Single('httpBasic')) ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) - .deserialize_into(GetSubscriptionResponse.from_dictionary) + .deserialize_into(ListCyclesResponse.from_dictionary) ).execute() - def get_subscription_cycle_by_id(self, - subscription_id, - cycle_id): - """Does a GET request to /subscriptions/{subscription_id}/cycles/{cycleId}. + def delete_subscription_item(self, + subscription_id, + subscription_item_id, + idempotency_key=None): + """Does a DELETE request to /subscriptions/{subscription_id}/items/{subscription_item_id}. - TODO: type endpoint description here. + Deletes a subscription item Args: - subscription_id (str): The subscription id - cycle_id (str): TODO: type description here. + subscription_id (str): Subscription id + subscription_item_id (str): Subscription item id + idempotency_key (str, optional): TODO: type description here. Returns: - GetPeriodResponse: Response from the API. + GetSubscriptionItemResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -1801,16 +1783,19 @@ def get_subscription_cycle_by_id(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/subscriptions/{subscription_id}/cycles/{cycleId}') - .http_method(HttpMethodEnum.GET) + .path('/subscriptions/{subscription_id}/items/{subscription_item_id}') + .http_method(HttpMethodEnum.DELETE) .template_param(Parameter() .key('subscription_id') .value(subscription_id) .should_encode(True)) .template_param(Parameter() - .key('cycleId') - .value(cycle_id) + .key('subscription_item_id') + .value(subscription_item_id) .should_encode(True)) + .header_param(Parameter() + .key('idempotency-key') + .value(idempotency_key)) .header_param(Parameter() .key('accept') .value('application/json')) @@ -1818,22 +1803,24 @@ def get_subscription_cycle_by_id(self, ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) - .deserialize_into(GetPeriodResponse.from_dictionary) + .deserialize_into(GetSubscriptionItemResponse.from_dictionary) ).execute() - def get_usage_report(self, - subscription_id, - period_id): - """Does a GET request to /subscriptions/{subscription_id}/periods/{period_id}/usages/report. + def get_increments(self, + subscription_id, + page=None, + size=None): + """Does a GET request to /subscriptions/{subscription_id}/increments/. TODO: type endpoint description here. Args: - subscription_id (str): The subscription Id - period_id (str): The period Id + subscription_id (str): The subscription id + page (int, optional): Page number + size (int, optional): Page size Returns: - GetUsageReportResponse: Response from the API. + ListIncrementsResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -1845,16 +1832,18 @@ def get_usage_report(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/subscriptions/{subscription_id}/periods/{period_id}/usages/report') + .path('/subscriptions/{subscription_id}/increments/') .http_method(HttpMethodEnum.GET) .template_param(Parameter() .key('subscription_id') .value(subscription_id) .should_encode(True)) - .template_param(Parameter() - .key('period_id') - .value(period_id) - .should_encode(True)) + .query_param(Parameter() + .key('page') + .value(page)) + .query_param(Parameter() + .key('size') + .value(size)) .header_param(Parameter() .key('accept') .value('application/json')) @@ -1862,23 +1851,27 @@ def get_usage_report(self, ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) - .deserialize_into(GetUsageReportResponse.from_dictionary) + .deserialize_into(ListIncrementsResponse.from_dictionary) ).execute() - def update_split_subscription(self, - id, - request): - """Does a PATCH request to /subscriptions/{id}/split. + def update_subscription_item(self, + subscription_id, + item_id, + body, + idempotency_key=None): + """Does a PUT request to /subscriptions/{subscription_id}/items/{item_id}. - TODO: type endpoint description here. + Updates a subscription item Args: - id (str): Subscription's id - request (UpdateSubscriptionSplitRequest): TODO: type description - here. + subscription_id (str): Subscription Id + item_id (str): Item id + body (UpdateSubscriptionItemRequest): Request for updating a + subscription item + idempotency_key (str, optional): TODO: type description here. Returns: - GetSubscriptionResponse: Response from the API. + GetSubscriptionItemResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -1890,14 +1883,21 @@ def update_split_subscription(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/subscriptions/{id}/split') - .http_method(HttpMethodEnum.PATCH) + .path('/subscriptions/{subscription_id}/items/{item_id}') + .http_method(HttpMethodEnum.PUT) .template_param(Parameter() - .key('id') - .value(id) + .key('subscription_id') + .value(subscription_id) + .should_encode(True)) + .template_param(Parameter() + .key('item_id') + .value(item_id) .should_encode(True)) .body_param(Parameter() - .value(request)) + .value(body)) + .header_param(Parameter() + .key('idempotency-key') + .value(idempotency_key)) .header_param(Parameter() .key('content-type') .value('application/json; charset=utf-8')) @@ -1909,5 +1909,5 @@ def update_split_subscription(self, ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) - .deserialize_into(GetSubscriptionResponse.from_dictionary) + .deserialize_into(GetSubscriptionItemResponse.from_dictionary) ).execute() diff --git a/pagarmeapisdk/controllers/tokens_controller.py b/pagarmeapisdk/controllers/tokens_controller.py index 9de6041..0975de5 100644 --- a/pagarmeapisdk/controllers/tokens_controller.py +++ b/pagarmeapisdk/controllers/tokens_controller.py @@ -23,18 +23,16 @@ class TokensController(BaseController): def __init__(self, config): super(TokensController, self).__init__(config) - def create_token(self, - public_key, - request, - idempotency_key=None): - """Does a POST request to /tokens?appId={public_key}. + def get_token(self, + id, + public_key): + """Does a GET request to /tokens/{id}?appId={public_key}. - TODO: type endpoint description here. + Gets a token from its id Args: + id (str): Token id public_key (str): Public key - request (CreateTokenRequest): Request for creating a token - idempotency_key (str, optional): TODO: type description here. Returns: GetTokenResponse: Response from the API. @@ -49,40 +47,37 @@ def create_token(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/tokens?appId={public_key}') - .http_method(HttpMethodEnum.POST) + .path('/tokens/{id}?appId={public_key}') + .http_method(HttpMethodEnum.GET) + .template_param(Parameter() + .key('id') + .value(id) + .should_encode(True)) .template_param(Parameter() .key('public_key') .value(public_key) .should_encode(True)) - .body_param(Parameter() - .value(request)) - .header_param(Parameter() - .key('idempotency-key') - .value(idempotency_key)) - .header_param(Parameter() - .key('content-type') - .value('application/json; charset=utf-8')) .header_param(Parameter() .key('accept') .value('application/json')) - .body_serializer(APIHelper.json_serialize) ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) .deserialize_into(GetTokenResponse.from_dictionary) ).execute() - def get_token(self, - id, - public_key): - """Does a GET request to /tokens/{id}?appId={public_key}. + def create_token(self, + public_key, + request, + idempotency_key=None): + """Does a POST request to /tokens?appId={public_key}. - Gets a token from its id + TODO: type endpoint description here. Args: - id (str): Token id public_key (str): Public key + request (CreateTokenRequest): Request for creating a token + idempotency_key (str, optional): TODO: type description here. Returns: GetTokenResponse: Response from the API. @@ -97,19 +92,24 @@ def get_token(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/tokens/{id}?appId={public_key}') - .http_method(HttpMethodEnum.GET) - .template_param(Parameter() - .key('id') - .value(id) - .should_encode(True)) + .path('/tokens?appId={public_key}') + .http_method(HttpMethodEnum.POST) .template_param(Parameter() .key('public_key') .value(public_key) .should_encode(True)) + .body_param(Parameter() + .value(request)) + .header_param(Parameter() + .key('idempotency-key') + .value(idempotency_key)) + .header_param(Parameter() + .key('content-type') + .value('application/json; charset=utf-8')) .header_param(Parameter() .key('accept') .value('application/json')) + .body_serializer(APIHelper.json_serialize) ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) diff --git a/pagarmeapisdk/controllers/transfers_controller.py b/pagarmeapisdk/controllers/transfers_controller.py index 70f16d2..cfdeb29 100644 --- a/pagarmeapisdk/controllers/transfers_controller.py +++ b/pagarmeapisdk/controllers/transfers_controller.py @@ -63,17 +63,13 @@ def get_transfer_by_id(self, .deserialize_into(GetTransfer.from_dictionary) ).execute() - def create_transfer(self, - request): - """Does a POST request to /transfers/recipients. - - TODO: type endpoint description here. + def get_transfers(self): + """Does a GET request to /transfers. - Args: - request (CreateTransfer): TODO: type description here. + Gets all transfers Returns: - GetTransfer: Response from the API. + ListTransfers: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -85,31 +81,29 @@ def create_transfer(self, return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/transfers/recipients') - .http_method(HttpMethodEnum.POST) - .body_param(Parameter() - .value(request)) - .header_param(Parameter() - .key('content-type') - .value('application/json; charset=utf-8')) + .path('/transfers') + .http_method(HttpMethodEnum.GET) .header_param(Parameter() .key('accept') .value('application/json')) - .body_serializer(APIHelper.json_serialize) .auth(Single('httpBasic')) ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) - .deserialize_into(GetTransfer.from_dictionary) + .deserialize_into(ListTransfers.from_dictionary) ).execute() - def get_transfers(self): - """Does a GET request to /transfers. + def create_transfer(self, + request): + """Does a POST request to /transfers/recipients. - Gets all transfers + TODO: type endpoint description here. + + Args: + request (CreateTransfer): TODO: type description here. Returns: - ListTransfers: Response from the API. + GetTransfer: Response from the API. Raises: APIException: When an error occurs while fetching the data from @@ -121,14 +115,20 @@ def get_transfers(self): return super().new_api_call_builder.request( RequestBuilder().server(Server.DEFAULT) - .path('/transfers') - .http_method(HttpMethodEnum.GET) + .path('/transfers/recipients') + .http_method(HttpMethodEnum.POST) + .body_param(Parameter() + .value(request)) + .header_param(Parameter() + .key('content-type') + .value('application/json; charset=utf-8')) .header_param(Parameter() .key('accept') .value('application/json')) + .body_serializer(APIHelper.json_serialize) .auth(Single('httpBasic')) ).response( ResponseHandler() .deserializer(APIHelper.json_deserialize) - .deserialize_into(ListTransfers.from_dictionary) + .deserialize_into(GetTransfer.from_dictionary) ).execute() diff --git a/pagarmeapisdk/http/auth/basic_auth.py b/pagarmeapisdk/http/auth/basic_auth.py index 594ea34..029072b 100644 --- a/pagarmeapisdk/http/auth/basic_auth.py +++ b/pagarmeapisdk/http/auth/basic_auth.py @@ -43,9 +43,9 @@ def password(self): def __init__(self, username, password): if username is None: raise ValueError('username cannot be None') - self._username = username if password is None: raise ValueError('password cannot be None') + self._username = username self._password = password def clone_with(self, username=None, password=None): diff --git a/pagarmeapisdk/models/__init__.py b/pagarmeapisdk/models/__init__.py index 0b7ed85..c12658e 100644 --- a/pagarmeapisdk/models/__init__.py +++ b/pagarmeapisdk/models/__init__.py @@ -1,220 +1,220 @@ __all__ = [ + 'list_charges_response', 'list_invoices_response', - 'get_checkout_boleto_payment_response', 'create_card_options_request', - 'update_subscription_billing_date_request', - 'list_charges_response', - 'list_subscriptions_response', - 'paging_response', - 'list_transactions_response', 'get_plan_item_response', - 'get_phones_response', 'create_card_token_request', - 'list_cards_response', - 'get_pricing_scheme_response', - 'get_price_bracket_response', 'get_token_response', - 'list_customers_response', - 'update_plan_item_request', 'update_subscription_item_request', 'get_charge_response', - 'get_checkout_payment_settings_response', + 'create_checkout_debit_card_payment_request', + 'create_token_request', + 'create_checkout_card_installment_option_request', + 'update_pricing_scheme_request', + 'get_setup_response', + 'get_card_token_response', + 'create_cancel_subscription_request', + 'create_plan_request', + 'create_voucher_payment_request', + 'list_addresses_response', + 'create_subscription_item_request', + 'get_phones_response', + 'get_price_bracket_response', 'list_plans_response', 'get_order_response', - 'get_antifraud_response', - 'create_setup_request', 'update_charge_card_request', 'create_phone_request', - 'create_checkout_debit_card_payment_request', - 'create_plan_item_request', 'create_capture_charge_request', - 'create_token_request', 'update_metadata_request', - 'create_checkout_card_installment_option_request', - 'update_pricing_scheme_request', 'list_access_tokens_response', - 'list_usages_response', - 'update_subscription_card_request', - 'get_setup_response', 'get_plan_response', 'update_plan_request', - 'create_price_bracket_request', - 'get_card_token_response', - 'get_checkout_card_installment_options_response', 'create_pricing_scheme_request', - 'create_cancel_subscription_request', + 'create_access_token_request', + 'get_phone_response', + 'list_order_response', + 'get_checkout_boleto_payment_response', + 'update_subscription_billing_date_request', + 'paging_response', + 'list_cards_response', + 'get_pricing_scheme_response', + 'list_customers_response', + 'get_checkout_payment_settings_response', + 'create_setup_request', + 'create_plan_item_request', + 'get_checkout_card_installment_options_response', 'update_card_request', - 'create_plan_request', + 'create_address_request', + 'update_price_bracket_request', + 'list_subscriptions_response', + 'list_transactions_response', + 'update_plan_item_request', + 'get_antifraud_response', + 'list_usages_response', + 'update_subscription_card_request', + 'create_price_bracket_request', 'create_bank_transfer_payment_request', 'create_phones_request', - 'create_voucher_payment_request', 'create_checkout_boleto_payment_request', 'update_charge_due_date_request', 'list_subscription_items_response', - 'create_access_token_request', - 'get_phone_response', - 'list_order_response', - 'list_addresses_response', 'get_discount_response', 'get_customer_response', - 'create_address_request', - 'update_price_bracket_request', - 'create_subscription_item_request', - 'create_order_request', - 'get_gateway_response_response', - 'create_device_request', - 'update_subscription_affiliation_id_request', 'get_increment_response', 'create_three_d_secure_request', 'update_charge_payment_method_request', - 'get_recipient_response', - 'update_recipient_request', + 'list_increments_response', + 'create_transfer_request', + 'list_transfer_response', + 'update_invoice_status_request', + 'get_transfer_response', 'create_anticipation_request', - 'get_anticipation_limits_response', - 'get_invoice_item_response', 'create_discount_request', 'get_card_response', - 'get_gateway_recipient_response', - 'list_increments_response', 'create_bank_account_request', 'get_balance_response', 'update_order_item_request', - 'create_boleto_payment_request', + 'get_subscription_item_response', + 'get_anticipation_limit_response', + 'create_subscription_request', + 'get_subscription_response', + 'get_period_response', + 'create_apple_pay_header_request', + 'update_order_status_request', + 'create_credit_card_payment_request', + 'create_device_request', + 'update_subscription_affiliation_id_request', + 'get_recipient_response', + 'get_anticipation_limits_response', + 'get_invoice_item_response', + 'get_gateway_recipient_response', 'list_anticipation_response', 'update_address_request', - 'get_subscription_item_response', - 'get_location_response', - 'create_transfer_settings_request', 'get_gateway_error_response', - 'create_transfer_request', 'get_billing_address_response', - 'list_transfer_response', - 'create_usage_request', - 'create_payment_authentication_request', - 'create_increment_request', - 'update_invoice_status_request', - 'get_anticipation_limit_response', 'get_usage_response', - 'create_subscription_request', 'create_apple_pay_request', 'update_customer_request', - 'get_subscription_response', - 'get_period_response', 'create_debit_card_payment_request', - 'create_apple_pay_header_request', - 'get_transfer_response', 'create_location_request', - 'update_order_status_request', - 'create_credit_card_payment_request', - 'list_discounts_response', - 'create_recipient_request', - 'list_recipient_response', + 'create_order_request', + 'get_gateway_response_response', + 'update_recipient_request', + 'create_boleto_payment_request', + 'get_location_response', + 'create_transfer_settings_request', + 'create_usage_request', + 'create_payment_authentication_request', + 'create_increment_request', 'get_device_response', - 'create_payment_request', + 'create_card_request', + 'update_automatic_anticipation_settings_request', + 'get_checkout_debit_card_payment_response', + 'get_split_response', + 'create_emv_decrypt_request', + 'get_withdraw_source_response', + 'update_subscription_payment_method_request', + 'update_subscription_minimum_price_request', + 'create_order_item_request', + 'get_transaction_report_file_response', + 'create_clear_sale_request', + 'list_transfers', + 'create_card_payment_contactless_request', + 'get_transfer_target_response', + 'list_withdrawals', + 'get_withdraw_response', + 'get_automatic_anticipation_response', + 'create_checkout_payment_request', + 'list_recipient_response', 'get_transaction_response', - 'update_recipient_bank_account_request', 'update_transfer_settings_request', 'create_cancel_charge_request', 'update_subscription_start_at_request', 'create_transaction_report_file_request', - 'create_card_request', 'create_emv_data_dukpt_decrypt_request', - 'get_withdraw_target_response', - 'get_charges_summary_response', 'create_private_label_payment_request', - 'update_automatic_anticipation_settings_request', 'create_cash_payment_request', - 'create_confirm_payment_request', 'create_shipping_request', - 'get_checkout_credit_card_payment_response', - 'create_charge_request', 'create_transfer', - 'get_checkout_debit_card_payment_response', 'get_anticipation_response', - 'create_automatic_anticipation_settings_request', 'create_cancel_charge_split_rules_request', - 'get_split_response', - 'create_pix_payment_request', + 'create_checkout_credit_card_payment_request', + 'get_checkout_payment_response', + 'get_transfer_settings_response', + 'get_transfer', + 'list_discounts_response', + 'create_recipient_request', + 'create_payment_request', + 'update_recipient_bank_account_request', + 'get_charges_summary_response', + 'create_confirm_payment_request', 'list_transactions_files_response', 'create_emv_data_tlv_decrypt_request', - 'create_emv_decrypt_request', - 'get_withdraw_source_response', + 'get_bank_account_response', + 'create_split_options_request', + 'pix_additional_information', + 'create_customer_request', + 'update_current_cycle_end_date_request', + 'update_current_cycle_status_request', + 'get_withdraw_target_response', + 'get_checkout_credit_card_payment_response', + 'create_charge_request', + 'create_automatic_anticipation_settings_request', + 'create_pix_payment_request', 'create_google_pay_request', - 'update_subscription_payment_method_request', 'create_antifraud_request', 'get_checkout_bank_transfer_payment_response', - 'get_bank_account_response', - 'update_subscription_minimum_price_request', - 'create_order_item_request', - 'create_split_options_request', - 'get_transaction_report_file_response', - 'create_clear_sale_request', 'get_usage_report_response', - 'list_transfers', - 'pix_additional_information', 'get_shipping_response', 'create_checkout_bank_transfer_request', - 'create_card_payment_contactless_request', - 'create_customer_request', - 'get_transfer_target_response', - 'list_withdrawals', - 'update_current_cycle_end_date_request', - 'create_checkout_credit_card_payment_request', - 'get_checkout_payment_response', 'create_emv_data_decrypt_request', - 'get_withdraw_response', - 'get_automatic_anticipation_response', 'create_split_request', - 'update_current_cycle_status_request', 'create_invoice_request', - 'get_transfer_settings_response', - 'create_checkout_payment_request', 'create_period_request', - 'get_transfer', - 'get_three_d_secure_response', - 'create_google_pay_header_request', - 'get_order_item_response', - 'get_address_response', 'create_card_payment_contactless_poi_request', - 'create_withdraw_request', - 'get_split_options_response', - 'get_payment_authentication_response', + 'get_address_response', 'list_charge_transactions_response', - 'list_cycles_response', - 'get_invoice_response', - 'get_access_token_response', 'get_transfer_source_response', + 'get_fine_response', + 'get_subscription_boleto_response', + 'create_bank_account_refunding_dto', + 'create_google_pay_intermediate_signing_key_request', + 'create_withdraw_request', 'create_sub_merchant_request', 'update_subscription_due_days_request', 'create_checkout_pix_payment_request', 'get_checkout_pix_payment_response', 'create_subscription_split_request', - 'get_subscription_split_response', - 'update_subscription_split_request', - 'get_pix_bank_account_response', - 'get_pix_payer_response', - 'get_interest_response', - 'get_fine_response', 'create_interest_request', - 'create_fine_request', 'create_subscription_boleto_request', - 'get_subscription_boleto_response', - 'create_bank_account_refunding_dto', 'get_payable_response', - 'list_payables_response', 'get_balance_operation_response', - 'get_movement_object_base_response', 'list_balance_operation_response', - 'create_google_pay_intermediate_signing_key_request', + 'create_register_information_address_request', + 'create_register_information_base_request', + 'create_google_pay_header_request', + 'get_order_item_response', + 'get_split_options_response', + 'get_payment_authentication_response', + 'list_cycles_response', + 'get_subscription_split_response', + 'update_subscription_split_request', + 'get_pix_bank_account_response', + 'get_movement_object_base_response', 'create_card_payload_request', 'get_retry_transaction_information_response', 'get_register_information_address_response', 'get_phone_number_response', - 'get_managing_partner_response', - 'get_register_information_response', 'create_register_information_phone_request', - 'create_register_information_address_request', 'create_managing_partner_request', - 'create_register_information_base_request', + 'get_three_d_secure_response', + 'get_invoice_response', + 'get_access_token_response', + 'get_pix_payer_response', + 'get_interest_response', + 'create_fine_request', + 'list_payables_response', + 'get_managing_partner_response', + 'get_register_information_response', 'create_kyc_link_response', ] diff --git a/pagarmeapisdk/models/create_managing_partner_request.py b/pagarmeapisdk/models/create_managing_partner_request.py index b244738..2393096 100644 --- a/pagarmeapisdk/models/create_managing_partner_request.py +++ b/pagarmeapisdk/models/create_managing_partner_request.py @@ -23,7 +23,7 @@ class CreateManagingPartnerRequest(object): document (str): TODO: type description here. mother_name (str): TODO: type description here. birthdate (str): TODO: type description here. - monthly_income (int): TODO: type description here. + monthly_income (long|int): TODO: type description here. professional_occupation (str): TODO: type description here. self_declared_legal_representative (bool): TODO: type description here. diff --git a/pagarmeapisdk/models/create_register_information_base_request.py b/pagarmeapisdk/models/create_register_information_base_request.py index 9a38c81..38c023f 100644 --- a/pagarmeapisdk/models/create_register_information_base_request.py +++ b/pagarmeapisdk/models/create_register_information_base_request.py @@ -105,7 +105,7 @@ class CreateRegisterInformationIndividualRequest(CreateRegisterInformationBaseRe name (str): TODO: type description here. mother_name (str): TODO: type description here. birthdate (str): TODO: type description here. - monthly_income (int): TODO: type description here. + monthly_income (long|int): TODO: type description here. professional_occupation (str): TODO: type description here. address (CreateRegisterInformationAddressRequest): TODO: type description here. @@ -222,7 +222,7 @@ class CreateRegisterInformationCorporationRequest(CreateRegisterInformationBaseR Attributes: company_name (str): TODO: type description here. trading_name (str): TODO: type description here. - annual_revenue (int): TODO: type description here. + annual_revenue (long|int): TODO: type description here. corporation_type (str): TODO: type description here. founding_date (str): TODO: type description here. cnae (str): TODO: type description here. diff --git a/pagarmeapisdk/models/get_movement_object_base_response.py b/pagarmeapisdk/models/get_movement_object_base_response.py index a634b13..a2ee4cc 100644 --- a/pagarmeapisdk/models/get_movement_object_base_response.py +++ b/pagarmeapisdk/models/get_movement_object_base_response.py @@ -107,9 +107,9 @@ def from_dictionary(cls, return None discriminators = { - 'refund': GetMovementObjectRefundResponse.from_dictionary, 'feeCollection': GetMovementObjectFeeCollectionResponse.from_dictionary, 'payable': GetMovementObjectPayableResponse.from_dictionary, + 'refund': GetMovementObjectRefundResponse.from_dictionary, 'transfer': GetMovementObjectTransferResponse.from_dictionary, 'settlement': GetMovementObjectSettlementResponse.from_dictionary } @@ -139,142 +139,6 @@ def from_dictionary(cls, charge_id, gateway_id) -class GetMovementObjectRefundResponse(GetMovementObjectBaseResponse): - - """Implementation of the 'GetMovementObjectRefundResponse' model. - - Generic response object for getting a MovementObjectRefund. - NOTE: This class inherits from 'GetMovementObjectBaseResponse'. - - Attributes: - fraud_coverage_fee (str): TODO: type description here. - charge_fee_recipient_id (str): TODO: type description here. - bank_account_id (str): TODO: type description here. - local_transaction_id (str): TODO: type description here. - updated_at (str): TODO: type description here. - - """ - - # Create a mapping from Model property names to API property names - _names = { - "fraud_coverage_fee": 'fraud_coverage_fee', - "charge_fee_recipient_id": 'charge_fee_recipient_id', - "bank_account_id": 'bank_account_id', - "local_transaction_id": 'local_transaction_id', - "updated_at": 'updated_at', - "object": 'object', - "id": 'id', - "status": 'status', - "amount": 'amount', - "created_at": 'created_at', - "mtype": 'type', - "charge_id": 'charge_id', - "gateway_id": 'gateway_id' - } - - _optionals = [ - 'fraud_coverage_fee', - 'charge_fee_recipient_id', - 'bank_account_id', - 'local_transaction_id', - 'updated_at', - ] - _optionals.extend(GetMovementObjectBaseResponse._optionals) - - _nullables = [ - 'fraud_coverage_fee', - 'charge_fee_recipient_id', - 'bank_account_id', - 'local_transaction_id', - 'updated_at', - ] - _nullables.extend(GetMovementObjectBaseResponse._nullables) - - def __init__(self, - fraud_coverage_fee=APIHelper.SKIP, - charge_fee_recipient_id=APIHelper.SKIP, - bank_account_id=APIHelper.SKIP, - local_transaction_id=APIHelper.SKIP, - updated_at=APIHelper.SKIP, - object='refund', - id=APIHelper.SKIP, - status=APIHelper.SKIP, - amount=APIHelper.SKIP, - created_at=APIHelper.SKIP, - mtype=APIHelper.SKIP, - charge_id=APIHelper.SKIP, - gateway_id=APIHelper.SKIP): - """Constructor for the GetMovementObjectRefundResponse class""" - - # Initialize members of the class - if fraud_coverage_fee is not APIHelper.SKIP: - self.fraud_coverage_fee = fraud_coverage_fee - if charge_fee_recipient_id is not APIHelper.SKIP: - self.charge_fee_recipient_id = charge_fee_recipient_id - if bank_account_id is not APIHelper.SKIP: - self.bank_account_id = bank_account_id - if local_transaction_id is not APIHelper.SKIP: - self.local_transaction_id = local_transaction_id - if updated_at is not APIHelper.SKIP: - self.updated_at = updated_at - - # Call the constructor for the base class - super(GetMovementObjectRefundResponse, self).__init__(object, - id, - status, - amount, - created_at, - mtype, - charge_id, - gateway_id) - - @classmethod - def from_dictionary(cls, - dictionary): - """Creates an instance of this model from a dictionary - - Args: - dictionary (dictionary): A dictionary representation of the object - as obtained from the deserialization of the server's response. The - keys MUST match property names in the API description. - - Returns: - object: An instance of this structure class. - - """ - - if dictionary is None: - return None - - # Extract variables from the dictionary - fraud_coverage_fee = dictionary.get("fraud_coverage_fee") if "fraud_coverage_fee" in dictionary.keys() else APIHelper.SKIP - charge_fee_recipient_id = dictionary.get("charge_fee_recipient_id") if "charge_fee_recipient_id" in dictionary.keys() else APIHelper.SKIP - bank_account_id = dictionary.get("bank_account_id") if "bank_account_id" in dictionary.keys() else APIHelper.SKIP - local_transaction_id = dictionary.get("local_transaction_id") if "local_transaction_id" in dictionary.keys() else APIHelper.SKIP - updated_at = dictionary.get("updated_at") if "updated_at" in dictionary.keys() else APIHelper.SKIP - object = dictionary.get("object") if dictionary.get("object") else 'refund' - id = dictionary.get("id") if "id" in dictionary.keys() else APIHelper.SKIP - status = dictionary.get("status") if "status" in dictionary.keys() else APIHelper.SKIP - amount = dictionary.get("amount") if "amount" in dictionary.keys() else APIHelper.SKIP - created_at = dictionary.get("created_at") if "created_at" in dictionary.keys() else APIHelper.SKIP - mtype = dictionary.get("type") if "type" in dictionary.keys() else APIHelper.SKIP - charge_id = dictionary.get("charge_id") if "charge_id" in dictionary.keys() else APIHelper.SKIP - gateway_id = dictionary.get("gateway_id") if "gateway_id" in dictionary.keys() else APIHelper.SKIP - # Return an object of this model - return cls(fraud_coverage_fee, - charge_fee_recipient_id, - bank_account_id, - local_transaction_id, - updated_at, - object, - id, - status, - amount, - created_at, - mtype, - charge_id, - gateway_id) - class GetMovementObjectFeeCollectionResponse(GetMovementObjectBaseResponse): """Implementation of the 'GetMovementObjectFeeCollectionResponse' model. @@ -577,6 +441,142 @@ def from_dictionary(cls, charge_id, gateway_id) +class GetMovementObjectRefundResponse(GetMovementObjectBaseResponse): + + """Implementation of the 'GetMovementObjectRefundResponse' model. + + Generic response object for getting a MovementObjectRefund. + NOTE: This class inherits from 'GetMovementObjectBaseResponse'. + + Attributes: + fraud_coverage_fee (str): TODO: type description here. + charge_fee_recipient_id (str): TODO: type description here. + bank_account_id (str): TODO: type description here. + local_transaction_id (str): TODO: type description here. + updated_at (str): TODO: type description here. + + """ + + # Create a mapping from Model property names to API property names + _names = { + "fraud_coverage_fee": 'fraud_coverage_fee', + "charge_fee_recipient_id": 'charge_fee_recipient_id', + "bank_account_id": 'bank_account_id', + "local_transaction_id": 'local_transaction_id', + "updated_at": 'updated_at', + "object": 'object', + "id": 'id', + "status": 'status', + "amount": 'amount', + "created_at": 'created_at', + "mtype": 'type', + "charge_id": 'charge_id', + "gateway_id": 'gateway_id' + } + + _optionals = [ + 'fraud_coverage_fee', + 'charge_fee_recipient_id', + 'bank_account_id', + 'local_transaction_id', + 'updated_at', + ] + _optionals.extend(GetMovementObjectBaseResponse._optionals) + + _nullables = [ + 'fraud_coverage_fee', + 'charge_fee_recipient_id', + 'bank_account_id', + 'local_transaction_id', + 'updated_at', + ] + _nullables.extend(GetMovementObjectBaseResponse._nullables) + + def __init__(self, + fraud_coverage_fee=APIHelper.SKIP, + charge_fee_recipient_id=APIHelper.SKIP, + bank_account_id=APIHelper.SKIP, + local_transaction_id=APIHelper.SKIP, + updated_at=APIHelper.SKIP, + object='refund', + id=APIHelper.SKIP, + status=APIHelper.SKIP, + amount=APIHelper.SKIP, + created_at=APIHelper.SKIP, + mtype=APIHelper.SKIP, + charge_id=APIHelper.SKIP, + gateway_id=APIHelper.SKIP): + """Constructor for the GetMovementObjectRefundResponse class""" + + # Initialize members of the class + if fraud_coverage_fee is not APIHelper.SKIP: + self.fraud_coverage_fee = fraud_coverage_fee + if charge_fee_recipient_id is not APIHelper.SKIP: + self.charge_fee_recipient_id = charge_fee_recipient_id + if bank_account_id is not APIHelper.SKIP: + self.bank_account_id = bank_account_id + if local_transaction_id is not APIHelper.SKIP: + self.local_transaction_id = local_transaction_id + if updated_at is not APIHelper.SKIP: + self.updated_at = updated_at + + # Call the constructor for the base class + super(GetMovementObjectRefundResponse, self).__init__(object, + id, + status, + amount, + created_at, + mtype, + charge_id, + gateway_id) + + @classmethod + def from_dictionary(cls, + dictionary): + """Creates an instance of this model from a dictionary + + Args: + dictionary (dictionary): A dictionary representation of the object + as obtained from the deserialization of the server's response. The + keys MUST match property names in the API description. + + Returns: + object: An instance of this structure class. + + """ + + if dictionary is None: + return None + + # Extract variables from the dictionary + fraud_coverage_fee = dictionary.get("fraud_coverage_fee") if "fraud_coverage_fee" in dictionary.keys() else APIHelper.SKIP + charge_fee_recipient_id = dictionary.get("charge_fee_recipient_id") if "charge_fee_recipient_id" in dictionary.keys() else APIHelper.SKIP + bank_account_id = dictionary.get("bank_account_id") if "bank_account_id" in dictionary.keys() else APIHelper.SKIP + local_transaction_id = dictionary.get("local_transaction_id") if "local_transaction_id" in dictionary.keys() else APIHelper.SKIP + updated_at = dictionary.get("updated_at") if "updated_at" in dictionary.keys() else APIHelper.SKIP + object = dictionary.get("object") if dictionary.get("object") else 'refund' + id = dictionary.get("id") if "id" in dictionary.keys() else APIHelper.SKIP + status = dictionary.get("status") if "status" in dictionary.keys() else APIHelper.SKIP + amount = dictionary.get("amount") if "amount" in dictionary.keys() else APIHelper.SKIP + created_at = dictionary.get("created_at") if "created_at" in dictionary.keys() else APIHelper.SKIP + mtype = dictionary.get("type") if "type" in dictionary.keys() else APIHelper.SKIP + charge_id = dictionary.get("charge_id") if "charge_id" in dictionary.keys() else APIHelper.SKIP + gateway_id = dictionary.get("gateway_id") if "gateway_id" in dictionary.keys() else APIHelper.SKIP + # Return an object of this model + return cls(fraud_coverage_fee, + charge_fee_recipient_id, + bank_account_id, + local_transaction_id, + updated_at, + object, + id, + status, + amount, + created_at, + mtype, + charge_id, + gateway_id) + class GetMovementObjectTransferResponse(GetMovementObjectBaseResponse): """Implementation of the 'GetMovementObjectTransferResponse' model. diff --git a/pagarmeapisdk/models/get_transaction_response.py b/pagarmeapisdk/models/get_transaction_response.py index 9f32547..fde07b8 100644 --- a/pagarmeapisdk/models/get_transaction_response.py +++ b/pagarmeapisdk/models/get_transaction_response.py @@ -195,13 +195,13 @@ def from_dictionary(cls, return None discriminators = { - 'bank_transfer': GetBankTransferTransactionResponse.from_dictionary, 'safetypay': GetSafetyPayTransactionResponse.from_dictionary, 'voucher': GetVoucherTransactionResponse.from_dictionary, + 'bank_transfer': GetBankTransferTransactionResponse.from_dictionary, 'boleto': GetBoletoTransactionResponse.from_dictionary, 'debit_card': GetDebitCardTransactionResponse.from_dictionary, - 'private_label': GetPrivateLabelTransactionResponse.from_dictionary, 'cash': GetCashTransactionResponse.from_dictionary, + 'private_label': GetPrivateLabelTransactionResponse.from_dictionary, 'credit_card': GetCreditCardTransactionResponse.from_dictionary, 'pix': GetPixTransactionResponse.from_dictionary } @@ -280,215 +280,6 @@ def from_dictionary(cls, fine, max_days_to_pay_past_due) -class GetBankTransferTransactionResponse(GetTransactionResponse): - - """Implementation of the 'GetBankTransferTransactionResponse' model. - - Response object for getting a bank transfer transaction - NOTE: This class inherits from 'GetTransactionResponse'. - - Attributes: - url (str): Payment url - bank_tid (str): Transaction identifier for the bank - bank (str): Bank - paid_at (datetime): Payment date - paid_amount (int): Paid amount - - """ - - # Create a mapping from Model property names to API property names - _names = { - "url": 'url', - "bank_tid": 'bank_tid', - "bank": 'bank', - "paid_at": 'paid_at', - "paid_amount": 'paid_amount', - "gateway_id": 'gateway_id', - "amount": 'amount', - "status": 'status', - "success": 'success', - "created_at": 'created_at', - "updated_at": 'updated_at', - "attempt_count": 'attempt_count', - "max_attempts": 'max_attempts', - "splits": 'splits', - "next_attempt": 'next_attempt', - "transaction_type": 'transaction_type', - "id": 'id', - "gateway_response": 'gateway_response', - "antifraud_response": 'antifraud_response', - "metadata": 'metadata', - "split": 'split', - "interest": 'interest', - "fine": 'fine', - "max_days_to_pay_past_due": 'max_days_to_pay_past_due' - } - - _optionals = [ - 'url', - 'bank_tid', - 'bank', - 'paid_at', - 'paid_amount', - ] - _optionals.extend(GetTransactionResponse._optionals) - - def __init__(self, - url=APIHelper.SKIP, - bank_tid=APIHelper.SKIP, - bank=APIHelper.SKIP, - paid_at=APIHelper.SKIP, - paid_amount=APIHelper.SKIP, - gateway_id=APIHelper.SKIP, - amount=APIHelper.SKIP, - status=APIHelper.SKIP, - success=APIHelper.SKIP, - created_at=APIHelper.SKIP, - updated_at=APIHelper.SKIP, - attempt_count=APIHelper.SKIP, - max_attempts=APIHelper.SKIP, - splits=APIHelper.SKIP, - next_attempt=APIHelper.SKIP, - transaction_type='bank_transfer', - id=APIHelper.SKIP, - gateway_response=APIHelper.SKIP, - antifraud_response=APIHelper.SKIP, - metadata=APIHelper.SKIP, - split=APIHelper.SKIP, - interest=APIHelper.SKIP, - fine=APIHelper.SKIP, - max_days_to_pay_past_due=APIHelper.SKIP): - """Constructor for the GetBankTransferTransactionResponse class""" - - # Initialize members of the class - if url is not APIHelper.SKIP: - self.url = url - if bank_tid is not APIHelper.SKIP: - self.bank_tid = bank_tid - if bank is not APIHelper.SKIP: - self.bank = bank - if paid_at is not APIHelper.SKIP: - self.paid_at = APIHelper.apply_datetime_converter(paid_at, APIHelper.RFC3339DateTime) if paid_at else None - if paid_amount is not APIHelper.SKIP: - self.paid_amount = paid_amount - - # Call the constructor for the base class - super(GetBankTransferTransactionResponse, self).__init__(gateway_id, - amount, - status, - success, - created_at, - updated_at, - attempt_count, - max_attempts, - splits, - next_attempt, - transaction_type, - id, - gateway_response, - antifraud_response, - metadata, - split, - interest, - fine, - max_days_to_pay_past_due) - - @classmethod - def from_dictionary(cls, - dictionary): - """Creates an instance of this model from a dictionary - - Args: - dictionary (dictionary): A dictionary representation of the object - as obtained from the deserialization of the server's response. The - keys MUST match property names in the API description. - - Returns: - object: An instance of this structure class. - - """ - - if dictionary is None: - return None - - # Extract variables from the dictionary - url = dictionary.get("url") if dictionary.get("url") else APIHelper.SKIP - bank_tid = dictionary.get("bank_tid") if dictionary.get("bank_tid") else APIHelper.SKIP - bank = dictionary.get("bank") if dictionary.get("bank") else APIHelper.SKIP - paid_at = APIHelper.RFC3339DateTime.from_value(dictionary.get("paid_at")).datetime if dictionary.get("paid_at") else APIHelper.SKIP - paid_amount = dictionary.get("paid_amount") if dictionary.get("paid_amount") else APIHelper.SKIP - gateway_id = dictionary.get("gateway_id") if "gateway_id" in dictionary.keys() else APIHelper.SKIP - amount = dictionary.get("amount") if "amount" in dictionary.keys() else APIHelper.SKIP - status = dictionary.get("status") if "status" in dictionary.keys() else APIHelper.SKIP - success = dictionary.get("success") if "success" in dictionary.keys() else APIHelper.SKIP - if 'created_at' in dictionary.keys(): - created_at = APIHelper.RFC3339DateTime.from_value(dictionary.get("created_at")).datetime if dictionary.get("created_at") else None - else: - created_at = APIHelper.SKIP - if 'updated_at' in dictionary.keys(): - updated_at = APIHelper.RFC3339DateTime.from_value(dictionary.get("updated_at")).datetime if dictionary.get("updated_at") else None - else: - updated_at = APIHelper.SKIP - attempt_count = dictionary.get("attempt_count") if "attempt_count" in dictionary.keys() else APIHelper.SKIP - max_attempts = dictionary.get("max_attempts") if "max_attempts" in dictionary.keys() else APIHelper.SKIP - if 'splits' in dictionary.keys(): - splits = [GetSplitResponse.from_dictionary(x) for x in dictionary.get('splits')] if dictionary.get('splits') else None - else: - splits = APIHelper.SKIP - if 'next_attempt' in dictionary.keys(): - next_attempt = APIHelper.RFC3339DateTime.from_value(dictionary.get("next_attempt")).datetime if dictionary.get("next_attempt") else None - else: - next_attempt = APIHelper.SKIP - transaction_type = dictionary.get("transaction_type") if dictionary.get("transaction_type") else 'bank_transfer' - id = dictionary.get("id") if "id" in dictionary.keys() else APIHelper.SKIP - if 'gateway_response' in dictionary.keys(): - gateway_response = GetGatewayResponseResponse.from_dictionary(dictionary.get('gateway_response')) if dictionary.get('gateway_response') else None - else: - gateway_response = APIHelper.SKIP - if 'antifraud_response' in dictionary.keys(): - antifraud_response = GetAntifraudResponse.from_dictionary(dictionary.get('antifraud_response')) if dictionary.get('antifraud_response') else None - else: - antifraud_response = APIHelper.SKIP - metadata = dictionary.get("metadata") if "metadata" in dictionary.keys() else APIHelper.SKIP - if 'split' in dictionary.keys(): - split = [GetSplitResponse.from_dictionary(x) for x in dictionary.get('split')] if dictionary.get('split') else None - else: - split = APIHelper.SKIP - if 'interest' in dictionary.keys(): - interest = GetInterestResponse.from_dictionary(dictionary.get('interest')) if dictionary.get('interest') else None - else: - interest = APIHelper.SKIP - if 'fine' in dictionary.keys(): - fine = GetFineResponse.from_dictionary(dictionary.get('fine')) if dictionary.get('fine') else None - else: - fine = APIHelper.SKIP - max_days_to_pay_past_due = dictionary.get("max_days_to_pay_past_due") if "max_days_to_pay_past_due" in dictionary.keys() else APIHelper.SKIP - # Return an object of this model - return cls(url, - bank_tid, - bank, - paid_at, - paid_amount, - gateway_id, - amount, - status, - success, - created_at, - updated_at, - attempt_count, - max_attempts, - splits, - next_attempt, - transaction_type, - id, - gateway_response, - antifraud_response, - metadata, - split, - interest, - fine, - max_days_to_pay_past_due) - class GetSafetyPayTransactionResponse(GetTransactionResponse): """Implementation of the 'GetSafetyPayTransactionResponse' model. @@ -968,54 +759,263 @@ def from_dictionary(cls, fine, max_days_to_pay_past_due) -class GetBoletoTransactionResponse(GetTransactionResponse): +class GetBankTransferTransactionResponse(GetTransactionResponse): - """Implementation of the 'GetBoletoTransactionResponse' model. + """Implementation of the 'GetBankTransferTransactionResponse' model. - Response object for getting a boleto transaction + Response object for getting a bank transfer transaction NOTE: This class inherits from 'GetTransactionResponse'. Attributes: - url (str): TODO: type description here. - barcode (str): TODO: type description here. - nosso_numero (str): TODO: type description here. - bank (str): TODO: type description here. - document_number (str): TODO: type description here. - instructions (str): TODO: type description here. - billing_address (GetBillingAddressResponse): TODO: type description - here. - due_at (datetime): TODO: type description here. - qr_code (str): TODO: type description here. - line (str): TODO: type description here. - pdf_password (str): TODO: type description here. - pdf (str): TODO: type description here. - paid_at (datetime): TODO: type description here. - paid_amount (str): TODO: type description here. - mtype (str): TODO: type description here. - credit_at (datetime): TODO: type description here. - statement_descriptor (str): Soft Descriptor + url (str): Payment url + bank_tid (str): Transaction identifier for the bank + bank (str): Bank + paid_at (datetime): Payment date + paid_amount (int): Paid amount """ # Create a mapping from Model property names to API property names _names = { "url": 'url', - "barcode": 'barcode', - "nosso_numero": 'nosso_numero', + "bank_tid": 'bank_tid', "bank": 'bank', - "document_number": 'document_number', - "instructions": 'instructions', - "billing_address": 'billing_address', - "due_at": 'due_at', - "qr_code": 'qr_code', - "line": 'line', - "pdf_password": 'pdf_password', - "pdf": 'pdf', "paid_at": 'paid_at', "paid_amount": 'paid_amount', - "mtype": 'type', - "credit_at": 'credit_at', - "statement_descriptor": 'statement_descriptor', + "gateway_id": 'gateway_id', + "amount": 'amount', + "status": 'status', + "success": 'success', + "created_at": 'created_at', + "updated_at": 'updated_at', + "attempt_count": 'attempt_count', + "max_attempts": 'max_attempts', + "splits": 'splits', + "next_attempt": 'next_attempt', + "transaction_type": 'transaction_type', + "id": 'id', + "gateway_response": 'gateway_response', + "antifraud_response": 'antifraud_response', + "metadata": 'metadata', + "split": 'split', + "interest": 'interest', + "fine": 'fine', + "max_days_to_pay_past_due": 'max_days_to_pay_past_due' + } + + _optionals = [ + 'url', + 'bank_tid', + 'bank', + 'paid_at', + 'paid_amount', + ] + _optionals.extend(GetTransactionResponse._optionals) + + def __init__(self, + url=APIHelper.SKIP, + bank_tid=APIHelper.SKIP, + bank=APIHelper.SKIP, + paid_at=APIHelper.SKIP, + paid_amount=APIHelper.SKIP, + gateway_id=APIHelper.SKIP, + amount=APIHelper.SKIP, + status=APIHelper.SKIP, + success=APIHelper.SKIP, + created_at=APIHelper.SKIP, + updated_at=APIHelper.SKIP, + attempt_count=APIHelper.SKIP, + max_attempts=APIHelper.SKIP, + splits=APIHelper.SKIP, + next_attempt=APIHelper.SKIP, + transaction_type='bank_transfer', + id=APIHelper.SKIP, + gateway_response=APIHelper.SKIP, + antifraud_response=APIHelper.SKIP, + metadata=APIHelper.SKIP, + split=APIHelper.SKIP, + interest=APIHelper.SKIP, + fine=APIHelper.SKIP, + max_days_to_pay_past_due=APIHelper.SKIP): + """Constructor for the GetBankTransferTransactionResponse class""" + + # Initialize members of the class + if url is not APIHelper.SKIP: + self.url = url + if bank_tid is not APIHelper.SKIP: + self.bank_tid = bank_tid + if bank is not APIHelper.SKIP: + self.bank = bank + if paid_at is not APIHelper.SKIP: + self.paid_at = APIHelper.apply_datetime_converter(paid_at, APIHelper.RFC3339DateTime) if paid_at else None + if paid_amount is not APIHelper.SKIP: + self.paid_amount = paid_amount + + # Call the constructor for the base class + super(GetBankTransferTransactionResponse, self).__init__(gateway_id, + amount, + status, + success, + created_at, + updated_at, + attempt_count, + max_attempts, + splits, + next_attempt, + transaction_type, + id, + gateway_response, + antifraud_response, + metadata, + split, + interest, + fine, + max_days_to_pay_past_due) + + @classmethod + def from_dictionary(cls, + dictionary): + """Creates an instance of this model from a dictionary + + Args: + dictionary (dictionary): A dictionary representation of the object + as obtained from the deserialization of the server's response. The + keys MUST match property names in the API description. + + Returns: + object: An instance of this structure class. + + """ + + if dictionary is None: + return None + + # Extract variables from the dictionary + url = dictionary.get("url") if dictionary.get("url") else APIHelper.SKIP + bank_tid = dictionary.get("bank_tid") if dictionary.get("bank_tid") else APIHelper.SKIP + bank = dictionary.get("bank") if dictionary.get("bank") else APIHelper.SKIP + paid_at = APIHelper.RFC3339DateTime.from_value(dictionary.get("paid_at")).datetime if dictionary.get("paid_at") else APIHelper.SKIP + paid_amount = dictionary.get("paid_amount") if dictionary.get("paid_amount") else APIHelper.SKIP + gateway_id = dictionary.get("gateway_id") if "gateway_id" in dictionary.keys() else APIHelper.SKIP + amount = dictionary.get("amount") if "amount" in dictionary.keys() else APIHelper.SKIP + status = dictionary.get("status") if "status" in dictionary.keys() else APIHelper.SKIP + success = dictionary.get("success") if "success" in dictionary.keys() else APIHelper.SKIP + if 'created_at' in dictionary.keys(): + created_at = APIHelper.RFC3339DateTime.from_value(dictionary.get("created_at")).datetime if dictionary.get("created_at") else None + else: + created_at = APIHelper.SKIP + if 'updated_at' in dictionary.keys(): + updated_at = APIHelper.RFC3339DateTime.from_value(dictionary.get("updated_at")).datetime if dictionary.get("updated_at") else None + else: + updated_at = APIHelper.SKIP + attempt_count = dictionary.get("attempt_count") if "attempt_count" in dictionary.keys() else APIHelper.SKIP + max_attempts = dictionary.get("max_attempts") if "max_attempts" in dictionary.keys() else APIHelper.SKIP + if 'splits' in dictionary.keys(): + splits = [GetSplitResponse.from_dictionary(x) for x in dictionary.get('splits')] if dictionary.get('splits') else None + else: + splits = APIHelper.SKIP + if 'next_attempt' in dictionary.keys(): + next_attempt = APIHelper.RFC3339DateTime.from_value(dictionary.get("next_attempt")).datetime if dictionary.get("next_attempt") else None + else: + next_attempt = APIHelper.SKIP + transaction_type = dictionary.get("transaction_type") if dictionary.get("transaction_type") else 'bank_transfer' + id = dictionary.get("id") if "id" in dictionary.keys() else APIHelper.SKIP + if 'gateway_response' in dictionary.keys(): + gateway_response = GetGatewayResponseResponse.from_dictionary(dictionary.get('gateway_response')) if dictionary.get('gateway_response') else None + else: + gateway_response = APIHelper.SKIP + if 'antifraud_response' in dictionary.keys(): + antifraud_response = GetAntifraudResponse.from_dictionary(dictionary.get('antifraud_response')) if dictionary.get('antifraud_response') else None + else: + antifraud_response = APIHelper.SKIP + metadata = dictionary.get("metadata") if "metadata" in dictionary.keys() else APIHelper.SKIP + if 'split' in dictionary.keys(): + split = [GetSplitResponse.from_dictionary(x) for x in dictionary.get('split')] if dictionary.get('split') else None + else: + split = APIHelper.SKIP + if 'interest' in dictionary.keys(): + interest = GetInterestResponse.from_dictionary(dictionary.get('interest')) if dictionary.get('interest') else None + else: + interest = APIHelper.SKIP + if 'fine' in dictionary.keys(): + fine = GetFineResponse.from_dictionary(dictionary.get('fine')) if dictionary.get('fine') else None + else: + fine = APIHelper.SKIP + max_days_to_pay_past_due = dictionary.get("max_days_to_pay_past_due") if "max_days_to_pay_past_due" in dictionary.keys() else APIHelper.SKIP + # Return an object of this model + return cls(url, + bank_tid, + bank, + paid_at, + paid_amount, + gateway_id, + amount, + status, + success, + created_at, + updated_at, + attempt_count, + max_attempts, + splits, + next_attempt, + transaction_type, + id, + gateway_response, + antifraud_response, + metadata, + split, + interest, + fine, + max_days_to_pay_past_due) + +class GetBoletoTransactionResponse(GetTransactionResponse): + + """Implementation of the 'GetBoletoTransactionResponse' model. + + Response object for getting a boleto transaction + NOTE: This class inherits from 'GetTransactionResponse'. + + Attributes: + url (str): TODO: type description here. + barcode (str): TODO: type description here. + nosso_numero (str): TODO: type description here. + bank (str): TODO: type description here. + document_number (str): TODO: type description here. + instructions (str): TODO: type description here. + billing_address (GetBillingAddressResponse): TODO: type description + here. + due_at (datetime): TODO: type description here. + qr_code (str): TODO: type description here. + line (str): TODO: type description here. + pdf_password (str): TODO: type description here. + pdf (str): TODO: type description here. + paid_at (datetime): TODO: type description here. + paid_amount (str): TODO: type description here. + mtype (str): TODO: type description here. + credit_at (datetime): TODO: type description here. + statement_descriptor (str): Soft Descriptor + + """ + + # Create a mapping from Model property names to API property names + _names = { + "url": 'url', + "barcode": 'barcode', + "nosso_numero": 'nosso_numero', + "bank": 'bank', + "document_number": 'document_number', + "instructions": 'instructions', + "billing_address": 'billing_address', + "due_at": 'due_at', + "qr_code": 'qr_code', + "line": 'line', + "pdf_password": 'pdf_password', + "pdf": 'pdf', + "paid_at": 'paid_at', + "paid_amount": 'paid_amount', + "mtype": 'type', + "credit_at": 'credit_at', + "statement_descriptor": 'statement_descriptor', "gateway_id": 'gateway_id', "amount": 'amount', "status": 'status', @@ -1633,42 +1633,21 @@ def from_dictionary(cls, fine, max_days_to_pay_past_due) -class GetPrivateLabelTransactionResponse(GetTransactionResponse): +class GetCashTransactionResponse(GetTransactionResponse): - """Implementation of the 'GetPrivateLabelTransactionResponse' model. + """Implementation of the 'GetCashTransactionResponse' model. - Response object for getting a private label transaction + Response object for getting a cash transaction NOTE: This class inherits from 'GetTransactionResponse'. Attributes: - statement_descriptor (str): Text that will appear on the credit card's - statement - acquirer_name (str): Acquirer name - acquirer_affiliation_code (str): Aquirer affiliation code - acquirer_tid (str): Acquirer TID - acquirer_nsu (str): Acquirer NSU - acquirer_auth_code (str): Acquirer authorization code - operation_type (str): Operation type - card (GetCardResponse): Card data - acquirer_message (str): Acquirer message - acquirer_return_code (str): Acquirer Return Code - installments (int): Number of installments + description (str): Description """ # Create a mapping from Model property names to API property names _names = { - "statement_descriptor": 'statement_descriptor', - "acquirer_name": 'acquirer_name', - "acquirer_affiliation_code": 'acquirer_affiliation_code', - "acquirer_tid": 'acquirer_tid', - "acquirer_nsu": 'acquirer_nsu', - "acquirer_auth_code": 'acquirer_auth_code', - "operation_type": 'operation_type', - "card": 'card', - "acquirer_message": 'acquirer_message', - "acquirer_return_code": 'acquirer_return_code', - "installments": 'installments', + "description": 'description', "gateway_id": 'gateway_id', "amount": 'amount', "status": 'status', @@ -1691,47 +1670,17 @@ class GetPrivateLabelTransactionResponse(GetTransactionResponse): } _optionals = [ - 'statement_descriptor', - 'acquirer_name', - 'acquirer_affiliation_code', - 'acquirer_tid', - 'acquirer_nsu', - 'acquirer_auth_code', - 'operation_type', - 'card', - 'acquirer_message', - 'acquirer_return_code', - 'installments', + 'description', ] _optionals.extend(GetTransactionResponse._optionals) _nullables = [ - 'statement_descriptor', - 'acquirer_name', - 'acquirer_affiliation_code', - 'acquirer_tid', - 'acquirer_nsu', - 'acquirer_auth_code', - 'operation_type', - 'card', - 'acquirer_message', - 'acquirer_return_code', - 'installments', + 'description', ] _nullables.extend(GetTransactionResponse._nullables) def __init__(self, - statement_descriptor=APIHelper.SKIP, - acquirer_name=APIHelper.SKIP, - acquirer_affiliation_code=APIHelper.SKIP, - acquirer_tid=APIHelper.SKIP, - acquirer_nsu=APIHelper.SKIP, - acquirer_auth_code=APIHelper.SKIP, - operation_type=APIHelper.SKIP, - card=APIHelper.SKIP, - acquirer_message=APIHelper.SKIP, - acquirer_return_code=APIHelper.SKIP, - installments=APIHelper.SKIP, + description=APIHelper.SKIP, gateway_id=APIHelper.SKIP, amount=APIHelper.SKIP, status=APIHelper.SKIP, @@ -1742,7 +1691,7 @@ def __init__(self, max_attempts=APIHelper.SKIP, splits=APIHelper.SKIP, next_attempt=APIHelper.SKIP, - transaction_type='private_label', + transaction_type='cash', id=APIHelper.SKIP, gateway_response=APIHelper.SKIP, antifraud_response=APIHelper.SKIP, @@ -1751,52 +1700,32 @@ def __init__(self, interest=APIHelper.SKIP, fine=APIHelper.SKIP, max_days_to_pay_past_due=APIHelper.SKIP): - """Constructor for the GetPrivateLabelTransactionResponse class""" + """Constructor for the GetCashTransactionResponse class""" # Initialize members of the class - if statement_descriptor is not APIHelper.SKIP: - self.statement_descriptor = statement_descriptor - if acquirer_name is not APIHelper.SKIP: - self.acquirer_name = acquirer_name - if acquirer_affiliation_code is not APIHelper.SKIP: - self.acquirer_affiliation_code = acquirer_affiliation_code - if acquirer_tid is not APIHelper.SKIP: - self.acquirer_tid = acquirer_tid - if acquirer_nsu is not APIHelper.SKIP: - self.acquirer_nsu = acquirer_nsu - if acquirer_auth_code is not APIHelper.SKIP: - self.acquirer_auth_code = acquirer_auth_code - if operation_type is not APIHelper.SKIP: - self.operation_type = operation_type - if card is not APIHelper.SKIP: - self.card = card - if acquirer_message is not APIHelper.SKIP: - self.acquirer_message = acquirer_message - if acquirer_return_code is not APIHelper.SKIP: - self.acquirer_return_code = acquirer_return_code - if installments is not APIHelper.SKIP: - self.installments = installments + if description is not APIHelper.SKIP: + self.description = description # Call the constructor for the base class - super(GetPrivateLabelTransactionResponse, self).__init__(gateway_id, - amount, - status, - success, - created_at, - updated_at, - attempt_count, - max_attempts, - splits, - next_attempt, - transaction_type, - id, - gateway_response, - antifraud_response, - metadata, - split, - interest, - fine, - max_days_to_pay_past_due) + super(GetCashTransactionResponse, self).__init__(gateway_id, + amount, + status, + success, + created_at, + updated_at, + attempt_count, + max_attempts, + splits, + next_attempt, + transaction_type, + id, + gateway_response, + antifraud_response, + metadata, + split, + interest, + fine, + max_days_to_pay_past_due) @classmethod def from_dictionary(cls, @@ -1817,20 +1746,7 @@ def from_dictionary(cls, return None # Extract variables from the dictionary - statement_descriptor = dictionary.get("statement_descriptor") if "statement_descriptor" in dictionary.keys() else APIHelper.SKIP - acquirer_name = dictionary.get("acquirer_name") if "acquirer_name" in dictionary.keys() else APIHelper.SKIP - acquirer_affiliation_code = dictionary.get("acquirer_affiliation_code") if "acquirer_affiliation_code" in dictionary.keys() else APIHelper.SKIP - acquirer_tid = dictionary.get("acquirer_tid") if "acquirer_tid" in dictionary.keys() else APIHelper.SKIP - acquirer_nsu = dictionary.get("acquirer_nsu") if "acquirer_nsu" in dictionary.keys() else APIHelper.SKIP - acquirer_auth_code = dictionary.get("acquirer_auth_code") if "acquirer_auth_code" in dictionary.keys() else APIHelper.SKIP - operation_type = dictionary.get("operation_type") if "operation_type" in dictionary.keys() else APIHelper.SKIP - if 'card' in dictionary.keys(): - card = GetCardResponse.from_dictionary(dictionary.get('card')) if dictionary.get('card') else None - else: - card = APIHelper.SKIP - acquirer_message = dictionary.get("acquirer_message") if "acquirer_message" in dictionary.keys() else APIHelper.SKIP - acquirer_return_code = dictionary.get("acquirer_return_code") if "acquirer_return_code" in dictionary.keys() else APIHelper.SKIP - installments = dictionary.get("installments") if "installments" in dictionary.keys() else APIHelper.SKIP + description = dictionary.get("description") if "description" in dictionary.keys() else APIHelper.SKIP gateway_id = dictionary.get("gateway_id") if "gateway_id" in dictionary.keys() else APIHelper.SKIP amount = dictionary.get("amount") if "amount" in dictionary.keys() else APIHelper.SKIP status = dictionary.get("status") if "status" in dictionary.keys() else APIHelper.SKIP @@ -1853,7 +1769,7 @@ def from_dictionary(cls, next_attempt = APIHelper.RFC3339DateTime.from_value(dictionary.get("next_attempt")).datetime if dictionary.get("next_attempt") else None else: next_attempt = APIHelper.SKIP - transaction_type = dictionary.get("transaction_type") if dictionary.get("transaction_type") else 'private_label' + transaction_type = dictionary.get("transaction_type") if dictionary.get("transaction_type") else 'cash' id = dictionary.get("id") if "id" in dictionary.keys() else APIHelper.SKIP if 'gateway_response' in dictionary.keys(): gateway_response = GetGatewayResponseResponse.from_dictionary(dictionary.get('gateway_response')) if dictionary.get('gateway_response') else None @@ -1878,17 +1794,7 @@ def from_dictionary(cls, fine = APIHelper.SKIP max_days_to_pay_past_due = dictionary.get("max_days_to_pay_past_due") if "max_days_to_pay_past_due" in dictionary.keys() else APIHelper.SKIP # Return an object of this model - return cls(statement_descriptor, - acquirer_name, - acquirer_affiliation_code, - acquirer_tid, - acquirer_nsu, - acquirer_auth_code, - operation_type, - card, - acquirer_message, - acquirer_return_code, - installments, + return cls(description, gateway_id, amount, status, @@ -1909,21 +1815,42 @@ def from_dictionary(cls, fine, max_days_to_pay_past_due) -class GetCashTransactionResponse(GetTransactionResponse): +class GetPrivateLabelTransactionResponse(GetTransactionResponse): - """Implementation of the 'GetCashTransactionResponse' model. + """Implementation of the 'GetPrivateLabelTransactionResponse' model. - Response object for getting a cash transaction + Response object for getting a private label transaction NOTE: This class inherits from 'GetTransactionResponse'. Attributes: - description (str): Description + statement_descriptor (str): Text that will appear on the credit card's + statement + acquirer_name (str): Acquirer name + acquirer_affiliation_code (str): Aquirer affiliation code + acquirer_tid (str): Acquirer TID + acquirer_nsu (str): Acquirer NSU + acquirer_auth_code (str): Acquirer authorization code + operation_type (str): Operation type + card (GetCardResponse): Card data + acquirer_message (str): Acquirer message + acquirer_return_code (str): Acquirer Return Code + installments (int): Number of installments """ # Create a mapping from Model property names to API property names _names = { - "description": 'description', + "statement_descriptor": 'statement_descriptor', + "acquirer_name": 'acquirer_name', + "acquirer_affiliation_code": 'acquirer_affiliation_code', + "acquirer_tid": 'acquirer_tid', + "acquirer_nsu": 'acquirer_nsu', + "acquirer_auth_code": 'acquirer_auth_code', + "operation_type": 'operation_type', + "card": 'card', + "acquirer_message": 'acquirer_message', + "acquirer_return_code": 'acquirer_return_code', + "installments": 'installments', "gateway_id": 'gateway_id', "amount": 'amount', "status": 'status', @@ -1946,17 +1873,47 @@ class GetCashTransactionResponse(GetTransactionResponse): } _optionals = [ - 'description', + 'statement_descriptor', + 'acquirer_name', + 'acquirer_affiliation_code', + 'acquirer_tid', + 'acquirer_nsu', + 'acquirer_auth_code', + 'operation_type', + 'card', + 'acquirer_message', + 'acquirer_return_code', + 'installments', ] _optionals.extend(GetTransactionResponse._optionals) _nullables = [ - 'description', + 'statement_descriptor', + 'acquirer_name', + 'acquirer_affiliation_code', + 'acquirer_tid', + 'acquirer_nsu', + 'acquirer_auth_code', + 'operation_type', + 'card', + 'acquirer_message', + 'acquirer_return_code', + 'installments', ] _nullables.extend(GetTransactionResponse._nullables) def __init__(self, - description=APIHelper.SKIP, + statement_descriptor=APIHelper.SKIP, + acquirer_name=APIHelper.SKIP, + acquirer_affiliation_code=APIHelper.SKIP, + acquirer_tid=APIHelper.SKIP, + acquirer_nsu=APIHelper.SKIP, + acquirer_auth_code=APIHelper.SKIP, + operation_type=APIHelper.SKIP, + card=APIHelper.SKIP, + acquirer_message=APIHelper.SKIP, + acquirer_return_code=APIHelper.SKIP, + installments=APIHelper.SKIP, gateway_id=APIHelper.SKIP, amount=APIHelper.SKIP, status=APIHelper.SKIP, @@ -1967,7 +1924,7 @@ def __init__(self, max_attempts=APIHelper.SKIP, splits=APIHelper.SKIP, next_attempt=APIHelper.SKIP, - transaction_type='cash', + transaction_type='private_label', id=APIHelper.SKIP, gateway_response=APIHelper.SKIP, antifraud_response=APIHelper.SKIP, @@ -1976,32 +1933,52 @@ def __init__(self, interest=APIHelper.SKIP, fine=APIHelper.SKIP, max_days_to_pay_past_due=APIHelper.SKIP): - """Constructor for the GetCashTransactionResponse class""" + """Constructor for the GetPrivateLabelTransactionResponse class""" # Initialize members of the class - if description is not APIHelper.SKIP: - self.description = description + if statement_descriptor is not APIHelper.SKIP: + self.statement_descriptor = statement_descriptor + if acquirer_name is not APIHelper.SKIP: + self.acquirer_name = acquirer_name + if acquirer_affiliation_code is not APIHelper.SKIP: + self.acquirer_affiliation_code = acquirer_affiliation_code + if acquirer_tid is not APIHelper.SKIP: + self.acquirer_tid = acquirer_tid + if acquirer_nsu is not APIHelper.SKIP: + self.acquirer_nsu = acquirer_nsu + if acquirer_auth_code is not APIHelper.SKIP: + self.acquirer_auth_code = acquirer_auth_code + if operation_type is not APIHelper.SKIP: + self.operation_type = operation_type + if card is not APIHelper.SKIP: + self.card = card + if acquirer_message is not APIHelper.SKIP: + self.acquirer_message = acquirer_message + if acquirer_return_code is not APIHelper.SKIP: + self.acquirer_return_code = acquirer_return_code + if installments is not APIHelper.SKIP: + self.installments = installments # Call the constructor for the base class - super(GetCashTransactionResponse, self).__init__(gateway_id, - amount, - status, - success, - created_at, - updated_at, - attempt_count, - max_attempts, - splits, - next_attempt, - transaction_type, - id, - gateway_response, - antifraud_response, - metadata, - split, - interest, - fine, - max_days_to_pay_past_due) + super(GetPrivateLabelTransactionResponse, self).__init__(gateway_id, + amount, + status, + success, + created_at, + updated_at, + attempt_count, + max_attempts, + splits, + next_attempt, + transaction_type, + id, + gateway_response, + antifraud_response, + metadata, + split, + interest, + fine, + max_days_to_pay_past_due) @classmethod def from_dictionary(cls, @@ -2022,7 +1999,20 @@ def from_dictionary(cls, return None # Extract variables from the dictionary - description = dictionary.get("description") if "description" in dictionary.keys() else APIHelper.SKIP + statement_descriptor = dictionary.get("statement_descriptor") if "statement_descriptor" in dictionary.keys() else APIHelper.SKIP + acquirer_name = dictionary.get("acquirer_name") if "acquirer_name" in dictionary.keys() else APIHelper.SKIP + acquirer_affiliation_code = dictionary.get("acquirer_affiliation_code") if "acquirer_affiliation_code" in dictionary.keys() else APIHelper.SKIP + acquirer_tid = dictionary.get("acquirer_tid") if "acquirer_tid" in dictionary.keys() else APIHelper.SKIP + acquirer_nsu = dictionary.get("acquirer_nsu") if "acquirer_nsu" in dictionary.keys() else APIHelper.SKIP + acquirer_auth_code = dictionary.get("acquirer_auth_code") if "acquirer_auth_code" in dictionary.keys() else APIHelper.SKIP + operation_type = dictionary.get("operation_type") if "operation_type" in dictionary.keys() else APIHelper.SKIP + if 'card' in dictionary.keys(): + card = GetCardResponse.from_dictionary(dictionary.get('card')) if dictionary.get('card') else None + else: + card = APIHelper.SKIP + acquirer_message = dictionary.get("acquirer_message") if "acquirer_message" in dictionary.keys() else APIHelper.SKIP + acquirer_return_code = dictionary.get("acquirer_return_code") if "acquirer_return_code" in dictionary.keys() else APIHelper.SKIP + installments = dictionary.get("installments") if "installments" in dictionary.keys() else APIHelper.SKIP gateway_id = dictionary.get("gateway_id") if "gateway_id" in dictionary.keys() else APIHelper.SKIP amount = dictionary.get("amount") if "amount" in dictionary.keys() else APIHelper.SKIP status = dictionary.get("status") if "status" in dictionary.keys() else APIHelper.SKIP @@ -2045,7 +2035,7 @@ def from_dictionary(cls, next_attempt = APIHelper.RFC3339DateTime.from_value(dictionary.get("next_attempt")).datetime if dictionary.get("next_attempt") else None else: next_attempt = APIHelper.SKIP - transaction_type = dictionary.get("transaction_type") if dictionary.get("transaction_type") else 'cash' + transaction_type = dictionary.get("transaction_type") if dictionary.get("transaction_type") else 'private_label' id = dictionary.get("id") if "id" in dictionary.keys() else APIHelper.SKIP if 'gateway_response' in dictionary.keys(): gateway_response = GetGatewayResponseResponse.from_dictionary(dictionary.get('gateway_response')) if dictionary.get('gateway_response') else None @@ -2070,7 +2060,17 @@ def from_dictionary(cls, fine = APIHelper.SKIP max_days_to_pay_past_due = dictionary.get("max_days_to_pay_past_due") if "max_days_to_pay_past_due" in dictionary.keys() else APIHelper.SKIP # Return an object of this model - return cls(description, + return cls(statement_descriptor, + acquirer_name, + acquirer_affiliation_code, + acquirer_tid, + acquirer_nsu, + acquirer_auth_code, + operation_type, + card, + acquirer_message, + acquirer_return_code, + installments, gateway_id, amount, status,