diff --git a/README.md b/README.md index f8bd2617..d79ab617 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,15 @@ Use this library to integrate Square payments into your app and grow your business with Square APIs including Catalog, Customers, Employees, Inventory, Labor, Locations, and Orders. +* [Requirements](#requirements) +* [Installation](#installation) +* [Quickstart](#quickstart) +* [Usage](#usage) +* [Tests](#tests) +* [SDK Reference](#sdk-reference) +* [Deprecated APIs](#deprecated-apis) + + ## Requirements Use of the Square PHP SDK requires: @@ -123,16 +132,18 @@ All environment variables: * [Sites] * [Snippets] -### Authorization APIs +### Authorization * [Mobile Authorization] * [OAuth] -### Deprecated APIs -* [Employees] -* [V1 Employees] -* [V1 Transactions] -* [V1 Items] -* [Transactions] +## Deprecated APIs + +The following Square APIs are [deprecated](https://developer.squareup.com/docs/build-basics/api-lifecycle): + +* [Employees] - replaced by the [Team] API. For more information, see [Migrate from the Employees API](https://developer.squareup.com/docs/team/migrate-from-v2-employees). + +* [Transactions] - replaced by the [Orders] and [Payments] APIs. For more information, see [Migrate from the Transactions API](https://developer.squareup.com/docs/payments-api/migrate-from-transactions-api). + [//]: # "Link anchor definitions" [Square Logo]: https://docs.connect.squareup.com/images/github/github-square-logo.svg @@ -153,7 +164,6 @@ All environment variables: [Checkout]: doc/apis/checkout.md [Catalog]: doc/apis/catalog.md [Customers]: doc/apis/customers.md -[Employees]: doc/apis/employees.md [Inventory]: doc/apis/inventory.md [Labor]: doc/apis/labor.md [Loyalty]: doc/apis/loyalty.md @@ -167,14 +177,12 @@ All environment variables: [Subscriptions]: doc/apis/subscriptions.md [Mobile Authorization]: doc/apis/mobile-authorization.md [OAuth]: doc/apis/o-auth.md -[V1 Employees]: doc/apis/v1-employees.md -[V1 Transactions]: doc/apis/v1-transactions.md -[V1 Items]: doc/apis/v1-items.md [Team]: doc/apis/team.md -[Transactions]: doc/apis/transactions.md [Sites]: doc/apis/sites.md [Snippets]: doc/apis/snippets.md [Cards]: doc/api/cards.md [Payouts]: doc/api/payouts.md [Gift Cards]: doc/api/gift-cards.md [Gift Card Activities]: doc/api/gift-card-activities.md +[Employees]: doc/apis/employees.md +[Transactions]: doc/apis/transactions.md diff --git a/composer.json b/composer.json index f82ab56c..c7194d62 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.1.0.20220823", + "version": "22.0.0.20220921", "type": "library", "keywords": [ "Square", diff --git a/doc/apis/apple-pay.md b/doc/apis/apple-pay.md index 445726da..39ab5d9c 100644 --- a/doc/apis/apple-pay.md +++ b/doc/apis/apple-pay.md @@ -18,8 +18,10 @@ an Apple Pay enabled domain. This endpoint provides an easy way for platform developers to bulk activate Apple Pay on the Web with Square for merchants using their platform. -To learn more about Web Apple Pay, see -[Add the Apple Pay on the Web Button](https://developer.squareup.com/docs/payment-form/add-digital-wallets/apple-pay). +Note: The SqPaymentForm library is deprecated as of May 13, 2021, and will only receive critical security updates until it is retired on October 31, 2022. +You must migrate your payment form code to the Web Payments SDK to continue using your domain for Apple Pay. For more information on migrating to the Web Payments SDK, see [Migrate to the Web Payments SDK](https://developer.squareup.com/docs/web-payments/migrate). + +To learn more about the Web Payments SDK and how to add Apple Pay, see [Take an Apple Pay Payment](https://developer.squareup.com/docs/web-payments/apple-pay). ```php function registerDomain(RegisterDomainRequest $body): ApiResponse diff --git a/doc/apis/invoices.md b/doc/apis/invoices.md index c80a1c61..9dba43cf 100644 --- a/doc/apis/invoices.md +++ b/doc/apis/invoices.md @@ -130,6 +130,7 @@ $body_invoice_customFields[1]->setPlacement(Models\InvoiceCustomFieldPlacement:: $body_invoice->setCustomFields($body_invoice_customFields); $body_invoice->setSaleOrServiceDate('2030-01-24'); +$body_invoice->setStorePaymentMethodEnabled(false); $body = new Models\CreateInvoiceRequest( $body_invoice ); diff --git a/doc/apis/loyalty.md b/doc/apis/loyalty.md index c6f0d595..719dc0c7 100644 --- a/doc/apis/loyalty.md +++ b/doc/apis/loyalty.md @@ -177,7 +177,8 @@ Adds points earned from a purchase to a [loyalty account](../../doc/models/loyal - If you are not using the Orders API to manage orders, provide `points` with the number of points to add. You must first perform a client-side computation of the points earned from the loyalty program and loyalty promotion. For spend-based and visit-based programs, you can call [CalculateLoyaltyPoints](../../doc/apis/loyalty.md#calculate-loyalty-points) - to compute the points earned from the loyalty program (but not points earned from a loyalty promotion). + to compute the points earned from the base loyalty program. For information about computing points earned from a loyalty promotion, see + [Calculating promotion points](https://developer.squareup.com/docs/loyalty-api/loyalty-promotions#calculate-promotion-points). ```php function accumulateLoyaltyPoints(string $accountId, AccumulateLoyaltyPointsRequest $body): ApiResponse diff --git a/doc/apis/v1-transactions.md b/doc/apis/v1-transactions.md index 49fccdd8..af91b3db 100644 --- a/doc/apis/v1-transactions.md +++ b/doc/apis/v1-transactions.md @@ -10,25 +10,25 @@ $v1TransactionsApi = $client->getV1TransactionsApi(); ## Methods -* [List Orders](../../doc/apis/v1-transactions.md#list-orders) -* [Retrieve Order](../../doc/apis/v1-transactions.md#retrieve-order) -* [Update Order](../../doc/apis/v1-transactions.md#update-order) -* [List Payments](../../doc/apis/v1-transactions.md#list-payments) -* [Retrieve Payment](../../doc/apis/v1-transactions.md#retrieve-payment) -* [List Refunds](../../doc/apis/v1-transactions.md#list-refunds) -* [Create Refund](../../doc/apis/v1-transactions.md#create-refund) -* [List Settlements](../../doc/apis/v1-transactions.md#list-settlements) -* [Retrieve Settlement](../../doc/apis/v1-transactions.md#retrieve-settlement) +* [V1 List Orders](../../doc/apis/v1-transactions.md#v1-list-orders) +* [V1 Retrieve Order](../../doc/apis/v1-transactions.md#v1-retrieve-order) +* [V1 Update Order](../../doc/apis/v1-transactions.md#v1-update-order) +* [V1 List Payments](../../doc/apis/v1-transactions.md#v1-list-payments) +* [V1 Retrieve Payment](../../doc/apis/v1-transactions.md#v1-retrieve-payment) +* [V1 List Refunds](../../doc/apis/v1-transactions.md#v1-list-refunds) +* [V1 Create Refund](../../doc/apis/v1-transactions.md#v1-create-refund) +* [V1 List Settlements](../../doc/apis/v1-transactions.md#v1-list-settlements) +* [V1 Retrieve Settlement](../../doc/apis/v1-transactions.md#v1-retrieve-settlement) -# List Orders +# V1 List Orders **This endpoint is deprecated.** Provides summary information for a merchant's online store orders. ```php -function listOrders( +function v1ListOrders( string $locationId, ?string $order = null, ?int $limit = null, @@ -54,7 +54,7 @@ function listOrders( ```php $locationId = 'location_id4'; -$apiResponse = $v1TransactionsApi->listOrders($locationId); +$apiResponse = $v1TransactionsApi->v1ListOrders($locationId); if ($apiResponse->isSuccess()) { $v1Order = $apiResponse->getResult(); @@ -68,14 +68,14 @@ if ($apiResponse->isSuccess()) { ``` -# Retrieve Order +# V1 Retrieve Order **This endpoint is deprecated.** Provides comprehensive information for a single online store order, including the order's history. ```php -function retrieveOrder(string $locationId, string $orderId): ApiResponse +function v1RetrieveOrder(string $locationId, string $orderId): ApiResponse ``` ## Parameters @@ -95,7 +95,7 @@ function retrieveOrder(string $locationId, string $orderId): ApiResponse $locationId = 'location_id4'; $orderId = 'order_id6'; -$apiResponse = $v1TransactionsApi->retrieveOrder($locationId, $orderId); +$apiResponse = $v1TransactionsApi->v1RetrieveOrder($locationId, $orderId); if ($apiResponse->isSuccess()) { $v1Order = $apiResponse->getResult(); @@ -109,14 +109,14 @@ if ($apiResponse->isSuccess()) { ``` -# Update Order +# V1 Update Order **This endpoint is deprecated.** Updates the details of an online store order. Every update you perform on an order corresponds to one of three actions: ```php -function updateOrder(string $locationId, string $orderId, V1UpdateOrderRequest $body): ApiResponse +function v1UpdateOrder(string $locationId, string $orderId, V1UpdateOrderRequest $body): ApiResponse ``` ## Parameters @@ -141,7 +141,7 @@ $body = new Models\V1UpdateOrderRequest( $body_action ); -$apiResponse = $v1TransactionsApi->updateOrder($locationId, $orderId, $body); +$apiResponse = $v1TransactionsApi->v1UpdateOrder($locationId, $orderId, $body); if ($apiResponse->isSuccess()) { $v1Order = $apiResponse->getResult(); @@ -155,7 +155,7 @@ if ($apiResponse->isSuccess()) { ``` -# List Payments +# V1 List Payments **This endpoint is deprecated.** @@ -172,7 +172,7 @@ list an offline payment chronologically between online payments that were seen in a previous request. ```php -function listPayments( +function v1ListPayments( string $locationId, ?string $order = null, ?string $beginTime = null, @@ -205,7 +205,7 @@ function listPayments( $locationId = 'location_id4'; $includePartial = false; -$apiResponse = $v1TransactionsApi->listPayments($locationId, null, null, null, null, null, $includePartial); +$apiResponse = $v1TransactionsApi->v1ListPayments($locationId, null, null, null, null, null, $includePartial); if ($apiResponse->isSuccess()) { $v1Payment = $apiResponse->getResult(); @@ -219,14 +219,14 @@ if ($apiResponse->isSuccess()) { ``` -# Retrieve Payment +# V1 Retrieve Payment **This endpoint is deprecated.** Provides comprehensive information for a single payment. ```php -function retrievePayment(string $locationId, string $paymentId): ApiResponse +function v1RetrievePayment(string $locationId, string $paymentId): ApiResponse ``` ## Parameters @@ -246,7 +246,7 @@ function retrievePayment(string $locationId, string $paymentId): ApiResponse $locationId = 'location_id4'; $paymentId = 'payment_id0'; -$apiResponse = $v1TransactionsApi->retrievePayment($locationId, $paymentId); +$apiResponse = $v1TransactionsApi->v1RetrievePayment($locationId, $paymentId); if ($apiResponse->isSuccess()) { $v1Payment = $apiResponse->getResult(); @@ -260,14 +260,14 @@ if ($apiResponse->isSuccess()) { ``` -# List Refunds +# V1 List Refunds **This endpoint is deprecated.** Provides the details for all refunds initiated by a merchant or any of the merchant's mobile staff during a date range. Date ranges cannot exceed one year in length. ```php -function listRefunds( +function v1ListRefunds( string $locationId, ?string $order = null, ?string $beginTime = null, @@ -297,7 +297,7 @@ function listRefunds( ```php $locationId = 'location_id4'; -$apiResponse = $v1TransactionsApi->listRefunds($locationId); +$apiResponse = $v1TransactionsApi->v1ListRefunds($locationId); if ($apiResponse->isSuccess()) { $v1Refund = $apiResponse->getResult(); @@ -311,7 +311,7 @@ if ($apiResponse->isSuccess()) { ``` -# Create Refund +# V1 Create Refund **This endpoint is deprecated.** @@ -329,7 +329,7 @@ purposes, you can create fake cash payments in Square Point of Sale and refund them. ```php -function createRefund(string $locationId, V1CreateRefundRequest $body): ApiResponse +function v1CreateRefund(string $locationId, V1CreateRefundRequest $body): ApiResponse ``` ## Parameters @@ -356,7 +356,7 @@ $body = new Models\V1CreateRefundRequest( $body_reason ); -$apiResponse = $v1TransactionsApi->createRefund($locationId, $body); +$apiResponse = $v1TransactionsApi->v1CreateRefund($locationId, $body); if ($apiResponse->isSuccess()) { $v1Refund = $apiResponse->getResult(); @@ -370,7 +370,7 @@ if ($apiResponse->isSuccess()) { ``` -# List Settlements +# V1 List Settlements **This endpoint is deprecated.** @@ -382,7 +382,7 @@ ranges cannot exceed one year in length. information. ```php -function listSettlements( +function v1ListSettlements( string $locationId, ?string $order = null, ?string $beginTime = null, @@ -414,7 +414,7 @@ function listSettlements( ```php $locationId = 'location_id4'; -$apiResponse = $v1TransactionsApi->listSettlements($locationId); +$apiResponse = $v1TransactionsApi->v1ListSettlements($locationId); if ($apiResponse->isSuccess()) { $v1Settlement = $apiResponse->getResult(); @@ -428,7 +428,7 @@ if ($apiResponse->isSuccess()) { ``` -# Retrieve Settlement +# V1 Retrieve Settlement **This endpoint is deprecated.** @@ -451,7 +451,7 @@ a bank account within 3 business days, but in exceptional cases it may take longer. ```php -function retrieveSettlement(string $locationId, string $settlementId): ApiResponse +function v1RetrieveSettlement(string $locationId, string $settlementId): ApiResponse ``` ## Parameters @@ -471,7 +471,7 @@ function retrieveSettlement(string $locationId, string $settlementId): ApiRespon $locationId = 'location_id4'; $settlementId = 'settlement_id0'; -$apiResponse = $v1TransactionsApi->retrieveSettlement($locationId, $settlementId); +$apiResponse = $v1TransactionsApi->v1RetrieveSettlement($locationId, $settlementId); if ($apiResponse->isSuccess()) { $v1Settlement = $apiResponse->getResult(); diff --git a/doc/apis/webhook-subscriptions.md b/doc/apis/webhook-subscriptions.md index 12e9b604..0596a6e2 100644 --- a/doc/apis/webhook-subscriptions.md +++ b/doc/apis/webhook-subscriptions.md @@ -75,7 +75,7 @@ function listWebhookSubscriptions( | `cursor` | `?string` | Query, Optional | A pagination cursor returned by a previous call to this endpoint.
Provide this to retrieve the next set of results for your original query.

For more information, see [Pagination](https://developer.squareup.com/docs/basics/api101/pagination). | | `includeDisabled` | `?bool` | Query, Optional | Includes disabled [Subscription](../../doc/models/webhook-subscription.md)s.
By default, all enabled [Subscription](../../doc/models/webhook-subscription.md)s are returned.
**Default**: `false` | | `sortOrder` | [`?string (SortOrder)`](../../doc/models/sort-order.md) | Query, Optional | Sorts the returned list by when the [Subscription](../../doc/models/webhook-subscription.md) was created with the specified order.
This field defaults to ASC. | -| `limit` | `?int` | Query, Optional | The maximum number of results to be returned in a single page.
It is possible to receive fewer results than the specified limit on a given page.
The default value of 100 is also the maximum allowed value. If the provided value is greater
than 100, it is ignored and the default value is used instead.

Default: 100 | +| `limit` | `?int` | Query, Optional | The maximum number of results to be returned in a single page.
It is possible to receive fewer results than the specified limit on a given page.
The default value of 100 is also the maximum allowed value.

Default: 100 | ## Response Type diff --git a/doc/client.md b/doc/client.md index 2f92e0a7..3f2534b0 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-23'` | +| `squareVersion` | `string` | Square Connect API versions
*Default*: `'2022-09-21'` | | `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-23', + 'squareVersion' => '2022-09-21', // Set the environment 'environment' => 'production', @@ -54,7 +54,7 @@ require_once "vendor/autoload.php"; $client = new Square\SquareClient([ 'accessToken' => 'AccessToken', - 'squareVersion' => '2022-08-23', + 'squareVersion' => '2022-09-21', ]); $locationsApi = $client->getLocationsApi(); diff --git a/doc/models/accumulate-loyalty-points-response.md b/doc/models/accumulate-loyalty-points-response.md index e7652240..834de7ea 100644 --- a/doc/models/accumulate-loyalty-points-response.md +++ b/doc/models/accumulate-loyalty-points-response.md @@ -13,7 +13,7 @@ Represents an [AccumulateLoyaltyPoints](../../doc/apis/loyalty.md#accumulate-loy | --- | --- | --- | --- | --- | --- | | `errors` | [`?(Error[])`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | getErrors(): ?array | setErrors(?array errors): void | | `event` | [`?LoyaltyEvent`](../../doc/models/loyalty-event.md) | Optional | Provides information about a loyalty event.
For more information, see [Search for Balance-Changing Loyalty Events](https://developer.squareup.com/docs/loyalty-api/loyalty-events). | getEvent(): ?LoyaltyEvent | setEvent(?LoyaltyEvent event): void | -| `events` | [`?(LoyaltyEvent[])`](../../doc/models/loyalty-event.md) | Optional | The resulting loyalty events. The `ACCUMULATE_POINTS` event is always included.
When using the Orders API, the `ACCUMULATE_PROMOTION_POINTS` event is included
if the purchase also qualifies for a loyalty promotion. | getEvents(): ?array | setEvents(?array events): void | +| `events` | [`?(LoyaltyEvent[])`](../../doc/models/loyalty-event.md) | Optional | The resulting loyalty events. If the purchase qualifies for points, the `ACCUMULATE_POINTS` event
is always included. When using the Orders API, the `ACCUMULATE_PROMOTION_POINTS` event is included
if the purchase also qualifies for a loyalty promotion. | getEvents(): ?array | setEvents(?array events): void | ## Example (as JSON) diff --git a/doc/models/cancel-invoice-response.md b/doc/models/cancel-invoice-response.md index 4199a885..8df3b68c 100644 --- a/doc/models/cancel-invoice-response.md +++ b/doc/models/cancel-invoice-response.md @@ -79,6 +79,7 @@ The response returned by the `CancelInvoice` request. "sale_or_service_date": "2030-01-24", "scheduled_at": "2030-01-13T10:00:00Z", "status": "CANCELED", + "store_payment_method_enabled": false, "timezone": "America/Los_Angeles", "title": "Event Planning Services", "updated_at": "2020-06-18T18:23:11Z", diff --git a/doc/models/create-invoice-request.md b/doc/models/create-invoice-request.md index 47bbeaac..8c1b96a3 100644 --- a/doc/models/create-invoice-request.md +++ b/doc/models/create-invoice-request.md @@ -61,6 +61,7 @@ Describes a `CreateInvoice` request. }, "sale_or_service_date": "2030-01-24", "scheduled_at": "2030-01-13T10:00:00Z", + "store_payment_method_enabled": false, "title": "Event Planning Services" } } diff --git a/doc/models/create-invoice-response.md b/doc/models/create-invoice-response.md index ab19ebd5..8fbc30a3 100644 --- a/doc/models/create-invoice-response.md +++ b/doc/models/create-invoice-response.md @@ -79,6 +79,7 @@ The response returned by the `CreateInvoice` request. "sale_or_service_date": "2030-01-24", "scheduled_at": "2030-01-13T10:00:00Z", "status": "DRAFT", + "store_payment_method_enabled": false, "timezone": "America/Los_Angeles", "title": "Event Planning Services", "updated_at": "2020-06-18T17:45:13Z", diff --git a/doc/models/custom-attribute-definition.md b/doc/models/custom-attribute-definition.md index b8c49e44..c7c33798 100644 --- a/doc/models/custom-attribute-definition.md +++ b/doc/models/custom-attribute-definition.md @@ -13,7 +13,7 @@ specifies the key, visibility, schema, and other properties for a custom attribu | Name | Type | Tags | Description | Getter | Setter | | --- | --- | --- | --- | --- | --- | | `key` | `?string` | Optional | The identifier
of the custom attribute definition and its corresponding custom attributes. This value
can be a simple key, which is the key that is provided when the custom attribute definition
is created, or a qualified key, if the requesting
application is not the definition owner. The qualified key consists of the application ID
of the custom attribute definition owner
followed by the simple key that was provided when the definition was created. It has the
format application_id:simple key.

The value for a simple key can contain up to 60 alphanumeric characters, periods (.),
underscores (_), and hyphens (-).

This field can not be changed
after the custom attribute definition is created. This field is required when creating
a definition and must be unique per application, seller, and resource type.
**Constraints**: *Minimum Length*: `1`, *Pattern*: `^([a-zA-Z0-9\._-]+:)?[a-zA-Z0-9\._-]{1,60}$` | getKey(): ?string | setKey(?string key): void | -| `schema` | `mixed` | Optional | The JSON schema for the custom attribute definition. For more information about the schema,
see [Custom Attributes Overview](https://developer.squareup.com/docs/devtools/customattributes/overview). | getSchema(): | setSchema( schema): void | +| `schema` | `mixed` | Optional | The JSON schema for the custom attribute definition, which determines the data type of the corresponding custom attributes. For more information,
see [Custom Attributes Overview](https://developer.squareup.com/docs/devtools/customattributes/overview). This field is required when creating a definition. | getSchema(): | setSchema( schema): void | | `name` | `?string` | Optional | The name of the custom attribute definition for API and seller-facing UI purposes. The name must
be unique within the seller and application pair. This field is required if the
`visibility` field is `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
**Constraints**: *Maximum Length*: `255` | getName(): ?string | setName(?string name): void | | `description` | `?string` | Optional | Seller-oriented description of the custom attribute definition, including any constraints
that the seller should observe. May be displayed as a tooltip in Square UIs. This field is
required if the `visibility` field is `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
**Constraints**: *Maximum Length*: `255` | getDescription(): ?string | setDescription(?string description): void | | `visibility` | [`?string (CustomAttributeDefinitionVisibility)`](../../doc/models/custom-attribute-definition-visibility.md) | Optional | The level of permission that a seller or other applications requires to
view this custom attribute definition.
The `Visibility` field controls who can read and write the custom attribute values
and custom attribute definition. | getVisibility(): ?string | setVisibility(?string visibility): void | diff --git a/doc/models/get-invoice-response.md b/doc/models/get-invoice-response.md index a50141b5..6185d963 100644 --- a/doc/models/get-invoice-response.md +++ b/doc/models/get-invoice-response.md @@ -79,6 +79,7 @@ Describes a `GetInvoice` response. "sale_or_service_date": "2030-01-24", "scheduled_at": "2030-01-13T10:00:00Z", "status": "DRAFT", + "store_payment_method_enabled": false, "timezone": "America/Los_Angeles", "title": "Event Planning Services", "updated_at": "2020-06-18T17:45:13Z", diff --git a/doc/models/gift-card-activity-adjust-decrement-reason.md b/doc/models/gift-card-activity-adjust-decrement-reason.md index cc777eb5..6af17603 100644 --- a/doc/models/gift-card-activity-adjust-decrement-reason.md +++ b/doc/models/gift-card-activity-adjust-decrement-reason.md @@ -11,7 +11,8 @@ Indicates the reason for deducting money from a [gift card](../../doc/models/gif | Name | Description | | --- | --- | -| `SUSPICIOUS_ACTIVITY` | The seller determined suspicious activity by the buyer. | -| `BALANCE_ACCIDENTALLY_INCREASED` | The seller previously increased the gift card balance by accident. | -| `SUPPORT_ISSUE` | The seller decreased the gift card balance to
accommodate support issues. | +| `SUSPICIOUS_ACTIVITY` | The balance was decreased because the seller detected suspicious or fraudulent activity
on the gift card. | +| `BALANCE_ACCIDENTALLY_INCREASED` | The balance was decreased to reverse an unintentional balance increase. | +| `SUPPORT_ISSUE` | The balance was decreased to accommodate support issues. | +| `PURCHASE_WAS_REFUNDED` | The balance was decreased because the order used to purchase or reload the
gift card was refunded. | diff --git a/doc/models/gift-card-activity-adjust-decrement.md b/doc/models/gift-card-activity-adjust-decrement.md index 645f2c78..35d573f7 100644 --- a/doc/models/gift-card-activity-adjust-decrement.md +++ b/doc/models/gift-card-activity-adjust-decrement.md @@ -22,7 +22,7 @@ Represents details about an `ADJUST_DECREMENT` [gift card activity type](../../d "amount": null, "currency": null }, - "reason": "BALANCE_ACCIDENTALLY_INCREASED" + "reason": "SUSPICIOUS_ACTIVITY" } ``` diff --git a/doc/models/invoice.md b/doc/models/invoice.md index 2396e992..329b4d85 100644 --- a/doc/models/invoice.md +++ b/doc/models/invoice.md @@ -34,6 +34,7 @@ invoices. For more information, see [Invoices API Overview](https://developer.sq | `subscriptionId` | `?string` | Optional | The ID of the [subscription](../../doc/models/subscription.md) associated with the invoice.
This field is present only on subscription billing invoices. | getSubscriptionId(): ?string | setSubscriptionId(?string subscriptionId): void | | `saleOrServiceDate` | `?string` | Optional | The date of the sale or the date that the service is rendered, in `YYYY-MM-DD` format.
This field can be used to specify a past or future date which is displayed on the invoice. | getSaleOrServiceDate(): ?string | setSaleOrServiceDate(?string saleOrServiceDate): void | | `paymentConditions` | `?string` | Optional | **France only.** The payment terms and conditions that are displayed on the invoice. For more information,
see [Payment conditions](https://developer.squareup.com/docs/invoices-api/overview#payment-conditions).

For countries other than France, Square returns an `INVALID_REQUEST_ERROR` with a `BAD_REQUEST` code and
"Payment conditions are not supported for this location's country" detail if this field is included in `CreateInvoice` or `UpdateInvoice` requests.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `2000` | getPaymentConditions(): ?string | setPaymentConditions(?string paymentConditions): void | +| `storePaymentMethodEnabled` | `?bool` | Optional | Indicates whether to allow a customer to save a credit or debit card as a card on file or a bank transfer as a
bank account on file. If `true`, Square displays a __Save my card on file__ or __Save my bank on file__ checkbox on the
invoice payment page. Stored payment information can be used for future automatic payments. The default value is `false`. | getStorePaymentMethodEnabled(): ?bool | setStorePaymentMethodEnabled(?bool storePaymentMethodEnabled): void | ## Example (as JSON) @@ -54,7 +55,8 @@ invoices. For more information, see [Invoices API Overview](https://developer.sq "accepted_payment_methods": null, "custom_fields": null, "sale_or_service_date": null, - "payment_conditions": null + "payment_conditions": null, + "store_payment_method_enabled": null } ``` diff --git a/doc/models/list-invoices-response.md b/doc/models/list-invoices-response.md index 0d266d0b..0c53d348 100644 --- a/doc/models/list-invoices-response.md +++ b/doc/models/list-invoices-response.md @@ -82,6 +82,7 @@ Describes a `ListInvoice` response. "sale_or_service_date": "2030-01-24", "scheduled_at": "2030-01-13T10:00:00Z", "status": "DRAFT", + "store_payment_method_enabled": false, "timezone": "America/Los_Angeles", "title": "Event Planning Services", "updated_at": "2020-06-18T17:45:13Z", @@ -150,6 +151,7 @@ Describes a `ListInvoice` response. "public_url": "https://squareup.com/pay-invoice/h9sfsfTGTSnYEhISUDBhEQ", "sale_or_service_date": "2030-01-24", "status": "PARTIALLY_PAID", + "store_payment_method_enabled": false, "timezone": "America/Los_Angeles", "updated_at": "2021-01-23T15:29:56Z", "version": 3 diff --git a/doc/models/list-webhook-subscriptions-request.md b/doc/models/list-webhook-subscriptions-request.md index ce96676c..dd702638 100644 --- a/doc/models/list-webhook-subscriptions-request.md +++ b/doc/models/list-webhook-subscriptions-request.md @@ -14,7 +14,7 @@ Lists all [Subscription](../../doc/models/webhook-subscription.md)s owned by you | `cursor` | `?string` | Optional | A pagination cursor returned by a previous call to this endpoint.
Provide this to retrieve the next set of results for your original query.

For more information, see [Pagination](https://developer.squareup.com/docs/basics/api101/pagination).
**Constraints**: *Maximum Length*: `256` | getCursor(): ?string | setCursor(?string cursor): void | | `includeDisabled` | `?bool` | Optional | Includes disabled [Subscription](../../doc/models/webhook-subscription.md)s.
By default, all enabled [Subscription](../../doc/models/webhook-subscription.md)s are returned. | getIncludeDisabled(): ?bool | setIncludeDisabled(?bool includeDisabled): void | | `sortOrder` | [`?string (SortOrder)`](../../doc/models/sort-order.md) | Optional | The order (e.g., chronological or alphabetical) in which results from a request are returned. | getSortOrder(): ?string | setSortOrder(?string sortOrder): void | -| `limit` | `?int` | Optional | The maximum number of results to be returned in a single page.
It is possible to receive fewer results than the specified limit on a given page.
The default value of 100 is also the maximum allowed value. If the provided value is greater
than 100, it is ignored and the default value is used instead.

Default: 100
**Constraints**: `>= 1`, `<= 100` | getLimit(): ?int | setLimit(?int limit): void | +| `limit` | `?int` | Optional | The maximum number of results to be returned in a single page.
It is possible to receive fewer results than the specified limit on a given page.
The default value of 100 is also the maximum allowed value.

Default: 100
**Constraints**: `>= 1`, `<= 100` | getLimit(): ?int | setLimit(?int limit): void | ## Example (as JSON) diff --git a/doc/models/obtain-token-response.md b/doc/models/obtain-token-response.md index 203301c0..12177a4e 100644 --- a/doc/models/obtain-token-response.md +++ b/doc/models/obtain-token-response.md @@ -20,8 +20,6 @@ | `shortLived` | `?bool` | Optional | A Boolean indicating that the access token is a short-lived access token.
The short-lived access token returned in the response expires in 24 hours. | getShortLived(): ?bool | setShortLived(?bool shortLived): void | | `errors` | [`?(Error[])`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | getErrors(): ?array | setErrors(?array errors): void | | `refreshTokenExpiresAt` | `?string` | Optional | The date when the `refresh_token` expires, in [ISO 8601](http://www.iso.org/iso/home/standards/iso8601.htm) format.
**Constraints**: *Minimum Length*: `20`, *Maximum Length*: `48` | getRefreshTokenExpiresAt(): ?string | setRefreshTokenExpiresAt(?string refreshTokenExpiresAt): void | -| `appSubscriptionId` | `?string` | Optional | The subscription id of a v2 subscription the merchant signed up
for. The subscription id is only present if the merchant signed up for a subscription during authorization. | getAppSubscriptionId(): ?string | setAppSubscriptionId(?string appSubscriptionId): void | -| `appPlanId` | `?string` | Optional | The plan id of a v2 subscription plan the merchant signed up
for. The plan id is only present if the merchant signed up for a subscription plan during authorization. | getAppPlanId(): ?string | setAppPlanId(?string appPlanId): void | ## Example (as JSON) diff --git a/doc/models/publish-invoice-response.md b/doc/models/publish-invoice-response.md index e033f2f2..d5f6d1ff 100644 --- a/doc/models/publish-invoice-response.md +++ b/doc/models/publish-invoice-response.md @@ -80,6 +80,7 @@ Describes a `PublishInvoice` response. "sale_or_service_date": "2030-01-24", "scheduled_at": "2030-01-13T10:00:00Z", "status": "SCHEDULED", + "store_payment_method_enabled": false, "timezone": "America/Los_Angeles", "title": "Event Planning Services", "updated_at": "2020-06-18T18:23:11Z", diff --git a/doc/models/search-invoices-response.md b/doc/models/search-invoices-response.md index bff10f2f..d43d38e7 100644 --- a/doc/models/search-invoices-response.md +++ b/doc/models/search-invoices-response.md @@ -82,6 +82,7 @@ Describes a `SearchInvoices` response. "sale_or_service_date": "2030-01-24", "scheduled_at": "2030-01-13T10:00:00Z", "status": "DRAFT", + "store_payment_method_enabled": false, "timezone": "America/Los_Angeles", "title": "Event Planning Services", "updated_at": "2020-06-18T17:45:13Z", @@ -151,6 +152,7 @@ Describes a `SearchInvoices` response. "public_url": "https://squareup.com/pay-invoice/h9sfsfTGTSnYEhISUDBhEQ", "sale_or_service_date": "2030-01-24", "status": "PARTIALLY_PAID", + "store_payment_method_enabled": false, "timezone": "America/Los_Angeles", "updated_at": "2021-01-23T15:29:56Z", "version": 3 diff --git a/doc/models/terminal-action-query-filter.md b/doc/models/terminal-action-query-filter.md index fc1a85c2..83ee6280 100644 --- a/doc/models/terminal-action-query-filter.md +++ b/doc/models/terminal-action-query-filter.md @@ -11,7 +11,7 @@ | --- | --- | --- | --- | --- | --- | | `deviceId` | `?string` | Optional | `TerminalAction`s associated with a specific device. If no device is specified then all
`TerminalAction`s for the merchant will be displayed. | getDeviceId(): ?string | setDeviceId(?string deviceId): void | | `createdAt` | [`?TimeRange`](../../doc/models/time-range.md) | Optional | Represents a generic time range. The start and end values are
represented in RFC 3339 format. Time ranges are customized to be
inclusive or exclusive based on the needs of a particular endpoint.
Refer to the relevant endpoint-specific documentation to determine
how time ranges are handled. | getCreatedAt(): ?TimeRange | setCreatedAt(?TimeRange createdAt): void | -| `status` | `?string` | Optional | Filter results with the desired status of the `TerminalAction`
Options: PENDING, IN_PROGRESS, CANCELED, COMPLETED | getStatus(): ?string | setStatus(?string status): void | +| `status` | `?string` | Optional | Filter results with the desired status of the `TerminalAction`
Options: `PENDING`, `IN_PROGRESS`, `CANCEL_REQUESTED`, `CANCELED`, `COMPLETED` | getStatus(): ?string | setStatus(?string status): void | | `type` | [`?string (TerminalActionActionType)`](../../doc/models/terminal-action-action-type.md) | Optional | Describes the type of this unit and indicates which field contains the unit information. This is an ‘open’ enum. | getType(): ?string | setType(?string type): void | ## Example (as JSON) diff --git a/doc/models/terminal-action.md b/doc/models/terminal-action.md index 6e7c9ead..594627c5 100644 --- a/doc/models/terminal-action.md +++ b/doc/models/terminal-action.md @@ -14,7 +14,7 @@ Represents an action processed by the Square Terminal. | `id` | `?string` | Optional | A unique ID for this `TerminalAction`.
**Constraints**: *Minimum Length*: `10`, *Maximum Length*: `255` | getId(): ?string | setId(?string id): void | | `deviceId` | `?string` | Optional | The unique Id of the device intended for this `TerminalAction`.
The Id can be retrieved from /v2/devices api. | getDeviceId(): ?string | setDeviceId(?string deviceId): void | | `deadlineDuration` | `?string` | Optional | The duration as an RFC 3339 duration, after which the action will be automatically canceled.
TerminalActions that are `PENDING` will be automatically `CANCELED` and have a cancellation reason
of `TIMED_OUT`

Default: 5 minutes from creation

Maximum: 5 minutes | getDeadlineDuration(): ?string | setDeadlineDuration(?string deadlineDuration): void | -| `status` | `?string` | Optional | The status of the `TerminalAction`.
Options: `PENDING`, `IN_PROGRESS`, `CANCELED`, `COMPLETED` | getStatus(): ?string | setStatus(?string status): void | +| `status` | `?string` | Optional | The status of the `TerminalAction`.
Options: `PENDING`, `IN_PROGRESS`, `CANCEL_REQUESTED`, `CANCELED`, `COMPLETED` | getStatus(): ?string | setStatus(?string status): void | | `cancelReason` | [`?string (ActionCancelReason)`](../../doc/models/action-cancel-reason.md) | Optional | - | getCancelReason(): ?string | setCancelReason(?string cancelReason): void | | `createdAt` | `?string` | Optional | The time when the `TerminalAction` was created as an RFC 3339 timestamp. | getCreatedAt(): ?string | setCreatedAt(?string createdAt): void | | `updatedAt` | `?string` | Optional | The time when the `TerminalAction` was last updated as an RFC 3339 timestamp. | getUpdatedAt(): ?string | setUpdatedAt(?string updatedAt): void | diff --git a/doc/models/terminal-checkout-query-filter.md b/doc/models/terminal-checkout-query-filter.md index 81006abe..dbb1fa67 100644 --- a/doc/models/terminal-checkout-query-filter.md +++ b/doc/models/terminal-checkout-query-filter.md @@ -11,7 +11,7 @@ | --- | --- | --- | --- | --- | --- | | `deviceId` | `?string` | Optional | The `TerminalCheckout` objects associated with a specific device. If no device is specified, then all
`TerminalCheckout` objects for the merchant are displayed. | getDeviceId(): ?string | setDeviceId(?string deviceId): void | | `createdAt` | [`?TimeRange`](../../doc/models/time-range.md) | Optional | Represents a generic time range. The start and end values are
represented in RFC 3339 format. Time ranges are customized to be
inclusive or exclusive based on the needs of a particular endpoint.
Refer to the relevant endpoint-specific documentation to determine
how time ranges are handled. | getCreatedAt(): ?TimeRange | setCreatedAt(?TimeRange createdAt): void | -| `status` | `?string` | Optional | Filtered results with the desired status of the `TerminalCheckout`.
Options: PENDING, IN_PROGRESS, CANCELED, COMPLETED | getStatus(): ?string | setStatus(?string status): void | +| `status` | `?string` | Optional | Filtered results with the desired status of the `TerminalCheckout`.
Options: `PENDING`, `IN_PROGRESS`, `CANCEL_REQUESTED`, `CANCELED`, `COMPLETED` | getStatus(): ?string | setStatus(?string status): void | ## Example (as JSON) diff --git a/doc/models/update-invoice-response.md b/doc/models/update-invoice-response.md index 1de28693..548e54c3 100644 --- a/doc/models/update-invoice-response.md +++ b/doc/models/update-invoice-response.md @@ -76,6 +76,7 @@ Describes a `UpdateInvoice` response. "sale_or_service_date": "2030-01-24", "scheduled_at": "2030-01-13T10:00:00Z", "status": "UNPAID", + "store_payment_method_enabled": false, "timezone": "America/Los_Angeles", "title": "Event Planning Services", "updated_at": "2020-06-18T18:23:11Z", diff --git a/src/Apis/ApplePayApi.php b/src/Apis/ApplePayApi.php index dcd53e97..0e12f8bf 100644 --- a/src/Apis/ApplePayApi.php +++ b/src/Apis/ApplePayApi.php @@ -30,9 +30,14 @@ public function __construct(ConfigurationInterface $config, array $authManagers, * This endpoint provides an easy way for platform developers to bulk activate * Apple Pay on the Web with Square for merchants using their platform. * - * To learn more about Web Apple Pay, see - * [Add the Apple Pay on the Web Button](https://developer.squareup.com/docs/payment-form/add-digital- - * wallets/apple-pay). + * Note: The SqPaymentForm library is deprecated as of May 13, 2021, and will only receive critical + * security updates until it is retired on October 31, 2022. + * You must migrate your payment form code to the Web Payments SDK to continue using your domain for + * Apple Pay. For more information on migrating to the Web Payments SDK, see [Migrate to the Web + * Payments SDK](https://developer.squareup.com/docs/web-payments/migrate). + * + * To learn more about the Web Payments SDK and how to add Apple Pay, see [Take an Apple Pay + * Payment](https://developer.squareup.com/docs/web-payments/apple-pay). * * @param Models\RegisterDomainRequest $body An object containing the fields to POST for the * request. diff --git a/src/Apis/BaseApi.php b/src/Apis/BaseApi.php index db0afc40..20711a53 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.1.0.20220823 ({api-version}) {engine}/{engine-version} ({os-info}) {detail}'; + private static $userAgent = 'Square-PHP-SDK/22.0.0.20220921 ({api-version}) {engine}/{engine-version} ({os-info}) {detail}'; /** * Constructor that sets the timeout of requests diff --git a/src/Apis/LoyaltyApi.php b/src/Apis/LoyaltyApi.php index 6584eac7..781ad364 100644 --- a/src/Apis/LoyaltyApi.php +++ b/src/Apis/LoyaltyApi.php @@ -246,8 +246,10 @@ public function retrieveLoyaltyAccount(string $accountId): ApiResponse * You must first perform a client-side computation of the points earned from the loyalty program and * loyalty promotion. For spend-based and visit-based programs, you can call * [CalculateLoyaltyPoints]($e/Loyalty/CalculateLoyaltyPoints) - * to compute the points earned from the loyalty program (but not points earned from a loyalty - * promotion). + * to compute the points earned from the base loyalty program. For information about computing points + * earned from a loyalty promotion, see + * [Calculating promotion points](https://developer.squareup.com/docs/loyalty-api/loyalty- + * promotions#calculate-promotion-points). * * @param string $accountId The ID of the target [loyalty account]($m/LoyaltyAccount). * @param Models\AccumulateLoyaltyPointsRequest $body An object containing the fields to POST diff --git a/src/Apis/V1TransactionsApi.php b/src/Apis/V1TransactionsApi.php index 877daa64..8f112e2f 100644 --- a/src/Apis/V1TransactionsApi.php +++ b/src/Apis/V1TransactionsApi.php @@ -39,7 +39,7 @@ public function __construct(ConfigurationInterface $config, array $authManagers, * * @throws ApiException Thrown if API call fails */ - public function listOrders( + public function v1ListOrders( string $locationId, ?string $order = null, ?int $limit = null, @@ -117,7 +117,7 @@ public function listOrders( * * @throws ApiException Thrown if API call fails */ - public function retrieveOrder(string $locationId, string $orderId): ApiResponse + public function v1RetrieveOrder(string $locationId, string $orderId): ApiResponse { trigger_error('Method ' . __METHOD__ . ' is deprecated.', E_USER_DEPRECATED); @@ -190,7 +190,7 @@ public function retrieveOrder(string $locationId, string $orderId): ApiResponse * * @throws ApiException Thrown if API call fails */ - public function updateOrder(string $locationId, string $orderId, Models\V1UpdateOrderRequest $body): ApiResponse + public function v1UpdateOrder(string $locationId, string $orderId, Models\V1UpdateOrderRequest $body): ApiResponse { trigger_error('Method ' . __METHOD__ . ' is deprecated.', E_USER_DEPRECATED); @@ -286,7 +286,7 @@ public function updateOrder(string $locationId, string $orderId, Models\V1Update * * @throws ApiException Thrown if API call fails */ - public function listPayments( + public function v1ListPayments( string $locationId, ?string $order = null, ?string $beginTime = null, @@ -372,7 +372,7 @@ public function listPayments( * * @throws ApiException Thrown if API call fails */ - public function retrievePayment(string $locationId, string $paymentId): ApiResponse + public function v1RetrievePayment(string $locationId, string $paymentId): ApiResponse { trigger_error('Method ' . __METHOD__ . ' is deprecated.', E_USER_DEPRECATED); @@ -453,7 +453,7 @@ public function retrievePayment(string $locationId, string $paymentId): ApiRespo * * @throws ApiException Thrown if API call fails */ - public function listRefunds( + public function v1ListRefunds( string $locationId, ?string $order = null, ?string $beginTime = null, @@ -548,7 +548,7 @@ public function listRefunds( * * @throws ApiException Thrown if API call fails */ - public function createRefund(string $locationId, Models\V1CreateRefundRequest $body): ApiResponse + public function v1CreateRefund(string $locationId, Models\V1CreateRefundRequest $body): ApiResponse { trigger_error('Method ' . __METHOD__ . ' is deprecated.', E_USER_DEPRECATED); @@ -637,7 +637,7 @@ public function createRefund(string $locationId, Models\V1CreateRefundRequest $b * * @throws ApiException Thrown if API call fails */ - public function listSettlements( + public function v1ListSettlements( string $locationId, ?string $order = null, ?string $beginTime = null, @@ -737,7 +737,7 @@ public function listSettlements( * * @throws ApiException Thrown if API call fails */ - public function retrieveSettlement(string $locationId, string $settlementId): ApiResponse + public function v1RetrieveSettlement(string $locationId, string $settlementId): ApiResponse { trigger_error('Method ' . __METHOD__ . ' is deprecated.', E_USER_DEPRECATED); diff --git a/src/Apis/WebhookSubscriptionsApi.php b/src/Apis/WebhookSubscriptionsApi.php index 88eb1c24..c98fd795 100644 --- a/src/Apis/WebhookSubscriptionsApi.php +++ b/src/Apis/WebhookSubscriptionsApi.php @@ -104,9 +104,7 @@ public function listWebhookEventTypes(?string $apiVersion = null): ApiResponse * This field defaults to ASC. * @param int|null $limit The maximum number of results to be returned in a single page. It is * possible to receive fewer results than the specified limit on a given page. - * The default value of 100 is also the maximum allowed value. If the provided value is - * greater - * than 100, it is ignored and the default value is used instead. + * The default value of 100 is also the maximum allowed value. * * Default: 100 * diff --git a/src/ConfigurationDefaults.php b/src/ConfigurationDefaults.php index ed6fa77a..58b76822 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-23'; + public const SQUARE_VERSION = '2022-09-21'; public const ADDITIONAL_HEADERS = []; diff --git a/src/Models/AccumulateLoyaltyPointsResponse.php b/src/Models/AccumulateLoyaltyPointsResponse.php index fad8a64f..dd3c1b79 100644 --- a/src/Models/AccumulateLoyaltyPointsResponse.php +++ b/src/Models/AccumulateLoyaltyPointsResponse.php @@ -76,8 +76,8 @@ public function setEvent(?LoyaltyEvent $event): void /** * Returns Events. - * The resulting loyalty events. The `ACCUMULATE_POINTS` event is always included. - * When using the Orders API, the `ACCUMULATE_PROMOTION_POINTS` event is included + * The resulting loyalty events. If the purchase qualifies for points, the `ACCUMULATE_POINTS` event + * is always included. When using the Orders API, the `ACCUMULATE_PROMOTION_POINTS` event is included * if the purchase also qualifies for a loyalty promotion. * * @return LoyaltyEvent[]|null @@ -89,8 +89,8 @@ public function getEvents(): ?array /** * Sets Events. - * The resulting loyalty events. The `ACCUMULATE_POINTS` event is always included. - * When using the Orders API, the `ACCUMULATE_PROMOTION_POINTS` event is included + * The resulting loyalty events. If the purchase qualifies for points, the `ACCUMULATE_POINTS` event + * is always included. When using the Orders API, the `ACCUMULATE_PROMOTION_POINTS` event is included * if the purchase also qualifies for a loyalty promotion. * * @maps events diff --git a/src/Models/CustomAttributeDefinition.php b/src/Models/CustomAttributeDefinition.php index 9bd3710b..dac15934 100644 --- a/src/Models/CustomAttributeDefinition.php +++ b/src/Models/CustomAttributeDefinition.php @@ -103,9 +103,10 @@ public function setKey(?string $key): void /** * Returns Schema. - * The JSON schema for the custom attribute definition. For more information about the schema, + * The JSON schema for the custom attribute definition, which determines the data type of the + * corresponding custom attributes. For more information, * see [Custom Attributes Overview](https://developer.squareup. - * com/docs/devtools/customattributes/overview). + * com/docs/devtools/customattributes/overview). This field is required when creating a definition. * * @return mixed */ @@ -116,9 +117,10 @@ public function getSchema() /** * Sets Schema. - * The JSON schema for the custom attribute definition. For more information about the schema, + * The JSON schema for the custom attribute definition, which determines the data type of the + * corresponding custom attributes. For more information, * see [Custom Attributes Overview](https://developer.squareup. - * com/docs/devtools/customattributes/overview). + * com/docs/devtools/customattributes/overview). This field is required when creating a definition. * * @maps schema * diff --git a/src/Models/GiftCardActivityAdjustDecrementReason.php b/src/Models/GiftCardActivityAdjustDecrementReason.php index f3a7d3d8..0aba02b1 100644 --- a/src/Models/GiftCardActivityAdjustDecrementReason.php +++ b/src/Models/GiftCardActivityAdjustDecrementReason.php @@ -10,18 +10,24 @@ class GiftCardActivityAdjustDecrementReason { /** - * The seller determined suspicious activity by the buyer. + * The balance was decreased because the seller detected suspicious or fraudulent activity + * on the gift card. */ public const SUSPICIOUS_ACTIVITY = 'SUSPICIOUS_ACTIVITY'; /** - * The seller previously increased the gift card balance by accident. + * The balance was decreased to reverse an unintentional balance increase. */ public const BALANCE_ACCIDENTALLY_INCREASED = 'BALANCE_ACCIDENTALLY_INCREASED'; /** - * The seller decreased the gift card balance to - * accommodate support issues. + * The balance was decreased to accommodate support issues. */ public const SUPPORT_ISSUE = 'SUPPORT_ISSUE'; + + /** + * The balance was decreased because the order used to purchase or reload the + * gift card was refunded. + */ + public const PURCHASE_WAS_REFUNDED = 'PURCHASE_WAS_REFUNDED'; } diff --git a/src/Models/Invoice.php b/src/Models/Invoice.php index 3c5d9901..a0a35231 100644 --- a/src/Models/Invoice.php +++ b/src/Models/Invoice.php @@ -123,6 +123,11 @@ class Invoice implements \JsonSerializable */ private $paymentConditions; + /** + * @var bool|null + */ + private $storePaymentMethodEnabled; + /** * Returns Id. * The Square-assigned ID of the invoice. @@ -711,6 +716,36 @@ public function setPaymentConditions(?string $paymentConditions): void $this->paymentConditions = $paymentConditions; } + /** + * Returns Store Payment Method Enabled. + * Indicates whether to allow a customer to save a credit or debit card as a card on file or a bank + * transfer as a + * bank account on file. If `true`, Square displays a __Save my card on file__ or __Save my bank on + * file__ checkbox on the + * invoice payment page. Stored payment information can be used for future automatic payments. The + * default value is `false`. + */ + public function getStorePaymentMethodEnabled(): ?bool + { + return $this->storePaymentMethodEnabled; + } + + /** + * Sets Store Payment Method Enabled. + * Indicates whether to allow a customer to save a credit or debit card as a card on file or a bank + * transfer as a + * bank account on file. If `true`, Square displays a __Save my card on file__ or __Save my bank on + * file__ checkbox on the + * invoice payment page. Stored payment information can be used for future automatic payments. The + * default value is `false`. + * + * @maps store_payment_method_enabled + */ + public function setStorePaymentMethodEnabled(?bool $storePaymentMethodEnabled): void + { + $this->storePaymentMethodEnabled = $storePaymentMethodEnabled; + } + /** * Encode this object to JSON * @@ -724,70 +759,73 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; if (isset($this->id)) { - $json['id'] = $this->id; + $json['id'] = $this->id; } if (isset($this->version)) { - $json['version'] = $this->version; + $json['version'] = $this->version; } if (isset($this->locationId)) { - $json['location_id'] = $this->locationId; + $json['location_id'] = $this->locationId; } if (isset($this->orderId)) { - $json['order_id'] = $this->orderId; + $json['order_id'] = $this->orderId; } if (isset($this->primaryRecipient)) { - $json['primary_recipient'] = $this->primaryRecipient; + $json['primary_recipient'] = $this->primaryRecipient; } if (isset($this->paymentRequests)) { - $json['payment_requests'] = $this->paymentRequests; + $json['payment_requests'] = $this->paymentRequests; } if (isset($this->deliveryMethod)) { - $json['delivery_method'] = $this->deliveryMethod; + $json['delivery_method'] = $this->deliveryMethod; } if (isset($this->invoiceNumber)) { - $json['invoice_number'] = $this->invoiceNumber; + $json['invoice_number'] = $this->invoiceNumber; } if (isset($this->title)) { - $json['title'] = $this->title; + $json['title'] = $this->title; } if (isset($this->description)) { - $json['description'] = $this->description; + $json['description'] = $this->description; } if (isset($this->scheduledAt)) { - $json['scheduled_at'] = $this->scheduledAt; + $json['scheduled_at'] = $this->scheduledAt; } if (isset($this->publicUrl)) { - $json['public_url'] = $this->publicUrl; + $json['public_url'] = $this->publicUrl; } if (isset($this->nextPaymentAmountMoney)) { - $json['next_payment_amount_money'] = $this->nextPaymentAmountMoney; + $json['next_payment_amount_money'] = $this->nextPaymentAmountMoney; } if (isset($this->status)) { - $json['status'] = $this->status; + $json['status'] = $this->status; } if (isset($this->timezone)) { - $json['timezone'] = $this->timezone; + $json['timezone'] = $this->timezone; } if (isset($this->createdAt)) { - $json['created_at'] = $this->createdAt; + $json['created_at'] = $this->createdAt; } if (isset($this->updatedAt)) { - $json['updated_at'] = $this->updatedAt; + $json['updated_at'] = $this->updatedAt; } if (isset($this->acceptedPaymentMethods)) { - $json['accepted_payment_methods'] = $this->acceptedPaymentMethods; + $json['accepted_payment_methods'] = $this->acceptedPaymentMethods; } if (isset($this->customFields)) { - $json['custom_fields'] = $this->customFields; + $json['custom_fields'] = $this->customFields; } if (isset($this->subscriptionId)) { - $json['subscription_id'] = $this->subscriptionId; + $json['subscription_id'] = $this->subscriptionId; } if (isset($this->saleOrServiceDate)) { - $json['sale_or_service_date'] = $this->saleOrServiceDate; + $json['sale_or_service_date'] = $this->saleOrServiceDate; } if (isset($this->paymentConditions)) { - $json['payment_conditions'] = $this->paymentConditions; + $json['payment_conditions'] = $this->paymentConditions; + } + if (isset($this->storePaymentMethodEnabled)) { + $json['store_payment_method_enabled'] = $this->storePaymentMethodEnabled; } $json = array_filter($json, function ($val) { return $val !== null; diff --git a/src/Models/ListWebhookSubscriptionsRequest.php b/src/Models/ListWebhookSubscriptionsRequest.php index 5b89d183..96a80bb5 100644 --- a/src/Models/ListWebhookSubscriptionsRequest.php +++ b/src/Models/ListWebhookSubscriptionsRequest.php @@ -103,8 +103,7 @@ public function setSortOrder(?string $sortOrder): void * Returns Limit. * The maximum number of results to be returned in a single page. * It is possible to receive fewer results than the specified limit on a given page. - * The default value of 100 is also the maximum allowed value. If the provided value is greater - * than 100, it is ignored and the default value is used instead. + * The default value of 100 is also the maximum allowed value. * * Default: 100 */ @@ -117,8 +116,7 @@ public function getLimit(): ?int * Sets Limit. * The maximum number of results to be returned in a single page. * It is possible to receive fewer results than the specified limit on a given page. - * The default value of 100 is also the maximum allowed value. If the provided value is greater - * than 100, it is ignored and the default value is used instead. + * The default value of 100 is also the maximum allowed value. * * Default: 100 * diff --git a/src/Models/ObtainTokenResponse.php b/src/Models/ObtainTokenResponse.php index 439791a1..a0693362 100644 --- a/src/Models/ObtainTokenResponse.php +++ b/src/Models/ObtainTokenResponse.php @@ -63,16 +63,6 @@ class ObtainTokenResponse implements \JsonSerializable */ private $refreshTokenExpiresAt; - /** - * @var string|null - */ - private $appSubscriptionId; - - /** - * @var string|null - */ - private $appPlanId; - /** * Returns Access Token. * A valid OAuth access token. OAuth access tokens are 64 bytes long. @@ -321,54 +311,6 @@ public function setRefreshTokenExpiresAt(?string $refreshTokenExpiresAt): void $this->refreshTokenExpiresAt = $refreshTokenExpiresAt; } - /** - * Returns App Subscription Id. - * The subscription id of a v2 subscription the merchant signed up - * for. The subscription id is only present if the merchant signed up for a subscription during - * authorization. - */ - public function getAppSubscriptionId(): ?string - { - return $this->appSubscriptionId; - } - - /** - * Sets App Subscription Id. - * The subscription id of a v2 subscription the merchant signed up - * for. The subscription id is only present if the merchant signed up for a subscription during - * authorization. - * - * @maps app_subscription_id - */ - public function setAppSubscriptionId(?string $appSubscriptionId): void - { - $this->appSubscriptionId = $appSubscriptionId; - } - - /** - * Returns App Plan Id. - * The plan id of a v2 subscription plan the merchant signed up - * for. The plan id is only present if the merchant signed up for a subscription plan during - * authorization. - */ - public function getAppPlanId(): ?string - { - return $this->appPlanId; - } - - /** - * Sets App Plan Id. - * The plan id of a v2 subscription plan the merchant signed up - * for. The plan id is only present if the merchant signed up for a subscription plan during - * authorization. - * - * @maps app_plan_id - */ - public function setAppPlanId(?string $appPlanId): void - { - $this->appPlanId = $appPlanId; - } - /** * Encode this object to JSON * @@ -414,12 +356,6 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) if (isset($this->refreshTokenExpiresAt)) { $json['refresh_token_expires_at'] = $this->refreshTokenExpiresAt; } - if (isset($this->appSubscriptionId)) { - $json['app_subscription_id'] = $this->appSubscriptionId; - } - if (isset($this->appPlanId)) { - $json['app_plan_id'] = $this->appPlanId; - } $json = array_filter($json, function ($val) { return $val !== null; }); diff --git a/src/Models/TerminalAction.php b/src/Models/TerminalAction.php index 4b18fdff..6abde056 100644 --- a/src/Models/TerminalAction.php +++ b/src/Models/TerminalAction.php @@ -143,7 +143,7 @@ public function setDeadlineDuration(?string $deadlineDuration): void /** * Returns Status. * The status of the `TerminalAction`. - * Options: `PENDING`, `IN_PROGRESS`, `CANCELED`, `COMPLETED` + * Options: `PENDING`, `IN_PROGRESS`, `CANCEL_REQUESTED`, `CANCELED`, `COMPLETED` */ public function getStatus(): ?string { @@ -153,7 +153,7 @@ public function getStatus(): ?string /** * Sets Status. * The status of the `TerminalAction`. - * Options: `PENDING`, `IN_PROGRESS`, `CANCELED`, `COMPLETED` + * Options: `PENDING`, `IN_PROGRESS`, `CANCEL_REQUESTED`, `CANCELED`, `COMPLETED` * * @maps status */ diff --git a/src/Models/TerminalActionQueryFilter.php b/src/Models/TerminalActionQueryFilter.php index 0210f212..6a8e6e80 100644 --- a/src/Models/TerminalActionQueryFilter.php +++ b/src/Models/TerminalActionQueryFilter.php @@ -81,7 +81,7 @@ public function setCreatedAt(?TimeRange $createdAt): void /** * Returns Status. * Filter results with the desired status of the `TerminalAction` - * Options: PENDING, IN_PROGRESS, CANCELED, COMPLETED + * Options: `PENDING`, `IN_PROGRESS`, `CANCEL_REQUESTED`, `CANCELED`, `COMPLETED` */ public function getStatus(): ?string { @@ -91,7 +91,7 @@ public function getStatus(): ?string /** * Sets Status. * Filter results with the desired status of the `TerminalAction` - * Options: PENDING, IN_PROGRESS, CANCELED, COMPLETED + * Options: `PENDING`, `IN_PROGRESS`, `CANCEL_REQUESTED`, `CANCELED`, `COMPLETED` * * @maps status */ diff --git a/src/Models/TerminalCheckoutQueryFilter.php b/src/Models/TerminalCheckoutQueryFilter.php index 62f34888..3639ec6b 100644 --- a/src/Models/TerminalCheckoutQueryFilter.php +++ b/src/Models/TerminalCheckoutQueryFilter.php @@ -78,7 +78,7 @@ public function setCreatedAt(?TimeRange $createdAt): void /** * Returns Status. * Filtered results with the desired status of the `TerminalCheckout`. - * Options: PENDING, IN_PROGRESS, CANCELED, COMPLETED + * Options: `PENDING`, `IN_PROGRESS`, `CANCEL_REQUESTED`, `CANCELED`, `COMPLETED` */ public function getStatus(): ?string { @@ -88,7 +88,7 @@ public function getStatus(): ?string /** * Sets Status. * Filtered results with the desired status of the `TerminalCheckout`. - * Options: PENDING, IN_PROGRESS, CANCELED, COMPLETED + * Options: `PENDING`, `IN_PROGRESS`, `CANCEL_REQUESTED`, `CANCELED`, `COMPLETED` * * @maps status */ diff --git a/src/SquareClient.php b/src/SquareClient.php index ac6ed6b1..7c8a3bf0 100644 --- a/src/SquareClient.php +++ b/src/SquareClient.php @@ -272,7 +272,7 @@ public function getBearerAuthCredentials(): ?BearerAuthCredentials */ public function getSdkVersion(): string { - return '21.1.0.20220823'; + return '22.0.0.20220921'; } /** diff --git a/tests/Flows/CustomersTest.php b/tests/Flows/CustomersTest.php index d957eb44..2f4ca0a9 100644 --- a/tests/Flows/CustomersTest.php +++ b/tests/Flows/CustomersTest.php @@ -44,11 +44,14 @@ class CustomersTest extends TestCase */ protected static $httpResponse; + private static $key; + /** * Setup test class */ public static function setUpBeforeClass(): void { + self::$key = 'favorite-drink_' . phpversion(); self::$httpResponse = new HttpCallBackCatcher(); self::$controller = ClientFactory::create(self::$httpResponse)->getCustomersApi(); self::$customAttributesController = ClientFactory::create(self::$httpResponse)->getCustomerCustomAttributesApi(); @@ -151,7 +154,7 @@ public function testUpdateCustomer(Customer $prevData): ?Customer // Delete the `favorite-drink` definition if it exists public function testCleanupCustomerCustomAttributeDefinition() { - $response = self::$customAttributesController->deleteCustomerCustomAttributeDefinition('favorite-drink'); + $response = self::$customAttributesController->deleteCustomerCustomAttributeDefinition(self::$key); $result = $response->getResult(); assert($result instanceof DeleteCustomerCustomAttributeDefinitionResponse); @@ -167,8 +170,8 @@ public function testCleanupCustomerCustomAttributeDefinition() public function testCreateCustomerCustomAttributeDefinition(): ?CustomAttributeDefinition { $definition = new CustomAttributeDefinition; - $definition->setKey('favorite-drink'); - $definition->setName('Favorite Drink'); + $definition->setKey(self::$key); + $definition->setName('Favorite Drink' . phpversion()); $definition->setDescription('The customer\'s favorite drink'); $definition->setVisibility(CustomAttributeDefinitionVisibility::VISIBILITY_READ_WRITE_VALUES); $definition->setSchema('{"$ref":"https://developer-production-s.squarecdn.com/schemas/v1/common.json#squareup.common.String"}'); @@ -183,8 +186,8 @@ public function testCreateCustomerCustomAttributeDefinition(): ?CustomAttributeD $this->assertTrue($response->isSuccess()); $this->assertEquals($response->getStatusCode(), 200); $this->assertNull($responseResult->getErrors()); - $this->assertEquals($data->getKey(), 'favorite-drink'); - $this->assertEquals($data->getName(), 'Favorite Drink'); + $this->assertEquals($data->getKey(), self::$key); + $this->assertEquals($data->getName(), 'Favorite Drink' . phpversion()); $this->assertEquals($data->getDescription(), 'The customer\'s favorite drink'); $this->assertEquals($data->getVisibility(), 'VISIBILITY_READ_WRITE_VALUES'); $this->assertEquals($data->getVersion(), 1); @@ -199,7 +202,7 @@ public function testCreateCustomerCustomAttributeDefinition(): ?CustomAttributeD */ public function testUpdateCustomerCustomAttributeDefinition(CustomAttributeDefinition $created): ?CustomAttributeDefinition { - $created->setName('Preferred Drink'); + $created->setName('Preferred Drink' . phpversion()); $updateRequest = new UpdateCustomerCustomAttributeDefinitionRequest($created); $response = self::$customAttributesController->updateCustomerCustomAttributeDefinition($created->getKey(), $updateRequest); @@ -211,8 +214,8 @@ public function testUpdateCustomerCustomAttributeDefinition(CustomAttributeDefin $this->assertTrue($response->isSuccess()); $this->assertEquals($response->getStatusCode(), 200); $this->assertNull($responseResult->getErrors()); - $this->assertEquals($data->getKey(), 'favorite-drink'); - $this->assertEquals($data->getName(), 'Preferred Drink'); + $this->assertEquals($data->getKey(), self::$key); + $this->assertEquals($data->getName(), 'Preferred Drink' . phpversion()); $this->assertEquals($data->getDescription(), 'The customer\'s favorite drink'); $this->assertEquals($data->getVisibility(), 'VISIBILITY_READ_WRITE_VALUES'); $this->assertEquals($data->getVersion(), 2); @@ -243,7 +246,7 @@ public function testCreateCustomerCustomAttribute(Customer $customerData, Custom assert($responseResult instanceof UpsertCustomerCustomAttributeResponse); $this->assertNull($responseResult->getErrors()); $result = $responseResult->getCustomAttribute(); - $this->assertEquals($result->getKey(), 'favorite-drink'); + $this->assertEquals($result->getKey(), self::$key); $this->assertEquals($result->getValue(), 'Double-shot breve'); $this->assertEquals($result->getVersion(), 1); $this->assertEquals($result->getVisibility(), 'VISIBILITY_READ_WRITE_VALUES'); @@ -274,7 +277,7 @@ public function testUpdateCustomerCustomAttribute(Customer $customerData, Custom assert($responseResult instanceof UpsertCustomerCustomAttributeResponse); $this->assertNull($responseResult->getErrors()); $result = $responseResult->getCustomAttribute(); - $this->assertEquals($result->getKey(), 'favorite-drink'); + $this->assertEquals($result->getKey(), self::$key); $this->assertEquals($result->getValue(), 'Black coffee'); $this->assertEquals($result->getVersion(), 2); $this->assertEquals($result->getVisibility(), 'VISIBILITY_READ_WRITE_VALUES');