From 3eee6fdffa542da03c214ab295386e625fa2300f Mon Sep 17 00:00:00 2001 From: andreals Date: Thu, 9 May 2024 13:01:16 +0000 Subject: [PATCH] Automated commit message --- README.md | 92 +- doc/controllers/balance-operations.md | 44 +- doc/controllers/charges.md | 376 ++--- doc/controllers/customers.md | 460 +++--- doc/controllers/invoices.md | 192 +-- doc/controllers/orders.md | 314 ++-- doc/controllers/plans.md | 336 ++-- doc/controllers/recipients.md | 500 +++--- doc/controllers/subscriptions.md | 1216 +++++++------- doc/controllers/tokens.md | 68 +- doc/controllers/transfers.md | 52 +- doc/models/create-customer-request.md | 2 +- doc/models/create-kyc-link-response.md | 27 + doc/models/create-order-request.md | 2 +- doc/models/create-subscription-request.md | 2 +- pom.xml | 8 +- src/main/java/me/pagar/api/Environment.java | 3 +- .../me/pagar/api/PagarmeApiSDKClient.java | 41 +- src/main/java/me/pagar/api/Server.java | 3 +- .../BalanceOperationsController.java | 18 +- .../api/controllers/ChargesController.java | 148 +- .../api/controllers/CustomersController.java | 206 +-- .../DefaultBalanceOperationsController.java | 70 +- .../controllers/DefaultChargesController.java | 400 ++--- .../DefaultCustomersController.java | 590 +++---- .../DefaultInvoicesController.java | 324 ++-- .../controllers/DefaultOrdersController.java | 344 ++-- .../controllers/DefaultPlansController.java | 308 ++-- .../DefaultRecipientsController.java | 689 ++++---- .../DefaultSubscriptionsController.java | 1436 ++++++++--------- .../controllers/DefaultTokensController.java | 66 +- .../DefaultTransfersController.java | 50 +- .../api/controllers/InvoicesController.java | 110 +- .../api/controllers/OrdersController.java | 118 +- .../api/controllers/PlansController.java | 100 +- .../api/controllers/RecipientsController.java | 229 +-- .../controllers/SubscriptionsController.java | 498 +++--- .../api/controllers/TokensController.java | 22 +- .../api/controllers/TransfersController.java | 14 +- .../pagar/api/http/request/HttpRequest.java | 25 +- .../api/models/CreateKYCLinkResponse.java | 273 ++++ .../models/GetMovementObjectBaseResponse.java | 2 +- .../api/models/GetTransactionResponse.java | 4 +- 43 files changed, 5087 insertions(+), 4695 deletions(-) create mode 100644 doc/models/create-kyc-link-response.md create mode 100644 src/main/java/me/pagar/api/models/CreateKYCLinkResponse.java diff --git a/README.md b/README.md index 89a093b..87b8ab9 100644 --- a/README.md +++ b/README.md @@ -16,19 +16,19 @@ you will need internet access for a successful build. * In order to open the client library in Eclipse click on `File -> Import`. -![Importing SDK into Eclipse - Step 1](https://apidocs.io/illustration/java?workspaceFolder=PagarmeApiSDK-Java&workspaceName=PagarmeApiSDK&projectName=PagarmeApiSDKLib&rootNamespace=me.pagar.api&groupId=PagarmeApiSDKLib&artifactId=pagarme-api-sdklib&version=6.8.7&step=import0) +![Importing SDK into Eclipse - Step 1](https://apidocs.io/illustration/java?workspaceFolder=PagarmeApiSDK-Java&workspaceName=PagarmeApiSDK&projectName=PagarmeApiSDKLib&rootNamespace=me.pagar.api&groupId=PagarmeApiSDKLib&artifactId=pagarme-api-sdklib&version=6.8.8&step=import0) * In the import dialog, select `Existing Java Project` and click `Next`. -![Importing SDK into Eclipse - Step 2](https://apidocs.io/illustration/java?workspaceFolder=PagarmeApiSDK-Java&workspaceName=PagarmeApiSDK&projectName=PagarmeApiSDKLib&rootNamespace=me.pagar.api&groupId=PagarmeApiSDKLib&artifactId=pagarme-api-sdklib&version=6.8.7&step=import1) +![Importing SDK into Eclipse - Step 2](https://apidocs.io/illustration/java?workspaceFolder=PagarmeApiSDK-Java&workspaceName=PagarmeApiSDK&projectName=PagarmeApiSDKLib&rootNamespace=me.pagar.api&groupId=PagarmeApiSDKLib&artifactId=pagarme-api-sdklib&version=6.8.8&step=import1) * Browse to locate the folder containing the source code. Select the detected location of the project and click `Finish`. -![Importing SDK into Eclipse - Step 3](https://apidocs.io/illustration/java?workspaceFolder=PagarmeApiSDK-Java&workspaceName=PagarmeApiSDK&projectName=PagarmeApiSDKLib&rootNamespace=me.pagar.api&groupId=PagarmeApiSDKLib&artifactId=pagarme-api-sdklib&version=6.8.7&step=import2) +![Importing SDK into Eclipse - Step 3](https://apidocs.io/illustration/java?workspaceFolder=PagarmeApiSDK-Java&workspaceName=PagarmeApiSDK&projectName=PagarmeApiSDKLib&rootNamespace=me.pagar.api&groupId=PagarmeApiSDKLib&artifactId=pagarme-api-sdklib&version=6.8.8&step=import2) * Upon successful import, the project will be automatically built by Eclipse after automatically resolving the dependencies. -![Importing SDK into Eclipse - Step 4](https://apidocs.io/illustration/java?workspaceFolder=PagarmeApiSDK-Java&workspaceName=PagarmeApiSDK&projectName=PagarmeApiSDKLib&rootNamespace=me.pagar.api&groupId=PagarmeApiSDKLib&artifactId=pagarme-api-sdklib&version=6.8.7&step=import3) +![Importing SDK into Eclipse - Step 4](https://apidocs.io/illustration/java?workspaceFolder=PagarmeApiSDK-Java&workspaceName=PagarmeApiSDK&projectName=PagarmeApiSDKLib&rootNamespace=me.pagar.api&groupId=PagarmeApiSDKLib&artifactId=pagarme-api-sdklib&version=6.8.8&step=import3) ## Installation @@ -38,35 +38,35 @@ The following section explains how to use the PagarmeApiSDKLib library in a new For starting a new project, click the menu command `File > New > Project`. -![Add a new project in Eclipse](https://apidocs.io/illustration/java?workspaceFolder=PagarmeApiSDK-Java&workspaceName=PagarmeApiSDK&projectName=PagarmeApiSDKLib&rootNamespace=me.pagar.api&groupId=PagarmeApiSDKLib&artifactId=pagarme-api-sdklib&version=6.8.7&step=createNewProject0) +![Add a new project in Eclipse](https://apidocs.io/illustration/java?workspaceFolder=PagarmeApiSDK-Java&workspaceName=PagarmeApiSDK&projectName=PagarmeApiSDKLib&rootNamespace=me.pagar.api&groupId=PagarmeApiSDKLib&artifactId=pagarme-api-sdklib&version=6.8.8&step=createNewProject0) Next, choose `Maven > Maven Project` and click `Next`. -![Create a new Maven Project - Step 1](https://apidocs.io/illustration/java?workspaceFolder=PagarmeApiSDK-Java&workspaceName=PagarmeApiSDK&projectName=PagarmeApiSDKLib&rootNamespace=me.pagar.api&groupId=PagarmeApiSDKLib&artifactId=pagarme-api-sdklib&version=6.8.7&step=createNewProject1) +![Create a new Maven Project - Step 1](https://apidocs.io/illustration/java?workspaceFolder=PagarmeApiSDK-Java&workspaceName=PagarmeApiSDK&projectName=PagarmeApiSDKLib&rootNamespace=me.pagar.api&groupId=PagarmeApiSDKLib&artifactId=pagarme-api-sdklib&version=6.8.8&step=createNewProject1) Here, make sure to use the current workspace by choosing `Use default Workspace location`, as shown in the picture below and click `Next`. -![Create a new Maven Project - Step 2](https://apidocs.io/illustration/java?workspaceFolder=PagarmeApiSDK-Java&workspaceName=PagarmeApiSDK&projectName=PagarmeApiSDKLib&rootNamespace=me.pagar.api&groupId=PagarmeApiSDKLib&artifactId=pagarme-api-sdklib&version=6.8.7&step=createNewProject2) +![Create a new Maven Project - Step 2](https://apidocs.io/illustration/java?workspaceFolder=PagarmeApiSDK-Java&workspaceName=PagarmeApiSDK&projectName=PagarmeApiSDKLib&rootNamespace=me.pagar.api&groupId=PagarmeApiSDKLib&artifactId=pagarme-api-sdklib&version=6.8.8&step=createNewProject2) Following this, select the *quick start* project type to create a simple project with an existing class and a `main` method. To do this, choose `maven-archetype-quickstart` item from the list and click `Next`. -![Create a new Maven Project - Step 3](https://apidocs.io/illustration/java?workspaceFolder=PagarmeApiSDK-Java&workspaceName=PagarmeApiSDK&projectName=PagarmeApiSDKLib&rootNamespace=me.pagar.api&groupId=PagarmeApiSDKLib&artifactId=pagarme-api-sdklib&version=6.8.7&step=createNewProject3) +![Create a new Maven Project - Step 3](https://apidocs.io/illustration/java?workspaceFolder=PagarmeApiSDK-Java&workspaceName=PagarmeApiSDK&projectName=PagarmeApiSDKLib&rootNamespace=me.pagar.api&groupId=PagarmeApiSDKLib&artifactId=pagarme-api-sdklib&version=6.8.8&step=createNewProject3) In the last step, provide a `Group Id` and `Artifact Id` as shown in the picture below and click `Finish`. -![Create a new Maven Project - Step 4](https://apidocs.io/illustration/java?workspaceFolder=PagarmeApiSDK-Java&workspaceName=PagarmeApiSDK&projectName=PagarmeApiSDKLib&rootNamespace=me.pagar.api&groupId=PagarmeApiSDKLib&artifactId=pagarme-api-sdklib&version=6.8.7&step=createNewProject4) +![Create a new Maven Project - Step 4](https://apidocs.io/illustration/java?workspaceFolder=PagarmeApiSDK-Java&workspaceName=PagarmeApiSDK&projectName=PagarmeApiSDKLib&rootNamespace=me.pagar.api&groupId=PagarmeApiSDKLib&artifactId=pagarme-api-sdklib&version=6.8.8&step=createNewProject4) ### 2. Add reference of the library project The created Maven project manages its dependencies using its `pom.xml` file. In order to add a dependency on the *PagarmeApiSDKLib* client library, double click on the `pom.xml` file in the `Package Explorer`. Opening the `pom.xml` file will render a graphical view on the canvas. Here, switch to the `Dependencies` tab and click the `Add` button as shown in the picture below. -![Adding dependency to the client library - Step 1](https://apidocs.io/illustration/java?workspaceFolder=PagarmeApiSDK-Java&workspaceName=PagarmeApiSDK&projectName=PagarmeApiSDKLib&rootNamespace=me.pagar.api&groupId=PagarmeApiSDKLib&artifactId=pagarme-api-sdklib&version=6.8.7&step=testProject0) +![Adding dependency to the client library - Step 1](https://apidocs.io/illustration/java?workspaceFolder=PagarmeApiSDK-Java&workspaceName=PagarmeApiSDK&projectName=PagarmeApiSDKLib&rootNamespace=me.pagar.api&groupId=PagarmeApiSDKLib&artifactId=pagarme-api-sdklib&version=6.8.8&step=testProject0) -Clicking the `Add` button will open a dialog where you need to specify PagarmeApiSDKLib in `Group Id`, pagarme-api-sdklib in `Artifact Id` and 6.8.7 in the `Version` fields. Once added click `OK`. Save the `pom.xml` file. +Clicking the `Add` button will open a dialog where you need to specify PagarmeApiSDKLib in `Group Id`, pagarme-api-sdklib in `Artifact Id` and 6.8.8 in the `Version` fields. Once added click `OK`. Save the `pom.xml` file. -![Adding dependency to the client library - Step 2](https://apidocs.io/illustration/java?workspaceFolder=PagarmeApiSDK-Java&workspaceName=PagarmeApiSDK&projectName=PagarmeApiSDKLib&rootNamespace=me.pagar.api&groupId=PagarmeApiSDKLib&artifactId=pagarme-api-sdklib&version=6.8.7&step=testProject1) +![Adding dependency to the client library - Step 2](https://apidocs.io/illustration/java?workspaceFolder=PagarmeApiSDK-Java&workspaceName=PagarmeApiSDK&projectName=PagarmeApiSDKLib&rootNamespace=me.pagar.api&groupId=PagarmeApiSDKLib&artifactId=pagarme-api-sdklib&version=6.8.8&step=testProject1) -![Adding sample code](https://apidocs.io/illustration/java?workspaceFolder=PagarmeApiSDK-Java&workspaceName=PagarmeApiSDK&projectName=PagarmeApiSDKLib&rootNamespace=me.pagar.api&groupId=PagarmeApiSDKLib&artifactId=pagarme-api-sdklib&version=6.8.7&step=testProject2) +![Adding sample code](https://apidocs.io/illustration/java?workspaceFolder=PagarmeApiSDK-Java&workspaceName=PagarmeApiSDK&projectName=PagarmeApiSDKLib&rootNamespace=me.pagar.api&groupId=PagarmeApiSDKLib&artifactId=pagarme-api-sdklib&version=6.8.8&step=testProject2) ### 3. Write sample code @@ -75,15 +75,15 @@ Here, you can add code to initialize the client library and instantiate a *Contr ## Initialize the API Client -**_Note:_** Documentation for the client can be found [here.](https://www.github.com/pagarme/pagarme-java-sdk/tree/6.8.7/doc/client.md) +**_Note:_** Documentation for the client can be found [here.](https://www.github.com/pagarme/pagarme-java-sdk/tree/6.8.8/doc/client.md) The following parameters are configurable for the API Client: | Parameter | Type | Description | | --- | --- | --- | | `serviceRefererName` | `String` | | -| `httpClientConfig` | [`ReadonlyHttpClientConfiguration`](https://www.github.com/pagarme/pagarme-java-sdk/tree/6.8.7/doc/http-client-configuration.md) | Http Client Configuration instance. | -| `basicAuthCredentials` | [`BasicAuthCredentials`](https://www.github.com/pagarme/pagarme-java-sdk/tree/6.8.7/doc/$a/https://www.github.com/pagarme/pagarme-java-sdk/tree/6.8.7/basic-authentication.md) | The Credentials Setter for Basic Authentication | +| `httpClientConfig` | [`ReadonlyHttpClientConfiguration`](https://www.github.com/pagarme/pagarme-java-sdk/tree/6.8.8/doc/http-client-configuration.md) | Http Client Configuration instance. | +| `basicAuthCredentials` | [`BasicAuthCredentials`](https://www.github.com/pagarme/pagarme-java-sdk/tree/6.8.8/doc/$a/https://www.github.com/pagarme/pagarme-java-sdk/tree/6.8.8/basic-authentication.md) | The Credentials Setter for Basic Authentication | The API client can be initialized as follows: @@ -104,7 +104,7 @@ PagarmeApiSDKClient client = new PagarmeApiSDKClient.Builder() This API uses the following authentication schemes. -* [`httpBasic (Basic Authentication)`](https://www.github.com/pagarme/pagarme-java-sdk/tree/6.8.7/doc/$a/https://www.github.com/pagarme/pagarme-java-sdk/tree/6.8.7/basic-authentication.md) +* [`httpBasic (Basic Authentication)`](https://www.github.com/pagarme/pagarme-java-sdk/tree/6.8.8/doc/$a/https://www.github.com/pagarme/pagarme-java-sdk/tree/6.8.8/basic-authentication.md) ## API Errors @@ -112,39 +112,39 @@ 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-java-sdk/tree/6.8.7/doc/models/error-exception.md) | -| 401 | Invalid API key | [`ErrorException`](https://www.github.com/pagarme/pagarme-java-sdk/tree/6.8.7/doc/models/error-exception.md) | -| 404 | An informed resource was not found | [`ErrorException`](https://www.github.com/pagarme/pagarme-java-sdk/tree/6.8.7/doc/models/error-exception.md) | -| 412 | Business validation error | [`ErrorException`](https://www.github.com/pagarme/pagarme-java-sdk/tree/6.8.7/doc/models/error-exception.md) | -| 422 | Contract validation error | [`ErrorException`](https://www.github.com/pagarme/pagarme-java-sdk/tree/6.8.7/doc/models/error-exception.md) | -| 500 | Internal server error | [`ErrorException`](https://www.github.com/pagarme/pagarme-java-sdk/tree/6.8.7/doc/models/error-exception.md) | +| 400 | Invalid request | [`ErrorException`](https://www.github.com/pagarme/pagarme-java-sdk/tree/6.8.8/doc/models/error-exception.md) | +| 401 | Invalid API key | [`ErrorException`](https://www.github.com/pagarme/pagarme-java-sdk/tree/6.8.8/doc/models/error-exception.md) | +| 404 | An informed resource was not found | [`ErrorException`](https://www.github.com/pagarme/pagarme-java-sdk/tree/6.8.8/doc/models/error-exception.md) | +| 412 | Business validation error | [`ErrorException`](https://www.github.com/pagarme/pagarme-java-sdk/tree/6.8.8/doc/models/error-exception.md) | +| 422 | Contract validation error | [`ErrorException`](https://www.github.com/pagarme/pagarme-java-sdk/tree/6.8.8/doc/models/error-exception.md) | +| 500 | Internal server error | [`ErrorException`](https://www.github.com/pagarme/pagarme-java-sdk/tree/6.8.8/doc/models/error-exception.md) | ## List of APIs -* [Subscriptions](https://www.github.com/pagarme/pagarme-java-sdk/tree/6.8.7/doc/controllers/subscriptions.md) -* [Orders](https://www.github.com/pagarme/pagarme-java-sdk/tree/6.8.7/doc/controllers/orders.md) -* [Plans](https://www.github.com/pagarme/pagarme-java-sdk/tree/6.8.7/doc/controllers/plans.md) -* [Invoices](https://www.github.com/pagarme/pagarme-java-sdk/tree/6.8.7/doc/controllers/invoices.md) -* [Customers](https://www.github.com/pagarme/pagarme-java-sdk/tree/6.8.7/doc/controllers/customers.md) -* [Charges](https://www.github.com/pagarme/pagarme-java-sdk/tree/6.8.7/doc/controllers/charges.md) -* [Recipients](https://www.github.com/pagarme/pagarme-java-sdk/tree/6.8.7/doc/controllers/recipients.md) -* [Tokens](https://www.github.com/pagarme/pagarme-java-sdk/tree/6.8.7/doc/controllers/tokens.md) -* [Transactions](https://www.github.com/pagarme/pagarme-java-sdk/tree/6.8.7/doc/controllers/transactions.md) -* [Transfers](https://www.github.com/pagarme/pagarme-java-sdk/tree/6.8.7/doc/controllers/transfers.md) -* [Payables](https://www.github.com/pagarme/pagarme-java-sdk/tree/6.8.7/doc/controllers/payables.md) -* [Balance Operations](https://www.github.com/pagarme/pagarme-java-sdk/tree/6.8.7/doc/controllers/balance-operations.md) +* [Subscriptions](https://www.github.com/pagarme/pagarme-java-sdk/tree/6.8.8/doc/controllers/subscriptions.md) +* [Orders](https://www.github.com/pagarme/pagarme-java-sdk/tree/6.8.8/doc/controllers/orders.md) +* [Plans](https://www.github.com/pagarme/pagarme-java-sdk/tree/6.8.8/doc/controllers/plans.md) +* [Invoices](https://www.github.com/pagarme/pagarme-java-sdk/tree/6.8.8/doc/controllers/invoices.md) +* [Customers](https://www.github.com/pagarme/pagarme-java-sdk/tree/6.8.8/doc/controllers/customers.md) +* [Charges](https://www.github.com/pagarme/pagarme-java-sdk/tree/6.8.8/doc/controllers/charges.md) +* [Recipients](https://www.github.com/pagarme/pagarme-java-sdk/tree/6.8.8/doc/controllers/recipients.md) +* [Tokens](https://www.github.com/pagarme/pagarme-java-sdk/tree/6.8.8/doc/controllers/tokens.md) +* [Transactions](https://www.github.com/pagarme/pagarme-java-sdk/tree/6.8.8/doc/controllers/transactions.md) +* [Transfers](https://www.github.com/pagarme/pagarme-java-sdk/tree/6.8.8/doc/controllers/transfers.md) +* [Payables](https://www.github.com/pagarme/pagarme-java-sdk/tree/6.8.8/doc/controllers/payables.md) +* [Balance Operations](https://www.github.com/pagarme/pagarme-java-sdk/tree/6.8.8/doc/controllers/balance-operations.md) ## Classes Documentation -* [Utility Classes](https://www.github.com/pagarme/pagarme-java-sdk/tree/6.8.7/doc/utility-classes.md) -* [HttpRequest](https://www.github.com/pagarme/pagarme-java-sdk/tree/6.8.7/doc/http-request.md) -* [HttpResponse](https://www.github.com/pagarme/pagarme-java-sdk/tree/6.8.7/doc/http-response.md) -* [HttpStringResponse](https://www.github.com/pagarme/pagarme-java-sdk/tree/6.8.7/doc/http-string-response.md) -* [HttpContext](https://www.github.com/pagarme/pagarme-java-sdk/tree/6.8.7/doc/http-context.md) -* [HttpBodyRequest](https://www.github.com/pagarme/pagarme-java-sdk/tree/6.8.7/doc/http-body-request.md) -* [Headers](https://www.github.com/pagarme/pagarme-java-sdk/tree/6.8.7/doc/headers.md) -* [ApiException](https://www.github.com/pagarme/pagarme-java-sdk/tree/6.8.7/doc/api-exception.md) -* [Configuration Interface](https://www.github.com/pagarme/pagarme-java-sdk/tree/6.8.7/doc/configuration-interface.md) -* [HttpClientConfiguration](https://www.github.com/pagarme/pagarme-java-sdk/tree/6.8.7/doc/http-client-configuration.md) -* [HttpClientConfiguration.Builder](https://www.github.com/pagarme/pagarme-java-sdk/tree/6.8.7/doc/http-client-configuration-builder.md) +* [Utility Classes](https://www.github.com/pagarme/pagarme-java-sdk/tree/6.8.8/doc/utility-classes.md) +* [HttpRequest](https://www.github.com/pagarme/pagarme-java-sdk/tree/6.8.8/doc/http-request.md) +* [HttpResponse](https://www.github.com/pagarme/pagarme-java-sdk/tree/6.8.8/doc/http-response.md) +* [HttpStringResponse](https://www.github.com/pagarme/pagarme-java-sdk/tree/6.8.8/doc/http-string-response.md) +* [HttpContext](https://www.github.com/pagarme/pagarme-java-sdk/tree/6.8.8/doc/http-context.md) +* [HttpBodyRequest](https://www.github.com/pagarme/pagarme-java-sdk/tree/6.8.8/doc/http-body-request.md) +* [Headers](https://www.github.com/pagarme/pagarme-java-sdk/tree/6.8.8/doc/headers.md) +* [ApiException](https://www.github.com/pagarme/pagarme-java-sdk/tree/6.8.8/doc/api-exception.md) +* [Configuration Interface](https://www.github.com/pagarme/pagarme-java-sdk/tree/6.8.8/doc/configuration-interface.md) +* [HttpClientConfiguration](https://www.github.com/pagarme/pagarme-java-sdk/tree/6.8.8/doc/http-client-configuration.md) +* [HttpClientConfiguration.Builder](https://www.github.com/pagarme/pagarme-java-sdk/tree/6.8.8/doc/http-client-configuration-builder.md) diff --git a/doc/controllers/balance-operations.md b/doc/controllers/balance-operations.md index 5ed105c..87086f6 100644 --- a/doc/controllers/balance-operations.md +++ b/doc/controllers/balance-operations.md @@ -10,34 +10,38 @@ BalanceOperationsController balanceOperationsController = client.getBalanceOpera ## Methods -* [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](../../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 +# Get Balance Operations ```java -GetBalanceOperationResponse getBalanceOperationById( - final long id) +ListBalanceOperationResponse getBalanceOperations( + final String status, + final LocalDateTime createdSince, + final LocalDateTime createdUntil, + final String recipientId) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `id` | `long` | Template, Required | - | +| `status` | `String` | Query, Optional | - | +| `createdSince` | `LocalDateTime` | Query, Optional | - | +| `createdUntil` | `LocalDateTime` | Query, Optional | - | +| `recipientId` | `String` | Query, Optional | - | ## Response Type -[`GetBalanceOperationResponse`](../../doc/models/get-balance-operation-response.md) +[`ListBalanceOperationResponse`](../../doc/models/list-balance-operation-response.md) ## Example Usage ```java -long id = 112L; - try { - GetBalanceOperationResponse result = balanceOperationsController.getBalanceOperationById(id); + ListBalanceOperationResponse result = balanceOperationsController.getBalanceOperations(null, null, null, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -47,34 +51,30 @@ try { ``` -# Get Balance Operations +# Get Balance Operation by Id ```java -ListBalanceOperationResponse getBalanceOperations( - final String status, - final LocalDateTime createdSince, - final LocalDateTime createdUntil, - final String recipientId) +GetBalanceOperationResponse getBalanceOperationById( + final long id) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `status` | `String` | Query, Optional | - | -| `createdSince` | `LocalDateTime` | Query, Optional | - | -| `createdUntil` | `LocalDateTime` | Query, Optional | - | -| `recipientId` | `String` | Query, Optional | - | +| `id` | `long` | Template, Required | - | ## Response Type -[`ListBalanceOperationResponse`](../../doc/models/list-balance-operation-response.md) +[`GetBalanceOperationResponse`](../../doc/models/get-balance-operation-response.md) ## Example Usage ```java +long id = 112L; + try { - ListBalanceOperationResponse result = balanceOperationsController.getBalanceOperations(null, null, null, null); + GetBalanceOperationResponse result = balanceOperationsController.getBalanceOperationById(id); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); diff --git a/doc/controllers/charges.md b/doc/controllers/charges.md index e6511a9..fcb61bd 100644 --- a/doc/controllers/charges.md +++ b/doc/controllers/charges.md @@ -11,18 +11,18 @@ ChargesController chargesController = client.getChargesController(); ## Methods * [Update Charge Metadata](../../doc/controllers/charges.md#update-charge-metadata) -* [Capture Charge](../../doc/controllers/charges.md#capture-charge) -* [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) +* [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) * [Get Charges Summary](../../doc/controllers/charges.md#get-charges-summary) * [Retry Charge](../../doc/controllers/charges.md#retry-charge) -* [Get Charges](../../doc/controllers/charges.md#get-charges) -* [Cancel Charge](../../doc/controllers/charges.md#cancel-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) # Update Charge Metadata @@ -71,14 +71,14 @@ try { ``` -# Capture Charge +# Update Charge Payment Method -Captures a charge +Updates a charge's payment method ```java -GetChargeResponse captureCharge( +GetChargeResponse updateChargePaymentMethod( final String chargeId, - final CreateCaptureChargeRequest request, + final UpdateChargePaymentMethodRequest request, final String idempotencyKey) ``` @@ -87,7 +87,7 @@ GetChargeResponse captureCharge( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `chargeId` | `String` | Template, Required | Charge id | -| `request` | [`CreateCaptureChargeRequest`](../../doc/models/create-capture-charge-request.md) | Body, Optional | Request for capturing a charge | +| `request` | [`UpdateChargePaymentMethodRequest`](../../doc/models/update-charge-payment-method-request.md) | Body, Required | Request for updating the payment method from a charge | | `idempotencyKey` | `String` | Header, Optional | - | ## Response Type @@ -98,9 +98,60 @@ GetChargeResponse captureCharge( ```java String chargeId = "charge_id8"; +UpdateChargePaymentMethodRequest request = new UpdateChargePaymentMethodRequest.Builder( + false, + "payment_method4", + new CreateCreditCardPaymentRequest.Builder() + .installments(1) + .capture(true) + .recurrencyCycle("\"first\" or \"subsequent\"") + .build(), + new CreateDebitCardPaymentRequest.Builder() + .build(), + new CreateBoletoPaymentRequest.Builder( + 226, + "instructions2", + new CreateAddressRequest.Builder( + "street8", + "number4", + "zip_code2", + "neighborhood4", + "city2", + "state6", + "country2", + "complement6", + "line_18", + "line_26" + ) + .build(), + "document_number6", + "statement_descriptor0" + ) + .build(), + new CreateVoucherPaymentRequest.Builder() + .recurrencyCycle("\"first\" or \"subsequent\"") + .build(), + new CreateCashPaymentRequest.Builder( + "description0", + false + ) + .build(), + new CreateBankTransferPaymentRequest.Builder( + "bank0", + 236 + ) + .build(), + new CreatePrivateLabelPaymentRequest.Builder() + .installments(1) + .capture(true) + .recurrencyCycle("\"first\" or \"subsequent\"") + .build() +) +.build(); + try { - GetChargeResponse result = chargesController.captureCharge(chargeId, null, null); + GetChargeResponse result = chargesController.updateChargePaymentMethod(chargeId, request, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -110,24 +161,26 @@ try { ``` -# Get Charge - -Get a charge from its id +# Get Charge Transactions ```java -GetChargeResponse getCharge( - final String chargeId) +ListChargeTransactionsResponse getChargeTransactions( + final String chargeId, + final Integer page, + final Integer size) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `chargeId` | `String` | Template, Required | Charge id | +| `chargeId` | `String` | Template, Required | Charge Id | +| `page` | `Integer` | Query, Optional | Page number | +| `size` | `Integer` | Query, Optional | Page size | ## Response Type -[`GetChargeResponse`](../../doc/models/get-charge-response.md) +[`ListChargeTransactionsResponse`](../../doc/models/list-charge-transactions-response.md) ## Example Usage @@ -135,7 +188,7 @@ GetChargeResponse getCharge( String chargeId = "charge_id8"; try { - GetChargeResponse result = chargesController.getCharge(chargeId); + ListChargeTransactionsResponse result = chargesController.getChargeTransactions(chargeId, null, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -145,12 +198,14 @@ try { ``` -# Confirm Payment +# Update Charge Due Date + +Updates the due date from a charge ```java -GetChargeResponse confirmPayment( +GetChargeResponse updateChargeDueDate( final String chargeId, - final CreateConfirmPaymentRequest request, + final UpdateChargeDueDateRequest request, final String idempotencyKey) ``` @@ -158,8 +213,8 @@ GetChargeResponse confirmPayment( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `chargeId` | `String` | Template, Required | - | -| `request` | [`CreateConfirmPaymentRequest`](../../doc/models/create-confirm-payment-request.md) | Body, Optional | Request for confirm payment | +| `chargeId` | `String` | Template, Required | Charge Id | +| `request` | [`UpdateChargeDueDateRequest`](../../doc/models/update-charge-due-date-request.md) | Body, Required | Request for updating the due date | | `idempotencyKey` | `String` | Header, Optional | - | ## Response Type @@ -170,9 +225,12 @@ GetChargeResponse confirmPayment( ```java String chargeId = "charge_id8"; +UpdateChargeDueDateRequest request = new UpdateChargeDueDateRequest.Builder() + .build(); + try { - GetChargeResponse result = chargesController.confirmPayment(chargeId, null, null); + GetChargeResponse result = chargesController.updateChargeDueDate(chargeId, request, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -182,34 +240,46 @@ try { ``` -# Get Charge Transactions +# Get Charges + +Lists all charges ```java -ListChargeTransactionsResponse getChargeTransactions( - final String chargeId, +ListChargesResponse getCharges( final Integer page, - final Integer size) + final Integer size, + final String code, + final String status, + final String paymentMethod, + final String customerId, + final String orderId, + final LocalDateTime createdSince, + final LocalDateTime createdUntil) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `chargeId` | `String` | Template, Required | Charge Id | | `page` | `Integer` | Query, Optional | Page number | | `size` | `Integer` | Query, Optional | Page size | +| `code` | `String` | Query, Optional | Filter for charge's code | +| `status` | `String` | Query, Optional | Filter for charge's status | +| `paymentMethod` | `String` | Query, Optional | Filter for charge's payment method | +| `customerId` | `String` | Query, Optional | Filter for charge's customer id | +| `orderId` | `String` | Query, Optional | Filter for charge's order id | +| `createdSince` | `LocalDateTime` | Query, Optional | Filter for the beginning of the range for charge's creation | +| `createdUntil` | `LocalDateTime` | Query, Optional | Filter for the end of the range for charge's creation | ## Response Type -[`ListChargeTransactionsResponse`](../../doc/models/list-charge-transactions-response.md) +[`ListChargesResponse`](../../doc/models/list-charges-response.md) ## Example Usage ```java -String chargeId = "charge_id8"; - try { - ListChargeTransactionsResponse result = chargesController.getChargeTransactions(chargeId, null, null); + ListChargesResponse result = chargesController.getCharges(null, null, null, null, null, null, null, null, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -219,14 +289,14 @@ try { ``` -# Update Charge Card +# Capture Charge -Updates the card from a charge +Captures a charge ```java -GetChargeResponse updateChargeCard( +GetChargeResponse captureCharge( final String chargeId, - final UpdateChargeCardRequest request, + final CreateCaptureChargeRequest request, final String idempotencyKey) ``` @@ -235,7 +305,7 @@ GetChargeResponse updateChargeCard( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `chargeId` | `String` | Template, Required | Charge id | -| `request` | [`UpdateChargeCardRequest`](../../doc/models/update-charge-card-request.md) | Body, Required | Request for updating a charge's card | +| `request` | [`CreateCaptureChargeRequest`](../../doc/models/create-capture-charge-request.md) | Body, Optional | Request for capturing a charge | | `idempotencyKey` | `String` | Header, Optional | - | ## Response Type @@ -246,19 +316,9 @@ GetChargeResponse updateChargeCard( ```java String chargeId = "charge_id8"; -UpdateChargeCardRequest request = new UpdateChargeCardRequest.Builder( - false, - "card_id2", - new CreateCardRequest.Builder() - .type("credit") - .build(), - false -) -.build(); - try { - GetChargeResponse result = chargesController.updateChargeCard(chargeId, request, null); + GetChargeResponse result = chargesController.captureCharge(chargeId, null, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -268,13 +328,14 @@ try { ``` -# Create Charge +# Update Charge Card -Creates a new charge +Updates the card from a charge ```java -GetChargeResponse createCharge( - final CreateChargeRequest request, +GetChargeResponse updateChargeCard( + final String chargeId, + final UpdateChargeCardRequest request, final String idempotencyKey) ``` @@ -282,7 +343,8 @@ GetChargeResponse createCharge( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `request` | [`CreateChargeRequest`](../../doc/models/create-charge-request.md) | Body, Required | Request for creating a charge | +| `chargeId` | `String` | Template, Required | Charge id | +| `request` | [`UpdateChargeCardRequest`](../../doc/models/update-charge-card-request.md) | Body, Required | Request for updating a charge's card | | `idempotencyKey` | `String` | Header, Optional | - | ## Response Type @@ -292,19 +354,20 @@ GetChargeResponse createCharge( ## Example Usage ```java -CreateChargeRequest request = new CreateChargeRequest.Builder( - 242, - new CreatePaymentRequest.Builder( - "payment_method4" - ) - .build(), - "order_id0" +String chargeId = "charge_id8"; +UpdateChargeCardRequest request = new UpdateChargeCardRequest.Builder( + false, + "card_id2", + new CreateCardRequest.Builder() + .type("credit") + .build(), + false ) .build(); try { - GetChargeResponse result = chargesController.createCharge(request, null); + GetChargeResponse result = chargesController.updateChargeCard(chargeId, request, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -314,15 +377,13 @@ try { ``` -# Update Charge Payment Method +# Get Charge -Updates a charge's payment method +Get a charge from its id ```java -GetChargeResponse updateChargePaymentMethod( - final String chargeId, - final UpdateChargePaymentMethodRequest request, - final String idempotencyKey) +GetChargeResponse getCharge( + final String chargeId) ``` ## Parameters @@ -330,8 +391,6 @@ GetChargeResponse updateChargePaymentMethod( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `chargeId` | `String` | 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 | -| `idempotencyKey` | `String` | Header, Optional | - | ## Response Type @@ -341,60 +400,9 @@ GetChargeResponse updateChargePaymentMethod( ```java String chargeId = "charge_id8"; -UpdateChargePaymentMethodRequest request = new UpdateChargePaymentMethodRequest.Builder( - false, - "payment_method4", - new CreateCreditCardPaymentRequest.Builder() - .installments(1) - .capture(true) - .recurrencyCycle("\"first\" or \"subsequent\"") - .build(), - new CreateDebitCardPaymentRequest.Builder() - .build(), - new CreateBoletoPaymentRequest.Builder( - 226, - "instructions2", - new CreateAddressRequest.Builder( - "street8", - "number4", - "zip_code2", - "neighborhood4", - "city2", - "state6", - "country2", - "complement6", - "line_18", - "line_26" - ) - .build(), - "document_number6", - "statement_descriptor0" - ) - .build(), - new CreateVoucherPaymentRequest.Builder() - .recurrencyCycle("\"first\" or \"subsequent\"") - .build(), - new CreateCashPaymentRequest.Builder( - "description0", - false - ) - .build(), - new CreateBankTransferPaymentRequest.Builder( - "bank0", - 236 - ) - .build(), - new CreatePrivateLabelPaymentRequest.Builder() - .installments(1) - .capture(true) - .recurrencyCycle("\"first\" or \"subsequent\"") - .build() -) -.build(); - try { - GetChargeResponse result = chargesController.updateChargePaymentMethod(chargeId, request, null); + GetChargeResponse result = chargesController.getCharge(chargeId); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -404,39 +412,34 @@ try { ``` -# Update Charge Due Date - -Updates the due date from a charge +# Get Charges Summary ```java -GetChargeResponse updateChargeDueDate( - final String chargeId, - final UpdateChargeDueDateRequest request, - final String idempotencyKey) +GetChargesSummaryResponse getChargesSummary( + final String status, + final LocalDateTime createdSince, + final LocalDateTime createdUntil) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `chargeId` | `String` | Template, Required | Charge Id | -| `request` | [`UpdateChargeDueDateRequest`](../../doc/models/update-charge-due-date-request.md) | Body, Required | Request for updating the due date | -| `idempotencyKey` | `String` | Header, Optional | - | +| `status` | `String` | Query, Required | - | +| `createdSince` | `LocalDateTime` | Query, Optional | - | +| `createdUntil` | `LocalDateTime` | Query, Optional | - | ## Response Type -[`GetChargeResponse`](../../doc/models/get-charge-response.md) +[`GetChargesSummaryResponse`](../../doc/models/get-charges-summary-response.md) ## Example Usage ```java -String chargeId = "charge_id8"; -UpdateChargeDueDateRequest request = new UpdateChargeDueDateRequest.Builder() - .build(); - +String status = "status8"; try { - GetChargeResponse result = chargesController.updateChargeDueDate(chargeId, request, null); + GetChargesSummaryResponse result = chargesController.getChargesSummary(status, null, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -446,34 +449,34 @@ try { ``` -# Get Charges Summary +# Retry Charge + +Retries a charge ```java -GetChargesSummaryResponse getChargesSummary( - final String status, - final LocalDateTime createdSince, - final LocalDateTime createdUntil) +GetChargeResponse retryCharge( + final String chargeId, + final String idempotencyKey) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `status` | `String` | Query, Required | - | -| `createdSince` | `LocalDateTime` | Query, Optional | - | -| `createdUntil` | `LocalDateTime` | Query, Optional | - | +| `chargeId` | `String` | Template, Required | Charge id | +| `idempotencyKey` | `String` | Header, Optional | - | ## Response Type -[`GetChargesSummaryResponse`](../../doc/models/get-charges-summary-response.md) +[`GetChargeResponse`](../../doc/models/get-charge-response.md) ## Example Usage ```java -String status = "status8"; +String chargeId = "charge_id8"; try { - GetChargesSummaryResponse result = chargesController.getChargesSummary(status, null, null); + GetChargeResponse result = chargesController.retryCharge(chargeId, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -483,13 +486,14 @@ try { ``` -# Retry Charge +# Cancel Charge -Retries a charge +Cancel a charge ```java -GetChargeResponse retryCharge( +GetChargeResponse cancelCharge( final String chargeId, + final CreateCancelChargeRequest request, final String idempotencyKey) ``` @@ -498,6 +502,7 @@ GetChargeResponse retryCharge( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `chargeId` | `String` | Template, Required | Charge id | +| `request` | [`CreateCancelChargeRequest`](../../doc/models/create-cancel-charge-request.md) | Body, Optional | Request for cancelling a charge | | `idempotencyKey` | `String` | Header, Optional | - | ## Response Type @@ -510,7 +515,7 @@ GetChargeResponse retryCharge( String chargeId = "charge_id8"; try { - GetChargeResponse result = chargesController.retryCharge(chargeId, null); + GetChargeResponse result = chargesController.cancelCharge(chargeId, null, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -520,46 +525,43 @@ try { ``` -# Get Charges +# Create Charge -Lists all charges +Creates a new charge ```java -ListChargesResponse getCharges( - final Integer page, - final Integer size, - final String code, - final String status, - final String paymentMethod, - final String customerId, - final String orderId, - final LocalDateTime createdSince, - final LocalDateTime createdUntil) +GetChargeResponse createCharge( + final CreateChargeRequest request, + final String idempotencyKey) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `page` | `Integer` | Query, Optional | Page number | -| `size` | `Integer` | Query, Optional | Page size | -| `code` | `String` | Query, Optional | Filter for charge's code | -| `status` | `String` | Query, Optional | Filter for charge's status | -| `paymentMethod` | `String` | Query, Optional | Filter for charge's payment method | -| `customerId` | `String` | Query, Optional | Filter for charge's customer id | -| `orderId` | `String` | Query, Optional | Filter for charge's order id | -| `createdSince` | `LocalDateTime` | Query, Optional | Filter for the beginning of the range for charge's creation | -| `createdUntil` | `LocalDateTime` | Query, Optional | Filter for the end of the range for charge's creation | +| `request` | [`CreateChargeRequest`](../../doc/models/create-charge-request.md) | Body, Required | Request for creating a charge | +| `idempotencyKey` | `String` | Header, Optional | - | ## Response Type -[`ListChargesResponse`](../../doc/models/list-charges-response.md) +[`GetChargeResponse`](../../doc/models/get-charge-response.md) ## Example Usage ```java +CreateChargeRequest request = new CreateChargeRequest.Builder( + 242, + new CreatePaymentRequest.Builder( + "payment_method4" + ) + .build(), + "order_id0" +) +.build(); + + try { - ListChargesResponse result = chargesController.getCharges(null, null, null, null, null, null, null, null, null); + GetChargeResponse result = chargesController.createCharge(request, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -569,14 +571,12 @@ try { ``` -# Cancel Charge - -Cancel a charge +# Confirm Payment ```java -GetChargeResponse cancelCharge( +GetChargeResponse confirmPayment( final String chargeId, - final CreateCancelChargeRequest request, + final CreateConfirmPaymentRequest request, final String idempotencyKey) ``` @@ -584,8 +584,8 @@ GetChargeResponse cancelCharge( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `chargeId` | `String` | Template, Required | Charge id | -| `request` | [`CreateCancelChargeRequest`](../../doc/models/create-cancel-charge-request.md) | Body, Optional | Request for cancelling a charge | +| `chargeId` | `String` | Template, Required | - | +| `request` | [`CreateConfirmPaymentRequest`](../../doc/models/create-confirm-payment-request.md) | Body, Optional | Request for confirm payment | | `idempotencyKey` | `String` | Header, Optional | - | ## Response Type @@ -598,7 +598,7 @@ GetChargeResponse cancelCharge( String chargeId = "charge_id8"; try { - GetChargeResponse result = chargesController.cancelCharge(chargeId, null, null); + GetChargeResponse result = chargesController.confirmPayment(chargeId, null, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); diff --git a/doc/controllers/customers.md b/doc/controllers/customers.md index 7ad2353..f7fa9c1 100644 --- a/doc/controllers/customers.md +++ b/doc/controllers/customers.md @@ -10,37 +10,38 @@ CustomersController customersController = client.getCustomersController(); ## 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) -* [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) +* [Get Customers](../../doc/controllers/customers.md#get-customers) * [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) -* [Get Customer](../../doc/controllers/customers.md#get-customer) +* [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) -# Create Address +# Update Card -Creates a new address for a customer +Updates a card ```java -GetAddressResponse createAddress( +GetCardResponse updateCard( final String customerId, - final CreateAddressRequest request, + final String cardId, + final UpdateCardRequest request, final String idempotencyKey) ``` @@ -49,34 +50,46 @@ GetAddressResponse createAddress( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `customerId` | `String` | Template, Required | Customer Id | -| `request` | [`CreateAddressRequest`](../../doc/models/create-address-request.md) | Body, Required | Request for creating an address | +| `cardId` | `String` | Template, Required | Card id | +| `request` | [`UpdateCardRequest`](../../doc/models/update-card-request.md) | Body, Required | Request for updating a card | | `idempotencyKey` | `String` | Header, Optional | - | ## Response Type -[`GetAddressResponse`](../../doc/models/get-address-response.md) +[`GetCardResponse`](../../doc/models/get-card-response.md) ## Example Usage ```java String customerId = "customer_id8"; -CreateAddressRequest request = new CreateAddressRequest.Builder( - "street6", - "number4", - "zip_code0", - "neighborhood2", - "city6", - "state2", - "country0", - "complement2", - "line_10", - "line_24" +String cardId = "card_id4"; +UpdateCardRequest request = new UpdateCardRequest.Builder( + "holder_name2", + 10, + 30, + new CreateAddressRequest.Builder( + "street8", + "number4", + "zip_code2", + "neighborhood4", + "city2", + "state6", + "country2", + "complement6", + "line_18", + "line_26" + ) + .build(), + new LinkedHashMap() {{ + put("key0", "metadata3"); + }}, + "label6" ) .build(); try { - GetAddressResponse result = customersController.createAddress(customerId, request, null); + GetCardResponse result = customersController.updateCard(customerId, cardId, request, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -86,15 +99,15 @@ try { ``` -# Update Card +# Update Address -Updates a card +Updates an address ```java -GetCardResponse updateCard( +GetAddressResponse updateAddress( final String customerId, - final String cardId, - final UpdateCardRequest request, + final String addressId, + final UpdateAddressRequest request, final String idempotencyKey) ``` @@ -103,46 +116,32 @@ GetCardResponse updateCard( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `customerId` | `String` | Template, Required | Customer Id | -| `cardId` | `String` | Template, Required | Card id | -| `request` | [`UpdateCardRequest`](../../doc/models/update-card-request.md) | Body, Required | Request for updating a card | +| `addressId` | `String` | Template, Required | Address Id | +| `request` | [`UpdateAddressRequest`](../../doc/models/update-address-request.md) | Body, Required | Request for updating an address | | `idempotencyKey` | `String` | Header, Optional | - | ## Response Type -[`GetCardResponse`](../../doc/models/get-card-response.md) +[`GetAddressResponse`](../../doc/models/get-address-response.md) ## Example Usage ```java String customerId = "customer_id8"; -String cardId = "card_id4"; -UpdateCardRequest request = new UpdateCardRequest.Builder( - "holder_name2", - 10, - 30, - new CreateAddressRequest.Builder( - "street8", - "number4", - "zip_code2", - "neighborhood4", - "city2", - "state6", - "country2", - "complement6", - "line_18", - "line_26" - ) - .build(), +String addressId = "address_id0"; +UpdateAddressRequest request = new UpdateAddressRequest.Builder( + "number4", + "complement2", new LinkedHashMap() {{ put("key0", "metadata3"); }}, - "label6" + "line_24" ) .build(); try { - GetCardResponse result = customersController.updateCard(customerId, cardId, request, null); + GetAddressResponse result = customersController.updateAddress(customerId, addressId, request, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -217,7 +216,7 @@ GetCustomerResponse createCustomer( ```java CreateCustomerRequest request = new CreateCustomerRequest.Builder( - "{\n \"name\": \"Tony Stark\"\n}", + "Tony Stark", "email0", "document0", "type4", @@ -255,13 +254,15 @@ try { ``` -# Delete Access Tokens +# Create Address -Delete a Customer's access tokens +Creates a new address for a customer ```java -ListAccessTokensResponse deleteAccessTokens( - final String customerId) +GetAddressResponse createAddress( + final String customerId, + final CreateAddressRequest request, + final String idempotencyKey) ``` ## Parameters @@ -269,18 +270,34 @@ ListAccessTokensResponse deleteAccessTokens( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `customerId` | `String` | Template, Required | Customer Id | +| `request` | [`CreateAddressRequest`](../../doc/models/create-address-request.md) | Body, Required | Request for creating an address | +| `idempotencyKey` | `String` | Header, Optional | - | ## Response Type -[`ListAccessTokensResponse`](../../doc/models/list-access-tokens-response.md) +[`GetAddressResponse`](../../doc/models/get-address-response.md) ## Example Usage ```java String customerId = "customer_id8"; +CreateAddressRequest request = new CreateAddressRequest.Builder( + "street6", + "number4", + "zip_code0", + "neighborhood2", + "city6", + "state2", + "country0", + "complement2", + "line_10", + "line_24" +) +.build(); + try { - ListAccessTokensResponse result = customersController.deleteAccessTokens(customerId); + GetAddressResponse result = customersController.createAddress(customerId, request, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -290,16 +307,13 @@ try { ``` -# Update Address +# Delete Access Tokens -Updates an address +Delete a Customer's access tokens ```java -GetAddressResponse updateAddress( - final String customerId, - final String addressId, - final UpdateAddressRequest request, - final String idempotencyKey) +ListAccessTokensResponse deleteAccessTokens( + final String customerId) ``` ## Parameters @@ -307,32 +321,18 @@ GetAddressResponse updateAddress( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `customerId` | `String` | Template, Required | Customer Id | -| `addressId` | `String` | Template, Required | Address Id | -| `request` | [`UpdateAddressRequest`](../../doc/models/update-address-request.md) | Body, Required | Request for updating an address | -| `idempotencyKey` | `String` | Header, Optional | - | ## Response Type -[`GetAddressResponse`](../../doc/models/get-address-response.md) +[`ListAccessTokensResponse`](../../doc/models/list-access-tokens-response.md) ## Example Usage ```java String customerId = "customer_id8"; -String addressId = "address_id0"; -UpdateAddressRequest request = new UpdateAddressRequest.Builder( - "number4", - "complement2", - new LinkedHashMap() {{ - put("key0", "metadata3"); - }}, - "line_24" -) -.build(); - try { - GetAddressResponse result = customersController.updateAddress(customerId, addressId, request, null); + ListAccessTokensResponse result = customersController.deleteAccessTokens(customerId); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -420,43 +420,40 @@ try { ``` -# Get Customers +# Create Card -Get all Customers +Creates a new card for a customer ```java -ListCustomersResponse getCustomers( - final String name, - final String document, - final Integer page, - final Integer size, - final String email, - final String code) +GetCardResponse createCard( + final String customerId, + final CreateCardRequest request, + final String idempotencyKey) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `name` | `String` | Query, Optional | Name of the Customer | -| `document` | `String` | Query, Optional | Document of the Customer | -| `page` | `Integer` | Query, Optional | Current page the the search | -| `size` | `Integer` | Query, Optional | Quantity pages of the search | -| `email` | `String` | Query, Optional | Customer's email | -| `code` | `String` | Query, Optional | Customer's code | +| `customerId` | `String` | Template, Required | Customer id | +| `request` | [`CreateCardRequest`](../../doc/models/create-card-request.md) | Body, Required | Request for creating a card | +| `idempotencyKey` | `String` | Header, Optional | - | ## Response Type -[`ListCustomersResponse`](../../doc/models/list-customers-response.md) +[`GetCardResponse`](../../doc/models/get-card-response.md) ## Example Usage ```java -Integer page = 1; -Integer size = 10; +String customerId = "customer_id8"; +CreateCardRequest request = new CreateCardRequest.Builder() + .type("credit") + .build(); + try { - ListCustomersResponse result = customersController.getCustomers(null, null, page, size, null, null); + GetCardResponse result = customersController.createCard(customerId, request, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -466,36 +463,43 @@ try { ``` -# Get Access Tokens +# Get Customers -Get all access tokens from a customer +Get all Customers ```java -ListAccessTokensResponse getAccessTokens( - final String customerId, +ListCustomersResponse getCustomers( + final String name, + final String document, final Integer page, - final Integer size) + final Integer size, + final String email, + final String code) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `customerId` | `String` | Template, Required | Customer Id | -| `page` | `Integer` | Query, Optional | Page number | -| `size` | `Integer` | Query, Optional | Page size | +| `name` | `String` | Query, Optional | Name of the Customer | +| `document` | `String` | Query, Optional | Document of the Customer | +| `page` | `Integer` | Query, Optional | Current page the the search | +| `size` | `Integer` | Query, Optional | Quantity pages of the search | +| `email` | `String` | Query, Optional | Customer's email | +| `code` | `String` | Query, Optional | Customer's code | ## Response Type -[`ListAccessTokensResponse`](../../doc/models/list-access-tokens-response.md) +[`ListCustomersResponse`](../../doc/models/list-customers-response.md) ## Example Usage ```java -String customerId = "customer_id8"; +Integer page = 1; +Integer size = 10; try { - ListAccessTokensResponse result = customersController.getAccessTokens(customerId, null, null); + ListCustomersResponse result = customersController.getCustomers(null, null, page, size, null, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -505,14 +509,14 @@ try { ``` -# Delete Card +# Update Customer -Delete a customer's card +Updates a customer ```java -GetCardResponse deleteCard( +GetCustomerResponse updateCustomer( final String customerId, - final String cardId, + final UpdateCustomerRequest request, final String idempotencyKey) ``` @@ -520,22 +524,24 @@ GetCardResponse deleteCard( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `customerId` | `String` | Template, Required | Customer Id | -| `cardId` | `String` | Template, Required | Card Id | +| `customerId` | `String` | Template, Required | Customer id | +| `request` | [`UpdateCustomerRequest`](../../doc/models/update-customer-request.md) | Body, Required | Request for updating a customer | | `idempotencyKey` | `String` | Header, Optional | - | ## Response Type -[`GetCardResponse`](../../doc/models/get-card-response.md) +[`GetCustomerResponse`](../../doc/models/get-customer-response.md) ## Example Usage ```java String customerId = "customer_id8"; -String cardId = "card_id4"; +UpdateCustomerRequest request = new UpdateCustomerRequest.Builder() + .build(); + try { - GetCardResponse result = customersController.deleteCard(customerId, cardId, null); + GetCustomerResponse result = customersController.updateCustomer(customerId, request, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -545,35 +551,39 @@ try { ``` -# Get Card +# Create Access Token -Get a customer's card +Creates a access token for a customer ```java -GetCardResponse getCard( +GetAccessTokenResponse createAccessToken( final String customerId, - final String cardId) + final CreateAccessTokenRequest request, + final String idempotencyKey) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `customerId` | `String` | Template, Required | Customer id | -| `cardId` | `String` | Template, Required | Card id | +| `customerId` | `String` | Template, Required | Customer Id | +| `request` | [`CreateAccessTokenRequest`](../../doc/models/create-access-token-request.md) | Body, Required | Request for creating a access token | +| `idempotencyKey` | `String` | Header, Optional | - | ## Response Type -[`GetCardResponse`](../../doc/models/get-card-response.md) +[`GetAccessTokenResponse`](../../doc/models/get-access-token-response.md) ## Example Usage ```java String customerId = "customer_id8"; -String cardId = "card_id4"; +CreateAccessTokenRequest request = new CreateAccessTokenRequest.Builder() + .build(); + try { - GetCardResponse result = customersController.getCard(customerId, cardId); + GetAccessTokenResponse result = customersController.createAccessToken(customerId, request, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -583,40 +593,36 @@ try { ``` -# Create Card +# Get Access Tokens -Creates a new card for a customer +Get all access tokens from a customer ```java -GetCardResponse createCard( +ListAccessTokensResponse getAccessTokens( final String customerId, - final CreateCardRequest request, - final String idempotencyKey) + final Integer page, + final Integer size) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `customerId` | `String` | Template, Required | Customer id | -| `request` | [`CreateCardRequest`](../../doc/models/create-card-request.md) | Body, Required | Request for creating a card | -| `idempotencyKey` | `String` | Header, Optional | - | +| `customerId` | `String` | Template, Required | Customer Id | +| `page` | `Integer` | Query, Optional | Page number | +| `size` | `Integer` | Query, Optional | Page size | ## Response Type -[`GetCardResponse`](../../doc/models/get-card-response.md) +[`ListAccessTokensResponse`](../../doc/models/list-access-tokens-response.md) ## Example Usage ```java String customerId = "customer_id8"; -CreateCardRequest request = new CreateCardRequest.Builder() - .type("credit") - .build(); - try { - GetCardResponse result = customersController.createCard(customerId, request, null); + ListAccessTokensResponse result = customersController.getAccessTokens(customerId, null, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -626,14 +632,15 @@ try { ``` -# Get Access Token +# Get Cards -Get a Customer's access token +Get all cards from a customer ```java -GetAccessTokenResponse getAccessToken( +ListCardsResponse getCards( final String customerId, - final String tokenId) + final Integer page, + final Integer size) ``` ## Parameters @@ -641,20 +648,20 @@ GetAccessTokenResponse getAccessToken( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `customerId` | `String` | Template, Required | Customer Id | -| `tokenId` | `String` | Template, Required | Token Id | +| `page` | `Integer` | Query, Optional | Page number | +| `size` | `Integer` | Query, Optional | Page size | ## Response Type -[`GetAccessTokenResponse`](../../doc/models/get-access-token-response.md) +[`ListCardsResponse`](../../doc/models/list-cards-response.md) ## Example Usage ```java String customerId = "customer_id8"; -String tokenId = "token_id6"; try { - GetAccessTokenResponse result = customersController.getAccessToken(customerId, tokenId); + ListCardsResponse result = customersController.getCards(customerId, null, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -664,15 +671,15 @@ try { ``` -# Get Addresses +# Renew Card -Gets all adressess from a customer +Renew a card ```java -ListAddressesResponse getAddresses( +GetCardResponse renewCard( final String customerId, - final Integer page, - final Integer size) + final String cardId, + final String idempotencyKey) ``` ## Parameters @@ -680,20 +687,21 @@ ListAddressesResponse getAddresses( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `customerId` | `String` | Template, Required | Customer id | -| `page` | `Integer` | Query, Optional | Page number | -| `size` | `Integer` | Query, Optional | Page size | +| `cardId` | `String` | Template, Required | Card Id | +| `idempotencyKey` | `String` | Header, Optional | - | ## Response Type -[`ListAddressesResponse`](../../doc/models/list-addresses-response.md) +[`GetCardResponse`](../../doc/models/get-card-response.md) ## Example Usage ```java String customerId = "customer_id8"; +String cardId = "card_id4"; try { - ListAddressesResponse result = customersController.getAddresses(customerId, null, null); + GetCardResponse result = customersController.renewCard(customerId, cardId, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -703,39 +711,35 @@ try { ``` -# Update Customer +# Get Access Token -Updates a customer +Get a Customer's access token ```java -GetCustomerResponse updateCustomer( +GetAccessTokenResponse getAccessToken( final String customerId, - final UpdateCustomerRequest request, - final String idempotencyKey) + final String tokenId) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `customerId` | `String` | Template, Required | Customer id | -| `request` | [`UpdateCustomerRequest`](../../doc/models/update-customer-request.md) | Body, Required | Request for updating a customer | -| `idempotencyKey` | `String` | Header, Optional | - | +| `customerId` | `String` | Template, Required | Customer Id | +| `tokenId` | `String` | Template, Required | Token Id | ## Response Type -[`GetCustomerResponse`](../../doc/models/get-customer-response.md) +[`GetAccessTokenResponse`](../../doc/models/get-access-token-response.md) ## Example Usage ```java String customerId = "customer_id8"; -UpdateCustomerRequest request = new UpdateCustomerRequest.Builder() - .build(); - +String tokenId = "token_id6"; try { - GetCustomerResponse result = customersController.updateCustomer(customerId, request, null); + GetAccessTokenResponse result = customersController.getAccessToken(customerId, tokenId); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -745,14 +749,14 @@ try { ``` -# Create Access Token +# Update Customer Metadata -Creates a access token for a customer +Updates the metadata a customer ```java -GetAccessTokenResponse createAccessToken( +GetCustomerResponse updateCustomerMetadata( final String customerId, - final CreateAccessTokenRequest request, + final UpdateMetadataRequest request, final String idempotencyKey) ``` @@ -760,24 +764,28 @@ GetAccessTokenResponse createAccessToken( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `customerId` | `String` | Template, Required | Customer Id | -| `request` | [`CreateAccessTokenRequest`](../../doc/models/create-access-token-request.md) | Body, Required | Request for creating a access token | +| `customerId` | `String` | Template, Required | The customer id | +| `request` | [`UpdateMetadataRequest`](../../doc/models/update-metadata-request.md) | Body, Required | Request for updating the customer metadata | | `idempotencyKey` | `String` | Header, Optional | - | ## Response Type -[`GetAccessTokenResponse`](../../doc/models/get-access-token-response.md) +[`GetCustomerResponse`](../../doc/models/get-customer-response.md) ## Example Usage ```java String customerId = "customer_id8"; -CreateAccessTokenRequest request = new CreateAccessTokenRequest.Builder() - .build(); +UpdateMetadataRequest request = new UpdateMetadataRequest.Builder( + new LinkedHashMap() {{ + put("key0", "metadata3"); + }} +) +.build(); try { - GetAccessTokenResponse result = customersController.createAccessToken(customerId, request, null); + GetCustomerResponse result = customersController.updateCustomerMetadata(customerId, request, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -787,15 +795,15 @@ try { ``` -# Get Cards +# Delete Card -Get all cards from a customer +Delete a customer's card ```java -ListCardsResponse getCards( +GetCardResponse deleteCard( final String customerId, - final Integer page, - final Integer size) + final String cardId, + final String idempotencyKey) ``` ## Parameters @@ -803,20 +811,21 @@ ListCardsResponse getCards( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `customerId` | `String` | Template, Required | Customer Id | -| `page` | `Integer` | Query, Optional | Page number | -| `size` | `Integer` | Query, Optional | Page size | +| `cardId` | `String` | Template, Required | Card Id | +| `idempotencyKey` | `String` | Header, Optional | - | ## Response Type -[`ListCardsResponse`](../../doc/models/list-cards-response.md) +[`GetCardResponse`](../../doc/models/get-card-response.md) ## Example Usage ```java String customerId = "customer_id8"; +String cardId = "card_id4"; try { - ListCardsResponse result = customersController.getCards(customerId, null, null); + GetCardResponse result = customersController.deleteCard(customerId, cardId, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -826,15 +835,15 @@ try { ``` -# Renew Card +# Get Addresses -Renew a card +Gets all adressess from a customer ```java -GetCardResponse renewCard( +ListAddressesResponse getAddresses( final String customerId, - final String cardId, - final String idempotencyKey) + final Integer page, + final Integer size) ``` ## Parameters @@ -842,21 +851,20 @@ GetCardResponse renewCard( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `customerId` | `String` | Template, Required | Customer id | -| `cardId` | `String` | Template, Required | Card Id | -| `idempotencyKey` | `String` | Header, Optional | - | +| `page` | `Integer` | Query, Optional | Page number | +| `size` | `Integer` | Query, Optional | Page size | ## Response Type -[`GetCardResponse`](../../doc/models/get-card-response.md) +[`ListAddressesResponse`](../../doc/models/list-addresses-response.md) ## Example Usage ```java String customerId = "customer_id8"; -String cardId = "card_id4"; try { - GetCardResponse result = customersController.renewCard(customerId, cardId, null); + ListAddressesResponse result = customersController.getAddresses(customerId, null, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -866,24 +874,20 @@ try { ``` -# Update Customer Metadata +# Get Customer -Updates the metadata a customer +Get a customer ```java -GetCustomerResponse updateCustomerMetadata( - final String customerId, - final UpdateMetadataRequest request, - final String idempotencyKey) +GetCustomerResponse getCustomer( + final String customerId) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `customerId` | `String` | Template, Required | The customer id | -| `request` | [`UpdateMetadataRequest`](../../doc/models/update-metadata-request.md) | Body, Required | Request for updating the customer metadata | -| `idempotencyKey` | `String` | Header, Optional | - | +| `customerId` | `String` | Template, Required | Customer Id | ## Response Type @@ -893,16 +897,9 @@ GetCustomerResponse updateCustomerMetadata( ```java String customerId = "customer_id8"; -UpdateMetadataRequest request = new UpdateMetadataRequest.Builder( - new LinkedHashMap() {{ - put("key0", "metadata3"); - }} -) -.build(); - try { - GetCustomerResponse result = customersController.updateCustomerMetadata(customerId, request, null); + GetCustomerResponse result = customersController.getCustomer(customerId); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -912,32 +909,35 @@ try { ``` -# Get Customer +# Get Card -Get a customer +Get a customer's card ```java -GetCustomerResponse getCustomer( - final String customerId) +GetCardResponse getCard( + final String customerId, + final String cardId) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `customerId` | `String` | Template, Required | Customer Id | +| `customerId` | `String` | Template, Required | Customer id | +| `cardId` | `String` | Template, Required | Card id | ## Response Type -[`GetCustomerResponse`](../../doc/models/get-customer-response.md) +[`GetCardResponse`](../../doc/models/get-card-response.md) ## Example Usage ```java String customerId = "customer_id8"; +String cardId = "card_id4"; try { - GetCustomerResponse result = customersController.getCustomer(customerId); + GetCardResponse result = customersController.getCard(customerId, cardId); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); diff --git a/doc/controllers/invoices.md b/doc/controllers/invoices.md index 3984739..699cf43 100644 --- a/doc/controllers/invoices.md +++ b/doc/controllers/invoices.md @@ -10,59 +10,52 @@ InvoicesController invoicesController = client.getInvoicesController(); ## 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 Invoice](../../doc/controllers/invoices.md#get-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 Invoices +# Update Invoice Metadata -Gets all invoices +Updates the metadata from an invoice ```java -ListInvoicesResponse getInvoices( - final Integer page, - final Integer size, - final String code, - final String customerId, - final String subscriptionId, - final LocalDateTime createdSince, - final LocalDateTime createdUntil, - final String status, - final LocalDateTime dueSince, - final LocalDateTime dueUntil, - final String customerDocument) +GetInvoiceResponse updateInvoiceMetadata( + final String invoiceId, + final UpdateMetadataRequest request, + final String idempotencyKey) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `page` | `Integer` | Query, Optional | Page number | -| `size` | `Integer` | Query, Optional | Page size | -| `code` | `String` | Query, Optional | Filter for Invoice's code | -| `customerId` | `String` | Query, Optional | Filter for Invoice's customer id | -| `subscriptionId` | `String` | Query, Optional | Filter for Invoice's subscription id | -| `createdSince` | `LocalDateTime` | Query, Optional | Filter for Invoice's creation date start range | -| `createdUntil` | `LocalDateTime` | Query, Optional | Filter for Invoices creation date end range | -| `status` | `String` | Query, Optional | Filter for Invoice's status | -| `dueSince` | `LocalDateTime` | Query, Optional | Filter for Invoice's due date start range | -| `dueUntil` | `LocalDateTime` | Query, Optional | Filter for Invoice's due date end range | -| `customerDocument` | `String` | Query, Optional | - | +| `invoiceId` | `String` | Template, Required | The invoice id | +| `request` | [`UpdateMetadataRequest`](../../doc/models/update-metadata-request.md) | Body, Required | Request for updating the invoice metadata | +| `idempotencyKey` | `String` | Header, Optional | - | ## Response Type -[`ListInvoicesResponse`](../../doc/models/list-invoices-response.md) +[`GetInvoiceResponse`](../../doc/models/get-invoice-response.md) ## Example Usage ```java +String invoiceId = "invoice_id0"; +UpdateMetadataRequest request = new UpdateMetadataRequest.Builder( + new LinkedHashMap() {{ + put("key0", "metadata3"); + }} +) +.build(); + + try { - ListInvoicesResponse result = invoicesController.getInvoices(null, null, null, null, null, null, null, null, null, null, null); + GetInvoiceResponse result = invoicesController.updateInvoiceMetadata(invoiceId, request, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -72,22 +65,18 @@ try { ``` -# Cancel Invoice - -Cancels an invoice +# Get Partial Invoice ```java -GetInvoiceResponse cancelInvoice( - final String invoiceId, - final String idempotencyKey) +GetInvoiceResponse getPartialInvoice( + final String subscriptionId) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `invoiceId` | `String` | Template, Required | Invoice id | -| `idempotencyKey` | `String` | Header, Optional | - | +| `subscriptionId` | `String` | Template, Required | Subscription Id | ## Response Type @@ -96,10 +85,10 @@ GetInvoiceResponse cancelInvoice( ## Example Usage ```java -String invoiceId = "invoice_id0"; +String subscriptionId = "subscription_id0"; try { - GetInvoiceResponse result = invoicesController.cancelInvoice(invoiceId, null); + GetInvoiceResponse result = invoicesController.getPartialInvoice(subscriptionId); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -109,14 +98,13 @@ try { ``` -# Update Invoice Status +# Cancel Invoice -Updates the status from an invoice +Cancels an invoice ```java -GetInvoiceResponse updateInvoiceStatus( +GetInvoiceResponse cancelInvoice( final String invoiceId, - final UpdateInvoiceStatusRequest request, final String idempotencyKey) ``` @@ -124,8 +112,7 @@ GetInvoiceResponse updateInvoiceStatus( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `invoiceId` | `String` | Template, Required | Invoice Id | -| `request` | [`UpdateInvoiceStatusRequest`](../../doc/models/update-invoice-status-request.md) | Body, Required | Request for updating an invoice's status | +| `invoiceId` | `String` | Template, Required | Invoice id | | `idempotencyKey` | `String` | Header, Optional | - | ## Response Type @@ -136,14 +123,9 @@ GetInvoiceResponse updateInvoiceStatus( ```java String invoiceId = "invoice_id0"; -UpdateInvoiceStatusRequest request = new UpdateInvoiceStatusRequest.Builder( - "status8" -) -.build(); - try { - GetInvoiceResponse result = invoicesController.updateInvoiceStatus(invoiceId, request, null); + GetInvoiceResponse result = invoicesController.cancelInvoice(invoiceId, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -153,14 +135,15 @@ try { ``` -# Update Invoice Metadata +# Create Invoice -Updates the metadata from an invoice +Create an Invoice ```java -GetInvoiceResponse updateInvoiceMetadata( - final String invoiceId, - final UpdateMetadataRequest request, +GetInvoiceResponse createInvoice( + final String subscriptionId, + final String cycleId, + final CreateInvoiceRequest request, final String idempotencyKey) ``` @@ -168,8 +151,9 @@ GetInvoiceResponse updateInvoiceMetadata( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `invoiceId` | `String` | Template, Required | The invoice id | -| `request` | [`UpdateMetadataRequest`](../../doc/models/update-metadata-request.md) | Body, Required | Request for updating the invoice metadata | +| `subscriptionId` | `String` | Template, Required | Subscription Id | +| `cycleId` | `String` | Template, Required | Cycle Id | +| `request` | [`CreateInvoiceRequest`](../../doc/models/create-invoice-request.md) | Body, Optional | - | | `idempotencyKey` | `String` | Header, Optional | - | ## Response Type @@ -179,17 +163,11 @@ GetInvoiceResponse updateInvoiceMetadata( ## Example Usage ```java -String invoiceId = "invoice_id0"; -UpdateMetadataRequest request = new UpdateMetadataRequest.Builder( - new LinkedHashMap() {{ - put("key0", "metadata3"); - }} -) -.build(); - +String subscriptionId = "subscription_id0"; +String cycleId = "cycle_id6"; try { - GetInvoiceResponse result = invoicesController.updateInvoiceMetadata(invoiceId, request, null); + GetInvoiceResponse result = invoicesController.createInvoice(subscriptionId, cycleId, null, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -199,30 +177,50 @@ try { ``` -# Get Partial Invoice +# Get Invoices + +Gets all invoices ```java -GetInvoiceResponse getPartialInvoice( - final String subscriptionId) +ListInvoicesResponse getInvoices( + final Integer page, + final Integer size, + final String code, + final String customerId, + final String subscriptionId, + final LocalDateTime createdSince, + final LocalDateTime createdUntil, + final String status, + final LocalDateTime dueSince, + final LocalDateTime dueUntil, + final String customerDocument) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `String` | Template, Required | Subscription Id | +| `page` | `Integer` | Query, Optional | Page number | +| `size` | `Integer` | Query, Optional | Page size | +| `code` | `String` | Query, Optional | Filter for Invoice's code | +| `customerId` | `String` | Query, Optional | Filter for Invoice's customer id | +| `subscriptionId` | `String` | Query, Optional | Filter for Invoice's subscription id | +| `createdSince` | `LocalDateTime` | Query, Optional | Filter for Invoice's creation date start range | +| `createdUntil` | `LocalDateTime` | Query, Optional | Filter for Invoices creation date end range | +| `status` | `String` | Query, Optional | Filter for Invoice's status | +| `dueSince` | `LocalDateTime` | Query, Optional | Filter for Invoice's due date start range | +| `dueUntil` | `LocalDateTime` | Query, Optional | Filter for Invoice's due date end range | +| `customerDocument` | `String` | Query, Optional | - | ## Response Type -[`GetInvoiceResponse`](../../doc/models/get-invoice-response.md) +[`ListInvoicesResponse`](../../doc/models/list-invoices-response.md) ## Example Usage ```java -String subscriptionId = "subscription_id0"; - try { - GetInvoiceResponse result = invoicesController.getPartialInvoice(subscriptionId); + ListInvoicesResponse result = invoicesController.getInvoices(null, null, null, null, null, null, null, null, null, null, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -232,26 +230,20 @@ try { ``` -# Create Invoice +# Get Invoice -Create an Invoice +Gets an invoice ```java -GetInvoiceResponse createInvoice( - final String subscriptionId, - final String cycleId, - final CreateInvoiceRequest request, - final String idempotencyKey) +GetInvoiceResponse getInvoice( + final String invoiceId) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `String` | Template, Required | Subscription Id | -| `cycleId` | `String` | Template, Required | Cycle Id | -| `request` | [`CreateInvoiceRequest`](../../doc/models/create-invoice-request.md) | Body, Optional | - | -| `idempotencyKey` | `String` | Header, Optional | - | +| `invoiceId` | `String` | Template, Required | Invoice Id | ## Response Type @@ -260,11 +252,10 @@ GetInvoiceResponse createInvoice( ## Example Usage ```java -String subscriptionId = "subscription_id0"; -String cycleId = "cycle_id6"; +String invoiceId = "invoice_id0"; try { - GetInvoiceResponse result = invoicesController.createInvoice(subscriptionId, cycleId, null, null); + GetInvoiceResponse result = invoicesController.getInvoice(invoiceId); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -274,13 +265,15 @@ try { ``` -# Get Invoice +# Update Invoice Status -Gets an invoice +Updates the status from an invoice ```java -GetInvoiceResponse getInvoice( - final String invoiceId) +GetInvoiceResponse updateInvoiceStatus( + final String invoiceId, + final UpdateInvoiceStatusRequest request, + final String idempotencyKey) ``` ## Parameters @@ -288,6 +281,8 @@ GetInvoiceResponse getInvoice( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `invoiceId` | `String` | Template, Required | Invoice Id | +| `request` | [`UpdateInvoiceStatusRequest`](../../doc/models/update-invoice-status-request.md) | Body, Required | Request for updating an invoice's status | +| `idempotencyKey` | `String` | Header, Optional | - | ## Response Type @@ -297,9 +292,14 @@ GetInvoiceResponse getInvoice( ```java String invoiceId = "invoice_id0"; +UpdateInvoiceStatusRequest request = new UpdateInvoiceStatusRequest.Builder( + "status8" +) +.build(); + try { - GetInvoiceResponse result = invoicesController.getInvoice(invoiceId); + GetInvoiceResponse result = invoicesController.updateInvoiceStatus(invoiceId, request, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); diff --git a/doc/controllers/orders.md b/doc/controllers/orders.md index 1023d99..bdb961e 100644 --- a/doc/controllers/orders.md +++ b/doc/controllers/orders.md @@ -10,44 +10,54 @@ OrdersController ordersController = client.getOrdersController(); ## Methods -* [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) +* [Delete All Order Items](../../doc/controllers/orders.md#delete-all-order-items) +* [Delete Order Item](../../doc/controllers/orders.md#delete-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) +* [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) -# Delete All Order Items +# Get Orders + +Gets all orders ```java -GetOrderResponse deleteAllOrderItems( - final String orderId, - final String idempotencyKey) +ListOrderResponse getOrders( + final Integer page, + final Integer size, + final String code, + final String status, + final LocalDateTime createdSince, + final LocalDateTime createdUntil, + final String customerId) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `orderId` | `String` | Template, Required | Order Id | -| `idempotencyKey` | `String` | Header, Optional | - | +| `page` | `Integer` | Query, Optional | Page number | +| `size` | `Integer` | Query, Optional | Page size | +| `code` | `String` | Query, Optional | Filter for order's code | +| `status` | `String` | Query, Optional | Filter for order's status | +| `createdSince` | `LocalDateTime` | Query, Optional | Filter for order's creation date start range | +| `createdUntil` | `LocalDateTime` | Query, Optional | Filter for order's creation date end range | +| `customerId` | `String` | Query, Optional | Filter for order's customer id | ## Response Type -[`GetOrderResponse`](../../doc/models/get-order-response.md) +[`ListOrderResponse`](../../doc/models/list-order-response.md) ## Example Usage ```java -String orderId = "orderId2"; - try { - GetOrderResponse result = ordersController.deleteAllOrderItems(orderId, null); + ListOrderResponse result = ordersController.getOrders(null, null, null, null, null, null, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -57,12 +67,14 @@ try { ``` -# Get Order Item +# Update Order Item ```java -GetOrderItemResponse getOrderItem( +GetOrderItemResponse updateOrderItem( final String orderId, - final String itemId) + final String itemId, + final UpdateOrderItemRequest request, + final String idempotencyKey) ``` ## Parameters @@ -71,6 +83,8 @@ GetOrderItemResponse getOrderItem( | --- | --- | --- | --- | | `orderId` | `String` | Template, Required | Order Id | | `itemId` | `String` | Template, Required | Item Id | +| `request` | [`UpdateOrderItemRequest`](../../doc/models/update-order-item-request.md) | Body, Required | Item Model | +| `idempotencyKey` | `String` | Header, Optional | - | ## Response Type @@ -81,9 +95,17 @@ GetOrderItemResponse getOrderItem( ```java String orderId = "orderId2"; String itemId = "itemId8"; +UpdateOrderItemRequest request = new UpdateOrderItemRequest.Builder( + 242, + "description6", + 100, + "category4" +) +.build(); + try { - GetOrderItemResponse result = ordersController.getOrderItem(orderId, itemId); + GetOrderItemResponse result = ordersController.updateOrderItem(orderId, itemId, request, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -93,14 +115,11 @@ try { ``` -# Update Order Metadata - -Updates the metadata from an order +# Delete All Order Items ```java -GetOrderResponse updateOrderMetadata( +GetOrderResponse deleteAllOrderItems( final String orderId, - final UpdateMetadataRequest request, final String idempotencyKey) ``` @@ -108,8 +127,7 @@ GetOrderResponse updateOrderMetadata( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `orderId` | `String` | Template, Required | The order id | -| `request` | [`UpdateMetadataRequest`](../../doc/models/update-metadata-request.md) | Body, Required | Request for updating the order metadata | +| `orderId` | `String` | Template, Required | Order Id | | `idempotencyKey` | `String` | Header, Optional | - | ## Response Type @@ -119,17 +137,10 @@ GetOrderResponse updateOrderMetadata( ## Example Usage ```java -String orderId = "order_id6"; -UpdateMetadataRequest request = new UpdateMetadataRequest.Builder( - new LinkedHashMap() {{ - put("key0", "metadata3"); - }} -) -.build(); - +String orderId = "orderId2"; try { - GetOrderResponse result = ordersController.updateOrderMetadata(orderId, request, null); + GetOrderResponse result = ordersController.deleteAllOrderItems(orderId, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -177,20 +188,22 @@ try { ``` -# Get Order - -Gets an order +# Close Order ```java -GetOrderResponse getOrder( - final String orderId) +GetOrderResponse closeOrder( + final String id, + final UpdateOrderStatusRequest request, + final String idempotencyKey) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `orderId` | `String` | Template, Required | Order id | +| `id` | `String` | Template, Required | Order Id | +| `request` | [`UpdateOrderStatusRequest`](../../doc/models/update-order-status-request.md) | Body, Required | Update Order Model | +| `idempotencyKey` | `String` | Header, Optional | - | ## Response Type @@ -199,10 +212,15 @@ GetOrderResponse getOrder( ## Example Usage ```java -String orderId = "order_id6"; +String id = "id0"; +UpdateOrderStatusRequest request = new UpdateOrderStatusRequest.Builder( + "status8" +) +.build(); + try { - GetOrderResponse result = ordersController.getOrder(orderId); + GetOrderResponse result = ordersController.closeOrder(id, request, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -212,42 +230,80 @@ try { ``` -# Get Orders +# Create Order -Gets all orders +Creates a new Order ```java -ListOrderResponse getOrders( - final Integer page, - final Integer size, - final String code, - final String status, - final LocalDateTime createdSince, - final LocalDateTime createdUntil, - final String customerId) +GetOrderResponse createOrder( + final CreateOrderRequest body, + final String idempotencyKey) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `page` | `Integer` | Query, Optional | Page number | -| `size` | `Integer` | Query, Optional | Page size | -| `code` | `String` | Query, Optional | Filter for order's code | -| `status` | `String` | Query, Optional | Filter for order's status | -| `createdSince` | `LocalDateTime` | Query, Optional | Filter for order's creation date start range | -| `createdUntil` | `LocalDateTime` | Query, Optional | Filter for order's creation date end range | -| `customerId` | `String` | Query, Optional | Filter for order's customer id | +| `body` | [`CreateOrderRequest`](../../doc/models/create-order-request.md) | Body, Required | Request for creating an order | +| `idempotencyKey` | `String` | Header, Optional | - | ## Response Type -[`ListOrderResponse`](../../doc/models/list-order-response.md) +[`GetOrderResponse`](../../doc/models/get-order-response.md) ## Example Usage ```java +CreateOrderRequest body = new CreateOrderRequest.Builder( + Arrays.asList( + new CreateOrderItemRequest.Builder( + 164, + "description2", + 22, + "category6" + ) + .build() + ), + new CreateCustomerRequest.Builder( + "Tony Stark", + "email6", + "document6", + "type0", + new CreateAddressRequest.Builder( + "street6", + "number4", + "zip_code0", + "neighborhood2", + "city6", + "state2", + "country0", + "complement2", + "line_10", + "line_24" + ) + .build(), + new LinkedHashMap() {{ + put("key0", "metadata3"); + }}, + new CreatePhonesRequest.Builder() + .build(), + "code8" + ) + .build(), + Arrays.asList( + new CreatePaymentRequest.Builder( + "payment_method8" + ) + .build() + ), + "code4", + true +) +.build(); + + try { - ListOrderResponse result = ordersController.getOrders(null, null, null, null, null, null, null); + GetOrderResponse result = ordersController.createOrder(body, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -257,13 +313,12 @@ try { ``` -# Update Order Item +# Create Order Item ```java -GetOrderItemResponse updateOrderItem( +GetOrderItemResponse createOrderItem( final String orderId, - final String itemId, - final UpdateOrderItemRequest request, + final CreateOrderItemRequest request, final String idempotencyKey) ``` @@ -272,8 +327,7 @@ GetOrderItemResponse updateOrderItem( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `orderId` | `String` | Template, Required | Order Id | -| `itemId` | `String` | Template, Required | Item Id | -| `request` | [`UpdateOrderItemRequest`](../../doc/models/update-order-item-request.md) | Body, Required | Item Model | +| `request` | [`CreateOrderItemRequest`](../../doc/models/create-order-item-request.md) | Body, Required | Order Item Model | | `idempotencyKey` | `String` | Header, Optional | - | ## Response Type @@ -284,8 +338,7 @@ GetOrderItemResponse updateOrderItem( ```java String orderId = "orderId2"; -String itemId = "itemId8"; -UpdateOrderItemRequest request = new UpdateOrderItemRequest.Builder( +CreateOrderItemRequest request = new CreateOrderItemRequest.Builder( 242, "description6", 100, @@ -295,7 +348,7 @@ UpdateOrderItemRequest request = new UpdateOrderItemRequest.Builder( try { - GetOrderItemResponse result = ordersController.updateOrderItem(orderId, itemId, request, null); + GetOrderItemResponse result = ordersController.createOrderItem(orderId, request, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -305,39 +358,33 @@ try { ``` -# Close Order +# Get Order Item ```java -GetOrderResponse closeOrder( - final String id, - final UpdateOrderStatusRequest request, - final String idempotencyKey) +GetOrderItemResponse getOrderItem( + final String orderId, + final String itemId) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `id` | `String` | Template, Required | Order Id | -| `request` | [`UpdateOrderStatusRequest`](../../doc/models/update-order-status-request.md) | Body, Required | Update Order Model | -| `idempotencyKey` | `String` | Header, Optional | - | +| `orderId` | `String` | Template, Required | Order Id | +| `itemId` | `String` | Template, Required | Item Id | ## Response Type -[`GetOrderResponse`](../../doc/models/get-order-response.md) +[`GetOrderItemResponse`](../../doc/models/get-order-item-response.md) ## Example Usage ```java -String id = "id0"; -UpdateOrderStatusRequest request = new UpdateOrderStatusRequest.Builder( - "status8" -) -.build(); - +String orderId = "orderId2"; +String itemId = "itemId8"; try { - GetOrderResponse result = ordersController.closeOrder(id, request, null); + GetOrderItemResponse result = ordersController.getOrderItem(orderId, itemId); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -347,13 +394,14 @@ try { ``` -# Create Order +# Update Order Metadata -Creates a new Order +Updates the metadata from an order ```java -GetOrderResponse createOrder( - final CreateOrderRequest body, +GetOrderResponse updateOrderMetadata( + final String orderId, + final UpdateMetadataRequest request, final String idempotencyKey) ``` @@ -361,7 +409,8 @@ GetOrderResponse createOrder( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `body` | [`CreateOrderRequest`](../../doc/models/create-order-request.md) | Body, Required | Request for creating an order | +| `orderId` | `String` | Template, Required | The order id | +| `request` | [`UpdateMetadataRequest`](../../doc/models/update-metadata-request.md) | Body, Required | Request for updating the order metadata | | `idempotencyKey` | `String` | Header, Optional | - | ## Response Type @@ -371,56 +420,17 @@ GetOrderResponse createOrder( ## Example Usage ```java -CreateOrderRequest body = new CreateOrderRequest.Builder( - Arrays.asList( - new CreateOrderItemRequest.Builder( - 164, - "description2", - 22, - "category6" - ) - .build() - ), - new CreateCustomerRequest.Builder( - "{\n \"name\": \"Tony Stark\"\n}", - "email6", - "document6", - "type0", - new CreateAddressRequest.Builder( - "street6", - "number4", - "zip_code0", - "neighborhood2", - "city6", - "state2", - "country0", - "complement2", - "line_10", - "line_24" - ) - .build(), - new LinkedHashMap() {{ - put("key0", "metadata3"); - }}, - new CreatePhonesRequest.Builder() - .build(), - "code8" - ) - .build(), - Arrays.asList( - new CreatePaymentRequest.Builder( - "payment_method8" - ) - .build() - ), - "code4", - true +String orderId = "order_id6"; +UpdateMetadataRequest request = new UpdateMetadataRequest.Builder( + new LinkedHashMap() {{ + put("key0", "metadata3"); + }} ) .build(); try { - GetOrderResponse result = ordersController.createOrder(body, null); + GetOrderResponse result = ordersController.updateOrderMetadata(orderId, request, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -430,42 +440,32 @@ try { ``` -# Create Order Item +# Get Order + +Gets an order ```java -GetOrderItemResponse createOrderItem( - final String orderId, - final CreateOrderItemRequest request, - final String idempotencyKey) +GetOrderResponse getOrder( + final String orderId) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `orderId` | `String` | Template, Required | Order Id | -| `request` | [`CreateOrderItemRequest`](../../doc/models/create-order-item-request.md) | Body, Required | Order Item Model | -| `idempotencyKey` | `String` | Header, Optional | - | +| `orderId` | `String` | Template, Required | Order id | ## Response Type -[`GetOrderItemResponse`](../../doc/models/get-order-item-response.md) +[`GetOrderResponse`](../../doc/models/get-order-response.md) ## Example Usage ```java -String orderId = "orderId2"; -CreateOrderItemRequest request = new CreateOrderItemRequest.Builder( - 242, - "description6", - 100, - "category4" -) -.build(); - +String orderId = "order_id6"; try { - GetOrderItemResponse result = ordersController.createOrderItem(orderId, request, null); + GetOrderResponse result = ordersController.getOrder(orderId); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); diff --git a/doc/controllers/plans.md b/doc/controllers/plans.md index 1761d6f..8971c72 100644 --- a/doc/controllers/plans.md +++ b/doc/controllers/plans.md @@ -11,15 +11,15 @@ PlansController plansController = client.getPlansController(); ## Methods * [Get Plan](../../doc/controllers/plans.md#get-plan) -* [Delete Plan Item](../../doc/controllers/plans.md#delete-plan-item) -* [Update Plan Metadata](../../doc/controllers/plans.md#update-plan-metadata) -* [Create Plan](../../doc/controllers/plans.md#create-plan) -* [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 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) +* [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) +* [Get Plans](../../doc/controllers/plans.md#get-plans) +* [Update Plan](../../doc/controllers/plans.md#update-plan) # Get Plan @@ -57,14 +57,13 @@ try { ``` -# Delete Plan Item +# Delete Plan -Removes an item from a plan +Deletes a plan ```java -GetPlanItemResponse deletePlanItem( +GetPlanResponse deletePlan( final String planId, - final String planItemId, final String idempotencyKey) ``` @@ -73,21 +72,19 @@ GetPlanItemResponse deletePlanItem( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `planId` | `String` | Template, Required | Plan id | -| `planItemId` | `String` | Template, Required | Plan item id | | `idempotencyKey` | `String` | Header, Optional | - | ## Response Type -[`GetPlanItemResponse`](../../doc/models/get-plan-item-response.md) +[`GetPlanResponse`](../../doc/models/get-plan-response.md) ## Example Usage ```java String planId = "plan_id8"; -String planItemId = "plan_item_id0"; try { - GetPlanItemResponse result = plansController.deletePlanItem(planId, planItemId, null); + GetPlanResponse result = plansController.deletePlan(planId, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -143,13 +140,15 @@ try { ``` -# Create Plan +# Update Plan Item -Creates a new plan +Updates a plan item ```java -GetPlanResponse createPlan( - final CreatePlanRequest body, +GetPlanItemResponse updatePlanItem( + final String planId, + final String planItemId, + final UpdatePlanItemRequest body, final String idempotencyKey) ``` @@ -157,61 +156,41 @@ GetPlanResponse createPlan( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `body` | [`CreatePlanRequest`](../../doc/models/create-plan-request.md) | Body, Required | Request for creating a plan | +| `planId` | `String` | Template, Required | Plan id | +| `planItemId` | `String` | Template, Required | Plan item id | +| `body` | [`UpdatePlanItemRequest`](../../doc/models/update-plan-item-request.md) | Body, Required | Request for updating the plan item | | `idempotencyKey` | `String` | Header, Optional | - | ## Response Type -[`GetPlanResponse`](../../doc/models/get-plan-response.md) +[`GetPlanItemResponse`](../../doc/models/get-plan-item-response.md) ## Example Usage ```java -CreatePlanRequest body = new CreatePlanRequest.Builder( +String planId = "plan_id8"; +String planItemId = "plan_item_id0"; +UpdatePlanItemRequest body = new UpdatePlanItemRequest.Builder( "name6", "description4", - "statement_descriptor6", - Arrays.asList( - new CreatePlanItemRequest.Builder( - "name8", - new CreatePricingSchemeRequest.Builder( - "scheme_type8" + "status2", + new UpdatePricingSchemeRequest.Builder( + "scheme_type8", + Arrays.asList( + new UpdatePriceBracketRequest.Builder( + 144, + 174 ) - .build(), - "id8", - "description2" + .build() ) - .build() - ), - false, - Arrays.asList( - "payment_methods9" - ), - Arrays.asList( - 207 - ), - "currency6", - "interval6", - 170, - Arrays.asList( - 201, - 200 - ), - "billing_type0", - new CreatePricingSchemeRequest.Builder( - "scheme_type8" ) - .build(), - new LinkedHashMap() {{ - put("key0", "metadata7"); - put("key1", "metadata8"); - }} + .build() ) .build(); try { - GetPlanResponse result = plansController.createPlan(body, null); + GetPlanItemResponse result = plansController.updatePlanItem(planId, planItemId, body, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -221,14 +200,14 @@ try { ``` -# Update Plan +# Create Plan Item -Updates a plan +Adds a new item to a plan ```java -GetPlanResponse updatePlan( +GetPlanItemResponse createPlanItem( final String planId, - final UpdatePlanRequest request, + final CreatePlanItemRequest request, final String idempotencyKey) ``` @@ -237,48 +216,31 @@ GetPlanResponse updatePlan( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `planId` | `String` | Template, Required | Plan id | -| `request` | [`UpdatePlanRequest`](../../doc/models/update-plan-request.md) | Body, Required | Request for updating a plan | +| `request` | [`CreatePlanItemRequest`](../../doc/models/create-plan-item-request.md) | Body, Required | Request for creating a plan item | | `idempotencyKey` | `String` | Header, Optional | - | ## Response Type -[`GetPlanResponse`](../../doc/models/get-plan-response.md) +[`GetPlanItemResponse`](../../doc/models/get-plan-item-response.md) ## Example Usage ```java String planId = "plan_id8"; -UpdatePlanRequest request = new UpdatePlanRequest.Builder( +CreatePlanItemRequest request = new CreatePlanItemRequest.Builder( "name6", - "description6", - Arrays.asList( - 151, - 152 - ), - "statement_descriptor6", - "currency6", - "interval4", - 114, - Arrays.asList( - "payment_methods1", - "payment_methods0", - "payment_methods9" - ), - "billing_type0", - "status8", - false, - Arrays.asList( - 115 - ), - new LinkedHashMap() {{ - put("key0", "metadata3"); - }} + new CreatePricingSchemeRequest.Builder( + "scheme_type8" + ) + .build(), + "id6", + "description6" ) .build(); try { - GetPlanResponse result = plansController.updatePlan(planId, request, null); + GetPlanItemResponse result = plansController.createPlanItem(planId, request, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -288,14 +250,14 @@ try { ``` -# Delete Plan +# Get Plan Item -Deletes a plan +Gets a plan item ```java -GetPlanResponse deletePlan( +GetPlanItemResponse getPlanItem( final String planId, - final String idempotencyKey) + final String planItemId) ``` ## Parameters @@ -303,19 +265,20 @@ GetPlanResponse deletePlan( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `planId` | `String` | Template, Required | Plan id | -| `idempotencyKey` | `String` | Header, Optional | - | +| `planItemId` | `String` | Template, Required | Plan item id | ## Response Type -[`GetPlanResponse`](../../doc/models/get-plan-response.md) +[`GetPlanItemResponse`](../../doc/models/get-plan-item-response.md) ## Example Usage ```java String planId = "plan_id8"; +String planItemId = "plan_item_id0"; try { - GetPlanResponse result = plansController.deletePlan(planId, null); + GetPlanItemResponse result = plansController.getPlanItem(planId, planItemId); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -325,42 +288,75 @@ try { ``` -# Get Plans +# Create Plan -Gets all plans +Creates a new plan ```java -ListPlansResponse getPlans( - final Integer page, - final Integer size, - final String name, - final String status, - final String billingType, - final LocalDateTime createdSince, - final LocalDateTime createdUntil) +GetPlanResponse createPlan( + final CreatePlanRequest body, + final String idempotencyKey) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `page` | `Integer` | Query, Optional | Page number | -| `size` | `Integer` | Query, Optional | Page size | -| `name` | `String` | Query, Optional | Filter for Plan's name | -| `status` | `String` | Query, Optional | Filter for Plan's status | -| `billingType` | `String` | Query, Optional | Filter for plan's billing type | -| `createdSince` | `LocalDateTime` | Query, Optional | Filter for plan's creation date start range | -| `createdUntil` | `LocalDateTime` | Query, Optional | Filter for plan's creation date end range | +| `body` | [`CreatePlanRequest`](../../doc/models/create-plan-request.md) | Body, Required | Request for creating a plan | +| `idempotencyKey` | `String` | Header, Optional | - | ## Response Type -[`ListPlansResponse`](../../doc/models/list-plans-response.md) +[`GetPlanResponse`](../../doc/models/get-plan-response.md) ## Example Usage ```java +CreatePlanRequest body = new CreatePlanRequest.Builder( + "name6", + "description4", + "statement_descriptor6", + Arrays.asList( + new CreatePlanItemRequest.Builder( + "name8", + new CreatePricingSchemeRequest.Builder( + "scheme_type8" + ) + .build(), + "id8", + "description2" + ) + .build() + ), + false, + Arrays.asList( + "payment_methods9" + ), + Arrays.asList( + 207 + ), + "currency6", + "interval6", + 170, + Arrays.asList( + 201, + 200 + ), + "billing_type0", + new CreatePricingSchemeRequest.Builder( + "scheme_type8" + ) + .build(), + new LinkedHashMap() {{ + put("key0", "metadata7"); + put("key1", "metadata8"); + }} +) +.build(); + + try { - ListPlansResponse result = plansController.getPlans(null, null, null, null, null, null, null); + GetPlanResponse result = plansController.createPlan(body, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -370,15 +366,14 @@ try { ``` -# Update Plan Item +# Delete Plan Item -Updates a plan item +Removes an item from a plan ```java -GetPlanItemResponse updatePlanItem( +GetPlanItemResponse deletePlanItem( final String planId, final String planItemId, - final UpdatePlanItemRequest body, final String idempotencyKey) ``` @@ -388,7 +383,6 @@ GetPlanItemResponse updatePlanItem( | --- | --- | --- | --- | | `planId` | `String` | Template, Required | Plan id | | `planItemId` | `String` | Template, Required | Plan item id | -| `body` | [`UpdatePlanItemRequest`](../../doc/models/update-plan-item-request.md) | Body, Required | Request for updating the plan item | | `idempotencyKey` | `String` | Header, Optional | - | ## Response Type @@ -400,27 +394,9 @@ GetPlanItemResponse updatePlanItem( ```java String planId = "plan_id8"; String planItemId = "plan_item_id0"; -UpdatePlanItemRequest body = new UpdatePlanItemRequest.Builder( - "name6", - "description4", - "status2", - new UpdatePricingSchemeRequest.Builder( - "scheme_type8", - Arrays.asList( - new UpdatePriceBracketRequest.Builder( - 144, - 174 - ) - .build() - ) - ) - .build() -) -.build(); - try { - GetPlanItemResponse result = plansController.updatePlanItem(planId, planItemId, body, null); + GetPlanItemResponse result = plansController.deletePlanItem(planId, planItemId, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -430,47 +406,42 @@ try { ``` -# Create Plan Item +# Get Plans -Adds a new item to a plan +Gets all plans ```java -GetPlanItemResponse createPlanItem( - final String planId, - final CreatePlanItemRequest request, - final String idempotencyKey) +ListPlansResponse getPlans( + final Integer page, + final Integer size, + final String name, + final String status, + final String billingType, + final LocalDateTime createdSince, + final LocalDateTime createdUntil) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `planId` | `String` | Template, Required | Plan id | -| `request` | [`CreatePlanItemRequest`](../../doc/models/create-plan-item-request.md) | Body, Required | Request for creating a plan item | -| `idempotencyKey` | `String` | Header, Optional | - | +| `page` | `Integer` | Query, Optional | Page number | +| `size` | `Integer` | Query, Optional | Page size | +| `name` | `String` | Query, Optional | Filter for Plan's name | +| `status` | `String` | Query, Optional | Filter for Plan's status | +| `billingType` | `String` | Query, Optional | Filter for plan's billing type | +| `createdSince` | `LocalDateTime` | Query, Optional | Filter for plan's creation date start range | +| `createdUntil` | `LocalDateTime` | Query, Optional | Filter for plan's creation date end range | ## Response Type -[`GetPlanItemResponse`](../../doc/models/get-plan-item-response.md) +[`ListPlansResponse`](../../doc/models/list-plans-response.md) ## Example Usage ```java -String planId = "plan_id8"; -CreatePlanItemRequest request = new CreatePlanItemRequest.Builder( - "name6", - new CreatePricingSchemeRequest.Builder( - "scheme_type8" - ) - .build(), - "id6", - "description6" -) -.build(); - - try { - GetPlanItemResponse result = plansController.createPlanItem(planId, request, null); + ListPlansResponse result = plansController.getPlans(null, null, null, null, null, null, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -480,14 +451,15 @@ try { ``` -# Get Plan Item +# Update Plan -Gets a plan item +Updates a plan ```java -GetPlanItemResponse getPlanItem( +GetPlanResponse updatePlan( final String planId, - final String planItemId) + final UpdatePlanRequest request, + final String idempotencyKey) ``` ## Parameters @@ -495,20 +467,48 @@ GetPlanItemResponse getPlanItem( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `planId` | `String` | Template, Required | Plan id | -| `planItemId` | `String` | Template, Required | Plan item id | +| `request` | [`UpdatePlanRequest`](../../doc/models/update-plan-request.md) | Body, Required | Request for updating a plan | +| `idempotencyKey` | `String` | Header, Optional | - | ## Response Type -[`GetPlanItemResponse`](../../doc/models/get-plan-item-response.md) +[`GetPlanResponse`](../../doc/models/get-plan-response.md) ## Example Usage ```java String planId = "plan_id8"; -String planItemId = "plan_item_id0"; +UpdatePlanRequest request = new UpdatePlanRequest.Builder( + "name6", + "description6", + Arrays.asList( + 151, + 152 + ), + "statement_descriptor6", + "currency6", + "interval4", + 114, + Arrays.asList( + "payment_methods1", + "payment_methods0", + "payment_methods9" + ), + "billing_type0", + "status8", + false, + Arrays.asList( + 115 + ), + new LinkedHashMap() {{ + put("key0", "metadata3"); + }} +) +.build(); + try { - GetPlanItemResponse result = plansController.getPlanItem(planId, planItemId); + GetPlanResponse result = plansController.updatePlan(planId, request, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); diff --git a/doc/controllers/recipients.md b/doc/controllers/recipients.md index 559bf58..56d198b 100644 --- a/doc/controllers/recipients.md +++ b/doc/controllers/recipients.md @@ -11,26 +11,27 @@ RecipientsController recipientsController = client.getRecipientsController(); ## Methods * [Update Recipient](../../doc/controllers/recipients.md#update-recipient) -* [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) +* [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) * [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 Recipient by Code](../../doc/controllers/recipients.md#get-recipient-by-code) -* [Update Automatic Anticipation Settings](../../doc/controllers/recipients.md#update-automatic-anticipation-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) * [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) # Update Recipient @@ -84,33 +85,43 @@ try { ``` -# Get Withdraw by Id +# Create Anticipation + +Creates an anticipation ```java -GetWithdrawResponse getWithdrawById( +GetAnticipationResponse createAnticipation( final String recipientId, - final String withdrawalId) + final CreateAnticipationRequest request, + final String idempotencyKey) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `recipientId` | `String` | Template, Required | - | -| `withdrawalId` | `String` | Template, Required | - | +| `recipientId` | `String` | Template, Required | Recipient id | +| `request` | [`CreateAnticipationRequest`](../../doc/models/create-anticipation-request.md) | Body, Required | Anticipation data | +| `idempotencyKey` | `String` | Header, Optional | - | ## Response Type -[`GetWithdrawResponse`](../../doc/models/get-withdraw-response.md) +[`GetAnticipationResponse`](../../doc/models/get-anticipation-response.md) ## Example Usage ```java String recipientId = "recipient_id0"; -String withdrawalId = "withdrawal_id2"; +CreateAnticipationRequest request = new CreateAnticipationRequest.Builder( + 242, + "timeframe8", + DateTimeHelper.fromRfc8601DateTime("2016-03-13T12:52:32.123Z") +) +.build(); + try { - GetWithdrawResponse result = recipientsController.getWithdrawById(recipientId, withdrawalId); + GetAnticipationResponse result = recipientsController.createAnticipation(recipientId, request, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -120,32 +131,38 @@ try { ``` -# Get Recipient +# Get Anticipation Limits -Retrieves recipient information +Gets the anticipation limits for a recipient ```java -GetRecipientResponse getRecipient( - final String recipientId) +GetAnticipationLimitResponse getAnticipationLimits( + final String recipientId, + final String timeframe, + final LocalDateTime paymentDate) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `recipientId` | `String` | Template, Required | Recipiend id | +| `recipientId` | `String` | Template, Required | Recipient id | +| `timeframe` | `String` | Query, Required | Timeframe | +| `paymentDate` | `LocalDateTime` | Query, Required | Anticipation payment date | ## Response Type -[`GetRecipientResponse`](../../doc/models/get-recipient-response.md) +[`GetAnticipationLimitResponse`](../../doc/models/get-anticipation-limit-response.md) ## Example Usage ```java String recipientId = "recipient_id0"; +String timeframe = "timeframe2"; +LocalDateTime paymentDate = DateTimeHelper.fromRfc8601DateTime("2016-03-13T12:52:32.123Z"); try { - GetRecipientResponse result = recipientsController.getRecipient(recipientId); + GetAnticipationLimitResponse result = recipientsController.getAnticipationLimits(recipientId, timeframe, paymentDate); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -155,32 +172,32 @@ try { ``` -# Get Balance +# Get Recipients -Get balance information for a recipient +Retrieves paginated recipients information ```java -GetBalanceResponse getBalance( - final String recipientId) +ListRecipientResponse getRecipients( + final Integer page, + final Integer size) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `recipientId` | `String` | Template, Required | Recipient id | +| `page` | `Integer` | Query, Optional | Page number | +| `size` | `Integer` | Query, Optional | Page size | ## Response Type -[`GetBalanceResponse`](../../doc/models/get-balance-response.md) +[`ListRecipientResponse`](../../doc/models/list-recipient-response.md) ## Example Usage ```java -String recipientId = "recipient_id0"; - try { - GetBalanceResponse result = recipientsController.getBalance(recipientId); + ListRecipientResponse result = recipientsController.getRecipients(null, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -190,32 +207,33 @@ try { ``` -# Get Recipients - -Retrieves paginated recipients information +# Get Withdraw by Id ```java -ListRecipientResponse getRecipients( - final Integer page, - final Integer size) +GetWithdrawResponse getWithdrawById( + final String recipientId, + final String withdrawalId) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `page` | `Integer` | Query, Optional | Page number | -| `size` | `Integer` | Query, Optional | Page size | +| `recipientId` | `String` | Template, Required | - | +| `withdrawalId` | `String` | Template, Required | - | ## Response Type -[`ListRecipientResponse`](../../doc/models/list-recipient-response.md) +[`GetWithdrawResponse`](../../doc/models/get-withdraw-response.md) ## Example Usage ```java +String recipientId = "recipient_id0"; +String withdrawalId = "withdrawal_id2"; + try { - ListRecipientResponse result = recipientsController.getRecipients(null, null); + GetWithdrawResponse result = recipientsController.getWithdrawById(recipientId, withdrawalId); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -284,6 +302,52 @@ try { ``` +# Update Recipient Metadata + +Updates recipient metadata + +```java +GetRecipientResponse updateRecipientMetadata( + final String recipientId, + final UpdateMetadataRequest request, + final String idempotencyKey) +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `recipientId` | `String` | Template, Required | Recipient id | +| `request` | [`UpdateMetadataRequest`](../../doc/models/update-metadata-request.md) | Body, Required | Metadata | +| `idempotencyKey` | `String` | Header, Optional | - | + +## Response Type + +[`GetRecipientResponse`](../../doc/models/get-recipient-response.md) + +## Example Usage + +```java +String recipientId = "recipient_id0"; +UpdateMetadataRequest request = new UpdateMetadataRequest.Builder( + new LinkedHashMap() {{ + put("key0", "metadata3"); + }} +) +.build(); + + +try { + GetRecipientResponse result = recipientsController.updateRecipientMetadata(recipientId, request, null); + System.out.println(result); +} catch (ApiException e) { + e.printStackTrace(); +} catch (IOException e) { + e.printStackTrace(); +} +``` + + # Get Transfers Gets a paginated list of transfers for the recipient @@ -406,6 +470,48 @@ try { ``` +# Update Automatic Anticipation Settings + +Updates recipient metadata + +```java +GetRecipientResponse updateAutomaticAnticipationSettings( + final String recipientId, + final UpdateAutomaticAnticipationSettingsRequest request, + final String idempotencyKey) +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `recipientId` | `String` | Template, Required | Recipient id | +| `request` | [`UpdateAutomaticAnticipationSettingsRequest`](../../doc/models/update-automatic-anticipation-settings-request.md) | Body, Required | Metadata | +| `idempotencyKey` | `String` | Header, Optional | - | + +## Response Type + +[`GetRecipientResponse`](../../doc/models/get-recipient-response.md) + +## Example Usage + +```java +String recipientId = "recipient_id0"; +UpdateAutomaticAnticipationSettingsRequest request = new UpdateAutomaticAnticipationSettingsRequest.Builder() + .build(); + + +try { + GetRecipientResponse result = recipientsController.updateAutomaticAnticipationSettings(recipientId, request, null); + System.out.println(result); +} catch (ApiException e) { + e.printStackTrace(); +} catch (IOException e) { + e.printStackTrace(); +} +``` + + # Get Anticipation Gets an anticipation @@ -488,32 +594,48 @@ try { ``` -# Get Recipient by Code +# Get Anticipations -Retrieves recipient information +Retrieves a paginated list of anticipations from a recipient ```java -GetRecipientResponse getRecipientByCode( - final String code) +ListAnticipationResponse getAnticipations( + final String recipientId, + final Integer page, + final Integer size, + final String status, + final String timeframe, + final LocalDateTime paymentDateSince, + final LocalDateTime paymentDateUntil, + final LocalDateTime createdSince, + final LocalDateTime createdUntil) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `code` | `String` | Template, Required | Recipient code | +| `recipientId` | `String` | Template, Required | Recipient id | +| `page` | `Integer` | Query, Optional | Page number | +| `size` | `Integer` | Query, Optional | Page size | +| `status` | `String` | Query, Optional | Filter for anticipation status | +| `timeframe` | `String` | Query, Optional | Filter for anticipation timeframe | +| `paymentDateSince` | `LocalDateTime` | Query, Optional | Filter for start range for anticipation payment date | +| `paymentDateUntil` | `LocalDateTime` | Query, Optional | Filter for end range for anticipation payment date | +| `createdSince` | `LocalDateTime` | Query, Optional | Filter for start range for anticipation creation date | +| `createdUntil` | `LocalDateTime` | 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 ```java -String code = "code8"; +String recipientId = "recipient_id0"; try { - GetRecipientResponse result = recipientsController.getRecipientByCode(code); + ListAnticipationResponse result = recipientsController.getAnticipations(recipientId, null, null, null, null, null, null, null, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -523,24 +645,20 @@ try { ``` -# Update Automatic Anticipation Settings +# Get Recipient -Updates recipient metadata +Retrieves recipient information ```java -GetRecipientResponse updateAutomaticAnticipationSettings( - final String recipientId, - final UpdateAutomaticAnticipationSettingsRequest request, - final String idempotencyKey) +GetRecipientResponse getRecipient( + final String recipientId) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `recipientId` | `String` | Template, Required | Recipient id | -| `request` | [`UpdateAutomaticAnticipationSettingsRequest`](../../doc/models/update-automatic-anticipation-settings-request.md) | Body, Required | Metadata | -| `idempotencyKey` | `String` | Header, Optional | - | +| `recipientId` | `String` | Template, Required | Recipiend id | ## Response Type @@ -550,12 +668,9 @@ GetRecipientResponse updateAutomaticAnticipationSettings( ```java String recipientId = "recipient_id0"; -UpdateAutomaticAnticipationSettingsRequest request = new UpdateAutomaticAnticipationSettingsRequest.Builder() - .build(); - try { - GetRecipientResponse result = recipientsController.updateAutomaticAnticipationSettings(recipientId, request, null); + GetRecipientResponse result = recipientsController.getRecipient(recipientId); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -565,44 +680,32 @@ try { ``` -# Create Transfer +# Get Balance -Creates a transfer for a recipient +Get balance information for a recipient ```java -GetTransferResponse createTransfer( - final String recipientId, - final CreateTransferRequest request, - final String idempotencyKey) +GetBalanceResponse getBalance( + final String recipientId) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `recipientId` | `String` | Template, Required | Recipient Id | -| `request` | [`CreateTransferRequest`](../../doc/models/create-transfer-request.md) | Body, Required | Transfer data | -| `idempotencyKey` | `String` | Header, Optional | - | +| `recipientId` | `String` | Template, Required | Recipient id | ## Response Type -[`GetTransferResponse`](../../doc/models/get-transfer-response.md) +[`GetBalanceResponse`](../../doc/models/get-balance-response.md) ## Example Usage ```java String recipientId = "recipient_id0"; -CreateTransferRequest request = new CreateTransferRequest.Builder( - 242, - new LinkedHashMap() {{ - put("key0", "metadata3"); - }} -) -.build(); - try { - GetTransferResponse result = recipientsController.createTransfer(recipientId, request, null); + GetBalanceResponse result = recipientsController.getBalance(recipientId); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -612,82 +715,42 @@ try { ``` -# Create Recipient +# Get Withdrawals -Creates a new recipient +Gets a paginated list of transfers for the recipient ```java -GetRecipientResponse createRecipient( - final CreateRecipientRequest request, - final String idempotencyKey) +ListWithdrawals getWithdrawals( + final String recipientId, + final Integer page, + final Integer size, + final String status, + final LocalDateTime createdSince, + final LocalDateTime createdUntil) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `request` | [`CreateRecipientRequest`](../../doc/models/create-recipient-request.md) | Body, Required | Recipient data | -| `idempotencyKey` | `String` | Header, Optional | - | +| `recipientId` | `String` | Template, Required | - | +| `page` | `Integer` | Query, Optional | - | +| `size` | `Integer` | Query, Optional | - | +| `status` | `String` | Query, Optional | - | +| `createdSince` | `LocalDateTime` | Query, Optional | - | +| `createdUntil` | `LocalDateTime` | Query, Optional | - | ## Response Type -[`GetRecipientResponse`](../../doc/models/get-recipient-response.md) +[`ListWithdrawals`](../../doc/models/list-withdrawals.md) ## Example Usage ```java -CreateRecipientRequest request = new CreateRecipientRequest.Builder( - new CreateBankAccountRequest.Builder( - "holder_name4", - "holder_type0", - "holder_document2", - "bank6", - "branch_number4", - "account_number8", - "account_check_digit4", - "type2", - new LinkedHashMap() {{ - put("key0", "metadata5"); - put("key1", "metadata4"); - put("key2", "metadata3"); - }} - ) - .build(), - new LinkedHashMap() {{ - put("key0", "metadata3"); - }}, - "code4", - "bank_transfer" -) -.build(); - - -try { - GetRecipientResponse result = recipientsController.createRecipient(request, null); - System.out.println(result); -} catch (ApiException e) { - e.printStackTrace(); -} catch (IOException e) { - e.printStackTrace(); -} -``` - - -# Get Default Recipient - -```java -GetRecipientResponse getDefaultRecipient() -``` - -## Response Type - -[`GetRecipientResponse`](../../doc/models/get-recipient-response.md) - -## Example Usage +String recipientId = "recipient_id0"; -```java try { - GetRecipientResponse result = recipientsController.getDefaultRecipient(); + ListWithdrawals result = recipientsController.getWithdrawals(recipientId, null, null, null, null, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -697,14 +760,14 @@ try { ``` -# Create Anticipation +# Create Transfer -Creates an anticipation +Creates a transfer for a recipient ```java -GetAnticipationResponse createAnticipation( +GetTransferResponse createTransfer( final String recipientId, - final CreateAnticipationRequest request, + final CreateTransferRequest request, final String idempotencyKey) ``` @@ -712,28 +775,29 @@ GetAnticipationResponse createAnticipation( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `recipientId` | `String` | Template, Required | Recipient id | -| `request` | [`CreateAnticipationRequest`](../../doc/models/create-anticipation-request.md) | Body, Required | Anticipation data | +| `recipientId` | `String` | Template, Required | Recipient Id | +| `request` | [`CreateTransferRequest`](../../doc/models/create-transfer-request.md) | Body, Required | Transfer data | | `idempotencyKey` | `String` | Header, Optional | - | ## Response Type -[`GetAnticipationResponse`](../../doc/models/get-anticipation-response.md) +[`GetTransferResponse`](../../doc/models/get-transfer-response.md) ## Example Usage ```java String recipientId = "recipient_id0"; -CreateAnticipationRequest request = new CreateAnticipationRequest.Builder( +CreateTransferRequest request = new CreateTransferRequest.Builder( 242, - "timeframe8", - DateTimeHelper.fromRfc8601DateTime("2016-03-13T12:52:32.123Z") + new LinkedHashMap() {{ + put("key0", "metadata3"); + }} ) .build(); try { - GetAnticipationResponse result = recipientsController.createAnticipation(recipientId, request, null); + GetTransferResponse result = recipientsController.createTransfer(recipientId, request, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -743,38 +807,58 @@ try { ``` -# Get Anticipation Limits +# Create Recipient -Gets the anticipation limits for a recipient +Creates a new recipient ```java -GetAnticipationLimitResponse getAnticipationLimits( - final String recipientId, - final String timeframe, - final LocalDateTime paymentDate) +GetRecipientResponse createRecipient( + final CreateRecipientRequest request, + final String idempotencyKey) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `recipientId` | `String` | Template, Required | Recipient id | -| `timeframe` | `String` | Query, Required | Timeframe | -| `paymentDate` | `LocalDateTime` | Query, Required | Anticipation payment date | +| `request` | [`CreateRecipientRequest`](../../doc/models/create-recipient-request.md) | Body, Required | Recipient data | +| `idempotencyKey` | `String` | Header, Optional | - | ## Response Type -[`GetAnticipationLimitResponse`](../../doc/models/get-anticipation-limit-response.md) +[`GetRecipientResponse`](../../doc/models/get-recipient-response.md) ## Example Usage ```java -String recipientId = "recipient_id0"; -String timeframe = "timeframe2"; -LocalDateTime paymentDate = DateTimeHelper.fromRfc8601DateTime("2016-03-13T12:52:32.123Z"); +CreateRecipientRequest request = new CreateRecipientRequest.Builder( + new CreateBankAccountRequest.Builder( + "holder_name4", + "holder_type0", + "holder_document2", + "bank6", + "branch_number4", + "account_number8", + "account_check_digit4", + "type2", + new LinkedHashMap() {{ + put("key0", "metadata5"); + put("key1", "metadata4"); + put("key2", "metadata3"); + }} + ) + .build(), + new LinkedHashMap() {{ + put("key0", "metadata3"); + }}, + "code4", + "bank_transfer" +) +.build(); + try { - GetAnticipationLimitResponse result = recipientsController.getAnticipationLimits(recipientId, timeframe, paymentDate); + GetRecipientResponse result = recipientsController.createRecipient(request, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -784,24 +868,20 @@ try { ``` -# Update Recipient Metadata +# Get Recipient by Code -Updates recipient metadata +Retrieves recipient information ```java -GetRecipientResponse updateRecipientMetadata( - final String recipientId, - final UpdateMetadataRequest request, - final String idempotencyKey) +GetRecipientResponse getRecipientByCode( + final String code) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `recipientId` | `String` | Template, Required | Recipient id | -| `request` | [`UpdateMetadataRequest`](../../doc/models/update-metadata-request.md) | Body, Required | Metadata | -| `idempotencyKey` | `String` | Header, Optional | - | +| `code` | `String` | Template, Required | Recipient code | ## Response Type @@ -810,17 +890,10 @@ GetRecipientResponse updateRecipientMetadata( ## Example Usage ```java -String recipientId = "recipient_id0"; -UpdateMetadataRequest request = new UpdateMetadataRequest.Builder( - new LinkedHashMap() {{ - put("key0", "metadata3"); - }} -) -.build(); - +String code = "code8"; try { - GetRecipientResponse result = recipientsController.updateRecipientMetadata(recipientId, request, null); + GetRecipientResponse result = recipientsController.getRecipientByCode(code); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -830,48 +903,21 @@ try { ``` -# Get Anticipations - -Retrieves a paginated list of anticipations from a recipient +# Get Default Recipient ```java -ListAnticipationResponse getAnticipations( - final String recipientId, - final Integer page, - final Integer size, - final String status, - final String timeframe, - final LocalDateTime paymentDateSince, - final LocalDateTime paymentDateUntil, - final LocalDateTime createdSince, - final LocalDateTime createdUntil) +GetRecipientResponse getDefaultRecipient() ``` -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `recipientId` | `String` | Template, Required | Recipient id | -| `page` | `Integer` | Query, Optional | Page number | -| `size` | `Integer` | Query, Optional | Page size | -| `status` | `String` | Query, Optional | Filter for anticipation status | -| `timeframe` | `String` | Query, Optional | Filter for anticipation timeframe | -| `paymentDateSince` | `LocalDateTime` | Query, Optional | Filter for start range for anticipation payment date | -| `paymentDateUntil` | `LocalDateTime` | Query, Optional | Filter for end range for anticipation payment date | -| `createdSince` | `LocalDateTime` | Query, Optional | Filter for start range for anticipation creation date | -| `createdUntil` | `LocalDateTime` | Query, Optional | Filter for end range for anticipation creation date | - ## Response Type -[`ListAnticipationResponse`](../../doc/models/list-anticipation-response.md) +[`GetRecipientResponse`](../../doc/models/get-recipient-response.md) ## Example Usage ```java -String recipientId = "recipient_id0"; - try { - ListAnticipationResponse result = recipientsController.getAnticipations(recipientId, null, null, null, null, null, null, null, null); + GetRecipientResponse result = recipientsController.getDefaultRecipient(); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -881,18 +927,13 @@ try { ``` -# Get Withdrawals +# Create KYC Link -Gets a paginated list of transfers for the recipient +Create a KYC link ```java -ListWithdrawals getWithdrawals( - final String recipientId, - final Integer page, - final Integer size, - final String status, - final LocalDateTime createdSince, - final LocalDateTime createdUntil) +CreateKYCLinkResponse createKYCLink( + final String recipientId) ``` ## Parameters @@ -900,15 +941,10 @@ ListWithdrawals getWithdrawals( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `recipientId` | `String` | Template, Required | - | -| `page` | `Integer` | Query, Optional | - | -| `size` | `Integer` | Query, Optional | - | -| `status` | `String` | Query, Optional | - | -| `createdSince` | `LocalDateTime` | Query, Optional | - | -| `createdUntil` | `LocalDateTime` | Query, Optional | - | ## Response Type -[`ListWithdrawals`](../../doc/models/list-withdrawals.md) +[`CreateKYCLinkResponse`](../../doc/models/create-kyc-link-response.md) ## Example Usage @@ -916,7 +952,7 @@ ListWithdrawals getWithdrawals( String recipientId = "recipient_id0"; try { - ListWithdrawals result = recipientsController.getWithdrawals(recipientId, null, null, null, null, null); + CreateKYCLinkResponse result = recipientsController.createKYCLink(recipientId); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); diff --git a/doc/controllers/subscriptions.md b/doc/controllers/subscriptions.md index 0f33c46..63c26bf 100644 --- a/doc/controllers/subscriptions.md +++ b/doc/controllers/subscriptions.md @@ -10,52 +10,49 @@ SubscriptionsController subscriptionsController = client.getSubscriptionsControl ## Methods -* [Update Subscription Card](../../doc/controllers/subscriptions.md#update-subscription-card) -* [Create Discount](../../doc/controllers/subscriptions.md#create-discount) -* [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) -* [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) +* [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) -* [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) +* [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) +* [Get Subscription Item](../../doc/controllers/subscriptions.md#get-subscription-item) * [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 Item](../../doc/controllers/subscriptions.md#update-subscription-item) - +* [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) -# Update Subscription Card -Updates the credit card from a subscription +# Renew Subscription ```java -GetSubscriptionResponse updateSubscriptionCard( +GetPeriodResponse renewSubscription( final String subscriptionId, - final UpdateSubscriptionCardRequest request, final String idempotencyKey) ``` @@ -63,29 +60,20 @@ GetSubscriptionResponse updateSubscriptionCard( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `String` | Template, Required | Subscription id | -| `request` | [`UpdateSubscriptionCardRequest`](../../doc/models/update-subscription-card-request.md) | Body, Required | Request for updating a card | +| `subscriptionId` | `String` | Template, Required | - | | `idempotencyKey` | `String` | Header, Optional | - | ## Response Type -[`GetSubscriptionResponse`](../../doc/models/get-subscription-response.md) +[`GetPeriodResponse`](../../doc/models/get-period-response.md) ## Example Usage ```java String subscriptionId = "subscription_id0"; -UpdateSubscriptionCardRequest request = new UpdateSubscriptionCardRequest.Builder( - new CreateCardRequest.Builder() - .type("credit") - .build(), - "card_id2" -) -.build(); - try { - GetSubscriptionResponse result = subscriptionsController.updateSubscriptionCard(subscriptionId, request, null); + GetPeriodResponse result = subscriptionsController.renewSubscription(subscriptionId, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -95,14 +83,14 @@ try { ``` -# Create Discount +# Update Subscription Card -Creates a discount +Updates the credit card from a subscription ```java -GetDiscountResponse createDiscount( +GetSubscriptionResponse updateSubscriptionCard( final String subscriptionId, - final CreateDiscountRequest request, + final UpdateSubscriptionCardRequest request, final String idempotencyKey) ``` @@ -111,27 +99,28 @@ GetDiscountResponse createDiscount( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `subscriptionId` | `String` | Template, Required | Subscription id | -| `request` | [`CreateDiscountRequest`](../../doc/models/create-discount-request.md) | Body, Required | Request for creating a discount | +| `request` | [`UpdateSubscriptionCardRequest`](../../doc/models/update-subscription-card-request.md) | Body, Required | Request for updating a card | | `idempotencyKey` | `String` | Header, Optional | - | ## Response Type -[`GetDiscountResponse`](../../doc/models/get-discount-response.md) +[`GetSubscriptionResponse`](../../doc/models/get-subscription-response.md) ## Example Usage ```java String subscriptionId = "subscription_id0"; -CreateDiscountRequest request = new CreateDiscountRequest.Builder( - 185.28D, - "discount_type4", - "item_id6" +UpdateSubscriptionCardRequest request = new UpdateSubscriptionCardRequest.Builder( + new CreateCardRequest.Builder() + .type("credit") + .build(), + "card_id2" ) .build(); try { - GetDiscountResponse result = subscriptionsController.createDiscount(subscriptionId, request, null); + GetSubscriptionResponse result = subscriptionsController.updateSubscriptionCard(subscriptionId, request, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -141,14 +130,15 @@ try { ``` -# Update Subscription Billing Date +# Delete Usage -Updates the billing date from a subscription +Deletes a usage ```java -GetSubscriptionResponse updateSubscriptionBillingDate( +GetUsageResponse deleteUsage( final String subscriptionId, - final UpdateSubscriptionBillingDateRequest request, + final String itemId, + final String usageId, final String idempotencyKey) ``` @@ -157,25 +147,23 @@ GetSubscriptionResponse updateSubscriptionBillingDate( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `subscriptionId` | `String` | Template, Required | The subscription id | -| `request` | [`UpdateSubscriptionBillingDateRequest`](../../doc/models/update-subscription-billing-date-request.md) | Body, Required | Request for updating the subscription billing date | +| `itemId` | `String` | Template, Required | The subscription item id | +| `usageId` | `String` | Template, Required | The usage id | | `idempotencyKey` | `String` | Header, Optional | - | ## Response Type -[`GetSubscriptionResponse`](../../doc/models/get-subscription-response.md) +[`GetUsageResponse`](../../doc/models/get-usage-response.md) ## Example Usage ```java String subscriptionId = "subscription_id0"; -UpdateSubscriptionBillingDateRequest request = new UpdateSubscriptionBillingDateRequest.Builder( - DateTimeHelper.fromRfc8601DateTime("2016-03-13T12:52:32.123Z") -) -.build(); - +String itemId = "item_id0"; +String usageId = "usage_id0"; try { - GetSubscriptionResponse result = subscriptionsController.updateSubscriptionBillingDate(subscriptionId, request, null); + GetUsageResponse result = subscriptionsController.deleteUsage(subscriptionId, itemId, usageId, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -185,14 +173,14 @@ try { ``` -# Update Subscription Start At +# Create Discount -Updates the start at date from a subscription +Creates a discount ```java -GetSubscriptionResponse updateSubscriptionStartAt( +GetDiscountResponse createDiscount( final String subscriptionId, - final UpdateSubscriptionStartAtRequest request, + final CreateDiscountRequest request, final String idempotencyKey) ``` @@ -200,26 +188,28 @@ GetSubscriptionResponse updateSubscriptionStartAt( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `String` | Template, Required | The subscription id | -| `request` | [`UpdateSubscriptionStartAtRequest`](../../doc/models/update-subscription-start-at-request.md) | Body, Required | Request for updating the subscription start date | +| `subscriptionId` | `String` | Template, Required | Subscription id | +| `request` | [`CreateDiscountRequest`](../../doc/models/create-discount-request.md) | Body, Required | Request for creating a discount | | `idempotencyKey` | `String` | Header, Optional | - | ## Response Type -[`GetSubscriptionResponse`](../../doc/models/get-subscription-response.md) +[`GetDiscountResponse`](../../doc/models/get-discount-response.md) ## Example Usage ```java String subscriptionId = "subscription_id0"; -UpdateSubscriptionStartAtRequest request = new UpdateSubscriptionStartAtRequest.Builder( - DateTimeHelper.fromRfc8601DateTime("2016-03-13T12:52:32.123Z") +CreateDiscountRequest request = new CreateDiscountRequest.Builder( + 185.28D, + "discount_type4", + "item_id6" ) .build(); try { - GetSubscriptionResponse result = subscriptionsController.updateSubscriptionStartAt(subscriptionId, request, null); + GetDiscountResponse result = subscriptionsController.createDiscount(subscriptionId, request, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -229,13 +219,15 @@ try { ``` -# Get Subscription +# Create an Usage -Gets a subscription +Create Usage ```java -GetSubscriptionResponse getSubscription( - final String subscriptionId) +GetUsageResponse createAnUsage( + final String subscriptionId, + final String itemId, + final String idempotencyKey) ``` ## Parameters @@ -243,18 +235,21 @@ GetSubscriptionResponse getSubscription( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `subscriptionId` | `String` | Template, Required | Subscription id | +| `itemId` | `String` | Template, Required | Item id | +| `idempotencyKey` | `String` | Header, Optional | - | ## Response Type -[`GetSubscriptionResponse`](../../doc/models/get-subscription-response.md) +[`GetUsageResponse`](../../doc/models/get-usage-response.md) ## Example Usage ```java String subscriptionId = "subscription_id0"; +String itemId = "item_id0"; try { - GetSubscriptionResponse result = subscriptionsController.getSubscription(subscriptionId); + GetUsageResponse result = subscriptionsController.createAnUsage(subscriptionId, itemId, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -264,48 +259,39 @@ try { ``` -# Get Usages - -Lists all usages from a subscription item +# Update Current Cycle Status ```java -ListUsagesResponse getUsages( +Void updateCurrentCycleStatus( final String subscriptionId, - final String itemId, - final Integer page, - final Integer size, - final String code, - final String group, - final LocalDateTime usedSince, - final LocalDateTime usedUntil) + final UpdateCurrentCycleStatusRequest request, + final String idempotencyKey) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `String` | Template, Required | The subscription id | -| `itemId` | `String` | Template, Required | The subscription item id | -| `page` | `Integer` | Query, Optional | Page number | -| `size` | `Integer` | Query, Optional | Page size | -| `code` | `String` | Query, Optional | Identification code in the client system | -| `group` | `String` | Query, Optional | Identification group in the client system | -| `usedSince` | `LocalDateTime` | Query, Optional | - | -| `usedUntil` | `LocalDateTime` | Query, Optional | - | +| `subscriptionId` | `String` | 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 | +| `idempotencyKey` | `String` | Header, Optional | - | ## Response Type -[`ListUsagesResponse`](../../doc/models/list-usages-response.md) +`void` ## Example Usage ```java String subscriptionId = "subscription_id0"; -String itemId = "item_id0"; +UpdateCurrentCycleStatusRequest request = new UpdateCurrentCycleStatusRequest.Builder( + "status8" +) +.build(); + try { - ListUsagesResponse result = subscriptionsController.getUsages(subscriptionId, itemId, null, null, null, null, null, null); - System.out.println(result); + subscriptionsController.updateCurrentCycleStatus(subscriptionId, request, null); } catch (ApiException e) { e.printStackTrace(); } catch (IOException e) { @@ -314,12 +300,14 @@ try { ``` -# Update Latest Period End At +# Delete Discount + +Deletes a discount ```java -GetSubscriptionResponse updateLatestPeriodEndAt( +GetDiscountResponse deleteDiscount( final String subscriptionId, - final UpdateCurrentCycleEndDateRequest request, + final String discountId, final String idempotencyKey) ``` @@ -327,24 +315,22 @@ GetSubscriptionResponse updateLatestPeriodEndAt( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `String` | 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 | +| `subscriptionId` | `String` | Template, Required | Subscription id | +| `discountId` | `String` | Template, Required | Discount Id | | `idempotencyKey` | `String` | Header, Optional | - | ## Response Type -[`GetSubscriptionResponse`](../../doc/models/get-subscription-response.md) +[`GetDiscountResponse`](../../doc/models/get-discount-response.md) ## Example Usage ```java String subscriptionId = "subscription_id0"; -UpdateCurrentCycleEndDateRequest request = new UpdateCurrentCycleEndDateRequest.Builder() - .build(); - +String discountId = "discount_id8"; try { - GetSubscriptionResponse result = subscriptionsController.updateLatestPeriodEndAt(subscriptionId, request, null); + GetDiscountResponse result = subscriptionsController.deleteDiscount(subscriptionId, discountId, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -354,37 +340,48 @@ try { ``` -# Delete Discount +# Get Subscription Items -Deletes a discount +Get Subscription Items ```java -GetDiscountResponse deleteDiscount( +ListSubscriptionItemsResponse getSubscriptionItems( final String subscriptionId, - final String discountId, - final String idempotencyKey) + final Integer page, + final Integer size, + final String name, + final String code, + final String status, + final String description, + final String createdSince, + final String createdUntil) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `String` | Template, Required | Subscription id | -| `discountId` | `String` | Template, Required | Discount Id | -| `idempotencyKey` | `String` | Header, Optional | - | +| `subscriptionId` | `String` | Template, Required | The subscription id | +| `page` | `Integer` | Query, Optional | Page number | +| `size` | `Integer` | Query, Optional | Page size | +| `name` | `String` | Query, Optional | The item name | +| `code` | `String` | Query, Optional | Identification code in the client system | +| `status` | `String` | Query, Optional | The item statis | +| `description` | `String` | Query, Optional | The item description | +| `createdSince` | `String` | Query, Optional | Filter for item's creation date start range | +| `createdUntil` | `String` | Query, Optional | Filter for item's creation date end range | ## Response Type -[`GetDiscountResponse`](../../doc/models/get-discount-response.md) +[`ListSubscriptionItemsResponse`](../../doc/models/list-subscription-items-response.md) ## Example Usage ```java String subscriptionId = "subscription_id0"; -String discountId = "discount_id8"; try { - GetDiscountResponse result = subscriptionsController.deleteDiscount(subscriptionId, discountId, null); + ListSubscriptionItemsResponse result = subscriptionsController.getSubscriptionItems(subscriptionId, null, null, null, null, null, null, null, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -442,41 +439,35 @@ try { ``` -# Cancel Subscription +# Get Subscription Item -Cancels a subscription +Get Subscription Item ```java -GetSubscriptionResponse cancelSubscription( +GetSubscriptionItemResponse getSubscriptionItem( final String subscriptionId, - final CreateCancelSubscriptionRequest request, - final String idempotencyKey) + final String itemId) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `String` | Template, Required | Subscription id | -| `request` | [`CreateCancelSubscriptionRequest`](../../doc/models/create-cancel-subscription-request.md) | Body, Optional | Request for cancelling a subscription | -| `idempotencyKey` | `String` | Header, Optional | - | +| `subscriptionId` | `String` | Template, Required | Subscription Id | +| `itemId` | `String` | Template, Required | Item id | ## Response Type -[`GetSubscriptionResponse`](../../doc/models/get-subscription-response.md) +[`GetSubscriptionItemResponse`](../../doc/models/get-subscription-item-response.md) ## Example Usage ```java String subscriptionId = "subscription_id0"; -CreateCancelSubscriptionRequest request = new CreateCancelSubscriptionRequest.Builder( - true -) -.build(); - +String itemId = "item_id0"; try { - GetSubscriptionResponse result = subscriptionsController.cancelSubscription(subscriptionId, request, null); + GetSubscriptionItemResponse result = subscriptionsController.getSubscriptionItem(subscriptionId, itemId); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -486,141 +477,52 @@ try { ``` -# Create Subscription +# Get Subscriptions -Creates a new subscription +Gets all subscriptions ```java -GetSubscriptionResponse createSubscription( - final CreateSubscriptionRequest body, - final String idempotencyKey) +ListSubscriptionsResponse getSubscriptions( + final Integer page, + final Integer size, + final String code, + final String billingType, + final String customerId, + final String planId, + final String cardId, + final String status, + final LocalDateTime nextBillingSince, + final LocalDateTime nextBillingUntil, + final LocalDateTime createdSince, + final LocalDateTime createdUntil) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `body` | [`CreateSubscriptionRequest`](../../doc/models/create-subscription-request.md) | Body, Required | Request for creating a subscription | -| `idempotencyKey` | `String` | Header, Optional | - | +| `page` | `Integer` | Query, Optional | Page number | +| `size` | `Integer` | Query, Optional | Page size | +| `code` | `String` | Query, Optional | Filter for subscription's code | +| `billingType` | `String` | Query, Optional | Filter for subscription's billing type | +| `customerId` | `String` | Query, Optional | Filter for subscription's customer id | +| `planId` | `String` | Query, Optional | Filter for subscription's plan id | +| `cardId` | `String` | Query, Optional | Filter for subscription's card id | +| `status` | `String` | Query, Optional | Filter for subscription's status | +| `nextBillingSince` | `LocalDateTime` | Query, Optional | Filter for subscription's next billing date start range | +| `nextBillingUntil` | `LocalDateTime` | Query, Optional | Filter for subscription's next billing date end range | +| `createdSince` | `LocalDateTime` | Query, Optional | Filter for subscription's creation date start range | +| `createdUntil` | `LocalDateTime` | Query, Optional | Filter for subscriptions creation date end range | ## Response Type -[`GetSubscriptionResponse`](../../doc/models/get-subscription-response.md) +[`ListSubscriptionsResponse`](../../doc/models/list-subscriptions-response.md) ## Example Usage ```java -CreateSubscriptionRequest body = new CreateSubscriptionRequest.Builder( - new CreateCustomerRequest.Builder( - "{\n \"name\": \"Tony Stark\"\n}", - "email6", - "document6", - "type0", - new CreateAddressRequest.Builder( - "street6", - "number4", - "zip_code0", - "neighborhood2", - "city6", - "state2", - "country0", - "complement2", - "line_10", - "line_24" - ) - .build(), - new LinkedHashMap() {{ - put("key0", "metadata3"); - }}, - new CreatePhonesRequest.Builder() - .build(), - "code8" - ) - .build(), - new CreateCardRequest.Builder() - .type("credit") - .build(), - "code4", - "payment_method4", - "billing_type0", - "statement_descriptor6", - "description4", - "currency6", - "interval6", - 170, - new CreatePricingSchemeRequest.Builder( - "scheme_type8" - ) - .build(), - Arrays.asList( - new CreateSubscriptionItemRequest.Builder( - "description2", - new CreatePricingSchemeRequest.Builder( - "scheme_type8" - ) - .build(), - "id8", - "plan_item_id8", - Arrays.asList( - new CreateDiscountRequest.Builder( - 90.66D, - "discount_type2", - "item_id4" - ) - .build() - ), - "name8" - ) - .build() - ), - new CreateShippingRequest.Builder( - 52, - "description6", - "recipient_name2", - "recipient_phone6", - "address_id6", - new CreateAddressRequest.Builder( - "street6", - "number4", - "zip_code0", - "neighborhood2", - "city6", - "state2", - "country0", - "complement2", - "line_10", - "line_24" - ) - .build(), - "type6" - ) - .build(), - Arrays.asList( - new CreateDiscountRequest.Builder( - 90.66D, - "discount_type2", - "item_id4" - ) - .build() - ), - new LinkedHashMap() {{ - put("key0", "metadata7"); - put("key1", "metadata8"); - }}, - Arrays.asList( - new CreateIncrementRequest.Builder( - 252.86D, - "increment_type6", - "item_id6" - ) - .build() - ) -) -.build(); - - try { - GetSubscriptionResponse result = subscriptionsController.createSubscription(body, null); + ListSubscriptionsResponse result = subscriptionsController.getSubscriptions(null, null, null, null, null, null, null, null, null, null, null, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -630,12 +532,14 @@ try { ``` -# Update Subscription Affiliation Id +# Cancel Subscription + +Cancels a subscription ```java -GetSubscriptionResponse updateSubscriptionAffiliationId( +GetSubscriptionResponse cancelSubscription( final String subscriptionId, - final UpdateSubscriptionAffiliationIdRequest request, + final CreateCancelSubscriptionRequest request, final String idempotencyKey) ``` @@ -643,8 +547,8 @@ GetSubscriptionResponse updateSubscriptionAffiliationId( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `String` | Template, Required | - | -| `request` | [`UpdateSubscriptionAffiliationIdRequest`](../../doc/models/update-subscription-affiliation-id-request.md) | Body, Required | Request for updating a subscription affiliation id | +| `subscriptionId` | `String` | Template, Required | Subscription id | +| `request` | [`CreateCancelSubscriptionRequest`](../../doc/models/create-cancel-subscription-request.md) | Body, Optional | Request for cancelling a subscription | | `idempotencyKey` | `String` | Header, Optional | - | ## Response Type @@ -655,14 +559,14 @@ GetSubscriptionResponse updateSubscriptionAffiliationId( ```java String subscriptionId = "subscription_id0"; -UpdateSubscriptionAffiliationIdRequest request = new UpdateSubscriptionAffiliationIdRequest.Builder( - "gateway_affiliation_id2" +CreateCancelSubscriptionRequest request = new CreateCancelSubscriptionRequest.Builder( + true ) .build(); try { - GetSubscriptionResponse result = subscriptionsController.updateSubscriptionAffiliationId(subscriptionId, request, null); + GetSubscriptionResponse result = subscriptionsController.cancelSubscription(subscriptionId, request, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -672,14 +576,14 @@ try { ``` -# Update Subscription Minium Price +# Create Increment -Atualização do valor mínimo da assinatura +Creates a increment ```java -GetSubscriptionResponse updateSubscriptionMiniumPrice( +GetIncrementResponse createIncrement( final String subscriptionId, - final UpdateSubscriptionMinimumPriceRequest request, + final CreateIncrementRequest request, final String idempotencyKey) ``` @@ -687,24 +591,28 @@ GetSubscriptionResponse updateSubscriptionMiniumPrice( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `String` | 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 | +| `subscriptionId` | `String` | Template, Required | Subscription id | +| `request` | [`CreateIncrementRequest`](../../doc/models/create-increment-request.md) | Body, Required | Request for creating a increment | | `idempotencyKey` | `String` | Header, Optional | - | ## Response Type -[`GetSubscriptionResponse`](../../doc/models/get-subscription-response.md) +[`GetIncrementResponse`](../../doc/models/get-increment-response.md) ## Example Usage ```java String subscriptionId = "subscription_id0"; -UpdateSubscriptionMinimumPriceRequest request = new UpdateSubscriptionMinimumPriceRequest.Builder() - .build(); +CreateIncrementRequest request = new CreateIncrementRequest.Builder( + 185.28D, + "increment_type8", + "item_id6" +) +.build(); try { - GetSubscriptionResponse result = subscriptionsController.updateSubscriptionMiniumPrice(subscriptionId, request, null); + GetIncrementResponse result = subscriptionsController.createIncrement(subscriptionId, request, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -714,69 +622,46 @@ try { ``` -# Get Subscription Cycle by Id - -```java -GetPeriodResponse getSubscriptionCycleById( - final String subscriptionId, - final String cycleId) -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `subscriptionId` | `String` | Template, Required | The subscription id | -| `cycleId` | `String` | Template, Required | - | - -## Response Type - -[`GetPeriodResponse`](../../doc/models/get-period-response.md) - -## Example Usage - -```java -String subscriptionId = "subscription_id0"; -String cycleId = "cycleId0"; - -try { - GetPeriodResponse result = subscriptionsController.getSubscriptionCycleById(subscriptionId, cycleId); - System.out.println(result); -} catch (ApiException e) { - e.printStackTrace(); -} catch (IOException e) { - e.printStackTrace(); -} -``` - +# Create Usage -# Get Usage Report +Creates a usage ```java -GetUsageReportResponse getUsageReport( +GetUsageResponse createUsage( final String subscriptionId, - final String periodId) + final String itemId, + final CreateUsageRequest body, + final String idempotencyKey) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `String` | Template, Required | The subscription Id | -| `periodId` | `String` | Template, Required | The period Id | +| `subscriptionId` | `String` | Template, Required | Subscription Id | +| `itemId` | `String` | Template, Required | Item id | +| `body` | [`CreateUsageRequest`](../../doc/models/create-usage-request.md) | Body, Required | Request for creating a usage | +| `idempotencyKey` | `String` | Header, Optional | - | ## Response Type -[`GetUsageReportResponse`](../../doc/models/get-usage-report-response.md) +[`GetUsageResponse`](../../doc/models/get-usage-response.md) ## Example Usage ```java String subscriptionId = "subscription_id0"; -String periodId = "period_id0"; +String itemId = "item_id0"; +CreateUsageRequest body = new CreateUsageRequest.Builder( + 156, + "description4", + DateTimeHelper.fromRfc8601DateTime("2016-03-13T12:52:32.123Z") +) +.build(); + try { - GetUsageReportResponse result = subscriptionsController.getUsageReport(subscriptionId, periodId); + GetUsageResponse result = subscriptionsController.createUsage(subscriptionId, itemId, body, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -786,32 +671,33 @@ try { ``` -# Renew Subscription +# Get Discount by Id ```java -GetPeriodResponse renewSubscription( +GetDiscountResponse getDiscountById( final String subscriptionId, - final String idempotencyKey) + final String discountId) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `String` | Template, Required | - | -| `idempotencyKey` | `String` | Header, Optional | - | +| `subscriptionId` | `String` | Template, Required | The subscription id | +| `discountId` | `String` | Template, Required | - | ## Response Type -[`GetPeriodResponse`](../../doc/models/get-period-response.md) +[`GetDiscountResponse`](../../doc/models/get-discount-response.md) ## Example Usage ```java String subscriptionId = "subscription_id0"; +String discountId = "discountId0"; try { - GetPeriodResponse result = subscriptionsController.renewSubscription(subscriptionId, null); + GetDiscountResponse result = subscriptionsController.getDiscountById(subscriptionId, discountId); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -821,15 +707,13 @@ try { ``` -# Delete Usage +# Create Subscription -Deletes a usage +Creates a new subscription ```java -GetUsageResponse deleteUsage( - final String subscriptionId, - final String itemId, - final String usageId, +GetSubscriptionResponse createSubscription( + final CreateSubscriptionRequest body, final String idempotencyKey) ``` @@ -837,24 +721,127 @@ GetUsageResponse deleteUsage( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `String` | Template, Required | The subscription id | -| `itemId` | `String` | Template, Required | The subscription item id | -| `usageId` | `String` | Template, Required | The usage id | +| `body` | [`CreateSubscriptionRequest`](../../doc/models/create-subscription-request.md) | Body, Required | Request for creating a subscription | | `idempotencyKey` | `String` | Header, Optional | - | ## Response Type -[`GetUsageResponse`](../../doc/models/get-usage-response.md) +[`GetSubscriptionResponse`](../../doc/models/get-subscription-response.md) ## Example Usage ```java -String subscriptionId = "subscription_id0"; -String itemId = "item_id0"; -String usageId = "usage_id0"; +CreateSubscriptionRequest body = new CreateSubscriptionRequest.Builder( + new CreateCustomerRequest.Builder( + "Tony Stark", + "email6", + "document6", + "type0", + new CreateAddressRequest.Builder( + "street6", + "number4", + "zip_code0", + "neighborhood2", + "city6", + "state2", + "country0", + "complement2", + "line_10", + "line_24" + ) + .build(), + new LinkedHashMap() {{ + put("key0", "metadata3"); + }}, + new CreatePhonesRequest.Builder() + .build(), + "code8" + ) + .build(), + new CreateCardRequest.Builder() + .type("credit") + .build(), + "code4", + "payment_method4", + "billing_type0", + "statement_descriptor6", + "description4", + "currency6", + "interval6", + 170, + new CreatePricingSchemeRequest.Builder( + "scheme_type8" + ) + .build(), + Arrays.asList( + new CreateSubscriptionItemRequest.Builder( + "description2", + new CreatePricingSchemeRequest.Builder( + "scheme_type8" + ) + .build(), + "id8", + "plan_item_id8", + Arrays.asList( + new CreateDiscountRequest.Builder( + 90.66D, + "discount_type2", + "item_id4" + ) + .build() + ), + "name8" + ) + .build() + ), + new CreateShippingRequest.Builder( + 52, + "description6", + "recipient_name2", + "recipient_phone6", + "address_id6", + new CreateAddressRequest.Builder( + "street6", + "number4", + "zip_code0", + "neighborhood2", + "city6", + "state2", + "country0", + "complement2", + "line_10", + "line_24" + ) + .build(), + "type6" + ) + .build(), + Arrays.asList( + new CreateDiscountRequest.Builder( + 90.66D, + "discount_type2", + "item_id4" + ) + .build() + ), + new LinkedHashMap() {{ + put("key0", "metadata7"); + put("key1", "metadata8"); + }}, + Arrays.asList( + new CreateIncrementRequest.Builder( + 252.86D, + "increment_type6", + "item_id6" + ) + .build() + ) +) +.build(); + try { - GetUsageResponse result = subscriptionsController.deleteUsage(subscriptionId, itemId, usageId, null); + GetSubscriptionResponse result = subscriptionsController.createSubscription(body, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -864,37 +851,33 @@ try { ``` -# Create an Usage - -Create Usage +# Get Increment by Id ```java -GetUsageResponse createAnUsage( +GetIncrementResponse getIncrementById( final String subscriptionId, - final String itemId, - final String idempotencyKey) + final String incrementId) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `String` | Template, Required | Subscription id | -| `itemId` | `String` | Template, Required | Item id | -| `idempotencyKey` | `String` | Header, Optional | - | +| `subscriptionId` | `String` | Template, Required | The subscription Id | +| `incrementId` | `String` | Template, Required | The increment Id | ## Response Type -[`GetUsageResponse`](../../doc/models/get-usage-response.md) +[`GetIncrementResponse`](../../doc/models/get-increment-response.md) ## Example Usage ```java String subscriptionId = "subscription_id0"; -String itemId = "item_id0"; +String incrementId = "increment_id8"; try { - GetUsageResponse result = subscriptionsController.createAnUsage(subscriptionId, itemId, null); + GetIncrementResponse result = subscriptionsController.getIncrementById(subscriptionId, incrementId); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -904,12 +887,12 @@ try { ``` -# Update Current Cycle Status +# Update Subscription Affiliation Id ```java -Void updateCurrentCycleStatus( +GetSubscriptionResponse updateSubscriptionAffiliationId( final String subscriptionId, - final UpdateCurrentCycleStatusRequest request, + final UpdateSubscriptionAffiliationIdRequest request, final String idempotencyKey) ``` @@ -917,26 +900,27 @@ Void updateCurrentCycleStatus( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `String` | 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 | +| `subscriptionId` | `String` | Template, Required | - | +| `request` | [`UpdateSubscriptionAffiliationIdRequest`](../../doc/models/update-subscription-affiliation-id-request.md) | Body, Required | Request for updating a subscription affiliation id | | `idempotencyKey` | `String` | Header, Optional | - | ## Response Type -`void` +[`GetSubscriptionResponse`](../../doc/models/get-subscription-response.md) ## Example Usage ```java String subscriptionId = "subscription_id0"; -UpdateCurrentCycleStatusRequest request = new UpdateCurrentCycleStatusRequest.Builder( - "status8" +UpdateSubscriptionAffiliationIdRequest request = new UpdateSubscriptionAffiliationIdRequest.Builder( + "gateway_affiliation_id2" ) .build(); try { - subscriptionsController.updateCurrentCycleStatus(subscriptionId, request, null); + GetSubscriptionResponse result = subscriptionsController.updateSubscriptionAffiliationId(subscriptionId, request, null); + System.out.println(result); } catch (ApiException e) { e.printStackTrace(); } catch (IOException e) { @@ -945,35 +929,43 @@ try { ``` -# Get Subscription Item +# Update Subscription Metadata -Get Subscription Item +Updates the metadata from a subscription ```java -GetSubscriptionItemResponse getSubscriptionItem( +GetSubscriptionResponse updateSubscriptionMetadata( final String subscriptionId, - final String itemId) + final UpdateMetadataRequest request, + final String idempotencyKey) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `String` | Template, Required | Subscription Id | -| `itemId` | `String` | Template, Required | Item id | +| `subscriptionId` | `String` | Template, Required | The subscription id | +| `request` | [`UpdateMetadataRequest`](../../doc/models/update-metadata-request.md) | Body, Required | Request for updating the subscrption metadata | +| `idempotencyKey` | `String` | Header, Optional | - | ## Response Type -[`GetSubscriptionItemResponse`](../../doc/models/get-subscription-item-response.md) +[`GetSubscriptionResponse`](../../doc/models/get-subscription-response.md) ## Example Usage ```java String subscriptionId = "subscription_id0"; -String itemId = "item_id0"; +UpdateMetadataRequest request = new UpdateMetadataRequest.Builder( + new LinkedHashMap() {{ + put("key0", "metadata3"); + }} +) +.build(); + try { - GetSubscriptionItemResponse result = subscriptionsController.getSubscriptionItem(subscriptionId, itemId); + GetSubscriptionResponse result = subscriptionsController.updateSubscriptionMetadata(subscriptionId, request, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -983,20 +975,24 @@ try { ``` -# Get Increment by Id +# Delete Increment + +Deletes a increment ```java -GetIncrementResponse getIncrementById( +GetIncrementResponse deleteIncrement( final String subscriptionId, - final String incrementId) + final String incrementId, + final String idempotencyKey) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `String` | Template, Required | The subscription Id | -| `incrementId` | `String` | Template, Required | The increment Id | +| `subscriptionId` | `String` | Template, Required | Subscription id | +| `incrementId` | `String` | Template, Required | Increment id | +| `idempotencyKey` | `String` | Header, Optional | - | ## Response Type @@ -1009,7 +1005,7 @@ String subscriptionId = "subscription_id0"; String incrementId = "increment_id8"; try { - GetIncrementResponse result = subscriptionsController.getIncrementById(subscriptionId, incrementId); + GetIncrementResponse result = subscriptionsController.deleteIncrement(subscriptionId, incrementId, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -1019,37 +1015,36 @@ try { ``` -# Delete Increment - -Deletes a increment +# Get Subscription Cycles ```java -GetIncrementResponse deleteIncrement( +ListCyclesResponse getSubscriptionCycles( final String subscriptionId, - final String incrementId, - final String idempotencyKey) + final String page, + final String size) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `String` | Template, Required | Subscription id | -| `incrementId` | `String` | Template, Required | Increment id | -| `idempotencyKey` | `String` | Header, Optional | - | +| `subscriptionId` | `String` | Template, Required | Subscription Id | +| `page` | `String` | Query, Required | Page number | +| `size` | `String` | Query, Required | Page size | ## Response Type -[`GetIncrementResponse`](../../doc/models/get-increment-response.md) +[`ListCyclesResponse`](../../doc/models/list-cycles-response.md) ## Example Usage ```java String subscriptionId = "subscription_id0"; -String incrementId = "increment_id8"; +String page = "page8"; +String size = "size0"; try { - GetIncrementResponse result = subscriptionsController.deleteIncrement(subscriptionId, incrementId, null); + ListCyclesResponse result = subscriptionsController.getSubscriptionCycles(subscriptionId, page, size); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -1098,14 +1093,14 @@ try { ``` -# Update Subscription Due Days +# Update Subscription Billing Date -Updates the boleto due days from a subscription +Updates the billing date from a subscription ```java -GetSubscriptionResponse updateSubscriptionDueDays( +GetSubscriptionResponse updateSubscriptionBillingDate( final String subscriptionId, - final UpdateSubscriptionDueDaysRequest request, + final UpdateSubscriptionBillingDateRequest request, final String idempotencyKey) ``` @@ -1113,8 +1108,8 @@ GetSubscriptionResponse updateSubscriptionDueDays( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `String` | Template, Required | Subscription Id | -| `request` | [`UpdateSubscriptionDueDaysRequest`](../../doc/models/update-subscription-due-days-request.md) | Body, Required | - | +| `subscriptionId` | `String` | Template, Required | The subscription id | +| `request` | [`UpdateSubscriptionBillingDateRequest`](../../doc/models/update-subscription-billing-date-request.md) | Body, Required | Request for updating the subscription billing date | | `idempotencyKey` | `String` | Header, Optional | - | ## Response Type @@ -1125,14 +1120,14 @@ GetSubscriptionResponse updateSubscriptionDueDays( ```java String subscriptionId = "subscription_id0"; -UpdateSubscriptionDueDaysRequest request = new UpdateSubscriptionDueDaysRequest.Builder( - 226 +UpdateSubscriptionBillingDateRequest request = new UpdateSubscriptionBillingDateRequest.Builder( + DateTimeHelper.fromRfc8601DateTime("2016-03-13T12:52:32.123Z") ) .build(); try { - GetSubscriptionResponse result = subscriptionsController.updateSubscriptionDueDays(subscriptionId, request, null); + GetSubscriptionResponse result = subscriptionsController.updateSubscriptionBillingDate(subscriptionId, request, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -1142,14 +1137,14 @@ try { ``` -# Create Subscription Item +# Delete Subscription Item -Creates a new Subscription item +Deletes a subscription item ```java -GetSubscriptionItemResponse createSubscriptionItem( +GetSubscriptionItemResponse deleteSubscriptionItem( final String subscriptionId, - final CreateSubscriptionItemRequest request, + final String subscriptionItemId, final String idempotencyKey) ``` @@ -1158,7 +1153,7 @@ GetSubscriptionItemResponse createSubscriptionItem( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `subscriptionId` | `String` | Template, Required | Subscription id | -| `request` | [`CreateSubscriptionItemRequest`](../../doc/models/create-subscription-item-request.md) | Body, Required | Request for creating a subscription item | +| `subscriptionItemId` | `String` | Template, Required | Subscription item id | | `idempotencyKey` | `String` | Header, Optional | - | ## Response Type @@ -1169,29 +1164,10 @@ GetSubscriptionItemResponse createSubscriptionItem( ```java String subscriptionId = "subscription_id0"; -CreateSubscriptionItemRequest request = new CreateSubscriptionItemRequest.Builder( - "description6", - new CreatePricingSchemeRequest.Builder( - "scheme_type8" - ) - .build(), - "id6", - "plan_item_id6", - Arrays.asList( - new CreateDiscountRequest.Builder( - 90.66D, - "discount_type2", - "item_id4" - ) - .build() - ), - "name6" -) -.build(); - +String subscriptionItemId = "subscription_item_id4"; try { - GetSubscriptionItemResponse result = subscriptionsController.createSubscriptionItem(subscriptionId, request, null); + GetSubscriptionItemResponse result = subscriptionsController.deleteSubscriptionItem(subscriptionId, subscriptionItemId, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -1201,44 +1177,34 @@ try { ``` -# Update Split Subscription +# Get Increments ```java -GetSubscriptionResponse updateSplitSubscription( - final String id, - final UpdateSubscriptionSplitRequest request) +ListIncrementsResponse getIncrements( + final String subscriptionId, + final Integer page, + final Integer size) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `id` | `String` | Template, Required | Subscription's id | -| `request` | [`UpdateSubscriptionSplitRequest`](../../doc/models/update-subscription-split-request.md) | Body, Required | - | +| `subscriptionId` | `String` | Template, Required | The subscription id | +| `page` | `Integer` | Query, Optional | Page number | +| `size` | `Integer` | Query, Optional | Page size | ## Response Type -[`GetSubscriptionResponse`](../../doc/models/get-subscription-response.md) +[`ListIncrementsResponse`](../../doc/models/list-increments-response.md) ## Example Usage ```java -String id = "id0"; -UpdateSubscriptionSplitRequest request = new UpdateSubscriptionSplitRequest.Builder( - false, - Arrays.asList( - new CreateSplitRequest.Builder( - "type2", - 118, - "recipient_id2" - ) - .build() - ) -) -.build(); - +String subscriptionId = "subscription_id0"; + try { - GetSubscriptionResponse result = subscriptionsController.updateSplitSubscription(id, request); + ListIncrementsResponse result = subscriptionsController.getIncrements(subscriptionId, null, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -1248,48 +1214,41 @@ try { ``` -# Get Subscription Items +# Update Subscription Due Days -Get Subscription Items +Updates the boleto due days from a subscription ```java -ListSubscriptionItemsResponse getSubscriptionItems( +GetSubscriptionResponse updateSubscriptionDueDays( final String subscriptionId, - final Integer page, - final Integer size, - final String name, - final String code, - final String status, - final String description, - final String createdSince, - final String createdUntil) + final UpdateSubscriptionDueDaysRequest request, + final String idempotencyKey) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `String` | Template, Required | The subscription id | -| `page` | `Integer` | Query, Optional | Page number | -| `size` | `Integer` | Query, Optional | Page size | -| `name` | `String` | Query, Optional | The item name | -| `code` | `String` | Query, Optional | Identification code in the client system | -| `status` | `String` | Query, Optional | The item statis | -| `description` | `String` | Query, Optional | The item description | -| `createdSince` | `String` | Query, Optional | Filter for item's creation date start range | -| `createdUntil` | `String` | Query, Optional | Filter for item's creation date end range | +| `subscriptionId` | `String` | Template, Required | Subscription Id | +| `request` | [`UpdateSubscriptionDueDaysRequest`](../../doc/models/update-subscription-due-days-request.md) | Body, Required | - | +| `idempotencyKey` | `String` | Header, Optional | - | ## Response Type -[`ListSubscriptionItemsResponse`](../../doc/models/list-subscription-items-response.md) +[`GetSubscriptionResponse`](../../doc/models/get-subscription-response.md) ## Example Usage ```java String subscriptionId = "subscription_id0"; +UpdateSubscriptionDueDaysRequest request = new UpdateSubscriptionDueDaysRequest.Builder( + 226 +) +.build(); + try { - ListSubscriptionItemsResponse result = subscriptionsController.getSubscriptionItems(subscriptionId, null, null, null, null, null, null, null, null); + GetSubscriptionResponse result = subscriptionsController.updateSubscriptionDueDays(subscriptionId, request, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -1299,52 +1258,101 @@ try { ``` -# Get Subscriptions +# Update Subscription Start At -Gets all subscriptions +Updates the start at date from a subscription ```java -ListSubscriptionsResponse getSubscriptions( - final Integer page, - final Integer size, - final String code, - final String billingType, - final String customerId, - final String planId, - final String cardId, - final String status, - final LocalDateTime nextBillingSince, - final LocalDateTime nextBillingUntil, - final LocalDateTime createdSince, - final LocalDateTime createdUntil) +GetSubscriptionResponse updateSubscriptionStartAt( + final String subscriptionId, + final UpdateSubscriptionStartAtRequest request, + final String idempotencyKey) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `page` | `Integer` | Query, Optional | Page number | -| `size` | `Integer` | Query, Optional | Page size | -| `code` | `String` | Query, Optional | Filter for subscription's code | -| `billingType` | `String` | Query, Optional | Filter for subscription's billing type | -| `customerId` | `String` | Query, Optional | Filter for subscription's customer id | -| `planId` | `String` | Query, Optional | Filter for subscription's plan id | -| `cardId` | `String` | Query, Optional | Filter for subscription's card id | -| `status` | `String` | Query, Optional | Filter for subscription's status | -| `nextBillingSince` | `LocalDateTime` | Query, Optional | Filter for subscription's next billing date start range | -| `nextBillingUntil` | `LocalDateTime` | Query, Optional | Filter for subscription's next billing date end range | -| `createdSince` | `LocalDateTime` | Query, Optional | Filter for subscription's creation date start range | -| `createdUntil` | `LocalDateTime` | Query, Optional | Filter for subscriptions creation date end range | +| `subscriptionId` | `String` | Template, Required | The subscription id | +| `request` | [`UpdateSubscriptionStartAtRequest`](../../doc/models/update-subscription-start-at-request.md) | Body, Required | Request for updating the subscription start date | +| `idempotencyKey` | `String` | Header, Optional | - | + +## Response Type + +[`GetSubscriptionResponse`](../../doc/models/get-subscription-response.md) + +## Example Usage + +```java +String subscriptionId = "subscription_id0"; +UpdateSubscriptionStartAtRequest request = new UpdateSubscriptionStartAtRequest.Builder( + DateTimeHelper.fromRfc8601DateTime("2016-03-13T12:52:32.123Z") +) +.build(); + + +try { + GetSubscriptionResponse result = subscriptionsController.updateSubscriptionStartAt(subscriptionId, request, null); + System.out.println(result); +} catch (ApiException e) { + e.printStackTrace(); +} catch (IOException e) { + e.printStackTrace(); +} +``` + + +# Update Subscription Item + +Updates a subscription item + +```java +GetSubscriptionItemResponse updateSubscriptionItem( + final String subscriptionId, + final String itemId, + final UpdateSubscriptionItemRequest body, + final String idempotencyKey) +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `subscriptionId` | `String` | Template, Required | Subscription Id | +| `itemId` | `String` | Template, Required | Item id | +| `body` | [`UpdateSubscriptionItemRequest`](../../doc/models/update-subscription-item-request.md) | Body, Required | Request for updating a subscription item | +| `idempotencyKey` | `String` | Header, Optional | - | ## Response Type -[`ListSubscriptionsResponse`](../../doc/models/list-subscriptions-response.md) +[`GetSubscriptionItemResponse`](../../doc/models/get-subscription-item-response.md) ## Example Usage ```java +String subscriptionId = "subscription_id0"; +String itemId = "item_id0"; +UpdateSubscriptionItemRequest body = new UpdateSubscriptionItemRequest.Builder( + "description4", + "status2", + new UpdatePricingSchemeRequest.Builder( + "scheme_type8", + Arrays.asList( + new UpdatePriceBracketRequest.Builder( + 144, + 174 + ) + .build() + ) + ) + .build(), + "name6" +) +.build(); + + try { - ListSubscriptionsResponse result = subscriptionsController.getSubscriptions(null, null, null, null, null, null, null, null, null, null, null, null); + GetSubscriptionItemResponse result = subscriptionsController.updateSubscriptionItem(subscriptionId, itemId, body, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -1354,14 +1362,14 @@ try { ``` -# Create Increment +# Create Subscription Item -Creates a increment +Creates a new Subscription item ```java -GetIncrementResponse createIncrement( +GetSubscriptionItemResponse createSubscriptionItem( final String subscriptionId, - final CreateIncrementRequest request, + final CreateSubscriptionItemRequest request, final String idempotencyKey) ``` @@ -1370,27 +1378,40 @@ GetIncrementResponse createIncrement( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `subscriptionId` | `String` | Template, Required | Subscription id | -| `request` | [`CreateIncrementRequest`](../../doc/models/create-increment-request.md) | Body, Required | Request for creating a increment | +| `request` | [`CreateSubscriptionItemRequest`](../../doc/models/create-subscription-item-request.md) | Body, Required | Request for creating a subscription item | | `idempotencyKey` | `String` | Header, Optional | - | ## Response Type -[`GetIncrementResponse`](../../doc/models/get-increment-response.md) +[`GetSubscriptionItemResponse`](../../doc/models/get-subscription-item-response.md) ## Example Usage ```java String subscriptionId = "subscription_id0"; -CreateIncrementRequest request = new CreateIncrementRequest.Builder( - 185.28D, - "increment_type8", - "item_id6" +CreateSubscriptionItemRequest request = new CreateSubscriptionItemRequest.Builder( + "description6", + new CreatePricingSchemeRequest.Builder( + "scheme_type8" + ) + .build(), + "id6", + "plan_item_id6", + Arrays.asList( + new CreateDiscountRequest.Builder( + 90.66D, + "discount_type2", + "item_id4" + ) + .build() + ), + "name6" ) .build(); try { - GetIncrementResponse result = subscriptionsController.createIncrement(subscriptionId, request, null); + GetSubscriptionItemResponse result = subscriptionsController.createSubscriptionItem(subscriptionId, request, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -1400,46 +1421,32 @@ try { ``` -# Create Usage +# Get Subscription -Creates a usage +Gets a subscription ```java -GetUsageResponse createUsage( - final String subscriptionId, - final String itemId, - final CreateUsageRequest body, - final String idempotencyKey) +GetSubscriptionResponse getSubscription( + final String subscriptionId) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `String` | Template, Required | Subscription Id | -| `itemId` | `String` | Template, Required | Item id | -| `body` | [`CreateUsageRequest`](../../doc/models/create-usage-request.md) | Body, Required | Request for creating a usage | -| `idempotencyKey` | `String` | Header, Optional | - | +| `subscriptionId` | `String` | Template, Required | Subscription id | ## Response Type -[`GetUsageResponse`](../../doc/models/get-usage-response.md) +[`GetSubscriptionResponse`](../../doc/models/get-subscription-response.md) ## Example Usage ```java String subscriptionId = "subscription_id0"; -String itemId = "item_id0"; -CreateUsageRequest body = new CreateUsageRequest.Builder( - 156, - "description4", - DateTimeHelper.fromRfc8601DateTime("2016-03-13T12:52:32.123Z") -) -.build(); - try { - GetUsageResponse result = subscriptionsController.createUsage(subscriptionId, itemId, body, null); + GetSubscriptionResponse result = subscriptionsController.getSubscription(subscriptionId); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -1449,12 +1456,20 @@ try { ``` -# Get Discount by Id +# Get Usages + +Lists all usages from a subscription item ```java -GetDiscountResponse getDiscountById( +ListUsagesResponse getUsages( final String subscriptionId, - final String discountId) + final String itemId, + final Integer page, + final Integer size, + final String code, + final String group, + final LocalDateTime usedSince, + final LocalDateTime usedUntil) ``` ## Parameters @@ -1462,20 +1477,26 @@ GetDiscountResponse getDiscountById( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `subscriptionId` | `String` | Template, Required | The subscription id | -| `discountId` | `String` | Template, Required | - | +| `itemId` | `String` | Template, Required | The subscription item id | +| `page` | `Integer` | Query, Optional | Page number | +| `size` | `Integer` | Query, Optional | Page size | +| `code` | `String` | Query, Optional | Identification code in the client system | +| `group` | `String` | Query, Optional | Identification group in the client system | +| `usedSince` | `LocalDateTime` | Query, Optional | - | +| `usedUntil` | `LocalDateTime` | Query, Optional | - | ## Response Type -[`GetDiscountResponse`](../../doc/models/get-discount-response.md) +[`ListUsagesResponse`](../../doc/models/list-usages-response.md) ## Example Usage ```java String subscriptionId = "subscription_id0"; -String discountId = "discountId0"; +String itemId = "item_id0"; try { - GetDiscountResponse result = subscriptionsController.getDiscountById(subscriptionId, discountId); + ListUsagesResponse result = subscriptionsController.getUsages(subscriptionId, itemId, null, null, null, null, null, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -1485,14 +1506,12 @@ try { ``` -# Update Subscription Metadata - -Updates the metadata from a subscription +# Update Latest Period End At ```java -GetSubscriptionResponse updateSubscriptionMetadata( +GetSubscriptionResponse updateLatestPeriodEndAt( final String subscriptionId, - final UpdateMetadataRequest request, + final UpdateCurrentCycleEndDateRequest request, final String idempotencyKey) ``` @@ -1500,8 +1519,8 @@ GetSubscriptionResponse updateSubscriptionMetadata( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `String` | Template, Required | The subscription id | -| `request` | [`UpdateMetadataRequest`](../../doc/models/update-metadata-request.md) | Body, Required | Request for updating the subscrption metadata | +| `subscriptionId` | `String` | 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 | | `idempotencyKey` | `String` | Header, Optional | - | ## Response Type @@ -1512,16 +1531,12 @@ GetSubscriptionResponse updateSubscriptionMetadata( ```java String subscriptionId = "subscription_id0"; -UpdateMetadataRequest request = new UpdateMetadataRequest.Builder( - new LinkedHashMap() {{ - put("key0", "metadata3"); - }} -) -.build(); +UpdateCurrentCycleEndDateRequest request = new UpdateCurrentCycleEndDateRequest.Builder() + .build(); try { - GetSubscriptionResponse result = subscriptionsController.updateSubscriptionMetadata(subscriptionId, request, null); + GetSubscriptionResponse result = subscriptionsController.updateLatestPeriodEndAt(subscriptionId, request, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -1531,13 +1546,15 @@ try { ``` -# Get Subscription Cycles +# Update Subscription Minium Price + +Atualização do valor mínimo da assinatura ```java -ListCyclesResponse getSubscriptionCycles( +GetSubscriptionResponse updateSubscriptionMiniumPrice( final String subscriptionId, - final String page, - final String size) + final UpdateSubscriptionMinimumPriceRequest request, + final String idempotencyKey) ``` ## Parameters @@ -1545,22 +1562,23 @@ ListCyclesResponse getSubscriptionCycles( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `subscriptionId` | `String` | Template, Required | Subscription Id | -| `page` | `String` | Query, Required | Page number | -| `size` | `String` | Query, Required | Page size | +| `request` | [`UpdateSubscriptionMinimumPriceRequest`](../../doc/models/update-subscription-minimum-price-request.md) | Body, Required | Request da requisição com o valor mínimo que será configurado | +| `idempotencyKey` | `String` | Header, Optional | - | ## Response Type -[`ListCyclesResponse`](../../doc/models/list-cycles-response.md) +[`GetSubscriptionResponse`](../../doc/models/get-subscription-response.md) ## Example Usage ```java String subscriptionId = "subscription_id0"; -String page = "page8"; -String size = "size0"; +UpdateSubscriptionMinimumPriceRequest request = new UpdateSubscriptionMinimumPriceRequest.Builder() + .build(); + try { - ListCyclesResponse result = subscriptionsController.getSubscriptionCycles(subscriptionId, page, size); + GetSubscriptionResponse result = subscriptionsController.updateSubscriptionMiniumPrice(subscriptionId, request, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -1570,37 +1588,33 @@ try { ``` -# Delete Subscription Item - -Deletes a subscription item +# Get Subscription Cycle by Id ```java -GetSubscriptionItemResponse deleteSubscriptionItem( +GetPeriodResponse getSubscriptionCycleById( final String subscriptionId, - final String subscriptionItemId, - final String idempotencyKey) + final String cycleId) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `String` | Template, Required | Subscription id | -| `subscriptionItemId` | `String` | Template, Required | Subscription item id | -| `idempotencyKey` | `String` | Header, Optional | - | +| `subscriptionId` | `String` | Template, Required | The subscription id | +| `cycleId` | `String` | Template, Required | - | ## Response Type -[`GetSubscriptionItemResponse`](../../doc/models/get-subscription-item-response.md) +[`GetPeriodResponse`](../../doc/models/get-period-response.md) ## Example Usage ```java String subscriptionId = "subscription_id0"; -String subscriptionItemId = "subscription_item_id4"; +String cycleId = "cycleId0"; try { - GetSubscriptionItemResponse result = subscriptionsController.deleteSubscriptionItem(subscriptionId, subscriptionItemId, null); + GetPeriodResponse result = subscriptionsController.getSubscriptionCycleById(subscriptionId, cycleId); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -1610,34 +1624,33 @@ try { ``` -# Get Increments +# Get Usage Report ```java -ListIncrementsResponse getIncrements( +GetUsageReportResponse getUsageReport( final String subscriptionId, - final Integer page, - final Integer size) + final String periodId) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `String` | Template, Required | The subscription id | -| `page` | `Integer` | Query, Optional | Page number | -| `size` | `Integer` | Query, Optional | Page size | +| `subscriptionId` | `String` | Template, Required | The subscription Id | +| `periodId` | `String` | Template, Required | The period Id | ## Response Type -[`ListIncrementsResponse`](../../doc/models/list-increments-response.md) +[`GetUsageReportResponse`](../../doc/models/get-usage-report-response.md) ## Example Usage ```java String subscriptionId = "subscription_id0"; +String periodId = "period_id0"; try { - ListIncrementsResponse result = subscriptionsController.getIncrements(subscriptionId, null, null); + GetUsageReportResponse result = subscriptionsController.getUsageReport(subscriptionId, periodId); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -1647,57 +1660,44 @@ try { ``` -# Update Subscription Item - -Updates a subscription item +# Update Split Subscription ```java -GetSubscriptionItemResponse updateSubscriptionItem( - final String subscriptionId, - final String itemId, - final UpdateSubscriptionItemRequest body, - final String idempotencyKey) +GetSubscriptionResponse updateSplitSubscription( + final String id, + final UpdateSubscriptionSplitRequest request) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `String` | Template, Required | Subscription Id | -| `itemId` | `String` | Template, Required | Item id | -| `body` | [`UpdateSubscriptionItemRequest`](../../doc/models/update-subscription-item-request.md) | Body, Required | Request for updating a subscription item | -| `idempotencyKey` | `String` | Header, Optional | - | +| `id` | `String` | Template, Required | Subscription's id | +| `request` | [`UpdateSubscriptionSplitRequest`](../../doc/models/update-subscription-split-request.md) | Body, Required | - | ## Response Type -[`GetSubscriptionItemResponse`](../../doc/models/get-subscription-item-response.md) +[`GetSubscriptionResponse`](../../doc/models/get-subscription-response.md) ## Example Usage ```java -String subscriptionId = "subscription_id0"; -String itemId = "item_id0"; -UpdateSubscriptionItemRequest body = new UpdateSubscriptionItemRequest.Builder( - "description4", - "status2", - new UpdatePricingSchemeRequest.Builder( - "scheme_type8", - Arrays.asList( - new UpdatePriceBracketRequest.Builder( - 144, - 174 - ) - .build() +String id = "id0"; +UpdateSubscriptionSplitRequest request = new UpdateSubscriptionSplitRequest.Builder( + false, + Arrays.asList( + new CreateSplitRequest.Builder( + "type2", + 118, + "recipient_id2" ) + .build() ) - .build(), - "name6" ) .build(); - try { - GetSubscriptionItemResponse result = subscriptionsController.updateSubscriptionItem(subscriptionId, itemId, body, null); + GetSubscriptionResponse result = subscriptionsController.updateSplitSubscription(id, request); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); diff --git a/doc/controllers/tokens.md b/doc/controllers/tokens.md index c107bbe..5e92abf 100644 --- a/doc/controllers/tokens.md +++ b/doc/controllers/tokens.md @@ -10,28 +10,28 @@ TokensController tokensController = client.getTokensController(); ## Methods -* [Get Token](../../doc/controllers/tokens.md#get-token) -* [Create Token](../../doc/controllers/tokens.md#create-token) +* [Create Token](../../doc/controllers/tokens.md#create-token) +* [Get Token](../../doc/controllers/tokens.md#get-token) -# Get Token - -Gets a token from its id +# Create Token :information_source: **Note** This endpoint does not require authentication. ```java -GetTokenResponse getToken( - final String id, - final String publicKey) +GetTokenResponse createToken( + final String publicKey, + final CreateTokenRequest request, + final String idempotencyKey) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `id` | `String` | Template, Required | Token id | | `publicKey` | `String` | Template, Required | Public key | +| `request` | [`CreateTokenRequest`](../../doc/models/create-token-request.md) | Body, Required | Request for creating a token | +| `idempotencyKey` | `String` | Header, Optional | - | ## Response Type @@ -40,11 +40,25 @@ GetTokenResponse getToken( ## Example Usage ```java -String id = "id0"; String publicKey = "public_key6"; +CreateTokenRequest request = new CreateTokenRequest.Builder( + "card", + new CreateCardTokenRequest.Builder( + "number6", + "holder_name2", + 228, + 68, + "cvv4", + "brand0", + "label6" + ) + .build() +) +.build(); + try { - GetTokenResponse result = tokensController.getToken(id, publicKey); + GetTokenResponse result = tokensController.createToken(publicKey, request, null); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -54,24 +68,24 @@ try { ``` -# Create Token +# Get Token + +Gets a token from its id :information_source: **Note** This endpoint does not require authentication. ```java -GetTokenResponse createToken( - final String publicKey, - final CreateTokenRequest request, - final String idempotencyKey) +GetTokenResponse getToken( + final String id, + final String publicKey) ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | +| `id` | `String` | Template, Required | Token id | | `publicKey` | `String` | Template, Required | Public key | -| `request` | [`CreateTokenRequest`](../../doc/models/create-token-request.md) | Body, Required | Request for creating a token | -| `idempotencyKey` | `String` | Header, Optional | - | ## Response Type @@ -80,25 +94,11 @@ GetTokenResponse createToken( ## Example Usage ```java +String id = "id0"; String publicKey = "public_key6"; -CreateTokenRequest request = new CreateTokenRequest.Builder( - "card", - new CreateCardTokenRequest.Builder( - "number6", - "holder_name2", - 228, - 68, - "cvv4", - "brand0", - "label6" - ) - .build() -) -.build(); - try { - GetTokenResponse result = tokensController.createToken(publicKey, request, null); + GetTokenResponse result = tokensController.getToken(id, publicKey); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); diff --git a/doc/controllers/transfers.md b/doc/controllers/transfers.md index 55a294a..f0ff452 100644 --- a/doc/controllers/transfers.md +++ b/doc/controllers/transfers.md @@ -11,8 +11,8 @@ TransfersController transfersController = client.getTransfersController(); ## Methods * [Get Transfer by Id](../../doc/controllers/transfers.md#get-transfer-by-id) -* [Get Transfers](../../doc/controllers/transfers.md#get-transfers) -* [Create Transfer](../../doc/controllers/transfers.md#create-transfer) +* [Create Transfer](../../doc/controllers/transfers.md#create-transfer) +* [Get Transfers](../../doc/controllers/transfers.md#get-transfers) # Get Transfer by Id @@ -48,23 +48,35 @@ try { ``` -# Get Transfers - -Gets all transfers +# Create Transfer ```java -ListTransfers getTransfers() +GetTransfer createTransfer( + final CreateTransfer request) ``` +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `request` | [`CreateTransfer`](../../doc/models/create-transfer.md) | Body, Required | - | + ## Response Type -[`ListTransfers`](../../doc/models/list-transfers.md) +[`GetTransfer`](../../doc/models/get-transfer.md) ## Example Usage ```java +CreateTransfer request = new CreateTransfer.Builder( + 242, + "source_id0", + "target_id6" +) +.build(); + try { - ListTransfers result = transfersController.getTransfers(); + GetTransfer result = transfersController.createTransfer(request); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); @@ -74,35 +86,23 @@ try { ``` -# Create Transfer +# Get Transfers + +Gets all transfers ```java -GetTransfer createTransfer( - final CreateTransfer request) +ListTransfers getTransfers() ``` -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `request` | [`CreateTransfer`](../../doc/models/create-transfer.md) | Body, Required | - | - ## Response Type -[`GetTransfer`](../../doc/models/get-transfer.md) +[`ListTransfers`](../../doc/models/list-transfers.md) ## Example Usage ```java -CreateTransfer request = new CreateTransfer.Builder( - 242, - "source_id0", - "target_id6" -) -.build(); - try { - GetTransfer result = transfersController.createTransfer(request); + ListTransfers result = transfersController.getTransfers(); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); diff --git a/doc/models/create-customer-request.md b/doc/models/create-customer-request.md index 7ea2e88..73687aa 100644 --- a/doc/models/create-customer-request.md +++ b/doc/models/create-customer-request.md @@ -26,7 +26,7 @@ Request for creating a new customer ```json { - "name": "{\n \"name\": \"Tony Stark\"\n}", + "name": "Tony Stark", "email": "email8", "document": "document8", "type": "type2", diff --git a/doc/models/create-kyc-link-response.md b/doc/models/create-kyc-link-response.md new file mode 100644 index 0000000..162fe05 --- /dev/null +++ b/doc/models/create-kyc-link-response.md @@ -0,0 +1,27 @@ + +# Create KYC Link Response + +KYC Link + +## Structure + +`CreateKYCLinkResponse` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `Base64` | `String` | Optional | Base64 | String getBase64() | setBase64(String base64) | +| `Url` | `String` | Optional | URL | String getUrl() | setUrl(String url) | +| `ExpirationDate` | `String` | Optional | Expiration Date | String getExpirationDate() | setExpirationDate(String expirationDate) | + +## Example (as JSON) + +```json +{ + "base64": "base644", + "url": "url0", + "expiration_date": "expiration_date0" +} +``` + diff --git a/doc/models/create-order-request.md b/doc/models/create-order-request.md index 496f52e..22c2bee 100644 --- a/doc/models/create-order-request.md +++ b/doc/models/create-order-request.md @@ -42,7 +42,7 @@ Request for creating an order } ], "customer": { - "name": "{\n \"name\": \"Tony Stark\"\n}", + "name": "Tony Stark", "email": "email6", "document": "document6", "type": "type0", diff --git a/doc/models/create-subscription-request.md b/doc/models/create-subscription-request.md index 39ae524..457b372 100644 --- a/doc/models/create-subscription-request.md +++ b/doc/models/create-subscription-request.md @@ -50,7 +50,7 @@ Request for creating a subcription ```json { "customer": { - "name": "{\n \"name\": \"Tony Stark\"\n}", + "name": "Tony Stark", "email": "email6", "document": "document6", "type": "type0", diff --git a/pom.xml b/pom.xml index 8e2e205..edae9df 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ 4.0.0 PagarmeApiSDKLib pagarme-api-sdklib - 6.8.7 + 6.8.8 jar PagarmeApiSDKLib @@ -20,17 +20,17 @@ io.apimatic core-interfaces - [0.2, 0.3) + [0.3, 0.4) io.apimatic core - [0.5, 0.6) + [0.6, 0.7) io.apimatic okhttp-client-adapter - [0.2, 0.3) + [0.3, 0.4) diff --git a/src/main/java/me/pagar/api/Environment.java b/src/main/java/me/pagar/api/Environment.java index a95f9ed..80b41bf 100644 --- a/src/main/java/me/pagar/api/Environment.java +++ b/src/main/java/me/pagar/api/Environment.java @@ -38,8 +38,7 @@ public enum Environment { @JsonCreator public static Environment constructFromString(String toConvert) throws IOException { Environment enumValue = fromString(toConvert); - if (enumValue == null) - { + if (enumValue == null) { throw new IOException("Unable to create enum instance with value: " + toConvert); } return enumValue; diff --git a/src/main/java/me/pagar/api/PagarmeApiSDKClient.java b/src/main/java/me/pagar/api/PagarmeApiSDKClient.java index 0081f5f..982709f 100644 --- a/src/main/java/me/pagar/api/PagarmeApiSDKClient.java +++ b/src/main/java/me/pagar/api/PagarmeApiSDKClient.java @@ -14,6 +14,7 @@ import java.util.HashMap; import java.util.Map; import java.util.function.Consumer; +import java.util.function.Supplier; import me.pagar.api.authentication.BasicAuthManager; import me.pagar.api.authentication.BasicAuthModel; import me.pagar.api.controllers.BalanceOperationsController; @@ -68,7 +69,7 @@ public final class PagarmeApiSDKClient implements PagarmeApiSDKClientInterface { private static final CompatibilityFactory compatibilityFactory = new CompatibilityFactoryImpl(); - private static String userAgent = "PagarmeApiSDK - Java 6.8.7"; + private static String userAgent = "PagarmeApiSDK - Java 6.8.8"; /** * Current API environment. @@ -103,29 +104,20 @@ public final class PagarmeApiSDKClient implements PagarmeApiSDKClientInterface { /** * Map of authentication Managers. */ - private Map authentications; + private Map authentications = new HashMap(); private PagarmeApiSDKClient(Environment environment, String serviceRefererName, HttpClient httpClient, ReadonlyHttpClientConfiguration httpClientConfig, - BasicAuthModel basicAuthModel, Map authentications) { + BasicAuthModel basicAuthModel) { this.environment = environment; this.serviceRefererName = serviceRefererName; this.httpClient = httpClient; this.httpClientConfig = httpClientConfig; - this.authentications = - (authentications == null) ? new HashMap<>() : new HashMap<>(authentications); - this.basicAuthModel = basicAuthModel; - if (this.authentications.containsKey("httpBasic")) { - this.basicAuthManager = (BasicAuthManager) this.authentications.get("httpBasic"); - } + this.basicAuthModel = basicAuthModel; - if (!this.authentications.containsKey("httpBasic") - || !getBasicAuthCredentials().equals(basicAuthModel.getUsername(), - basicAuthModel.getPassword())) { - this.basicAuthManager = new BasicAuthManager(basicAuthModel); - this.authentications.put("httpBasic", basicAuthManager); - } + this.basicAuthManager = new BasicAuthManager(basicAuthModel); + this.authentications.put("httpBasic", basicAuthManager); GlobalConfiguration globalConfig = new GlobalConfiguration.Builder() .httpClient(httpClient).baseUri(server -> getBaseUri(server)) @@ -377,9 +369,7 @@ public Builder newBuilder() { builder.httpClient = getHttpClient(); builder.basicAuthCredentials(getBasicAuthModel() .toBuilder().build()); - builder.authentications = authentications; - builder.httpClientConfig(configBldr -> configBldr = - ((HttpClientConfiguration) httpClientConfig).newBuilder()); + builder.httpClientConfig(() -> ((HttpClientConfiguration) httpClientConfig).newBuilder()); return builder; } @@ -392,7 +382,6 @@ public static class Builder { private String serviceRefererName = ""; private HttpClient httpClient; private BasicAuthModel basicAuthModel = new BasicAuthModel.Builder("", "").build(); - private Map authentications = null; private HttpClientConfiguration.Builder httpClientConfigBuilder = new HttpClientConfiguration.Builder(); @@ -472,6 +461,18 @@ public Builder httpClientConfig(Consumer action return this; } + /** + * Private Setter for the Builder of httpClientConfiguration, takes in an operation to be performed + * on the builder instance of HTTP client configuration. + * + * @param supplier Supplier for the builder of httpClientConfiguration. + * @return Builder + */ + private Builder httpClientConfig(Supplier supplier) { + httpClientConfigBuilder = supplier.get(); + return this; + } + /** * Builds a new PagarmeApiSDKClient object using the set fields. * @return PagarmeApiSDKClient @@ -481,7 +482,7 @@ public PagarmeApiSDKClient build() { httpClient = new OkClient(httpClientConfig.getConfiguration(), compatibilityFactory); return new PagarmeApiSDKClient(environment, serviceRefererName, httpClient, - httpClientConfig, basicAuthModel, authentications); + httpClientConfig, basicAuthModel); } } } \ No newline at end of file diff --git a/src/main/java/me/pagar/api/Server.java b/src/main/java/me/pagar/api/Server.java index 3aefaa0..859bde8 100644 --- a/src/main/java/me/pagar/api/Server.java +++ b/src/main/java/me/pagar/api/Server.java @@ -38,8 +38,7 @@ public enum Server { @JsonCreator public static Server constructFromString(String toConvert) throws IOException { Server enumValue = fromString(toConvert); - if (enumValue == null) - { + if (enumValue == null) { throw new IOException("Unable to create enum instance with value: " + toConvert); } return enumValue; diff --git a/src/main/java/me/pagar/api/controllers/BalanceOperationsController.java b/src/main/java/me/pagar/api/controllers/BalanceOperationsController.java index cfc4fe1..b11f83e 100644 --- a/src/main/java/me/pagar/api/controllers/BalanceOperationsController.java +++ b/src/main/java/me/pagar/api/controllers/BalanceOperationsController.java @@ -17,15 +17,6 @@ * This can be overridden for the mock calls. */ public interface BalanceOperationsController { - /** - * @param id Required parameter: Example: - * @return Returns the GetBalanceOperationResponse response from the API call - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - GetBalanceOperationResponse getBalanceOperationById( - final long id) throws ApiException, IOException; - /** * @param status Optional parameter: Example: * @param createdSince Optional parameter: Example: @@ -41,4 +32,13 @@ ListBalanceOperationResponse getBalanceOperations( final LocalDateTime createdUntil, final String recipientId) throws ApiException, IOException; + /** + * @param id Required parameter: Example: + * @return Returns the GetBalanceOperationResponse response from the API call + * @throws ApiException Represents error response from the server. + * @throws IOException Signals that an I/O exception of some sort has occurred. + */ + GetBalanceOperationResponse getBalanceOperationById( + final long id) throws ApiException, IOException; + } \ No newline at end of file diff --git a/src/main/java/me/pagar/api/controllers/ChargesController.java b/src/main/java/me/pagar/api/controllers/ChargesController.java index 02470ca..062ec69 100644 --- a/src/main/java/me/pagar/api/controllers/ChargesController.java +++ b/src/main/java/me/pagar/api/controllers/ChargesController.java @@ -42,108 +42,111 @@ GetChargeResponse updateChargeMetadata( final String idempotencyKey) throws ApiException, IOException; /** - * Captures a charge. + * Updates a charge's payment method. * @param chargeId Required parameter: Charge id - * @param request Optional parameter: Request for capturing a charge + * @param request Required parameter: Request for updating the payment method from a charge * @param idempotencyKey Optional parameter: Example: * @return Returns the GetChargeResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - GetChargeResponse captureCharge( + GetChargeResponse updateChargePaymentMethod( final String chargeId, - final CreateCaptureChargeRequest request, + final UpdateChargePaymentMethodRequest request, final String idempotencyKey) throws ApiException, IOException; /** - * Get a charge from its id. - * @param chargeId Required parameter: Charge id - * @return Returns the GetChargeResponse response from the API call + * @param chargeId Required parameter: Charge Id + * @param page Optional parameter: Page number + * @param size Optional parameter: Page size + * @return Returns the ListChargeTransactionsResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - GetChargeResponse getCharge( - final String chargeId) throws ApiException, IOException; + ListChargeTransactionsResponse getChargeTransactions( + final String chargeId, + final Integer page, + final Integer size) throws ApiException, IOException; /** - * @param chargeId Required parameter: Example: - * @param request Optional parameter: Request for confirm payment + * Updates the due date from a charge. + * @param chargeId Required parameter: Charge Id + * @param request Required parameter: Request for updating the due date * @param idempotencyKey Optional parameter: Example: * @return Returns the GetChargeResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - GetChargeResponse confirmPayment( + GetChargeResponse updateChargeDueDate( final String chargeId, - final CreateConfirmPaymentRequest request, + final UpdateChargeDueDateRequest request, final String idempotencyKey) throws ApiException, IOException; /** - * @param chargeId Required parameter: Charge Id + * Lists all charges. * @param page Optional parameter: Page number * @param size Optional parameter: Page size - * @return Returns the ListChargeTransactionsResponse response from the API call + * @param code Optional parameter: Filter for charge's code + * @param status Optional parameter: Filter for charge's status + * @param paymentMethod Optional parameter: Filter for charge's payment method + * @param customerId Optional parameter: Filter for charge's customer id + * @param orderId Optional parameter: Filter for charge's order id + * @param createdSince Optional parameter: Filter for the beginning of the range for charge's + * creation + * @param createdUntil Optional parameter: Filter for the end of the range for charge's + * creation + * @return Returns the ListChargesResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - ListChargeTransactionsResponse getChargeTransactions( - final String chargeId, + ListChargesResponse getCharges( final Integer page, - final Integer size) throws ApiException, IOException; + final Integer size, + final String code, + final String status, + final String paymentMethod, + final String customerId, + final String orderId, + final LocalDateTime createdSince, + final LocalDateTime createdUntil) throws ApiException, IOException; /** - * Updates the card from a charge. + * Captures a charge. * @param chargeId Required parameter: Charge id - * @param request Required parameter: Request for updating a charge's card + * @param request Optional parameter: Request for capturing a charge * @param idempotencyKey Optional parameter: Example: * @return Returns the GetChargeResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - GetChargeResponse updateChargeCard( + GetChargeResponse captureCharge( final String chargeId, - final UpdateChargeCardRequest request, - final String idempotencyKey) throws ApiException, IOException; - - /** - * Creates a new charge. - * @param request Required parameter: Request for creating a charge - * @param idempotencyKey Optional parameter: Example: - * @return Returns the GetChargeResponse response from the API call - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - GetChargeResponse createCharge( - final CreateChargeRequest request, + final CreateCaptureChargeRequest request, final String idempotencyKey) throws ApiException, IOException; /** - * Updates a charge's payment method. + * Updates the card from a charge. * @param chargeId Required parameter: Charge id - * @param request Required parameter: Request for updating the payment method from a charge + * @param request Required parameter: Request for updating a charge's card * @param idempotencyKey Optional parameter: Example: * @return Returns the GetChargeResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - GetChargeResponse updateChargePaymentMethod( + GetChargeResponse updateChargeCard( final String chargeId, - final UpdateChargePaymentMethodRequest request, + final UpdateChargeCardRequest request, final String idempotencyKey) throws ApiException, IOException; /** - * Updates the due date from a charge. - * @param chargeId Required parameter: Charge Id - * @param request Required parameter: Request for updating the due date - * @param idempotencyKey Optional parameter: Example: + * Get a charge from its id. + * @param chargeId Required parameter: Charge id * @return Returns the GetChargeResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - GetChargeResponse updateChargeDueDate( - final String chargeId, - final UpdateChargeDueDateRequest request, - final String idempotencyKey) throws ApiException, IOException; + GetChargeResponse getCharge( + final String chargeId) throws ApiException, IOException; /** * @param status Required parameter: Example: @@ -170,34 +173,6 @@ GetChargeResponse retryCharge( final String chargeId, final String idempotencyKey) throws ApiException, IOException; - /** - * Lists all charges. - * @param page Optional parameter: Page number - * @param size Optional parameter: Page size - * @param code Optional parameter: Filter for charge's code - * @param status Optional parameter: Filter for charge's status - * @param paymentMethod Optional parameter: Filter for charge's payment method - * @param customerId Optional parameter: Filter for charge's customer id - * @param orderId Optional parameter: Filter for charge's order id - * @param createdSince Optional parameter: Filter for the beginning of the range for charge's - * creation - * @param createdUntil Optional parameter: Filter for the end of the range for charge's - * creation - * @return Returns the ListChargesResponse response from the API call - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - ListChargesResponse getCharges( - final Integer page, - final Integer size, - final String code, - final String status, - final String paymentMethod, - final String customerId, - final String orderId, - final LocalDateTime createdSince, - final LocalDateTime createdUntil) throws ApiException, IOException; - /** * Cancel a charge. * @param chargeId Required parameter: Charge id @@ -212,4 +187,29 @@ GetChargeResponse cancelCharge( final CreateCancelChargeRequest request, final String idempotencyKey) throws ApiException, IOException; + /** + * Creates a new charge. + * @param request Required parameter: Request for creating a charge + * @param idempotencyKey Optional parameter: Example: + * @return Returns the GetChargeResponse response from the API call + * @throws ApiException Represents error response from the server. + * @throws IOException Signals that an I/O exception of some sort has occurred. + */ + GetChargeResponse createCharge( + final CreateChargeRequest request, + final String idempotencyKey) throws ApiException, IOException; + + /** + * @param chargeId Required parameter: Example: + * @param request Optional parameter: Request for confirm payment + * @param idempotencyKey Optional parameter: Example: + * @return Returns the GetChargeResponse response from the API call + * @throws ApiException Represents error response from the server. + * @throws IOException Signals that an I/O exception of some sort has occurred. + */ + GetChargeResponse confirmPayment( + final String chargeId, + final CreateConfirmPaymentRequest request, + final String idempotencyKey) throws ApiException, IOException; + } \ No newline at end of file diff --git a/src/main/java/me/pagar/api/controllers/CustomersController.java b/src/main/java/me/pagar/api/controllers/CustomersController.java index 5629763..8e80fe8 100644 --- a/src/main/java/me/pagar/api/controllers/CustomersController.java +++ b/src/main/java/me/pagar/api/controllers/CustomersController.java @@ -31,33 +31,35 @@ */ public interface CustomersController { /** - * Creates a new address for a customer. + * Updates a card. * @param customerId Required parameter: Customer Id - * @param request Required parameter: Request for creating an address + * @param cardId Required parameter: Card id + * @param request Required parameter: Request for updating a card * @param idempotencyKey Optional parameter: Example: - * @return Returns the GetAddressResponse response from the API call + * @return Returns the GetCardResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - GetAddressResponse createAddress( + GetCardResponse updateCard( final String customerId, - final CreateAddressRequest request, + final String cardId, + final UpdateCardRequest request, final String idempotencyKey) throws ApiException, IOException; /** - * Updates a card. + * Updates an address. * @param customerId Required parameter: Customer Id - * @param cardId Required parameter: Card id - * @param request Required parameter: Request for updating a card + * @param addressId Required parameter: Address Id + * @param request Required parameter: Request for updating an address * @param idempotencyKey Optional parameter: Example: - * @return Returns the GetCardResponse response from the API call + * @return Returns the GetAddressResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - GetCardResponse updateCard( + GetAddressResponse updateAddress( final String customerId, - final String cardId, - final UpdateCardRequest request, + final String addressId, + final UpdateAddressRequest request, final String idempotencyKey) throws ApiException, IOException; /** @@ -87,30 +89,28 @@ GetCustomerResponse createCustomer( final String idempotencyKey) throws ApiException, IOException; /** - * Delete a Customer's access tokens. + * Creates a new address for a customer. * @param customerId Required parameter: Customer Id - * @return Returns the ListAccessTokensResponse response from the API call + * @param request Required parameter: Request for creating an address + * @param idempotencyKey Optional parameter: Example: + * @return Returns the GetAddressResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - ListAccessTokensResponse deleteAccessTokens( - final String customerId) throws ApiException, IOException; + GetAddressResponse createAddress( + final String customerId, + final CreateAddressRequest request, + final String idempotencyKey) throws ApiException, IOException; /** - * Updates an address. + * Delete a Customer's access tokens. * @param customerId Required parameter: Customer Id - * @param addressId Required parameter: Address Id - * @param request Required parameter: Request for updating an address - * @param idempotencyKey Optional parameter: Example: - * @return Returns the GetAddressResponse response from the API call + * @return Returns the ListAccessTokensResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - GetAddressResponse updateAddress( - final String customerId, - final String addressId, - final UpdateAddressRequest request, - final String idempotencyKey) throws ApiException, IOException; + ListAccessTokensResponse deleteAccessTokens( + final String customerId) throws ApiException, IOException; /** * Get a customer's address. @@ -138,6 +138,20 @@ GetAddressResponse deleteAddress( final String addressId, final String idempotencyKey) throws ApiException, IOException; + /** + * Creates a new card for a customer. + * @param customerId Required parameter: Customer id + * @param request Required parameter: Request for creating a card + * @param idempotencyKey Optional parameter: Example: + * @return Returns the GetCardResponse response from the API call + * @throws ApiException Represents error response from the server. + * @throws IOException Signals that an I/O exception of some sort has occurred. + */ + GetCardResponse createCard( + final String customerId, + final CreateCardRequest request, + final String idempotencyKey) throws ApiException, IOException; + /** * Get all Customers. * @param name Optional parameter: Name of the Customer @@ -159,154 +173,128 @@ ListCustomersResponse getCustomers( final String code) throws ApiException, IOException; /** - * Get all access tokens from a customer. - * @param customerId Required parameter: Customer Id - * @param page Optional parameter: Page number - * @param size Optional parameter: Page size - * @return Returns the ListAccessTokensResponse response from the API call - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - ListAccessTokensResponse getAccessTokens( - final String customerId, - final Integer page, - final Integer size) throws ApiException, IOException; - - /** - * Delete a customer's card. - * @param customerId Required parameter: Customer Id - * @param cardId Required parameter: Card Id + * Updates a customer. + * @param customerId Required parameter: Customer id + * @param request Required parameter: Request for updating a customer * @param idempotencyKey Optional parameter: Example: - * @return Returns the GetCardResponse response from the API call + * @return Returns the GetCustomerResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - GetCardResponse deleteCard( + GetCustomerResponse updateCustomer( final String customerId, - final String cardId, + final UpdateCustomerRequest request, final String idempotencyKey) throws ApiException, IOException; /** - * Get a customer's card. - * @param customerId Required parameter: Customer id - * @param cardId Required parameter: Card id - * @return Returns the GetCardResponse response from the API call - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - GetCardResponse getCard( - final String customerId, - final String cardId) throws ApiException, IOException; - - /** - * Creates a new card for a customer. - * @param customerId Required parameter: Customer id - * @param request Required parameter: Request for creating a card + * Creates a access token for a customer. + * @param customerId Required parameter: Customer Id + * @param request Required parameter: Request for creating a access token * @param idempotencyKey Optional parameter: Example: - * @return Returns the GetCardResponse response from the API call + * @return Returns the GetAccessTokenResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - GetCardResponse createCard( + GetAccessTokenResponse createAccessToken( final String customerId, - final CreateCardRequest request, + final CreateAccessTokenRequest request, final String idempotencyKey) throws ApiException, IOException; /** - * Get a Customer's access token. + * Get all access tokens from a customer. * @param customerId Required parameter: Customer Id - * @param tokenId Required parameter: Token Id - * @return Returns the GetAccessTokenResponse response from the API call + * @param page Optional parameter: Page number + * @param size Optional parameter: Page size + * @return Returns the ListAccessTokensResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - GetAccessTokenResponse getAccessToken( + ListAccessTokensResponse getAccessTokens( final String customerId, - final String tokenId) throws ApiException, IOException; + final Integer page, + final Integer size) throws ApiException, IOException; /** - * Gets all adressess from a customer. - * @param customerId Required parameter: Customer id + * Get all cards from a customer. + * @param customerId Required parameter: Customer Id * @param page Optional parameter: Page number * @param size Optional parameter: Page size - * @return Returns the ListAddressesResponse response from the API call + * @return Returns the ListCardsResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - ListAddressesResponse getAddresses( + ListCardsResponse getCards( final String customerId, final Integer page, final Integer size) throws ApiException, IOException; /** - * Updates a customer. + * Renew a card. * @param customerId Required parameter: Customer id - * @param request Required parameter: Request for updating a customer + * @param cardId Required parameter: Card Id * @param idempotencyKey Optional parameter: Example: - * @return Returns the GetCustomerResponse response from the API call + * @return Returns the GetCardResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - GetCustomerResponse updateCustomer( + GetCardResponse renewCard( final String customerId, - final UpdateCustomerRequest request, + final String cardId, final String idempotencyKey) throws ApiException, IOException; /** - * Creates a access token for a customer. + * Get a Customer's access token. * @param customerId Required parameter: Customer Id - * @param request Required parameter: Request for creating a access token - * @param idempotencyKey Optional parameter: Example: + * @param tokenId Required parameter: Token Id * @return Returns the GetAccessTokenResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - GetAccessTokenResponse createAccessToken( + GetAccessTokenResponse getAccessToken( final String customerId, - final CreateAccessTokenRequest request, - final String idempotencyKey) throws ApiException, IOException; + final String tokenId) throws ApiException, IOException; /** - * Get all cards from a customer. - * @param customerId Required parameter: Customer Id - * @param page Optional parameter: Page number - * @param size Optional parameter: Page size - * @return Returns the ListCardsResponse response from the API call + * Updates the metadata a customer. + * @param customerId Required parameter: The customer id + * @param request Required parameter: Request for updating the customer metadata + * @param idempotencyKey Optional parameter: Example: + * @return Returns the GetCustomerResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - ListCardsResponse getCards( + GetCustomerResponse updateCustomerMetadata( final String customerId, - final Integer page, - final Integer size) throws ApiException, IOException; + final UpdateMetadataRequest request, + final String idempotencyKey) throws ApiException, IOException; /** - * Renew a card. - * @param customerId Required parameter: Customer id + * Delete a customer's card. + * @param customerId Required parameter: Customer Id * @param cardId Required parameter: Card Id * @param idempotencyKey Optional parameter: Example: * @return Returns the GetCardResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - GetCardResponse renewCard( + GetCardResponse deleteCard( final String customerId, final String cardId, final String idempotencyKey) throws ApiException, IOException; /** - * Updates the metadata a customer. - * @param customerId Required parameter: The customer id - * @param request Required parameter: Request for updating the customer metadata - * @param idempotencyKey Optional parameter: Example: - * @return Returns the GetCustomerResponse response from the API call + * Gets all adressess from a customer. + * @param customerId Required parameter: Customer id + * @param page Optional parameter: Page number + * @param size Optional parameter: Page size + * @return Returns the ListAddressesResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - GetCustomerResponse updateCustomerMetadata( + ListAddressesResponse getAddresses( final String customerId, - final UpdateMetadataRequest request, - final String idempotencyKey) throws ApiException, IOException; + final Integer page, + final Integer size) throws ApiException, IOException; /** * Get a customer. @@ -318,4 +306,16 @@ GetCustomerResponse updateCustomerMetadata( GetCustomerResponse getCustomer( final String customerId) throws ApiException, IOException; + /** + * Get a customer's card. + * @param customerId Required parameter: Customer id + * @param cardId Required parameter: Card id + * @return Returns the GetCardResponse response from the API call + * @throws ApiException Represents error response from the server. + * @throws IOException Signals that an I/O exception of some sort has occurred. + */ + GetCardResponse getCard( + final String customerId, + final String cardId) throws ApiException, IOException; + } \ No newline at end of file diff --git a/src/main/java/me/pagar/api/controllers/DefaultBalanceOperationsController.java b/src/main/java/me/pagar/api/controllers/DefaultBalanceOperationsController.java index e40a7fb..3367f16 100644 --- a/src/main/java/me/pagar/api/controllers/DefaultBalanceOperationsController.java +++ b/src/main/java/me/pagar/api/controllers/DefaultBalanceOperationsController.java @@ -31,41 +31,6 @@ public DefaultBalanceOperationsController(GlobalConfiguration globalConfig) { super(globalConfig); } - /** - * @param id Required parameter: Example: - * @return Returns the GetBalanceOperationResponse response from the API call - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - public GetBalanceOperationResponse getBalanceOperationById( - final long id) throws ApiException, IOException { - return prepareGetBalanceOperationByIdRequest(id).execute(); - } - - /** - * Builds the ApiCall object for getBalanceOperationById. - */ - private ApiCall prepareGetBalanceOperationByIdRequest( - final long id) throws IOException { - return new ApiCall.Builder() - .globalConfig(getGlobalConfiguration()) - .requestBuilder(requestBuilder -> requestBuilder - .server(Server.ENUM_DEFAULT.value()) - .path("/balance/operations/{id}") - .templateParam(param -> param.key("id").value(id).isRequired(false) - .shouldEncode(true)) - .headerParam(param -> param.key("accept").value("application/json")) - .withAuth(auth -> auth - .add("httpBasic")) - .httpMethod(HttpMethod.GET)) - .responseHandler(responseHandler -> responseHandler - .deserializer( - response -> ApiHelper.deserialize(response, GetBalanceOperationResponse.class)) - .nullify404(false) - .globalErrorCase(GLOBAL_ERROR_CASES)) - .build(); - } - /** * @param status Optional parameter: Example: * @param createdSince Optional parameter: Example: @@ -116,4 +81,39 @@ private ApiCall prepareGetBalanceOpe .globalErrorCase(GLOBAL_ERROR_CASES)) .build(); } + + /** + * @param id Required parameter: Example: + * @return Returns the GetBalanceOperationResponse response from the API call + * @throws ApiException Represents error response from the server. + * @throws IOException Signals that an I/O exception of some sort has occurred. + */ + public GetBalanceOperationResponse getBalanceOperationById( + final long id) throws ApiException, IOException { + return prepareGetBalanceOperationByIdRequest(id).execute(); + } + + /** + * Builds the ApiCall object for getBalanceOperationById. + */ + private ApiCall prepareGetBalanceOperationByIdRequest( + final long id) throws IOException { + return new ApiCall.Builder() + .globalConfig(getGlobalConfiguration()) + .requestBuilder(requestBuilder -> requestBuilder + .server(Server.ENUM_DEFAULT.value()) + .path("/balance/operations/{id}") + .templateParam(param -> param.key("id").value(id).isRequired(false) + .shouldEncode(true)) + .headerParam(param -> param.key("accept").value("application/json")) + .withAuth(auth -> auth + .add("httpBasic")) + .httpMethod(HttpMethod.GET)) + .responseHandler(responseHandler -> responseHandler + .deserializer( + response -> ApiHelper.deserialize(response, GetBalanceOperationResponse.class)) + .nullify404(false) + .globalErrorCase(GLOBAL_ERROR_CASES)) + .build(); + } } \ No newline at end of file diff --git a/src/main/java/me/pagar/api/controllers/DefaultChargesController.java b/src/main/java/me/pagar/api/controllers/DefaultChargesController.java index bb22c70..d2e4533 100644 --- a/src/main/java/me/pagar/api/controllers/DefaultChargesController.java +++ b/src/main/java/me/pagar/api/controllers/DefaultChargesController.java @@ -90,34 +90,34 @@ private ApiCall prepareUpdateChargeMetadataRequ } /** - * Captures a charge. + * Updates a charge's payment method. * @param chargeId Required parameter: Charge id - * @param request Optional parameter: Request for capturing a charge + * @param request Required parameter: Request for updating the payment method from a charge * @param idempotencyKey Optional parameter: Example: * @return Returns the GetChargeResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetChargeResponse captureCharge( + public GetChargeResponse updateChargePaymentMethod( final String chargeId, - final CreateCaptureChargeRequest request, + final UpdateChargePaymentMethodRequest request, final String idempotencyKey) throws ApiException, IOException { - return prepareCaptureChargeRequest(chargeId, request, idempotencyKey).execute(); + return prepareUpdateChargePaymentMethodRequest(chargeId, request, idempotencyKey).execute(); } /** - * Builds the ApiCall object for captureCharge. + * Builds the ApiCall object for updateChargePaymentMethod. */ - private ApiCall prepareCaptureChargeRequest( + private ApiCall prepareUpdateChargePaymentMethodRequest( final String chargeId, - final CreateCaptureChargeRequest request, + final UpdateChargePaymentMethodRequest request, final String idempotencyKey) throws JsonProcessingException, IOException { return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/charges/{charge_id}/capture") - .bodyParam(param -> param.value(request).isRequired(false)) + .path("/charges/{charge_id}/payment-method") + .bodyParam(param -> param.value(request)) .bodySerializer(() -> ApiHelper.serialize(request)) .templateParam(param -> param.key("charge_id").value(chargeId) .shouldEncode(true)) @@ -127,7 +127,7 @@ private ApiCall prepareCaptureChargeRequest( .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) - .httpMethod(HttpMethod.POST)) + .httpMethod(HttpMethod.PATCH)) .responseHandler(responseHandler -> responseHandler .deserializer( response -> ApiHelper.deserialize(response, GetChargeResponse.class)) @@ -137,27 +137,36 @@ private ApiCall prepareCaptureChargeRequest( } /** - * Get a charge from its id. - * @param chargeId Required parameter: Charge id - * @return Returns the GetChargeResponse response from the API call + * @param chargeId Required parameter: Charge Id + * @param page Optional parameter: Page number + * @param size Optional parameter: Page size + * @return Returns the ListChargeTransactionsResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetChargeResponse getCharge( - final String chargeId) throws ApiException, IOException { - return prepareGetChargeRequest(chargeId).execute(); + public ListChargeTransactionsResponse getChargeTransactions( + final String chargeId, + final Integer page, + final Integer size) throws ApiException, IOException { + return prepareGetChargeTransactionsRequest(chargeId, page, size).execute(); } /** - * Builds the ApiCall object for getCharge. + * Builds the ApiCall object for getChargeTransactions. */ - private ApiCall prepareGetChargeRequest( - final String chargeId) throws IOException { - return new ApiCall.Builder() + private ApiCall prepareGetChargeTransactionsRequest( + final String chargeId, + final Integer page, + final Integer size) throws IOException { + return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/charges/{charge_id}") + .path("/charges/{charge_id}/transactions") + .queryParam(param -> param.key("page") + .value(page).isRequired(false)) + .queryParam(param -> param.key("size") + .value(size).isRequired(false)) .templateParam(param -> param.key("charge_id").value(chargeId) .shouldEncode(true)) .headerParam(param -> param.key("accept").value("application/json")) @@ -166,40 +175,41 @@ private ApiCall prepareGetChargeRequest( .httpMethod(HttpMethod.GET)) .responseHandler(responseHandler -> responseHandler .deserializer( - response -> ApiHelper.deserialize(response, GetChargeResponse.class)) + response -> ApiHelper.deserialize(response, ListChargeTransactionsResponse.class)) .nullify404(false) .globalErrorCase(GLOBAL_ERROR_CASES)) .build(); } /** - * @param chargeId Required parameter: Example: - * @param request Optional parameter: Request for confirm payment + * Updates the due date from a charge. + * @param chargeId Required parameter: Charge Id + * @param request Required parameter: Request for updating the due date * @param idempotencyKey Optional parameter: Example: * @return Returns the GetChargeResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetChargeResponse confirmPayment( + public GetChargeResponse updateChargeDueDate( final String chargeId, - final CreateConfirmPaymentRequest request, + final UpdateChargeDueDateRequest request, final String idempotencyKey) throws ApiException, IOException { - return prepareConfirmPaymentRequest(chargeId, request, idempotencyKey).execute(); + return prepareUpdateChargeDueDateRequest(chargeId, request, idempotencyKey).execute(); } /** - * Builds the ApiCall object for confirmPayment. + * Builds the ApiCall object for updateChargeDueDate. */ - private ApiCall prepareConfirmPaymentRequest( + private ApiCall prepareUpdateChargeDueDateRequest( final String chargeId, - final CreateConfirmPaymentRequest request, + final UpdateChargeDueDateRequest request, final String idempotencyKey) throws JsonProcessingException, IOException { return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/charges/{charge_id}/confirm-payment") - .bodyParam(param -> param.value(request).isRequired(false)) + .path("/Charges/{charge_id}/due-date") + .bodyParam(param -> param.value(request)) .bodySerializer(() -> ApiHelper.serialize(request)) .templateParam(param -> param.key("charge_id").value(chargeId) .shouldEncode(true)) @@ -209,7 +219,7 @@ private ApiCall prepareConfirmPaymentRequest( .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) - .httpMethod(HttpMethod.POST)) + .httpMethod(HttpMethod.PATCH)) .responseHandler(responseHandler -> responseHandler .deserializer( response -> ApiHelper.deserialize(response, GetChargeResponse.class)) @@ -219,79 +229,113 @@ private ApiCall prepareConfirmPaymentRequest( } /** - * @param chargeId Required parameter: Charge Id + * Lists all charges. * @param page Optional parameter: Page number * @param size Optional parameter: Page size - * @return Returns the ListChargeTransactionsResponse response from the API call + * @param code Optional parameter: Filter for charge's code + * @param status Optional parameter: Filter for charge's status + * @param paymentMethod Optional parameter: Filter for charge's payment method + * @param customerId Optional parameter: Filter for charge's customer id + * @param orderId Optional parameter: Filter for charge's order id + * @param createdSince Optional parameter: Filter for the beginning of the range for charge's + * creation + * @param createdUntil Optional parameter: Filter for the end of the range for charge's + * creation + * @return Returns the ListChargesResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public ListChargeTransactionsResponse getChargeTransactions( - final String chargeId, + public ListChargesResponse getCharges( final Integer page, - final Integer size) throws ApiException, IOException { - return prepareGetChargeTransactionsRequest(chargeId, page, size).execute(); + final Integer size, + final String code, + final String status, + final String paymentMethod, + final String customerId, + final String orderId, + final LocalDateTime createdSince, + final LocalDateTime createdUntil) throws ApiException, IOException { + return prepareGetChargesRequest(page, size, code, status, paymentMethod, customerId, + orderId, createdSince, createdUntil).execute(); } /** - * Builds the ApiCall object for getChargeTransactions. + * Builds the ApiCall object for getCharges. */ - private ApiCall prepareGetChargeTransactionsRequest( - final String chargeId, + private ApiCall prepareGetChargesRequest( final Integer page, - final Integer size) throws IOException { - return new ApiCall.Builder() + final Integer size, + final String code, + final String status, + final String paymentMethod, + final String customerId, + final String orderId, + final LocalDateTime createdSince, + final LocalDateTime createdUntil) throws IOException { + return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/charges/{charge_id}/transactions") + .path("/charges") .queryParam(param -> param.key("page") .value(page).isRequired(false)) .queryParam(param -> param.key("size") .value(size).isRequired(false)) - .templateParam(param -> param.key("charge_id").value(chargeId) - .shouldEncode(true)) + .queryParam(param -> param.key("code") + .value(code).isRequired(false)) + .queryParam(param -> param.key("status") + .value(status).isRequired(false)) + .queryParam(param -> param.key("payment_method") + .value(paymentMethod).isRequired(false)) + .queryParam(param -> param.key("customer_id") + .value(customerId).isRequired(false)) + .queryParam(param -> param.key("order_id") + .value(orderId).isRequired(false)) + .queryParam(param -> param.key("created_since") + .value(DateTimeHelper.toRfc8601DateTime(createdSince)).isRequired(false)) + .queryParam(param -> param.key("created_until") + .value(DateTimeHelper.toRfc8601DateTime(createdUntil)).isRequired(false)) .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) .httpMethod(HttpMethod.GET)) .responseHandler(responseHandler -> responseHandler .deserializer( - response -> ApiHelper.deserialize(response, ListChargeTransactionsResponse.class)) + response -> ApiHelper.deserialize(response, ListChargesResponse.class)) .nullify404(false) .globalErrorCase(GLOBAL_ERROR_CASES)) .build(); } /** - * Updates the card from a charge. + * Captures a charge. * @param chargeId Required parameter: Charge id - * @param request Required parameter: Request for updating a charge's card + * @param request Optional parameter: Request for capturing a charge * @param idempotencyKey Optional parameter: Example: * @return Returns the GetChargeResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetChargeResponse updateChargeCard( + public GetChargeResponse captureCharge( final String chargeId, - final UpdateChargeCardRequest request, + final CreateCaptureChargeRequest request, final String idempotencyKey) throws ApiException, IOException { - return prepareUpdateChargeCardRequest(chargeId, request, idempotencyKey).execute(); + return prepareCaptureChargeRequest(chargeId, request, idempotencyKey).execute(); } /** - * Builds the ApiCall object for updateChargeCard. + * Builds the ApiCall object for captureCharge. */ - private ApiCall prepareUpdateChargeCardRequest( + private ApiCall prepareCaptureChargeRequest( final String chargeId, - final UpdateChargeCardRequest request, + final CreateCaptureChargeRequest request, final String idempotencyKey) throws JsonProcessingException, IOException { return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/charges/{charge_id}/card") - .bodyParam(param -> param.value(request)) + .path("/charges/{charge_id}/capture") + .bodyParam(param -> param.value(request).isRequired(false)) .bodySerializer(() -> ApiHelper.serialize(request)) .templateParam(param -> param.key("charge_id").value(chargeId) .shouldEncode(true)) @@ -299,48 +343,6 @@ private ApiCall prepareUpdateChargeCardRequest( .value(idempotencyKey).isRequired(false)) .headerParam(param ->param.key("content-type").value("application/json")) .headerParam(param -> param.key("accept").value("application/json")) - .withAuth(auth -> auth - .add("httpBasic")) - .httpMethod(HttpMethod.PATCH)) - .responseHandler(responseHandler -> responseHandler - .deserializer( - response -> ApiHelper.deserialize(response, GetChargeResponse.class)) - .nullify404(false) - .globalErrorCase(GLOBAL_ERROR_CASES)) - .build(); - } - - /** - * Creates a new charge. - * @param request Required parameter: Request for creating a charge - * @param idempotencyKey Optional parameter: Example: - * @return Returns the GetChargeResponse response from the API call - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - public GetChargeResponse createCharge( - final CreateChargeRequest request, - final String idempotencyKey) throws ApiException, IOException { - return prepareCreateChargeRequest(request, idempotencyKey).execute(); - } - - /** - * Builds the ApiCall object for createCharge. - */ - private ApiCall prepareCreateChargeRequest( - final CreateChargeRequest request, - final String idempotencyKey) throws JsonProcessingException, IOException { - return new ApiCall.Builder() - .globalConfig(getGlobalConfiguration()) - .requestBuilder(requestBuilder -> requestBuilder - .server(Server.ENUM_DEFAULT.value()) - .path("/Charges") - .bodyParam(param -> param.value(request)) - .bodySerializer(() -> ApiHelper.serialize(request)) - .headerParam(param -> param.key("idempotency-key") - .value(idempotencyKey).isRequired(false)) - .headerParam(param ->param.key("content-type").value("application/json")) - .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) .httpMethod(HttpMethod.POST)) @@ -353,33 +355,33 @@ private ApiCall prepareCreateChargeRequest( } /** - * Updates a charge's payment method. + * Updates the card from a charge. * @param chargeId Required parameter: Charge id - * @param request Required parameter: Request for updating the payment method from a charge + * @param request Required parameter: Request for updating a charge's card * @param idempotencyKey Optional parameter: Example: * @return Returns the GetChargeResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetChargeResponse updateChargePaymentMethod( + public GetChargeResponse updateChargeCard( final String chargeId, - final UpdateChargePaymentMethodRequest request, + final UpdateChargeCardRequest request, final String idempotencyKey) throws ApiException, IOException { - return prepareUpdateChargePaymentMethodRequest(chargeId, request, idempotencyKey).execute(); + return prepareUpdateChargeCardRequest(chargeId, request, idempotencyKey).execute(); } /** - * Builds the ApiCall object for updateChargePaymentMethod. + * Builds the ApiCall object for updateChargeCard. */ - private ApiCall prepareUpdateChargePaymentMethodRequest( + private ApiCall prepareUpdateChargeCardRequest( final String chargeId, - final UpdateChargePaymentMethodRequest request, + final UpdateChargeCardRequest request, final String idempotencyKey) throws JsonProcessingException, IOException { return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/charges/{charge_id}/payment-method") + .path("/charges/{charge_id}/card") .bodyParam(param -> param.value(request)) .bodySerializer(() -> ApiHelper.serialize(request)) .templateParam(param -> param.key("charge_id").value(chargeId) @@ -400,44 +402,33 @@ private ApiCall prepareUpdateChargePaymentMetho } /** - * Updates the due date from a charge. - * @param chargeId Required parameter: Charge Id - * @param request Required parameter: Request for updating the due date - * @param idempotencyKey Optional parameter: Example: + * Get a charge from its id. + * @param chargeId Required parameter: Charge id * @return Returns the GetChargeResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetChargeResponse updateChargeDueDate( - final String chargeId, - final UpdateChargeDueDateRequest request, - final String idempotencyKey) throws ApiException, IOException { - return prepareUpdateChargeDueDateRequest(chargeId, request, idempotencyKey).execute(); + public GetChargeResponse getCharge( + final String chargeId) throws ApiException, IOException { + return prepareGetChargeRequest(chargeId).execute(); } /** - * Builds the ApiCall object for updateChargeDueDate. + * Builds the ApiCall object for getCharge. */ - private ApiCall prepareUpdateChargeDueDateRequest( - final String chargeId, - final UpdateChargeDueDateRequest request, - final String idempotencyKey) throws JsonProcessingException, IOException { + private ApiCall prepareGetChargeRequest( + final String chargeId) throws IOException { return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/Charges/{charge_id}/due-date") - .bodyParam(param -> param.value(request)) - .bodySerializer(() -> ApiHelper.serialize(request)) + .path("/charges/{charge_id}") .templateParam(param -> param.key("charge_id").value(chargeId) .shouldEncode(true)) - .headerParam(param -> param.key("idempotency-key") - .value(idempotencyKey).isRequired(false)) - .headerParam(param ->param.key("content-type").value("application/json")) .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) - .httpMethod(HttpMethod.PATCH)) + .httpMethod(HttpMethod.GET)) .responseHandler(responseHandler -> responseHandler .deserializer( response -> ApiHelper.deserialize(response, GetChargeResponse.class)) @@ -533,112 +524,121 @@ private ApiCall prepareRetryChargeRequest( } /** - * Lists all charges. - * @param page Optional parameter: Page number - * @param size Optional parameter: Page size - * @param code Optional parameter: Filter for charge's code - * @param status Optional parameter: Filter for charge's status - * @param paymentMethod Optional parameter: Filter for charge's payment method - * @param customerId Optional parameter: Filter for charge's customer id - * @param orderId Optional parameter: Filter for charge's order id - * @param createdSince Optional parameter: Filter for the beginning of the range for charge's - * creation - * @param createdUntil Optional parameter: Filter for the end of the range for charge's - * creation - * @return Returns the ListChargesResponse response from the API call + * Cancel a charge. + * @param chargeId Required parameter: Charge id + * @param request Optional parameter: Request for cancelling a charge + * @param idempotencyKey Optional parameter: Example: + * @return Returns the GetChargeResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public ListChargesResponse getCharges( - final Integer page, - final Integer size, - final String code, - final String status, - final String paymentMethod, - final String customerId, - final String orderId, - final LocalDateTime createdSince, - final LocalDateTime createdUntil) throws ApiException, IOException { - return prepareGetChargesRequest(page, size, code, status, paymentMethod, customerId, - orderId, createdSince, createdUntil).execute(); + public GetChargeResponse cancelCharge( + final String chargeId, + final CreateCancelChargeRequest request, + final String idempotencyKey) throws ApiException, IOException { + return prepareCancelChargeRequest(chargeId, request, idempotencyKey).execute(); } /** - * Builds the ApiCall object for getCharges. + * Builds the ApiCall object for cancelCharge. */ - private ApiCall prepareGetChargesRequest( - final Integer page, - final Integer size, - final String code, - final String status, - final String paymentMethod, - final String customerId, - final String orderId, - final LocalDateTime createdSince, - final LocalDateTime createdUntil) throws IOException { - return new ApiCall.Builder() + private ApiCall prepareCancelChargeRequest( + final String chargeId, + final CreateCancelChargeRequest request, + final String idempotencyKey) throws JsonProcessingException, IOException { + return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/charges") - .queryParam(param -> param.key("page") - .value(page).isRequired(false)) - .queryParam(param -> param.key("size") - .value(size).isRequired(false)) - .queryParam(param -> param.key("code") - .value(code).isRequired(false)) - .queryParam(param -> param.key("status") - .value(status).isRequired(false)) - .queryParam(param -> param.key("payment_method") - .value(paymentMethod).isRequired(false)) - .queryParam(param -> param.key("customer_id") - .value(customerId).isRequired(false)) - .queryParam(param -> param.key("order_id") - .value(orderId).isRequired(false)) - .queryParam(param -> param.key("created_since") - .value(DateTimeHelper.toRfc8601DateTime(createdSince)).isRequired(false)) - .queryParam(param -> param.key("created_until") - .value(DateTimeHelper.toRfc8601DateTime(createdUntil)).isRequired(false)) + .path("/charges/{charge_id}") + .bodyParam(param -> param.value(request).isRequired(false)) + .bodySerializer(() -> ApiHelper.serialize(request)) + .templateParam(param -> param.key("charge_id").value(chargeId) + .shouldEncode(true)) + .headerParam(param -> param.key("idempotency-key") + .value(idempotencyKey).isRequired(false)) + .headerParam(param ->param.key("content-type").value("application/json")) .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) - .httpMethod(HttpMethod.GET)) + .httpMethod(HttpMethod.DELETE)) .responseHandler(responseHandler -> responseHandler .deserializer( - response -> ApiHelper.deserialize(response, ListChargesResponse.class)) + response -> ApiHelper.deserialize(response, GetChargeResponse.class)) .nullify404(false) .globalErrorCase(GLOBAL_ERROR_CASES)) .build(); } /** - * Cancel a charge. - * @param chargeId Required parameter: Charge id - * @param request Optional parameter: Request for cancelling a charge + * Creates a new charge. + * @param request Required parameter: Request for creating a charge * @param idempotencyKey Optional parameter: Example: * @return Returns the GetChargeResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetChargeResponse cancelCharge( + public GetChargeResponse createCharge( + final CreateChargeRequest request, + final String idempotencyKey) throws ApiException, IOException { + return prepareCreateChargeRequest(request, idempotencyKey).execute(); + } + + /** + * Builds the ApiCall object for createCharge. + */ + private ApiCall prepareCreateChargeRequest( + final CreateChargeRequest request, + final String idempotencyKey) throws JsonProcessingException, IOException { + return new ApiCall.Builder() + .globalConfig(getGlobalConfiguration()) + .requestBuilder(requestBuilder -> requestBuilder + .server(Server.ENUM_DEFAULT.value()) + .path("/Charges") + .bodyParam(param -> param.value(request)) + .bodySerializer(() -> ApiHelper.serialize(request)) + .headerParam(param -> param.key("idempotency-key") + .value(idempotencyKey).isRequired(false)) + .headerParam(param ->param.key("content-type").value("application/json")) + .headerParam(param -> param.key("accept").value("application/json")) + .withAuth(auth -> auth + .add("httpBasic")) + .httpMethod(HttpMethod.POST)) + .responseHandler(responseHandler -> responseHandler + .deserializer( + response -> ApiHelper.deserialize(response, GetChargeResponse.class)) + .nullify404(false) + .globalErrorCase(GLOBAL_ERROR_CASES)) + .build(); + } + + /** + * @param chargeId Required parameter: Example: + * @param request Optional parameter: Request for confirm payment + * @param idempotencyKey Optional parameter: Example: + * @return Returns the GetChargeResponse response from the API call + * @throws ApiException Represents error response from the server. + * @throws IOException Signals that an I/O exception of some sort has occurred. + */ + public GetChargeResponse confirmPayment( final String chargeId, - final CreateCancelChargeRequest request, + final CreateConfirmPaymentRequest request, final String idempotencyKey) throws ApiException, IOException { - return prepareCancelChargeRequest(chargeId, request, idempotencyKey).execute(); + return prepareConfirmPaymentRequest(chargeId, request, idempotencyKey).execute(); } /** - * Builds the ApiCall object for cancelCharge. + * Builds the ApiCall object for confirmPayment. */ - private ApiCall prepareCancelChargeRequest( + private ApiCall prepareConfirmPaymentRequest( final String chargeId, - final CreateCancelChargeRequest request, + final CreateConfirmPaymentRequest request, final String idempotencyKey) throws JsonProcessingException, IOException { return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/charges/{charge_id}") + .path("/charges/{charge_id}/confirm-payment") .bodyParam(param -> param.value(request).isRequired(false)) .bodySerializer(() -> ApiHelper.serialize(request)) .templateParam(param -> param.key("charge_id").value(chargeId) @@ -649,7 +649,7 @@ private ApiCall prepareCancelChargeRequest( .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) - .httpMethod(HttpMethod.DELETE)) + .httpMethod(HttpMethod.POST)) .responseHandler(responseHandler -> responseHandler .deserializer( response -> ApiHelper.deserialize(response, GetChargeResponse.class)) diff --git a/src/main/java/me/pagar/api/controllers/DefaultCustomersController.java b/src/main/java/me/pagar/api/controllers/DefaultCustomersController.java index 6e1814e..5e2adda 100644 --- a/src/main/java/me/pagar/api/controllers/DefaultCustomersController.java +++ b/src/main/java/me/pagar/api/controllers/DefaultCustomersController.java @@ -45,88 +45,94 @@ public DefaultCustomersController(GlobalConfiguration globalConfig) { } /** - * Creates a new address for a customer. + * Updates a card. * @param customerId Required parameter: Customer Id - * @param request Required parameter: Request for creating an address + * @param cardId Required parameter: Card id + * @param request Required parameter: Request for updating a card * @param idempotencyKey Optional parameter: Example: - * @return Returns the GetAddressResponse response from the API call + * @return Returns the GetCardResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetAddressResponse createAddress( + public GetCardResponse updateCard( final String customerId, - final CreateAddressRequest request, + final String cardId, + final UpdateCardRequest request, final String idempotencyKey) throws ApiException, IOException { - return prepareCreateAddressRequest(customerId, request, idempotencyKey).execute(); + return prepareUpdateCardRequest(customerId, cardId, request, idempotencyKey).execute(); } /** - * Builds the ApiCall object for createAddress. + * Builds the ApiCall object for updateCard. */ - private ApiCall prepareCreateAddressRequest( + private ApiCall prepareUpdateCardRequest( final String customerId, - final CreateAddressRequest request, + final String cardId, + final UpdateCardRequest request, final String idempotencyKey) throws JsonProcessingException, IOException { - return new ApiCall.Builder() + return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/customers/{customer_id}/addresses") + .path("/customers/{customer_id}/cards/{card_id}") .bodyParam(param -> param.value(request)) .bodySerializer(() -> ApiHelper.serialize(request)) .templateParam(param -> param.key("customer_id").value(customerId) .shouldEncode(true)) + .templateParam(param -> param.key("card_id").value(cardId) + .shouldEncode(true)) .headerParam(param -> param.key("idempotency-key") .value(idempotencyKey).isRequired(false)) .headerParam(param ->param.key("content-type").value("application/json")) .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) - .httpMethod(HttpMethod.POST)) + .httpMethod(HttpMethod.PUT)) .responseHandler(responseHandler -> responseHandler .deserializer( - response -> ApiHelper.deserialize(response, GetAddressResponse.class)) + response -> ApiHelper.deserialize(response, GetCardResponse.class)) .nullify404(false) .globalErrorCase(GLOBAL_ERROR_CASES)) .build(); } /** - * Updates a card. + * Updates an address. * @param customerId Required parameter: Customer Id - * @param cardId Required parameter: Card id - * @param request Required parameter: Request for updating a card + * @param addressId Required parameter: Address Id + * @param request Required parameter: Request for updating an address * @param idempotencyKey Optional parameter: Example: - * @return Returns the GetCardResponse response from the API call + * @return Returns the GetAddressResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetCardResponse updateCard( + public GetAddressResponse updateAddress( final String customerId, - final String cardId, - final UpdateCardRequest request, + final String addressId, + final UpdateAddressRequest request, final String idempotencyKey) throws ApiException, IOException { - return prepareUpdateCardRequest(customerId, cardId, request, idempotencyKey).execute(); + return prepareUpdateAddressRequest(customerId, addressId, request, + idempotencyKey).execute(); } /** - * Builds the ApiCall object for updateCard. + * Builds the ApiCall object for updateAddress. */ - private ApiCall prepareUpdateCardRequest( + private ApiCall prepareUpdateAddressRequest( final String customerId, - final String cardId, - final UpdateCardRequest request, + final String addressId, + final UpdateAddressRequest request, final String idempotencyKey) throws JsonProcessingException, IOException { - return new ApiCall.Builder() + return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/customers/{customer_id}/cards/{card_id}") + .path("/customers/{customer_id}/addresses/{address_id}") .bodyParam(param -> param.value(request)) .bodySerializer(() -> ApiHelper.serialize(request)) .templateParam(param -> param.key("customer_id").value(customerId) .shouldEncode(true)) - .templateParam(param -> param.key("card_id").value(cardId) + .templateParam(param -> param.key("address_id").value(addressId) .shouldEncode(true)) .headerParam(param -> param.key("idempotency-key") .value(idempotencyKey).isRequired(false)) @@ -137,7 +143,7 @@ private ApiCall prepareUpdateCardRequest( .httpMethod(HttpMethod.PUT)) .responseHandler(responseHandler -> responseHandler .deserializer( - response -> ApiHelper.deserialize(response, GetCardResponse.class)) + response -> ApiHelper.deserialize(response, GetAddressResponse.class)) .nullify404(false) .globalErrorCase(GLOBAL_ERROR_CASES)) .build(); @@ -232,89 +238,83 @@ private ApiCall prepareCreateCustomerRequest( } /** - * Delete a Customer's access tokens. + * Creates a new address for a customer. * @param customerId Required parameter: Customer Id - * @return Returns the ListAccessTokensResponse response from the API call + * @param request Required parameter: Request for creating an address + * @param idempotencyKey Optional parameter: Example: + * @return Returns the GetAddressResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public ListAccessTokensResponse deleteAccessTokens( - final String customerId) throws ApiException, IOException { - return prepareDeleteAccessTokensRequest(customerId).execute(); + public GetAddressResponse createAddress( + final String customerId, + final CreateAddressRequest request, + final String idempotencyKey) throws ApiException, IOException { + return prepareCreateAddressRequest(customerId, request, idempotencyKey).execute(); } /** - * Builds the ApiCall object for deleteAccessTokens. + * Builds the ApiCall object for createAddress. */ - private ApiCall prepareDeleteAccessTokensRequest( - final String customerId) throws IOException { - return new ApiCall.Builder() + private ApiCall prepareCreateAddressRequest( + final String customerId, + final CreateAddressRequest request, + final String idempotencyKey) throws JsonProcessingException, IOException { + return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/customers/{customer_id}/access-tokens/") + .path("/customers/{customer_id}/addresses") + .bodyParam(param -> param.value(request)) + .bodySerializer(() -> ApiHelper.serialize(request)) .templateParam(param -> param.key("customer_id").value(customerId) .shouldEncode(true)) + .headerParam(param -> param.key("idempotency-key") + .value(idempotencyKey).isRequired(false)) + .headerParam(param ->param.key("content-type").value("application/json")) .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) - .httpMethod(HttpMethod.GET)) + .httpMethod(HttpMethod.POST)) .responseHandler(responseHandler -> responseHandler .deserializer( - response -> ApiHelper.deserialize(response, ListAccessTokensResponse.class)) + response -> ApiHelper.deserialize(response, GetAddressResponse.class)) .nullify404(false) .globalErrorCase(GLOBAL_ERROR_CASES)) .build(); } /** - * Updates an address. + * Delete a Customer's access tokens. * @param customerId Required parameter: Customer Id - * @param addressId Required parameter: Address Id - * @param request Required parameter: Request for updating an address - * @param idempotencyKey Optional parameter: Example: - * @return Returns the GetAddressResponse response from the API call + * @return Returns the ListAccessTokensResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetAddressResponse updateAddress( - final String customerId, - final String addressId, - final UpdateAddressRequest request, - final String idempotencyKey) throws ApiException, IOException { - return prepareUpdateAddressRequest(customerId, addressId, request, - idempotencyKey).execute(); + public ListAccessTokensResponse deleteAccessTokens( + final String customerId) throws ApiException, IOException { + return prepareDeleteAccessTokensRequest(customerId).execute(); } /** - * Builds the ApiCall object for updateAddress. + * Builds the ApiCall object for deleteAccessTokens. */ - private ApiCall prepareUpdateAddressRequest( - final String customerId, - final String addressId, - final UpdateAddressRequest request, - final String idempotencyKey) throws JsonProcessingException, IOException { - return new ApiCall.Builder() + private ApiCall prepareDeleteAccessTokensRequest( + final String customerId) throws IOException { + return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/customers/{customer_id}/addresses/{address_id}") - .bodyParam(param -> param.value(request)) - .bodySerializer(() -> ApiHelper.serialize(request)) + .path("/customers/{customer_id}/access-tokens/") .templateParam(param -> param.key("customer_id").value(customerId) .shouldEncode(true)) - .templateParam(param -> param.key("address_id").value(addressId) - .shouldEncode(true)) - .headerParam(param -> param.key("idempotency-key") - .value(idempotencyKey).isRequired(false)) - .headerParam(param ->param.key("content-type").value("application/json")) .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) - .httpMethod(HttpMethod.PUT)) + .httpMethod(HttpMethod.GET)) .responseHandler(responseHandler -> responseHandler .deserializer( - response -> ApiHelper.deserialize(response, GetAddressResponse.class)) + response -> ApiHelper.deserialize(response, ListAccessTokensResponse.class)) .nullify404(false) .globalErrorCase(GLOBAL_ERROR_CASES)) .build(); @@ -407,6 +407,53 @@ private ApiCall prepareDeleteAddressRequest( .build(); } + /** + * Creates a new card for a customer. + * @param customerId Required parameter: Customer id + * @param request Required parameter: Request for creating a card + * @param idempotencyKey Optional parameter: Example: + * @return Returns the GetCardResponse response from the API call + * @throws ApiException Represents error response from the server. + * @throws IOException Signals that an I/O exception of some sort has occurred. + */ + public GetCardResponse createCard( + final String customerId, + final CreateCardRequest request, + final String idempotencyKey) throws ApiException, IOException { + return prepareCreateCardRequest(customerId, request, idempotencyKey).execute(); + } + + /** + * Builds the ApiCall object for createCard. + */ + private ApiCall prepareCreateCardRequest( + final String customerId, + final CreateCardRequest request, + final String idempotencyKey) throws JsonProcessingException, IOException { + return new ApiCall.Builder() + .globalConfig(getGlobalConfiguration()) + .requestBuilder(requestBuilder -> requestBuilder + .server(Server.ENUM_DEFAULT.value()) + .path("/customers/{customer_id}/cards") + .bodyParam(param -> param.value(request)) + .bodySerializer(() -> ApiHelper.serialize(request)) + .templateParam(param -> param.key("customer_id").value(customerId) + .shouldEncode(true)) + .headerParam(param -> param.key("idempotency-key") + .value(idempotencyKey).isRequired(false)) + .headerParam(param ->param.key("content-type").value("application/json")) + .headerParam(param -> param.key("accept").value("application/json")) + .withAuth(auth -> auth + .add("httpBasic")) + .httpMethod(HttpMethod.POST)) + .responseHandler(responseHandler -> responseHandler + .deserializer( + response -> ApiHelper.deserialize(response, GetCardResponse.class)) + .nullify404(false) + .globalErrorCase(GLOBAL_ERROR_CASES)) + .build(); + } + /** * Get all Customers. * @param name Optional parameter: Name of the Customer @@ -469,300 +516,306 @@ private ApiCall prepareGetCustomersRequest( } /** - * Get all access tokens from a customer. - * @param customerId Required parameter: Customer Id - * @param page Optional parameter: Page number - * @param size Optional parameter: Page size - * @return Returns the ListAccessTokensResponse response from the API call + * Updates a customer. + * @param customerId Required parameter: Customer id + * @param request Required parameter: Request for updating a customer + * @param idempotencyKey Optional parameter: Example: + * @return Returns the GetCustomerResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public ListAccessTokensResponse getAccessTokens( + public GetCustomerResponse updateCustomer( final String customerId, - final Integer page, - final Integer size) throws ApiException, IOException { - return prepareGetAccessTokensRequest(customerId, page, size).execute(); + final UpdateCustomerRequest request, + final String idempotencyKey) throws ApiException, IOException { + return prepareUpdateCustomerRequest(customerId, request, idempotencyKey).execute(); } /** - * Builds the ApiCall object for getAccessTokens. + * Builds the ApiCall object for updateCustomer. */ - private ApiCall prepareGetAccessTokensRequest( + private ApiCall prepareUpdateCustomerRequest( final String customerId, - final Integer page, - final Integer size) throws IOException { - return new ApiCall.Builder() + final UpdateCustomerRequest request, + final String idempotencyKey) throws JsonProcessingException, IOException { + return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/customers/{customer_id}/access-tokens") - .queryParam(param -> param.key("page") - .value(page).isRequired(false)) - .queryParam(param -> param.key("size") - .value(size).isRequired(false)) + .path("/customers/{customer_id}") + .bodyParam(param -> param.value(request)) + .bodySerializer(() -> ApiHelper.serialize(request)) .templateParam(param -> param.key("customer_id").value(customerId) .shouldEncode(true)) + .headerParam(param -> param.key("idempotency-key") + .value(idempotencyKey).isRequired(false)) + .headerParam(param ->param.key("content-type").value("application/json")) .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) - .httpMethod(HttpMethod.GET)) + .httpMethod(HttpMethod.PUT)) .responseHandler(responseHandler -> responseHandler .deserializer( - response -> ApiHelper.deserialize(response, ListAccessTokensResponse.class)) + response -> ApiHelper.deserialize(response, GetCustomerResponse.class)) .nullify404(false) .globalErrorCase(GLOBAL_ERROR_CASES)) .build(); } /** - * Delete a customer's card. + * Creates a access token for a customer. * @param customerId Required parameter: Customer Id - * @param cardId Required parameter: Card Id + * @param request Required parameter: Request for creating a access token * @param idempotencyKey Optional parameter: Example: - * @return Returns the GetCardResponse response from the API call + * @return Returns the GetAccessTokenResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetCardResponse deleteCard( + public GetAccessTokenResponse createAccessToken( final String customerId, - final String cardId, + final CreateAccessTokenRequest request, final String idempotencyKey) throws ApiException, IOException { - return prepareDeleteCardRequest(customerId, cardId, idempotencyKey).execute(); + return prepareCreateAccessTokenRequest(customerId, request, idempotencyKey).execute(); } /** - * Builds the ApiCall object for deleteCard. + * Builds the ApiCall object for createAccessToken. */ - private ApiCall prepareDeleteCardRequest( + private ApiCall prepareCreateAccessTokenRequest( final String customerId, - final String cardId, - final String idempotencyKey) throws IOException { - return new ApiCall.Builder() + final CreateAccessTokenRequest request, + final String idempotencyKey) throws JsonProcessingException, IOException { + return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/customers/{customer_id}/cards/{card_id}") + .path("/customers/{customer_id}/access-tokens") + .bodyParam(param -> param.value(request)) + .bodySerializer(() -> ApiHelper.serialize(request)) .templateParam(param -> param.key("customer_id").value(customerId) .shouldEncode(true)) - .templateParam(param -> param.key("card_id").value(cardId) - .shouldEncode(true)) .headerParam(param -> param.key("idempotency-key") .value(idempotencyKey).isRequired(false)) + .headerParam(param ->param.key("content-type").value("application/json")) .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) - .httpMethod(HttpMethod.DELETE)) + .httpMethod(HttpMethod.POST)) .responseHandler(responseHandler -> responseHandler .deserializer( - response -> ApiHelper.deserialize(response, GetCardResponse.class)) + response -> ApiHelper.deserialize(response, GetAccessTokenResponse.class)) .nullify404(false) .globalErrorCase(GLOBAL_ERROR_CASES)) .build(); } /** - * Get a customer's card. - * @param customerId Required parameter: Customer id - * @param cardId Required parameter: Card id - * @return Returns the GetCardResponse response from the API call + * Get all access tokens from a customer. + * @param customerId Required parameter: Customer Id + * @param page Optional parameter: Page number + * @param size Optional parameter: Page size + * @return Returns the ListAccessTokensResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetCardResponse getCard( + public ListAccessTokensResponse getAccessTokens( final String customerId, - final String cardId) throws ApiException, IOException { - return prepareGetCardRequest(customerId, cardId).execute(); + final Integer page, + final Integer size) throws ApiException, IOException { + return prepareGetAccessTokensRequest(customerId, page, size).execute(); } /** - * Builds the ApiCall object for getCard. + * Builds the ApiCall object for getAccessTokens. */ - private ApiCall prepareGetCardRequest( + private ApiCall prepareGetAccessTokensRequest( final String customerId, - final String cardId) throws IOException { - return new ApiCall.Builder() + final Integer page, + final Integer size) throws IOException { + return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/customers/{customer_id}/cards/{card_id}") + .path("/customers/{customer_id}/access-tokens") + .queryParam(param -> param.key("page") + .value(page).isRequired(false)) + .queryParam(param -> param.key("size") + .value(size).isRequired(false)) .templateParam(param -> param.key("customer_id").value(customerId) .shouldEncode(true)) - .templateParam(param -> param.key("card_id").value(cardId) - .shouldEncode(true)) .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) .httpMethod(HttpMethod.GET)) .responseHandler(responseHandler -> responseHandler .deserializer( - response -> ApiHelper.deserialize(response, GetCardResponse.class)) + response -> ApiHelper.deserialize(response, ListAccessTokensResponse.class)) .nullify404(false) .globalErrorCase(GLOBAL_ERROR_CASES)) .build(); } /** - * Creates a new card for a customer. - * @param customerId Required parameter: Customer id - * @param request Required parameter: Request for creating a card - * @param idempotencyKey Optional parameter: Example: - * @return Returns the GetCardResponse response from the API call + * Get all cards from a customer. + * @param customerId Required parameter: Customer Id + * @param page Optional parameter: Page number + * @param size Optional parameter: Page size + * @return Returns the ListCardsResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetCardResponse createCard( + public ListCardsResponse getCards( final String customerId, - final CreateCardRequest request, - final String idempotencyKey) throws ApiException, IOException { - return prepareCreateCardRequest(customerId, request, idempotencyKey).execute(); + final Integer page, + final Integer size) throws ApiException, IOException { + return prepareGetCardsRequest(customerId, page, size).execute(); } /** - * Builds the ApiCall object for createCard. + * Builds the ApiCall object for getCards. */ - private ApiCall prepareCreateCardRequest( + private ApiCall prepareGetCardsRequest( final String customerId, - final CreateCardRequest request, - final String idempotencyKey) throws JsonProcessingException, IOException { - return new ApiCall.Builder() + final Integer page, + final Integer size) throws IOException { + return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) .path("/customers/{customer_id}/cards") - .bodyParam(param -> param.value(request)) - .bodySerializer(() -> ApiHelper.serialize(request)) + .queryParam(param -> param.key("page") + .value(page).isRequired(false)) + .queryParam(param -> param.key("size") + .value(size).isRequired(false)) .templateParam(param -> param.key("customer_id").value(customerId) .shouldEncode(true)) - .headerParam(param -> param.key("idempotency-key") - .value(idempotencyKey).isRequired(false)) - .headerParam(param ->param.key("content-type").value("application/json")) .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) - .httpMethod(HttpMethod.POST)) + .httpMethod(HttpMethod.GET)) .responseHandler(responseHandler -> responseHandler .deserializer( - response -> ApiHelper.deserialize(response, GetCardResponse.class)) + response -> ApiHelper.deserialize(response, ListCardsResponse.class)) .nullify404(false) .globalErrorCase(GLOBAL_ERROR_CASES)) .build(); } /** - * Get a Customer's access token. - * @param customerId Required parameter: Customer Id - * @param tokenId Required parameter: Token Id - * @return Returns the GetAccessTokenResponse response from the API call + * Renew a card. + * @param customerId Required parameter: Customer id + * @param cardId Required parameter: Card Id + * @param idempotencyKey Optional parameter: Example: + * @return Returns the GetCardResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetAccessTokenResponse getAccessToken( + public GetCardResponse renewCard( final String customerId, - final String tokenId) throws ApiException, IOException { - return prepareGetAccessTokenRequest(customerId, tokenId).execute(); + final String cardId, + final String idempotencyKey) throws ApiException, IOException { + return prepareRenewCardRequest(customerId, cardId, idempotencyKey).execute(); } /** - * Builds the ApiCall object for getAccessToken. + * Builds the ApiCall object for renewCard. */ - private ApiCall prepareGetAccessTokenRequest( + private ApiCall prepareRenewCardRequest( final String customerId, - final String tokenId) throws IOException { - return new ApiCall.Builder() + final String cardId, + final String idempotencyKey) throws IOException { + return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/customers/{customer_id}/access-tokens/{token_id}") + .path("/customers/{customer_id}/cards/{card_id}/renew") .templateParam(param -> param.key("customer_id").value(customerId) .shouldEncode(true)) - .templateParam(param -> param.key("token_id").value(tokenId) + .templateParam(param -> param.key("card_id").value(cardId) .shouldEncode(true)) + .headerParam(param -> param.key("idempotency-key") + .value(idempotencyKey).isRequired(false)) .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) - .httpMethod(HttpMethod.GET)) + .httpMethod(HttpMethod.POST)) .responseHandler(responseHandler -> responseHandler .deserializer( - response -> ApiHelper.deserialize(response, GetAccessTokenResponse.class)) + response -> ApiHelper.deserialize(response, GetCardResponse.class)) .nullify404(false) .globalErrorCase(GLOBAL_ERROR_CASES)) .build(); } /** - * Gets all adressess from a customer. - * @param customerId Required parameter: Customer id - * @param page Optional parameter: Page number - * @param size Optional parameter: Page size - * @return Returns the ListAddressesResponse response from the API call + * Get a Customer's access token. + * @param customerId Required parameter: Customer Id + * @param tokenId Required parameter: Token Id + * @return Returns the GetAccessTokenResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public ListAddressesResponse getAddresses( + public GetAccessTokenResponse getAccessToken( final String customerId, - final Integer page, - final Integer size) throws ApiException, IOException { - return prepareGetAddressesRequest(customerId, page, size).execute(); + final String tokenId) throws ApiException, IOException { + return prepareGetAccessTokenRequest(customerId, tokenId).execute(); } /** - * Builds the ApiCall object for getAddresses. + * Builds the ApiCall object for getAccessToken. */ - private ApiCall prepareGetAddressesRequest( + private ApiCall prepareGetAccessTokenRequest( final String customerId, - final Integer page, - final Integer size) throws IOException { - return new ApiCall.Builder() + final String tokenId) throws IOException { + return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/customers/{customer_id}/addresses") - .queryParam(param -> param.key("page") - .value(page).isRequired(false)) - .queryParam(param -> param.key("size") - .value(size).isRequired(false)) + .path("/customers/{customer_id}/access-tokens/{token_id}") .templateParam(param -> param.key("customer_id").value(customerId) .shouldEncode(true)) + .templateParam(param -> param.key("token_id").value(tokenId) + .shouldEncode(true)) .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) .httpMethod(HttpMethod.GET)) .responseHandler(responseHandler -> responseHandler .deserializer( - response -> ApiHelper.deserialize(response, ListAddressesResponse.class)) + response -> ApiHelper.deserialize(response, GetAccessTokenResponse.class)) .nullify404(false) .globalErrorCase(GLOBAL_ERROR_CASES)) .build(); } /** - * Updates a customer. - * @param customerId Required parameter: Customer id - * @param request Required parameter: Request for updating a customer + * Updates the metadata a customer. + * @param customerId Required parameter: The customer id + * @param request Required parameter: Request for updating the customer metadata * @param idempotencyKey Optional parameter: Example: * @return Returns the GetCustomerResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetCustomerResponse updateCustomer( + public GetCustomerResponse updateCustomerMetadata( final String customerId, - final UpdateCustomerRequest request, + final UpdateMetadataRequest request, final String idempotencyKey) throws ApiException, IOException { - return prepareUpdateCustomerRequest(customerId, request, idempotencyKey).execute(); + return prepareUpdateCustomerMetadataRequest(customerId, request, idempotencyKey).execute(); } /** - * Builds the ApiCall object for updateCustomer. + * Builds the ApiCall object for updateCustomerMetadata. */ - private ApiCall prepareUpdateCustomerRequest( + private ApiCall prepareUpdateCustomerMetadataRequest( final String customerId, - final UpdateCustomerRequest request, + final UpdateMetadataRequest request, final String idempotencyKey) throws JsonProcessingException, IOException { return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/customers/{customer_id}") + .path("/Customers/{customer_id}/metadata") .bodyParam(param -> param.value(request)) .bodySerializer(() -> ApiHelper.serialize(request)) .templateParam(param -> param.key("customer_id").value(customerId) @@ -773,7 +826,7 @@ private ApiCall prepareUpdateCustomerRequest( .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) - .httpMethod(HttpMethod.PUT)) + .httpMethod(HttpMethod.PATCH)) .responseHandler(responseHandler -> responseHandler .deserializer( response -> ApiHelper.deserialize(response, GetCustomerResponse.class)) @@ -783,80 +836,79 @@ private ApiCall prepareUpdateCustomerRequest( } /** - * Creates a access token for a customer. + * Delete a customer's card. * @param customerId Required parameter: Customer Id - * @param request Required parameter: Request for creating a access token + * @param cardId Required parameter: Card Id * @param idempotencyKey Optional parameter: Example: - * @return Returns the GetAccessTokenResponse response from the API call + * @return Returns the GetCardResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetAccessTokenResponse createAccessToken( + public GetCardResponse deleteCard( final String customerId, - final CreateAccessTokenRequest request, + final String cardId, final String idempotencyKey) throws ApiException, IOException { - return prepareCreateAccessTokenRequest(customerId, request, idempotencyKey).execute(); + return prepareDeleteCardRequest(customerId, cardId, idempotencyKey).execute(); } /** - * Builds the ApiCall object for createAccessToken. + * Builds the ApiCall object for deleteCard. */ - private ApiCall prepareCreateAccessTokenRequest( + private ApiCall prepareDeleteCardRequest( final String customerId, - final CreateAccessTokenRequest request, - final String idempotencyKey) throws JsonProcessingException, IOException { - return new ApiCall.Builder() + final String cardId, + final String idempotencyKey) throws IOException { + return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/customers/{customer_id}/access-tokens") - .bodyParam(param -> param.value(request)) - .bodySerializer(() -> ApiHelper.serialize(request)) + .path("/customers/{customer_id}/cards/{card_id}") .templateParam(param -> param.key("customer_id").value(customerId) .shouldEncode(true)) + .templateParam(param -> param.key("card_id").value(cardId) + .shouldEncode(true)) .headerParam(param -> param.key("idempotency-key") .value(idempotencyKey).isRequired(false)) - .headerParam(param ->param.key("content-type").value("application/json")) .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) - .httpMethod(HttpMethod.POST)) + .httpMethod(HttpMethod.DELETE)) .responseHandler(responseHandler -> responseHandler .deserializer( - response -> ApiHelper.deserialize(response, GetAccessTokenResponse.class)) + response -> ApiHelper.deserialize(response, GetCardResponse.class)) .nullify404(false) .globalErrorCase(GLOBAL_ERROR_CASES)) .build(); } /** - * Get all cards from a customer. - * @param customerId Required parameter: Customer Id + * Gets all adressess from a customer. + * @param customerId Required parameter: Customer id * @param page Optional parameter: Page number * @param size Optional parameter: Page size - * @return Returns the ListCardsResponse response from the API call + * @return Returns the ListAddressesResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public ListCardsResponse getCards( + public ListAddressesResponse getAddresses( final String customerId, final Integer page, final Integer size) throws ApiException, IOException { - return prepareGetCardsRequest(customerId, page, size).execute(); + return prepareGetAddressesRequest(customerId, page, size).execute(); } /** - * Builds the ApiCall object for getCards. + * Builds the ApiCall object for getAddresses. */ - private ApiCall prepareGetCardsRequest( + private ApiCall prepareGetAddressesRequest( final String customerId, final Integer page, final Integer size) throws IOException { - return new ApiCall.Builder() + return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/customers/{customer_id}/cards") + .path("/customers/{customer_id}/addresses") .queryParam(param -> param.key("page") .value(page).isRequired(false)) .queryParam(param -> param.key("size") @@ -869,97 +921,40 @@ private ApiCall prepareGetCardsRequest( .httpMethod(HttpMethod.GET)) .responseHandler(responseHandler -> responseHandler .deserializer( - response -> ApiHelper.deserialize(response, ListCardsResponse.class)) - .nullify404(false) - .globalErrorCase(GLOBAL_ERROR_CASES)) - .build(); - } - - /** - * Renew a card. - * @param customerId Required parameter: Customer id - * @param cardId Required parameter: Card Id - * @param idempotencyKey Optional parameter: Example: - * @return Returns the GetCardResponse response from the API call - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - public GetCardResponse renewCard( - final String customerId, - final String cardId, - final String idempotencyKey) throws ApiException, IOException { - return prepareRenewCardRequest(customerId, cardId, idempotencyKey).execute(); - } - - /** - * Builds the ApiCall object for renewCard. - */ - private ApiCall prepareRenewCardRequest( - final String customerId, - final String cardId, - final String idempotencyKey) throws IOException { - return new ApiCall.Builder() - .globalConfig(getGlobalConfiguration()) - .requestBuilder(requestBuilder -> requestBuilder - .server(Server.ENUM_DEFAULT.value()) - .path("/customers/{customer_id}/cards/{card_id}/renew") - .templateParam(param -> param.key("customer_id").value(customerId) - .shouldEncode(true)) - .templateParam(param -> param.key("card_id").value(cardId) - .shouldEncode(true)) - .headerParam(param -> param.key("idempotency-key") - .value(idempotencyKey).isRequired(false)) - .headerParam(param -> param.key("accept").value("application/json")) - .withAuth(auth -> auth - .add("httpBasic")) - .httpMethod(HttpMethod.POST)) - .responseHandler(responseHandler -> responseHandler - .deserializer( - response -> ApiHelper.deserialize(response, GetCardResponse.class)) + response -> ApiHelper.deserialize(response, ListAddressesResponse.class)) .nullify404(false) .globalErrorCase(GLOBAL_ERROR_CASES)) .build(); } /** - * Updates the metadata a customer. - * @param customerId Required parameter: The customer id - * @param request Required parameter: Request for updating the customer metadata - * @param idempotencyKey Optional parameter: Example: + * Get a customer. + * @param customerId Required parameter: Customer Id * @return Returns the GetCustomerResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetCustomerResponse updateCustomerMetadata( - final String customerId, - final UpdateMetadataRequest request, - final String idempotencyKey) throws ApiException, IOException { - return prepareUpdateCustomerMetadataRequest(customerId, request, idempotencyKey).execute(); + public GetCustomerResponse getCustomer( + final String customerId) throws ApiException, IOException { + return prepareGetCustomerRequest(customerId).execute(); } /** - * Builds the ApiCall object for updateCustomerMetadata. + * Builds the ApiCall object for getCustomer. */ - private ApiCall prepareUpdateCustomerMetadataRequest( - final String customerId, - final UpdateMetadataRequest request, - final String idempotencyKey) throws JsonProcessingException, IOException { + private ApiCall prepareGetCustomerRequest( + final String customerId) throws IOException { return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/Customers/{customer_id}/metadata") - .bodyParam(param -> param.value(request)) - .bodySerializer(() -> ApiHelper.serialize(request)) + .path("/customers/{customer_id}") .templateParam(param -> param.key("customer_id").value(customerId) .shouldEncode(true)) - .headerParam(param -> param.key("idempotency-key") - .value(idempotencyKey).isRequired(false)) - .headerParam(param ->param.key("content-type").value("application/json")) .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) - .httpMethod(HttpMethod.PATCH)) + .httpMethod(HttpMethod.GET)) .responseHandler(responseHandler -> responseHandler .deserializer( response -> ApiHelper.deserialize(response, GetCustomerResponse.class)) @@ -969,36 +964,41 @@ private ApiCall prepareUpdateCustomerMetadata } /** - * Get a customer. - * @param customerId Required parameter: Customer Id - * @return Returns the GetCustomerResponse response from the API call + * Get a customer's card. + * @param customerId Required parameter: Customer id + * @param cardId Required parameter: Card id + * @return Returns the GetCardResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetCustomerResponse getCustomer( - final String customerId) throws ApiException, IOException { - return prepareGetCustomerRequest(customerId).execute(); + public GetCardResponse getCard( + final String customerId, + final String cardId) throws ApiException, IOException { + return prepareGetCardRequest(customerId, cardId).execute(); } /** - * Builds the ApiCall object for getCustomer. + * Builds the ApiCall object for getCard. */ - private ApiCall prepareGetCustomerRequest( - final String customerId) throws IOException { - return new ApiCall.Builder() + private ApiCall prepareGetCardRequest( + final String customerId, + final String cardId) throws IOException { + return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/customers/{customer_id}") + .path("/customers/{customer_id}/cards/{card_id}") .templateParam(param -> param.key("customer_id").value(customerId) .shouldEncode(true)) + .templateParam(param -> param.key("card_id").value(cardId) + .shouldEncode(true)) .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) .httpMethod(HttpMethod.GET)) .responseHandler(responseHandler -> responseHandler .deserializer( - response -> ApiHelper.deserialize(response, GetCustomerResponse.class)) + response -> ApiHelper.deserialize(response, GetCardResponse.class)) .nullify404(false) .globalErrorCase(GLOBAL_ERROR_CASES)) .build(); diff --git a/src/main/java/me/pagar/api/controllers/DefaultInvoicesController.java b/src/main/java/me/pagar/api/controllers/DefaultInvoicesController.java index d80c162..7330636 100644 --- a/src/main/java/me/pagar/api/controllers/DefaultInvoicesController.java +++ b/src/main/java/me/pagar/api/controllers/DefaultInvoicesController.java @@ -36,125 +36,79 @@ public DefaultInvoicesController(GlobalConfiguration globalConfig) { } /** - * Gets all invoices. - * @param page Optional parameter: Page number - * @param size Optional parameter: Page size - * @param code Optional parameter: Filter for Invoice's code - * @param customerId Optional parameter: Filter for Invoice's customer id - * @param subscriptionId Optional parameter: Filter for Invoice's subscription id - * @param createdSince Optional parameter: Filter for Invoice's creation date start range - * @param createdUntil Optional parameter: Filter for Invoices creation date end range - * @param status Optional parameter: Filter for Invoice's status - * @param dueSince Optional parameter: Filter for Invoice's due date start range - * @param dueUntil Optional parameter: Filter for Invoice's due date end range - * @param customerDocument Optional parameter: Example: - * @return Returns the ListInvoicesResponse response from the API call + * Updates the metadata from an invoice. + * @param invoiceId Required parameter: The invoice id + * @param request Required parameter: Request for updating the invoice metadata + * @param idempotencyKey Optional parameter: Example: + * @return Returns the GetInvoiceResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public ListInvoicesResponse getInvoices( - final Integer page, - final Integer size, - final String code, - final String customerId, - final String subscriptionId, - final LocalDateTime createdSince, - final LocalDateTime createdUntil, - final String status, - final LocalDateTime dueSince, - final LocalDateTime dueUntil, - final String customerDocument) throws ApiException, IOException { - return prepareGetInvoicesRequest(page, size, code, customerId, subscriptionId, createdSince, - createdUntil, status, dueSince, dueUntil, customerDocument).execute(); + public GetInvoiceResponse updateInvoiceMetadata( + final String invoiceId, + final UpdateMetadataRequest request, + final String idempotencyKey) throws ApiException, IOException { + return prepareUpdateInvoiceMetadataRequest(invoiceId, request, idempotencyKey).execute(); } /** - * Builds the ApiCall object for getInvoices. + * Builds the ApiCall object for updateInvoiceMetadata. */ - private ApiCall prepareGetInvoicesRequest( - final Integer page, - final Integer size, - final String code, - final String customerId, - final String subscriptionId, - final LocalDateTime createdSince, - final LocalDateTime createdUntil, - final String status, - final LocalDateTime dueSince, - final LocalDateTime dueUntil, - final String customerDocument) throws IOException { - return new ApiCall.Builder() + private ApiCall prepareUpdateInvoiceMetadataRequest( + final String invoiceId, + final UpdateMetadataRequest request, + final String idempotencyKey) throws JsonProcessingException, IOException { + return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/invoices") - .queryParam(param -> param.key("page") - .value(page).isRequired(false)) - .queryParam(param -> param.key("size") - .value(size).isRequired(false)) - .queryParam(param -> param.key("code") - .value(code).isRequired(false)) - .queryParam(param -> param.key("customer_id") - .value(customerId).isRequired(false)) - .queryParam(param -> param.key("subscription_id") - .value(subscriptionId).isRequired(false)) - .queryParam(param -> param.key("created_since") - .value(DateTimeHelper.toRfc8601DateTime(createdSince)).isRequired(false)) - .queryParam(param -> param.key("created_until") - .value(DateTimeHelper.toRfc8601DateTime(createdUntil)).isRequired(false)) - .queryParam(param -> param.key("status") - .value(status).isRequired(false)) - .queryParam(param -> param.key("due_since") - .value(DateTimeHelper.toRfc8601DateTime(dueSince)).isRequired(false)) - .queryParam(param -> param.key("due_until") - .value(DateTimeHelper.toRfc8601DateTime(dueUntil)).isRequired(false)) - .queryParam(param -> param.key("customer_document") - .value(customerDocument).isRequired(false)) + .path("/invoices/{invoice_id}/metadata") + .bodyParam(param -> param.value(request)) + .bodySerializer(() -> ApiHelper.serialize(request)) + .templateParam(param -> param.key("invoice_id").value(invoiceId) + .shouldEncode(true)) + .headerParam(param -> param.key("idempotency-key") + .value(idempotencyKey).isRequired(false)) + .headerParam(param ->param.key("content-type").value("application/json")) .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) - .httpMethod(HttpMethod.GET)) + .httpMethod(HttpMethod.PATCH)) .responseHandler(responseHandler -> responseHandler .deserializer( - response -> ApiHelper.deserialize(response, ListInvoicesResponse.class)) + response -> ApiHelper.deserialize(response, GetInvoiceResponse.class)) .nullify404(false) .globalErrorCase(GLOBAL_ERROR_CASES)) .build(); } /** - * Cancels an invoice. - * @param invoiceId Required parameter: Invoice id - * @param idempotencyKey Optional parameter: Example: + * @param subscriptionId Required parameter: Subscription Id * @return Returns the GetInvoiceResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetInvoiceResponse cancelInvoice( - final String invoiceId, - final String idempotencyKey) throws ApiException, IOException { - return prepareCancelInvoiceRequest(invoiceId, idempotencyKey).execute(); + public GetInvoiceResponse getPartialInvoice( + final String subscriptionId) throws ApiException, IOException { + return prepareGetPartialInvoiceRequest(subscriptionId).execute(); } /** - * Builds the ApiCall object for cancelInvoice. + * Builds the ApiCall object for getPartialInvoice. */ - private ApiCall prepareCancelInvoiceRequest( - final String invoiceId, - final String idempotencyKey) throws IOException { + private ApiCall prepareGetPartialInvoiceRequest( + final String subscriptionId) throws IOException { return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/invoices/{invoice_id}") - .templateParam(param -> param.key("invoice_id").value(invoiceId) + .path("/subscriptions/{subscription_id}/partial-invoice") + .templateParam(param -> param.key("subscription_id").value(subscriptionId) .shouldEncode(true)) - .headerParam(param -> param.key("idempotency-key") - .value(idempotencyKey).isRequired(false)) .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) - .httpMethod(HttpMethod.DELETE)) + .httpMethod(HttpMethod.GET)) .responseHandler(responseHandler -> responseHandler .deserializer( response -> ApiHelper.deserialize(response, GetInvoiceResponse.class)) @@ -164,44 +118,38 @@ private ApiCall prepareCancelInvoiceRequest( } /** - * Updates the status from an invoice. - * @param invoiceId Required parameter: Invoice Id - * @param request Required parameter: Request for updating an invoice's status + * Cancels an invoice. + * @param invoiceId Required parameter: Invoice id * @param idempotencyKey Optional parameter: Example: * @return Returns the GetInvoiceResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetInvoiceResponse updateInvoiceStatus( + public GetInvoiceResponse cancelInvoice( final String invoiceId, - final UpdateInvoiceStatusRequest request, final String idempotencyKey) throws ApiException, IOException { - return prepareUpdateInvoiceStatusRequest(invoiceId, request, idempotencyKey).execute(); + return prepareCancelInvoiceRequest(invoiceId, idempotencyKey).execute(); } /** - * Builds the ApiCall object for updateInvoiceStatus. + * Builds the ApiCall object for cancelInvoice. */ - private ApiCall prepareUpdateInvoiceStatusRequest( + private ApiCall prepareCancelInvoiceRequest( final String invoiceId, - final UpdateInvoiceStatusRequest request, - final String idempotencyKey) throws JsonProcessingException, IOException { + final String idempotencyKey) throws IOException { return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/invoices/{invoice_id}/status") - .bodyParam(param -> param.value(request)) - .bodySerializer(() -> ApiHelper.serialize(request)) + .path("/invoices/{invoice_id}") .templateParam(param -> param.key("invoice_id").value(invoiceId) .shouldEncode(true)) .headerParam(param -> param.key("idempotency-key") .value(idempotencyKey).isRequired(false)) - .headerParam(param ->param.key("content-type").value("application/json")) .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) - .httpMethod(HttpMethod.PATCH)) + .httpMethod(HttpMethod.DELETE)) .responseHandler(responseHandler -> responseHandler .deserializer( response -> ApiHelper.deserialize(response, GetInvoiceResponse.class)) @@ -211,36 +159,42 @@ private ApiCall prepareUpdateInvoiceStatusRequ } /** - * Updates the metadata from an invoice. - * @param invoiceId Required parameter: The invoice id - * @param request Required parameter: Request for updating the invoice metadata + * Create an Invoice. + * @param subscriptionId Required parameter: Subscription Id + * @param cycleId Required parameter: Cycle Id + * @param request Optional parameter: Example: * @param idempotencyKey Optional parameter: Example: * @return Returns the GetInvoiceResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetInvoiceResponse updateInvoiceMetadata( - final String invoiceId, - final UpdateMetadataRequest request, + public GetInvoiceResponse createInvoice( + final String subscriptionId, + final String cycleId, + final CreateInvoiceRequest request, final String idempotencyKey) throws ApiException, IOException { - return prepareUpdateInvoiceMetadataRequest(invoiceId, request, idempotencyKey).execute(); + return prepareCreateInvoiceRequest(subscriptionId, cycleId, request, + idempotencyKey).execute(); } /** - * Builds the ApiCall object for updateInvoiceMetadata. + * Builds the ApiCall object for createInvoice. */ - private ApiCall prepareUpdateInvoiceMetadataRequest( - final String invoiceId, - final UpdateMetadataRequest request, + private ApiCall prepareCreateInvoiceRequest( + final String subscriptionId, + final String cycleId, + final CreateInvoiceRequest request, final String idempotencyKey) throws JsonProcessingException, IOException { return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/invoices/{invoice_id}/metadata") - .bodyParam(param -> param.value(request)) + .path("/subscriptions/{subscription_id}/cycles/{cycle_id}/pay") + .bodyParam(param -> param.value(request).isRequired(false)) .bodySerializer(() -> ApiHelper.serialize(request)) - .templateParam(param -> param.key("invoice_id").value(invoiceId) + .templateParam(param -> param.key("subscription_id").value(subscriptionId) + .shouldEncode(true)) + .templateParam(param -> param.key("cycle_id").value(cycleId) .shouldEncode(true)) .headerParam(param -> param.key("idempotency-key") .value(idempotencyKey).isRequired(false)) @@ -248,7 +202,7 @@ private ApiCall prepareUpdateInvoiceMetadataRe .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) - .httpMethod(HttpMethod.PATCH)) + .httpMethod(HttpMethod.POST)) .responseHandler(responseHandler -> responseHandler .deserializer( response -> ApiHelper.deserialize(response, GetInvoiceResponse.class)) @@ -258,85 +212,120 @@ private ApiCall prepareUpdateInvoiceMetadataRe } /** - * @param subscriptionId Required parameter: Subscription Id - * @return Returns the GetInvoiceResponse response from the API call + * Gets all invoices. + * @param page Optional parameter: Page number + * @param size Optional parameter: Page size + * @param code Optional parameter: Filter for Invoice's code + * @param customerId Optional parameter: Filter for Invoice's customer id + * @param subscriptionId Optional parameter: Filter for Invoice's subscription id + * @param createdSince Optional parameter: Filter for Invoice's creation date start range + * @param createdUntil Optional parameter: Filter for Invoices creation date end range + * @param status Optional parameter: Filter for Invoice's status + * @param dueSince Optional parameter: Filter for Invoice's due date start range + * @param dueUntil Optional parameter: Filter for Invoice's due date end range + * @param customerDocument Optional parameter: Example: + * @return Returns the ListInvoicesResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetInvoiceResponse getPartialInvoice( - final String subscriptionId) throws ApiException, IOException { - return prepareGetPartialInvoiceRequest(subscriptionId).execute(); + public ListInvoicesResponse getInvoices( + final Integer page, + final Integer size, + final String code, + final String customerId, + final String subscriptionId, + final LocalDateTime createdSince, + final LocalDateTime createdUntil, + final String status, + final LocalDateTime dueSince, + final LocalDateTime dueUntil, + final String customerDocument) throws ApiException, IOException { + return prepareGetInvoicesRequest(page, size, code, customerId, subscriptionId, createdSince, + createdUntil, status, dueSince, dueUntil, customerDocument).execute(); } /** - * Builds the ApiCall object for getPartialInvoice. + * Builds the ApiCall object for getInvoices. */ - private ApiCall prepareGetPartialInvoiceRequest( - final String subscriptionId) throws IOException { - return new ApiCall.Builder() + private ApiCall prepareGetInvoicesRequest( + final Integer page, + final Integer size, + final String code, + final String customerId, + final String subscriptionId, + final LocalDateTime createdSince, + final LocalDateTime createdUntil, + final String status, + final LocalDateTime dueSince, + final LocalDateTime dueUntil, + final String customerDocument) throws IOException { + return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/subscriptions/{subscription_id}/partial-invoice") - .templateParam(param -> param.key("subscription_id").value(subscriptionId) - .shouldEncode(true)) + .path("/invoices") + .queryParam(param -> param.key("page") + .value(page).isRequired(false)) + .queryParam(param -> param.key("size") + .value(size).isRequired(false)) + .queryParam(param -> param.key("code") + .value(code).isRequired(false)) + .queryParam(param -> param.key("customer_id") + .value(customerId).isRequired(false)) + .queryParam(param -> param.key("subscription_id") + .value(subscriptionId).isRequired(false)) + .queryParam(param -> param.key("created_since") + .value(DateTimeHelper.toRfc8601DateTime(createdSince)).isRequired(false)) + .queryParam(param -> param.key("created_until") + .value(DateTimeHelper.toRfc8601DateTime(createdUntil)).isRequired(false)) + .queryParam(param -> param.key("status") + .value(status).isRequired(false)) + .queryParam(param -> param.key("due_since") + .value(DateTimeHelper.toRfc8601DateTime(dueSince)).isRequired(false)) + .queryParam(param -> param.key("due_until") + .value(DateTimeHelper.toRfc8601DateTime(dueUntil)).isRequired(false)) + .queryParam(param -> param.key("customer_document") + .value(customerDocument).isRequired(false)) .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) .httpMethod(HttpMethod.GET)) .responseHandler(responseHandler -> responseHandler .deserializer( - response -> ApiHelper.deserialize(response, GetInvoiceResponse.class)) + response -> ApiHelper.deserialize(response, ListInvoicesResponse.class)) .nullify404(false) .globalErrorCase(GLOBAL_ERROR_CASES)) .build(); } /** - * Create an Invoice. - * @param subscriptionId Required parameter: Subscription Id - * @param cycleId Required parameter: Cycle Id - * @param request Optional parameter: Example: - * @param idempotencyKey Optional parameter: Example: + * Gets an invoice. + * @param invoiceId Required parameter: Invoice Id * @return Returns the GetInvoiceResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetInvoiceResponse createInvoice( - final String subscriptionId, - final String cycleId, - final CreateInvoiceRequest request, - final String idempotencyKey) throws ApiException, IOException { - return prepareCreateInvoiceRequest(subscriptionId, cycleId, request, - idempotencyKey).execute(); + public GetInvoiceResponse getInvoice( + final String invoiceId) throws ApiException, IOException { + return prepareGetInvoiceRequest(invoiceId).execute(); } /** - * Builds the ApiCall object for createInvoice. + * Builds the ApiCall object for getInvoice. */ - private ApiCall prepareCreateInvoiceRequest( - final String subscriptionId, - final String cycleId, - final CreateInvoiceRequest request, - final String idempotencyKey) throws JsonProcessingException, IOException { + private ApiCall prepareGetInvoiceRequest( + final String invoiceId) throws IOException { return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/subscriptions/{subscription_id}/cycles/{cycle_id}/pay") - .bodyParam(param -> param.value(request).isRequired(false)) - .bodySerializer(() -> ApiHelper.serialize(request)) - .templateParam(param -> param.key("subscription_id").value(subscriptionId) - .shouldEncode(true)) - .templateParam(param -> param.key("cycle_id").value(cycleId) + .path("/invoices/{invoice_id}") + .templateParam(param -> param.key("invoice_id").value(invoiceId) .shouldEncode(true)) - .headerParam(param -> param.key("idempotency-key") - .value(idempotencyKey).isRequired(false)) - .headerParam(param ->param.key("content-type").value("application/json")) .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) - .httpMethod(HttpMethod.POST)) + .httpMethod(HttpMethod.GET)) .responseHandler(responseHandler -> responseHandler .deserializer( response -> ApiHelper.deserialize(response, GetInvoiceResponse.class)) @@ -346,33 +335,44 @@ private ApiCall prepareCreateInvoiceRequest( } /** - * Gets an invoice. + * Updates the status from an invoice. * @param invoiceId Required parameter: Invoice Id + * @param request Required parameter: Request for updating an invoice's status + * @param idempotencyKey Optional parameter: Example: * @return Returns the GetInvoiceResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetInvoiceResponse getInvoice( - final String invoiceId) throws ApiException, IOException { - return prepareGetInvoiceRequest(invoiceId).execute(); + public GetInvoiceResponse updateInvoiceStatus( + final String invoiceId, + final UpdateInvoiceStatusRequest request, + final String idempotencyKey) throws ApiException, IOException { + return prepareUpdateInvoiceStatusRequest(invoiceId, request, idempotencyKey).execute(); } /** - * Builds the ApiCall object for getInvoice. + * Builds the ApiCall object for updateInvoiceStatus. */ - private ApiCall prepareGetInvoiceRequest( - final String invoiceId) throws IOException { + private ApiCall prepareUpdateInvoiceStatusRequest( + final String invoiceId, + final UpdateInvoiceStatusRequest request, + final String idempotencyKey) throws JsonProcessingException, IOException { return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/invoices/{invoice_id}") + .path("/invoices/{invoice_id}/status") + .bodyParam(param -> param.value(request)) + .bodySerializer(() -> ApiHelper.serialize(request)) .templateParam(param -> param.key("invoice_id").value(invoiceId) .shouldEncode(true)) + .headerParam(param -> param.key("idempotency-key") + .value(idempotencyKey).isRequired(false)) + .headerParam(param ->param.key("content-type").value("application/json")) .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) - .httpMethod(HttpMethod.GET)) + .httpMethod(HttpMethod.PATCH)) .responseHandler(responseHandler -> responseHandler .deserializer( response -> ApiHelper.deserialize(response, GetInvoiceResponse.class)) diff --git a/src/main/java/me/pagar/api/controllers/DefaultOrdersController.java b/src/main/java/me/pagar/api/controllers/DefaultOrdersController.java index 561145f..a51600a 100644 --- a/src/main/java/me/pagar/api/controllers/DefaultOrdersController.java +++ b/src/main/java/me/pagar/api/controllers/DefaultOrdersController.java @@ -39,40 +39,67 @@ public DefaultOrdersController(GlobalConfiguration globalConfig) { } /** - * @param orderId Required parameter: Order Id - * @param idempotencyKey Optional parameter: Example: - * @return Returns the GetOrderResponse response from the API call + * Gets all orders. + * @param page Optional parameter: Page number + * @param size Optional parameter: Page size + * @param code Optional parameter: Filter for order's code + * @param status Optional parameter: Filter for order's status + * @param createdSince Optional parameter: Filter for order's creation date start range + * @param createdUntil Optional parameter: Filter for order's creation date end range + * @param customerId Optional parameter: Filter for order's customer id + * @return Returns the ListOrderResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetOrderResponse deleteAllOrderItems( - final String orderId, - final String idempotencyKey) throws ApiException, IOException { - return prepareDeleteAllOrderItemsRequest(orderId, idempotencyKey).execute(); + public ListOrderResponse getOrders( + final Integer page, + final Integer size, + final String code, + final String status, + final LocalDateTime createdSince, + final LocalDateTime createdUntil, + final String customerId) throws ApiException, IOException { + return prepareGetOrdersRequest(page, size, code, status, createdSince, createdUntil, + customerId).execute(); } /** - * Builds the ApiCall object for deleteAllOrderItems. + * Builds the ApiCall object for getOrders. */ - private ApiCall prepareDeleteAllOrderItemsRequest( - final String orderId, - final String idempotencyKey) throws IOException { - return new ApiCall.Builder() + private ApiCall prepareGetOrdersRequest( + final Integer page, + final Integer size, + final String code, + final String status, + final LocalDateTime createdSince, + final LocalDateTime createdUntil, + final String customerId) throws IOException { + return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/orders/{orderId}/items") - .templateParam(param -> param.key("orderId").value(orderId) - .shouldEncode(true)) - .headerParam(param -> param.key("idempotency-key") - .value(idempotencyKey).isRequired(false)) + .path("/orders") + .queryParam(param -> param.key("page") + .value(page).isRequired(false)) + .queryParam(param -> param.key("size") + .value(size).isRequired(false)) + .queryParam(param -> param.key("code") + .value(code).isRequired(false)) + .queryParam(param -> param.key("status") + .value(status).isRequired(false)) + .queryParam(param -> param.key("created_since") + .value(DateTimeHelper.toRfc8601DateTime(createdSince)).isRequired(false)) + .queryParam(param -> param.key("created_until") + .value(DateTimeHelper.toRfc8601DateTime(createdUntil)).isRequired(false)) + .queryParam(param -> param.key("customer_id") + .value(customerId).isRequired(false)) .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) - .httpMethod(HttpMethod.DELETE)) + .httpMethod(HttpMethod.GET)) .responseHandler(responseHandler -> responseHandler .deserializer( - response -> ApiHelper.deserialize(response, GetOrderResponse.class)) + response -> ApiHelper.deserialize(response, ListOrderResponse.class)) .nullify404(false) .globalErrorCase(GLOBAL_ERROR_CASES)) .build(); @@ -81,35 +108,46 @@ private ApiCall prepareDeleteAllOrderItemsReques /** * @param orderId Required parameter: Order Id * @param itemId Required parameter: Item Id + * @param request Required parameter: Item Model + * @param idempotencyKey Optional parameter: Example: * @return Returns the GetOrderItemResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetOrderItemResponse getOrderItem( + public GetOrderItemResponse updateOrderItem( final String orderId, - final String itemId) throws ApiException, IOException { - return prepareGetOrderItemRequest(orderId, itemId).execute(); + final String itemId, + final UpdateOrderItemRequest request, + final String idempotencyKey) throws ApiException, IOException { + return prepareUpdateOrderItemRequest(orderId, itemId, request, idempotencyKey).execute(); } /** - * Builds the ApiCall object for getOrderItem. + * Builds the ApiCall object for updateOrderItem. */ - private ApiCall prepareGetOrderItemRequest( + private ApiCall prepareUpdateOrderItemRequest( final String orderId, - final String itemId) throws IOException { + final String itemId, + final UpdateOrderItemRequest request, + final String idempotencyKey) throws JsonProcessingException, IOException { return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) .path("/orders/{orderId}/items/{itemId}") + .bodyParam(param -> param.value(request)) + .bodySerializer(() -> ApiHelper.serialize(request)) .templateParam(param -> param.key("orderId").value(orderId) .shouldEncode(true)) .templateParam(param -> param.key("itemId").value(itemId) .shouldEncode(true)) + .headerParam(param -> param.key("idempotency-key") + .value(idempotencyKey).isRequired(false)) + .headerParam(param ->param.key("content-type").value("application/json")) .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) - .httpMethod(HttpMethod.GET)) + .httpMethod(HttpMethod.PUT)) .responseHandler(responseHandler -> responseHandler .deserializer( response -> ApiHelper.deserialize(response, GetOrderItemResponse.class)) @@ -119,44 +157,37 @@ private ApiCall prepareGetOrderItemRequest( } /** - * Updates the metadata from an order. - * @param orderId Required parameter: The order id - * @param request Required parameter: Request for updating the order metadata + * @param orderId Required parameter: Order Id * @param idempotencyKey Optional parameter: Example: * @return Returns the GetOrderResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetOrderResponse updateOrderMetadata( + public GetOrderResponse deleteAllOrderItems( final String orderId, - final UpdateMetadataRequest request, final String idempotencyKey) throws ApiException, IOException { - return prepareUpdateOrderMetadataRequest(orderId, request, idempotencyKey).execute(); + return prepareDeleteAllOrderItemsRequest(orderId, idempotencyKey).execute(); } /** - * Builds the ApiCall object for updateOrderMetadata. + * Builds the ApiCall object for deleteAllOrderItems. */ - private ApiCall prepareUpdateOrderMetadataRequest( + private ApiCall prepareDeleteAllOrderItemsRequest( final String orderId, - final UpdateMetadataRequest request, - final String idempotencyKey) throws JsonProcessingException, IOException { + final String idempotencyKey) throws IOException { return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/Orders/{order_id}/metadata") - .bodyParam(param -> param.value(request)) - .bodySerializer(() -> ApiHelper.serialize(request)) - .templateParam(param -> param.key("order_id").value(orderId) + .path("/orders/{orderId}/items") + .templateParam(param -> param.key("orderId").value(orderId) .shouldEncode(true)) .headerParam(param -> param.key("idempotency-key") .value(idempotencyKey).isRequired(false)) - .headerParam(param ->param.key("content-type").value("application/json")) .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) - .httpMethod(HttpMethod.PATCH)) + .httpMethod(HttpMethod.DELETE)) .responseHandler(responseHandler -> responseHandler .deserializer( response -> ApiHelper.deserialize(response, GetOrderResponse.class)) @@ -211,33 +242,43 @@ private ApiCall prepareDeleteOrderItemReques } /** - * Gets an order. - * @param orderId Required parameter: Order id + * @param id Required parameter: Order Id + * @param request Required parameter: Update Order Model + * @param idempotencyKey Optional parameter: Example: * @return Returns the GetOrderResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetOrderResponse getOrder( - final String orderId) throws ApiException, IOException { - return prepareGetOrderRequest(orderId).execute(); + public GetOrderResponse closeOrder( + final String id, + final UpdateOrderStatusRequest request, + final String idempotencyKey) throws ApiException, IOException { + return prepareCloseOrderRequest(id, request, idempotencyKey).execute(); } /** - * Builds the ApiCall object for getOrder. + * Builds the ApiCall object for closeOrder. */ - private ApiCall prepareGetOrderRequest( - final String orderId) throws IOException { + private ApiCall prepareCloseOrderRequest( + final String id, + final UpdateOrderStatusRequest request, + final String idempotencyKey) throws JsonProcessingException, IOException { return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/orders/{order_id}") - .templateParam(param -> param.key("order_id").value(orderId) + .path("/orders/{id}/closed") + .bodyParam(param -> param.value(request)) + .bodySerializer(() -> ApiHelper.serialize(request)) + .templateParam(param -> param.key("id").value(id) .shouldEncode(true)) + .headerParam(param -> param.key("idempotency-key") + .value(idempotencyKey).isRequired(false)) + .headerParam(param ->param.key("content-type").value("application/json")) .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) - .httpMethod(HttpMethod.GET)) + .httpMethod(HttpMethod.PATCH)) .responseHandler(responseHandler -> responseHandler .deserializer( response -> ApiHelper.deserialize(response, GetOrderResponse.class)) @@ -247,67 +288,42 @@ private ApiCall prepareGetOrderRequest( } /** - * Gets all orders. - * @param page Optional parameter: Page number - * @param size Optional parameter: Page size - * @param code Optional parameter: Filter for order's code - * @param status Optional parameter: Filter for order's status - * @param createdSince Optional parameter: Filter for order's creation date start range - * @param createdUntil Optional parameter: Filter for order's creation date end range - * @param customerId Optional parameter: Filter for order's customer id - * @return Returns the ListOrderResponse response from the API call + * Creates a new Order. + * @param body Required parameter: Request for creating an order + * @param idempotencyKey Optional parameter: Example: + * @return Returns the GetOrderResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public ListOrderResponse getOrders( - final Integer page, - final Integer size, - final String code, - final String status, - final LocalDateTime createdSince, - final LocalDateTime createdUntil, - final String customerId) throws ApiException, IOException { - return prepareGetOrdersRequest(page, size, code, status, createdSince, createdUntil, - customerId).execute(); + public GetOrderResponse createOrder( + final CreateOrderRequest body, + final String idempotencyKey) throws ApiException, IOException { + return prepareCreateOrderRequest(body, idempotencyKey).execute(); } /** - * Builds the ApiCall object for getOrders. + * Builds the ApiCall object for createOrder. */ - private ApiCall prepareGetOrdersRequest( - final Integer page, - final Integer size, - final String code, - final String status, - final LocalDateTime createdSince, - final LocalDateTime createdUntil, - final String customerId) throws IOException { - return new ApiCall.Builder() + private ApiCall prepareCreateOrderRequest( + final CreateOrderRequest body, + final String idempotencyKey) throws JsonProcessingException, IOException { + return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) .path("/orders") - .queryParam(param -> param.key("page") - .value(page).isRequired(false)) - .queryParam(param -> param.key("size") - .value(size).isRequired(false)) - .queryParam(param -> param.key("code") - .value(code).isRequired(false)) - .queryParam(param -> param.key("status") - .value(status).isRequired(false)) - .queryParam(param -> param.key("created_since") - .value(DateTimeHelper.toRfc8601DateTime(createdSince)).isRequired(false)) - .queryParam(param -> param.key("created_until") - .value(DateTimeHelper.toRfc8601DateTime(createdUntil)).isRequired(false)) - .queryParam(param -> param.key("customer_id") - .value(customerId).isRequired(false)) + .bodyParam(param -> param.value(body)) + .bodySerializer(() -> ApiHelper.serialize(body)) + .headerParam(param -> param.key("idempotency-key") + .value(idempotencyKey).isRequired(false)) + .headerParam(param ->param.key("content-type").value("application/json")) .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) - .httpMethod(HttpMethod.GET)) + .httpMethod(HttpMethod.POST)) .responseHandler(responseHandler -> responseHandler .deserializer( - response -> ApiHelper.deserialize(response, ListOrderResponse.class)) + response -> ApiHelper.deserialize(response, GetOrderResponse.class)) .nullify404(false) .globalErrorCase(GLOBAL_ERROR_CASES)) .build(); @@ -315,47 +331,42 @@ private ApiCall prepareGetOrdersRequest( /** * @param orderId Required parameter: Order Id - * @param itemId Required parameter: Item Id - * @param request Required parameter: Item Model + * @param request Required parameter: Order Item Model * @param idempotencyKey Optional parameter: Example: * @return Returns the GetOrderItemResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetOrderItemResponse updateOrderItem( + public GetOrderItemResponse createOrderItem( final String orderId, - final String itemId, - final UpdateOrderItemRequest request, + final CreateOrderItemRequest request, final String idempotencyKey) throws ApiException, IOException { - return prepareUpdateOrderItemRequest(orderId, itemId, request, idempotencyKey).execute(); + return prepareCreateOrderItemRequest(orderId, request, idempotencyKey).execute(); } /** - * Builds the ApiCall object for updateOrderItem. + * Builds the ApiCall object for createOrderItem. */ - private ApiCall prepareUpdateOrderItemRequest( + private ApiCall prepareCreateOrderItemRequest( final String orderId, - final String itemId, - final UpdateOrderItemRequest request, + final CreateOrderItemRequest request, final String idempotencyKey) throws JsonProcessingException, IOException { return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/orders/{orderId}/items/{itemId}") + .path("/orders/{orderId}/items") .bodyParam(param -> param.value(request)) .bodySerializer(() -> ApiHelper.serialize(request)) .templateParam(param -> param.key("orderId").value(orderId) .shouldEncode(true)) - .templateParam(param -> param.key("itemId").value(itemId) - .shouldEncode(true)) .headerParam(param -> param.key("idempotency-key") .value(idempotencyKey).isRequired(false)) .headerParam(param ->param.key("content-type").value("application/json")) .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) - .httpMethod(HttpMethod.PUT)) + .httpMethod(HttpMethod.POST)) .responseHandler(responseHandler -> responseHandler .deserializer( response -> ApiHelper.deserialize(response, GetOrderItemResponse.class)) @@ -365,85 +376,84 @@ private ApiCall prepareUpdateOrderItemReques } /** - * @param id Required parameter: Order Id - * @param request Required parameter: Update Order Model - * @param idempotencyKey Optional parameter: Example: - * @return Returns the GetOrderResponse response from the API call + * @param orderId Required parameter: Order Id + * @param itemId Required parameter: Item Id + * @return Returns the GetOrderItemResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetOrderResponse closeOrder( - final String id, - final UpdateOrderStatusRequest request, - final String idempotencyKey) throws ApiException, IOException { - return prepareCloseOrderRequest(id, request, idempotencyKey).execute(); + public GetOrderItemResponse getOrderItem( + final String orderId, + final String itemId) throws ApiException, IOException { + return prepareGetOrderItemRequest(orderId, itemId).execute(); } /** - * Builds the ApiCall object for closeOrder. + * Builds the ApiCall object for getOrderItem. */ - private ApiCall prepareCloseOrderRequest( - final String id, - final UpdateOrderStatusRequest request, - final String idempotencyKey) throws JsonProcessingException, IOException { - return new ApiCall.Builder() + private ApiCall prepareGetOrderItemRequest( + final String orderId, + final String itemId) throws IOException { + return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/orders/{id}/closed") - .bodyParam(param -> param.value(request)) - .bodySerializer(() -> ApiHelper.serialize(request)) - .templateParam(param -> param.key("id").value(id) + .path("/orders/{orderId}/items/{itemId}") + .templateParam(param -> param.key("orderId").value(orderId) + .shouldEncode(true)) + .templateParam(param -> param.key("itemId").value(itemId) .shouldEncode(true)) - .headerParam(param -> param.key("idempotency-key") - .value(idempotencyKey).isRequired(false)) - .headerParam(param ->param.key("content-type").value("application/json")) .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) - .httpMethod(HttpMethod.PATCH)) + .httpMethod(HttpMethod.GET)) .responseHandler(responseHandler -> responseHandler .deserializer( - response -> ApiHelper.deserialize(response, GetOrderResponse.class)) + response -> ApiHelper.deserialize(response, GetOrderItemResponse.class)) .nullify404(false) .globalErrorCase(GLOBAL_ERROR_CASES)) .build(); } /** - * Creates a new Order. - * @param body Required parameter: Request for creating an order + * Updates the metadata from an order. + * @param orderId Required parameter: The order id + * @param request Required parameter: Request for updating the order metadata * @param idempotencyKey Optional parameter: Example: * @return Returns the GetOrderResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetOrderResponse createOrder( - final CreateOrderRequest body, + public GetOrderResponse updateOrderMetadata( + final String orderId, + final UpdateMetadataRequest request, final String idempotencyKey) throws ApiException, IOException { - return prepareCreateOrderRequest(body, idempotencyKey).execute(); + return prepareUpdateOrderMetadataRequest(orderId, request, idempotencyKey).execute(); } /** - * Builds the ApiCall object for createOrder. + * Builds the ApiCall object for updateOrderMetadata. */ - private ApiCall prepareCreateOrderRequest( - final CreateOrderRequest body, + private ApiCall prepareUpdateOrderMetadataRequest( + final String orderId, + final UpdateMetadataRequest request, final String idempotencyKey) throws JsonProcessingException, IOException { return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/orders") - .bodyParam(param -> param.value(body)) - .bodySerializer(() -> ApiHelper.serialize(body)) + .path("/Orders/{order_id}/metadata") + .bodyParam(param -> param.value(request)) + .bodySerializer(() -> ApiHelper.serialize(request)) + .templateParam(param -> param.key("order_id").value(orderId) + .shouldEncode(true)) .headerParam(param -> param.key("idempotency-key") .value(idempotencyKey).isRequired(false)) .headerParam(param ->param.key("content-type").value("application/json")) .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) - .httpMethod(HttpMethod.POST)) + .httpMethod(HttpMethod.PATCH)) .responseHandler(responseHandler -> responseHandler .deserializer( response -> ApiHelper.deserialize(response, GetOrderResponse.class)) @@ -453,46 +463,36 @@ private ApiCall prepareCreateOrderRequest( } /** - * @param orderId Required parameter: Order Id - * @param request Required parameter: Order Item Model - * @param idempotencyKey Optional parameter: Example: - * @return Returns the GetOrderItemResponse response from the API call + * Gets an order. + * @param orderId Required parameter: Order id + * @return Returns the GetOrderResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetOrderItemResponse createOrderItem( - final String orderId, - final CreateOrderItemRequest request, - final String idempotencyKey) throws ApiException, IOException { - return prepareCreateOrderItemRequest(orderId, request, idempotencyKey).execute(); + public GetOrderResponse getOrder( + final String orderId) throws ApiException, IOException { + return prepareGetOrderRequest(orderId).execute(); } /** - * Builds the ApiCall object for createOrderItem. + * Builds the ApiCall object for getOrder. */ - private ApiCall prepareCreateOrderItemRequest( - final String orderId, - final CreateOrderItemRequest request, - final String idempotencyKey) throws JsonProcessingException, IOException { - return new ApiCall.Builder() + private ApiCall prepareGetOrderRequest( + final String orderId) throws IOException { + return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/orders/{orderId}/items") - .bodyParam(param -> param.value(request)) - .bodySerializer(() -> ApiHelper.serialize(request)) - .templateParam(param -> param.key("orderId").value(orderId) + .path("/orders/{order_id}") + .templateParam(param -> param.key("order_id").value(orderId) .shouldEncode(true)) - .headerParam(param -> param.key("idempotency-key") - .value(idempotencyKey).isRequired(false)) - .headerParam(param ->param.key("content-type").value("application/json")) .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) - .httpMethod(HttpMethod.POST)) + .httpMethod(HttpMethod.GET)) .responseHandler(responseHandler -> responseHandler .deserializer( - response -> ApiHelper.deserialize(response, GetOrderItemResponse.class)) + response -> ApiHelper.deserialize(response, GetOrderResponse.class)) .nullify404(false) .globalErrorCase(GLOBAL_ERROR_CASES)) .build(); diff --git a/src/main/java/me/pagar/api/controllers/DefaultPlansController.java b/src/main/java/me/pagar/api/controllers/DefaultPlansController.java index bbc2540..58a3a8b 100644 --- a/src/main/java/me/pagar/api/controllers/DefaultPlansController.java +++ b/src/main/java/me/pagar/api/controllers/DefaultPlansController.java @@ -75,37 +75,32 @@ private ApiCall prepareGetPlanRequest( } /** - * Removes an item from a plan. + * Deletes a plan. * @param planId Required parameter: Plan id - * @param planItemId Required parameter: Plan item id * @param idempotencyKey Optional parameter: Example: - * @return Returns the GetPlanItemResponse response from the API call + * @return Returns the GetPlanResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetPlanItemResponse deletePlanItem( + public GetPlanResponse deletePlan( final String planId, - final String planItemId, final String idempotencyKey) throws ApiException, IOException { - return prepareDeletePlanItemRequest(planId, planItemId, idempotencyKey).execute(); + return prepareDeletePlanRequest(planId, idempotencyKey).execute(); } /** - * Builds the ApiCall object for deletePlanItem. + * Builds the ApiCall object for deletePlan. */ - private ApiCall prepareDeletePlanItemRequest( + private ApiCall prepareDeletePlanRequest( final String planId, - final String planItemId, final String idempotencyKey) throws IOException { - return new ApiCall.Builder() + return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/plans/{plan_id}/items/{plan_item_id}") + .path("/plans/{plan_id}") .templateParam(param -> param.key("plan_id").value(planId) .shouldEncode(true)) - .templateParam(param -> param.key("plan_item_id").value(planItemId) - .shouldEncode(true)) .headerParam(param -> param.key("idempotency-key") .value(idempotencyKey).isRequired(false)) .headerParam(param -> param.key("accept").value("application/json")) @@ -114,7 +109,7 @@ private ApiCall prepareDeletePlanItemRequest( .httpMethod(HttpMethod.DELETE)) .responseHandler(responseHandler -> responseHandler .deserializer( - response -> ApiHelper.deserialize(response, GetPlanItemResponse.class)) + response -> ApiHelper.deserialize(response, GetPlanResponse.class)) .nullify404(false) .globalErrorCase(GLOBAL_ERROR_CASES)) .build(); @@ -168,75 +163,85 @@ private ApiCall prepareUpdatePlanMetadataRequest( } /** - * Creates a new plan. - * @param body Required parameter: Request for creating a plan + * Updates a plan item. + * @param planId Required parameter: Plan id + * @param planItemId Required parameter: Plan item id + * @param body Required parameter: Request for updating the plan item * @param idempotencyKey Optional parameter: Example: - * @return Returns the GetPlanResponse response from the API call + * @return Returns the GetPlanItemResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetPlanResponse createPlan( - final CreatePlanRequest body, + public GetPlanItemResponse updatePlanItem( + final String planId, + final String planItemId, + final UpdatePlanItemRequest body, final String idempotencyKey) throws ApiException, IOException { - return prepareCreatePlanRequest(body, idempotencyKey).execute(); + return prepareUpdatePlanItemRequest(planId, planItemId, body, idempotencyKey).execute(); } /** - * Builds the ApiCall object for createPlan. + * Builds the ApiCall object for updatePlanItem. */ - private ApiCall prepareCreatePlanRequest( - final CreatePlanRequest body, + private ApiCall prepareUpdatePlanItemRequest( + final String planId, + final String planItemId, + final UpdatePlanItemRequest body, final String idempotencyKey) throws JsonProcessingException, IOException { - return new ApiCall.Builder() + return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/plans") + .path("/plans/{plan_id}/items/{plan_item_id}") .bodyParam(param -> param.value(body)) .bodySerializer(() -> ApiHelper.serialize(body)) + .templateParam(param -> param.key("plan_id").value(planId) + .shouldEncode(true)) + .templateParam(param -> param.key("plan_item_id").value(planItemId) + .shouldEncode(true)) .headerParam(param -> param.key("idempotency-key") .value(idempotencyKey).isRequired(false)) .headerParam(param ->param.key("content-type").value("application/json")) .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) - .httpMethod(HttpMethod.POST)) + .httpMethod(HttpMethod.PUT)) .responseHandler(responseHandler -> responseHandler .deserializer( - response -> ApiHelper.deserialize(response, GetPlanResponse.class)) + response -> ApiHelper.deserialize(response, GetPlanItemResponse.class)) .nullify404(false) .globalErrorCase(GLOBAL_ERROR_CASES)) .build(); } /** - * Updates a plan. + * Adds a new item to a plan. * @param planId Required parameter: Plan id - * @param request Required parameter: Request for updating a plan + * @param request Required parameter: Request for creating a plan item * @param idempotencyKey Optional parameter: Example: - * @return Returns the GetPlanResponse response from the API call + * @return Returns the GetPlanItemResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetPlanResponse updatePlan( + public GetPlanItemResponse createPlanItem( final String planId, - final UpdatePlanRequest request, + final CreatePlanItemRequest request, final String idempotencyKey) throws ApiException, IOException { - return prepareUpdatePlanRequest(planId, request, idempotencyKey).execute(); + return prepareCreatePlanItemRequest(planId, request, idempotencyKey).execute(); } /** - * Builds the ApiCall object for updatePlan. + * Builds the ApiCall object for createPlanItem. */ - private ApiCall prepareUpdatePlanRequest( + private ApiCall prepareCreatePlanItemRequest( final String planId, - final UpdatePlanRequest request, + final CreatePlanItemRequest request, final String idempotencyKey) throws JsonProcessingException, IOException { - return new ApiCall.Builder() + return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/plans/{plan_id}") + .path("/plans/{plan_id}/items") .bodyParam(param -> param.value(request)) .bodySerializer(() -> ApiHelper.serialize(request)) .templateParam(param -> param.key("plan_id").value(planId) @@ -247,167 +252,136 @@ private ApiCall prepareUpdatePlanRequest( .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) - .httpMethod(HttpMethod.PUT)) + .httpMethod(HttpMethod.POST)) .responseHandler(responseHandler -> responseHandler .deserializer( - response -> ApiHelper.deserialize(response, GetPlanResponse.class)) + response -> ApiHelper.deserialize(response, GetPlanItemResponse.class)) .nullify404(false) .globalErrorCase(GLOBAL_ERROR_CASES)) .build(); } /** - * Deletes a plan. + * Gets a plan item. * @param planId Required parameter: Plan id - * @param idempotencyKey Optional parameter: Example: - * @return Returns the GetPlanResponse response from the API call + * @param planItemId Required parameter: Plan item id + * @return Returns the GetPlanItemResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetPlanResponse deletePlan( + public GetPlanItemResponse getPlanItem( final String planId, - final String idempotencyKey) throws ApiException, IOException { - return prepareDeletePlanRequest(planId, idempotencyKey).execute(); + final String planItemId) throws ApiException, IOException { + return prepareGetPlanItemRequest(planId, planItemId).execute(); } /** - * Builds the ApiCall object for deletePlan. + * Builds the ApiCall object for getPlanItem. */ - private ApiCall prepareDeletePlanRequest( + private ApiCall prepareGetPlanItemRequest( final String planId, - final String idempotencyKey) throws IOException { - return new ApiCall.Builder() + final String planItemId) throws IOException { + return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/plans/{plan_id}") + .path("/plans/{plan_id}/items/{plan_item_id}") .templateParam(param -> param.key("plan_id").value(planId) .shouldEncode(true)) - .headerParam(param -> param.key("idempotency-key") - .value(idempotencyKey).isRequired(false)) + .templateParam(param -> param.key("plan_item_id").value(planItemId) + .shouldEncode(true)) .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) - .httpMethod(HttpMethod.DELETE)) + .httpMethod(HttpMethod.GET)) .responseHandler(responseHandler -> responseHandler .deserializer( - response -> ApiHelper.deserialize(response, GetPlanResponse.class)) + response -> ApiHelper.deserialize(response, GetPlanItemResponse.class)) .nullify404(false) .globalErrorCase(GLOBAL_ERROR_CASES)) .build(); } /** - * Gets all plans. - * @param page Optional parameter: Page number - * @param size Optional parameter: Page size - * @param name Optional parameter: Filter for Plan's name - * @param status Optional parameter: Filter for Plan's status - * @param billingType Optional parameter: Filter for plan's billing type - * @param createdSince Optional parameter: Filter for plan's creation date start range - * @param createdUntil Optional parameter: Filter for plan's creation date end range - * @return Returns the ListPlansResponse response from the API call + * Creates a new plan. + * @param body Required parameter: Request for creating a plan + * @param idempotencyKey Optional parameter: Example: + * @return Returns the GetPlanResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public ListPlansResponse getPlans( - final Integer page, - final Integer size, - final String name, - final String status, - final String billingType, - final LocalDateTime createdSince, - final LocalDateTime createdUntil) throws ApiException, IOException { - return prepareGetPlansRequest(page, size, name, status, billingType, createdSince, - createdUntil).execute(); + public GetPlanResponse createPlan( + final CreatePlanRequest body, + final String idempotencyKey) throws ApiException, IOException { + return prepareCreatePlanRequest(body, idempotencyKey).execute(); } /** - * Builds the ApiCall object for getPlans. + * Builds the ApiCall object for createPlan. */ - private ApiCall prepareGetPlansRequest( - final Integer page, - final Integer size, - final String name, - final String status, - final String billingType, - final LocalDateTime createdSince, - final LocalDateTime createdUntil) throws IOException { - return new ApiCall.Builder() + private ApiCall prepareCreatePlanRequest( + final CreatePlanRequest body, + final String idempotencyKey) throws JsonProcessingException, IOException { + return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) .path("/plans") - .queryParam(param -> param.key("page") - .value(page).isRequired(false)) - .queryParam(param -> param.key("size") - .value(size).isRequired(false)) - .queryParam(param -> param.key("name") - .value(name).isRequired(false)) - .queryParam(param -> param.key("status") - .value(status).isRequired(false)) - .queryParam(param -> param.key("billing_type") - .value(billingType).isRequired(false)) - .queryParam(param -> param.key("created_since") - .value(DateTimeHelper.toRfc8601DateTime(createdSince)).isRequired(false)) - .queryParam(param -> param.key("created_until") - .value(DateTimeHelper.toRfc8601DateTime(createdUntil)).isRequired(false)) + .bodyParam(param -> param.value(body)) + .bodySerializer(() -> ApiHelper.serialize(body)) + .headerParam(param -> param.key("idempotency-key") + .value(idempotencyKey).isRequired(false)) + .headerParam(param ->param.key("content-type").value("application/json")) .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) - .httpMethod(HttpMethod.GET)) + .httpMethod(HttpMethod.POST)) .responseHandler(responseHandler -> responseHandler .deserializer( - response -> ApiHelper.deserialize(response, ListPlansResponse.class)) + response -> ApiHelper.deserialize(response, GetPlanResponse.class)) .nullify404(false) .globalErrorCase(GLOBAL_ERROR_CASES)) .build(); } /** - * Updates a plan item. + * Removes an item from a plan. * @param planId Required parameter: Plan id * @param planItemId Required parameter: Plan item id - * @param body Required parameter: Request for updating the plan item * @param idempotencyKey Optional parameter: Example: * @return Returns the GetPlanItemResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetPlanItemResponse updatePlanItem( + public GetPlanItemResponse deletePlanItem( final String planId, final String planItemId, - final UpdatePlanItemRequest body, final String idempotencyKey) throws ApiException, IOException { - return prepareUpdatePlanItemRequest(planId, planItemId, body, idempotencyKey).execute(); + return prepareDeletePlanItemRequest(planId, planItemId, idempotencyKey).execute(); } /** - * Builds the ApiCall object for updatePlanItem. + * Builds the ApiCall object for deletePlanItem. */ - private ApiCall prepareUpdatePlanItemRequest( + private ApiCall prepareDeletePlanItemRequest( final String planId, final String planItemId, - final UpdatePlanItemRequest body, - final String idempotencyKey) throws JsonProcessingException, IOException { + final String idempotencyKey) throws IOException { return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) .path("/plans/{plan_id}/items/{plan_item_id}") - .bodyParam(param -> param.value(body)) - .bodySerializer(() -> ApiHelper.serialize(body)) .templateParam(param -> param.key("plan_id").value(planId) .shouldEncode(true)) .templateParam(param -> param.key("plan_item_id").value(planItemId) .shouldEncode(true)) .headerParam(param -> param.key("idempotency-key") .value(idempotencyKey).isRequired(false)) - .headerParam(param ->param.key("content-type").value("application/json")) .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) - .httpMethod(HttpMethod.PUT)) + .httpMethod(HttpMethod.DELETE)) .responseHandler(responseHandler -> responseHandler .deserializer( response -> ApiHelper.deserialize(response, GetPlanItemResponse.class)) @@ -417,88 +391,114 @@ private ApiCall prepareUpdatePlanItemRequest( } /** - * Adds a new item to a plan. - * @param planId Required parameter: Plan id - * @param request Required parameter: Request for creating a plan item - * @param idempotencyKey Optional parameter: Example: - * @return Returns the GetPlanItemResponse response from the API call + * Gets all plans. + * @param page Optional parameter: Page number + * @param size Optional parameter: Page size + * @param name Optional parameter: Filter for Plan's name + * @param status Optional parameter: Filter for Plan's status + * @param billingType Optional parameter: Filter for plan's billing type + * @param createdSince Optional parameter: Filter for plan's creation date start range + * @param createdUntil Optional parameter: Filter for plan's creation date end range + * @return Returns the ListPlansResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetPlanItemResponse createPlanItem( - final String planId, - final CreatePlanItemRequest request, - final String idempotencyKey) throws ApiException, IOException { - return prepareCreatePlanItemRequest(planId, request, idempotencyKey).execute(); + public ListPlansResponse getPlans( + final Integer page, + final Integer size, + final String name, + final String status, + final String billingType, + final LocalDateTime createdSince, + final LocalDateTime createdUntil) throws ApiException, IOException { + return prepareGetPlansRequest(page, size, name, status, billingType, createdSince, + createdUntil).execute(); } /** - * Builds the ApiCall object for createPlanItem. + * Builds the ApiCall object for getPlans. */ - private ApiCall prepareCreatePlanItemRequest( - final String planId, - final CreatePlanItemRequest request, - final String idempotencyKey) throws JsonProcessingException, IOException { - return new ApiCall.Builder() + private ApiCall prepareGetPlansRequest( + final Integer page, + final Integer size, + final String name, + final String status, + final String billingType, + final LocalDateTime createdSince, + final LocalDateTime createdUntil) throws IOException { + return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/plans/{plan_id}/items") - .bodyParam(param -> param.value(request)) - .bodySerializer(() -> ApiHelper.serialize(request)) - .templateParam(param -> param.key("plan_id").value(planId) - .shouldEncode(true)) - .headerParam(param -> param.key("idempotency-key") - .value(idempotencyKey).isRequired(false)) - .headerParam(param ->param.key("content-type").value("application/json")) + .path("/plans") + .queryParam(param -> param.key("page") + .value(page).isRequired(false)) + .queryParam(param -> param.key("size") + .value(size).isRequired(false)) + .queryParam(param -> param.key("name") + .value(name).isRequired(false)) + .queryParam(param -> param.key("status") + .value(status).isRequired(false)) + .queryParam(param -> param.key("billing_type") + .value(billingType).isRequired(false)) + .queryParam(param -> param.key("created_since") + .value(DateTimeHelper.toRfc8601DateTime(createdSince)).isRequired(false)) + .queryParam(param -> param.key("created_until") + .value(DateTimeHelper.toRfc8601DateTime(createdUntil)).isRequired(false)) .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) - .httpMethod(HttpMethod.POST)) + .httpMethod(HttpMethod.GET)) .responseHandler(responseHandler -> responseHandler .deserializer( - response -> ApiHelper.deserialize(response, GetPlanItemResponse.class)) + response -> ApiHelper.deserialize(response, ListPlansResponse.class)) .nullify404(false) .globalErrorCase(GLOBAL_ERROR_CASES)) .build(); } /** - * Gets a plan item. + * Updates a plan. * @param planId Required parameter: Plan id - * @param planItemId Required parameter: Plan item id - * @return Returns the GetPlanItemResponse response from the API call + * @param request Required parameter: Request for updating a plan + * @param idempotencyKey Optional parameter: Example: + * @return Returns the GetPlanResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetPlanItemResponse getPlanItem( + public GetPlanResponse updatePlan( final String planId, - final String planItemId) throws ApiException, IOException { - return prepareGetPlanItemRequest(planId, planItemId).execute(); + final UpdatePlanRequest request, + final String idempotencyKey) throws ApiException, IOException { + return prepareUpdatePlanRequest(planId, request, idempotencyKey).execute(); } /** - * Builds the ApiCall object for getPlanItem. + * Builds the ApiCall object for updatePlan. */ - private ApiCall prepareGetPlanItemRequest( + private ApiCall prepareUpdatePlanRequest( final String planId, - final String planItemId) throws IOException { - return new ApiCall.Builder() + final UpdatePlanRequest request, + final String idempotencyKey) throws JsonProcessingException, IOException { + return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/plans/{plan_id}/items/{plan_item_id}") + .path("/plans/{plan_id}") + .bodyParam(param -> param.value(request)) + .bodySerializer(() -> ApiHelper.serialize(request)) .templateParam(param -> param.key("plan_id").value(planId) .shouldEncode(true)) - .templateParam(param -> param.key("plan_item_id").value(planItemId) - .shouldEncode(true)) + .headerParam(param -> param.key("idempotency-key") + .value(idempotencyKey).isRequired(false)) + .headerParam(param ->param.key("content-type").value("application/json")) .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) - .httpMethod(HttpMethod.GET)) + .httpMethod(HttpMethod.PUT)) .responseHandler(responseHandler -> responseHandler .deserializer( - response -> ApiHelper.deserialize(response, GetPlanItemResponse.class)) + response -> ApiHelper.deserialize(response, GetPlanResponse.class)) .nullify404(false) .globalErrorCase(GLOBAL_ERROR_CASES)) .build(); diff --git a/src/main/java/me/pagar/api/controllers/DefaultRecipientsController.java b/src/main/java/me/pagar/api/controllers/DefaultRecipientsController.java index f19ffa5..db33740 100644 --- a/src/main/java/me/pagar/api/controllers/DefaultRecipientsController.java +++ b/src/main/java/me/pagar/api/controllers/DefaultRecipientsController.java @@ -17,6 +17,7 @@ import me.pagar.api.exceptions.ApiException; import me.pagar.api.http.request.HttpMethod; import me.pagar.api.models.CreateAnticipationRequest; +import me.pagar.api.models.CreateKYCLinkResponse; import me.pagar.api.models.CreateRecipientRequest; import me.pagar.api.models.CreateTransferRequest; import me.pagar.api.models.CreateWithdrawRequest; @@ -97,67 +98,84 @@ private ApiCall prepareUpdateRecipientReques } /** - * @param recipientId Required parameter: Example: - * @param withdrawalId Required parameter: Example: - * @return Returns the GetWithdrawResponse response from the API call + * Creates an anticipation. + * @param recipientId Required parameter: Recipient id + * @param request Required parameter: Anticipation data + * @param idempotencyKey Optional parameter: Example: + * @return Returns the GetAnticipationResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetWithdrawResponse getWithdrawById( + public GetAnticipationResponse createAnticipation( final String recipientId, - final String withdrawalId) throws ApiException, IOException { - return prepareGetWithdrawByIdRequest(recipientId, withdrawalId).execute(); + final CreateAnticipationRequest request, + final String idempotencyKey) throws ApiException, IOException { + return prepareCreateAnticipationRequest(recipientId, request, idempotencyKey).execute(); } /** - * Builds the ApiCall object for getWithdrawById. + * Builds the ApiCall object for createAnticipation. */ - private ApiCall prepareGetWithdrawByIdRequest( + private ApiCall prepareCreateAnticipationRequest( final String recipientId, - final String withdrawalId) throws IOException { - return new ApiCall.Builder() + final CreateAnticipationRequest request, + final String idempotencyKey) throws JsonProcessingException, IOException { + return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/recipients/{recipient_id}/withdrawals/{withdrawal_id}") + .path("/recipients/{recipient_id}/anticipations") + .bodyParam(param -> param.value(request)) + .bodySerializer(() -> ApiHelper.serialize(request)) .templateParam(param -> param.key("recipient_id").value(recipientId) .shouldEncode(true)) - .templateParam(param -> param.key("withdrawal_id").value(withdrawalId) - .shouldEncode(true)) + .headerParam(param -> param.key("idempotency-key") + .value(idempotencyKey).isRequired(false)) + .headerParam(param ->param.key("content-type").value("application/json")) .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) - .httpMethod(HttpMethod.GET)) + .httpMethod(HttpMethod.POST)) .responseHandler(responseHandler -> responseHandler .deserializer( - response -> ApiHelper.deserialize(response, GetWithdrawResponse.class)) + response -> ApiHelper.deserialize(response, GetAnticipationResponse.class)) .nullify404(false) .globalErrorCase(GLOBAL_ERROR_CASES)) .build(); } /** - * Retrieves recipient information. - * @param recipientId Required parameter: Recipiend id - * @return Returns the GetRecipientResponse response from the API call + * Gets the anticipation limits for a recipient. + * @param recipientId Required parameter: Recipient id + * @param timeframe Required parameter: Timeframe + * @param paymentDate Required parameter: Anticipation payment date + * @return Returns the GetAnticipationLimitResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetRecipientResponse getRecipient( - final String recipientId) throws ApiException, IOException { - return prepareGetRecipientRequest(recipientId).execute(); + public GetAnticipationLimitResponse getAnticipationLimits( + final String recipientId, + final String timeframe, + final LocalDateTime paymentDate) throws ApiException, IOException { + return prepareGetAnticipationLimitsRequest(recipientId, timeframe, paymentDate).execute(); } /** - * Builds the ApiCall object for getRecipient. + * Builds the ApiCall object for getAnticipationLimits. */ - private ApiCall prepareGetRecipientRequest( - final String recipientId) throws IOException { - return new ApiCall.Builder() + private ApiCall prepareGetAnticipationLimitsRequest( + final String recipientId, + final String timeframe, + final LocalDateTime paymentDate) throws IOException { + return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/recipients/{recipient_id}") + .path("/recipients/{recipient_id}/anticipation_limits") + .queryParam(param -> param.key("timeframe") + .value(timeframe)) + .queryParam(param -> param.key("payment_date") + .value(DateTimeHelper.toRfc8601DateTime(paymentDate))) .templateParam(param -> param.key("recipient_id").value(recipientId) .shouldEncode(true)) .headerParam(param -> param.key("accept").value("application/json")) @@ -166,84 +184,88 @@ private ApiCall prepareGetRecipientRequest( .httpMethod(HttpMethod.GET)) .responseHandler(responseHandler -> responseHandler .deserializer( - response -> ApiHelper.deserialize(response, GetRecipientResponse.class)) + response -> ApiHelper.deserialize(response, GetAnticipationLimitResponse.class)) .nullify404(false) .globalErrorCase(GLOBAL_ERROR_CASES)) .build(); } /** - * Get balance information for a recipient. - * @param recipientId Required parameter: Recipient id - * @return Returns the GetBalanceResponse response from the API call + * Retrieves paginated recipients information. + * @param page Optional parameter: Page number + * @param size Optional parameter: Page size + * @return Returns the ListRecipientResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetBalanceResponse getBalance( - final String recipientId) throws ApiException, IOException { - return prepareGetBalanceRequest(recipientId).execute(); + public ListRecipientResponse getRecipients( + final Integer page, + final Integer size) throws ApiException, IOException { + return prepareGetRecipientsRequest(page, size).execute(); } /** - * Builds the ApiCall object for getBalance. + * Builds the ApiCall object for getRecipients. */ - private ApiCall prepareGetBalanceRequest( - final String recipientId) throws IOException { - return new ApiCall.Builder() + private ApiCall prepareGetRecipientsRequest( + final Integer page, + final Integer size) throws IOException { + return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/recipients/{recipient_id}/balance") - .templateParam(param -> param.key("recipient_id").value(recipientId) - .shouldEncode(true)) + .path("/recipients") + .queryParam(param -> param.key("page") + .value(page).isRequired(false)) + .queryParam(param -> param.key("size") + .value(size).isRequired(false)) .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) .httpMethod(HttpMethod.GET)) .responseHandler(responseHandler -> responseHandler .deserializer( - response -> ApiHelper.deserialize(response, GetBalanceResponse.class)) + response -> ApiHelper.deserialize(response, ListRecipientResponse.class)) .nullify404(false) .globalErrorCase(GLOBAL_ERROR_CASES)) .build(); } /** - * Retrieves paginated recipients information. - * @param page Optional parameter: Page number - * @param size Optional parameter: Page size - * @return Returns the ListRecipientResponse response from the API call + * @param recipientId Required parameter: Example: + * @param withdrawalId Required parameter: Example: + * @return Returns the GetWithdrawResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public ListRecipientResponse getRecipients( - final Integer page, - final Integer size) throws ApiException, IOException { - return prepareGetRecipientsRequest(page, size).execute(); + public GetWithdrawResponse getWithdrawById( + final String recipientId, + final String withdrawalId) throws ApiException, IOException { + return prepareGetWithdrawByIdRequest(recipientId, withdrawalId).execute(); } /** - * Builds the ApiCall object for getRecipients. + * Builds the ApiCall object for getWithdrawById. */ - private ApiCall prepareGetRecipientsRequest( - final Integer page, - final Integer size) throws IOException { - return new ApiCall.Builder() + private ApiCall prepareGetWithdrawByIdRequest( + final String recipientId, + final String withdrawalId) throws IOException { + return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/recipients") - .queryParam(param -> param.key("page") - .value(page).isRequired(false)) - .queryParam(param -> param.key("size") - .value(size).isRequired(false)) + .path("/recipients/{recipient_id}/withdrawals/{withdrawal_id}") + .templateParam(param -> param.key("recipient_id").value(recipientId) + .shouldEncode(true)) + .templateParam(param -> param.key("withdrawal_id").value(withdrawalId) + .shouldEncode(true)) .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) .httpMethod(HttpMethod.GET)) .responseHandler(responseHandler -> responseHandler .deserializer( - response -> ApiHelper.deserialize(response, ListRecipientResponse.class)) + response -> ApiHelper.deserialize(response, GetWithdrawResponse.class)) .nullify404(false) .globalErrorCase(GLOBAL_ERROR_CASES)) .build(); @@ -297,6 +319,54 @@ private ApiCall prepareUpdateRecipientDefaul .build(); } + /** + * Updates recipient metadata. + * @param recipientId Required parameter: Recipient id + * @param request Required parameter: Metadata + * @param idempotencyKey Optional parameter: Example: + * @return Returns the GetRecipientResponse response from the API call + * @throws ApiException Represents error response from the server. + * @throws IOException Signals that an I/O exception of some sort has occurred. + */ + public GetRecipientResponse updateRecipientMetadata( + final String recipientId, + final UpdateMetadataRequest request, + final String idempotencyKey) throws ApiException, IOException { + return prepareUpdateRecipientMetadataRequest(recipientId, request, + idempotencyKey).execute(); + } + + /** + * Builds the ApiCall object for updateRecipientMetadata. + */ + private ApiCall prepareUpdateRecipientMetadataRequest( + final String recipientId, + final UpdateMetadataRequest request, + final String idempotencyKey) throws JsonProcessingException, IOException { + return new ApiCall.Builder() + .globalConfig(getGlobalConfiguration()) + .requestBuilder(requestBuilder -> requestBuilder + .server(Server.ENUM_DEFAULT.value()) + .path("/recipients/{recipient_id}/metadata") + .bodyParam(param -> param.value(request)) + .bodySerializer(() -> ApiHelper.serialize(request)) + .templateParam(param -> param.key("recipient_id").value(recipientId) + .shouldEncode(true)) + .headerParam(param -> param.key("idempotency-key") + .value(idempotencyKey).isRequired(false)) + .headerParam(param ->param.key("content-type").value("application/json")) + .headerParam(param -> param.key("accept").value("application/json")) + .withAuth(auth -> auth + .add("httpBasic")) + .httpMethod(HttpMethod.PATCH)) + .responseHandler(responseHandler -> responseHandler + .deserializer( + response -> ApiHelper.deserialize(response, GetRecipientResponse.class)) + .nullify404(false) + .globalErrorCase(GLOBAL_ERROR_CASES)) + .build(); + } + /** * Gets a paginated list of transfers for the recipient. * @param recipientId Required parameter: Recipient id @@ -441,6 +511,54 @@ private ApiCall prepareCreateWithdrawRequest( .build(); } + /** + * Updates recipient metadata. + * @param recipientId Required parameter: Recipient id + * @param request Required parameter: Metadata + * @param idempotencyKey Optional parameter: Example: + * @return Returns the GetRecipientResponse response from the API call + * @throws ApiException Represents error response from the server. + * @throws IOException Signals that an I/O exception of some sort has occurred. + */ + public GetRecipientResponse updateAutomaticAnticipationSettings( + final String recipientId, + final UpdateAutomaticAnticipationSettingsRequest request, + final String idempotencyKey) throws ApiException, IOException { + return prepareUpdateAutomaticAnticipationSettingsRequest(recipientId, request, + idempotencyKey).execute(); + } + + /** + * Builds the ApiCall object for updateAutomaticAnticipationSettings. + */ + private ApiCall prepareUpdateAutomaticAnticipationSettingsRequest( + final String recipientId, + final UpdateAutomaticAnticipationSettingsRequest request, + final String idempotencyKey) throws JsonProcessingException, IOException { + return new ApiCall.Builder() + .globalConfig(getGlobalConfiguration()) + .requestBuilder(requestBuilder -> requestBuilder + .server(Server.ENUM_DEFAULT.value()) + .path("/recipients/{recipient_id}/automatic-anticipation-settings") + .bodyParam(param -> param.value(request)) + .bodySerializer(() -> ApiHelper.serialize(request)) + .templateParam(param -> param.key("recipient_id").value(recipientId) + .shouldEncode(true)) + .headerParam(param -> param.key("idempotency-key") + .value(idempotencyKey).isRequired(false)) + .headerParam(param ->param.key("content-type").value("application/json")) + .headerParam(param -> param.key("accept").value("application/json")) + .withAuth(auth -> auth + .add("httpBasic")) + .httpMethod(HttpMethod.PATCH)) + .responseHandler(responseHandler -> responseHandler + .deserializer( + response -> ApiHelper.deserialize(response, GetRecipientResponse.class)) + .nullify404(false) + .globalErrorCase(GLOBAL_ERROR_CASES)) + .build(); + } + /** * Gets an anticipation. * @param recipientId Required parameter: Recipient id @@ -530,28 +648,72 @@ private ApiCall prepareUpdateRecipientTransf } /** - * Retrieves recipient information. - * @param code Required parameter: Recipient code - * @return Returns the GetRecipientResponse response from the API call + * Retrieves a paginated list of anticipations from a recipient. + * @param recipientId Required parameter: Recipient id + * @param page Optional parameter: Page number + * @param size Optional parameter: Page size + * @param status Optional parameter: Filter for anticipation status + * @param timeframe Optional parameter: Filter for anticipation timeframe + * @param paymentDateSince Optional parameter: Filter for start range for anticipation payment + * date + * @param paymentDateUntil Optional parameter: Filter for end range for anticipation payment + * date + * @param createdSince Optional parameter: Filter for start range for anticipation creation + * date + * @param createdUntil Optional parameter: Filter for end range for anticipation creation date + * @return Returns the ListAnticipationResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetRecipientResponse getRecipientByCode( - final String code) throws ApiException, IOException { - return prepareGetRecipientByCodeRequest(code).execute(); + public ListAnticipationResponse getAnticipations( + final String recipientId, + final Integer page, + final Integer size, + final String status, + final String timeframe, + final LocalDateTime paymentDateSince, + final LocalDateTime paymentDateUntil, + final LocalDateTime createdSince, + final LocalDateTime createdUntil) throws ApiException, IOException { + return prepareGetAnticipationsRequest(recipientId, page, size, status, timeframe, + paymentDateSince, paymentDateUntil, createdSince, createdUntil).execute(); } /** - * Builds the ApiCall object for getRecipientByCode. + * Builds the ApiCall object for getAnticipations. */ - private ApiCall prepareGetRecipientByCodeRequest( - final String code) throws IOException { - return new ApiCall.Builder() + private ApiCall prepareGetAnticipationsRequest( + final String recipientId, + final Integer page, + final Integer size, + final String status, + final String timeframe, + final LocalDateTime paymentDateSince, + final LocalDateTime paymentDateUntil, + final LocalDateTime createdSince, + final LocalDateTime createdUntil) throws IOException { + return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/recipients/{code}") - .templateParam(param -> param.key("code").value(code) + .path("/recipients/{recipient_id}/anticipations") + .queryParam(param -> param.key("page") + .value(page).isRequired(false)) + .queryParam(param -> param.key("size") + .value(size).isRequired(false)) + .queryParam(param -> param.key("status") + .value(status).isRequired(false)) + .queryParam(param -> param.key("timeframe") + .value(timeframe).isRequired(false)) + .queryParam(param -> param.key("payment_date_since") + .value(DateTimeHelper.toRfc8601DateTime(paymentDateSince)).isRequired(false)) + .queryParam(param -> param.key("payment_date_until") + .value(DateTimeHelper.toRfc8601DateTime(paymentDateUntil)).isRequired(false)) + .queryParam(param -> param.key("created_since") + .value(DateTimeHelper.toRfc8601DateTime(createdSince)).isRequired(false)) + .queryParam(param -> param.key("created_until") + .value(DateTimeHelper.toRfc8601DateTime(createdUntil)).isRequired(false)) + .templateParam(param -> param.key("recipient_id").value(recipientId) .shouldEncode(true)) .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth @@ -559,52 +721,40 @@ private ApiCall prepareGetRecipientByCodeReq .httpMethod(HttpMethod.GET)) .responseHandler(responseHandler -> responseHandler .deserializer( - response -> ApiHelper.deserialize(response, GetRecipientResponse.class)) + response -> ApiHelper.deserialize(response, ListAnticipationResponse.class)) .nullify404(false) .globalErrorCase(GLOBAL_ERROR_CASES)) .build(); } /** - * Updates recipient metadata. - * @param recipientId Required parameter: Recipient id - * @param request Required parameter: Metadata - * @param idempotencyKey Optional parameter: Example: + * Retrieves recipient information. + * @param recipientId Required parameter: Recipiend id * @return Returns the GetRecipientResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetRecipientResponse updateAutomaticAnticipationSettings( - final String recipientId, - final UpdateAutomaticAnticipationSettingsRequest request, - final String idempotencyKey) throws ApiException, IOException { - return prepareUpdateAutomaticAnticipationSettingsRequest(recipientId, request, - idempotencyKey).execute(); + public GetRecipientResponse getRecipient( + final String recipientId) throws ApiException, IOException { + return prepareGetRecipientRequest(recipientId).execute(); } /** - * Builds the ApiCall object for updateAutomaticAnticipationSettings. + * Builds the ApiCall object for getRecipient. */ - private ApiCall prepareUpdateAutomaticAnticipationSettingsRequest( - final String recipientId, - final UpdateAutomaticAnticipationSettingsRequest request, - final String idempotencyKey) throws JsonProcessingException, IOException { + private ApiCall prepareGetRecipientRequest( + final String recipientId) throws IOException { return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/recipients/{recipient_id}/automatic-anticipation-settings") - .bodyParam(param -> param.value(request)) - .bodySerializer(() -> ApiHelper.serialize(request)) + .path("/recipients/{recipient_id}") .templateParam(param -> param.key("recipient_id").value(recipientId) .shouldEncode(true)) - .headerParam(param -> param.key("idempotency-key") - .value(idempotencyKey).isRequired(false)) - .headerParam(param ->param.key("content-type").value("application/json")) .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) - .httpMethod(HttpMethod.PATCH)) + .httpMethod(HttpMethod.GET)) .responseHandler(responseHandler -> responseHandler .deserializer( response -> ApiHelper.deserialize(response, GetRecipientResponse.class)) @@ -614,152 +764,131 @@ private ApiCall prepareUpdateAutomaticAntici } /** - * Creates a transfer for a recipient. - * @param recipientId Required parameter: Recipient Id - * @param request Required parameter: Transfer data - * @param idempotencyKey Optional parameter: Example: - * @return Returns the GetTransferResponse response from the API call + * Get balance information for a recipient. + * @param recipientId Required parameter: Recipient id + * @return Returns the GetBalanceResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetTransferResponse createTransfer( - final String recipientId, - final CreateTransferRequest request, - final String idempotencyKey) throws ApiException, IOException { - return prepareCreateTransferRequest(recipientId, request, idempotencyKey).execute(); + public GetBalanceResponse getBalance( + final String recipientId) throws ApiException, IOException { + return prepareGetBalanceRequest(recipientId).execute(); } /** - * Builds the ApiCall object for createTransfer. + * Builds the ApiCall object for getBalance. */ - private ApiCall prepareCreateTransferRequest( - final String recipientId, - final CreateTransferRequest request, - final String idempotencyKey) throws JsonProcessingException, IOException { - return new ApiCall.Builder() + private ApiCall prepareGetBalanceRequest( + final String recipientId) throws IOException { + return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/recipients/{recipient_id}/transfers") - .bodyParam(param -> param.value(request)) - .bodySerializer(() -> ApiHelper.serialize(request)) + .path("/recipients/{recipient_id}/balance") .templateParam(param -> param.key("recipient_id").value(recipientId) .shouldEncode(true)) - .headerParam(param -> param.key("idempotency-key") - .value(idempotencyKey).isRequired(false)) - .headerParam(param ->param.key("content-type").value("application/json")) .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) - .httpMethod(HttpMethod.POST)) - .responseHandler(responseHandler -> responseHandler - .deserializer( - response -> ApiHelper.deserialize(response, GetTransferResponse.class)) - .nullify404(false) - .globalErrorCase(GLOBAL_ERROR_CASES)) - .build(); - } - - /** - * Creates a new recipient. - * @param request Required parameter: Recipient data - * @param idempotencyKey Optional parameter: Example: - * @return Returns the GetRecipientResponse response from the API call - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - public GetRecipientResponse createRecipient( - final CreateRecipientRequest request, - final String idempotencyKey) throws ApiException, IOException { - return prepareCreateRecipientRequest(request, idempotencyKey).execute(); - } - - /** - * Builds the ApiCall object for createRecipient. - */ - private ApiCall prepareCreateRecipientRequest( - final CreateRecipientRequest request, - final String idempotencyKey) throws JsonProcessingException, IOException { - return new ApiCall.Builder() - .globalConfig(getGlobalConfiguration()) - .requestBuilder(requestBuilder -> requestBuilder - .server(Server.ENUM_DEFAULT.value()) - .path("/recipients") - .bodyParam(param -> param.value(request)) - .bodySerializer(() -> ApiHelper.serialize(request)) - .headerParam(param -> param.key("idempotency-key") - .value(idempotencyKey).isRequired(false)) - .headerParam(param ->param.key("content-type").value("application/json")) - .headerParam(param -> param.key("accept").value("application/json")) - .withAuth(auth -> auth - .add("httpBasic")) - .httpMethod(HttpMethod.POST)) + .httpMethod(HttpMethod.GET)) .responseHandler(responseHandler -> responseHandler .deserializer( - response -> ApiHelper.deserialize(response, GetRecipientResponse.class)) + response -> ApiHelper.deserialize(response, GetBalanceResponse.class)) .nullify404(false) .globalErrorCase(GLOBAL_ERROR_CASES)) .build(); } /** - * @return Returns the GetRecipientResponse response from the API call + * Gets a paginated list of transfers for the recipient. + * @param recipientId Required parameter: Example: + * @param page Optional parameter: Example: + * @param size Optional parameter: Example: + * @param status Optional parameter: Example: + * @param createdSince Optional parameter: Example: + * @param createdUntil Optional parameter: Example: + * @return Returns the ListWithdrawals response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetRecipientResponse getDefaultRecipient() throws ApiException, IOException { - return prepareGetDefaultRecipientRequest().execute(); + public ListWithdrawals getWithdrawals( + final String recipientId, + final Integer page, + final Integer size, + final String status, + final LocalDateTime createdSince, + final LocalDateTime createdUntil) throws ApiException, IOException { + return prepareGetWithdrawalsRequest(recipientId, page, size, status, createdSince, + createdUntil).execute(); } /** - * Builds the ApiCall object for getDefaultRecipient. + * Builds the ApiCall object for getWithdrawals. */ - private ApiCall prepareGetDefaultRecipientRequest() throws IOException { - return new ApiCall.Builder() + private ApiCall prepareGetWithdrawalsRequest( + final String recipientId, + final Integer page, + final Integer size, + final String status, + final LocalDateTime createdSince, + final LocalDateTime createdUntil) throws IOException { + return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/recipients/default") + .path("/recipients/{recipient_id}/withdrawals") + .queryParam(param -> param.key("page") + .value(page).isRequired(false)) + .queryParam(param -> param.key("size") + .value(size).isRequired(false)) + .queryParam(param -> param.key("status") + .value(status).isRequired(false)) + .queryParam(param -> param.key("created_since") + .value(DateTimeHelper.toRfc8601DateTime(createdSince)).isRequired(false)) + .queryParam(param -> param.key("created_until") + .value(DateTimeHelper.toRfc8601DateTime(createdUntil)).isRequired(false)) + .templateParam(param -> param.key("recipient_id").value(recipientId) + .shouldEncode(true)) .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) .httpMethod(HttpMethod.GET)) .responseHandler(responseHandler -> responseHandler .deserializer( - response -> ApiHelper.deserialize(response, GetRecipientResponse.class)) + response -> ApiHelper.deserialize(response, ListWithdrawals.class)) .nullify404(false) .globalErrorCase(GLOBAL_ERROR_CASES)) .build(); } /** - * Creates an anticipation. - * @param recipientId Required parameter: Recipient id - * @param request Required parameter: Anticipation data + * Creates a transfer for a recipient. + * @param recipientId Required parameter: Recipient Id + * @param request Required parameter: Transfer data * @param idempotencyKey Optional parameter: Example: - * @return Returns the GetAnticipationResponse response from the API call + * @return Returns the GetTransferResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetAnticipationResponse createAnticipation( + public GetTransferResponse createTransfer( final String recipientId, - final CreateAnticipationRequest request, + final CreateTransferRequest request, final String idempotencyKey) throws ApiException, IOException { - return prepareCreateAnticipationRequest(recipientId, request, idempotencyKey).execute(); + return prepareCreateTransferRequest(recipientId, request, idempotencyKey).execute(); } /** - * Builds the ApiCall object for createAnticipation. + * Builds the ApiCall object for createTransfer. */ - private ApiCall prepareCreateAnticipationRequest( + private ApiCall prepareCreateTransferRequest( final String recipientId, - final CreateAnticipationRequest request, + final CreateTransferRequest request, final String idempotencyKey) throws JsonProcessingException, IOException { - return new ApiCall.Builder() + return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/recipients/{recipient_id}/anticipations") + .path("/recipients/{recipient_id}/transfers") .bodyParam(param -> param.value(request)) .bodySerializer(() -> ApiHelper.serialize(request)) .templateParam(param -> param.key("recipient_id").value(recipientId) @@ -773,98 +902,82 @@ private ApiCall prepareCreateAnticipation .httpMethod(HttpMethod.POST)) .responseHandler(responseHandler -> responseHandler .deserializer( - response -> ApiHelper.deserialize(response, GetAnticipationResponse.class)) + response -> ApiHelper.deserialize(response, GetTransferResponse.class)) .nullify404(false) .globalErrorCase(GLOBAL_ERROR_CASES)) .build(); } /** - * Gets the anticipation limits for a recipient. - * @param recipientId Required parameter: Recipient id - * @param timeframe Required parameter: Timeframe - * @param paymentDate Required parameter: Anticipation payment date - * @return Returns the GetAnticipationLimitResponse response from the API call + * Creates a new recipient. + * @param request Required parameter: Recipient data + * @param idempotencyKey Optional parameter: Example: + * @return Returns the GetRecipientResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetAnticipationLimitResponse getAnticipationLimits( - final String recipientId, - final String timeframe, - final LocalDateTime paymentDate) throws ApiException, IOException { - return prepareGetAnticipationLimitsRequest(recipientId, timeframe, paymentDate).execute(); + public GetRecipientResponse createRecipient( + final CreateRecipientRequest request, + final String idempotencyKey) throws ApiException, IOException { + return prepareCreateRecipientRequest(request, idempotencyKey).execute(); } /** - * Builds the ApiCall object for getAnticipationLimits. + * Builds the ApiCall object for createRecipient. */ - private ApiCall prepareGetAnticipationLimitsRequest( - final String recipientId, - final String timeframe, - final LocalDateTime paymentDate) throws IOException { - return new ApiCall.Builder() + private ApiCall prepareCreateRecipientRequest( + final CreateRecipientRequest request, + final String idempotencyKey) throws JsonProcessingException, IOException { + return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/recipients/{recipient_id}/anticipation_limits") - .queryParam(param -> param.key("timeframe") - .value(timeframe)) - .queryParam(param -> param.key("payment_date") - .value(DateTimeHelper.toRfc8601DateTime(paymentDate))) - .templateParam(param -> param.key("recipient_id").value(recipientId) - .shouldEncode(true)) + .path("/recipients") + .bodyParam(param -> param.value(request)) + .bodySerializer(() -> ApiHelper.serialize(request)) + .headerParam(param -> param.key("idempotency-key") + .value(idempotencyKey).isRequired(false)) + .headerParam(param ->param.key("content-type").value("application/json")) .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) - .httpMethod(HttpMethod.GET)) + .httpMethod(HttpMethod.POST)) .responseHandler(responseHandler -> responseHandler .deserializer( - response -> ApiHelper.deserialize(response, GetAnticipationLimitResponse.class)) + response -> ApiHelper.deserialize(response, GetRecipientResponse.class)) .nullify404(false) .globalErrorCase(GLOBAL_ERROR_CASES)) .build(); } /** - * Updates recipient metadata. - * @param recipientId Required parameter: Recipient id - * @param request Required parameter: Metadata - * @param idempotencyKey Optional parameter: Example: + * Retrieves recipient information. + * @param code Required parameter: Recipient code * @return Returns the GetRecipientResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetRecipientResponse updateRecipientMetadata( - final String recipientId, - final UpdateMetadataRequest request, - final String idempotencyKey) throws ApiException, IOException { - return prepareUpdateRecipientMetadataRequest(recipientId, request, - idempotencyKey).execute(); + public GetRecipientResponse getRecipientByCode( + final String code) throws ApiException, IOException { + return prepareGetRecipientByCodeRequest(code).execute(); } /** - * Builds the ApiCall object for updateRecipientMetadata. + * Builds the ApiCall object for getRecipientByCode. */ - private ApiCall prepareUpdateRecipientMetadataRequest( - final String recipientId, - final UpdateMetadataRequest request, - final String idempotencyKey) throws JsonProcessingException, IOException { + private ApiCall prepareGetRecipientByCodeRequest( + final String code) throws IOException { return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/recipients/{recipient_id}/metadata") - .bodyParam(param -> param.value(request)) - .bodySerializer(() -> ApiHelper.serialize(request)) - .templateParam(param -> param.key("recipient_id").value(recipientId) + .path("/recipients/{code}") + .templateParam(param -> param.key("code").value(code) .shouldEncode(true)) - .headerParam(param -> param.key("idempotency-key") - .value(idempotencyKey).isRequired(false)) - .headerParam(param ->param.key("content-type").value("application/json")) .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) - .httpMethod(HttpMethod.PATCH)) + .httpMethod(HttpMethod.GET)) .responseHandler(responseHandler -> responseHandler .deserializer( response -> ApiHelper.deserialize(response, GetRecipientResponse.class)) @@ -874,142 +987,66 @@ private ApiCall prepareUpdateRecipientMetada } /** - * Retrieves a paginated list of anticipations from a recipient. - * @param recipientId Required parameter: Recipient id - * @param page Optional parameter: Page number - * @param size Optional parameter: Page size - * @param status Optional parameter: Filter for anticipation status - * @param timeframe Optional parameter: Filter for anticipation timeframe - * @param paymentDateSince Optional parameter: Filter for start range for anticipation payment - * date - * @param paymentDateUntil Optional parameter: Filter for end range for anticipation payment - * date - * @param createdSince Optional parameter: Filter for start range for anticipation creation - * date - * @param createdUntil Optional parameter: Filter for end range for anticipation creation date - * @return Returns the ListAnticipationResponse response from the API call + * @return Returns the GetRecipientResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public ListAnticipationResponse getAnticipations( - final String recipientId, - final Integer page, - final Integer size, - final String status, - final String timeframe, - final LocalDateTime paymentDateSince, - final LocalDateTime paymentDateUntil, - final LocalDateTime createdSince, - final LocalDateTime createdUntil) throws ApiException, IOException { - return prepareGetAnticipationsRequest(recipientId, page, size, status, timeframe, - paymentDateSince, paymentDateUntil, createdSince, createdUntil).execute(); + public GetRecipientResponse getDefaultRecipient() throws ApiException, IOException { + return prepareGetDefaultRecipientRequest().execute(); } /** - * Builds the ApiCall object for getAnticipations. + * Builds the ApiCall object for getDefaultRecipient. */ - private ApiCall prepareGetAnticipationsRequest( - final String recipientId, - final Integer page, - final Integer size, - final String status, - final String timeframe, - final LocalDateTime paymentDateSince, - final LocalDateTime paymentDateUntil, - final LocalDateTime createdSince, - final LocalDateTime createdUntil) throws IOException { - return new ApiCall.Builder() + private ApiCall prepareGetDefaultRecipientRequest() throws IOException { + return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/recipients/{recipient_id}/anticipations") - .queryParam(param -> param.key("page") - .value(page).isRequired(false)) - .queryParam(param -> param.key("size") - .value(size).isRequired(false)) - .queryParam(param -> param.key("status") - .value(status).isRequired(false)) - .queryParam(param -> param.key("timeframe") - .value(timeframe).isRequired(false)) - .queryParam(param -> param.key("payment_date_since") - .value(DateTimeHelper.toRfc8601DateTime(paymentDateSince)).isRequired(false)) - .queryParam(param -> param.key("payment_date_until") - .value(DateTimeHelper.toRfc8601DateTime(paymentDateUntil)).isRequired(false)) - .queryParam(param -> param.key("created_since") - .value(DateTimeHelper.toRfc8601DateTime(createdSince)).isRequired(false)) - .queryParam(param -> param.key("created_until") - .value(DateTimeHelper.toRfc8601DateTime(createdUntil)).isRequired(false)) - .templateParam(param -> param.key("recipient_id").value(recipientId) - .shouldEncode(true)) + .path("/recipients/default") .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) .httpMethod(HttpMethod.GET)) .responseHandler(responseHandler -> responseHandler .deserializer( - response -> ApiHelper.deserialize(response, ListAnticipationResponse.class)) + response -> ApiHelper.deserialize(response, GetRecipientResponse.class)) .nullify404(false) .globalErrorCase(GLOBAL_ERROR_CASES)) .build(); } /** - * Gets a paginated list of transfers for the recipient. + * Create a KYC link. * @param recipientId Required parameter: Example: - * @param page Optional parameter: Example: - * @param size Optional parameter: Example: - * @param status Optional parameter: Example: - * @param createdSince Optional parameter: Example: - * @param createdUntil Optional parameter: Example: - * @return Returns the ListWithdrawals response from the API call + * @return Returns the CreateKYCLinkResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public ListWithdrawals getWithdrawals( - final String recipientId, - final Integer page, - final Integer size, - final String status, - final LocalDateTime createdSince, - final LocalDateTime createdUntil) throws ApiException, IOException { - return prepareGetWithdrawalsRequest(recipientId, page, size, status, createdSince, - createdUntil).execute(); + public CreateKYCLinkResponse createKYCLink( + final String recipientId) throws ApiException, IOException { + return prepareCreateKYCLinkRequest(recipientId).execute(); } /** - * Builds the ApiCall object for getWithdrawals. + * Builds the ApiCall object for createKYCLink. */ - private ApiCall prepareGetWithdrawalsRequest( - final String recipientId, - final Integer page, - final Integer size, - final String status, - final LocalDateTime createdSince, - final LocalDateTime createdUntil) throws IOException { - return new ApiCall.Builder() + private ApiCall prepareCreateKYCLinkRequest( + final String recipientId) throws IOException { + return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/recipients/{recipient_id}/withdrawals") - .queryParam(param -> param.key("page") - .value(page).isRequired(false)) - .queryParam(param -> param.key("size") - .value(size).isRequired(false)) - .queryParam(param -> param.key("status") - .value(status).isRequired(false)) - .queryParam(param -> param.key("created_since") - .value(DateTimeHelper.toRfc8601DateTime(createdSince)).isRequired(false)) - .queryParam(param -> param.key("created_until") - .value(DateTimeHelper.toRfc8601DateTime(createdUntil)).isRequired(false)) + .path("/recipients/{recipient_id}/kyc_link") .templateParam(param -> param.key("recipient_id").value(recipientId) .shouldEncode(true)) .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) - .httpMethod(HttpMethod.GET)) + .httpMethod(HttpMethod.POST)) .responseHandler(responseHandler -> responseHandler .deserializer( - response -> ApiHelper.deserialize(response, ListWithdrawals.class)) + response -> ApiHelper.deserialize(response, CreateKYCLinkResponse.class)) .nullify404(false) .globalErrorCase(GLOBAL_ERROR_CASES)) .build(); diff --git a/src/main/java/me/pagar/api/controllers/DefaultSubscriptionsController.java b/src/main/java/me/pagar/api/controllers/DefaultSubscriptionsController.java index 96173a8..b9e659e 100644 --- a/src/main/java/me/pagar/api/controllers/DefaultSubscriptionsController.java +++ b/src/main/java/me/pagar/api/controllers/DefaultSubscriptionsController.java @@ -62,81 +62,74 @@ public DefaultSubscriptionsController(GlobalConfiguration globalConfig) { } /** - * Updates the credit card from a subscription. - * @param subscriptionId Required parameter: Subscription id - * @param request Required parameter: Request for updating a card + * @param subscriptionId Required parameter: Example: * @param idempotencyKey Optional parameter: Example: - * @return Returns the GetSubscriptionResponse response from the API call + * @return Returns the GetPeriodResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetSubscriptionResponse updateSubscriptionCard( + public GetPeriodResponse renewSubscription( final String subscriptionId, - final UpdateSubscriptionCardRequest request, final String idempotencyKey) throws ApiException, IOException { - return prepareUpdateSubscriptionCardRequest(subscriptionId, request, - idempotencyKey).execute(); + return prepareRenewSubscriptionRequest(subscriptionId, idempotencyKey).execute(); } /** - * Builds the ApiCall object for updateSubscriptionCard. + * Builds the ApiCall object for renewSubscription. */ - private ApiCall prepareUpdateSubscriptionCardRequest( + private ApiCall prepareRenewSubscriptionRequest( final String subscriptionId, - final UpdateSubscriptionCardRequest request, - final String idempotencyKey) throws JsonProcessingException, IOException { - return new ApiCall.Builder() + final String idempotencyKey) throws IOException { + return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/subscriptions/{subscription_id}/card") - .bodyParam(param -> param.value(request)) - .bodySerializer(() -> ApiHelper.serialize(request)) + .path("/subscriptions/{subscription_id}/cycles") .templateParam(param -> param.key("subscription_id").value(subscriptionId) .shouldEncode(true)) .headerParam(param -> param.key("idempotency-key") .value(idempotencyKey).isRequired(false)) - .headerParam(param ->param.key("content-type").value("application/json")) .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) - .httpMethod(HttpMethod.PATCH)) + .httpMethod(HttpMethod.POST)) .responseHandler(responseHandler -> responseHandler .deserializer( - response -> ApiHelper.deserialize(response, GetSubscriptionResponse.class)) + response -> ApiHelper.deserialize(response, GetPeriodResponse.class)) .nullify404(false) .globalErrorCase(GLOBAL_ERROR_CASES)) .build(); } /** - * Creates a discount. + * Updates the credit card from a subscription. * @param subscriptionId Required parameter: Subscription id - * @param request Required parameter: Request for creating a discount + * @param request Required parameter: Request for updating a card * @param idempotencyKey Optional parameter: Example: - * @return Returns the GetDiscountResponse response from the API call + * @return Returns the GetSubscriptionResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetDiscountResponse createDiscount( + public GetSubscriptionResponse updateSubscriptionCard( final String subscriptionId, - final CreateDiscountRequest request, + final UpdateSubscriptionCardRequest request, final String idempotencyKey) throws ApiException, IOException { - return prepareCreateDiscountRequest(subscriptionId, request, idempotencyKey).execute(); + return prepareUpdateSubscriptionCardRequest(subscriptionId, request, + idempotencyKey).execute(); } /** - * Builds the ApiCall object for createDiscount. + * Builds the ApiCall object for updateSubscriptionCard. */ - private ApiCall prepareCreateDiscountRequest( + private ApiCall prepareUpdateSubscriptionCardRequest( final String subscriptionId, - final CreateDiscountRequest request, + final UpdateSubscriptionCardRequest request, final String idempotencyKey) throws JsonProcessingException, IOException { - return new ApiCall.Builder() + return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/subscriptions/{subscription_id}/discounts") + .path("/subscriptions/{subscription_id}/card") .bodyParam(param -> param.value(request)) .bodySerializer(() -> ApiHelper.serialize(request)) .templateParam(param -> param.key("subscription_id").value(subscriptionId) @@ -147,92 +140,94 @@ private ApiCall prepareCreateDiscountRequest( .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) - .httpMethod(HttpMethod.POST)) + .httpMethod(HttpMethod.PATCH)) .responseHandler(responseHandler -> responseHandler .deserializer( - response -> ApiHelper.deserialize(response, GetDiscountResponse.class)) + response -> ApiHelper.deserialize(response, GetSubscriptionResponse.class)) .nullify404(false) .globalErrorCase(GLOBAL_ERROR_CASES)) .build(); } /** - * Updates the billing date from a subscription. + * Deletes a usage. * @param subscriptionId Required parameter: The subscription id - * @param request Required parameter: Request for updating the subscription billing date + * @param itemId Required parameter: The subscription item id + * @param usageId Required parameter: The usage id * @param idempotencyKey Optional parameter: Example: - * @return Returns the GetSubscriptionResponse response from the API call + * @return Returns the GetUsageResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetSubscriptionResponse updateSubscriptionBillingDate( + public GetUsageResponse deleteUsage( final String subscriptionId, - final UpdateSubscriptionBillingDateRequest request, + final String itemId, + final String usageId, final String idempotencyKey) throws ApiException, IOException { - return prepareUpdateSubscriptionBillingDateRequest(subscriptionId, request, - idempotencyKey).execute(); + return prepareDeleteUsageRequest(subscriptionId, itemId, usageId, idempotencyKey).execute(); } /** - * Builds the ApiCall object for updateSubscriptionBillingDate. + * Builds the ApiCall object for deleteUsage. */ - private ApiCall prepareUpdateSubscriptionBillingDateRequest( + private ApiCall prepareDeleteUsageRequest( final String subscriptionId, - final UpdateSubscriptionBillingDateRequest request, - final String idempotencyKey) throws JsonProcessingException, IOException { - return new ApiCall.Builder() + final String itemId, + final String usageId, + final String idempotencyKey) throws IOException { + return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/subscriptions/{subscription_id}/billing-date") - .bodyParam(param -> param.value(request)) - .bodySerializer(() -> ApiHelper.serialize(request)) + .path("/subscriptions/{subscription_id}/items/{item_id}/usages/{usage_id}") .templateParam(param -> param.key("subscription_id").value(subscriptionId) .shouldEncode(true)) + .templateParam(param -> param.key("item_id").value(itemId) + .shouldEncode(true)) + .templateParam(param -> param.key("usage_id").value(usageId) + .shouldEncode(true)) .headerParam(param -> param.key("idempotency-key") .value(idempotencyKey).isRequired(false)) - .headerParam(param ->param.key("content-type").value("application/json")) .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) - .httpMethod(HttpMethod.PATCH)) + .httpMethod(HttpMethod.DELETE)) .responseHandler(responseHandler -> responseHandler .deserializer( - response -> ApiHelper.deserialize(response, GetSubscriptionResponse.class)) + response -> ApiHelper.deserialize(response, GetUsageResponse.class)) .nullify404(false) .globalErrorCase(GLOBAL_ERROR_CASES)) .build(); } /** - * Updates the start at date from a subscription. - * @param subscriptionId Required parameter: The subscription id - * @param request Required parameter: Request for updating the subscription start date + * Creates a discount. + * @param subscriptionId Required parameter: Subscription id + * @param request Required parameter: Request for creating a discount * @param idempotencyKey Optional parameter: Example: - * @return Returns the GetSubscriptionResponse response from the API call + * @return Returns the GetDiscountResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetSubscriptionResponse updateSubscriptionStartAt( + public GetDiscountResponse createDiscount( final String subscriptionId, - final UpdateSubscriptionStartAtRequest request, + final CreateDiscountRequest request, final String idempotencyKey) throws ApiException, IOException { - return prepareUpdateSubscriptionStartAtRequest(subscriptionId, request, - idempotencyKey).execute(); + return prepareCreateDiscountRequest(subscriptionId, request, idempotencyKey).execute(); } /** - * Builds the ApiCall object for updateSubscriptionStartAt. + * Builds the ApiCall object for createDiscount. */ - private ApiCall prepareUpdateSubscriptionStartAtRequest( + private ApiCall prepareCreateDiscountRequest( final String subscriptionId, - final UpdateSubscriptionStartAtRequest request, + final CreateDiscountRequest request, final String idempotencyKey) throws JsonProcessingException, IOException { - return new ApiCall.Builder() + return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/subscriptions/{subscription_id}/start-at") + .path("/subscriptions/{subscription_id}/discounts") .bodyParam(param -> param.value(request)) .bodySerializer(() -> ApiHelper.serialize(request)) .templateParam(param -> param.key("subscription_id").value(subscriptionId) @@ -243,152 +238,88 @@ private ApiCall prepareUpdateSubscription .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) - .httpMethod(HttpMethod.PATCH)) + .httpMethod(HttpMethod.POST)) .responseHandler(responseHandler -> responseHandler .deserializer( - response -> ApiHelper.deserialize(response, GetSubscriptionResponse.class)) + response -> ApiHelper.deserialize(response, GetDiscountResponse.class)) .nullify404(false) .globalErrorCase(GLOBAL_ERROR_CASES)) .build(); } /** - * Gets a subscription. + * Create Usage. * @param subscriptionId Required parameter: Subscription id - * @return Returns the GetSubscriptionResponse response from the API call - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - public GetSubscriptionResponse getSubscription( - final String subscriptionId) throws ApiException, IOException { - return prepareGetSubscriptionRequest(subscriptionId).execute(); - } - - /** - * Builds the ApiCall object for getSubscription. - */ - private ApiCall prepareGetSubscriptionRequest( - final String subscriptionId) throws IOException { - return new ApiCall.Builder() - .globalConfig(getGlobalConfiguration()) - .requestBuilder(requestBuilder -> requestBuilder - .server(Server.ENUM_DEFAULT.value()) - .path("/subscriptions/{subscription_id}") - .templateParam(param -> param.key("subscription_id").value(subscriptionId) - .shouldEncode(true)) - .headerParam(param -> param.key("accept").value("application/json")) - .withAuth(auth -> auth - .add("httpBasic")) - .httpMethod(HttpMethod.GET)) - .responseHandler(responseHandler -> responseHandler - .deserializer( - response -> ApiHelper.deserialize(response, GetSubscriptionResponse.class)) - .nullify404(false) - .globalErrorCase(GLOBAL_ERROR_CASES)) - .build(); - } - - /** - * Lists all usages from a subscription item. - * @param subscriptionId Required parameter: The subscription id - * @param itemId Required parameter: The subscription item id - * @param page Optional parameter: Page number - * @param size Optional parameter: Page size - * @param code Optional parameter: Identification code in the client system - * @param group Optional parameter: Identification group in the client system - * @param usedSince Optional parameter: Example: - * @param usedUntil Optional parameter: Example: - * @return Returns the ListUsagesResponse response from the API call + * @param itemId Required parameter: Item id + * @param idempotencyKey Optional parameter: Example: + * @return Returns the GetUsageResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public ListUsagesResponse getUsages( + public GetUsageResponse createAnUsage( final String subscriptionId, final String itemId, - final Integer page, - final Integer size, - final String code, - final String group, - final LocalDateTime usedSince, - final LocalDateTime usedUntil) throws ApiException, IOException { - return prepareGetUsagesRequest(subscriptionId, itemId, page, size, code, group, usedSince, - usedUntil).execute(); + final String idempotencyKey) throws ApiException, IOException { + return prepareCreateAnUsageRequest(subscriptionId, itemId, idempotencyKey).execute(); } /** - * Builds the ApiCall object for getUsages. + * Builds the ApiCall object for createAnUsage. */ - private ApiCall prepareGetUsagesRequest( + private ApiCall prepareCreateAnUsageRequest( final String subscriptionId, final String itemId, - final Integer page, - final Integer size, - final String code, - final String group, - final LocalDateTime usedSince, - final LocalDateTime usedUntil) throws IOException { - return new ApiCall.Builder() + final String idempotencyKey) throws IOException { + return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) .path("/subscriptions/{subscription_id}/items/{item_id}/usages") - .queryParam(param -> param.key("page") - .value(page).isRequired(false)) - .queryParam(param -> param.key("size") - .value(size).isRequired(false)) - .queryParam(param -> param.key("code") - .value(code).isRequired(false)) - .queryParam(param -> param.key("group") - .value(group).isRequired(false)) - .queryParam(param -> param.key("used_since") - .value(DateTimeHelper.toRfc8601DateTime(usedSince)).isRequired(false)) - .queryParam(param -> param.key("used_until") - .value(DateTimeHelper.toRfc8601DateTime(usedUntil)).isRequired(false)) .templateParam(param -> param.key("subscription_id").value(subscriptionId) .shouldEncode(true)) .templateParam(param -> param.key("item_id").value(itemId) .shouldEncode(true)) + .headerParam(param -> param.key("idempotency-key") + .value(idempotencyKey).isRequired(false)) .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) - .httpMethod(HttpMethod.GET)) + .httpMethod(HttpMethod.POST)) .responseHandler(responseHandler -> responseHandler .deserializer( - response -> ApiHelper.deserialize(response, ListUsagesResponse.class)) + response -> ApiHelper.deserialize(response, GetUsageResponse.class)) .nullify404(false) .globalErrorCase(GLOBAL_ERROR_CASES)) .build(); } /** - * @param subscriptionId Required parameter: Example: - * @param request Required parameter: Request for updating the end date of the current - * signature cycle + * @param subscriptionId Required parameter: Subscription Id + * @param request Required parameter: Request for updating the end date of the subscription + * current status * @param idempotencyKey Optional parameter: Example: - * @return Returns the GetSubscriptionResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetSubscriptionResponse updateLatestPeriodEndAt( + public void updateCurrentCycleStatus( final String subscriptionId, - final UpdateCurrentCycleEndDateRequest request, + final UpdateCurrentCycleStatusRequest request, final String idempotencyKey) throws ApiException, IOException { - return prepareUpdateLatestPeriodEndAtRequest(subscriptionId, request, - idempotencyKey).execute(); + prepareUpdateCurrentCycleStatusRequest(subscriptionId, request, idempotencyKey).execute(); } /** - * Builds the ApiCall object for updateLatestPeriodEndAt. + * Builds the ApiCall object for updateCurrentCycleStatus. */ - private ApiCall prepareUpdateLatestPeriodEndAtRequest( + private ApiCall prepareUpdateCurrentCycleStatusRequest( final String subscriptionId, - final UpdateCurrentCycleEndDateRequest request, + final UpdateCurrentCycleStatusRequest request, final String idempotencyKey) throws JsonProcessingException, IOException { - return new ApiCall.Builder() + return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/subscriptions/{subscription_id}/periods/latest/end-at") + .path("/subscriptions/{subscription_id}/cycle-status") .bodyParam(param -> param.value(request)) .bodySerializer(() -> ApiHelper.serialize(request)) .templateParam(param -> param.key("subscription_id").value(subscriptionId) @@ -396,13 +327,10 @@ private ApiCall prepareUpdateLatestPeriod .headerParam(param -> param.key("idempotency-key") .value(idempotencyKey).isRequired(false)) .headerParam(param ->param.key("content-type").value("application/json")) - .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) .httpMethod(HttpMethod.PATCH)) .responseHandler(responseHandler -> responseHandler - .deserializer( - response -> ApiHelper.deserialize(response, GetSubscriptionResponse.class)) .nullify404(false) .globalErrorCase(GLOBAL_ERROR_CASES)) .build(); @@ -455,83 +383,113 @@ private ApiCall prepareDeleteDiscountRequest( } /** - * Updates the payment method from a subscription. - * @param subscriptionId Required parameter: Subscription id - * @param request Required parameter: Request for updating the paymentmethod from a - * subscription - * @param idempotencyKey Optional parameter: Example: - * @return Returns the GetSubscriptionResponse response from the API call - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - public GetSubscriptionResponse updateSubscriptionPaymentMethod( - final String subscriptionId, - final UpdateSubscriptionPaymentMethodRequest request, - final String idempotencyKey) throws ApiException, IOException { - return prepareUpdateSubscriptionPaymentMethodRequest(subscriptionId, request, - idempotencyKey).execute(); + * Get Subscription Items. + * @param subscriptionId Required parameter: The subscription id + * @param page Optional parameter: Page number + * @param size Optional parameter: Page size + * @param name Optional parameter: The item name + * @param code Optional parameter: Identification code in the client system + * @param status Optional parameter: The item statis + * @param description Optional parameter: The item description + * @param createdSince Optional parameter: Filter for item's creation date start range + * @param createdUntil Optional parameter: Filter for item's creation date end range + * @return Returns the ListSubscriptionItemsResponse response from the API call + * @throws ApiException Represents error response from the server. + * @throws IOException Signals that an I/O exception of some sort has occurred. + */ + public ListSubscriptionItemsResponse getSubscriptionItems( + final String subscriptionId, + final Integer page, + final Integer size, + final String name, + final String code, + final String status, + final String description, + final String createdSince, + final String createdUntil) throws ApiException, IOException { + return prepareGetSubscriptionItemsRequest(subscriptionId, page, size, name, code, status, + description, createdSince, createdUntil).execute(); } /** - * Builds the ApiCall object for updateSubscriptionPaymentMethod. + * Builds the ApiCall object for getSubscriptionItems. */ - private ApiCall prepareUpdateSubscriptionPaymentMethodRequest( + private ApiCall prepareGetSubscriptionItemsRequest( final String subscriptionId, - final UpdateSubscriptionPaymentMethodRequest request, - final String idempotencyKey) throws JsonProcessingException, IOException { - return new ApiCall.Builder() + final Integer page, + final Integer size, + final String name, + final String code, + final String status, + final String description, + final String createdSince, + final String createdUntil) throws IOException { + return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/subscriptions/{subscription_id}/payment-method") - .bodyParam(param -> param.value(request)) - .bodySerializer(() -> ApiHelper.serialize(request)) + .path("/subscriptions/{subscription_id}/items") + .queryParam(param -> param.key("page") + .value(page).isRequired(false)) + .queryParam(param -> param.key("size") + .value(size).isRequired(false)) + .queryParam(param -> param.key("name") + .value(name).isRequired(false)) + .queryParam(param -> param.key("code") + .value(code).isRequired(false)) + .queryParam(param -> param.key("status") + .value(status).isRequired(false)) + .queryParam(param -> param.key("description") + .value(description).isRequired(false)) + .queryParam(param -> param.key("created_since") + .value(createdSince).isRequired(false)) + .queryParam(param -> param.key("created_until") + .value(createdUntil).isRequired(false)) .templateParam(param -> param.key("subscription_id").value(subscriptionId) .shouldEncode(true)) - .headerParam(param -> param.key("idempotency-key") - .value(idempotencyKey).isRequired(false)) - .headerParam(param ->param.key("content-type").value("application/json")) .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) - .httpMethod(HttpMethod.PATCH)) + .httpMethod(HttpMethod.GET)) .responseHandler(responseHandler -> responseHandler .deserializer( - response -> ApiHelper.deserialize(response, GetSubscriptionResponse.class)) + response -> ApiHelper.deserialize(response, ListSubscriptionItemsResponse.class)) .nullify404(false) .globalErrorCase(GLOBAL_ERROR_CASES)) .build(); } /** - * Cancels a subscription. + * Updates the payment method from a subscription. * @param subscriptionId Required parameter: Subscription id - * @param request Optional parameter: Request for cancelling a subscription + * @param request Required parameter: Request for updating the paymentmethod from a + * subscription * @param idempotencyKey Optional parameter: Example: * @return Returns the GetSubscriptionResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetSubscriptionResponse cancelSubscription( + public GetSubscriptionResponse updateSubscriptionPaymentMethod( final String subscriptionId, - final CreateCancelSubscriptionRequest request, + final UpdateSubscriptionPaymentMethodRequest request, final String idempotencyKey) throws ApiException, IOException { - return prepareCancelSubscriptionRequest(subscriptionId, request, idempotencyKey).execute(); + return prepareUpdateSubscriptionPaymentMethodRequest(subscriptionId, request, + idempotencyKey).execute(); } /** - * Builds the ApiCall object for cancelSubscription. + * Builds the ApiCall object for updateSubscriptionPaymentMethod. */ - private ApiCall prepareCancelSubscriptionRequest( + private ApiCall prepareUpdateSubscriptionPaymentMethodRequest( final String subscriptionId, - final CreateCancelSubscriptionRequest request, + final UpdateSubscriptionPaymentMethodRequest request, final String idempotencyKey) throws JsonProcessingException, IOException { return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/subscriptions/{subscription_id}") - .bodyParam(param -> param.value(request).isRequired(false)) + .path("/subscriptions/{subscription_id}/payment-method") + .bodyParam(param -> param.value(request)) .bodySerializer(() -> ApiHelper.serialize(request)) .templateParam(param -> param.key("subscription_id").value(subscriptionId) .shouldEncode(true)) @@ -541,7 +499,7 @@ private ApiCall prepareCancelSubscription .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) - .httpMethod(HttpMethod.DELETE)) + .httpMethod(HttpMethod.PATCH)) .responseHandler(responseHandler -> responseHandler .deserializer( response -> ApiHelper.deserialize(response, GetSubscriptionResponse.class)) @@ -551,125 +509,170 @@ private ApiCall prepareCancelSubscription } /** - * Creates a new subscription. - * @param body Required parameter: Request for creating a subscription - * @param idempotencyKey Optional parameter: Example: - * @return Returns the GetSubscriptionResponse response from the API call + * Get Subscription Item. + * @param subscriptionId Required parameter: Subscription Id + * @param itemId Required parameter: Item id + * @return Returns the GetSubscriptionItemResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetSubscriptionResponse createSubscription( - final CreateSubscriptionRequest body, - final String idempotencyKey) throws ApiException, IOException { - return prepareCreateSubscriptionRequest(body, idempotencyKey).execute(); + public GetSubscriptionItemResponse getSubscriptionItem( + final String subscriptionId, + final String itemId) throws ApiException, IOException { + return prepareGetSubscriptionItemRequest(subscriptionId, itemId).execute(); } /** - * Builds the ApiCall object for createSubscription. + * Builds the ApiCall object for getSubscriptionItem. */ - private ApiCall prepareCreateSubscriptionRequest( - final CreateSubscriptionRequest body, - final String idempotencyKey) throws JsonProcessingException, IOException { - return new ApiCall.Builder() + private ApiCall prepareGetSubscriptionItemRequest( + final String subscriptionId, + final String itemId) throws IOException { + return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/subscriptions") - .bodyParam(param -> param.value(body)) - .bodySerializer(() -> ApiHelper.serialize(body)) - .headerParam(param -> param.key("idempotency-key") - .value(idempotencyKey).isRequired(false)) - .headerParam(param ->param.key("content-type").value("application/json")) + .path("/subscriptions/{subscription_id}/items/{item_id}") + .templateParam(param -> param.key("subscription_id").value(subscriptionId) + .shouldEncode(true)) + .templateParam(param -> param.key("item_id").value(itemId) + .shouldEncode(true)) .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) - .httpMethod(HttpMethod.POST)) + .httpMethod(HttpMethod.GET)) .responseHandler(responseHandler -> responseHandler .deserializer( - response -> ApiHelper.deserialize(response, GetSubscriptionResponse.class)) + response -> ApiHelper.deserialize(response, GetSubscriptionItemResponse.class)) .nullify404(false) .globalErrorCase(GLOBAL_ERROR_CASES)) .build(); } /** - * @param subscriptionId Required parameter: Example: - * @param request Required parameter: Request for updating a subscription affiliation id - * @param idempotencyKey Optional parameter: Example: - * @return Returns the GetSubscriptionResponse response from the API call + * Gets all subscriptions. + * @param page Optional parameter: Page number + * @param size Optional parameter: Page size + * @param code Optional parameter: Filter for subscription's code + * @param billingType Optional parameter: Filter for subscription's billing type + * @param customerId Optional parameter: Filter for subscription's customer id + * @param planId Optional parameter: Filter for subscription's plan id + * @param cardId Optional parameter: Filter for subscription's card id + * @param status Optional parameter: Filter for subscription's status + * @param nextBillingSince Optional parameter: Filter for subscription's next billing date + * start range + * @param nextBillingUntil Optional parameter: Filter for subscription's next billing date end + * range + * @param createdSince Optional parameter: Filter for subscription's creation date start range + * @param createdUntil Optional parameter: Filter for subscriptions creation date end range + * @return Returns the ListSubscriptionsResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetSubscriptionResponse updateSubscriptionAffiliationId( - final String subscriptionId, - final UpdateSubscriptionAffiliationIdRequest request, - final String idempotencyKey) throws ApiException, IOException { - return prepareUpdateSubscriptionAffiliationIdRequest(subscriptionId, request, - idempotencyKey).execute(); + public ListSubscriptionsResponse getSubscriptions( + final Integer page, + final Integer size, + final String code, + final String billingType, + final String customerId, + final String planId, + final String cardId, + final String status, + final LocalDateTime nextBillingSince, + final LocalDateTime nextBillingUntil, + final LocalDateTime createdSince, + final LocalDateTime createdUntil) throws ApiException, IOException { + return prepareGetSubscriptionsRequest(page, size, code, billingType, customerId, planId, + cardId, status, nextBillingSince, nextBillingUntil, createdSince, + createdUntil).execute(); } /** - * Builds the ApiCall object for updateSubscriptionAffiliationId. + * Builds the ApiCall object for getSubscriptions. */ - private ApiCall prepareUpdateSubscriptionAffiliationIdRequest( - final String subscriptionId, - final UpdateSubscriptionAffiliationIdRequest request, - final String idempotencyKey) throws JsonProcessingException, IOException { - return new ApiCall.Builder() + private ApiCall prepareGetSubscriptionsRequest( + final Integer page, + final Integer size, + final String code, + final String billingType, + final String customerId, + final String planId, + final String cardId, + final String status, + final LocalDateTime nextBillingSince, + final LocalDateTime nextBillingUntil, + final LocalDateTime createdSince, + final LocalDateTime createdUntil) throws IOException { + return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/subscriptions/{subscription_id}/gateway-affiliation-id") - .bodyParam(param -> param.value(request)) - .bodySerializer(() -> ApiHelper.serialize(request)) - .templateParam(param -> param.key("subscription_id").value(subscriptionId) - .shouldEncode(true)) - .headerParam(param -> param.key("idempotency-key") - .value(idempotencyKey).isRequired(false)) - .headerParam(param ->param.key("content-type").value("application/json")) + .path("/subscriptions") + .queryParam(param -> param.key("page") + .value(page).isRequired(false)) + .queryParam(param -> param.key("size") + .value(size).isRequired(false)) + .queryParam(param -> param.key("code") + .value(code).isRequired(false)) + .queryParam(param -> param.key("billing_type") + .value(billingType).isRequired(false)) + .queryParam(param -> param.key("customer_id") + .value(customerId).isRequired(false)) + .queryParam(param -> param.key("plan_id") + .value(planId).isRequired(false)) + .queryParam(param -> param.key("card_id") + .value(cardId).isRequired(false)) + .queryParam(param -> param.key("status") + .value(status).isRequired(false)) + .queryParam(param -> param.key("next_billing_since") + .value(DateTimeHelper.toRfc8601DateTime(nextBillingSince)).isRequired(false)) + .queryParam(param -> param.key("next_billing_until") + .value(DateTimeHelper.toRfc8601DateTime(nextBillingUntil)).isRequired(false)) + .queryParam(param -> param.key("created_since") + .value(DateTimeHelper.toRfc8601DateTime(createdSince)).isRequired(false)) + .queryParam(param -> param.key("created_until") + .value(DateTimeHelper.toRfc8601DateTime(createdUntil)).isRequired(false)) .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) - .httpMethod(HttpMethod.PATCH)) + .httpMethod(HttpMethod.GET)) .responseHandler(responseHandler -> responseHandler .deserializer( - response -> ApiHelper.deserialize(response, GetSubscriptionResponse.class)) + response -> ApiHelper.deserialize(response, ListSubscriptionsResponse.class)) .nullify404(false) .globalErrorCase(GLOBAL_ERROR_CASES)) .build(); } /** - * Atualização do valor mínimo da assinatura. - * @param subscriptionId Required parameter: Subscription Id - * @param request Required parameter: Request da requisição com o valor mínimo que será - * configurado + * Cancels a subscription. + * @param subscriptionId Required parameter: Subscription id + * @param request Optional parameter: Request for cancelling a subscription * @param idempotencyKey Optional parameter: Example: * @return Returns the GetSubscriptionResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetSubscriptionResponse updateSubscriptionMiniumPrice( + public GetSubscriptionResponse cancelSubscription( final String subscriptionId, - final UpdateSubscriptionMinimumPriceRequest request, + final CreateCancelSubscriptionRequest request, final String idempotencyKey) throws ApiException, IOException { - return prepareUpdateSubscriptionMiniumPriceRequest(subscriptionId, request, - idempotencyKey).execute(); + return prepareCancelSubscriptionRequest(subscriptionId, request, idempotencyKey).execute(); } /** - * Builds the ApiCall object for updateSubscriptionMiniumPrice. + * Builds the ApiCall object for cancelSubscription. */ - private ApiCall prepareUpdateSubscriptionMiniumPriceRequest( + private ApiCall prepareCancelSubscriptionRequest( final String subscriptionId, - final UpdateSubscriptionMinimumPriceRequest request, + final CreateCancelSubscriptionRequest request, final String idempotencyKey) throws JsonProcessingException, IOException { return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/subscriptions/{subscription_id}/minimum_price") - .bodyParam(param -> param.value(request)) + .path("/subscriptions/{subscription_id}") + .bodyParam(param -> param.value(request).isRequired(false)) .bodySerializer(() -> ApiHelper.serialize(request)) .templateParam(param -> param.key("subscription_id").value(subscriptionId) .shouldEncode(true)) @@ -679,7 +682,7 @@ private ApiCall prepareUpdateSubscription .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) - .httpMethod(HttpMethod.PATCH)) + .httpMethod(HttpMethod.DELETE)) .responseHandler(responseHandler -> responseHandler .deserializer( response -> ApiHelper.deserialize(response, GetSubscriptionResponse.class)) @@ -689,249 +692,254 @@ private ApiCall prepareUpdateSubscription } /** - * @param subscriptionId Required parameter: The subscription id - * @param cycleId Required parameter: Example: - * @return Returns the GetPeriodResponse response from the API call + * Creates a increment. + * @param subscriptionId Required parameter: Subscription id + * @param request Required parameter: Request for creating a increment + * @param idempotencyKey Optional parameter: Example: + * @return Returns the GetIncrementResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetPeriodResponse getSubscriptionCycleById( + public GetIncrementResponse createIncrement( final String subscriptionId, - final String cycleId) throws ApiException, IOException { - return prepareGetSubscriptionCycleByIdRequest(subscriptionId, cycleId).execute(); + final CreateIncrementRequest request, + final String idempotencyKey) throws ApiException, IOException { + return prepareCreateIncrementRequest(subscriptionId, request, idempotencyKey).execute(); } /** - * Builds the ApiCall object for getSubscriptionCycleById. + * Builds the ApiCall object for createIncrement. */ - private ApiCall prepareGetSubscriptionCycleByIdRequest( + private ApiCall prepareCreateIncrementRequest( final String subscriptionId, - final String cycleId) throws IOException { - return new ApiCall.Builder() + final CreateIncrementRequest request, + final String idempotencyKey) throws JsonProcessingException, IOException { + return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/subscriptions/{subscription_id}/cycles/{cycleId}") + .path("/subscriptions/{subscription_id}/increments") + .bodyParam(param -> param.value(request)) + .bodySerializer(() -> ApiHelper.serialize(request)) .templateParam(param -> param.key("subscription_id").value(subscriptionId) .shouldEncode(true)) - .templateParam(param -> param.key("cycleId").value(cycleId) - .shouldEncode(true)) + .headerParam(param -> param.key("idempotency-key") + .value(idempotencyKey).isRequired(false)) + .headerParam(param ->param.key("content-type").value("application/json")) .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) - .httpMethod(HttpMethod.GET)) + .httpMethod(HttpMethod.POST)) .responseHandler(responseHandler -> responseHandler .deserializer( - response -> ApiHelper.deserialize(response, GetPeriodResponse.class)) + response -> ApiHelper.deserialize(response, GetIncrementResponse.class)) .nullify404(false) .globalErrorCase(GLOBAL_ERROR_CASES)) .build(); } /** - * @param subscriptionId Required parameter: The subscription Id - * @param periodId Required parameter: The period Id - * @return Returns the GetUsageReportResponse response from the API call + * Creates a usage. + * @param subscriptionId Required parameter: Subscription Id + * @param itemId Required parameter: Item id + * @param body Required parameter: Request for creating a usage + * @param idempotencyKey Optional parameter: Example: + * @return Returns the GetUsageResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetUsageReportResponse getUsageReport( + public GetUsageResponse createUsage( final String subscriptionId, - final String periodId) throws ApiException, IOException { - return prepareGetUsageReportRequest(subscriptionId, periodId).execute(); + final String itemId, + final CreateUsageRequest body, + final String idempotencyKey) throws ApiException, IOException { + return prepareCreateUsageRequest(subscriptionId, itemId, body, idempotencyKey).execute(); } /** - * Builds the ApiCall object for getUsageReport. + * Builds the ApiCall object for createUsage. */ - private ApiCall prepareGetUsageReportRequest( + private ApiCall prepareCreateUsageRequest( final String subscriptionId, - final String periodId) throws IOException { - return new ApiCall.Builder() + final String itemId, + final CreateUsageRequest body, + final String idempotencyKey) throws JsonProcessingException, IOException { + return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/subscriptions/{subscription_id}/periods/{period_id}/usages/report") + .path("/subscriptions/{subscription_id}/items/{item_id}/usages") + .bodyParam(param -> param.value(body)) + .bodySerializer(() -> ApiHelper.serialize(body)) .templateParam(param -> param.key("subscription_id").value(subscriptionId) .shouldEncode(true)) - .templateParam(param -> param.key("period_id").value(periodId) + .templateParam(param -> param.key("item_id").value(itemId) .shouldEncode(true)) + .headerParam(param -> param.key("idempotency-key") + .value(idempotencyKey).isRequired(false)) + .headerParam(param ->param.key("content-type").value("application/json")) .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) - .httpMethod(HttpMethod.GET)) + .httpMethod(HttpMethod.POST)) .responseHandler(responseHandler -> responseHandler .deserializer( - response -> ApiHelper.deserialize(response, GetUsageReportResponse.class)) + response -> ApiHelper.deserialize(response, GetUsageResponse.class)) .nullify404(false) .globalErrorCase(GLOBAL_ERROR_CASES)) .build(); } /** - * @param subscriptionId Required parameter: Example: - * @param idempotencyKey Optional parameter: Example: - * @return Returns the GetPeriodResponse response from the API call + * @param subscriptionId Required parameter: The subscription id + * @param discountId Required parameter: Example: + * @return Returns the GetDiscountResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetPeriodResponse renewSubscription( + public GetDiscountResponse getDiscountById( final String subscriptionId, - final String idempotencyKey) throws ApiException, IOException { - return prepareRenewSubscriptionRequest(subscriptionId, idempotencyKey).execute(); + final String discountId) throws ApiException, IOException { + return prepareGetDiscountByIdRequest(subscriptionId, discountId).execute(); } /** - * Builds the ApiCall object for renewSubscription. + * Builds the ApiCall object for getDiscountById. */ - private ApiCall prepareRenewSubscriptionRequest( + private ApiCall prepareGetDiscountByIdRequest( final String subscriptionId, - final String idempotencyKey) throws IOException { - return new ApiCall.Builder() + final String discountId) throws IOException { + return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/subscriptions/{subscription_id}/cycles") + .path("/subscriptions/{subscription_id}/discounts/{discountId}") .templateParam(param -> param.key("subscription_id").value(subscriptionId) .shouldEncode(true)) - .headerParam(param -> param.key("idempotency-key") - .value(idempotencyKey).isRequired(false)) + .templateParam(param -> param.key("discountId").value(discountId) + .shouldEncode(true)) .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) - .httpMethod(HttpMethod.POST)) + .httpMethod(HttpMethod.GET)) .responseHandler(responseHandler -> responseHandler .deserializer( - response -> ApiHelper.deserialize(response, GetPeriodResponse.class)) + response -> ApiHelper.deserialize(response, GetDiscountResponse.class)) .nullify404(false) .globalErrorCase(GLOBAL_ERROR_CASES)) .build(); } /** - * Deletes a usage. - * @param subscriptionId Required parameter: The subscription id - * @param itemId Required parameter: The subscription item id - * @param usageId Required parameter: The usage id + * Creates a new subscription. + * @param body Required parameter: Request for creating a subscription * @param idempotencyKey Optional parameter: Example: - * @return Returns the GetUsageResponse response from the API call + * @return Returns the GetSubscriptionResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetUsageResponse deleteUsage( - final String subscriptionId, - final String itemId, - final String usageId, + public GetSubscriptionResponse createSubscription( + final CreateSubscriptionRequest body, final String idempotencyKey) throws ApiException, IOException { - return prepareDeleteUsageRequest(subscriptionId, itemId, usageId, idempotencyKey).execute(); + return prepareCreateSubscriptionRequest(body, idempotencyKey).execute(); } /** - * Builds the ApiCall object for deleteUsage. + * Builds the ApiCall object for createSubscription. */ - private ApiCall prepareDeleteUsageRequest( - final String subscriptionId, - final String itemId, - final String usageId, - final String idempotencyKey) throws IOException { - return new ApiCall.Builder() + private ApiCall prepareCreateSubscriptionRequest( + final CreateSubscriptionRequest body, + final String idempotencyKey) throws JsonProcessingException, IOException { + return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/subscriptions/{subscription_id}/items/{item_id}/usages/{usage_id}") - .templateParam(param -> param.key("subscription_id").value(subscriptionId) - .shouldEncode(true)) - .templateParam(param -> param.key("item_id").value(itemId) - .shouldEncode(true)) - .templateParam(param -> param.key("usage_id").value(usageId) - .shouldEncode(true)) + .path("/subscriptions") + .bodyParam(param -> param.value(body)) + .bodySerializer(() -> ApiHelper.serialize(body)) .headerParam(param -> param.key("idempotency-key") .value(idempotencyKey).isRequired(false)) + .headerParam(param ->param.key("content-type").value("application/json")) .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) - .httpMethod(HttpMethod.DELETE)) + .httpMethod(HttpMethod.POST)) .responseHandler(responseHandler -> responseHandler .deserializer( - response -> ApiHelper.deserialize(response, GetUsageResponse.class)) + response -> ApiHelper.deserialize(response, GetSubscriptionResponse.class)) .nullify404(false) .globalErrorCase(GLOBAL_ERROR_CASES)) .build(); } /** - * Create Usage. - * @param subscriptionId Required parameter: Subscription id - * @param itemId Required parameter: Item id - * @param idempotencyKey Optional parameter: Example: - * @return Returns the GetUsageResponse response from the API call + * @param subscriptionId Required parameter: The subscription Id + * @param incrementId Required parameter: The increment Id + * @return Returns the GetIncrementResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetUsageResponse createAnUsage( + public GetIncrementResponse getIncrementById( final String subscriptionId, - final String itemId, - final String idempotencyKey) throws ApiException, IOException { - return prepareCreateAnUsageRequest(subscriptionId, itemId, idempotencyKey).execute(); + final String incrementId) throws ApiException, IOException { + return prepareGetIncrementByIdRequest(subscriptionId, incrementId).execute(); } /** - * Builds the ApiCall object for createAnUsage. + * Builds the ApiCall object for getIncrementById. */ - private ApiCall prepareCreateAnUsageRequest( + private ApiCall prepareGetIncrementByIdRequest( final String subscriptionId, - final String itemId, - final String idempotencyKey) throws IOException { - return new ApiCall.Builder() + final String incrementId) throws IOException { + return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/subscriptions/{subscription_id}/items/{item_id}/usages") + .path("/subscriptions/{subscription_id}/increments/{increment_id}") .templateParam(param -> param.key("subscription_id").value(subscriptionId) .shouldEncode(true)) - .templateParam(param -> param.key("item_id").value(itemId) + .templateParam(param -> param.key("increment_id").value(incrementId) .shouldEncode(true)) - .headerParam(param -> param.key("idempotency-key") - .value(idempotencyKey).isRequired(false)) .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) - .httpMethod(HttpMethod.POST)) + .httpMethod(HttpMethod.GET)) .responseHandler(responseHandler -> responseHandler .deserializer( - response -> ApiHelper.deserialize(response, GetUsageResponse.class)) + response -> ApiHelper.deserialize(response, GetIncrementResponse.class)) .nullify404(false) .globalErrorCase(GLOBAL_ERROR_CASES)) .build(); } /** - * @param subscriptionId Required parameter: Subscription Id - * @param request Required parameter: Request for updating the end date of the subscription - * current status + * @param subscriptionId Required parameter: Example: + * @param request Required parameter: Request for updating a subscription affiliation id * @param idempotencyKey Optional parameter: Example: + * @return Returns the GetSubscriptionResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public void updateCurrentCycleStatus( + public GetSubscriptionResponse updateSubscriptionAffiliationId( final String subscriptionId, - final UpdateCurrentCycleStatusRequest request, + final UpdateSubscriptionAffiliationIdRequest request, final String idempotencyKey) throws ApiException, IOException { - prepareUpdateCurrentCycleStatusRequest(subscriptionId, request, idempotencyKey).execute(); + return prepareUpdateSubscriptionAffiliationIdRequest(subscriptionId, request, + idempotencyKey).execute(); } /** - * Builds the ApiCall object for updateCurrentCycleStatus. + * Builds the ApiCall object for updateSubscriptionAffiliationId. */ - private ApiCall prepareUpdateCurrentCycleStatusRequest( + private ApiCall prepareUpdateSubscriptionAffiliationIdRequest( final String subscriptionId, - final UpdateCurrentCycleStatusRequest request, + final UpdateSubscriptionAffiliationIdRequest request, final String idempotencyKey) throws JsonProcessingException, IOException { - return new ApiCall.Builder() + return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/subscriptions/{subscription_id}/cycle-status") + .path("/subscriptions/{subscription_id}/gateway-affiliation-id") .bodyParam(param -> param.value(request)) .bodySerializer(() -> ApiHelper.serialize(request)) .templateParam(param -> param.key("subscription_id").value(subscriptionId) @@ -939,75 +947,89 @@ private ApiCall prepareUpdateCurrentCycleStatusRequest( .headerParam(param -> param.key("idempotency-key") .value(idempotencyKey).isRequired(false)) .headerParam(param ->param.key("content-type").value("application/json")) + .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) .httpMethod(HttpMethod.PATCH)) .responseHandler(responseHandler -> responseHandler + .deserializer( + response -> ApiHelper.deserialize(response, GetSubscriptionResponse.class)) .nullify404(false) .globalErrorCase(GLOBAL_ERROR_CASES)) .build(); } /** - * Get Subscription Item. - * @param subscriptionId Required parameter: Subscription Id - * @param itemId Required parameter: Item id - * @return Returns the GetSubscriptionItemResponse response from the API call + * Updates the metadata from a subscription. + * @param subscriptionId Required parameter: The subscription id + * @param request Required parameter: Request for updating the subscrption metadata + * @param idempotencyKey Optional parameter: Example: + * @return Returns the GetSubscriptionResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetSubscriptionItemResponse getSubscriptionItem( + public GetSubscriptionResponse updateSubscriptionMetadata( final String subscriptionId, - final String itemId) throws ApiException, IOException { - return prepareGetSubscriptionItemRequest(subscriptionId, itemId).execute(); + final UpdateMetadataRequest request, + final String idempotencyKey) throws ApiException, IOException { + return prepareUpdateSubscriptionMetadataRequest(subscriptionId, request, + idempotencyKey).execute(); } /** - * Builds the ApiCall object for getSubscriptionItem. + * Builds the ApiCall object for updateSubscriptionMetadata. */ - private ApiCall prepareGetSubscriptionItemRequest( + private ApiCall prepareUpdateSubscriptionMetadataRequest( final String subscriptionId, - final String itemId) throws IOException { - return new ApiCall.Builder() + final UpdateMetadataRequest request, + final String idempotencyKey) throws JsonProcessingException, IOException { + return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/subscriptions/{subscription_id}/items/{item_id}") + .path("/Subscriptions/{subscription_id}/metadata") + .bodyParam(param -> param.value(request)) + .bodySerializer(() -> ApiHelper.serialize(request)) .templateParam(param -> param.key("subscription_id").value(subscriptionId) .shouldEncode(true)) - .templateParam(param -> param.key("item_id").value(itemId) - .shouldEncode(true)) + .headerParam(param -> param.key("idempotency-key") + .value(idempotencyKey).isRequired(false)) + .headerParam(param ->param.key("content-type").value("application/json")) .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) - .httpMethod(HttpMethod.GET)) + .httpMethod(HttpMethod.PATCH)) .responseHandler(responseHandler -> responseHandler .deserializer( - response -> ApiHelper.deserialize(response, GetSubscriptionItemResponse.class)) + response -> ApiHelper.deserialize(response, GetSubscriptionResponse.class)) .nullify404(false) .globalErrorCase(GLOBAL_ERROR_CASES)) .build(); } /** - * @param subscriptionId Required parameter: The subscription Id - * @param incrementId Required parameter: The increment Id + * Deletes a increment. + * @param subscriptionId Required parameter: Subscription id + * @param incrementId Required parameter: Increment id + * @param idempotencyKey Optional parameter: Example: * @return Returns the GetIncrementResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetIncrementResponse getIncrementById( + public GetIncrementResponse deleteIncrement( final String subscriptionId, - final String incrementId) throws ApiException, IOException { - return prepareGetIncrementByIdRequest(subscriptionId, incrementId).execute(); + final String incrementId, + final String idempotencyKey) throws ApiException, IOException { + return prepareDeleteIncrementRequest(subscriptionId, incrementId, idempotencyKey).execute(); } /** - * Builds the ApiCall object for getIncrementById. + * Builds the ApiCall object for deleteIncrement. */ - private ApiCall prepareGetIncrementByIdRequest( + private ApiCall prepareDeleteIncrementRequest( final String subscriptionId, - final String incrementId) throws IOException { + final String incrementId, + final String idempotencyKey) throws IOException { return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder @@ -1017,10 +1039,12 @@ private ApiCall prepareGetIncrementByIdReque .shouldEncode(true)) .templateParam(param -> param.key("increment_id").value(incrementId) .shouldEncode(true)) + .headerParam(param -> param.key("idempotency-key") + .value(idempotencyKey).isRequired(false)) .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) - .httpMethod(HttpMethod.GET)) + .httpMethod(HttpMethod.DELETE)) .responseHandler(responseHandler -> responseHandler .deserializer( response -> ApiHelper.deserialize(response, GetIncrementResponse.class)) @@ -1030,46 +1054,45 @@ private ApiCall prepareGetIncrementByIdReque } /** - * Deletes a increment. - * @param subscriptionId Required parameter: Subscription id - * @param incrementId Required parameter: Increment id - * @param idempotencyKey Optional parameter: Example: - * @return Returns the GetIncrementResponse response from the API call + * @param subscriptionId Required parameter: Subscription Id + * @param page Required parameter: Page number + * @param size Required parameter: Page size + * @return Returns the ListCyclesResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetIncrementResponse deleteIncrement( + public ListCyclesResponse getSubscriptionCycles( final String subscriptionId, - final String incrementId, - final String idempotencyKey) throws ApiException, IOException { - return prepareDeleteIncrementRequest(subscriptionId, incrementId, idempotencyKey).execute(); + final String page, + final String size) throws ApiException, IOException { + return prepareGetSubscriptionCyclesRequest(subscriptionId, page, size).execute(); } /** - * Builds the ApiCall object for deleteIncrement. + * Builds the ApiCall object for getSubscriptionCycles. */ - private ApiCall prepareDeleteIncrementRequest( + private ApiCall prepareGetSubscriptionCyclesRequest( final String subscriptionId, - final String incrementId, - final String idempotencyKey) throws IOException { - return new ApiCall.Builder() + final String page, + final String size) throws IOException { + return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/subscriptions/{subscription_id}/increments/{increment_id}") + .path("/subscriptions/{subscription_id}/cycles") + .queryParam(param -> param.key("page") + .value(page)) + .queryParam(param -> param.key("size") + .value(size)) .templateParam(param -> param.key("subscription_id").value(subscriptionId) .shouldEncode(true)) - .templateParam(param -> param.key("increment_id").value(incrementId) - .shouldEncode(true)) - .headerParam(param -> param.key("idempotency-key") - .value(idempotencyKey).isRequired(false)) .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) - .httpMethod(HttpMethod.DELETE)) + .httpMethod(HttpMethod.GET)) .responseHandler(responseHandler -> responseHandler .deserializer( - response -> ApiHelper.deserialize(response, GetIncrementResponse.class)) + response -> ApiHelper.deserialize(response, ListCyclesResponse.class)) .nullify404(false) .globalErrorCase(GLOBAL_ERROR_CASES)) .build(); @@ -1121,34 +1144,34 @@ private ApiCall prepareGetDiscountsRequest( } /** - * Updates the boleto due days from a subscription. - * @param subscriptionId Required parameter: Subscription Id - * @param request Required parameter: Example: + * Updates the billing date from a subscription. + * @param subscriptionId Required parameter: The subscription id + * @param request Required parameter: Request for updating the subscription billing date * @param idempotencyKey Optional parameter: Example: * @return Returns the GetSubscriptionResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetSubscriptionResponse updateSubscriptionDueDays( + public GetSubscriptionResponse updateSubscriptionBillingDate( final String subscriptionId, - final UpdateSubscriptionDueDaysRequest request, + final UpdateSubscriptionBillingDateRequest request, final String idempotencyKey) throws ApiException, IOException { - return prepareUpdateSubscriptionDueDaysRequest(subscriptionId, request, + return prepareUpdateSubscriptionBillingDateRequest(subscriptionId, request, idempotencyKey).execute(); } /** - * Builds the ApiCall object for updateSubscriptionDueDays. + * Builds the ApiCall object for updateSubscriptionBillingDate. */ - private ApiCall prepareUpdateSubscriptionDueDaysRequest( + private ApiCall prepareUpdateSubscriptionBillingDateRequest( final String subscriptionId, - final UpdateSubscriptionDueDaysRequest request, + final UpdateSubscriptionBillingDateRequest request, final String idempotencyKey) throws JsonProcessingException, IOException { return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/subscriptions/{subscription_id}/boleto-due-days") + .path("/subscriptions/{subscription_id}/billing-date") .bodyParam(param -> param.value(request)) .bodySerializer(() -> ApiHelper.serialize(request)) .templateParam(param -> param.key("subscription_id").value(subscriptionId) @@ -1169,81 +1192,132 @@ private ApiCall prepareUpdateSubscription } /** - * Creates a new Subscription item. + * Deletes a subscription item. * @param subscriptionId Required parameter: Subscription id - * @param request Required parameter: Request for creating a subscription item + * @param subscriptionItemId Required parameter: Subscription item id * @param idempotencyKey Optional parameter: Example: * @return Returns the GetSubscriptionItemResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetSubscriptionItemResponse createSubscriptionItem( + public GetSubscriptionItemResponse deleteSubscriptionItem( final String subscriptionId, - final CreateSubscriptionItemRequest request, + final String subscriptionItemId, final String idempotencyKey) throws ApiException, IOException { - return prepareCreateSubscriptionItemRequest(subscriptionId, request, + return prepareDeleteSubscriptionItemRequest(subscriptionId, subscriptionItemId, idempotencyKey).execute(); } /** - * Builds the ApiCall object for createSubscriptionItem. + * Builds the ApiCall object for deleteSubscriptionItem. */ - private ApiCall prepareCreateSubscriptionItemRequest( + private ApiCall prepareDeleteSubscriptionItemRequest( final String subscriptionId, - final CreateSubscriptionItemRequest request, - final String idempotencyKey) throws JsonProcessingException, IOException { + final String subscriptionItemId, + final String idempotencyKey) throws IOException { return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/subscriptions/{subscription_id}/items") - .bodyParam(param -> param.value(request)) - .bodySerializer(() -> ApiHelper.serialize(request)) + .path("/subscriptions/{subscription_id}/items/{subscription_item_id}") .templateParam(param -> param.key("subscription_id").value(subscriptionId) .shouldEncode(true)) + .templateParam(param -> param.key("subscription_item_id").value(subscriptionItemId) + .shouldEncode(true)) .headerParam(param -> param.key("idempotency-key") .value(idempotencyKey).isRequired(false)) - .headerParam(param ->param.key("content-type").value("application/json")) .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) - .httpMethod(HttpMethod.POST)) + .httpMethod(HttpMethod.DELETE)) + .responseHandler(responseHandler -> responseHandler + .deserializer( + response -> ApiHelper.deserialize(response, GetSubscriptionItemResponse.class)) + .nullify404(false) + .globalErrorCase(GLOBAL_ERROR_CASES)) + .build(); + } + + /** + * @param subscriptionId Required parameter: The subscription id + * @param page Optional parameter: Page number + * @param size Optional parameter: Page size + * @return Returns the ListIncrementsResponse response from the API call + * @throws ApiException Represents error response from the server. + * @throws IOException Signals that an I/O exception of some sort has occurred. + */ + public ListIncrementsResponse getIncrements( + final String subscriptionId, + final Integer page, + final Integer size) throws ApiException, IOException { + return prepareGetIncrementsRequest(subscriptionId, page, size).execute(); + } + + /** + * Builds the ApiCall object for getIncrements. + */ + private ApiCall prepareGetIncrementsRequest( + final String subscriptionId, + final Integer page, + final Integer size) throws IOException { + return new ApiCall.Builder() + .globalConfig(getGlobalConfiguration()) + .requestBuilder(requestBuilder -> requestBuilder + .server(Server.ENUM_DEFAULT.value()) + .path("/subscriptions/{subscription_id}/increments/") + .queryParam(param -> param.key("page") + .value(page).isRequired(false)) + .queryParam(param -> param.key("size") + .value(size).isRequired(false)) + .templateParam(param -> param.key("subscription_id").value(subscriptionId) + .shouldEncode(true)) + .headerParam(param -> param.key("accept").value("application/json")) + .withAuth(auth -> auth + .add("httpBasic")) + .httpMethod(HttpMethod.GET)) .responseHandler(responseHandler -> responseHandler .deserializer( - response -> ApiHelper.deserialize(response, GetSubscriptionItemResponse.class)) + response -> ApiHelper.deserialize(response, ListIncrementsResponse.class)) .nullify404(false) .globalErrorCase(GLOBAL_ERROR_CASES)) .build(); } /** - * @param id Required parameter: Subscription's id + * Updates the boleto due days from a subscription. + * @param subscriptionId Required parameter: Subscription Id * @param request Required parameter: Example: + * @param idempotencyKey Optional parameter: Example: * @return Returns the GetSubscriptionResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetSubscriptionResponse updateSplitSubscription( - final String id, - final UpdateSubscriptionSplitRequest request) throws ApiException, IOException { - return prepareUpdateSplitSubscriptionRequest(id, request).execute(); + public GetSubscriptionResponse updateSubscriptionDueDays( + final String subscriptionId, + final UpdateSubscriptionDueDaysRequest request, + final String idempotencyKey) throws ApiException, IOException { + return prepareUpdateSubscriptionDueDaysRequest(subscriptionId, request, + idempotencyKey).execute(); } /** - * Builds the ApiCall object for updateSplitSubscription. + * Builds the ApiCall object for updateSubscriptionDueDays. */ - private ApiCall prepareUpdateSplitSubscriptionRequest( - final String id, - final UpdateSubscriptionSplitRequest request) throws JsonProcessingException, IOException { + private ApiCall prepareUpdateSubscriptionDueDaysRequest( + final String subscriptionId, + final UpdateSubscriptionDueDaysRequest request, + final String idempotencyKey) throws JsonProcessingException, IOException { return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/subscriptions/{id}/split") + .path("/subscriptions/{subscription_id}/boleto-due-days") .bodyParam(param -> param.value(request)) .bodySerializer(() -> ApiHelper.serialize(request)) - .templateParam(param -> param.key("id").value(id) + .templateParam(param -> param.key("subscription_id").value(subscriptionId) .shouldEncode(true)) + .headerParam(param -> param.key("idempotency-key") + .value(idempotencyKey).isRequired(false)) .headerParam(param ->param.key("content-type").value("application/json")) .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth @@ -1258,205 +1332,135 @@ private ApiCall prepareUpdateSplitSubscri } /** - * Get Subscription Items. + * Updates the start at date from a subscription. * @param subscriptionId Required parameter: The subscription id - * @param page Optional parameter: Page number - * @param size Optional parameter: Page size - * @param name Optional parameter: The item name - * @param code Optional parameter: Identification code in the client system - * @param status Optional parameter: The item statis - * @param description Optional parameter: The item description - * @param createdSince Optional parameter: Filter for item's creation date start range - * @param createdUntil Optional parameter: Filter for item's creation date end range - * @return Returns the ListSubscriptionItemsResponse response from the API call + * @param request Required parameter: Request for updating the subscription start date + * @param idempotencyKey Optional parameter: Example: + * @return Returns the GetSubscriptionResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public ListSubscriptionItemsResponse getSubscriptionItems( + public GetSubscriptionResponse updateSubscriptionStartAt( final String subscriptionId, - final Integer page, - final Integer size, - final String name, - final String code, - final String status, - final String description, - final String createdSince, - final String createdUntil) throws ApiException, IOException { - return prepareGetSubscriptionItemsRequest(subscriptionId, page, size, name, code, status, - description, createdSince, createdUntil).execute(); + final UpdateSubscriptionStartAtRequest request, + final String idempotencyKey) throws ApiException, IOException { + return prepareUpdateSubscriptionStartAtRequest(subscriptionId, request, + idempotencyKey).execute(); } /** - * Builds the ApiCall object for getSubscriptionItems. + * Builds the ApiCall object for updateSubscriptionStartAt. */ - private ApiCall prepareGetSubscriptionItemsRequest( + private ApiCall prepareUpdateSubscriptionStartAtRequest( final String subscriptionId, - final Integer page, - final Integer size, - final String name, - final String code, - final String status, - final String description, - final String createdSince, - final String createdUntil) throws IOException { - return new ApiCall.Builder() + final UpdateSubscriptionStartAtRequest request, + final String idempotencyKey) throws JsonProcessingException, IOException { + return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/subscriptions/{subscription_id}/items") - .queryParam(param -> param.key("page") - .value(page).isRequired(false)) - .queryParam(param -> param.key("size") - .value(size).isRequired(false)) - .queryParam(param -> param.key("name") - .value(name).isRequired(false)) - .queryParam(param -> param.key("code") - .value(code).isRequired(false)) - .queryParam(param -> param.key("status") - .value(status).isRequired(false)) - .queryParam(param -> param.key("description") - .value(description).isRequired(false)) - .queryParam(param -> param.key("created_since") - .value(createdSince).isRequired(false)) - .queryParam(param -> param.key("created_until") - .value(createdUntil).isRequired(false)) + .path("/subscriptions/{subscription_id}/start-at") + .bodyParam(param -> param.value(request)) + .bodySerializer(() -> ApiHelper.serialize(request)) .templateParam(param -> param.key("subscription_id").value(subscriptionId) .shouldEncode(true)) + .headerParam(param -> param.key("idempotency-key") + .value(idempotencyKey).isRequired(false)) + .headerParam(param ->param.key("content-type").value("application/json")) .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) - .httpMethod(HttpMethod.GET)) + .httpMethod(HttpMethod.PATCH)) .responseHandler(responseHandler -> responseHandler .deserializer( - response -> ApiHelper.deserialize(response, ListSubscriptionItemsResponse.class)) + response -> ApiHelper.deserialize(response, GetSubscriptionResponse.class)) .nullify404(false) .globalErrorCase(GLOBAL_ERROR_CASES)) .build(); } /** - * Gets all subscriptions. - * @param page Optional parameter: Page number - * @param size Optional parameter: Page size - * @param code Optional parameter: Filter for subscription's code - * @param billingType Optional parameter: Filter for subscription's billing type - * @param customerId Optional parameter: Filter for subscription's customer id - * @param planId Optional parameter: Filter for subscription's plan id - * @param cardId Optional parameter: Filter for subscription's card id - * @param status Optional parameter: Filter for subscription's status - * @param nextBillingSince Optional parameter: Filter for subscription's next billing date - * start range - * @param nextBillingUntil Optional parameter: Filter for subscription's next billing date end - * range - * @param createdSince Optional parameter: Filter for subscription's creation date start range - * @param createdUntil Optional parameter: Filter for subscriptions creation date end range - * @return Returns the ListSubscriptionsResponse response from the API call + * Updates a subscription item. + * @param subscriptionId Required parameter: Subscription Id + * @param itemId Required parameter: Item id + * @param body Required parameter: Request for updating a subscription item + * @param idempotencyKey Optional parameter: Example: + * @return Returns the GetSubscriptionItemResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public ListSubscriptionsResponse getSubscriptions( - final Integer page, - final Integer size, - final String code, - final String billingType, - final String customerId, - final String planId, - final String cardId, - final String status, - final LocalDateTime nextBillingSince, - final LocalDateTime nextBillingUntil, - final LocalDateTime createdSince, - final LocalDateTime createdUntil) throws ApiException, IOException { - return prepareGetSubscriptionsRequest(page, size, code, billingType, customerId, planId, - cardId, status, nextBillingSince, nextBillingUntil, createdSince, - createdUntil).execute(); + public GetSubscriptionItemResponse updateSubscriptionItem( + final String subscriptionId, + final String itemId, + final UpdateSubscriptionItemRequest body, + final String idempotencyKey) throws ApiException, IOException { + return prepareUpdateSubscriptionItemRequest(subscriptionId, itemId, body, + idempotencyKey).execute(); } /** - * Builds the ApiCall object for getSubscriptions. + * Builds the ApiCall object for updateSubscriptionItem. */ - private ApiCall prepareGetSubscriptionsRequest( - final Integer page, - final Integer size, - final String code, - final String billingType, - final String customerId, - final String planId, - final String cardId, - final String status, - final LocalDateTime nextBillingSince, - final LocalDateTime nextBillingUntil, - final LocalDateTime createdSince, - final LocalDateTime createdUntil) throws IOException { - return new ApiCall.Builder() + private ApiCall prepareUpdateSubscriptionItemRequest( + final String subscriptionId, + final String itemId, + final UpdateSubscriptionItemRequest body, + final String idempotencyKey) throws JsonProcessingException, IOException { + return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/subscriptions") - .queryParam(param -> param.key("page") - .value(page).isRequired(false)) - .queryParam(param -> param.key("size") - .value(size).isRequired(false)) - .queryParam(param -> param.key("code") - .value(code).isRequired(false)) - .queryParam(param -> param.key("billing_type") - .value(billingType).isRequired(false)) - .queryParam(param -> param.key("customer_id") - .value(customerId).isRequired(false)) - .queryParam(param -> param.key("plan_id") - .value(planId).isRequired(false)) - .queryParam(param -> param.key("card_id") - .value(cardId).isRequired(false)) - .queryParam(param -> param.key("status") - .value(status).isRequired(false)) - .queryParam(param -> param.key("next_billing_since") - .value(DateTimeHelper.toRfc8601DateTime(nextBillingSince)).isRequired(false)) - .queryParam(param -> param.key("next_billing_until") - .value(DateTimeHelper.toRfc8601DateTime(nextBillingUntil)).isRequired(false)) - .queryParam(param -> param.key("created_since") - .value(DateTimeHelper.toRfc8601DateTime(createdSince)).isRequired(false)) - .queryParam(param -> param.key("created_until") - .value(DateTimeHelper.toRfc8601DateTime(createdUntil)).isRequired(false)) + .path("/subscriptions/{subscription_id}/items/{item_id}") + .bodyParam(param -> param.value(body)) + .bodySerializer(() -> ApiHelper.serialize(body)) + .templateParam(param -> param.key("subscription_id").value(subscriptionId) + .shouldEncode(true)) + .templateParam(param -> param.key("item_id").value(itemId) + .shouldEncode(true)) + .headerParam(param -> param.key("idempotency-key") + .value(idempotencyKey).isRequired(false)) + .headerParam(param ->param.key("content-type").value("application/json")) .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) - .httpMethod(HttpMethod.GET)) + .httpMethod(HttpMethod.PUT)) .responseHandler(responseHandler -> responseHandler .deserializer( - response -> ApiHelper.deserialize(response, ListSubscriptionsResponse.class)) + response -> ApiHelper.deserialize(response, GetSubscriptionItemResponse.class)) .nullify404(false) .globalErrorCase(GLOBAL_ERROR_CASES)) .build(); } /** - * Creates a increment. + * Creates a new Subscription item. * @param subscriptionId Required parameter: Subscription id - * @param request Required parameter: Request for creating a increment + * @param request Required parameter: Request for creating a subscription item * @param idempotencyKey Optional parameter: Example: - * @return Returns the GetIncrementResponse response from the API call + * @return Returns the GetSubscriptionItemResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetIncrementResponse createIncrement( + public GetSubscriptionItemResponse createSubscriptionItem( final String subscriptionId, - final CreateIncrementRequest request, + final CreateSubscriptionItemRequest request, final String idempotencyKey) throws ApiException, IOException { - return prepareCreateIncrementRequest(subscriptionId, request, idempotencyKey).execute(); + return prepareCreateSubscriptionItemRequest(subscriptionId, request, + idempotencyKey).execute(); } /** - * Builds the ApiCall object for createIncrement. + * Builds the ApiCall object for createSubscriptionItem. */ - private ApiCall prepareCreateIncrementRequest( + private ApiCall prepareCreateSubscriptionItemRequest( final String subscriptionId, - final CreateIncrementRequest request, + final CreateSubscriptionItemRequest request, final String idempotencyKey) throws JsonProcessingException, IOException { - return new ApiCall.Builder() + return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/subscriptions/{subscription_id}/increments") + .path("/subscriptions/{subscription_id}/items") .bodyParam(param -> param.value(request)) .bodySerializer(() -> ApiHelper.serialize(request)) .templateParam(param -> param.key("subscription_id").value(subscriptionId) @@ -1470,91 +1474,107 @@ private ApiCall prepareCreateIncrementReques .httpMethod(HttpMethod.POST)) .responseHandler(responseHandler -> responseHandler .deserializer( - response -> ApiHelper.deserialize(response, GetIncrementResponse.class)) + response -> ApiHelper.deserialize(response, GetSubscriptionItemResponse.class)) .nullify404(false) .globalErrorCase(GLOBAL_ERROR_CASES)) .build(); } /** - * Creates a usage. - * @param subscriptionId Required parameter: Subscription Id - * @param itemId Required parameter: Item id - * @param body Required parameter: Request for creating a usage - * @param idempotencyKey Optional parameter: Example: - * @return Returns the GetUsageResponse response from the API call + * Gets a subscription. + * @param subscriptionId Required parameter: Subscription id + * @return Returns the GetSubscriptionResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetUsageResponse createUsage( - final String subscriptionId, - final String itemId, - final CreateUsageRequest body, - final String idempotencyKey) throws ApiException, IOException { - return prepareCreateUsageRequest(subscriptionId, itemId, body, idempotencyKey).execute(); + public GetSubscriptionResponse getSubscription( + final String subscriptionId) throws ApiException, IOException { + return prepareGetSubscriptionRequest(subscriptionId).execute(); } /** - * Builds the ApiCall object for createUsage. + * Builds the ApiCall object for getSubscription. */ - private ApiCall prepareCreateUsageRequest( - final String subscriptionId, - final String itemId, - final CreateUsageRequest body, - final String idempotencyKey) throws JsonProcessingException, IOException { - return new ApiCall.Builder() + private ApiCall prepareGetSubscriptionRequest( + final String subscriptionId) throws IOException { + return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/subscriptions/{subscription_id}/items/{item_id}/usages") - .bodyParam(param -> param.value(body)) - .bodySerializer(() -> ApiHelper.serialize(body)) + .path("/subscriptions/{subscription_id}") .templateParam(param -> param.key("subscription_id").value(subscriptionId) .shouldEncode(true)) - .templateParam(param -> param.key("item_id").value(itemId) - .shouldEncode(true)) - .headerParam(param -> param.key("idempotency-key") - .value(idempotencyKey).isRequired(false)) - .headerParam(param ->param.key("content-type").value("application/json")) .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) - .httpMethod(HttpMethod.POST)) + .httpMethod(HttpMethod.GET)) .responseHandler(responseHandler -> responseHandler .deserializer( - response -> ApiHelper.deserialize(response, GetUsageResponse.class)) + response -> ApiHelper.deserialize(response, GetSubscriptionResponse.class)) .nullify404(false) .globalErrorCase(GLOBAL_ERROR_CASES)) .build(); } /** + * Lists all usages from a subscription item. * @param subscriptionId Required parameter: The subscription id - * @param discountId Required parameter: Example: - * @return Returns the GetDiscountResponse response from the API call + * @param itemId Required parameter: The subscription item id + * @param page Optional parameter: Page number + * @param size Optional parameter: Page size + * @param code Optional parameter: Identification code in the client system + * @param group Optional parameter: Identification group in the client system + * @param usedSince Optional parameter: Example: + * @param usedUntil Optional parameter: Example: + * @return Returns the ListUsagesResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetDiscountResponse getDiscountById( + public ListUsagesResponse getUsages( final String subscriptionId, - final String discountId) throws ApiException, IOException { - return prepareGetDiscountByIdRequest(subscriptionId, discountId).execute(); + final String itemId, + final Integer page, + final Integer size, + final String code, + final String group, + final LocalDateTime usedSince, + final LocalDateTime usedUntil) throws ApiException, IOException { + return prepareGetUsagesRequest(subscriptionId, itemId, page, size, code, group, usedSince, + usedUntil).execute(); } /** - * Builds the ApiCall object for getDiscountById. + * Builds the ApiCall object for getUsages. */ - private ApiCall prepareGetDiscountByIdRequest( + private ApiCall prepareGetUsagesRequest( final String subscriptionId, - final String discountId) throws IOException { - return new ApiCall.Builder() + final String itemId, + final Integer page, + final Integer size, + final String code, + final String group, + final LocalDateTime usedSince, + final LocalDateTime usedUntil) throws IOException { + return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/subscriptions/{subscription_id}/discounts/{discountId}") + .path("/subscriptions/{subscription_id}/items/{item_id}/usages") + .queryParam(param -> param.key("page") + .value(page).isRequired(false)) + .queryParam(param -> param.key("size") + .value(size).isRequired(false)) + .queryParam(param -> param.key("code") + .value(code).isRequired(false)) + .queryParam(param -> param.key("group") + .value(group).isRequired(false)) + .queryParam(param -> param.key("used_since") + .value(DateTimeHelper.toRfc8601DateTime(usedSince)).isRequired(false)) + .queryParam(param -> param.key("used_until") + .value(DateTimeHelper.toRfc8601DateTime(usedUntil)).isRequired(false)) .templateParam(param -> param.key("subscription_id").value(subscriptionId) .shouldEncode(true)) - .templateParam(param -> param.key("discountId").value(discountId) + .templateParam(param -> param.key("item_id").value(itemId) .shouldEncode(true)) .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth @@ -1562,41 +1582,41 @@ private ApiCall prepareGetDiscountByIdRequest .httpMethod(HttpMethod.GET)) .responseHandler(responseHandler -> responseHandler .deserializer( - response -> ApiHelper.deserialize(response, GetDiscountResponse.class)) + response -> ApiHelper.deserialize(response, ListUsagesResponse.class)) .nullify404(false) .globalErrorCase(GLOBAL_ERROR_CASES)) .build(); } /** - * Updates the metadata from a subscription. - * @param subscriptionId Required parameter: The subscription id - * @param request Required parameter: Request for updating the subscrption metadata + * @param subscriptionId Required parameter: Example: + * @param request Required parameter: Request for updating the end date of the current + * signature cycle * @param idempotencyKey Optional parameter: Example: * @return Returns the GetSubscriptionResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetSubscriptionResponse updateSubscriptionMetadata( + public GetSubscriptionResponse updateLatestPeriodEndAt( final String subscriptionId, - final UpdateMetadataRequest request, + final UpdateCurrentCycleEndDateRequest request, final String idempotencyKey) throws ApiException, IOException { - return prepareUpdateSubscriptionMetadataRequest(subscriptionId, request, + return prepareUpdateLatestPeriodEndAtRequest(subscriptionId, request, idempotencyKey).execute(); } /** - * Builds the ApiCall object for updateSubscriptionMetadata. + * Builds the ApiCall object for updateLatestPeriodEndAt. */ - private ApiCall prepareUpdateSubscriptionMetadataRequest( + private ApiCall prepareUpdateLatestPeriodEndAtRequest( final String subscriptionId, - final UpdateMetadataRequest request, + final UpdateCurrentCycleEndDateRequest request, final String idempotencyKey) throws JsonProcessingException, IOException { return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/Subscriptions/{subscription_id}/metadata") + .path("/subscriptions/{subscription_id}/periods/latest/end-at") .bodyParam(param -> param.value(request)) .bodySerializer(() -> ApiHelper.serialize(request)) .templateParam(param -> param.key("subscription_id").value(subscriptionId) @@ -1617,190 +1637,170 @@ private ApiCall prepareUpdateSubscription } /** + * Atualização do valor mínimo da assinatura. * @param subscriptionId Required parameter: Subscription Id - * @param page Required parameter: Page number - * @param size Required parameter: Page size - * @return Returns the ListCyclesResponse response from the API call + * @param request Required parameter: Request da requisição com o valor mínimo que será + * configurado + * @param idempotencyKey Optional parameter: Example: + * @return Returns the GetSubscriptionResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public ListCyclesResponse getSubscriptionCycles( + public GetSubscriptionResponse updateSubscriptionMiniumPrice( final String subscriptionId, - final String page, - final String size) throws ApiException, IOException { - return prepareGetSubscriptionCyclesRequest(subscriptionId, page, size).execute(); + final UpdateSubscriptionMinimumPriceRequest request, + final String idempotencyKey) throws ApiException, IOException { + return prepareUpdateSubscriptionMiniumPriceRequest(subscriptionId, request, + idempotencyKey).execute(); } /** - * Builds the ApiCall object for getSubscriptionCycles. + * Builds the ApiCall object for updateSubscriptionMiniumPrice. */ - private ApiCall prepareGetSubscriptionCyclesRequest( + private ApiCall prepareUpdateSubscriptionMiniumPriceRequest( final String subscriptionId, - final String page, - final String size) throws IOException { - return new ApiCall.Builder() + final UpdateSubscriptionMinimumPriceRequest request, + final String idempotencyKey) throws JsonProcessingException, IOException { + return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/subscriptions/{subscription_id}/cycles") - .queryParam(param -> param.key("page") - .value(page)) - .queryParam(param -> param.key("size") - .value(size)) + .path("/subscriptions/{subscription_id}/minimum_price") + .bodyParam(param -> param.value(request)) + .bodySerializer(() -> ApiHelper.serialize(request)) .templateParam(param -> param.key("subscription_id").value(subscriptionId) .shouldEncode(true)) + .headerParam(param -> param.key("idempotency-key") + .value(idempotencyKey).isRequired(false)) + .headerParam(param ->param.key("content-type").value("application/json")) .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) - .httpMethod(HttpMethod.GET)) + .httpMethod(HttpMethod.PATCH)) .responseHandler(responseHandler -> responseHandler .deserializer( - response -> ApiHelper.deserialize(response, ListCyclesResponse.class)) + response -> ApiHelper.deserialize(response, GetSubscriptionResponse.class)) .nullify404(false) .globalErrorCase(GLOBAL_ERROR_CASES)) .build(); } /** - * Deletes a subscription item. - * @param subscriptionId Required parameter: Subscription id - * @param subscriptionItemId Required parameter: Subscription item id - * @param idempotencyKey Optional parameter: Example: - * @return Returns the GetSubscriptionItemResponse response from the API call + * @param subscriptionId Required parameter: The subscription id + * @param cycleId Required parameter: Example: + * @return Returns the GetPeriodResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetSubscriptionItemResponse deleteSubscriptionItem( + public GetPeriodResponse getSubscriptionCycleById( final String subscriptionId, - final String subscriptionItemId, - final String idempotencyKey) throws ApiException, IOException { - return prepareDeleteSubscriptionItemRequest(subscriptionId, subscriptionItemId, - idempotencyKey).execute(); + final String cycleId) throws ApiException, IOException { + return prepareGetSubscriptionCycleByIdRequest(subscriptionId, cycleId).execute(); } /** - * Builds the ApiCall object for deleteSubscriptionItem. + * Builds the ApiCall object for getSubscriptionCycleById. */ - private ApiCall prepareDeleteSubscriptionItemRequest( + private ApiCall prepareGetSubscriptionCycleByIdRequest( final String subscriptionId, - final String subscriptionItemId, - final String idempotencyKey) throws IOException { - return new ApiCall.Builder() + final String cycleId) throws IOException { + return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/subscriptions/{subscription_id}/items/{subscription_item_id}") + .path("/subscriptions/{subscription_id}/cycles/{cycleId}") .templateParam(param -> param.key("subscription_id").value(subscriptionId) .shouldEncode(true)) - .templateParam(param -> param.key("subscription_item_id").value(subscriptionItemId) + .templateParam(param -> param.key("cycleId").value(cycleId) .shouldEncode(true)) - .headerParam(param -> param.key("idempotency-key") - .value(idempotencyKey).isRequired(false)) .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) - .httpMethod(HttpMethod.DELETE)) + .httpMethod(HttpMethod.GET)) .responseHandler(responseHandler -> responseHandler .deserializer( - response -> ApiHelper.deserialize(response, GetSubscriptionItemResponse.class)) + response -> ApiHelper.deserialize(response, GetPeriodResponse.class)) .nullify404(false) .globalErrorCase(GLOBAL_ERROR_CASES)) .build(); } /** - * @param subscriptionId Required parameter: The subscription id - * @param page Optional parameter: Page number - * @param size Optional parameter: Page size - * @return Returns the ListIncrementsResponse response from the API call + * @param subscriptionId Required parameter: The subscription Id + * @param periodId Required parameter: The period Id + * @return Returns the GetUsageReportResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public ListIncrementsResponse getIncrements( + public GetUsageReportResponse getUsageReport( final String subscriptionId, - final Integer page, - final Integer size) throws ApiException, IOException { - return prepareGetIncrementsRequest(subscriptionId, page, size).execute(); + final String periodId) throws ApiException, IOException { + return prepareGetUsageReportRequest(subscriptionId, periodId).execute(); } /** - * Builds the ApiCall object for getIncrements. + * Builds the ApiCall object for getUsageReport. */ - private ApiCall prepareGetIncrementsRequest( + private ApiCall prepareGetUsageReportRequest( final String subscriptionId, - final Integer page, - final Integer size) throws IOException { - return new ApiCall.Builder() + final String periodId) throws IOException { + return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/subscriptions/{subscription_id}/increments/") - .queryParam(param -> param.key("page") - .value(page).isRequired(false)) - .queryParam(param -> param.key("size") - .value(size).isRequired(false)) + .path("/subscriptions/{subscription_id}/periods/{period_id}/usages/report") .templateParam(param -> param.key("subscription_id").value(subscriptionId) .shouldEncode(true)) + .templateParam(param -> param.key("period_id").value(periodId) + .shouldEncode(true)) .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) .httpMethod(HttpMethod.GET)) .responseHandler(responseHandler -> responseHandler .deserializer( - response -> ApiHelper.deserialize(response, ListIncrementsResponse.class)) + response -> ApiHelper.deserialize(response, GetUsageReportResponse.class)) .nullify404(false) .globalErrorCase(GLOBAL_ERROR_CASES)) .build(); } /** - * Updates a subscription item. - * @param subscriptionId Required parameter: Subscription Id - * @param itemId Required parameter: Item id - * @param body Required parameter: Request for updating a subscription item - * @param idempotencyKey Optional parameter: Example: - * @return Returns the GetSubscriptionItemResponse response from the API call + * @param id Required parameter: Subscription's id + * @param request Required parameter: Example: + * @return Returns the GetSubscriptionResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetSubscriptionItemResponse updateSubscriptionItem( - final String subscriptionId, - final String itemId, - final UpdateSubscriptionItemRequest body, - final String idempotencyKey) throws ApiException, IOException { - return prepareUpdateSubscriptionItemRequest(subscriptionId, itemId, body, - idempotencyKey).execute(); + public GetSubscriptionResponse updateSplitSubscription( + final String id, + final UpdateSubscriptionSplitRequest request) throws ApiException, IOException { + return prepareUpdateSplitSubscriptionRequest(id, request).execute(); } /** - * Builds the ApiCall object for updateSubscriptionItem. + * Builds the ApiCall object for updateSplitSubscription. */ - private ApiCall prepareUpdateSubscriptionItemRequest( - final String subscriptionId, - final String itemId, - final UpdateSubscriptionItemRequest body, - final String idempotencyKey) throws JsonProcessingException, IOException { - return new ApiCall.Builder() + private ApiCall prepareUpdateSplitSubscriptionRequest( + final String id, + final UpdateSubscriptionSplitRequest request) throws JsonProcessingException, IOException { + return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/subscriptions/{subscription_id}/items/{item_id}") - .bodyParam(param -> param.value(body)) - .bodySerializer(() -> ApiHelper.serialize(body)) - .templateParam(param -> param.key("subscription_id").value(subscriptionId) - .shouldEncode(true)) - .templateParam(param -> param.key("item_id").value(itemId) + .path("/subscriptions/{id}/split") + .bodyParam(param -> param.value(request)) + .bodySerializer(() -> ApiHelper.serialize(request)) + .templateParam(param -> param.key("id").value(id) .shouldEncode(true)) - .headerParam(param -> param.key("idempotency-key") - .value(idempotencyKey).isRequired(false)) .headerParam(param ->param.key("content-type").value("application/json")) .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) - .httpMethod(HttpMethod.PUT)) + .httpMethod(HttpMethod.PATCH)) .responseHandler(responseHandler -> responseHandler .deserializer( - response -> ApiHelper.deserialize(response, GetSubscriptionItemResponse.class)) + response -> ApiHelper.deserialize(response, GetSubscriptionResponse.class)) .nullify404(false) .globalErrorCase(GLOBAL_ERROR_CASES)) .build(); diff --git a/src/main/java/me/pagar/api/controllers/DefaultTokensController.java b/src/main/java/me/pagar/api/controllers/DefaultTokensController.java index c466415..4c75126 100644 --- a/src/main/java/me/pagar/api/controllers/DefaultTokensController.java +++ b/src/main/java/me/pagar/api/controllers/DefaultTokensController.java @@ -31,36 +31,41 @@ public DefaultTokensController(GlobalConfiguration globalConfig) { } /** - * Gets a token from its id. - * @param id Required parameter: Token id * @param publicKey Required parameter: Public key + * @param request Required parameter: Request for creating a token + * @param idempotencyKey Optional parameter: Example: * @return Returns the GetTokenResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetTokenResponse getToken( - final String id, - final String publicKey) throws ApiException, IOException { - return prepareGetTokenRequest(id, publicKey).execute(); + public GetTokenResponse createToken( + final String publicKey, + final CreateTokenRequest request, + final String idempotencyKey) throws ApiException, IOException { + return prepareCreateTokenRequest(publicKey, request, idempotencyKey).execute(); } /** - * Builds the ApiCall object for getToken. + * Builds the ApiCall object for createToken. */ - private ApiCall prepareGetTokenRequest( - final String id, - final String publicKey) throws IOException { + private ApiCall prepareCreateTokenRequest( + final String publicKey, + final CreateTokenRequest request, + final String idempotencyKey) throws JsonProcessingException, IOException { return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/tokens/{id}?appId={public_key}") - .templateParam(param -> param.key("id").value(id) - .shouldEncode(true)) + .path("/tokens?appId={public_key}") + .bodyParam(param -> param.value(request)) + .bodySerializer(() -> ApiHelper.serialize(request)) .templateParam(param -> param.key("public_key").value(publicKey) .shouldEncode(true)) + .headerParam(param -> param.key("idempotency-key") + .value(idempotencyKey).isRequired(false)) + .headerParam(param ->param.key("content-type").value("application/json")) .headerParam(param -> param.key("accept").value("application/json")) - .httpMethod(HttpMethod.GET)) + .httpMethod(HttpMethod.POST)) .responseHandler(responseHandler -> responseHandler .deserializer( response -> ApiHelper.deserialize(response, GetTokenResponse.class)) @@ -70,41 +75,36 @@ private ApiCall prepareGetTokenRequest( } /** + * Gets a token from its id. + * @param id Required parameter: Token id * @param publicKey Required parameter: Public key - * @param request Required parameter: Request for creating a token - * @param idempotencyKey Optional parameter: Example: * @return Returns the GetTokenResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetTokenResponse createToken( - final String publicKey, - final CreateTokenRequest request, - final String idempotencyKey) throws ApiException, IOException { - return prepareCreateTokenRequest(publicKey, request, idempotencyKey).execute(); + public GetTokenResponse getToken( + final String id, + final String publicKey) throws ApiException, IOException { + return prepareGetTokenRequest(id, publicKey).execute(); } /** - * Builds the ApiCall object for createToken. + * Builds the ApiCall object for getToken. */ - private ApiCall prepareCreateTokenRequest( - final String publicKey, - final CreateTokenRequest request, - final String idempotencyKey) throws JsonProcessingException, IOException { + private ApiCall prepareGetTokenRequest( + final String id, + final String publicKey) throws IOException { return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/tokens?appId={public_key}") - .bodyParam(param -> param.value(request)) - .bodySerializer(() -> ApiHelper.serialize(request)) + .path("/tokens/{id}?appId={public_key}") + .templateParam(param -> param.key("id").value(id) + .shouldEncode(true)) .templateParam(param -> param.key("public_key").value(publicKey) .shouldEncode(true)) - .headerParam(param -> param.key("idempotency-key") - .value(idempotencyKey).isRequired(false)) - .headerParam(param ->param.key("content-type").value("application/json")) .headerParam(param -> param.key("accept").value("application/json")) - .httpMethod(HttpMethod.POST)) + .httpMethod(HttpMethod.GET)) .responseHandler(responseHandler -> responseHandler .deserializer( response -> ApiHelper.deserialize(response, GetTokenResponse.class)) diff --git a/src/main/java/me/pagar/api/controllers/DefaultTransfersController.java b/src/main/java/me/pagar/api/controllers/DefaultTransfersController.java index f5d4629..51d5421 100644 --- a/src/main/java/me/pagar/api/controllers/DefaultTransfersController.java +++ b/src/main/java/me/pagar/api/controllers/DefaultTransfersController.java @@ -67,67 +67,67 @@ private ApiCall prepareGetTransferByIdRequest( } /** - * Gets all transfers. - * @return Returns the ListTransfers response from the API call + * @param request Required parameter: Example: + * @return Returns the GetTransfer response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public ListTransfers getTransfers() throws ApiException, IOException { - return prepareGetTransfersRequest().execute(); + public GetTransfer createTransfer( + final CreateTransfer request) throws ApiException, IOException { + return prepareCreateTransferRequest(request).execute(); } /** - * Builds the ApiCall object for getTransfers. + * Builds the ApiCall object for createTransfer. */ - private ApiCall prepareGetTransfersRequest() throws IOException { - return new ApiCall.Builder() + private ApiCall prepareCreateTransferRequest( + final CreateTransfer request) throws JsonProcessingException, IOException { + return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/transfers") + .path("/transfers/recipients") + .bodyParam(param -> param.value(request)) + .bodySerializer(() -> ApiHelper.serialize(request)) + .headerParam(param ->param.key("content-type").value("application/json")) .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) - .httpMethod(HttpMethod.GET)) + .httpMethod(HttpMethod.POST)) .responseHandler(responseHandler -> responseHandler .deserializer( - response -> ApiHelper.deserialize(response, ListTransfers.class)) + response -> ApiHelper.deserialize(response, GetTransfer.class)) .nullify404(false) .globalErrorCase(GLOBAL_ERROR_CASES)) .build(); } /** - * @param request Required parameter: Example: - * @return Returns the GetTransfer response from the API call + * Gets all transfers. + * @return Returns the ListTransfers response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - public GetTransfer createTransfer( - final CreateTransfer request) throws ApiException, IOException { - return prepareCreateTransferRequest(request).execute(); + public ListTransfers getTransfers() throws ApiException, IOException { + return prepareGetTransfersRequest().execute(); } /** - * Builds the ApiCall object for createTransfer. + * Builds the ApiCall object for getTransfers. */ - private ApiCall prepareCreateTransferRequest( - final CreateTransfer request) throws JsonProcessingException, IOException { - return new ApiCall.Builder() + private ApiCall prepareGetTransfersRequest() throws IOException { + return new ApiCall.Builder() .globalConfig(getGlobalConfiguration()) .requestBuilder(requestBuilder -> requestBuilder .server(Server.ENUM_DEFAULT.value()) - .path("/transfers/recipients") - .bodyParam(param -> param.value(request)) - .bodySerializer(() -> ApiHelper.serialize(request)) - .headerParam(param ->param.key("content-type").value("application/json")) + .path("/transfers") .headerParam(param -> param.key("accept").value("application/json")) .withAuth(auth -> auth .add("httpBasic")) - .httpMethod(HttpMethod.POST)) + .httpMethod(HttpMethod.GET)) .responseHandler(responseHandler -> responseHandler .deserializer( - response -> ApiHelper.deserialize(response, GetTransfer.class)) + response -> ApiHelper.deserialize(response, ListTransfers.class)) .nullify404(false) .globalErrorCase(GLOBAL_ERROR_CASES)) .build(); diff --git a/src/main/java/me/pagar/api/controllers/InvoicesController.java b/src/main/java/me/pagar/api/controllers/InvoicesController.java index 91abdd9..5d74ee9 100644 --- a/src/main/java/me/pagar/api/controllers/InvoicesController.java +++ b/src/main/java/me/pagar/api/controllers/InvoicesController.java @@ -21,84 +21,40 @@ */ public interface InvoicesController { /** - * Gets all invoices. - * @param page Optional parameter: Page number - * @param size Optional parameter: Page size - * @param code Optional parameter: Filter for Invoice's code - * @param customerId Optional parameter: Filter for Invoice's customer id - * @param subscriptionId Optional parameter: Filter for Invoice's subscription id - * @param createdSince Optional parameter: Filter for Invoice's creation date start range - * @param createdUntil Optional parameter: Filter for Invoices creation date end range - * @param status Optional parameter: Filter for Invoice's status - * @param dueSince Optional parameter: Filter for Invoice's due date start range - * @param dueUntil Optional parameter: Filter for Invoice's due date end range - * @param customerDocument Optional parameter: Example: - * @return Returns the ListInvoicesResponse response from the API call - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - ListInvoicesResponse getInvoices( - final Integer page, - final Integer size, - final String code, - final String customerId, - final String subscriptionId, - final LocalDateTime createdSince, - final LocalDateTime createdUntil, - final String status, - final LocalDateTime dueSince, - final LocalDateTime dueUntil, - final String customerDocument) throws ApiException, IOException; - - /** - * Cancels an invoice. - * @param invoiceId Required parameter: Invoice id + * Updates the metadata from an invoice. + * @param invoiceId Required parameter: The invoice id + * @param request Required parameter: Request for updating the invoice metadata * @param idempotencyKey Optional parameter: Example: * @return Returns the GetInvoiceResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - GetInvoiceResponse cancelInvoice( + GetInvoiceResponse updateInvoiceMetadata( final String invoiceId, + final UpdateMetadataRequest request, final String idempotencyKey) throws ApiException, IOException; /** - * Updates the status from an invoice. - * @param invoiceId Required parameter: Invoice Id - * @param request Required parameter: Request for updating an invoice's status - * @param idempotencyKey Optional parameter: Example: + * @param subscriptionId Required parameter: Subscription Id * @return Returns the GetInvoiceResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - GetInvoiceResponse updateInvoiceStatus( - final String invoiceId, - final UpdateInvoiceStatusRequest request, - final String idempotencyKey) throws ApiException, IOException; + GetInvoiceResponse getPartialInvoice( + final String subscriptionId) throws ApiException, IOException; /** - * Updates the metadata from an invoice. - * @param invoiceId Required parameter: The invoice id - * @param request Required parameter: Request for updating the invoice metadata + * Cancels an invoice. + * @param invoiceId Required parameter: Invoice id * @param idempotencyKey Optional parameter: Example: * @return Returns the GetInvoiceResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - GetInvoiceResponse updateInvoiceMetadata( + GetInvoiceResponse cancelInvoice( final String invoiceId, - final UpdateMetadataRequest request, final String idempotencyKey) throws ApiException, IOException; - /** - * @param subscriptionId Required parameter: Subscription Id - * @return Returns the GetInvoiceResponse response from the API call - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - GetInvoiceResponse getPartialInvoice( - final String subscriptionId) throws ApiException, IOException; - /** * Create an Invoice. * @param subscriptionId Required parameter: Subscription Id @@ -115,6 +71,36 @@ GetInvoiceResponse createInvoice( final CreateInvoiceRequest request, final String idempotencyKey) throws ApiException, IOException; + /** + * Gets all invoices. + * @param page Optional parameter: Page number + * @param size Optional parameter: Page size + * @param code Optional parameter: Filter for Invoice's code + * @param customerId Optional parameter: Filter for Invoice's customer id + * @param subscriptionId Optional parameter: Filter for Invoice's subscription id + * @param createdSince Optional parameter: Filter for Invoice's creation date start range + * @param createdUntil Optional parameter: Filter for Invoices creation date end range + * @param status Optional parameter: Filter for Invoice's status + * @param dueSince Optional parameter: Filter for Invoice's due date start range + * @param dueUntil Optional parameter: Filter for Invoice's due date end range + * @param customerDocument Optional parameter: Example: + * @return Returns the ListInvoicesResponse response from the API call + * @throws ApiException Represents error response from the server. + * @throws IOException Signals that an I/O exception of some sort has occurred. + */ + ListInvoicesResponse getInvoices( + final Integer page, + final Integer size, + final String code, + final String customerId, + final String subscriptionId, + final LocalDateTime createdSince, + final LocalDateTime createdUntil, + final String status, + final LocalDateTime dueSince, + final LocalDateTime dueUntil, + final String customerDocument) throws ApiException, IOException; + /** * Gets an invoice. * @param invoiceId Required parameter: Invoice Id @@ -125,4 +111,18 @@ GetInvoiceResponse createInvoice( GetInvoiceResponse getInvoice( final String invoiceId) throws ApiException, IOException; + /** + * Updates the status from an invoice. + * @param invoiceId Required parameter: Invoice Id + * @param request Required parameter: Request for updating an invoice's status + * @param idempotencyKey Optional parameter: Example: + * @return Returns the GetInvoiceResponse response from the API call + * @throws ApiException Represents error response from the server. + * @throws IOException Signals that an I/O exception of some sort has occurred. + */ + GetInvoiceResponse updateInvoiceStatus( + final String invoiceId, + final UpdateInvoiceStatusRequest request, + final String idempotencyKey) throws ApiException, IOException; + } \ No newline at end of file diff --git a/src/main/java/me/pagar/api/controllers/OrdersController.java b/src/main/java/me/pagar/api/controllers/OrdersController.java index de63fd5..104e2ee 100644 --- a/src/main/java/me/pagar/api/controllers/OrdersController.java +++ b/src/main/java/me/pagar/api/controllers/OrdersController.java @@ -23,65 +23,6 @@ * This can be overridden for the mock calls. */ public interface OrdersController { - /** - * @param orderId Required parameter: Order Id - * @param idempotencyKey Optional parameter: Example: - * @return Returns the GetOrderResponse response from the API call - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - GetOrderResponse deleteAllOrderItems( - final String orderId, - final String idempotencyKey) throws ApiException, IOException; - - /** - * @param orderId Required parameter: Order Id - * @param itemId Required parameter: Item Id - * @return Returns the GetOrderItemResponse response from the API call - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - GetOrderItemResponse getOrderItem( - final String orderId, - final String itemId) throws ApiException, IOException; - - /** - * Updates the metadata from an order. - * @param orderId Required parameter: The order id - * @param request Required parameter: Request for updating the order metadata - * @param idempotencyKey Optional parameter: Example: - * @return Returns the GetOrderResponse response from the API call - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - GetOrderResponse updateOrderMetadata( - final String orderId, - final UpdateMetadataRequest request, - final String idempotencyKey) throws ApiException, IOException; - - /** - * @param orderId Required parameter: Order Id - * @param itemId Required parameter: Item Id - * @param idempotencyKey Optional parameter: Example: - * @return Returns the GetOrderItemResponse response from the API call - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - GetOrderItemResponse deleteOrderItem( - final String orderId, - final String itemId, - final String idempotencyKey) throws ApiException, IOException; - - /** - * Gets an order. - * @param orderId Required parameter: Order id - * @return Returns the GetOrderResponse response from the API call - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - GetOrderResponse getOrder( - final String orderId) throws ApiException, IOException; - /** * Gets all orders. * @param page Optional parameter: Page number @@ -119,6 +60,30 @@ GetOrderItemResponse updateOrderItem( final UpdateOrderItemRequest request, final String idempotencyKey) throws ApiException, IOException; + /** + * @param orderId Required parameter: Order Id + * @param idempotencyKey Optional parameter: Example: + * @return Returns the GetOrderResponse response from the API call + * @throws ApiException Represents error response from the server. + * @throws IOException Signals that an I/O exception of some sort has occurred. + */ + GetOrderResponse deleteAllOrderItems( + final String orderId, + final String idempotencyKey) throws ApiException, IOException; + + /** + * @param orderId Required parameter: Order Id + * @param itemId Required parameter: Item Id + * @param idempotencyKey Optional parameter: Example: + * @return Returns the GetOrderItemResponse response from the API call + * @throws ApiException Represents error response from the server. + * @throws IOException Signals that an I/O exception of some sort has occurred. + */ + GetOrderItemResponse deleteOrderItem( + final String orderId, + final String itemId, + final String idempotencyKey) throws ApiException, IOException; + /** * @param id Required parameter: Order Id * @param request Required parameter: Update Order Model @@ -157,4 +122,39 @@ GetOrderItemResponse createOrderItem( final CreateOrderItemRequest request, final String idempotencyKey) throws ApiException, IOException; + /** + * @param orderId Required parameter: Order Id + * @param itemId Required parameter: Item Id + * @return Returns the GetOrderItemResponse response from the API call + * @throws ApiException Represents error response from the server. + * @throws IOException Signals that an I/O exception of some sort has occurred. + */ + GetOrderItemResponse getOrderItem( + final String orderId, + final String itemId) throws ApiException, IOException; + + /** + * Updates the metadata from an order. + * @param orderId Required parameter: The order id + * @param request Required parameter: Request for updating the order metadata + * @param idempotencyKey Optional parameter: Example: + * @return Returns the GetOrderResponse response from the API call + * @throws ApiException Represents error response from the server. + * @throws IOException Signals that an I/O exception of some sort has occurred. + */ + GetOrderResponse updateOrderMetadata( + final String orderId, + final UpdateMetadataRequest request, + final String idempotencyKey) throws ApiException, IOException; + + /** + * Gets an order. + * @param orderId Required parameter: Order id + * @return Returns the GetOrderResponse response from the API call + * @throws ApiException Represents error response from the server. + * @throws IOException Signals that an I/O exception of some sort has occurred. + */ + GetOrderResponse getOrder( + final String orderId) throws ApiException, IOException; + } \ No newline at end of file diff --git a/src/main/java/me/pagar/api/controllers/PlansController.java b/src/main/java/me/pagar/api/controllers/PlansController.java index 75d9942..e0d53ca 100644 --- a/src/main/java/me/pagar/api/controllers/PlansController.java +++ b/src/main/java/me/pagar/api/controllers/PlansController.java @@ -34,17 +34,15 @@ GetPlanResponse getPlan( final String planId) throws ApiException, IOException; /** - * Removes an item from a plan. + * Deletes a plan. * @param planId Required parameter: Plan id - * @param planItemId Required parameter: Plan item id * @param idempotencyKey Optional parameter: Example: - * @return Returns the GetPlanItemResponse response from the API call + * @return Returns the GetPlanResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - GetPlanItemResponse deletePlanItem( + GetPlanResponse deletePlan( final String planId, - final String planItemId, final String idempotencyKey) throws ApiException, IOException; /** @@ -62,41 +60,71 @@ GetPlanResponse updatePlanMetadata( final String idempotencyKey) throws ApiException, IOException; /** - * Creates a new plan. - * @param body Required parameter: Request for creating a plan + * Updates a plan item. + * @param planId Required parameter: Plan id + * @param planItemId Required parameter: Plan item id + * @param body Required parameter: Request for updating the plan item * @param idempotencyKey Optional parameter: Example: - * @return Returns the GetPlanResponse response from the API call + * @return Returns the GetPlanItemResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - GetPlanResponse createPlan( - final CreatePlanRequest body, + GetPlanItemResponse updatePlanItem( + final String planId, + final String planItemId, + final UpdatePlanItemRequest body, final String idempotencyKey) throws ApiException, IOException; /** - * Updates a plan. + * Adds a new item to a plan. * @param planId Required parameter: Plan id - * @param request Required parameter: Request for updating a plan + * @param request Required parameter: Request for creating a plan item * @param idempotencyKey Optional parameter: Example: - * @return Returns the GetPlanResponse response from the API call + * @return Returns the GetPlanItemResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - GetPlanResponse updatePlan( + GetPlanItemResponse createPlanItem( final String planId, - final UpdatePlanRequest request, + final CreatePlanItemRequest request, final String idempotencyKey) throws ApiException, IOException; /** - * Deletes a plan. + * Gets a plan item. * @param planId Required parameter: Plan id + * @param planItemId Required parameter: Plan item id + * @return Returns the GetPlanItemResponse response from the API call + * @throws ApiException Represents error response from the server. + * @throws IOException Signals that an I/O exception of some sort has occurred. + */ + GetPlanItemResponse getPlanItem( + final String planId, + final String planItemId) throws ApiException, IOException; + + /** + * Creates a new plan. + * @param body Required parameter: Request for creating a plan * @param idempotencyKey Optional parameter: Example: * @return Returns the GetPlanResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - GetPlanResponse deletePlan( + GetPlanResponse createPlan( + final CreatePlanRequest body, + final String idempotencyKey) throws ApiException, IOException; + + /** + * Removes an item from a plan. + * @param planId Required parameter: Plan id + * @param planItemId Required parameter: Plan item id + * @param idempotencyKey Optional parameter: Example: + * @return Returns the GetPlanItemResponse response from the API call + * @throws ApiException Represents error response from the server. + * @throws IOException Signals that an I/O exception of some sort has occurred. + */ + GetPlanItemResponse deletePlanItem( final String planId, + final String planItemId, final String idempotencyKey) throws ApiException, IOException; /** @@ -122,45 +150,17 @@ ListPlansResponse getPlans( final LocalDateTime createdUntil) throws ApiException, IOException; /** - * Updates a plan item. - * @param planId Required parameter: Plan id - * @param planItemId Required parameter: Plan item id - * @param body Required parameter: Request for updating the plan item - * @param idempotencyKey Optional parameter: Example: - * @return Returns the GetPlanItemResponse response from the API call - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - GetPlanItemResponse updatePlanItem( - final String planId, - final String planItemId, - final UpdatePlanItemRequest body, - final String idempotencyKey) throws ApiException, IOException; - - /** - * Adds a new item to a plan. + * Updates a plan. * @param planId Required parameter: Plan id - * @param request Required parameter: Request for creating a plan item + * @param request Required parameter: Request for updating a plan * @param idempotencyKey Optional parameter: Example: - * @return Returns the GetPlanItemResponse response from the API call + * @return Returns the GetPlanResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - GetPlanItemResponse createPlanItem( + GetPlanResponse updatePlan( final String planId, - final CreatePlanItemRequest request, + final UpdatePlanRequest request, final String idempotencyKey) throws ApiException, IOException; - /** - * Gets a plan item. - * @param planId Required parameter: Plan id - * @param planItemId Required parameter: Plan item id - * @return Returns the GetPlanItemResponse response from the API call - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - GetPlanItemResponse getPlanItem( - final String planId, - final String planItemId) throws ApiException, IOException; - } \ No newline at end of file diff --git a/src/main/java/me/pagar/api/controllers/RecipientsController.java b/src/main/java/me/pagar/api/controllers/RecipientsController.java index 48a2554..c70b4c8 100644 --- a/src/main/java/me/pagar/api/controllers/RecipientsController.java +++ b/src/main/java/me/pagar/api/controllers/RecipientsController.java @@ -10,6 +10,7 @@ import java.time.LocalDateTime; import me.pagar.api.exceptions.ApiException; import me.pagar.api.models.CreateAnticipationRequest; +import me.pagar.api.models.CreateKYCLinkResponse; import me.pagar.api.models.CreateRecipientRequest; import me.pagar.api.models.CreateTransferRequest; import me.pagar.api.models.CreateWithdrawRequest; @@ -49,35 +50,32 @@ GetRecipientResponse updateRecipient( final String idempotencyKey) throws ApiException, IOException; /** - * @param recipientId Required parameter: Example: - * @param withdrawalId Required parameter: Example: - * @return Returns the GetWithdrawResponse response from the API call + * Creates an anticipation. + * @param recipientId Required parameter: Recipient id + * @param request Required parameter: Anticipation data + * @param idempotencyKey Optional parameter: Example: + * @return Returns the GetAnticipationResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - GetWithdrawResponse getWithdrawById( + GetAnticipationResponse createAnticipation( final String recipientId, - final String withdrawalId) throws ApiException, IOException; - - /** - * Retrieves recipient information. - * @param recipientId Required parameter: Recipiend id - * @return Returns the GetRecipientResponse response from the API call - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - GetRecipientResponse getRecipient( - final String recipientId) throws ApiException, IOException; + final CreateAnticipationRequest request, + final String idempotencyKey) throws ApiException, IOException; /** - * Get balance information for a recipient. + * Gets the anticipation limits for a recipient. * @param recipientId Required parameter: Recipient id - * @return Returns the GetBalanceResponse response from the API call + * @param timeframe Required parameter: Timeframe + * @param paymentDate Required parameter: Anticipation payment date + * @return Returns the GetAnticipationLimitResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - GetBalanceResponse getBalance( - final String recipientId) throws ApiException, IOException; + GetAnticipationLimitResponse getAnticipationLimits( + final String recipientId, + final String timeframe, + final LocalDateTime paymentDate) throws ApiException, IOException; /** * Retrieves paginated recipients information. @@ -91,6 +89,17 @@ ListRecipientResponse getRecipients( final Integer page, final Integer size) throws ApiException, IOException; + /** + * @param recipientId Required parameter: Example: + * @param withdrawalId Required parameter: Example: + * @return Returns the GetWithdrawResponse response from the API call + * @throws ApiException Represents error response from the server. + * @throws IOException Signals that an I/O exception of some sort has occurred. + */ + GetWithdrawResponse getWithdrawById( + final String recipientId, + final String withdrawalId) throws ApiException, IOException; + /** * Updates the default bank account from a recipient. * @param recipientId Required parameter: Recipient id @@ -105,6 +114,20 @@ GetRecipientResponse updateRecipientDefaultBankAccount( final UpdateRecipientBankAccountRequest request, final String idempotencyKey) throws ApiException, IOException; + /** + * Updates recipient metadata. + * @param recipientId Required parameter: Recipient id + * @param request Required parameter: Metadata + * @param idempotencyKey Optional parameter: Example: + * @return Returns the GetRecipientResponse response from the API call + * @throws ApiException Represents error response from the server. + * @throws IOException Signals that an I/O exception of some sort has occurred. + */ + GetRecipientResponse updateRecipientMetadata( + final String recipientId, + final UpdateMetadataRequest request, + final String idempotencyKey) throws ApiException, IOException; + /** * Gets a paginated list of transfers for the recipient. * @param recipientId Required parameter: Recipient id @@ -148,6 +171,20 @@ GetWithdrawResponse createWithdraw( final String recipientId, final CreateWithdrawRequest request) throws ApiException, IOException; + /** + * Updates recipient metadata. + * @param recipientId Required parameter: Recipient id + * @param request Required parameter: Metadata + * @param idempotencyKey Optional parameter: Example: + * @return Returns the GetRecipientResponse response from the API call + * @throws ApiException Represents error response from the server. + * @throws IOException Signals that an I/O exception of some sort has occurred. + */ + GetRecipientResponse updateAutomaticAnticipationSettings( + final String recipientId, + final UpdateAutomaticAnticipationSettingsRequest request, + final String idempotencyKey) throws ApiException, IOException; + /** * Gets an anticipation. * @param recipientId Required parameter: Recipient id @@ -173,29 +210,74 @@ GetRecipientResponse updateRecipientTransferSettings( final UpdateTransferSettingsRequest request, final String idempotencyKey) throws ApiException, IOException; + /** + * Retrieves a paginated list of anticipations from a recipient. + * @param recipientId Required parameter: Recipient id + * @param page Optional parameter: Page number + * @param size Optional parameter: Page size + * @param status Optional parameter: Filter for anticipation status + * @param timeframe Optional parameter: Filter for anticipation timeframe + * @param paymentDateSince Optional parameter: Filter for start range for anticipation payment + * date + * @param paymentDateUntil Optional parameter: Filter for end range for anticipation payment + * date + * @param createdSince Optional parameter: Filter for start range for anticipation creation + * date + * @param createdUntil Optional parameter: Filter for end range for anticipation creation date + * @return Returns the ListAnticipationResponse response from the API call + * @throws ApiException Represents error response from the server. + * @throws IOException Signals that an I/O exception of some sort has occurred. + */ + ListAnticipationResponse getAnticipations( + final String recipientId, + final Integer page, + final Integer size, + final String status, + final String timeframe, + final LocalDateTime paymentDateSince, + final LocalDateTime paymentDateUntil, + final LocalDateTime createdSince, + final LocalDateTime createdUntil) throws ApiException, IOException; + /** * Retrieves recipient information. - * @param code Required parameter: Recipient code + * @param recipientId Required parameter: Recipiend id * @return Returns the GetRecipientResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - GetRecipientResponse getRecipientByCode( - final String code) throws ApiException, IOException; + GetRecipientResponse getRecipient( + final String recipientId) throws ApiException, IOException; /** - * Updates recipient metadata. + * Get balance information for a recipient. * @param recipientId Required parameter: Recipient id - * @param request Required parameter: Metadata - * @param idempotencyKey Optional parameter: Example: - * @return Returns the GetRecipientResponse response from the API call + * @return Returns the GetBalanceResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - GetRecipientResponse updateAutomaticAnticipationSettings( + GetBalanceResponse getBalance( + final String recipientId) throws ApiException, IOException; + + /** + * Gets a paginated list of transfers for the recipient. + * @param recipientId Required parameter: Example: + * @param page Optional parameter: Example: + * @param size Optional parameter: Example: + * @param status Optional parameter: Example: + * @param createdSince Optional parameter: Example: + * @param createdUntil Optional parameter: Example: + * @return Returns the ListWithdrawals response from the API call + * @throws ApiException Represents error response from the server. + * @throws IOException Signals that an I/O exception of some sort has occurred. + */ + ListWithdrawals getWithdrawals( final String recipientId, - final UpdateAutomaticAnticipationSettingsRequest request, - final String idempotencyKey) throws ApiException, IOException; + final Integer page, + final Integer size, + final String status, + final LocalDateTime createdSince, + final LocalDateTime createdUntil) throws ApiException, IOException; /** * Creates a transfer for a recipient. @@ -224,101 +306,30 @@ GetRecipientResponse createRecipient( final String idempotencyKey) throws ApiException, IOException; /** + * Retrieves recipient information. + * @param code Required parameter: Recipient code * @return Returns the GetRecipientResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - GetRecipientResponse getDefaultRecipient() throws ApiException, IOException; - - /** - * Creates an anticipation. - * @param recipientId Required parameter: Recipient id - * @param request Required parameter: Anticipation data - * @param idempotencyKey Optional parameter: Example: - * @return Returns the GetAnticipationResponse response from the API call - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - GetAnticipationResponse createAnticipation( - final String recipientId, - final CreateAnticipationRequest request, - final String idempotencyKey) throws ApiException, IOException; - - /** - * Gets the anticipation limits for a recipient. - * @param recipientId Required parameter: Recipient id - * @param timeframe Required parameter: Timeframe - * @param paymentDate Required parameter: Anticipation payment date - * @return Returns the GetAnticipationLimitResponse response from the API call - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - GetAnticipationLimitResponse getAnticipationLimits( - final String recipientId, - final String timeframe, - final LocalDateTime paymentDate) throws ApiException, IOException; + GetRecipientResponse getRecipientByCode( + final String code) throws ApiException, IOException; /** - * Updates recipient metadata. - * @param recipientId Required parameter: Recipient id - * @param request Required parameter: Metadata - * @param idempotencyKey Optional parameter: Example: * @return Returns the GetRecipientResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - GetRecipientResponse updateRecipientMetadata( - final String recipientId, - final UpdateMetadataRequest request, - final String idempotencyKey) throws ApiException, IOException; - - /** - * Retrieves a paginated list of anticipations from a recipient. - * @param recipientId Required parameter: Recipient id - * @param page Optional parameter: Page number - * @param size Optional parameter: Page size - * @param status Optional parameter: Filter for anticipation status - * @param timeframe Optional parameter: Filter for anticipation timeframe - * @param paymentDateSince Optional parameter: Filter for start range for anticipation payment - * date - * @param paymentDateUntil Optional parameter: Filter for end range for anticipation payment - * date - * @param createdSince Optional parameter: Filter for start range for anticipation creation - * date - * @param createdUntil Optional parameter: Filter for end range for anticipation creation date - * @return Returns the ListAnticipationResponse response from the API call - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - ListAnticipationResponse getAnticipations( - final String recipientId, - final Integer page, - final Integer size, - final String status, - final String timeframe, - final LocalDateTime paymentDateSince, - final LocalDateTime paymentDateUntil, - final LocalDateTime createdSince, - final LocalDateTime createdUntil) throws ApiException, IOException; + GetRecipientResponse getDefaultRecipient() throws ApiException, IOException; /** - * Gets a paginated list of transfers for the recipient. + * Create a KYC link. * @param recipientId Required parameter: Example: - * @param page Optional parameter: Example: - * @param size Optional parameter: Example: - * @param status Optional parameter: Example: - * @param createdSince Optional parameter: Example: - * @param createdUntil Optional parameter: Example: - * @return Returns the ListWithdrawals response from the API call + * @return Returns the CreateKYCLinkResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - ListWithdrawals getWithdrawals( - final String recipientId, - final Integer page, - final Integer size, - final String status, - final LocalDateTime createdSince, - final LocalDateTime createdUntil) throws ApiException, IOException; + CreateKYCLinkResponse createKYCLink( + final String recipientId) throws ApiException, IOException; } \ No newline at end of file diff --git a/src/main/java/me/pagar/api/controllers/SubscriptionsController.java b/src/main/java/me/pagar/api/controllers/SubscriptionsController.java index 68449d9..041284e 100644 --- a/src/main/java/me/pagar/api/controllers/SubscriptionsController.java +++ b/src/main/java/me/pagar/api/controllers/SubscriptionsController.java @@ -46,6 +46,17 @@ * This can be overridden for the mock calls. */ public interface SubscriptionsController { + /** + * @param subscriptionId Required parameter: Example: + * @param idempotencyKey Optional parameter: Example: + * @return Returns the GetPeriodResponse response from the API call + * @throws ApiException Represents error response from the server. + * @throws IOException Signals that an I/O exception of some sort has occurred. + */ + GetPeriodResponse renewSubscription( + final String subscriptionId, + final String idempotencyKey) throws ApiException, IOException; + /** * Updates the credit card from a subscription. * @param subscriptionId Required parameter: Subscription id @@ -60,6 +71,22 @@ GetSubscriptionResponse updateSubscriptionCard( final UpdateSubscriptionCardRequest request, final String idempotencyKey) throws ApiException, IOException; + /** + * Deletes a usage. + * @param subscriptionId Required parameter: The subscription id + * @param itemId Required parameter: The subscription item id + * @param usageId Required parameter: The usage id + * @param idempotencyKey Optional parameter: Example: + * @return Returns the GetUsageResponse response from the API call + * @throws ApiException Represents error response from the server. + * @throws IOException Signals that an I/O exception of some sort has occurred. + */ + GetUsageResponse deleteUsage( + final String subscriptionId, + final String itemId, + final String usageId, + final String idempotencyKey) throws ApiException, IOException; + /** * Creates a discount. * @param subscriptionId Required parameter: Subscription id @@ -75,109 +102,132 @@ GetDiscountResponse createDiscount( final String idempotencyKey) throws ApiException, IOException; /** - * Updates the billing date from a subscription. - * @param subscriptionId Required parameter: The subscription id - * @param request Required parameter: Request for updating the subscription billing date + * Create Usage. + * @param subscriptionId Required parameter: Subscription id + * @param itemId Required parameter: Item id * @param idempotencyKey Optional parameter: Example: - * @return Returns the GetSubscriptionResponse response from the API call + * @return Returns the GetUsageResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - GetSubscriptionResponse updateSubscriptionBillingDate( + GetUsageResponse createAnUsage( final String subscriptionId, - final UpdateSubscriptionBillingDateRequest request, + final String itemId, final String idempotencyKey) throws ApiException, IOException; /** - * Updates the start at date from a subscription. - * @param subscriptionId Required parameter: The subscription id - * @param request Required parameter: Request for updating the subscription start date + * @param subscriptionId Required parameter: Subscription Id + * @param request Required parameter: Request for updating the end date of the subscription + * current status * @param idempotencyKey Optional parameter: Example: - * @return Returns the GetSubscriptionResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - GetSubscriptionResponse updateSubscriptionStartAt( + void updateCurrentCycleStatus( final String subscriptionId, - final UpdateSubscriptionStartAtRequest request, + final UpdateCurrentCycleStatusRequest request, final String idempotencyKey) throws ApiException, IOException; /** - * Gets a subscription. + * Deletes a discount. * @param subscriptionId Required parameter: Subscription id - * @return Returns the GetSubscriptionResponse response from the API call + * @param discountId Required parameter: Discount Id + * @param idempotencyKey Optional parameter: Example: + * @return Returns the GetDiscountResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - GetSubscriptionResponse getSubscription( - final String subscriptionId) throws ApiException, IOException; + GetDiscountResponse deleteDiscount( + final String subscriptionId, + final String discountId, + final String idempotencyKey) throws ApiException, IOException; /** - * Lists all usages from a subscription item. + * Get Subscription Items. * @param subscriptionId Required parameter: The subscription id - * @param itemId Required parameter: The subscription item id * @param page Optional parameter: Page number * @param size Optional parameter: Page size + * @param name Optional parameter: The item name * @param code Optional parameter: Identification code in the client system - * @param group Optional parameter: Identification group in the client system - * @param usedSince Optional parameter: Example: - * @param usedUntil Optional parameter: Example: - * @return Returns the ListUsagesResponse response from the API call + * @param status Optional parameter: The item statis + * @param description Optional parameter: The item description + * @param createdSince Optional parameter: Filter for item's creation date start range + * @param createdUntil Optional parameter: Filter for item's creation date end range + * @return Returns the ListSubscriptionItemsResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - ListUsagesResponse getUsages( + ListSubscriptionItemsResponse getSubscriptionItems( final String subscriptionId, - final String itemId, final Integer page, final Integer size, + final String name, final String code, - final String group, - final LocalDateTime usedSince, - final LocalDateTime usedUntil) throws ApiException, IOException; + final String status, + final String description, + final String createdSince, + final String createdUntil) throws ApiException, IOException; /** - * @param subscriptionId Required parameter: Example: - * @param request Required parameter: Request for updating the end date of the current - * signature cycle + * Updates the payment method from a subscription. + * @param subscriptionId Required parameter: Subscription id + * @param request Required parameter: Request for updating the paymentmethod from a + * subscription * @param idempotencyKey Optional parameter: Example: * @return Returns the GetSubscriptionResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - GetSubscriptionResponse updateLatestPeriodEndAt( + GetSubscriptionResponse updateSubscriptionPaymentMethod( final String subscriptionId, - final UpdateCurrentCycleEndDateRequest request, + final UpdateSubscriptionPaymentMethodRequest request, final String idempotencyKey) throws ApiException, IOException; /** - * Deletes a discount. - * @param subscriptionId Required parameter: Subscription id - * @param discountId Required parameter: Discount Id - * @param idempotencyKey Optional parameter: Example: - * @return Returns the GetDiscountResponse response from the API call + * Get Subscription Item. + * @param subscriptionId Required parameter: Subscription Id + * @param itemId Required parameter: Item id + * @return Returns the GetSubscriptionItemResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - GetDiscountResponse deleteDiscount( + GetSubscriptionItemResponse getSubscriptionItem( final String subscriptionId, - final String discountId, - final String idempotencyKey) throws ApiException, IOException; + final String itemId) throws ApiException, IOException; /** - * Updates the payment method from a subscription. - * @param subscriptionId Required parameter: Subscription id - * @param request Required parameter: Request for updating the paymentmethod from a - * subscription - * @param idempotencyKey Optional parameter: Example: - * @return Returns the GetSubscriptionResponse response from the API call + * Gets all subscriptions. + * @param page Optional parameter: Page number + * @param size Optional parameter: Page size + * @param code Optional parameter: Filter for subscription's code + * @param billingType Optional parameter: Filter for subscription's billing type + * @param customerId Optional parameter: Filter for subscription's customer id + * @param planId Optional parameter: Filter for subscription's plan id + * @param cardId Optional parameter: Filter for subscription's card id + * @param status Optional parameter: Filter for subscription's status + * @param nextBillingSince Optional parameter: Filter for subscription's next billing date + * start range + * @param nextBillingUntil Optional parameter: Filter for subscription's next billing date end + * range + * @param createdSince Optional parameter: Filter for subscription's creation date start range + * @param createdUntil Optional parameter: Filter for subscriptions creation date end range + * @return Returns the ListSubscriptionsResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - GetSubscriptionResponse updateSubscriptionPaymentMethod( - final String subscriptionId, - final UpdateSubscriptionPaymentMethodRequest request, - final String idempotencyKey) throws ApiException, IOException; + ListSubscriptionsResponse getSubscriptions( + final Integer page, + final Integer size, + final String code, + final String billingType, + final String customerId, + final String planId, + final String cardId, + final String status, + final LocalDateTime nextBillingSince, + final LocalDateTime nextBillingUntil, + final LocalDateTime createdSince, + final LocalDateTime createdUntil) throws ApiException, IOException; /** * Cancels a subscription. @@ -194,170 +244,176 @@ GetSubscriptionResponse cancelSubscription( final String idempotencyKey) throws ApiException, IOException; /** - * Creates a new subscription. - * @param body Required parameter: Request for creating a subscription + * Creates a increment. + * @param subscriptionId Required parameter: Subscription id + * @param request Required parameter: Request for creating a increment * @param idempotencyKey Optional parameter: Example: - * @return Returns the GetSubscriptionResponse response from the API call + * @return Returns the GetIncrementResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - GetSubscriptionResponse createSubscription( - final CreateSubscriptionRequest body, + GetIncrementResponse createIncrement( + final String subscriptionId, + final CreateIncrementRequest request, final String idempotencyKey) throws ApiException, IOException; /** - * @param subscriptionId Required parameter: Example: - * @param request Required parameter: Request for updating a subscription affiliation id + * Creates a usage. + * @param subscriptionId Required parameter: Subscription Id + * @param itemId Required parameter: Item id + * @param body Required parameter: Request for creating a usage * @param idempotencyKey Optional parameter: Example: - * @return Returns the GetSubscriptionResponse response from the API call + * @return Returns the GetUsageResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - GetSubscriptionResponse updateSubscriptionAffiliationId( + GetUsageResponse createUsage( final String subscriptionId, - final UpdateSubscriptionAffiliationIdRequest request, + final String itemId, + final CreateUsageRequest body, final String idempotencyKey) throws ApiException, IOException; /** - * Atualização do valor mínimo da assinatura. - * @param subscriptionId Required parameter: Subscription Id - * @param request Required parameter: Request da requisição com o valor mínimo que será - * configurado - * @param idempotencyKey Optional parameter: Example: - * @return Returns the GetSubscriptionResponse response from the API call + * @param subscriptionId Required parameter: The subscription id + * @param discountId Required parameter: Example: + * @return Returns the GetDiscountResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - GetSubscriptionResponse updateSubscriptionMiniumPrice( + GetDiscountResponse getDiscountById( final String subscriptionId, - final UpdateSubscriptionMinimumPriceRequest request, - final String idempotencyKey) throws ApiException, IOException; + final String discountId) throws ApiException, IOException; /** - * @param subscriptionId Required parameter: The subscription id - * @param cycleId Required parameter: Example: - * @return Returns the GetPeriodResponse response from the API call + * Creates a new subscription. + * @param body Required parameter: Request for creating a subscription + * @param idempotencyKey Optional parameter: Example: + * @return Returns the GetSubscriptionResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - GetPeriodResponse getSubscriptionCycleById( - final String subscriptionId, - final String cycleId) throws ApiException, IOException; + GetSubscriptionResponse createSubscription( + final CreateSubscriptionRequest body, + final String idempotencyKey) throws ApiException, IOException; /** * @param subscriptionId Required parameter: The subscription Id - * @param periodId Required parameter: The period Id - * @return Returns the GetUsageReportResponse response from the API call + * @param incrementId Required parameter: The increment Id + * @return Returns the GetIncrementResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - GetUsageReportResponse getUsageReport( + GetIncrementResponse getIncrementById( final String subscriptionId, - final String periodId) throws ApiException, IOException; + final String incrementId) throws ApiException, IOException; /** * @param subscriptionId Required parameter: Example: + * @param request Required parameter: Request for updating a subscription affiliation id * @param idempotencyKey Optional parameter: Example: - * @return Returns the GetPeriodResponse response from the API call + * @return Returns the GetSubscriptionResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - GetPeriodResponse renewSubscription( + GetSubscriptionResponse updateSubscriptionAffiliationId( final String subscriptionId, + final UpdateSubscriptionAffiliationIdRequest request, final String idempotencyKey) throws ApiException, IOException; /** - * Deletes a usage. + * Updates the metadata from a subscription. * @param subscriptionId Required parameter: The subscription id - * @param itemId Required parameter: The subscription item id - * @param usageId Required parameter: The usage id + * @param request Required parameter: Request for updating the subscrption metadata * @param idempotencyKey Optional parameter: Example: - * @return Returns the GetUsageResponse response from the API call + * @return Returns the GetSubscriptionResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - GetUsageResponse deleteUsage( + GetSubscriptionResponse updateSubscriptionMetadata( final String subscriptionId, - final String itemId, - final String usageId, + final UpdateMetadataRequest request, final String idempotencyKey) throws ApiException, IOException; /** - * Create Usage. + * Deletes a increment. * @param subscriptionId Required parameter: Subscription id - * @param itemId Required parameter: Item id + * @param incrementId Required parameter: Increment id * @param idempotencyKey Optional parameter: Example: - * @return Returns the GetUsageResponse response from the API call + * @return Returns the GetIncrementResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - GetUsageResponse createAnUsage( + GetIncrementResponse deleteIncrement( final String subscriptionId, - final String itemId, + final String incrementId, final String idempotencyKey) throws ApiException, IOException; /** * @param subscriptionId Required parameter: Subscription Id - * @param request Required parameter: Request for updating the end date of the subscription - * current status - * @param idempotencyKey Optional parameter: Example: + * @param page Required parameter: Page number + * @param size Required parameter: Page size + * @return Returns the ListCyclesResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - void updateCurrentCycleStatus( + ListCyclesResponse getSubscriptionCycles( final String subscriptionId, - final UpdateCurrentCycleStatusRequest request, - final String idempotencyKey) throws ApiException, IOException; + final String page, + final String size) throws ApiException, IOException; /** - * Get Subscription Item. - * @param subscriptionId Required parameter: Subscription Id - * @param itemId Required parameter: Item id - * @return Returns the GetSubscriptionItemResponse response from the API call + * @param subscriptionId Required parameter: The subscription id + * @param page Required parameter: Page number + * @param size Required parameter: Page size + * @return Returns the ListDiscountsResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - GetSubscriptionItemResponse getSubscriptionItem( + ListDiscountsResponse getDiscounts( final String subscriptionId, - final String itemId) throws ApiException, IOException; + final int page, + final int size) throws ApiException, IOException; /** - * @param subscriptionId Required parameter: The subscription Id - * @param incrementId Required parameter: The increment Id - * @return Returns the GetIncrementResponse response from the API call + * Updates the billing date from a subscription. + * @param subscriptionId Required parameter: The subscription id + * @param request Required parameter: Request for updating the subscription billing date + * @param idempotencyKey Optional parameter: Example: + * @return Returns the GetSubscriptionResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - GetIncrementResponse getIncrementById( + GetSubscriptionResponse updateSubscriptionBillingDate( final String subscriptionId, - final String incrementId) throws ApiException, IOException; + final UpdateSubscriptionBillingDateRequest request, + final String idempotencyKey) throws ApiException, IOException; /** - * Deletes a increment. + * Deletes a subscription item. * @param subscriptionId Required parameter: Subscription id - * @param incrementId Required parameter: Increment id + * @param subscriptionItemId Required parameter: Subscription item id * @param idempotencyKey Optional parameter: Example: - * @return Returns the GetIncrementResponse response from the API call + * @return Returns the GetSubscriptionItemResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - GetIncrementResponse deleteIncrement( + GetSubscriptionItemResponse deleteSubscriptionItem( final String subscriptionId, - final String incrementId, + final String subscriptionItemId, final String idempotencyKey) throws ApiException, IOException; /** * @param subscriptionId Required parameter: The subscription id - * @param page Required parameter: Page number - * @param size Required parameter: Page size - * @return Returns the ListDiscountsResponse response from the API call + * @param page Optional parameter: Page number + * @param size Optional parameter: Page size + * @return Returns the ListIncrementsResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - ListDiscountsResponse getDiscounts( + ListIncrementsResponse getIncrements( final String subscriptionId, - final int page, - final int size) throws ApiException, IOException; + final Integer page, + final Integer size) throws ApiException, IOException; /** * Updates the boleto due days from a subscription. @@ -374,199 +430,143 @@ GetSubscriptionResponse updateSubscriptionDueDays( final String idempotencyKey) throws ApiException, IOException; /** - * Creates a new Subscription item. - * @param subscriptionId Required parameter: Subscription id - * @param request Required parameter: Request for creating a subscription item + * Updates the start at date from a subscription. + * @param subscriptionId Required parameter: The subscription id + * @param request Required parameter: Request for updating the subscription start date * @param idempotencyKey Optional parameter: Example: - * @return Returns the GetSubscriptionItemResponse response from the API call + * @return Returns the GetSubscriptionResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - GetSubscriptionItemResponse createSubscriptionItem( + GetSubscriptionResponse updateSubscriptionStartAt( final String subscriptionId, - final CreateSubscriptionItemRequest request, + final UpdateSubscriptionStartAtRequest request, final String idempotencyKey) throws ApiException, IOException; /** - * @param id Required parameter: Subscription's id - * @param request Required parameter: Example: - * @return Returns the GetSubscriptionResponse response from the API call - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - GetSubscriptionResponse updateSplitSubscription( - final String id, - final UpdateSubscriptionSplitRequest request) throws ApiException, IOException; - - /** - * Get Subscription Items. - * @param subscriptionId Required parameter: The subscription id - * @param page Optional parameter: Page number - * @param size Optional parameter: Page size - * @param name Optional parameter: The item name - * @param code Optional parameter: Identification code in the client system - * @param status Optional parameter: The item statis - * @param description Optional parameter: The item description - * @param createdSince Optional parameter: Filter for item's creation date start range - * @param createdUntil Optional parameter: Filter for item's creation date end range - * @return Returns the ListSubscriptionItemsResponse response from the API call + * Updates a subscription item. + * @param subscriptionId Required parameter: Subscription Id + * @param itemId Required parameter: Item id + * @param body Required parameter: Request for updating a subscription item + * @param idempotencyKey Optional parameter: Example: + * @return Returns the GetSubscriptionItemResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - ListSubscriptionItemsResponse getSubscriptionItems( + GetSubscriptionItemResponse updateSubscriptionItem( final String subscriptionId, - final Integer page, - final Integer size, - final String name, - final String code, - final String status, - final String description, - final String createdSince, - final String createdUntil) throws ApiException, IOException; - - /** - * Gets all subscriptions. - * @param page Optional parameter: Page number - * @param size Optional parameter: Page size - * @param code Optional parameter: Filter for subscription's code - * @param billingType Optional parameter: Filter for subscription's billing type - * @param customerId Optional parameter: Filter for subscription's customer id - * @param planId Optional parameter: Filter for subscription's plan id - * @param cardId Optional parameter: Filter for subscription's card id - * @param status Optional parameter: Filter for subscription's status - * @param nextBillingSince Optional parameter: Filter for subscription's next billing date - * start range - * @param nextBillingUntil Optional parameter: Filter for subscription's next billing date end - * range - * @param createdSince Optional parameter: Filter for subscription's creation date start range - * @param createdUntil Optional parameter: Filter for subscriptions creation date end range - * @return Returns the ListSubscriptionsResponse response from the API call - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - ListSubscriptionsResponse getSubscriptions( - final Integer page, - final Integer size, - final String code, - final String billingType, - final String customerId, - final String planId, - final String cardId, - final String status, - final LocalDateTime nextBillingSince, - final LocalDateTime nextBillingUntil, - final LocalDateTime createdSince, - final LocalDateTime createdUntil) throws ApiException, IOException; + final String itemId, + final UpdateSubscriptionItemRequest body, + final String idempotencyKey) throws ApiException, IOException; /** - * Creates a increment. + * Creates a new Subscription item. * @param subscriptionId Required parameter: Subscription id - * @param request Required parameter: Request for creating a increment + * @param request Required parameter: Request for creating a subscription item * @param idempotencyKey Optional parameter: Example: - * @return Returns the GetIncrementResponse response from the API call + * @return Returns the GetSubscriptionItemResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - GetIncrementResponse createIncrement( + GetSubscriptionItemResponse createSubscriptionItem( final String subscriptionId, - final CreateIncrementRequest request, + final CreateSubscriptionItemRequest request, final String idempotencyKey) throws ApiException, IOException; /** - * Creates a usage. - * @param subscriptionId Required parameter: Subscription Id - * @param itemId Required parameter: Item id - * @param body Required parameter: Request for creating a usage - * @param idempotencyKey Optional parameter: Example: - * @return Returns the GetUsageResponse response from the API call + * Gets a subscription. + * @param subscriptionId Required parameter: Subscription id + * @return Returns the GetSubscriptionResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - GetUsageResponse createUsage( - final String subscriptionId, - final String itemId, - final CreateUsageRequest body, - final String idempotencyKey) throws ApiException, IOException; + GetSubscriptionResponse getSubscription( + final String subscriptionId) throws ApiException, IOException; /** + * Lists all usages from a subscription item. * @param subscriptionId Required parameter: The subscription id - * @param discountId Required parameter: Example: - * @return Returns the GetDiscountResponse response from the API call + * @param itemId Required parameter: The subscription item id + * @param page Optional parameter: Page number + * @param size Optional parameter: Page size + * @param code Optional parameter: Identification code in the client system + * @param group Optional parameter: Identification group in the client system + * @param usedSince Optional parameter: Example: + * @param usedUntil Optional parameter: Example: + * @return Returns the ListUsagesResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - GetDiscountResponse getDiscountById( + ListUsagesResponse getUsages( final String subscriptionId, - final String discountId) throws ApiException, IOException; + final String itemId, + final Integer page, + final Integer size, + final String code, + final String group, + final LocalDateTime usedSince, + final LocalDateTime usedUntil) throws ApiException, IOException; /** - * Updates the metadata from a subscription. - * @param subscriptionId Required parameter: The subscription id - * @param request Required parameter: Request for updating the subscrption metadata + * @param subscriptionId Required parameter: Example: + * @param request Required parameter: Request for updating the end date of the current + * signature cycle * @param idempotencyKey Optional parameter: Example: * @return Returns the GetSubscriptionResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - GetSubscriptionResponse updateSubscriptionMetadata( + GetSubscriptionResponse updateLatestPeriodEndAt( final String subscriptionId, - final UpdateMetadataRequest request, + final UpdateCurrentCycleEndDateRequest request, final String idempotencyKey) throws ApiException, IOException; /** + * Atualização do valor mínimo da assinatura. * @param subscriptionId Required parameter: Subscription Id - * @param page Required parameter: Page number - * @param size Required parameter: Page size - * @return Returns the ListCyclesResponse response from the API call + * @param request Required parameter: Request da requisição com o valor mínimo que será + * configurado + * @param idempotencyKey Optional parameter: Example: + * @return Returns the GetSubscriptionResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - ListCyclesResponse getSubscriptionCycles( + GetSubscriptionResponse updateSubscriptionMiniumPrice( final String subscriptionId, - final String page, - final String size) throws ApiException, IOException; + final UpdateSubscriptionMinimumPriceRequest request, + final String idempotencyKey) throws ApiException, IOException; /** - * Deletes a subscription item. - * @param subscriptionId Required parameter: Subscription id - * @param subscriptionItemId Required parameter: Subscription item id - * @param idempotencyKey Optional parameter: Example: - * @return Returns the GetSubscriptionItemResponse response from the API call + * @param subscriptionId Required parameter: The subscription id + * @param cycleId Required parameter: Example: + * @return Returns the GetPeriodResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - GetSubscriptionItemResponse deleteSubscriptionItem( + GetPeriodResponse getSubscriptionCycleById( final String subscriptionId, - final String subscriptionItemId, - final String idempotencyKey) throws ApiException, IOException; + final String cycleId) throws ApiException, IOException; /** - * @param subscriptionId Required parameter: The subscription id - * @param page Optional parameter: Page number - * @param size Optional parameter: Page size - * @return Returns the ListIncrementsResponse response from the API call + * @param subscriptionId Required parameter: The subscription Id + * @param periodId Required parameter: The period Id + * @return Returns the GetUsageReportResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - ListIncrementsResponse getIncrements( + GetUsageReportResponse getUsageReport( final String subscriptionId, - final Integer page, - final Integer size) throws ApiException, IOException; + final String periodId) throws ApiException, IOException; /** - * Updates a subscription item. - * @param subscriptionId Required parameter: Subscription Id - * @param itemId Required parameter: Item id - * @param body Required parameter: Request for updating a subscription item - * @param idempotencyKey Optional parameter: Example: - * @return Returns the GetSubscriptionItemResponse response from the API call + * @param id Required parameter: Subscription's id + * @param request Required parameter: Example: + * @return Returns the GetSubscriptionResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - GetSubscriptionItemResponse updateSubscriptionItem( - final String subscriptionId, - final String itemId, - final UpdateSubscriptionItemRequest body, - final String idempotencyKey) throws ApiException, IOException; + GetSubscriptionResponse updateSplitSubscription( + final String id, + final UpdateSubscriptionSplitRequest request) throws ApiException, IOException; } \ No newline at end of file diff --git a/src/main/java/me/pagar/api/controllers/TokensController.java b/src/main/java/me/pagar/api/controllers/TokensController.java index f0161b7..bf4967f 100644 --- a/src/main/java/me/pagar/api/controllers/TokensController.java +++ b/src/main/java/me/pagar/api/controllers/TokensController.java @@ -17,28 +17,28 @@ */ public interface TokensController { /** - * Gets a token from its id. - * @param id Required parameter: Token id * @param publicKey Required parameter: Public key + * @param request Required parameter: Request for creating a token + * @param idempotencyKey Optional parameter: Example: * @return Returns the GetTokenResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - GetTokenResponse getToken( - final String id, - final String publicKey) throws ApiException, IOException; + GetTokenResponse createToken( + final String publicKey, + final CreateTokenRequest request, + final String idempotencyKey) throws ApiException, IOException; /** + * Gets a token from its id. + * @param id Required parameter: Token id * @param publicKey Required parameter: Public key - * @param request Required parameter: Request for creating a token - * @param idempotencyKey Optional parameter: Example: * @return Returns the GetTokenResponse response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - GetTokenResponse createToken( - final String publicKey, - final CreateTokenRequest request, - final String idempotencyKey) throws ApiException, IOException; + GetTokenResponse getToken( + final String id, + final String publicKey) throws ApiException, IOException; } \ No newline at end of file diff --git a/src/main/java/me/pagar/api/controllers/TransfersController.java b/src/main/java/me/pagar/api/controllers/TransfersController.java index 9ecec8e..99989c7 100644 --- a/src/main/java/me/pagar/api/controllers/TransfersController.java +++ b/src/main/java/me/pagar/api/controllers/TransfersController.java @@ -27,20 +27,20 @@ GetTransfer getTransferById( final String transferId) throws ApiException, IOException; /** - * Gets all transfers. - * @return Returns the ListTransfers response from the API call + * @param request Required parameter: Example: + * @return Returns the GetTransfer response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - ListTransfers getTransfers() throws ApiException, IOException; + GetTransfer createTransfer( + final CreateTransfer request) throws ApiException, IOException; /** - * @param request Required parameter: Example: - * @return Returns the GetTransfer response from the API call + * Gets all transfers. + * @return Returns the ListTransfers response from the API call * @throws ApiException Represents error response from the server. * @throws IOException Signals that an I/O exception of some sort has occurred. */ - GetTransfer createTransfer( - final CreateTransfer request) throws ApiException, IOException; + ListTransfers getTransfers() throws ApiException, IOException; } \ No newline at end of file diff --git a/src/main/java/me/pagar/api/http/request/HttpRequest.java b/src/main/java/me/pagar/api/http/request/HttpRequest.java index 0ed8b86..fa41084 100644 --- a/src/main/java/me/pagar/api/http/request/HttpRequest.java +++ b/src/main/java/me/pagar/api/http/request/HttpRequest.java @@ -137,16 +137,25 @@ public String toString() { + ", parameters=" + parameters + "]"; } + /** + * Get the request URL + * + * @param arraySerializationFormat Array serialization format + * @return The complete URL including serialized query parameters + */ @Override public String getUrl(ArraySerializationFormat arraySerializationFormat) { - StringBuilder urlBuilder = new StringBuilder(getQueryUrl()); - - // set query parameters - ApiHelper.appendUrlWithQueryParameters(urlBuilder, getQueryParameters(), - arraySerializationFormat); - - // validate and preprocess url - return ApiHelper.cleanUrl(urlBuilder); + return getQueryUrl(); + } + + /** + * Get the request URL without query parameters + * + * @return The complete URL excluding query parameters + */ + @Override + public String getUrl() { + return ApiHelper.removeQueryParametersFromUrl(getQueryUrl()); } } diff --git a/src/main/java/me/pagar/api/models/CreateKYCLinkResponse.java b/src/main/java/me/pagar/api/models/CreateKYCLinkResponse.java new file mode 100644 index 0000000..c96832b --- /dev/null +++ b/src/main/java/me/pagar/api/models/CreateKYCLinkResponse.java @@ -0,0 +1,273 @@ +/* + * PagarmeApiSDKLib + * + * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). + */ + +package me.pagar.api.models; + +import com.fasterxml.jackson.annotation.JsonGetter; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import io.apimatic.core.types.OptionalNullable; + +/** + * This is a model class for CreateKYCLinkResponse type. + */ +public class CreateKYCLinkResponse { + private OptionalNullable base64; + private OptionalNullable url; + private OptionalNullable expirationDate; + + /** + * Default constructor. + */ + public CreateKYCLinkResponse() { + } + + /** + * Initialization constructor. + * @param base64 String value for base64. + * @param url String value for url. + * @param expirationDate String value for expirationDate. + */ + public CreateKYCLinkResponse( + String base64, + String url, + String expirationDate) { + this.base64 = OptionalNullable.of(base64); + this.url = OptionalNullable.of(url); + this.expirationDate = OptionalNullable.of(expirationDate); + } + + /** + * Initialization constructor. + * @param base64 String value for base64. + * @param url String value for url. + * @param expirationDate String value for expirationDate. + */ + + protected CreateKYCLinkResponse(OptionalNullable base64, OptionalNullable url, + OptionalNullable expirationDate) { + this.base64 = base64; + this.url = url; + this.expirationDate = expirationDate; + } + + /** + * Internal Getter for Base64. + * Base64 + * @return Returns the Internal String + */ + @JsonGetter("base64") + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonSerialize(using = OptionalNullable.Serializer.class) + protected OptionalNullable internalGetBase64() { + return this.base64; + } + + /** + * Getter for Base64. + * Base64 + * @return Returns the String + */ + public String getBase64() { + return OptionalNullable.getFrom(base64); + } + + /** + * Setter for Base64. + * Base64 + * @param base64 Value for String + */ + @JsonSetter("base64") + public void setBase64(String base64) { + this.base64 = OptionalNullable.of(base64); + } + + /** + * UnSetter for Base64. + * Base64 + */ + public void unsetBase64() { + base64 = null; + } + + /** + * Internal Getter for Url. + * URL + * @return Returns the Internal String + */ + @JsonGetter("url") + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonSerialize(using = OptionalNullable.Serializer.class) + protected OptionalNullable internalGetUrl() { + return this.url; + } + + /** + * Getter for Url. + * URL + * @return Returns the String + */ + public String getUrl() { + return OptionalNullable.getFrom(url); + } + + /** + * Setter for Url. + * URL + * @param url Value for String + */ + @JsonSetter("url") + public void setUrl(String url) { + this.url = OptionalNullable.of(url); + } + + /** + * UnSetter for Url. + * URL + */ + public void unsetUrl() { + url = null; + } + + /** + * Internal Getter for ExpirationDate. + * Expiration Date + * @return Returns the Internal String + */ + @JsonGetter("expiration_date") + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonSerialize(using = OptionalNullable.Serializer.class) + protected OptionalNullable internalGetExpirationDate() { + return this.expirationDate; + } + + /** + * Getter for ExpirationDate. + * Expiration Date + * @return Returns the String + */ + public String getExpirationDate() { + return OptionalNullable.getFrom(expirationDate); + } + + /** + * Setter for ExpirationDate. + * Expiration Date + * @param expirationDate Value for String + */ + @JsonSetter("expiration_date") + public void setExpirationDate(String expirationDate) { + this.expirationDate = OptionalNullable.of(expirationDate); + } + + /** + * UnSetter for ExpirationDate. + * Expiration Date + */ + public void unsetExpirationDate() { + expirationDate = null; + } + + /** + * Converts this CreateKYCLinkResponse into string format. + * @return String representation of this class + */ + @Override + public String toString() { + return "CreateKYCLinkResponse [" + "base64=" + base64 + ", url=" + url + ", expirationDate=" + + expirationDate + "]"; + } + + /** + * Builds a new {@link CreateKYCLinkResponse.Builder} object. + * Creates the instance with the state of the current model. + * @return a new {@link CreateKYCLinkResponse.Builder} object + */ + public Builder toBuilder() { + Builder builder = new Builder(); + builder.base64 = internalGetBase64(); + builder.url = internalGetUrl(); + builder.expirationDate = internalGetExpirationDate(); + return builder; + } + + /** + * Class to build instances of {@link CreateKYCLinkResponse}. + */ + public static class Builder { + private OptionalNullable base64; + private OptionalNullable url; + private OptionalNullable expirationDate; + + + + /** + * Setter for base64. + * @param base64 String value for base64. + * @return Builder + */ + public Builder base64(String base64) { + this.base64 = OptionalNullable.of(base64); + return this; + } + + /** + * UnSetter for base64. + * @return Builder + */ + public Builder unsetBase64() { + base64 = null; + return this; + } + + /** + * Setter for url. + * @param url String value for url. + * @return Builder + */ + public Builder url(String url) { + this.url = OptionalNullable.of(url); + return this; + } + + /** + * UnSetter for url. + * @return Builder + */ + public Builder unsetUrl() { + url = null; + return this; + } + + /** + * Setter for expirationDate. + * @param expirationDate String value for expirationDate. + * @return Builder + */ + public Builder expirationDate(String expirationDate) { + this.expirationDate = OptionalNullable.of(expirationDate); + return this; + } + + /** + * UnSetter for expirationDate. + * @return Builder + */ + public Builder unsetExpirationDate() { + expirationDate = null; + return this; + } + + /** + * Builds a new {@link CreateKYCLinkResponse} object using the set fields. + * @return {@link CreateKYCLinkResponse} + */ + public CreateKYCLinkResponse build() { + return new CreateKYCLinkResponse(base64, url, expirationDate); + } + } +} diff --git a/src/main/java/me/pagar/api/models/GetMovementObjectBaseResponse.java b/src/main/java/me/pagar/api/models/GetMovementObjectBaseResponse.java index 1ee38be..f635c1b 100644 --- a/src/main/java/me/pagar/api/models/GetMovementObjectBaseResponse.java +++ b/src/main/java/me/pagar/api/models/GetMovementObjectBaseResponse.java @@ -26,9 +26,9 @@ defaultImpl = GetMovementObjectBaseResponse.class, visible = true) @JsonSubTypes({ + @Type(value = GetMovementObjectRefundResponse.class, name = "refund"), @Type(value = GetMovementObjectFeeCollectionResponse.class, name = "feeCollection"), @Type(value = GetMovementObjectPayableResponse.class, name = "payable"), - @Type(value = GetMovementObjectRefundResponse.class, name = "refund"), @Type(value = GetMovementObjectTransferResponse.class, name = "transfer"), @Type(value = GetMovementObjectSettlementResponse.class, name = "settlement") }) diff --git a/src/main/java/me/pagar/api/models/GetTransactionResponse.java b/src/main/java/me/pagar/api/models/GetTransactionResponse.java index 15c2d93..0ac2619 100644 --- a/src/main/java/me/pagar/api/models/GetTransactionResponse.java +++ b/src/main/java/me/pagar/api/models/GetTransactionResponse.java @@ -31,13 +31,13 @@ defaultImpl = GetTransactionResponse.class, visible = true) @JsonSubTypes({ + @Type(value = GetBankTransferTransactionResponse.class, name = "bank_transfer"), @Type(value = GetSafetyPayTransactionResponse.class, name = "safetypay"), @Type(value = GetVoucherTransactionResponse.class, name = "voucher"), - @Type(value = GetBankTransferTransactionResponse.class, name = "bank_transfer"), @Type(value = GetBoletoTransactionResponse.class, name = "boleto"), @Type(value = GetDebitCardTransactionResponse.class, name = "debit_card"), - @Type(value = GetCashTransactionResponse.class, name = "cash"), @Type(value = GetPrivateLabelTransactionResponse.class, name = "private_label"), + @Type(value = GetCashTransactionResponse.class, name = "cash"), @Type(value = GetCreditCardTransactionResponse.class, name = "credit_card"), @Type(value = GetPixTransactionResponse.class, name = "pix") })