From be295dc866b631e00689b48a9ea4cd3c0e111713 Mon Sep 17 00:00:00 2001 From: andreals Date: Tue, 8 Oct 2024 20:14:18 +0000 Subject: [PATCH] Automated commit message --- README.md | 48 +++++++-------- doc/models/get-integration-response.md | 21 +++++++ doc/models/get-order-response.md | 1 + .../GetIntegrationResponseBuilder.php | 57 ++++++++++++++++++ .../Builders/GetOrderResponseBuilder.php | 19 ++++++ src/Models/GetIntegrationResponse.php | 58 +++++++++++++++++++ src/Models/GetOrderResponse.php | 37 ++++++++++++ src/PagarmeApiSDKClient.php | 2 +- 8 files changed, 218 insertions(+), 25 deletions(-) create mode 100644 doc/models/get-integration-response.md create mode 100644 src/Models/Builders/GetIntegrationResponseBuilder.php create mode 100644 src/Models/GetIntegrationResponse.php diff --git a/README.md b/README.md index 3ed1348..6c6ac08 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.12/doc/client.md) +**_Note:_** Documentation for the client can be found [here.](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.13/doc/client.md) The following parameters are configurable for the API Client: @@ -115,7 +115,7 @@ 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'` | -| `basicAuthCredentials` | [`BasicAuthCredentials`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.12/doc/auth/basic-authentication.md) | The Credentials Setter for Basic Authentication | +| `basicAuthCredentials` | [`BasicAuthCredentials`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.13/doc/auth/basic-authentication.md) | The Credentials Setter for Basic Authentication | The API client can be initialized as follows: @@ -135,7 +135,7 @@ $client = PagarmeApiSDKClientBuilder::init() This API uses the following authentication schemes. -* [`httpBasic (Basic Authentication)`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.12/doc/auth/basic-authentication.md) +* [`httpBasic (Basic Authentication)`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.13/doc/auth/basic-authentication.md) ## API Errors @@ -143,31 +143,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.12/doc/models/error-exception.md) | -| 401 | Invalid API key | [`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.12/doc/models/error-exception.md) | -| 404 | An informed resource was not found | [`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.12/doc/models/error-exception.md) | -| 412 | Business validation error | [`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.12/doc/models/error-exception.md) | -| 422 | Contract validation error | [`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.12/doc/models/error-exception.md) | -| 500 | Internal server error | [`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.12/doc/models/error-exception.md) | +| 400 | Invalid request | [`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.13/doc/models/error-exception.md) | +| 401 | Invalid API key | [`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.13/doc/models/error-exception.md) | +| 404 | An informed resource was not found | [`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.13/doc/models/error-exception.md) | +| 412 | Business validation error | [`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.13/doc/models/error-exception.md) | +| 422 | Contract validation error | [`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.13/doc/models/error-exception.md) | +| 500 | Internal server error | [`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.13/doc/models/error-exception.md) | ## List of APIs -* [Subscriptions](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.12/doc/controllers/subscriptions.md) -* [Orders](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.12/doc/controllers/orders.md) -* [Plans](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.12/doc/controllers/plans.md) -* [Invoices](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.12/doc/controllers/invoices.md) -* [Customers](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.12/doc/controllers/customers.md) -* [Charges](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.12/doc/controllers/charges.md) -* [Recipients](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.12/doc/controllers/recipients.md) -* [Tokens](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.12/doc/controllers/tokens.md) -* [Transactions](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.12/doc/controllers/transactions.md) -* [Transfers](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.12/doc/controllers/transfers.md) -* [Payables](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.12/doc/controllers/payables.md) -* [Balance Operations](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.12/doc/controllers/balance-operations.md) +* [Subscriptions](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.13/doc/controllers/subscriptions.md) +* [Orders](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.13/doc/controllers/orders.md) +* [Plans](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.13/doc/controllers/plans.md) +* [Invoices](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.13/doc/controllers/invoices.md) +* [Customers](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.13/doc/controllers/customers.md) +* [Charges](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.13/doc/controllers/charges.md) +* [Recipients](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.13/doc/controllers/recipients.md) +* [Tokens](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.13/doc/controllers/tokens.md) +* [Transactions](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.13/doc/controllers/transactions.md) +* [Transfers](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.13/doc/controllers/transfers.md) +* [Payables](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.13/doc/controllers/payables.md) +* [Balance Operations](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.13/doc/controllers/balance-operations.md) ## Classes Documentation -* [ApiException](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.12/doc/api-exception.md) -* [HttpRequest](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.12/doc/http-request.md) -* [HttpResponse](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.12/doc/http-response.md) +* [ApiException](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.13/doc/api-exception.md) +* [HttpRequest](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.13/doc/http-request.md) +* [HttpResponse](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.13/doc/http-response.md) diff --git a/doc/models/get-integration-response.md b/doc/models/get-integration-response.md new file mode 100644 index 0000000..1736b72 --- /dev/null +++ b/doc/models/get-integration-response.md @@ -0,0 +1,21 @@ + +# Get Integration Response + +## Structure + +`GetIntegrationResponse` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `code` | `?string` | Optional | - | getCode(): ?string | setCode(?string code): void | + +## Example (as JSON) + +```json +{ + "code": "code2" +} +``` + diff --git a/doc/models/get-order-response.md b/doc/models/get-order-response.md index 7640c6c..e2b3191 100644 --- a/doc/models/get-order-response.md +++ b/doc/models/get-order-response.md @@ -31,6 +31,7 @@ Response object for getting an Order | `sessionId` | `?string` | Optional | Session id | getSessionId(): ?string | setSessionId(?string sessionId): void | | `location` | [`?GetLocationResponse`](../../doc/models/get-location-response.md) | Optional | Location | getLocation(): ?GetLocationResponse | setLocation(?GetLocationResponse location): void | | `device` | [`?GetDeviceResponse`](../../doc/models/get-device-response.md) | Optional | Device's informations | getDevice(): ?GetDeviceResponse | setDevice(?GetDeviceResponse device): void | +| `integration` | [`?GetIntegrationResponse`](../../doc/models/get-integration-response.md) | Optional | - | getIntegration(): ?GetIntegrationResponse | setIntegration(?GetIntegrationResponse integration): void | ## Example (as JSON) diff --git a/src/Models/Builders/GetIntegrationResponseBuilder.php b/src/Models/Builders/GetIntegrationResponseBuilder.php new file mode 100644 index 0000000..518937f --- /dev/null +++ b/src/Models/Builders/GetIntegrationResponseBuilder.php @@ -0,0 +1,57 @@ +instance = $instance; + } + + /** + * Initializes a new get integration response Builder object. + */ + public static function init(): self + { + return new self(new GetIntegrationResponse()); + } + + /** + * Sets code field. + */ + public function code(?string $value): self + { + $this->instance->setCode($value); + return $this; + } + + /** + * Initializes a new get integration response object. + */ + public function build(): GetIntegrationResponse + { + return CoreHelper::clone($this->instance); + } +} diff --git a/src/Models/Builders/GetOrderResponseBuilder.php b/src/Models/Builders/GetOrderResponseBuilder.php index b17870b..b5cf753 100644 --- a/src/Models/Builders/GetOrderResponseBuilder.php +++ b/src/Models/Builders/GetOrderResponseBuilder.php @@ -13,6 +13,7 @@ use Core\Utils\CoreHelper; use PagarmeApiSDKLib\Models\GetCustomerResponse; use PagarmeApiSDKLib\Models\GetDeviceResponse; +use PagarmeApiSDKLib\Models\GetIntegrationResponse; use PagarmeApiSDKLib\Models\GetLocationResponse; use PagarmeApiSDKLib\Models\GetOrderResponse; use PagarmeApiSDKLib\Models\GetShippingResponse; @@ -402,6 +403,24 @@ public function unsetDevice(): self return $this; } + /** + * Sets integration field. + */ + public function integration(?GetIntegrationResponse $value): self + { + $this->instance->setIntegration($value); + return $this; + } + + /** + * Unsets integration field. + */ + public function unsetIntegration(): self + { + $this->instance->unsetIntegration(); + return $this; + } + /** * Initializes a new get order response object. */ diff --git a/src/Models/GetIntegrationResponse.php b/src/Models/GetIntegrationResponse.php new file mode 100644 index 0000000..ee9c66f --- /dev/null +++ b/src/Models/GetIntegrationResponse.php @@ -0,0 +1,58 @@ +code; + } + + /** + * Sets Code. + * + * @maps code + */ + public function setCode(?string $code): void + { + $this->code = $code; + } + + /** + * 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 (isset($this->code)) { + $json['code'] = $this->code; + } + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/GetOrderResponse.php b/src/Models/GetOrderResponse.php index e0c8c61..0c6678a 100644 --- a/src/Models/GetOrderResponse.php +++ b/src/Models/GetOrderResponse.php @@ -118,6 +118,11 @@ class GetOrderResponse implements \JsonSerializable */ private $device = []; + /** + * @var array + */ + private $integration = []; + /** * Returns Id. */ @@ -735,6 +740,35 @@ public function unsetDevice(): void $this->device = []; } + /** + * Returns Integration. + */ + public function getIntegration(): ?GetIntegrationResponse + { + if (count($this->integration) == 0) { + return null; + } + return $this->integration['value']; + } + + /** + * Sets Integration. + * + * @maps integration + */ + public function setIntegration(?GetIntegrationResponse $integration): void + { + $this->integration['value'] = $integration; + } + + /** + * Unsets Integration. + */ + public function unsetIntegration(): void + { + $this->integration = []; + } + /** * Encode this object to JSON * @@ -807,6 +841,9 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) if (!empty($this->device)) { $json['device'] = $this->device['value']; } + if (!empty($this->integration)) { + $json['integration'] = $this->integration['value']; + } return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; } diff --git a/src/PagarmeApiSDKClient.php b/src/PagarmeApiSDKClient.php index ce40dd0..b663ddc 100644 --- a/src/PagarmeApiSDKClient.php +++ b/src/PagarmeApiSDKClient.php @@ -79,7 +79,7 @@ public function __construct(array $config = []) ->converter(new CompatibilityConverter()) ->jsonHelper(ApiHelper::getJsonHelper()) ->apiCallback($this->config['httpCallback'] ?? null) - ->userAgent('PagarmeApiSDK - PHP 6.8.12') + ->userAgent('PagarmeApiSDK - PHP 6.8.13') ->globalConfig($this->getGlobalConfiguration()) ->globalErrors($this->getGlobalErrors()) ->serverUrls(self::ENVIRONMENT_MAP[$this->getEnvironment()], Server::DEFAULT_)