diff --git a/composer.json b/composer.json index ed0b1afc..f82ab56c 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "square/square", "description": "Use Square APIs to manage and run business including payment, customer, product, inventory, and employee management.", - "version": "21.0.0.20220817", + "version": "21.1.0.20220823", "type": "library", "keywords": [ "Square", diff --git a/doc/client.md b/doc/client.md index d22fd14c..2f92e0a7 100644 --- a/doc/client.md +++ b/doc/client.md @@ -5,7 +5,7 @@ The following parameters are configurable for the API Client: | Parameter | Type | Description | | --- | --- | --- | -| `squareVersion` | `string` | Square Connect API versions
*Default*: `'2022-08-17'` | +| `squareVersion` | `string` | Square Connect API versions
*Default*: `'2022-08-23'` | | `customUrl` | `string` | Sets the base URL requests are made to. Defaults to `https://connect.squareup.com`
*Default*: `'https://connect.squareup.com'` | | `environment` | `string` | The API environment.
**Default: `production`** | | `timeout` | `int` | Timeout for API calls in seconds.
*Default*: `60` | @@ -27,7 +27,7 @@ The API client can be initialized as follows: $client = new Square\SquareClient([ // Set authentication parameters 'accessToken' => 'AccessToken', - 'squareVersion' => '2022-08-17', + 'squareVersion' => '2022-08-23', // Set the environment 'environment' => 'production', @@ -54,7 +54,7 @@ require_once "vendor/autoload.php"; $client = new Square\SquareClient([ 'accessToken' => 'AccessToken', - 'squareVersion' => '2022-08-17', + 'squareVersion' => '2022-08-23', ]); $locationsApi = $client->getLocationsApi(); diff --git a/doc/models/buy-now-pay-later-details.md b/doc/models/buy-now-pay-later-details.md index 03ca62ef..8afa5e59 100644 --- a/doc/models/buy-now-pay-later-details.md +++ b/doc/models/buy-now-pay-later-details.md @@ -11,15 +11,17 @@ Additional details about a Buy Now Pay Later payment type. | Name | Type | Tags | Description | Getter | Setter | | --- | --- | --- | --- | --- | --- | -| `brand` | `?string` | Optional | The brand used for the Buy Now Pay Later payment.
The brand can be `AFTERPAY` or `UNKNOWN`.
**Constraints**: *Maximum Length*: `50` | getBrand(): ?string | setBrand(?string brand): void | +| `brand` | `?string` | Optional | The brand used for the Buy Now Pay Later payment.
The brand can be `AFTERPAY`, `CLEARPAY` or `UNKNOWN`.
**Constraints**: *Maximum Length*: `50` | getBrand(): ?string | setBrand(?string brand): void | | `afterpayDetails` | [`?AfterpayDetails`](../../doc/models/afterpay-details.md) | Optional | Additional details about Afterpay payments. | getAfterpayDetails(): ?AfterpayDetails | setAfterpayDetails(?AfterpayDetails afterpayDetails): void | +| `clearpayDetails` | [`?ClearpayDetails`](../../doc/models/clearpay-details.md) | Optional | Additional details about Clearpay payments. | getClearpayDetails(): ?ClearpayDetails | setClearpayDetails(?ClearpayDetails clearpayDetails): void | ## Example (as JSON) ```json { "brand": null, - "afterpay_details": null + "afterpay_details": null, + "clearpay_details": null } ``` diff --git a/doc/models/clearpay-details.md b/doc/models/clearpay-details.md new file mode 100644 index 00000000..a74897fb --- /dev/null +++ b/doc/models/clearpay-details.md @@ -0,0 +1,23 @@ + +# Clearpay Details + +Additional details about Clearpay payments. + +## Structure + +`ClearpayDetails` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `emailAddress` | `?string` | Optional | Email address on the buyer's Clearpay account.
**Constraints**: *Maximum Length*: `255` | getEmailAddress(): ?string | setEmailAddress(?string emailAddress): void | + +## Example (as JSON) + +```json +{ + "email_address": null +} +``` + diff --git a/src/Apis/BaseApi.php b/src/Apis/BaseApi.php index eb692506..db0afc40 100644 --- a/src/Apis/BaseApi.php +++ b/src/Apis/BaseApi.php @@ -51,7 +51,7 @@ class BaseApi */ protected $internalUserAgent; - private static $userAgent = 'Square-PHP-SDK/21.0.0.20220817 ({api-version}) {engine}/{engine-version} ({os-info}) {detail}'; + private static $userAgent = 'Square-PHP-SDK/21.1.0.20220823 ({api-version}) {engine}/{engine-version} ({os-info}) {detail}'; /** * Constructor that sets the timeout of requests diff --git a/src/ConfigurationDefaults.php b/src/ConfigurationDefaults.php index 122bf526..ed6fa77a 100644 --- a/src/ConfigurationDefaults.php +++ b/src/ConfigurationDefaults.php @@ -27,7 +27,7 @@ class ConfigurationDefaults public const HTTP_METHODS_TO_RETRY = ['GET', 'PUT']; - public const SQUARE_VERSION = '2022-08-17'; + public const SQUARE_VERSION = '2022-08-23'; public const ADDITIONAL_HEADERS = []; diff --git a/src/Models/BuyNowPayLaterDetails.php b/src/Models/BuyNowPayLaterDetails.php index b98d8d96..048b003a 100644 --- a/src/Models/BuyNowPayLaterDetails.php +++ b/src/Models/BuyNowPayLaterDetails.php @@ -21,10 +21,15 @@ class BuyNowPayLaterDetails implements \JsonSerializable */ private $afterpayDetails; + /** + * @var ClearpayDetails|null + */ + private $clearpayDetails; + /** * Returns Brand. * The brand used for the Buy Now Pay Later payment. - * The brand can be `AFTERPAY` or `UNKNOWN`. + * The brand can be `AFTERPAY`, `CLEARPAY` or `UNKNOWN`. */ public function getBrand(): ?string { @@ -34,7 +39,7 @@ public function getBrand(): ?string /** * Sets Brand. * The brand used for the Buy Now Pay Later payment. - * The brand can be `AFTERPAY` or `UNKNOWN`. + * The brand can be `AFTERPAY`, `CLEARPAY` or `UNKNOWN`. * * @maps brand */ @@ -63,6 +68,26 @@ public function setAfterpayDetails(?AfterpayDetails $afterpayDetails): void $this->afterpayDetails = $afterpayDetails; } + /** + * Returns Clearpay Details. + * Additional details about Clearpay payments. + */ + public function getClearpayDetails(): ?ClearpayDetails + { + return $this->clearpayDetails; + } + + /** + * Sets Clearpay Details. + * Additional details about Clearpay payments. + * + * @maps clearpay_details + */ + public function setClearpayDetails(?ClearpayDetails $clearpayDetails): void + { + $this->clearpayDetails = $clearpayDetails; + } + /** * Encode this object to JSON * @@ -81,6 +106,9 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) if (isset($this->afterpayDetails)) { $json['afterpay_details'] = $this->afterpayDetails; } + if (isset($this->clearpayDetails)) { + $json['clearpay_details'] = $this->clearpayDetails; + } $json = array_filter($json, function ($val) { return $val !== null; }); diff --git a/src/Models/ClearpayDetails.php b/src/Models/ClearpayDetails.php new file mode 100644 index 00000000..71fbe2e1 --- /dev/null +++ b/src/Models/ClearpayDetails.php @@ -0,0 +1,60 @@ +emailAddress; + } + + /** + * Sets Email Address. + * Email address on the buyer's Clearpay account. + * + * @maps email_address + */ + public function setEmailAddress(?string $emailAddress): void + { + $this->emailAddress = $emailAddress; + } + + /** + * 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->emailAddress)) { + $json['email_address'] = $this->emailAddress; + } + $json = array_filter($json, function ($val) { + return $val !== null; + }); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/SquareClient.php b/src/SquareClient.php index 7bf08eb0..ac6ed6b1 100644 --- a/src/SquareClient.php +++ b/src/SquareClient.php @@ -272,7 +272,7 @@ public function getBearerAuthCredentials(): ?BearerAuthCredentials */ public function getSdkVersion(): string { - return '21.0.0.20220817'; + return '21.1.0.20220823'; } /**