From f43d8291bb09d74ded6424edfe0e0cdb876624a4 Mon Sep 17 00:00:00 2001 From: andreals Date: Thu, 9 Nov 2023 19:01:30 +0000 Subject: [PATCH 1/4] Automated commit message --- README.md | 44 +++---- .../get-credit-card-transaction-response.md | 1 + .../get-debit-card-transaction-response.md | 1 + ...-retry-transaction-information-response.md | 27 +++++ ...etCreditCardTransactionResponseBuilder.php | 19 +++ ...GetDebitCardTransactionResponseBuilder.php | 19 +++ ...yTransactionInformationResponseBuilder.php | 75 ++++++++++++ .../GetCreditCardTransactionResponse.php | 40 +++++++ .../GetDebitCardTransactionResponse.php | 40 +++++++ ...GetRetryTransactionInformationResponse.php | 109 ++++++++++++++++++ src/PagarmeApiSDKClient.php | 2 +- 11 files changed, 354 insertions(+), 23 deletions(-) create mode 100644 doc/models/get-retry-transaction-information-response.md create mode 100644 src/Models/Builders/GetRetryTransactionInformationResponseBuilder.php create mode 100644 src/Models/GetRetryTransactionInformationResponse.php diff --git a/README.md b/README.md index a0f053e..52ac9b5 100644 --- a/README.md +++ b/README.md @@ -99,7 +99,7 @@ To run your project, right click on your PHP file inside your Test project and c ## Initialize the API Client -**_Note:_** Documentation for the client can be found [here.](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.1/doc/client.md) +**_Note:_** Documentation for the client can be found [here.](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.2/doc/client.md) The following parameters are configurable for the API Client: @@ -138,31 +138,31 @@ Here is the list of errors that the API might throw. | HTTP Status Code | Error Description | Exception Class | | --- | --- | --- | -| 400 | Invalid request | [`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.1/doc/models/error-exception.md) | -| 401 | Invalid API key | [`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.1/doc/models/error-exception.md) | -| 404 | An informed resource was not found | [`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.1/doc/models/error-exception.md) | -| 412 | Business validation error | [`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.1/doc/models/error-exception.md) | -| 422 | Contract validation error | [`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.1/doc/models/error-exception.md) | -| 500 | Internal server error | [`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.1/doc/models/error-exception.md) | +| 400 | Invalid request | [`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.2/doc/models/error-exception.md) | +| 401 | Invalid API key | [`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.2/doc/models/error-exception.md) | +| 404 | An informed resource was not found | [`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.2/doc/models/error-exception.md) | +| 412 | Business validation error | [`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.2/doc/models/error-exception.md) | +| 422 | Contract validation error | [`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.2/doc/models/error-exception.md) | +| 500 | Internal server error | [`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.2/doc/models/error-exception.md) | ## List of APIs -* [Subscriptions](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.1/doc/controllers/subscriptions.md) -* [Orders](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.1/doc/controllers/orders.md) -* [Plans](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.1/doc/controllers/plans.md) -* [Invoices](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.1/doc/controllers/invoices.md) -* [Customers](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.1/doc/controllers/customers.md) -* [Charges](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.1/doc/controllers/charges.md) -* [Recipients](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.1/doc/controllers/recipients.md) -* [Tokens](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.1/doc/controllers/tokens.md) -* [Transactions](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.1/doc/controllers/transactions.md) -* [Transfers](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.1/doc/controllers/transfers.md) -* [Payables](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.1/doc/controllers/payables.md) -* [Balance Operations](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.1/doc/controllers/balance-operations.md) +* [Subscriptions](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.2/doc/controllers/subscriptions.md) +* [Orders](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.2/doc/controllers/orders.md) +* [Plans](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.2/doc/controllers/plans.md) +* [Invoices](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.2/doc/controllers/invoices.md) +* [Customers](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.2/doc/controllers/customers.md) +* [Charges](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.2/doc/controllers/charges.md) +* [Recipients](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.2/doc/controllers/recipients.md) +* [Tokens](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.2/doc/controllers/tokens.md) +* [Transactions](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.2/doc/controllers/transactions.md) +* [Transfers](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.2/doc/controllers/transfers.md) +* [Payables](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.2/doc/controllers/payables.md) +* [Balance Operations](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.2/doc/controllers/balance-operations.md) ## Classes Documentation -* [ApiException](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.1/doc/api-exception.md) -* [HttpRequest](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.1/doc/http-request.md) -* [HttpResponse](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.1/doc/http-response.md) +* [ApiException](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.2/doc/api-exception.md) +* [HttpRequest](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.2/doc/http-request.md) +* [HttpResponse](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.2/doc/http-response.md) diff --git a/doc/models/get-credit-card-transaction-response.md b/doc/models/get-credit-card-transaction-response.md index a445c68..8143e41 100644 --- a/doc/models/get-credit-card-transaction-response.md +++ b/doc/models/get-credit-card-transaction-response.md @@ -28,6 +28,7 @@ Response object for getting a credit card transaction | `installments` | `?int` | Optional | Number of installments | getInstallments(): ?int | setInstallments(?int installments): void | | `threedAuthenticationUrl` | `?string` | Optional | 3D-S authentication Url | getThreedAuthenticationUrl(): ?string | setThreedAuthenticationUrl(?string threedAuthenticationUrl): void | | `fundingSource` | `?string` | Optional | Identify when a card is prepaid, credit or debit. | getFundingSource(): ?string | setFundingSource(?string fundingSource): void | +| `retryInfo` | [`?GetRetryTransactionInformationResponse`](../../doc/models/get-retry-transaction-information-response.md) | Optional | Retry transaction information | getRetryInfo(): ?GetRetryTransactionInformationResponse | setRetryInfo(?GetRetryTransactionInformationResponse retryInfo): void | ## Example (as JSON) diff --git a/doc/models/get-debit-card-transaction-response.md b/doc/models/get-debit-card-transaction-response.md index 4cb5695..30c2616 100644 --- a/doc/models/get-debit-card-transaction-response.md +++ b/doc/models/get-debit-card-transaction-response.md @@ -30,6 +30,7 @@ Response object for getting a debit card transaction | `authenticationType` | `?string` | Optional | Authentication type | getAuthenticationType(): ?string | setAuthenticationType(?string authenticationType): void | | `threedAuthenticationUrl` | `?string` | Optional | 3D-S Authentication Url | getThreedAuthenticationUrl(): ?string | setThreedAuthenticationUrl(?string threedAuthenticationUrl): void | | `fundingSource` | `?string` | Optional | Identify when a card is prepaid, credit or debit. | getFundingSource(): ?string | setFundingSource(?string fundingSource): void | +| `retryInfo` | [`?GetRetryTransactionInformationResponse`](../../doc/models/get-retry-transaction-information-response.md) | Optional | Retry transaction information | getRetryInfo(): ?GetRetryTransactionInformationResponse | setRetryInfo(?GetRetryTransactionInformationResponse retryInfo): void | ## Example (as JSON) diff --git a/doc/models/get-retry-transaction-information-response.md b/doc/models/get-retry-transaction-information-response.md new file mode 100644 index 0000000..df1e8fd --- /dev/null +++ b/doc/models/get-retry-transaction-information-response.md @@ -0,0 +1,27 @@ + +# Get Retry Transaction Information Response + +Response object for getting an RetryTransactionInformation + +## Structure + +`GetRetryTransactionInformationResponse` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `brandFailureReturnCode` | `?string` | Required | - | getBrandFailureReturnCode(): ?string | setBrandFailureReturnCode(?string brandFailureReturnCode): void | +| `transactionLimit` | `?int` | Required | - | getTransactionLimit(): ?int | setTransactionLimit(?int transactionLimit): void | +| `transactionDateLimit` | `?DateTime` | Required | - | getTransactionDateLimit(): ?\DateTime | setTransactionDateLimit(?\DateTime transactionDateLimit): void | + +## Example (as JSON) + +```json +{ + "brand_failure_return_code": "brand_failure_return_code2", + "transaction_limit": 44, + "transaction_date_limit": "2016-03-13T12:52:32.123Z" +} +``` + diff --git a/src/Models/Builders/GetCreditCardTransactionResponseBuilder.php b/src/Models/Builders/GetCreditCardTransactionResponseBuilder.php index 2062450..c7ab8bf 100644 --- a/src/Models/Builders/GetCreditCardTransactionResponseBuilder.php +++ b/src/Models/Builders/GetCreditCardTransactionResponseBuilder.php @@ -17,6 +17,7 @@ use PagarmeApiSDKLib\Models\GetFineResponse; use PagarmeApiSDKLib\Models\GetGatewayResponseResponse; use PagarmeApiSDKLib\Models\GetInterestResponse; +use PagarmeApiSDKLib\Models\GetRetryTransactionInformationResponse; /** * Builder for model GetCreditCardTransactionResponse @@ -583,6 +584,24 @@ public function unsetFundingSource(): self return $this; } + /** + * Sets retry info field. + */ + public function retryInfo(?GetRetryTransactionInformationResponse $value): self + { + $this->instance->setRetryInfo($value); + return $this; + } + + /** + * Unsets retry info field. + */ + public function unsetRetryInfo(): self + { + $this->instance->unsetRetryInfo(); + return $this; + } + /** * Initializes a new get credit card transaction response object. */ diff --git a/src/Models/Builders/GetDebitCardTransactionResponseBuilder.php b/src/Models/Builders/GetDebitCardTransactionResponseBuilder.php index 47bdf27..ce88391 100644 --- a/src/Models/Builders/GetDebitCardTransactionResponseBuilder.php +++ b/src/Models/Builders/GetDebitCardTransactionResponseBuilder.php @@ -17,6 +17,7 @@ use PagarmeApiSDKLib\Models\GetFineResponse; use PagarmeApiSDKLib\Models\GetGatewayResponseResponse; use PagarmeApiSDKLib\Models\GetInterestResponse; +use PagarmeApiSDKLib\Models\GetRetryTransactionInformationResponse; /** * Builder for model GetDebitCardTransactionResponse @@ -646,6 +647,24 @@ public function unsetFundingSource(): self return $this; } + /** + * Sets retry info field. + */ + public function retryInfo(?GetRetryTransactionInformationResponse $value): self + { + $this->instance->setRetryInfo($value); + return $this; + } + + /** + * Unsets retry info field. + */ + public function unsetRetryInfo(): self + { + $this->instance->unsetRetryInfo(); + return $this; + } + /** * Initializes a new get debit card transaction response object. */ diff --git a/src/Models/Builders/GetRetryTransactionInformationResponseBuilder.php b/src/Models/Builders/GetRetryTransactionInformationResponseBuilder.php new file mode 100644 index 0000000..f93d006 --- /dev/null +++ b/src/Models/Builders/GetRetryTransactionInformationResponseBuilder.php @@ -0,0 +1,75 @@ +instance = $instance; + } + + /** + * Initializes a new get retry transaction information response Builder object. + */ + public static function init(): self + { + return new self(new GetRetryTransactionInformationResponse()); + } + + /** + * Sets brand failure return code field. + */ + public function brandFailureReturnCode(?string $value): self + { + $this->instance->setBrandFailureReturnCode($value); + return $this; + } + + /** + * Sets transaction limit field. + */ + public function transactionLimit(?int $value): self + { + $this->instance->setTransactionLimit($value); + return $this; + } + + /** + * Sets transaction date limit field. + */ + public function transactionDateLimit(?\DateTime $value): self + { + $this->instance->setTransactionDateLimit($value); + return $this; + } + + /** + * Initializes a new get retry transaction information response object. + */ + public function build(): GetRetryTransactionInformationResponse + { + return CoreHelper::clone($this->instance); + } +} diff --git a/src/Models/GetCreditCardTransactionResponse.php b/src/Models/GetCreditCardTransactionResponse.php index 198c8af..9de827e 100644 --- a/src/Models/GetCreditCardTransactionResponse.php +++ b/src/Models/GetCreditCardTransactionResponse.php @@ -85,6 +85,11 @@ class GetCreditCardTransactionResponse extends GetTransactionResponse implements */ private $fundingSource = []; + /** + * @var array + */ + private $retryInfo = []; + /** * Returns Statement Descriptor. * Text that will appear on the credit card's statement @@ -465,6 +470,38 @@ public function unsetFundingSource(): void $this->fundingSource = []; } + /** + * Returns Retry Info. + * Retry transaction information + */ + public function getRetryInfo(): ?GetRetryTransactionInformationResponse + { + if (count($this->retryInfo) == 0) { + return null; + } + return $this->retryInfo['value']; + } + + /** + * Sets Retry Info. + * Retry transaction information + * + * @maps retry_info + */ + public function setRetryInfo(?GetRetryTransactionInformationResponse $retryInfo): void + { + $this->retryInfo['value'] = $retryInfo; + } + + /** + * Unsets Retry Info. + * Retry transaction information + */ + public function unsetRetryInfo(): void + { + $this->retryInfo = []; + } + /** * Encode this object to JSON * @@ -516,6 +553,9 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) if (!empty($this->fundingSource)) { $json['funding_source'] = $this->fundingSource['value']; } + if (!empty($this->retryInfo)) { + $json['retry_info'] = $this->retryInfo['value']; + } $json = array_merge($json, parent::jsonSerialize(true)); $json['transaction_type'] = $this->getTransactionType() ?? 'credit_card'; diff --git a/src/Models/GetDebitCardTransactionResponse.php b/src/Models/GetDebitCardTransactionResponse.php index 49a7fd8..5d478c5 100644 --- a/src/Models/GetDebitCardTransactionResponse.php +++ b/src/Models/GetDebitCardTransactionResponse.php @@ -95,6 +95,11 @@ class GetDebitCardTransactionResponse extends GetTransactionResponse implements */ private $fundingSource = []; + /** + * @var array + */ + private $retryInfo = []; + /** * Returns Statement Descriptor. * Text that will appear on the debit card's statement @@ -575,6 +580,38 @@ public function unsetFundingSource(): void $this->fundingSource = []; } + /** + * Returns Retry Info. + * Retry transaction information + */ + public function getRetryInfo(): ?GetRetryTransactionInformationResponse + { + if (count($this->retryInfo) == 0) { + return null; + } + return $this->retryInfo['value']; + } + + /** + * Sets Retry Info. + * Retry transaction information + * + * @maps retry_info + */ + public function setRetryInfo(?GetRetryTransactionInformationResponse $retryInfo): void + { + $this->retryInfo['value'] = $retryInfo; + } + + /** + * Unsets Retry Info. + * Retry transaction information + */ + public function unsetRetryInfo(): void + { + $this->retryInfo = []; + } + /** * Encode this object to JSON * @@ -632,6 +669,9 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) if (!empty($this->fundingSource)) { $json['funding_source'] = $this->fundingSource['value']; } + if (!empty($this->retryInfo)) { + $json['retry_info'] = $this->retryInfo['value']; + } $json = array_merge($json, parent::jsonSerialize(true)); $json['transaction_type'] = $this->getTransactionType() ?? 'debit_card'; diff --git a/src/Models/GetRetryTransactionInformationResponse.php b/src/Models/GetRetryTransactionInformationResponse.php new file mode 100644 index 0000000..3b2f604 --- /dev/null +++ b/src/Models/GetRetryTransactionInformationResponse.php @@ -0,0 +1,109 @@ +brandFailureReturnCode; + } + + /** + * Sets Brand Failure Return Code. + * + * @maps brand_failure_return_code + */ + public function setBrandFailureReturnCode(?string $brandFailureReturnCode): void + { + $this->brandFailureReturnCode = $brandFailureReturnCode; + } + + /** + * Returns Transaction Limit. + */ + public function getTransactionLimit(): ?int + { + return $this->transactionLimit; + } + + /** + * Sets Transaction Limit. + * + * @maps transaction_limit + */ + public function setTransactionLimit(?int $transactionLimit): void + { + $this->transactionLimit = $transactionLimit; + } + + /** + * Returns Transaction Date Limit. + */ + public function getTransactionDateLimit(): ?\DateTime + { + return $this->transactionDateLimit; + } + + /** + * Sets Transaction Date Limit. + * + * @maps transaction_date_limit + * @factory \PagarmeApiSDKLib\Utils\DateTimeHelper::fromRfc3339DateTime + */ + public function setTransactionDateLimit(?\DateTime $transactionDateLimit): void + { + $this->transactionDateLimit = $transactionDateLimit; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + $json['brand_failure_return_code'] = $this->brandFailureReturnCode; + $json['transaction_limit'] = $this->transactionLimit; + $json['transaction_date_limit'] = DateTimeHelper::toRfc3339DateTime($this->transactionDateLimit); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/PagarmeApiSDKClient.php b/src/PagarmeApiSDKClient.php index d67b8a2..51ff8dd 100644 --- a/src/PagarmeApiSDKClient.php +++ b/src/PagarmeApiSDKClient.php @@ -80,7 +80,7 @@ public function __construct(array $config = []) ->converter(new CompatibilityConverter()) ->jsonHelper(ApiHelper::getJsonHelper()) ->apiCallback($this->config['httpCallback'] ?? null) - ->userAgent('PagarmeApiSDK - PHP 6.8.1') + ->userAgent('PagarmeApiSDK - PHP 6.8.2') ->globalConfig($this->getGlobalConfiguration()) ->globalErrors($this->getGlobalErrors()) ->serverUrls(self::ENVIRONMENT_MAP[$this->getEnvironment()], Server::DEFAULT_) From af62bc2a6fa955a3dcfca35a72d40fa4fb6bf425 Mon Sep 17 00:00:00 2001 From: andreals Date: Mon, 5 Feb 2024 13:18:15 +0000 Subject: [PATCH 2/4] Automated commit message --- LICENSE | 2 +- README.md | 44 +- doc/controllers/charges.md | 278 ++-- doc/controllers/customers.md | 388 +++--- doc/controllers/invoices.md | 182 +-- doc/controllers/orders.md | 170 +-- doc/controllers/plans.md | 310 ++--- doc/controllers/recipients.md | 431 +++--- doc/controllers/subscriptions.md | 1220 ++++++++--------- doc/controllers/transfers.md | 40 +- doc/models/create-managing-partner-request.md | 56 + doc/models/create-recipient-request.md | 26 +- ...te-register-information-address-request.md | 37 + ...reate-register-information-base-request.md | 37 + ...egister-information-corporation-request.md | 87 ++ ...register-information-individual-request.md | 60 + ...eate-register-information-phone-request.md | 27 + doc/models/get-balance-operation-response.md | 2 +- doc/models/get-managing-partner-response.md | 37 + doc/models/get-phone-number-response.md | 27 + doc/models/get-recipient-response.md | 1 + ...t-register-information-address-response.md | 34 + .../get-register-information-response.md | 56 + doc/models/get-transaction-response.md | 19 +- .../list-charge-transactions-response.md | 38 +- doc/models/list-transactions-response.md | 57 +- src/ApiHelper.php | 14 +- src/Controllers/ChargesController.php | 254 ++-- src/Controllers/CustomersController.php | 314 ++--- src/Controllers/InvoicesController.php | 154 +-- src/Controllers/OrdersController.php | 136 +- src/Controllers/PlansController.php | 152 +- src/Controllers/RecipientsController.php | 336 ++--- src/Controllers/SubscriptionsController.php | 860 ++++++------ src/Controllers/TransfersController.php | 32 +- src/Exceptions/ApiException.php | 3 +- .../CreateManagingPartnerRequestBuilder.php | 70 + .../CreateRecipientRequestBuilder.php | 126 +- ...gisterInformationAddressRequestBuilder.php | 65 + ...eRegisterInformationBaseRequestBuilder.php | 66 + ...erInformationCorporationRequestBuilder.php | 140 ++ ...terInformationIndividualRequestBuilder.php | 104 ++ ...RegisterInformationPhoneRequestBuilder.php | 48 + .../GetBalanceOperationResponseBuilder.php | 2 +- .../GetManagingPartnerResponseBuilder.php | 238 ++++ .../GetPhoneNumberResponseBuilder.php | 102 ++ .../Builders/GetRecipientResponseBuilder.php | 19 + ...isterInformationAddressResponseBuilder.php | 192 +++ .../GetRegisterInformationResponseBuilder.php | 391 ++++++ src/Models/CreateManagingPartnerRequest.php | 325 +++++ src/Models/CreateRecipientRequest.php | 226 ++- ...reateRegisterInformationAddressRequest.php | 265 ++++ .../CreateRegisterInformationBaseRequest.php | 192 +++ ...eRegisterInformationCorporationRequest.php | 303 ++++ ...teRegisterInformationIndividualRequest.php | 225 +++ .../CreateRegisterInformationPhoneRequest.php | 122 ++ src/Models/GetBalanceOperationResponse.php | 4 +- src/Models/GetManagingPartnerResponse.php | 435 ++++++ src/Models/GetPhoneNumberResponse.php | 146 ++ src/Models/GetRecipientResponse.php | 37 + .../GetRegisterInformationAddressResponse.php | 331 +++++ src/Models/GetRegisterInformationResponse.php | 746 ++++++++++ src/PagarmeApiSDKClient.php | 2 +- 63 files changed, 7995 insertions(+), 2848 deletions(-) create mode 100644 doc/models/create-managing-partner-request.md create mode 100644 doc/models/create-register-information-address-request.md create mode 100644 doc/models/create-register-information-base-request.md create mode 100644 doc/models/create-register-information-corporation-request.md create mode 100644 doc/models/create-register-information-individual-request.md create mode 100644 doc/models/create-register-information-phone-request.md create mode 100644 doc/models/get-managing-partner-response.md create mode 100644 doc/models/get-phone-number-response.md create mode 100644 doc/models/get-register-information-address-response.md create mode 100644 doc/models/get-register-information-response.md create mode 100644 src/Models/Builders/CreateManagingPartnerRequestBuilder.php create mode 100644 src/Models/Builders/CreateRegisterInformationAddressRequestBuilder.php create mode 100644 src/Models/Builders/CreateRegisterInformationBaseRequestBuilder.php create mode 100644 src/Models/Builders/CreateRegisterInformationCorporationRequestBuilder.php create mode 100644 src/Models/Builders/CreateRegisterInformationIndividualRequestBuilder.php create mode 100644 src/Models/Builders/CreateRegisterInformationPhoneRequestBuilder.php create mode 100644 src/Models/Builders/GetManagingPartnerResponseBuilder.php create mode 100644 src/Models/Builders/GetPhoneNumberResponseBuilder.php create mode 100644 src/Models/Builders/GetRegisterInformationAddressResponseBuilder.php create mode 100644 src/Models/Builders/GetRegisterInformationResponseBuilder.php create mode 100644 src/Models/CreateManagingPartnerRequest.php create mode 100644 src/Models/CreateRegisterInformationAddressRequest.php create mode 100644 src/Models/CreateRegisterInformationBaseRequest.php create mode 100644 src/Models/CreateRegisterInformationCorporationRequest.php create mode 100644 src/Models/CreateRegisterInformationIndividualRequest.php create mode 100644 src/Models/CreateRegisterInformationPhoneRequest.php create mode 100644 src/Models/GetManagingPartnerResponse.php create mode 100644 src/Models/GetPhoneNumberResponse.php create mode 100644 src/Models/GetRegisterInformationAddressResponse.php create mode 100644 src/Models/GetRegisterInformationResponse.php diff --git a/LICENSE b/LICENSE index 9712589..b9181f7 100644 --- a/LICENSE +++ b/LICENSE @@ -3,7 +3,7 @@ License: The MIT License (MIT) http://opensource.org/licenses/MIT -Copyright (c) 2014 - 2023 APIMATIC Limited +Copyright (c) 2014 - 2024 APIMATIC Limited Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 52ac9b5..6a92e7c 100644 --- a/README.md +++ b/README.md @@ -99,7 +99,7 @@ To run your project, right click on your PHP file inside your Test project and c ## Initialize the API Client -**_Note:_** Documentation for the client can be found [here.](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.2/doc/client.md) +**_Note:_** Documentation for the client can be found [here.](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.3/doc/client.md) The following parameters are configurable for the API Client: @@ -138,31 +138,31 @@ Here is the list of errors that the API might throw. | HTTP Status Code | Error Description | Exception Class | | --- | --- | --- | -| 400 | Invalid request | [`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.2/doc/models/error-exception.md) | -| 401 | Invalid API key | [`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.2/doc/models/error-exception.md) | -| 404 | An informed resource was not found | [`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.2/doc/models/error-exception.md) | -| 412 | Business validation error | [`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.2/doc/models/error-exception.md) | -| 422 | Contract validation error | [`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.2/doc/models/error-exception.md) | -| 500 | Internal server error | [`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.2/doc/models/error-exception.md) | +| 400 | Invalid request | [`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.3/doc/models/error-exception.md) | +| 401 | Invalid API key | [`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.3/doc/models/error-exception.md) | +| 404 | An informed resource was not found | [`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.3/doc/models/error-exception.md) | +| 412 | Business validation error | [`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.3/doc/models/error-exception.md) | +| 422 | Contract validation error | [`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.3/doc/models/error-exception.md) | +| 500 | Internal server error | [`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.3/doc/models/error-exception.md) | ## List of APIs -* [Subscriptions](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.2/doc/controllers/subscriptions.md) -* [Orders](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.2/doc/controllers/orders.md) -* [Plans](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.2/doc/controllers/plans.md) -* [Invoices](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.2/doc/controllers/invoices.md) -* [Customers](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.2/doc/controllers/customers.md) -* [Charges](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.2/doc/controllers/charges.md) -* [Recipients](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.2/doc/controllers/recipients.md) -* [Tokens](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.2/doc/controllers/tokens.md) -* [Transactions](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.2/doc/controllers/transactions.md) -* [Transfers](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.2/doc/controllers/transfers.md) -* [Payables](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.2/doc/controllers/payables.md) -* [Balance Operations](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.2/doc/controllers/balance-operations.md) +* [Subscriptions](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.3/doc/controllers/subscriptions.md) +* [Orders](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.3/doc/controllers/orders.md) +* [Plans](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.3/doc/controllers/plans.md) +* [Invoices](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.3/doc/controllers/invoices.md) +* [Customers](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.3/doc/controllers/customers.md) +* [Charges](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.3/doc/controllers/charges.md) +* [Recipients](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.3/doc/controllers/recipients.md) +* [Tokens](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.3/doc/controllers/tokens.md) +* [Transactions](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.3/doc/controllers/transactions.md) +* [Transfers](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.3/doc/controllers/transfers.md) +* [Payables](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.3/doc/controllers/payables.md) +* [Balance Operations](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.3/doc/controllers/balance-operations.md) ## Classes Documentation -* [ApiException](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.2/doc/api-exception.md) -* [HttpRequest](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.2/doc/http-request.md) -* [HttpResponse](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.2/doc/http-response.md) +* [ApiException](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.3/doc/api-exception.md) +* [HttpRequest](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.3/doc/http-request.md) +* [HttpResponse](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.3/doc/http-response.md) diff --git a/doc/controllers/charges.md b/doc/controllers/charges.md index 525cdd3..d0529df 100644 --- a/doc/controllers/charges.md +++ b/doc/controllers/charges.md @@ -12,17 +12,17 @@ $chargesController = $client->getChargesController(); * [Update Charge Metadata](../../doc/controllers/charges.md#update-charge-metadata) * [Update Charge Payment Method](../../doc/controllers/charges.md#update-charge-payment-method) +* [Update Charge Card](../../doc/controllers/charges.md#update-charge-card) +* [Get Charges Summary](../../doc/controllers/charges.md#get-charges-summary) +* [Create Charge](../../doc/controllers/charges.md#create-charge) * [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) * [Cancel Charge](../../doc/controllers/charges.md#cancel-charge) -* [Create Charge](../../doc/controllers/charges.md#create-charge) +* [Get Charges](../../doc/controllers/charges.md#get-charges) * [Confirm Payment](../../doc/controllers/charges.md#confirm-payment) +* [Update Charge Due Date](../../doc/controllers/charges.md#update-charge-due-date) +* [Retry Charge](../../doc/controllers/charges.md#retry-charge) # Update Charge Metadata @@ -148,159 +148,155 @@ $result = $chargesController->updateChargePaymentMethod( ``` -# Get Charge Transactions +# Update Charge Card + +Updates the card from a charge ```php -function getChargeTransactions( +function updateChargeCard( string $chargeId, - ?int $page = null, - ?int $size = null -): ListChargeTransactionsResponse + UpdateChargeCardRequest $request, + ?string $idempotencyKey = null +): GetChargeResponse ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `chargeId` | `string` | Template, Required | Charge Id | -| `page` | `?int` | Query, Optional | Page number | -| `size` | `?int` | Query, Optional | Page size | +| `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 -[`ListChargeTransactionsResponse`](../../doc/models/list-charge-transactions-response.md) +[`GetChargeResponse`](../../doc/models/get-charge-response.md) ## Example Usage ```php $chargeId = 'charge_id8'; -$result = $chargesController->getChargeTransactions($chargeId); -``` +$request = UpdateChargeCardRequestBuilder::init( + false, + 'card_id2', + CreateCardRequestBuilder::init() + ->type('credit') + ->build(), + false +)->build(); +$result = $chargesController->updateChargeCard( + $chargeId, + $request +); +``` -# Update Charge Due Date -Updates the due date from a charge +# Get Charges Summary ```php -function updateChargeDueDate( - string $chargeId, - UpdateChargeDueDateRequest $request, - ?string $idempotencyKey = null -): GetChargeResponse +function getChargesSummary( + string $status, + ?\DateTime $createdSince = null, + ?\DateTime $createdUntil = null +): GetChargesSummaryResponse ``` ## 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` | `?DateTime` | Query, Optional | - | +| `createdUntil` | `?DateTime` | Query, Optional | - | ## Response Type -[`GetChargeResponse`](../../doc/models/get-charge-response.md) +[`GetChargesSummaryResponse`](../../doc/models/get-charges-summary-response.md) ## Example Usage ```php -$chargeId = 'charge_id8'; - -$request = UpdateChargeDueDateRequestBuilder::init()->build(); +$status = 'status8'; -$result = $chargesController->updateChargeDueDate( - $chargeId, - $request -); +$result = $chargesController->getChargesSummary($status); ``` -# Get Charges +# Create Charge -Lists all charges +Creates a new charge ```php -function getCharges( - ?int $page = null, - ?int $size = null, - ?string $code = null, - ?string $status = null, - ?string $paymentMethod = null, - ?string $customerId = null, - ?string $orderId = null, - ?\DateTime $createdSince = null, - ?\DateTime $createdUntil = null -): ListChargesResponse +function createCharge(CreateChargeRequest $request, ?string $idempotencyKey = null): GetChargeResponse ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `page` | `?int` | Query, Optional | Page number | -| `size` | `?int` | 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` | `?DateTime` | Query, Optional | Filter for the beginning of the range for charge's creation | -| `createdUntil` | `?DateTime` | 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 ```php -$result = $chargesController->getCharges(); -``` +$request = CreateChargeRequestBuilder::init( + 242, + CreatePaymentRequestBuilder::init( + 'payment_method4' + )->build(), + 'order_id0' +)->build(); +$result = $chargesController->createCharge($request); +``` -# Capture Charge -Captures a charge +# Get Charge Transactions ```php -function captureCharge( +function getChargeTransactions( string $chargeId, - ?CreateCaptureChargeRequest $request = null, - ?string $idempotencyKey = null -): GetChargeResponse + ?int $page = null, + ?int $size = null +): ListChargeTransactionsResponse ``` ## Parameters | 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 | -| `idempotencyKey` | `?string` | Header, Optional | - | +| `chargeId` | `string` | Template, Required | Charge Id | +| `page` | `?int` | Query, Optional | Page number | +| `size` | `?int` | Query, Optional | Page size | ## Response Type -[`GetChargeResponse`](../../doc/models/get-charge-response.md) +[`ListChargeTransactionsResponse`](../../doc/models/list-charge-transactions-response.md) ## Example Usage ```php $chargeId = 'charge_id8'; -$result = $chargesController->captureCharge($chargeId); +$result = $chargesController->getChargeTransactions($chargeId); ``` -# Update Charge Card +# Capture Charge -Updates the card from a charge +Captures a charge ```php -function updateChargeCard( +function captureCharge( string $chargeId, - UpdateChargeCardRequest $request, + ?CreateCaptureChargeRequest $request = null, ?string $idempotencyKey = null ): GetChargeResponse ``` @@ -310,7 +306,7 @@ function 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 @@ -322,19 +318,7 @@ function updateChargeCard( ```php $chargeId = 'charge_id8'; -$request = UpdateChargeCardRequestBuilder::init( - false, - 'card_id2', - CreateCardRequestBuilder::init() - ->type('credit') - ->build(), - false -)->build(); - -$result = $chargesController->updateChargeCard( - $chargeId, - $request -); +$result = $chargesController->captureCharge($chargeId); ``` @@ -365,73 +349,88 @@ $result = $chargesController->getCharge($chargeId); ``` -# Get Charges Summary +# Cancel Charge + +Cancel a charge ```php -function getChargesSummary( - string $status, - ?\DateTime $createdSince = null, - ?\DateTime $createdUntil = null -): GetChargesSummaryResponse +function cancelCharge( + string $chargeId, + ?CreateCancelChargeRequest $request = null, + ?string $idempotencyKey = null +): GetChargeResponse ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `status` | `string` | Query, Required | - | -| `createdSince` | `?DateTime` | Query, Optional | - | -| `createdUntil` | `?DateTime` | Query, Optional | - | +| `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 -[`GetChargesSummaryResponse`](../../doc/models/get-charges-summary-response.md) +[`GetChargeResponse`](../../doc/models/get-charge-response.md) ## Example Usage ```php -$status = 'status8'; +$chargeId = 'charge_id8'; -$result = $chargesController->getChargesSummary($status); +$result = $chargesController->cancelCharge($chargeId); ``` -# Retry Charge +# Get Charges -Retries a charge +Lists all charges ```php -function retryCharge(string $chargeId, ?string $idempotencyKey = null): GetChargeResponse +function getCharges( + ?int $page = null, + ?int $size = null, + ?string $code = null, + ?string $status = null, + ?string $paymentMethod = null, + ?string $customerId = null, + ?string $orderId = null, + ?\DateTime $createdSince = null, + ?\DateTime $createdUntil = null +): ListChargesResponse ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `chargeId` | `string` | Template, Required | Charge id | -| `idempotencyKey` | `?string` | Header, Optional | - | +| `page` | `?int` | Query, Optional | Page number | +| `size` | `?int` | 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` | `?DateTime` | Query, Optional | Filter for the beginning of the range for charge's creation | +| `createdUntil` | `?DateTime` | Query, Optional | Filter for the end of the range for charge's creation | ## Response Type -[`GetChargeResponse`](../../doc/models/get-charge-response.md) +[`ListChargesResponse`](../../doc/models/list-charges-response.md) ## Example Usage ```php -$chargeId = 'charge_id8'; - -$result = $chargesController->retryCharge($chargeId); +$result = $chargesController->getCharges(); ``` -# Cancel Charge - -Cancel a charge +# Confirm Payment ```php -function cancelCharge( +function confirmPayment( string $chargeId, - ?CreateCancelChargeRequest $request = null, + ?CreateConfirmPaymentRequest $request = null, ?string $idempotencyKey = null ): GetChargeResponse ``` @@ -440,8 +439,8 @@ function 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 @@ -453,23 +452,28 @@ function cancelCharge( ```php $chargeId = 'charge_id8'; -$result = $chargesController->cancelCharge($chargeId); +$result = $chargesController->confirmPayment($chargeId); ``` -# Create Charge +# Update Charge Due Date -Creates a new charge +Updates the due date from a charge ```php -function createCharge(CreateChargeRequest $request, ?string $idempotencyKey = null): GetChargeResponse +function updateChargeDueDate( + string $chargeId, + UpdateChargeDueDateRequest $request, + ?string $idempotencyKey = null +): GetChargeResponse ``` ## Parameters | 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` | [`UpdateChargeDueDateRequest`](../../doc/models/update-charge-due-date-request.md) | Body, Required | Request for updating the due date | | `idempotencyKey` | `?string` | Header, Optional | - | ## Response Type @@ -479,34 +483,30 @@ function createCharge(CreateChargeRequest $request, ?string $idempotencyKey = nu ## Example Usage ```php -$request = CreateChargeRequestBuilder::init( - 242, - CreatePaymentRequestBuilder::init( - 'payment_method4' - )->build(), - 'order_id0' -)->build(); +$chargeId = 'charge_id8'; -$result = $chargesController->createCharge($request); +$request = UpdateChargeDueDateRequestBuilder::init()->build(); + +$result = $chargesController->updateChargeDueDate( + $chargeId, + $request +); ``` -# Confirm Payment +# Retry Charge + +Retries a charge ```php -function confirmPayment( - string $chargeId, - ?CreateConfirmPaymentRequest $request = null, - ?string $idempotencyKey = null -): GetChargeResponse +function retryCharge(string $chargeId, ?string $idempotencyKey = null): GetChargeResponse ``` ## Parameters | 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 | | `idempotencyKey` | `?string` | Header, Optional | - | ## Response Type @@ -518,6 +518,6 @@ function confirmPayment( ```php $chargeId = 'charge_id8'; -$result = $chargesController->confirmPayment($chargeId); +$result = $chargesController->retryCharge($chargeId); ``` diff --git a/doc/controllers/customers.md b/doc/controllers/customers.md index 999461d..25d6651 100644 --- a/doc/controllers/customers.md +++ b/doc/controllers/customers.md @@ -13,24 +13,24 @@ $customersController = $client->getCustomersController(); * [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) -* [Get Address](../../doc/controllers/customers.md#get-address) -* [Delete Address](../../doc/controllers/customers.md#delete-address) +* [Create Customer](../../doc/controllers/customers.md#create-customer) * [Create Card](../../doc/controllers/customers.md#create-card) -* [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 Address](../../doc/controllers/customers.md#get-address) +* [Delete Address](../../doc/controllers/customers.md#delete-address) * [Get Access Token](../../doc/controllers/customers.md#get-access-token) * [Update Customer Metadata](../../doc/controllers/customers.md#update-customer-metadata) +* [Get Card](../../doc/controllers/customers.md#get-card) +* [Delete Access Tokens](../../doc/controllers/customers.md#delete-access-tokens) +* [Create Access Token](../../doc/controllers/customers.md#create-access-token) +* [Get Access Tokens](../../doc/controllers/customers.md#get-access-tokens) +* [Get Customers](../../doc/controllers/customers.md#get-customers) +* [Update Customer](../../doc/controllers/customers.md#update-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) # Update Card @@ -184,6 +184,55 @@ $result = $customersController->deleteAccessToken( ``` +# Create Address + +Creates a new address for a customer + +```php +function createAddress( + string $customerId, + CreateAddressRequest $request, + ?string $idempotencyKey = null +): GetAddressResponse +``` + +## Parameters + +| 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 + +[`GetAddressResponse`](../../doc/models/get-address-response.md) + +## Example Usage + +```php +$customerId = 'customer_id8'; + +$request = CreateAddressRequestBuilder::init( + 'street6', + 'number4', + 'zip_code0', + 'neighborhood2', + 'city6', + 'state2', + 'country0', + 'complement2', + 'line_10', + 'line_24' +)->build(); + +$result = $customersController->createAddress( + $customerId, + $request +); +``` + + # Create Customer Creates a new customer @@ -236,61 +285,52 @@ $result = $customersController->createCustomer($request); ``` -# Create Address +# Create Card -Creates a new address for a customer +Creates a new card for a customer ```php -function createAddress( +function createCard( string $customerId, - CreateAddressRequest $request, + CreateCardRequest $request, ?string $idempotencyKey = null -): GetAddressResponse +): GetCardResponse ``` ## Parameters | 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 | +| `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 -[`GetAddressResponse`](../../doc/models/get-address-response.md) +[`GetCardResponse`](../../doc/models/get-card-response.md) ## Example Usage ```php $customerId = 'customer_id8'; -$request = CreateAddressRequestBuilder::init( - 'street6', - 'number4', - 'zip_code0', - 'neighborhood2', - 'city6', - 'state2', - 'country0', - 'complement2', - 'line_10', - 'line_24' -)->build(); +$request = CreateCardRequestBuilder::init() + ->type('credit') + ->build(); -$result = $customersController->createAddress( +$result = $customersController->createCard( $customerId, $request ); ``` -# Delete Access Tokens +# Get Cards -Delete a Customer's access tokens +Get all cards from a customer ```php -function deleteAccessTokens(string $customerId): ListAccessTokensResponse +function getCards(string $customerId, ?int $page = null, ?int $size = null): ListCardsResponse ``` ## Parameters @@ -298,26 +338,28 @@ function deleteAccessTokens(string $customerId): ListAccessTokensResponse | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `customerId` | `string` | Template, Required | Customer Id | +| `page` | `?int` | Query, Optional | Page number | +| `size` | `?int` | Query, Optional | Page size | ## Response Type -[`ListAccessTokensResponse`](../../doc/models/list-access-tokens-response.md) +[`ListCardsResponse`](../../doc/models/list-cards-response.md) ## Example Usage ```php $customerId = 'customer_id8'; -$result = $customersController->deleteAccessTokens($customerId); +$result = $customersController->getCards($customerId); ``` -# Get Address +# Renew Card -Get a customer's address +Renew a card ```php -function getAddress(string $customerId, string $addressId): GetAddressResponse +function renewCard(string $customerId, string $cardId, ?string $idempotencyKey = null): GetCardResponse ``` ## Parameters @@ -325,45 +367,41 @@ function getAddress(string $customerId, string $addressId): GetAddressResponse | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `customerId` | `string` | Template, Required | Customer id | -| `addressId` | `string` | Template, Required | Address Id | +| `cardId` | `string` | Template, Required | Card Id | +| `idempotencyKey` | `?string` | Header, Optional | - | ## Response Type -[`GetAddressResponse`](../../doc/models/get-address-response.md) +[`GetCardResponse`](../../doc/models/get-card-response.md) ## Example Usage ```php $customerId = 'customer_id8'; -$addressId = 'address_id0'; +$cardId = 'card_id4'; -$result = $customersController->getAddress( +$result = $customersController->renewCard( $customerId, - $addressId + $cardId ); ``` -# Delete Address +# Get Address -Delete a Customer's address +Get a customer's address ```php -function deleteAddress( - string $customerId, - string $addressId, - ?string $idempotencyKey = null -): GetAddressResponse +function getAddress(string $customerId, string $addressId): GetAddressResponse ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `customerId` | `string` | Template, Required | Customer Id | +| `customerId` | `string` | Template, Required | Customer id | | `addressId` | `string` | Template, Required | Address Id | -| `idempotencyKey` | `?string` | Header, Optional | - | ## Response Type @@ -376,107 +414,92 @@ $customerId = 'customer_id8'; $addressId = 'address_id0'; -$result = $customersController->deleteAddress( +$result = $customersController->getAddress( $customerId, $addressId ); ``` -# Create Card +# Delete Address -Creates a new card for a customer +Delete a Customer's address ```php -function createCard( +function deleteAddress( string $customerId, - CreateCardRequest $request, + string $addressId, ?string $idempotencyKey = null -): GetCardResponse +): GetAddressResponse ``` ## 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 | +| `customerId` | `string` | Template, Required | Customer Id | +| `addressId` | `string` | Template, Required | Address Id | | `idempotencyKey` | `?string` | Header, Optional | - | ## Response Type -[`GetCardResponse`](../../doc/models/get-card-response.md) +[`GetAddressResponse`](../../doc/models/get-address-response.md) ## Example Usage ```php $customerId = 'customer_id8'; -$request = CreateCardRequestBuilder::init() - ->type('credit') - ->build(); +$addressId = 'address_id0'; -$result = $customersController->createCard( +$result = $customersController->deleteAddress( $customerId, - $request + $addressId ); ``` -# Get Customers +# Get Access Token -Get all Customers +Get a Customer's access token ```php -function getCustomers( - ?string $name = null, - ?string $document = null, - ?int $page = 1, - ?int $size = 10, - ?string $email = null, - ?string $code = null -): ListCustomersResponse +function getAccessToken(string $customerId, string $tokenId): GetAccessTokenResponse ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `name` | `?string` | Query, Optional | Name of the Customer | -| `document` | `?string` | Query, Optional | Document of the Customer | -| `page` | `?int` | Query, Optional | Current page the the search
**Default**: `1` | -| `size` | `?int` | Query, Optional | Quantity pages of the search
**Default**: `10` | -| `email` | `?string` | Query, Optional | Customer's email | -| `code` | `?string` | Query, Optional | Customer's code | +| `customerId` | `string` | Template, Required | Customer Id | +| `tokenId` | `string` | Template, Required | Token Id | ## Response Type -[`ListCustomersResponse`](../../doc/models/list-customers-response.md) +[`GetAccessTokenResponse`](../../doc/models/get-access-token-response.md) ## Example Usage ```php -$page = 1; +$customerId = 'customer_id8'; -$size = 10; +$tokenId = 'token_id6'; -$result = $customersController->getCustomers( - null, - null, - $page, - $size +$result = $customersController->getAccessToken( + $customerId, + $tokenId ); ``` -# Update Customer +# Update Customer Metadata -Updates a customer +Updates the metadata a customer ```php -function updateCustomer( +function updateCustomerMetadata( string $customerId, - UpdateCustomerRequest $request, + UpdateMetadataRequest $request, ?string $idempotencyKey = null ): GetCustomerResponse ``` @@ -485,8 +508,8 @@ function updateCustomer( | 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 | +| `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 @@ -498,59 +521,58 @@ function updateCustomer( ```php $customerId = 'customer_id8'; -$request = UpdateCustomerRequestBuilder::init()->build(); +$request = UpdateMetadataRequestBuilder::init( + [ + 'key0' => 'metadata3' + ] +)->build(); -$result = $customersController->updateCustomer( +$result = $customersController->updateCustomerMetadata( $customerId, $request ); ``` -# Create Access Token +# Get Card -Creates a access token for a customer +Get a customer's card ```php -function createAccessToken( - string $customerId, - CreateAccessTokenRequest $request, - ?string $idempotencyKey = null -): GetAccessTokenResponse +function getCard(string $customerId, string $cardId): GetCardResponse ``` ## Parameters | 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 | -| `idempotencyKey` | `?string` | Header, Optional | - | +| `customerId` | `string` | Template, Required | Customer id | +| `cardId` | `string` | Template, Required | Card id | ## Response Type -[`GetAccessTokenResponse`](../../doc/models/get-access-token-response.md) +[`GetCardResponse`](../../doc/models/get-card-response.md) ## Example Usage ```php $customerId = 'customer_id8'; -$request = CreateAccessTokenRequestBuilder::init()->build(); +$cardId = 'card_id4'; -$result = $customersController->createAccessToken( +$result = $customersController->getCard( $customerId, - $request + $cardId ); ``` -# Get Access Tokens +# Delete Access Tokens -Get all access tokens from a customer +Delete a Customer's access tokens ```php -function getAccessTokens(string $customerId, ?int $page = null, ?int $size = null): ListAccessTokensResponse +function deleteAccessTokens(string $customerId): ListAccessTokensResponse ``` ## Parameters @@ -558,8 +580,6 @@ function getAccessTokens(string $customerId, ?int $page = null, ?int $size = nul | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `customerId` | `string` | Template, Required | Customer Id | -| `page` | `?int` | Query, Optional | Page number | -| `size` | `?int` | Query, Optional | Page size | ## Response Type @@ -570,16 +590,20 @@ function getAccessTokens(string $customerId, ?int $page = null, ?int $size = nul ```php $customerId = 'customer_id8'; -$result = $customersController->getAccessTokens($customerId); +$result = $customersController->deleteAccessTokens($customerId); ``` -# Get Cards +# Create Access Token -Get all cards from a customer +Creates a access token for a customer ```php -function getCards(string $customerId, ?int $page = null, ?int $size = null): ListCardsResponse +function createAccessToken( + string $customerId, + CreateAccessTokenRequest $request, + ?string $idempotencyKey = null +): GetAccessTokenResponse ``` ## Parameters @@ -587,97 +611,110 @@ function getCards(string $customerId, ?int $page = null, ?int $size = null): Lis | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `customerId` | `string` | Template, Required | Customer Id | -| `page` | `?int` | Query, Optional | Page number | -| `size` | `?int` | Query, Optional | Page size | +| `request` | [`CreateAccessTokenRequest`](../../doc/models/create-access-token-request.md) | Body, Required | Request for creating a access token | +| `idempotencyKey` | `?string` | Header, Optional | - | ## Response Type -[`ListCardsResponse`](../../doc/models/list-cards-response.md) +[`GetAccessTokenResponse`](../../doc/models/get-access-token-response.md) ## Example Usage ```php $customerId = 'customer_id8'; -$result = $customersController->getCards($customerId); +$request = CreateAccessTokenRequestBuilder::init()->build(); + +$result = $customersController->createAccessToken( + $customerId, + $request +); ``` -# Renew Card +# Get Access Tokens -Renew a card +Get all access tokens from a customer ```php -function renewCard(string $customerId, string $cardId, ?string $idempotencyKey = null): GetCardResponse +function getAccessTokens(string $customerId, ?int $page = null, ?int $size = null): ListAccessTokensResponse ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `customerId` | `string` | Template, Required | Customer id | -| `cardId` | `string` | Template, Required | Card Id | -| `idempotencyKey` | `?string` | Header, Optional | - | +| `customerId` | `string` | Template, Required | Customer Id | +| `page` | `?int` | Query, Optional | Page number | +| `size` | `?int` | Query, Optional | Page size | ## Response Type -[`GetCardResponse`](../../doc/models/get-card-response.md) +[`ListAccessTokensResponse`](../../doc/models/list-access-tokens-response.md) ## Example Usage ```php $customerId = 'customer_id8'; -$cardId = 'card_id4'; - -$result = $customersController->renewCard( - $customerId, - $cardId -); +$result = $customersController->getAccessTokens($customerId); ``` -# Get Access Token +# Get Customers -Get a Customer's access token +Get all Customers ```php -function getAccessToken(string $customerId, string $tokenId): GetAccessTokenResponse +function getCustomers( + ?string $name = null, + ?string $document = null, + ?int $page = 1, + ?int $size = 10, + ?string $email = null, + ?string $code = null +): ListCustomersResponse ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `customerId` | `string` | Template, Required | Customer Id | -| `tokenId` | `string` | Template, Required | Token Id | +| `name` | `?string` | Query, Optional | Name of the Customer | +| `document` | `?string` | Query, Optional | Document of the Customer | +| `page` | `?int` | Query, Optional | Current page the the search | +| `size` | `?int` | Query, Optional | Quantity pages of the search | +| `email` | `?string` | Query, Optional | Customer's email | +| `code` | `?string` | Query, Optional | Customer's code | ## Response Type -[`GetAccessTokenResponse`](../../doc/models/get-access-token-response.md) +[`ListCustomersResponse`](../../doc/models/list-customers-response.md) ## Example Usage ```php -$customerId = 'customer_id8'; +$page = 1; -$tokenId = 'token_id6'; +$size = 10; -$result = $customersController->getAccessToken( - $customerId, - $tokenId +$result = $customersController->getCustomers( + null, + null, + $page, + $size ); ``` -# Update Customer Metadata +# Update Customer -Updates the metadata a customer +Updates a customer ```php -function updateCustomerMetadata( +function updateCustomer( string $customerId, - UpdateMetadataRequest $request, + UpdateCustomerRequest $request, ?string $idempotencyKey = null ): GetCustomerResponse ``` @@ -686,8 +723,8 @@ function updateCustomerMetadata( | 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 | +| `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 @@ -699,13 +736,9 @@ function updateCustomerMetadata( ```php $customerId = 'customer_id8'; -$request = UpdateMetadataRequestBuilder::init( - [ - 'key0' => 'metadata3' - ] -)->build(); +$request = UpdateCustomerRequestBuilder::init()->build(); -$result = $customersController->updateCustomerMetadata( +$result = $customersController->updateCustomer( $customerId, $request ); @@ -801,36 +834,3 @@ $customerId = 'customer_id8'; $result = $customersController->getCustomer($customerId); ``` - -# Get Card - -Get a customer's card - -```php -function getCard(string $customerId, string $cardId): GetCardResponse -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `customerId` | `string` | Template, Required | Customer id | -| `cardId` | `string` | Template, Required | Card id | - -## Response Type - -[`GetCardResponse`](../../doc/models/get-card-response.md) - -## Example Usage - -```php -$customerId = 'customer_id8'; - -$cardId = 'card_id4'; - -$result = $customersController->getCard( - $customerId, - $cardId -); -``` - diff --git a/doc/controllers/invoices.md b/doc/controllers/invoices.md index 4400978..147c228 100644 --- a/doc/controllers/invoices.md +++ b/doc/controllers/invoices.md @@ -10,23 +10,24 @@ $invoicesController = $client->getInvoicesController(); ## Methods -* [Update Invoice Metadata](../../doc/controllers/invoices.md#update-invoice-metadata) -* [Get Partial Invoice](../../doc/controllers/invoices.md#get-partial-invoice) -* [Cancel Invoice](../../doc/controllers/invoices.md#cancel-invoice) * [Create Invoice](../../doc/controllers/invoices.md#create-invoice) * [Get Invoices](../../doc/controllers/invoices.md#get-invoices) -* [Get Invoice](../../doc/controllers/invoices.md#get-invoice) +* [Cancel Invoice](../../doc/controllers/invoices.md#cancel-invoice) +* [Update Invoice Metadata](../../doc/controllers/invoices.md#update-invoice-metadata) +* [Get Partial Invoice](../../doc/controllers/invoices.md#get-partial-invoice) * [Update Invoice Status](../../doc/controllers/invoices.md#update-invoice-status) +* [Get Invoice](../../doc/controllers/invoices.md#get-invoice) -# Update Invoice Metadata +# Create Invoice -Updates the metadata from an invoice +Create an Invoice ```php -function updateInvoiceMetadata( - string $invoiceId, - UpdateMetadataRequest $request, +function createInvoice( + string $subscriptionId, + string $cycleId, + ?CreateInvoiceRequest $request = null, ?string $idempotencyKey = null ): GetInvoiceResponse ``` @@ -35,8 +36,9 @@ function 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 @@ -46,43 +48,61 @@ function updateInvoiceMetadata( ## Example Usage ```php -$invoiceId = 'invoice_id0'; +$subscriptionId = 'subscription_id0'; -$request = UpdateMetadataRequestBuilder::init( - [ - 'key0' => 'metadata3' - ] -)->build(); +$cycleId = 'cycle_id6'; -$result = $invoicesController->updateInvoiceMetadata( - $invoiceId, - $request +$result = $invoicesController->createInvoice( + $subscriptionId, + $cycleId ); ``` -# Get Partial Invoice +# Get Invoices + +Gets all invoices ```php -function getPartialInvoice(string $subscriptionId): GetInvoiceResponse +function getInvoices( + ?int $page = null, + ?int $size = null, + ?string $code = null, + ?string $customerId = null, + ?string $subscriptionId = null, + ?\DateTime $createdSince = null, + ?\DateTime $createdUntil = null, + ?string $status = null, + ?\DateTime $dueSince = null, + ?\DateTime $dueUntil = null, + ?string $customerDocument = null +): ListInvoicesResponse ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `string` | Template, Required | Subscription Id | +| `page` | `?int` | Query, Optional | Page number | +| `size` | `?int` | 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` | `?DateTime` | Query, Optional | Filter for Invoice's creation date start range | +| `createdUntil` | `?DateTime` | Query, Optional | Filter for Invoices creation date end range | +| `status` | `?string` | Query, Optional | Filter for Invoice's status | +| `dueSince` | `?DateTime` | Query, Optional | Filter for Invoice's due date start range | +| `dueUntil` | `?DateTime` | 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 ```php -$subscriptionId = 'subscription_id0'; - -$result = $invoicesController->getPartialInvoice($subscriptionId); +$result = $invoicesController->getInvoices(); ``` @@ -114,15 +134,14 @@ $result = $invoicesController->cancelInvoice($invoiceId); ``` -# Create Invoice +# Update Invoice Metadata -Create an Invoice +Updates the metadata from an invoice ```php -function createInvoice( - string $subscriptionId, - string $cycleId, - ?CreateInvoiceRequest $request = null, +function updateInvoiceMetadata( + string $invoiceId, + UpdateMetadataRequest $request, ?string $idempotencyKey = null ): GetInvoiceResponse ``` @@ -131,9 +150,8 @@ function createInvoice( | 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 | - | +| `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 @@ -143,70 +161,56 @@ function createInvoice( ## Example Usage ```php -$subscriptionId = 'subscription_id0'; +$invoiceId = 'invoice_id0'; -$cycleId = 'cycle_id6'; +$request = UpdateMetadataRequestBuilder::init( + [ + 'key0' => 'metadata3' + ] +)->build(); -$result = $invoicesController->createInvoice( - $subscriptionId, - $cycleId +$result = $invoicesController->updateInvoiceMetadata( + $invoiceId, + $request ); ``` -# Get Invoices - -Gets all invoices +# Get Partial Invoice ```php -function getInvoices( - ?int $page = null, - ?int $size = null, - ?string $code = null, - ?string $customerId = null, - ?string $subscriptionId = null, - ?\DateTime $createdSince = null, - ?\DateTime $createdUntil = null, - ?string $status = null, - ?\DateTime $dueSince = null, - ?\DateTime $dueUntil = null, - ?string $customerDocument = null -): ListInvoicesResponse +function getPartialInvoice(string $subscriptionId): GetInvoiceResponse ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `page` | `?int` | Query, Optional | Page number | -| `size` | `?int` | 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` | `?DateTime` | Query, Optional | Filter for Invoice's creation date start range | -| `createdUntil` | `?DateTime` | Query, Optional | Filter for Invoices creation date end range | -| `status` | `?string` | Query, Optional | Filter for Invoice's status | -| `dueSince` | `?DateTime` | Query, Optional | Filter for Invoice's due date start range | -| `dueUntil` | `?DateTime` | Query, Optional | Filter for Invoice's due date end range | -| `customerDocument` | `?string` | Query, Optional | - | +| `subscriptionId` | `string` | Template, Required | Subscription Id | ## Response Type -[`ListInvoicesResponse`](../../doc/models/list-invoices-response.md) +[`GetInvoiceResponse`](../../doc/models/get-invoice-response.md) ## Example Usage ```php -$result = $invoicesController->getInvoices(); +$subscriptionId = 'subscription_id0'; + +$result = $invoicesController->getPartialInvoice($subscriptionId); ``` -# Get Invoice +# Update Invoice Status -Gets an invoice +Updates the status from an invoice ```php -function getInvoice(string $invoiceId): GetInvoiceResponse +function updateInvoiceStatus( + string $invoiceId, + UpdateInvoiceStatusRequest $request, + ?string $idempotencyKey = null +): GetInvoiceResponse ``` ## Parameters @@ -214,6 +218,8 @@ function getInvoice(string $invoiceId): GetInvoiceResponse | 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 @@ -224,20 +230,23 @@ function getInvoice(string $invoiceId): GetInvoiceResponse ```php $invoiceId = 'invoice_id0'; -$result = $invoicesController->getInvoice($invoiceId); +$request = UpdateInvoiceStatusRequestBuilder::init( + 'status8' +)->build(); + +$result = $invoicesController->updateInvoiceStatus( + $invoiceId, + $request +); ``` -# Update Invoice Status +# Get Invoice -Updates the status from an invoice +Gets an invoice ```php -function updateInvoiceStatus( - string $invoiceId, - UpdateInvoiceStatusRequest $request, - ?string $idempotencyKey = null -): GetInvoiceResponse +function getInvoice(string $invoiceId): GetInvoiceResponse ``` ## Parameters @@ -245,8 +254,6 @@ function 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 | -| `idempotencyKey` | `?string` | Header, Optional | - | ## Response Type @@ -257,13 +264,6 @@ function updateInvoiceStatus( ```php $invoiceId = 'invoice_id0'; -$request = UpdateInvoiceStatusRequestBuilder::init( - 'status8' -)->build(); - -$result = $invoicesController->updateInvoiceStatus( - $invoiceId, - $request -); +$result = $invoicesController->getInvoice($invoiceId); ``` diff --git a/doc/controllers/orders.md b/doc/controllers/orders.md index 17c7232..9becc00 100644 --- a/doc/controllers/orders.md +++ b/doc/controllers/orders.md @@ -11,15 +11,15 @@ $ordersController = $client->getOrdersController(); ## Methods * [Get Orders](../../doc/controllers/orders.md#get-orders) +* [Get Order Item](../../doc/controllers/orders.md#get-order-item) +* [Get Order](../../doc/controllers/orders.md#get-order) +* [Close Order](../../doc/controllers/orders.md#close-order) +* [Create Order](../../doc/controllers/orders.md#create-order) * [Update Order Item](../../doc/controllers/orders.md#update-order-item) * [Delete All Order Items](../../doc/controllers/orders.md#delete-all-order-items) +* [Update Order Metadata](../../doc/controllers/orders.md#update-order-metadata) * [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) -* [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) # Get Orders @@ -61,15 +61,10 @@ $result = $ordersController->getOrders(); ``` -# Update Order Item +# Get Order Item ```php -function updateOrderItem( - string $orderId, - string $itemId, - UpdateOrderItemRequest $request, - ?string $idempotencyKey = null -): GetOrderItemResponse +function getOrderItem(string $orderId, string $itemId): GetOrderItemResponse ``` ## Parameters @@ -78,8 +73,6 @@ function updateOrderItem( | --- | --- | --- | --- | | `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 @@ -92,76 +85,37 @@ $orderId = 'orderId2'; $itemId = 'itemId8'; -$request = UpdateOrderItemRequestBuilder::init( - 242, - 'description6', - 100, - 'category4' -)->build(); - -$result = $ordersController->updateOrderItem( +$result = $ordersController->getOrderItem( $orderId, - $itemId, - $request + $itemId ); ``` -# Delete All Order Items - -```php -function deleteAllOrderItems(string $orderId, ?string $idempotencyKey = null): GetOrderResponse -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `orderId` | `string` | Template, Required | Order Id | -| `idempotencyKey` | `?string` | Header, Optional | - | - -## Response Type - -[`GetOrderResponse`](../../doc/models/get-order-response.md) - -## Example Usage - -```php -$orderId = 'orderId2'; - -$result = $ordersController->deleteAllOrderItems($orderId); -``` - +# Get Order -# Delete Order Item +Gets an order ```php -function deleteOrderItem(string $orderId, string $itemId, ?string $idempotencyKey = null): GetOrderItemResponse +function getOrder(string $orderId): GetOrderResponse ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `orderId` | `string` | Template, Required | Order Id | -| `itemId` | `string` | Template, Required | Item Id | -| `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 ```php -$orderId = 'orderId2'; - -$itemId = 'itemId8'; +$orderId = 'order_id6'; -$result = $ordersController->deleteOrderItem( - $orderId, - $itemId -); +$result = $ordersController->getOrder($orderId); ``` @@ -272,12 +226,13 @@ $result = $ordersController->createOrder($body); ``` -# Create Order Item +# Update Order Item ```php -function createOrderItem( +function updateOrderItem( string $orderId, - CreateOrderItemRequest $request, + string $itemId, + UpdateOrderItemRequest $request, ?string $idempotencyKey = null ): GetOrderItemResponse ``` @@ -287,7 +242,8 @@ function createOrderItem( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `orderId` | `string` | Template, Required | Order Id | -| `request` | [`CreateOrderItemRequest`](../../doc/models/create-order-item-request.md) | Body, Required | Order Item Model | +| `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 @@ -299,24 +255,27 @@ function createOrderItem( ```php $orderId = 'orderId2'; -$request = CreateOrderItemRequestBuilder::init( +$itemId = 'itemId8'; + +$request = UpdateOrderItemRequestBuilder::init( 242, 'description6', 100, 'category4' )->build(); -$result = $ordersController->createOrderItem( +$result = $ordersController->updateOrderItem( $orderId, + $itemId, $request ); ``` -# Get Order Item +# Delete All Order Items ```php -function getOrderItem(string $orderId, string $itemId): GetOrderItemResponse +function deleteAllOrderItems(string $orderId, ?string $idempotencyKey = null): GetOrderResponse ``` ## Parameters @@ -324,23 +283,18 @@ function getOrderItem(string $orderId, string $itemId): GetOrderItemResponse | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `orderId` | `string` | Template, Required | Order Id | -| `itemId` | `string` | Template, Required | Item Id | +| `idempotencyKey` | `?string` | Header, Optional | - | ## Response Type -[`GetOrderItemResponse`](../../doc/models/get-order-item-response.md) +[`GetOrderResponse`](../../doc/models/get-order-response.md) ## Example Usage ```php $orderId = 'orderId2'; -$itemId = 'itemId8'; - -$result = $ordersController->getOrderItem( - $orderId, - $itemId -); +$result = $ordersController->deleteAllOrderItems($orderId); ``` @@ -386,29 +340,75 @@ $result = $ordersController->updateOrderMetadata( ``` -# Get Order +# Delete Order Item -Gets an order +```php +function deleteOrderItem(string $orderId, string $itemId, ?string $idempotencyKey = null): GetOrderItemResponse +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `orderId` | `string` | Template, Required | Order Id | +| `itemId` | `string` | Template, Required | Item Id | +| `idempotencyKey` | `?string` | Header, Optional | - | + +## Response Type + +[`GetOrderItemResponse`](../../doc/models/get-order-item-response.md) + +## Example Usage ```php -function getOrder(string $orderId): GetOrderResponse +$orderId = 'orderId2'; + +$itemId = 'itemId8'; + +$result = $ordersController->deleteOrderItem( + $orderId, + $itemId +); +``` + + +# Create Order Item + +```php +function createOrderItem( + string $orderId, + CreateOrderItemRequest $request, + ?string $idempotencyKey = null +): GetOrderItemResponse ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `orderId` | `string` | Template, Required | Order id | +| `orderId` | `string` | Template, Required | Order Id | +| `request` | [`CreateOrderItemRequest`](../../doc/models/create-order-item-request.md) | Body, Required | Order Item Model | +| `idempotencyKey` | `?string` | Header, Optional | - | ## Response Type -[`GetOrderResponse`](../../doc/models/get-order-response.md) +[`GetOrderItemResponse`](../../doc/models/get-order-item-response.md) ## Example Usage ```php -$orderId = 'order_id6'; +$orderId = 'orderId2'; -$result = $ordersController->getOrder($orderId); +$request = CreateOrderItemRequestBuilder::init( + 242, + 'description6', + 100, + 'category4' +)->build(); + +$result = $ordersController->createOrderItem( + $orderId, + $request +); ``` diff --git a/doc/controllers/plans.md b/doc/controllers/plans.md index f2be784..ac39fcc 100644 --- a/doc/controllers/plans.md +++ b/doc/controllers/plans.md @@ -11,15 +11,15 @@ $plansController = $client->getPlansController(); ## Methods * [Get Plan](../../doc/controllers/plans.md#get-plan) -* [Delete Plan](../../doc/controllers/plans.md#delete-plan) +* [Update Plan](../../doc/controllers/plans.md#update-plan) * [Update Plan Metadata](../../doc/controllers/plans.md#update-plan-metadata) +* [Delete Plan Item](../../doc/controllers/plans.md#delete-plan-item) +* [Get Plans](../../doc/controllers/plans.md#get-plans) +* [Get Plan Item](../../doc/controllers/plans.md#get-plan-item) +* [Delete Plan](../../doc/controllers/plans.md#delete-plan) * [Update Plan Item](../../doc/controllers/plans.md#update-plan-item) * [Create Plan Item](../../doc/controllers/plans.md#create-plan-item) -* [Get Plan Item](../../doc/controllers/plans.md#get-plan-item) * [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 @@ -49,12 +49,12 @@ $result = $plansController->getPlan($planId); ``` -# Delete Plan +# Update Plan -Deletes a plan +Updates a plan ```php -function deletePlan(string $planId, ?string $idempotencyKey = null): GetPlanResponse +function updatePlan(string $planId, UpdatePlanRequest $request, ?string $idempotencyKey = null): GetPlanResponse ``` ## Parameters @@ -62,6 +62,7 @@ function deletePlan(string $planId, ?string $idempotencyKey = null): GetPlanResp | 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 | | `idempotencyKey` | `?string` | Header, Optional | - | ## Response Type @@ -73,7 +74,37 @@ function deletePlan(string $planId, ?string $idempotencyKey = null): GetPlanResp ```php $planId = 'plan_id8'; -$result = $plansController->deletePlan($planId); +$request = UpdatePlanRequestBuilder::init( + 'name6', + 'description6', + [ + 151, + 152 + ], + 'statement_descriptor6', + 'currency6', + 'interval4', + 114, + [ + 'payment_methods1', + 'payment_methods0', + 'payment_methods9' + ], + 'billing_type0', + 'status8', + false, + [ + 115 + ], + [ + 'key0' => 'metadata3' + ] +)->build(); + +$result = $plansController->updatePlan( + $planId, + $request +); ``` @@ -119,17 +150,12 @@ $result = $plansController->updatePlanMetadata( ``` -# Update Plan Item +# Delete Plan Item -Updates a plan item +Removes an item from a plan ```php -function updatePlanItem( - string $planId, - string $planItemId, - UpdatePlanItemRequest $body, - ?string $idempotencyKey = null -): GetPlanItemResponse +function deletePlanItem(string $planId, string $planItemId, ?string $idempotencyKey = null): GetPlanItemResponse ``` ## Parameters @@ -138,7 +164,6 @@ function 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 @@ -152,71 +177,49 @@ $planId = 'plan_id8'; $planItemId = 'plan_item_id0'; -$body = UpdatePlanItemRequestBuilder::init( - 'name6', - 'description4', - 'status2', - UpdatePricingSchemeRequestBuilder::init( - 'scheme_type8', - [ - UpdatePriceBracketRequestBuilder::init( - 144, - 174 - )->build() - ] - )->build() -)->build(); - -$result = $plansController->updatePlanItem( +$result = $plansController->deletePlanItem( $planId, - $planItemId, - $body + $planItemId ); ``` -# Create Plan Item +# Get Plans -Adds a new item to a plan +Gets all plans ```php -function createPlanItem( - string $planId, - CreatePlanItemRequest $request, - ?string $idempotencyKey = null -): GetPlanItemResponse +function getPlans( + ?int $page = null, + ?int $size = null, + ?string $name = null, + ?string $status = null, + ?string $billingType = null, + ?\DateTime $createdSince = null, + ?\DateTime $createdUntil = null +): ListPlansResponse ``` ## 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` | `?int` | Query, Optional | Page number | +| `size` | `?int` | 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` | `?DateTime` | Query, Optional | Filter for plan's creation date start range | +| `createdUntil` | `?DateTime` | 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 ```php -$planId = 'plan_id8'; - -$request = CreatePlanItemRequestBuilder::init( - 'name6', - CreatePricingSchemeRequestBuilder::init( - 'scheme_type8' - )->build(), - 'id6', - 'description6' -)->build(); - -$result = $plansController->createPlanItem( - $planId, - $request -); +$result = $plansController->getPlans(); ``` @@ -253,19 +256,19 @@ $result = $plansController->getPlanItem( ``` -# Create Plan +# Delete Plan -Creates a new plan +Deletes a plan ```php -function createPlan(CreatePlanRequest $body, ?string $idempotencyKey = null): GetPlanResponse +function deletePlan(string $planId, ?string $idempotencyKey = null): GetPlanResponse ``` ## Parameters | 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 | | `idempotencyKey` | `?string` | Header, Optional | - | ## Response Type @@ -275,54 +278,23 @@ function createPlan(CreatePlanRequest $body, ?string $idempotencyKey = null): Ge ## Example Usage ```php -$body = CreatePlanRequestBuilder::init( - 'name6', - 'description4', - 'statement_descriptor6', - [ - CreatePlanItemRequestBuilder::init( - 'name8', - CreatePricingSchemeRequestBuilder::init( - 'scheme_type8' - )->build(), - 'id8', - 'description2' - )->build() - ], - false, - [ - 'payment_methods9' - ], - [ - 207 - ], - 'currency6', - 'interval6', - 170, - [ - 201, - 200 - ], - 'billing_type0', - CreatePricingSchemeRequestBuilder::init( - 'scheme_type8' - )->build(), - [ - 'key0' => 'metadata7', - 'key1' => 'metadata8' - ] -)->build(); +$planId = 'plan_id8'; -$result = $plansController->createPlan($body); +$result = $plansController->deletePlan($planId); ``` -# Delete Plan Item +# Update Plan Item -Removes an item from a plan +Updates a plan item ```php -function deletePlanItem(string $planId, string $planItemId, ?string $idempotencyKey = null): GetPlanItemResponse +function updatePlanItem( + string $planId, + string $planItemId, + UpdatePlanItemRequest $body, + ?string $idempotencyKey = null +): GetPlanItemResponse ``` ## Parameters @@ -331,6 +303,7 @@ function deletePlanItem(string $planId, string $planItemId, ?string $idempotency | --- | --- | --- | --- | | `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 @@ -344,66 +317,87 @@ $planId = 'plan_id8'; $planItemId = 'plan_item_id0'; -$result = $plansController->deletePlanItem( +$body = UpdatePlanItemRequestBuilder::init( + 'name6', + 'description4', + 'status2', + UpdatePricingSchemeRequestBuilder::init( + 'scheme_type8', + [ + UpdatePriceBracketRequestBuilder::init( + 144, + 174 + )->build() + ] + )->build() +)->build(); + +$result = $plansController->updatePlanItem( $planId, - $planItemId + $planItemId, + $body ); ``` -# Get Plans +# Create Plan Item -Gets all plans +Adds a new item to a plan ```php -function getPlans( - ?int $page = null, - ?int $size = null, - ?string $name = null, - ?string $status = null, - ?string $billingType = null, - ?\DateTime $createdSince = null, - ?\DateTime $createdUntil = null -): ListPlansResponse +function createPlanItem( + string $planId, + CreatePlanItemRequest $request, + ?string $idempotencyKey = null +): GetPlanItemResponse ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `page` | `?int` | Query, Optional | Page number | -| `size` | `?int` | 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` | `?DateTime` | Query, Optional | Filter for plan's creation date start range | -| `createdUntil` | `?DateTime` | Query, Optional | Filter for plan's creation date end range | +| `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 | - | ## Response Type -[`ListPlansResponse`](../../doc/models/list-plans-response.md) +[`GetPlanItemResponse`](../../doc/models/get-plan-item-response.md) ## Example Usage ```php -$result = $plansController->getPlans(); +$planId = 'plan_id8'; + +$request = CreatePlanItemRequestBuilder::init( + 'name6', + CreatePricingSchemeRequestBuilder::init( + 'scheme_type8' + )->build(), + 'id6', + 'description6' +)->build(); + +$result = $plansController->createPlanItem( + $planId, + $request +); ``` -# Update Plan +# Create Plan -Updates a plan +Creates a new plan ```php -function updatePlan(string $planId, UpdatePlanRequest $request, ?string $idempotencyKey = null): GetPlanResponse +function createPlan(CreatePlanRequest $body, ?string $idempotencyKey = null): GetPlanResponse ``` ## Parameters | 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 | +| `body` | [`CreatePlanRequest`](../../doc/models/create-plan-request.md) | Body, Required | Request for creating a plan | | `idempotencyKey` | `?string` | Header, Optional | - | ## Response Type @@ -413,38 +407,44 @@ function updatePlan(string $planId, UpdatePlanRequest $request, ?string $idempot ## Example Usage ```php -$planId = 'plan_id8'; - -$request = UpdatePlanRequestBuilder::init( +$body = CreatePlanRequestBuilder::init( 'name6', - 'description6', + 'description4', + 'statement_descriptor6', [ - 151, - 152 + CreatePlanItemRequestBuilder::init( + 'name8', + CreatePricingSchemeRequestBuilder::init( + 'scheme_type8' + )->build(), + 'id8', + 'description2' + )->build() ], - 'statement_descriptor6', - 'currency6', - 'interval4', - 114, + false, [ - 'payment_methods1', - 'payment_methods0', 'payment_methods9' ], - 'billing_type0', - 'status8', - false, [ - 115 + 207 ], + 'currency6', + 'interval6', + 170, [ - 'key0' => 'metadata3' + 201, + 200 + ], + 'billing_type0', + CreatePricingSchemeRequestBuilder::init( + 'scheme_type8' + )->build(), + [ + 'key0' => 'metadata7', + 'key1' => 'metadata8' ] )->build(); -$result = $plansController->updatePlan( - $planId, - $request -); +$result = $plansController->createPlan($body); ``` diff --git a/doc/controllers/recipients.md b/doc/controllers/recipients.md index 80d0f40..301562a 100644 --- a/doc/controllers/recipients.md +++ b/doc/controllers/recipients.md @@ -14,21 +14,21 @@ $recipientsController = $client->getRecipientsController(); * [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 Anticipations](../../doc/controllers/recipients.md#get-anticipations) -* [Get Recipient](../../doc/controllers/recipients.md#get-recipient) +* [Update Recipient Default Bank Account](../../doc/controllers/recipients.md#update-recipient-default-bank-account) +* [Create Withdraw](../../doc/controllers/recipients.md#create-withdraw) * [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) +* [Update Automatic Anticipation Settings](../../doc/controllers/recipients.md#update-automatic-anticipation-settings) +* [Get Recipient](../../doc/controllers/recipients.md#get-recipient) +* [Get Withdrawals](../../doc/controllers/recipients.md#get-withdrawals) +* [Get Withdraw by Id](../../doc/controllers/recipients.md#get-withdraw-by-id) +* [Get Transfers](../../doc/controllers/recipients.md#get-transfers) * [Get Recipient by Code](../../doc/controllers/recipients.md#get-recipient-by-code) * [Get Default Recipient](../../doc/controllers/recipients.md#get-default-recipient) @@ -189,47 +189,54 @@ $result = $recipientsController->getRecipients(); ``` -# Get Withdraw by Id +# Update Recipient Metadata + +Updates recipient metadata ```php -function getWithdrawById(string $recipientId, string $withdrawalId): GetWithdrawResponse +function updateRecipientMetadata( + string $recipientId, + UpdateMetadataRequest $request, + ?string $idempotencyKey = null +): GetRecipientResponse ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `recipientId` | `string` | Template, Required | - | -| `withdrawalId` | `string` | Template, Required | - | +| `recipientId` | `string` | Template, Required | Recipient id | +| `request` | [`UpdateMetadataRequest`](../../doc/models/update-metadata-request.md) | Body, Required | Metadata | +| `idempotencyKey` | `?string` | Header, Optional | - | ## Response Type -[`GetWithdrawResponse`](../../doc/models/get-withdraw-response.md) +[`GetRecipientResponse`](../../doc/models/get-recipient-response.md) ## Example Usage ```php $recipientId = 'recipient_id0'; -$withdrawalId = 'withdrawal_id2'; +$request = UpdateMetadataRequestBuilder::init( + [ + 'key0' => 'metadata3' + ] +)->build(); -$result = $recipientsController->getWithdrawById( +$result = $recipientsController->updateRecipientMetadata( $recipientId, - $withdrawalId + $request ); ``` -# Update Recipient Default Bank Account +# Get Transfer -Updates the default bank account from a recipient +Gets a transfer ```php -function updateRecipientDefaultBankAccount( - string $recipientId, - UpdateRecipientBankAccountRequest $request, - ?string $idempotencyKey = null -): GetRecipientResponse +function getTransfer(string $recipientId, string $transferId): GetTransferResponse ``` ## Parameters @@ -237,51 +244,65 @@ function updateRecipientDefaultBankAccount( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `recipientId` | `string` | Template, Required | Recipient id | -| `request` | [`UpdateRecipientBankAccountRequest`](../../doc/models/update-recipient-bank-account-request.md) | Body, Required | Bank account data | -| `idempotencyKey` | `?string` | Header, Optional | - | +| `transferId` | `string` | Template, Required | Transfer id | ## Response Type -[`GetRecipientResponse`](../../doc/models/get-recipient-response.md) +[`GetTransferResponse`](../../doc/models/get-transfer-response.md) ## Example Usage ```php $recipientId = 'recipient_id0'; -$request = UpdateRecipientBankAccountRequestBuilder::init( - CreateBankAccountRequestBuilder::init( - 'holder_name0', - 'holder_type6', - 'holder_document8', - 'bank2', - 'branch_number0', - 'account_number4', - 'account_check_digit0', - 'type6', - [ - 'key0' => 'metadata1', - 'key1' => 'metadata0' - ] - )->build(), - 'bank_transfer' -)->build(); +$transferId = 'transfer_id6'; -$result = $recipientsController->updateRecipientDefaultBankAccount( +$result = $recipientsController->getTransfer( $recipientId, - $request + $transferId ); ``` -# Update Recipient Metadata +# Get Anticipation -Updates recipient metadata +Gets an anticipation ```php -function updateRecipientMetadata( +function getAnticipation(string $recipientId, string $anticipationId): GetAnticipationResponse +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `recipientId` | `string` | Template, Required | Recipient id | +| `anticipationId` | `string` | Template, Required | Anticipation id | + +## Response Type + +[`GetAnticipationResponse`](../../doc/models/get-anticipation-response.md) + +## Example Usage + +```php +$recipientId = 'recipient_id0'; + +$anticipationId = 'anticipation_id0'; + +$result = $recipientsController->getAnticipation( + $recipientId, + $anticipationId +); +``` + + +# Update Recipient Transfer Settings + +```php +function updateRecipientTransferSettings( string $recipientId, - UpdateMetadataRequest $request, + UpdateTransferSettingsRequest $request, ?string $idempotencyKey = null ): GetRecipientResponse ``` @@ -290,8 +311,8 @@ function updateRecipientMetadata( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `recipientId` | `string` | Template, Required | Recipient id | -| `request` | [`UpdateMetadataRequest`](../../doc/models/update-metadata-request.md) | Body, Required | Metadata | +| `recipientId` | `string` | Template, Required | Recipient Identificator | +| `request` | [`UpdateTransferSettingsRequest`](../../doc/models/update-transfer-settings-request.md) | Body, Required | - | | `idempotencyKey` | `?string` | Header, Optional | - | ## Response Type @@ -303,32 +324,35 @@ function updateRecipientMetadata( ```php $recipientId = 'recipient_id0'; -$request = UpdateMetadataRequestBuilder::init( - [ - 'key0' => 'metadata3' - ] +$request = UpdateTransferSettingsRequestBuilder::init( + 'transfer_enabled2', + 'transfer_interval6', + 'transfer_day6' )->build(); -$result = $recipientsController->updateRecipientMetadata( +$result = $recipientsController->updateRecipientTransferSettings( $recipientId, $request ); ``` -# Get Transfers +# Get Anticipations -Gets a paginated list of transfers for the recipient +Retrieves a paginated list of anticipations from a recipient ```php -function getTransfers( +function getAnticipations( string $recipientId, ?int $page = null, ?int $size = null, ?string $status = null, + ?string $timeframe = null, + ?\DateTime $paymentDateSince = null, + ?\DateTime $paymentDateUntil = null, ?\DateTime $createdSince = null, ?\DateTime $createdUntil = null -): ListTransferResponse +): ListAnticipationResponse ``` ## Parameters @@ -338,29 +362,36 @@ function getTransfers( | `recipientId` | `string` | Template, Required | Recipient id | | `page` | `?int` | Query, Optional | Page number | | `size` | `?int` | Query, Optional | Page size | -| `status` | `?string` | Query, Optional | Filter for transfer status | -| `createdSince` | `?DateTime` | Query, Optional | Filter for start range of transfer creation date | -| `createdUntil` | `?DateTime` | Query, Optional | Filter for end range of transfer creation date | +| `status` | `?string` | Query, Optional | Filter for anticipation status | +| `timeframe` | `?string` | Query, Optional | Filter for anticipation timeframe | +| `paymentDateSince` | `?DateTime` | Query, Optional | Filter for start range for anticipation payment date | +| `paymentDateUntil` | `?DateTime` | Query, Optional | Filter for end range for anticipation payment date | +| `createdSince` | `?DateTime` | Query, Optional | Filter for start range for anticipation creation date | +| `createdUntil` | `?DateTime` | Query, Optional | Filter for end range for anticipation creation date | ## Response Type -[`ListTransferResponse`](../../doc/models/list-transfer-response.md) +[`ListAnticipationResponse`](../../doc/models/list-anticipation-response.md) ## Example Usage ```php $recipientId = 'recipient_id0'; -$result = $recipientsController->getTransfers($recipientId); +$result = $recipientsController->getAnticipations($recipientId); ``` -# Get Transfer +# Update Recipient Default Bank Account -Gets a transfer +Updates the default bank account from a recipient ```php -function getTransfer(string $recipientId, string $transferId): GetTransferResponse +function updateRecipientDefaultBankAccount( + string $recipientId, + UpdateRecipientBankAccountRequest $request, + ?string $idempotencyKey = null +): GetRecipientResponse ``` ## Parameters @@ -368,22 +399,39 @@ function getTransfer(string $recipientId, string $transferId): GetTransferRespon | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `recipientId` | `string` | Template, Required | Recipient id | -| `transferId` | `string` | Template, Required | Transfer id | +| `request` | [`UpdateRecipientBankAccountRequest`](../../doc/models/update-recipient-bank-account-request.md) | Body, Required | Bank account data | +| `idempotencyKey` | `?string` | Header, Optional | - | ## Response Type -[`GetTransferResponse`](../../doc/models/get-transfer-response.md) +[`GetRecipientResponse`](../../doc/models/get-recipient-response.md) ## Example Usage ```php $recipientId = 'recipient_id0'; -$transferId = 'transfer_id6'; +$request = UpdateRecipientBankAccountRequestBuilder::init( + CreateBankAccountRequestBuilder::init( + 'holder_name0', + 'holder_type6', + 'holder_document8', + 'bank2', + 'branch_number0', + 'account_number4', + 'account_check_digit0', + 'type6', + [ + 'key0' => 'metadata1', + 'key1' => 'metadata0' + ] + )->build(), + 'bank_transfer' +)->build(); -$result = $recipientsController->getTransfer( +$result = $recipientsController->updateRecipientDefaultBankAccount( $recipientId, - $transferId + $request ); ``` @@ -421,16 +469,12 @@ $result = $recipientsController->createWithdraw( ``` -# Update Automatic Anticipation Settings +# Get Balance -Updates recipient metadata +Get balance information for a recipient ```php -function updateAutomaticAnticipationSettings( - string $recipientId, - UpdateAutomaticAnticipationSettingsRequest $request, - ?string $idempotencyKey = null -): GetRecipientResponse +function getBalance(string $recipientId): GetBalanceResponse ``` ## Parameters @@ -438,76 +482,76 @@ function updateAutomaticAnticipationSettings( | 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) +[`GetBalanceResponse`](../../doc/models/get-balance-response.md) ## Example Usage ```php $recipientId = 'recipient_id0'; -$request = UpdateAutomaticAnticipationSettingsRequestBuilder::init()->build(); - -$result = $recipientsController->updateAutomaticAnticipationSettings( - $recipientId, - $request -); +$result = $recipientsController->getBalance($recipientId); ``` -# Get Anticipation +# Create Transfer -Gets an anticipation +Creates a transfer for a recipient ```php -function getAnticipation(string $recipientId, string $anticipationId): GetAnticipationResponse +function createTransfer( + string $recipientId, + CreateTransferRequest $request, + ?string $idempotencyKey = null +): GetTransferResponse ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `recipientId` | `string` | Template, Required | Recipient id | -| `anticipationId` | `string` | Template, Required | Anticipation id | +| `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 ```php $recipientId = 'recipient_id0'; -$anticipationId = 'anticipation_id0'; +$request = CreateTransferRequestBuilder::init( + 242, + [ + 'key0' => 'metadata3' + ] +)->build(); -$result = $recipientsController->getAnticipation( +$result = $recipientsController->createTransfer( $recipientId, - $anticipationId + $request ); ``` -# Update Recipient Transfer Settings +# Create Recipient + +Creates a new recipient ```php -function updateRecipientTransferSettings( - string $recipientId, - UpdateTransferSettingsRequest $request, - ?string $idempotencyKey = null -): GetRecipientResponse +function createRecipient(CreateRecipientRequest $request, ?string $idempotencyKey = null): GetRecipientResponse ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `recipientId` | `string` | Template, Required | Recipient Identificator | -| `request` | [`UpdateTransferSettingsRequest`](../../doc/models/update-transfer-settings-request.md) | Body, Required | - | +| `request` | [`CreateRecipientRequest`](../../doc/models/create-recipient-request.md) | Body, Required | Recipient data | | `idempotencyKey` | `?string` | Header, Optional | - | ## Response Type @@ -517,37 +561,43 @@ function updateRecipientTransferSettings( ## Example Usage ```php -$recipientId = 'recipient_id0'; - -$request = UpdateTransferSettingsRequestBuilder::init( - 'transfer_enabled2', - 'transfer_interval6', - 'transfer_day6' +$request = CreateRecipientRequestBuilder::init( + CreateBankAccountRequestBuilder::init( + 'holder_name4', + 'holder_type0', + 'holder_document2', + 'bank6', + 'branch_number4', + 'account_number8', + 'account_check_digit4', + 'type2', + [ + 'key0' => 'metadata5', + 'key1' => 'metadata4', + 'key2' => 'metadata3' + ] + )->build(), + [ + 'key0' => 'metadata3' + ], + 'code4', + 'bank_transfer' )->build(); -$result = $recipientsController->updateRecipientTransferSettings( - $recipientId, - $request -); +$result = $recipientsController->createRecipient($request); ``` -# Get Anticipations +# Update Automatic Anticipation Settings -Retrieves a paginated list of anticipations from a recipient +Updates recipient metadata ```php -function getAnticipations( +function updateAutomaticAnticipationSettings( string $recipientId, - ?int $page = null, - ?int $size = null, - ?string $status = null, - ?string $timeframe = null, - ?\DateTime $paymentDateSince = null, - ?\DateTime $paymentDateUntil = null, - ?\DateTime $createdSince = null, - ?\DateTime $createdUntil = null -): ListAnticipationResponse + UpdateAutomaticAnticipationSettingsRequest $request, + ?string $idempotencyKey = null +): GetRecipientResponse ``` ## Parameters @@ -555,25 +605,24 @@ function getAnticipations( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `recipientId` | `string` | Template, Required | Recipient id | -| `page` | `?int` | Query, Optional | Page number | -| `size` | `?int` | Query, Optional | Page size | -| `status` | `?string` | Query, Optional | Filter for anticipation status | -| `timeframe` | `?string` | Query, Optional | Filter for anticipation timeframe | -| `paymentDateSince` | `?DateTime` | Query, Optional | Filter for start range for anticipation payment date | -| `paymentDateUntil` | `?DateTime` | Query, Optional | Filter for end range for anticipation payment date | -| `createdSince` | `?DateTime` | Query, Optional | Filter for start range for anticipation creation date | -| `createdUntil` | `?DateTime` | Query, Optional | Filter for end range for anticipation creation date | +| `request` | [`UpdateAutomaticAnticipationSettingsRequest`](../../doc/models/update-automatic-anticipation-settings-request.md) | Body, Required | Metadata | +| `idempotencyKey` | `?string` | Header, Optional | - | ## Response Type -[`ListAnticipationResponse`](../../doc/models/list-anticipation-response.md) +[`GetRecipientResponse`](../../doc/models/get-recipient-response.md) ## Example Usage ```php $recipientId = 'recipient_id0'; -$result = $recipientsController->getAnticipations($recipientId); +$request = UpdateAutomaticAnticipationSettingsRequestBuilder::init()->build(); + +$result = $recipientsController->updateAutomaticAnticipationSettings( + $recipientId, + $request +); ``` @@ -604,33 +653,6 @@ $result = $recipientsController->getRecipient($recipientId); ``` -# Get Balance - -Get balance information for a recipient - -```php -function getBalance(string $recipientId): GetBalanceResponse -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `recipientId` | `string` | Template, Required | Recipient id | - -## Response Type - -[`GetBalanceResponse`](../../doc/models/get-balance-response.md) - -## Example Usage - -```php -$recipientId = 'recipient_id0'; - -$result = $recipientsController->getBalance($recipientId); -``` - - # Get Withdrawals Gets a paginated list of transfers for the recipient @@ -670,100 +692,73 @@ $result = $recipientsController->getWithdrawals($recipientId); ``` -# Create Transfer - -Creates a transfer for a recipient +# Get Withdraw by Id ```php -function createTransfer( - string $recipientId, - CreateTransferRequest $request, - ?string $idempotencyKey = null -): GetTransferResponse +function getWithdrawById(string $recipientId, string $withdrawalId): GetWithdrawResponse ``` ## 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 | - | +| `withdrawalId` | `string` | Template, Required | - | ## Response Type -[`GetTransferResponse`](../../doc/models/get-transfer-response.md) +[`GetWithdrawResponse`](../../doc/models/get-withdraw-response.md) ## Example Usage ```php $recipientId = 'recipient_id0'; -$request = CreateTransferRequestBuilder::init( - 242, - [ - 'key0' => 'metadata3' - ] -)->build(); +$withdrawalId = 'withdrawal_id2'; -$result = $recipientsController->createTransfer( +$result = $recipientsController->getWithdrawById( $recipientId, - $request + $withdrawalId ); ``` -# Create Recipient +# Get Transfers -Creates a new recipient +Gets a paginated list of transfers for the recipient ```php -function createRecipient(CreateRecipientRequest $request, ?string $idempotencyKey = null): GetRecipientResponse +function getTransfers( + string $recipientId, + ?int $page = null, + ?int $size = null, + ?string $status = null, + ?\DateTime $createdSince = null, + ?\DateTime $createdUntil = null +): ListTransferResponse ``` ## 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 | Recipient id | +| `page` | `?int` | Query, Optional | Page number | +| `size` | `?int` | Query, Optional | Page size | +| `status` | `?string` | Query, Optional | Filter for transfer status | +| `createdSince` | `?DateTime` | Query, Optional | Filter for start range of transfer creation date | +| `createdUntil` | `?DateTime` | Query, Optional | Filter for end range of transfer creation date | ## Response Type -[`GetRecipientResponse`](../../doc/models/get-recipient-response.md) +[`ListTransferResponse`](../../doc/models/list-transfer-response.md) ## Example Usage ```php -$request = CreateRecipientRequestBuilder::init( - 'name6', - 'email0', - 'description6', - 'document0', - 'type4', - CreateBankAccountRequestBuilder::init( - 'holder_name4', - 'holder_type0', - 'holder_document2', - 'bank6', - 'branch_number4', - 'account_number8', - 'account_check_digit4', - 'type2', - [ - 'key0' => 'metadata5', - 'key1' => 'metadata4', - 'key2' => 'metadata3' - ] - )->build(), - [ - 'key0' => 'metadata3' - ], - 'code4', - 'bank_transfer' -)->build(); +$recipientId = 'recipient_id0'; -$result = $recipientsController->createRecipient($request); +$result = $recipientsController->getTransfers($recipientId); ``` diff --git a/doc/controllers/subscriptions.md b/doc/controllers/subscriptions.md index c1883f8..2fa7d5d 100644 --- a/doc/controllers/subscriptions.md +++ b/doc/controllers/subscriptions.md @@ -11,39 +11,39 @@ $subscriptionsController = $client->getSubscriptionsController(); ## Methods * [Renew Subscription](../../doc/controllers/subscriptions.md#renew-subscription) -* [Update Subscription Card](../../doc/controllers/subscriptions.md#update-subscription-card) -* [Delete Usage](../../doc/controllers/subscriptions.md#delete-usage) -* [Create Discount](../../doc/controllers/subscriptions.md#create-discount) -* [Create an Usage](../../doc/controllers/subscriptions.md#create-an-usage) -* [Update Current Cycle Status](../../doc/controllers/subscriptions.md#update-current-cycle-status) * [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 Subscription](../../doc/controllers/subscriptions.md#get-subscription) +* [Update Latest Period End At](../../doc/controllers/subscriptions.md#update-latest-period-end-at) +* [Update Current Cycle Status](../../doc/controllers/subscriptions.md#update-current-cycle-status) +* [Get Subscription Items](../../doc/controllers/subscriptions.md#get-subscription-items) +* [Get Subscription Item](../../doc/controllers/subscriptions.md#get-subscription-item) +* [Update Subscription Affiliation Id](../../doc/controllers/subscriptions.md#update-subscription-affiliation-id) * [Get Discounts](../../doc/controllers/subscriptions.md#get-discounts) -* [Update Subscription Billing Date](../../doc/controllers/subscriptions.md#update-subscription-billing-date) -* [Delete Subscription Item](../../doc/controllers/subscriptions.md#delete-subscription-item) -* [Get Increments](../../doc/controllers/subscriptions.md#get-increments) -* [Update Subscription Due Days](../../doc/controllers/subscriptions.md#update-subscription-due-days) -* [Update Subscription Start At](../../doc/controllers/subscriptions.md#update-subscription-start-at) * [Update Subscription Item](../../doc/controllers/subscriptions.md#update-subscription-item) * [Create Subscription Item](../../doc/controllers/subscriptions.md#create-subscription-item) -* [Get Subscription](../../doc/controllers/subscriptions.md#get-subscription) * [Get Usages](../../doc/controllers/subscriptions.md#get-usages) -* [Update Latest Period End At](../../doc/controllers/subscriptions.md#update-latest-period-end-at) * [Update Subscription Minium Price](../../doc/controllers/subscriptions.md#update-subscription-minium-price) * [Get Subscription Cycle by Id](../../doc/controllers/subscriptions.md#get-subscription-cycle-by-id) +* [Create an Usage](../../doc/controllers/subscriptions.md#create-an-usage) +* [Cancel Subscription](../../doc/controllers/subscriptions.md#cancel-subscription) +* [Delete Subscription Item](../../doc/controllers/subscriptions.md#delete-subscription-item) +* [Get Increments](../../doc/controllers/subscriptions.md#get-increments) +* [Update Subscription Due Days](../../doc/controllers/subscriptions.md#update-subscription-due-days) +* [Update Subscription Card](../../doc/controllers/subscriptions.md#update-subscription-card) +* [Delete Usage](../../doc/controllers/subscriptions.md#delete-usage) +* [Create Discount](../../doc/controllers/subscriptions.md#create-discount) +* [Update Subscription Payment Method](../../doc/controllers/subscriptions.md#update-subscription-payment-method) +* [Create Increment](../../doc/controllers/subscriptions.md#create-increment) +* [Create Usage](../../doc/controllers/subscriptions.md#create-usage) +* [Get Subscription Cycles](../../doc/controllers/subscriptions.md#get-subscription-cycles) +* [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 Usage Report](../../doc/controllers/subscriptions.md#get-usage-report) * [Update Split Subscription](../../doc/controllers/subscriptions.md#update-split-subscription) @@ -74,100 +74,14 @@ $result = $subscriptionsController->renewSubscription($subscriptionId); ``` -# Update Subscription Card - -Updates the credit card from a subscription - -```php -function updateSubscriptionCard( - string $subscriptionId, - UpdateSubscriptionCardRequest $request, - ?string $idempotencyKey = null -): GetSubscriptionResponse -``` - -## Parameters - -| 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 | -| `idempotencyKey` | `?string` | Header, Optional | - | - -## Response Type - -[`GetSubscriptionResponse`](../../doc/models/get-subscription-response.md) - -## Example Usage - -```php -$subscriptionId = 'subscription_id0'; - -$request = UpdateSubscriptionCardRequestBuilder::init( - CreateCardRequestBuilder::init() - ->type('credit') - ->build(), - 'card_id2' -)->build(); - -$result = $subscriptionsController->updateSubscriptionCard( - $subscriptionId, - $request -); -``` - - -# Delete Usage - -Deletes a usage - -```php -function deleteUsage( - string $subscriptionId, - string $itemId, - string $usageId, - ?string $idempotencyKey = null -): GetUsageResponse -``` - -## Parameters - -| 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 | -| `idempotencyKey` | `?string` | Header, Optional | - | - -## Response Type - -[`GetUsageResponse`](../../doc/models/get-usage-response.md) - -## Example Usage - -```php -$subscriptionId = 'subscription_id0'; - -$itemId = 'item_id0'; - -$usageId = 'usage_id0'; - -$result = $subscriptionsController->deleteUsage( - $subscriptionId, - $itemId, - $usageId -); -``` - - -# Create Discount +# Delete Discount -Creates a discount +Deletes a discount ```php -function createDiscount( +function deleteDiscount( string $subscriptionId, - CreateDiscountRequest $request, + string $discountId, ?string $idempotencyKey = null ): GetDiscountResponse ``` @@ -177,7 +91,7 @@ function 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 | +| `discountId` | `string` | Template, Required | Discount Id | | `idempotencyKey` | `?string` | Header, Optional | - | ## Response Type @@ -189,182 +103,261 @@ function createDiscount( ```php $subscriptionId = 'subscription_id0'; -$request = CreateDiscountRequestBuilder::init( - 185.28, - 'discount_type4', - 'item_id6' -)->build(); +$discountId = 'discount_id8'; -$result = $subscriptionsController->createDiscount( +$result = $subscriptionsController->deleteDiscount( $subscriptionId, - $request + $discountId ); ``` -# Create an Usage +# Get Subscriptions -Create Usage +Gets all subscriptions ```php -function createAnUsage(string $subscriptionId, string $itemId, ?string $idempotencyKey = null): GetUsageResponse +function getSubscriptions( + ?int $page = null, + ?int $size = null, + ?string $code = null, + ?string $billingType = null, + ?string $customerId = null, + ?string $planId = null, + ?string $cardId = null, + ?string $status = null, + ?\DateTime $nextBillingSince = null, + ?\DateTime $nextBillingUntil = null, + ?\DateTime $createdSince = null, + ?\DateTime $createdUntil = null +): ListSubscriptionsResponse ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `string` | Template, Required | Subscription id | -| `itemId` | `string` | Template, Required | Item id | -| `idempotencyKey` | `?string` | Header, Optional | - | +| `page` | `?int` | Query, Optional | Page number | +| `size` | `?int` | 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` | `?DateTime` | Query, Optional | Filter for subscription's next billing date start range | +| `nextBillingUntil` | `?DateTime` | Query, Optional | Filter for subscription's next billing date end range | +| `createdSince` | `?DateTime` | Query, Optional | Filter for subscription's creation date start range | +| `createdUntil` | `?DateTime` | Query, Optional | Filter for subscriptions creation date end range | ## Response Type -[`GetUsageResponse`](../../doc/models/get-usage-response.md) +[`ListSubscriptionsResponse`](../../doc/models/list-subscriptions-response.md) ## Example Usage ```php -$subscriptionId = 'subscription_id0'; - -$itemId = 'item_id0'; - -$result = $subscriptionsController->createAnUsage( - $subscriptionId, - $itemId -); +$result = $subscriptionsController->getSubscriptions(); ``` -# Update Current Cycle Status +# Get Discount by Id ```php -function updateCurrentCycleStatus( - string $subscriptionId, - UpdateCurrentCycleStatusRequest $request, - ?string $idempotencyKey = null -): void +function getDiscountById(string $subscriptionId, string $discountId): GetDiscountResponse ``` ## Parameters | 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 | -| `idempotencyKey` | `?string` | Header, Optional | - | +| `subscriptionId` | `string` | Template, Required | The subscription id | +| `discountId` | `string` | Template, Required | - | ## Response Type -`void` +[`GetDiscountResponse`](../../doc/models/get-discount-response.md) ## Example Usage ```php $subscriptionId = 'subscription_id0'; -$request = UpdateCurrentCycleStatusRequestBuilder::init( - 'status8' -)->build(); +$discountId = 'discountId0'; -$subscriptionsController->updateCurrentCycleStatus( +$result = $subscriptionsController->getDiscountById( $subscriptionId, - $request + $discountId ); ``` -# Delete Discount +# Create Subscription -Deletes a discount +Creates a new subscription ```php -function deleteDiscount( - string $subscriptionId, - string $discountId, +function createSubscription( + CreateSubscriptionRequest $body, ?string $idempotencyKey = null -): GetDiscountResponse +): GetSubscriptionResponse ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `string` | Template, Required | Subscription id | -| `discountId` | `string` | Template, Required | Discount Id | +| `body` | [`CreateSubscriptionRequest`](../../doc/models/create-subscription-request.md) | Body, Required | Request for creating a subscription | | `idempotencyKey` | `?string` | Header, Optional | - | ## Response Type -[`GetDiscountResponse`](../../doc/models/get-discount-response.md) +[`GetSubscriptionResponse`](../../doc/models/get-subscription-response.md) ## Example Usage ```php -$subscriptionId = 'subscription_id0'; - -$discountId = 'discount_id8'; - -$result = $subscriptionsController->deleteDiscount( - $subscriptionId, - $discountId -); -``` - - -# Get Subscription Items - -Get Subscription Items - -```php -function getSubscriptionItems( - string $subscriptionId, - ?int $page = null, - ?int $size = null, - ?string $name = null, - ?string $code = null, - ?string $status = null, - ?string $description = null, - ?string $createdSince = null, - ?string $createdUntil = null -): ListSubscriptionItemsResponse +$body = CreateSubscriptionRequestBuilder::init( + CreateCustomerRequestBuilder::init( + '{ + "name": "Tony Stark" +}', + 'email6', + 'document6', + 'type0', + CreateAddressRequestBuilder::init( + 'street6', + 'number4', + 'zip_code0', + 'neighborhood2', + 'city6', + 'state2', + 'country0', + 'complement2', + 'line_10', + 'line_24' + )->build(), + [ + 'key0' => 'metadata3' + ], + CreatePhonesRequestBuilder::init()->build(), + 'code8' + )->build(), + CreateCardRequestBuilder::init() + ->type('credit') + ->build(), + 'code4', + 'payment_method4', + 'billing_type0', + 'statement_descriptor6', + 'description4', + 'currency6', + 'interval6', + 170, + CreatePricingSchemeRequestBuilder::init( + 'scheme_type8' + )->build(), + [ + CreateSubscriptionItemRequestBuilder::init( + 'description2', + CreatePricingSchemeRequestBuilder::init( + 'scheme_type8' + )->build(), + 'id8', + 'plan_item_id8', + [ + CreateDiscountRequestBuilder::init( + 90.66, + 'discount_type2', + 'item_id4' + )->build() + ], + 'name8' + )->build() + ], + CreateShippingRequestBuilder::init( + 52, + 'description6', + 'recipient_name2', + 'recipient_phone6', + 'address_id6', + CreateAddressRequestBuilder::init( + 'street6', + 'number4', + 'zip_code0', + 'neighborhood2', + 'city6', + 'state2', + 'country0', + 'complement2', + 'line_10', + 'line_24' + )->build(), + 'type6' + )->build(), + [ + CreateDiscountRequestBuilder::init( + 90.66, + 'discount_type2', + 'item_id4' + )->build() + ], + [ + 'key0' => 'metadata7', + 'key1' => 'metadata8' + ], + [ + CreateIncrementRequestBuilder::init( + 252.86, + 'increment_type6', + 'item_id6' + )->build() + ] +)->build(); + +$result = $subscriptionsController->createSubscription($body); +``` + + +# Get Increment by Id + +```php +function getIncrementById(string $subscriptionId, string $incrementId): GetIncrementResponse ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `string` | Template, Required | The subscription id | -| `page` | `?int` | Query, Optional | Page number | -| `size` | `?int` | 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 | The subscription Id | +| `incrementId` | `string` | Template, Required | The increment Id | ## Response Type -[`ListSubscriptionItemsResponse`](../../doc/models/list-subscription-items-response.md) +[`GetIncrementResponse`](../../doc/models/get-increment-response.md) ## Example Usage ```php $subscriptionId = 'subscription_id0'; -$result = $subscriptionsController->getSubscriptionItems($subscriptionId); +$incrementId = 'increment_id8'; + +$result = $subscriptionsController->getIncrementById( + $subscriptionId, + $incrementId +); ``` -# Update Subscription Payment Method +# Update Subscription Metadata -Updates the payment method from a subscription +Updates the metadata from a subscription ```php -function updateSubscriptionPaymentMethod( +function updateSubscriptionMetadata( string $subscriptionId, - UpdateSubscriptionPaymentMethodRequest $request, + UpdateMetadataRequest $request, ?string $idempotencyKey = null ): GetSubscriptionResponse ``` @@ -373,8 +366,8 @@ function updateSubscriptionPaymentMethod( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `string` | Template, Required | Subscription id | -| `request` | [`UpdateSubscriptionPaymentMethodRequest`](../../doc/models/update-subscription-payment-method-request.md) | Body, Required | Request for updating the paymentmethod from a subscription | +| `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 @@ -386,111 +379,90 @@ function updateSubscriptionPaymentMethod( ```php $subscriptionId = 'subscription_id0'; -$request = UpdateSubscriptionPaymentMethodRequestBuilder::init( - 'payment_method4', - 'card_id2', - CreateCardRequestBuilder::init() - ->type('credit') - ->build() +$request = UpdateMetadataRequestBuilder::init( + [ + 'key0' => 'metadata3' + ] )->build(); -$result = $subscriptionsController->updateSubscriptionPaymentMethod( +$result = $subscriptionsController->updateSubscriptionMetadata( $subscriptionId, $request ); ``` -# Get Subscription Item +# Delete Increment -Get Subscription Item +Deletes a increment ```php -function getSubscriptionItem(string $subscriptionId, string $itemId): GetSubscriptionItemResponse +function deleteIncrement( + string $subscriptionId, + string $incrementId, + ?string $idempotencyKey = null +): GetIncrementResponse ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `string` | Template, Required | Subscription Id | -| `itemId` | `string` | Template, Required | Item id | +| `subscriptionId` | `string` | Template, Required | Subscription id | +| `incrementId` | `string` | Template, Required | Increment id | +| `idempotencyKey` | `?string` | Header, Optional | - | ## Response Type -[`GetSubscriptionItemResponse`](../../doc/models/get-subscription-item-response.md) +[`GetIncrementResponse`](../../doc/models/get-increment-response.md) ## Example Usage ```php $subscriptionId = 'subscription_id0'; -$itemId = 'item_id0'; +$incrementId = 'increment_id8'; -$result = $subscriptionsController->getSubscriptionItem( +$result = $subscriptionsController->deleteIncrement( $subscriptionId, - $itemId + $incrementId ); ``` -# Get Subscriptions +# Get Subscription -Gets all subscriptions +Gets a subscription ```php -function getSubscriptions( - ?int $page = null, - ?int $size = null, - ?string $code = null, - ?string $billingType = null, - ?string $customerId = null, - ?string $planId = null, - ?string $cardId = null, - ?string $status = null, - ?\DateTime $nextBillingSince = null, - ?\DateTime $nextBillingUntil = null, - ?\DateTime $createdSince = null, - ?\DateTime $createdUntil = null -): ListSubscriptionsResponse +function getSubscription(string $subscriptionId): GetSubscriptionResponse ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `page` | `?int` | Query, Optional | Page number | -| `size` | `?int` | 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` | `?DateTime` | Query, Optional | Filter for subscription's next billing date start range | -| `nextBillingUntil` | `?DateTime` | Query, Optional | Filter for subscription's next billing date end range | -| `createdSince` | `?DateTime` | Query, Optional | Filter for subscription's creation date start range | -| `createdUntil` | `?DateTime` | Query, Optional | Filter for subscriptions creation date end range | +| `subscriptionId` | `string` | Template, Required | Subscription id | ## Response Type -[`ListSubscriptionsResponse`](../../doc/models/list-subscriptions-response.md) +[`GetSubscriptionResponse`](../../doc/models/get-subscription-response.md) ## Example Usage ```php -$result = $subscriptionsController->getSubscriptions(); -``` +$subscriptionId = 'subscription_id0'; +$result = $subscriptionsController->getSubscription($subscriptionId); +``` -# Cancel Subscription -Cancels a subscription +# Update Latest Period End At ```php -function cancelSubscription( +function updateLatestPeriodEndAt( string $subscriptionId, - ?CreateCancelSubscriptionRequest $request = null, + UpdateCurrentCycleEndDateRequest $request, ?string $idempotencyKey = null ): GetSubscriptionResponse ``` @@ -499,8 +471,8 @@ function cancelSubscription( | 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 | +| `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 @@ -512,144 +484,137 @@ function cancelSubscription( ```php $subscriptionId = 'subscription_id0'; -$request = CreateCancelSubscriptionRequestBuilder::init( - true -)->build(); +$request = UpdateCurrentCycleEndDateRequestBuilder::init()->build(); -$result = $subscriptionsController->cancelSubscription( +$result = $subscriptionsController->updateLatestPeriodEndAt( $subscriptionId, $request ); ``` -# Create Increment - -Creates a increment +# Update Current Cycle Status ```php -function createIncrement( +function updateCurrentCycleStatus( string $subscriptionId, - CreateIncrementRequest $request, + UpdateCurrentCycleStatusRequest $request, ?string $idempotencyKey = null -): GetIncrementResponse +): void ``` ## Parameters | 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 | +| `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 -[`GetIncrementResponse`](../../doc/models/get-increment-response.md) +`void` ## Example Usage ```php $subscriptionId = 'subscription_id0'; -$request = CreateIncrementRequestBuilder::init( - 185.28, - 'increment_type8', - 'item_id6' +$request = UpdateCurrentCycleStatusRequestBuilder::init( + 'status8' )->build(); -$result = $subscriptionsController->createIncrement( +$subscriptionsController->updateCurrentCycleStatus( $subscriptionId, $request ); ``` -# Create Usage +# Get Subscription Items -Creates a usage +Get Subscription Items ```php -function createUsage( +function getSubscriptionItems( string $subscriptionId, - string $itemId, - CreateUsageRequest $body, - ?string $idempotencyKey = null -): GetUsageResponse + ?int $page = null, + ?int $size = null, + ?string $name = null, + ?string $code = null, + ?string $status = null, + ?string $description = null, + ?string $createdSince = null, + ?string $createdUntil = null +): ListSubscriptionItemsResponse ``` ## 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 | The subscription id | +| `page` | `?int` | Query, Optional | Page number | +| `size` | `?int` | 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 -[`GetUsageResponse`](../../doc/models/get-usage-response.md) +[`ListSubscriptionItemsResponse`](../../doc/models/list-subscription-items-response.md) ## Example Usage ```php $subscriptionId = 'subscription_id0'; -$itemId = 'item_id0'; - -$body = CreateUsageRequestBuilder::init( - 156, - 'description4', - DateTimeHelper::fromRfc3339DateTimeRequired('2016-03-13T12:52:32.123Z') -)->build(); - -$result = $subscriptionsController->createUsage( - $subscriptionId, - $itemId, - $body -); +$result = $subscriptionsController->getSubscriptionItems($subscriptionId); ``` -# Get Discount by Id +# Get Subscription Item + +Get Subscription Item ```php -function getDiscountById(string $subscriptionId, string $discountId): GetDiscountResponse +function getSubscriptionItem(string $subscriptionId, string $itemId): GetSubscriptionItemResponse ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `string` | Template, Required | The subscription id | -| `discountId` | `string` | Template, Required | - | +| `subscriptionId` | `string` | Template, Required | Subscription Id | +| `itemId` | `string` | Template, Required | Item id | ## Response Type -[`GetDiscountResponse`](../../doc/models/get-discount-response.md) +[`GetSubscriptionItemResponse`](../../doc/models/get-subscription-item-response.md) ## Example Usage ```php $subscriptionId = 'subscription_id0'; -$discountId = 'discountId0'; +$itemId = 'item_id0'; -$result = $subscriptionsController->getDiscountById( +$result = $subscriptionsController->getSubscriptionItem( $subscriptionId, - $discountId + $itemId ); ``` -# Create Subscription - -Creates a new subscription +# Update Subscription Affiliation Id ```php -function createSubscription( - CreateSubscriptionRequest $body, +function updateSubscriptionAffiliationId( + string $subscriptionId, + UpdateSubscriptionAffiliationIdRequest $request, ?string $idempotencyKey = null ): GetSubscriptionResponse ``` @@ -658,7 +623,8 @@ function createSubscription( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `body` | [`CreateSubscriptionRequest`](../../doc/models/create-subscription-request.md) | Body, Required | Request for creating a subscription | +| `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 @@ -668,187 +634,178 @@ function createSubscription( ## Example Usage ```php -$body = CreateSubscriptionRequestBuilder::init( - CreateCustomerRequestBuilder::init( - '{ - "name": "Tony Stark" -}', - 'email6', - 'document6', - 'type0', - CreateAddressRequestBuilder::init( - 'street6', - 'number4', - 'zip_code0', - 'neighborhood2', - 'city6', - 'state2', - 'country0', - 'complement2', - 'line_10', - 'line_24' - )->build(), - [ - 'key0' => 'metadata3' - ], - CreatePhonesRequestBuilder::init()->build(), - 'code8' - )->build(), - CreateCardRequestBuilder::init() - ->type('credit') - ->build(), - 'code4', - 'payment_method4', - 'billing_type0', - 'statement_descriptor6', - 'description4', - 'currency6', - 'interval6', - 170, - CreatePricingSchemeRequestBuilder::init( - 'scheme_type8' - )->build(), - [ - CreateSubscriptionItemRequestBuilder::init( - 'description2', - CreatePricingSchemeRequestBuilder::init( - 'scheme_type8' - )->build(), - 'id8', - 'plan_item_id8', - [ - CreateDiscountRequestBuilder::init( - 90.66, - 'discount_type2', - 'item_id4' - )->build() - ], - 'name8' - )->build() - ], - CreateShippingRequestBuilder::init( - 52, - 'description6', - 'recipient_name2', - 'recipient_phone6', - 'address_id6', - CreateAddressRequestBuilder::init( - 'street6', - 'number4', - 'zip_code0', - 'neighborhood2', - 'city6', - 'state2', - 'country0', - 'complement2', - 'line_10', - 'line_24' - )->build(), - 'type6' - )->build(), - [ - CreateDiscountRequestBuilder::init( - 90.66, - 'discount_type2', - 'item_id4' - )->build() - ], - [ - 'key0' => 'metadata7', - 'key1' => 'metadata8' - ], - [ - CreateIncrementRequestBuilder::init( - 252.86, - 'increment_type6', - 'item_id6' - )->build() - ] +$subscriptionId = 'subscription_id0'; + +$request = UpdateSubscriptionAffiliationIdRequestBuilder::init( + 'gateway_affiliation_id2' )->build(); -$result = $subscriptionsController->createSubscription($body); +$result = $subscriptionsController->updateSubscriptionAffiliationId( + $subscriptionId, + $request +); +``` + + +# Get Discounts + +```php +function getDiscounts(string $subscriptionId, int $page, int $size): ListDiscountsResponse +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `subscriptionId` | `string` | Template, Required | The subscription id | +| `page` | `int` | Query, Required | Page number | +| `size` | `int` | Query, Required | Page size | + +## Response Type + +[`ListDiscountsResponse`](../../doc/models/list-discounts-response.md) + +## Example Usage + +```php +$subscriptionId = 'subscription_id0'; + +$page = 30; + +$size = 18; + +$result = $subscriptionsController->getDiscounts( + $subscriptionId, + $page, + $size +); ``` -# Get Increment by Id +# Update Subscription Item + +Updates a subscription item ```php -function getIncrementById(string $subscriptionId, string $incrementId): GetIncrementResponse +function updateSubscriptionItem( + string $subscriptionId, + string $itemId, + UpdateSubscriptionItemRequest $body, + ?string $idempotencyKey = null +): GetSubscriptionItemResponse ``` ## 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 | +| `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 -[`GetIncrementResponse`](../../doc/models/get-increment-response.md) +[`GetSubscriptionItemResponse`](../../doc/models/get-subscription-item-response.md) ## Example Usage ```php $subscriptionId = 'subscription_id0'; -$incrementId = 'increment_id8'; +$itemId = 'item_id0'; -$result = $subscriptionsController->getIncrementById( +$body = UpdateSubscriptionItemRequestBuilder::init( + 'description4', + 'status2', + UpdatePricingSchemeRequestBuilder::init( + 'scheme_type8', + [ + UpdatePriceBracketRequestBuilder::init( + 144, + 174 + )->build() + ] + )->build(), + 'name6' +)->build(); + +$result = $subscriptionsController->updateSubscriptionItem( $subscriptionId, - $incrementId + $itemId, + $body ); ``` -# Update Subscription Affiliation Id +# Create Subscription Item + +Creates a new Subscription item ```php -function updateSubscriptionAffiliationId( +function createSubscriptionItem( string $subscriptionId, - UpdateSubscriptionAffiliationIdRequest $request, + CreateSubscriptionItemRequest $request, ?string $idempotencyKey = null -): GetSubscriptionResponse +): GetSubscriptionItemResponse ``` ## Parameters | 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` | [`CreateSubscriptionItemRequest`](../../doc/models/create-subscription-item-request.md) | Body, Required | Request for creating a subscription item | | `idempotencyKey` | `?string` | Header, Optional | - | ## Response Type -[`GetSubscriptionResponse`](../../doc/models/get-subscription-response.md) +[`GetSubscriptionItemResponse`](../../doc/models/get-subscription-item-response.md) ## Example Usage ```php $subscriptionId = 'subscription_id0'; -$request = UpdateSubscriptionAffiliationIdRequestBuilder::init( - 'gateway_affiliation_id2' +$request = CreateSubscriptionItemRequestBuilder::init( + 'description6', + CreatePricingSchemeRequestBuilder::init( + 'scheme_type8' + )->build(), + 'id6', + 'plan_item_id6', + [ + CreateDiscountRequestBuilder::init( + 90.66, + 'discount_type2', + 'item_id4' + )->build() + ], + 'name6' )->build(); -$result = $subscriptionsController->updateSubscriptionAffiliationId( +$result = $subscriptionsController->createSubscriptionItem( $subscriptionId, $request ); ``` -# Update Subscription Metadata +# Get Usages -Updates the metadata from a subscription +Lists all usages from a subscription item ```php -function updateSubscriptionMetadata( +function getUsages( string $subscriptionId, - UpdateMetadataRequest $request, - ?string $idempotencyKey = null -): GetSubscriptionResponse + string $itemId, + ?int $page = null, + ?int $size = null, + ?string $code = null, + ?string $group = null, + ?\DateTime $usedSince = null, + ?\DateTime $usedUntil = null +): ListUsagesResponse ``` ## Parameters @@ -856,147 +813,143 @@ function 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 | -| `idempotencyKey` | `?string` | Header, Optional | - | +| `itemId` | `string` | Template, Required | The subscription item id | +| `page` | `?int` | Query, Optional | Page number | +| `size` | `?int` | 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` | `?DateTime` | Query, Optional | - | +| `usedUntil` | `?DateTime` | Query, Optional | - | ## Response Type -[`GetSubscriptionResponse`](../../doc/models/get-subscription-response.md) +[`ListUsagesResponse`](../../doc/models/list-usages-response.md) ## Example Usage ```php $subscriptionId = 'subscription_id0'; -$request = UpdateMetadataRequestBuilder::init( - [ - 'key0' => 'metadata3' - ] -)->build(); +$itemId = 'item_id0'; -$result = $subscriptionsController->updateSubscriptionMetadata( +$result = $subscriptionsController->getUsages( $subscriptionId, - $request + $itemId ); ``` -# Delete Increment +# Update Subscription Minium Price -Deletes a increment +Atualização do valor mínimo da assinatura ```php -function deleteIncrement( +function updateSubscriptionMiniumPrice( string $subscriptionId, - string $incrementId, + UpdateSubscriptionMinimumPriceRequest $request, ?string $idempotencyKey = null -): GetIncrementResponse +): GetSubscriptionResponse ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `string` | Template, Required | Subscription id | -| `incrementId` | `string` | Template, Required | Increment id | +| `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 | | `idempotencyKey` | `?string` | Header, Optional | - | ## Response Type -[`GetIncrementResponse`](../../doc/models/get-increment-response.md) +[`GetSubscriptionResponse`](../../doc/models/get-subscription-response.md) ## Example Usage ```php $subscriptionId = 'subscription_id0'; -$incrementId = 'increment_id8'; +$request = UpdateSubscriptionMinimumPriceRequestBuilder::init()->build(); -$result = $subscriptionsController->deleteIncrement( +$result = $subscriptionsController->updateSubscriptionMiniumPrice( $subscriptionId, - $incrementId + $request ); ``` -# Get Subscription Cycles +# Get Subscription Cycle by Id ```php -function getSubscriptionCycles(string $subscriptionId, string $page, string $size): ListCyclesResponse +function getSubscriptionCycleById(string $subscriptionId, string $cycleId): GetPeriodResponse ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `string` | Template, Required | Subscription Id | -| `page` | `string` | Query, Required | Page number | -| `size` | `string` | Query, Required | Page size | +| `subscriptionId` | `string` | Template, Required | The subscription id | +| `cycleId` | `string` | Template, Required | - | ## Response Type -[`ListCyclesResponse`](../../doc/models/list-cycles-response.md) +[`GetPeriodResponse`](../../doc/models/get-period-response.md) ## Example Usage ```php $subscriptionId = 'subscription_id0'; -$page = 'page8'; - -$size = 'size0'; +$cycleId = 'cycleId0'; -$result = $subscriptionsController->getSubscriptionCycles( +$result = $subscriptionsController->getSubscriptionCycleById( $subscriptionId, - $page, - $size + $cycleId ); ``` -# Get Discounts +# Create an Usage + +Create Usage ```php -function getDiscounts(string $subscriptionId, int $page, int $size): ListDiscountsResponse +function createAnUsage(string $subscriptionId, string $itemId, ?string $idempotencyKey = null): GetUsageResponse ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `string` | Template, Required | The subscription id | -| `page` | `int` | Query, Required | Page number | -| `size` | `int` | Query, Required | Page size | +| `subscriptionId` | `string` | Template, Required | Subscription id | +| `itemId` | `string` | Template, Required | Item id | +| `idempotencyKey` | `?string` | Header, Optional | - | ## Response Type -[`ListDiscountsResponse`](../../doc/models/list-discounts-response.md) +[`GetUsageResponse`](../../doc/models/get-usage-response.md) ## Example Usage ```php $subscriptionId = 'subscription_id0'; -$page = 30; - -$size = 18; +$itemId = 'item_id0'; -$result = $subscriptionsController->getDiscounts( +$result = $subscriptionsController->createAnUsage( $subscriptionId, - $page, - $size + $itemId ); ``` -# Update Subscription Billing Date +# Cancel Subscription -Updates the billing date from a subscription +Cancels a subscription ```php -function updateSubscriptionBillingDate( +function cancelSubscription( string $subscriptionId, - UpdateSubscriptionBillingDateRequest $request, + ?CreateCancelSubscriptionRequest $request = null, ?string $idempotencyKey = null ): GetSubscriptionResponse ``` @@ -1005,8 +958,8 @@ function 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 | +| `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 @@ -1018,11 +971,11 @@ function updateSubscriptionBillingDate( ```php $subscriptionId = 'subscription_id0'; -$request = UpdateSubscriptionBillingDateRequestBuilder::init( - DateTimeHelper::fromRfc3339DateTimeRequired('2016-03-13T12:52:32.123Z') +$request = CreateCancelSubscriptionRequestBuilder::init( + true )->build(); -$result = $subscriptionsController->updateSubscriptionBillingDate( +$result = $subscriptionsController->cancelSubscription( $subscriptionId, $request ); @@ -1099,9 +1052,49 @@ $result = $subscriptionsController->getIncrements($subscriptionId); Updates the boleto due days from a subscription ```php -function updateSubscriptionDueDays( +function updateSubscriptionDueDays( + string $subscriptionId, + UpdateSubscriptionDueDaysRequest $request, + ?string $idempotencyKey = null +): GetSubscriptionResponse +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `subscriptionId` | `string` | Template, Required | Subscription Id | +| `request` | [`UpdateSubscriptionDueDaysRequest`](../../doc/models/update-subscription-due-days-request.md) | Body, Required | - | +| `idempotencyKey` | `?string` | Header, Optional | - | + +## Response Type + +[`GetSubscriptionResponse`](../../doc/models/get-subscription-response.md) + +## Example Usage + +```php +$subscriptionId = 'subscription_id0'; + +$request = UpdateSubscriptionDueDaysRequestBuilder::init( + 226 +)->build(); + +$result = $subscriptionsController->updateSubscriptionDueDays( + $subscriptionId, + $request +); +``` + + +# Update Subscription Card + +Updates the credit card from a subscription + +```php +function updateSubscriptionCard( string $subscriptionId, - UpdateSubscriptionDueDaysRequest $request, + UpdateSubscriptionCardRequest $request, ?string $idempotencyKey = null ): GetSubscriptionResponse ``` @@ -1110,8 +1103,8 @@ function 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 | Subscription id | +| `request` | [`UpdateSubscriptionCardRequest`](../../doc/models/update-subscription-card-request.md) | Body, Required | Request for updating a card | | `idempotencyKey` | `?string` | Header, Optional | - | ## Response Type @@ -1123,27 +1116,31 @@ function updateSubscriptionDueDays( ```php $subscriptionId = 'subscription_id0'; -$request = UpdateSubscriptionDueDaysRequestBuilder::init( - 226 +$request = UpdateSubscriptionCardRequestBuilder::init( + CreateCardRequestBuilder::init() + ->type('credit') + ->build(), + 'card_id2' )->build(); -$result = $subscriptionsController->updateSubscriptionDueDays( +$result = $subscriptionsController->updateSubscriptionCard( $subscriptionId, $request ); ``` -# Update Subscription Start At +# Delete Usage -Updates the start at date from a subscription +Deletes a usage ```php -function updateSubscriptionStartAt( +function deleteUsage( string $subscriptionId, - UpdateSubscriptionStartAtRequest $request, + string $itemId, + string $usageId, ?string $idempotencyKey = null -): GetSubscriptionResponse +): GetUsageResponse ``` ## Parameters @@ -1151,95 +1148,83 @@ function 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 | +| `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 ```php $subscriptionId = 'subscription_id0'; -$request = UpdateSubscriptionStartAtRequestBuilder::init( - DateTimeHelper::fromRfc3339DateTimeRequired('2016-03-13T12:52:32.123Z') -)->build(); +$itemId = 'item_id0'; -$result = $subscriptionsController->updateSubscriptionStartAt( +$usageId = 'usage_id0'; + +$result = $subscriptionsController->deleteUsage( $subscriptionId, - $request + $itemId, + $usageId ); ``` -# Update Subscription Item +# Create Discount -Updates a subscription item +Creates a discount ```php -function updateSubscriptionItem( +function createDiscount( string $subscriptionId, - string $itemId, - UpdateSubscriptionItemRequest $body, + CreateDiscountRequest $request, ?string $idempotencyKey = null -): GetSubscriptionItemResponse +): GetDiscountResponse ``` ## 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 | +| `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 -[`GetSubscriptionItemResponse`](../../doc/models/get-subscription-item-response.md) +[`GetDiscountResponse`](../../doc/models/get-discount-response.md) ## Example Usage ```php $subscriptionId = 'subscription_id0'; -$itemId = 'item_id0'; - -$body = UpdateSubscriptionItemRequestBuilder::init( - 'description4', - 'status2', - UpdatePricingSchemeRequestBuilder::init( - 'scheme_type8', - [ - UpdatePriceBracketRequestBuilder::init( - 144, - 174 - )->build() - ] - )->build(), - 'name6' +$request = CreateDiscountRequestBuilder::init( + 185.28, + 'discount_type4', + 'item_id6' )->build(); -$result = $subscriptionsController->updateSubscriptionItem( +$result = $subscriptionsController->createDiscount( $subscriptionId, - $itemId, - $body + $request ); ``` -# Create Subscription Item +# Update Subscription Payment Method -Creates a new Subscription item +Updates the payment method from a subscription ```php -function createSubscriptionItem( +function updateSubscriptionPaymentMethod( string $subscriptionId, - CreateSubscriptionItemRequest $request, + UpdateSubscriptionPaymentMethodRequest $request, ?string $idempotencyKey = null -): GetSubscriptionItemResponse +): GetSubscriptionResponse ``` ## Parameters @@ -1247,48 +1232,43 @@ function 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 | +| `request` | [`UpdateSubscriptionPaymentMethodRequest`](../../doc/models/update-subscription-payment-method-request.md) | Body, Required | Request for updating the paymentmethod from a subscription | | `idempotencyKey` | `?string` | Header, Optional | - | ## Response Type -[`GetSubscriptionItemResponse`](../../doc/models/get-subscription-item-response.md) +[`GetSubscriptionResponse`](../../doc/models/get-subscription-response.md) ## Example Usage ```php $subscriptionId = 'subscription_id0'; -$request = CreateSubscriptionItemRequestBuilder::init( - 'description6', - CreatePricingSchemeRequestBuilder::init( - 'scheme_type8' - )->build(), - 'id6', - 'plan_item_id6', - [ - CreateDiscountRequestBuilder::init( - 90.66, - 'discount_type2', - 'item_id4' - )->build() - ], - 'name6' +$request = UpdateSubscriptionPaymentMethodRequestBuilder::init( + 'payment_method4', + 'card_id2', + CreateCardRequestBuilder::init() + ->type('credit') + ->build() )->build(); -$result = $subscriptionsController->createSubscriptionItem( +$result = $subscriptionsController->updateSubscriptionPaymentMethod( $subscriptionId, $request ); ``` -# Get Subscription +# Create Increment -Gets a subscription +Creates a increment ```php -function getSubscription(string $subscriptionId): GetSubscriptionResponse +function createIncrement( + string $subscriptionId, + CreateIncrementRequest $request, + ?string $idempotencyKey = null +): GetIncrementResponse ``` ## Parameters @@ -1296,53 +1276,56 @@ function getSubscription(string $subscriptionId): GetSubscriptionResponse | 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 | +| `idempotencyKey` | `?string` | Header, Optional | - | ## Response Type -[`GetSubscriptionResponse`](../../doc/models/get-subscription-response.md) +[`GetIncrementResponse`](../../doc/models/get-increment-response.md) ## Example Usage ```php $subscriptionId = 'subscription_id0'; -$result = $subscriptionsController->getSubscription($subscriptionId); +$request = CreateIncrementRequestBuilder::init( + 185.28, + 'increment_type8', + 'item_id6' +)->build(); + +$result = $subscriptionsController->createIncrement( + $subscriptionId, + $request +); ``` -# Get Usages +# Create Usage -Lists all usages from a subscription item +Creates a usage ```php -function getUsages( +function createUsage( string $subscriptionId, string $itemId, - ?int $page = null, - ?int $size = null, - ?string $code = null, - ?string $group = null, - ?\DateTime $usedSince = null, - ?\DateTime $usedUntil = null -): ListUsagesResponse + CreateUsageRequest $body, + ?string $idempotencyKey = null +): GetUsageResponse ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `string` | Template, Required | The subscription id | -| `itemId` | `string` | Template, Required | The subscription item id | -| `page` | `?int` | Query, Optional | Page number | -| `size` | `?int` | 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` | `?DateTime` | Query, Optional | - | -| `usedUntil` | `?DateTime` | Query, Optional | - | +| `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 -[`ListUsagesResponse`](../../doc/models/list-usages-response.md) +[`GetUsageResponse`](../../doc/models/get-usage-response.md) ## Example Usage @@ -1351,57 +1334,63 @@ $subscriptionId = 'subscription_id0'; $itemId = 'item_id0'; -$result = $subscriptionsController->getUsages( +$body = CreateUsageRequestBuilder::init( + 156, + 'description4', + DateTimeHelper::fromRfc3339DateTimeRequired('2016-03-13T12:52:32.123Z') +)->build(); + +$result = $subscriptionsController->createUsage( $subscriptionId, - $itemId + $itemId, + $body ); ``` -# Update Latest Period End At +# Get Subscription Cycles ```php -function updateLatestPeriodEndAt( - string $subscriptionId, - UpdateCurrentCycleEndDateRequest $request, - ?string $idempotencyKey = null -): GetSubscriptionResponse +function getSubscriptionCycles(string $subscriptionId, string $page, string $size): ListCyclesResponse ``` ## Parameters | 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 | -| `idempotencyKey` | `?string` | Header, Optional | - | +| `subscriptionId` | `string` | Template, Required | Subscription Id | +| `page` | `string` | Query, Required | Page number | +| `size` | `string` | Query, Required | Page size | ## Response Type -[`GetSubscriptionResponse`](../../doc/models/get-subscription-response.md) +[`ListCyclesResponse`](../../doc/models/list-cycles-response.md) ## Example Usage ```php $subscriptionId = 'subscription_id0'; -$request = UpdateCurrentCycleEndDateRequestBuilder::init()->build(); +$page = 'page8'; -$result = $subscriptionsController->updateLatestPeriodEndAt( +$size = 'size0'; + +$result = $subscriptionsController->getSubscriptionCycles( $subscriptionId, - $request + $page, + $size ); ``` -# Update Subscription Minium Price +# Update Subscription Billing Date -Atualização do valor mínimo da assinatura +Updates the billing date from a subscription ```php -function updateSubscriptionMiniumPrice( +function updateSubscriptionBillingDate( string $subscriptionId, - UpdateSubscriptionMinimumPriceRequest $request, + UpdateSubscriptionBillingDateRequest $request, ?string $idempotencyKey = null ): GetSubscriptionResponse ``` @@ -1410,8 +1399,8 @@ function 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 | 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 @@ -1423,19 +1412,27 @@ function updateSubscriptionMiniumPrice( ```php $subscriptionId = 'subscription_id0'; -$request = UpdateSubscriptionMinimumPriceRequestBuilder::init()->build(); +$request = UpdateSubscriptionBillingDateRequestBuilder::init( + DateTimeHelper::fromRfc3339DateTimeRequired('2016-03-13T12:52:32.123Z') +)->build(); -$result = $subscriptionsController->updateSubscriptionMiniumPrice( +$result = $subscriptionsController->updateSubscriptionBillingDate( $subscriptionId, $request ); ``` -# Get Subscription Cycle by Id +# Update Subscription Start At + +Updates the start at date from a subscription ```php -function getSubscriptionCycleById(string $subscriptionId, string $cycleId): GetPeriodResponse +function updateSubscriptionStartAt( + string $subscriptionId, + UpdateSubscriptionStartAtRequest $request, + ?string $idempotencyKey = null +): GetSubscriptionResponse ``` ## Parameters @@ -1443,22 +1440,25 @@ function getSubscriptionCycleById(string $subscriptionId, string $cycleId): GetP | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `subscriptionId` | `string` | Template, Required | The subscription id | -| `cycleId` | `string` | Template, Required | - | +| `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 -[`GetPeriodResponse`](../../doc/models/get-period-response.md) +[`GetSubscriptionResponse`](../../doc/models/get-subscription-response.md) ## Example Usage ```php $subscriptionId = 'subscription_id0'; -$cycleId = 'cycleId0'; +$request = UpdateSubscriptionStartAtRequestBuilder::init( + DateTimeHelper::fromRfc3339DateTimeRequired('2016-03-13T12:52:32.123Z') +)->build(); -$result = $subscriptionsController->getSubscriptionCycleById( +$result = $subscriptionsController->updateSubscriptionStartAt( $subscriptionId, - $cycleId + $request ); ``` diff --git a/doc/controllers/transfers.md b/doc/controllers/transfers.md index 36eb1cb..306c6bf 100644 --- a/doc/controllers/transfers.md +++ b/doc/controllers/transfers.md @@ -10,9 +10,28 @@ $transfersController = $client->getTransfersController(); ## Methods +* [Get Transfers](../../doc/controllers/transfers.md#get-transfers) * [Get Transfer by Id](../../doc/controllers/transfers.md#get-transfer-by-id) * [Create Transfer](../../doc/controllers/transfers.md#create-transfer) -* [Get Transfers](../../doc/controllers/transfers.md#get-transfers) + + +# Get Transfers + +Gets all transfers + +```php +function getTransfers(): ListTransfers +``` + +## Response Type + +[`ListTransfers`](../../doc/models/list-transfers.md) + +## Example Usage + +```php +$result = $transfersController->getTransfers(); +``` # Get Transfer by Id @@ -68,22 +87,3 @@ $request = CreateTransferBuilder::init( $result = $transfersController->createTransfer($request); ``` - -# Get Transfers - -Gets all transfers - -```php -function getTransfers(): ListTransfers -``` - -## Response Type - -[`ListTransfers`](../../doc/models/list-transfers.md) - -## Example Usage - -```php -$result = $transfersController->getTransfers(); -``` - diff --git a/doc/models/create-managing-partner-request.md b/doc/models/create-managing-partner-request.md new file mode 100644 index 0000000..5c327a1 --- /dev/null +++ b/doc/models/create-managing-partner-request.md @@ -0,0 +1,56 @@ + +# Create Managing Partner Request + +Managing Partner Request + +## Structure + +`CreateManagingPartnerRequest` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `name` | `string` | Required | - | getName(): string | setName(string name): void | +| `email` | `string` | Required | - | getEmail(): string | setEmail(string email): void | +| `document` | `string` | Required | - | getDocument(): string | setDocument(string document): void | +| `motherName` | `string` | Required | - | getMotherName(): string | setMotherName(string motherName): void | +| `birthdate` | `string` | Required | - | getBirthdate(): string | setBirthdate(string birthdate): void | +| `monthlyIncome` | `string` | Required | - | getMonthlyIncome(): string | setMonthlyIncome(string monthlyIncome): void | +| `professionalOccupation` | `string` | Required | - | getProfessionalOccupation(): string | setProfessionalOccupation(string professionalOccupation): void | +| `selfDeclaredLegalRepresentative` | `bool` | Required | - | getSelfDeclaredLegalRepresentative(): bool | setSelfDeclaredLegalRepresentative(bool selfDeclaredLegalRepresentative): void | +| `address` | [`CreateRegisterInformationAddressRequest`](../../doc/models/create-register-information-address-request.md) | Required | - | getAddress(): CreateRegisterInformationAddressRequest | setAddress(CreateRegisterInformationAddressRequest address): void | +| `phoneNumbers` | [`CreateRegisterInformationPhoneRequest[]`](../../doc/models/create-register-information-phone-request.md) | Required | - | getPhoneNumbers(): array | setPhoneNumbers(array phoneNumbers): void | + +## Example (as JSON) + +```json +{ + "name": "name4", + "email": "email2", + "document": "document2", + "mother_name": "mother_name0", + "birthdate": "birthdate8", + "monthly_income": "monthly_income0", + "professional_occupation": "professional_occupation8", + "self_declared_legal_representative": false, + "address": { + "street": "street6", + "complementary": "complementary8", + "street_number": "street_number6", + "neighborhood": "neighborhood2", + "city": "city6", + "state": "state2", + "zip_code": "zip_code0", + "reference_point": "reference_point0" + }, + "phone_numbers": [ + { + "ddd": "ddd4", + "number": "number2", + "type": "type0" + } + ] +} +``` + diff --git a/doc/models/create-recipient-request.md b/doc/models/create-recipient-request.md index 7e8cdc7..dbd7c62 100644 --- a/doc/models/create-recipient-request.md +++ b/doc/models/create-recipient-request.md @@ -11,26 +11,22 @@ Request for creating a recipient | Name | Type | Tags | Description | Getter | Setter | | --- | --- | --- | --- | --- | --- | -| `name` | `string` | Required | Recipient name | getName(): string | setName(string name): void | -| `email` | `string` | Required | Recipient email | getEmail(): string | setEmail(string email): void | -| `description` | `string` | Required | Recipient description | getDescription(): string | setDescription(string description): void | -| `document` | `string` | Required | Recipient document number | getDocument(): string | setDocument(string document): void | -| `type` | `string` | Required | Recipient type | getType(): string | setType(string type): void | +| `name` | `?string` | Optional | Recipient name. Required if the register_information field isn't populated. | getName(): ?string | setName(?string name): void | +| `email` | `?string` | Optional | Recipient email. Required if the register_information field isn't populated. | getEmail(): ?string | setEmail(?string email): void | +| `description` | `?string` | Optional | Recipient description | getDescription(): ?string | setDescription(?string description): void | +| `document` | `?string` | Optional | Recipient document number. Required if the register_information field isn't populated. | getDocument(): ?string | setDocument(?string document): void | +| `type` | `?string` | Optional | Recipient type. Required if the register_information field isn't populated. | getType(): ?string | setType(?string type): void | | `defaultBankAccount` | [`CreateBankAccountRequest`](../../doc/models/create-bank-account-request.md) | Required | Bank account | getDefaultBankAccount(): CreateBankAccountRequest | setDefaultBankAccount(CreateBankAccountRequest defaultBankAccount): void | | `metadata` | `array` | Required | Metadata | getMetadata(): array | setMetadata(array metadata): void | | `transferSettings` | [`?CreateTransferSettingsRequest`](../../doc/models/create-transfer-settings-request.md) | Optional | Receiver Transfer Information | getTransferSettings(): ?CreateTransferSettingsRequest | setTransferSettings(?CreateTransferSettingsRequest transferSettings): void | | `code` | `string` | Required | Recipient code | getCode(): string | setCode(string code): void | | `paymentMode` | `string` | Required | Payment mode
**Default**: `'bank_transfer'` | getPaymentMode(): string | setPaymentMode(string paymentMode): void | +| `registerInformation` | [`?CreateRegisterInformationBaseRequest`](../../doc/models/create-register-information-base-request.md) | Optional | Register Information | getRegisterInformation(): ?CreateRegisterInformationBaseRequest | setRegisterInformation(?CreateRegisterInformationBaseRequest registerInformation): void | ## Example (as JSON) ```json { - "name": "name6", - "email": "email0", - "description": "description6", - "document": "document0", - "type": "type4", "default_bank_account": { "holder_name": "holder_name4", "holder_type": "holder_type0", @@ -53,11 +49,11 @@ Request for creating a recipient }, "code": "code4", "payment_mode": "bank_transfer", - "transfer_settings": { - "transfer_enabled": false, - "transfer_interval": "transfer_interval4", - "transfer_day": 10 - } + "name": "name6", + "email": "email0", + "description": "description6", + "document": "document0", + "type": "type4" } ``` diff --git a/doc/models/create-register-information-address-request.md b/doc/models/create-register-information-address-request.md new file mode 100644 index 0000000..bb0bd05 --- /dev/null +++ b/doc/models/create-register-information-address-request.md @@ -0,0 +1,37 @@ + +# Create Register Information Address Request + +Register Information Address + +## Structure + +`CreateRegisterInformationAddressRequest` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `street` | `string` | Required | - | getStreet(): string | setStreet(string street): void | +| `complementary` | `string` | Required | - | getComplementary(): string | setComplementary(string complementary): void | +| `streetNumber` | `string` | Required | - | getStreetNumber(): string | setStreetNumber(string streetNumber): void | +| `neighborhood` | `string` | Required | - | getNeighborhood(): string | setNeighborhood(string neighborhood): void | +| `city` | `string` | Required | - | getCity(): string | setCity(string city): void | +| `state` | `string` | Required | - | getState(): string | setState(string state): void | +| `zipCode` | `string` | Required | - | getZipCode(): string | setZipCode(string zipCode): void | +| `referencePoint` | `string` | Required | - | getReferencePoint(): string | setReferencePoint(string referencePoint): void | + +## Example (as JSON) + +```json +{ + "street": "street8", + "complementary": "complementary0", + "street_number": "street_number8", + "neighborhood": "neighborhood4", + "city": "city8", + "state": "state4", + "zip_code": "zip_code2", + "reference_point": "reference_point2" +} +``` + diff --git a/doc/models/create-register-information-base-request.md b/doc/models/create-register-information-base-request.md new file mode 100644 index 0000000..a5458fe --- /dev/null +++ b/doc/models/create-register-information-base-request.md @@ -0,0 +1,37 @@ + +# Create Register Information Base Request + +Request object for RegisterInformation. + +## Structure + +`CreateRegisterInformationBaseRequest` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `email` | `string` | Required | - | getEmail(): string | setEmail(string email): void | +| `document` | `string` | Required | - | getDocument(): string | setDocument(string document): void | +| `type` | `string` | Required | "individual" ou "corporation" | getType(): string | setType(string type): void | +| `siteUrl` | `?string` | Optional | - | getSiteUrl(): ?string | setSiteUrl(?string siteUrl): void | +| `phoneNumbers` | [`CreateRegisterInformationPhoneRequest[]`](../../doc/models/create-register-information-phone-request.md) | Required | - | getPhoneNumbers(): array | setPhoneNumbers(array phoneNumbers): void | + +## Example (as JSON) + +```json +{ + "email": "email4", + "document": "document6", + "type": "type8", + "phone_numbers": [ + { + "ddd": "ddd4", + "number": "number2", + "type": "type0" + } + ], + "site_url": "site_url4" +} +``` + diff --git a/doc/models/create-register-information-corporation-request.md b/doc/models/create-register-information-corporation-request.md new file mode 100644 index 0000000..70d9cee --- /dev/null +++ b/doc/models/create-register-information-corporation-request.md @@ -0,0 +1,87 @@ + +# Create Register Information Corporation Request + +## Structure + +`CreateRegisterInformationCorporationRequest` + +## Inherits From + +[`CreateRegisterInformationBaseRequest`](../../doc/models/create-register-information-base-request.md) + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `companyName` | `string` | Required | - | getCompanyName(): string | setCompanyName(string companyName): void | +| `tradingName` | `string` | Required | - | getTradingName(): string | setTradingName(string tradingName): void | +| `annualRevenue` | `string` | Required | - | getAnnualRevenue(): string | setAnnualRevenue(string annualRevenue): void | +| `corporationType` | `?string` | Optional | - | getCorporationType(): ?string | setCorporationType(?string corporationType): void | +| `foundingDate` | `?string` | Optional | - | getFoundingDate(): ?string | setFoundingDate(?string foundingDate): void | +| `cnae` | `?string` | Optional | - | getCnae(): ?string | setCnae(?string cnae): void | +| `managingPartners` | [`CreateManagingPartnerRequest[]`](../../doc/models/create-managing-partner-request.md) | Required | - | getManagingPartners(): array | setManagingPartners(array managingPartners): void | +| `mainAddress` | [`CreateRegisterInformationAddressRequest`](../../doc/models/create-register-information-address-request.md) | Required | - | getMainAddress(): CreateRegisterInformationAddressRequest | setMainAddress(CreateRegisterInformationAddressRequest mainAddress): void | + +## Example (as JSON) + +```json +{ + "email": "email4", + "document": "document6", + "type": "type8", + "phone_numbers": [ + { + "ddd": "ddd4", + "number": "number2", + "type": "type0" + } + ], + "company_name": "company_name8", + "trading_name": "trading_name0", + "annual_revenue": "annual_revenue0", + "managing_partners": [ + { + "name": "name4", + "email": "email2", + "document": "document8", + "mother_name": "mother_name0", + "birthdate": "birthdate8", + "monthly_income": "monthly_income0", + "professional_occupation": "professional_occupation8", + "self_declared_legal_representative": false, + "address": { + "street": "street6", + "complementary": "complementary8", + "street_number": "street_number6", + "neighborhood": "neighborhood2", + "city": "city6", + "state": "state2", + "zip_code": "zip_code0", + "reference_point": "reference_point0" + }, + "phone_numbers": [ + { + "ddd": "ddd4", + "number": "number2", + "type": "type0" + } + ] + } + ], + "main_address": { + "street": "street8", + "complementary": "complementary0", + "street_number": "street_number8", + "neighborhood": "neighborhood4", + "city": "city8", + "state": "state4", + "zip_code": "zip_code2", + "reference_point": "reference_point2" + }, + "site_url": "site_url4", + "corporation_type": "corporation_type2", + "founding_date": "founding_date2", + "cnae": "cnae2" +} +``` + diff --git a/doc/models/create-register-information-individual-request.md b/doc/models/create-register-information-individual-request.md new file mode 100644 index 0000000..6c087bf --- /dev/null +++ b/doc/models/create-register-information-individual-request.md @@ -0,0 +1,60 @@ + +# Create Register Information Individual Request + +## Structure + +`CreateRegisterInformationIndividualRequest` + +## Inherits From + +[`CreateRegisterInformationBaseRequest`](../../doc/models/create-register-information-base-request.md) + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `name` | `string` | Required | - | getName(): string | setName(string name): void | +| `motherName` | `?string` | Optional | - | getMotherName(): ?string | setMotherName(?string motherName): void | +| `birthdate` | `string` | Required | - | getBirthdate(): string | setBirthdate(string birthdate): void | +| `monthlyIncome` | `string` | Required | - | getMonthlyIncome(): string | setMonthlyIncome(string monthlyIncome): void | +| `professionalOccupation` | `string` | Required | - | getProfessionalOccupation(): string | setProfessionalOccupation(string professionalOccupation): void | +| `address` | [`CreateRegisterInformationAddressRequest`](../../doc/models/create-register-information-address-request.md) | Required | - | getAddress(): CreateRegisterInformationAddressRequest | setAddress(CreateRegisterInformationAddressRequest address): void | + +## Example (as JSON) + +```json +{ + "email": "email4", + "document": "document6", + "type": "type8", + "site_url": "site_url4", + "phone_numbers": [ + { + "ddd": "ddd4", + "number": "number2", + "type": "type0" + }, + { + "ddd": "ddd4", + "number": "number2", + "type": "type0" + } + ], + "name": "name6", + "mother_name": "mother_name2", + "birthdate": "birthdate0", + "monthly_income": "monthly_income2", + "professional_occupation": "professional_occupation0", + "address": { + "street": "street6", + "complementary": "complementary8", + "street_number": "street_number6", + "neighborhood": "neighborhood2", + "city": "city6", + "state": "state2", + "zip_code": "zip_code0", + "reference_point": "reference_point0" + } +} +``` + diff --git a/doc/models/create-register-information-phone-request.md b/doc/models/create-register-information-phone-request.md new file mode 100644 index 0000000..52011c0 --- /dev/null +++ b/doc/models/create-register-information-phone-request.md @@ -0,0 +1,27 @@ + +# Create Register Information Phone Request + +Register Information Phone + +## Structure + +`CreateRegisterInformationPhoneRequest` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `ddd` | `string` | Required | - | getDdd(): string | setDdd(string ddd): void | +| `number` | `string` | Required | - | getNumber(): string | setNumber(string number): void | +| `type` | `string` | Required | - | getType(): string | setType(string type): void | + +## Example (as JSON) + +```json +{ + "ddd": "ddd4", + "number": "number6", + "type": "type8" +} +``` + diff --git a/doc/models/get-balance-operation-response.md b/doc/models/get-balance-operation-response.md index 5e701ed..695306e 100644 --- a/doc/models/get-balance-operation-response.md +++ b/doc/models/get-balance-operation-response.md @@ -16,7 +16,7 @@ Generic response object for getting a BalanceOperation. | `balanceAmount` | `?string` | Optional | - | getBalanceAmount(): ?string | setBalanceAmount(?string balanceAmount): void | | `balanceOldAmount` | `?string` | Optional | - | getBalanceOldAmount(): ?string | setBalanceOldAmount(?string balanceOldAmount): void | | `type` | `?string` | Optional | - | getType(): ?string | setType(?string type): void | -| `amount` | `?string` | Optional | - | getAmount(): ?string | setAmount(?string amount): void | +| `amount` | `?int` | Optional | - | getAmount(): ?int | setAmount(?int amount): void | | `fee` | `?string` | Optional | - | getFee(): ?string | setFee(?string fee): void | | `createdAt` | `?string` | Optional | - | getCreatedAt(): ?string | setCreatedAt(?string createdAt): void | | `movementObject` | [`?GetMovementObjectBaseResponse`](../../doc/models/get-movement-object-base-response.md) | Optional | - | getMovementObject(): ?GetMovementObjectBaseResponse | setMovementObject(?GetMovementObjectBaseResponse movementObject): void | diff --git a/doc/models/get-managing-partner-response.md b/doc/models/get-managing-partner-response.md new file mode 100644 index 0000000..f642ca4 --- /dev/null +++ b/doc/models/get-managing-partner-response.md @@ -0,0 +1,37 @@ + +# Get Managing Partner Response + +Response object for getting an ManagingPartnerResponse + +## Structure + +`GetManagingPartnerResponse` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `name` | `?string` | Optional | - | getName(): ?string | setName(?string name): void | +| `email` | `?string` | Optional | - | getEmail(): ?string | setEmail(?string email): void | +| `document` | `?string` | Optional | - | getDocument(): ?string | setDocument(?string document): void | +| `type` | `?string` | Optional | - | getType(): ?string | setType(?string type): void | +| `motherName` | `?string` | Optional | - | getMotherName(): ?string | setMotherName(?string motherName): void | +| `birthdate` | `?string` | Optional | - | getBirthdate(): ?string | setBirthdate(?string birthdate): void | +| `monthlyIncome` | `?string` | Optional | - | getMonthlyIncome(): ?string | setMonthlyIncome(?string monthlyIncome): void | +| `professionalOccupation` | `?string` | Optional | - | getProfessionalOccupation(): ?string | setProfessionalOccupation(?string professionalOccupation): void | +| `selfDeclaredRepresentative` | `?bool` | Optional | - | getSelfDeclaredRepresentative(): ?bool | setSelfDeclaredRepresentative(?bool selfDeclaredRepresentative): void | +| `address` | [`?GetRegisterInformationAddressResponse`](../../doc/models/get-register-information-address-response.md) | Optional | - | getAddress(): ?GetRegisterInformationAddressResponse | setAddress(?GetRegisterInformationAddressResponse address): void | +| `phoneNumbers` | [`?(GetPhoneNumberResponse[])`](../../doc/models/get-phone-number-response.md) | Optional | - | getPhoneNumbers(): ?array | setPhoneNumbers(?array phoneNumbers): void | + +## Example (as JSON) + +```json +{ + "name": "name0", + "email": "email6", + "document": "document6", + "type": "type0", + "mother_name": "mother_name6" +} +``` + diff --git a/doc/models/get-phone-number-response.md b/doc/models/get-phone-number-response.md new file mode 100644 index 0000000..a9200f3 --- /dev/null +++ b/doc/models/get-phone-number-response.md @@ -0,0 +1,27 @@ + +# Get Phone Number Response + +Response object for getting an PhoneNumberResponse + +## Structure + +`GetPhoneNumberResponse` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `ddd` | `?string` | Optional | - | getDdd(): ?string | setDdd(?string ddd): void | +| `number` | `?string` | Optional | - | getNumber(): ?string | setNumber(?string number): void | +| `type` | `?string` | Optional | - | getType(): ?string | setType(?string type): void | + +## Example (as JSON) + +```json +{ + "ddd": "ddd2", + "number": "number0", + "type": "type8" +} +``` + diff --git a/doc/models/get-recipient-response.md b/doc/models/get-recipient-response.md index 6f1363c..660f600 100644 --- a/doc/models/get-recipient-response.md +++ b/doc/models/get-recipient-response.md @@ -28,6 +28,7 @@ Recipient response | `transferSettings` | [`?GetTransferSettingsResponse`](../../doc/models/get-transfer-settings-response.md) | Optional | - | getTransferSettings(): ?GetTransferSettingsResponse | setTransferSettings(?GetTransferSettingsResponse transferSettings): void | | `code` | `?string` | Optional | Recipient code | getCode(): ?string | setCode(?string code): void | | `paymentMode` | `?string` | Optional | Payment mode
**Default**: `'bank_transfer'` | getPaymentMode(): ?string | setPaymentMode(?string paymentMode): void | +| `registerInformation` | [`?GetRegisterInformationResponse`](../../doc/models/get-register-information-response.md) | Optional | - | getRegisterInformation(): ?GetRegisterInformationResponse | setRegisterInformation(?GetRegisterInformationResponse registerInformation): void | ## Example (as JSON) diff --git a/doc/models/get-register-information-address-response.md b/doc/models/get-register-information-address-response.md new file mode 100644 index 0000000..df61567 --- /dev/null +++ b/doc/models/get-register-information-address-response.md @@ -0,0 +1,34 @@ + +# Get Register Information Address Response + +Response object for getting an RegisterInformationAddress + +## Structure + +`GetRegisterInformationAddressResponse` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `street` | `?string` | Optional | - | getStreet(): ?string | setStreet(?string street): void | +| `complementary` | `?string` | Optional | - | getComplementary(): ?string | setComplementary(?string complementary): void | +| `streetNumber` | `?string` | Optional | - | getStreetNumber(): ?string | setStreetNumber(?string streetNumber): void | +| `neighborhood` | `?string` | Optional | - | getNeighborhood(): ?string | setNeighborhood(?string neighborhood): void | +| `city` | `?string` | Optional | - | getCity(): ?string | setCity(?string city): void | +| `state` | `?string` | Optional | - | getState(): ?string | setState(?string state): void | +| `zipCode` | `?string` | Optional | - | getZipCode(): ?string | setZipCode(?string zipCode): void | +| `referencePoint` | `?string` | Optional | - | getReferencePoint(): ?string | setReferencePoint(?string referencePoint): void | + +## Example (as JSON) + +```json +{ + "street": "street2", + "complementary": "complementary4", + "street_number": "street_number2", + "neighborhood": "neighborhood8", + "city": "city2" +} +``` + diff --git a/doc/models/get-register-information-response.md b/doc/models/get-register-information-response.md new file mode 100644 index 0000000..78b0499 --- /dev/null +++ b/doc/models/get-register-information-response.md @@ -0,0 +1,56 @@ + +# Get Register Information Response + +Response object for getting an RegisterInformationResponse + +## Structure + +`GetRegisterInformationResponse` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `email` | `?string` | Optional | - | getEmail(): ?string | setEmail(?string email): void | +| `document` | `?string` | Optional | - | getDocument(): ?string | setDocument(?string document): void | +| `type` | `?string` | Optional | - | getType(): ?string | setType(?string type): void | +| `siteUrl` | `?string` | Optional | - | getSiteUrl(): ?string | setSiteUrl(?string siteUrl): void | +| `phoneNumbers` | [`?(GetPhoneNumberResponse[])`](../../doc/models/get-phone-number-response.md) | Optional | - | getPhoneNumbers(): ?array | setPhoneNumbers(?array phoneNumbers): void | +| `name` | `?string` | Optional | - | getName(): ?string | setName(?string name): void | +| `motherName` | `?string` | Optional | - | getMotherName(): ?string | setMotherName(?string motherName): void | +| `birthdate` | `?string` | Optional | - | getBirthdate(): ?string | setBirthdate(?string birthdate): void | +| `monthlyIncome` | `?string` | Optional | - | getMonthlyIncome(): ?string | setMonthlyIncome(?string monthlyIncome): void | +| `professionalOccupation` | `?string` | Optional | - | getProfessionalOccupation(): ?string | setProfessionalOccupation(?string professionalOccupation): void | +| `address` | [`?GetRegisterInformationAddressResponse`](../../doc/models/get-register-information-address-response.md) | Optional | - | getAddress(): ?GetRegisterInformationAddressResponse | setAddress(?GetRegisterInformationAddressResponse address): void | +| `companyName` | `?string` | Optional | - | getCompanyName(): ?string | setCompanyName(?string companyName): void | +| `tradingName` | `?string` | Optional | - | getTradingName(): ?string | setTradingName(?string tradingName): void | +| `annualRevenue` | `?string` | Optional | - | getAnnualRevenue(): ?string | setAnnualRevenue(?string annualRevenue): void | +| `corporationType` | `?string` | Optional | - | getCorporationType(): ?string | setCorporationType(?string corporationType): void | +| `foundingDate` | `?string` | Optional | - | getFoundingDate(): ?string | setFoundingDate(?string foundingDate): void | +| `cnae` | `?string` | Optional | - | getCnae(): ?string | setCnae(?string cnae): void | +| `mainAddress` | [`?GetRegisterInformationAddressResponse`](../../doc/models/get-register-information-address-response.md) | Optional | - | getMainAddress(): ?GetRegisterInformationAddressResponse | setMainAddress(?GetRegisterInformationAddressResponse mainAddress): void | +| `managingPartners` | [`?(GetManagingPartnerResponse[])`](../../doc/models/get-managing-partner-response.md) | Optional | - | getManagingPartners(): ?array | setManagingPartners(?array managingPartners): void | + +## Example (as JSON) + +```json +{ + "email": "email2", + "document": "document2", + "type": "type6", + "site_url": "site_url6", + "phone_numbers": [ + { + "ddd": "ddd4", + "number": "number2", + "type": "type0" + }, + { + "ddd": "ddd4", + "number": "number2", + "type": "type0" + } + ] +} +``` + diff --git a/doc/models/get-transaction-response.md b/doc/models/get-transaction-response.md index 54189f5..50e6a51 100644 --- a/doc/models/get-transaction-response.md +++ b/doc/models/get-transaction-response.md @@ -40,20 +40,11 @@ Generic response object for getting a transaction. "status": "status6", "success": false, "created_at": "2016-03-13T12:52:32.123Z", - "qr_code": "qr_code0", - "qr_code_url": "qr_code_url6", - "expires_at": "2016-03-13T12:52:32.123Z", - "additional_information": [ - { - "Name": "Name0", - "Value": "Value2" - }, - { - "Name": "Name0", - "Value": "Value2" - } - ], - "end_to_end_id": "end_to_end_id6" + "statement_descriptor": "statement_descriptor2", + "acquirer_name": "acquirer_name6", + "acquirer_affiliation_code": "acquirer_affiliation_code6", + "acquirer_tid": "acquirer_tid8", + "acquirer_nsu": "acquirer_nsu8" } ``` diff --git a/doc/models/list-charge-transactions-response.md b/doc/models/list-charge-transactions-response.md index 84f7b68..cc5f56a 100644 --- a/doc/models/list-charge-transactions-response.md +++ b/doc/models/list-charge-transactions-response.md @@ -25,20 +25,11 @@ Response object for listing charge transactions "status": "status6", "success": false, "created_at": "2016-03-13T12:52:32.123Z", - "qr_code": "qr_code0", - "qr_code_url": "qr_code_url6", - "expires_at": "2016-03-13T12:52:32.123Z", - "additional_information": [ - { - "Name": "Name0", - "Value": "Value2" - }, - { - "Name": "Name0", - "Value": "Value2" - } - ], - "end_to_end_id": "end_to_end_id6" + "statement_descriptor": "statement_descriptor2", + "acquirer_name": "acquirer_name6", + "acquirer_affiliation_code": "acquirer_affiliation_code6", + "acquirer_tid": "acquirer_tid8", + "acquirer_nsu": "acquirer_nsu8" }, { "gateway_id": "gateway_id8", @@ -46,20 +37,11 @@ Response object for listing charge transactions "status": "status6", "success": false, "created_at": "2016-03-13T12:52:32.123Z", - "qr_code": "qr_code0", - "qr_code_url": "qr_code_url6", - "expires_at": "2016-03-13T12:52:32.123Z", - "additional_information": [ - { - "Name": "Name0", - "Value": "Value2" - }, - { - "Name": "Name0", - "Value": "Value2" - } - ], - "end_to_end_id": "end_to_end_id6" + "statement_descriptor": "statement_descriptor2", + "acquirer_name": "acquirer_name6", + "acquirer_affiliation_code": "acquirer_affiliation_code6", + "acquirer_tid": "acquirer_tid8", + "acquirer_nsu": "acquirer_nsu8" } ], "paging": { diff --git a/doc/models/list-transactions-response.md b/doc/models/list-transactions-response.md index 563a573..9898977 100644 --- a/doc/models/list-transactions-response.md +++ b/doc/models/list-transactions-response.md @@ -25,20 +25,11 @@ Response object for listing transactions "status": "status6", "success": false, "created_at": "2016-03-13T12:52:32.123Z", - "qr_code": "qr_code0", - "qr_code_url": "qr_code_url6", - "expires_at": "2016-03-13T12:52:32.123Z", - "additional_information": [ - { - "Name": "Name0", - "Value": "Value2" - }, - { - "Name": "Name0", - "Value": "Value2" - } - ], - "end_to_end_id": "end_to_end_id6" + "statement_descriptor": "statement_descriptor2", + "acquirer_name": "acquirer_name6", + "acquirer_affiliation_code": "acquirer_affiliation_code6", + "acquirer_tid": "acquirer_tid8", + "acquirer_nsu": "acquirer_nsu8" }, { "gateway_id": "gateway_id8", @@ -46,20 +37,11 @@ Response object for listing transactions "status": "status6", "success": false, "created_at": "2016-03-13T12:52:32.123Z", - "qr_code": "qr_code0", - "qr_code_url": "qr_code_url6", - "expires_at": "2016-03-13T12:52:32.123Z", - "additional_information": [ - { - "Name": "Name0", - "Value": "Value2" - }, - { - "Name": "Name0", - "Value": "Value2" - } - ], - "end_to_end_id": "end_to_end_id6" + "statement_descriptor": "statement_descriptor2", + "acquirer_name": "acquirer_name6", + "acquirer_affiliation_code": "acquirer_affiliation_code6", + "acquirer_tid": "acquirer_tid8", + "acquirer_nsu": "acquirer_nsu8" }, { "gateway_id": "gateway_id8", @@ -67,20 +49,11 @@ Response object for listing transactions "status": "status6", "success": false, "created_at": "2016-03-13T12:52:32.123Z", - "qr_code": "qr_code0", - "qr_code_url": "qr_code_url6", - "expires_at": "2016-03-13T12:52:32.123Z", - "additional_information": [ - { - "Name": "Name0", - "Value": "Value2" - }, - { - "Name": "Name0", - "Value": "Value2" - } - ], - "end_to_end_id": "end_to_end_id6" + "statement_descriptor": "statement_descriptor2", + "acquirer_name": "acquirer_name6", + "acquirer_affiliation_code": "acquirer_affiliation_code6", + "acquirer_tid": "acquirer_tid8", + "acquirer_nsu": "acquirer_nsu8" } ], "paging": { diff --git a/src/ApiHelper.php b/src/ApiHelper.php index 3ffae4a..e8b1374 100644 --- a/src/ApiHelper.php +++ b/src/ApiHelper.php @@ -27,21 +27,25 @@ class ApiHelper */ private const INHERITED_MODELS_MAP = [ Models\GetTransactionResponse::class => [ + Models\GetVoucherTransactionResponse::class, Models\GetBankTransferTransactionResponse::class, Models\GetSafetyPayTransactionResponse::class, - Models\GetVoucherTransactionResponse::class, - Models\GetBoletoTransactionResponse::class, Models\GetDebitCardTransactionResponse::class, - Models\GetPrivateLabelTransactionResponse::class, + Models\GetBoletoTransactionResponse::class, Models\GetCashTransactionResponse::class, - Models\GetCreditCardTransactionResponse::class, - Models\GetPixTransactionResponse::class + Models\GetPrivateLabelTransactionResponse::class, + Models\GetPixTransactionResponse::class, + Models\GetCreditCardTransactionResponse::class ], Models\GetMovementObjectBaseResponse::class => [ Models\GetMovementObjectRefundResponse::class, Models\GetMovementObjectFeeCollectionResponse::class, Models\GetMovementObjectPayableResponse::class, Models\GetMovementObjectTransferResponse::class + ], + Models\CreateRegisterInformationBaseRequest::class => [ + Models\CreateRegisterInformationIndividualRequest::class, + Models\CreateRegisterInformationCorporationRequest::class ] ]; diff --git a/src/Controllers/ChargesController.php b/src/Controllers/ChargesController.php index a3a5aca..30230af 100644 --- a/src/Controllers/ChargesController.php +++ b/src/Controllers/ChargesController.php @@ -92,49 +92,22 @@ public function updateChargePaymentMethod( } /** - * @param string $chargeId Charge Id - * @param int|null $page Page number - * @param int|null $size Page size - * - * @return ListChargeTransactionsResponse Response from the API call - * - * @throws ApiException Thrown if API call fails - */ - public function getChargeTransactions( - string $chargeId, - ?int $page = null, - ?int $size = null - ): ListChargeTransactionsResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/charges/{charge_id}/transactions') - ->auth('global') - ->parameters( - TemplateParam::init('charge_id', $chargeId), - QueryParam::init('page', $page), - QueryParam::init('size', $size) - ); - - $_resHandler = $this->responseHandler()->type(ListChargeTransactionsResponse::class); - - return $this->execute($_reqBuilder, $_resHandler); - } - - /** - * Updates the due date from a charge + * Updates the card from a charge * - * @param string $chargeId Charge Id - * @param UpdateChargeDueDateRequest $request Request for updating the due date + * @param string $chargeId Charge id + * @param UpdateChargeCardRequest $request Request for updating a charge's card * @param string|null $idempotencyKey * * @return GetChargeResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function updateChargeDueDate( + public function updateChargeCard( string $chargeId, - UpdateChargeDueDateRequest $request, + UpdateChargeCardRequest $request, ?string $idempotencyKey = null ): GetChargeResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::PATCH, '/Charges/{charge_id}/due-date') + $_reqBuilder = $this->requestBuilder(RequestMethod::PATCH, '/charges/{charge_id}/card') ->auth('global') ->parameters( TemplateParam::init('charge_id', $chargeId), @@ -148,101 +121,99 @@ public function updateChargeDueDate( } /** - * Lists all charges - * - * @param int|null $page Page number - * @param int|null $size Page size - * @param string|null $code Filter for charge's code - * @param string|null $status Filter for charge's status - * @param string|null $paymentMethod Filter for charge's payment method - * @param string|null $customerId Filter for charge's customer id - * @param string|null $orderId Filter for charge's order id - * @param \DateTime|null $createdSince Filter for the beginning of the range for charge's - * creation - * @param \DateTime|null $createdUntil Filter for the end of the range for charge's creation + * @param string $status + * @param \DateTime|null $createdSince + * @param \DateTime|null $createdUntil * - * @return ListChargesResponse Response from the API call + * @return GetChargesSummaryResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function getCharges( - ?int $page = null, - ?int $size = null, - ?string $code = null, - ?string $status = null, - ?string $paymentMethod = null, - ?string $customerId = null, - ?string $orderId = null, + public function getChargesSummary( + string $status, ?\DateTime $createdSince = null, ?\DateTime $createdUntil = null - ): ListChargesResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/charges') + ): GetChargesSummaryResponse { + $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/charges/summary') ->auth('global') ->parameters( - QueryParam::init('page', $page), - QueryParam::init('size', $size), - QueryParam::init('code', $code), QueryParam::init('status', $status), - QueryParam::init('payment_method', $paymentMethod), - QueryParam::init('customer_id', $customerId), - QueryParam::init('order_id', $orderId), QueryParam::init('created_since', $createdSince) ->serializeBy([DateTimeHelper::class, 'toRfc3339DateTime']), QueryParam::init('created_until', $createdUntil) ->serializeBy([DateTimeHelper::class, 'toRfc3339DateTime']) ); - $_resHandler = $this->responseHandler()->type(ListChargesResponse::class); + $_resHandler = $this->responseHandler()->type(GetChargesSummaryResponse::class); return $this->execute($_reqBuilder, $_resHandler); } /** - * Captures a charge + * Creates a new charge * - * @param string $chargeId Charge id - * @param CreateCaptureChargeRequest|null $request Request for capturing a charge + * @param CreateChargeRequest $request Request for creating a charge * @param string|null $idempotencyKey * * @return GetChargeResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function captureCharge( + public function createCharge(CreateChargeRequest $request, ?string $idempotencyKey = null): GetChargeResponse + { + $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/Charges') + ->auth('global') + ->parameters(BodyParam::init($request), HeaderParam::init('idempotency-key', $idempotencyKey)); + + $_resHandler = $this->responseHandler()->type(GetChargeResponse::class); + + return $this->execute($_reqBuilder, $_resHandler); + } + + /** + * @param string $chargeId Charge Id + * @param int|null $page Page number + * @param int|null $size Page size + * + * @return ListChargeTransactionsResponse Response from the API call + * + * @throws ApiException Thrown if API call fails + */ + public function getChargeTransactions( string $chargeId, - ?CreateCaptureChargeRequest $request = null, - ?string $idempotencyKey = null - ): GetChargeResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/charges/{charge_id}/capture') + ?int $page = null, + ?int $size = null + ): ListChargeTransactionsResponse { + $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/charges/{charge_id}/transactions') ->auth('global') ->parameters( TemplateParam::init('charge_id', $chargeId), - BodyParam::init($request), - HeaderParam::init('idempotency-key', $idempotencyKey) + QueryParam::init('page', $page), + QueryParam::init('size', $size) ); - $_resHandler = $this->responseHandler()->type(GetChargeResponse::class); + $_resHandler = $this->responseHandler()->type(ListChargeTransactionsResponse::class); return $this->execute($_reqBuilder, $_resHandler); } /** - * Updates the card from a charge + * Captures a charge * * @param string $chargeId Charge id - * @param UpdateChargeCardRequest $request Request for updating a charge's card + * @param CreateCaptureChargeRequest|null $request Request for capturing a charge * @param string|null $idempotencyKey * * @return GetChargeResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function updateChargeCard( + public function captureCharge( string $chargeId, - UpdateChargeCardRequest $request, + ?CreateCaptureChargeRequest $request = null, ?string $idempotencyKey = null ): GetChargeResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::PATCH, '/charges/{charge_id}/card') + $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/charges/{charge_id}/capture') ->auth('global') ->parameters( TemplateParam::init('charge_id', $chargeId), @@ -276,75 +247,99 @@ public function getCharge(string $chargeId): GetChargeResponse } /** - * @param string $status - * @param \DateTime|null $createdSince - * @param \DateTime|null $createdUntil + * Cancel a charge * - * @return GetChargesSummaryResponse Response from the API call + * @param string $chargeId Charge id + * @param CreateCancelChargeRequest|null $request Request for cancelling a charge + * @param string|null $idempotencyKey + * + * @return GetChargeResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function getChargesSummary( - string $status, - ?\DateTime $createdSince = null, - ?\DateTime $createdUntil = null - ): GetChargesSummaryResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/charges/summary') + public function cancelCharge( + string $chargeId, + ?CreateCancelChargeRequest $request = null, + ?string $idempotencyKey = null + ): GetChargeResponse { + $_reqBuilder = $this->requestBuilder(RequestMethod::DELETE, '/charges/{charge_id}') ->auth('global') ->parameters( - QueryParam::init('status', $status), - QueryParam::init('created_since', $createdSince) - ->serializeBy([DateTimeHelper::class, 'toRfc3339DateTime']), - QueryParam::init('created_until', $createdUntil) - ->serializeBy([DateTimeHelper::class, 'toRfc3339DateTime']) + TemplateParam::init('charge_id', $chargeId), + BodyParam::init($request), + HeaderParam::init('idempotency-key', $idempotencyKey) ); - $_resHandler = $this->responseHandler()->type(GetChargesSummaryResponse::class); + $_resHandler = $this->responseHandler()->type(GetChargeResponse::class); return $this->execute($_reqBuilder, $_resHandler); } /** - * Retries a charge + * Lists all charges * - * @param string $chargeId Charge id - * @param string|null $idempotencyKey + * @param int|null $page Page number + * @param int|null $size Page size + * @param string|null $code Filter for charge's code + * @param string|null $status Filter for charge's status + * @param string|null $paymentMethod Filter for charge's payment method + * @param string|null $customerId Filter for charge's customer id + * @param string|null $orderId Filter for charge's order id + * @param \DateTime|null $createdSince Filter for the beginning of the range for charge's + * creation + * @param \DateTime|null $createdUntil Filter for the end of the range for charge's creation * - * @return GetChargeResponse Response from the API call + * @return ListChargesResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function retryCharge(string $chargeId, ?string $idempotencyKey = null): GetChargeResponse - { - $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/charges/{charge_id}/retry') + public function getCharges( + ?int $page = null, + ?int $size = null, + ?string $code = null, + ?string $status = null, + ?string $paymentMethod = null, + ?string $customerId = null, + ?string $orderId = null, + ?\DateTime $createdSince = null, + ?\DateTime $createdUntil = null + ): ListChargesResponse { + $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/charges') ->auth('global') ->parameters( - TemplateParam::init('charge_id', $chargeId), - HeaderParam::init('idempotency-key', $idempotencyKey) + QueryParam::init('page', $page), + QueryParam::init('size', $size), + QueryParam::init('code', $code), + QueryParam::init('status', $status), + QueryParam::init('payment_method', $paymentMethod), + QueryParam::init('customer_id', $customerId), + QueryParam::init('order_id', $orderId), + QueryParam::init('created_since', $createdSince) + ->serializeBy([DateTimeHelper::class, 'toRfc3339DateTime']), + QueryParam::init('created_until', $createdUntil) + ->serializeBy([DateTimeHelper::class, 'toRfc3339DateTime']) ); - $_resHandler = $this->responseHandler()->type(GetChargeResponse::class); + $_resHandler = $this->responseHandler()->type(ListChargesResponse::class); return $this->execute($_reqBuilder, $_resHandler); } /** - * Cancel a charge - * - * @param string $chargeId Charge id - * @param CreateCancelChargeRequest|null $request Request for cancelling a charge + * @param string $chargeId + * @param CreateConfirmPaymentRequest|null $request Request for confirm payment * @param string|null $idempotencyKey * * @return GetChargeResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function cancelCharge( + public function confirmPayment( string $chargeId, - ?CreateCancelChargeRequest $request = null, + ?CreateConfirmPaymentRequest $request = null, ?string $idempotencyKey = null ): GetChargeResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::DELETE, '/charges/{charge_id}') + $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/charges/{charge_id}/confirm-payment') ->auth('global') ->parameters( TemplateParam::init('charge_id', $chargeId), @@ -358,20 +353,28 @@ public function cancelCharge( } /** - * Creates a new charge + * Updates the due date from a charge * - * @param CreateChargeRequest $request Request for creating a charge + * @param string $chargeId Charge Id + * @param UpdateChargeDueDateRequest $request Request for updating the due date * @param string|null $idempotencyKey * * @return GetChargeResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function createCharge(CreateChargeRequest $request, ?string $idempotencyKey = null): GetChargeResponse - { - $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/Charges') + public function updateChargeDueDate( + string $chargeId, + UpdateChargeDueDateRequest $request, + ?string $idempotencyKey = null + ): GetChargeResponse { + $_reqBuilder = $this->requestBuilder(RequestMethod::PATCH, '/Charges/{charge_id}/due-date') ->auth('global') - ->parameters(BodyParam::init($request), HeaderParam::init('idempotency-key', $idempotencyKey)); + ->parameters( + TemplateParam::init('charge_id', $chargeId), + BodyParam::init($request), + HeaderParam::init('idempotency-key', $idempotencyKey) + ); $_resHandler = $this->responseHandler()->type(GetChargeResponse::class); @@ -379,24 +382,21 @@ public function createCharge(CreateChargeRequest $request, ?string $idempotencyK } /** - * @param string $chargeId - * @param CreateConfirmPaymentRequest|null $request Request for confirm payment + * Retries a charge + * + * @param string $chargeId Charge id * @param string|null $idempotencyKey * * @return GetChargeResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function confirmPayment( - string $chargeId, - ?CreateConfirmPaymentRequest $request = null, - ?string $idempotencyKey = null - ): GetChargeResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/charges/{charge_id}/confirm-payment') + public function retryCharge(string $chargeId, ?string $idempotencyKey = null): GetChargeResponse + { + $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/charges/{charge_id}/retry') ->auth('global') ->parameters( TemplateParam::init('charge_id', $chargeId), - BodyParam::init($request), HeaderParam::init('idempotency-key', $idempotencyKey) ); diff --git a/src/Controllers/CustomersController.php b/src/Controllers/CustomersController.php index f5ee284..c9ad0e0 100644 --- a/src/Controllers/CustomersController.php +++ b/src/Controllers/CustomersController.php @@ -131,6 +131,35 @@ public function deleteAccessToken( return $this->execute($_reqBuilder, $_resHandler); } + /** + * Creates a new address for a customer + * + * @param string $customerId Customer Id + * @param CreateAddressRequest $request Request for creating an address + * @param string|null $idempotencyKey + * + * @return GetAddressResponse Response from the API call + * + * @throws ApiException Thrown if API call fails + */ + public function createAddress( + string $customerId, + CreateAddressRequest $request, + ?string $idempotencyKey = null + ): GetAddressResponse { + $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/customers/{customer_id}/addresses') + ->auth('global') + ->parameters( + TemplateParam::init('customer_id', $customerId), + BodyParam::init($request), + HeaderParam::init('idempotency-key', $idempotencyKey) + ); + + $_resHandler = $this->responseHandler()->type(GetAddressResponse::class); + + return $this->execute($_reqBuilder, $_resHandler); + } + /** * Creates a new customer * @@ -153,22 +182,22 @@ public function createCustomer(CreateCustomerRequest $request, ?string $idempote } /** - * Creates a new address for a customer + * Creates a new card for a customer * - * @param string $customerId Customer Id - * @param CreateAddressRequest $request Request for creating an address + * @param string $customerId Customer id + * @param CreateCardRequest $request Request for creating a card * @param string|null $idempotencyKey * - * @return GetAddressResponse Response from the API call + * @return GetCardResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function createAddress( + public function createCard( string $customerId, - CreateAddressRequest $request, + CreateCardRequest $request, ?string $idempotencyKey = null - ): GetAddressResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/customers/{customer_id}/addresses') + ): GetCardResponse { + $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/customers/{customer_id}/cards') ->auth('global') ->parameters( TemplateParam::init('customer_id', $customerId), @@ -176,27 +205,59 @@ public function createAddress( HeaderParam::init('idempotency-key', $idempotencyKey) ); - $_resHandler = $this->responseHandler()->type(GetAddressResponse::class); + $_resHandler = $this->responseHandler()->type(GetCardResponse::class); return $this->execute($_reqBuilder, $_resHandler); } /** - * Delete a Customer's access tokens + * Get all cards from a customer * * @param string $customerId Customer Id + * @param int|null $page Page number + * @param int|null $size Page size * - * @return ListAccessTokensResponse Response from the API call + * @return ListCardsResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function deleteAccessTokens(string $customerId): ListAccessTokensResponse + public function getCards(string $customerId, ?int $page = null, ?int $size = null): ListCardsResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/customers/{customer_id}/access-tokens/') + $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/customers/{customer_id}/cards') ->auth('global') - ->parameters(TemplateParam::init('customer_id', $customerId)); + ->parameters( + TemplateParam::init('customer_id', $customerId), + QueryParam::init('page', $page), + QueryParam::init('size', $size) + ); - $_resHandler = $this->responseHandler()->type(ListAccessTokensResponse::class); + $_resHandler = $this->responseHandler()->type(ListCardsResponse::class); + + return $this->execute($_reqBuilder, $_resHandler); + } + + /** + * Renew a card + * + * @param string $customerId Customer id + * @param string $cardId Card Id + * @param string|null $idempotencyKey + * + * @return GetCardResponse Response from the API call + * + * @throws ApiException Thrown if API call fails + */ + public function renewCard(string $customerId, string $cardId, ?string $idempotencyKey = null): GetCardResponse + { + $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/customers/{customer_id}/cards/{card_id}/renew') + ->auth('global') + ->parameters( + TemplateParam::init('customer_id', $customerId), + TemplateParam::init('card_id', $cardId), + HeaderParam::init('idempotency-key', $idempotencyKey) + ); + + $_resHandler = $this->responseHandler()->type(GetCardResponse::class); return $this->execute($_reqBuilder, $_resHandler); } @@ -258,22 +319,49 @@ public function deleteAddress( } /** - * Creates a new card for a customer + * Get a Customer's access token * - * @param string $customerId Customer id - * @param CreateCardRequest $request Request for creating a card + * @param string $customerId Customer Id + * @param string $tokenId Token Id + * + * @return GetAccessTokenResponse Response from the API call + * + * @throws ApiException Thrown if API call fails + */ + public function getAccessToken(string $customerId, string $tokenId): GetAccessTokenResponse + { + $_reqBuilder = $this->requestBuilder( + RequestMethod::GET, + '/customers/{customer_id}/access-tokens/{token_id}' + ) + ->auth('global') + ->parameters( + TemplateParam::init('customer_id', $customerId), + TemplateParam::init('token_id', $tokenId) + ); + + $_resHandler = $this->responseHandler()->type(GetAccessTokenResponse::class); + + return $this->execute($_reqBuilder, $_resHandler); + } + + /** + * Updates the metadata a customer + * + * @param string $customerId The customer id + * @param UpdateMetadataRequest $request Request for updating the customer metadata * @param string|null $idempotencyKey * - * @return GetCardResponse Response from the API call + * @return GetCustomerResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function createCard( + public function updateCustomerMetadata( string $customerId, - CreateCardRequest $request, + UpdateMetadataRequest $request, ?string $idempotencyKey = null - ): GetCardResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/customers/{customer_id}/cards') + ): GetCustomerResponse { + $_reqBuilder = $this->requestBuilder(RequestMethod::PATCH, '/Customers/{customer_id}/metadata') ->auth('global') ->parameters( TemplateParam::init('customer_id', $customerId), @@ -281,74 +369,48 @@ public function createCard( HeaderParam::init('idempotency-key', $idempotencyKey) ); - $_resHandler = $this->responseHandler()->type(GetCardResponse::class); + $_resHandler = $this->responseHandler()->type(GetCustomerResponse::class); return $this->execute($_reqBuilder, $_resHandler); } /** - * Get all Customers + * Get a customer's card * - * @param string|null $name Name of the Customer - * @param string|null $document Document of the Customer - * @param int|null $page Current page the the search - * @param int|null $size Quantity pages of the search - * @param string|null $email Customer's email - * @param string|null $code Customer's code + * @param string $customerId Customer id + * @param string $cardId Card id * - * @return ListCustomersResponse Response from the API call + * @return GetCardResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function getCustomers( - ?string $name = null, - ?string $document = null, - ?int $page = 1, - ?int $size = 10, - ?string $email = null, - ?string $code = null - ): ListCustomersResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/customers') + public function getCard(string $customerId, string $cardId): GetCardResponse + { + $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/customers/{customer_id}/cards/{card_id}') ->auth('global') - ->parameters( - QueryParam::init('name', $name), - QueryParam::init('document', $document), - QueryParam::init('page', $page), - QueryParam::init('size', $size), - QueryParam::init('email', $email), - QueryParam::init('Code', $code) - ); + ->parameters(TemplateParam::init('customer_id', $customerId), TemplateParam::init('card_id', $cardId)); - $_resHandler = $this->responseHandler()->type(ListCustomersResponse::class); + $_resHandler = $this->responseHandler()->type(GetCardResponse::class); return $this->execute($_reqBuilder, $_resHandler); } /** - * Updates a customer + * Delete a Customer's access tokens * - * @param string $customerId Customer id - * @param UpdateCustomerRequest $request Request for updating a customer - * @param string|null $idempotencyKey + * @param string $customerId Customer Id * - * @return GetCustomerResponse Response from the API call + * @return ListAccessTokensResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function updateCustomer( - string $customerId, - UpdateCustomerRequest $request, - ?string $idempotencyKey = null - ): GetCustomerResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::PUT, '/customers/{customer_id}') + public function deleteAccessTokens(string $customerId): ListAccessTokensResponse + { + $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/customers/{customer_id}/access-tokens/') ->auth('global') - ->parameters( - TemplateParam::init('customer_id', $customerId), - BodyParam::init($request), - HeaderParam::init('idempotency-key', $idempotencyKey) - ); + ->parameters(TemplateParam::init('customer_id', $customerId)); - $_resHandler = $this->responseHandler()->type(GetCustomerResponse::class); + $_resHandler = $this->responseHandler()->type(ListAccessTokensResponse::class); return $this->execute($_reqBuilder, $_resHandler); } @@ -409,101 +471,60 @@ public function getAccessTokens(string $customerId, ?int $page = null, ?int $siz } /** - * Get all cards from a customer + * Get all Customers * - * @param string $customerId Customer Id - * @param int|null $page Page number - * @param int|null $size Page size + * @param string|null $name Name of the Customer + * @param string|null $document Document of the Customer + * @param int|null $page Current page the the search + * @param int|null $size Quantity pages of the search + * @param string|null $email Customer's email + * @param string|null $code Customer's code * - * @return ListCardsResponse Response from the API call + * @return ListCustomersResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function getCards(string $customerId, ?int $page = null, ?int $size = null): ListCardsResponse - { - $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/customers/{customer_id}/cards') + public function getCustomers( + ?string $name = null, + ?string $document = null, + ?int $page = 1, + ?int $size = 10, + ?string $email = null, + ?string $code = null + ): ListCustomersResponse { + $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/customers') ->auth('global') ->parameters( - TemplateParam::init('customer_id', $customerId), + QueryParam::init('name', $name), + QueryParam::init('document', $document), QueryParam::init('page', $page), - QueryParam::init('size', $size) + QueryParam::init('size', $size), + QueryParam::init('email', $email), + QueryParam::init('Code', $code) ); - $_resHandler = $this->responseHandler()->type(ListCardsResponse::class); + $_resHandler = $this->responseHandler()->type(ListCustomersResponse::class); return $this->execute($_reqBuilder, $_resHandler); } /** - * Renew a card + * Updates a customer * * @param string $customerId Customer id - * @param string $cardId Card Id - * @param string|null $idempotencyKey - * - * @return GetCardResponse Response from the API call - * - * @throws ApiException Thrown if API call fails - */ - public function renewCard(string $customerId, string $cardId, ?string $idempotencyKey = null): GetCardResponse - { - $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/customers/{customer_id}/cards/{card_id}/renew') - ->auth('global') - ->parameters( - TemplateParam::init('customer_id', $customerId), - TemplateParam::init('card_id', $cardId), - HeaderParam::init('idempotency-key', $idempotencyKey) - ); - - $_resHandler = $this->responseHandler()->type(GetCardResponse::class); - - return $this->execute($_reqBuilder, $_resHandler); - } - - /** - * Get a Customer's access token - * - * @param string $customerId Customer Id - * @param string $tokenId Token Id - * - * @return GetAccessTokenResponse Response from the API call - * - * @throws ApiException Thrown if API call fails - */ - public function getAccessToken(string $customerId, string $tokenId): GetAccessTokenResponse - { - $_reqBuilder = $this->requestBuilder( - RequestMethod::GET, - '/customers/{customer_id}/access-tokens/{token_id}' - ) - ->auth('global') - ->parameters( - TemplateParam::init('customer_id', $customerId), - TemplateParam::init('token_id', $tokenId) - ); - - $_resHandler = $this->responseHandler()->type(GetAccessTokenResponse::class); - - return $this->execute($_reqBuilder, $_resHandler); - } - - /** - * Updates the metadata a customer - * - * @param string $customerId The customer id - * @param UpdateMetadataRequest $request Request for updating the customer metadata + * @param UpdateCustomerRequest $request Request for updating a customer * @param string|null $idempotencyKey * * @return GetCustomerResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function updateCustomerMetadata( + public function updateCustomer( string $customerId, - UpdateMetadataRequest $request, + UpdateCustomerRequest $request, ?string $idempotencyKey = null ): GetCustomerResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::PATCH, '/Customers/{customer_id}/metadata') + $_reqBuilder = $this->requestBuilder(RequestMethod::PUT, '/customers/{customer_id}') ->auth('global') ->parameters( TemplateParam::init('customer_id', $customerId), @@ -587,25 +608,4 @@ public function getCustomer(string $customerId): GetCustomerResponse return $this->execute($_reqBuilder, $_resHandler); } - - /** - * Get a customer's card - * - * @param string $customerId Customer id - * @param string $cardId Card id - * - * @return GetCardResponse Response from the API call - * - * @throws ApiException Thrown if API call fails - */ - public function getCard(string $customerId, string $cardId): GetCardResponse - { - $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/customers/{customer_id}/cards/{card_id}') - ->auth('global') - ->parameters(TemplateParam::init('customer_id', $customerId), TemplateParam::init('card_id', $cardId)); - - $_resHandler = $this->responseHandler()->type(GetCardResponse::class); - - return $this->execute($_reqBuilder, $_resHandler); - } } diff --git a/src/Controllers/InvoicesController.php b/src/Controllers/InvoicesController.php index 73716c7..857a90a 100644 --- a/src/Controllers/InvoicesController.php +++ b/src/Controllers/InvoicesController.php @@ -25,78 +25,6 @@ class InvoicesController extends BaseController { - /** - * Updates the metadata from an invoice - * - * @param string $invoiceId The invoice id - * @param UpdateMetadataRequest $request Request for updating the invoice metadata - * @param string|null $idempotencyKey - * - * @return GetInvoiceResponse Response from the API call - * - * @throws ApiException Thrown if API call fails - */ - public function updateInvoiceMetadata( - string $invoiceId, - UpdateMetadataRequest $request, - ?string $idempotencyKey = null - ): GetInvoiceResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::PATCH, '/invoices/{invoice_id}/metadata') - ->auth('global') - ->parameters( - TemplateParam::init('invoice_id', $invoiceId), - BodyParam::init($request), - HeaderParam::init('idempotency-key', $idempotencyKey) - ); - - $_resHandler = $this->responseHandler()->type(GetInvoiceResponse::class); - - return $this->execute($_reqBuilder, $_resHandler); - } - - /** - * @param string $subscriptionId Subscription Id - * - * @return GetInvoiceResponse Response from the API call - * - * @throws ApiException Thrown if API call fails - */ - public function getPartialInvoice(string $subscriptionId): GetInvoiceResponse - { - $_reqBuilder = $this->requestBuilder( - RequestMethod::GET, - '/subscriptions/{subscription_id}/partial-invoice' - )->auth('global')->parameters(TemplateParam::init('subscription_id', $subscriptionId)); - - $_resHandler = $this->responseHandler()->type(GetInvoiceResponse::class); - - return $this->execute($_reqBuilder, $_resHandler); - } - - /** - * Cancels an invoice - * - * @param string $invoiceId Invoice id - * @param string|null $idempotencyKey - * - * @return GetInvoiceResponse Response from the API call - * - * @throws ApiException Thrown if API call fails - */ - public function cancelInvoice(string $invoiceId, ?string $idempotencyKey = null): GetInvoiceResponse - { - $_reqBuilder = $this->requestBuilder(RequestMethod::DELETE, '/invoices/{invoice_id}') - ->auth('global') - ->parameters( - TemplateParam::init('invoice_id', $invoiceId), - HeaderParam::init('idempotency-key', $idempotencyKey) - ); - - $_resHandler = $this->responseHandler()->type(GetInvoiceResponse::class); - - return $this->execute($_reqBuilder, $_resHandler); - } - /** * Create an Invoice * @@ -188,19 +116,71 @@ public function getInvoices( } /** - * Gets an invoice + * Cancels an invoice * - * @param string $invoiceId Invoice Id + * @param string $invoiceId Invoice id + * @param string|null $idempotencyKey * * @return GetInvoiceResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function getInvoice(string $invoiceId): GetInvoiceResponse + public function cancelInvoice(string $invoiceId, ?string $idempotencyKey = null): GetInvoiceResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/invoices/{invoice_id}') + $_reqBuilder = $this->requestBuilder(RequestMethod::DELETE, '/invoices/{invoice_id}') ->auth('global') - ->parameters(TemplateParam::init('invoice_id', $invoiceId)); + ->parameters( + TemplateParam::init('invoice_id', $invoiceId), + HeaderParam::init('idempotency-key', $idempotencyKey) + ); + + $_resHandler = $this->responseHandler()->type(GetInvoiceResponse::class); + + return $this->execute($_reqBuilder, $_resHandler); + } + + /** + * Updates the metadata from an invoice + * + * @param string $invoiceId The invoice id + * @param UpdateMetadataRequest $request Request for updating the invoice metadata + * @param string|null $idempotencyKey + * + * @return GetInvoiceResponse Response from the API call + * + * @throws ApiException Thrown if API call fails + */ + public function updateInvoiceMetadata( + string $invoiceId, + UpdateMetadataRequest $request, + ?string $idempotencyKey = null + ): GetInvoiceResponse { + $_reqBuilder = $this->requestBuilder(RequestMethod::PATCH, '/invoices/{invoice_id}/metadata') + ->auth('global') + ->parameters( + TemplateParam::init('invoice_id', $invoiceId), + BodyParam::init($request), + HeaderParam::init('idempotency-key', $idempotencyKey) + ); + + $_resHandler = $this->responseHandler()->type(GetInvoiceResponse::class); + + return $this->execute($_reqBuilder, $_resHandler); + } + + /** + * @param string $subscriptionId Subscription Id + * + * @return GetInvoiceResponse Response from the API call + * + * @throws ApiException Thrown if API call fails + */ + public function getPartialInvoice(string $subscriptionId): GetInvoiceResponse + { + $_reqBuilder = $this->requestBuilder( + RequestMethod::GET, + '/subscriptions/{subscription_id}/partial-invoice' + )->auth('global')->parameters(TemplateParam::init('subscription_id', $subscriptionId)); $_resHandler = $this->responseHandler()->type(GetInvoiceResponse::class); @@ -235,4 +215,24 @@ public function updateInvoiceStatus( return $this->execute($_reqBuilder, $_resHandler); } + + /** + * Gets an invoice + * + * @param string $invoiceId Invoice Id + * + * @return GetInvoiceResponse Response from the API call + * + * @throws ApiException Thrown if API call fails + */ + public function getInvoice(string $invoiceId): GetInvoiceResponse + { + $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/invoices/{invoice_id}') + ->auth('global') + ->parameters(TemplateParam::init('invoice_id', $invoiceId)); + + $_resHandler = $this->responseHandler()->type(GetInvoiceResponse::class); + + return $this->execute($_reqBuilder, $_resHandler); + } } diff --git a/src/Controllers/OrdersController.php b/src/Controllers/OrdersController.php index 8c68db9..cabe654 100644 --- a/src/Controllers/OrdersController.php +++ b/src/Controllers/OrdersController.php @@ -74,27 +74,16 @@ public function getOrders( /** * @param string $orderId Order Id * @param string $itemId Item Id - * @param UpdateOrderItemRequest $request Item Model - * @param string|null $idempotencyKey * * @return GetOrderItemResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function updateOrderItem( - string $orderId, - string $itemId, - UpdateOrderItemRequest $request, - ?string $idempotencyKey = null - ): GetOrderItemResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::PUT, '/orders/{orderId}/items/{itemId}') + public function getOrderItem(string $orderId, string $itemId): GetOrderItemResponse + { + $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/orders/{orderId}/items/{itemId}') ->auth('global') - ->parameters( - TemplateParam::init('orderId', $orderId), - TemplateParam::init('itemId', $itemId), - BodyParam::init($request), - HeaderParam::init('idempotency-key', $idempotencyKey) - ); + ->parameters(TemplateParam::init('orderId', $orderId), TemplateParam::init('itemId', $itemId)); $_resHandler = $this->responseHandler()->type(GetOrderItemResponse::class); @@ -102,54 +91,25 @@ public function updateOrderItem( } /** - * @param string $orderId Order Id - * @param string|null $idempotencyKey + * Gets an order + * + * @param string $orderId Order id * * @return GetOrderResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function deleteAllOrderItems(string $orderId, ?string $idempotencyKey = null): GetOrderResponse + public function getOrder(string $orderId): GetOrderResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::DELETE, '/orders/{orderId}/items') + $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/orders/{order_id}') ->auth('global') - ->parameters( - TemplateParam::init('orderId', $orderId), - HeaderParam::init('idempotency-key', $idempotencyKey) - ); + ->parameters(TemplateParam::init('order_id', $orderId)); $_resHandler = $this->responseHandler()->type(GetOrderResponse::class); return $this->execute($_reqBuilder, $_resHandler); } - /** - * @param string $orderId Order Id - * @param string $itemId Item Id - * @param string|null $idempotencyKey - * - * @return GetOrderItemResponse Response from the API call - * - * @throws ApiException Thrown if API call fails - */ - public function deleteOrderItem( - string $orderId, - string $itemId, - ?string $idempotencyKey = null - ): GetOrderItemResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::DELETE, '/orders/{orderId}/items/{itemId}') - ->auth('global') - ->parameters( - TemplateParam::init('orderId', $orderId), - TemplateParam::init('itemId', $itemId), - HeaderParam::init('idempotency-key', $idempotencyKey) - ); - - $_resHandler = $this->responseHandler()->type(GetOrderItemResponse::class); - - return $this->execute($_reqBuilder, $_resHandler); - } - /** * @param string $id Order Id * @param UpdateOrderStatusRequest $request Update Order Model @@ -200,22 +160,25 @@ public function createOrder(CreateOrderRequest $body, ?string $idempotencyKey = /** * @param string $orderId Order Id - * @param CreateOrderItemRequest $request Order Item Model + * @param string $itemId Item Id + * @param UpdateOrderItemRequest $request Item Model * @param string|null $idempotencyKey * * @return GetOrderItemResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function createOrderItem( + public function updateOrderItem( string $orderId, - CreateOrderItemRequest $request, + string $itemId, + UpdateOrderItemRequest $request, ?string $idempotencyKey = null ): GetOrderItemResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/orders/{orderId}/items') + $_reqBuilder = $this->requestBuilder(RequestMethod::PUT, '/orders/{orderId}/items/{itemId}') ->auth('global') ->parameters( TemplateParam::init('orderId', $orderId), + TemplateParam::init('itemId', $itemId), BodyParam::init($request), HeaderParam::init('idempotency-key', $idempotencyKey) ); @@ -227,19 +190,22 @@ public function createOrderItem( /** * @param string $orderId Order Id - * @param string $itemId Item Id + * @param string|null $idempotencyKey * - * @return GetOrderItemResponse Response from the API call + * @return GetOrderResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function getOrderItem(string $orderId, string $itemId): GetOrderItemResponse + public function deleteAllOrderItems(string $orderId, ?string $idempotencyKey = null): GetOrderResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/orders/{orderId}/items/{itemId}') + $_reqBuilder = $this->requestBuilder(RequestMethod::DELETE, '/orders/{orderId}/items') ->auth('global') - ->parameters(TemplateParam::init('orderId', $orderId), TemplateParam::init('itemId', $itemId)); + ->parameters( + TemplateParam::init('orderId', $orderId), + HeaderParam::init('idempotency-key', $idempotencyKey) + ); - $_resHandler = $this->responseHandler()->type(GetOrderItemResponse::class); + $_resHandler = $this->responseHandler()->type(GetOrderResponse::class); return $this->execute($_reqBuilder, $_resHandler); } @@ -274,21 +240,55 @@ public function updateOrderMetadata( } /** - * Gets an order + * @param string $orderId Order Id + * @param string $itemId Item Id + * @param string|null $idempotencyKey * - * @param string $orderId Order id + * @return GetOrderItemResponse Response from the API call * - * @return GetOrderResponse Response from the API call + * @throws ApiException Thrown if API call fails + */ + public function deleteOrderItem( + string $orderId, + string $itemId, + ?string $idempotencyKey = null + ): GetOrderItemResponse { + $_reqBuilder = $this->requestBuilder(RequestMethod::DELETE, '/orders/{orderId}/items/{itemId}') + ->auth('global') + ->parameters( + TemplateParam::init('orderId', $orderId), + TemplateParam::init('itemId', $itemId), + HeaderParam::init('idempotency-key', $idempotencyKey) + ); + + $_resHandler = $this->responseHandler()->type(GetOrderItemResponse::class); + + return $this->execute($_reqBuilder, $_resHandler); + } + + /** + * @param string $orderId Order Id + * @param CreateOrderItemRequest $request Order Item Model + * @param string|null $idempotencyKey + * + * @return GetOrderItemResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function getOrder(string $orderId): GetOrderResponse - { - $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/orders/{order_id}') + public function createOrderItem( + string $orderId, + CreateOrderItemRequest $request, + ?string $idempotencyKey = null + ): GetOrderItemResponse { + $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/orders/{orderId}/items') ->auth('global') - ->parameters(TemplateParam::init('order_id', $orderId)); + ->parameters( + TemplateParam::init('orderId', $orderId), + BodyParam::init($request), + HeaderParam::init('idempotency-key', $idempotencyKey) + ); - $_resHandler = $this->responseHandler()->type(GetOrderResponse::class); + $_resHandler = $this->responseHandler()->type(GetOrderItemResponse::class); return $this->execute($_reqBuilder, $_resHandler); } diff --git a/src/Controllers/PlansController.php b/src/Controllers/PlansController.php index d29683c..e824b56 100644 --- a/src/Controllers/PlansController.php +++ b/src/Controllers/PlansController.php @@ -49,21 +49,26 @@ public function getPlan(string $planId): GetPlanResponse } /** - * Deletes a plan + * Updates a plan * * @param string $planId Plan id + * @param UpdatePlanRequest $request Request for updating a plan * @param string|null $idempotencyKey * * @return GetPlanResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function deletePlan(string $planId, ?string $idempotencyKey = null): GetPlanResponse - { - $_reqBuilder = $this->requestBuilder(RequestMethod::DELETE, '/plans/{plan_id}') + public function updatePlan( + string $planId, + UpdatePlanRequest $request, + ?string $idempotencyKey = null + ): GetPlanResponse { + $_reqBuilder = $this->requestBuilder(RequestMethod::PUT, '/plans/{plan_id}') ->auth('global') ->parameters( TemplateParam::init('plan_id', $planId), + BodyParam::init($request), HeaderParam::init('idempotency-key', $idempotencyKey) ); @@ -102,29 +107,26 @@ public function updatePlanMetadata( } /** - * Updates a plan item + * Removes an item from a plan * * @param string $planId Plan id * @param string $planItemId Plan item id - * @param UpdatePlanItemRequest $body Request for updating the plan item * @param string|null $idempotencyKey * * @return GetPlanItemResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function updatePlanItem( + public function deletePlanItem( string $planId, string $planItemId, - UpdatePlanItemRequest $body, ?string $idempotencyKey = null ): GetPlanItemResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::PUT, '/plans/{plan_id}/items/{plan_item_id}') + $_reqBuilder = $this->requestBuilder(RequestMethod::DELETE, '/plans/{plan_id}/items/{plan_item_id}') ->auth('global') ->parameters( TemplateParam::init('plan_id', $planId), TemplateParam::init('plan_item_id', $planItemId), - BodyParam::init($body), HeaderParam::init('idempotency-key', $idempotencyKey) ); @@ -134,30 +136,44 @@ public function updatePlanItem( } /** - * Adds a new item to a plan + * Gets all plans * - * @param string $planId Plan id - * @param CreatePlanItemRequest $request Request for creating a plan item - * @param string|null $idempotencyKey + * @param int|null $page Page number + * @param int|null $size Page size + * @param string|null $name Filter for Plan's name + * @param string|null $status Filter for Plan's status + * @param string|null $billingType Filter for plan's billing type + * @param \DateTime|null $createdSince Filter for plan's creation date start range + * @param \DateTime|null $createdUntil Filter for plan's creation date end range * - * @return GetPlanItemResponse Response from the API call + * @return ListPlansResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function createPlanItem( - string $planId, - CreatePlanItemRequest $request, - ?string $idempotencyKey = null - ): GetPlanItemResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/plans/{plan_id}/items') + public function getPlans( + ?int $page = null, + ?int $size = null, + ?string $name = null, + ?string $status = null, + ?string $billingType = null, + ?\DateTime $createdSince = null, + ?\DateTime $createdUntil = null + ): ListPlansResponse { + $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/plans') ->auth('global') ->parameters( - TemplateParam::init('plan_id', $planId), - BodyParam::init($request), - HeaderParam::init('idempotency-key', $idempotencyKey) + QueryParam::init('page', $page), + QueryParam::init('size', $size), + QueryParam::init('name', $name), + QueryParam::init('status', $status), + QueryParam::init('billing_type', $billingType), + QueryParam::init('created_since', $createdSince) + ->serializeBy([DateTimeHelper::class, 'toRfc3339DateTime']), + QueryParam::init('created_until', $createdUntil) + ->serializeBy([DateTimeHelper::class, 'toRfc3339DateTime']) ); - $_resHandler = $this->responseHandler()->type(GetPlanItemResponse::class); + $_resHandler = $this->responseHandler()->type(ListPlansResponse::class); return $this->execute($_reqBuilder, $_resHandler); } @@ -184,20 +200,23 @@ public function getPlanItem(string $planId, string $planItemId): GetPlanItemResp } /** - * Creates a new plan + * Deletes a plan * - * @param CreatePlanRequest $body Request for creating a plan + * @param string $planId Plan id * @param string|null $idempotencyKey * * @return GetPlanResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function createPlan(CreatePlanRequest $body, ?string $idempotencyKey = null): GetPlanResponse + public function deletePlan(string $planId, ?string $idempotencyKey = null): GetPlanResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/plans') + $_reqBuilder = $this->requestBuilder(RequestMethod::DELETE, '/plans/{plan_id}') ->auth('global') - ->parameters(BodyParam::init($body), HeaderParam::init('idempotency-key', $idempotencyKey)); + ->parameters( + TemplateParam::init('plan_id', $planId), + HeaderParam::init('idempotency-key', $idempotencyKey) + ); $_resHandler = $this->responseHandler()->type(GetPlanResponse::class); @@ -205,26 +224,29 @@ public function createPlan(CreatePlanRequest $body, ?string $idempotencyKey = nu } /** - * Removes an item from a plan + * Updates a plan item * * @param string $planId Plan id * @param string $planItemId Plan item id + * @param UpdatePlanItemRequest $body Request for updating the plan item * @param string|null $idempotencyKey * * @return GetPlanItemResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function deletePlanItem( + public function updatePlanItem( string $planId, string $planItemId, + UpdatePlanItemRequest $body, ?string $idempotencyKey = null ): GetPlanItemResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::DELETE, '/plans/{plan_id}/items/{plan_item_id}') + $_reqBuilder = $this->requestBuilder(RequestMethod::PUT, '/plans/{plan_id}/items/{plan_item_id}') ->auth('global') ->parameters( TemplateParam::init('plan_id', $planId), TemplateParam::init('plan_item_id', $planItemId), + BodyParam::init($body), HeaderParam::init('idempotency-key', $idempotencyKey) ); @@ -234,71 +256,49 @@ public function deletePlanItem( } /** - * Gets all plans + * Adds a new item to a plan * - * @param int|null $page Page number - * @param int|null $size Page size - * @param string|null $name Filter for Plan's name - * @param string|null $status Filter for Plan's status - * @param string|null $billingType Filter for plan's billing type - * @param \DateTime|null $createdSince Filter for plan's creation date start range - * @param \DateTime|null $createdUntil Filter for plan's creation date end range + * @param string $planId Plan id + * @param CreatePlanItemRequest $request Request for creating a plan item + * @param string|null $idempotencyKey * - * @return ListPlansResponse Response from the API call + * @return GetPlanItemResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function getPlans( - ?int $page = null, - ?int $size = null, - ?string $name = null, - ?string $status = null, - ?string $billingType = null, - ?\DateTime $createdSince = null, - ?\DateTime $createdUntil = null - ): ListPlansResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/plans') + public function createPlanItem( + string $planId, + CreatePlanItemRequest $request, + ?string $idempotencyKey = null + ): GetPlanItemResponse { + $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/plans/{plan_id}/items') ->auth('global') ->parameters( - QueryParam::init('page', $page), - QueryParam::init('size', $size), - QueryParam::init('name', $name), - QueryParam::init('status', $status), - QueryParam::init('billing_type', $billingType), - QueryParam::init('created_since', $createdSince) - ->serializeBy([DateTimeHelper::class, 'toRfc3339DateTime']), - QueryParam::init('created_until', $createdUntil) - ->serializeBy([DateTimeHelper::class, 'toRfc3339DateTime']) + TemplateParam::init('plan_id', $planId), + BodyParam::init($request), + HeaderParam::init('idempotency-key', $idempotencyKey) ); - $_resHandler = $this->responseHandler()->type(ListPlansResponse::class); + $_resHandler = $this->responseHandler()->type(GetPlanItemResponse::class); return $this->execute($_reqBuilder, $_resHandler); } /** - * Updates a plan + * Creates a new plan * - * @param string $planId Plan id - * @param UpdatePlanRequest $request Request for updating a plan + * @param CreatePlanRequest $body Request for creating a plan * @param string|null $idempotencyKey * * @return GetPlanResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function updatePlan( - string $planId, - UpdatePlanRequest $request, - ?string $idempotencyKey = null - ): GetPlanResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::PUT, '/plans/{plan_id}') + public function createPlan(CreatePlanRequest $body, ?string $idempotencyKey = null): GetPlanResponse + { + $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/plans') ->auth('global') - ->parameters( - TemplateParam::init('plan_id', $planId), - BodyParam::init($request), - HeaderParam::init('idempotency-key', $idempotencyKey) - ); + ->parameters(BodyParam::init($body), HeaderParam::init('idempotency-key', $idempotencyKey)); $_resHandler = $this->responseHandler()->type(GetPlanResponse::class); diff --git a/src/Controllers/RecipientsController.php b/src/Controllers/RecipientsController.php index 4626510..cdc2e90 100644 --- a/src/Controllers/RecipientsController.php +++ b/src/Controllers/RecipientsController.php @@ -149,79 +149,103 @@ public function getRecipients(?int $page = null, ?int $size = null): ListRecipie } /** - * @param string $recipientId - * @param string $withdrawalId + * Updates recipient metadata * - * @return GetWithdrawResponse Response from the API call + * @param string $recipientId Recipient id + * @param UpdateMetadataRequest $request Metadata + * @param string|null $idempotencyKey + * + * @return GetRecipientResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function getWithdrawById(string $recipientId, string $withdrawalId): GetWithdrawResponse + public function updateRecipientMetadata( + string $recipientId, + UpdateMetadataRequest $request, + ?string $idempotencyKey = null + ): GetRecipientResponse { + $_reqBuilder = $this->requestBuilder(RequestMethod::PATCH, '/recipients/{recipient_id}/metadata') + ->auth('global') + ->parameters( + TemplateParam::init('recipient_id', $recipientId), + BodyParam::init($request), + HeaderParam::init('idempotency-key', $idempotencyKey) + ); + + $_resHandler = $this->responseHandler()->type(GetRecipientResponse::class); + + return $this->execute($_reqBuilder, $_resHandler); + } + + /** + * Gets a transfer + * + * @param string $recipientId Recipient id + * @param string $transferId Transfer id + * + * @return GetTransferResponse Response from the API call + * + * @throws ApiException Thrown if API call fails + */ + public function getTransfer(string $recipientId, string $transferId): GetTransferResponse { $_reqBuilder = $this->requestBuilder( RequestMethod::GET, - '/recipients/{recipient_id}/withdrawals/{withdrawal_id}' + '/recipients/{recipient_id}/transfers/{transfer_id}' ) ->auth('global') ->parameters( TemplateParam::init('recipient_id', $recipientId), - TemplateParam::init('withdrawal_id', $withdrawalId) + TemplateParam::init('transfer_id', $transferId) ); - $_resHandler = $this->responseHandler()->type(GetWithdrawResponse::class); + $_resHandler = $this->responseHandler()->type(GetTransferResponse::class); return $this->execute($_reqBuilder, $_resHandler); } /** - * Updates the default bank account from a recipient + * Gets an anticipation * * @param string $recipientId Recipient id - * @param UpdateRecipientBankAccountRequest $request Bank account data - * @param string|null $idempotencyKey + * @param string $anticipationId Anticipation id * - * @return GetRecipientResponse Response from the API call + * @return GetAnticipationResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function updateRecipientDefaultBankAccount( - string $recipientId, - UpdateRecipientBankAccountRequest $request, - ?string $idempotencyKey = null - ): GetRecipientResponse { + public function getAnticipation(string $recipientId, string $anticipationId): GetAnticipationResponse + { $_reqBuilder = $this->requestBuilder( - RequestMethod::PATCH, - '/recipients/{recipient_id}/default-bank-account' + RequestMethod::GET, + '/recipients/{recipient_id}/anticipations/{anticipation_id}' ) ->auth('global') ->parameters( TemplateParam::init('recipient_id', $recipientId), - BodyParam::init($request), - HeaderParam::init('idempotency-key', $idempotencyKey) + TemplateParam::init('anticipation_id', $anticipationId) ); - $_resHandler = $this->responseHandler()->type(GetRecipientResponse::class); + $_resHandler = $this->responseHandler()->type(GetAnticipationResponse::class); return $this->execute($_reqBuilder, $_resHandler); } /** - * Updates recipient metadata - * - * @param string $recipientId Recipient id - * @param UpdateMetadataRequest $request Metadata + * @param string $recipientId Recipient Identificator + * @param UpdateTransferSettingsRequest $request * @param string|null $idempotencyKey * * @return GetRecipientResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function updateRecipientMetadata( + public function updateRecipientTransferSettings( string $recipientId, - UpdateMetadataRequest $request, + UpdateTransferSettingsRequest $request, ?string $idempotencyKey = null ): GetRecipientResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::PATCH, '/recipients/{recipient_id}/metadata') + $_reqBuilder = $this->requestBuilder(RequestMethod::PATCH, '/recipients/{recipient_id}/transfer-settings') ->auth('global') ->parameters( TemplateParam::init('recipient_id', $recipientId), @@ -235,68 +259,84 @@ public function updateRecipientMetadata( } /** - * Gets a paginated list of transfers for the recipient + * Retrieves a paginated list of anticipations from a recipient * * @param string $recipientId Recipient id * @param int|null $page Page number * @param int|null $size Page size - * @param string|null $status Filter for transfer status - * @param \DateTime|null $createdSince Filter for start range of transfer creation date - * @param \DateTime|null $createdUntil Filter for end range of transfer creation date + * @param string|null $status Filter for anticipation status + * @param string|null $timeframe Filter for anticipation timeframe + * @param \DateTime|null $paymentDateSince Filter for start range for anticipation payment date + * @param \DateTime|null $paymentDateUntil Filter for end range for anticipation payment date + * @param \DateTime|null $createdSince Filter for start range for anticipation creation date + * @param \DateTime|null $createdUntil Filter for end range for anticipation creation date * - * @return ListTransferResponse Response from the API call + * @return ListAnticipationResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function getTransfers( + public function getAnticipations( string $recipientId, ?int $page = null, ?int $size = null, ?string $status = null, + ?string $timeframe = null, + ?\DateTime $paymentDateSince = null, + ?\DateTime $paymentDateUntil = null, ?\DateTime $createdSince = null, ?\DateTime $createdUntil = null - ): ListTransferResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/recipients/{recipient_id}/transfers') + ): ListAnticipationResponse { + $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/recipients/{recipient_id}/anticipations') ->auth('global') ->parameters( TemplateParam::init('recipient_id', $recipientId), QueryParam::init('page', $page), QueryParam::init('size', $size), QueryParam::init('status', $status), + QueryParam::init('timeframe', $timeframe), + QueryParam::init('payment_date_since', $paymentDateSince) + ->serializeBy([DateTimeHelper::class, 'toRfc3339DateTime']), + QueryParam::init('payment_date_until', $paymentDateUntil) + ->serializeBy([DateTimeHelper::class, 'toRfc3339DateTime']), QueryParam::init('created_since', $createdSince) ->serializeBy([DateTimeHelper::class, 'toRfc3339DateTime']), QueryParam::init('created_until', $createdUntil) ->serializeBy([DateTimeHelper::class, 'toRfc3339DateTime']) ); - $_resHandler = $this->responseHandler()->type(ListTransferResponse::class); + $_resHandler = $this->responseHandler()->type(ListAnticipationResponse::class); return $this->execute($_reqBuilder, $_resHandler); } /** - * Gets a transfer + * Updates the default bank account from a recipient * * @param string $recipientId Recipient id - * @param string $transferId Transfer id + * @param UpdateRecipientBankAccountRequest $request Bank account data + * @param string|null $idempotencyKey * - * @return GetTransferResponse Response from the API call + * @return GetRecipientResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function getTransfer(string $recipientId, string $transferId): GetTransferResponse - { + public function updateRecipientDefaultBankAccount( + string $recipientId, + UpdateRecipientBankAccountRequest $request, + ?string $idempotencyKey = null + ): GetRecipientResponse { $_reqBuilder = $this->requestBuilder( - RequestMethod::GET, - '/recipients/{recipient_id}/transfers/{transfer_id}' + RequestMethod::PATCH, + '/recipients/{recipient_id}/default-bank-account' ) ->auth('global') ->parameters( TemplateParam::init('recipient_id', $recipientId), - TemplateParam::init('transfer_id', $transferId) + BodyParam::init($request), + HeaderParam::init('idempotency-key', $idempotencyKey) ); - $_resHandler = $this->responseHandler()->type(GetTransferResponse::class); + $_resHandler = $this->responseHandler()->type(GetRecipientResponse::class); return $this->execute($_reqBuilder, $_resHandler); } @@ -321,85 +361,71 @@ public function createWithdraw(string $recipientId, CreateWithdrawRequest $reque } /** - * Updates recipient metadata + * Get balance information for a recipient * * @param string $recipientId Recipient id - * @param UpdateAutomaticAnticipationSettingsRequest $request Metadata - * @param string|null $idempotencyKey * - * @return GetRecipientResponse Response from the API call + * @return GetBalanceResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function updateAutomaticAnticipationSettings( - string $recipientId, - UpdateAutomaticAnticipationSettingsRequest $request, - ?string $idempotencyKey = null - ): GetRecipientResponse { - $_reqBuilder = $this->requestBuilder( - RequestMethod::PATCH, - '/recipients/{recipient_id}/automatic-anticipation-settings' - ) + public function getBalance(string $recipientId): GetBalanceResponse + { + $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/recipients/{recipient_id}/balance') ->auth('global') - ->parameters( - TemplateParam::init('recipient_id', $recipientId), - BodyParam::init($request), - HeaderParam::init('idempotency-key', $idempotencyKey) - ); + ->parameters(TemplateParam::init('recipient_id', $recipientId)); - $_resHandler = $this->responseHandler()->type(GetRecipientResponse::class); + $_resHandler = $this->responseHandler()->type(GetBalanceResponse::class); return $this->execute($_reqBuilder, $_resHandler); } /** - * Gets an anticipation + * Creates a transfer for a recipient * - * @param string $recipientId Recipient id - * @param string $anticipationId Anticipation id + * @param string $recipientId Recipient Id + * @param CreateTransferRequest $request Transfer data + * @param string|null $idempotencyKey * - * @return GetAnticipationResponse Response from the API call + * @return GetTransferResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function getAnticipation(string $recipientId, string $anticipationId): GetAnticipationResponse - { - $_reqBuilder = $this->requestBuilder( - RequestMethod::GET, - '/recipients/{recipient_id}/anticipations/{anticipation_id}' - ) + public function createTransfer( + string $recipientId, + CreateTransferRequest $request, + ?string $idempotencyKey = null + ): GetTransferResponse { + $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/recipients/{recipient_id}/transfers') ->auth('global') ->parameters( TemplateParam::init('recipient_id', $recipientId), - TemplateParam::init('anticipation_id', $anticipationId) + BodyParam::init($request), + HeaderParam::init('idempotency-key', $idempotencyKey) ); - $_resHandler = $this->responseHandler()->type(GetAnticipationResponse::class); + $_resHandler = $this->responseHandler()->type(GetTransferResponse::class); return $this->execute($_reqBuilder, $_resHandler); } /** - * @param string $recipientId Recipient Identificator - * @param UpdateTransferSettingsRequest $request + * Creates a new recipient + * + * @param CreateRecipientRequest $request Recipient data * @param string|null $idempotencyKey * * @return GetRecipientResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function updateRecipientTransferSettings( - string $recipientId, - UpdateTransferSettingsRequest $request, + public function createRecipient( + CreateRecipientRequest $request, ?string $idempotencyKey = null ): GetRecipientResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::PATCH, '/recipients/{recipient_id}/transfer-settings') + $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/recipients') ->auth('global') - ->parameters( - TemplateParam::init('recipient_id', $recipientId), - BodyParam::init($request), - HeaderParam::init('idempotency-key', $idempotencyKey) - ); + ->parameters(BodyParam::init($request), HeaderParam::init('idempotency-key', $idempotencyKey)); $_resHandler = $this->responseHandler()->type(GetRecipientResponse::class); @@ -407,52 +433,33 @@ public function updateRecipientTransferSettings( } /** - * Retrieves a paginated list of anticipations from a recipient + * Updates recipient metadata * * @param string $recipientId Recipient id - * @param int|null $page Page number - * @param int|null $size Page size - * @param string|null $status Filter for anticipation status - * @param string|null $timeframe Filter for anticipation timeframe - * @param \DateTime|null $paymentDateSince Filter for start range for anticipation payment date - * @param \DateTime|null $paymentDateUntil Filter for end range for anticipation payment date - * @param \DateTime|null $createdSince Filter for start range for anticipation creation date - * @param \DateTime|null $createdUntil Filter for end range for anticipation creation date + * @param UpdateAutomaticAnticipationSettingsRequest $request Metadata + * @param string|null $idempotencyKey * - * @return ListAnticipationResponse Response from the API call + * @return GetRecipientResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function getAnticipations( + public function updateAutomaticAnticipationSettings( string $recipientId, - ?int $page = null, - ?int $size = null, - ?string $status = null, - ?string $timeframe = null, - ?\DateTime $paymentDateSince = null, - ?\DateTime $paymentDateUntil = null, - ?\DateTime $createdSince = null, - ?\DateTime $createdUntil = null - ): ListAnticipationResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/recipients/{recipient_id}/anticipations') + UpdateAutomaticAnticipationSettingsRequest $request, + ?string $idempotencyKey = null + ): GetRecipientResponse { + $_reqBuilder = $this->requestBuilder( + RequestMethod::PATCH, + '/recipients/{recipient_id}/automatic-anticipation-settings' + ) ->auth('global') ->parameters( TemplateParam::init('recipient_id', $recipientId), - QueryParam::init('page', $page), - QueryParam::init('size', $size), - QueryParam::init('status', $status), - QueryParam::init('timeframe', $timeframe), - QueryParam::init('payment_date_since', $paymentDateSince) - ->serializeBy([DateTimeHelper::class, 'toRfc3339DateTime']), - QueryParam::init('payment_date_until', $paymentDateUntil) - ->serializeBy([DateTimeHelper::class, 'toRfc3339DateTime']), - QueryParam::init('created_since', $createdSince) - ->serializeBy([DateTimeHelper::class, 'toRfc3339DateTime']), - QueryParam::init('created_until', $createdUntil) - ->serializeBy([DateTimeHelper::class, 'toRfc3339DateTime']) + BodyParam::init($request), + HeaderParam::init('idempotency-key', $idempotencyKey) ); - $_resHandler = $this->responseHandler()->type(ListAnticipationResponse::class); + $_resHandler = $this->responseHandler()->type(GetRecipientResponse::class); return $this->execute($_reqBuilder, $_resHandler); } @@ -477,26 +484,6 @@ public function getRecipient(string $recipientId): GetRecipientResponse return $this->execute($_reqBuilder, $_resHandler); } - /** - * Get balance information for a recipient - * - * @param string $recipientId Recipient id - * - * @return GetBalanceResponse Response from the API call - * - * @throws ApiException Thrown if API call fails - */ - public function getBalance(string $recipientId): GetBalanceResponse - { - $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/recipients/{recipient_id}/balance') - ->auth('global') - ->parameters(TemplateParam::init('recipient_id', $recipientId)); - - $_resHandler = $this->responseHandler()->type(GetBalanceResponse::class); - - return $this->execute($_reqBuilder, $_resHandler); - } - /** * Gets a paginated list of transfers for the recipient * @@ -538,53 +525,66 @@ public function getWithdrawals( } /** - * Creates a transfer for a recipient - * - * @param string $recipientId Recipient Id - * @param CreateTransferRequest $request Transfer data - * @param string|null $idempotencyKey + * @param string $recipientId + * @param string $withdrawalId * - * @return GetTransferResponse Response from the API call + * @return GetWithdrawResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function createTransfer( - string $recipientId, - CreateTransferRequest $request, - ?string $idempotencyKey = null - ): GetTransferResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/recipients/{recipient_id}/transfers') + public function getWithdrawById(string $recipientId, string $withdrawalId): GetWithdrawResponse + { + $_reqBuilder = $this->requestBuilder( + RequestMethod::GET, + '/recipients/{recipient_id}/withdrawals/{withdrawal_id}' + ) ->auth('global') ->parameters( TemplateParam::init('recipient_id', $recipientId), - BodyParam::init($request), - HeaderParam::init('idempotency-key', $idempotencyKey) + TemplateParam::init('withdrawal_id', $withdrawalId) ); - $_resHandler = $this->responseHandler()->type(GetTransferResponse::class); + $_resHandler = $this->responseHandler()->type(GetWithdrawResponse::class); return $this->execute($_reqBuilder, $_resHandler); } /** - * Creates a new recipient + * Gets a paginated list of transfers for the recipient * - * @param CreateRecipientRequest $request Recipient data - * @param string|null $idempotencyKey + * @param string $recipientId Recipient id + * @param int|null $page Page number + * @param int|null $size Page size + * @param string|null $status Filter for transfer status + * @param \DateTime|null $createdSince Filter for start range of transfer creation date + * @param \DateTime|null $createdUntil Filter for end range of transfer creation date * - * @return GetRecipientResponse Response from the API call + * @return ListTransferResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function createRecipient( - CreateRecipientRequest $request, - ?string $idempotencyKey = null - ): GetRecipientResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/recipients') + public function getTransfers( + string $recipientId, + ?int $page = null, + ?int $size = null, + ?string $status = null, + ?\DateTime $createdSince = null, + ?\DateTime $createdUntil = null + ): ListTransferResponse { + $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/recipients/{recipient_id}/transfers') ->auth('global') - ->parameters(BodyParam::init($request), HeaderParam::init('idempotency-key', $idempotencyKey)); + ->parameters( + TemplateParam::init('recipient_id', $recipientId), + QueryParam::init('page', $page), + QueryParam::init('size', $size), + QueryParam::init('status', $status), + QueryParam::init('created_since', $createdSince) + ->serializeBy([DateTimeHelper::class, 'toRfc3339DateTime']), + QueryParam::init('created_until', $createdUntil) + ->serializeBy([DateTimeHelper::class, 'toRfc3339DateTime']) + ); - $_resHandler = $this->responseHandler()->type(GetRecipientResponse::class); + $_resHandler = $this->responseHandler()->type(ListTransferResponse::class); return $this->execute($_reqBuilder, $_resHandler); } diff --git a/src/Controllers/SubscriptionsController.php b/src/Controllers/SubscriptionsController.php index 10cfdd5..53d83c3 100644 --- a/src/Controllers/SubscriptionsController.php +++ b/src/Controllers/SubscriptionsController.php @@ -74,91 +74,116 @@ public function renewSubscription(string $subscriptionId, ?string $idempotencyKe } /** - * Updates the credit card from a subscription + * Deletes a discount * * @param string $subscriptionId Subscription id - * @param UpdateSubscriptionCardRequest $request Request for updating a card + * @param string $discountId Discount Id * @param string|null $idempotencyKey * - * @return GetSubscriptionResponse Response from the API call + * @return GetDiscountResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function updateSubscriptionCard( + public function deleteDiscount( string $subscriptionId, - UpdateSubscriptionCardRequest $request, + string $discountId, ?string $idempotencyKey = null - ): GetSubscriptionResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::PATCH, '/subscriptions/{subscription_id}/card') + ): GetDiscountResponse { + $_reqBuilder = $this->requestBuilder( + RequestMethod::DELETE, + '/subscriptions/{subscription_id}/discounts/{discount_id}' + ) ->auth('global') ->parameters( TemplateParam::init('subscription_id', $subscriptionId), - BodyParam::init($request), + TemplateParam::init('discount_id', $discountId), HeaderParam::init('idempotency-key', $idempotencyKey) ); - $_resHandler = $this->responseHandler()->type(GetSubscriptionResponse::class); + $_resHandler = $this->responseHandler()->type(GetDiscountResponse::class); return $this->execute($_reqBuilder, $_resHandler); } /** - * Deletes a usage + * Gets all subscriptions * - * @param string $subscriptionId The subscription id - * @param string $itemId The subscription item id - * @param string $usageId The usage id - * @param string|null $idempotencyKey + * @param int|null $page Page number + * @param int|null $size Page size + * @param string|null $code Filter for subscription's code + * @param string|null $billingType Filter for subscription's billing type + * @param string|null $customerId Filter for subscription's customer id + * @param string|null $planId Filter for subscription's plan id + * @param string|null $cardId Filter for subscription's card id + * @param string|null $status Filter for subscription's status + * @param \DateTime|null $nextBillingSince Filter for subscription's next billing date start + * range + * @param \DateTime|null $nextBillingUntil Filter for subscription's next billing date end range + * @param \DateTime|null $createdSince Filter for subscription's creation date start range + * @param \DateTime|null $createdUntil Filter for subscriptions creation date end range * - * @return GetUsageResponse Response from the API call + * @return ListSubscriptionsResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function deleteUsage( - string $subscriptionId, - string $itemId, - string $usageId, - ?string $idempotencyKey = null - ): GetUsageResponse { - $_reqBuilder = $this->requestBuilder( - RequestMethod::DELETE, - '/subscriptions/{subscription_id}/items/{item_id}/usages/{usage_id}' - ) + public function getSubscriptions( + ?int $page = null, + ?int $size = null, + ?string $code = null, + ?string $billingType = null, + ?string $customerId = null, + ?string $planId = null, + ?string $cardId = null, + ?string $status = null, + ?\DateTime $nextBillingSince = null, + ?\DateTime $nextBillingUntil = null, + ?\DateTime $createdSince = null, + ?\DateTime $createdUntil = null + ): ListSubscriptionsResponse { + $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/subscriptions') ->auth('global') ->parameters( - TemplateParam::init('subscription_id', $subscriptionId), - TemplateParam::init('item_id', $itemId), - TemplateParam::init('usage_id', $usageId), - HeaderParam::init('idempotency-key', $idempotencyKey) + QueryParam::init('page', $page), + QueryParam::init('size', $size), + QueryParam::init('code', $code), + QueryParam::init('billing_type', $billingType), + QueryParam::init('customer_id', $customerId), + QueryParam::init('plan_id', $planId), + QueryParam::init('card_id', $cardId), + QueryParam::init('status', $status), + QueryParam::init('next_billing_since', $nextBillingSince) + ->serializeBy([DateTimeHelper::class, 'toRfc3339DateTime']), + QueryParam::init('next_billing_until', $nextBillingUntil) + ->serializeBy([DateTimeHelper::class, 'toRfc3339DateTime']), + QueryParam::init('created_since', $createdSince) + ->serializeBy([DateTimeHelper::class, 'toRfc3339DateTime']), + QueryParam::init('created_until', $createdUntil) + ->serializeBy([DateTimeHelper::class, 'toRfc3339DateTime']) ); - $_resHandler = $this->responseHandler()->type(GetUsageResponse::class); + $_resHandler = $this->responseHandler()->type(ListSubscriptionsResponse::class); return $this->execute($_reqBuilder, $_resHandler); } /** - * Creates a discount - * - * @param string $subscriptionId Subscription id - * @param CreateDiscountRequest $request Request for creating a discount - * @param string|null $idempotencyKey + * @param string $subscriptionId The subscription id + * @param string $discountId * * @return GetDiscountResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function createDiscount( - string $subscriptionId, - CreateDiscountRequest $request, - ?string $idempotencyKey = null - ): GetDiscountResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/subscriptions/{subscription_id}/discounts') + public function getDiscountById(string $subscriptionId, string $discountId): GetDiscountResponse + { + $_reqBuilder = $this->requestBuilder( + RequestMethod::GET, + '/subscriptions/{subscription_id}/discounts/{discountId}' + ) ->auth('global') ->parameters( TemplateParam::init('subscription_id', $subscriptionId), - BodyParam::init($request), - HeaderParam::init('idempotency-key', $idempotencyKey) + TemplateParam::init('discountId', $discountId) ); $_resHandler = $this->responseHandler()->type(GetDiscountResponse::class); @@ -167,53 +192,70 @@ public function createDiscount( } /** - * Create Usage + * Creates a new subscription * - * @param string $subscriptionId Subscription id - * @param string $itemId Item id + * @param CreateSubscriptionRequest $body Request for creating a subscription * @param string|null $idempotencyKey * - * @return GetUsageResponse Response from the API call + * @return GetSubscriptionResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function createAnUsage( - string $subscriptionId, - string $itemId, + public function createSubscription( + CreateSubscriptionRequest $body, ?string $idempotencyKey = null - ): GetUsageResponse { + ): GetSubscriptionResponse { + $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/subscriptions') + ->auth('global') + ->parameters(BodyParam::init($body), HeaderParam::init('idempotency-key', $idempotencyKey)); + + $_resHandler = $this->responseHandler()->type(GetSubscriptionResponse::class); + + return $this->execute($_reqBuilder, $_resHandler); + } + + /** + * @param string $subscriptionId The subscription Id + * @param string $incrementId The increment Id + * + * @return GetIncrementResponse Response from the API call + * + * @throws ApiException Thrown if API call fails + */ + public function getIncrementById(string $subscriptionId, string $incrementId): GetIncrementResponse + { $_reqBuilder = $this->requestBuilder( - RequestMethod::POST, - '/subscriptions/{subscription_id}/items/{item_id}/usages' + RequestMethod::GET, + '/subscriptions/{subscription_id}/increments/{increment_id}' ) ->auth('global') ->parameters( TemplateParam::init('subscription_id', $subscriptionId), - TemplateParam::init('item_id', $itemId), - HeaderParam::init('idempotency-key', $idempotencyKey) + TemplateParam::init('increment_id', $incrementId) ); - $_resHandler = $this->responseHandler()->type(GetUsageResponse::class); + $_resHandler = $this->responseHandler()->type(GetIncrementResponse::class); return $this->execute($_reqBuilder, $_resHandler); } /** - * @param string $subscriptionId Subscription Id - * @param UpdateCurrentCycleStatusRequest $request Request for updating the end date of the - * subscription current status + * Updates the metadata from a subscription + * + * @param string $subscriptionId The subscription id + * @param UpdateMetadataRequest $request Request for updating the subscrption metadata * @param string|null $idempotencyKey * - * @return void Response from the API call + * @return GetSubscriptionResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function updateCurrentCycleStatus( + public function updateSubscriptionMetadata( string $subscriptionId, - UpdateCurrentCycleStatusRequest $request, + UpdateMetadataRequest $request, ?string $idempotencyKey = null - ): void { - $_reqBuilder = $this->requestBuilder(RequestMethod::PATCH, '/subscriptions/{subscription_id}/cycle-status') + ): GetSubscriptionResponse { + $_reqBuilder = $this->requestBuilder(RequestMethod::PATCH, '/Subscriptions/{subscription_id}/metadata') ->auth('global') ->parameters( TemplateParam::init('subscription_id', $subscriptionId), @@ -221,108 +263,81 @@ public function updateCurrentCycleStatus( HeaderParam::init('idempotency-key', $idempotencyKey) ); - $this->execute($_reqBuilder); + $_resHandler = $this->responseHandler()->type(GetSubscriptionResponse::class); + + return $this->execute($_reqBuilder, $_resHandler); } /** - * Deletes a discount + * Deletes a increment * * @param string $subscriptionId Subscription id - * @param string $discountId Discount Id + * @param string $incrementId Increment id * @param string|null $idempotencyKey * - * @return GetDiscountResponse Response from the API call + * @return GetIncrementResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function deleteDiscount( + public function deleteIncrement( string $subscriptionId, - string $discountId, + string $incrementId, ?string $idempotencyKey = null - ): GetDiscountResponse { + ): GetIncrementResponse { $_reqBuilder = $this->requestBuilder( RequestMethod::DELETE, - '/subscriptions/{subscription_id}/discounts/{discount_id}' + '/subscriptions/{subscription_id}/increments/{increment_id}' ) ->auth('global') ->parameters( TemplateParam::init('subscription_id', $subscriptionId), - TemplateParam::init('discount_id', $discountId), + TemplateParam::init('increment_id', $incrementId), HeaderParam::init('idempotency-key', $idempotencyKey) ); - $_resHandler = $this->responseHandler()->type(GetDiscountResponse::class); + $_resHandler = $this->responseHandler()->type(GetIncrementResponse::class); return $this->execute($_reqBuilder, $_resHandler); } /** - * Get Subscription Items + * Gets a subscription * - * @param string $subscriptionId The subscription id - * @param int|null $page Page number - * @param int|null $size Page size - * @param string|null $name The item name - * @param string|null $code Identification code in the client system - * @param string|null $status The item statis - * @param string|null $description The item description - * @param string|null $createdSince Filter for item's creation date start range - * @param string|null $createdUntil Filter for item's creation date end range + * @param string $subscriptionId Subscription id * - * @return ListSubscriptionItemsResponse Response from the API call + * @return GetSubscriptionResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function getSubscriptionItems( - string $subscriptionId, - ?int $page = null, - ?int $size = null, - ?string $name = null, - ?string $code = null, - ?string $status = null, - ?string $description = null, - ?string $createdSince = null, - ?string $createdUntil = null - ): ListSubscriptionItemsResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/subscriptions/{subscription_id}/items') + public function getSubscription(string $subscriptionId): GetSubscriptionResponse + { + $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/subscriptions/{subscription_id}') ->auth('global') - ->parameters( - TemplateParam::init('subscription_id', $subscriptionId), - QueryParam::init('page', $page), - QueryParam::init('size', $size), - QueryParam::init('name', $name), - QueryParam::init('code', $code), - QueryParam::init('status', $status), - QueryParam::init('description', $description), - QueryParam::init('created_since', $createdSince), - QueryParam::init('created_until', $createdUntil) - ); + ->parameters(TemplateParam::init('subscription_id', $subscriptionId)); - $_resHandler = $this->responseHandler()->type(ListSubscriptionItemsResponse::class); + $_resHandler = $this->responseHandler()->type(GetSubscriptionResponse::class); return $this->execute($_reqBuilder, $_resHandler); } /** - * Updates the payment method from a subscription - * - * @param string $subscriptionId Subscription id - * @param UpdateSubscriptionPaymentMethodRequest $request Request for updating the paymentmethod - * from a subscription + * @param string $subscriptionId + * @param UpdateCurrentCycleEndDateRequest $request Request for updating the end date of the + * current signature cycle * @param string|null $idempotencyKey * * @return GetSubscriptionResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function updateSubscriptionPaymentMethod( + public function updateLatestPeriodEndAt( string $subscriptionId, - UpdateSubscriptionPaymentMethodRequest $request, + UpdateCurrentCycleEndDateRequest $request, ?string $idempotencyKey = null ): GetSubscriptionResponse { $_reqBuilder = $this->requestBuilder( RequestMethod::PATCH, - '/subscriptions/{subscription_id}/payment-method' + '/subscriptions/{subscription_id}/periods/latest/end-at' ) ->auth('global') ->parameters( @@ -337,110 +352,21 @@ public function updateSubscriptionPaymentMethod( } /** - * Get Subscription Item - * * @param string $subscriptionId Subscription Id - * @param string $itemId Item id - * - * @return GetSubscriptionItemResponse Response from the API call - * - * @throws ApiException Thrown if API call fails - */ - public function getSubscriptionItem(string $subscriptionId, string $itemId): GetSubscriptionItemResponse - { - $_reqBuilder = $this->requestBuilder( - RequestMethod::GET, - '/subscriptions/{subscription_id}/items/{item_id}' - ) - ->auth('global') - ->parameters( - TemplateParam::init('subscription_id', $subscriptionId), - TemplateParam::init('item_id', $itemId) - ); - - $_resHandler = $this->responseHandler()->type(GetSubscriptionItemResponse::class); - - return $this->execute($_reqBuilder, $_resHandler); - } - - /** - * Gets all subscriptions - * - * @param int|null $page Page number - * @param int|null $size Page size - * @param string|null $code Filter for subscription's code - * @param string|null $billingType Filter for subscription's billing type - * @param string|null $customerId Filter for subscription's customer id - * @param string|null $planId Filter for subscription's plan id - * @param string|null $cardId Filter for subscription's card id - * @param string|null $status Filter for subscription's status - * @param \DateTime|null $nextBillingSince Filter for subscription's next billing date start - * range - * @param \DateTime|null $nextBillingUntil Filter for subscription's next billing date end range - * @param \DateTime|null $createdSince Filter for subscription's creation date start range - * @param \DateTime|null $createdUntil Filter for subscriptions creation date end range - * - * @return ListSubscriptionsResponse Response from the API call - * - * @throws ApiException Thrown if API call fails - */ - public function getSubscriptions( - ?int $page = null, - ?int $size = null, - ?string $code = null, - ?string $billingType = null, - ?string $customerId = null, - ?string $planId = null, - ?string $cardId = null, - ?string $status = null, - ?\DateTime $nextBillingSince = null, - ?\DateTime $nextBillingUntil = null, - ?\DateTime $createdSince = null, - ?\DateTime $createdUntil = null - ): ListSubscriptionsResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/subscriptions') - ->auth('global') - ->parameters( - QueryParam::init('page', $page), - QueryParam::init('size', $size), - QueryParam::init('code', $code), - QueryParam::init('billing_type', $billingType), - QueryParam::init('customer_id', $customerId), - QueryParam::init('plan_id', $planId), - QueryParam::init('card_id', $cardId), - QueryParam::init('status', $status), - QueryParam::init('next_billing_since', $nextBillingSince) - ->serializeBy([DateTimeHelper::class, 'toRfc3339DateTime']), - QueryParam::init('next_billing_until', $nextBillingUntil) - ->serializeBy([DateTimeHelper::class, 'toRfc3339DateTime']), - QueryParam::init('created_since', $createdSince) - ->serializeBy([DateTimeHelper::class, 'toRfc3339DateTime']), - QueryParam::init('created_until', $createdUntil) - ->serializeBy([DateTimeHelper::class, 'toRfc3339DateTime']) - ); - - $_resHandler = $this->responseHandler()->type(ListSubscriptionsResponse::class); - - return $this->execute($_reqBuilder, $_resHandler); - } - - /** - * Cancels a subscription - * - * @param string $subscriptionId Subscription id - * @param CreateCancelSubscriptionRequest|null $request Request for cancelling a subscription + * @param UpdateCurrentCycleStatusRequest $request Request for updating the end date of the + * subscription current status * @param string|null $idempotencyKey * - * @return GetSubscriptionResponse Response from the API call + * @return void Response from the API call * * @throws ApiException Thrown if API call fails */ - public function cancelSubscription( + public function updateCurrentCycleStatus( string $subscriptionId, - ?CreateCancelSubscriptionRequest $request = null, + UpdateCurrentCycleStatusRequest $request, ?string $idempotencyKey = null - ): GetSubscriptionResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::DELETE, '/subscriptions/{subscription_id}') + ): void { + $_reqBuilder = $this->requestBuilder(RequestMethod::PATCH, '/subscriptions/{subscription_id}/cycle-status') ->auth('global') ->parameters( TemplateParam::init('subscription_id', $subscriptionId), @@ -448,167 +374,190 @@ public function cancelSubscription( HeaderParam::init('idempotency-key', $idempotencyKey) ); - $_resHandler = $this->responseHandler()->type(GetSubscriptionResponse::class); - - return $this->execute($_reqBuilder, $_resHandler); + $this->execute($_reqBuilder); } /** - * Creates a increment + * Get Subscription Items * - * @param string $subscriptionId Subscription id - * @param CreateIncrementRequest $request Request for creating a increment - * @param string|null $idempotencyKey + * @param string $subscriptionId The subscription id + * @param int|null $page Page number + * @param int|null $size Page size + * @param string|null $name The item name + * @param string|null $code Identification code in the client system + * @param string|null $status The item statis + * @param string|null $description The item description + * @param string|null $createdSince Filter for item's creation date start range + * @param string|null $createdUntil Filter for item's creation date end range * - * @return GetIncrementResponse Response from the API call + * @return ListSubscriptionItemsResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function createIncrement( + public function getSubscriptionItems( string $subscriptionId, - CreateIncrementRequest $request, - ?string $idempotencyKey = null - ): GetIncrementResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/subscriptions/{subscription_id}/increments') + ?int $page = null, + ?int $size = null, + ?string $name = null, + ?string $code = null, + ?string $status = null, + ?string $description = null, + ?string $createdSince = null, + ?string $createdUntil = null + ): ListSubscriptionItemsResponse { + $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/subscriptions/{subscription_id}/items') ->auth('global') ->parameters( TemplateParam::init('subscription_id', $subscriptionId), - BodyParam::init($request), - HeaderParam::init('idempotency-key', $idempotencyKey) + QueryParam::init('page', $page), + QueryParam::init('size', $size), + QueryParam::init('name', $name), + QueryParam::init('code', $code), + QueryParam::init('status', $status), + QueryParam::init('description', $description), + QueryParam::init('created_since', $createdSince), + QueryParam::init('created_until', $createdUntil) ); - $_resHandler = $this->responseHandler()->type(GetIncrementResponse::class); + $_resHandler = $this->responseHandler()->type(ListSubscriptionItemsResponse::class); return $this->execute($_reqBuilder, $_resHandler); } /** - * Creates a usage + * Get Subscription Item * * @param string $subscriptionId Subscription Id * @param string $itemId Item id - * @param CreateUsageRequest $body Request for creating a usage - * @param string|null $idempotencyKey * - * @return GetUsageResponse Response from the API call + * @return GetSubscriptionItemResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function createUsage( - string $subscriptionId, - string $itemId, - CreateUsageRequest $body, - ?string $idempotencyKey = null - ): GetUsageResponse { + public function getSubscriptionItem(string $subscriptionId, string $itemId): GetSubscriptionItemResponse + { $_reqBuilder = $this->requestBuilder( - RequestMethod::POST, - '/subscriptions/{subscription_id}/items/{item_id}/usages' + RequestMethod::GET, + '/subscriptions/{subscription_id}/items/{item_id}' ) ->auth('global') ->parameters( TemplateParam::init('subscription_id', $subscriptionId), - TemplateParam::init('item_id', $itemId), - BodyParam::init($body), - HeaderParam::init('idempotency-key', $idempotencyKey) + TemplateParam::init('item_id', $itemId) ); - $_resHandler = $this->responseHandler()->type(GetUsageResponse::class); + $_resHandler = $this->responseHandler()->type(GetSubscriptionItemResponse::class); return $this->execute($_reqBuilder, $_resHandler); } /** - * @param string $subscriptionId The subscription id - * @param string $discountId + * @param string $subscriptionId + * @param UpdateSubscriptionAffiliationIdRequest $request Request for updating a subscription + * affiliation id + * @param string|null $idempotencyKey * - * @return GetDiscountResponse Response from the API call + * @return GetSubscriptionResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function getDiscountById(string $subscriptionId, string $discountId): GetDiscountResponse - { + public function updateSubscriptionAffiliationId( + string $subscriptionId, + UpdateSubscriptionAffiliationIdRequest $request, + ?string $idempotencyKey = null + ): GetSubscriptionResponse { $_reqBuilder = $this->requestBuilder( - RequestMethod::GET, - '/subscriptions/{subscription_id}/discounts/{discountId}' + RequestMethod::PATCH, + '/subscriptions/{subscription_id}/gateway-affiliation-id' ) ->auth('global') ->parameters( TemplateParam::init('subscription_id', $subscriptionId), - TemplateParam::init('discountId', $discountId) + BodyParam::init($request), + HeaderParam::init('idempotency-key', $idempotencyKey) ); - $_resHandler = $this->responseHandler()->type(GetDiscountResponse::class); + $_resHandler = $this->responseHandler()->type(GetSubscriptionResponse::class); return $this->execute($_reqBuilder, $_resHandler); } /** - * Creates a new subscription - * - * @param CreateSubscriptionRequest $body Request for creating a subscription - * @param string|null $idempotencyKey + * @param string $subscriptionId The subscription id + * @param int $page Page number + * @param int $size Page size * - * @return GetSubscriptionResponse Response from the API call + * @return ListDiscountsResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function createSubscription( - CreateSubscriptionRequest $body, - ?string $idempotencyKey = null - ): GetSubscriptionResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/subscriptions') + public function getDiscounts(string $subscriptionId, int $page, int $size): ListDiscountsResponse + { + $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/subscriptions/{subscription_id}/discounts/') ->auth('global') - ->parameters(BodyParam::init($body), HeaderParam::init('idempotency-key', $idempotencyKey)); + ->parameters( + TemplateParam::init('subscription_id', $subscriptionId), + QueryParam::init('page', $page), + QueryParam::init('size', $size) + ); - $_resHandler = $this->responseHandler()->type(GetSubscriptionResponse::class); + $_resHandler = $this->responseHandler()->type(ListDiscountsResponse::class); return $this->execute($_reqBuilder, $_resHandler); } /** - * @param string $subscriptionId The subscription Id - * @param string $incrementId The increment Id + * Updates a subscription item * - * @return GetIncrementResponse Response from the API call + * @param string $subscriptionId Subscription Id + * @param string $itemId Item id + * @param UpdateSubscriptionItemRequest $body Request for updating a subscription item + * @param string|null $idempotencyKey + * + * @return GetSubscriptionItemResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function getIncrementById(string $subscriptionId, string $incrementId): GetIncrementResponse - { + public function updateSubscriptionItem( + string $subscriptionId, + string $itemId, + UpdateSubscriptionItemRequest $body, + ?string $idempotencyKey = null + ): GetSubscriptionItemResponse { $_reqBuilder = $this->requestBuilder( - RequestMethod::GET, - '/subscriptions/{subscription_id}/increments/{increment_id}' + RequestMethod::PUT, + '/subscriptions/{subscription_id}/items/{item_id}' ) ->auth('global') ->parameters( TemplateParam::init('subscription_id', $subscriptionId), - TemplateParam::init('increment_id', $incrementId) + TemplateParam::init('item_id', $itemId), + BodyParam::init($body), + HeaderParam::init('idempotency-key', $idempotencyKey) ); - $_resHandler = $this->responseHandler()->type(GetIncrementResponse::class); + $_resHandler = $this->responseHandler()->type(GetSubscriptionItemResponse::class); return $this->execute($_reqBuilder, $_resHandler); } /** - * @param string $subscriptionId - * @param UpdateSubscriptionAffiliationIdRequest $request Request for updating a subscription - * affiliation id + * Creates a new Subscription item + * + * @param string $subscriptionId Subscription id + * @param CreateSubscriptionItemRequest $request Request for creating a subscription item * @param string|null $idempotencyKey * - * @return GetSubscriptionResponse Response from the API call + * @return GetSubscriptionItemResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function updateSubscriptionAffiliationId( + public function createSubscriptionItem( string $subscriptionId, - UpdateSubscriptionAffiliationIdRequest $request, + CreateSubscriptionItemRequest $request, ?string $idempotencyKey = null - ): GetSubscriptionResponse { - $_reqBuilder = $this->requestBuilder( - RequestMethod::PATCH, - '/subscriptions/{subscription_id}/gateway-affiliation-id' - ) + ): GetSubscriptionItemResponse { + $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/subscriptions/{subscription_id}/items') ->auth('global') ->parameters( TemplateParam::init('subscription_id', $subscriptionId), @@ -616,138 +565,165 @@ public function updateSubscriptionAffiliationId( HeaderParam::init('idempotency-key', $idempotencyKey) ); - $_resHandler = $this->responseHandler()->type(GetSubscriptionResponse::class); + $_resHandler = $this->responseHandler()->type(GetSubscriptionItemResponse::class); return $this->execute($_reqBuilder, $_resHandler); } /** - * Updates the metadata from a subscription + * Lists all usages from a subscription item * * @param string $subscriptionId The subscription id - * @param UpdateMetadataRequest $request Request for updating the subscrption metadata - * @param string|null $idempotencyKey + * @param string $itemId The subscription item id + * @param int|null $page Page number + * @param int|null $size Page size + * @param string|null $code Identification code in the client system + * @param string|null $group Identification group in the client system + * @param \DateTime|null $usedSince + * @param \DateTime|null $usedUntil * - * @return GetSubscriptionResponse Response from the API call + * @return ListUsagesResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function updateSubscriptionMetadata( + public function getUsages( string $subscriptionId, - UpdateMetadataRequest $request, - ?string $idempotencyKey = null - ): GetSubscriptionResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::PATCH, '/Subscriptions/{subscription_id}/metadata') + string $itemId, + ?int $page = null, + ?int $size = null, + ?string $code = null, + ?string $group = null, + ?\DateTime $usedSince = null, + ?\DateTime $usedUntil = null + ): ListUsagesResponse { + $_reqBuilder = $this->requestBuilder( + RequestMethod::GET, + '/subscriptions/{subscription_id}/items/{item_id}/usages' + ) ->auth('global') ->parameters( TemplateParam::init('subscription_id', $subscriptionId), - BodyParam::init($request), - HeaderParam::init('idempotency-key', $idempotencyKey) + TemplateParam::init('item_id', $itemId), + QueryParam::init('page', $page), + QueryParam::init('size', $size), + QueryParam::init('code', $code), + QueryParam::init('group', $group), + QueryParam::init('used_since', $usedSince)->serializeBy([DateTimeHelper::class, 'toRfc3339DateTime']), + QueryParam::init('used_until', $usedUntil)->serializeBy([DateTimeHelper::class, 'toRfc3339DateTime']) ); - $_resHandler = $this->responseHandler()->type(GetSubscriptionResponse::class); + $_resHandler = $this->responseHandler()->type(ListUsagesResponse::class); return $this->execute($_reqBuilder, $_resHandler); } /** - * Deletes a increment + * Atualização do valor mínimo da assinatura * - * @param string $subscriptionId Subscription id - * @param string $incrementId Increment id + * @param string $subscriptionId Subscription Id + * @param UpdateSubscriptionMinimumPriceRequest $request Request da requisição com o valor + * mínimo que será configurado * @param string|null $idempotencyKey * - * @return GetIncrementResponse Response from the API call + * @return GetSubscriptionResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function deleteIncrement( + public function updateSubscriptionMiniumPrice( string $subscriptionId, - string $incrementId, + UpdateSubscriptionMinimumPriceRequest $request, ?string $idempotencyKey = null - ): GetIncrementResponse { + ): GetSubscriptionResponse { $_reqBuilder = $this->requestBuilder( - RequestMethod::DELETE, - '/subscriptions/{subscription_id}/increments/{increment_id}' + RequestMethod::PATCH, + '/subscriptions/{subscription_id}/minimum_price' ) ->auth('global') ->parameters( TemplateParam::init('subscription_id', $subscriptionId), - TemplateParam::init('increment_id', $incrementId), + BodyParam::init($request), HeaderParam::init('idempotency-key', $idempotencyKey) ); - $_resHandler = $this->responseHandler()->type(GetIncrementResponse::class); + $_resHandler = $this->responseHandler()->type(GetSubscriptionResponse::class); return $this->execute($_reqBuilder, $_resHandler); } /** - * @param string $subscriptionId Subscription Id - * @param string $page Page number - * @param string $size Page size + * @param string $subscriptionId The subscription id + * @param string $cycleId * - * @return ListCyclesResponse Response from the API call + * @return GetPeriodResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function getSubscriptionCycles(string $subscriptionId, string $page, string $size): ListCyclesResponse + public function getSubscriptionCycleById(string $subscriptionId, string $cycleId): GetPeriodResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/subscriptions/{subscription_id}/cycles') + $_reqBuilder = $this->requestBuilder( + RequestMethod::GET, + '/subscriptions/{subscription_id}/cycles/{cycleId}' + ) ->auth('global') ->parameters( TemplateParam::init('subscription_id', $subscriptionId), - QueryParam::init('page', $page), - QueryParam::init('size', $size) + TemplateParam::init('cycleId', $cycleId) ); - $_resHandler = $this->responseHandler()->type(ListCyclesResponse::class); + $_resHandler = $this->responseHandler()->type(GetPeriodResponse::class); return $this->execute($_reqBuilder, $_resHandler); } /** - * @param string $subscriptionId The subscription id - * @param int $page Page number - * @param int $size Page size + * Create Usage * - * @return ListDiscountsResponse Response from the API call + * @param string $subscriptionId Subscription id + * @param string $itemId Item id + * @param string|null $idempotencyKey + * + * @return GetUsageResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function getDiscounts(string $subscriptionId, int $page, int $size): ListDiscountsResponse - { - $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/subscriptions/{subscription_id}/discounts/') + public function createAnUsage( + string $subscriptionId, + string $itemId, + ?string $idempotencyKey = null + ): GetUsageResponse { + $_reqBuilder = $this->requestBuilder( + RequestMethod::POST, + '/subscriptions/{subscription_id}/items/{item_id}/usages' + ) ->auth('global') ->parameters( TemplateParam::init('subscription_id', $subscriptionId), - QueryParam::init('page', $page), - QueryParam::init('size', $size) + TemplateParam::init('item_id', $itemId), + HeaderParam::init('idempotency-key', $idempotencyKey) ); - $_resHandler = $this->responseHandler()->type(ListDiscountsResponse::class); + $_resHandler = $this->responseHandler()->type(GetUsageResponse::class); return $this->execute($_reqBuilder, $_resHandler); } /** - * Updates the billing date from a subscription + * Cancels a subscription * - * @param string $subscriptionId The subscription id - * @param UpdateSubscriptionBillingDateRequest $request Request for updating the subscription - * billing date + * @param string $subscriptionId Subscription id + * @param CreateCancelSubscriptionRequest|null $request Request for cancelling a subscription * @param string|null $idempotencyKey * * @return GetSubscriptionResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function updateSubscriptionBillingDate( + public function cancelSubscription( string $subscriptionId, - UpdateSubscriptionBillingDateRequest $request, + ?CreateCancelSubscriptionRequest $request = null, ?string $idempotencyKey = null ): GetSubscriptionResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::PATCH, '/subscriptions/{subscription_id}/billing-date') + $_reqBuilder = $this->requestBuilder(RequestMethod::DELETE, '/subscriptions/{subscription_id}') ->auth('global') ->parameters( TemplateParam::init('subscription_id', $subscriptionId), @@ -849,23 +825,22 @@ public function updateSubscriptionDueDays( } /** - * Updates the start at date from a subscription + * Updates the credit card from a subscription * - * @param string $subscriptionId The subscription id - * @param UpdateSubscriptionStartAtRequest $request Request for updating the subscription start - * date + * @param string $subscriptionId Subscription id + * @param UpdateSubscriptionCardRequest $request Request for updating a card * @param string|null $idempotencyKey * * @return GetSubscriptionResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function updateSubscriptionStartAt( + public function updateSubscriptionCard( string $subscriptionId, - UpdateSubscriptionStartAtRequest $request, + UpdateSubscriptionCardRequest $request, ?string $idempotencyKey = null ): GetSubscriptionResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::PATCH, '/subscriptions/{subscription_id}/start-at') + $_reqBuilder = $this->requestBuilder(RequestMethod::PATCH, '/subscriptions/{subscription_id}/card') ->auth('global') ->parameters( TemplateParam::init('subscription_id', $subscriptionId), @@ -879,57 +854,57 @@ public function updateSubscriptionStartAt( } /** - * Updates a subscription item + * Deletes a usage * - * @param string $subscriptionId Subscription Id - * @param string $itemId Item id - * @param UpdateSubscriptionItemRequest $body Request for updating a subscription item + * @param string $subscriptionId The subscription id + * @param string $itemId The subscription item id + * @param string $usageId The usage id * @param string|null $idempotencyKey * - * @return GetSubscriptionItemResponse Response from the API call + * @return GetUsageResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function updateSubscriptionItem( + public function deleteUsage( string $subscriptionId, string $itemId, - UpdateSubscriptionItemRequest $body, + string $usageId, ?string $idempotencyKey = null - ): GetSubscriptionItemResponse { + ): GetUsageResponse { $_reqBuilder = $this->requestBuilder( - RequestMethod::PUT, - '/subscriptions/{subscription_id}/items/{item_id}' + RequestMethod::DELETE, + '/subscriptions/{subscription_id}/items/{item_id}/usages/{usage_id}' ) ->auth('global') ->parameters( TemplateParam::init('subscription_id', $subscriptionId), TemplateParam::init('item_id', $itemId), - BodyParam::init($body), + TemplateParam::init('usage_id', $usageId), HeaderParam::init('idempotency-key', $idempotencyKey) ); - $_resHandler = $this->responseHandler()->type(GetSubscriptionItemResponse::class); + $_resHandler = $this->responseHandler()->type(GetUsageResponse::class); return $this->execute($_reqBuilder, $_resHandler); } /** - * Creates a new Subscription item + * Creates a discount * * @param string $subscriptionId Subscription id - * @param CreateSubscriptionItemRequest $request Request for creating a subscription item + * @param CreateDiscountRequest $request Request for creating a discount * @param string|null $idempotencyKey * - * @return GetSubscriptionItemResponse Response from the API call + * @return GetDiscountResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function createSubscriptionItem( + public function createDiscount( string $subscriptionId, - CreateSubscriptionItemRequest $request, + CreateDiscountRequest $request, ?string $idempotencyKey = null - ): GetSubscriptionItemResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/subscriptions/{subscription_id}/items') + ): GetDiscountResponse { + $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/subscriptions/{subscription_id}/discounts') ->auth('global') ->parameters( TemplateParam::init('subscription_id', $subscriptionId), @@ -937,25 +912,38 @@ public function createSubscriptionItem( HeaderParam::init('idempotency-key', $idempotencyKey) ); - $_resHandler = $this->responseHandler()->type(GetSubscriptionItemResponse::class); + $_resHandler = $this->responseHandler()->type(GetDiscountResponse::class); return $this->execute($_reqBuilder, $_resHandler); } /** - * Gets a subscription + * Updates the payment method from a subscription * * @param string $subscriptionId Subscription id + * @param UpdateSubscriptionPaymentMethodRequest $request Request for updating the paymentmethod + * from a subscription + * @param string|null $idempotencyKey * * @return GetSubscriptionResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function getSubscription(string $subscriptionId): GetSubscriptionResponse - { - $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/subscriptions/{subscription_id}') + public function updateSubscriptionPaymentMethod( + string $subscriptionId, + UpdateSubscriptionPaymentMethodRequest $request, + ?string $idempotencyKey = null + ): GetSubscriptionResponse { + $_reqBuilder = $this->requestBuilder( + RequestMethod::PATCH, + '/subscriptions/{subscription_id}/payment-method' + ) ->auth('global') - ->parameters(TemplateParam::init('subscription_id', $subscriptionId)); + ->parameters( + TemplateParam::init('subscription_id', $subscriptionId), + BodyParam::init($request), + HeaderParam::init('idempotency-key', $idempotencyKey) + ); $_resHandler = $this->responseHandler()->type(GetSubscriptionResponse::class); @@ -963,104 +951,111 @@ public function getSubscription(string $subscriptionId): GetSubscriptionResponse } /** - * Lists all usages from a subscription item + * Creates a increment * - * @param string $subscriptionId The subscription id - * @param string $itemId The subscription item id - * @param int|null $page Page number - * @param int|null $size Page size - * @param string|null $code Identification code in the client system - * @param string|null $group Identification group in the client system - * @param \DateTime|null $usedSince - * @param \DateTime|null $usedUntil + * @param string $subscriptionId Subscription id + * @param CreateIncrementRequest $request Request for creating a increment + * @param string|null $idempotencyKey * - * @return ListUsagesResponse Response from the API call + * @return GetIncrementResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function getUsages( + public function createIncrement( string $subscriptionId, - string $itemId, - ?int $page = null, - ?int $size = null, - ?string $code = null, - ?string $group = null, - ?\DateTime $usedSince = null, - ?\DateTime $usedUntil = null - ): ListUsagesResponse { - $_reqBuilder = $this->requestBuilder( - RequestMethod::GET, - '/subscriptions/{subscription_id}/items/{item_id}/usages' - ) + CreateIncrementRequest $request, + ?string $idempotencyKey = null + ): GetIncrementResponse { + $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/subscriptions/{subscription_id}/increments') ->auth('global') ->parameters( TemplateParam::init('subscription_id', $subscriptionId), - TemplateParam::init('item_id', $itemId), - QueryParam::init('page', $page), - QueryParam::init('size', $size), - QueryParam::init('code', $code), - QueryParam::init('group', $group), - QueryParam::init('used_since', $usedSince)->serializeBy([DateTimeHelper::class, 'toRfc3339DateTime']), - QueryParam::init('used_until', $usedUntil)->serializeBy([DateTimeHelper::class, 'toRfc3339DateTime']) + BodyParam::init($request), + HeaderParam::init('idempotency-key', $idempotencyKey) ); - $_resHandler = $this->responseHandler()->type(ListUsagesResponse::class); + $_resHandler = $this->responseHandler()->type(GetIncrementResponse::class); return $this->execute($_reqBuilder, $_resHandler); } /** - * @param string $subscriptionId - * @param UpdateCurrentCycleEndDateRequest $request Request for updating the end date of the - * current signature cycle + * Creates a usage + * + * @param string $subscriptionId Subscription Id + * @param string $itemId Item id + * @param CreateUsageRequest $body Request for creating a usage * @param string|null $idempotencyKey * - * @return GetSubscriptionResponse Response from the API call + * @return GetUsageResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function updateLatestPeriodEndAt( + public function createUsage( string $subscriptionId, - UpdateCurrentCycleEndDateRequest $request, + string $itemId, + CreateUsageRequest $body, ?string $idempotencyKey = null - ): GetSubscriptionResponse { + ): GetUsageResponse { $_reqBuilder = $this->requestBuilder( - RequestMethod::PATCH, - '/subscriptions/{subscription_id}/periods/latest/end-at' + RequestMethod::POST, + '/subscriptions/{subscription_id}/items/{item_id}/usages' ) ->auth('global') ->parameters( TemplateParam::init('subscription_id', $subscriptionId), - BodyParam::init($request), + TemplateParam::init('item_id', $itemId), + BodyParam::init($body), HeaderParam::init('idempotency-key', $idempotencyKey) ); - $_resHandler = $this->responseHandler()->type(GetSubscriptionResponse::class); + $_resHandler = $this->responseHandler()->type(GetUsageResponse::class); return $this->execute($_reqBuilder, $_resHandler); } /** - * Atualização do valor mínimo da assinatura - * * @param string $subscriptionId Subscription Id - * @param UpdateSubscriptionMinimumPriceRequest $request Request da requisição com o valor - * mínimo que será configurado + * @param string $page Page number + * @param string $size Page size + * + * @return ListCyclesResponse Response from the API call + * + * @throws ApiException Thrown if API call fails + */ + public function getSubscriptionCycles(string $subscriptionId, string $page, string $size): ListCyclesResponse + { + $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/subscriptions/{subscription_id}/cycles') + ->auth('global') + ->parameters( + TemplateParam::init('subscription_id', $subscriptionId), + QueryParam::init('page', $page), + QueryParam::init('size', $size) + ); + + $_resHandler = $this->responseHandler()->type(ListCyclesResponse::class); + + return $this->execute($_reqBuilder, $_resHandler); + } + + /** + * Updates the billing date from a subscription + * + * @param string $subscriptionId The subscription id + * @param UpdateSubscriptionBillingDateRequest $request Request for updating the subscription + * billing date * @param string|null $idempotencyKey * * @return GetSubscriptionResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function updateSubscriptionMiniumPrice( + public function updateSubscriptionBillingDate( string $subscriptionId, - UpdateSubscriptionMinimumPriceRequest $request, + UpdateSubscriptionBillingDateRequest $request, ?string $idempotencyKey = null ): GetSubscriptionResponse { - $_reqBuilder = $this->requestBuilder( - RequestMethod::PATCH, - '/subscriptions/{subscription_id}/minimum_price' - ) + $_reqBuilder = $this->requestBuilder(RequestMethod::PATCH, '/subscriptions/{subscription_id}/billing-date') ->auth('global') ->parameters( TemplateParam::init('subscription_id', $subscriptionId), @@ -1074,26 +1069,31 @@ public function updateSubscriptionMiniumPrice( } /** + * Updates the start at date from a subscription + * * @param string $subscriptionId The subscription id - * @param string $cycleId + * @param UpdateSubscriptionStartAtRequest $request Request for updating the subscription start + * date + * @param string|null $idempotencyKey * - * @return GetPeriodResponse Response from the API call + * @return GetSubscriptionResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function getSubscriptionCycleById(string $subscriptionId, string $cycleId): GetPeriodResponse - { - $_reqBuilder = $this->requestBuilder( - RequestMethod::GET, - '/subscriptions/{subscription_id}/cycles/{cycleId}' - ) + public function updateSubscriptionStartAt( + string $subscriptionId, + UpdateSubscriptionStartAtRequest $request, + ?string $idempotencyKey = null + ): GetSubscriptionResponse { + $_reqBuilder = $this->requestBuilder(RequestMethod::PATCH, '/subscriptions/{subscription_id}/start-at') ->auth('global') ->parameters( TemplateParam::init('subscription_id', $subscriptionId), - TemplateParam::init('cycleId', $cycleId) + BodyParam::init($request), + HeaderParam::init('idempotency-key', $idempotencyKey) ); - $_resHandler = $this->responseHandler()->type(GetPeriodResponse::class); + $_resHandler = $this->responseHandler()->type(GetSubscriptionResponse::class); return $this->execute($_reqBuilder, $_resHandler); } diff --git a/src/Controllers/TransfersController.php b/src/Controllers/TransfersController.php index 39a6ca5..779edf3 100644 --- a/src/Controllers/TransfersController.php +++ b/src/Controllers/TransfersController.php @@ -21,35 +21,33 @@ class TransfersController extends BaseController { /** - * @param string $transferId + * Gets all transfers * - * @return GetTransfer Response from the API call + * @return ListTransfers Response from the API call * * @throws ApiException Thrown if API call fails */ - public function getTransferById(string $transferId): GetTransfer + public function getTransfers(): ListTransfers { - $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/transfers/{transfer_id}') - ->auth('global') - ->parameters(TemplateParam::init('transfer_id', $transferId)); + $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/transfers')->auth('global'); - $_resHandler = $this->responseHandler()->type(GetTransfer::class); + $_resHandler = $this->responseHandler()->type(ListTransfers::class); return $this->execute($_reqBuilder, $_resHandler); } /** - * @param CreateTransfer $request + * @param string $transferId * * @return GetTransfer Response from the API call * * @throws ApiException Thrown if API call fails */ - public function createTransfer(CreateTransfer $request): GetTransfer + public function getTransferById(string $transferId): GetTransfer { - $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/transfers/recipients') + $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/transfers/{transfer_id}') ->auth('global') - ->parameters(BodyParam::init($request)); + ->parameters(TemplateParam::init('transfer_id', $transferId)); $_resHandler = $this->responseHandler()->type(GetTransfer::class); @@ -57,17 +55,19 @@ public function createTransfer(CreateTransfer $request): GetTransfer } /** - * Gets all transfers + * @param CreateTransfer $request * - * @return ListTransfers Response from the API call + * @return GetTransfer Response from the API call * * @throws ApiException Thrown if API call fails */ - public function getTransfers(): ListTransfers + public function createTransfer(CreateTransfer $request): GetTransfer { - $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/transfers')->auth('global'); + $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/transfers/recipients') + ->auth('global') + ->parameters(BodyParam::init($request)); - $_resHandler = $this->responseHandler()->type(ListTransfers::class); + $_resHandler = $this->responseHandler()->type(GetTransfer::class); return $this->execute($_reqBuilder, $_resHandler); } diff --git a/src/Exceptions/ApiException.php b/src/Exceptions/ApiException.php index 97fb5f0..581b03e 100644 --- a/src/Exceptions/ApiException.php +++ b/src/Exceptions/ApiException.php @@ -36,8 +36,9 @@ class ApiException extends \Exception implements ExceptionInterface /** * @param string $reason the reason for raising an exception * @param HttpRequest $request + * @param HttpResponse|null $response */ - public function __construct(string $reason, HttpRequest $request, ?HttpResponse $response = null) + public function __construct(string $reason, HttpRequest $request, ?HttpResponse $response) { parent::__construct($reason, \is_null($response) ? 0 : $response->getStatusCode()); $this->request = $request; diff --git a/src/Models/Builders/CreateManagingPartnerRequestBuilder.php b/src/Models/Builders/CreateManagingPartnerRequestBuilder.php new file mode 100644 index 0000000..7f56a57 --- /dev/null +++ b/src/Models/Builders/CreateManagingPartnerRequestBuilder.php @@ -0,0 +1,70 @@ +instance = $instance; + } + + /** + * Initializes a new create managing partner request Builder object. + */ + public static function init( + string $name, + string $email, + string $document, + string $motherName, + string $birthdate, + string $monthlyIncome, + string $professionalOccupation, + bool $selfDeclaredLegalRepresentative, + CreateRegisterInformationAddressRequest $address, + array $phoneNumbers + ): self { + return new self(new CreateManagingPartnerRequest( + $name, + $email, + $document, + $motherName, + $birthdate, + $monthlyIncome, + $professionalOccupation, + $selfDeclaredLegalRepresentative, + $address, + $phoneNumbers + )); + } + + /** + * Initializes a new create managing partner request object. + */ + public function build(): CreateManagingPartnerRequest + { + return CoreHelper::clone($this->instance); + } +} diff --git a/src/Models/Builders/CreateRecipientRequestBuilder.php b/src/Models/Builders/CreateRecipientRequestBuilder.php index ae7494d..e28edd7 100644 --- a/src/Models/Builders/CreateRecipientRequestBuilder.php +++ b/src/Models/Builders/CreateRecipientRequestBuilder.php @@ -13,6 +13,7 @@ use Core\Utils\CoreHelper; use PagarmeApiSDKLib\Models\CreateBankAccountRequest; use PagarmeApiSDKLib\Models\CreateRecipientRequest; +use PagarmeApiSDKLib\Models\CreateRegisterInformationBaseRequest; use PagarmeApiSDKLib\Models\CreateTransferSettingsRequest; /** @@ -36,27 +37,102 @@ private function __construct(CreateRecipientRequest $instance) * Initializes a new create recipient request Builder object. */ public static function init( - string $name, - string $email, - string $description, - string $document, - string $type, CreateBankAccountRequest $defaultBankAccount, array $metadata, string $code, string $paymentMode ): self { - return new self(new CreateRecipientRequest( - $name, - $email, - $description, - $document, - $type, - $defaultBankAccount, - $metadata, - $code, - $paymentMode - )); + return new self(new CreateRecipientRequest($defaultBankAccount, $metadata, $code, $paymentMode)); + } + + /** + * Sets name field. + */ + public function name(?string $value): self + { + $this->instance->setName($value); + return $this; + } + + /** + * Unsets name field. + */ + public function unsetName(): self + { + $this->instance->unsetName(); + return $this; + } + + /** + * Sets email field. + */ + public function email(?string $value): self + { + $this->instance->setEmail($value); + return $this; + } + + /** + * Unsets email field. + */ + public function unsetEmail(): self + { + $this->instance->unsetEmail(); + return $this; + } + + /** + * Sets description field. + */ + public function description(?string $value): self + { + $this->instance->setDescription($value); + return $this; + } + + /** + * Unsets description field. + */ + public function unsetDescription(): self + { + $this->instance->unsetDescription(); + return $this; + } + + /** + * Sets document field. + */ + public function document(?string $value): self + { + $this->instance->setDocument($value); + return $this; + } + + /** + * Unsets document field. + */ + public function unsetDocument(): self + { + $this->instance->unsetDocument(); + return $this; + } + + /** + * Sets type field. + */ + public function type(?string $value): self + { + $this->instance->setType($value); + return $this; + } + + /** + * Unsets type field. + */ + public function unsetType(): self + { + $this->instance->unsetType(); + return $this; } /** @@ -68,6 +144,24 @@ public function transferSettings(?CreateTransferSettingsRequest $value): self return $this; } + /** + * Sets register information field. + */ + public function registerInformation(?CreateRegisterInformationBaseRequest $value): self + { + $this->instance->setRegisterInformation($value); + return $this; + } + + /** + * Unsets register information field. + */ + public function unsetRegisterInformation(): self + { + $this->instance->unsetRegisterInformation(); + return $this; + } + /** * Initializes a new create recipient request object. */ diff --git a/src/Models/Builders/CreateRegisterInformationAddressRequestBuilder.php b/src/Models/Builders/CreateRegisterInformationAddressRequestBuilder.php new file mode 100644 index 0000000..4d1c634 --- /dev/null +++ b/src/Models/Builders/CreateRegisterInformationAddressRequestBuilder.php @@ -0,0 +1,65 @@ +instance = $instance; + } + + /** + * Initializes a new create register information address request Builder object. + */ + public static function init( + string $street, + string $complementary, + string $streetNumber, + string $neighborhood, + string $city, + string $state, + string $zipCode, + string $referencePoint + ): self { + return new self(new CreateRegisterInformationAddressRequest( + $street, + $complementary, + $streetNumber, + $neighborhood, + $city, + $state, + $zipCode, + $referencePoint + )); + } + + /** + * Initializes a new create register information address request object. + */ + public function build(): CreateRegisterInformationAddressRequest + { + return CoreHelper::clone($this->instance); + } +} diff --git a/src/Models/Builders/CreateRegisterInformationBaseRequestBuilder.php b/src/Models/Builders/CreateRegisterInformationBaseRequestBuilder.php new file mode 100644 index 0000000..98a2afe --- /dev/null +++ b/src/Models/Builders/CreateRegisterInformationBaseRequestBuilder.php @@ -0,0 +1,66 @@ +instance = $instance; + } + + /** + * Initializes a new create register information base request Builder object. + */ + public static function init(string $email, string $document, string $type, array $phoneNumbers): self + { + return new self(new CreateRegisterInformationBaseRequest($email, $document, $type, $phoneNumbers)); + } + + /** + * Sets site url field. + */ + public function siteUrl(?string $value): self + { + $this->instance->setSiteUrl($value); + return $this; + } + + /** + * Unsets site url field. + */ + public function unsetSiteUrl(): self + { + $this->instance->unsetSiteUrl(); + return $this; + } + + /** + * Initializes a new create register information base request object. + */ + public function build(): CreateRegisterInformationBaseRequest + { + return CoreHelper::clone($this->instance); + } +} diff --git a/src/Models/Builders/CreateRegisterInformationCorporationRequestBuilder.php b/src/Models/Builders/CreateRegisterInformationCorporationRequestBuilder.php new file mode 100644 index 0000000..cce760f --- /dev/null +++ b/src/Models/Builders/CreateRegisterInformationCorporationRequestBuilder.php @@ -0,0 +1,140 @@ +instance = $instance; + } + + /** + * Initializes a new create register information corporation request Builder object. + */ + public static function init( + string $email, + string $document, + string $type, + array $phoneNumbers, + string $companyName, + string $tradingName, + string $annualRevenue, + array $managingPartners, + CreateRegisterInformationAddressRequest $mainAddress + ): self { + return new self(new CreateRegisterInformationCorporationRequest( + $email, + $document, + $type, + $phoneNumbers, + $companyName, + $tradingName, + $annualRevenue, + $managingPartners, + $mainAddress + )); + } + + /** + * Sets site url field. + */ + public function siteUrl(?string $value): self + { + $this->instance->setSiteUrl($value); + return $this; + } + + /** + * Unsets site url field. + */ + public function unsetSiteUrl(): self + { + $this->instance->unsetSiteUrl(); + return $this; + } + + /** + * Sets corporation type field. + */ + public function corporationType(?string $value): self + { + $this->instance->setCorporationType($value); + return $this; + } + + /** + * Unsets corporation type field. + */ + public function unsetCorporationType(): self + { + $this->instance->unsetCorporationType(); + return $this; + } + + /** + * Sets founding date field. + */ + public function foundingDate(?string $value): self + { + $this->instance->setFoundingDate($value); + return $this; + } + + /** + * Unsets founding date field. + */ + public function unsetFoundingDate(): self + { + $this->instance->unsetFoundingDate(); + return $this; + } + + /** + * Sets cnae field. + */ + public function cnae(?string $value): self + { + $this->instance->setCnae($value); + return $this; + } + + /** + * Unsets cnae field. + */ + public function unsetCnae(): self + { + $this->instance->unsetCnae(); + return $this; + } + + /** + * Initializes a new create register information corporation request object. + */ + public function build(): CreateRegisterInformationCorporationRequest + { + return CoreHelper::clone($this->instance); + } +} diff --git a/src/Models/Builders/CreateRegisterInformationIndividualRequestBuilder.php b/src/Models/Builders/CreateRegisterInformationIndividualRequestBuilder.php new file mode 100644 index 0000000..580e2e8 --- /dev/null +++ b/src/Models/Builders/CreateRegisterInformationIndividualRequestBuilder.php @@ -0,0 +1,104 @@ +instance = $instance; + } + + /** + * Initializes a new create register information individual request Builder object. + */ + public static function init( + string $email, + string $document, + string $type, + array $phoneNumbers, + string $name, + string $birthdate, + string $monthlyIncome, + string $professionalOccupation, + CreateRegisterInformationAddressRequest $address + ): self { + return new self(new CreateRegisterInformationIndividualRequest( + $email, + $document, + $type, + $phoneNumbers, + $name, + $birthdate, + $monthlyIncome, + $professionalOccupation, + $address + )); + } + + /** + * Sets site url field. + */ + public function siteUrl(?string $value): self + { + $this->instance->setSiteUrl($value); + return $this; + } + + /** + * Unsets site url field. + */ + public function unsetSiteUrl(): self + { + $this->instance->unsetSiteUrl(); + return $this; + } + + /** + * Sets mother name field. + */ + public function motherName(?string $value): self + { + $this->instance->setMotherName($value); + return $this; + } + + /** + * Unsets mother name field. + */ + public function unsetMotherName(): self + { + $this->instance->unsetMotherName(); + return $this; + } + + /** + * Initializes a new create register information individual request object. + */ + public function build(): CreateRegisterInformationIndividualRequest + { + return CoreHelper::clone($this->instance); + } +} diff --git a/src/Models/Builders/CreateRegisterInformationPhoneRequestBuilder.php b/src/Models/Builders/CreateRegisterInformationPhoneRequestBuilder.php new file mode 100644 index 0000000..b6cf4d2 --- /dev/null +++ b/src/Models/Builders/CreateRegisterInformationPhoneRequestBuilder.php @@ -0,0 +1,48 @@ +instance = $instance; + } + + /** + * Initializes a new create register information phone request Builder object. + */ + public static function init(string $ddd, string $number, string $type): self + { + return new self(new CreateRegisterInformationPhoneRequest($ddd, $number, $type)); + } + + /** + * Initializes a new create register information phone request object. + */ + public function build(): CreateRegisterInformationPhoneRequest + { + return CoreHelper::clone($this->instance); + } +} diff --git a/src/Models/Builders/GetBalanceOperationResponseBuilder.php b/src/Models/Builders/GetBalanceOperationResponseBuilder.php index 5ea95c3..9d3f426 100644 --- a/src/Models/Builders/GetBalanceOperationResponseBuilder.php +++ b/src/Models/Builders/GetBalanceOperationResponseBuilder.php @@ -132,7 +132,7 @@ public function unsetType(): self /** * Sets amount field. */ - public function amount(?string $value): self + public function amount(?int $value): self { $this->instance->setAmount($value); return $this; diff --git a/src/Models/Builders/GetManagingPartnerResponseBuilder.php b/src/Models/Builders/GetManagingPartnerResponseBuilder.php new file mode 100644 index 0000000..a313fb0 --- /dev/null +++ b/src/Models/Builders/GetManagingPartnerResponseBuilder.php @@ -0,0 +1,238 @@ +instance = $instance; + } + + /** + * Initializes a new get managing partner response Builder object. + */ + public static function init(): self + { + return new self(new GetManagingPartnerResponse()); + } + + /** + * Sets name field. + */ + public function name(?string $value): self + { + $this->instance->setName($value); + return $this; + } + + /** + * Unsets name field. + */ + public function unsetName(): self + { + $this->instance->unsetName(); + return $this; + } + + /** + * Sets email field. + */ + public function email(?string $value): self + { + $this->instance->setEmail($value); + return $this; + } + + /** + * Unsets email field. + */ + public function unsetEmail(): self + { + $this->instance->unsetEmail(); + return $this; + } + + /** + * Sets document field. + */ + public function document(?string $value): self + { + $this->instance->setDocument($value); + return $this; + } + + /** + * Unsets document field. + */ + public function unsetDocument(): self + { + $this->instance->unsetDocument(); + return $this; + } + + /** + * Sets type field. + */ + public function type(?string $value): self + { + $this->instance->setType($value); + return $this; + } + + /** + * Unsets type field. + */ + public function unsetType(): self + { + $this->instance->unsetType(); + return $this; + } + + /** + * Sets mother name field. + */ + public function motherName(?string $value): self + { + $this->instance->setMotherName($value); + return $this; + } + + /** + * Unsets mother name field. + */ + public function unsetMotherName(): self + { + $this->instance->unsetMotherName(); + return $this; + } + + /** + * Sets birthdate field. + */ + public function birthdate(?string $value): self + { + $this->instance->setBirthdate($value); + return $this; + } + + /** + * Unsets birthdate field. + */ + public function unsetBirthdate(): self + { + $this->instance->unsetBirthdate(); + return $this; + } + + /** + * Sets monthly income field. + */ + public function monthlyIncome(?string $value): self + { + $this->instance->setMonthlyIncome($value); + return $this; + } + + /** + * Unsets monthly income field. + */ + public function unsetMonthlyIncome(): self + { + $this->instance->unsetMonthlyIncome(); + return $this; + } + + /** + * Sets professional occupation field. + */ + public function professionalOccupation(?string $value): self + { + $this->instance->setProfessionalOccupation($value); + return $this; + } + + /** + * Unsets professional occupation field. + */ + public function unsetProfessionalOccupation(): self + { + $this->instance->unsetProfessionalOccupation(); + return $this; + } + + /** + * Sets self declared representative field. + */ + public function selfDeclaredRepresentative(?bool $value): self + { + $this->instance->setSelfDeclaredRepresentative($value); + return $this; + } + + /** + * Sets address field. + */ + public function address(?GetRegisterInformationAddressResponse $value): self + { + $this->instance->setAddress($value); + return $this; + } + + /** + * Unsets address field. + */ + public function unsetAddress(): self + { + $this->instance->unsetAddress(); + return $this; + } + + /** + * Sets phone numbers field. + */ + public function phoneNumbers(?array $value): self + { + $this->instance->setPhoneNumbers($value); + return $this; + } + + /** + * Unsets phone numbers field. + */ + public function unsetPhoneNumbers(): self + { + $this->instance->unsetPhoneNumbers(); + return $this; + } + + /** + * Initializes a new get managing partner response object. + */ + public function build(): GetManagingPartnerResponse + { + return CoreHelper::clone($this->instance); + } +} diff --git a/src/Models/Builders/GetPhoneNumberResponseBuilder.php b/src/Models/Builders/GetPhoneNumberResponseBuilder.php new file mode 100644 index 0000000..3a8b476 --- /dev/null +++ b/src/Models/Builders/GetPhoneNumberResponseBuilder.php @@ -0,0 +1,102 @@ +instance = $instance; + } + + /** + * Initializes a new get phone number response Builder object. + */ + public static function init(): self + { + return new self(new GetPhoneNumberResponse()); + } + + /** + * Sets ddd field. + */ + public function ddd(?string $value): self + { + $this->instance->setDdd($value); + return $this; + } + + /** + * Unsets ddd field. + */ + public function unsetDdd(): self + { + $this->instance->unsetDdd(); + return $this; + } + + /** + * Sets number field. + */ + public function number(?string $value): self + { + $this->instance->setNumber($value); + return $this; + } + + /** + * Unsets number field. + */ + public function unsetNumber(): self + { + $this->instance->unsetNumber(); + return $this; + } + + /** + * Sets type field. + */ + public function type(?string $value): self + { + $this->instance->setType($value); + return $this; + } + + /** + * Unsets type field. + */ + public function unsetType(): self + { + $this->instance->unsetType(); + return $this; + } + + /** + * Initializes a new get phone number response object. + */ + public function build(): GetPhoneNumberResponse + { + return CoreHelper::clone($this->instance); + } +} diff --git a/src/Models/Builders/GetRecipientResponseBuilder.php b/src/Models/Builders/GetRecipientResponseBuilder.php index f8a5b3a..d446991 100644 --- a/src/Models/Builders/GetRecipientResponseBuilder.php +++ b/src/Models/Builders/GetRecipientResponseBuilder.php @@ -14,6 +14,7 @@ use PagarmeApiSDKLib\Models\GetAutomaticAnticipationResponse; use PagarmeApiSDKLib\Models\GetBankAccountResponse; use PagarmeApiSDKLib\Models\GetRecipientResponse; +use PagarmeApiSDKLib\Models\GetRegisterInformationResponse; use PagarmeApiSDKLib\Models\GetTransferSettingsResponse; /** @@ -347,6 +348,24 @@ public function unsetPaymentMode(): self return $this; } + /** + * Sets register information field. + */ + public function registerInformation(?GetRegisterInformationResponse $value): self + { + $this->instance->setRegisterInformation($value); + return $this; + } + + /** + * Unsets register information field. + */ + public function unsetRegisterInformation(): self + { + $this->instance->unsetRegisterInformation(); + return $this; + } + /** * Initializes a new get recipient response object. */ diff --git a/src/Models/Builders/GetRegisterInformationAddressResponseBuilder.php b/src/Models/Builders/GetRegisterInformationAddressResponseBuilder.php new file mode 100644 index 0000000..2197c67 --- /dev/null +++ b/src/Models/Builders/GetRegisterInformationAddressResponseBuilder.php @@ -0,0 +1,192 @@ +instance = $instance; + } + + /** + * Initializes a new get register information address response Builder object. + */ + public static function init(): self + { + return new self(new GetRegisterInformationAddressResponse()); + } + + /** + * Sets street field. + */ + public function street(?string $value): self + { + $this->instance->setStreet($value); + return $this; + } + + /** + * Unsets street field. + */ + public function unsetStreet(): self + { + $this->instance->unsetStreet(); + return $this; + } + + /** + * Sets complementary field. + */ + public function complementary(?string $value): self + { + $this->instance->setComplementary($value); + return $this; + } + + /** + * Unsets complementary field. + */ + public function unsetComplementary(): self + { + $this->instance->unsetComplementary(); + return $this; + } + + /** + * Sets street number field. + */ + public function streetNumber(?string $value): self + { + $this->instance->setStreetNumber($value); + return $this; + } + + /** + * Unsets street number field. + */ + public function unsetStreetNumber(): self + { + $this->instance->unsetStreetNumber(); + return $this; + } + + /** + * Sets neighborhood field. + */ + public function neighborhood(?string $value): self + { + $this->instance->setNeighborhood($value); + return $this; + } + + /** + * Unsets neighborhood field. + */ + public function unsetNeighborhood(): self + { + $this->instance->unsetNeighborhood(); + return $this; + } + + /** + * Sets city field. + */ + public function city(?string $value): self + { + $this->instance->setCity($value); + return $this; + } + + /** + * Unsets city field. + */ + public function unsetCity(): self + { + $this->instance->unsetCity(); + return $this; + } + + /** + * Sets state field. + */ + public function state(?string $value): self + { + $this->instance->setState($value); + return $this; + } + + /** + * Unsets state field. + */ + public function unsetState(): self + { + $this->instance->unsetState(); + return $this; + } + + /** + * Sets zip code field. + */ + public function zipCode(?string $value): self + { + $this->instance->setZipCode($value); + return $this; + } + + /** + * Unsets zip code field. + */ + public function unsetZipCode(): self + { + $this->instance->unsetZipCode(); + return $this; + } + + /** + * Sets reference point field. + */ + public function referencePoint(?string $value): self + { + $this->instance->setReferencePoint($value); + return $this; + } + + /** + * Unsets reference point field. + */ + public function unsetReferencePoint(): self + { + $this->instance->unsetReferencePoint(); + return $this; + } + + /** + * Initializes a new get register information address response object. + */ + public function build(): GetRegisterInformationAddressResponse + { + return CoreHelper::clone($this->instance); + } +} diff --git a/src/Models/Builders/GetRegisterInformationResponseBuilder.php b/src/Models/Builders/GetRegisterInformationResponseBuilder.php new file mode 100644 index 0000000..13846f8 --- /dev/null +++ b/src/Models/Builders/GetRegisterInformationResponseBuilder.php @@ -0,0 +1,391 @@ +instance = $instance; + } + + /** + * Initializes a new get register information response Builder object. + */ + public static function init(): self + { + return new self(new GetRegisterInformationResponse()); + } + + /** + * Sets email field. + */ + public function email(?string $value): self + { + $this->instance->setEmail($value); + return $this; + } + + /** + * Unsets email field. + */ + public function unsetEmail(): self + { + $this->instance->unsetEmail(); + return $this; + } + + /** + * Sets document field. + */ + public function document(?string $value): self + { + $this->instance->setDocument($value); + return $this; + } + + /** + * Unsets document field. + */ + public function unsetDocument(): self + { + $this->instance->unsetDocument(); + return $this; + } + + /** + * Sets type field. + */ + public function type(?string $value): self + { + $this->instance->setType($value); + return $this; + } + + /** + * Unsets type field. + */ + public function unsetType(): self + { + $this->instance->unsetType(); + return $this; + } + + /** + * Sets site url field. + */ + public function siteUrl(?string $value): self + { + $this->instance->setSiteUrl($value); + return $this; + } + + /** + * Unsets site url field. + */ + public function unsetSiteUrl(): self + { + $this->instance->unsetSiteUrl(); + return $this; + } + + /** + * Sets phone numbers field. + */ + public function phoneNumbers(?array $value): self + { + $this->instance->setPhoneNumbers($value); + return $this; + } + + /** + * Unsets phone numbers field. + */ + public function unsetPhoneNumbers(): self + { + $this->instance->unsetPhoneNumbers(); + return $this; + } + + /** + * Sets name field. + */ + public function name(?string $value): self + { + $this->instance->setName($value); + return $this; + } + + /** + * Unsets name field. + */ + public function unsetName(): self + { + $this->instance->unsetName(); + return $this; + } + + /** + * Sets mother name field. + */ + public function motherName(?string $value): self + { + $this->instance->setMotherName($value); + return $this; + } + + /** + * Unsets mother name field. + */ + public function unsetMotherName(): self + { + $this->instance->unsetMotherName(); + return $this; + } + + /** + * Sets birthdate field. + */ + public function birthdate(?string $value): self + { + $this->instance->setBirthdate($value); + return $this; + } + + /** + * Unsets birthdate field. + */ + public function unsetBirthdate(): self + { + $this->instance->unsetBirthdate(); + return $this; + } + + /** + * Sets monthly income field. + */ + public function monthlyIncome(?string $value): self + { + $this->instance->setMonthlyIncome($value); + return $this; + } + + /** + * Unsets monthly income field. + */ + public function unsetMonthlyIncome(): self + { + $this->instance->unsetMonthlyIncome(); + return $this; + } + + /** + * Sets professional occupation field. + */ + public function professionalOccupation(?string $value): self + { + $this->instance->setProfessionalOccupation($value); + return $this; + } + + /** + * Unsets professional occupation field. + */ + public function unsetProfessionalOccupation(): self + { + $this->instance->unsetProfessionalOccupation(); + return $this; + } + + /** + * Sets address field. + */ + public function address(?GetRegisterInformationAddressResponse $value): self + { + $this->instance->setAddress($value); + return $this; + } + + /** + * Unsets address field. + */ + public function unsetAddress(): self + { + $this->instance->unsetAddress(); + return $this; + } + + /** + * Sets company name field. + */ + public function companyName(?string $value): self + { + $this->instance->setCompanyName($value); + return $this; + } + + /** + * Unsets company name field. + */ + public function unsetCompanyName(): self + { + $this->instance->unsetCompanyName(); + return $this; + } + + /** + * Sets trading name field. + */ + public function tradingName(?string $value): self + { + $this->instance->setTradingName($value); + return $this; + } + + /** + * Unsets trading name field. + */ + public function unsetTradingName(): self + { + $this->instance->unsetTradingName(); + return $this; + } + + /** + * Sets annual revenue field. + */ + public function annualRevenue(?string $value): self + { + $this->instance->setAnnualRevenue($value); + return $this; + } + + /** + * Unsets annual revenue field. + */ + public function unsetAnnualRevenue(): self + { + $this->instance->unsetAnnualRevenue(); + return $this; + } + + /** + * Sets corporation type field. + */ + public function corporationType(?string $value): self + { + $this->instance->setCorporationType($value); + return $this; + } + + /** + * Unsets corporation type field. + */ + public function unsetCorporationType(): self + { + $this->instance->unsetCorporationType(); + return $this; + } + + /** + * Sets founding date field. + */ + public function foundingDate(?string $value): self + { + $this->instance->setFoundingDate($value); + return $this; + } + + /** + * Unsets founding date field. + */ + public function unsetFoundingDate(): self + { + $this->instance->unsetFoundingDate(); + return $this; + } + + /** + * Sets cnae field. + */ + public function cnae(?string $value): self + { + $this->instance->setCnae($value); + return $this; + } + + /** + * Unsets cnae field. + */ + public function unsetCnae(): self + { + $this->instance->unsetCnae(); + return $this; + } + + /** + * Sets main address field. + */ + public function mainAddress(?GetRegisterInformationAddressResponse $value): self + { + $this->instance->setMainAddress($value); + return $this; + } + + /** + * Unsets main address field. + */ + public function unsetMainAddress(): self + { + $this->instance->unsetMainAddress(); + return $this; + } + + /** + * Sets managing partners field. + */ + public function managingPartners(?array $value): self + { + $this->instance->setManagingPartners($value); + return $this; + } + + /** + * Unsets managing partners field. + */ + public function unsetManagingPartners(): self + { + $this->instance->unsetManagingPartners(); + return $this; + } + + /** + * Initializes a new get register information response object. + */ + public function build(): GetRegisterInformationResponse + { + return CoreHelper::clone($this->instance); + } +} diff --git a/src/Models/CreateManagingPartnerRequest.php b/src/Models/CreateManagingPartnerRequest.php new file mode 100644 index 0000000..da2bc60 --- /dev/null +++ b/src/Models/CreateManagingPartnerRequest.php @@ -0,0 +1,325 @@ +name = $name; + $this->email = $email; + $this->document = $document; + $this->motherName = $motherName; + $this->birthdate = $birthdate; + $this->monthlyIncome = $monthlyIncome; + $this->professionalOccupation = $professionalOccupation; + $this->selfDeclaredLegalRepresentative = $selfDeclaredLegalRepresentative; + $this->address = $address; + $this->phoneNumbers = $phoneNumbers; + } + + /** + * Returns Name. + */ + public function getName(): string + { + return $this->name; + } + + /** + * Sets Name. + * + * @required + * @maps name + */ + public function setName(string $name): void + { + $this->name = $name; + } + + /** + * Returns Email. + */ + public function getEmail(): string + { + return $this->email; + } + + /** + * Sets Email. + * + * @required + * @maps email + */ + public function setEmail(string $email): void + { + $this->email = $email; + } + + /** + * Returns Document. + */ + public function getDocument(): string + { + return $this->document; + } + + /** + * Sets Document. + * + * @required + * @maps document + */ + public function setDocument(string $document): void + { + $this->document = $document; + } + + /** + * Returns Mother Name. + */ + public function getMotherName(): string + { + return $this->motherName; + } + + /** + * Sets Mother Name. + * + * @required + * @maps mother_name + */ + public function setMotherName(string $motherName): void + { + $this->motherName = $motherName; + } + + /** + * Returns Birthdate. + */ + public function getBirthdate(): string + { + return $this->birthdate; + } + + /** + * Sets Birthdate. + * + * @required + * @maps birthdate + */ + public function setBirthdate(string $birthdate): void + { + $this->birthdate = $birthdate; + } + + /** + * Returns Monthly Income. + */ + public function getMonthlyIncome(): string + { + return $this->monthlyIncome; + } + + /** + * Sets Monthly Income. + * + * @required + * @maps monthly_income + */ + public function setMonthlyIncome(string $monthlyIncome): void + { + $this->monthlyIncome = $monthlyIncome; + } + + /** + * Returns Professional Occupation. + */ + public function getProfessionalOccupation(): string + { + return $this->professionalOccupation; + } + + /** + * Sets Professional Occupation. + * + * @required + * @maps professional_occupation + */ + public function setProfessionalOccupation(string $professionalOccupation): void + { + $this->professionalOccupation = $professionalOccupation; + } + + /** + * Returns Self Declared Legal Representative. + */ + public function getSelfDeclaredLegalRepresentative(): bool + { + return $this->selfDeclaredLegalRepresentative; + } + + /** + * Sets Self Declared Legal Representative. + * + * @required + * @maps self_declared_legal_representative + */ + public function setSelfDeclaredLegalRepresentative(bool $selfDeclaredLegalRepresentative): void + { + $this->selfDeclaredLegalRepresentative = $selfDeclaredLegalRepresentative; + } + + /** + * Returns Address. + */ + public function getAddress(): CreateRegisterInformationAddressRequest + { + return $this->address; + } + + /** + * Sets Address. + * + * @required + * @maps address + */ + public function setAddress(CreateRegisterInformationAddressRequest $address): void + { + $this->address = $address; + } + + /** + * Returns Phone Numbers. + * + * @return CreateRegisterInformationPhoneRequest[] + */ + public function getPhoneNumbers(): array + { + return $this->phoneNumbers; + } + + /** + * Sets Phone Numbers. + * + * @required + * @maps phone_numbers + * + * @param CreateRegisterInformationPhoneRequest[] $phoneNumbers + */ + public function setPhoneNumbers(array $phoneNumbers): void + { + $this->phoneNumbers = $phoneNumbers; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + $json['name'] = $this->name; + $json['email'] = $this->email; + $json['document'] = $this->document; + $json['mother_name'] = $this->motherName; + $json['birthdate'] = $this->birthdate; + $json['monthly_income'] = $this->monthlyIncome; + $json['professional_occupation'] = $this->professionalOccupation; + $json['self_declared_legal_representative'] = $this->selfDeclaredLegalRepresentative; + $json['address'] = $this->address; + $json['phone_numbers'] = $this->phoneNumbers; + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/CreateRecipientRequest.php b/src/Models/CreateRecipientRequest.php index a7ac9da..63db7db 100644 --- a/src/Models/CreateRecipientRequest.php +++ b/src/Models/CreateRecipientRequest.php @@ -18,29 +18,29 @@ class CreateRecipientRequest implements \JsonSerializable { /** - * @var string + * @var array */ - private $name; + private $name = []; /** - * @var string + * @var array */ - private $email; + private $email = []; /** - * @var string + * @var array */ - private $description; + private $description = []; /** - * @var string + * @var array */ - private $document; + private $document = []; /** - * @var string + * @var array */ - private $type; + private $type = []; /** * @var CreateBankAccountRequest @@ -68,32 +68,22 @@ class CreateRecipientRequest implements \JsonSerializable private $paymentMode; /** - * @param string $name - * @param string $email - * @param string $description - * @param string $document - * @param string $type + * @var array + */ + private $registerInformation = []; + + /** * @param CreateBankAccountRequest $defaultBankAccount * @param array $metadata * @param string $code * @param string $paymentMode */ public function __construct( - string $name, - string $email, - string $description, - string $document, - string $type, CreateBankAccountRequest $defaultBankAccount, array $metadata, string $code, string $paymentMode ) { - $this->name = $name; - $this->email = $email; - $this->description = $description; - $this->document = $document; - $this->type = $type; $this->defaultBankAccount = $defaultBankAccount; $this->metadata = $metadata; $this->code = $code; @@ -102,107 +92,162 @@ public function __construct( /** * Returns Name. - * Recipient name + * Recipient name. Required if the register_information field isn't populated. */ - public function getName(): string + public function getName(): ?string { - return $this->name; + if (count($this->name) == 0) { + return null; + } + return $this->name['value']; } /** * Sets Name. - * Recipient name + * Recipient name. Required if the register_information field isn't populated. * - * @required * @maps name */ - public function setName(string $name): void + public function setName(?string $name): void + { + $this->name['value'] = $name; + } + + /** + * Unsets Name. + * Recipient name. Required if the register_information field isn't populated. + */ + public function unsetName(): void { - $this->name = $name; + $this->name = []; } /** * Returns Email. - * Recipient email + * Recipient email. Required if the register_information field isn't populated. */ - public function getEmail(): string + public function getEmail(): ?string { - return $this->email; + if (count($this->email) == 0) { + return null; + } + return $this->email['value']; } /** * Sets Email. - * Recipient email + * Recipient email. Required if the register_information field isn't populated. * - * @required * @maps email */ - public function setEmail(string $email): void + public function setEmail(?string $email): void { - $this->email = $email; + $this->email['value'] = $email; + } + + /** + * Unsets Email. + * Recipient email. Required if the register_information field isn't populated. + */ + public function unsetEmail(): void + { + $this->email = []; } /** * Returns Description. * Recipient description */ - public function getDescription(): string + public function getDescription(): ?string { - return $this->description; + if (count($this->description) == 0) { + return null; + } + return $this->description['value']; } /** * Sets Description. * Recipient description * - * @required * @maps description */ - public function setDescription(string $description): void + public function setDescription(?string $description): void { - $this->description = $description; + $this->description['value'] = $description; + } + + /** + * Unsets Description. + * Recipient description + */ + public function unsetDescription(): void + { + $this->description = []; } /** * Returns Document. - * Recipient document number + * Recipient document number. Required if the register_information field isn't populated. */ - public function getDocument(): string + public function getDocument(): ?string { - return $this->document; + if (count($this->document) == 0) { + return null; + } + return $this->document['value']; } /** * Sets Document. - * Recipient document number + * Recipient document number. Required if the register_information field isn't populated. * - * @required * @maps document */ - public function setDocument(string $document): void + public function setDocument(?string $document): void { - $this->document = $document; + $this->document['value'] = $document; + } + + /** + * Unsets Document. + * Recipient document number. Required if the register_information field isn't populated. + */ + public function unsetDocument(): void + { + $this->document = []; } /** * Returns Type. - * Recipient type + * Recipient type. Required if the register_information field isn't populated. */ - public function getType(): string + public function getType(): ?string { - return $this->type; + if (count($this->type) == 0) { + return null; + } + return $this->type['value']; } /** * Sets Type. - * Recipient type + * Recipient type. Required if the register_information field isn't populated. * - * @required * @maps type */ - public function setType(string $type): void + public function setType(?string $type): void { - $this->type = $type; + $this->type['value'] = $type; + } + + /** + * Unsets Type. + * Recipient type. Required if the register_information field isn't populated. + */ + public function unsetType(): void + { + $this->type = []; } /** @@ -313,6 +358,38 @@ public function setPaymentMode(string $paymentMode): void $this->paymentMode = $paymentMode; } + /** + * Returns Register Information. + * Register Information + */ + public function getRegisterInformation(): ?CreateRegisterInformationBaseRequest + { + if (count($this->registerInformation) == 0) { + return null; + } + return $this->registerInformation['value']; + } + + /** + * Sets Register Information. + * Register Information + * + * @maps register_information + */ + public function setRegisterInformation(?CreateRegisterInformationBaseRequest $registerInformation): void + { + $this->registerInformation['value'] = $registerInformation; + } + + /** + * Unsets Register Information. + * Register Information + */ + public function unsetRegisterInformation(): void + { + $this->registerInformation = []; + } + /** * Encode this object to JSON * @@ -325,18 +402,31 @@ public function setPaymentMode(string $paymentMode): void public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; - $json['name'] = $this->name; - $json['email'] = $this->email; - $json['description'] = $this->description; - $json['document'] = $this->document; - $json['type'] = $this->type; - $json['default_bank_account'] = $this->defaultBankAccount; - $json['metadata'] = $this->metadata; + if (!empty($this->name)) { + $json['name'] = $this->name['value']; + } + if (!empty($this->email)) { + $json['email'] = $this->email['value']; + } + if (!empty($this->description)) { + $json['description'] = $this->description['value']; + } + if (!empty($this->document)) { + $json['document'] = $this->document['value']; + } + if (!empty($this->type)) { + $json['type'] = $this->type['value']; + } + $json['default_bank_account'] = $this->defaultBankAccount; + $json['metadata'] = $this->metadata; if (isset($this->transferSettings)) { - $json['transfer_settings'] = $this->transferSettings; + $json['transfer_settings'] = $this->transferSettings; + } + $json['code'] = $this->code; + $json['payment_mode'] = $this->paymentMode; + if (!empty($this->registerInformation)) { + $json['register_information'] = $this->registerInformation['value']; } - $json['code'] = $this->code; - $json['payment_mode'] = $this->paymentMode; return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; } diff --git a/src/Models/CreateRegisterInformationAddressRequest.php b/src/Models/CreateRegisterInformationAddressRequest.php new file mode 100644 index 0000000..8dccf51 --- /dev/null +++ b/src/Models/CreateRegisterInformationAddressRequest.php @@ -0,0 +1,265 @@ +street = $street; + $this->complementary = $complementary; + $this->streetNumber = $streetNumber; + $this->neighborhood = $neighborhood; + $this->city = $city; + $this->state = $state; + $this->zipCode = $zipCode; + $this->referencePoint = $referencePoint; + } + + /** + * Returns Street. + */ + public function getStreet(): string + { + return $this->street; + } + + /** + * Sets Street. + * + * @required + * @maps street + */ + public function setStreet(string $street): void + { + $this->street = $street; + } + + /** + * Returns Complementary. + */ + public function getComplementary(): string + { + return $this->complementary; + } + + /** + * Sets Complementary. + * + * @required + * @maps complementary + */ + public function setComplementary(string $complementary): void + { + $this->complementary = $complementary; + } + + /** + * Returns Street Number. + */ + public function getStreetNumber(): string + { + return $this->streetNumber; + } + + /** + * Sets Street Number. + * + * @required + * @maps street_number + */ + public function setStreetNumber(string $streetNumber): void + { + $this->streetNumber = $streetNumber; + } + + /** + * Returns Neighborhood. + */ + public function getNeighborhood(): string + { + return $this->neighborhood; + } + + /** + * Sets Neighborhood. + * + * @required + * @maps neighborhood + */ + public function setNeighborhood(string $neighborhood): void + { + $this->neighborhood = $neighborhood; + } + + /** + * Returns City. + */ + public function getCity(): string + { + return $this->city; + } + + /** + * Sets City. + * + * @required + * @maps city + */ + public function setCity(string $city): void + { + $this->city = $city; + } + + /** + * Returns State. + */ + public function getState(): string + { + return $this->state; + } + + /** + * Sets State. + * + * @required + * @maps state + */ + public function setState(string $state): void + { + $this->state = $state; + } + + /** + * Returns Zip Code. + */ + public function getZipCode(): string + { + return $this->zipCode; + } + + /** + * Sets Zip Code. + * + * @required + * @maps zip_code + */ + public function setZipCode(string $zipCode): void + { + $this->zipCode = $zipCode; + } + + /** + * Returns Reference Point. + */ + public function getReferencePoint(): string + { + return $this->referencePoint; + } + + /** + * Sets Reference Point. + * + * @required + * @maps reference_point + */ + public function setReferencePoint(string $referencePoint): void + { + $this->referencePoint = $referencePoint; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + $json['street'] = $this->street; + $json['complementary'] = $this->complementary; + $json['street_number'] = $this->streetNumber; + $json['neighborhood'] = $this->neighborhood; + $json['city'] = $this->city; + $json['state'] = $this->state; + $json['zip_code'] = $this->zipCode; + $json['reference_point'] = $this->referencePoint; + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/CreateRegisterInformationBaseRequest.php b/src/Models/CreateRegisterInformationBaseRequest.php new file mode 100644 index 0000000..ed75a3a --- /dev/null +++ b/src/Models/CreateRegisterInformationBaseRequest.php @@ -0,0 +1,192 @@ +email = $email; + $this->document = $document; + $this->type = $type; + $this->phoneNumbers = $phoneNumbers; + } + + /** + * Returns Email. + */ + public function getEmail(): string + { + return $this->email; + } + + /** + * Sets Email. + * + * @required + * @maps email + */ + public function setEmail(string $email): void + { + $this->email = $email; + } + + /** + * Returns Document. + */ + public function getDocument(): string + { + return $this->document; + } + + /** + * Sets Document. + * + * @required + * @maps document + */ + public function setDocument(string $document): void + { + $this->document = $document; + } + + /** + * Returns Type. + * "individual" ou "corporation" + */ + public function getType(): string + { + return $this->type; + } + + /** + * Sets Type. + * "individual" ou "corporation" + * + * @required + * @maps type + */ + public function setType(string $type): void + { + $this->type = $type; + } + + /** + * Returns Site Url. + */ + public function getSiteUrl(): ?string + { + if (count($this->siteUrl) == 0) { + return null; + } + return $this->siteUrl['value']; + } + + /** + * Sets Site Url. + * + * @maps site_url + */ + public function setSiteUrl(?string $siteUrl): void + { + $this->siteUrl['value'] = $siteUrl; + } + + /** + * Unsets Site Url. + */ + public function unsetSiteUrl(): void + { + $this->siteUrl = []; + } + + /** + * Returns Phone Numbers. + * + * @return CreateRegisterInformationPhoneRequest[] + */ + public function getPhoneNumbers(): array + { + return $this->phoneNumbers; + } + + /** + * Sets Phone Numbers. + * + * @required + * @maps phone_numbers + * + * @param CreateRegisterInformationPhoneRequest[] $phoneNumbers + */ + public function setPhoneNumbers(array $phoneNumbers): void + { + $this->phoneNumbers = $phoneNumbers; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + $json['email'] = $this->email; + $json['document'] = $this->document; + $json['type'] = $this->type; + if (!empty($this->siteUrl)) { + $json['site_url'] = $this->siteUrl['value']; + } + $json['phone_numbers'] = $this->phoneNumbers; + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/CreateRegisterInformationCorporationRequest.php b/src/Models/CreateRegisterInformationCorporationRequest.php new file mode 100644 index 0000000..045150e --- /dev/null +++ b/src/Models/CreateRegisterInformationCorporationRequest.php @@ -0,0 +1,303 @@ +companyName = $companyName; + $this->tradingName = $tradingName; + $this->annualRevenue = $annualRevenue; + $this->managingPartners = $managingPartners; + $this->mainAddress = $mainAddress; + } + + /** + * Returns Company Name. + */ + public function getCompanyName(): string + { + return $this->companyName; + } + + /** + * Sets Company Name. + * + * @required + * @maps company_name + */ + public function setCompanyName(string $companyName): void + { + $this->companyName = $companyName; + } + + /** + * Returns Trading Name. + */ + public function getTradingName(): string + { + return $this->tradingName; + } + + /** + * Sets Trading Name. + * + * @required + * @maps trading_name + */ + public function setTradingName(string $tradingName): void + { + $this->tradingName = $tradingName; + } + + /** + * Returns Annual Revenue. + */ + public function getAnnualRevenue(): string + { + return $this->annualRevenue; + } + + /** + * Sets Annual Revenue. + * + * @required + * @maps annual_revenue + */ + public function setAnnualRevenue(string $annualRevenue): void + { + $this->annualRevenue = $annualRevenue; + } + + /** + * Returns Corporation Type. + */ + public function getCorporationType(): ?string + { + if (count($this->corporationType) == 0) { + return null; + } + return $this->corporationType['value']; + } + + /** + * Sets Corporation Type. + * + * @maps corporation_type + */ + public function setCorporationType(?string $corporationType): void + { + $this->corporationType['value'] = $corporationType; + } + + /** + * Unsets Corporation Type. + */ + public function unsetCorporationType(): void + { + $this->corporationType = []; + } + + /** + * Returns Founding Date. + */ + public function getFoundingDate(): ?string + { + if (count($this->foundingDate) == 0) { + return null; + } + return $this->foundingDate['value']; + } + + /** + * Sets Founding Date. + * + * @maps founding_date + */ + public function setFoundingDate(?string $foundingDate): void + { + $this->foundingDate['value'] = $foundingDate; + } + + /** + * Unsets Founding Date. + */ + public function unsetFoundingDate(): void + { + $this->foundingDate = []; + } + + /** + * Returns Cnae. + */ + public function getCnae(): ?string + { + if (count($this->cnae) == 0) { + return null; + } + return $this->cnae['value']; + } + + /** + * Sets Cnae. + * + * @maps cnae + */ + public function setCnae(?string $cnae): void + { + $this->cnae['value'] = $cnae; + } + + /** + * Unsets Cnae. + */ + public function unsetCnae(): void + { + $this->cnae = []; + } + + /** + * Returns Managing Partners. + * + * @return CreateManagingPartnerRequest[] + */ + public function getManagingPartners(): array + { + return $this->managingPartners; + } + + /** + * Sets Managing Partners. + * + * @required + * @maps managing_partners + * + * @param CreateManagingPartnerRequest[] $managingPartners + */ + public function setManagingPartners(array $managingPartners): void + { + $this->managingPartners = $managingPartners; + } + + /** + * Returns Main Address. + */ + public function getMainAddress(): CreateRegisterInformationAddressRequest + { + return $this->mainAddress; + } + + /** + * Sets Main Address. + * + * @required + * @maps main_address + */ + public function setMainAddress(CreateRegisterInformationAddressRequest $mainAddress): void + { + $this->mainAddress = $mainAddress; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + $json['company_name'] = $this->companyName; + $json['trading_name'] = $this->tradingName; + $json['annual_revenue'] = $this->annualRevenue; + if (!empty($this->corporationType)) { + $json['corporation_type'] = $this->corporationType['value']; + } + if (!empty($this->foundingDate)) { + $json['founding_date'] = $this->foundingDate['value']; + } + if (!empty($this->cnae)) { + $json['cnae'] = $this->cnae['value']; + } + $json['managing_partners'] = $this->managingPartners; + $json['main_address'] = $this->mainAddress; + $json = array_merge($json, parent::jsonSerialize(true)); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/CreateRegisterInformationIndividualRequest.php b/src/Models/CreateRegisterInformationIndividualRequest.php new file mode 100644 index 0000000..4388a93 --- /dev/null +++ b/src/Models/CreateRegisterInformationIndividualRequest.php @@ -0,0 +1,225 @@ +name = $name; + $this->birthdate = $birthdate; + $this->monthlyIncome = $monthlyIncome; + $this->professionalOccupation = $professionalOccupation; + $this->address = $address; + } + + /** + * Returns Name. + */ + public function getName(): string + { + return $this->name; + } + + /** + * Sets Name. + * + * @required + * @maps name + */ + public function setName(string $name): void + { + $this->name = $name; + } + + /** + * Returns Mother Name. + */ + public function getMotherName(): ?string + { + if (count($this->motherName) == 0) { + return null; + } + return $this->motherName['value']; + } + + /** + * Sets Mother Name. + * + * @maps mother_name + */ + public function setMotherName(?string $motherName): void + { + $this->motherName['value'] = $motherName; + } + + /** + * Unsets Mother Name. + */ + public function unsetMotherName(): void + { + $this->motherName = []; + } + + /** + * Returns Birthdate. + */ + public function getBirthdate(): string + { + return $this->birthdate; + } + + /** + * Sets Birthdate. + * + * @required + * @maps birthdate + */ + public function setBirthdate(string $birthdate): void + { + $this->birthdate = $birthdate; + } + + /** + * Returns Monthly Income. + */ + public function getMonthlyIncome(): string + { + return $this->monthlyIncome; + } + + /** + * Sets Monthly Income. + * + * @required + * @maps monthly_income + */ + public function setMonthlyIncome(string $monthlyIncome): void + { + $this->monthlyIncome = $monthlyIncome; + } + + /** + * Returns Professional Occupation. + */ + public function getProfessionalOccupation(): string + { + return $this->professionalOccupation; + } + + /** + * Sets Professional Occupation. + * + * @required + * @maps professional_occupation + */ + public function setProfessionalOccupation(string $professionalOccupation): void + { + $this->professionalOccupation = $professionalOccupation; + } + + /** + * Returns Address. + */ + public function getAddress(): CreateRegisterInformationAddressRequest + { + return $this->address; + } + + /** + * Sets Address. + * + * @required + * @maps address + */ + public function setAddress(CreateRegisterInformationAddressRequest $address): void + { + $this->address = $address; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + $json['name'] = $this->name; + if (!empty($this->motherName)) { + $json['mother_name'] = $this->motherName['value']; + } + $json['birthdate'] = $this->birthdate; + $json['monthly_income'] = $this->monthlyIncome; + $json['professional_occupation'] = $this->professionalOccupation; + $json['address'] = $this->address; + $json = array_merge($json, parent::jsonSerialize(true)); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/CreateRegisterInformationPhoneRequest.php b/src/Models/CreateRegisterInformationPhoneRequest.php new file mode 100644 index 0000000..f48fdcb --- /dev/null +++ b/src/Models/CreateRegisterInformationPhoneRequest.php @@ -0,0 +1,122 @@ +ddd = $ddd; + $this->number = $number; + $this->type = $type; + } + + /** + * Returns Ddd. + */ + public function getDdd(): string + { + return $this->ddd; + } + + /** + * Sets Ddd. + * + * @required + * @maps ddd + */ + public function setDdd(string $ddd): void + { + $this->ddd = $ddd; + } + + /** + * Returns Number. + */ + public function getNumber(): string + { + return $this->number; + } + + /** + * Sets Number. + * + * @required + * @maps number + */ + public function setNumber(string $number): void + { + $this->number = $number; + } + + /** + * Returns Type. + */ + public function getType(): string + { + return $this->type; + } + + /** + * Sets Type. + * + * @required + * @maps type + */ + public function setType(string $type): void + { + $this->type = $type; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + $json['ddd'] = $this->ddd; + $json['number'] = $this->number; + $json['type'] = $this->type; + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/GetBalanceOperationResponse.php b/src/Models/GetBalanceOperationResponse.php index 394996e..4e770ae 100644 --- a/src/Models/GetBalanceOperationResponse.php +++ b/src/Models/GetBalanceOperationResponse.php @@ -210,7 +210,7 @@ public function unsetType(): void /** * Returns Amount. */ - public function getAmount(): ?string + public function getAmount(): ?int { if (count($this->amount) == 0) { return null; @@ -223,7 +223,7 @@ public function getAmount(): ?string * * @maps amount */ - public function setAmount(?string $amount): void + public function setAmount(?int $amount): void { $this->amount['value'] = $amount; } diff --git a/src/Models/GetManagingPartnerResponse.php b/src/Models/GetManagingPartnerResponse.php new file mode 100644 index 0000000..ddede57 --- /dev/null +++ b/src/Models/GetManagingPartnerResponse.php @@ -0,0 +1,435 @@ +name) == 0) { + return null; + } + return $this->name['value']; + } + + /** + * Sets Name. + * + * @maps name + */ + public function setName(?string $name): void + { + $this->name['value'] = $name; + } + + /** + * Unsets Name. + */ + public function unsetName(): void + { + $this->name = []; + } + + /** + * Returns Email. + */ + public function getEmail(): ?string + { + if (count($this->email) == 0) { + return null; + } + return $this->email['value']; + } + + /** + * Sets Email. + * + * @maps email + */ + public function setEmail(?string $email): void + { + $this->email['value'] = $email; + } + + /** + * Unsets Email. + */ + public function unsetEmail(): void + { + $this->email = []; + } + + /** + * Returns Document. + */ + public function getDocument(): ?string + { + if (count($this->document) == 0) { + return null; + } + return $this->document['value']; + } + + /** + * Sets Document. + * + * @maps document + */ + public function setDocument(?string $document): void + { + $this->document['value'] = $document; + } + + /** + * Unsets Document. + */ + public function unsetDocument(): void + { + $this->document = []; + } + + /** + * Returns Type. + */ + public function getType(): ?string + { + if (count($this->type) == 0) { + return null; + } + return $this->type['value']; + } + + /** + * Sets Type. + * + * @maps type + */ + public function setType(?string $type): void + { + $this->type['value'] = $type; + } + + /** + * Unsets Type. + */ + public function unsetType(): void + { + $this->type = []; + } + + /** + * Returns Mother Name. + */ + public function getMotherName(): ?string + { + if (count($this->motherName) == 0) { + return null; + } + return $this->motherName['value']; + } + + /** + * Sets Mother Name. + * + * @maps mother_name + */ + public function setMotherName(?string $motherName): void + { + $this->motherName['value'] = $motherName; + } + + /** + * Unsets Mother Name. + */ + public function unsetMotherName(): void + { + $this->motherName = []; + } + + /** + * Returns Birthdate. + */ + public function getBirthdate(): ?string + { + if (count($this->birthdate) == 0) { + return null; + } + return $this->birthdate['value']; + } + + /** + * Sets Birthdate. + * + * @maps birthdate + */ + public function setBirthdate(?string $birthdate): void + { + $this->birthdate['value'] = $birthdate; + } + + /** + * Unsets Birthdate. + */ + public function unsetBirthdate(): void + { + $this->birthdate = []; + } + + /** + * Returns Monthly Income. + */ + public function getMonthlyIncome(): ?string + { + if (count($this->monthlyIncome) == 0) { + return null; + } + return $this->monthlyIncome['value']; + } + + /** + * Sets Monthly Income. + * + * @maps monthly_income + */ + public function setMonthlyIncome(?string $monthlyIncome): void + { + $this->monthlyIncome['value'] = $monthlyIncome; + } + + /** + * Unsets Monthly Income. + */ + public function unsetMonthlyIncome(): void + { + $this->monthlyIncome = []; + } + + /** + * Returns Professional Occupation. + */ + public function getProfessionalOccupation(): ?string + { + if (count($this->professionalOccupation) == 0) { + return null; + } + return $this->professionalOccupation['value']; + } + + /** + * Sets Professional Occupation. + * + * @maps professional_occupation + */ + public function setProfessionalOccupation(?string $professionalOccupation): void + { + $this->professionalOccupation['value'] = $professionalOccupation; + } + + /** + * Unsets Professional Occupation. + */ + public function unsetProfessionalOccupation(): void + { + $this->professionalOccupation = []; + } + + /** + * Returns Self Declared Representative. + */ + public function getSelfDeclaredRepresentative(): ?bool + { + return $this->selfDeclaredRepresentative; + } + + /** + * Sets Self Declared Representative. + * + * @maps self_declared_representative + */ + public function setSelfDeclaredRepresentative(?bool $selfDeclaredRepresentative): void + { + $this->selfDeclaredRepresentative = $selfDeclaredRepresentative; + } + + /** + * Returns Address. + */ + public function getAddress(): ?GetRegisterInformationAddressResponse + { + if (count($this->address) == 0) { + return null; + } + return $this->address['value']; + } + + /** + * Sets Address. + * + * @maps address + */ + public function setAddress(?GetRegisterInformationAddressResponse $address): void + { + $this->address['value'] = $address; + } + + /** + * Unsets Address. + */ + public function unsetAddress(): void + { + $this->address = []; + } + + /** + * Returns Phone Numbers. + * + * @return GetPhoneNumberResponse[]|null + */ + public function getPhoneNumbers(): ?array + { + if (count($this->phoneNumbers) == 0) { + return null; + } + return $this->phoneNumbers['value']; + } + + /** + * Sets Phone Numbers. + * + * @maps phone_numbers + * + * @param GetPhoneNumberResponse[]|null $phoneNumbers + */ + public function setPhoneNumbers(?array $phoneNumbers): void + { + $this->phoneNumbers['value'] = $phoneNumbers; + } + + /** + * Unsets Phone Numbers. + */ + public function unsetPhoneNumbers(): void + { + $this->phoneNumbers = []; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + if (!empty($this->name)) { + $json['name'] = $this->name['value']; + } + if (!empty($this->email)) { + $json['email'] = $this->email['value']; + } + if (!empty($this->document)) { + $json['document'] = $this->document['value']; + } + if (!empty($this->type)) { + $json['type'] = $this->type['value']; + } + if (!empty($this->motherName)) { + $json['mother_name'] = $this->motherName['value']; + } + if (!empty($this->birthdate)) { + $json['birthdate'] = $this->birthdate['value']; + } + if (!empty($this->monthlyIncome)) { + $json['monthly_income'] = $this->monthlyIncome['value']; + } + if (!empty($this->professionalOccupation)) { + $json['professional_occupation'] = $this->professionalOccupation['value']; + } + if (isset($this->selfDeclaredRepresentative)) { + $json['self_declared_representative'] = $this->selfDeclaredRepresentative; + } + if (!empty($this->address)) { + $json['address'] = $this->address['value']; + } + if (!empty($this->phoneNumbers)) { + $json['phone_numbers'] = $this->phoneNumbers['value']; + } + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/GetPhoneNumberResponse.php b/src/Models/GetPhoneNumberResponse.php new file mode 100644 index 0000000..8a5af67 --- /dev/null +++ b/src/Models/GetPhoneNumberResponse.php @@ -0,0 +1,146 @@ +ddd) == 0) { + return null; + } + return $this->ddd['value']; + } + + /** + * Sets Ddd. + * + * @maps ddd + */ + public function setDdd(?string $ddd): void + { + $this->ddd['value'] = $ddd; + } + + /** + * Unsets Ddd. + */ + public function unsetDdd(): void + { + $this->ddd = []; + } + + /** + * Returns Number. + */ + public function getNumber(): ?string + { + if (count($this->number) == 0) { + return null; + } + return $this->number['value']; + } + + /** + * Sets Number. + * + * @maps number + */ + public function setNumber(?string $number): void + { + $this->number['value'] = $number; + } + + /** + * Unsets Number. + */ + public function unsetNumber(): void + { + $this->number = []; + } + + /** + * Returns Type. + */ + public function getType(): ?string + { + if (count($this->type) == 0) { + return null; + } + return $this->type['value']; + } + + /** + * Sets Type. + * + * @maps type + */ + public function setType(?string $type): void + { + $this->type['value'] = $type; + } + + /** + * Unsets Type. + */ + public function unsetType(): void + { + $this->type = []; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + if (!empty($this->ddd)) { + $json['ddd'] = $this->ddd['value']; + } + if (!empty($this->number)) { + $json['number'] = $this->number['value']; + } + if (!empty($this->type)) { + $json['type'] = $this->type['value']; + } + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/GetRecipientResponse.php b/src/Models/GetRecipientResponse.php index e9ed89a..abaf18d 100644 --- a/src/Models/GetRecipientResponse.php +++ b/src/Models/GetRecipientResponse.php @@ -103,6 +103,11 @@ class GetRecipientResponse implements \JsonSerializable */ private $paymentMode = ['value' => 'bank_transfer']; + /** + * @var array + */ + private $registerInformation = []; + /** * Returns Id. * Id @@ -653,6 +658,35 @@ public function unsetPaymentMode(): void $this->paymentMode = []; } + /** + * Returns Register Information. + */ + public function getRegisterInformation(): ?GetRegisterInformationResponse + { + if (count($this->registerInformation) == 0) { + return null; + } + return $this->registerInformation['value']; + } + + /** + * Sets Register Information. + * + * @maps register_information + */ + public function setRegisterInformation(?GetRegisterInformationResponse $registerInformation): void + { + $this->registerInformation['value'] = $registerInformation; + } + + /** + * Unsets Register Information. + */ + public function unsetRegisterInformation(): void + { + $this->registerInformation = []; + } + /** * Encode this object to JSON * @@ -716,6 +750,9 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) if (!empty($this->paymentMode)) { $json['payment_mode'] = $this->paymentMode['value']; } + if (!empty($this->registerInformation)) { + $json['register_information'] = $this->registerInformation['value']; + } return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; } diff --git a/src/Models/GetRegisterInformationAddressResponse.php b/src/Models/GetRegisterInformationAddressResponse.php new file mode 100644 index 0000000..71f0331 --- /dev/null +++ b/src/Models/GetRegisterInformationAddressResponse.php @@ -0,0 +1,331 @@ +street) == 0) { + return null; + } + return $this->street['value']; + } + + /** + * Sets Street. + * + * @maps street + */ + public function setStreet(?string $street): void + { + $this->street['value'] = $street; + } + + /** + * Unsets Street. + */ + public function unsetStreet(): void + { + $this->street = []; + } + + /** + * Returns Complementary. + */ + public function getComplementary(): ?string + { + if (count($this->complementary) == 0) { + return null; + } + return $this->complementary['value']; + } + + /** + * Sets Complementary. + * + * @maps complementary + */ + public function setComplementary(?string $complementary): void + { + $this->complementary['value'] = $complementary; + } + + /** + * Unsets Complementary. + */ + public function unsetComplementary(): void + { + $this->complementary = []; + } + + /** + * Returns Street Number. + */ + public function getStreetNumber(): ?string + { + if (count($this->streetNumber) == 0) { + return null; + } + return $this->streetNumber['value']; + } + + /** + * Sets Street Number. + * + * @maps street_number + */ + public function setStreetNumber(?string $streetNumber): void + { + $this->streetNumber['value'] = $streetNumber; + } + + /** + * Unsets Street Number. + */ + public function unsetStreetNumber(): void + { + $this->streetNumber = []; + } + + /** + * Returns Neighborhood. + */ + public function getNeighborhood(): ?string + { + if (count($this->neighborhood) == 0) { + return null; + } + return $this->neighborhood['value']; + } + + /** + * Sets Neighborhood. + * + * @maps neighborhood + */ + public function setNeighborhood(?string $neighborhood): void + { + $this->neighborhood['value'] = $neighborhood; + } + + /** + * Unsets Neighborhood. + */ + public function unsetNeighborhood(): void + { + $this->neighborhood = []; + } + + /** + * Returns City. + */ + public function getCity(): ?string + { + if (count($this->city) == 0) { + return null; + } + return $this->city['value']; + } + + /** + * Sets City. + * + * @maps city + */ + public function setCity(?string $city): void + { + $this->city['value'] = $city; + } + + /** + * Unsets City. + */ + public function unsetCity(): void + { + $this->city = []; + } + + /** + * Returns State. + */ + public function getState(): ?string + { + if (count($this->state) == 0) { + return null; + } + return $this->state['value']; + } + + /** + * Sets State. + * + * @maps state + */ + public function setState(?string $state): void + { + $this->state['value'] = $state; + } + + /** + * Unsets State. + */ + public function unsetState(): void + { + $this->state = []; + } + + /** + * Returns Zip Code. + */ + public function getZipCode(): ?string + { + if (count($this->zipCode) == 0) { + return null; + } + return $this->zipCode['value']; + } + + /** + * Sets Zip Code. + * + * @maps zip_code + */ + public function setZipCode(?string $zipCode): void + { + $this->zipCode['value'] = $zipCode; + } + + /** + * Unsets Zip Code. + */ + public function unsetZipCode(): void + { + $this->zipCode = []; + } + + /** + * Returns Reference Point. + */ + public function getReferencePoint(): ?string + { + if (count($this->referencePoint) == 0) { + return null; + } + return $this->referencePoint['value']; + } + + /** + * Sets Reference Point. + * + * @maps reference_point + */ + public function setReferencePoint(?string $referencePoint): void + { + $this->referencePoint['value'] = $referencePoint; + } + + /** + * Unsets Reference Point. + */ + public function unsetReferencePoint(): void + { + $this->referencePoint = []; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + if (!empty($this->street)) { + $json['street'] = $this->street['value']; + } + if (!empty($this->complementary)) { + $json['complementary'] = $this->complementary['value']; + } + if (!empty($this->streetNumber)) { + $json['street_number'] = $this->streetNumber['value']; + } + if (!empty($this->neighborhood)) { + $json['neighborhood'] = $this->neighborhood['value']; + } + if (!empty($this->city)) { + $json['city'] = $this->city['value']; + } + if (!empty($this->state)) { + $json['state'] = $this->state['value']; + } + if (!empty($this->zipCode)) { + $json['zip_code'] = $this->zipCode['value']; + } + if (!empty($this->referencePoint)) { + $json['reference_point'] = $this->referencePoint['value']; + } + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/GetRegisterInformationResponse.php b/src/Models/GetRegisterInformationResponse.php new file mode 100644 index 0000000..c90f143 --- /dev/null +++ b/src/Models/GetRegisterInformationResponse.php @@ -0,0 +1,746 @@ +email) == 0) { + return null; + } + return $this->email['value']; + } + + /** + * Sets Email. + * + * @maps email + */ + public function setEmail(?string $email): void + { + $this->email['value'] = $email; + } + + /** + * Unsets Email. + */ + public function unsetEmail(): void + { + $this->email = []; + } + + /** + * Returns Document. + */ + public function getDocument(): ?string + { + if (count($this->document) == 0) { + return null; + } + return $this->document['value']; + } + + /** + * Sets Document. + * + * @maps document + */ + public function setDocument(?string $document): void + { + $this->document['value'] = $document; + } + + /** + * Unsets Document. + */ + public function unsetDocument(): void + { + $this->document = []; + } + + /** + * Returns Type. + */ + public function getType(): ?string + { + if (count($this->type) == 0) { + return null; + } + return $this->type['value']; + } + + /** + * Sets Type. + * + * @maps type + */ + public function setType(?string $type): void + { + $this->type['value'] = $type; + } + + /** + * Unsets Type. + */ + public function unsetType(): void + { + $this->type = []; + } + + /** + * Returns Site Url. + */ + public function getSiteUrl(): ?string + { + if (count($this->siteUrl) == 0) { + return null; + } + return $this->siteUrl['value']; + } + + /** + * Sets Site Url. + * + * @maps site_url + */ + public function setSiteUrl(?string $siteUrl): void + { + $this->siteUrl['value'] = $siteUrl; + } + + /** + * Unsets Site Url. + */ + public function unsetSiteUrl(): void + { + $this->siteUrl = []; + } + + /** + * Returns Phone Numbers. + * + * @return GetPhoneNumberResponse[]|null + */ + public function getPhoneNumbers(): ?array + { + if (count($this->phoneNumbers) == 0) { + return null; + } + return $this->phoneNumbers['value']; + } + + /** + * Sets Phone Numbers. + * + * @maps phone_numbers + * + * @param GetPhoneNumberResponse[]|null $phoneNumbers + */ + public function setPhoneNumbers(?array $phoneNumbers): void + { + $this->phoneNumbers['value'] = $phoneNumbers; + } + + /** + * Unsets Phone Numbers. + */ + public function unsetPhoneNumbers(): void + { + $this->phoneNumbers = []; + } + + /** + * Returns Name. + */ + public function getName(): ?string + { + if (count($this->name) == 0) { + return null; + } + return $this->name['value']; + } + + /** + * Sets Name. + * + * @maps name + */ + public function setName(?string $name): void + { + $this->name['value'] = $name; + } + + /** + * Unsets Name. + */ + public function unsetName(): void + { + $this->name = []; + } + + /** + * Returns Mother Name. + */ + public function getMotherName(): ?string + { + if (count($this->motherName) == 0) { + return null; + } + return $this->motherName['value']; + } + + /** + * Sets Mother Name. + * + * @maps mother_name + */ + public function setMotherName(?string $motherName): void + { + $this->motherName['value'] = $motherName; + } + + /** + * Unsets Mother Name. + */ + public function unsetMotherName(): void + { + $this->motherName = []; + } + + /** + * Returns Birthdate. + */ + public function getBirthdate(): ?string + { + if (count($this->birthdate) == 0) { + return null; + } + return $this->birthdate['value']; + } + + /** + * Sets Birthdate. + * + * @maps birthdate + */ + public function setBirthdate(?string $birthdate): void + { + $this->birthdate['value'] = $birthdate; + } + + /** + * Unsets Birthdate. + */ + public function unsetBirthdate(): void + { + $this->birthdate = []; + } + + /** + * Returns Monthly Income. + */ + public function getMonthlyIncome(): ?string + { + if (count($this->monthlyIncome) == 0) { + return null; + } + return $this->monthlyIncome['value']; + } + + /** + * Sets Monthly Income. + * + * @maps monthly_income + */ + public function setMonthlyIncome(?string $monthlyIncome): void + { + $this->monthlyIncome['value'] = $monthlyIncome; + } + + /** + * Unsets Monthly Income. + */ + public function unsetMonthlyIncome(): void + { + $this->monthlyIncome = []; + } + + /** + * Returns Professional Occupation. + */ + public function getProfessionalOccupation(): ?string + { + if (count($this->professionalOccupation) == 0) { + return null; + } + return $this->professionalOccupation['value']; + } + + /** + * Sets Professional Occupation. + * + * @maps professional_occupation + */ + public function setProfessionalOccupation(?string $professionalOccupation): void + { + $this->professionalOccupation['value'] = $professionalOccupation; + } + + /** + * Unsets Professional Occupation. + */ + public function unsetProfessionalOccupation(): void + { + $this->professionalOccupation = []; + } + + /** + * Returns Address. + */ + public function getAddress(): ?GetRegisterInformationAddressResponse + { + if (count($this->address) == 0) { + return null; + } + return $this->address['value']; + } + + /** + * Sets Address. + * + * @maps address + */ + public function setAddress(?GetRegisterInformationAddressResponse $address): void + { + $this->address['value'] = $address; + } + + /** + * Unsets Address. + */ + public function unsetAddress(): void + { + $this->address = []; + } + + /** + * Returns Company Name. + */ + public function getCompanyName(): ?string + { + if (count($this->companyName) == 0) { + return null; + } + return $this->companyName['value']; + } + + /** + * Sets Company Name. + * + * @maps company_name + */ + public function setCompanyName(?string $companyName): void + { + $this->companyName['value'] = $companyName; + } + + /** + * Unsets Company Name. + */ + public function unsetCompanyName(): void + { + $this->companyName = []; + } + + /** + * Returns Trading Name. + */ + public function getTradingName(): ?string + { + if (count($this->tradingName) == 0) { + return null; + } + return $this->tradingName['value']; + } + + /** + * Sets Trading Name. + * + * @maps trading_name + */ + public function setTradingName(?string $tradingName): void + { + $this->tradingName['value'] = $tradingName; + } + + /** + * Unsets Trading Name. + */ + public function unsetTradingName(): void + { + $this->tradingName = []; + } + + /** + * Returns Annual Revenue. + */ + public function getAnnualRevenue(): ?string + { + if (count($this->annualRevenue) == 0) { + return null; + } + return $this->annualRevenue['value']; + } + + /** + * Sets Annual Revenue. + * + * @maps annual_revenue + */ + public function setAnnualRevenue(?string $annualRevenue): void + { + $this->annualRevenue['value'] = $annualRevenue; + } + + /** + * Unsets Annual Revenue. + */ + public function unsetAnnualRevenue(): void + { + $this->annualRevenue = []; + } + + /** + * Returns Corporation Type. + */ + public function getCorporationType(): ?string + { + if (count($this->corporationType) == 0) { + return null; + } + return $this->corporationType['value']; + } + + /** + * Sets Corporation Type. + * + * @maps corporation_type + */ + public function setCorporationType(?string $corporationType): void + { + $this->corporationType['value'] = $corporationType; + } + + /** + * Unsets Corporation Type. + */ + public function unsetCorporationType(): void + { + $this->corporationType = []; + } + + /** + * Returns Founding Date. + */ + public function getFoundingDate(): ?string + { + if (count($this->foundingDate) == 0) { + return null; + } + return $this->foundingDate['value']; + } + + /** + * Sets Founding Date. + * + * @maps founding_date + */ + public function setFoundingDate(?string $foundingDate): void + { + $this->foundingDate['value'] = $foundingDate; + } + + /** + * Unsets Founding Date. + */ + public function unsetFoundingDate(): void + { + $this->foundingDate = []; + } + + /** + * Returns Cnae. + */ + public function getCnae(): ?string + { + if (count($this->cnae) == 0) { + return null; + } + return $this->cnae['value']; + } + + /** + * Sets Cnae. + * + * @maps cnae + */ + public function setCnae(?string $cnae): void + { + $this->cnae['value'] = $cnae; + } + + /** + * Unsets Cnae. + */ + public function unsetCnae(): void + { + $this->cnae = []; + } + + /** + * Returns Main Address. + */ + public function getMainAddress(): ?GetRegisterInformationAddressResponse + { + if (count($this->mainAddress) == 0) { + return null; + } + return $this->mainAddress['value']; + } + + /** + * Sets Main Address. + * + * @maps main_address + */ + public function setMainAddress(?GetRegisterInformationAddressResponse $mainAddress): void + { + $this->mainAddress['value'] = $mainAddress; + } + + /** + * Unsets Main Address. + */ + public function unsetMainAddress(): void + { + $this->mainAddress = []; + } + + /** + * Returns Managing Partners. + * + * @return GetManagingPartnerResponse[]|null + */ + public function getManagingPartners(): ?array + { + if (count($this->managingPartners) == 0) { + return null; + } + return $this->managingPartners['value']; + } + + /** + * Sets Managing Partners. + * + * @maps managing_partners + * + * @param GetManagingPartnerResponse[]|null $managingPartners + */ + public function setManagingPartners(?array $managingPartners): void + { + $this->managingPartners['value'] = $managingPartners; + } + + /** + * Unsets Managing Partners. + */ + public function unsetManagingPartners(): void + { + $this->managingPartners = []; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + if (!empty($this->email)) { + $json['email'] = $this->email['value']; + } + if (!empty($this->document)) { + $json['document'] = $this->document['value']; + } + if (!empty($this->type)) { + $json['type'] = $this->type['value']; + } + if (!empty($this->siteUrl)) { + $json['site_url'] = $this->siteUrl['value']; + } + if (!empty($this->phoneNumbers)) { + $json['phone_numbers'] = $this->phoneNumbers['value']; + } + if (!empty($this->name)) { + $json['name'] = $this->name['value']; + } + if (!empty($this->motherName)) { + $json['mother_name'] = $this->motherName['value']; + } + if (!empty($this->birthdate)) { + $json['birthdate'] = $this->birthdate['value']; + } + if (!empty($this->monthlyIncome)) { + $json['monthly_income'] = $this->monthlyIncome['value']; + } + if (!empty($this->professionalOccupation)) { + $json['professional_occupation'] = $this->professionalOccupation['value']; + } + if (!empty($this->address)) { + $json['address'] = $this->address['value']; + } + if (!empty($this->companyName)) { + $json['company_name'] = $this->companyName['value']; + } + if (!empty($this->tradingName)) { + $json['trading_name'] = $this->tradingName['value']; + } + if (!empty($this->annualRevenue)) { + $json['annual_revenue'] = $this->annualRevenue['value']; + } + if (!empty($this->corporationType)) { + $json['corporation_type'] = $this->corporationType['value']; + } + if (!empty($this->foundingDate)) { + $json['founding_date'] = $this->foundingDate['value']; + } + if (!empty($this->cnae)) { + $json['cnae'] = $this->cnae['value']; + } + if (!empty($this->mainAddress)) { + $json['main_address'] = $this->mainAddress['value']; + } + if (!empty($this->managingPartners)) { + $json['managing_partners'] = $this->managingPartners['value']; + } + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/PagarmeApiSDKClient.php b/src/PagarmeApiSDKClient.php index 51ff8dd..10d39ec 100644 --- a/src/PagarmeApiSDKClient.php +++ b/src/PagarmeApiSDKClient.php @@ -80,7 +80,7 @@ public function __construct(array $config = []) ->converter(new CompatibilityConverter()) ->jsonHelper(ApiHelper::getJsonHelper()) ->apiCallback($this->config['httpCallback'] ?? null) - ->userAgent('PagarmeApiSDK - PHP 6.8.2') + ->userAgent('PagarmeApiSDK - PHP 6.8.3') ->globalConfig($this->getGlobalConfiguration()) ->globalErrors($this->getGlobalErrors()) ->serverUrls(self::ENVIRONMENT_MAP[$this->getEnvironment()], Server::DEFAULT_) From 774a0291820c16263219ba21a30752f0bc3a552a Mon Sep 17 00:00:00 2001 From: andreals Date: Mon, 5 Feb 2024 14:33:09 +0000 Subject: [PATCH 3/4] Automated commit message --- README.md | 44 +++++++++---------- ...ckout-card-installment-options-response.md | 4 +- ...t-checkout-credit-card-payment-response.md | 2 +- ...tCardInstallmentOptionsResponseBuilder.php | 2 +- ...CheckoutCardInstallmentOptionsResponse.php | 6 +-- src/PagarmeApiSDKClient.php | 2 +- 6 files changed, 30 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index 6a92e7c..aa2437c 100644 --- a/README.md +++ b/README.md @@ -99,7 +99,7 @@ To run your project, right click on your PHP file inside your Test project and c ## Initialize the API Client -**_Note:_** Documentation for the client can be found [here.](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.3/doc/client.md) +**_Note:_** Documentation for the client can be found [here.](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.4/doc/client.md) The following parameters are configurable for the API Client: @@ -138,31 +138,31 @@ Here is the list of errors that the API might throw. | HTTP Status Code | Error Description | Exception Class | | --- | --- | --- | -| 400 | Invalid request | [`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.3/doc/models/error-exception.md) | -| 401 | Invalid API key | [`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.3/doc/models/error-exception.md) | -| 404 | An informed resource was not found | [`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.3/doc/models/error-exception.md) | -| 412 | Business validation error | [`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.3/doc/models/error-exception.md) | -| 422 | Contract validation error | [`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.3/doc/models/error-exception.md) | -| 500 | Internal server error | [`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.3/doc/models/error-exception.md) | +| 400 | Invalid request | [`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.4/doc/models/error-exception.md) | +| 401 | Invalid API key | [`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.4/doc/models/error-exception.md) | +| 404 | An informed resource was not found | [`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.4/doc/models/error-exception.md) | +| 412 | Business validation error | [`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.4/doc/models/error-exception.md) | +| 422 | Contract validation error | [`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.4/doc/models/error-exception.md) | +| 500 | Internal server error | [`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.4/doc/models/error-exception.md) | ## List of APIs -* [Subscriptions](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.3/doc/controllers/subscriptions.md) -* [Orders](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.3/doc/controllers/orders.md) -* [Plans](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.3/doc/controllers/plans.md) -* [Invoices](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.3/doc/controllers/invoices.md) -* [Customers](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.3/doc/controllers/customers.md) -* [Charges](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.3/doc/controllers/charges.md) -* [Recipients](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.3/doc/controllers/recipients.md) -* [Tokens](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.3/doc/controllers/tokens.md) -* [Transactions](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.3/doc/controllers/transactions.md) -* [Transfers](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.3/doc/controllers/transfers.md) -* [Payables](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.3/doc/controllers/payables.md) -* [Balance Operations](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.3/doc/controllers/balance-operations.md) +* [Subscriptions](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.4/doc/controllers/subscriptions.md) +* [Orders](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.4/doc/controllers/orders.md) +* [Plans](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.4/doc/controllers/plans.md) +* [Invoices](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.4/doc/controllers/invoices.md) +* [Customers](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.4/doc/controllers/customers.md) +* [Charges](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.4/doc/controllers/charges.md) +* [Recipients](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.4/doc/controllers/recipients.md) +* [Tokens](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.4/doc/controllers/tokens.md) +* [Transactions](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.4/doc/controllers/transactions.md) +* [Transfers](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.4/doc/controllers/transfers.md) +* [Payables](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.4/doc/controllers/payables.md) +* [Balance Operations](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.4/doc/controllers/balance-operations.md) ## Classes Documentation -* [ApiException](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.3/doc/api-exception.md) -* [HttpRequest](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.3/doc/http-request.md) -* [HttpResponse](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.3/doc/http-response.md) +* [ApiException](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.4/doc/api-exception.md) +* [HttpRequest](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.4/doc/http-request.md) +* [HttpResponse](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.4/doc/http-response.md) diff --git a/doc/models/get-checkout-card-installment-options-response.md b/doc/models/get-checkout-card-installment-options-response.md index 32b2e31..332a06f 100644 --- a/doc/models/get-checkout-card-installment-options-response.md +++ b/doc/models/get-checkout-card-installment-options-response.md @@ -9,14 +9,14 @@ | Name | Type | Tags | Description | Getter | Setter | | --- | --- | --- | --- | --- | --- | -| `number` | `?string` | Required | Número de parcelas | getNumber(): ?string | setNumber(?string number): void | +| `number` | `?int` | Required | Número de parcelas | getNumber(): ?int | setNumber(?int number): void | | `total` | `?int` | Required | Valor total da compra | getTotal(): ?int | setTotal(?int total): void | ## Example (as JSON) ```json { - "number": "number0", + "number": 40, "total": 188 } ``` diff --git a/doc/models/get-checkout-credit-card-payment-response.md b/doc/models/get-checkout-credit-card-payment-response.md index 6b21837..6c19af6 100644 --- a/doc/models/get-checkout-credit-card-payment-response.md +++ b/doc/models/get-checkout-credit-card-payment-response.md @@ -20,7 +20,7 @@ "statementDescriptor": "statementDescriptor8", "installments": [ { - "number": "number2", + "number": 164, "total": 16 } ], diff --git a/src/Models/Builders/GetCheckoutCardInstallmentOptionsResponseBuilder.php b/src/Models/Builders/GetCheckoutCardInstallmentOptionsResponseBuilder.php index 1a44dc9..ab509b6 100644 --- a/src/Models/Builders/GetCheckoutCardInstallmentOptionsResponseBuilder.php +++ b/src/Models/Builders/GetCheckoutCardInstallmentOptionsResponseBuilder.php @@ -41,7 +41,7 @@ public static function init(): self /** * Sets number field. */ - public function number(?string $value): self + public function number(?int $value): self { $this->instance->setNumber($value); return $this; diff --git a/src/Models/GetCheckoutCardInstallmentOptionsResponse.php b/src/Models/GetCheckoutCardInstallmentOptionsResponse.php index 778f1c0..088aae0 100644 --- a/src/Models/GetCheckoutCardInstallmentOptionsResponse.php +++ b/src/Models/GetCheckoutCardInstallmentOptionsResponse.php @@ -15,7 +15,7 @@ class GetCheckoutCardInstallmentOptionsResponse implements \JsonSerializable { /** - * @var string|null + * @var int|null */ private $number; @@ -28,7 +28,7 @@ class GetCheckoutCardInstallmentOptionsResponse implements \JsonSerializable * Returns Number. * Número de parcelas */ - public function getNumber(): ?string + public function getNumber(): ?int { return $this->number; } @@ -39,7 +39,7 @@ public function getNumber(): ?string * * @maps number */ - public function setNumber(?string $number): void + public function setNumber(?int $number): void { $this->number = $number; } diff --git a/src/PagarmeApiSDKClient.php b/src/PagarmeApiSDKClient.php index 10d39ec..d341998 100644 --- a/src/PagarmeApiSDKClient.php +++ b/src/PagarmeApiSDKClient.php @@ -80,7 +80,7 @@ public function __construct(array $config = []) ->converter(new CompatibilityConverter()) ->jsonHelper(ApiHelper::getJsonHelper()) ->apiCallback($this->config['httpCallback'] ?? null) - ->userAgent('PagarmeApiSDK - PHP 6.8.3') + ->userAgent('PagarmeApiSDK - PHP 6.8.4') ->globalConfig($this->getGlobalConfiguration()) ->globalErrors($this->getGlobalErrors()) ->serverUrls(self::ENVIRONMENT_MAP[$this->getEnvironment()], Server::DEFAULT_) From 5a42793cb8af2465a6c766c24a716f13b38afb75 Mon Sep 17 00:00:00 2001 From: andreals Date: Mon, 19 Feb 2024 19:10:45 +0000 Subject: [PATCH 4/4] Automated commit message --- README.md | 52 +- doc/client.md | 4 - doc/controllers/charges.md | 278 ++-- doc/controllers/customers.md | 388 +++--- doc/controllers/invoices.md | 182 +-- doc/controllers/orders.md | 170 +-- doc/controllers/plans.md | 310 ++--- doc/controllers/recipients.md | 426 +++--- doc/controllers/subscriptions.md | 1202 ++++++++--------- doc/controllers/tokens.md | 4 - doc/controllers/transfers.md | 40 +- doc/models/create-managing-partner-request.md | 4 +- ...egister-information-corporation-request.md | 6 +- ...register-information-individual-request.md | 4 +- doc/models/get-transaction-response.md | 19 +- .../list-charge-transactions-response.md | 38 +- doc/models/list-transactions-response.md | 57 +- src/ApiHelper.php | 10 +- src/BasicAuthCredentials.php | 35 - src/BasicAuthManager.php | 68 - src/ConfigurationDefaults.php | 8 +- src/ConfigurationInterface.php | 5 - .../BalanceOperationsController.php | 2 - src/Controllers/ChargesController.php | 265 ++-- src/Controllers/CustomersController.php | 325 ++--- src/Controllers/InvoicesController.php | 156 +-- src/Controllers/OrdersController.php | 144 +- src/Controllers/PayablesController.php | 2 - src/Controllers/PlansController.php | 162 ++- src/Controllers/RecipientsController.php | 356 +++-- src/Controllers/SubscriptionsController.php | 868 ++++++------ src/Controllers/TransactionsController.php | 1 - src/Controllers/TransfersController.php | 32 +- .../CreateManagingPartnerRequestBuilder.php | 2 +- ...erInformationCorporationRequestBuilder.php | 2 +- ...terInformationIndividualRequestBuilder.php | 2 +- src/Models/CreateManagingPartnerRequest.php | 10 +- ...eRegisterInformationCorporationRequest.php | 10 +- ...teRegisterInformationIndividualRequest.php | 10 +- src/PagarmeApiSDKClient.php | 16 +- src/PagarmeApiSDKClientBuilder.php | 12 - 41 files changed, 2729 insertions(+), 2958 deletions(-) delete mode 100644 src/BasicAuthCredentials.php delete mode 100644 src/BasicAuthManager.php diff --git a/README.md b/README.md index aa2437c..47b0f82 100644 --- a/README.md +++ b/README.md @@ -99,7 +99,7 @@ To run your project, right click on your PHP file inside your Test project and c ## Initialize the API Client -**_Note:_** Documentation for the client can be found [here.](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.4/doc/client.md) +**_Note:_** Documentation for the client can be found [here.](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.5/doc/client.md) The following parameters are configurable for the API Client: @@ -115,54 +115,46 @@ The following parameters are configurable for the API Client: | `retryOnTimeout` | `bool` | Whether to retry on request timeout.
*Default*: `true` | | `httpStatusCodesToRetry` | `array` | Http status codes to retry against.
*Default*: `408, 413, 429, 500, 502, 503, 504, 521, 522, 524` | | `httpMethodsToRetry` | `array` | Http methods to retry against.
*Default*: `'GET', 'PUT'` | -| `basicAuthUserName` | `string` | The username to use with basic authentication | -| `basicAuthPassword` | `string` | The password to use with basic authentication | The API client can be initialized as follows: ```php $client = PagarmeApiSDKClientBuilder::init() - ->basicAuthUserName('BasicAuthUserName') - ->basicAuthPassword('BasicAuthPassword') ->serviceRefererName('ServiceRefererName') ->build(); ``` -## Authorization - -This API uses `Basic Authentication`. - ## API Errors 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-php-sdk/tree/6.8.4/doc/models/error-exception.md) | -| 401 | Invalid API key | [`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.4/doc/models/error-exception.md) | -| 404 | An informed resource was not found | [`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.4/doc/models/error-exception.md) | -| 412 | Business validation error | [`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.4/doc/models/error-exception.md) | -| 422 | Contract validation error | [`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.4/doc/models/error-exception.md) | -| 500 | Internal server error | [`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.4/doc/models/error-exception.md) | +| 400 | Invalid request | [`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.5/doc/models/error-exception.md) | +| 401 | Invalid API key | [`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.5/doc/models/error-exception.md) | +| 404 | An informed resource was not found | [`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.5/doc/models/error-exception.md) | +| 412 | Business validation error | [`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.5/doc/models/error-exception.md) | +| 422 | Contract validation error | [`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.5/doc/models/error-exception.md) | +| 500 | Internal server error | [`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.5/doc/models/error-exception.md) | ## List of APIs -* [Subscriptions](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.4/doc/controllers/subscriptions.md) -* [Orders](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.4/doc/controllers/orders.md) -* [Plans](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.4/doc/controllers/plans.md) -* [Invoices](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.4/doc/controllers/invoices.md) -* [Customers](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.4/doc/controllers/customers.md) -* [Charges](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.4/doc/controllers/charges.md) -* [Recipients](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.4/doc/controllers/recipients.md) -* [Tokens](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.4/doc/controllers/tokens.md) -* [Transactions](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.4/doc/controllers/transactions.md) -* [Transfers](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.4/doc/controllers/transfers.md) -* [Payables](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.4/doc/controllers/payables.md) -* [Balance Operations](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.4/doc/controllers/balance-operations.md) +* [Subscriptions](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.5/doc/controllers/subscriptions.md) +* [Orders](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.5/doc/controllers/orders.md) +* [Plans](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.5/doc/controllers/plans.md) +* [Invoices](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.5/doc/controllers/invoices.md) +* [Customers](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.5/doc/controllers/customers.md) +* [Charges](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.5/doc/controllers/charges.md) +* [Recipients](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.5/doc/controllers/recipients.md) +* [Tokens](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.5/doc/controllers/tokens.md) +* [Transactions](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.5/doc/controllers/transactions.md) +* [Transfers](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.5/doc/controllers/transfers.md) +* [Payables](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.5/doc/controllers/payables.md) +* [Balance Operations](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.5/doc/controllers/balance-operations.md) ## Classes Documentation -* [ApiException](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.4/doc/api-exception.md) -* [HttpRequest](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.4/doc/http-request.md) -* [HttpResponse](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.4/doc/http-response.md) +* [ApiException](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.5/doc/api-exception.md) +* [HttpRequest](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.5/doc/http-request.md) +* [HttpResponse](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.5/doc/http-response.md) diff --git a/doc/client.md b/doc/client.md index d437a11..0071fb8 100644 --- a/doc/client.md +++ b/doc/client.md @@ -15,15 +15,11 @@ The following parameters are configurable for the API Client: | `retryOnTimeout` | `bool` | Whether to retry on request timeout.
*Default*: `true` | | `httpStatusCodesToRetry` | `array` | Http status codes to retry against.
*Default*: `408, 413, 429, 500, 502, 503, 504, 521, 522, 524` | | `httpMethodsToRetry` | `array` | Http methods to retry against.
*Default*: `'GET', 'PUT'` | -| `basicAuthUserName` | `string` | The username to use with basic authentication | -| `basicAuthPassword` | `string` | The password to use with basic authentication | The API client can be initialized as follows: ```php $client = PagarmeApiSDKClientBuilder::init() - ->basicAuthUserName('BasicAuthUserName') - ->basicAuthPassword('BasicAuthPassword') ->serviceRefererName('ServiceRefererName') ->build(); ``` diff --git a/doc/controllers/charges.md b/doc/controllers/charges.md index d0529df..525cdd3 100644 --- a/doc/controllers/charges.md +++ b/doc/controllers/charges.md @@ -12,17 +12,17 @@ $chargesController = $client->getChargesController(); * [Update Charge Metadata](../../doc/controllers/charges.md#update-charge-metadata) * [Update Charge Payment Method](../../doc/controllers/charges.md#update-charge-payment-method) -* [Update Charge Card](../../doc/controllers/charges.md#update-charge-card) -* [Get Charges Summary](../../doc/controllers/charges.md#get-charges-summary) -* [Create Charge](../../doc/controllers/charges.md#create-charge) * [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) * [Cancel Charge](../../doc/controllers/charges.md#cancel-charge) -* [Get Charges](../../doc/controllers/charges.md#get-charges) +* [Create Charge](../../doc/controllers/charges.md#create-charge) * [Confirm Payment](../../doc/controllers/charges.md#confirm-payment) -* [Update Charge Due Date](../../doc/controllers/charges.md#update-charge-due-date) -* [Retry Charge](../../doc/controllers/charges.md#retry-charge) # Update Charge Metadata @@ -148,155 +148,159 @@ $result = $chargesController->updateChargePaymentMethod( ``` -# Update Charge Card - -Updates the card from a charge +# Get Charge Transactions ```php -function updateChargeCard( +function getChargeTransactions( string $chargeId, - UpdateChargeCardRequest $request, - ?string $idempotencyKey = null -): GetChargeResponse + ?int $page = null, + ?int $size = null +): ListChargeTransactionsResponse ``` ## Parameters | 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 | -| `idempotencyKey` | `?string` | Header, Optional | - | +| `chargeId` | `string` | Template, Required | Charge Id | +| `page` | `?int` | Query, Optional | Page number | +| `size` | `?int` | Query, Optional | Page size | ## Response Type -[`GetChargeResponse`](../../doc/models/get-charge-response.md) +[`ListChargeTransactionsResponse`](../../doc/models/list-charge-transactions-response.md) ## Example Usage ```php $chargeId = 'charge_id8'; -$request = UpdateChargeCardRequestBuilder::init( - false, - 'card_id2', - CreateCardRequestBuilder::init() - ->type('credit') - ->build(), - false -)->build(); - -$result = $chargesController->updateChargeCard( - $chargeId, - $request -); +$result = $chargesController->getChargeTransactions($chargeId); ``` -# Get Charges Summary +# Update Charge Due Date + +Updates the due date from a charge ```php -function getChargesSummary( - string $status, - ?\DateTime $createdSince = null, - ?\DateTime $createdUntil = null -): GetChargesSummaryResponse +function updateChargeDueDate( + string $chargeId, + UpdateChargeDueDateRequest $request, + ?string $idempotencyKey = null +): GetChargeResponse ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `status` | `string` | Query, Required | - | -| `createdSince` | `?DateTime` | Query, Optional | - | -| `createdUntil` | `?DateTime` | Query, Optional | - | +| `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 -[`GetChargesSummaryResponse`](../../doc/models/get-charges-summary-response.md) +[`GetChargeResponse`](../../doc/models/get-charge-response.md) ## Example Usage ```php -$status = 'status8'; +$chargeId = 'charge_id8'; -$result = $chargesController->getChargesSummary($status); +$request = UpdateChargeDueDateRequestBuilder::init()->build(); + +$result = $chargesController->updateChargeDueDate( + $chargeId, + $request +); ``` -# Create Charge +# Get Charges -Creates a new charge +Lists all charges ```php -function createCharge(CreateChargeRequest $request, ?string $idempotencyKey = null): GetChargeResponse +function getCharges( + ?int $page = null, + ?int $size = null, + ?string $code = null, + ?string $status = null, + ?string $paymentMethod = null, + ?string $customerId = null, + ?string $orderId = null, + ?\DateTime $createdSince = null, + ?\DateTime $createdUntil = null +): ListChargesResponse ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `request` | [`CreateChargeRequest`](../../doc/models/create-charge-request.md) | Body, Required | Request for creating a charge | -| `idempotencyKey` | `?string` | Header, Optional | - | +| `page` | `?int` | Query, Optional | Page number | +| `size` | `?int` | 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` | `?DateTime` | Query, Optional | Filter for the beginning of the range for charge's creation | +| `createdUntil` | `?DateTime` | Query, Optional | Filter for the end of the range for charge's creation | ## Response Type -[`GetChargeResponse`](../../doc/models/get-charge-response.md) +[`ListChargesResponse`](../../doc/models/list-charges-response.md) ## Example Usage ```php -$request = CreateChargeRequestBuilder::init( - 242, - CreatePaymentRequestBuilder::init( - 'payment_method4' - )->build(), - 'order_id0' -)->build(); - -$result = $chargesController->createCharge($request); +$result = $chargesController->getCharges(); ``` -# Get Charge Transactions +# Capture Charge + +Captures a charge ```php -function getChargeTransactions( +function captureCharge( string $chargeId, - ?int $page = null, - ?int $size = null -): ListChargeTransactionsResponse + ?CreateCaptureChargeRequest $request = null, + ?string $idempotencyKey = null +): GetChargeResponse ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `chargeId` | `string` | Template, Required | Charge Id | -| `page` | `?int` | Query, Optional | Page number | -| `size` | `?int` | Query, Optional | Page size | +| `chargeId` | `string` | Template, Required | Charge id | +| `request` | [`?CreateCaptureChargeRequest`](../../doc/models/create-capture-charge-request.md) | Body, Optional | Request for capturing a charge | +| `idempotencyKey` | `?string` | Header, Optional | - | ## Response Type -[`ListChargeTransactionsResponse`](../../doc/models/list-charge-transactions-response.md) +[`GetChargeResponse`](../../doc/models/get-charge-response.md) ## Example Usage ```php $chargeId = 'charge_id8'; -$result = $chargesController->getChargeTransactions($chargeId); +$result = $chargesController->captureCharge($chargeId); ``` -# Capture Charge +# Update Charge Card -Captures a charge +Updates the card from a charge ```php -function captureCharge( +function updateChargeCard( string $chargeId, - ?CreateCaptureChargeRequest $request = null, + UpdateChargeCardRequest $request, ?string $idempotencyKey = null ): GetChargeResponse ``` @@ -306,7 +310,7 @@ function 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` | [`UpdateChargeCardRequest`](../../doc/models/update-charge-card-request.md) | Body, Required | Request for updating a charge's card | | `idempotencyKey` | `?string` | Header, Optional | - | ## Response Type @@ -318,7 +322,19 @@ function captureCharge( ```php $chargeId = 'charge_id8'; -$result = $chargesController->captureCharge($chargeId); +$request = UpdateChargeCardRequestBuilder::init( + false, + 'card_id2', + CreateCardRequestBuilder::init() + ->type('credit') + ->build(), + false +)->build(); + +$result = $chargesController->updateChargeCard( + $chargeId, + $request +); ``` @@ -349,88 +365,73 @@ $result = $chargesController->getCharge($chargeId); ``` -# Cancel Charge - -Cancel a charge +# Get Charges Summary ```php -function cancelCharge( - string $chargeId, - ?CreateCancelChargeRequest $request = null, - ?string $idempotencyKey = null -): GetChargeResponse +function getChargesSummary( + string $status, + ?\DateTime $createdSince = null, + ?\DateTime $createdUntil = null +): GetChargesSummaryResponse ``` ## Parameters | 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 | - | +| `status` | `string` | Query, Required | - | +| `createdSince` | `?DateTime` | Query, Optional | - | +| `createdUntil` | `?DateTime` | Query, Optional | - | ## Response Type -[`GetChargeResponse`](../../doc/models/get-charge-response.md) +[`GetChargesSummaryResponse`](../../doc/models/get-charges-summary-response.md) ## Example Usage ```php -$chargeId = 'charge_id8'; +$status = 'status8'; -$result = $chargesController->cancelCharge($chargeId); +$result = $chargesController->getChargesSummary($status); ``` -# Get Charges +# Retry Charge -Lists all charges +Retries a charge ```php -function getCharges( - ?int $page = null, - ?int $size = null, - ?string $code = null, - ?string $status = null, - ?string $paymentMethod = null, - ?string $customerId = null, - ?string $orderId = null, - ?\DateTime $createdSince = null, - ?\DateTime $createdUntil = null -): ListChargesResponse +function retryCharge(string $chargeId, ?string $idempotencyKey = null): GetChargeResponse ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `page` | `?int` | Query, Optional | Page number | -| `size` | `?int` | 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` | `?DateTime` | Query, Optional | Filter for the beginning of the range for charge's creation | -| `createdUntil` | `?DateTime` | Query, Optional | Filter for the end of the range for charge's creation | +| `chargeId` | `string` | Template, Required | Charge id | +| `idempotencyKey` | `?string` | Header, Optional | - | ## Response Type -[`ListChargesResponse`](../../doc/models/list-charges-response.md) +[`GetChargeResponse`](../../doc/models/get-charge-response.md) ## Example Usage ```php -$result = $chargesController->getCharges(); +$chargeId = 'charge_id8'; + +$result = $chargesController->retryCharge($chargeId); ``` -# Confirm Payment +# Cancel Charge + +Cancel a charge ```php -function confirmPayment( +function cancelCharge( string $chargeId, - ?CreateConfirmPaymentRequest $request = null, + ?CreateCancelChargeRequest $request = null, ?string $idempotencyKey = null ): GetChargeResponse ``` @@ -439,8 +440,8 @@ function 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` | [`?CreateCancelChargeRequest`](../../doc/models/create-cancel-charge-request.md) | Body, Optional | Request for cancelling a charge | | `idempotencyKey` | `?string` | Header, Optional | - | ## Response Type @@ -452,28 +453,23 @@ function confirmPayment( ```php $chargeId = 'charge_id8'; -$result = $chargesController->confirmPayment($chargeId); +$result = $chargesController->cancelCharge($chargeId); ``` -# Update Charge Due Date +# Create Charge -Updates the due date from a charge +Creates a new charge ```php -function updateChargeDueDate( - string $chargeId, - UpdateChargeDueDateRequest $request, - ?string $idempotencyKey = null -): GetChargeResponse +function createCharge(CreateChargeRequest $request, ?string $idempotencyKey = null): GetChargeResponse ``` ## 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 | +| `request` | [`CreateChargeRequest`](../../doc/models/create-charge-request.md) | Body, Required | Request for creating a charge | | `idempotencyKey` | `?string` | Header, Optional | - | ## Response Type @@ -483,30 +479,34 @@ function updateChargeDueDate( ## Example Usage ```php -$chargeId = 'charge_id8'; - -$request = UpdateChargeDueDateRequestBuilder::init()->build(); +$request = CreateChargeRequestBuilder::init( + 242, + CreatePaymentRequestBuilder::init( + 'payment_method4' + )->build(), + 'order_id0' +)->build(); -$result = $chargesController->updateChargeDueDate( - $chargeId, - $request -); +$result = $chargesController->createCharge($request); ``` -# Retry Charge - -Retries a charge +# Confirm Payment ```php -function retryCharge(string $chargeId, ?string $idempotencyKey = null): GetChargeResponse +function confirmPayment( + string $chargeId, + ?CreateConfirmPaymentRequest $request = null, + ?string $idempotencyKey = null +): GetChargeResponse ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `chargeId` | `string` | Template, Required | Charge id | +| `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 @@ -518,6 +518,6 @@ function retryCharge(string $chargeId, ?string $idempotencyKey = null): GetCharg ```php $chargeId = 'charge_id8'; -$result = $chargesController->retryCharge($chargeId); +$result = $chargesController->confirmPayment($chargeId); ``` diff --git a/doc/controllers/customers.md b/doc/controllers/customers.md index 25d6651..e6c9872 100644 --- a/doc/controllers/customers.md +++ b/doc/controllers/customers.md @@ -13,24 +13,24 @@ $customersController = $client->getCustomersController(); * [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 Address](../../doc/controllers/customers.md#create-address) * [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) +* [Get Address](../../doc/controllers/customers.md#get-address) +* [Delete Address](../../doc/controllers/customers.md#delete-address) * [Create Card](../../doc/controllers/customers.md#create-card) +* [Get Customers](../../doc/controllers/customers.md#get-customers) +* [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 Address](../../doc/controllers/customers.md#get-address) -* [Delete Address](../../doc/controllers/customers.md#delete-address) * [Get Access Token](../../doc/controllers/customers.md#get-access-token) * [Update Customer Metadata](../../doc/controllers/customers.md#update-customer-metadata) -* [Get Card](../../doc/controllers/customers.md#get-card) -* [Delete Access Tokens](../../doc/controllers/customers.md#delete-access-tokens) -* [Create Access Token](../../doc/controllers/customers.md#create-access-token) -* [Get Access Tokens](../../doc/controllers/customers.md#get-access-tokens) -* [Get Customers](../../doc/controllers/customers.md#get-customers) -* [Update Customer](../../doc/controllers/customers.md#update-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) # Update Card @@ -184,55 +184,6 @@ $result = $customersController->deleteAccessToken( ``` -# Create Address - -Creates a new address for a customer - -```php -function createAddress( - string $customerId, - CreateAddressRequest $request, - ?string $idempotencyKey = null -): GetAddressResponse -``` - -## Parameters - -| 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 - -[`GetAddressResponse`](../../doc/models/get-address-response.md) - -## Example Usage - -```php -$customerId = 'customer_id8'; - -$request = CreateAddressRequestBuilder::init( - 'street6', - 'number4', - 'zip_code0', - 'neighborhood2', - 'city6', - 'state2', - 'country0', - 'complement2', - 'line_10', - 'line_24' -)->build(); - -$result = $customersController->createAddress( - $customerId, - $request -); -``` - - # Create Customer Creates a new customer @@ -285,52 +236,61 @@ $result = $customersController->createCustomer($request); ``` -# Create Card +# Create Address -Creates a new card for a customer +Creates a new address for a customer ```php -function createCard( +function createAddress( string $customerId, - CreateCardRequest $request, + CreateAddressRequest $request, ?string $idempotencyKey = null -): GetCardResponse +): GetAddressResponse ``` ## 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 | +| `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 -[`GetCardResponse`](../../doc/models/get-card-response.md) +[`GetAddressResponse`](../../doc/models/get-address-response.md) ## Example Usage ```php $customerId = 'customer_id8'; -$request = CreateCardRequestBuilder::init() - ->type('credit') - ->build(); +$request = CreateAddressRequestBuilder::init( + 'street6', + 'number4', + 'zip_code0', + 'neighborhood2', + 'city6', + 'state2', + 'country0', + 'complement2', + 'line_10', + 'line_24' +)->build(); -$result = $customersController->createCard( +$result = $customersController->createAddress( $customerId, $request ); ``` -# Get Cards +# Delete Access Tokens -Get all cards from a customer +Delete a Customer's access tokens ```php -function getCards(string $customerId, ?int $page = null, ?int $size = null): ListCardsResponse +function deleteAccessTokens(string $customerId): ListAccessTokensResponse ``` ## Parameters @@ -338,28 +298,26 @@ function getCards(string $customerId, ?int $page = null, ?int $size = null): Lis | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `customerId` | `string` | Template, Required | Customer Id | -| `page` | `?int` | Query, Optional | Page number | -| `size` | `?int` | Query, Optional | Page size | ## Response Type -[`ListCardsResponse`](../../doc/models/list-cards-response.md) +[`ListAccessTokensResponse`](../../doc/models/list-access-tokens-response.md) ## Example Usage ```php $customerId = 'customer_id8'; -$result = $customersController->getCards($customerId); +$result = $customersController->deleteAccessTokens($customerId); ``` -# Renew Card +# Get Address -Renew a card +Get a customer's address ```php -function renewCard(string $customerId, string $cardId, ?string $idempotencyKey = null): GetCardResponse +function getAddress(string $customerId, string $addressId): GetAddressResponse ``` ## Parameters @@ -367,41 +325,45 @@ function renewCard(string $customerId, string $cardId, ?string $idempotencyKey = | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `customerId` | `string` | Template, Required | Customer id | -| `cardId` | `string` | Template, Required | Card Id | -| `idempotencyKey` | `?string` | Header, Optional | - | +| `addressId` | `string` | Template, Required | Address Id | ## Response Type -[`GetCardResponse`](../../doc/models/get-card-response.md) +[`GetAddressResponse`](../../doc/models/get-address-response.md) ## Example Usage ```php $customerId = 'customer_id8'; -$cardId = 'card_id4'; +$addressId = 'address_id0'; -$result = $customersController->renewCard( +$result = $customersController->getAddress( $customerId, - $cardId + $addressId ); ``` -# Get Address +# Delete Address -Get a customer's address +Delete a Customer's address ```php -function getAddress(string $customerId, string $addressId): GetAddressResponse +function deleteAddress( + string $customerId, + string $addressId, + ?string $idempotencyKey = null +): GetAddressResponse ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `customerId` | `string` | Template, Required | Customer id | +| `customerId` | `string` | Template, Required | Customer Id | | `addressId` | `string` | Template, Required | Address Id | +| `idempotencyKey` | `?string` | Header, Optional | - | ## Response Type @@ -414,92 +376,107 @@ $customerId = 'customer_id8'; $addressId = 'address_id0'; -$result = $customersController->getAddress( +$result = $customersController->deleteAddress( $customerId, $addressId ); ``` -# Delete Address +# Create Card -Delete a Customer's address +Creates a new card for a customer ```php -function deleteAddress( +function createCard( string $customerId, - string $addressId, + CreateCardRequest $request, ?string $idempotencyKey = null -): GetAddressResponse +): GetCardResponse ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `customerId` | `string` | Template, Required | Customer Id | -| `addressId` | `string` | Template, Required | Address Id | +| `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 -[`GetAddressResponse`](../../doc/models/get-address-response.md) +[`GetCardResponse`](../../doc/models/get-card-response.md) ## Example Usage ```php $customerId = 'customer_id8'; -$addressId = 'address_id0'; +$request = CreateCardRequestBuilder::init() + ->type('credit') + ->build(); -$result = $customersController->deleteAddress( +$result = $customersController->createCard( $customerId, - $addressId + $request ); ``` -# Get Access Token +# Get Customers -Get a Customer's access token +Get all Customers ```php -function getAccessToken(string $customerId, string $tokenId): GetAccessTokenResponse +function getCustomers( + ?string $name = null, + ?string $document = null, + ?int $page = 1, + ?int $size = 10, + ?string $email = null, + ?string $code = null +): ListCustomersResponse ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `customerId` | `string` | Template, Required | Customer Id | -| `tokenId` | `string` | Template, Required | Token Id | +| `name` | `?string` | Query, Optional | Name of the Customer | +| `document` | `?string` | Query, Optional | Document of the Customer | +| `page` | `?int` | Query, Optional | Current page the the search | +| `size` | `?int` | Query, Optional | Quantity pages of the search | +| `email` | `?string` | Query, Optional | Customer's email | +| `code` | `?string` | Query, Optional | Customer's code | ## Response Type -[`GetAccessTokenResponse`](../../doc/models/get-access-token-response.md) +[`ListCustomersResponse`](../../doc/models/list-customers-response.md) ## Example Usage ```php -$customerId = 'customer_id8'; +$page = 1; -$tokenId = 'token_id6'; +$size = 10; -$result = $customersController->getAccessToken( - $customerId, - $tokenId +$result = $customersController->getCustomers( + null, + null, + $page, + $size ); ``` -# Update Customer Metadata +# Update Customer -Updates the metadata a customer +Updates a customer ```php -function updateCustomerMetadata( +function updateCustomer( string $customerId, - UpdateMetadataRequest $request, + UpdateCustomerRequest $request, ?string $idempotencyKey = null ): GetCustomerResponse ``` @@ -508,8 +485,8 @@ function updateCustomerMetadata( | 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 | +| `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 @@ -521,58 +498,59 @@ function updateCustomerMetadata( ```php $customerId = 'customer_id8'; -$request = UpdateMetadataRequestBuilder::init( - [ - 'key0' => 'metadata3' - ] -)->build(); +$request = UpdateCustomerRequestBuilder::init()->build(); -$result = $customersController->updateCustomerMetadata( +$result = $customersController->updateCustomer( $customerId, $request ); ``` -# Get Card +# Create Access Token -Get a customer's card +Creates a access token for a customer ```php -function getCard(string $customerId, string $cardId): GetCardResponse +function createAccessToken( + string $customerId, + CreateAccessTokenRequest $request, + ?string $idempotencyKey = null +): GetAccessTokenResponse ``` ## 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 ```php $customerId = 'customer_id8'; -$cardId = 'card_id4'; +$request = CreateAccessTokenRequestBuilder::init()->build(); -$result = $customersController->getCard( +$result = $customersController->createAccessToken( $customerId, - $cardId + $request ); ``` -# Delete Access Tokens +# Get Access Tokens -Delete a Customer's access tokens +Get all access tokens from a customer ```php -function deleteAccessTokens(string $customerId): ListAccessTokensResponse +function getAccessTokens(string $customerId, ?int $page = null, ?int $size = null): ListAccessTokensResponse ``` ## Parameters @@ -580,6 +558,8 @@ function deleteAccessTokens(string $customerId): ListAccessTokensResponse | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `customerId` | `string` | Template, Required | Customer Id | +| `page` | `?int` | Query, Optional | Page number | +| `size` | `?int` | Query, Optional | Page size | ## Response Type @@ -590,20 +570,16 @@ function deleteAccessTokens(string $customerId): ListAccessTokensResponse ```php $customerId = 'customer_id8'; -$result = $customersController->deleteAccessTokens($customerId); +$result = $customersController->getAccessTokens($customerId); ``` -# Create Access Token +# Get Cards -Creates a access token for a customer +Get all cards from a customer ```php -function createAccessToken( - string $customerId, - CreateAccessTokenRequest $request, - ?string $idempotencyKey = null -): GetAccessTokenResponse +function getCards(string $customerId, ?int $page = null, ?int $size = null): ListCardsResponse ``` ## Parameters @@ -611,110 +587,97 @@ function 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 | -| `idempotencyKey` | `?string` | Header, Optional | - | +| `page` | `?int` | Query, Optional | Page number | +| `size` | `?int` | Query, Optional | Page size | ## Response Type -[`GetAccessTokenResponse`](../../doc/models/get-access-token-response.md) +[`ListCardsResponse`](../../doc/models/list-cards-response.md) ## Example Usage ```php $customerId = 'customer_id8'; -$request = CreateAccessTokenRequestBuilder::init()->build(); - -$result = $customersController->createAccessToken( - $customerId, - $request -); +$result = $customersController->getCards($customerId); ``` -# Get Access Tokens +# Renew Card -Get all access tokens from a customer +Renew a card ```php -function getAccessTokens(string $customerId, ?int $page = null, ?int $size = null): ListAccessTokensResponse +function renewCard(string $customerId, string $cardId, ?string $idempotencyKey = null): GetCardResponse ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `customerId` | `string` | Template, Required | Customer Id | -| `page` | `?int` | Query, Optional | Page number | -| `size` | `?int` | Query, Optional | Page size | +| `customerId` | `string` | Template, Required | Customer id | +| `cardId` | `string` | Template, Required | Card Id | +| `idempotencyKey` | `?string` | Header, Optional | - | ## Response Type -[`ListAccessTokensResponse`](../../doc/models/list-access-tokens-response.md) +[`GetCardResponse`](../../doc/models/get-card-response.md) ## Example Usage ```php $customerId = 'customer_id8'; -$result = $customersController->getAccessTokens($customerId); +$cardId = 'card_id4'; + +$result = $customersController->renewCard( + $customerId, + $cardId +); ``` -# Get Customers +# Get Access Token -Get all Customers +Get a Customer's access token ```php -function getCustomers( - ?string $name = null, - ?string $document = null, - ?int $page = 1, - ?int $size = 10, - ?string $email = null, - ?string $code = null -): ListCustomersResponse +function getAccessToken(string $customerId, string $tokenId): GetAccessTokenResponse ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `name` | `?string` | Query, Optional | Name of the Customer | -| `document` | `?string` | Query, Optional | Document of the Customer | -| `page` | `?int` | Query, Optional | Current page the the search | -| `size` | `?int` | 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 | +| `tokenId` | `string` | Template, Required | Token Id | ## Response Type -[`ListCustomersResponse`](../../doc/models/list-customers-response.md) +[`GetAccessTokenResponse`](../../doc/models/get-access-token-response.md) ## Example Usage ```php -$page = 1; +$customerId = 'customer_id8'; -$size = 10; +$tokenId = 'token_id6'; -$result = $customersController->getCustomers( - null, - null, - $page, - $size +$result = $customersController->getAccessToken( + $customerId, + $tokenId ); ``` -# Update Customer +# Update Customer Metadata -Updates a customer +Updates the metadata a customer ```php -function updateCustomer( +function updateCustomerMetadata( string $customerId, - UpdateCustomerRequest $request, + UpdateMetadataRequest $request, ?string $idempotencyKey = null ): GetCustomerResponse ``` @@ -723,8 +686,8 @@ function updateCustomer( | 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 | +| `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 @@ -736,9 +699,13 @@ function updateCustomer( ```php $customerId = 'customer_id8'; -$request = UpdateCustomerRequestBuilder::init()->build(); +$request = UpdateMetadataRequestBuilder::init( + [ + 'key0' => 'metadata3' + ] +)->build(); -$result = $customersController->updateCustomer( +$result = $customersController->updateCustomerMetadata( $customerId, $request ); @@ -834,3 +801,36 @@ $customerId = 'customer_id8'; $result = $customersController->getCustomer($customerId); ``` + +# Get Card + +Get a customer's card + +```php +function getCard(string $customerId, string $cardId): GetCardResponse +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `customerId` | `string` | Template, Required | Customer id | +| `cardId` | `string` | Template, Required | Card id | + +## Response Type + +[`GetCardResponse`](../../doc/models/get-card-response.md) + +## Example Usage + +```php +$customerId = 'customer_id8'; + +$cardId = 'card_id4'; + +$result = $customersController->getCard( + $customerId, + $cardId +); +``` + diff --git a/doc/controllers/invoices.md b/doc/controllers/invoices.md index 147c228..4400978 100644 --- a/doc/controllers/invoices.md +++ b/doc/controllers/invoices.md @@ -10,24 +10,23 @@ $invoicesController = $client->getInvoicesController(); ## Methods -* [Create Invoice](../../doc/controllers/invoices.md#create-invoice) -* [Get Invoices](../../doc/controllers/invoices.md#get-invoices) -* [Cancel Invoice](../../doc/controllers/invoices.md#cancel-invoice) * [Update Invoice Metadata](../../doc/controllers/invoices.md#update-invoice-metadata) * [Get Partial Invoice](../../doc/controllers/invoices.md#get-partial-invoice) -* [Update Invoice Status](../../doc/controllers/invoices.md#update-invoice-status) +* [Cancel Invoice](../../doc/controllers/invoices.md#cancel-invoice) +* [Create Invoice](../../doc/controllers/invoices.md#create-invoice) +* [Get Invoices](../../doc/controllers/invoices.md#get-invoices) * [Get Invoice](../../doc/controllers/invoices.md#get-invoice) +* [Update Invoice Status](../../doc/controllers/invoices.md#update-invoice-status) -# Create Invoice +# Update Invoice Metadata -Create an Invoice +Updates the metadata from an invoice ```php -function createInvoice( - string $subscriptionId, - string $cycleId, - ?CreateInvoiceRequest $request = null, +function updateInvoiceMetadata( + string $invoiceId, + UpdateMetadataRequest $request, ?string $idempotencyKey = null ): GetInvoiceResponse ``` @@ -36,9 +35,8 @@ function createInvoice( | 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 | - | +| `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 @@ -48,61 +46,43 @@ function createInvoice( ## Example Usage ```php -$subscriptionId = 'subscription_id0'; +$invoiceId = 'invoice_id0'; -$cycleId = 'cycle_id6'; +$request = UpdateMetadataRequestBuilder::init( + [ + 'key0' => 'metadata3' + ] +)->build(); -$result = $invoicesController->createInvoice( - $subscriptionId, - $cycleId +$result = $invoicesController->updateInvoiceMetadata( + $invoiceId, + $request ); ``` -# Get Invoices - -Gets all invoices +# Get Partial Invoice ```php -function getInvoices( - ?int $page = null, - ?int $size = null, - ?string $code = null, - ?string $customerId = null, - ?string $subscriptionId = null, - ?\DateTime $createdSince = null, - ?\DateTime $createdUntil = null, - ?string $status = null, - ?\DateTime $dueSince = null, - ?\DateTime $dueUntil = null, - ?string $customerDocument = null -): ListInvoicesResponse +function getPartialInvoice(string $subscriptionId): GetInvoiceResponse ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `page` | `?int` | Query, Optional | Page number | -| `size` | `?int` | 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` | `?DateTime` | Query, Optional | Filter for Invoice's creation date start range | -| `createdUntil` | `?DateTime` | Query, Optional | Filter for Invoices creation date end range | -| `status` | `?string` | Query, Optional | Filter for Invoice's status | -| `dueSince` | `?DateTime` | Query, Optional | Filter for Invoice's due date start range | -| `dueUntil` | `?DateTime` | Query, Optional | Filter for Invoice's due date end range | -| `customerDocument` | `?string` | Query, Optional | - | +| `subscriptionId` | `string` | Template, Required | Subscription Id | ## Response Type -[`ListInvoicesResponse`](../../doc/models/list-invoices-response.md) +[`GetInvoiceResponse`](../../doc/models/get-invoice-response.md) ## Example Usage ```php -$result = $invoicesController->getInvoices(); +$subscriptionId = 'subscription_id0'; + +$result = $invoicesController->getPartialInvoice($subscriptionId); ``` @@ -134,14 +114,15 @@ $result = $invoicesController->cancelInvoice($invoiceId); ``` -# Update Invoice Metadata +# Create Invoice -Updates the metadata from an invoice +Create an Invoice ```php -function updateInvoiceMetadata( - string $invoiceId, - UpdateMetadataRequest $request, +function createInvoice( + string $subscriptionId, + string $cycleId, + ?CreateInvoiceRequest $request = null, ?string $idempotencyKey = null ): GetInvoiceResponse ``` @@ -150,8 +131,9 @@ function 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 @@ -161,56 +143,70 @@ function updateInvoiceMetadata( ## Example Usage ```php -$invoiceId = 'invoice_id0'; +$subscriptionId = 'subscription_id0'; -$request = UpdateMetadataRequestBuilder::init( - [ - 'key0' => 'metadata3' - ] -)->build(); +$cycleId = 'cycle_id6'; -$result = $invoicesController->updateInvoiceMetadata( - $invoiceId, - $request +$result = $invoicesController->createInvoice( + $subscriptionId, + $cycleId ); ``` -# Get Partial Invoice +# Get Invoices + +Gets all invoices ```php -function getPartialInvoice(string $subscriptionId): GetInvoiceResponse +function getInvoices( + ?int $page = null, + ?int $size = null, + ?string $code = null, + ?string $customerId = null, + ?string $subscriptionId = null, + ?\DateTime $createdSince = null, + ?\DateTime $createdUntil = null, + ?string $status = null, + ?\DateTime $dueSince = null, + ?\DateTime $dueUntil = null, + ?string $customerDocument = null +): ListInvoicesResponse ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `string` | Template, Required | Subscription Id | +| `page` | `?int` | Query, Optional | Page number | +| `size` | `?int` | 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` | `?DateTime` | Query, Optional | Filter for Invoice's creation date start range | +| `createdUntil` | `?DateTime` | Query, Optional | Filter for Invoices creation date end range | +| `status` | `?string` | Query, Optional | Filter for Invoice's status | +| `dueSince` | `?DateTime` | Query, Optional | Filter for Invoice's due date start range | +| `dueUntil` | `?DateTime` | 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 ```php -$subscriptionId = 'subscription_id0'; - -$result = $invoicesController->getPartialInvoice($subscriptionId); +$result = $invoicesController->getInvoices(); ``` -# Update Invoice Status +# Get Invoice -Updates the status from an invoice +Gets an invoice ```php -function updateInvoiceStatus( - string $invoiceId, - UpdateInvoiceStatusRequest $request, - ?string $idempotencyKey = null -): GetInvoiceResponse +function getInvoice(string $invoiceId): GetInvoiceResponse ``` ## Parameters @@ -218,8 +214,6 @@ function 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 | -| `idempotencyKey` | `?string` | Header, Optional | - | ## Response Type @@ -230,23 +224,20 @@ function updateInvoiceStatus( ```php $invoiceId = 'invoice_id0'; -$request = UpdateInvoiceStatusRequestBuilder::init( - 'status8' -)->build(); - -$result = $invoicesController->updateInvoiceStatus( - $invoiceId, - $request -); +$result = $invoicesController->getInvoice($invoiceId); ``` -# Get Invoice +# Update Invoice Status -Gets an invoice +Updates the status from an invoice ```php -function getInvoice(string $invoiceId): GetInvoiceResponse +function updateInvoiceStatus( + string $invoiceId, + UpdateInvoiceStatusRequest $request, + ?string $idempotencyKey = null +): GetInvoiceResponse ``` ## Parameters @@ -254,6 +245,8 @@ function getInvoice(string $invoiceId): GetInvoiceResponse | 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 @@ -264,6 +257,13 @@ function getInvoice(string $invoiceId): GetInvoiceResponse ```php $invoiceId = 'invoice_id0'; -$result = $invoicesController->getInvoice($invoiceId); +$request = UpdateInvoiceStatusRequestBuilder::init( + 'status8' +)->build(); + +$result = $invoicesController->updateInvoiceStatus( + $invoiceId, + $request +); ``` diff --git a/doc/controllers/orders.md b/doc/controllers/orders.md index 9becc00..17c7232 100644 --- a/doc/controllers/orders.md +++ b/doc/controllers/orders.md @@ -11,15 +11,15 @@ $ordersController = $client->getOrdersController(); ## Methods * [Get Orders](../../doc/controllers/orders.md#get-orders) -* [Get Order Item](../../doc/controllers/orders.md#get-order-item) -* [Get Order](../../doc/controllers/orders.md#get-order) -* [Close Order](../../doc/controllers/orders.md#close-order) -* [Create Order](../../doc/controllers/orders.md#create-order) * [Update Order Item](../../doc/controllers/orders.md#update-order-item) * [Delete All Order Items](../../doc/controllers/orders.md#delete-all-order-items) -* [Update Order Metadata](../../doc/controllers/orders.md#update-order-metadata) * [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) +* [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) # Get Orders @@ -61,10 +61,15 @@ $result = $ordersController->getOrders(); ``` -# Get Order Item +# Update Order Item ```php -function getOrderItem(string $orderId, string $itemId): GetOrderItemResponse +function updateOrderItem( + string $orderId, + string $itemId, + UpdateOrderItemRequest $request, + ?string $idempotencyKey = null +): GetOrderItemResponse ``` ## Parameters @@ -73,6 +78,8 @@ function getOrderItem(string $orderId, string $itemId): GetOrderItemResponse | --- | --- | --- | --- | | `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 @@ -85,26 +92,33 @@ $orderId = 'orderId2'; $itemId = 'itemId8'; -$result = $ordersController->getOrderItem( +$request = UpdateOrderItemRequestBuilder::init( + 242, + 'description6', + 100, + 'category4' +)->build(); + +$result = $ordersController->updateOrderItem( $orderId, - $itemId + $itemId, + $request ); ``` -# Get Order - -Gets an order +# Delete All Order Items ```php -function getOrder(string $orderId): GetOrderResponse +function deleteAllOrderItems(string $orderId, ?string $idempotencyKey = null): GetOrderResponse ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `orderId` | `string` | Template, Required | Order id | +| `orderId` | `string` | Template, Required | Order Id | +| `idempotencyKey` | `?string` | Header, Optional | - | ## Response Type @@ -113,9 +127,41 @@ function getOrder(string $orderId): GetOrderResponse ## Example Usage ```php -$orderId = 'order_id6'; +$orderId = 'orderId2'; -$result = $ordersController->getOrder($orderId); +$result = $ordersController->deleteAllOrderItems($orderId); +``` + + +# Delete Order Item + +```php +function deleteOrderItem(string $orderId, string $itemId, ?string $idempotencyKey = null): GetOrderItemResponse +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `orderId` | `string` | Template, Required | Order Id | +| `itemId` | `string` | Template, Required | Item Id | +| `idempotencyKey` | `?string` | Header, Optional | - | + +## Response Type + +[`GetOrderItemResponse`](../../doc/models/get-order-item-response.md) + +## Example Usage + +```php +$orderId = 'orderId2'; + +$itemId = 'itemId8'; + +$result = $ordersController->deleteOrderItem( + $orderId, + $itemId +); ``` @@ -226,13 +272,12 @@ $result = $ordersController->createOrder($body); ``` -# Update Order Item +# Create Order Item ```php -function updateOrderItem( +function createOrderItem( string $orderId, - string $itemId, - UpdateOrderItemRequest $request, + CreateOrderItemRequest $request, ?string $idempotencyKey = null ): GetOrderItemResponse ``` @@ -242,8 +287,7 @@ function 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 @@ -255,27 +299,24 @@ function updateOrderItem( ```php $orderId = 'orderId2'; -$itemId = 'itemId8'; - -$request = UpdateOrderItemRequestBuilder::init( +$request = CreateOrderItemRequestBuilder::init( 242, 'description6', 100, 'category4' )->build(); -$result = $ordersController->updateOrderItem( +$result = $ordersController->createOrderItem( $orderId, - $itemId, $request ); ``` -# Delete All Order Items +# Get Order Item ```php -function deleteAllOrderItems(string $orderId, ?string $idempotencyKey = null): GetOrderResponse +function getOrderItem(string $orderId, string $itemId): GetOrderItemResponse ``` ## Parameters @@ -283,18 +324,23 @@ function deleteAllOrderItems(string $orderId, ?string $idempotencyKey = null): G | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `orderId` | `string` | Template, Required | Order Id | -| `idempotencyKey` | `?string` | Header, Optional | - | +| `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 ```php $orderId = 'orderId2'; -$result = $ordersController->deleteAllOrderItems($orderId); +$itemId = 'itemId8'; + +$result = $ordersController->getOrderItem( + $orderId, + $itemId +); ``` @@ -340,75 +386,29 @@ $result = $ordersController->updateOrderMetadata( ``` -# Delete Order Item - -```php -function deleteOrderItem(string $orderId, string $itemId, ?string $idempotencyKey = null): GetOrderItemResponse -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `orderId` | `string` | Template, Required | Order Id | -| `itemId` | `string` | Template, Required | Item Id | -| `idempotencyKey` | `?string` | Header, Optional | - | - -## Response Type - -[`GetOrderItemResponse`](../../doc/models/get-order-item-response.md) - -## Example Usage - -```php -$orderId = 'orderId2'; - -$itemId = 'itemId8'; - -$result = $ordersController->deleteOrderItem( - $orderId, - $itemId -); -``` - +# Get Order -# Create Order Item +Gets an order ```php -function createOrderItem( - string $orderId, - CreateOrderItemRequest $request, - ?string $idempotencyKey = null -): GetOrderItemResponse +function getOrder(string $orderId): GetOrderResponse ``` ## 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 ```php -$orderId = 'orderId2'; - -$request = CreateOrderItemRequestBuilder::init( - 242, - 'description6', - 100, - 'category4' -)->build(); +$orderId = 'order_id6'; -$result = $ordersController->createOrderItem( - $orderId, - $request -); +$result = $ordersController->getOrder($orderId); ``` diff --git a/doc/controllers/plans.md b/doc/controllers/plans.md index ac39fcc..f2be784 100644 --- a/doc/controllers/plans.md +++ b/doc/controllers/plans.md @@ -11,15 +11,15 @@ $plansController = $client->getPlansController(); ## Methods * [Get Plan](../../doc/controllers/plans.md#get-plan) -* [Update Plan](../../doc/controllers/plans.md#update-plan) -* [Update Plan Metadata](../../doc/controllers/plans.md#update-plan-metadata) -* [Delete Plan Item](../../doc/controllers/plans.md#delete-plan-item) -* [Get Plans](../../doc/controllers/plans.md#get-plans) -* [Get Plan Item](../../doc/controllers/plans.md#get-plan-item) * [Delete Plan](../../doc/controllers/plans.md#delete-plan) +* [Update Plan Metadata](../../doc/controllers/plans.md#update-plan-metadata) * [Update Plan Item](../../doc/controllers/plans.md#update-plan-item) * [Create Plan Item](../../doc/controllers/plans.md#create-plan-item) +* [Get Plan Item](../../doc/controllers/plans.md#get-plan-item) * [Create Plan](../../doc/controllers/plans.md#create-plan) +* [Delete Plan Item](../../doc/controllers/plans.md#delete-plan-item) +* [Get Plans](../../doc/controllers/plans.md#get-plans) +* [Update Plan](../../doc/controllers/plans.md#update-plan) # Get Plan @@ -49,12 +49,12 @@ $result = $plansController->getPlan($planId); ``` -# Update Plan +# Delete Plan -Updates a plan +Deletes a plan ```php -function updatePlan(string $planId, UpdatePlanRequest $request, ?string $idempotencyKey = null): GetPlanResponse +function deletePlan(string $planId, ?string $idempotencyKey = null): GetPlanResponse ``` ## Parameters @@ -62,7 +62,6 @@ function updatePlan(string $planId, UpdatePlanRequest $request, ?string $idempot | 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 | | `idempotencyKey` | `?string` | Header, Optional | - | ## Response Type @@ -74,37 +73,7 @@ function updatePlan(string $planId, UpdatePlanRequest $request, ?string $idempot ```php $planId = 'plan_id8'; -$request = UpdatePlanRequestBuilder::init( - 'name6', - 'description6', - [ - 151, - 152 - ], - 'statement_descriptor6', - 'currency6', - 'interval4', - 114, - [ - 'payment_methods1', - 'payment_methods0', - 'payment_methods9' - ], - 'billing_type0', - 'status8', - false, - [ - 115 - ], - [ - 'key0' => 'metadata3' - ] -)->build(); - -$result = $plansController->updatePlan( - $planId, - $request -); +$result = $plansController->deletePlan($planId); ``` @@ -150,12 +119,17 @@ $result = $plansController->updatePlanMetadata( ``` -# Delete Plan Item +# Update Plan Item -Removes an item from a plan +Updates a plan item ```php -function deletePlanItem(string $planId, string $planItemId, ?string $idempotencyKey = null): GetPlanItemResponse +function updatePlanItem( + string $planId, + string $planItemId, + UpdatePlanItemRequest $body, + ?string $idempotencyKey = null +): GetPlanItemResponse ``` ## Parameters @@ -164,6 +138,7 @@ function deletePlanItem(string $planId, string $planItemId, ?string $idempotency | --- | --- | --- | --- | | `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 @@ -177,49 +152,71 @@ $planId = 'plan_id8'; $planItemId = 'plan_item_id0'; -$result = $plansController->deletePlanItem( +$body = UpdatePlanItemRequestBuilder::init( + 'name6', + 'description4', + 'status2', + UpdatePricingSchemeRequestBuilder::init( + 'scheme_type8', + [ + UpdatePriceBracketRequestBuilder::init( + 144, + 174 + )->build() + ] + )->build() +)->build(); + +$result = $plansController->updatePlanItem( $planId, - $planItemId + $planItemId, + $body ); ``` -# Get Plans +# Create Plan Item -Gets all plans +Adds a new item to a plan ```php -function getPlans( - ?int $page = null, - ?int $size = null, - ?string $name = null, - ?string $status = null, - ?string $billingType = null, - ?\DateTime $createdSince = null, - ?\DateTime $createdUntil = null -): ListPlansResponse +function createPlanItem( + string $planId, + CreatePlanItemRequest $request, + ?string $idempotencyKey = null +): GetPlanItemResponse ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `page` | `?int` | Query, Optional | Page number | -| `size` | `?int` | 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` | `?DateTime` | Query, Optional | Filter for plan's creation date start range | -| `createdUntil` | `?DateTime` | Query, Optional | Filter for plan's creation date end range | +| `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 | - | ## Response Type -[`ListPlansResponse`](../../doc/models/list-plans-response.md) +[`GetPlanItemResponse`](../../doc/models/get-plan-item-response.md) ## Example Usage ```php -$result = $plansController->getPlans(); +$planId = 'plan_id8'; + +$request = CreatePlanItemRequestBuilder::init( + 'name6', + CreatePricingSchemeRequestBuilder::init( + 'scheme_type8' + )->build(), + 'id6', + 'description6' +)->build(); + +$result = $plansController->createPlanItem( + $planId, + $request +); ``` @@ -256,19 +253,19 @@ $result = $plansController->getPlanItem( ``` -# Delete Plan +# Create Plan -Deletes a plan +Creates a new plan ```php -function deletePlan(string $planId, ?string $idempotencyKey = null): GetPlanResponse +function createPlan(CreatePlanRequest $body, ?string $idempotencyKey = null): GetPlanResponse ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `planId` | `string` | Template, Required | Plan id | +| `body` | [`CreatePlanRequest`](../../doc/models/create-plan-request.md) | Body, Required | Request for creating a plan | | `idempotencyKey` | `?string` | Header, Optional | - | ## Response Type @@ -278,23 +275,54 @@ function deletePlan(string $planId, ?string $idempotencyKey = null): GetPlanResp ## Example Usage ```php -$planId = 'plan_id8'; +$body = CreatePlanRequestBuilder::init( + 'name6', + 'description4', + 'statement_descriptor6', + [ + CreatePlanItemRequestBuilder::init( + 'name8', + CreatePricingSchemeRequestBuilder::init( + 'scheme_type8' + )->build(), + 'id8', + 'description2' + )->build() + ], + false, + [ + 'payment_methods9' + ], + [ + 207 + ], + 'currency6', + 'interval6', + 170, + [ + 201, + 200 + ], + 'billing_type0', + CreatePricingSchemeRequestBuilder::init( + 'scheme_type8' + )->build(), + [ + 'key0' => 'metadata7', + 'key1' => 'metadata8' + ] +)->build(); -$result = $plansController->deletePlan($planId); +$result = $plansController->createPlan($body); ``` -# Update Plan Item +# Delete Plan Item -Updates a plan item +Removes an item from a plan ```php -function updatePlanItem( - string $planId, - string $planItemId, - UpdatePlanItemRequest $body, - ?string $idempotencyKey = null -): GetPlanItemResponse +function deletePlanItem(string $planId, string $planItemId, ?string $idempotencyKey = null): GetPlanItemResponse ``` ## Parameters @@ -303,7 +331,6 @@ function 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 @@ -317,87 +344,66 @@ $planId = 'plan_id8'; $planItemId = 'plan_item_id0'; -$body = UpdatePlanItemRequestBuilder::init( - 'name6', - 'description4', - 'status2', - UpdatePricingSchemeRequestBuilder::init( - 'scheme_type8', - [ - UpdatePriceBracketRequestBuilder::init( - 144, - 174 - )->build() - ] - )->build() -)->build(); - -$result = $plansController->updatePlanItem( +$result = $plansController->deletePlanItem( $planId, - $planItemId, - $body + $planItemId ); ``` -# Create Plan Item +# Get Plans -Adds a new item to a plan +Gets all plans ```php -function createPlanItem( - string $planId, - CreatePlanItemRequest $request, - ?string $idempotencyKey = null -): GetPlanItemResponse +function getPlans( + ?int $page = null, + ?int $size = null, + ?string $name = null, + ?string $status = null, + ?string $billingType = null, + ?\DateTime $createdSince = null, + ?\DateTime $createdUntil = null +): ListPlansResponse ``` ## 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` | `?int` | Query, Optional | Page number | +| `size` | `?int` | 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` | `?DateTime` | Query, Optional | Filter for plan's creation date start range | +| `createdUntil` | `?DateTime` | 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 ```php -$planId = 'plan_id8'; - -$request = CreatePlanItemRequestBuilder::init( - 'name6', - CreatePricingSchemeRequestBuilder::init( - 'scheme_type8' - )->build(), - 'id6', - 'description6' -)->build(); - -$result = $plansController->createPlanItem( - $planId, - $request -); +$result = $plansController->getPlans(); ``` -# Create Plan +# Update Plan -Creates a new plan +Updates a plan ```php -function createPlan(CreatePlanRequest $body, ?string $idempotencyKey = null): GetPlanResponse +function updatePlan(string $planId, UpdatePlanRequest $request, ?string $idempotencyKey = null): GetPlanResponse ``` ## Parameters | 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 | +| `request` | [`UpdatePlanRequest`](../../doc/models/update-plan-request.md) | Body, Required | Request for updating a plan | | `idempotencyKey` | `?string` | Header, Optional | - | ## Response Type @@ -407,44 +413,38 @@ function createPlan(CreatePlanRequest $body, ?string $idempotencyKey = null): Ge ## Example Usage ```php -$body = CreatePlanRequestBuilder::init( +$planId = 'plan_id8'; + +$request = UpdatePlanRequestBuilder::init( 'name6', - 'description4', - 'statement_descriptor6', + 'description6', [ - CreatePlanItemRequestBuilder::init( - 'name8', - CreatePricingSchemeRequestBuilder::init( - 'scheme_type8' - )->build(), - 'id8', - 'description2' - )->build() + 151, + 152 ], - false, + 'statement_descriptor6', + 'currency6', + 'interval4', + 114, [ + 'payment_methods1', + 'payment_methods0', 'payment_methods9' ], + 'billing_type0', + 'status8', + false, [ - 207 - ], - 'currency6', - 'interval6', - 170, - [ - 201, - 200 + 115 ], - 'billing_type0', - CreatePricingSchemeRequestBuilder::init( - 'scheme_type8' - )->build(), [ - 'key0' => 'metadata7', - 'key1' => 'metadata8' + 'key0' => 'metadata3' ] )->build(); -$result = $plansController->createPlan($body); +$result = $plansController->updatePlan( + $planId, + $request +); ``` diff --git a/doc/controllers/recipients.md b/doc/controllers/recipients.md index 301562a..52891c5 100644 --- a/doc/controllers/recipients.md +++ b/doc/controllers/recipients.md @@ -14,21 +14,21 @@ $recipientsController = $client->getRecipientsController(); * [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 Anticipations](../../doc/controllers/recipients.md#get-anticipations) -* [Update Recipient Default Bank Account](../../doc/controllers/recipients.md#update-recipient-default-bank-account) -* [Create Withdraw](../../doc/controllers/recipients.md#create-withdraw) +* [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) -* [Update Automatic Anticipation Settings](../../doc/controllers/recipients.md#update-automatic-anticipation-settings) -* [Get Recipient](../../doc/controllers/recipients.md#get-recipient) -* [Get Withdrawals](../../doc/controllers/recipients.md#get-withdrawals) -* [Get Withdraw by Id](../../doc/controllers/recipients.md#get-withdraw-by-id) -* [Get Transfers](../../doc/controllers/recipients.md#get-transfers) * [Get Recipient by Code](../../doc/controllers/recipients.md#get-recipient-by-code) * [Get Default Recipient](../../doc/controllers/recipients.md#get-default-recipient) @@ -189,54 +189,47 @@ $result = $recipientsController->getRecipients(); ``` -# Update Recipient Metadata - -Updates recipient metadata +# Get Withdraw by Id ```php -function updateRecipientMetadata( - string $recipientId, - UpdateMetadataRequest $request, - ?string $idempotencyKey = null -): GetRecipientResponse +function getWithdrawById(string $recipientId, string $withdrawalId): GetWithdrawResponse ``` ## 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 | - | +| `recipientId` | `string` | Template, Required | - | +| `withdrawalId` | `string` | Template, Required | - | ## Response Type -[`GetRecipientResponse`](../../doc/models/get-recipient-response.md) +[`GetWithdrawResponse`](../../doc/models/get-withdraw-response.md) ## Example Usage ```php $recipientId = 'recipient_id0'; -$request = UpdateMetadataRequestBuilder::init( - [ - 'key0' => 'metadata3' - ] -)->build(); +$withdrawalId = 'withdrawal_id2'; -$result = $recipientsController->updateRecipientMetadata( +$result = $recipientsController->getWithdrawById( $recipientId, - $request + $withdrawalId ); ``` -# Get Transfer +# Update Recipient Default Bank Account -Gets a transfer +Updates the default bank account from a recipient ```php -function getTransfer(string $recipientId, string $transferId): GetTransferResponse +function updateRecipientDefaultBankAccount( + string $recipientId, + UpdateRecipientBankAccountRequest $request, + ?string $idempotencyKey = null +): GetRecipientResponse ``` ## Parameters @@ -244,65 +237,51 @@ function getTransfer(string $recipientId, string $transferId): GetTransferRespon | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `recipientId` | `string` | Template, Required | Recipient id | -| `transferId` | `string` | Template, Required | Transfer id | +| `request` | [`UpdateRecipientBankAccountRequest`](../../doc/models/update-recipient-bank-account-request.md) | Body, Required | Bank account data | +| `idempotencyKey` | `?string` | Header, Optional | - | ## Response Type -[`GetTransferResponse`](../../doc/models/get-transfer-response.md) +[`GetRecipientResponse`](../../doc/models/get-recipient-response.md) ## Example Usage ```php $recipientId = 'recipient_id0'; -$transferId = 'transfer_id6'; +$request = UpdateRecipientBankAccountRequestBuilder::init( + CreateBankAccountRequestBuilder::init( + 'holder_name0', + 'holder_type6', + 'holder_document8', + 'bank2', + 'branch_number0', + 'account_number4', + 'account_check_digit0', + 'type6', + [ + 'key0' => 'metadata1', + 'key1' => 'metadata0' + ] + )->build(), + 'bank_transfer' +)->build(); -$result = $recipientsController->getTransfer( +$result = $recipientsController->updateRecipientDefaultBankAccount( $recipientId, - $transferId + $request ); ``` -# Get Anticipation - -Gets an anticipation - -```php -function getAnticipation(string $recipientId, string $anticipationId): GetAnticipationResponse -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `recipientId` | `string` | Template, Required | Recipient id | -| `anticipationId` | `string` | Template, Required | Anticipation id | - -## Response Type - -[`GetAnticipationResponse`](../../doc/models/get-anticipation-response.md) - -## Example Usage - -```php -$recipientId = 'recipient_id0'; - -$anticipationId = 'anticipation_id0'; - -$result = $recipientsController->getAnticipation( - $recipientId, - $anticipationId -); -``` - +# Update Recipient Metadata -# Update Recipient Transfer Settings +Updates recipient metadata ```php -function updateRecipientTransferSettings( +function updateRecipientMetadata( string $recipientId, - UpdateTransferSettingsRequest $request, + UpdateMetadataRequest $request, ?string $idempotencyKey = null ): GetRecipientResponse ``` @@ -311,8 +290,8 @@ function updateRecipientTransferSettings( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `recipientId` | `string` | Template, Required | Recipient Identificator | -| `request` | [`UpdateTransferSettingsRequest`](../../doc/models/update-transfer-settings-request.md) | Body, Required | - | +| `recipientId` | `string` | Template, Required | Recipient id | +| `request` | [`UpdateMetadataRequest`](../../doc/models/update-metadata-request.md) | Body, Required | Metadata | | `idempotencyKey` | `?string` | Header, Optional | - | ## Response Type @@ -324,35 +303,32 @@ function updateRecipientTransferSettings( ```php $recipientId = 'recipient_id0'; -$request = UpdateTransferSettingsRequestBuilder::init( - 'transfer_enabled2', - 'transfer_interval6', - 'transfer_day6' +$request = UpdateMetadataRequestBuilder::init( + [ + 'key0' => 'metadata3' + ] )->build(); -$result = $recipientsController->updateRecipientTransferSettings( +$result = $recipientsController->updateRecipientMetadata( $recipientId, $request ); ``` -# Get Anticipations +# Get Transfers -Retrieves a paginated list of anticipations from a recipient +Gets a paginated list of transfers for the recipient ```php -function getAnticipations( +function getTransfers( string $recipientId, ?int $page = null, ?int $size = null, ?string $status = null, - ?string $timeframe = null, - ?\DateTime $paymentDateSince = null, - ?\DateTime $paymentDateUntil = null, ?\DateTime $createdSince = null, ?\DateTime $createdUntil = null -): ListAnticipationResponse +): ListTransferResponse ``` ## Parameters @@ -362,36 +338,29 @@ function getAnticipations( | `recipientId` | `string` | Template, Required | Recipient id | | `page` | `?int` | Query, Optional | Page number | | `size` | `?int` | Query, Optional | Page size | -| `status` | `?string` | Query, Optional | Filter for anticipation status | -| `timeframe` | `?string` | Query, Optional | Filter for anticipation timeframe | -| `paymentDateSince` | `?DateTime` | Query, Optional | Filter for start range for anticipation payment date | -| `paymentDateUntil` | `?DateTime` | Query, Optional | Filter for end range for anticipation payment date | -| `createdSince` | `?DateTime` | Query, Optional | Filter for start range for anticipation creation date | -| `createdUntil` | `?DateTime` | Query, Optional | Filter for end range for anticipation creation date | +| `status` | `?string` | Query, Optional | Filter for transfer status | +| `createdSince` | `?DateTime` | Query, Optional | Filter for start range of transfer creation date | +| `createdUntil` | `?DateTime` | Query, Optional | Filter for end range of transfer creation date | ## Response Type -[`ListAnticipationResponse`](../../doc/models/list-anticipation-response.md) +[`ListTransferResponse`](../../doc/models/list-transfer-response.md) ## Example Usage ```php $recipientId = 'recipient_id0'; -$result = $recipientsController->getAnticipations($recipientId); +$result = $recipientsController->getTransfers($recipientId); ``` -# Update Recipient Default Bank Account +# Get Transfer -Updates the default bank account from a recipient +Gets a transfer ```php -function updateRecipientDefaultBankAccount( - string $recipientId, - UpdateRecipientBankAccountRequest $request, - ?string $idempotencyKey = null -): GetRecipientResponse +function getTransfer(string $recipientId, string $transferId): GetTransferResponse ``` ## Parameters @@ -399,39 +368,22 @@ function updateRecipientDefaultBankAccount( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `recipientId` | `string` | Template, Required | Recipient id | -| `request` | [`UpdateRecipientBankAccountRequest`](../../doc/models/update-recipient-bank-account-request.md) | Body, Required | Bank account data | -| `idempotencyKey` | `?string` | Header, Optional | - | +| `transferId` | `string` | Template, Required | Transfer id | ## Response Type -[`GetRecipientResponse`](../../doc/models/get-recipient-response.md) +[`GetTransferResponse`](../../doc/models/get-transfer-response.md) ## Example Usage ```php $recipientId = 'recipient_id0'; -$request = UpdateRecipientBankAccountRequestBuilder::init( - CreateBankAccountRequestBuilder::init( - 'holder_name0', - 'holder_type6', - 'holder_document8', - 'bank2', - 'branch_number0', - 'account_number4', - 'account_check_digit0', - 'type6', - [ - 'key0' => 'metadata1', - 'key1' => 'metadata0' - ] - )->build(), - 'bank_transfer' -)->build(); +$transferId = 'transfer_id6'; -$result = $recipientsController->updateRecipientDefaultBankAccount( +$result = $recipientsController->getTransfer( $recipientId, - $request + $transferId ); ``` @@ -469,12 +421,16 @@ $result = $recipientsController->createWithdraw( ``` -# Get Balance +# Update Automatic Anticipation Settings -Get balance information for a recipient +Updates recipient metadata ```php -function getBalance(string $recipientId): GetBalanceResponse +function updateAutomaticAnticipationSettings( + string $recipientId, + UpdateAutomaticAnticipationSettingsRequest $request, + ?string $idempotencyKey = null +): GetRecipientResponse ``` ## Parameters @@ -482,76 +438,76 @@ function getBalance(string $recipientId): GetBalanceResponse | 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 -[`GetBalanceResponse`](../../doc/models/get-balance-response.md) +[`GetRecipientResponse`](../../doc/models/get-recipient-response.md) ## Example Usage ```php $recipientId = 'recipient_id0'; -$result = $recipientsController->getBalance($recipientId); +$request = UpdateAutomaticAnticipationSettingsRequestBuilder::init()->build(); + +$result = $recipientsController->updateAutomaticAnticipationSettings( + $recipientId, + $request +); ``` -# Create Transfer +# Get Anticipation -Creates a transfer for a recipient +Gets an anticipation ```php -function createTransfer( - string $recipientId, - CreateTransferRequest $request, - ?string $idempotencyKey = null -): GetTransferResponse +function getAnticipation(string $recipientId, string $anticipationId): GetAnticipationResponse ``` ## 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 | +| `anticipationId` | `string` | Template, Required | Anticipation id | ## Response Type -[`GetTransferResponse`](../../doc/models/get-transfer-response.md) +[`GetAnticipationResponse`](../../doc/models/get-anticipation-response.md) ## Example Usage ```php $recipientId = 'recipient_id0'; -$request = CreateTransferRequestBuilder::init( - 242, - [ - 'key0' => 'metadata3' - ] -)->build(); +$anticipationId = 'anticipation_id0'; -$result = $recipientsController->createTransfer( +$result = $recipientsController->getAnticipation( $recipientId, - $request + $anticipationId ); ``` -# Create Recipient - -Creates a new recipient +# Update Recipient Transfer Settings ```php -function createRecipient(CreateRecipientRequest $request, ?string $idempotencyKey = null): GetRecipientResponse +function updateRecipientTransferSettings( + string $recipientId, + UpdateTransferSettingsRequest $request, + ?string $idempotencyKey = null +): GetRecipientResponse ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `request` | [`CreateRecipientRequest`](../../doc/models/create-recipient-request.md) | Body, Required | Recipient data | +| `recipientId` | `string` | Template, Required | Recipient Identificator | +| `request` | [`UpdateTransferSettingsRequest`](../../doc/models/update-transfer-settings-request.md) | Body, Required | - | | `idempotencyKey` | `?string` | Header, Optional | - | ## Response Type @@ -561,43 +517,37 @@ function createRecipient(CreateRecipientRequest $request, ?string $idempotencyKe ## Example Usage ```php -$request = CreateRecipientRequestBuilder::init( - CreateBankAccountRequestBuilder::init( - 'holder_name4', - 'holder_type0', - 'holder_document2', - 'bank6', - 'branch_number4', - 'account_number8', - 'account_check_digit4', - 'type2', - [ - 'key0' => 'metadata5', - 'key1' => 'metadata4', - 'key2' => 'metadata3' - ] - )->build(), - [ - 'key0' => 'metadata3' - ], - 'code4', - 'bank_transfer' +$recipientId = 'recipient_id0'; + +$request = UpdateTransferSettingsRequestBuilder::init( + 'transfer_enabled2', + 'transfer_interval6', + 'transfer_day6' )->build(); -$result = $recipientsController->createRecipient($request); +$result = $recipientsController->updateRecipientTransferSettings( + $recipientId, + $request +); ``` -# Update Automatic Anticipation Settings +# Get Anticipations -Updates recipient metadata +Retrieves a paginated list of anticipations from a recipient ```php -function updateAutomaticAnticipationSettings( +function getAnticipations( string $recipientId, - UpdateAutomaticAnticipationSettingsRequest $request, - ?string $idempotencyKey = null -): GetRecipientResponse + ?int $page = null, + ?int $size = null, + ?string $status = null, + ?string $timeframe = null, + ?\DateTime $paymentDateSince = null, + ?\DateTime $paymentDateUntil = null, + ?\DateTime $createdSince = null, + ?\DateTime $createdUntil = null +): ListAnticipationResponse ``` ## Parameters @@ -605,24 +555,25 @@ function updateAutomaticAnticipationSettings( | 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 | - | +| `page` | `?int` | Query, Optional | Page number | +| `size` | `?int` | Query, Optional | Page size | +| `status` | `?string` | Query, Optional | Filter for anticipation status | +| `timeframe` | `?string` | Query, Optional | Filter for anticipation timeframe | +| `paymentDateSince` | `?DateTime` | Query, Optional | Filter for start range for anticipation payment date | +| `paymentDateUntil` | `?DateTime` | Query, Optional | Filter for end range for anticipation payment date | +| `createdSince` | `?DateTime` | Query, Optional | Filter for start range for anticipation creation date | +| `createdUntil` | `?DateTime` | Query, Optional | Filter for end range for anticipation creation date | ## Response Type -[`GetRecipientResponse`](../../doc/models/get-recipient-response.md) +[`ListAnticipationResponse`](../../doc/models/list-anticipation-response.md) ## Example Usage ```php $recipientId = 'recipient_id0'; -$request = UpdateAutomaticAnticipationSettingsRequestBuilder::init()->build(); - -$result = $recipientsController->updateAutomaticAnticipationSettings( - $recipientId, - $request -); +$result = $recipientsController->getAnticipations($recipientId); ``` @@ -653,6 +604,33 @@ $result = $recipientsController->getRecipient($recipientId); ``` +# Get Balance + +Get balance information for a recipient + +```php +function getBalance(string $recipientId): GetBalanceResponse +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `recipientId` | `string` | Template, Required | Recipient id | + +## Response Type + +[`GetBalanceResponse`](../../doc/models/get-balance-response.md) + +## Example Usage + +```php +$recipientId = 'recipient_id0'; + +$result = $recipientsController->getBalance($recipientId); +``` + + # Get Withdrawals Gets a paginated list of transfers for the recipient @@ -692,73 +670,95 @@ $result = $recipientsController->getWithdrawals($recipientId); ``` -# Get Withdraw by Id +# Create Transfer + +Creates a transfer for a recipient ```php -function getWithdrawById(string $recipientId, string $withdrawalId): GetWithdrawResponse +function createTransfer( + string $recipientId, + CreateTransferRequest $request, + ?string $idempotencyKey = null +): GetTransferResponse ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `recipientId` | `string` | Template, Required | - | -| `withdrawalId` | `string` | Template, Required | - | +| `recipientId` | `string` | Template, Required | Recipient Id | +| `request` | [`CreateTransferRequest`](../../doc/models/create-transfer-request.md) | Body, Required | Transfer data | +| `idempotencyKey` | `?string` | Header, Optional | - | ## Response Type -[`GetWithdrawResponse`](../../doc/models/get-withdraw-response.md) +[`GetTransferResponse`](../../doc/models/get-transfer-response.md) ## Example Usage ```php $recipientId = 'recipient_id0'; -$withdrawalId = 'withdrawal_id2'; +$request = CreateTransferRequestBuilder::init( + 242, + [ + 'key0' => 'metadata3' + ] +)->build(); -$result = $recipientsController->getWithdrawById( +$result = $recipientsController->createTransfer( $recipientId, - $withdrawalId + $request ); ``` -# Get Transfers +# Create Recipient -Gets a paginated list of transfers for the recipient +Creates a new recipient ```php -function getTransfers( - string $recipientId, - ?int $page = null, - ?int $size = null, - ?string $status = null, - ?\DateTime $createdSince = null, - ?\DateTime $createdUntil = null -): ListTransferResponse +function createRecipient(CreateRecipientRequest $request, ?string $idempotencyKey = null): GetRecipientResponse ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `recipientId` | `string` | Template, Required | Recipient id | -| `page` | `?int` | Query, Optional | Page number | -| `size` | `?int` | Query, Optional | Page size | -| `status` | `?string` | Query, Optional | Filter for transfer status | -| `createdSince` | `?DateTime` | Query, Optional | Filter for start range of transfer creation date | -| `createdUntil` | `?DateTime` | Query, Optional | Filter for end range of transfer creation date | +| `request` | [`CreateRecipientRequest`](../../doc/models/create-recipient-request.md) | Body, Required | Recipient data | +| `idempotencyKey` | `?string` | Header, Optional | - | ## Response Type -[`ListTransferResponse`](../../doc/models/list-transfer-response.md) +[`GetRecipientResponse`](../../doc/models/get-recipient-response.md) ## Example Usage ```php -$recipientId = 'recipient_id0'; +$request = CreateRecipientRequestBuilder::init( + CreateBankAccountRequestBuilder::init( + 'holder_name4', + 'holder_type0', + 'holder_document2', + 'bank6', + 'branch_number4', + 'account_number8', + 'account_check_digit4', + 'type2', + [ + 'key0' => 'metadata5', + 'key1' => 'metadata4', + 'key2' => 'metadata3' + ] + )->build(), + [ + 'key0' => 'metadata3' + ], + 'code4', + 'bank_transfer' +)->build(); -$result = $recipientsController->getTransfers($recipientId); +$result = $recipientsController->createRecipient($request); ``` diff --git a/doc/controllers/subscriptions.md b/doc/controllers/subscriptions.md index 2fa7d5d..c1883f8 100644 --- a/doc/controllers/subscriptions.md +++ b/doc/controllers/subscriptions.md @@ -11,39 +11,39 @@ $subscriptionsController = $client->getSubscriptionsController(); ## Methods * [Renew Subscription](../../doc/controllers/subscriptions.md#renew-subscription) +* [Update Subscription Card](../../doc/controllers/subscriptions.md#update-subscription-card) +* [Delete Usage](../../doc/controllers/subscriptions.md#delete-usage) +* [Create Discount](../../doc/controllers/subscriptions.md#create-discount) +* [Create an Usage](../../doc/controllers/subscriptions.md#create-an-usage) +* [Update Current Cycle Status](../../doc/controllers/subscriptions.md#update-current-cycle-status) * [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](../../doc/controllers/subscriptions.md#get-subscription) -* [Update Latest Period End At](../../doc/controllers/subscriptions.md#update-latest-period-end-at) -* [Update Current Cycle Status](../../doc/controllers/subscriptions.md#update-current-cycle-status) -* [Get Subscription Items](../../doc/controllers/subscriptions.md#get-subscription-items) -* [Get Subscription Item](../../doc/controllers/subscriptions.md#get-subscription-item) -* [Update Subscription Affiliation Id](../../doc/controllers/subscriptions.md#update-subscription-affiliation-id) +* [Get Subscription Cycles](../../doc/controllers/subscriptions.md#get-subscription-cycles) * [Get Discounts](../../doc/controllers/subscriptions.md#get-discounts) +* [Update Subscription Billing Date](../../doc/controllers/subscriptions.md#update-subscription-billing-date) +* [Delete Subscription Item](../../doc/controllers/subscriptions.md#delete-subscription-item) +* [Get Increments](../../doc/controllers/subscriptions.md#get-increments) +* [Update Subscription Due Days](../../doc/controllers/subscriptions.md#update-subscription-due-days) +* [Update Subscription Start At](../../doc/controllers/subscriptions.md#update-subscription-start-at) * [Update Subscription Item](../../doc/controllers/subscriptions.md#update-subscription-item) * [Create Subscription Item](../../doc/controllers/subscriptions.md#create-subscription-item) +* [Get Subscription](../../doc/controllers/subscriptions.md#get-subscription) * [Get Usages](../../doc/controllers/subscriptions.md#get-usages) +* [Update Latest Period End At](../../doc/controllers/subscriptions.md#update-latest-period-end-at) * [Update Subscription Minium Price](../../doc/controllers/subscriptions.md#update-subscription-minium-price) * [Get Subscription Cycle by Id](../../doc/controllers/subscriptions.md#get-subscription-cycle-by-id) -* [Create an Usage](../../doc/controllers/subscriptions.md#create-an-usage) -* [Cancel Subscription](../../doc/controllers/subscriptions.md#cancel-subscription) -* [Delete Subscription Item](../../doc/controllers/subscriptions.md#delete-subscription-item) -* [Get Increments](../../doc/controllers/subscriptions.md#get-increments) -* [Update Subscription Due Days](../../doc/controllers/subscriptions.md#update-subscription-due-days) -* [Update Subscription Card](../../doc/controllers/subscriptions.md#update-subscription-card) -* [Delete Usage](../../doc/controllers/subscriptions.md#delete-usage) -* [Create Discount](../../doc/controllers/subscriptions.md#create-discount) -* [Update Subscription Payment Method](../../doc/controllers/subscriptions.md#update-subscription-payment-method) -* [Create Increment](../../doc/controllers/subscriptions.md#create-increment) -* [Create Usage](../../doc/controllers/subscriptions.md#create-usage) -* [Get Subscription Cycles](../../doc/controllers/subscriptions.md#get-subscription-cycles) -* [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 Usage Report](../../doc/controllers/subscriptions.md#get-usage-report) * [Update Split Subscription](../../doc/controllers/subscriptions.md#update-split-subscription) @@ -74,16 +74,16 @@ $result = $subscriptionsController->renewSubscription($subscriptionId); ``` -# Delete Discount +# Update Subscription Card -Deletes a discount +Updates the credit card from a subscription ```php -function deleteDiscount( +function updateSubscriptionCard( string $subscriptionId, - string $discountId, + UpdateSubscriptionCardRequest $request, ?string $idempotencyKey = null -): GetDiscountResponse +): GetSubscriptionResponse ``` ## Parameters @@ -91,88 +91,94 @@ function deleteDiscount( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `subscriptionId` | `string` | Template, Required | Subscription id | -| `discountId` | `string` | Template, Required | Discount Id | +| `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 ```php $subscriptionId = 'subscription_id0'; -$discountId = 'discount_id8'; +$request = UpdateSubscriptionCardRequestBuilder::init( + CreateCardRequestBuilder::init() + ->type('credit') + ->build(), + 'card_id2' +)->build(); -$result = $subscriptionsController->deleteDiscount( +$result = $subscriptionsController->updateSubscriptionCard( $subscriptionId, - $discountId + $request ); ``` -# Get Subscriptions +# Delete Usage -Gets all subscriptions +Deletes a usage ```php -function getSubscriptions( - ?int $page = null, - ?int $size = null, - ?string $code = null, - ?string $billingType = null, - ?string $customerId = null, - ?string $planId = null, - ?string $cardId = null, - ?string $status = null, - ?\DateTime $nextBillingSince = null, - ?\DateTime $nextBillingUntil = null, - ?\DateTime $createdSince = null, - ?\DateTime $createdUntil = null -): ListSubscriptionsResponse +function deleteUsage( + string $subscriptionId, + string $itemId, + string $usageId, + ?string $idempotencyKey = null +): GetUsageResponse ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `page` | `?int` | Query, Optional | Page number | -| `size` | `?int` | 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` | `?DateTime` | Query, Optional | Filter for subscription's next billing date start range | -| `nextBillingUntil` | `?DateTime` | Query, Optional | Filter for subscription's next billing date end range | -| `createdSince` | `?DateTime` | Query, Optional | Filter for subscription's creation date start range | -| `createdUntil` | `?DateTime` | Query, Optional | Filter for subscriptions creation date end range | +| `subscriptionId` | `string` | Template, Required | The subscription id | +| `itemId` | `string` | Template, Required | The subscription item id | +| `usageId` | `string` | Template, Required | The usage id | +| `idempotencyKey` | `?string` | Header, Optional | - | ## Response Type -[`ListSubscriptionsResponse`](../../doc/models/list-subscriptions-response.md) +[`GetUsageResponse`](../../doc/models/get-usage-response.md) ## Example Usage ```php -$result = $subscriptionsController->getSubscriptions(); +$subscriptionId = 'subscription_id0'; + +$itemId = 'item_id0'; + +$usageId = 'usage_id0'; + +$result = $subscriptionsController->deleteUsage( + $subscriptionId, + $itemId, + $usageId +); ``` -# Get Discount by Id +# Create Discount + +Creates a discount ```php -function getDiscountById(string $subscriptionId, string $discountId): GetDiscountResponse +function createDiscount( + string $subscriptionId, + CreateDiscountRequest $request, + ?string $idempotencyKey = null +): GetDiscountResponse ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `string` | Template, Required | The subscription id | -| `discountId` | `string` | Template, Required | - | +| `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 @@ -183,181 +189,182 @@ function getDiscountById(string $subscriptionId, string $discountId): GetDiscoun ```php $subscriptionId = 'subscription_id0'; -$discountId = 'discountId0'; +$request = CreateDiscountRequestBuilder::init( + 185.28, + 'discount_type4', + 'item_id6' +)->build(); -$result = $subscriptionsController->getDiscountById( +$result = $subscriptionsController->createDiscount( $subscriptionId, - $discountId + $request ); ``` -# Create Subscription +# Create an Usage -Creates a new subscription +Create Usage ```php -function createSubscription( - CreateSubscriptionRequest $body, +function createAnUsage(string $subscriptionId, string $itemId, ?string $idempotencyKey = null): GetUsageResponse +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `subscriptionId` | `string` | Template, Required | Subscription id | +| `itemId` | `string` | Template, Required | Item id | +| `idempotencyKey` | `?string` | Header, Optional | - | + +## Response Type + +[`GetUsageResponse`](../../doc/models/get-usage-response.md) + +## Example Usage + +```php +$subscriptionId = 'subscription_id0'; + +$itemId = 'item_id0'; + +$result = $subscriptionsController->createAnUsage( + $subscriptionId, + $itemId +); +``` + + +# Update Current Cycle Status + +```php +function updateCurrentCycleStatus( + string $subscriptionId, + UpdateCurrentCycleStatusRequest $request, ?string $idempotencyKey = null -): GetSubscriptionResponse +): void ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `body` | [`CreateSubscriptionRequest`](../../doc/models/create-subscription-request.md) | Body, Required | Request for creating a subscription | +| `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 -[`GetSubscriptionResponse`](../../doc/models/get-subscription-response.md) +`void` ## Example Usage ```php -$body = CreateSubscriptionRequestBuilder::init( - CreateCustomerRequestBuilder::init( - '{ - "name": "Tony Stark" -}', - 'email6', - 'document6', - 'type0', - CreateAddressRequestBuilder::init( - 'street6', - 'number4', - 'zip_code0', - 'neighborhood2', - 'city6', - 'state2', - 'country0', - 'complement2', - 'line_10', - 'line_24' - )->build(), - [ - 'key0' => 'metadata3' - ], - CreatePhonesRequestBuilder::init()->build(), - 'code8' - )->build(), - CreateCardRequestBuilder::init() - ->type('credit') - ->build(), - 'code4', - 'payment_method4', - 'billing_type0', - 'statement_descriptor6', - 'description4', - 'currency6', - 'interval6', - 170, - CreatePricingSchemeRequestBuilder::init( - 'scheme_type8' - )->build(), - [ - CreateSubscriptionItemRequestBuilder::init( - 'description2', - CreatePricingSchemeRequestBuilder::init( - 'scheme_type8' - )->build(), - 'id8', - 'plan_item_id8', - [ - CreateDiscountRequestBuilder::init( - 90.66, - 'discount_type2', - 'item_id4' - )->build() - ], - 'name8' - )->build() - ], - CreateShippingRequestBuilder::init( - 52, - 'description6', - 'recipient_name2', - 'recipient_phone6', - 'address_id6', - CreateAddressRequestBuilder::init( - 'street6', - 'number4', - 'zip_code0', - 'neighborhood2', - 'city6', - 'state2', - 'country0', - 'complement2', - 'line_10', - 'line_24' - )->build(), - 'type6' - )->build(), - [ - CreateDiscountRequestBuilder::init( - 90.66, - 'discount_type2', - 'item_id4' - )->build() - ], - [ - 'key0' => 'metadata7', - 'key1' => 'metadata8' - ], - [ - CreateIncrementRequestBuilder::init( - 252.86, - 'increment_type6', - 'item_id6' - )->build() - ] +$subscriptionId = 'subscription_id0'; + +$request = UpdateCurrentCycleStatusRequestBuilder::init( + 'status8' )->build(); -$result = $subscriptionsController->createSubscription($body); +$subscriptionsController->updateCurrentCycleStatus( + $subscriptionId, + $request +); ``` -# Get Increment by Id +# Delete Discount + +Deletes a discount ```php -function getIncrementById(string $subscriptionId, string $incrementId): GetIncrementResponse +function deleteDiscount( + string $subscriptionId, + string $discountId, + ?string $idempotencyKey = null +): GetDiscountResponse ``` ## 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 | +| `discountId` | `string` | Template, Required | Discount Id | +| `idempotencyKey` | `?string` | Header, Optional | - | ## Response Type -[`GetIncrementResponse`](../../doc/models/get-increment-response.md) +[`GetDiscountResponse`](../../doc/models/get-discount-response.md) ## Example Usage ```php $subscriptionId = 'subscription_id0'; -$incrementId = 'increment_id8'; +$discountId = 'discount_id8'; -$result = $subscriptionsController->getIncrementById( +$result = $subscriptionsController->deleteDiscount( $subscriptionId, - $incrementId + $discountId ); ``` -# Update Subscription Metadata +# Get Subscription Items -Updates the metadata from a subscription +Get Subscription Items ```php -function updateSubscriptionMetadata( +function getSubscriptionItems( string $subscriptionId, - UpdateMetadataRequest $request, + ?int $page = null, + ?int $size = null, + ?string $name = null, + ?string $code = null, + ?string $status = null, + ?string $description = null, + ?string $createdSince = null, + ?string $createdUntil = null +): ListSubscriptionItemsResponse +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `subscriptionId` | `string` | Template, Required | The subscription id | +| `page` | `?int` | Query, Optional | Page number | +| `size` | `?int` | 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 + +[`ListSubscriptionItemsResponse`](../../doc/models/list-subscription-items-response.md) + +## Example Usage + +```php +$subscriptionId = 'subscription_id0'; + +$result = $subscriptionsController->getSubscriptionItems($subscriptionId); +``` + + +# Update Subscription Payment Method + +Updates the payment method from a subscription + +```php +function updateSubscriptionPaymentMethod( + string $subscriptionId, + UpdateSubscriptionPaymentMethodRequest $request, ?string $idempotencyKey = null ): GetSubscriptionResponse ``` @@ -366,8 +373,8 @@ function 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 | Subscription id | +| `request` | [`UpdateSubscriptionPaymentMethodRequest`](../../doc/models/update-subscription-payment-method-request.md) | Body, Required | Request for updating the paymentmethod from a subscription | | `idempotencyKey` | `?string` | Header, Optional | - | ## Response Type @@ -379,90 +386,111 @@ function updateSubscriptionMetadata( ```php $subscriptionId = 'subscription_id0'; -$request = UpdateMetadataRequestBuilder::init( - [ - 'key0' => 'metadata3' - ] +$request = UpdateSubscriptionPaymentMethodRequestBuilder::init( + 'payment_method4', + 'card_id2', + CreateCardRequestBuilder::init() + ->type('credit') + ->build() )->build(); -$result = $subscriptionsController->updateSubscriptionMetadata( +$result = $subscriptionsController->updateSubscriptionPaymentMethod( $subscriptionId, $request ); ``` -# Delete Increment +# Get Subscription Item -Deletes a increment +Get Subscription Item ```php -function deleteIncrement( - string $subscriptionId, - string $incrementId, - ?string $idempotencyKey = null -): GetIncrementResponse +function getSubscriptionItem(string $subscriptionId, string $itemId): GetSubscriptionItemResponse ``` ## 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 | +| `itemId` | `string` | Template, Required | Item id | ## Response Type -[`GetIncrementResponse`](../../doc/models/get-increment-response.md) +[`GetSubscriptionItemResponse`](../../doc/models/get-subscription-item-response.md) ## Example Usage ```php $subscriptionId = 'subscription_id0'; -$incrementId = 'increment_id8'; +$itemId = 'item_id0'; -$result = $subscriptionsController->deleteIncrement( +$result = $subscriptionsController->getSubscriptionItem( $subscriptionId, - $incrementId + $itemId ); ``` -# Get Subscription +# Get Subscriptions -Gets a subscription +Gets all subscriptions ```php -function getSubscription(string $subscriptionId): GetSubscriptionResponse +function getSubscriptions( + ?int $page = null, + ?int $size = null, + ?string $code = null, + ?string $billingType = null, + ?string $customerId = null, + ?string $planId = null, + ?string $cardId = null, + ?string $status = null, + ?\DateTime $nextBillingSince = null, + ?\DateTime $nextBillingUntil = null, + ?\DateTime $createdSince = null, + ?\DateTime $createdUntil = null +): ListSubscriptionsResponse ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `string` | Template, Required | Subscription id | +| `page` | `?int` | Query, Optional | Page number | +| `size` | `?int` | 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` | `?DateTime` | Query, Optional | Filter for subscription's next billing date start range | +| `nextBillingUntil` | `?DateTime` | Query, Optional | Filter for subscription's next billing date end range | +| `createdSince` | `?DateTime` | Query, Optional | Filter for subscription's creation date start range | +| `createdUntil` | `?DateTime` | 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 ```php -$subscriptionId = 'subscription_id0'; - -$result = $subscriptionsController->getSubscription($subscriptionId); +$result = $subscriptionsController->getSubscriptions(); ``` -# Update Latest Period End At +# Cancel Subscription + +Cancels a subscription ```php -function updateLatestPeriodEndAt( +function cancelSubscription( string $subscriptionId, - UpdateCurrentCycleEndDateRequest $request, + ?CreateCancelSubscriptionRequest $request = null, ?string $idempotencyKey = null ): GetSubscriptionResponse ``` @@ -471,8 +499,8 @@ function 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 | +| `request` | [`?CreateCancelSubscriptionRequest`](../../doc/models/create-cancel-subscription-request.md) | Body, Optional | Request for cancelling a subscription | | `idempotencyKey` | `?string` | Header, Optional | - | ## Response Type @@ -484,104 +512,70 @@ function updateLatestPeriodEndAt( ```php $subscriptionId = 'subscription_id0'; -$request = UpdateCurrentCycleEndDateRequestBuilder::init()->build(); +$request = CreateCancelSubscriptionRequestBuilder::init( + true +)->build(); -$result = $subscriptionsController->updateLatestPeriodEndAt( +$result = $subscriptionsController->cancelSubscription( $subscriptionId, $request ); ``` -# Update Current Cycle Status +# Create Increment + +Creates a increment ```php -function updateCurrentCycleStatus( +function createIncrement( string $subscriptionId, - UpdateCurrentCycleStatusRequest $request, + CreateIncrementRequest $request, ?string $idempotencyKey = null -): void +): GetIncrementResponse ``` ## Parameters | 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 | Subscription id | +| `request` | [`CreateIncrementRequest`](../../doc/models/create-increment-request.md) | Body, Required | Request for creating a increment | | `idempotencyKey` | `?string` | Header, Optional | - | ## Response Type -`void` +[`GetIncrementResponse`](../../doc/models/get-increment-response.md) ## Example Usage ```php $subscriptionId = 'subscription_id0'; -$request = UpdateCurrentCycleStatusRequestBuilder::init( - 'status8' +$request = CreateIncrementRequestBuilder::init( + 185.28, + 'increment_type8', + 'item_id6' )->build(); -$subscriptionsController->updateCurrentCycleStatus( +$result = $subscriptionsController->createIncrement( $subscriptionId, $request ); ``` -# Get Subscription Items +# Create Usage -Get Subscription Items +Creates a usage ```php -function getSubscriptionItems( +function createUsage( string $subscriptionId, - ?int $page = null, - ?int $size = null, - ?string $name = null, - ?string $code = null, - ?string $status = null, - ?string $description = null, - ?string $createdSince = null, - ?string $createdUntil = null -): ListSubscriptionItemsResponse -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `subscriptionId` | `string` | Template, Required | The subscription id | -| `page` | `?int` | Query, Optional | Page number | -| `size` | `?int` | 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 - -[`ListSubscriptionItemsResponse`](../../doc/models/list-subscription-items-response.md) - -## Example Usage - -```php -$subscriptionId = 'subscription_id0'; - -$result = $subscriptionsController->getSubscriptionItems($subscriptionId); -``` - - -# Get Subscription Item - -Get Subscription Item - -```php -function getSubscriptionItem(string $subscriptionId, string $itemId): GetSubscriptionItemResponse + string $itemId, + CreateUsageRequest $body, + ?string $idempotencyKey = null +): GetUsageResponse ``` ## Parameters @@ -590,10 +584,12 @@ function getSubscriptionItem(string $subscriptionId, string $itemId): GetSubscri | --- | --- | --- | --- | | `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 -[`GetSubscriptionItemResponse`](../../doc/models/get-subscription-item-response.md) +[`GetUsageResponse`](../../doc/models/get-usage-response.md) ## Example Usage @@ -602,210 +598,257 @@ $subscriptionId = 'subscription_id0'; $itemId = 'item_id0'; -$result = $subscriptionsController->getSubscriptionItem( +$body = CreateUsageRequestBuilder::init( + 156, + 'description4', + DateTimeHelper::fromRfc3339DateTimeRequired('2016-03-13T12:52:32.123Z') +)->build(); + +$result = $subscriptionsController->createUsage( $subscriptionId, - $itemId + $itemId, + $body ); ``` -# Update Subscription Affiliation Id +# Get Discount by Id ```php -function updateSubscriptionAffiliationId( - string $subscriptionId, - UpdateSubscriptionAffiliationIdRequest $request, - ?string $idempotencyKey = null -): GetSubscriptionResponse +function getDiscountById(string $subscriptionId, string $discountId): GetDiscountResponse ``` ## Parameters | 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 | -| `idempotencyKey` | `?string` | Header, Optional | - | +| `subscriptionId` | `string` | Template, Required | The subscription id | +| `discountId` | `string` | Template, Required | - | ## Response Type -[`GetSubscriptionResponse`](../../doc/models/get-subscription-response.md) +[`GetDiscountResponse`](../../doc/models/get-discount-response.md) ## Example Usage ```php $subscriptionId = 'subscription_id0'; -$request = UpdateSubscriptionAffiliationIdRequestBuilder::init( - 'gateway_affiliation_id2' -)->build(); +$discountId = 'discountId0'; -$result = $subscriptionsController->updateSubscriptionAffiliationId( +$result = $subscriptionsController->getDiscountById( $subscriptionId, - $request + $discountId ); ``` -# Get Discounts +# Create Subscription + +Creates a new subscription ```php -function getDiscounts(string $subscriptionId, int $page, int $size): ListDiscountsResponse +function createSubscription( + CreateSubscriptionRequest $body, + ?string $idempotencyKey = null +): GetSubscriptionResponse ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `string` | Template, Required | The subscription id | -| `page` | `int` | Query, Required | Page number | -| `size` | `int` | Query, Required | Page size | +| `body` | [`CreateSubscriptionRequest`](../../doc/models/create-subscription-request.md) | Body, Required | Request for creating a subscription | +| `idempotencyKey` | `?string` | Header, Optional | - | ## Response Type -[`ListDiscountsResponse`](../../doc/models/list-discounts-response.md) +[`GetSubscriptionResponse`](../../doc/models/get-subscription-response.md) ## Example Usage ```php -$subscriptionId = 'subscription_id0'; - -$page = 30; - -$size = 18; +$body = CreateSubscriptionRequestBuilder::init( + CreateCustomerRequestBuilder::init( + '{ + "name": "Tony Stark" +}', + 'email6', + 'document6', + 'type0', + CreateAddressRequestBuilder::init( + 'street6', + 'number4', + 'zip_code0', + 'neighborhood2', + 'city6', + 'state2', + 'country0', + 'complement2', + 'line_10', + 'line_24' + )->build(), + [ + 'key0' => 'metadata3' + ], + CreatePhonesRequestBuilder::init()->build(), + 'code8' + )->build(), + CreateCardRequestBuilder::init() + ->type('credit') + ->build(), + 'code4', + 'payment_method4', + 'billing_type0', + 'statement_descriptor6', + 'description4', + 'currency6', + 'interval6', + 170, + CreatePricingSchemeRequestBuilder::init( + 'scheme_type8' + )->build(), + [ + CreateSubscriptionItemRequestBuilder::init( + 'description2', + CreatePricingSchemeRequestBuilder::init( + 'scheme_type8' + )->build(), + 'id8', + 'plan_item_id8', + [ + CreateDiscountRequestBuilder::init( + 90.66, + 'discount_type2', + 'item_id4' + )->build() + ], + 'name8' + )->build() + ], + CreateShippingRequestBuilder::init( + 52, + 'description6', + 'recipient_name2', + 'recipient_phone6', + 'address_id6', + CreateAddressRequestBuilder::init( + 'street6', + 'number4', + 'zip_code0', + 'neighborhood2', + 'city6', + 'state2', + 'country0', + 'complement2', + 'line_10', + 'line_24' + )->build(), + 'type6' + )->build(), + [ + CreateDiscountRequestBuilder::init( + 90.66, + 'discount_type2', + 'item_id4' + )->build() + ], + [ + 'key0' => 'metadata7', + 'key1' => 'metadata8' + ], + [ + CreateIncrementRequestBuilder::init( + 252.86, + 'increment_type6', + 'item_id6' + )->build() + ] +)->build(); -$result = $subscriptionsController->getDiscounts( - $subscriptionId, - $page, - $size -); +$result = $subscriptionsController->createSubscription($body); ``` -# Update Subscription Item - -Updates a subscription item +# Get Increment by Id ```php -function updateSubscriptionItem( - string $subscriptionId, - string $itemId, - UpdateSubscriptionItemRequest $body, - ?string $idempotencyKey = null -): GetSubscriptionItemResponse +function getIncrementById(string $subscriptionId, string $incrementId): GetIncrementResponse ``` ## 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 | - | +| `subscriptionId` | `string` | Template, Required | The subscription Id | +| `incrementId` | `string` | Template, Required | The increment Id | ## Response Type -[`GetSubscriptionItemResponse`](../../doc/models/get-subscription-item-response.md) +[`GetIncrementResponse`](../../doc/models/get-increment-response.md) ## Example Usage ```php $subscriptionId = 'subscription_id0'; -$itemId = 'item_id0'; - -$body = UpdateSubscriptionItemRequestBuilder::init( - 'description4', - 'status2', - UpdatePricingSchemeRequestBuilder::init( - 'scheme_type8', - [ - UpdatePriceBracketRequestBuilder::init( - 144, - 174 - )->build() - ] - )->build(), - 'name6' -)->build(); +$incrementId = 'increment_id8'; -$result = $subscriptionsController->updateSubscriptionItem( +$result = $subscriptionsController->getIncrementById( $subscriptionId, - $itemId, - $body + $incrementId ); ``` -# Create Subscription Item - -Creates a new Subscription item +# Update Subscription Affiliation Id ```php -function createSubscriptionItem( +function updateSubscriptionAffiliationId( string $subscriptionId, - CreateSubscriptionItemRequest $request, + UpdateSubscriptionAffiliationIdRequest $request, ?string $idempotencyKey = null -): GetSubscriptionItemResponse +): GetSubscriptionResponse ``` ## Parameters | 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 | +| `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 -[`GetSubscriptionItemResponse`](../../doc/models/get-subscription-item-response.md) +[`GetSubscriptionResponse`](../../doc/models/get-subscription-response.md) ## Example Usage ```php $subscriptionId = 'subscription_id0'; -$request = CreateSubscriptionItemRequestBuilder::init( - 'description6', - CreatePricingSchemeRequestBuilder::init( - 'scheme_type8' - )->build(), - 'id6', - 'plan_item_id6', - [ - CreateDiscountRequestBuilder::init( - 90.66, - 'discount_type2', - 'item_id4' - )->build() - ], - 'name6' +$request = UpdateSubscriptionAffiliationIdRequestBuilder::init( + 'gateway_affiliation_id2' )->build(); -$result = $subscriptionsController->createSubscriptionItem( +$result = $subscriptionsController->updateSubscriptionAffiliationId( $subscriptionId, $request ); ``` -# Get Usages +# Update Subscription Metadata -Lists all usages from a subscription item +Updates the metadata from a subscription ```php -function getUsages( +function updateSubscriptionMetadata( string $subscriptionId, - string $itemId, - ?int $page = null, - ?int $size = null, - ?string $code = null, - ?string $group = null, - ?\DateTime $usedSince = null, - ?\DateTime $usedUntil = null -): ListUsagesResponse + UpdateMetadataRequest $request, + ?string $idempotencyKey = null +): GetSubscriptionResponse ``` ## Parameters @@ -813,143 +856,147 @@ function getUsages( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `subscriptionId` | `string` | Template, Required | The subscription id | -| `itemId` | `string` | Template, Required | The subscription item id | -| `page` | `?int` | Query, Optional | Page number | -| `size` | `?int` | 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` | `?DateTime` | Query, Optional | - | -| `usedUntil` | `?DateTime` | Query, Optional | - | +| `request` | [`UpdateMetadataRequest`](../../doc/models/update-metadata-request.md) | Body, Required | Request for updating the subscrption metadata | +| `idempotencyKey` | `?string` | Header, Optional | - | ## Response Type -[`ListUsagesResponse`](../../doc/models/list-usages-response.md) +[`GetSubscriptionResponse`](../../doc/models/get-subscription-response.md) ## Example Usage ```php $subscriptionId = 'subscription_id0'; -$itemId = 'item_id0'; +$request = UpdateMetadataRequestBuilder::init( + [ + 'key0' => 'metadata3' + ] +)->build(); -$result = $subscriptionsController->getUsages( +$result = $subscriptionsController->updateSubscriptionMetadata( $subscriptionId, - $itemId + $request ); ``` -# Update Subscription Minium Price +# Delete Increment -Atualização do valor mínimo da assinatura +Deletes a increment ```php -function updateSubscriptionMiniumPrice( +function deleteIncrement( string $subscriptionId, - UpdateSubscriptionMinimumPriceRequest $request, + string $incrementId, ?string $idempotencyKey = null -): GetSubscriptionResponse +): GetIncrementResponse ``` ## Parameters | 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 | +| `incrementId` | `string` | Template, Required | Increment id | | `idempotencyKey` | `?string` | Header, Optional | - | ## Response Type -[`GetSubscriptionResponse`](../../doc/models/get-subscription-response.md) +[`GetIncrementResponse`](../../doc/models/get-increment-response.md) ## Example Usage ```php $subscriptionId = 'subscription_id0'; -$request = UpdateSubscriptionMinimumPriceRequestBuilder::init()->build(); +$incrementId = 'increment_id8'; -$result = $subscriptionsController->updateSubscriptionMiniumPrice( +$result = $subscriptionsController->deleteIncrement( $subscriptionId, - $request + $incrementId ); ``` -# Get Subscription Cycle by Id +# Get Subscription Cycles ```php -function getSubscriptionCycleById(string $subscriptionId, string $cycleId): GetPeriodResponse +function getSubscriptionCycles(string $subscriptionId, string $page, string $size): ListCyclesResponse ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `string` | Template, Required | The subscription id | -| `cycleId` | `string` | Template, Required | - | +| `subscriptionId` | `string` | Template, Required | Subscription Id | +| `page` | `string` | Query, Required | Page number | +| `size` | `string` | Query, Required | Page size | ## Response Type -[`GetPeriodResponse`](../../doc/models/get-period-response.md) +[`ListCyclesResponse`](../../doc/models/list-cycles-response.md) ## Example Usage ```php $subscriptionId = 'subscription_id0'; -$cycleId = 'cycleId0'; +$page = 'page8'; -$result = $subscriptionsController->getSubscriptionCycleById( +$size = 'size0'; + +$result = $subscriptionsController->getSubscriptionCycles( $subscriptionId, - $cycleId + $page, + $size ); ``` -# Create an Usage - -Create Usage +# Get Discounts ```php -function createAnUsage(string $subscriptionId, string $itemId, ?string $idempotencyKey = null): GetUsageResponse +function getDiscounts(string $subscriptionId, int $page, int $size): ListDiscountsResponse ``` ## 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 | +| `page` | `int` | Query, Required | Page number | +| `size` | `int` | Query, Required | Page size | ## Response Type -[`GetUsageResponse`](../../doc/models/get-usage-response.md) +[`ListDiscountsResponse`](../../doc/models/list-discounts-response.md) ## Example Usage ```php $subscriptionId = 'subscription_id0'; -$itemId = 'item_id0'; +$page = 30; -$result = $subscriptionsController->createAnUsage( +$size = 18; + +$result = $subscriptionsController->getDiscounts( $subscriptionId, - $itemId + $page, + $size ); ``` -# Cancel Subscription +# Update Subscription Billing Date -Cancels a subscription +Updates the billing date from a subscription ```php -function cancelSubscription( +function updateSubscriptionBillingDate( string $subscriptionId, - ?CreateCancelSubscriptionRequest $request = null, + UpdateSubscriptionBillingDateRequest $request, ?string $idempotencyKey = null ): GetSubscriptionResponse ``` @@ -958,8 +1005,8 @@ function cancelSubscription( | 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 | +| `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 @@ -971,11 +1018,11 @@ function cancelSubscription( ```php $subscriptionId = 'subscription_id0'; -$request = CreateCancelSubscriptionRequestBuilder::init( - true +$request = UpdateSubscriptionBillingDateRequestBuilder::init( + DateTimeHelper::fromRfc3339DateTimeRequired('2016-03-13T12:52:32.123Z') )->build(); -$result = $subscriptionsController->cancelSubscription( +$result = $subscriptionsController->updateSubscriptionBillingDate( $subscriptionId, $request ); @@ -1049,52 +1096,12 @@ $result = $subscriptionsController->getIncrements($subscriptionId); # Update Subscription Due Days -Updates the boleto due days from a subscription - -```php -function updateSubscriptionDueDays( - string $subscriptionId, - UpdateSubscriptionDueDaysRequest $request, - ?string $idempotencyKey = null -): GetSubscriptionResponse -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `subscriptionId` | `string` | Template, Required | Subscription Id | -| `request` | [`UpdateSubscriptionDueDaysRequest`](../../doc/models/update-subscription-due-days-request.md) | Body, Required | - | -| `idempotencyKey` | `?string` | Header, Optional | - | - -## Response Type - -[`GetSubscriptionResponse`](../../doc/models/get-subscription-response.md) - -## Example Usage - -```php -$subscriptionId = 'subscription_id0'; - -$request = UpdateSubscriptionDueDaysRequestBuilder::init( - 226 -)->build(); - -$result = $subscriptionsController->updateSubscriptionDueDays( - $subscriptionId, - $request -); -``` - - -# Update Subscription Card - -Updates the credit card from a subscription +Updates the boleto due days from a subscription ```php -function updateSubscriptionCard( +function updateSubscriptionDueDays( string $subscriptionId, - UpdateSubscriptionCardRequest $request, + UpdateSubscriptionDueDaysRequest $request, ?string $idempotencyKey = null ): GetSubscriptionResponse ``` @@ -1103,8 +1110,8 @@ function 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 | Subscription Id | +| `request` | [`UpdateSubscriptionDueDaysRequest`](../../doc/models/update-subscription-due-days-request.md) | Body, Required | - | | `idempotencyKey` | `?string` | Header, Optional | - | ## Response Type @@ -1116,31 +1123,27 @@ function updateSubscriptionCard( ```php $subscriptionId = 'subscription_id0'; -$request = UpdateSubscriptionCardRequestBuilder::init( - CreateCardRequestBuilder::init() - ->type('credit') - ->build(), - 'card_id2' +$request = UpdateSubscriptionDueDaysRequestBuilder::init( + 226 )->build(); -$result = $subscriptionsController->updateSubscriptionCard( +$result = $subscriptionsController->updateSubscriptionDueDays( $subscriptionId, $request ); ``` -# Delete Usage +# Update Subscription Start At -Deletes a usage +Updates the start at date from a subscription ```php -function deleteUsage( +function updateSubscriptionStartAt( string $subscriptionId, - string $itemId, - string $usageId, + UpdateSubscriptionStartAtRequest $request, ?string $idempotencyKey = null -): GetUsageResponse +): GetSubscriptionResponse ``` ## Parameters @@ -1148,83 +1151,95 @@ function 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 | +| `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 -[`GetUsageResponse`](../../doc/models/get-usage-response.md) +[`GetSubscriptionResponse`](../../doc/models/get-subscription-response.md) ## Example Usage ```php $subscriptionId = 'subscription_id0'; -$itemId = 'item_id0'; - -$usageId = 'usage_id0'; +$request = UpdateSubscriptionStartAtRequestBuilder::init( + DateTimeHelper::fromRfc3339DateTimeRequired('2016-03-13T12:52:32.123Z') +)->build(); -$result = $subscriptionsController->deleteUsage( +$result = $subscriptionsController->updateSubscriptionStartAt( $subscriptionId, - $itemId, - $usageId + $request ); ``` -# Create Discount +# Update Subscription Item -Creates a discount +Updates a subscription item ```php -function createDiscount( +function updateSubscriptionItem( string $subscriptionId, - CreateDiscountRequest $request, + string $itemId, + UpdateSubscriptionItemRequest $body, ?string $idempotencyKey = null -): GetDiscountResponse +): GetSubscriptionItemResponse ``` ## Parameters | 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 | +| `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 -[`GetDiscountResponse`](../../doc/models/get-discount-response.md) +[`GetSubscriptionItemResponse`](../../doc/models/get-subscription-item-response.md) ## Example Usage ```php $subscriptionId = 'subscription_id0'; -$request = CreateDiscountRequestBuilder::init( - 185.28, - 'discount_type4', - 'item_id6' +$itemId = 'item_id0'; + +$body = UpdateSubscriptionItemRequestBuilder::init( + 'description4', + 'status2', + UpdatePricingSchemeRequestBuilder::init( + 'scheme_type8', + [ + UpdatePriceBracketRequestBuilder::init( + 144, + 174 + )->build() + ] + )->build(), + 'name6' )->build(); -$result = $subscriptionsController->createDiscount( +$result = $subscriptionsController->updateSubscriptionItem( $subscriptionId, - $request + $itemId, + $body ); ``` -# Update Subscription Payment Method +# Create Subscription Item -Updates the payment method from a subscription +Creates a new Subscription item ```php -function updateSubscriptionPaymentMethod( +function createSubscriptionItem( string $subscriptionId, - UpdateSubscriptionPaymentMethodRequest $request, + CreateSubscriptionItemRequest $request, ?string $idempotencyKey = null -): GetSubscriptionResponse +): GetSubscriptionItemResponse ``` ## Parameters @@ -1232,43 +1247,48 @@ function updateSubscriptionPaymentMethod( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `subscriptionId` | `string` | Template, Required | Subscription id | -| `request` | [`UpdateSubscriptionPaymentMethodRequest`](../../doc/models/update-subscription-payment-method-request.md) | Body, Required | Request for updating the paymentmethod from a subscription | +| `request` | [`CreateSubscriptionItemRequest`](../../doc/models/create-subscription-item-request.md) | Body, Required | Request for creating a subscription item | | `idempotencyKey` | `?string` | Header, Optional | - | ## Response Type -[`GetSubscriptionResponse`](../../doc/models/get-subscription-response.md) +[`GetSubscriptionItemResponse`](../../doc/models/get-subscription-item-response.md) ## Example Usage ```php $subscriptionId = 'subscription_id0'; -$request = UpdateSubscriptionPaymentMethodRequestBuilder::init( - 'payment_method4', - 'card_id2', - CreateCardRequestBuilder::init() - ->type('credit') - ->build() +$request = CreateSubscriptionItemRequestBuilder::init( + 'description6', + CreatePricingSchemeRequestBuilder::init( + 'scheme_type8' + )->build(), + 'id6', + 'plan_item_id6', + [ + CreateDiscountRequestBuilder::init( + 90.66, + 'discount_type2', + 'item_id4' + )->build() + ], + 'name6' )->build(); -$result = $subscriptionsController->updateSubscriptionPaymentMethod( +$result = $subscriptionsController->createSubscriptionItem( $subscriptionId, $request ); ``` -# Create Increment +# Get Subscription -Creates a increment +Gets a subscription ```php -function createIncrement( - string $subscriptionId, - CreateIncrementRequest $request, - ?string $idempotencyKey = null -): GetIncrementResponse +function getSubscription(string $subscriptionId): GetSubscriptionResponse ``` ## Parameters @@ -1276,56 +1296,53 @@ function 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 | -| `idempotencyKey` | `?string` | Header, Optional | - | ## Response Type -[`GetIncrementResponse`](../../doc/models/get-increment-response.md) +[`GetSubscriptionResponse`](../../doc/models/get-subscription-response.md) ## Example Usage ```php $subscriptionId = 'subscription_id0'; -$request = CreateIncrementRequestBuilder::init( - 185.28, - 'increment_type8', - 'item_id6' -)->build(); - -$result = $subscriptionsController->createIncrement( - $subscriptionId, - $request -); +$result = $subscriptionsController->getSubscription($subscriptionId); ``` -# Create Usage +# Get Usages -Creates a usage +Lists all usages from a subscription item ```php -function createUsage( +function getUsages( string $subscriptionId, string $itemId, - CreateUsageRequest $body, - ?string $idempotencyKey = null -): GetUsageResponse + ?int $page = null, + ?int $size = null, + ?string $code = null, + ?string $group = null, + ?\DateTime $usedSince = null, + ?\DateTime $usedUntil = null +): ListUsagesResponse ``` ## 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 | The subscription id | +| `itemId` | `string` | Template, Required | The subscription item id | +| `page` | `?int` | Query, Optional | Page number | +| `size` | `?int` | 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` | `?DateTime` | Query, Optional | - | +| `usedUntil` | `?DateTime` | Query, Optional | - | ## Response Type -[`GetUsageResponse`](../../doc/models/get-usage-response.md) +[`ListUsagesResponse`](../../doc/models/list-usages-response.md) ## Example Usage @@ -1334,63 +1351,57 @@ $subscriptionId = 'subscription_id0'; $itemId = 'item_id0'; -$body = CreateUsageRequestBuilder::init( - 156, - 'description4', - DateTimeHelper::fromRfc3339DateTimeRequired('2016-03-13T12:52:32.123Z') -)->build(); - -$result = $subscriptionsController->createUsage( +$result = $subscriptionsController->getUsages( $subscriptionId, - $itemId, - $body + $itemId ); ``` -# Get Subscription Cycles +# Update Latest Period End At ```php -function getSubscriptionCycles(string $subscriptionId, string $page, string $size): ListCyclesResponse +function updateLatestPeriodEndAt( + string $subscriptionId, + UpdateCurrentCycleEndDateRequest $request, + ?string $idempotencyKey = null +): GetSubscriptionResponse ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `string` | Template, Required | Subscription Id | -| `page` | `string` | Query, Required | Page number | -| `size` | `string` | Query, Required | Page size | +| `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 -[`ListCyclesResponse`](../../doc/models/list-cycles-response.md) +[`GetSubscriptionResponse`](../../doc/models/get-subscription-response.md) ## Example Usage ```php $subscriptionId = 'subscription_id0'; -$page = 'page8'; - -$size = 'size0'; +$request = UpdateCurrentCycleEndDateRequestBuilder::init()->build(); -$result = $subscriptionsController->getSubscriptionCycles( +$result = $subscriptionsController->updateLatestPeriodEndAt( $subscriptionId, - $page, - $size + $request ); ``` -# Update Subscription Billing Date +# Update Subscription Minium Price -Updates the billing date from a subscription +Atualização do valor mínimo da assinatura ```php -function updateSubscriptionBillingDate( +function updateSubscriptionMiniumPrice( string $subscriptionId, - UpdateSubscriptionBillingDateRequest $request, + UpdateSubscriptionMinimumPriceRequest $request, ?string $idempotencyKey = null ): GetSubscriptionResponse ``` @@ -1399,8 +1410,8 @@ function 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 | +| `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 | | `idempotencyKey` | `?string` | Header, Optional | - | ## Response Type @@ -1412,27 +1423,19 @@ function updateSubscriptionBillingDate( ```php $subscriptionId = 'subscription_id0'; -$request = UpdateSubscriptionBillingDateRequestBuilder::init( - DateTimeHelper::fromRfc3339DateTimeRequired('2016-03-13T12:52:32.123Z') -)->build(); +$request = UpdateSubscriptionMinimumPriceRequestBuilder::init()->build(); -$result = $subscriptionsController->updateSubscriptionBillingDate( +$result = $subscriptionsController->updateSubscriptionMiniumPrice( $subscriptionId, $request ); ``` -# Update Subscription Start At - -Updates the start at date from a subscription +# Get Subscription Cycle by Id ```php -function updateSubscriptionStartAt( - string $subscriptionId, - UpdateSubscriptionStartAtRequest $request, - ?string $idempotencyKey = null -): GetSubscriptionResponse +function getSubscriptionCycleById(string $subscriptionId, string $cycleId): GetPeriodResponse ``` ## Parameters @@ -1440,25 +1443,22 @@ function 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 | -| `idempotencyKey` | `?string` | Header, Optional | - | +| `cycleId` | `string` | Template, Required | - | ## Response Type -[`GetSubscriptionResponse`](../../doc/models/get-subscription-response.md) +[`GetPeriodResponse`](../../doc/models/get-period-response.md) ## Example Usage ```php $subscriptionId = 'subscription_id0'; -$request = UpdateSubscriptionStartAtRequestBuilder::init( - DateTimeHelper::fromRfc3339DateTimeRequired('2016-03-13T12:52:32.123Z') -)->build(); +$cycleId = 'cycleId0'; -$result = $subscriptionsController->updateSubscriptionStartAt( +$result = $subscriptionsController->getSubscriptionCycleById( $subscriptionId, - $request + $cycleId ); ``` diff --git a/doc/controllers/tokens.md b/doc/controllers/tokens.md index 732e7a7..ba3d3f3 100644 --- a/doc/controllers/tokens.md +++ b/doc/controllers/tokens.md @@ -16,8 +16,6 @@ $tokensController = $client->getTokensController(); # Create Token -:information_source: **Note** This endpoint does not require authentication. - ```php function createToken( string $publicKey, @@ -67,8 +65,6 @@ $result = $tokensController->createToken( Gets a token from its id -:information_source: **Note** This endpoint does not require authentication. - ```php function getToken(string $id, string $publicKey): GetTokenResponse ``` diff --git a/doc/controllers/transfers.md b/doc/controllers/transfers.md index 306c6bf..36eb1cb 100644 --- a/doc/controllers/transfers.md +++ b/doc/controllers/transfers.md @@ -10,28 +10,9 @@ $transfersController = $client->getTransfersController(); ## Methods -* [Get Transfers](../../doc/controllers/transfers.md#get-transfers) * [Get Transfer by Id](../../doc/controllers/transfers.md#get-transfer-by-id) * [Create Transfer](../../doc/controllers/transfers.md#create-transfer) - - -# Get Transfers - -Gets all transfers - -```php -function getTransfers(): ListTransfers -``` - -## Response Type - -[`ListTransfers`](../../doc/models/list-transfers.md) - -## Example Usage - -```php -$result = $transfersController->getTransfers(); -``` +* [Get Transfers](../../doc/controllers/transfers.md#get-transfers) # Get Transfer by Id @@ -87,3 +68,22 @@ $request = CreateTransferBuilder::init( $result = $transfersController->createTransfer($request); ``` + +# Get Transfers + +Gets all transfers + +```php +function getTransfers(): ListTransfers +``` + +## Response Type + +[`ListTransfers`](../../doc/models/list-transfers.md) + +## Example Usage + +```php +$result = $transfersController->getTransfers(); +``` + diff --git a/doc/models/create-managing-partner-request.md b/doc/models/create-managing-partner-request.md index 5c327a1..f836932 100644 --- a/doc/models/create-managing-partner-request.md +++ b/doc/models/create-managing-partner-request.md @@ -16,7 +16,7 @@ Managing Partner Request | `document` | `string` | Required | - | getDocument(): string | setDocument(string document): void | | `motherName` | `string` | Required | - | getMotherName(): string | setMotherName(string motherName): void | | `birthdate` | `string` | Required | - | getBirthdate(): string | setBirthdate(string birthdate): void | -| `monthlyIncome` | `string` | Required | - | getMonthlyIncome(): string | setMonthlyIncome(string monthlyIncome): void | +| `monthlyIncome` | `int` | Required | - | getMonthlyIncome(): int | setMonthlyIncome(int monthlyIncome): void | | `professionalOccupation` | `string` | Required | - | getProfessionalOccupation(): string | setProfessionalOccupation(string professionalOccupation): void | | `selfDeclaredLegalRepresentative` | `bool` | Required | - | getSelfDeclaredLegalRepresentative(): bool | setSelfDeclaredLegalRepresentative(bool selfDeclaredLegalRepresentative): void | | `address` | [`CreateRegisterInformationAddressRequest`](../../doc/models/create-register-information-address-request.md) | Required | - | getAddress(): CreateRegisterInformationAddressRequest | setAddress(CreateRegisterInformationAddressRequest address): void | @@ -31,7 +31,7 @@ Managing Partner Request "document": "document2", "mother_name": "mother_name0", "birthdate": "birthdate8", - "monthly_income": "monthly_income0", + "monthly_income": 70, "professional_occupation": "professional_occupation8", "self_declared_legal_representative": false, "address": { diff --git a/doc/models/create-register-information-corporation-request.md b/doc/models/create-register-information-corporation-request.md index 70d9cee..841f7fe 100644 --- a/doc/models/create-register-information-corporation-request.md +++ b/doc/models/create-register-information-corporation-request.md @@ -15,7 +15,7 @@ | --- | --- | --- | --- | --- | --- | | `companyName` | `string` | Required | - | getCompanyName(): string | setCompanyName(string companyName): void | | `tradingName` | `string` | Required | - | getTradingName(): string | setTradingName(string tradingName): void | -| `annualRevenue` | `string` | Required | - | getAnnualRevenue(): string | setAnnualRevenue(string annualRevenue): void | +| `annualRevenue` | `int` | Required | - | getAnnualRevenue(): int | setAnnualRevenue(int annualRevenue): void | | `corporationType` | `?string` | Optional | - | getCorporationType(): ?string | setCorporationType(?string corporationType): void | | `foundingDate` | `?string` | Optional | - | getFoundingDate(): ?string | setFoundingDate(?string foundingDate): void | | `cnae` | `?string` | Optional | - | getCnae(): ?string | setCnae(?string cnae): void | @@ -38,7 +38,7 @@ ], "company_name": "company_name8", "trading_name": "trading_name0", - "annual_revenue": "annual_revenue0", + "annual_revenue": 156, "managing_partners": [ { "name": "name4", @@ -46,7 +46,7 @@ "document": "document8", "mother_name": "mother_name0", "birthdate": "birthdate8", - "monthly_income": "monthly_income0", + "monthly_income": 202, "professional_occupation": "professional_occupation8", "self_declared_legal_representative": false, "address": { diff --git a/doc/models/create-register-information-individual-request.md b/doc/models/create-register-information-individual-request.md index 6c087bf..6134ea9 100644 --- a/doc/models/create-register-information-individual-request.md +++ b/doc/models/create-register-information-individual-request.md @@ -16,7 +16,7 @@ | `name` | `string` | Required | - | getName(): string | setName(string name): void | | `motherName` | `?string` | Optional | - | getMotherName(): ?string | setMotherName(?string motherName): void | | `birthdate` | `string` | Required | - | getBirthdate(): string | setBirthdate(string birthdate): void | -| `monthlyIncome` | `string` | Required | - | getMonthlyIncome(): string | setMonthlyIncome(string monthlyIncome): void | +| `monthlyIncome` | `int` | Required | - | getMonthlyIncome(): int | setMonthlyIncome(int monthlyIncome): void | | `professionalOccupation` | `string` | Required | - | getProfessionalOccupation(): string | setProfessionalOccupation(string professionalOccupation): void | | `address` | [`CreateRegisterInformationAddressRequest`](../../doc/models/create-register-information-address-request.md) | Required | - | getAddress(): CreateRegisterInformationAddressRequest | setAddress(CreateRegisterInformationAddressRequest address): void | @@ -43,7 +43,7 @@ "name": "name6", "mother_name": "mother_name2", "birthdate": "birthdate0", - "monthly_income": "monthly_income2", + "monthly_income": 206, "professional_occupation": "professional_occupation0", "address": { "street": "street6", diff --git a/doc/models/get-transaction-response.md b/doc/models/get-transaction-response.md index 50e6a51..54189f5 100644 --- a/doc/models/get-transaction-response.md +++ b/doc/models/get-transaction-response.md @@ -40,11 +40,20 @@ Generic response object for getting a transaction. "status": "status6", "success": false, "created_at": "2016-03-13T12:52:32.123Z", - "statement_descriptor": "statement_descriptor2", - "acquirer_name": "acquirer_name6", - "acquirer_affiliation_code": "acquirer_affiliation_code6", - "acquirer_tid": "acquirer_tid8", - "acquirer_nsu": "acquirer_nsu8" + "qr_code": "qr_code0", + "qr_code_url": "qr_code_url6", + "expires_at": "2016-03-13T12:52:32.123Z", + "additional_information": [ + { + "Name": "Name0", + "Value": "Value2" + }, + { + "Name": "Name0", + "Value": "Value2" + } + ], + "end_to_end_id": "end_to_end_id6" } ``` diff --git a/doc/models/list-charge-transactions-response.md b/doc/models/list-charge-transactions-response.md index cc5f56a..84f7b68 100644 --- a/doc/models/list-charge-transactions-response.md +++ b/doc/models/list-charge-transactions-response.md @@ -25,11 +25,20 @@ Response object for listing charge transactions "status": "status6", "success": false, "created_at": "2016-03-13T12:52:32.123Z", - "statement_descriptor": "statement_descriptor2", - "acquirer_name": "acquirer_name6", - "acquirer_affiliation_code": "acquirer_affiliation_code6", - "acquirer_tid": "acquirer_tid8", - "acquirer_nsu": "acquirer_nsu8" + "qr_code": "qr_code0", + "qr_code_url": "qr_code_url6", + "expires_at": "2016-03-13T12:52:32.123Z", + "additional_information": [ + { + "Name": "Name0", + "Value": "Value2" + }, + { + "Name": "Name0", + "Value": "Value2" + } + ], + "end_to_end_id": "end_to_end_id6" }, { "gateway_id": "gateway_id8", @@ -37,11 +46,20 @@ Response object for listing charge transactions "status": "status6", "success": false, "created_at": "2016-03-13T12:52:32.123Z", - "statement_descriptor": "statement_descriptor2", - "acquirer_name": "acquirer_name6", - "acquirer_affiliation_code": "acquirer_affiliation_code6", - "acquirer_tid": "acquirer_tid8", - "acquirer_nsu": "acquirer_nsu8" + "qr_code": "qr_code0", + "qr_code_url": "qr_code_url6", + "expires_at": "2016-03-13T12:52:32.123Z", + "additional_information": [ + { + "Name": "Name0", + "Value": "Value2" + }, + { + "Name": "Name0", + "Value": "Value2" + } + ], + "end_to_end_id": "end_to_end_id6" } ], "paging": { diff --git a/doc/models/list-transactions-response.md b/doc/models/list-transactions-response.md index 9898977..563a573 100644 --- a/doc/models/list-transactions-response.md +++ b/doc/models/list-transactions-response.md @@ -25,11 +25,20 @@ Response object for listing transactions "status": "status6", "success": false, "created_at": "2016-03-13T12:52:32.123Z", - "statement_descriptor": "statement_descriptor2", - "acquirer_name": "acquirer_name6", - "acquirer_affiliation_code": "acquirer_affiliation_code6", - "acquirer_tid": "acquirer_tid8", - "acquirer_nsu": "acquirer_nsu8" + "qr_code": "qr_code0", + "qr_code_url": "qr_code_url6", + "expires_at": "2016-03-13T12:52:32.123Z", + "additional_information": [ + { + "Name": "Name0", + "Value": "Value2" + }, + { + "Name": "Name0", + "Value": "Value2" + } + ], + "end_to_end_id": "end_to_end_id6" }, { "gateway_id": "gateway_id8", @@ -37,11 +46,20 @@ Response object for listing transactions "status": "status6", "success": false, "created_at": "2016-03-13T12:52:32.123Z", - "statement_descriptor": "statement_descriptor2", - "acquirer_name": "acquirer_name6", - "acquirer_affiliation_code": "acquirer_affiliation_code6", - "acquirer_tid": "acquirer_tid8", - "acquirer_nsu": "acquirer_nsu8" + "qr_code": "qr_code0", + "qr_code_url": "qr_code_url6", + "expires_at": "2016-03-13T12:52:32.123Z", + "additional_information": [ + { + "Name": "Name0", + "Value": "Value2" + }, + { + "Name": "Name0", + "Value": "Value2" + } + ], + "end_to_end_id": "end_to_end_id6" }, { "gateway_id": "gateway_id8", @@ -49,11 +67,20 @@ Response object for listing transactions "status": "status6", "success": false, "created_at": "2016-03-13T12:52:32.123Z", - "statement_descriptor": "statement_descriptor2", - "acquirer_name": "acquirer_name6", - "acquirer_affiliation_code": "acquirer_affiliation_code6", - "acquirer_tid": "acquirer_tid8", - "acquirer_nsu": "acquirer_nsu8" + "qr_code": "qr_code0", + "qr_code_url": "qr_code_url6", + "expires_at": "2016-03-13T12:52:32.123Z", + "additional_information": [ + { + "Name": "Name0", + "Value": "Value2" + }, + { + "Name": "Name0", + "Value": "Value2" + } + ], + "end_to_end_id": "end_to_end_id6" } ], "paging": { diff --git a/src/ApiHelper.php b/src/ApiHelper.php index e8b1374..6d67757 100644 --- a/src/ApiHelper.php +++ b/src/ApiHelper.php @@ -27,15 +27,15 @@ class ApiHelper */ private const INHERITED_MODELS_MAP = [ Models\GetTransactionResponse::class => [ - Models\GetVoucherTransactionResponse::class, Models\GetBankTransferTransactionResponse::class, Models\GetSafetyPayTransactionResponse::class, - Models\GetDebitCardTransactionResponse::class, + Models\GetVoucherTransactionResponse::class, Models\GetBoletoTransactionResponse::class, - Models\GetCashTransactionResponse::class, + Models\GetDebitCardTransactionResponse::class, Models\GetPrivateLabelTransactionResponse::class, - Models\GetPixTransactionResponse::class, - Models\GetCreditCardTransactionResponse::class + Models\GetCashTransactionResponse::class, + Models\GetCreditCardTransactionResponse::class, + Models\GetPixTransactionResponse::class ], Models\GetMovementObjectBaseResponse::class => [ Models\GetMovementObjectRefundResponse::class, diff --git a/src/BasicAuthCredentials.php b/src/BasicAuthCredentials.php deleted file mode 100644 index 23d88d8..0000000 --- a/src/BasicAuthCredentials.php +++ /dev/null @@ -1,35 +0,0 @@ -required() - ); - $this->basicAuthUserName = $basicAuthUserName; - $this->basicAuthPassword = $basicAuthPassword; - } - - /** - * String value for basicAuthUserName. - */ - public function getBasicAuthUserName(): string - { - return $this->basicAuthUserName; - } - - /** - * String value for basicAuthPassword. - */ - public function getBasicAuthPassword(): string - { - return $this->basicAuthPassword; - } - - /** - * Checks if provided credentials match with existing ones. - * - * @param string $basicAuthUserName The username to use with basic authentication - * @param string $basicAuthPassword The password to use with basic authentication - */ - public function equals(string $basicAuthUserName, string $basicAuthPassword): bool - { - return $basicAuthUserName == $this->basicAuthUserName && - $basicAuthPassword == $this->basicAuthPassword; - } -} diff --git a/src/ConfigurationDefaults.php b/src/ConfigurationDefaults.php index 148c547..2ad7fbc 100644 --- a/src/ConfigurationDefaults.php +++ b/src/ConfigurationDefaults.php @@ -37,10 +37,6 @@ class ConfigurationDefaults public const ENVIRONMENT = Environment::PRODUCTION; - public const BASIC_AUTH_USER_NAME = ''; - - public const BASIC_AUTH_PASSWORD = ''; - /** * @var array Associative list of all default configurations */ @@ -55,8 +51,6 @@ class ConfigurationDefaults 'httpStatusCodesToRetry' => self::HTTP_STATUS_CODES_TO_RETRY, 'httpMethodsToRetry' => self::HTTP_METHODS_TO_RETRY, 'serviceRefererName' => self::SERVICE_REFERER_NAME, - 'environment' => self::ENVIRONMENT, - 'basicAuthUserName' => self::BASIC_AUTH_USER_NAME, - 'basicAuthPassword' => self::BASIC_AUTH_PASSWORD + 'environment' => self::ENVIRONMENT ]; } diff --git a/src/ConfigurationInterface.php b/src/ConfigurationInterface.php index 7bad9c3..e89478a 100644 --- a/src/ConfigurationInterface.php +++ b/src/ConfigurationInterface.php @@ -27,11 +27,6 @@ public function getServiceRefererName(): string; */ public function getEnvironment(): string; - /** - * Get the credentials to use with BasicAuth - */ - public function getBasicAuthCredentials(): ?BasicAuthCredentials; - /** * Get the base uri for a given server in the current environment. * diff --git a/src/Controllers/BalanceOperationsController.php b/src/Controllers/BalanceOperationsController.php index 8d027f6..fb623cc 100644 --- a/src/Controllers/BalanceOperationsController.php +++ b/src/Controllers/BalanceOperationsController.php @@ -37,7 +37,6 @@ public function getBalanceOperations( ?string $recipientId = null ): ListBalanceOperationResponse { $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/balance/operations') - ->auth('global') ->parameters( QueryParam::init('status', $status), QueryParam::init('created_since', $createdSince) @@ -62,7 +61,6 @@ public function getBalanceOperations( public function getBalanceOperationById(int $id): GetBalanceOperationResponse { $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/balance/operations/{id}') - ->auth('global') ->parameters(TemplateParam::init('id', $id)); $_resHandler = $this->responseHandler()->type(GetBalanceOperationResponse::class); diff --git a/src/Controllers/ChargesController.php b/src/Controllers/ChargesController.php index 30230af..9048de7 100644 --- a/src/Controllers/ChargesController.php +++ b/src/Controllers/ChargesController.php @@ -49,7 +49,6 @@ public function updateChargeMetadata( ?string $idempotencyKey = null ): GetChargeResponse { $_reqBuilder = $this->requestBuilder(RequestMethod::PATCH, '/Charges/{charge_id}/metadata') - ->auth('global') ->parameters( TemplateParam::init('charge_id', $chargeId), BodyParam::init($request), @@ -79,7 +78,6 @@ public function updateChargePaymentMethod( ?string $idempotencyKey = null ): GetChargeResponse { $_reqBuilder = $this->requestBuilder(RequestMethod::PATCH, '/charges/{charge_id}/payment-method') - ->auth('global') ->parameters( TemplateParam::init('charge_id', $chargeId), BodyParam::init($request), @@ -92,78 +90,53 @@ public function updateChargePaymentMethod( } /** - * Updates the card from a charge - * - * @param string $chargeId Charge id - * @param UpdateChargeCardRequest $request Request for updating a charge's card - * @param string|null $idempotencyKey + * @param string $chargeId Charge Id + * @param int|null $page Page number + * @param int|null $size Page size * - * @return GetChargeResponse Response from the API call + * @return ListChargeTransactionsResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function updateChargeCard( + public function getChargeTransactions( string $chargeId, - UpdateChargeCardRequest $request, - ?string $idempotencyKey = null - ): GetChargeResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::PATCH, '/charges/{charge_id}/card') - ->auth('global') + ?int $page = null, + ?int $size = null + ): ListChargeTransactionsResponse { + $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/charges/{charge_id}/transactions') ->parameters( TemplateParam::init('charge_id', $chargeId), - BodyParam::init($request), - HeaderParam::init('idempotency-key', $idempotencyKey) - ); - - $_resHandler = $this->responseHandler()->type(GetChargeResponse::class); - - return $this->execute($_reqBuilder, $_resHandler); - } - - /** - * @param string $status - * @param \DateTime|null $createdSince - * @param \DateTime|null $createdUntil - * - * @return GetChargesSummaryResponse Response from the API call - * - * @throws ApiException Thrown if API call fails - */ - public function getChargesSummary( - string $status, - ?\DateTime $createdSince = null, - ?\DateTime $createdUntil = null - ): GetChargesSummaryResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/charges/summary') - ->auth('global') - ->parameters( - QueryParam::init('status', $status), - QueryParam::init('created_since', $createdSince) - ->serializeBy([DateTimeHelper::class, 'toRfc3339DateTime']), - QueryParam::init('created_until', $createdUntil) - ->serializeBy([DateTimeHelper::class, 'toRfc3339DateTime']) + QueryParam::init('page', $page), + QueryParam::init('size', $size) ); - $_resHandler = $this->responseHandler()->type(GetChargesSummaryResponse::class); + $_resHandler = $this->responseHandler()->type(ListChargeTransactionsResponse::class); return $this->execute($_reqBuilder, $_resHandler); } /** - * Creates a new charge + * Updates the due date from a charge * - * @param CreateChargeRequest $request Request for creating a charge + * @param string $chargeId Charge Id + * @param UpdateChargeDueDateRequest $request Request for updating the due date * @param string|null $idempotencyKey * * @return GetChargeResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function createCharge(CreateChargeRequest $request, ?string $idempotencyKey = null): GetChargeResponse - { - $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/Charges') - ->auth('global') - ->parameters(BodyParam::init($request), HeaderParam::init('idempotency-key', $idempotencyKey)); + public function updateChargeDueDate( + string $chargeId, + UpdateChargeDueDateRequest $request, + ?string $idempotencyKey = null + ): GetChargeResponse { + $_reqBuilder = $this->requestBuilder(RequestMethod::PATCH, '/Charges/{charge_id}/due-date') + ->parameters( + TemplateParam::init('charge_id', $chargeId), + BodyParam::init($request), + HeaderParam::init('idempotency-key', $idempotencyKey) + ); $_resHandler = $this->responseHandler()->type(GetChargeResponse::class); @@ -171,28 +144,50 @@ public function createCharge(CreateChargeRequest $request, ?string $idempotencyK } /** - * @param string $chargeId Charge Id + * Lists all charges + * * @param int|null $page Page number * @param int|null $size Page size + * @param string|null $code Filter for charge's code + * @param string|null $status Filter for charge's status + * @param string|null $paymentMethod Filter for charge's payment method + * @param string|null $customerId Filter for charge's customer id + * @param string|null $orderId Filter for charge's order id + * @param \DateTime|null $createdSince Filter for the beginning of the range for charge's + * creation + * @param \DateTime|null $createdUntil Filter for the end of the range for charge's creation * - * @return ListChargeTransactionsResponse Response from the API call + * @return ListChargesResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function getChargeTransactions( - string $chargeId, + public function getCharges( ?int $page = null, - ?int $size = null - ): ListChargeTransactionsResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/charges/{charge_id}/transactions') - ->auth('global') + ?int $size = null, + ?string $code = null, + ?string $status = null, + ?string $paymentMethod = null, + ?string $customerId = null, + ?string $orderId = null, + ?\DateTime $createdSince = null, + ?\DateTime $createdUntil = null + ): ListChargesResponse { + $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/charges') ->parameters( - TemplateParam::init('charge_id', $chargeId), QueryParam::init('page', $page), - QueryParam::init('size', $size) + QueryParam::init('size', $size), + QueryParam::init('code', $code), + QueryParam::init('status', $status), + QueryParam::init('payment_method', $paymentMethod), + QueryParam::init('customer_id', $customerId), + QueryParam::init('order_id', $orderId), + QueryParam::init('created_since', $createdSince) + ->serializeBy([DateTimeHelper::class, 'toRfc3339DateTime']), + QueryParam::init('created_until', $createdUntil) + ->serializeBy([DateTimeHelper::class, 'toRfc3339DateTime']) ); - $_resHandler = $this->responseHandler()->type(ListChargeTransactionsResponse::class); + $_resHandler = $this->responseHandler()->type(ListChargesResponse::class); return $this->execute($_reqBuilder, $_resHandler); } @@ -214,7 +209,6 @@ public function captureCharge( ?string $idempotencyKey = null ): GetChargeResponse { $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/charges/{charge_id}/capture') - ->auth('global') ->parameters( TemplateParam::init('charge_id', $chargeId), BodyParam::init($request), @@ -227,19 +221,27 @@ public function captureCharge( } /** - * Get a charge from its id + * Updates the card from a charge * * @param string $chargeId Charge id + * @param UpdateChargeCardRequest $request Request for updating a charge's card + * @param string|null $idempotencyKey * * @return GetChargeResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function getCharge(string $chargeId): GetChargeResponse - { - $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/charges/{charge_id}') - ->auth('global') - ->parameters(TemplateParam::init('charge_id', $chargeId)); + public function updateChargeCard( + string $chargeId, + UpdateChargeCardRequest $request, + ?string $idempotencyKey = null + ): GetChargeResponse { + $_reqBuilder = $this->requestBuilder(RequestMethod::PATCH, '/charges/{charge_id}/card') + ->parameters( + TemplateParam::init('charge_id', $chargeId), + BodyParam::init($request), + HeaderParam::init('idempotency-key', $idempotencyKey) + ); $_resHandler = $this->responseHandler()->type(GetChargeResponse::class); @@ -247,28 +249,18 @@ public function getCharge(string $chargeId): GetChargeResponse } /** - * Cancel a charge + * Get a charge from its id * * @param string $chargeId Charge id - * @param CreateCancelChargeRequest|null $request Request for cancelling a charge - * @param string|null $idempotencyKey * * @return GetChargeResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function cancelCharge( - string $chargeId, - ?CreateCancelChargeRequest $request = null, - ?string $idempotencyKey = null - ): GetChargeResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::DELETE, '/charges/{charge_id}') - ->auth('global') - ->parameters( - TemplateParam::init('charge_id', $chargeId), - BodyParam::init($request), - HeaderParam::init('idempotency-key', $idempotencyKey) - ); + public function getCharge(string $chargeId): GetChargeResponse + { + $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/charges/{charge_id}') + ->parameters(TemplateParam::init('charge_id', $chargeId)); $_resHandler = $this->responseHandler()->type(GetChargeResponse::class); @@ -276,74 +268,48 @@ public function cancelCharge( } /** - * Lists all charges - * - * @param int|null $page Page number - * @param int|null $size Page size - * @param string|null $code Filter for charge's code - * @param string|null $status Filter for charge's status - * @param string|null $paymentMethod Filter for charge's payment method - * @param string|null $customerId Filter for charge's customer id - * @param string|null $orderId Filter for charge's order id - * @param \DateTime|null $createdSince Filter for the beginning of the range for charge's - * creation - * @param \DateTime|null $createdUntil Filter for the end of the range for charge's creation + * @param string $status + * @param \DateTime|null $createdSince + * @param \DateTime|null $createdUntil * - * @return ListChargesResponse Response from the API call + * @return GetChargesSummaryResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function getCharges( - ?int $page = null, - ?int $size = null, - ?string $code = null, - ?string $status = null, - ?string $paymentMethod = null, - ?string $customerId = null, - ?string $orderId = null, + public function getChargesSummary( + string $status, ?\DateTime $createdSince = null, ?\DateTime $createdUntil = null - ): ListChargesResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/charges') - ->auth('global') + ): GetChargesSummaryResponse { + $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/charges/summary') ->parameters( - QueryParam::init('page', $page), - QueryParam::init('size', $size), - QueryParam::init('code', $code), QueryParam::init('status', $status), - QueryParam::init('payment_method', $paymentMethod), - QueryParam::init('customer_id', $customerId), - QueryParam::init('order_id', $orderId), QueryParam::init('created_since', $createdSince) ->serializeBy([DateTimeHelper::class, 'toRfc3339DateTime']), QueryParam::init('created_until', $createdUntil) ->serializeBy([DateTimeHelper::class, 'toRfc3339DateTime']) ); - $_resHandler = $this->responseHandler()->type(ListChargesResponse::class); + $_resHandler = $this->responseHandler()->type(GetChargesSummaryResponse::class); return $this->execute($_reqBuilder, $_resHandler); } /** - * @param string $chargeId - * @param CreateConfirmPaymentRequest|null $request Request for confirm payment + * Retries a charge + * + * @param string $chargeId Charge id * @param string|null $idempotencyKey * * @return GetChargeResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function confirmPayment( - string $chargeId, - ?CreateConfirmPaymentRequest $request = null, - ?string $idempotencyKey = null - ): GetChargeResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/charges/{charge_id}/confirm-payment') - ->auth('global') + public function retryCharge(string $chargeId, ?string $idempotencyKey = null): GetChargeResponse + { + $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/charges/{charge_id}/retry') ->parameters( TemplateParam::init('charge_id', $chargeId), - BodyParam::init($request), HeaderParam::init('idempotency-key', $idempotencyKey) ); @@ -353,23 +319,22 @@ public function confirmPayment( } /** - * Updates the due date from a charge + * Cancel a charge * - * @param string $chargeId Charge Id - * @param UpdateChargeDueDateRequest $request Request for updating the due date + * @param string $chargeId Charge id + * @param CreateCancelChargeRequest|null $request Request for cancelling a charge * @param string|null $idempotencyKey * * @return GetChargeResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function updateChargeDueDate( + public function cancelCharge( string $chargeId, - UpdateChargeDueDateRequest $request, + ?CreateCancelChargeRequest $request = null, ?string $idempotencyKey = null ): GetChargeResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::PATCH, '/Charges/{charge_id}/due-date') - ->auth('global') + $_reqBuilder = $this->requestBuilder(RequestMethod::DELETE, '/charges/{charge_id}') ->parameters( TemplateParam::init('charge_id', $chargeId), BodyParam::init($request), @@ -382,21 +347,43 @@ public function updateChargeDueDate( } /** - * Retries a charge + * Creates a new charge * - * @param string $chargeId Charge id + * @param CreateChargeRequest $request Request for creating a charge * @param string|null $idempotencyKey * * @return GetChargeResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function retryCharge(string $chargeId, ?string $idempotencyKey = null): GetChargeResponse + public function createCharge(CreateChargeRequest $request, ?string $idempotencyKey = null): GetChargeResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/charges/{charge_id}/retry') - ->auth('global') + $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/Charges') + ->parameters(BodyParam::init($request), HeaderParam::init('idempotency-key', $idempotencyKey)); + + $_resHandler = $this->responseHandler()->type(GetChargeResponse::class); + + return $this->execute($_reqBuilder, $_resHandler); + } + + /** + * @param string $chargeId + * @param CreateConfirmPaymentRequest|null $request Request for confirm payment + * @param string|null $idempotencyKey + * + * @return GetChargeResponse Response from the API call + * + * @throws ApiException Thrown if API call fails + */ + public function confirmPayment( + string $chargeId, + ?CreateConfirmPaymentRequest $request = null, + ?string $idempotencyKey = null + ): GetChargeResponse { + $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/charges/{charge_id}/confirm-payment') ->parameters( TemplateParam::init('charge_id', $chargeId), + BodyParam::init($request), HeaderParam::init('idempotency-key', $idempotencyKey) ); diff --git a/src/Controllers/CustomersController.php b/src/Controllers/CustomersController.php index c9ad0e0..995fc1a 100644 --- a/src/Controllers/CustomersController.php +++ b/src/Controllers/CustomersController.php @@ -54,7 +54,6 @@ public function updateCard( ?string $idempotencyKey = null ): GetCardResponse { $_reqBuilder = $this->requestBuilder(RequestMethod::PUT, '/customers/{customer_id}/cards/{card_id}') - ->auth('global') ->parameters( TemplateParam::init('customer_id', $customerId), TemplateParam::init('card_id', $cardId), @@ -86,7 +85,6 @@ public function updateAddress( ?string $idempotencyKey = null ): GetAddressResponse { $_reqBuilder = $this->requestBuilder(RequestMethod::PUT, '/customers/{customer_id}/addresses/{address_id}') - ->auth('global') ->parameters( TemplateParam::init('customer_id', $customerId), TemplateParam::init('address_id', $addressId), @@ -119,7 +117,6 @@ public function deleteAccessToken( RequestMethod::DELETE, '/customers/{customer_id}/access-tokens/{token_id}' ) - ->auth('global') ->parameters( TemplateParam::init('customer_id', $customerId), TemplateParam::init('token_id', $tokenId), @@ -131,35 +128,6 @@ public function deleteAccessToken( return $this->execute($_reqBuilder, $_resHandler); } - /** - * Creates a new address for a customer - * - * @param string $customerId Customer Id - * @param CreateAddressRequest $request Request for creating an address - * @param string|null $idempotencyKey - * - * @return GetAddressResponse Response from the API call - * - * @throws ApiException Thrown if API call fails - */ - public function createAddress( - string $customerId, - CreateAddressRequest $request, - ?string $idempotencyKey = null - ): GetAddressResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/customers/{customer_id}/addresses') - ->auth('global') - ->parameters( - TemplateParam::init('customer_id', $customerId), - BodyParam::init($request), - HeaderParam::init('idempotency-key', $idempotencyKey) - ); - - $_resHandler = $this->responseHandler()->type(GetAddressResponse::class); - - return $this->execute($_reqBuilder, $_resHandler); - } - /** * Creates a new customer * @@ -173,7 +141,6 @@ public function createAddress( public function createCustomer(CreateCustomerRequest $request, ?string $idempotencyKey = null): GetCustomerResponse { $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/customers') - ->auth('global') ->parameters(BodyParam::init($request), HeaderParam::init('idempotency-key', $idempotencyKey)); $_resHandler = $this->responseHandler()->type(GetCustomerResponse::class); @@ -182,82 +149,48 @@ public function createCustomer(CreateCustomerRequest $request, ?string $idempote } /** - * Creates a new card for a customer + * Creates a new address for a customer * - * @param string $customerId Customer id - * @param CreateCardRequest $request Request for creating a card + * @param string $customerId Customer Id + * @param CreateAddressRequest $request Request for creating an address * @param string|null $idempotencyKey * - * @return GetCardResponse Response from the API call + * @return GetAddressResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function createCard( + public function createAddress( string $customerId, - CreateCardRequest $request, + CreateAddressRequest $request, ?string $idempotencyKey = null - ): GetCardResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/customers/{customer_id}/cards') - ->auth('global') + ): GetAddressResponse { + $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/customers/{customer_id}/addresses') ->parameters( TemplateParam::init('customer_id', $customerId), BodyParam::init($request), HeaderParam::init('idempotency-key', $idempotencyKey) ); - $_resHandler = $this->responseHandler()->type(GetCardResponse::class); + $_resHandler = $this->responseHandler()->type(GetAddressResponse::class); return $this->execute($_reqBuilder, $_resHandler); } /** - * Get all cards from a customer + * Delete a Customer's access tokens * * @param string $customerId Customer Id - * @param int|null $page Page number - * @param int|null $size Page size - * - * @return ListCardsResponse Response from the API call - * - * @throws ApiException Thrown if API call fails - */ - public function getCards(string $customerId, ?int $page = null, ?int $size = null): ListCardsResponse - { - $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/customers/{customer_id}/cards') - ->auth('global') - ->parameters( - TemplateParam::init('customer_id', $customerId), - QueryParam::init('page', $page), - QueryParam::init('size', $size) - ); - - $_resHandler = $this->responseHandler()->type(ListCardsResponse::class); - - return $this->execute($_reqBuilder, $_resHandler); - } - - /** - * Renew a card * - * @param string $customerId Customer id - * @param string $cardId Card Id - * @param string|null $idempotencyKey - * - * @return GetCardResponse Response from the API call + * @return ListAccessTokensResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function renewCard(string $customerId, string $cardId, ?string $idempotencyKey = null): GetCardResponse + public function deleteAccessTokens(string $customerId): ListAccessTokensResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/customers/{customer_id}/cards/{card_id}/renew') - ->auth('global') - ->parameters( - TemplateParam::init('customer_id', $customerId), - TemplateParam::init('card_id', $cardId), - HeaderParam::init('idempotency-key', $idempotencyKey) - ); + $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/customers/{customer_id}/access-tokens/') + ->parameters(TemplateParam::init('customer_id', $customerId)); - $_resHandler = $this->responseHandler()->type(GetCardResponse::class); + $_resHandler = $this->responseHandler()->type(ListAccessTokensResponse::class); return $this->execute($_reqBuilder, $_resHandler); } @@ -275,7 +208,6 @@ public function renewCard(string $customerId, string $cardId, ?string $idempoten public function getAddress(string $customerId, string $addressId): GetAddressResponse { $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/customers/{customer_id}/addresses/{address_id}') - ->auth('global') ->parameters( TemplateParam::init('customer_id', $customerId), TemplateParam::init('address_id', $addressId) @@ -306,7 +238,6 @@ public function deleteAddress( RequestMethod::DELETE, '/customers/{customer_id}/addresses/{address_id}' ) - ->auth('global') ->parameters( TemplateParam::init('customer_id', $customerId), TemplateParam::init('address_id', $addressId), @@ -319,98 +250,94 @@ public function deleteAddress( } /** - * Get a Customer's access token - * - * @param string $customerId Customer Id - * @param string $tokenId Token Id - * - * @return GetAccessTokenResponse Response from the API call - * - * @throws ApiException Thrown if API call fails - */ - public function getAccessToken(string $customerId, string $tokenId): GetAccessTokenResponse - { - $_reqBuilder = $this->requestBuilder( - RequestMethod::GET, - '/customers/{customer_id}/access-tokens/{token_id}' - ) - ->auth('global') - ->parameters( - TemplateParam::init('customer_id', $customerId), - TemplateParam::init('token_id', $tokenId) - ); - - $_resHandler = $this->responseHandler()->type(GetAccessTokenResponse::class); - - return $this->execute($_reqBuilder, $_resHandler); - } - - /** - * Updates the metadata a customer + * Creates a new card for a customer * - * @param string $customerId The customer id - * @param UpdateMetadataRequest $request Request for updating the customer metadata + * @param string $customerId Customer id + * @param CreateCardRequest $request Request for creating a card * @param string|null $idempotencyKey * - * @return GetCustomerResponse Response from the API call + * @return GetCardResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function updateCustomerMetadata( + public function createCard( string $customerId, - UpdateMetadataRequest $request, + CreateCardRequest $request, ?string $idempotencyKey = null - ): GetCustomerResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::PATCH, '/Customers/{customer_id}/metadata') - ->auth('global') + ): GetCardResponse { + $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/customers/{customer_id}/cards') ->parameters( TemplateParam::init('customer_id', $customerId), BodyParam::init($request), HeaderParam::init('idempotency-key', $idempotencyKey) ); - $_resHandler = $this->responseHandler()->type(GetCustomerResponse::class); + $_resHandler = $this->responseHandler()->type(GetCardResponse::class); return $this->execute($_reqBuilder, $_resHandler); } /** - * Get a customer's card + * Get all Customers * - * @param string $customerId Customer id - * @param string $cardId Card id + * @param string|null $name Name of the Customer + * @param string|null $document Document of the Customer + * @param int|null $page Current page the the search + * @param int|null $size Quantity pages of the search + * @param string|null $email Customer's email + * @param string|null $code Customer's code * - * @return GetCardResponse Response from the API call + * @return ListCustomersResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function getCard(string $customerId, string $cardId): GetCardResponse - { - $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/customers/{customer_id}/cards/{card_id}') - ->auth('global') - ->parameters(TemplateParam::init('customer_id', $customerId), TemplateParam::init('card_id', $cardId)); + public function getCustomers( + ?string $name = null, + ?string $document = null, + ?int $page = 1, + ?int $size = 10, + ?string $email = null, + ?string $code = null + ): ListCustomersResponse { + $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/customers') + ->parameters( + QueryParam::init('name', $name), + QueryParam::init('document', $document), + QueryParam::init('page', $page), + QueryParam::init('size', $size), + QueryParam::init('email', $email), + QueryParam::init('Code', $code) + ); - $_resHandler = $this->responseHandler()->type(GetCardResponse::class); + $_resHandler = $this->responseHandler()->type(ListCustomersResponse::class); return $this->execute($_reqBuilder, $_resHandler); } /** - * Delete a Customer's access tokens + * Updates a customer * - * @param string $customerId Customer Id + * @param string $customerId Customer id + * @param UpdateCustomerRequest $request Request for updating a customer + * @param string|null $idempotencyKey * - * @return ListAccessTokensResponse Response from the API call + * @return GetCustomerResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function deleteAccessTokens(string $customerId): ListAccessTokensResponse - { - $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/customers/{customer_id}/access-tokens/') - ->auth('global') - ->parameters(TemplateParam::init('customer_id', $customerId)); + public function updateCustomer( + string $customerId, + UpdateCustomerRequest $request, + ?string $idempotencyKey = null + ): GetCustomerResponse { + $_reqBuilder = $this->requestBuilder(RequestMethod::PUT, '/customers/{customer_id}') + ->parameters( + TemplateParam::init('customer_id', $customerId), + BodyParam::init($request), + HeaderParam::init('idempotency-key', $idempotencyKey) + ); - $_resHandler = $this->responseHandler()->type(ListAccessTokensResponse::class); + $_resHandler = $this->responseHandler()->type(GetCustomerResponse::class); return $this->execute($_reqBuilder, $_resHandler); } @@ -432,7 +359,6 @@ public function createAccessToken( ?string $idempotencyKey = null ): GetAccessTokenResponse { $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/customers/{customer_id}/access-tokens') - ->auth('global') ->parameters( TemplateParam::init('customer_id', $customerId), BodyParam::init($request), @@ -458,7 +384,6 @@ public function createAccessToken( public function getAccessTokens(string $customerId, ?int $page = null, ?int $size = null): ListAccessTokensResponse { $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/customers/{customer_id}/access-tokens') - ->auth('global') ->parameters( TemplateParam::init('customer_id', $customerId), QueryParam::init('page', $page), @@ -471,61 +396,94 @@ public function getAccessTokens(string $customerId, ?int $page = null, ?int $siz } /** - * Get all Customers + * Get all cards from a customer * - * @param string|null $name Name of the Customer - * @param string|null $document Document of the Customer - * @param int|null $page Current page the the search - * @param int|null $size Quantity pages of the search - * @param string|null $email Customer's email - * @param string|null $code Customer's code + * @param string $customerId Customer Id + * @param int|null $page Page number + * @param int|null $size Page size * - * @return ListCustomersResponse Response from the API call + * @return ListCardsResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function getCustomers( - ?string $name = null, - ?string $document = null, - ?int $page = 1, - ?int $size = 10, - ?string $email = null, - ?string $code = null - ): ListCustomersResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/customers') - ->auth('global') + public function getCards(string $customerId, ?int $page = null, ?int $size = null): ListCardsResponse + { + $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/customers/{customer_id}/cards') ->parameters( - QueryParam::init('name', $name), - QueryParam::init('document', $document), + TemplateParam::init('customer_id', $customerId), QueryParam::init('page', $page), - QueryParam::init('size', $size), - QueryParam::init('email', $email), - QueryParam::init('Code', $code) + QueryParam::init('size', $size) ); - $_resHandler = $this->responseHandler()->type(ListCustomersResponse::class); + $_resHandler = $this->responseHandler()->type(ListCardsResponse::class); return $this->execute($_reqBuilder, $_resHandler); } /** - * Updates a customer + * Renew a card * * @param string $customerId Customer id - * @param UpdateCustomerRequest $request Request for updating a customer + * @param string $cardId Card Id + * @param string|null $idempotencyKey + * + * @return GetCardResponse Response from the API call + * + * @throws ApiException Thrown if API call fails + */ + public function renewCard(string $customerId, string $cardId, ?string $idempotencyKey = null): GetCardResponse + { + $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/customers/{customer_id}/cards/{card_id}/renew') + ->parameters( + TemplateParam::init('customer_id', $customerId), + TemplateParam::init('card_id', $cardId), + HeaderParam::init('idempotency-key', $idempotencyKey) + ); + + $_resHandler = $this->responseHandler()->type(GetCardResponse::class); + + return $this->execute($_reqBuilder, $_resHandler); + } + + /** + * Get a Customer's access token + * + * @param string $customerId Customer Id + * @param string $tokenId Token Id + * + * @return GetAccessTokenResponse Response from the API call + * + * @throws ApiException Thrown if API call fails + */ + public function getAccessToken(string $customerId, string $tokenId): GetAccessTokenResponse + { + $_reqBuilder = $this->requestBuilder( + RequestMethod::GET, + '/customers/{customer_id}/access-tokens/{token_id}' + )->parameters(TemplateParam::init('customer_id', $customerId), TemplateParam::init('token_id', $tokenId)); + + $_resHandler = $this->responseHandler()->type(GetAccessTokenResponse::class); + + return $this->execute($_reqBuilder, $_resHandler); + } + + /** + * Updates the metadata a customer + * + * @param string $customerId The customer id + * @param UpdateMetadataRequest $request Request for updating the customer metadata * @param string|null $idempotencyKey * * @return GetCustomerResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function updateCustomer( + public function updateCustomerMetadata( string $customerId, - UpdateCustomerRequest $request, + UpdateMetadataRequest $request, ?string $idempotencyKey = null ): GetCustomerResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::PUT, '/customers/{customer_id}') - ->auth('global') + $_reqBuilder = $this->requestBuilder(RequestMethod::PATCH, '/Customers/{customer_id}/metadata') ->parameters( TemplateParam::init('customer_id', $customerId), BodyParam::init($request), @@ -551,7 +509,6 @@ public function updateCustomer( public function deleteCard(string $customerId, string $cardId, ?string $idempotencyKey = null): GetCardResponse { $_reqBuilder = $this->requestBuilder(RequestMethod::DELETE, '/customers/{customer_id}/cards/{card_id}') - ->auth('global') ->parameters( TemplateParam::init('customer_id', $customerId), TemplateParam::init('card_id', $cardId), @@ -577,7 +534,6 @@ public function deleteCard(string $customerId, string $cardId, ?string $idempote public function getAddresses(string $customerId, ?int $page = null, ?int $size = null): ListAddressesResponse { $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/customers/{customer_id}/addresses') - ->auth('global') ->parameters( TemplateParam::init('customer_id', $customerId), QueryParam::init('page', $page), @@ -601,11 +557,30 @@ public function getAddresses(string $customerId, ?int $page = null, ?int $size = public function getCustomer(string $customerId): GetCustomerResponse { $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/customers/{customer_id}') - ->auth('global') ->parameters(TemplateParam::init('customer_id', $customerId)); $_resHandler = $this->responseHandler()->type(GetCustomerResponse::class); return $this->execute($_reqBuilder, $_resHandler); } + + /** + * Get a customer's card + * + * @param string $customerId Customer id + * @param string $cardId Card id + * + * @return GetCardResponse Response from the API call + * + * @throws ApiException Thrown if API call fails + */ + public function getCard(string $customerId, string $cardId): GetCardResponse + { + $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/customers/{customer_id}/cards/{card_id}') + ->parameters(TemplateParam::init('customer_id', $customerId), TemplateParam::init('card_id', $cardId)); + + $_resHandler = $this->responseHandler()->type(GetCardResponse::class); + + return $this->execute($_reqBuilder, $_resHandler); + } } diff --git a/src/Controllers/InvoicesController.php b/src/Controllers/InvoicesController.php index 857a90a..375eaa6 100644 --- a/src/Controllers/InvoicesController.php +++ b/src/Controllers/InvoicesController.php @@ -25,6 +25,76 @@ class InvoicesController extends BaseController { + /** + * Updates the metadata from an invoice + * + * @param string $invoiceId The invoice id + * @param UpdateMetadataRequest $request Request for updating the invoice metadata + * @param string|null $idempotencyKey + * + * @return GetInvoiceResponse Response from the API call + * + * @throws ApiException Thrown if API call fails + */ + public function updateInvoiceMetadata( + string $invoiceId, + UpdateMetadataRequest $request, + ?string $idempotencyKey = null + ): GetInvoiceResponse { + $_reqBuilder = $this->requestBuilder(RequestMethod::PATCH, '/invoices/{invoice_id}/metadata') + ->parameters( + TemplateParam::init('invoice_id', $invoiceId), + BodyParam::init($request), + HeaderParam::init('idempotency-key', $idempotencyKey) + ); + + $_resHandler = $this->responseHandler()->type(GetInvoiceResponse::class); + + return $this->execute($_reqBuilder, $_resHandler); + } + + /** + * @param string $subscriptionId Subscription Id + * + * @return GetInvoiceResponse Response from the API call + * + * @throws ApiException Thrown if API call fails + */ + public function getPartialInvoice(string $subscriptionId): GetInvoiceResponse + { + $_reqBuilder = $this->requestBuilder( + RequestMethod::GET, + '/subscriptions/{subscription_id}/partial-invoice' + )->parameters(TemplateParam::init('subscription_id', $subscriptionId)); + + $_resHandler = $this->responseHandler()->type(GetInvoiceResponse::class); + + return $this->execute($_reqBuilder, $_resHandler); + } + + /** + * Cancels an invoice + * + * @param string $invoiceId Invoice id + * @param string|null $idempotencyKey + * + * @return GetInvoiceResponse Response from the API call + * + * @throws ApiException Thrown if API call fails + */ + public function cancelInvoice(string $invoiceId, ?string $idempotencyKey = null): GetInvoiceResponse + { + $_reqBuilder = $this->requestBuilder(RequestMethod::DELETE, '/invoices/{invoice_id}') + ->parameters( + TemplateParam::init('invoice_id', $invoiceId), + HeaderParam::init('idempotency-key', $idempotencyKey) + ); + + $_resHandler = $this->responseHandler()->type(GetInvoiceResponse::class); + + return $this->execute($_reqBuilder, $_resHandler); + } + /** * Create an Invoice * @@ -47,7 +117,6 @@ public function createInvoice( RequestMethod::POST, '/subscriptions/{subscription_id}/cycles/{cycle_id}/pay' ) - ->auth('global') ->parameters( TemplateParam::init('subscription_id', $subscriptionId), TemplateParam::init('cycle_id', $cycleId), @@ -93,7 +162,6 @@ public function getInvoices( ?string $customerDocument = null ): ListInvoicesResponse { $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/invoices') - ->auth('global') ->parameters( QueryParam::init('page', $page), QueryParam::init('size', $size), @@ -116,71 +184,18 @@ public function getInvoices( } /** - * Cancels an invoice - * - * @param string $invoiceId Invoice id - * @param string|null $idempotencyKey - * - * @return GetInvoiceResponse Response from the API call - * - * @throws ApiException Thrown if API call fails - */ - public function cancelInvoice(string $invoiceId, ?string $idempotencyKey = null): GetInvoiceResponse - { - $_reqBuilder = $this->requestBuilder(RequestMethod::DELETE, '/invoices/{invoice_id}') - ->auth('global') - ->parameters( - TemplateParam::init('invoice_id', $invoiceId), - HeaderParam::init('idempotency-key', $idempotencyKey) - ); - - $_resHandler = $this->responseHandler()->type(GetInvoiceResponse::class); - - return $this->execute($_reqBuilder, $_resHandler); - } - - /** - * Updates the metadata from an invoice - * - * @param string $invoiceId The invoice id - * @param UpdateMetadataRequest $request Request for updating the invoice metadata - * @param string|null $idempotencyKey - * - * @return GetInvoiceResponse Response from the API call + * Gets an invoice * - * @throws ApiException Thrown if API call fails - */ - public function updateInvoiceMetadata( - string $invoiceId, - UpdateMetadataRequest $request, - ?string $idempotencyKey = null - ): GetInvoiceResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::PATCH, '/invoices/{invoice_id}/metadata') - ->auth('global') - ->parameters( - TemplateParam::init('invoice_id', $invoiceId), - BodyParam::init($request), - HeaderParam::init('idempotency-key', $idempotencyKey) - ); - - $_resHandler = $this->responseHandler()->type(GetInvoiceResponse::class); - - return $this->execute($_reqBuilder, $_resHandler); - } - - /** - * @param string $subscriptionId Subscription Id + * @param string $invoiceId Invoice Id * * @return GetInvoiceResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function getPartialInvoice(string $subscriptionId): GetInvoiceResponse + public function getInvoice(string $invoiceId): GetInvoiceResponse { - $_reqBuilder = $this->requestBuilder( - RequestMethod::GET, - '/subscriptions/{subscription_id}/partial-invoice' - )->auth('global')->parameters(TemplateParam::init('subscription_id', $subscriptionId)); + $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/invoices/{invoice_id}') + ->parameters(TemplateParam::init('invoice_id', $invoiceId)); $_resHandler = $this->responseHandler()->type(GetInvoiceResponse::class); @@ -204,7 +219,6 @@ public function updateInvoiceStatus( ?string $idempotencyKey = null ): GetInvoiceResponse { $_reqBuilder = $this->requestBuilder(RequestMethod::PATCH, '/invoices/{invoice_id}/status') - ->auth('global') ->parameters( TemplateParam::init('invoice_id', $invoiceId), BodyParam::init($request), @@ -215,24 +229,4 @@ public function updateInvoiceStatus( return $this->execute($_reqBuilder, $_resHandler); } - - /** - * Gets an invoice - * - * @param string $invoiceId Invoice Id - * - * @return GetInvoiceResponse Response from the API call - * - * @throws ApiException Thrown if API call fails - */ - public function getInvoice(string $invoiceId): GetInvoiceResponse - { - $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/invoices/{invoice_id}') - ->auth('global') - ->parameters(TemplateParam::init('invoice_id', $invoiceId)); - - $_resHandler = $this->responseHandler()->type(GetInvoiceResponse::class); - - return $this->execute($_reqBuilder, $_resHandler); - } } diff --git a/src/Controllers/OrdersController.php b/src/Controllers/OrdersController.php index cabe654..fd63294 100644 --- a/src/Controllers/OrdersController.php +++ b/src/Controllers/OrdersController.php @@ -53,7 +53,6 @@ public function getOrders( ?string $customerId = null ): ListOrderResponse { $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/orders') - ->auth('global') ->parameters( QueryParam::init('page', $page), QueryParam::init('size', $size), @@ -74,16 +73,26 @@ public function getOrders( /** * @param string $orderId Order Id * @param string $itemId Item Id + * @param UpdateOrderItemRequest $request Item Model + * @param string|null $idempotencyKey * * @return GetOrderItemResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function getOrderItem(string $orderId, string $itemId): GetOrderItemResponse - { - $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/orders/{orderId}/items/{itemId}') - ->auth('global') - ->parameters(TemplateParam::init('orderId', $orderId), TemplateParam::init('itemId', $itemId)); + public function updateOrderItem( + string $orderId, + string $itemId, + UpdateOrderItemRequest $request, + ?string $idempotencyKey = null + ): GetOrderItemResponse { + $_reqBuilder = $this->requestBuilder(RequestMethod::PUT, '/orders/{orderId}/items/{itemId}') + ->parameters( + TemplateParam::init('orderId', $orderId), + TemplateParam::init('itemId', $itemId), + BodyParam::init($request), + HeaderParam::init('idempotency-key', $idempotencyKey) + ); $_resHandler = $this->responseHandler()->type(GetOrderItemResponse::class); @@ -91,25 +100,52 @@ public function getOrderItem(string $orderId, string $itemId): GetOrderItemRespo } /** - * Gets an order - * - * @param string $orderId Order id + * @param string $orderId Order Id + * @param string|null $idempotencyKey * * @return GetOrderResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function getOrder(string $orderId): GetOrderResponse + public function deleteAllOrderItems(string $orderId, ?string $idempotencyKey = null): GetOrderResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/orders/{order_id}') - ->auth('global') - ->parameters(TemplateParam::init('order_id', $orderId)); + $_reqBuilder = $this->requestBuilder(RequestMethod::DELETE, '/orders/{orderId}/items') + ->parameters( + TemplateParam::init('orderId', $orderId), + HeaderParam::init('idempotency-key', $idempotencyKey) + ); $_resHandler = $this->responseHandler()->type(GetOrderResponse::class); return $this->execute($_reqBuilder, $_resHandler); } + /** + * @param string $orderId Order Id + * @param string $itemId Item Id + * @param string|null $idempotencyKey + * + * @return GetOrderItemResponse Response from the API call + * + * @throws ApiException Thrown if API call fails + */ + public function deleteOrderItem( + string $orderId, + string $itemId, + ?string $idempotencyKey = null + ): GetOrderItemResponse { + $_reqBuilder = $this->requestBuilder(RequestMethod::DELETE, '/orders/{orderId}/items/{itemId}') + ->parameters( + TemplateParam::init('orderId', $orderId), + TemplateParam::init('itemId', $itemId), + HeaderParam::init('idempotency-key', $idempotencyKey) + ); + + $_resHandler = $this->responseHandler()->type(GetOrderItemResponse::class); + + return $this->execute($_reqBuilder, $_resHandler); + } + /** * @param string $id Order Id * @param UpdateOrderStatusRequest $request Update Order Model @@ -125,7 +161,6 @@ public function closeOrder( ?string $idempotencyKey = null ): GetOrderResponse { $_reqBuilder = $this->requestBuilder(RequestMethod::PATCH, '/orders/{id}/closed') - ->auth('global') ->parameters( TemplateParam::init('id', $id), BodyParam::init($request), @@ -150,7 +185,6 @@ public function closeOrder( public function createOrder(CreateOrderRequest $body, ?string $idempotencyKey = null): GetOrderResponse { $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/orders') - ->auth('global') ->parameters(BodyParam::init($body), HeaderParam::init('idempotency-key', $idempotencyKey)); $_resHandler = $this->responseHandler()->type(GetOrderResponse::class); @@ -160,25 +194,21 @@ public function createOrder(CreateOrderRequest $body, ?string $idempotencyKey = /** * @param string $orderId Order Id - * @param string $itemId Item Id - * @param UpdateOrderItemRequest $request Item Model + * @param CreateOrderItemRequest $request Order Item Model * @param string|null $idempotencyKey * * @return GetOrderItemResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function updateOrderItem( + public function createOrderItem( string $orderId, - string $itemId, - UpdateOrderItemRequest $request, + CreateOrderItemRequest $request, ?string $idempotencyKey = null ): GetOrderItemResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::PUT, '/orders/{orderId}/items/{itemId}') - ->auth('global') + $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/orders/{orderId}/items') ->parameters( TemplateParam::init('orderId', $orderId), - TemplateParam::init('itemId', $itemId), BodyParam::init($request), HeaderParam::init('idempotency-key', $idempotencyKey) ); @@ -190,22 +220,18 @@ public function updateOrderItem( /** * @param string $orderId Order Id - * @param string|null $idempotencyKey + * @param string $itemId Item Id * - * @return GetOrderResponse Response from the API call + * @return GetOrderItemResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function deleteAllOrderItems(string $orderId, ?string $idempotencyKey = null): GetOrderResponse + public function getOrderItem(string $orderId, string $itemId): GetOrderItemResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::DELETE, '/orders/{orderId}/items') - ->auth('global') - ->parameters( - TemplateParam::init('orderId', $orderId), - HeaderParam::init('idempotency-key', $idempotencyKey) - ); + $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/orders/{orderId}/items/{itemId}') + ->parameters(TemplateParam::init('orderId', $orderId), TemplateParam::init('itemId', $itemId)); - $_resHandler = $this->responseHandler()->type(GetOrderResponse::class); + $_resHandler = $this->responseHandler()->type(GetOrderItemResponse::class); return $this->execute($_reqBuilder, $_resHandler); } @@ -227,7 +253,6 @@ public function updateOrderMetadata( ?string $idempotencyKey = null ): GetOrderResponse { $_reqBuilder = $this->requestBuilder(RequestMethod::PATCH, '/Orders/{order_id}/metadata') - ->auth('global') ->parameters( TemplateParam::init('order_id', $orderId), BodyParam::init($request), @@ -240,55 +265,20 @@ public function updateOrderMetadata( } /** - * @param string $orderId Order Id - * @param string $itemId Item Id - * @param string|null $idempotencyKey - * - * @return GetOrderItemResponse Response from the API call + * Gets an order * - * @throws ApiException Thrown if API call fails - */ - public function deleteOrderItem( - string $orderId, - string $itemId, - ?string $idempotencyKey = null - ): GetOrderItemResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::DELETE, '/orders/{orderId}/items/{itemId}') - ->auth('global') - ->parameters( - TemplateParam::init('orderId', $orderId), - TemplateParam::init('itemId', $itemId), - HeaderParam::init('idempotency-key', $idempotencyKey) - ); - - $_resHandler = $this->responseHandler()->type(GetOrderItemResponse::class); - - return $this->execute($_reqBuilder, $_resHandler); - } - - /** - * @param string $orderId Order Id - * @param CreateOrderItemRequest $request Order Item Model - * @param string|null $idempotencyKey + * @param string $orderId Order id * - * @return GetOrderItemResponse Response from the API call + * @return GetOrderResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function createOrderItem( - string $orderId, - CreateOrderItemRequest $request, - ?string $idempotencyKey = null - ): GetOrderItemResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/orders/{orderId}/items') - ->auth('global') - ->parameters( - TemplateParam::init('orderId', $orderId), - BodyParam::init($request), - HeaderParam::init('idempotency-key', $idempotencyKey) - ); + public function getOrder(string $orderId): GetOrderResponse + { + $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/orders/{order_id}') + ->parameters(TemplateParam::init('order_id', $orderId)); - $_resHandler = $this->responseHandler()->type(GetOrderItemResponse::class); + $_resHandler = $this->responseHandler()->type(GetOrderResponse::class); return $this->execute($_reqBuilder, $_resHandler); } diff --git a/src/Controllers/PayablesController.php b/src/Controllers/PayablesController.php index d71a668..1573c9b 100644 --- a/src/Controllers/PayablesController.php +++ b/src/Controllers/PayablesController.php @@ -65,7 +65,6 @@ public function getPayables( ?int $gatewayId = null ): ListPayablesResponse { $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/payables') - ->auth('global') ->parameters( QueryParam::init('type', $type), QueryParam::init('split_id', $splitId), @@ -107,7 +106,6 @@ public function getPayables( public function getPayableById(int $id): GetPayableResponse { $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/payables/{id}') - ->auth('global') ->parameters(TemplateParam::init('id', $id)); $_resHandler = $this->responseHandler()->type(GetPayableResponse::class); diff --git a/src/Controllers/PlansController.php b/src/Controllers/PlansController.php index e824b56..990bdd2 100644 --- a/src/Controllers/PlansController.php +++ b/src/Controllers/PlansController.php @@ -40,7 +40,6 @@ class PlansController extends BaseController public function getPlan(string $planId): GetPlanResponse { $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/plans/{plan_id}') - ->auth('global') ->parameters(TemplateParam::init('plan_id', $planId)); $_resHandler = $this->responseHandler()->type(GetPlanResponse::class); @@ -49,26 +48,20 @@ public function getPlan(string $planId): GetPlanResponse } /** - * Updates a plan + * Deletes a plan * * @param string $planId Plan id - * @param UpdatePlanRequest $request Request for updating a plan * @param string|null $idempotencyKey * * @return GetPlanResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function updatePlan( - string $planId, - UpdatePlanRequest $request, - ?string $idempotencyKey = null - ): GetPlanResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::PUT, '/plans/{plan_id}') - ->auth('global') + public function deletePlan(string $planId, ?string $idempotencyKey = null): GetPlanResponse + { + $_reqBuilder = $this->requestBuilder(RequestMethod::DELETE, '/plans/{plan_id}') ->parameters( TemplateParam::init('plan_id', $planId), - BodyParam::init($request), HeaderParam::init('idempotency-key', $idempotencyKey) ); @@ -94,7 +87,6 @@ public function updatePlanMetadata( ?string $idempotencyKey = null ): GetPlanResponse { $_reqBuilder = $this->requestBuilder(RequestMethod::PATCH, '/Plans/{plan_id}/metadata') - ->auth('global') ->parameters( TemplateParam::init('plan_id', $planId), BodyParam::init($request), @@ -107,26 +99,28 @@ public function updatePlanMetadata( } /** - * Removes an item from a plan + * Updates a plan item * * @param string $planId Plan id * @param string $planItemId Plan item id + * @param UpdatePlanItemRequest $body Request for updating the plan item * @param string|null $idempotencyKey * * @return GetPlanItemResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function deletePlanItem( + public function updatePlanItem( string $planId, string $planItemId, + UpdatePlanItemRequest $body, ?string $idempotencyKey = null ): GetPlanItemResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::DELETE, '/plans/{plan_id}/items/{plan_item_id}') - ->auth('global') + $_reqBuilder = $this->requestBuilder(RequestMethod::PUT, '/plans/{plan_id}/items/{plan_item_id}') ->parameters( TemplateParam::init('plan_id', $planId), TemplateParam::init('plan_item_id', $planItemId), + BodyParam::init($body), HeaderParam::init('idempotency-key', $idempotencyKey) ); @@ -136,44 +130,29 @@ public function deletePlanItem( } /** - * Gets all plans + * Adds a new item to a plan * - * @param int|null $page Page number - * @param int|null $size Page size - * @param string|null $name Filter for Plan's name - * @param string|null $status Filter for Plan's status - * @param string|null $billingType Filter for plan's billing type - * @param \DateTime|null $createdSince Filter for plan's creation date start range - * @param \DateTime|null $createdUntil Filter for plan's creation date end range + * @param string $planId Plan id + * @param CreatePlanItemRequest $request Request for creating a plan item + * @param string|null $idempotencyKey * - * @return ListPlansResponse Response from the API call + * @return GetPlanItemResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function getPlans( - ?int $page = null, - ?int $size = null, - ?string $name = null, - ?string $status = null, - ?string $billingType = null, - ?\DateTime $createdSince = null, - ?\DateTime $createdUntil = null - ): ListPlansResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/plans') - ->auth('global') + public function createPlanItem( + string $planId, + CreatePlanItemRequest $request, + ?string $idempotencyKey = null + ): GetPlanItemResponse { + $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/plans/{plan_id}/items') ->parameters( - QueryParam::init('page', $page), - QueryParam::init('size', $size), - QueryParam::init('name', $name), - QueryParam::init('status', $status), - QueryParam::init('billing_type', $billingType), - QueryParam::init('created_since', $createdSince) - ->serializeBy([DateTimeHelper::class, 'toRfc3339DateTime']), - QueryParam::init('created_until', $createdUntil) - ->serializeBy([DateTimeHelper::class, 'toRfc3339DateTime']) + TemplateParam::init('plan_id', $planId), + BodyParam::init($request), + HeaderParam::init('idempotency-key', $idempotencyKey) ); - $_resHandler = $this->responseHandler()->type(ListPlansResponse::class); + $_resHandler = $this->responseHandler()->type(GetPlanItemResponse::class); return $this->execute($_reqBuilder, $_resHandler); } @@ -191,7 +170,6 @@ public function getPlans( public function getPlanItem(string $planId, string $planItemId): GetPlanItemResponse { $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/plans/{plan_id}/items/{plan_item_id}') - ->auth('global') ->parameters(TemplateParam::init('plan_id', $planId), TemplateParam::init('plan_item_id', $planItemId)); $_resHandler = $this->responseHandler()->type(GetPlanItemResponse::class); @@ -200,23 +178,19 @@ public function getPlanItem(string $planId, string $planItemId): GetPlanItemResp } /** - * Deletes a plan + * Creates a new plan * - * @param string $planId Plan id + * @param CreatePlanRequest $body Request for creating a plan * @param string|null $idempotencyKey * * @return GetPlanResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function deletePlan(string $planId, ?string $idempotencyKey = null): GetPlanResponse + public function createPlan(CreatePlanRequest $body, ?string $idempotencyKey = null): GetPlanResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::DELETE, '/plans/{plan_id}') - ->auth('global') - ->parameters( - TemplateParam::init('plan_id', $planId), - HeaderParam::init('idempotency-key', $idempotencyKey) - ); + $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/plans') + ->parameters(BodyParam::init($body), HeaderParam::init('idempotency-key', $idempotencyKey)); $_resHandler = $this->responseHandler()->type(GetPlanResponse::class); @@ -224,29 +198,25 @@ public function deletePlan(string $planId, ?string $idempotencyKey = null): GetP } /** - * Updates a plan item + * Removes an item from a plan * * @param string $planId Plan id * @param string $planItemId Plan item id - * @param UpdatePlanItemRequest $body Request for updating the plan item * @param string|null $idempotencyKey * * @return GetPlanItemResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function updatePlanItem( + public function deletePlanItem( string $planId, string $planItemId, - UpdatePlanItemRequest $body, ?string $idempotencyKey = null ): GetPlanItemResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::PUT, '/plans/{plan_id}/items/{plan_item_id}') - ->auth('global') + $_reqBuilder = $this->requestBuilder(RequestMethod::DELETE, '/plans/{plan_id}/items/{plan_item_id}') ->parameters( TemplateParam::init('plan_id', $planId), TemplateParam::init('plan_item_id', $planItemId), - BodyParam::init($body), HeaderParam::init('idempotency-key', $idempotencyKey) ); @@ -256,49 +226,69 @@ public function updatePlanItem( } /** - * Adds a new item to a plan + * Gets all plans * - * @param string $planId Plan id - * @param CreatePlanItemRequest $request Request for creating a plan item - * @param string|null $idempotencyKey + * @param int|null $page Page number + * @param int|null $size Page size + * @param string|null $name Filter for Plan's name + * @param string|null $status Filter for Plan's status + * @param string|null $billingType Filter for plan's billing type + * @param \DateTime|null $createdSince Filter for plan's creation date start range + * @param \DateTime|null $createdUntil Filter for plan's creation date end range * - * @return GetPlanItemResponse Response from the API call + * @return ListPlansResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function createPlanItem( - string $planId, - CreatePlanItemRequest $request, - ?string $idempotencyKey = null - ): GetPlanItemResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/plans/{plan_id}/items') - ->auth('global') + public function getPlans( + ?int $page = null, + ?int $size = null, + ?string $name = null, + ?string $status = null, + ?string $billingType = null, + ?\DateTime $createdSince = null, + ?\DateTime $createdUntil = null + ): ListPlansResponse { + $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/plans') ->parameters( - TemplateParam::init('plan_id', $planId), - BodyParam::init($request), - HeaderParam::init('idempotency-key', $idempotencyKey) + QueryParam::init('page', $page), + QueryParam::init('size', $size), + QueryParam::init('name', $name), + QueryParam::init('status', $status), + QueryParam::init('billing_type', $billingType), + QueryParam::init('created_since', $createdSince) + ->serializeBy([DateTimeHelper::class, 'toRfc3339DateTime']), + QueryParam::init('created_until', $createdUntil) + ->serializeBy([DateTimeHelper::class, 'toRfc3339DateTime']) ); - $_resHandler = $this->responseHandler()->type(GetPlanItemResponse::class); + $_resHandler = $this->responseHandler()->type(ListPlansResponse::class); return $this->execute($_reqBuilder, $_resHandler); } /** - * Creates a new plan + * Updates a plan * - * @param CreatePlanRequest $body Request for creating a plan + * @param string $planId Plan id + * @param UpdatePlanRequest $request Request for updating a plan * @param string|null $idempotencyKey * * @return GetPlanResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function createPlan(CreatePlanRequest $body, ?string $idempotencyKey = null): GetPlanResponse - { - $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/plans') - ->auth('global') - ->parameters(BodyParam::init($body), HeaderParam::init('idempotency-key', $idempotencyKey)); + public function updatePlan( + string $planId, + UpdatePlanRequest $request, + ?string $idempotencyKey = null + ): GetPlanResponse { + $_reqBuilder = $this->requestBuilder(RequestMethod::PUT, '/plans/{plan_id}') + ->parameters( + TemplateParam::init('plan_id', $planId), + BodyParam::init($request), + HeaderParam::init('idempotency-key', $idempotencyKey) + ); $_resHandler = $this->responseHandler()->type(GetPlanResponse::class); diff --git a/src/Controllers/RecipientsController.php b/src/Controllers/RecipientsController.php index cdc2e90..0128c99 100644 --- a/src/Controllers/RecipientsController.php +++ b/src/Controllers/RecipientsController.php @@ -56,7 +56,6 @@ public function updateRecipient( ?string $idempotencyKey = null ): GetRecipientResponse { $_reqBuilder = $this->requestBuilder(RequestMethod::PUT, '/recipients/{recipient_id}') - ->auth('global') ->parameters( TemplateParam::init('recipient_id', $recipientId), BodyParam::init($request), @@ -85,7 +84,6 @@ public function createAnticipation( ?string $idempotencyKey = null ): GetAnticipationResponse { $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/recipients/{recipient_id}/anticipations') - ->auth('global') ->parameters( TemplateParam::init('recipient_id', $recipientId), BodyParam::init($request), @@ -114,7 +112,6 @@ public function getAnticipationLimits( \DateTime $paymentDate ): GetAnticipationLimitResponse { $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/recipients/{recipient_id}/anticipation_limits') - ->auth('global') ->parameters( TemplateParam::init('recipient_id', $recipientId), QueryParam::init('timeframe', $timeframe), @@ -140,7 +137,6 @@ public function getAnticipationLimits( public function getRecipients(?int $page = null, ?int $size = null): ListRecipientResponse { $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/recipients') - ->auth('global') ->parameters(QueryParam::init('page', $page), QueryParam::init('size', $size)); $_resHandler = $this->responseHandler()->type(ListRecipientResponse::class); @@ -149,104 +145,77 @@ public function getRecipients(?int $page = null, ?int $size = null): ListRecipie } /** - * Updates recipient metadata - * - * @param string $recipientId Recipient id - * @param UpdateMetadataRequest $request Metadata - * @param string|null $idempotencyKey - * - * @return GetRecipientResponse Response from the API call - * - * @throws ApiException Thrown if API call fails - */ - public function updateRecipientMetadata( - string $recipientId, - UpdateMetadataRequest $request, - ?string $idempotencyKey = null - ): GetRecipientResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::PATCH, '/recipients/{recipient_id}/metadata') - ->auth('global') - ->parameters( - TemplateParam::init('recipient_id', $recipientId), - BodyParam::init($request), - HeaderParam::init('idempotency-key', $idempotencyKey) - ); - - $_resHandler = $this->responseHandler()->type(GetRecipientResponse::class); - - return $this->execute($_reqBuilder, $_resHandler); - } - - /** - * Gets a transfer - * - * @param string $recipientId Recipient id - * @param string $transferId Transfer id + * @param string $recipientId + * @param string $withdrawalId * - * @return GetTransferResponse Response from the API call + * @return GetWithdrawResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function getTransfer(string $recipientId, string $transferId): GetTransferResponse + public function getWithdrawById(string $recipientId, string $withdrawalId): GetWithdrawResponse { $_reqBuilder = $this->requestBuilder( RequestMethod::GET, - '/recipients/{recipient_id}/transfers/{transfer_id}' + '/recipients/{recipient_id}/withdrawals/{withdrawal_id}' ) - ->auth('global') ->parameters( TemplateParam::init('recipient_id', $recipientId), - TemplateParam::init('transfer_id', $transferId) + TemplateParam::init('withdrawal_id', $withdrawalId) ); - $_resHandler = $this->responseHandler()->type(GetTransferResponse::class); + $_resHandler = $this->responseHandler()->type(GetWithdrawResponse::class); return $this->execute($_reqBuilder, $_resHandler); } /** - * Gets an anticipation + * Updates the default bank account from a recipient * * @param string $recipientId Recipient id - * @param string $anticipationId Anticipation id + * @param UpdateRecipientBankAccountRequest $request Bank account data + * @param string|null $idempotencyKey * - * @return GetAnticipationResponse Response from the API call + * @return GetRecipientResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function getAnticipation(string $recipientId, string $anticipationId): GetAnticipationResponse - { + public function updateRecipientDefaultBankAccount( + string $recipientId, + UpdateRecipientBankAccountRequest $request, + ?string $idempotencyKey = null + ): GetRecipientResponse { $_reqBuilder = $this->requestBuilder( - RequestMethod::GET, - '/recipients/{recipient_id}/anticipations/{anticipation_id}' + RequestMethod::PATCH, + '/recipients/{recipient_id}/default-bank-account' ) - ->auth('global') ->parameters( TemplateParam::init('recipient_id', $recipientId), - TemplateParam::init('anticipation_id', $anticipationId) + BodyParam::init($request), + HeaderParam::init('idempotency-key', $idempotencyKey) ); - $_resHandler = $this->responseHandler()->type(GetAnticipationResponse::class); + $_resHandler = $this->responseHandler()->type(GetRecipientResponse::class); return $this->execute($_reqBuilder, $_resHandler); } /** - * @param string $recipientId Recipient Identificator - * @param UpdateTransferSettingsRequest $request + * Updates recipient metadata + * + * @param string $recipientId Recipient id + * @param UpdateMetadataRequest $request Metadata * @param string|null $idempotencyKey * * @return GetRecipientResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function updateRecipientTransferSettings( + public function updateRecipientMetadata( string $recipientId, - UpdateTransferSettingsRequest $request, + UpdateMetadataRequest $request, ?string $idempotencyKey = null ): GetRecipientResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::PATCH, '/recipients/{recipient_id}/transfer-settings') - ->auth('global') + $_reqBuilder = $this->requestBuilder(RequestMethod::PATCH, '/recipients/{recipient_id}/metadata') ->parameters( TemplateParam::init('recipient_id', $recipientId), BodyParam::init($request), @@ -259,84 +228,66 @@ public function updateRecipientTransferSettings( } /** - * Retrieves a paginated list of anticipations from a recipient + * Gets a paginated list of transfers for the recipient * * @param string $recipientId Recipient id * @param int|null $page Page number * @param int|null $size Page size - * @param string|null $status Filter for anticipation status - * @param string|null $timeframe Filter for anticipation timeframe - * @param \DateTime|null $paymentDateSince Filter for start range for anticipation payment date - * @param \DateTime|null $paymentDateUntil Filter for end range for anticipation payment date - * @param \DateTime|null $createdSince Filter for start range for anticipation creation date - * @param \DateTime|null $createdUntil Filter for end range for anticipation creation date + * @param string|null $status Filter for transfer status + * @param \DateTime|null $createdSince Filter for start range of transfer creation date + * @param \DateTime|null $createdUntil Filter for end range of transfer creation date * - * @return ListAnticipationResponse Response from the API call + * @return ListTransferResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function getAnticipations( + public function getTransfers( string $recipientId, ?int $page = null, ?int $size = null, ?string $status = null, - ?string $timeframe = null, - ?\DateTime $paymentDateSince = null, - ?\DateTime $paymentDateUntil = null, ?\DateTime $createdSince = null, ?\DateTime $createdUntil = null - ): ListAnticipationResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/recipients/{recipient_id}/anticipations') - ->auth('global') + ): ListTransferResponse { + $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/recipients/{recipient_id}/transfers') ->parameters( TemplateParam::init('recipient_id', $recipientId), QueryParam::init('page', $page), QueryParam::init('size', $size), QueryParam::init('status', $status), - QueryParam::init('timeframe', $timeframe), - QueryParam::init('payment_date_since', $paymentDateSince) - ->serializeBy([DateTimeHelper::class, 'toRfc3339DateTime']), - QueryParam::init('payment_date_until', $paymentDateUntil) - ->serializeBy([DateTimeHelper::class, 'toRfc3339DateTime']), QueryParam::init('created_since', $createdSince) ->serializeBy([DateTimeHelper::class, 'toRfc3339DateTime']), QueryParam::init('created_until', $createdUntil) ->serializeBy([DateTimeHelper::class, 'toRfc3339DateTime']) ); - $_resHandler = $this->responseHandler()->type(ListAnticipationResponse::class); + $_resHandler = $this->responseHandler()->type(ListTransferResponse::class); return $this->execute($_reqBuilder, $_resHandler); } /** - * Updates the default bank account from a recipient + * Gets a transfer * * @param string $recipientId Recipient id - * @param UpdateRecipientBankAccountRequest $request Bank account data - * @param string|null $idempotencyKey + * @param string $transferId Transfer id * - * @return GetRecipientResponse Response from the API call + * @return GetTransferResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function updateRecipientDefaultBankAccount( - string $recipientId, - UpdateRecipientBankAccountRequest $request, - ?string $idempotencyKey = null - ): GetRecipientResponse { + public function getTransfer(string $recipientId, string $transferId): GetTransferResponse + { $_reqBuilder = $this->requestBuilder( - RequestMethod::PATCH, - '/recipients/{recipient_id}/default-bank-account' + RequestMethod::GET, + '/recipients/{recipient_id}/transfers/{transfer_id}' ) - ->auth('global') ->parameters( TemplateParam::init('recipient_id', $recipientId), - BodyParam::init($request), - HeaderParam::init('idempotency-key', $idempotencyKey) + TemplateParam::init('transfer_id', $transferId) ); - $_resHandler = $this->responseHandler()->type(GetRecipientResponse::class); + $_resHandler = $this->responseHandler()->type(GetTransferResponse::class); return $this->execute($_reqBuilder, $_resHandler); } @@ -352,7 +303,6 @@ public function updateRecipientDefaultBankAccount( public function createWithdraw(string $recipientId, CreateWithdrawRequest $request): GetWithdrawResponse { $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/recipients/{recipient_id}/withdrawals') - ->auth('global') ->parameters(TemplateParam::init('recipient_id', $recipientId), BodyParam::init($request)); $_resHandler = $this->responseHandler()->type(GetWithdrawResponse::class); @@ -361,71 +311,82 @@ public function createWithdraw(string $recipientId, CreateWithdrawRequest $reque } /** - * Get balance information for a recipient + * Updates recipient metadata * * @param string $recipientId Recipient id + * @param UpdateAutomaticAnticipationSettingsRequest $request Metadata + * @param string|null $idempotencyKey * - * @return GetBalanceResponse Response from the API call + * @return GetRecipientResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function getBalance(string $recipientId): GetBalanceResponse - { - $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/recipients/{recipient_id}/balance') - ->auth('global') - ->parameters(TemplateParam::init('recipient_id', $recipientId)); + public function updateAutomaticAnticipationSettings( + string $recipientId, + UpdateAutomaticAnticipationSettingsRequest $request, + ?string $idempotencyKey = null + ): GetRecipientResponse { + $_reqBuilder = $this->requestBuilder( + RequestMethod::PATCH, + '/recipients/{recipient_id}/automatic-anticipation-settings' + ) + ->parameters( + TemplateParam::init('recipient_id', $recipientId), + BodyParam::init($request), + HeaderParam::init('idempotency-key', $idempotencyKey) + ); - $_resHandler = $this->responseHandler()->type(GetBalanceResponse::class); + $_resHandler = $this->responseHandler()->type(GetRecipientResponse::class); return $this->execute($_reqBuilder, $_resHandler); } /** - * Creates a transfer for a recipient + * Gets an anticipation * - * @param string $recipientId Recipient Id - * @param CreateTransferRequest $request Transfer data - * @param string|null $idempotencyKey + * @param string $recipientId Recipient id + * @param string $anticipationId Anticipation id * - * @return GetTransferResponse Response from the API call + * @return GetAnticipationResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function createTransfer( - string $recipientId, - CreateTransferRequest $request, - ?string $idempotencyKey = null - ): GetTransferResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/recipients/{recipient_id}/transfers') - ->auth('global') + public function getAnticipation(string $recipientId, string $anticipationId): GetAnticipationResponse + { + $_reqBuilder = $this->requestBuilder( + RequestMethod::GET, + '/recipients/{recipient_id}/anticipations/{anticipation_id}' + ) ->parameters( TemplateParam::init('recipient_id', $recipientId), - BodyParam::init($request), - HeaderParam::init('idempotency-key', $idempotencyKey) + TemplateParam::init('anticipation_id', $anticipationId) ); - $_resHandler = $this->responseHandler()->type(GetTransferResponse::class); + $_resHandler = $this->responseHandler()->type(GetAnticipationResponse::class); return $this->execute($_reqBuilder, $_resHandler); } /** - * Creates a new recipient - * - * @param CreateRecipientRequest $request Recipient data + * @param string $recipientId Recipient Identificator + * @param UpdateTransferSettingsRequest $request * @param string|null $idempotencyKey * * @return GetRecipientResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function createRecipient( - CreateRecipientRequest $request, + public function updateRecipientTransferSettings( + string $recipientId, + UpdateTransferSettingsRequest $request, ?string $idempotencyKey = null ): GetRecipientResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/recipients') - ->auth('global') - ->parameters(BodyParam::init($request), HeaderParam::init('idempotency-key', $idempotencyKey)); + $_reqBuilder = $this->requestBuilder(RequestMethod::PATCH, '/recipients/{recipient_id}/transfer-settings') + ->parameters( + TemplateParam::init('recipient_id', $recipientId), + BodyParam::init($request), + HeaderParam::init('idempotency-key', $idempotencyKey) + ); $_resHandler = $this->responseHandler()->type(GetRecipientResponse::class); @@ -433,33 +394,51 @@ public function createRecipient( } /** - * Updates recipient metadata + * Retrieves a paginated list of anticipations from a recipient * * @param string $recipientId Recipient id - * @param UpdateAutomaticAnticipationSettingsRequest $request Metadata - * @param string|null $idempotencyKey + * @param int|null $page Page number + * @param int|null $size Page size + * @param string|null $status Filter for anticipation status + * @param string|null $timeframe Filter for anticipation timeframe + * @param \DateTime|null $paymentDateSince Filter for start range for anticipation payment date + * @param \DateTime|null $paymentDateUntil Filter for end range for anticipation payment date + * @param \DateTime|null $createdSince Filter for start range for anticipation creation date + * @param \DateTime|null $createdUntil Filter for end range for anticipation creation date * - * @return GetRecipientResponse Response from the API call + * @return ListAnticipationResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function updateAutomaticAnticipationSettings( + public function getAnticipations( string $recipientId, - UpdateAutomaticAnticipationSettingsRequest $request, - ?string $idempotencyKey = null - ): GetRecipientResponse { - $_reqBuilder = $this->requestBuilder( - RequestMethod::PATCH, - '/recipients/{recipient_id}/automatic-anticipation-settings' - ) - ->auth('global') + ?int $page = null, + ?int $size = null, + ?string $status = null, + ?string $timeframe = null, + ?\DateTime $paymentDateSince = null, + ?\DateTime $paymentDateUntil = null, + ?\DateTime $createdSince = null, + ?\DateTime $createdUntil = null + ): ListAnticipationResponse { + $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/recipients/{recipient_id}/anticipations') ->parameters( TemplateParam::init('recipient_id', $recipientId), - BodyParam::init($request), - HeaderParam::init('idempotency-key', $idempotencyKey) + QueryParam::init('page', $page), + QueryParam::init('size', $size), + QueryParam::init('status', $status), + QueryParam::init('timeframe', $timeframe), + QueryParam::init('payment_date_since', $paymentDateSince) + ->serializeBy([DateTimeHelper::class, 'toRfc3339DateTime']), + QueryParam::init('payment_date_until', $paymentDateUntil) + ->serializeBy([DateTimeHelper::class, 'toRfc3339DateTime']), + QueryParam::init('created_since', $createdSince) + ->serializeBy([DateTimeHelper::class, 'toRfc3339DateTime']), + QueryParam::init('created_until', $createdUntil) + ->serializeBy([DateTimeHelper::class, 'toRfc3339DateTime']) ); - $_resHandler = $this->responseHandler()->type(GetRecipientResponse::class); + $_resHandler = $this->responseHandler()->type(ListAnticipationResponse::class); return $this->execute($_reqBuilder, $_resHandler); } @@ -476,7 +455,6 @@ public function updateAutomaticAnticipationSettings( public function getRecipient(string $recipientId): GetRecipientResponse { $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/recipients/{recipient_id}') - ->auth('global') ->parameters(TemplateParam::init('recipient_id', $recipientId)); $_resHandler = $this->responseHandler()->type(GetRecipientResponse::class); @@ -484,6 +462,25 @@ public function getRecipient(string $recipientId): GetRecipientResponse return $this->execute($_reqBuilder, $_resHandler); } + /** + * Get balance information for a recipient + * + * @param string $recipientId Recipient id + * + * @return GetBalanceResponse Response from the API call + * + * @throws ApiException Thrown if API call fails + */ + public function getBalance(string $recipientId): GetBalanceResponse + { + $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/recipients/{recipient_id}/balance') + ->parameters(TemplateParam::init('recipient_id', $recipientId)); + + $_resHandler = $this->responseHandler()->type(GetBalanceResponse::class); + + return $this->execute($_reqBuilder, $_resHandler); + } + /** * Gets a paginated list of transfers for the recipient * @@ -507,7 +504,6 @@ public function getWithdrawals( ?\DateTime $createdUntil = null ): ListWithdrawals { $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/recipients/{recipient_id}/withdrawals') - ->auth('global') ->parameters( TemplateParam::init('recipient_id', $recipientId), QueryParam::init('page', $page), @@ -525,66 +521,51 @@ public function getWithdrawals( } /** - * @param string $recipientId - * @param string $withdrawalId + * Creates a transfer for a recipient * - * @return GetWithdrawResponse Response from the API call + * @param string $recipientId Recipient Id + * @param CreateTransferRequest $request Transfer data + * @param string|null $idempotencyKey + * + * @return GetTransferResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function getWithdrawById(string $recipientId, string $withdrawalId): GetWithdrawResponse - { - $_reqBuilder = $this->requestBuilder( - RequestMethod::GET, - '/recipients/{recipient_id}/withdrawals/{withdrawal_id}' - ) - ->auth('global') + public function createTransfer( + string $recipientId, + CreateTransferRequest $request, + ?string $idempotencyKey = null + ): GetTransferResponse { + $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/recipients/{recipient_id}/transfers') ->parameters( TemplateParam::init('recipient_id', $recipientId), - TemplateParam::init('withdrawal_id', $withdrawalId) + BodyParam::init($request), + HeaderParam::init('idempotency-key', $idempotencyKey) ); - $_resHandler = $this->responseHandler()->type(GetWithdrawResponse::class); + $_resHandler = $this->responseHandler()->type(GetTransferResponse::class); return $this->execute($_reqBuilder, $_resHandler); } /** - * Gets a paginated list of transfers for the recipient + * Creates a new recipient * - * @param string $recipientId Recipient id - * @param int|null $page Page number - * @param int|null $size Page size - * @param string|null $status Filter for transfer status - * @param \DateTime|null $createdSince Filter for start range of transfer creation date - * @param \DateTime|null $createdUntil Filter for end range of transfer creation date + * @param CreateRecipientRequest $request Recipient data + * @param string|null $idempotencyKey * - * @return ListTransferResponse Response from the API call + * @return GetRecipientResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function getTransfers( - string $recipientId, - ?int $page = null, - ?int $size = null, - ?string $status = null, - ?\DateTime $createdSince = null, - ?\DateTime $createdUntil = null - ): ListTransferResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/recipients/{recipient_id}/transfers') - ->auth('global') - ->parameters( - TemplateParam::init('recipient_id', $recipientId), - QueryParam::init('page', $page), - QueryParam::init('size', $size), - QueryParam::init('status', $status), - QueryParam::init('created_since', $createdSince) - ->serializeBy([DateTimeHelper::class, 'toRfc3339DateTime']), - QueryParam::init('created_until', $createdUntil) - ->serializeBy([DateTimeHelper::class, 'toRfc3339DateTime']) - ); + public function createRecipient( + CreateRecipientRequest $request, + ?string $idempotencyKey = null + ): GetRecipientResponse { + $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/recipients') + ->parameters(BodyParam::init($request), HeaderParam::init('idempotency-key', $idempotencyKey)); - $_resHandler = $this->responseHandler()->type(ListTransferResponse::class); + $_resHandler = $this->responseHandler()->type(GetRecipientResponse::class); return $this->execute($_reqBuilder, $_resHandler); } @@ -601,7 +582,6 @@ public function getTransfers( public function getRecipientByCode(string $code): GetRecipientResponse { $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/recipients/{code}') - ->auth('global') ->parameters(TemplateParam::init('code', $code)); $_resHandler = $this->responseHandler()->type(GetRecipientResponse::class); @@ -616,7 +596,7 @@ public function getRecipientByCode(string $code): GetRecipientResponse */ public function getDefaultRecipient(): GetRecipientResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/recipients/default')->auth('global'); + $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/recipients/default'); $_resHandler = $this->responseHandler()->type(GetRecipientResponse::class); diff --git a/src/Controllers/SubscriptionsController.php b/src/Controllers/SubscriptionsController.php index 53d83c3..a0641f7 100644 --- a/src/Controllers/SubscriptionsController.php +++ b/src/Controllers/SubscriptionsController.php @@ -62,7 +62,6 @@ class SubscriptionsController extends BaseController public function renewSubscription(string $subscriptionId, ?string $idempotencyKey = null): GetPeriodResponse { $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/subscriptions/{subscription_id}/cycles') - ->auth('global') ->parameters( TemplateParam::init('subscription_id', $subscriptionId), HeaderParam::init('idempotency-key', $idempotencyKey) @@ -74,307 +73,180 @@ public function renewSubscription(string $subscriptionId, ?string $idempotencyKe } /** - * Deletes a discount + * Updates the credit card from a subscription * * @param string $subscriptionId Subscription id - * @param string $discountId Discount Id + * @param UpdateSubscriptionCardRequest $request Request for updating a card * @param string|null $idempotencyKey * - * @return GetDiscountResponse Response from the API call + * @return GetSubscriptionResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function deleteDiscount( + public function updateSubscriptionCard( string $subscriptionId, - string $discountId, + UpdateSubscriptionCardRequest $request, ?string $idempotencyKey = null - ): GetDiscountResponse { - $_reqBuilder = $this->requestBuilder( - RequestMethod::DELETE, - '/subscriptions/{subscription_id}/discounts/{discount_id}' - ) - ->auth('global') + ): GetSubscriptionResponse { + $_reqBuilder = $this->requestBuilder(RequestMethod::PATCH, '/subscriptions/{subscription_id}/card') ->parameters( TemplateParam::init('subscription_id', $subscriptionId), - TemplateParam::init('discount_id', $discountId), + BodyParam::init($request), HeaderParam::init('idempotency-key', $idempotencyKey) ); - $_resHandler = $this->responseHandler()->type(GetDiscountResponse::class); + $_resHandler = $this->responseHandler()->type(GetSubscriptionResponse::class); return $this->execute($_reqBuilder, $_resHandler); } /** - * Gets all subscriptions - * - * @param int|null $page Page number - * @param int|null $size Page size - * @param string|null $code Filter for subscription's code - * @param string|null $billingType Filter for subscription's billing type - * @param string|null $customerId Filter for subscription's customer id - * @param string|null $planId Filter for subscription's plan id - * @param string|null $cardId Filter for subscription's card id - * @param string|null $status Filter for subscription's status - * @param \DateTime|null $nextBillingSince Filter for subscription's next billing date start - * range - * @param \DateTime|null $nextBillingUntil Filter for subscription's next billing date end range - * @param \DateTime|null $createdSince Filter for subscription's creation date start range - * @param \DateTime|null $createdUntil Filter for subscriptions creation date end range - * - * @return ListSubscriptionsResponse Response from the API call + * Deletes a usage * - * @throws ApiException Thrown if API call fails - */ - public function getSubscriptions( - ?int $page = null, - ?int $size = null, - ?string $code = null, - ?string $billingType = null, - ?string $customerId = null, - ?string $planId = null, - ?string $cardId = null, - ?string $status = null, - ?\DateTime $nextBillingSince = null, - ?\DateTime $nextBillingUntil = null, - ?\DateTime $createdSince = null, - ?\DateTime $createdUntil = null - ): ListSubscriptionsResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/subscriptions') - ->auth('global') - ->parameters( - QueryParam::init('page', $page), - QueryParam::init('size', $size), - QueryParam::init('code', $code), - QueryParam::init('billing_type', $billingType), - QueryParam::init('customer_id', $customerId), - QueryParam::init('plan_id', $planId), - QueryParam::init('card_id', $cardId), - QueryParam::init('status', $status), - QueryParam::init('next_billing_since', $nextBillingSince) - ->serializeBy([DateTimeHelper::class, 'toRfc3339DateTime']), - QueryParam::init('next_billing_until', $nextBillingUntil) - ->serializeBy([DateTimeHelper::class, 'toRfc3339DateTime']), - QueryParam::init('created_since', $createdSince) - ->serializeBy([DateTimeHelper::class, 'toRfc3339DateTime']), - QueryParam::init('created_until', $createdUntil) - ->serializeBy([DateTimeHelper::class, 'toRfc3339DateTime']) - ); - - $_resHandler = $this->responseHandler()->type(ListSubscriptionsResponse::class); - - return $this->execute($_reqBuilder, $_resHandler); - } - - /** * @param string $subscriptionId The subscription id - * @param string $discountId - * - * @return GetDiscountResponse Response from the API call - * - * @throws ApiException Thrown if API call fails - */ - public function getDiscountById(string $subscriptionId, string $discountId): GetDiscountResponse - { - $_reqBuilder = $this->requestBuilder( - RequestMethod::GET, - '/subscriptions/{subscription_id}/discounts/{discountId}' - ) - ->auth('global') - ->parameters( - TemplateParam::init('subscription_id', $subscriptionId), - TemplateParam::init('discountId', $discountId) - ); - - $_resHandler = $this->responseHandler()->type(GetDiscountResponse::class); - - return $this->execute($_reqBuilder, $_resHandler); - } - - /** - * Creates a new subscription - * - * @param CreateSubscriptionRequest $body Request for creating a subscription + * @param string $itemId The subscription item id + * @param string $usageId The usage id * @param string|null $idempotencyKey * - * @return GetSubscriptionResponse Response from the API call + * @return GetUsageResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function createSubscription( - CreateSubscriptionRequest $body, + public function deleteUsage( + string $subscriptionId, + string $itemId, + string $usageId, ?string $idempotencyKey = null - ): GetSubscriptionResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/subscriptions') - ->auth('global') - ->parameters(BodyParam::init($body), HeaderParam::init('idempotency-key', $idempotencyKey)); - - $_resHandler = $this->responseHandler()->type(GetSubscriptionResponse::class); - - return $this->execute($_reqBuilder, $_resHandler); - } - - /** - * @param string $subscriptionId The subscription Id - * @param string $incrementId The increment Id - * - * @return GetIncrementResponse Response from the API call - * - * @throws ApiException Thrown if API call fails - */ - public function getIncrementById(string $subscriptionId, string $incrementId): GetIncrementResponse - { + ): GetUsageResponse { $_reqBuilder = $this->requestBuilder( - RequestMethod::GET, - '/subscriptions/{subscription_id}/increments/{increment_id}' + RequestMethod::DELETE, + '/subscriptions/{subscription_id}/items/{item_id}/usages/{usage_id}' ) - ->auth('global') ->parameters( TemplateParam::init('subscription_id', $subscriptionId), - TemplateParam::init('increment_id', $incrementId) + TemplateParam::init('item_id', $itemId), + TemplateParam::init('usage_id', $usageId), + HeaderParam::init('idempotency-key', $idempotencyKey) ); - $_resHandler = $this->responseHandler()->type(GetIncrementResponse::class); + $_resHandler = $this->responseHandler()->type(GetUsageResponse::class); return $this->execute($_reqBuilder, $_resHandler); } /** - * Updates the metadata from a subscription + * Creates a discount * - * @param string $subscriptionId The subscription id - * @param UpdateMetadataRequest $request Request for updating the subscrption metadata + * @param string $subscriptionId Subscription id + * @param CreateDiscountRequest $request Request for creating a discount * @param string|null $idempotencyKey * - * @return GetSubscriptionResponse Response from the API call + * @return GetDiscountResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function updateSubscriptionMetadata( + public function createDiscount( string $subscriptionId, - UpdateMetadataRequest $request, + CreateDiscountRequest $request, ?string $idempotencyKey = null - ): GetSubscriptionResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::PATCH, '/Subscriptions/{subscription_id}/metadata') - ->auth('global') + ): GetDiscountResponse { + $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/subscriptions/{subscription_id}/discounts') ->parameters( TemplateParam::init('subscription_id', $subscriptionId), BodyParam::init($request), HeaderParam::init('idempotency-key', $idempotencyKey) ); - $_resHandler = $this->responseHandler()->type(GetSubscriptionResponse::class); + $_resHandler = $this->responseHandler()->type(GetDiscountResponse::class); return $this->execute($_reqBuilder, $_resHandler); } /** - * Deletes a increment + * Create Usage * * @param string $subscriptionId Subscription id - * @param string $incrementId Increment id + * @param string $itemId Item id * @param string|null $idempotencyKey * - * @return GetIncrementResponse Response from the API call + * @return GetUsageResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function deleteIncrement( + public function createAnUsage( string $subscriptionId, - string $incrementId, + string $itemId, ?string $idempotencyKey = null - ): GetIncrementResponse { + ): GetUsageResponse { $_reqBuilder = $this->requestBuilder( - RequestMethod::DELETE, - '/subscriptions/{subscription_id}/increments/{increment_id}' + RequestMethod::POST, + '/subscriptions/{subscription_id}/items/{item_id}/usages' ) - ->auth('global') ->parameters( TemplateParam::init('subscription_id', $subscriptionId), - TemplateParam::init('increment_id', $incrementId), + TemplateParam::init('item_id', $itemId), HeaderParam::init('idempotency-key', $idempotencyKey) ); - $_resHandler = $this->responseHandler()->type(GetIncrementResponse::class); - - return $this->execute($_reqBuilder, $_resHandler); - } - - /** - * Gets a subscription - * - * @param string $subscriptionId Subscription id - * - * @return GetSubscriptionResponse Response from the API call - * - * @throws ApiException Thrown if API call fails - */ - public function getSubscription(string $subscriptionId): GetSubscriptionResponse - { - $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/subscriptions/{subscription_id}') - ->auth('global') - ->parameters(TemplateParam::init('subscription_id', $subscriptionId)); - - $_resHandler = $this->responseHandler()->type(GetSubscriptionResponse::class); + $_resHandler = $this->responseHandler()->type(GetUsageResponse::class); return $this->execute($_reqBuilder, $_resHandler); } /** - * @param string $subscriptionId - * @param UpdateCurrentCycleEndDateRequest $request Request for updating the end date of the - * current signature cycle + * @param string $subscriptionId Subscription Id + * @param UpdateCurrentCycleStatusRequest $request Request for updating the end date of the + * subscription current status * @param string|null $idempotencyKey * - * @return GetSubscriptionResponse Response from the API call + * @return void Response from the API call * * @throws ApiException Thrown if API call fails */ - public function updateLatestPeriodEndAt( + public function updateCurrentCycleStatus( string $subscriptionId, - UpdateCurrentCycleEndDateRequest $request, + UpdateCurrentCycleStatusRequest $request, ?string $idempotencyKey = null - ): GetSubscriptionResponse { - $_reqBuilder = $this->requestBuilder( - RequestMethod::PATCH, - '/subscriptions/{subscription_id}/periods/latest/end-at' - ) - ->auth('global') + ): void { + $_reqBuilder = $this->requestBuilder(RequestMethod::PATCH, '/subscriptions/{subscription_id}/cycle-status') ->parameters( TemplateParam::init('subscription_id', $subscriptionId), BodyParam::init($request), HeaderParam::init('idempotency-key', $idempotencyKey) ); - $_resHandler = $this->responseHandler()->type(GetSubscriptionResponse::class); - - return $this->execute($_reqBuilder, $_resHandler); + $this->execute($_reqBuilder); } /** - * @param string $subscriptionId Subscription Id - * @param UpdateCurrentCycleStatusRequest $request Request for updating the end date of the - * subscription current status + * Deletes a discount + * + * @param string $subscriptionId Subscription id + * @param string $discountId Discount Id * @param string|null $idempotencyKey * - * @return void Response from the API call + * @return GetDiscountResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function updateCurrentCycleStatus( + public function deleteDiscount( string $subscriptionId, - UpdateCurrentCycleStatusRequest $request, + string $discountId, ?string $idempotencyKey = null - ): void { - $_reqBuilder = $this->requestBuilder(RequestMethod::PATCH, '/subscriptions/{subscription_id}/cycle-status') - ->auth('global') + ): GetDiscountResponse { + $_reqBuilder = $this->requestBuilder( + RequestMethod::DELETE, + '/subscriptions/{subscription_id}/discounts/{discount_id}' + ) ->parameters( TemplateParam::init('subscription_id', $subscriptionId), - BodyParam::init($request), + TemplateParam::init('discount_id', $discountId), HeaderParam::init('idempotency-key', $idempotencyKey) ); - $this->execute($_reqBuilder); + $_resHandler = $this->responseHandler()->type(GetDiscountResponse::class); + + return $this->execute($_reqBuilder, $_resHandler); } /** @@ -406,7 +278,6 @@ public function getSubscriptionItems( ?string $createdUntil = null ): ListSubscriptionItemsResponse { $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/subscriptions/{subscription_id}/items') - ->auth('global') ->parameters( TemplateParam::init('subscription_id', $subscriptionId), QueryParam::init('page', $page), @@ -425,9 +296,41 @@ public function getSubscriptionItems( } /** - * Get Subscription Item + * Updates the payment method from a subscription * - * @param string $subscriptionId Subscription Id + * @param string $subscriptionId Subscription id + * @param UpdateSubscriptionPaymentMethodRequest $request Request for updating the paymentmethod + * from a subscription + * @param string|null $idempotencyKey + * + * @return GetSubscriptionResponse Response from the API call + * + * @throws ApiException Thrown if API call fails + */ + public function updateSubscriptionPaymentMethod( + string $subscriptionId, + UpdateSubscriptionPaymentMethodRequest $request, + ?string $idempotencyKey = null + ): GetSubscriptionResponse { + $_reqBuilder = $this->requestBuilder( + RequestMethod::PATCH, + '/subscriptions/{subscription_id}/payment-method' + ) + ->parameters( + TemplateParam::init('subscription_id', $subscriptionId), + BodyParam::init($request), + HeaderParam::init('idempotency-key', $idempotencyKey) + ); + + $_resHandler = $this->responseHandler()->type(GetSubscriptionResponse::class); + + return $this->execute($_reqBuilder, $_resHandler); + } + + /** + * Get Subscription Item + * + * @param string $subscriptionId Subscription Id * @param string $itemId Item id * * @return GetSubscriptionItemResponse Response from the API call @@ -440,7 +343,6 @@ public function getSubscriptionItem(string $subscriptionId, string $itemId): Get RequestMethod::GET, '/subscriptions/{subscription_id}/items/{item_id}' ) - ->auth('global') ->parameters( TemplateParam::init('subscription_id', $subscriptionId), TemplateParam::init('item_id', $itemId) @@ -452,25 +354,82 @@ public function getSubscriptionItem(string $subscriptionId, string $itemId): Get } /** - * @param string $subscriptionId - * @param UpdateSubscriptionAffiliationIdRequest $request Request for updating a subscription - * affiliation id + * Gets all subscriptions + * + * @param int|null $page Page number + * @param int|null $size Page size + * @param string|null $code Filter for subscription's code + * @param string|null $billingType Filter for subscription's billing type + * @param string|null $customerId Filter for subscription's customer id + * @param string|null $planId Filter for subscription's plan id + * @param string|null $cardId Filter for subscription's card id + * @param string|null $status Filter for subscription's status + * @param \DateTime|null $nextBillingSince Filter for subscription's next billing date start + * range + * @param \DateTime|null $nextBillingUntil Filter for subscription's next billing date end range + * @param \DateTime|null $createdSince Filter for subscription's creation date start range + * @param \DateTime|null $createdUntil Filter for subscriptions creation date end range + * + * @return ListSubscriptionsResponse Response from the API call + * + * @throws ApiException Thrown if API call fails + */ + public function getSubscriptions( + ?int $page = null, + ?int $size = null, + ?string $code = null, + ?string $billingType = null, + ?string $customerId = null, + ?string $planId = null, + ?string $cardId = null, + ?string $status = null, + ?\DateTime $nextBillingSince = null, + ?\DateTime $nextBillingUntil = null, + ?\DateTime $createdSince = null, + ?\DateTime $createdUntil = null + ): ListSubscriptionsResponse { + $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/subscriptions') + ->parameters( + QueryParam::init('page', $page), + QueryParam::init('size', $size), + QueryParam::init('code', $code), + QueryParam::init('billing_type', $billingType), + QueryParam::init('customer_id', $customerId), + QueryParam::init('plan_id', $planId), + QueryParam::init('card_id', $cardId), + QueryParam::init('status', $status), + QueryParam::init('next_billing_since', $nextBillingSince) + ->serializeBy([DateTimeHelper::class, 'toRfc3339DateTime']), + QueryParam::init('next_billing_until', $nextBillingUntil) + ->serializeBy([DateTimeHelper::class, 'toRfc3339DateTime']), + QueryParam::init('created_since', $createdSince) + ->serializeBy([DateTimeHelper::class, 'toRfc3339DateTime']), + QueryParam::init('created_until', $createdUntil) + ->serializeBy([DateTimeHelper::class, 'toRfc3339DateTime']) + ); + + $_resHandler = $this->responseHandler()->type(ListSubscriptionsResponse::class); + + return $this->execute($_reqBuilder, $_resHandler); + } + + /** + * Cancels a subscription + * + * @param string $subscriptionId Subscription id + * @param CreateCancelSubscriptionRequest|null $request Request for cancelling a subscription * @param string|null $idempotencyKey * * @return GetSubscriptionResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function updateSubscriptionAffiliationId( + public function cancelSubscription( string $subscriptionId, - UpdateSubscriptionAffiliationIdRequest $request, + ?CreateCancelSubscriptionRequest $request = null, ?string $idempotencyKey = null ): GetSubscriptionResponse { - $_reqBuilder = $this->requestBuilder( - RequestMethod::PATCH, - '/subscriptions/{subscription_id}/gateway-affiliation-id' - ) - ->auth('global') + $_reqBuilder = $this->requestBuilder(RequestMethod::DELETE, '/subscriptions/{subscription_id}') ->parameters( TemplateParam::init('subscription_id', $subscriptionId), BodyParam::init($request), @@ -483,52 +442,55 @@ public function updateSubscriptionAffiliationId( } /** - * @param string $subscriptionId The subscription id - * @param int $page Page number - * @param int $size Page size + * Creates a increment * - * @return ListDiscountsResponse Response from the API call + * @param string $subscriptionId Subscription id + * @param CreateIncrementRequest $request Request for creating a increment + * @param string|null $idempotencyKey + * + * @return GetIncrementResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function getDiscounts(string $subscriptionId, int $page, int $size): ListDiscountsResponse - { - $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/subscriptions/{subscription_id}/discounts/') - ->auth('global') + public function createIncrement( + string $subscriptionId, + CreateIncrementRequest $request, + ?string $idempotencyKey = null + ): GetIncrementResponse { + $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/subscriptions/{subscription_id}/increments') ->parameters( TemplateParam::init('subscription_id', $subscriptionId), - QueryParam::init('page', $page), - QueryParam::init('size', $size) + BodyParam::init($request), + HeaderParam::init('idempotency-key', $idempotencyKey) ); - $_resHandler = $this->responseHandler()->type(ListDiscountsResponse::class); + $_resHandler = $this->responseHandler()->type(GetIncrementResponse::class); return $this->execute($_reqBuilder, $_resHandler); } /** - * Updates a subscription item + * Creates a usage * * @param string $subscriptionId Subscription Id * @param string $itemId Item id - * @param UpdateSubscriptionItemRequest $body Request for updating a subscription item + * @param CreateUsageRequest $body Request for creating a usage * @param string|null $idempotencyKey * - * @return GetSubscriptionItemResponse Response from the API call + * @return GetUsageResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function updateSubscriptionItem( + public function createUsage( string $subscriptionId, string $itemId, - UpdateSubscriptionItemRequest $body, + CreateUsageRequest $body, ?string $idempotencyKey = null - ): GetSubscriptionItemResponse { + ): GetUsageResponse { $_reqBuilder = $this->requestBuilder( - RequestMethod::PUT, - '/subscriptions/{subscription_id}/items/{item_id}' + RequestMethod::POST, + '/subscriptions/{subscription_id}/items/{item_id}/usages' ) - ->auth('global') ->parameters( TemplateParam::init('subscription_id', $subscriptionId), TemplateParam::init('item_id', $itemId), @@ -536,109 +498,100 @@ public function updateSubscriptionItem( HeaderParam::init('idempotency-key', $idempotencyKey) ); - $_resHandler = $this->responseHandler()->type(GetSubscriptionItemResponse::class); + $_resHandler = $this->responseHandler()->type(GetUsageResponse::class); return $this->execute($_reqBuilder, $_resHandler); } /** - * Creates a new Subscription item - * - * @param string $subscriptionId Subscription id - * @param CreateSubscriptionItemRequest $request Request for creating a subscription item - * @param string|null $idempotencyKey + * @param string $subscriptionId The subscription id + * @param string $discountId * - * @return GetSubscriptionItemResponse Response from the API call + * @return GetDiscountResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function createSubscriptionItem( - string $subscriptionId, - CreateSubscriptionItemRequest $request, - ?string $idempotencyKey = null - ): GetSubscriptionItemResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/subscriptions/{subscription_id}/items') - ->auth('global') + public function getDiscountById(string $subscriptionId, string $discountId): GetDiscountResponse + { + $_reqBuilder = $this->requestBuilder( + RequestMethod::GET, + '/subscriptions/{subscription_id}/discounts/{discountId}' + ) ->parameters( TemplateParam::init('subscription_id', $subscriptionId), - BodyParam::init($request), - HeaderParam::init('idempotency-key', $idempotencyKey) + TemplateParam::init('discountId', $discountId) ); - $_resHandler = $this->responseHandler()->type(GetSubscriptionItemResponse::class); + $_resHandler = $this->responseHandler()->type(GetDiscountResponse::class); return $this->execute($_reqBuilder, $_resHandler); } /** - * Lists all usages from a subscription item + * Creates a new subscription * - * @param string $subscriptionId The subscription id - * @param string $itemId The subscription item id - * @param int|null $page Page number - * @param int|null $size Page size - * @param string|null $code Identification code in the client system - * @param string|null $group Identification group in the client system - * @param \DateTime|null $usedSince - * @param \DateTime|null $usedUntil + * @param CreateSubscriptionRequest $body Request for creating a subscription + * @param string|null $idempotencyKey * - * @return ListUsagesResponse Response from the API call + * @return GetSubscriptionResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function getUsages( - string $subscriptionId, - string $itemId, - ?int $page = null, - ?int $size = null, - ?string $code = null, - ?string $group = null, - ?\DateTime $usedSince = null, - ?\DateTime $usedUntil = null - ): ListUsagesResponse { + public function createSubscription( + CreateSubscriptionRequest $body, + ?string $idempotencyKey = null + ): GetSubscriptionResponse { + $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/subscriptions') + ->parameters(BodyParam::init($body), HeaderParam::init('idempotency-key', $idempotencyKey)); + + $_resHandler = $this->responseHandler()->type(GetSubscriptionResponse::class); + + return $this->execute($_reqBuilder, $_resHandler); + } + + /** + * @param string $subscriptionId The subscription Id + * @param string $incrementId The increment Id + * + * @return GetIncrementResponse Response from the API call + * + * @throws ApiException Thrown if API call fails + */ + public function getIncrementById(string $subscriptionId, string $incrementId): GetIncrementResponse + { $_reqBuilder = $this->requestBuilder( RequestMethod::GET, - '/subscriptions/{subscription_id}/items/{item_id}/usages' + '/subscriptions/{subscription_id}/increments/{increment_id}' ) - ->auth('global') ->parameters( TemplateParam::init('subscription_id', $subscriptionId), - TemplateParam::init('item_id', $itemId), - QueryParam::init('page', $page), - QueryParam::init('size', $size), - QueryParam::init('code', $code), - QueryParam::init('group', $group), - QueryParam::init('used_since', $usedSince)->serializeBy([DateTimeHelper::class, 'toRfc3339DateTime']), - QueryParam::init('used_until', $usedUntil)->serializeBy([DateTimeHelper::class, 'toRfc3339DateTime']) + TemplateParam::init('increment_id', $incrementId) ); - $_resHandler = $this->responseHandler()->type(ListUsagesResponse::class); + $_resHandler = $this->responseHandler()->type(GetIncrementResponse::class); return $this->execute($_reqBuilder, $_resHandler); } /** - * Atualização do valor mínimo da assinatura - * - * @param string $subscriptionId Subscription Id - * @param UpdateSubscriptionMinimumPriceRequest $request Request da requisição com o valor - * mínimo que será configurado + * @param string $subscriptionId + * @param UpdateSubscriptionAffiliationIdRequest $request Request for updating a subscription + * affiliation id * @param string|null $idempotencyKey * * @return GetSubscriptionResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function updateSubscriptionMiniumPrice( + public function updateSubscriptionAffiliationId( string $subscriptionId, - UpdateSubscriptionMinimumPriceRequest $request, + UpdateSubscriptionAffiliationIdRequest $request, ?string $idempotencyKey = null ): GetSubscriptionResponse { $_reqBuilder = $this->requestBuilder( RequestMethod::PATCH, - '/subscriptions/{subscription_id}/minimum_price' + '/subscriptions/{subscription_id}/gateway-affiliation-id' ) - ->auth('global') ->parameters( TemplateParam::init('subscription_id', $subscriptionId), BodyParam::init($request), @@ -651,80 +604,128 @@ public function updateSubscriptionMiniumPrice( } /** + * Updates the metadata from a subscription + * * @param string $subscriptionId The subscription id - * @param string $cycleId + * @param UpdateMetadataRequest $request Request for updating the subscrption metadata + * @param string|null $idempotencyKey * - * @return GetPeriodResponse Response from the API call + * @return GetSubscriptionResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function getSubscriptionCycleById(string $subscriptionId, string $cycleId): GetPeriodResponse - { + public function updateSubscriptionMetadata( + string $subscriptionId, + UpdateMetadataRequest $request, + ?string $idempotencyKey = null + ): GetSubscriptionResponse { + $_reqBuilder = $this->requestBuilder(RequestMethod::PATCH, '/Subscriptions/{subscription_id}/metadata') + ->parameters( + TemplateParam::init('subscription_id', $subscriptionId), + BodyParam::init($request), + HeaderParam::init('idempotency-key', $idempotencyKey) + ); + + $_resHandler = $this->responseHandler()->type(GetSubscriptionResponse::class); + + return $this->execute($_reqBuilder, $_resHandler); + } + + /** + * Deletes a increment + * + * @param string $subscriptionId Subscription id + * @param string $incrementId Increment id + * @param string|null $idempotencyKey + * + * @return GetIncrementResponse Response from the API call + * + * @throws ApiException Thrown if API call fails + */ + public function deleteIncrement( + string $subscriptionId, + string $incrementId, + ?string $idempotencyKey = null + ): GetIncrementResponse { $_reqBuilder = $this->requestBuilder( - RequestMethod::GET, - '/subscriptions/{subscription_id}/cycles/{cycleId}' + RequestMethod::DELETE, + '/subscriptions/{subscription_id}/increments/{increment_id}' ) - ->auth('global') ->parameters( TemplateParam::init('subscription_id', $subscriptionId), - TemplateParam::init('cycleId', $cycleId) + TemplateParam::init('increment_id', $incrementId), + HeaderParam::init('idempotency-key', $idempotencyKey) + ); + + $_resHandler = $this->responseHandler()->type(GetIncrementResponse::class); + + return $this->execute($_reqBuilder, $_resHandler); + } + + /** + * @param string $subscriptionId Subscription Id + * @param string $page Page number + * @param string $size Page size + * + * @return ListCyclesResponse Response from the API call + * + * @throws ApiException Thrown if API call fails + */ + public function getSubscriptionCycles(string $subscriptionId, string $page, string $size): ListCyclesResponse + { + $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/subscriptions/{subscription_id}/cycles') + ->parameters( + TemplateParam::init('subscription_id', $subscriptionId), + QueryParam::init('page', $page), + QueryParam::init('size', $size) ); - $_resHandler = $this->responseHandler()->type(GetPeriodResponse::class); + $_resHandler = $this->responseHandler()->type(ListCyclesResponse::class); return $this->execute($_reqBuilder, $_resHandler); } /** - * Create Usage - * - * @param string $subscriptionId Subscription id - * @param string $itemId Item id - * @param string|null $idempotencyKey + * @param string $subscriptionId The subscription id + * @param int $page Page number + * @param int $size Page size * - * @return GetUsageResponse Response from the API call + * @return ListDiscountsResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function createAnUsage( - string $subscriptionId, - string $itemId, - ?string $idempotencyKey = null - ): GetUsageResponse { - $_reqBuilder = $this->requestBuilder( - RequestMethod::POST, - '/subscriptions/{subscription_id}/items/{item_id}/usages' - ) - ->auth('global') + public function getDiscounts(string $subscriptionId, int $page, int $size): ListDiscountsResponse + { + $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/subscriptions/{subscription_id}/discounts/') ->parameters( TemplateParam::init('subscription_id', $subscriptionId), - TemplateParam::init('item_id', $itemId), - HeaderParam::init('idempotency-key', $idempotencyKey) + QueryParam::init('page', $page), + QueryParam::init('size', $size) ); - $_resHandler = $this->responseHandler()->type(GetUsageResponse::class); + $_resHandler = $this->responseHandler()->type(ListDiscountsResponse::class); return $this->execute($_reqBuilder, $_resHandler); } /** - * Cancels a subscription + * Updates the billing date from a subscription * - * @param string $subscriptionId Subscription id - * @param CreateCancelSubscriptionRequest|null $request Request for cancelling a subscription + * @param string $subscriptionId The subscription id + * @param UpdateSubscriptionBillingDateRequest $request Request for updating the subscription + * billing date * @param string|null $idempotencyKey * * @return GetSubscriptionResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function cancelSubscription( + public function updateSubscriptionBillingDate( string $subscriptionId, - ?CreateCancelSubscriptionRequest $request = null, + UpdateSubscriptionBillingDateRequest $request, ?string $idempotencyKey = null ): GetSubscriptionResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::DELETE, '/subscriptions/{subscription_id}') - ->auth('global') + $_reqBuilder = $this->requestBuilder(RequestMethod::PATCH, '/subscriptions/{subscription_id}/billing-date') ->parameters( TemplateParam::init('subscription_id', $subscriptionId), BodyParam::init($request), @@ -756,7 +757,6 @@ public function deleteSubscriptionItem( RequestMethod::DELETE, '/subscriptions/{subscription_id}/items/{subscription_item_id}' ) - ->auth('global') ->parameters( TemplateParam::init('subscription_id', $subscriptionId), TemplateParam::init('subscription_item_id', $subscriptionItemId), @@ -780,7 +780,6 @@ public function deleteSubscriptionItem( public function getIncrements(string $subscriptionId, ?int $page = null, ?int $size = null): ListIncrementsResponse { $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/subscriptions/{subscription_id}/increments/') - ->auth('global') ->parameters( TemplateParam::init('subscription_id', $subscriptionId), QueryParam::init('page', $page), @@ -812,7 +811,6 @@ public function updateSubscriptionDueDays( RequestMethod::PATCH, '/subscriptions/{subscription_id}/boleto-due-days' ) - ->auth('global') ->parameters( TemplateParam::init('subscription_id', $subscriptionId), BodyParam::init($request), @@ -825,23 +823,23 @@ public function updateSubscriptionDueDays( } /** - * Updates the credit card from a subscription + * Updates the start at date from a subscription * - * @param string $subscriptionId Subscription id - * @param UpdateSubscriptionCardRequest $request Request for updating a card + * @param string $subscriptionId The subscription id + * @param UpdateSubscriptionStartAtRequest $request Request for updating the subscription start + * date * @param string|null $idempotencyKey * * @return GetSubscriptionResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function updateSubscriptionCard( + public function updateSubscriptionStartAt( string $subscriptionId, - UpdateSubscriptionCardRequest $request, + UpdateSubscriptionStartAtRequest $request, ?string $idempotencyKey = null ): GetSubscriptionResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::PATCH, '/subscriptions/{subscription_id}/card') - ->auth('global') + $_reqBuilder = $this->requestBuilder(RequestMethod::PATCH, '/subscriptions/{subscription_id}/start-at') ->parameters( TemplateParam::init('subscription_id', $subscriptionId), BodyParam::init($request), @@ -854,96 +852,80 @@ public function updateSubscriptionCard( } /** - * Deletes a usage + * Updates a subscription item * - * @param string $subscriptionId The subscription id - * @param string $itemId The subscription item id - * @param string $usageId The usage id + * @param string $subscriptionId Subscription Id + * @param string $itemId Item id + * @param UpdateSubscriptionItemRequest $body Request for updating a subscription item * @param string|null $idempotencyKey * - * @return GetUsageResponse Response from the API call + * @return GetSubscriptionItemResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function deleteUsage( + public function updateSubscriptionItem( string $subscriptionId, string $itemId, - string $usageId, + UpdateSubscriptionItemRequest $body, ?string $idempotencyKey = null - ): GetUsageResponse { + ): GetSubscriptionItemResponse { $_reqBuilder = $this->requestBuilder( - RequestMethod::DELETE, - '/subscriptions/{subscription_id}/items/{item_id}/usages/{usage_id}' + RequestMethod::PUT, + '/subscriptions/{subscription_id}/items/{item_id}' ) - ->auth('global') ->parameters( TemplateParam::init('subscription_id', $subscriptionId), TemplateParam::init('item_id', $itemId), - TemplateParam::init('usage_id', $usageId), + BodyParam::init($body), HeaderParam::init('idempotency-key', $idempotencyKey) ); - $_resHandler = $this->responseHandler()->type(GetUsageResponse::class); + $_resHandler = $this->responseHandler()->type(GetSubscriptionItemResponse::class); return $this->execute($_reqBuilder, $_resHandler); } /** - * Creates a discount + * Creates a new Subscription item * * @param string $subscriptionId Subscription id - * @param CreateDiscountRequest $request Request for creating a discount + * @param CreateSubscriptionItemRequest $request Request for creating a subscription item * @param string|null $idempotencyKey * - * @return GetDiscountResponse Response from the API call + * @return GetSubscriptionItemResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function createDiscount( + public function createSubscriptionItem( string $subscriptionId, - CreateDiscountRequest $request, + CreateSubscriptionItemRequest $request, ?string $idempotencyKey = null - ): GetDiscountResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/subscriptions/{subscription_id}/discounts') - ->auth('global') + ): GetSubscriptionItemResponse { + $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/subscriptions/{subscription_id}/items') ->parameters( TemplateParam::init('subscription_id', $subscriptionId), BodyParam::init($request), HeaderParam::init('idempotency-key', $idempotencyKey) ); - $_resHandler = $this->responseHandler()->type(GetDiscountResponse::class); + $_resHandler = $this->responseHandler()->type(GetSubscriptionItemResponse::class); return $this->execute($_reqBuilder, $_resHandler); } /** - * Updates the payment method from a subscription + * Gets a subscription * * @param string $subscriptionId Subscription id - * @param UpdateSubscriptionPaymentMethodRequest $request Request for updating the paymentmethod - * from a subscription - * @param string|null $idempotencyKey * * @return GetSubscriptionResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function updateSubscriptionPaymentMethod( - string $subscriptionId, - UpdateSubscriptionPaymentMethodRequest $request, - ?string $idempotencyKey = null - ): GetSubscriptionResponse { - $_reqBuilder = $this->requestBuilder( - RequestMethod::PATCH, - '/subscriptions/{subscription_id}/payment-method' - ) - ->auth('global') - ->parameters( - TemplateParam::init('subscription_id', $subscriptionId), - BodyParam::init($request), - HeaderParam::init('idempotency-key', $idempotencyKey) - ); + public function getSubscription(string $subscriptionId): GetSubscriptionResponse + { + $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/subscriptions/{subscription_id}') + ->parameters(TemplateParam::init('subscription_id', $subscriptionId)); $_resHandler = $this->responseHandler()->type(GetSubscriptionResponse::class); @@ -951,112 +933,102 @@ public function updateSubscriptionPaymentMethod( } /** - * Creates a increment + * Lists all usages from a subscription item * - * @param string $subscriptionId Subscription id - * @param CreateIncrementRequest $request Request for creating a increment - * @param string|null $idempotencyKey + * @param string $subscriptionId The subscription id + * @param string $itemId The subscription item id + * @param int|null $page Page number + * @param int|null $size Page size + * @param string|null $code Identification code in the client system + * @param string|null $group Identification group in the client system + * @param \DateTime|null $usedSince + * @param \DateTime|null $usedUntil * - * @return GetIncrementResponse Response from the API call + * @return ListUsagesResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function createIncrement( + public function getUsages( string $subscriptionId, - CreateIncrementRequest $request, - ?string $idempotencyKey = null - ): GetIncrementResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/subscriptions/{subscription_id}/increments') - ->auth('global') + string $itemId, + ?int $page = null, + ?int $size = null, + ?string $code = null, + ?string $group = null, + ?\DateTime $usedSince = null, + ?\DateTime $usedUntil = null + ): ListUsagesResponse { + $_reqBuilder = $this->requestBuilder( + RequestMethod::GET, + '/subscriptions/{subscription_id}/items/{item_id}/usages' + ) ->parameters( TemplateParam::init('subscription_id', $subscriptionId), - BodyParam::init($request), - HeaderParam::init('idempotency-key', $idempotencyKey) + TemplateParam::init('item_id', $itemId), + QueryParam::init('page', $page), + QueryParam::init('size', $size), + QueryParam::init('code', $code), + QueryParam::init('group', $group), + QueryParam::init('used_since', $usedSince)->serializeBy([DateTimeHelper::class, 'toRfc3339DateTime']), + QueryParam::init('used_until', $usedUntil)->serializeBy([DateTimeHelper::class, 'toRfc3339DateTime']) ); - $_resHandler = $this->responseHandler()->type(GetIncrementResponse::class); + $_resHandler = $this->responseHandler()->type(ListUsagesResponse::class); return $this->execute($_reqBuilder, $_resHandler); } /** - * Creates a usage - * - * @param string $subscriptionId Subscription Id - * @param string $itemId Item id - * @param CreateUsageRequest $body Request for creating a usage + * @param string $subscriptionId + * @param UpdateCurrentCycleEndDateRequest $request Request for updating the end date of the + * current signature cycle * @param string|null $idempotencyKey * - * @return GetUsageResponse Response from the API call + * @return GetSubscriptionResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function createUsage( + public function updateLatestPeriodEndAt( string $subscriptionId, - string $itemId, - CreateUsageRequest $body, + UpdateCurrentCycleEndDateRequest $request, ?string $idempotencyKey = null - ): GetUsageResponse { + ): GetSubscriptionResponse { $_reqBuilder = $this->requestBuilder( - RequestMethod::POST, - '/subscriptions/{subscription_id}/items/{item_id}/usages' + RequestMethod::PATCH, + '/subscriptions/{subscription_id}/periods/latest/end-at' ) - ->auth('global') ->parameters( TemplateParam::init('subscription_id', $subscriptionId), - TemplateParam::init('item_id', $itemId), - BodyParam::init($body), + BodyParam::init($request), HeaderParam::init('idempotency-key', $idempotencyKey) ); - $_resHandler = $this->responseHandler()->type(GetUsageResponse::class); - - return $this->execute($_reqBuilder, $_resHandler); - } - - /** - * @param string $subscriptionId Subscription Id - * @param string $page Page number - * @param string $size Page size - * - * @return ListCyclesResponse Response from the API call - * - * @throws ApiException Thrown if API call fails - */ - public function getSubscriptionCycles(string $subscriptionId, string $page, string $size): ListCyclesResponse - { - $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/subscriptions/{subscription_id}/cycles') - ->auth('global') - ->parameters( - TemplateParam::init('subscription_id', $subscriptionId), - QueryParam::init('page', $page), - QueryParam::init('size', $size) - ); - - $_resHandler = $this->responseHandler()->type(ListCyclesResponse::class); + $_resHandler = $this->responseHandler()->type(GetSubscriptionResponse::class); return $this->execute($_reqBuilder, $_resHandler); } /** - * Updates the billing date from a subscription + * Atualização do valor mínimo da assinatura * - * @param string $subscriptionId The subscription id - * @param UpdateSubscriptionBillingDateRequest $request Request for updating the subscription - * billing date + * @param string $subscriptionId Subscription Id + * @param UpdateSubscriptionMinimumPriceRequest $request Request da requisição com o valor + * mínimo que será configurado * @param string|null $idempotencyKey * * @return GetSubscriptionResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function updateSubscriptionBillingDate( + public function updateSubscriptionMiniumPrice( string $subscriptionId, - UpdateSubscriptionBillingDateRequest $request, + UpdateSubscriptionMinimumPriceRequest $request, ?string $idempotencyKey = null ): GetSubscriptionResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::PATCH, '/subscriptions/{subscription_id}/billing-date') - ->auth('global') + $_reqBuilder = $this->requestBuilder( + RequestMethod::PATCH, + '/subscriptions/{subscription_id}/minimum_price' + ) ->parameters( TemplateParam::init('subscription_id', $subscriptionId), BodyParam::init($request), @@ -1069,31 +1041,25 @@ public function updateSubscriptionBillingDate( } /** - * Updates the start at date from a subscription - * * @param string $subscriptionId The subscription id - * @param UpdateSubscriptionStartAtRequest $request Request for updating the subscription start - * date - * @param string|null $idempotencyKey + * @param string $cycleId * - * @return GetSubscriptionResponse Response from the API call + * @return GetPeriodResponse Response from the API call * * @throws ApiException Thrown if API call fails */ - public function updateSubscriptionStartAt( - string $subscriptionId, - UpdateSubscriptionStartAtRequest $request, - ?string $idempotencyKey = null - ): GetSubscriptionResponse { - $_reqBuilder = $this->requestBuilder(RequestMethod::PATCH, '/subscriptions/{subscription_id}/start-at') - ->auth('global') + public function getSubscriptionCycleById(string $subscriptionId, string $cycleId): GetPeriodResponse + { + $_reqBuilder = $this->requestBuilder( + RequestMethod::GET, + '/subscriptions/{subscription_id}/cycles/{cycleId}' + ) ->parameters( TemplateParam::init('subscription_id', $subscriptionId), - BodyParam::init($request), - HeaderParam::init('idempotency-key', $idempotencyKey) + TemplateParam::init('cycleId', $cycleId) ); - $_resHandler = $this->responseHandler()->type(GetSubscriptionResponse::class); + $_resHandler = $this->responseHandler()->type(GetPeriodResponse::class); return $this->execute($_reqBuilder, $_resHandler); } @@ -1112,7 +1078,6 @@ public function getUsageReport(string $subscriptionId, string $periodId): GetUsa RequestMethod::GET, '/subscriptions/{subscription_id}/periods/{period_id}/usages/report' ) - ->auth('global') ->parameters( TemplateParam::init('subscription_id', $subscriptionId), TemplateParam::init('period_id', $periodId) @@ -1136,7 +1101,6 @@ public function updateSplitSubscription( UpdateSubscriptionSplitRequest $request ): GetSubscriptionResponse { $_reqBuilder = $this->requestBuilder(RequestMethod::PATCH, '/subscriptions/{id}/split') - ->auth('global') ->parameters(TemplateParam::init('id', $id), BodyParam::init($request)); $_resHandler = $this->responseHandler()->type(GetSubscriptionResponse::class); diff --git a/src/Controllers/TransactionsController.php b/src/Controllers/TransactionsController.php index a4574ff..152a9c6 100644 --- a/src/Controllers/TransactionsController.php +++ b/src/Controllers/TransactionsController.php @@ -27,7 +27,6 @@ class TransactionsController extends BaseController public function getTransaction(string $transactionId): GetTransactionResponse { $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/transactions/{transaction_id}') - ->auth('global') ->parameters(TemplateParam::init('transaction_id', $transactionId)); $_resHandler = $this->responseHandler()->type(GetTransactionResponse::class); diff --git a/src/Controllers/TransfersController.php b/src/Controllers/TransfersController.php index 779edf3..e465ebb 100644 --- a/src/Controllers/TransfersController.php +++ b/src/Controllers/TransfersController.php @@ -21,33 +21,33 @@ class TransfersController extends BaseController { /** - * Gets all transfers + * @param string $transferId * - * @return ListTransfers Response from the API call + * @return GetTransfer Response from the API call * * @throws ApiException Thrown if API call fails */ - public function getTransfers(): ListTransfers + public function getTransferById(string $transferId): GetTransfer { - $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/transfers')->auth('global'); + $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/transfers/{transfer_id}') + ->parameters(TemplateParam::init('transfer_id', $transferId)); - $_resHandler = $this->responseHandler()->type(ListTransfers::class); + $_resHandler = $this->responseHandler()->type(GetTransfer::class); return $this->execute($_reqBuilder, $_resHandler); } /** - * @param string $transferId + * @param CreateTransfer $request * * @return GetTransfer Response from the API call * * @throws ApiException Thrown if API call fails */ - public function getTransferById(string $transferId): GetTransfer + public function createTransfer(CreateTransfer $request): GetTransfer { - $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/transfers/{transfer_id}') - ->auth('global') - ->parameters(TemplateParam::init('transfer_id', $transferId)); + $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/transfers/recipients') + ->parameters(BodyParam::init($request)); $_resHandler = $this->responseHandler()->type(GetTransfer::class); @@ -55,19 +55,17 @@ public function getTransferById(string $transferId): GetTransfer } /** - * @param CreateTransfer $request + * Gets all transfers * - * @return GetTransfer Response from the API call + * @return ListTransfers Response from the API call * * @throws ApiException Thrown if API call fails */ - public function createTransfer(CreateTransfer $request): GetTransfer + public function getTransfers(): ListTransfers { - $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/transfers/recipients') - ->auth('global') - ->parameters(BodyParam::init($request)); + $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/transfers'); - $_resHandler = $this->responseHandler()->type(GetTransfer::class); + $_resHandler = $this->responseHandler()->type(ListTransfers::class); return $this->execute($_reqBuilder, $_resHandler); } diff --git a/src/Models/Builders/CreateManagingPartnerRequestBuilder.php b/src/Models/Builders/CreateManagingPartnerRequestBuilder.php index 7f56a57..e5f6104 100644 --- a/src/Models/Builders/CreateManagingPartnerRequestBuilder.php +++ b/src/Models/Builders/CreateManagingPartnerRequestBuilder.php @@ -40,7 +40,7 @@ public static function init( string $document, string $motherName, string $birthdate, - string $monthlyIncome, + int $monthlyIncome, string $professionalOccupation, bool $selfDeclaredLegalRepresentative, CreateRegisterInformationAddressRequest $address, diff --git a/src/Models/Builders/CreateRegisterInformationCorporationRequestBuilder.php b/src/Models/Builders/CreateRegisterInformationCorporationRequestBuilder.php index cce760f..6be19df 100644 --- a/src/Models/Builders/CreateRegisterInformationCorporationRequestBuilder.php +++ b/src/Models/Builders/CreateRegisterInformationCorporationRequestBuilder.php @@ -41,7 +41,7 @@ public static function init( array $phoneNumbers, string $companyName, string $tradingName, - string $annualRevenue, + int $annualRevenue, array $managingPartners, CreateRegisterInformationAddressRequest $mainAddress ): self { diff --git a/src/Models/Builders/CreateRegisterInformationIndividualRequestBuilder.php b/src/Models/Builders/CreateRegisterInformationIndividualRequestBuilder.php index 580e2e8..3a0fc9a 100644 --- a/src/Models/Builders/CreateRegisterInformationIndividualRequestBuilder.php +++ b/src/Models/Builders/CreateRegisterInformationIndividualRequestBuilder.php @@ -41,7 +41,7 @@ public static function init( array $phoneNumbers, string $name, string $birthdate, - string $monthlyIncome, + int $monthlyIncome, string $professionalOccupation, CreateRegisterInformationAddressRequest $address ): self { diff --git a/src/Models/CreateManagingPartnerRequest.php b/src/Models/CreateManagingPartnerRequest.php index da2bc60..74a8aca 100644 --- a/src/Models/CreateManagingPartnerRequest.php +++ b/src/Models/CreateManagingPartnerRequest.php @@ -43,7 +43,7 @@ class CreateManagingPartnerRequest implements \JsonSerializable private $birthdate; /** - * @var string + * @var int */ private $monthlyIncome; @@ -73,7 +73,7 @@ class CreateManagingPartnerRequest implements \JsonSerializable * @param string $document * @param string $motherName * @param string $birthdate - * @param string $monthlyIncome + * @param int $monthlyIncome * @param string $professionalOccupation * @param bool $selfDeclaredLegalRepresentative * @param CreateRegisterInformationAddressRequest $address @@ -85,7 +85,7 @@ public function __construct( string $document, string $motherName, string $birthdate, - string $monthlyIncome, + int $monthlyIncome, string $professionalOccupation, bool $selfDeclaredLegalRepresentative, CreateRegisterInformationAddressRequest $address, @@ -201,7 +201,7 @@ public function setBirthdate(string $birthdate): void /** * Returns Monthly Income. */ - public function getMonthlyIncome(): string + public function getMonthlyIncome(): int { return $this->monthlyIncome; } @@ -212,7 +212,7 @@ public function getMonthlyIncome(): string * @required * @maps monthly_income */ - public function setMonthlyIncome(string $monthlyIncome): void + public function setMonthlyIncome(int $monthlyIncome): void { $this->monthlyIncome = $monthlyIncome; } diff --git a/src/Models/CreateRegisterInformationCorporationRequest.php b/src/Models/CreateRegisterInformationCorporationRequest.php index 045150e..1183907 100644 --- a/src/Models/CreateRegisterInformationCorporationRequest.php +++ b/src/Models/CreateRegisterInformationCorporationRequest.php @@ -25,7 +25,7 @@ class CreateRegisterInformationCorporationRequest extends CreateRegisterInformat private $tradingName; /** - * @var string + * @var int */ private $annualRevenue; @@ -61,7 +61,7 @@ class CreateRegisterInformationCorporationRequest extends CreateRegisterInformat * @param CreateRegisterInformationPhoneRequest[] $phoneNumbers * @param string $companyName * @param string $tradingName - * @param string $annualRevenue + * @param int $annualRevenue * @param CreateManagingPartnerRequest[] $managingPartners * @param CreateRegisterInformationAddressRequest $mainAddress */ @@ -72,7 +72,7 @@ public function __construct( array $phoneNumbers, string $companyName, string $tradingName, - string $annualRevenue, + int $annualRevenue, array $managingPartners, CreateRegisterInformationAddressRequest $mainAddress ) { @@ -125,7 +125,7 @@ public function setTradingName(string $tradingName): void /** * Returns Annual Revenue. */ - public function getAnnualRevenue(): string + public function getAnnualRevenue(): int { return $this->annualRevenue; } @@ -136,7 +136,7 @@ public function getAnnualRevenue(): string * @required * @maps annual_revenue */ - public function setAnnualRevenue(string $annualRevenue): void + public function setAnnualRevenue(int $annualRevenue): void { $this->annualRevenue = $annualRevenue; } diff --git a/src/Models/CreateRegisterInformationIndividualRequest.php b/src/Models/CreateRegisterInformationIndividualRequest.php index 4388a93..c99b854 100644 --- a/src/Models/CreateRegisterInformationIndividualRequest.php +++ b/src/Models/CreateRegisterInformationIndividualRequest.php @@ -30,7 +30,7 @@ class CreateRegisterInformationIndividualRequest extends CreateRegisterInformati private $birthdate; /** - * @var string + * @var int */ private $monthlyIncome; @@ -51,7 +51,7 @@ class CreateRegisterInformationIndividualRequest extends CreateRegisterInformati * @param CreateRegisterInformationPhoneRequest[] $phoneNumbers * @param string $name * @param string $birthdate - * @param string $monthlyIncome + * @param int $monthlyIncome * @param string $professionalOccupation * @param CreateRegisterInformationAddressRequest $address */ @@ -62,7 +62,7 @@ public function __construct( array $phoneNumbers, string $name, string $birthdate, - string $monthlyIncome, + int $monthlyIncome, string $professionalOccupation, CreateRegisterInformationAddressRequest $address ) { @@ -144,7 +144,7 @@ public function setBirthdate(string $birthdate): void /** * Returns Monthly Income. */ - public function getMonthlyIncome(): string + public function getMonthlyIncome(): int { return $this->monthlyIncome; } @@ -155,7 +155,7 @@ public function getMonthlyIncome(): string * @required * @maps monthly_income */ - public function setMonthlyIncome(string $monthlyIncome): void + public function setMonthlyIncome(int $monthlyIncome): void { $this->monthlyIncome = $monthlyIncome; } diff --git a/src/PagarmeApiSDKClient.php b/src/PagarmeApiSDKClient.php index d341998..7fa5f1a 100644 --- a/src/PagarmeApiSDKClient.php +++ b/src/PagarmeApiSDKClient.php @@ -57,8 +57,6 @@ class PagarmeApiSDKClient implements ConfigurationInterface private $balanceOperations; - private $basicAuthManager; - private $config; private $client; @@ -72,19 +70,14 @@ class PagarmeApiSDKClient implements ConfigurationInterface public function __construct(array $config = []) { $this->config = array_merge(ConfigurationDefaults::_ALL, CoreHelper::clone($config)); - $this->basicAuthManager = new BasicAuthManager( - $this->config['basicAuthUserName'] ?? ConfigurationDefaults::BASIC_AUTH_USER_NAME, - $this->config['basicAuthPassword'] ?? ConfigurationDefaults::BASIC_AUTH_PASSWORD - ); $this->client = ClientBuilder::init(new HttpClient(Configuration::init($this))) ->converter(new CompatibilityConverter()) ->jsonHelper(ApiHelper::getJsonHelper()) ->apiCallback($this->config['httpCallback'] ?? null) - ->userAgent('PagarmeApiSDK - PHP 6.8.4') + ->userAgent('PagarmeApiSDK - PHP 6.8.5') ->globalConfig($this->getGlobalConfiguration()) ->globalErrors($this->getGlobalErrors()) ->serverUrls(self::ENVIRONMENT_MAP[$this->getEnvironment()], Server::DEFAULT_) - ->authManagers(['global' => $this->basicAuthManager]) ->build(); } @@ -107,8 +100,6 @@ public function toBuilder(): PagarmeApiSDKClientBuilder ->httpMethodsToRetry($this->getHttpMethodsToRetry()) ->serviceRefererName($this->getServiceRefererName()) ->environment($this->getEnvironment()) - ->basicAuthUserName($this->basicAuthManager->getBasicAuthUserName()) - ->basicAuthPassword($this->basicAuthManager->getBasicAuthPassword()) ->httpCallback($this->config['httpCallback'] ?? null); } @@ -167,11 +158,6 @@ public function getEnvironment(): string return $this->config['environment'] ?? ConfigurationDefaults::ENVIRONMENT; } - public function getBasicAuthCredentials(): ?BasicAuthCredentials - { - return $this->basicAuthManager; - } - /** * Get the client configuration as an associative array * diff --git a/src/PagarmeApiSDKClientBuilder.php b/src/PagarmeApiSDKClientBuilder.php index 4aecc55..2576358 100644 --- a/src/PagarmeApiSDKClientBuilder.php +++ b/src/PagarmeApiSDKClientBuilder.php @@ -113,18 +113,6 @@ public function environment(string $environment): self return $this; } - public function basicAuthUserName(string $basicAuthUserName): self - { - $this->config['basicAuthUserName'] = $basicAuthUserName; - return $this; - } - - public function basicAuthPassword(string $basicAuthPassword): self - { - $this->config['basicAuthPassword'] = $basicAuthPassword; - return $this; - } - public function httpCallback($httpCallback): self { if (!$httpCallback instanceof CoreCallback) {