From fb9c4ff2f49d40e0d1db8bf04a67b92d500c2115 Mon Sep 17 00:00:00 2001 From: autobot Date: Tue, 16 Apr 2024 22:35:38 +0000 Subject: [PATCH] Generated PR for Release: 36.0.0.20240417 --- .github/pull_request_template.md | 4 + composer.json | 2 +- doc/apis/o-auth.md | 72 ----- doc/client.md | 6 +- .../catalog-custom-attribute-definition.md | 2 +- doc/models/order-line-item-tax.md | 2 +- doc/models/order.md | 4 +- doc/models/renew-token-request.md | 21 -- doc/models/renew-token-response.md | 31 --- src/Apis/OAuthApi.php | 52 ---- src/ConfigurationDefaults.php | 2 +- .../Builders/RenewTokenRequestBuilder.php | 60 ----- .../Builders/RenewTokenResponseBuilder.php | 105 -------- .../CatalogCustomAttributeDefinition.php | 8 +- src/Models/Order.php | 16 +- src/Models/OrderLineItemTax.php | 6 - src/Models/RenewTokenRequest.php | 69 ----- src/Models/RenewTokenResponse.php | 247 ------------------ src/SquareClient.php | 4 +- 19 files changed, 27 insertions(+), 686 deletions(-) create mode 100644 .github/pull_request_template.md delete mode 100644 doc/models/renew-token-request.md delete mode 100644 doc/models/renew-token-response.md delete mode 100644 src/Models/Builders/RenewTokenRequestBuilder.php delete mode 100644 src/Models/Builders/RenewTokenResponseBuilder.php delete mode 100644 src/Models/RenewTokenRequest.php delete mode 100644 src/Models/RenewTokenResponse.php diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 00000000..77bc5759 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,4 @@ +# **ATTENTION** +This repository **cannot** accept Pull Requests. If you wish to proceed with opening this PR, please understand that your code **will not** be pulled into this repository. Consider opening an issue which lays out the problem instead. Thank you very much for your efforts and highlighting issues! + +Please direct all technical support questions, feature requests, API-related issues, and general discussions to our Square-supported developer channels. For public support, [join us in our Square Developer Discord server](https://discord.com/invite/squaredev) or [post in our Developer Forums](https://developer.squareup.com/forums). For private support, [contact our Developer Success Engineers](https://squareup.com/help/us/en/contact?panel=BF53A9C8EF68) directly. diff --git a/composer.json b/composer.json index eafe1dc0..e4cbb8b8 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": "35.1.0.20240320", + "version": "36.0.0.20240417", "type": "library", "keywords": [ "Square", diff --git a/doc/apis/o-auth.md b/doc/apis/o-auth.md index d30dbd3c..ac52d8ed 100644 --- a/doc/apis/o-auth.md +++ b/doc/apis/o-auth.md @@ -10,83 +10,11 @@ $oAuthApi = $client->getOAuthApi(); ## Methods -* [Renew Token](../../doc/apis/o-auth.md#renew-token) * [Revoke Token](../../doc/apis/o-auth.md#revoke-token) * [Obtain Token](../../doc/apis/o-auth.md#obtain-token) * [Retrieve Token Status](../../doc/apis/o-auth.md#retrieve-token-status) -# Renew Token - -**This endpoint is deprecated.** - -`RenewToken` is deprecated. For information about refreshing OAuth access tokens, see -[Migrate from Renew to Refresh OAuth Tokens](https://developer.squareup.com/docs/oauth-api/migrate-to-refresh-tokens). - -Renews an OAuth access token before it expires. - -OAuth access tokens besides your application's personal access token expire after 30 days. -You can also renew expired tokens within 15 days of their expiration. -You cannot renew an access token that has been expired for more than 15 days. -Instead, the associated user must recomplete the OAuth flow from the beginning. - -__Important:__ The `Authorization` header for this endpoint must have the -following format: - -``` -Authorization: Client APPLICATION_SECRET -``` - -Replace `APPLICATION_SECRET` with the application secret on the **Credentials** -page in the [Developer Dashboard](https://developer.squareup.com/apps). - -:information_source: **Note** This endpoint does not require authentication. - -```php -function renewToken(string $clientId, RenewTokenRequest $body, string $authorization): ApiResponse -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `clientId` | `string` | Template, Required | Your application ID, which is available on the **OAuth** page in the [Developer Dashboard](https://developer.squareup.com/apps). | -| `body` | [`RenewTokenRequest`](../../doc/models/renew-token-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `authorization` | `string` | Header, Required | Client APPLICATION_SECRET | - -## Response Type - -This method returns a `Square\Utils\ApiResponse` instance. The `getResult()` method on this instance returns the response data which is of type [`RenewTokenResponse`](../../doc/models/renew-token-response.md). - -## Example Usage - -```php -$clientId = 'client_id8'; - -$body = RenewTokenRequestBuilder::init() - ->accessToken('ACCESS_TOKEN') - ->build(); - -$authorization = 'Client CLIENT_SECRET'; - -$apiResponse = $oAuthApi->renewToken( - $clientId, - $body, - $authorization -); - -if ($apiResponse->isSuccess()) { - $renewTokenResponse = $apiResponse->getResult(); -} else { - $errors = $apiResponse->getErrors(); -} - -// Getting more response information -var_dump($apiResponse->getStatusCode()); -var_dump($apiResponse->getHeaders()); -``` - - # Revoke Token Revokes an access token generated with the OAuth flow. diff --git a/doc/client.md b/doc/client.md index 34adbc96..43d7ae56 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*: `'2024-03-20'` | +| `squareVersion` | `string` | Square Connect API versions
*Default*: `'2024-04-17'` | | `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` | @@ -30,7 +30,7 @@ $client = SquareClientBuilder::init() 'AccessToken' ) ) - ->squareVersion('2024-03-20') + ->squareVersion('2024-04-17') ->environment('production') ->customUrl('https://connect.squareup.com') ->build(); @@ -60,7 +60,7 @@ $client = SquareClientBuilder::init() 'AccessToken' ) ) - ->squareVersion('2024-03-20') + ->squareVersion('2024-04-17') ->build(); $apiResponse = $client->getLocationsApi()->listLocations(); diff --git a/doc/models/catalog-custom-attribute-definition.md b/doc/models/catalog-custom-attribute-definition.md index e84096d9..a748ce44 100644 --- a/doc/models/catalog-custom-attribute-definition.md +++ b/doc/models/catalog-custom-attribute-definition.md @@ -19,7 +19,7 @@ to store any sensitive information (personally identifiable information, card de | `name` | `string` | Required | The name of this definition for API and seller-facing UI purposes.
The name must be unique within the (merchant, application) pair. Required.
May not be empty and may not exceed 255 characters. Can be modified after creation.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `255` | getName(): string | setName(string name): void | | `description` | `?string` | Optional | Seller-oriented description of the meaning of this Custom Attribute,
any constraints that the seller should observe, etc. May be displayed as a tooltip in Square UIs.
**Constraints**: *Maximum Length*: `255` | getDescription(): ?string | setDescription(?string description): void | | `sourceApplication` | [`?SourceApplication`](../../doc/models/source-application.md) | Optional | Represents information about the application used to generate a change. | getSourceApplication(): ?SourceApplication | setSourceApplication(?SourceApplication sourceApplication): void | -| `allowedObjectTypes` | [`string(CatalogObjectType)[]`](../../doc/models/catalog-object-type.md) | Required | The set of `CatalogObject` types that this custom atttribute may be applied to.
Currently, only `ITEM`, `ITEM_VARIATION`, and `MODIFIER` are allowed. At least one type must be included.
See [CatalogObjectType](#type-catalogobjecttype) for possible values | getAllowedObjectTypes(): array | setAllowedObjectTypes(array allowedObjectTypes): void | +| `allowedObjectTypes` | [`string(CatalogObjectType)[]`](../../doc/models/catalog-object-type.md) | Required | The set of `CatalogObject` types that this custom atttribute may be applied to.
Currently, only `ITEM`, `ITEM_VARIATION`, `MODIFIER`, `MODIFIER_LIST`, and `CATEGORY` are allowed. At least one type must be included.
See [CatalogObjectType](#type-catalogobjecttype) for possible values | getAllowedObjectTypes(): array | setAllowedObjectTypes(array allowedObjectTypes): void | | `sellerVisibility` | [`?string(CatalogCustomAttributeDefinitionSellerVisibility)`](../../doc/models/catalog-custom-attribute-definition-seller-visibility.md) | Optional | Defines the visibility of a custom attribute to sellers in Square
client applications, Square APIs or in Square UIs (including Square Point
of Sale applications and Square Dashboard). | getSellerVisibility(): ?string | setSellerVisibility(?string sellerVisibility): void | | `appVisibility` | [`?string(CatalogCustomAttributeDefinitionAppVisibility)`](../../doc/models/catalog-custom-attribute-definition-app-visibility.md) | Optional | Defines the visibility of a custom attribute to applications other than their
creating application. | getAppVisibility(): ?string | setAppVisibility(?string appVisibility): void | | `stringConfig` | [`?CatalogCustomAttributeDefinitionStringConfig`](../../doc/models/catalog-custom-attribute-definition-string-config.md) | Optional | Configuration associated with Custom Attribute Definitions of type `STRING`. | getStringConfig(): ?CatalogCustomAttributeDefinitionStringConfig | setStringConfig(?CatalogCustomAttributeDefinitionStringConfig stringConfig): void | diff --git a/doc/models/order-line-item-tax.md b/doc/models/order-line-item-tax.md index d46ded8e..b446d2f4 100644 --- a/doc/models/order-line-item-tax.md +++ b/doc/models/order-line-item-tax.md @@ -20,7 +20,7 @@ contributes to the order subtotal. | `catalogVersion` | `?int` | Optional | The version of the catalog object that this tax references. | getCatalogVersion(): ?int | setCatalogVersion(?int catalogVersion): void | | `name` | `?string` | Optional | The tax's name.
**Constraints**: *Maximum Length*: `255` | getName(): ?string | setName(?string name): void | | `type` | [`?string(OrderLineItemTaxType)`](../../doc/models/order-line-item-tax-type.md) | Optional | Indicates how the tax is applied to the associated line item or order. | getType(): ?string | setType(?string type): void | -| `percentage` | `?string` | Optional | The percentage of the tax, as a string representation of a decimal
number. For example, a value of `"7.25"` corresponds to a percentage of
7.25%.

Either `percentage` or `amount_money` should be set, but not both.
**Constraints**: *Maximum Length*: `10` | getPercentage(): ?string | setPercentage(?string percentage): void | +| `percentage` | `?string` | Optional | The percentage of the tax, as a string representation of a decimal
number. For example, a value of `"7.25"` corresponds to a percentage of
7.25%.
**Constraints**: *Maximum Length*: `10` | getPercentage(): ?string | setPercentage(?string percentage): void | | `metadata` | `?array` | Optional | Application-defined data attached to this tax. Metadata fields are intended
to store descriptive references or associations with an entity in another system or store brief
information about the object. Square does not process this field; it only stores and returns it
in relevant API calls. Do not use metadata to store any sensitive information (such as personally
identifiable information or card details).

Keys written by applications must be 60 characters or less and must be in the character set
`[a-zA-Z0-9_-]`. Entries can also include metadata generated by Square. These keys are prefixed
with a namespace, separated from the key with a ':' character.

Values have a maximum length of 255 characters.

An application can have up to 10 entries per metadata field.

Entries written by applications are private and can only be read or modified by the same
application.

For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata). | getMetadata(): ?array | setMetadata(?array metadata): void | | `appliedMoney` | [`?Money`](../../doc/models/money.md) | Optional | Represents an amount of money. `Money` fields can be signed or unsigned.
Fields that do not explicitly define whether they are signed or unsigned are
considered unsigned and can only hold positive amounts. For signed fields, the
sign of the value indicates the purpose of the money transfer. See
[Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts)
for more information. | getAppliedMoney(): ?Money | setAppliedMoney(?Money appliedMoney): void | | `scope` | [`?string(OrderLineItemTaxScope)`](../../doc/models/order-line-item-tax-scope.md) | Optional | Indicates whether this is a line-item or order-level tax. | getScope(): ?string | setScope(?string scope): void | diff --git a/doc/models/order.md b/doc/models/order.md index 076fbef3..f38d9861 100644 --- a/doc/models/order.md +++ b/doc/models/order.md @@ -33,8 +33,8 @@ itemization data. | `tenders` | [`?(Tender[])`](../../doc/models/tender.md) | Optional | The tenders that were used to pay for the order. | getTenders(): ?array | setTenders(?array tenders): void | | `refunds` | [`?(Refund[])`](../../doc/models/refund.md) | Optional | The refunds that are part of this order. | getRefunds(): ?array | setRefunds(?array refunds): void | | `metadata` | `?array` | Optional | Application-defined data attached to this order. Metadata fields are intended
to store descriptive references or associations with an entity in another system or store brief
information about the object. Square does not process this field; it only stores and returns it
in relevant API calls. Do not use metadata to store any sensitive information (such as personally
identifiable information or card details).

Keys written by applications must be 60 characters or less and must be in the character set
`[a-zA-Z0-9_-]`. Entries can also include metadata generated by Square. These keys are prefixed
with a namespace, separated from the key with a ':' character.

Values have a maximum length of 255 characters.

An application can have up to 10 entries per metadata field.

Entries written by applications are private and can only be read or modified by the same
application.

For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata). | getMetadata(): ?array | setMetadata(?array metadata): void | -| `createdAt` | `?string` | Optional | The timestamp for when the order was created, in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). | getCreatedAt(): ?string | setCreatedAt(?string createdAt): void | -| `updatedAt` | `?string` | Optional | The timestamp for when the order was last updated, in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). | getUpdatedAt(): ?string | setUpdatedAt(?string updatedAt): void | +| `createdAt` | `?string` | Optional | The timestamp for when the order was created, at server side, in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). | getCreatedAt(): ?string | setCreatedAt(?string createdAt): void | +| `updatedAt` | `?string` | Optional | The timestamp for when the order was last updated, at server side, in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). | getUpdatedAt(): ?string | setUpdatedAt(?string updatedAt): void | | `closedAt` | `?string` | Optional | The timestamp for when the order reached a terminal [state](entity:OrderState), in RFC 3339 format (for example "2016-09-04T23:59:33.123Z"). | getClosedAt(): ?string | setClosedAt(?string closedAt): void | | `state` | [`?string(OrderState)`](../../doc/models/order-state.md) | Optional | The state of the order. | getState(): ?string | setState(?string state): void | | `version` | `?int` | Optional | The version number, which is incremented each time an update is committed to the order.
Orders not created through the API do not include a version number and
therefore cannot be updated.

[Read more about working with versions](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders). | getVersion(): ?int | setVersion(?int version): void | diff --git a/doc/models/renew-token-request.md b/doc/models/renew-token-request.md deleted file mode 100644 index 5434e907..00000000 --- a/doc/models/renew-token-request.md +++ /dev/null @@ -1,21 +0,0 @@ - -# Renew Token Request - -## Structure - -`RenewTokenRequest` - -## Fields - -| Name | Type | Tags | Description | Getter | Setter | -| --- | --- | --- | --- | --- | --- | -| `accessToken` | `?string` | Optional | The token you want to renew.
**Constraints**: *Minimum Length*: `2`, *Maximum Length*: `1024` | getAccessToken(): ?string | setAccessToken(?string accessToken): void | - -## Example (as JSON) - -```json -{ - "access_token": "ACCESS_TOKEN" -} -``` - diff --git a/doc/models/renew-token-response.md b/doc/models/renew-token-response.md deleted file mode 100644 index 5d004dfd..00000000 --- a/doc/models/renew-token-response.md +++ /dev/null @@ -1,31 +0,0 @@ - -# Renew Token Response - -## Structure - -`RenewTokenResponse` - -## Fields - -| Name | Type | Tags | Description | Getter | Setter | -| --- | --- | --- | --- | --- | --- | -| `accessToken` | `?string` | Optional | The renewed access token.
This value might be different from the `access_token` you provided in your request.
You provide this token in a header with every request to Connect API endpoints.
See [Request and response headers](https://developer.squareup.com/docs/api/connect/v2/#requestandresponseheaders) for the format of this header.
**Constraints**: *Minimum Length*: `2`, *Maximum Length*: `1024` | getAccessToken(): ?string | setAccessToken(?string accessToken): void | -| `tokenType` | `?string` | Optional | This value is always _bearer_.
**Constraints**: *Minimum Length*: `2`, *Maximum Length*: `10` | getTokenType(): ?string | setTokenType(?string tokenType): void | -| `expiresAt` | `?string` | Optional | The date when the `access_token` expires, in [ISO 8601](http://www.iso.org/iso/home/standards/iso8601.htm) format.
**Constraints**: *Minimum Length*: `20`, *Maximum Length*: `48` | getExpiresAt(): ?string | setExpiresAt(?string expiresAt): void | -| `merchantId` | `?string` | Optional | The ID of the authorizing merchant's business.
**Constraints**: *Minimum Length*: `8`, *Maximum Length*: `191` | getMerchantId(): ?string | setMerchantId(?string merchantId): void | -| `subscriptionId` | `?string` | Optional | __LEGACY FIELD__. The ID of the merchant subscription associated with
the authorization. The ID is only present if the merchant signed up for a subscription
during authorization. | getSubscriptionId(): ?string | setSubscriptionId(?string subscriptionId): void | -| `planId` | `?string` | Optional | __LEGACY FIELD__. The ID of the subscription plan the merchant signed
up for. The ID is only present if the merchant signed up for a subscription plan during
authorization. | getPlanId(): ?string | setPlanId(?string planId): void | -| `errors` | [`?(Error[])`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | getErrors(): ?array | setErrors(?array errors): void | - -## Example (as JSON) - -```json -{ - "access_token": "ACCESS_TOKEN", - "expires_at": "2006-01-02T15:04:05Z", - "merchant_id": "MERCHANT_ID", - "token_type": "bearer", - "subscription_id": "subscription_id8" -} -``` - diff --git a/src/Apis/OAuthApi.php b/src/Apis/OAuthApi.php index 457a207f..b691c6db 100644 --- a/src/Apis/OAuthApi.php +++ b/src/Apis/OAuthApi.php @@ -6,68 +6,16 @@ use Core\Request\Parameters\BodyParam; use Core\Request\Parameters\HeaderParam; -use Core\Request\Parameters\TemplateParam; use CoreInterfaces\Core\Request\RequestMethod; use Square\Http\ApiResponse; use Square\Models\ObtainTokenRequest; use Square\Models\ObtainTokenResponse; -use Square\Models\RenewTokenRequest; -use Square\Models\RenewTokenResponse; use Square\Models\RetrieveTokenStatusResponse; use Square\Models\RevokeTokenRequest; use Square\Models\RevokeTokenResponse; class OAuthApi extends BaseApi { - /** - * `RenewToken` is deprecated. For information about refreshing OAuth access tokens, see - * [Migrate from Renew to Refresh OAuth Tokens](https://developer.squareup.com/docs/oauth-api/migrate- - * to-refresh-tokens). - * - * Renews an OAuth access token before it expires. - * - * OAuth access tokens besides your application's personal access token expire after 30 days. - * You can also renew expired tokens within 15 days of their expiration. - * You cannot renew an access token that has been expired for more than 15 days. - * Instead, the associated user must recomplete the OAuth flow from the beginning. - * - * __Important:__ The `Authorization` header for this endpoint must have the - * following format: - * - * ``` - * Authorization: Client APPLICATION_SECRET - * ``` - * - * Replace `APPLICATION_SECRET` with the application secret on the **Credentials** - * page in the [Developer Dashboard](https://developer.squareup.com/apps). - * - * @deprecated - * - * @param string $clientId Your application ID, which is available on the **OAuth** page in the - * [Developer Dashboard](https://developer.squareup.com/apps). - * @param RenewTokenRequest $body An object containing the fields to POST for the request. See - * the corresponding object definition for field details. - * @param string $authorization Client APPLICATION_SECRET - * - * @return ApiResponse Response from the API call - */ - public function renewToken(string $clientId, RenewTokenRequest $body, string $authorization): ApiResponse - { - trigger_error('Method ' . __METHOD__ . ' is deprecated.', E_USER_DEPRECATED); - - $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/oauth2/clients/{client_id}/access-token/renew') - ->parameters( - TemplateParam::init('client_id', $clientId), - HeaderParam::init('Content-Type', 'application/json'), - BodyParam::init($body), - HeaderParam::init('Authorization', $authorization) - ); - - $_resHandler = $this->responseHandler()->type(RenewTokenResponse::class)->returnApiResponse(); - - return $this->execute($_reqBuilder, $_resHandler); - } - /** * Revokes an access token generated with the OAuth flow. * diff --git a/src/ConfigurationDefaults.php b/src/ConfigurationDefaults.php index 27d107ae..109f124f 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 = '2024-03-20'; + public const SQUARE_VERSION = '2024-04-17'; public const ADDITIONAL_HEADERS = []; diff --git a/src/Models/Builders/RenewTokenRequestBuilder.php b/src/Models/Builders/RenewTokenRequestBuilder.php deleted file mode 100644 index e939376c..00000000 --- a/src/Models/Builders/RenewTokenRequestBuilder.php +++ /dev/null @@ -1,60 +0,0 @@ -instance = $instance; - } - - /** - * Initializes a new renew token request Builder object. - */ - public static function init(): self - { - return new self(new RenewTokenRequest()); - } - - /** - * Sets access token field. - */ - public function accessToken(?string $value): self - { - $this->instance->setAccessToken($value); - return $this; - } - - /** - * Unsets access token field. - */ - public function unsetAccessToken(): self - { - $this->instance->unsetAccessToken(); - return $this; - } - - /** - * Initializes a new renew token request object. - */ - public function build(): RenewTokenRequest - { - return CoreHelper::clone($this->instance); - } -} diff --git a/src/Models/Builders/RenewTokenResponseBuilder.php b/src/Models/Builders/RenewTokenResponseBuilder.php deleted file mode 100644 index d668f4a7..00000000 --- a/src/Models/Builders/RenewTokenResponseBuilder.php +++ /dev/null @@ -1,105 +0,0 @@ -instance = $instance; - } - - /** - * Initializes a new renew token response Builder object. - */ - public static function init(): self - { - return new self(new RenewTokenResponse()); - } - - /** - * Sets access token field. - */ - public function accessToken(?string $value): self - { - $this->instance->setAccessToken($value); - return $this; - } - - /** - * Sets token type field. - */ - public function tokenType(?string $value): self - { - $this->instance->setTokenType($value); - return $this; - } - - /** - * Sets expires at field. - */ - public function expiresAt(?string $value): self - { - $this->instance->setExpiresAt($value); - return $this; - } - - /** - * Sets merchant id field. - */ - public function merchantId(?string $value): self - { - $this->instance->setMerchantId($value); - return $this; - } - - /** - * Sets subscription id field. - */ - public function subscriptionId(?string $value): self - { - $this->instance->setSubscriptionId($value); - return $this; - } - - /** - * Sets plan id field. - */ - public function planId(?string $value): self - { - $this->instance->setPlanId($value); - return $this; - } - - /** - * Sets errors field. - */ - public function errors(?array $value): self - { - $this->instance->setErrors($value); - return $this; - } - - /** - * Initializes a new renew token response object. - */ - public function build(): RenewTokenResponse - { - return CoreHelper::clone($this->instance); - } -} diff --git a/src/Models/CatalogCustomAttributeDefinition.php b/src/Models/CatalogCustomAttributeDefinition.php index 19544d8d..20504200 100644 --- a/src/Models/CatalogCustomAttributeDefinition.php +++ b/src/Models/CatalogCustomAttributeDefinition.php @@ -192,8 +192,8 @@ public function setSourceApplication(?SourceApplication $sourceApplication): voi /** * Returns Allowed Object Types. * The set of `CatalogObject` types that this custom atttribute may be applied to. - * Currently, only `ITEM`, `ITEM_VARIATION`, and `MODIFIER` are allowed. At least one type must be - * included. + * Currently, only `ITEM`, `ITEM_VARIATION`, `MODIFIER`, `MODIFIER_LIST`, and `CATEGORY` are allowed. + * At least one type must be included. * See [CatalogObjectType](#type-catalogobjecttype) for possible values * * @return string[] @@ -206,8 +206,8 @@ public function getAllowedObjectTypes(): array /** * Sets Allowed Object Types. * The set of `CatalogObject` types that this custom atttribute may be applied to. - * Currently, only `ITEM`, `ITEM_VARIATION`, and `MODIFIER` are allowed. At least one type must be - * included. + * Currently, only `ITEM`, `ITEM_VARIATION`, `MODIFIER`, `MODIFIER_LIST`, and `CATEGORY` are allowed. + * At least one type must be included. * See [CatalogObjectType](#type-catalogobjecttype) for possible values * * @required diff --git a/src/Models/Order.php b/src/Models/Order.php index da49e9b5..d0797e16 100644 --- a/src/Models/Order.php +++ b/src/Models/Order.php @@ -794,8 +794,8 @@ public function unsetMetadata(): void /** * Returns Created At. - * The timestamp for when the order was created, in RFC 3339 format (for example, "2016-09-04T23:59:33. - * 123Z"). + * The timestamp for when the order was created, at server side, in RFC 3339 format (for example, "2016- + * 09-04T23:59:33.123Z"). */ public function getCreatedAt(): ?string { @@ -804,8 +804,8 @@ public function getCreatedAt(): ?string /** * Sets Created At. - * The timestamp for when the order was created, in RFC 3339 format (for example, "2016-09-04T23:59:33. - * 123Z"). + * The timestamp for when the order was created, at server side, in RFC 3339 format (for example, "2016- + * 09-04T23:59:33.123Z"). * * @maps created_at */ @@ -816,8 +816,8 @@ public function setCreatedAt(?string $createdAt): void /** * Returns Updated At. - * The timestamp for when the order was last updated, in RFC 3339 format (for example, "2016-09-04T23: - * 59:33.123Z"). + * The timestamp for when the order was last updated, at server side, in RFC 3339 format (for example, + * "2016-09-04T23:59:33.123Z"). */ public function getUpdatedAt(): ?string { @@ -826,8 +826,8 @@ public function getUpdatedAt(): ?string /** * Sets Updated At. - * The timestamp for when the order was last updated, in RFC 3339 format (for example, "2016-09-04T23: - * 59:33.123Z"). + * The timestamp for when the order was last updated, at server side, in RFC 3339 format (for example, + * "2016-09-04T23:59:33.123Z"). * * @maps updated_at */ diff --git a/src/Models/OrderLineItemTax.php b/src/Models/OrderLineItemTax.php index 2ecacb9e..d6512389 100644 --- a/src/Models/OrderLineItemTax.php +++ b/src/Models/OrderLineItemTax.php @@ -218,8 +218,6 @@ public function setType(?string $type): void * The percentage of the tax, as a string representation of a decimal * number. For example, a value of `"7.25"` corresponds to a percentage of * 7.25%. - * - * Either `percentage` or `amount_money` should be set, but not both. */ public function getPercentage(): ?string { @@ -235,8 +233,6 @@ public function getPercentage(): ?string * number. For example, a value of `"7.25"` corresponds to a percentage of * 7.25%. * - * Either `percentage` or `amount_money` should be set, but not both. - * * @maps percentage */ public function setPercentage(?string $percentage): void @@ -249,8 +245,6 @@ public function setPercentage(?string $percentage): void * The percentage of the tax, as a string representation of a decimal * number. For example, a value of `"7.25"` corresponds to a percentage of * 7.25%. - * - * Either `percentage` or `amount_money` should be set, but not both. */ public function unsetPercentage(): void { diff --git a/src/Models/RenewTokenRequest.php b/src/Models/RenewTokenRequest.php deleted file mode 100644 index 19b353df..00000000 --- a/src/Models/RenewTokenRequest.php +++ /dev/null @@ -1,69 +0,0 @@ -accessToken) == 0) { - return null; - } - return $this->accessToken['value']; - } - - /** - * Sets Access Token. - * The token you want to renew. - * - * @maps access_token - */ - public function setAccessToken(?string $accessToken): void - { - $this->accessToken['value'] = $accessToken; - } - - /** - * Unsets Access Token. - * The token you want to renew. - */ - public function unsetAccessToken(): void - { - $this->accessToken = []; - } - - /** - * 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->accessToken)) { - $json['access_token'] = $this->accessToken['value']; - } - $json = array_filter($json, function ($val) { - return $val !== null; - }); - - return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; - } -} diff --git a/src/Models/RenewTokenResponse.php b/src/Models/RenewTokenResponse.php deleted file mode 100644 index c32e0b38..00000000 --- a/src/Models/RenewTokenResponse.php +++ /dev/null @@ -1,247 +0,0 @@ -accessToken; - } - - /** - * Sets Access Token. - * The renewed access token. - * This value might be different from the `access_token` you provided in your request. - * You provide this token in a header with every request to Connect API endpoints. - * See [Request and response headers](https://developer.squareup. - * com/docs/api/connect/v2/#requestandresponseheaders) for the format of this header. - * - * @maps access_token - */ - public function setAccessToken(?string $accessToken): void - { - $this->accessToken = $accessToken; - } - - /** - * Returns Token Type. - * This value is always _bearer_. - */ - public function getTokenType(): ?string - { - return $this->tokenType; - } - - /** - * Sets Token Type. - * This value is always _bearer_. - * - * @maps token_type - */ - public function setTokenType(?string $tokenType): void - { - $this->tokenType = $tokenType; - } - - /** - * Returns Expires At. - * The date when the `access_token` expires, in [ISO 8601](http://www.iso. - * org/iso/home/standards/iso8601.htm) format. - */ - public function getExpiresAt(): ?string - { - return $this->expiresAt; - } - - /** - * Sets Expires At. - * The date when the `access_token` expires, in [ISO 8601](http://www.iso. - * org/iso/home/standards/iso8601.htm) format. - * - * @maps expires_at - */ - public function setExpiresAt(?string $expiresAt): void - { - $this->expiresAt = $expiresAt; - } - - /** - * Returns Merchant Id. - * The ID of the authorizing merchant's business. - */ - public function getMerchantId(): ?string - { - return $this->merchantId; - } - - /** - * Sets Merchant Id. - * The ID of the authorizing merchant's business. - * - * @maps merchant_id - */ - public function setMerchantId(?string $merchantId): void - { - $this->merchantId = $merchantId; - } - - /** - * Returns Subscription Id. - * __LEGACY FIELD__. The ID of the merchant subscription associated with - * the authorization. The ID is only present if the merchant signed up for a subscription - * during authorization. - */ - public function getSubscriptionId(): ?string - { - return $this->subscriptionId; - } - - /** - * Sets Subscription Id. - * __LEGACY FIELD__. The ID of the merchant subscription associated with - * the authorization. The ID is only present if the merchant signed up for a subscription - * during authorization. - * - * @maps subscription_id - */ - public function setSubscriptionId(?string $subscriptionId): void - { - $this->subscriptionId = $subscriptionId; - } - - /** - * Returns Plan Id. - * __LEGACY FIELD__. The ID of the subscription plan the merchant signed - * up for. The ID is only present if the merchant signed up for a subscription plan during - * authorization. - */ - public function getPlanId(): ?string - { - return $this->planId; - } - - /** - * Sets Plan Id. - * __LEGACY FIELD__. The ID of the subscription plan the merchant signed - * up for. The ID is only present if the merchant signed up for a subscription plan during - * authorization. - * - * @maps plan_id - */ - public function setPlanId(?string $planId): void - { - $this->planId = $planId; - } - - /** - * Returns Errors. - * Any errors that occurred during the request. - * - * @return Error[]|null - */ - public function getErrors(): ?array - { - return $this->errors; - } - - /** - * Sets Errors. - * Any errors that occurred during the request. - * - * @maps errors - * - * @param Error[]|null $errors - */ - public function setErrors(?array $errors): void - { - $this->errors = $errors; - } - - /** - * 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->accessToken)) { - $json['access_token'] = $this->accessToken; - } - if (isset($this->tokenType)) { - $json['token_type'] = $this->tokenType; - } - if (isset($this->expiresAt)) { - $json['expires_at'] = $this->expiresAt; - } - if (isset($this->merchantId)) { - $json['merchant_id'] = $this->merchantId; - } - if (isset($this->subscriptionId)) { - $json['subscription_id'] = $this->subscriptionId; - } - if (isset($this->planId)) { - $json['plan_id'] = $this->planId; - } - if (isset($this->errors)) { - $json['errors'] = $this->errors; - } - $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 4a978ecd..5c0ac289 100644 --- a/src/SquareClient.php +++ b/src/SquareClient.php @@ -164,7 +164,7 @@ public function __construct(array $config = []) ->jsonHelper(ApiHelper::getJsonHelper()) ->apiCallback($this->config['httpCallback'] ?? null) ->userAgent( - 'Square-PHP-SDK/35.1.0.20240320 ({api-version}) {engine}/{engine-version} ({os-' . + 'Square-PHP-SDK/36.0.0.20240417 ({api-version}) {engine}/{engine-version} ({os-' . 'info}) {detail}' ) ->userAgentConfig( @@ -319,7 +319,7 @@ public function withConfiguration(array $config): self */ public function getSdkVersion(): string { - return '35.1.0.20240320'; + return '36.0.0.20240417'; } /**