diff --git a/composer.json b/composer.json index d5d58c11..08b0a3df 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": "34.0.1.20240118", + "version": "35.0.0.20240222", "type": "library", "keywords": [ "Square", diff --git a/doc/apis/checkout.md b/doc/apis/checkout.md index 2bfdf69e..3dbae027 100644 --- a/doc/apis/checkout.md +++ b/doc/apis/checkout.md @@ -351,7 +351,7 @@ function listPaymentLinks(?string $cursor = null, ?int $limit = null): ApiRespon | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `cursor` | `?string` | Query, Optional | A pagination cursor returned by a previous call to this endpoint.
Provide this cursor to retrieve the next set of results for the original query.
If a cursor is not provided, the endpoint returns the first page of the results.
For more information, see [Pagination](https://developer.squareup.com/docs/basics/api101/pagination). | +| `cursor` | `?string` | Query, Optional | A pagination cursor returned by a previous call to this endpoint.
Provide this cursor to retrieve the next set of results for the original query.
If a cursor is not provided, the endpoint returns the first page of the results.
For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | | `limit` | `?int` | Query, Optional | A limit on the number of results to return per page. The limit is advisory and
the implementation might return more or less results. If the supplied limit is negative, zero, or
greater than the maximum limit of 1000, it is ignored.

Default value: `100` | ## Response Type diff --git a/doc/apis/customers.md b/doc/apis/customers.md index b4b03c39..93377078 100644 --- a/doc/apis/customers.md +++ b/doc/apis/customers.md @@ -12,6 +12,10 @@ $customersApi = $client->getCustomersApi(); * [List Customers](../../doc/apis/customers.md#list-customers) * [Create Customer](../../doc/apis/customers.md#create-customer) +* [Bulk Create Customers](../../doc/apis/customers.md#bulk-create-customers) +* [Bulk Delete Customers](../../doc/apis/customers.md#bulk-delete-customers) +* [Bulk Retrieve Customers](../../doc/apis/customers.md#bulk-retrieve-customers) +* [Bulk Update Customers](../../doc/apis/customers.md#bulk-update-customers) * [Search Customers](../../doc/apis/customers.md#search-customers) * [Delete Customer](../../doc/apis/customers.md#delete-customer) * [Retrieve Customer](../../doc/apis/customers.md#retrieve-customer) @@ -142,6 +146,237 @@ var_dump($apiResponse->getHeaders()); ``` +# Bulk Create Customers + +Creates multiple [customer profiles](../../doc/models/customer.md) for a business. + +This endpoint takes a map of individual create requests and returns a map of responses. + +You must provide at least one of the following values in each create request: + +- `given_name` +- `family_name` +- `company_name` +- `email_address` +- `phone_number` + +```php +function bulkCreateCustomers(BulkCreateCustomersRequest $body): ApiResponse +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `body` | [`BulkCreateCustomersRequest`](../../doc/models/bulk-create-customers-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | + +## Response Type + +This method returns a `Square\Utils\ApiResponse` instance. The `getResult()` method on this instance returns the response data which is of type [`BulkCreateCustomersResponse`](../../doc/models/bulk-create-customers-response.md). + +## Example Usage + +```php +$body = BulkCreateCustomersRequestBuilder::init( + [ + '8bb76c4f-e35d-4c5b-90de-1194cd9179f0' => BulkCreateCustomerDataBuilder::init() + ->givenName('Amelia') + ->familyName('Earhart') + ->emailAddress('Amelia.Earhart@example.com') + ->address( + AddressBuilder::init() + ->addressLine1('500 Electric Ave') + ->addressLine2('Suite 600') + ->locality('New York') + ->administrativeDistrictLevel1('NY') + ->postalCode('10003') + ->country(Country::US) + ->build() + ) + ->phoneNumber('+1-212-555-4240') + ->referenceId('YOUR_REFERENCE_ID') + ->note('a customer') + ->build(), + 'd1689f23-b25d-4932-b2f0-aed00f5e2029' => BulkCreateCustomerDataBuilder::init() + ->givenName('Marie') + ->familyName('Curie') + ->emailAddress('Marie.Curie@example.com') + ->address( + AddressBuilder::init() + ->addressLine1('500 Electric Ave') + ->addressLine2('Suite 601') + ->locality('New York') + ->administrativeDistrictLevel1('NY') + ->postalCode('10003') + ->country(Country::US) + ->build() + ) + ->phoneNumber('+1-212-444-4240') + ->referenceId('YOUR_REFERENCE_ID') + ->note('another customer') + ->build() + ] +)->build(); + +$apiResponse = $customersApi->bulkCreateCustomers($body); + +if ($apiResponse->isSuccess()) { + $bulkCreateCustomersResponse = $apiResponse->getResult(); +} else { + $errors = $apiResponse->getErrors(); +} + +// Getting more response information +var_dump($apiResponse->getStatusCode()); +var_dump($apiResponse->getHeaders()); +``` + + +# Bulk Delete Customers + +Deletes multiple customer profiles. + +The endpoint takes a list of customer IDs and returns a map of responses. + +```php +function bulkDeleteCustomers(BulkDeleteCustomersRequest $body): ApiResponse +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `body` | [`BulkDeleteCustomersRequest`](../../doc/models/bulk-delete-customers-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | + +## Response Type + +This method returns a `Square\Utils\ApiResponse` instance. The `getResult()` method on this instance returns the response data which is of type [`BulkDeleteCustomersResponse`](../../doc/models/bulk-delete-customers-response.md). + +## Example Usage + +```php +$body = BulkDeleteCustomersRequestBuilder::init( + [ + '8DDA5NZVBZFGAX0V3HPF81HHE0', + 'N18CPRVXR5214XPBBA6BZQWF3C', + '2GYD7WNXF7BJZW1PMGNXZ3Y8M8' + ] +)->build(); + +$apiResponse = $customersApi->bulkDeleteCustomers($body); + +if ($apiResponse->isSuccess()) { + $bulkDeleteCustomersResponse = $apiResponse->getResult(); +} else { + $errors = $apiResponse->getErrors(); +} + +// Getting more response information +var_dump($apiResponse->getStatusCode()); +var_dump($apiResponse->getHeaders()); +``` + + +# Bulk Retrieve Customers + +Retrieves multiple customer profiles. + +This endpoint takes a list of customer IDs and returns a map of responses. + +```php +function bulkRetrieveCustomers(BulkRetrieveCustomersRequest $body): ApiResponse +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `body` | [`BulkRetrieveCustomersRequest`](../../doc/models/bulk-retrieve-customers-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | + +## Response Type + +This method returns a `Square\Utils\ApiResponse` instance. The `getResult()` method on this instance returns the response data which is of type [`BulkRetrieveCustomersResponse`](../../doc/models/bulk-retrieve-customers-response.md). + +## Example Usage + +```php +$body = BulkRetrieveCustomersRequestBuilder::init( + [ + '8DDA5NZVBZFGAX0V3HPF81HHE0', + 'N18CPRVXR5214XPBBA6BZQWF3C', + '2GYD7WNXF7BJZW1PMGNXZ3Y8M8' + ] +)->build(); + +$apiResponse = $customersApi->bulkRetrieveCustomers($body); + +if ($apiResponse->isSuccess()) { + $bulkRetrieveCustomersResponse = $apiResponse->getResult(); +} else { + $errors = $apiResponse->getErrors(); +} + +// Getting more response information +var_dump($apiResponse->getStatusCode()); +var_dump($apiResponse->getHeaders()); +``` + + +# Bulk Update Customers + +Updates multiple customer profiles. + +This endpoint takes a map of individual update requests and returns a map of responses. + +You cannot use this endpoint to change cards on file. To make changes, use the [Cards API](../../doc/apis/cards.md) or [Gift Cards API](../../doc/apis/gift-cards.md). + +```php +function bulkUpdateCustomers(BulkUpdateCustomersRequest $body): ApiResponse +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `body` | [`BulkUpdateCustomersRequest`](../../doc/models/bulk-update-customers-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | + +## Response Type + +This method returns a `Square\Utils\ApiResponse` instance. The `getResult()` method on this instance returns the response data which is of type [`BulkUpdateCustomersResponse`](../../doc/models/bulk-update-customers-response.md). + +## Example Usage + +```php +$body = BulkUpdateCustomersRequestBuilder::init( + [ + '8DDA5NZVBZFGAX0V3HPF81HHE0' => BulkUpdateCustomerDataBuilder::init() + ->emailAddress('New.Amelia.Earhart@example.com') + ->phoneNumber('phone_number2') + ->note('updated customer note') + ->version(2) + ->build(), + 'N18CPRVXR5214XPBBA6BZQWF3C' => BulkUpdateCustomerDataBuilder::init() + ->givenName('Marie') + ->familyName('Curie') + ->version(0) + ->build() + ] +)->build(); + +$apiResponse = $customersApi->bulkUpdateCustomers($body); + +if ($apiResponse->isSuccess()) { + $bulkUpdateCustomersResponse = $apiResponse->getResult(); +} else { + $errors = $apiResponse->getErrors(); +} + +// Getting more response information +var_dump($apiResponse->getStatusCode()); +var_dump($apiResponse->getHeaders()); +``` + + # Search Customers Searches the customer profiles associated with a Square account using one or more supported query filters. @@ -237,9 +472,6 @@ var_dump($apiResponse->getHeaders()); Deletes a customer profile from a business. This operation also unlinks any associated cards on file. -As a best practice, include the `version` field in the request to enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) control. -If included, the value must be set to the current version of the customer profile. - To delete a customer profile that was created by merging existing profiles, you must use the ID of the newly created profile. ```php @@ -316,11 +548,7 @@ var_dump($apiResponse->getHeaders()); # Update Customer Updates a customer profile. This endpoint supports sparse updates, so only new or changed fields are required in the request. -To add or update a field, specify the new value. To remove a field, specify `null` -(recommended) or specify an empty string (string fields only). - -As a best practice, include the `version` field in the request to enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) control. -If included, the value must be set to the current version of the customer profile. +To add or update a field, specify the new value. To remove a field, specify `null`. To update a customer profile that was created by merging existing profiles, you must use the ID of the newly created profile. @@ -348,7 +576,7 @@ $customerId = 'customer_id8'; $body = UpdateCustomerRequestBuilder::init() ->emailAddress('New.Amelia.Earhart@example.com') - ->phoneNumber('') + ->phoneNumber('phone_number2') ->note('updated customer note') ->version(2) ->build(); diff --git a/doc/apis/invoices.md b/doc/apis/invoices.md index 5bb32702..23d88845 100644 --- a/doc/apis/invoices.md +++ b/doc/apis/invoices.md @@ -528,9 +528,12 @@ nothing. Square also makes the invoice available on a Square-hosted invoice page The invoice `status` also changes from `DRAFT` to a status based on the invoice configuration. For example, the status changes to `UNPAID` if -Square emails the invoice or `PARTIALLY_PAID` if Square charge a card on file for a portion of the +Square emails the invoice or `PARTIALLY_PAID` if Square charges a card on file for a portion of the invoice amount. +In addition to the required `ORDERS_WRITE` and `INVOICES_WRITE` permissions, `CUSTOMERS_READ` +and `PAYMENTS_WRITE` are required when publishing invoices configured for card-on-file payments. + ```php function publishInvoice(string $invoiceId, PublishInvoiceRequest $body): ApiResponse ``` diff --git a/doc/apis/locations.md b/doc/apis/locations.md index 9b1cf1ec..206ec9ad 100644 --- a/doc/apis/locations.md +++ b/doc/apis/locations.md @@ -19,7 +19,7 @@ $locationsApi = $client->getLocationsApi(); # List Locations Provides details about all of the seller's [locations](https://developer.squareup.com/docs/locations-api), -including those with an inactive status. +including those with an inactive status. Locations are listed alphabetically by `name`. ```php function listLocations(): ApiResponse diff --git a/doc/apis/v1-transactions.md b/doc/apis/v1-transactions.md index 61068898..53182d71 100644 --- a/doc/apis/v1-transactions.md +++ b/doc/apis/v1-transactions.md @@ -13,12 +13,6 @@ $v1TransactionsApi = $client->getV1TransactionsApi(); * [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) # V1 List Orders @@ -163,351 +157,3 @@ var_dump($apiResponse->getStatusCode()); var_dump($apiResponse->getHeaders()); ``` - -# V1 List Payments - -**This endpoint is deprecated.** - -Provides summary information for all payments taken for a given -Square account during a date range. Date ranges cannot exceed 1 year in -length. See Date ranges for details of inclusive and exclusive dates. - -*Note**: Details for payments processed with Square Point of Sale while -in offline mode may not be transmitted to Square for up to 72 hours. -Offline payments have a `created_at` value that reflects the time the -payment was originally processed, not the time it was subsequently -transmitted to Square. Consequently, the ListPayments endpoint might -list an offline payment chronologically between online payments that -were seen in a previous request. - -```php -function v1ListPayments( - string $locationId, - ?string $order = null, - ?string $beginTime = null, - ?string $endTime = null, - ?int $limit = null, - ?string $batchToken = null, - ?bool $includePartial = false -): ApiResponse -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `locationId` | `string` | Template, Required | The ID of the location to list payments for. If you specify me, this endpoint returns payments aggregated from all of the business's locations. | -| `order` | [`?string(SortOrder)`](../../doc/models/sort-order.md) | Query, Optional | The order in which payments are listed in the response. | -| `beginTime` | `?string` | Query, Optional | The beginning of the requested reporting period, in ISO 8601 format. If this value is before January 1, 2013 (2013-01-01T00:00:00Z), this endpoint returns an error. Default value: The current time minus one year. | -| `endTime` | `?string` | Query, Optional | The end of the requested reporting period, in ISO 8601 format. If this value is more than one year greater than begin_time, this endpoint returns an error. Default value: The current time. | -| `limit` | `?int` | Query, Optional | The maximum number of payments to return in a single response. This value cannot exceed 200. | -| `batchToken` | `?string` | Query, Optional | A pagination cursor to retrieve the next set of results for your
original query to the endpoint. | -| `includePartial` | `?bool` | Query, Optional | Indicates whether or not to include partial payments in the response. Partial payments will have the tenders collected so far, but the itemizations will be empty until the payment is completed. | - -## Response Type - -This method returns a `Square\Utils\ApiResponse` instance. The `getResult()` method on this instance returns the response data which is of type [`V1Payment[]`](../../doc/models/v1-payment.md). - -## Example Usage - -```php -$locationId = 'location_id4'; - -$includePartial = false; - -$apiResponse = $v1TransactionsApi->v1ListPayments( - $locationId, - null, - null, - null, - null, - null, - $includePartial -); - -if ($apiResponse->isSuccess()) { - $v1Payment = $apiResponse->getResult(); -} else { - $errors = $apiResponse->getErrors(); -} - -// Getting more response information -var_dump($apiResponse->getStatusCode()); -var_dump($apiResponse->getHeaders()); -``` - - -# V1 Retrieve Payment - -**This endpoint is deprecated.** - -Provides comprehensive information for a single payment. - -```php -function v1RetrievePayment(string $locationId, string $paymentId): ApiResponse -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `locationId` | `string` | Template, Required | The ID of the payment's associated location. | -| `paymentId` | `string` | Template, Required | The Square-issued payment ID. payment_id comes from Payment objects returned by the List Payments endpoint, Settlement objects returned by the List Settlements endpoint, or Refund objects returned by the List Refunds endpoint. | - -## Response Type - -This method returns a `Square\Utils\ApiResponse` instance. The `getResult()` method on this instance returns the response data which is of type [`V1Payment`](../../doc/models/v1-payment.md). - -## Example Usage - -```php -$locationId = 'location_id4'; - -$paymentId = 'payment_id0'; - -$apiResponse = $v1TransactionsApi->v1RetrievePayment( - $locationId, - $paymentId -); - -if ($apiResponse->isSuccess()) { - $v1Payment = $apiResponse->getResult(); -} else { - $errors = $apiResponse->getErrors(); -} - -// Getting more response information -var_dump($apiResponse->getStatusCode()); -var_dump($apiResponse->getHeaders()); -``` - - -# 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 v1ListRefunds( - string $locationId, - ?string $order = null, - ?string $beginTime = null, - ?string $endTime = null, - ?int $limit = null, - ?string $batchToken = null -): ApiResponse -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `locationId` | `string` | Template, Required | The ID of the location to list refunds for. | -| `order` | [`?string(SortOrder)`](../../doc/models/sort-order.md) | Query, Optional | The order in which payments are listed in the response. | -| `beginTime` | `?string` | Query, Optional | The beginning of the requested reporting period, in ISO 8601 format. If this value is before January 1, 2013 (2013-01-01T00:00:00Z), this endpoint returns an error. Default value: The current time minus one year. | -| `endTime` | `?string` | Query, Optional | The end of the requested reporting period, in ISO 8601 format. If this value is more than one year greater than begin_time, this endpoint returns an error. Default value: The current time. | -| `limit` | `?int` | Query, Optional | The approximate number of refunds to return in a single response. Default: 100. Max: 200. Response may contain more results than the prescribed limit when refunds are made simultaneously to multiple tenders in a payment or when refunds are generated in an exchange to account for the value of returned goods. | -| `batchToken` | `?string` | Query, Optional | A pagination cursor to retrieve the next set of results for your
original query to the endpoint. | - -## Response Type - -This method returns a `Square\Utils\ApiResponse` instance. The `getResult()` method on this instance returns the response data which is of type [`V1Refund[]`](../../doc/models/v1-refund.md). - -## Example Usage - -```php -$locationId = 'location_id4'; - -$apiResponse = $v1TransactionsApi->v1ListRefunds($locationId); - -if ($apiResponse->isSuccess()) { - $v1Refund = $apiResponse->getResult(); -} else { - $errors = $apiResponse->getErrors(); -} - -// Getting more response information -var_dump($apiResponse->getStatusCode()); -var_dump($apiResponse->getHeaders()); -``` - - -# V1 Create Refund - -**This endpoint is deprecated.** - -Issues a refund for a previously processed payment. You must issue -a refund within 60 days of the associated payment. - -You cannot issue a partial refund for a split tender payment. You must -instead issue a full or partial refund for a particular tender, by -providing the applicable tender id to the V1CreateRefund endpoint. -Issuing a full refund for a split tender payment refunds all tenders -associated with the payment. - -Issuing a refund for a card payment is not reversible. For development -purposes, you can create fake cash payments in Square Point of Sale and -refund them. - -```php -function v1CreateRefund(string $locationId, V1CreateRefundRequest $body): ApiResponse -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `locationId` | `string` | Template, Required | The ID of the original payment's associated location. | -| `body` | [`V1CreateRefundRequest`](../../doc/models/v1-create-refund-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | - -## Response Type - -This method returns a `Square\Utils\ApiResponse` instance. The `getResult()` method on this instance returns the response data which is of type [`V1Refund`](../../doc/models/v1-refund.md). - -## Example Usage - -```php -$locationId = 'location_id4'; - -$body = V1CreateRefundRequestBuilder::init( - 'payment_id6', - V1CreateRefundRequestType::FULL, - 'reason8' -)->build(); - -$apiResponse = $v1TransactionsApi->v1CreateRefund( - $locationId, - $body -); - -if ($apiResponse->isSuccess()) { - $v1Refund = $apiResponse->getResult(); -} else { - $errors = $apiResponse->getErrors(); -} - -// Getting more response information -var_dump($apiResponse->getStatusCode()); -var_dump($apiResponse->getHeaders()); -``` - - -# V1 List Settlements - -**This endpoint is deprecated.** - -Provides summary information for all deposits and withdrawals -initiated by Square to a linked bank account during a date range. Date -ranges cannot exceed one year in length. - -*Note**: the ListSettlements endpoint does not provide entry -information. - -```php -function v1ListSettlements( - string $locationId, - ?string $order = null, - ?string $beginTime = null, - ?string $endTime = null, - ?int $limit = null, - ?string $status = null, - ?string $batchToken = null -): ApiResponse -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `locationId` | `string` | Template, Required | The ID of the location to list settlements for. If you specify me, this endpoint returns settlements aggregated from all of the business's locations. | -| `order` | [`?string(SortOrder)`](../../doc/models/sort-order.md) | Query, Optional | The order in which settlements are listed in the response. | -| `beginTime` | `?string` | Query, Optional | The beginning of the requested reporting period, in ISO 8601 format. If this value is before January 1, 2013 (2013-01-01T00:00:00Z), this endpoint returns an error. Default value: The current time minus one year. | -| `endTime` | `?string` | Query, Optional | The end of the requested reporting period, in ISO 8601 format. If this value is more than one year greater than begin_time, this endpoint returns an error. Default value: The current time. | -| `limit` | `?int` | Query, Optional | The maximum number of settlements to return in a single response. This value cannot exceed 200. | -| `status` | [`?string(V1ListSettlementsRequestStatus)`](../../doc/models/v1-list-settlements-request-status.md) | Query, Optional | Provide this parameter to retrieve only settlements with a particular status (SENT or FAILED). | -| `batchToken` | `?string` | Query, Optional | A pagination cursor to retrieve the next set of results for your
original query to the endpoint. | - -## Response Type - -This method returns a `Square\Utils\ApiResponse` instance. The `getResult()` method on this instance returns the response data which is of type [`V1Settlement[]`](../../doc/models/v1-settlement.md). - -## Example Usage - -```php -$locationId = 'location_id4'; - -$apiResponse = $v1TransactionsApi->v1ListSettlements($locationId); - -if ($apiResponse->isSuccess()) { - $v1Settlement = $apiResponse->getResult(); -} else { - $errors = $apiResponse->getErrors(); -} - -// Getting more response information -var_dump($apiResponse->getStatusCode()); -var_dump($apiResponse->getHeaders()); -``` - - -# V1 Retrieve Settlement - -**This endpoint is deprecated.** - -Provides comprehensive information for a single settlement. - -The returned `Settlement` objects include an `entries` field that lists -the transactions that contribute to the settlement total. Most -settlement entries correspond to a payment payout, but settlement -entries are also generated for less common events, like refunds, manual -adjustments, or chargeback holds. - -Square initiates its regular deposits as indicated in the -[Deposit Options with Square](https://squareup.com/help/us/en/article/3807) -help article. Details for a regular deposit are usually not available -from Connect API endpoints before 10 p.m. PST the same day. - -Square does not know when an initiated settlement **completes**, only -whether it has failed. A completed settlement is typically reflected in -a bank account within 3 business days, but in exceptional cases it may -take longer. - -```php -function v1RetrieveSettlement(string $locationId, string $settlementId): ApiResponse -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `locationId` | `string` | Template, Required | The ID of the settlements's associated location. | -| `settlementId` | `string` | Template, Required | The settlement's Square-issued ID. You obtain this value from Settlement objects returned by the List Settlements endpoint. | - -## Response Type - -This method returns a `Square\Utils\ApiResponse` instance. The `getResult()` method on this instance returns the response data which is of type [`V1Settlement`](../../doc/models/v1-settlement.md). - -## Example Usage - -```php -$locationId = 'location_id4'; - -$settlementId = 'settlement_id0'; - -$apiResponse = $v1TransactionsApi->v1RetrieveSettlement( - $locationId, - $settlementId -); - -if ($apiResponse->isSuccess()) { - $v1Settlement = $apiResponse->getResult(); -} else { - $errors = $apiResponse->getErrors(); -} - -// Getting more response information -var_dump($apiResponse->getStatusCode()); -var_dump($apiResponse->getHeaders()); -``` - diff --git a/doc/auth/oauth-2-bearer-token.md b/doc/auth/oauth-2-bearer-token.md new file mode 100644 index 00000000..da137264 --- /dev/null +++ b/doc/auth/oauth-2-bearer-token.md @@ -0,0 +1,34 @@ + +# OAuth 2 Bearer token + + + +Documentation for accessing and setting credentials for global. + +## Auth Credentials + +| Name | Type | Description | Setter | Getter | +| --- | --- | --- | --- | --- | +| AccessToken | `string` | The OAuth 2.0 Access Token to use for API requests. | `accessToken` | `getAccessToken()` | + + + +**Note:** Auth credentials can be set using `BearerAuthCredentialsBuilder::init()` in `bearerAuthCredentials` method in the client builder and accessed through `getBearerAuthCredentials` method in the client instance. + +## Usage Example + +### Client Initialization + +You must provide credentials in the client as shown in the following code snippet. + +```php +$client = SquareClientBuilder::init() + ->bearerAuthCredentials( + BearerAuthCredentialsBuilder::init( + 'AccessToken' + ) + ) + ->build(); +``` + + diff --git a/doc/client.md b/doc/client.md index 16aec1e2..634c6a06 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-01-18'` | +| `squareVersion` | `string` | Square Connect API versions
*Default*: `'2024-02-22'` | | `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` | @@ -19,14 +19,18 @@ The following parameters are configurable for the API Client: | `httpMethodsToRetry` | `array` | Http methods to retry against.
*Default*: `'GET', 'PUT'` | | `additionalHeaders` | `array` | Additional headers to add to each API call
*Default*: `[]` | | `userAgentDetail` | `string` | User agent detail, to be appended with user-agent header. | -| `accessToken` | `string` | The OAuth 2.0 Access Token to use for API requests. | +| `bearerAuthCredentials` | [`BearerAuthCredentials`](auth/oauth-2-bearer-token.md) | The Credentials Setter for OAuth 2 Bearer token | The API client can be initialized as follows: ```php $client = SquareClientBuilder::init() - ->accessToken('AccessToken') - ->squareVersion('2024-01-18') + ->bearerAuthCredentials( + BearerAuthCredentialsBuilder::init( + 'AccessToken' + ) + ) + ->squareVersion('2024-02-22') ->environment('production') ->customUrl('https://connect.squareup.com') ->build(); @@ -48,10 +52,15 @@ API calls return an `ApiResponse` object that includes the following fields: require_once "vendor/autoload.php"; use Square\SquareClientBuilder; +use Square\Authentication\BearerAuthCredentialsBuilder; $client = SquareClientBuilder::init() - ->accessToken('AccessToken') - ->squareVersion('2024-01-18') + ->bearerAuthCredentials( + BearerAuthCredentialsBuilder::init( + 'AccessToken' + ) + ) + ->squareVersion('2024-02-22') ->build(); $apiResponse = $client->getLocationsApi()->listLocations(); diff --git a/doc/models/activity-type.md b/doc/models/activity-type.md index f2157dcf..69a5808e 100644 --- a/doc/models/activity-type.md +++ b/doc/models/activity-type.md @@ -12,40 +12,56 @@ | `ADJUSTMENT` | A manual adjustment applied to the seller's account by Square. | | `APP_FEE_REFUND` | A refund for an application fee on a payment. | | `APP_FEE_REVENUE` | Revenue generated from an application fee on a payment. | -| `AUTOMATIC_SAVINGS` | An automatic transfer from the payment processing balance to the Square Savings account.
These are, generally, proportional to the seller's sales. | -| `AUTOMATIC_SAVINGS_REVERSED` | An automatic transfer from the Square Savings account back to the processing balance.
These are, generally, proportional to the seller's refunds. | +| `AUTOMATIC_SAVINGS` | An automatic transfer from the payment processing balance to the Square Savings account. These are generally proportional to the seller's sales. | +| `AUTOMATIC_SAVINGS_REVERSED` | An automatic transfer from the Square Savings account back to the processing balance. These are generally proportional to the seller's refunds. | | `CHARGE` | A credit card payment capture. | | `DEPOSIT_FEE` | Any fees involved with deposits such as instant deposits. | | `DISPUTE` | The balance change due to a dispute event. | | `ESCHEATMENT` | An escheatment entry for remittance. | -| `FEE` | The Square processing fee. | +| `FEE` | The cost plus adjustment fee. | | `FREE_PROCESSING` | Square offers free payments processing for a variety of business scenarios, including seller
referrals or when Square wants to apologize (for example, for a bug, customer service, or repricing complication).
This entry represents a credit to the seller for the purposes of free processing. | | `HOLD_ADJUSTMENT` | An adjustment made by Square related to holding a payment. | -| `INITIAL_BALANCE_CHANGE` | An external change to a seller's balance. Initial, in the sense that it
causes the creation of the other activity types, such as hold and refund. | +| `INITIAL_BALANCE_CHANGE` | An external change to a seller's balance (initial, in the sense that it causes the creation of the other activity types, such as a hold and refund). | | `MONEY_TRANSFER` | The balance change from a money transfer. | | `MONEY_TRANSFER_REVERSAL` | The reversal of a money transfer. | -| `OPEN_DISPUTE` | The balance change for a chargeback that has been filed. | -| `OTHER` | Any other type that does not belong in the rest of the types. | -| `OTHER_ADJUSTMENT` | Any other type of adjustment that does not fall under existing types. | -| `PAID_SERVICE_FEE` | A fee paid to a third-party merchant. | -| `PAID_SERVICE_FEE_REFUND` | A fee paid to a third-party merchant. | +| `OPEN_DISPUTE` | The balance change for a chargeback that's been filed. | +| `OTHER` | Any other type that doesn't belong in the rest of the types. | +| `OTHER_ADJUSTMENT` | Any other type of adjustment that doesn't fall under existing types. | +| `PAID_SERVICE_FEE` | A fee paid to a third-party seller. | +| `PAID_SERVICE_FEE_REFUND` | A fee refunded to a third-party seller. | | `REDEMPTION_CODE` | Repayment for a redemption code. | | `REFUND` | A refund for an existing card payment. | | `RELEASE_ADJUSTMENT` | An adjustment made by Square related to releasing a payment. | -| `RESERVE_HOLD` | Fees paid for funding risk reserve. | -| `RESERVE_RELEASE` | Fees released from risk reserve. | +| `RESERVE_HOLD` | Fees paid for a funding risk reserve. | +| `RESERVE_RELEASE` | Fees released from a risk reserve. | | `RETURNED_PAYOUT` | An entry created when Square receives a response for the ACH file that Square sent indicating that the
settlement of the original entry failed. | -| `SQUARE_CAPITAL_PAYMENT` | A capital merchant cash advance (MCA) assessment. These are, generally,
proportional to the merchant's sales but can be issued for other reasons related to the MCA. | -| `SQUARE_CAPITAL_REVERSED_PAYMENT` | A capital merchant cash advance (MCA) assessment refund. These are, generally,
proportional to the merchant's refunds but can be issued for other reasons related to the MCA. | +| `SQUARE_CAPITAL_PAYMENT` | A capital merchant cash advance (MCA) assessment. These are generally proportional to the merchant's sales but can be issued for other reasons related to the MCA. | +| `SQUARE_CAPITAL_REVERSED_PAYMENT` | A capital merchant cash advance (MCA) assessment refund. These are generally proportional to the merchant's refunds but can be issued for other reasons related to the MCA. | | `SUBSCRIPTION_FEE` | A fee charged for subscription to a Square product. | -| `SUBSCRIPTION_FEE_PAID_REFUND` | A Square subscription fee that has been refunded. | +| `SUBSCRIPTION_FEE_PAID_REFUND` | A Square subscription fee that's been refunded. | | `SUBSCRIPTION_FEE_REFUND` | The refund of a previously charged Square product subscription fee. | | `TAX_ON_FEE` | The tax paid on fee amounts. | | `THIRD_PARTY_FEE` | Fees collected by a third-party platform. | | `THIRD_PARTY_FEE_REFUND` | Refunded fees from a third-party platform. | -| `PAYOUT` | Balance change due to money transfer. | -| `AUTOMATIC_BITCOIN_CONVERSIONS` | Indicates the withholding of a portion of each payment by Square that has been
automatically converted into bitcoin using Cash App. The seller manages their bitcoin in
their Cash App account. | -| `AUTOMATIC_BITCOIN_CONVERSIONS_REVERSED` | Indicates a return of the payment withholding that had been scheduled to be converted
into bitcoin using Cash App to the Square payments balance. | -| `CREDIT_CARD_REPAYMENT` | The repayment made toward the outstanding balance on the seller's Square credit card. | -| `CREDIT_CARD_REPAYMENT_REVERSED` | The reversal of the repayment made toward the outstanding balance on the seller's
Square credit card. | +| `PAYOUT` | The balance change due to money transfer. | +| `AUTOMATIC_BITCOIN_CONVERSIONS` | Indicates that the portion of each payment withheld by Square was automatically converted into bitcoin using Cash App. The seller manages their bitcoin in their Cash App account. | +| `AUTOMATIC_BITCOIN_CONVERSIONS_REVERSED` | Indicates that a withheld payment, which was scheduled to be converted into bitcoin using Cash App, was deposited back to the Square payments balance. | +| `CREDIT_CARD_REPAYMENT` | Indicates that a repayment toward the outstanding balance on the seller's Square credit card was made. | +| `CREDIT_CARD_REPAYMENT_REVERSED` | Indicates that a repayment toward the outstanding balance on the seller's Square credit card was reversed. | +| `LOCAL_OFFERS_CASHBACK` | Cashback amount given by a Square Local Offers seller to their customer for a purchase. | +| `LOCAL_OFFERS_FEE` | A commission fee paid by a Square Local Offers seller to Square for a purchase discovered through Square Local Offers. | +| `PERCENTAGE_PROCESSING_ENROLLMENT` | When activating Percentage Processing, a credit is applied to the seller’s account to offset any negative balance caused by a dispute. | +| `PERCENTAGE_PROCESSING_DEACTIVATION` | Deducting the outstanding Percentage Processing balance from the seller’s account. It's the final installment in repaying the dispute-induced negative balance through percentage processing. | +| `PERCENTAGE_PROCESSING_REPAYMENT` | Withheld funds from a payment to cover a negative balance. It's an installment to repay the amount from a dispute that had been offset during Percentage Processing enrollment. | +| `PERCENTAGE_PROCESSING_REPAYMENT_REVERSED` | The reversal of a percentage processing repayment that happens for example when a refund is issued for a payment. | +| `PROCESSING_FEE` | The processing fee for a payment. If sellers opt for Gross Settlement, i.e., direct bank withdrawal instead of deducting fees from daily sales, the processing fee is recorded separately as a new payout entry, not part of the CHARGE payout entry. | +| `PROCESSING_FEE_REFUND` | The processing fee for a payment refund issued by sellers enrolled in Gross Settlement. The refunded processing fee is recorded separately as a new payout entry, not part of the REFUND payout entry. | +| `UNDO_PROCESSING_FEE_REFUND` | When undoing a processing fee refund in a Gross Settlement payment, this payout entry type is used. | +| `GIFT_CARD_LOAD_FEE` | Fee collected during the sale or reload of a gift card. This fee, which is a portion of the amount loaded on the gift card, is deducted from the merchant's payment balance. | +| `GIFT_CARD_LOAD_FEE_REFUND` | Refund for fee charged during the sale or reload of a gift card. | +| `UNDO_GIFT_CARD_LOAD_FEE_REFUND` | The undo of a refund for a fee charged during the sale or reload of a gift card. | +| `BALANCE_FOLDERS_TRANSFER` | A transfer of funds to a banking folder. In the United States, the folder name is 'Checking Folder'; in Canada, it's 'Balance Folder.' | +| `BALANCE_FOLDERS_TRANSFER_REVERSED` | A reversal of transfer of funds from a banking folder. In the United States, the folder name is 'Checking Folder'; in Canada, it's 'Balance Folder.' | +| `GIFT_CARD_POOL_TRANSFER` | A transfer of gift card funds to a central gift card pool account. In franchises, when gift cards are loaded or reloaded at any location, the money transfers to the franchisor's account. | +| `GIFT_CARD_POOL_TRANSFER_REVERSED` | A reversal of transfer of gift card funds from a central gift card pool account. In franchises, when gift cards are loaded or reloaded at any location, the money transfers to the franchisor's account. | diff --git a/doc/models/bulk-create-customer-data.md b/doc/models/bulk-create-customer-data.md new file mode 100644 index 00000000..53dfe6be --- /dev/null +++ b/doc/models/bulk-create-customer-data.md @@ -0,0 +1,38 @@ + +# Bulk Create Customer Data + +Defines the customer data provided in individual create requests for a +[BulkCreateCustomers](../../doc/apis/customers.md#bulk-create-customers) operation. + +## Structure + +`BulkCreateCustomerData` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `givenName` | `?string` | Optional | The given name (that is, the first name) associated with the customer profile.
**Constraints**: *Maximum Length*: `300` | getGivenName(): ?string | setGivenName(?string givenName): void | +| `familyName` | `?string` | Optional | The family name (that is, the last name) associated with the customer profile.
**Constraints**: *Maximum Length*: `300` | getFamilyName(): ?string | setFamilyName(?string familyName): void | +| `companyName` | `?string` | Optional | A business name associated with the customer profile.
**Constraints**: *Maximum Length*: `500` | getCompanyName(): ?string | setCompanyName(?string companyName): void | +| `nickname` | `?string` | Optional | A nickname for the customer profile.
**Constraints**: *Maximum Length*: `100` | getNickname(): ?string | setNickname(?string nickname): void | +| `emailAddress` | `?string` | Optional | The email address associated with the customer profile.
**Constraints**: *Maximum Length*: `254` | getEmailAddress(): ?string | setEmailAddress(?string emailAddress): void | +| `address` | [`?Address`](../../doc/models/address.md) | Optional | Represents a postal address in a country.
For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). | getAddress(): ?Address | setAddress(?Address address): void | +| `phoneNumber` | `?string` | Optional | The phone number associated with the customer profile. The phone number must be valid
and can contain 9–16 digits, with an optional `+` prefix and country code. For more information,
see [Customer phone numbers](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#phone-number). | getPhoneNumber(): ?string | setPhoneNumber(?string phoneNumber): void | +| `referenceId` | `?string` | Optional | An optional second ID used to associate the customer profile with an
entity in another system.
**Constraints**: *Maximum Length*: `100` | getReferenceId(): ?string | setReferenceId(?string referenceId): void | +| `note` | `?string` | Optional | A custom note associated with the customer profile. | getNote(): ?string | setNote(?string note): void | +| `birthday` | `?string` | Optional | The birthday associated with the customer profile, in `YYYY-MM-DD` or `MM-DD` format.
For example, specify `1998-09-21` for September 21, 1998, or `09-21` for September 21.
Birthdays are returned in `YYYY-MM-DD` format, where `YYYY` is the specified birth year or
`0000` if a birth year is not specified. | getBirthday(): ?string | setBirthday(?string birthday): void | +| `taxIds` | [`?CustomerTaxIds`](../../doc/models/customer-tax-ids.md) | Optional | Represents the tax ID associated with a [customer profile](../../doc/models/customer.md). The corresponding `tax_ids` field is available only for customers of sellers in EU countries or the United Kingdom.
For more information, see [Customer tax IDs](https://developer.squareup.com/docs/customers-api/what-it-does#customer-tax-ids). | getTaxIds(): ?CustomerTaxIds | setTaxIds(?CustomerTaxIds taxIds): void | + +## Example (as JSON) + +```json +{ + "given_name": "given_name4", + "family_name": "family_name4", + "company_name": "company_name8", + "nickname": "nickname8", + "email_address": "email_address0" +} +``` + diff --git a/doc/models/bulk-create-customers-request.md b/doc/models/bulk-create-customers-request.md new file mode 100644 index 00000000..7e23e093 --- /dev/null +++ b/doc/models/bulk-create-customers-request.md @@ -0,0 +1,61 @@ + +# Bulk Create Customers Request + +Defines the body parameters that can be included in requests to the +[BulkCreateCustomers](../../doc/apis/customers.md#bulk-create-customers) endpoint. + +## Structure + +`BulkCreateCustomersRequest` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `customers` | [`array`](../../doc/models/bulk-create-customer-data.md) | Required | A map of 1 to 100 individual create requests, represented by `idempotency key: { customer data }`
key-value pairs.

Each key is an [idempotency key](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency)
that uniquely identifies the create request. Each value contains the customer data used to create the
customer profile. | getCustomers(): array | setCustomers(array customers): void | + +## Example (as JSON) + +```json +{ + "customers": { + "8bb76c4f-e35d-4c5b-90de-1194cd9179f0": { + "address": { + "address_line_1": "500 Electric Ave", + "address_line_2": "Suite 600", + "administrative_district_level_1": "NY", + "country": "US", + "locality": "New York", + "postal_code": "10003" + }, + "email_address": "Amelia.Earhart@example.com", + "family_name": "Earhart", + "given_name": "Amelia", + "note": "a customer", + "phone_number": "+1-212-555-4240", + "reference_id": "YOUR_REFERENCE_ID", + "company_name": "company_name8", + "nickname": "nickname8" + }, + "d1689f23-b25d-4932-b2f0-aed00f5e2029": { + "address": { + "address_line_1": "500 Electric Ave", + "address_line_2": "Suite 601", + "administrative_district_level_1": "NY", + "country": "US", + "locality": "New York", + "postal_code": "10003" + }, + "email_address": "Marie.Curie@example.com", + "family_name": "Curie", + "given_name": "Marie", + "note": "another customer", + "phone_number": "+1-212-444-4240", + "reference_id": "YOUR_REFERENCE_ID", + "company_name": "company_name8", + "nickname": "nickname8" + } + } +} +``` + diff --git a/doc/models/bulk-create-customers-response.md b/doc/models/bulk-create-customers-response.md new file mode 100644 index 00000000..07a6faec --- /dev/null +++ b/doc/models/bulk-create-customers-response.md @@ -0,0 +1,150 @@ + +# Bulk Create Customers Response + +Defines the fields included in the response body from the +[BulkCreateCustomers](../../doc/apis/customers.md#bulk-create-customers) endpoint. + +## Structure + +`BulkCreateCustomersResponse` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `responses` | [`?array`](../../doc/models/create-customer-response.md) | Optional | A map of responses that correspond to individual create requests, represented by
key-value pairs.

Each key is the idempotency key that was provided for a create request and each value
is the corresponding response.
If the request succeeds, the value is the new customer profile.
If the request fails, the value contains any errors that occurred during the request. | getResponses(): ?array | setResponses(?array responses): void | +| `errors` | [`?(Error[])`](../../doc/models/error.md) | Optional | Any top-level errors that prevented the bulk operation from running. | getErrors(): ?array | setErrors(?array errors): void | + +## Example (as JSON) + +```json +{ + "responses": { + "8bb76c4f-e35d-4c5b-90de-1194cd9179f4": { + "customer": { + "address": { + "address_line_1": "500 Electric Ave", + "address_line_2": "Suite 600", + "administrative_district_level_1": "NY", + "country": "US", + "locality": "New York", + "postal_code": "10003" + }, + "created_at": "2024-03-23T20:21:54.859Z", + "creation_source": "THIRD_PARTY", + "email_address": "Amelia.Earhart@example.com", + "family_name": "Earhart", + "given_name": "Amelia", + "id": "8DDA5NZVBZFGAX0V3HPF81HHE0", + "note": "a customer", + "phone_number": "+1-212-555-4240", + "preferences": { + "email_unsubscribed": false + }, + "reference_id": "YOUR_REFERENCE_ID", + "updated_at": "2024-03-23T20:21:54.859Z", + "version": 0, + "cards": [ + { + "id": "id8", + "card_brand": "DISCOVER", + "last_4": "last_40", + "exp_month": 152, + "exp_year": 144 + } + ] + }, + "errors": [ + { + "category": "MERCHANT_SUBSCRIPTION_ERROR", + "code": "MAP_KEY_LENGTH_TOO_LONG", + "detail": "detail6", + "field": "field4" + }, + { + "category": "MERCHANT_SUBSCRIPTION_ERROR", + "code": "MAP_KEY_LENGTH_TOO_LONG", + "detail": "detail6", + "field": "field4" + }, + { + "category": "MERCHANT_SUBSCRIPTION_ERROR", + "code": "MAP_KEY_LENGTH_TOO_LONG", + "detail": "detail6", + "field": "field4" + } + ] + }, + "d1689f23-b25d-4932-b2f0-aed00f5e2029": { + "customer": { + "address": { + "address_line_1": "500 Electric Ave", + "address_line_2": "Suite 601", + "administrative_district_level_1": "NY", + "country": "US", + "locality": "New York", + "postal_code": "10003" + }, + "created_at": "2024-03-23T20:21:54.859Z", + "creation_source": "THIRD_PARTY", + "email_address": "Marie.Curie@example.com", + "family_name": "Curie", + "given_name": "Marie", + "id": "N18CPRVXR5214XPBBA6BZQWF3C", + "note": "another customer", + "phone_number": "+1-212-444-4240", + "preferences": { + "email_unsubscribed": false + }, + "reference_id": "YOUR_REFERENCE_ID", + "updated_at": "2024-03-23T20:21:54.859Z", + "version": 0, + "cards": [ + { + "id": "id8", + "card_brand": "DISCOVER", + "last_4": "last_40", + "exp_month": 152, + "exp_year": 144 + } + ] + }, + "errors": [ + { + "category": "MERCHANT_SUBSCRIPTION_ERROR", + "code": "MAP_KEY_LENGTH_TOO_LONG", + "detail": "detail6", + "field": "field4" + }, + { + "category": "MERCHANT_SUBSCRIPTION_ERROR", + "code": "MAP_KEY_LENGTH_TOO_LONG", + "detail": "detail6", + "field": "field4" + }, + { + "category": "MERCHANT_SUBSCRIPTION_ERROR", + "code": "MAP_KEY_LENGTH_TOO_LONG", + "detail": "detail6", + "field": "field4" + } + ] + } + }, + "errors": [ + { + "category": "MERCHANT_SUBSCRIPTION_ERROR", + "code": "MAP_KEY_LENGTH_TOO_LONG", + "detail": "detail6", + "field": "field4" + }, + { + "category": "MERCHANT_SUBSCRIPTION_ERROR", + "code": "MAP_KEY_LENGTH_TOO_LONG", + "detail": "detail6", + "field": "field4" + } + ] +} +``` + diff --git a/doc/models/bulk-delete-customers-request.md b/doc/models/bulk-delete-customers-request.md new file mode 100644 index 00000000..856ecddf --- /dev/null +++ b/doc/models/bulk-delete-customers-request.md @@ -0,0 +1,28 @@ + +# Bulk Delete Customers Request + +Defines the body parameters that can be included in requests to the +[BulkDeleteCustomers](../../doc/apis/customers.md#bulk-delete-customers) endpoint. + +## Structure + +`BulkDeleteCustomersRequest` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `customerIds` | `string[]` | Required | The IDs of the [customer profiles](entity:Customer) to delete. | getCustomerIds(): array | setCustomerIds(array customerIds): void | + +## Example (as JSON) + +```json +{ + "customer_ids": [ + "8DDA5NZVBZFGAX0V3HPF81HHE0", + "N18CPRVXR5214XPBBA6BZQWF3C", + "2GYD7WNXF7BJZW1PMGNXZ3Y8M8" + ] +} +``` + diff --git a/doc/models/bulk-delete-customers-response.md b/doc/models/bulk-delete-customers-response.md new file mode 100644 index 00000000..5a1fbdde --- /dev/null +++ b/doc/models/bulk-delete-customers-response.md @@ -0,0 +1,94 @@ + +# Bulk Delete Customers Response + +Defines the fields included in the response body from the +[BulkDeleteCustomers](../../doc/apis/customers.md#bulk-delete-customers) endpoint. + +## Structure + +`BulkDeleteCustomersResponse` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `responses` | [`?array`](../../doc/models/delete-customer-response.md) | Optional | A map of responses that correspond to individual delete requests, represented by
key-value pairs.

Each key is the customer ID that was specified for a delete request and each value
is the corresponding response.
If the request succeeds, the value is an empty object (`{ }`).
If the request fails, the value contains any errors that occurred during the request. | getResponses(): ?array | setResponses(?array responses): void | +| `errors` | [`?(Error[])`](../../doc/models/error.md) | Optional | Any top-level errors that prevented the bulk operation from running. | getErrors(): ?array | setErrors(?array errors): void | + +## Example (as JSON) + +```json +{ + "responses": { + "2GYD7WNXF7BJZW1PMGNXZ3Y8M8": { + "errors": [ + { + "category": "INVALID_REQUEST_ERROR", + "code": "NOT_FOUND", + "detail": "Customer with ID `2GYD7WNXF7BJZW1PMGNXZ3Y8M8` not found.", + "field": "field4" + } + ] + }, + "8DDA5NZVBZFGAX0V3HPF81HHE0": { + "errors": [ + { + "category": "MERCHANT_SUBSCRIPTION_ERROR", + "code": "MAP_KEY_LENGTH_TOO_LONG", + "detail": "detail6", + "field": "field4" + }, + { + "category": "MERCHANT_SUBSCRIPTION_ERROR", + "code": "MAP_KEY_LENGTH_TOO_LONG", + "detail": "detail6", + "field": "field4" + }, + { + "category": "MERCHANT_SUBSCRIPTION_ERROR", + "code": "MAP_KEY_LENGTH_TOO_LONG", + "detail": "detail6", + "field": "field4" + } + ] + }, + "N18CPRVXR5214XPBBA6BZQWF3C": { + "errors": [ + { + "category": "MERCHANT_SUBSCRIPTION_ERROR", + "code": "MAP_KEY_LENGTH_TOO_LONG", + "detail": "detail6", + "field": "field4" + }, + { + "category": "MERCHANT_SUBSCRIPTION_ERROR", + "code": "MAP_KEY_LENGTH_TOO_LONG", + "detail": "detail6", + "field": "field4" + }, + { + "category": "MERCHANT_SUBSCRIPTION_ERROR", + "code": "MAP_KEY_LENGTH_TOO_LONG", + "detail": "detail6", + "field": "field4" + } + ] + } + }, + "errors": [ + { + "category": "MERCHANT_SUBSCRIPTION_ERROR", + "code": "MAP_KEY_LENGTH_TOO_LONG", + "detail": "detail6", + "field": "field4" + }, + { + "category": "MERCHANT_SUBSCRIPTION_ERROR", + "code": "MAP_KEY_LENGTH_TOO_LONG", + "detail": "detail6", + "field": "field4" + } + ] +} +``` + diff --git a/doc/models/bulk-retrieve-customers-request.md b/doc/models/bulk-retrieve-customers-request.md new file mode 100644 index 00000000..91dfa9da --- /dev/null +++ b/doc/models/bulk-retrieve-customers-request.md @@ -0,0 +1,28 @@ + +# Bulk Retrieve Customers Request + +Defines the body parameters that can be included in requests to the +[BulkRetrieveCustomers](../../doc/apis/customers.md#bulk-retrieve-customers) endpoint. + +## Structure + +`BulkRetrieveCustomersRequest` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `customerIds` | `string[]` | Required | The IDs of the [customer profiles](entity:Customer) to retrieve. | getCustomerIds(): array | setCustomerIds(array customerIds): void | + +## Example (as JSON) + +```json +{ + "customer_ids": [ + "8DDA5NZVBZFGAX0V3HPF81HHE0", + "N18CPRVXR5214XPBBA6BZQWF3C", + "2GYD7WNXF7BJZW1PMGNXZ3Y8M8" + ] +} +``` + diff --git a/doc/models/bulk-retrieve-customers-response.md b/doc/models/bulk-retrieve-customers-response.md new file mode 100644 index 00000000..cf5fcb1f --- /dev/null +++ b/doc/models/bulk-retrieve-customers-response.md @@ -0,0 +1,142 @@ + +# Bulk Retrieve Customers Response + +Defines the fields included in the response body from the +[BulkRetrieveCustomers](../../doc/apis/customers.md#bulk-retrieve-customers) endpoint. + +## Structure + +`BulkRetrieveCustomersResponse` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `responses` | [`?array`](../../doc/models/retrieve-customer-response.md) | Optional | A map of responses that correspond to individual retrieve requests, represented by
key-value pairs.

Each key is the customer ID that was specified for a retrieve request and each value
is the corresponding response.
If the request succeeds, the value is the requested customer profile.
If the request fails, the value contains any errors that occurred during the request. | getResponses(): ?array | setResponses(?array responses): void | +| `errors` | [`?(Error[])`](../../doc/models/error.md) | Optional | Any top-level errors that prevented the bulk operation from running. | getErrors(): ?array | setErrors(?array errors): void | + +## Example (as JSON) + +```json +{ + "responses": { + "2GYD7WNXF7BJZW1PMGNXZ3Y8M8": { + "errors": [ + { + "category": "INVALID_REQUEST_ERROR", + "code": "NOT_FOUND", + "detail": "Customer with ID `2GYD7WNXF7BJZW1PMGNXZ3Y8M8` not found.", + "field": "field4" + } + ], + "customer": { + "id": "id0", + "created_at": "created_at2", + "updated_at": "updated_at4", + "cards": [ + { + "id": "id8", + "card_brand": "DISCOVER", + "last_4": "last_40", + "exp_month": 152, + "exp_year": 144 + } + ], + "given_name": "given_name2" + } + }, + "8DDA5NZVBZFGAX0V3HPF81HHE0": { + "customer": { + "birthday": "1897-07-24", + "created_at": "2024-01-19T00:27:54.59Z", + "creation_source": "THIRD_PARTY", + "email_address": "New.Amelia.Earhart@example.com", + "family_name": "Earhart", + "given_name": "Amelia", + "id": "8DDA5NZVBZFGAX0V3HPF81HHE0", + "note": "updated customer note", + "preferences": { + "email_unsubscribed": false + }, + "updated_at": "2024-01-19T00:38:06Z", + "version": 3 + }, + "errors": [ + { + "category": "MERCHANT_SUBSCRIPTION_ERROR", + "code": "MAP_KEY_LENGTH_TOO_LONG", + "detail": "detail6", + "field": "field4" + }, + { + "category": "MERCHANT_SUBSCRIPTION_ERROR", + "code": "MAP_KEY_LENGTH_TOO_LONG", + "detail": "detail6", + "field": "field4" + }, + { + "category": "MERCHANT_SUBSCRIPTION_ERROR", + "code": "MAP_KEY_LENGTH_TOO_LONG", + "detail": "detail6", + "field": "field4" + } + ] + }, + "N18CPRVXR5214XPBBA6BZQWF3C": { + "customer": { + "created_at": "2024-01-19T00:27:54.59Z", + "creation_source": "THIRD_PARTY", + "family_name": "Curie", + "given_name": "Marie", + "id": "N18CPRVXR5214XPBBA6BZQWF3C", + "preferences": { + "email_unsubscribed": false + }, + "updated_at": "2024-01-19T00:38:06Z", + "version": 1 + }, + "errors": [ + { + "category": "MERCHANT_SUBSCRIPTION_ERROR", + "code": "MAP_KEY_LENGTH_TOO_LONG", + "detail": "detail6", + "field": "field4" + }, + { + "category": "MERCHANT_SUBSCRIPTION_ERROR", + "code": "MAP_KEY_LENGTH_TOO_LONG", + "detail": "detail6", + "field": "field4" + }, + { + "category": "MERCHANT_SUBSCRIPTION_ERROR", + "code": "MAP_KEY_LENGTH_TOO_LONG", + "detail": "detail6", + "field": "field4" + } + ] + } + }, + "errors": [ + { + "category": "MERCHANT_SUBSCRIPTION_ERROR", + "code": "MAP_KEY_LENGTH_TOO_LONG", + "detail": "detail6", + "field": "field4" + }, + { + "category": "MERCHANT_SUBSCRIPTION_ERROR", + "code": "MAP_KEY_LENGTH_TOO_LONG", + "detail": "detail6", + "field": "field4" + }, + { + "category": "MERCHANT_SUBSCRIPTION_ERROR", + "code": "MAP_KEY_LENGTH_TOO_LONG", + "detail": "detail6", + "field": "field4" + } + ] +} +``` + diff --git a/doc/models/bulk-update-customer-data.md b/doc/models/bulk-update-customer-data.md new file mode 100644 index 00000000..86897afb --- /dev/null +++ b/doc/models/bulk-update-customer-data.md @@ -0,0 +1,39 @@ + +# Bulk Update Customer Data + +Defines the customer data provided in individual update requests for a +[BulkUpdateCustomers](../../doc/apis/customers.md#bulk-update-customers) operation. + +## Structure + +`BulkUpdateCustomerData` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `givenName` | `?string` | Optional | The given name (that is, the first name) associated with the customer profile.
**Constraints**: *Maximum Length*: `300` | getGivenName(): ?string | setGivenName(?string givenName): void | +| `familyName` | `?string` | Optional | The family name (that is, the last name) associated with the customer profile.
**Constraints**: *Maximum Length*: `300` | getFamilyName(): ?string | setFamilyName(?string familyName): void | +| `companyName` | `?string` | Optional | A business name associated with the customer profile.
**Constraints**: *Maximum Length*: `500` | getCompanyName(): ?string | setCompanyName(?string companyName): void | +| `nickname` | `?string` | Optional | A nickname for the customer profile.
**Constraints**: *Maximum Length*: `100` | getNickname(): ?string | setNickname(?string nickname): void | +| `emailAddress` | `?string` | Optional | The email address associated with the customer profile.
**Constraints**: *Maximum Length*: `254` | getEmailAddress(): ?string | setEmailAddress(?string emailAddress): void | +| `address` | [`?Address`](../../doc/models/address.md) | Optional | Represents a postal address in a country.
For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). | getAddress(): ?Address | setAddress(?Address address): void | +| `phoneNumber` | `?string` | Optional | The phone number associated with the customer profile. The phone number must be valid
and can contain 9–16 digits, with an optional `+` prefix and country code. For more information,
see [Customer phone numbers](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#phone-number). | getPhoneNumber(): ?string | setPhoneNumber(?string phoneNumber): void | +| `referenceId` | `?string` | Optional | An optional second ID used to associate the customer profile with an
entity in another system.
**Constraints**: *Maximum Length*: `100` | getReferenceId(): ?string | setReferenceId(?string referenceId): void | +| `note` | `?string` | Optional | An custom note associates with the customer profile. | getNote(): ?string | setNote(?string note): void | +| `birthday` | `?string` | Optional | The birthday associated with the customer profile, in `YYYY-MM-DD` or `MM-DD` format.
For example, specify `1998-09-21` for September 21, 1998, or `09-21` for September 21.
Birthdays are returned in `YYYY-MM-DD` format, where `YYYY` is the specified birth year or
`0000` if a birth year is not specified. | getBirthday(): ?string | setBirthday(?string birthday): void | +| `taxIds` | [`?CustomerTaxIds`](../../doc/models/customer-tax-ids.md) | Optional | Represents the tax ID associated with a [customer profile](../../doc/models/customer.md). The corresponding `tax_ids` field is available only for customers of sellers in EU countries or the United Kingdom.
For more information, see [Customer tax IDs](https://developer.squareup.com/docs/customers-api/what-it-does#customer-tax-ids). | getTaxIds(): ?CustomerTaxIds | setTaxIds(?CustomerTaxIds taxIds): void | +| `version` | `?int` | Optional | The current version of the customer profile.

As a best practice, you should include this field to enable
[optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)
control. | getVersion(): ?int | setVersion(?int version): void | + +## Example (as JSON) + +```json +{ + "given_name": "given_name4", + "family_name": "family_name4", + "company_name": "company_name8", + "nickname": "nickname8", + "email_address": "email_address0" +} +``` + diff --git a/doc/models/bulk-update-customers-request.md b/doc/models/bulk-update-customers-request.md new file mode 100644 index 00000000..7e040b96 --- /dev/null +++ b/doc/models/bulk-update-customers-request.md @@ -0,0 +1,43 @@ + +# Bulk Update Customers Request + +Defines the body parameters that can be included in requests to the +[BulkUpdateCustomers](../../doc/apis/customers.md#bulk-update-customers) endpoint. + +## Structure + +`BulkUpdateCustomersRequest` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `customers` | [`array`](../../doc/models/bulk-update-customer-data.md) | Required | A map of 1 to 100 individual update requests, represented by `customer ID: { customer data }`
key-value pairs.

Each key is the ID of the [customer profile](entity:Customer) to update. To update a customer profile
that was created by merging existing profiles, provide the ID of the newly created profile.

Each value contains the updated customer data. Only new or changed fields are required. To add or
update a field, specify the new value. To remove a field, specify `null`. | getCustomers(): array | setCustomers(array customers): void | + +## Example (as JSON) + +```json +{ + "customers": { + "8DDA5NZVBZFGAX0V3HPF81HHE0": { + "email_address": "New.Amelia.Earhart@example.com", + "note": "updated customer note", + "phone_number": null, + "version": 2, + "given_name": "given_name4", + "family_name": "family_name6", + "company_name": "company_name8", + "nickname": "nickname8" + }, + "N18CPRVXR5214XPBBA6BZQWF3C": { + "family_name": "Curie", + "given_name": "Marie", + "version": 0, + "company_name": "company_name8", + "nickname": "nickname8", + "email_address": "email_address0" + } + } +} +``` + diff --git a/doc/models/bulk-update-customers-response.md b/doc/models/bulk-update-customers-response.md new file mode 100644 index 00000000..f2a22801 --- /dev/null +++ b/doc/models/bulk-update-customers-response.md @@ -0,0 +1,135 @@ + +# Bulk Update Customers Response + +Defines the fields included in the response body from the +[BulkUpdateCustomers](../../doc/apis/customers.md#bulk-update-customers) endpoint. + +## Structure + +`BulkUpdateCustomersResponse` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `responses` | [`?array`](../../doc/models/update-customer-response.md) | Optional | A map of responses that correspond to individual update requests, represented by
key-value pairs.

Each key is the customer ID that was specified for an update request and each value
is the corresponding response.
If the request succeeds, the value is the updated customer profile.
If the request fails, the value contains any errors that occurred during the request. | getResponses(): ?array | setResponses(?array responses): void | +| `errors` | [`?(Error[])`](../../doc/models/error.md) | Optional | Any top-level errors that prevented the bulk operation from running. | getErrors(): ?array | setErrors(?array errors): void | + +## Example (as JSON) + +```json +{ + "responses": { + "8DDA5NZVBZFGAX0V3HPF81HHE0": { + "customer": { + "birthday": "1897-07-24", + "created_at": "2024-01-19T00:27:54.59Z", + "creation_source": "THIRD_PARTY", + "email_address": "New.Amelia.Earhart@example.com", + "family_name": "Earhart", + "given_name": "Amelia", + "id": "8DDA5NZVBZFGAX0V3HPF81HHE0", + "note": "updated customer note", + "preferences": { + "email_unsubscribed": false + }, + "updated_at": "2024-01-19T00:38:06Z", + "version": 3, + "cards": [ + { + "id": "id8", + "card_brand": "DISCOVER", + "last_4": "last_40", + "exp_month": 152, + "exp_year": 144 + } + ] + }, + "errors": [ + { + "category": "MERCHANT_SUBSCRIPTION_ERROR", + "code": "MAP_KEY_LENGTH_TOO_LONG", + "detail": "detail6", + "field": "field4" + }, + { + "category": "MERCHANT_SUBSCRIPTION_ERROR", + "code": "MAP_KEY_LENGTH_TOO_LONG", + "detail": "detail6", + "field": "field4" + }, + { + "category": "MERCHANT_SUBSCRIPTION_ERROR", + "code": "MAP_KEY_LENGTH_TOO_LONG", + "detail": "detail6", + "field": "field4" + } + ] + }, + "N18CPRVXR5214XPBBA6BZQWF3C": { + "customer": { + "created_at": "2024-01-19T00:27:54.59Z", + "creation_source": "THIRD_PARTY", + "family_name": "Curie", + "given_name": "Marie", + "id": "N18CPRVXR5214XPBBA6BZQWF3C", + "preferences": { + "email_unsubscribed": false + }, + "updated_at": "2024-01-19T00:38:06Z", + "version": 1, + "cards": [ + { + "id": "id8", + "card_brand": "DISCOVER", + "last_4": "last_40", + "exp_month": 152, + "exp_year": 144 + } + ] + }, + "errors": [ + { + "category": "MERCHANT_SUBSCRIPTION_ERROR", + "code": "MAP_KEY_LENGTH_TOO_LONG", + "detail": "detail6", + "field": "field4" + }, + { + "category": "MERCHANT_SUBSCRIPTION_ERROR", + "code": "MAP_KEY_LENGTH_TOO_LONG", + "detail": "detail6", + "field": "field4" + }, + { + "category": "MERCHANT_SUBSCRIPTION_ERROR", + "code": "MAP_KEY_LENGTH_TOO_LONG", + "detail": "detail6", + "field": "field4" + } + ] + } + }, + "errors": [ + { + "category": "MERCHANT_SUBSCRIPTION_ERROR", + "code": "MAP_KEY_LENGTH_TOO_LONG", + "detail": "detail6", + "field": "field4" + }, + { + "category": "MERCHANT_SUBSCRIPTION_ERROR", + "code": "MAP_KEY_LENGTH_TOO_LONG", + "detail": "detail6", + "field": "field4" + }, + { + "category": "MERCHANT_SUBSCRIPTION_ERROR", + "code": "MAP_KEY_LENGTH_TOO_LONG", + "detail": "detail6", + "field": "field4" + } + ] +} +``` + diff --git a/doc/models/catalog-item-modifier-list-info.md b/doc/models/catalog-item-modifier-list-info.md index b0d5c590..225ecf2e 100644 --- a/doc/models/catalog-item-modifier-list-info.md +++ b/doc/models/catalog-item-modifier-list-info.md @@ -1,7 +1,8 @@ # Catalog Item Modifier List Info -Options to control the properties of a `CatalogModifierList` applied to a `CatalogItem` instance. +References a text-based modifier or a list of non text-based modifiers applied to a `CatalogItem` instance +and specifies supported behaviors of the application. ## Structure @@ -16,6 +17,7 @@ Options to control the properties of a `CatalogModifierList` applied to a `Catal | `minSelectedModifiers` | `?int` | Optional | If 0 or larger, the smallest number of `CatalogModifier`s that must be selected from this `CatalogModifierList`. | getMinSelectedModifiers(): ?int | setMinSelectedModifiers(?int minSelectedModifiers): void | | `maxSelectedModifiers` | `?int` | Optional | If 0 or larger, the largest number of `CatalogModifier`s that can be selected from this `CatalogModifierList`. | getMaxSelectedModifiers(): ?int | setMaxSelectedModifiers(?int maxSelectedModifiers): void | | `enabled` | `?bool` | Optional | If `true`, enable this `CatalogModifierList`. The default value is `true`. | getEnabled(): ?bool | setEnabled(?bool enabled): void | +| `ordinal` | `?int` | Optional | The position of this `CatalogItemModifierListInfo` object within the `modifier_list_info` list applied
to a `CatalogItem` instance. | getOrdinal(): ?int | setOrdinal(?int ordinal): void | ## Example (as JSON) @@ -34,7 +36,8 @@ Options to control the properties of a `CatalogModifierList` applied to a `Catal ], "min_selected_modifiers": 170, "max_selected_modifiers": 66, - "enabled": false + "enabled": false, + "ordinal": 204 } ``` diff --git a/doc/models/catalog-modifier-list-modifier-type.md b/doc/models/catalog-modifier-list-modifier-type.md new file mode 100644 index 00000000..eede3572 --- /dev/null +++ b/doc/models/catalog-modifier-list-modifier-type.md @@ -0,0 +1,16 @@ + +# Catalog Modifier List Modifier Type + +Defines the type of `CatalogModifierList`. + +## Enumeration + +`CatalogModifierListModifierType` + +## Fields + +| Name | Description | +| --- | --- | +| `LIST` | The `CatalogModifierList` instance is a non-empty list of non text-based modifiers. | +| `TEXT` | The `CatalogModifierList` instance is a single text-based modifier. | + diff --git a/doc/models/catalog-modifier-list.md b/doc/models/catalog-modifier-list.md index 222ed27b..68c8e22c 100644 --- a/doc/models/catalog-modifier-list.md +++ b/doc/models/catalog-modifier-list.md @@ -1,12 +1,18 @@ # Catalog Modifier List -A list of modifiers applicable to items at the time of sale. +For a text-based modifier, this encapsulates the modifier's text when its `modifier_type` is `TEXT`. +For example, to sell T-shirts with custom prints, a text-based modifier can be used to capture the buyer-supplied +text string to be selected for the T-shirt at the time of sale. +For non text-based modifiers, this encapsulates a non-empty list of modifiers applicable to items +at the time of sale. Each element of the modifier list is a `CatalogObject` instance of the `MODIFIER` type. For example, a "Condiments" modifier list applicable to a "Hot Dog" item may contain "Ketchup", "Mustard", and "Relish" modifiers. -Use the `selection_type` field to specify whether or not multiple selections from -the modifier list are allowed. + +A non text-based modifier can be applied to the modified item once or multiple times, if the `selection_type` field +is set to `SINGLE` or `MULTIPLE`, respectively. On the other hand, a text-based modifier can be applied to the item +only once and the `selection_type` field is always set to `SINGLE`. ## Structure @@ -16,11 +22,15 @@ the modifier list are allowed. | Name | Type | Tags | Description | Getter | Setter | | --- | --- | --- | --- | --- | --- | -| `name` | `?string` | Optional | The name for the `CatalogModifierList` instance. This is a searchable attribute for use in applicable query filters, and its value length is of Unicode code points.
**Constraints**: *Maximum Length*: `255` | getName(): ?string | setName(?string name): void | -| `ordinal` | `?int` | Optional | Determines where this modifier list appears in a list of `CatalogModifierList` values. | getOrdinal(): ?int | setOrdinal(?int ordinal): void | +| `name` | `?string` | Optional | The name of the `CatalogModifierList` instance. This is a searchable attribute for use in applicable query filters, and its value length is of
Unicode code points.
**Constraints**: *Maximum Length*: `255` | getName(): ?string | setName(?string name): void | +| `ordinal` | `?int` | Optional | The position of this `CatalogModifierList` within a list of `CatalogModifierList` instances. | getOrdinal(): ?int | setOrdinal(?int ordinal): void | | `selectionType` | [`?string(CatalogModifierListSelectionType)`](../../doc/models/catalog-modifier-list-selection-type.md) | Optional | Indicates whether a CatalogModifierList supports multiple selections. | getSelectionType(): ?string | setSelectionType(?string selectionType): void | -| `modifiers` | [`?(CatalogObject[])`](../../doc/models/catalog-object.md) | Optional | The options included in the `CatalogModifierList`.
You must include at least one `CatalogModifier`.
Each CatalogObject must have type `MODIFIER` and contain
`CatalogModifier` data. | getModifiers(): ?array | setModifiers(?array modifiers): void | -| `imageIds` | `?(string[])` | Optional | The IDs of images associated with this `CatalogModifierList` instance.
Currently these images are not displayed by Square, but are free to be displayed in 3rd party applications. | getImageIds(): ?array | setImageIds(?array imageIds): void | +| `modifiers` | [`?(CatalogObject[])`](../../doc/models/catalog-object.md) | Optional | A non-empty list of `CatalogModifier` objects to be included in the `CatalogModifierList`,
for non text-based modifiers when the `modifier_type` attribute is `LIST`. Each element of this list
is a `CatalogObject` instance of the `MODIFIER` type, containing the following attributes:

```
{
"id": "{{catalog_modifier_id}}",
"type": "MODIFIER",
"modifier_data": {{a CatalogModifier instance>}}
}
``` | getModifiers(): ?array | setModifiers(?array modifiers): void | +| `imageIds` | `?(string[])` | Optional | The IDs of images associated with this `CatalogModifierList` instance.
Currently these images are not displayed on Square products, but may be displayed in 3rd-party applications. | getImageIds(): ?array | setImageIds(?array imageIds): void | +| `modifierType` | [`?string(CatalogModifierListModifierType)`](../../doc/models/catalog-modifier-list-modifier-type.md) | Optional | Defines the type of `CatalogModifierList`. | getModifierType(): ?string | setModifierType(?string modifierType): void | +| `maxLength` | `?int` | Optional | The maximum length, in Unicode points, of the text string of the text-based modifier as represented by
this `CatalogModifierList` object with the `modifier_type` set to `TEXT`. | getMaxLength(): ?int | setMaxLength(?int maxLength): void | +| `textRequired` | `?bool` | Optional | Whether the text string must be a non-empty string (`true`) or not (`false`) for a text-based modifier
as represented by this `CatalogModifierList` object with the `modifier_type` set to `TEXT`. | getTextRequired(): ?bool | setTextRequired(?bool textRequired): void | +| `internalName` | `?string` | Optional | A note for internal use by the business.

For example, for a text-based modifier applied to a T-shirt item, if the buyer-supplied text of "Hello, Kitty!"
is to be printed on the T-shirt, this `internal_name` attribute can be "Use italic face" as
an instruction for the business to follow.

For non text-based modifiers, this `internal_name` attribute can be
used to include SKUs, internal codes, or supplemental descriptions for internal use.
**Constraints**: *Maximum Length*: `512` | getInternalName(): ?string | setInternalName(?string internalName): void | ## Example (as JSON) diff --git a/doc/models/catalog-object.md b/doc/models/catalog-object.md index 478c4c5e..e1470eb1 100644 --- a/doc/models/catalog-object.md +++ b/doc/models/catalog-object.md @@ -35,7 +35,7 @@ For a more detailed discussion of the Catalog data model, please see the | `itemVariationData` | [`?CatalogItemVariation`](../../doc/models/catalog-item-variation.md) | Optional | An item variation, representing a product for sale, in the Catalog object model. Each [item](../../doc/models/catalog-item.md) must have at least one
item variation and can have at most 250 item variations.

An item variation can be sellable, stockable, or both if it has a unit of measure for its count for the sold number of the variation, the stocked
number of the variation, or both. For example, when a variation representing wine is stocked and sold by the bottle, the variation is both
stockable and sellable. But when a variation of the wine is sold by the glass, the sold units cannot be used as a measure of the stocked units. This by-the-glass
variation is sellable, but not stockable. To accurately keep track of the wine's inventory count at any time, the sellable count must be
converted to stockable count. Typically, the seller defines this unit conversion. For example, 1 bottle equals 5 glasses. The Square API exposes
the `stockable_conversion` property on the variation to specify the conversion. Thus, when two glasses of the wine are sold, the sellable count
decreases by 2, and the stockable count automatically decreases by 0.4 bottle according to the conversion. | getItemVariationData(): ?CatalogItemVariation | setItemVariationData(?CatalogItemVariation itemVariationData): void | | `taxData` | [`?CatalogTax`](../../doc/models/catalog-tax.md) | Optional | A tax applicable to an item. | getTaxData(): ?CatalogTax | setTaxData(?CatalogTax taxData): void | | `discountData` | [`?CatalogDiscount`](../../doc/models/catalog-discount.md) | Optional | A discount applicable to items. | getDiscountData(): ?CatalogDiscount | setDiscountData(?CatalogDiscount discountData): void | -| `modifierListData` | [`?CatalogModifierList`](../../doc/models/catalog-modifier-list.md) | Optional | A list of modifiers applicable to items at the time of sale.

For example, a "Condiments" modifier list applicable to a "Hot Dog" item
may contain "Ketchup", "Mustard", and "Relish" modifiers.
Use the `selection_type` field to specify whether or not multiple selections from
the modifier list are allowed. | getModifierListData(): ?CatalogModifierList | setModifierListData(?CatalogModifierList modifierListData): void | +| `modifierListData` | [`?CatalogModifierList`](../../doc/models/catalog-modifier-list.md) | Optional | For a text-based modifier, this encapsulates the modifier's text when its `modifier_type` is `TEXT`.
For example, to sell T-shirts with custom prints, a text-based modifier can be used to capture the buyer-supplied
text string to be selected for the T-shirt at the time of sale.

For non text-based modifiers, this encapsulates a non-empty list of modifiers applicable to items
at the time of sale. Each element of the modifier list is a `CatalogObject` instance of the `MODIFIER` type.
For example, a "Condiments" modifier list applicable to a "Hot Dog" item
may contain "Ketchup", "Mustard", and "Relish" modifiers.

A non text-based modifier can be applied to the modified item once or multiple times, if the `selection_type` field
is set to `SINGLE` or `MULTIPLE`, respectively. On the other hand, a text-based modifier can be applied to the item
only once and the `selection_type` field is always set to `SINGLE`. | getModifierListData(): ?CatalogModifierList | setModifierListData(?CatalogModifierList modifierListData): void | | `modifierData` | [`?CatalogModifier`](../../doc/models/catalog-modifier.md) | Optional | A modifier applicable to items at the time of sale. An example of a modifier is a Cheese add-on to a Burger item. | getModifierData(): ?CatalogModifier | setModifierData(?CatalogModifier modifierData): void | | `timePeriodData` | [`?CatalogTimePeriod`](../../doc/models/catalog-time-period.md) | Optional | Represents a time period - either a single period or a repeating period. | getTimePeriodData(): ?CatalogTimePeriod | setTimePeriodData(?CatalogTimePeriod timePeriodData): void | | `productSetData` | [`?CatalogProductSet`](../../doc/models/catalog-product-set.md) | Optional | Represents a collection of catalog objects for the purpose of applying a
`PricingRule`. Including a catalog object will include all of its subtypes.
For example, including a category in a product set will include all of its
items and associated item variations in the product set. Including an item in
a product set will also include its item variations. | getProductSetData(): ?CatalogProductSet | setProductSetData(?CatalogProductSet productSetData): void | diff --git a/doc/models/create-customer-response.md b/doc/models/create-customer-response.md index 1c9d583a..00e21aa3 100644 --- a/doc/models/create-customer-response.md +++ b/doc/models/create-customer-response.md @@ -2,7 +2,8 @@ # Create Customer Response Defines the fields that are included in the response body of -a request to the `CreateCustomer` endpoint. +a request to the [CreateCustomer](../../doc/apis/customers.md#create-customer) or +[BulkCreateCustomers](../../doc/apis/customers.md#bulk-create-customers) endpoint. Either `errors` or `customer` is present in a given response (never both). diff --git a/doc/models/list-payment-links-request.md b/doc/models/list-payment-links-request.md index 17b56d12..f78cfc3a 100644 --- a/doc/models/list-payment-links-request.md +++ b/doc/models/list-payment-links-request.md @@ -9,7 +9,7 @@ | Name | Type | Tags | Description | Getter | Setter | | --- | --- | --- | --- | --- | --- | -| `cursor` | `?string` | Optional | A pagination cursor returned by a previous call to this endpoint.
Provide this cursor to retrieve the next set of results for the original query.
If a cursor is not provided, the endpoint returns the first page of the results.
For more information, see [Pagination](https://developer.squareup.com/docs/basics/api101/pagination). | getCursor(): ?string | setCursor(?string cursor): void | +| `cursor` | `?string` | Optional | A pagination cursor returned by a previous call to this endpoint.
Provide this cursor to retrieve the next set of results for the original query.
If a cursor is not provided, the endpoint returns the first page of the results.
For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | getCursor(): ?string | setCursor(?string cursor): void | | `limit` | `?int` | Optional | A limit on the number of results to return per page. The limit is advisory and
the implementation might return more or less results. If the supplied limit is negative, zero, or
greater than the maximum limit of 1000, it is ignored.

Default value: `100` | getLimit(): ?int | setLimit(?int limit): void | ## Example (as JSON) diff --git a/doc/models/list-payment-links-response.md b/doc/models/list-payment-links-response.md index 18281bac..cca38d9b 100644 --- a/doc/models/list-payment-links-response.md +++ b/doc/models/list-payment-links-response.md @@ -11,7 +11,7 @@ | --- | --- | --- | --- | --- | --- | | `errors` | [`?(Error[])`](../../doc/models/error.md) | Optional | Errors that occurred during the request. | getErrors(): ?array | setErrors(?array errors): void | | `paymentLinks` | [`?(PaymentLink[])`](../../doc/models/payment-link.md) | Optional | The list of payment links. | getPaymentLinks(): ?array | setPaymentLinks(?array paymentLinks): void | -| `cursor` | `?string` | Optional | When a response is truncated, it includes a cursor that you can use in a subsequent request
to retrieve the next set of gift cards. If a cursor is not present, this is the final response.
For more information, see [Pagination](https://developer.squareup.com/docs/basics/api101/pagination). | getCursor(): ?string | setCursor(?string cursor): void | +| `cursor` | `?string` | Optional | When a response is truncated, it includes a cursor that you can use in a subsequent request
to retrieve the next set of gift cards. If a cursor is not present, this is the final response.
For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | getCursor(): ?string | setCursor(?string cursor): void | ## Example (as JSON) diff --git a/doc/models/order-line-item-tax.md b/doc/models/order-line-item-tax.md index b446d2f4..d46ded8e 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%.
**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%.

Either `percentage` or `amount_money` should be set, but not both.
**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/payment-balance-activity-fee-detail.md b/doc/models/payment-balance-activity-fee-detail.md index 8996750a..f8f01f34 100644 --- a/doc/models/payment-balance-activity-fee-detail.md +++ b/doc/models/payment-balance-activity-fee-detail.md @@ -9,7 +9,7 @@ | Name | Type | Tags | Description | Getter | Setter | | --- | --- | --- | --- | --- | --- | -| `paymentId` | `?string` | Optional | The ID of the payment associated with this activity. | getPaymentId(): ?string | setPaymentId(?string paymentId): void | +| `paymentId` | `?string` | Optional | The ID of the payment associated with this activity
This will only be populated when a principal LedgerEntryToken is also populated.
If the fee is independent (there is no principal LedgerEntryToken) then this will likely not
be populated. | getPaymentId(): ?string | setPaymentId(?string paymentId): void | ## Example (as JSON) diff --git a/doc/models/payment-refund.md b/doc/models/payment-refund.md index 14dbf9c1..36ff4867 100644 --- a/doc/models/payment-refund.md +++ b/doc/models/payment-refund.md @@ -16,7 +16,7 @@ the original payment and the amount of money refunded. | `status` | `?string` | Optional | The refund's status:

- `PENDING` - Awaiting approval.
- `COMPLETED` - Successfully completed.
- `REJECTED` - The refund was rejected.
- `FAILED` - An error occurred.
**Constraints**: *Maximum Length*: `50` | getStatus(): ?string | setStatus(?string status): void | | `locationId` | `?string` | Optional | The location ID associated with the payment this refund is attached to.
**Constraints**: *Maximum Length*: `50` | getLocationId(): ?string | setLocationId(?string locationId): void | | `unlinked` | `?bool` | Optional | Flag indicating whether or not the refund is linked to an existing payment in Square. | getUnlinked(): ?bool | setUnlinked(?bool unlinked): void | -| `destinationType` | `?string` | Optional | The destination type for this refund.

Current values include `CARD`, `BANK_ACCOUNT`, `WALLET`, `BUY_NOW_PAY_LATER`, `CASH`, and
`EXTERNAL`.
**Constraints**: *Maximum Length*: `50` | getDestinationType(): ?string | setDestinationType(?string destinationType): void | +| `destinationType` | `?string` | Optional | The destination type for this refund.

Current values include `CARD`, `BANK_ACCOUNT`, `WALLET`, `BUY_NOW_PAY_LATER`, `CASH`,
`EXTERNAL`, and `SQUARE_ACCOUNT`.
**Constraints**: *Maximum Length*: `50` | getDestinationType(): ?string | setDestinationType(?string destinationType): void | | `destinationDetails` | [`?DestinationDetails`](../../doc/models/destination-details.md) | Optional | Details about a refund's destination. | getDestinationDetails(): ?DestinationDetails | setDestinationDetails(?DestinationDetails destinationDetails): void | | `amountMoney` | [`Money`](../../doc/models/money.md) | Required | 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. | getAmountMoney(): Money | setAmountMoney(Money amountMoney): void | | `appFeeMoney` | [`?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. | getAppFeeMoney(): ?Money | setAppFeeMoney(?Money appFeeMoney): void | diff --git a/doc/models/payout-entry.md b/doc/models/payout-entry.md index 645f0ecf..8e035149 100644 --- a/doc/models/payout-entry.md +++ b/doc/models/payout-entry.md @@ -49,7 +49,7 @@ The total amount of the payout will equal the sum of the payout entries for a ba "id": "id8", "payout_id": "payout_id4", "effective_at": "effective_at8", - "type": "DEPOSIT_FEE", + "type": "SQUARE_CAPITAL_REVERSED_PAYMENT", "gross_amount_money": { "amount": 186, "currency": "BWP" diff --git a/doc/models/retrieve-merchant-settings-response.md b/doc/models/retrieve-merchant-settings-response.md index 5cc1bf84..dfe3a44a 100644 --- a/doc/models/retrieve-merchant-settings-response.md +++ b/doc/models/retrieve-merchant-settings-response.md @@ -20,7 +20,6 @@ "merchant_id": "MERCHANT_ID", "payment_methods": { "afterpay_clearpay": { - "available": true, "enabled": true, "item_eligibility_range": { "max": { @@ -44,15 +43,12 @@ } }, "apple_pay": { - "available": true, "enabled": true }, "cash_app_pay": { - "available": true, "enabled": true }, "google_pay": { - "available": true, "enabled": true }, "cash_app": { diff --git a/doc/models/search-orders-response.md b/doc/models/search-orders-response.md index b14456dc..78a40786 100644 --- a/doc/models/search-orders-response.md +++ b/doc/models/search-orders-response.md @@ -14,7 +14,7 @@ Either the `order_entries` or `orders` field is set, depending on whether | --- | --- | --- | --- | --- | --- | | `orderEntries` | [`?(OrderEntry[])`](../../doc/models/order-entry.md) | Optional | A list of [OrderEntries](entity:OrderEntry) that fit the query
conditions. The list is populated only if `return_entries` is set to `true` in the request. | getOrderEntries(): ?array | setOrderEntries(?array orderEntries): void | | `orders` | [`?(Order[])`](../../doc/models/order.md) | Optional | A list of
[Order](entity:Order) objects that match the query conditions. The list is populated only if
`return_entries` is set to `false` in the request. | getOrders(): ?array | setOrders(?array orders): void | -| `cursor` | `?string` | Optional | The pagination cursor to be used in a subsequent request. If unset,
this is the final response.
For more information, see [Pagination](https://developer.squareup.com/docs/basics/build-basics/common-api-patterns/pagination). | getCursor(): ?string | setCursor(?string cursor): void | +| `cursor` | `?string` | Optional | The pagination cursor to be used in a subsequent request. If unset,
this is the final response.
For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | getCursor(): ?string | setCursor(?string cursor): void | | `errors` | [`?(Error[])`](../../doc/models/error.md) | Optional | [Errors](entity:Error) encountered during the search. | getErrors(): ?array | setErrors(?array errors): void | ## Example (as JSON) diff --git a/doc/models/update-customer-request.md b/doc/models/update-customer-request.md index 71a6a616..366f22be 100644 --- a/doc/models/update-customer-request.md +++ b/doc/models/update-customer-request.md @@ -31,7 +31,7 @@ Defines the body parameters that can be included in a request to the { "email_address": "New.Amelia.Earhart@example.com", "note": "updated customer note", - "phone_number": "", + "phone_number": null, "version": 2, "given_name": "given_name0", "family_name": "family_name8", diff --git a/doc/models/update-customer-response.md b/doc/models/update-customer-response.md index 9a8daa89..919ffdef 100644 --- a/doc/models/update-customer-response.md +++ b/doc/models/update-customer-response.md @@ -2,7 +2,8 @@ # Update Customer Response Defines the fields that are included in the response body of -a request to the `UpdateCustomer` endpoint. +a request to the [UpdateCustomer](../../doc/apis/customers.md#update-customer) or +[BulkUpdateCustomers](../../doc/apis/customers.md#bulk-update-customers) endpoint. Either `errors` or `customer` is present in a given response (never both). diff --git a/doc/models/update-merchant-settings-response.md b/doc/models/update-merchant-settings-response.md index aa47979b..15ed6c21 100644 --- a/doc/models/update-merchant-settings-response.md +++ b/doc/models/update-merchant-settings-response.md @@ -20,7 +20,6 @@ "merchant_id": "MERCHANT_ID", "payment_methods": { "afterpay_clearpay": { - "available": true, "enabled": true, "item_eligibility_range": { "max": { @@ -44,15 +43,12 @@ } }, "apple_pay": { - "available": true, "enabled": false }, "cash_app_pay": { - "available": true, "enabled": true }, "google_pay": { - "available": true, "enabled": true }, "cash_app": { diff --git a/doc/models/v1-create-refund-request-type.md b/doc/models/v1-create-refund-request-type.md deleted file mode 100644 index 439e1bc0..00000000 --- a/doc/models/v1-create-refund-request-type.md +++ /dev/null @@ -1,14 +0,0 @@ - -# V1 Create Refund Request Type - -## Enumeration - -`V1CreateRefundRequestType` - -## Fields - -| Name | -| --- | -| `FULL` | -| `PARTIAL` | - diff --git a/doc/models/v1-create-refund-request.md b/doc/models/v1-create-refund-request.md deleted file mode 100644 index f6e1e384..00000000 --- a/doc/models/v1-create-refund-request.md +++ /dev/null @@ -1,34 +0,0 @@ - -# V1 Create Refund Request - -V1CreateRefundRequest - -## Structure - -`V1CreateRefundRequest` - -## Fields - -| Name | Type | Tags | Description | Getter | Setter | -| --- | --- | --- | --- | --- | --- | -| `paymentId` | `string` | Required | The ID of the payment to refund. If you are creating a `PARTIAL`
refund for a split tender payment, instead provide the id of the
particular tender you want to refund. | getPaymentId(): string | setPaymentId(string paymentId): void | -| `type` | [`string(V1CreateRefundRequestType)`](../../doc/models/v1-create-refund-request-type.md) | Required | - | getType(): string | setType(string type): void | -| `reason` | `string` | Required | The reason for the refund. | getReason(): string | setReason(string reason): void | -| `refundedMoney` | [`?V1Money`](../../doc/models/v1-money.md) | Optional | - | getRefundedMoney(): ?V1Money | setRefundedMoney(?V1Money refundedMoney): void | -| `requestIdempotenceKey` | `?string` | Optional | An optional key to ensure idempotence if you issue the same PARTIAL refund request more than once. | getRequestIdempotenceKey(): ?string | setRequestIdempotenceKey(?string requestIdempotenceKey): void | - -## Example (as JSON) - -```json -{ - "payment_id": "payment_id2", - "type": "FULL", - "reason": "reason2", - "refunded_money": { - "amount": 214, - "currency_code": "SRD" - }, - "request_idempotence_key": "request_idempotence_key6" -} -``` - diff --git a/doc/models/v1-list-payments-request.md b/doc/models/v1-list-payments-request.md deleted file mode 100644 index 9e25fb63..00000000 --- a/doc/models/v1-list-payments-request.md +++ /dev/null @@ -1,30 +0,0 @@ - -# V1 List Payments Request - -## Structure - -`V1ListPaymentsRequest` - -## Fields - -| Name | Type | Tags | Description | Getter | Setter | -| --- | --- | --- | --- | --- | --- | -| `order` | [`?string(SortOrder)`](../../doc/models/sort-order.md) | Optional | The order (e.g., chronological or alphabetical) in which results from a request are returned. | getOrder(): ?string | setOrder(?string order): void | -| `beginTime` | `?string` | Optional | The beginning of the requested reporting period, in ISO 8601 format. If this value is before January 1, 2013 (2013-01-01T00:00:00Z), this endpoint returns an error. Default value: The current time minus one year. | getBeginTime(): ?string | setBeginTime(?string beginTime): void | -| `endTime` | `?string` | Optional | The end of the requested reporting period, in ISO 8601 format. If this value is more than one year greater than begin_time, this endpoint returns an error. Default value: The current time. | getEndTime(): ?string | setEndTime(?string endTime): void | -| `limit` | `?int` | Optional | The maximum number of payments to return in a single response. This value cannot exceed 200. | getLimit(): ?int | setLimit(?int limit): void | -| `batchToken` | `?string` | Optional | A pagination cursor to retrieve the next set of results for your
original query to the endpoint. | getBatchToken(): ?string | setBatchToken(?string batchToken): void | -| `includePartial` | `?bool` | Optional | Indicates whether or not to include partial payments in the response. Partial payments will have the tenders collected so far, but the itemizations will be empty until the payment is completed. | getIncludePartial(): ?bool | setIncludePartial(?bool includePartial): void | - -## Example (as JSON) - -```json -{ - "order": "DESC", - "begin_time": "begin_time8", - "end_time": "end_time2", - "limit": 104, - "batch_token": "batch_token8" -} -``` - diff --git a/doc/models/v1-list-payments-response.md b/doc/models/v1-list-payments-response.md deleted file mode 100644 index 8207e1b7..00000000 --- a/doc/models/v1-list-payments-response.md +++ /dev/null @@ -1,42 +0,0 @@ - -# V1 List Payments Response - -## Structure - -`V1ListPaymentsResponse` - -## Fields - -| Name | Type | Tags | Description | Getter | Setter | -| --- | --- | --- | --- | --- | --- | -| `items` | [`?(V1Payment[])`](../../doc/models/v1-payment.md) | Optional | - | getItems(): ?array | setItems(?array items): void | - -## Example (as JSON) - -```json -{ - "items": [ - { - "id": "id8", - "merchant_id": "merchant_id8", - "created_at": "created_at6", - "creator_id": "creator_id8", - "device": { - "id": "id6", - "name": "name6" - } - }, - { - "id": "id8", - "merchant_id": "merchant_id8", - "created_at": "created_at6", - "creator_id": "creator_id8", - "device": { - "id": "id6", - "name": "name6" - } - } - ] -} -``` - diff --git a/doc/models/v1-list-refunds-request.md b/doc/models/v1-list-refunds-request.md deleted file mode 100644 index 07965888..00000000 --- a/doc/models/v1-list-refunds-request.md +++ /dev/null @@ -1,29 +0,0 @@ - -# V1 List Refunds Request - -## Structure - -`V1ListRefundsRequest` - -## Fields - -| Name | Type | Tags | Description | Getter | Setter | -| --- | --- | --- | --- | --- | --- | -| `order` | [`?string(SortOrder)`](../../doc/models/sort-order.md) | Optional | The order (e.g., chronological or alphabetical) in which results from a request are returned. | getOrder(): ?string | setOrder(?string order): void | -| `beginTime` | `?string` | Optional | The beginning of the requested reporting period, in ISO 8601 format. If this value is before January 1, 2013 (2013-01-01T00:00:00Z), this endpoint returns an error. Default value: The current time minus one year. | getBeginTime(): ?string | setBeginTime(?string beginTime): void | -| `endTime` | `?string` | Optional | The end of the requested reporting period, in ISO 8601 format. If this value is more than one year greater than begin_time, this endpoint returns an error. Default value: The current time. | getEndTime(): ?string | setEndTime(?string endTime): void | -| `limit` | `?int` | Optional | The approximate number of refunds to return in a single response. Default: 100. Max: 200. Response may contain more results than the prescribed limit when refunds are made simultaneously to multiple tenders in a payment or when refunds are generated in an exchange to account for the value of returned goods. | getLimit(): ?int | setLimit(?int limit): void | -| `batchToken` | `?string` | Optional | A pagination cursor to retrieve the next set of results for your
original query to the endpoint. | getBatchToken(): ?string | setBatchToken(?string batchToken): void | - -## Example (as JSON) - -```json -{ - "order": "DESC", - "begin_time": "begin_time0", - "end_time": "end_time4", - "limit": 66, - "batch_token": "batch_token0" -} -``` - diff --git a/doc/models/v1-list-refunds-response.md b/doc/models/v1-list-refunds-response.md deleted file mode 100644 index cae95b62..00000000 --- a/doc/models/v1-list-refunds-response.md +++ /dev/null @@ -1,70 +0,0 @@ - -# V1 List Refunds Response - -## Structure - -`V1ListRefundsResponse` - -## Fields - -| Name | Type | Tags | Description | Getter | Setter | -| --- | --- | --- | --- | --- | --- | -| `items` | [`?(V1Refund[])`](../../doc/models/v1-refund.md) | Optional | - | getItems(): ?array | setItems(?array items): void | - -## Example (as JSON) - -```json -{ - "items": [ - { - "type": "FULL", - "reason": "reason6", - "refunded_money": { - "amount": 214, - "currency_code": "SRD" - }, - "refunded_processing_fee_money": { - "amount": 0, - "currency_code": "BGN" - }, - "refunded_tax_money": { - "amount": 148, - "currency_code": "SRD" - } - }, - { - "type": "FULL", - "reason": "reason6", - "refunded_money": { - "amount": 214, - "currency_code": "SRD" - }, - "refunded_processing_fee_money": { - "amount": 0, - "currency_code": "BGN" - }, - "refunded_tax_money": { - "amount": 148, - "currency_code": "SRD" - } - }, - { - "type": "FULL", - "reason": "reason6", - "refunded_money": { - "amount": 214, - "currency_code": "SRD" - }, - "refunded_processing_fee_money": { - "amount": 0, - "currency_code": "BGN" - }, - "refunded_tax_money": { - "amount": 148, - "currency_code": "SRD" - } - } - ] -} -``` - diff --git a/doc/models/v1-list-settlements-request-status.md b/doc/models/v1-list-settlements-request-status.md deleted file mode 100644 index 6f2be903..00000000 --- a/doc/models/v1-list-settlements-request-status.md +++ /dev/null @@ -1,14 +0,0 @@ - -# V1 List Settlements Request Status - -## Enumeration - -`V1ListSettlementsRequestStatus` - -## Fields - -| Name | -| --- | -| `SENT` | -| `FAILED` | - diff --git a/doc/models/v1-list-settlements-request.md b/doc/models/v1-list-settlements-request.md deleted file mode 100644 index fdd236ea..00000000 --- a/doc/models/v1-list-settlements-request.md +++ /dev/null @@ -1,30 +0,0 @@ - -# V1 List Settlements Request - -## Structure - -`V1ListSettlementsRequest` - -## Fields - -| Name | Type | Tags | Description | Getter | Setter | -| --- | --- | --- | --- | --- | --- | -| `order` | [`?string(SortOrder)`](../../doc/models/sort-order.md) | Optional | The order (e.g., chronological or alphabetical) in which results from a request are returned. | getOrder(): ?string | setOrder(?string order): void | -| `beginTime` | `?string` | Optional | The beginning of the requested reporting period, in ISO 8601 format. If this value is before January 1, 2013 (2013-01-01T00:00:00Z), this endpoint returns an error. Default value: The current time minus one year. | getBeginTime(): ?string | setBeginTime(?string beginTime): void | -| `endTime` | `?string` | Optional | The end of the requested reporting period, in ISO 8601 format. If this value is more than one year greater than begin_time, this endpoint returns an error. Default value: The current time. | getEndTime(): ?string | setEndTime(?string endTime): void | -| `limit` | `?int` | Optional | The maximum number of settlements to return in a single response. This value cannot exceed 200. | getLimit(): ?int | setLimit(?int limit): void | -| `status` | [`?string(V1ListSettlementsRequestStatus)`](../../doc/models/v1-list-settlements-request-status.md) | Optional | - | getStatus(): ?string | setStatus(?string status): void | -| `batchToken` | `?string` | Optional | A pagination cursor to retrieve the next set of results for your
original query to the endpoint. | getBatchToken(): ?string | setBatchToken(?string batchToken): void | - -## Example (as JSON) - -```json -{ - "order": "DESC", - "begin_time": "begin_time8", - "end_time": "end_time2", - "limit": 226, - "status": "SENT" -} -``` - diff --git a/doc/models/v1-list-settlements-response.md b/doc/models/v1-list-settlements-response.md deleted file mode 100644 index 43c0c181..00000000 --- a/doc/models/v1-list-settlements-response.md +++ /dev/null @@ -1,52 +0,0 @@ - -# V1 List Settlements Response - -## Structure - -`V1ListSettlementsResponse` - -## Fields - -| Name | Type | Tags | Description | Getter | Setter | -| --- | --- | --- | --- | --- | --- | -| `items` | [`?(V1Settlement[])`](../../doc/models/v1-settlement.md) | Optional | - | getItems(): ?array | setItems(?array items): void | - -## Example (as JSON) - -```json -{ - "items": [ - { - "id": "id8", - "status": "FAILED", - "total_money": { - "amount": 250, - "currency_code": "KZT" - }, - "initiated_at": "initiated_at0", - "bank_account_id": "bank_account_id8" - }, - { - "id": "id8", - "status": "FAILED", - "total_money": { - "amount": 250, - "currency_code": "KZT" - }, - "initiated_at": "initiated_at0", - "bank_account_id": "bank_account_id8" - }, - { - "id": "id8", - "status": "FAILED", - "total_money": { - "amount": 250, - "currency_code": "KZT" - }, - "initiated_at": "initiated_at0", - "bank_account_id": "bank_account_id8" - } - ] -} -``` - diff --git a/doc/models/v1-payment-discount.md b/doc/models/v1-payment-discount.md deleted file mode 100644 index 81a9693c..00000000 --- a/doc/models/v1-payment-discount.md +++ /dev/null @@ -1,30 +0,0 @@ - -# V1 Payment Discount - -V1PaymentDiscount - -## Structure - -`V1PaymentDiscount` - -## Fields - -| Name | Type | Tags | Description | Getter | Setter | -| --- | --- | --- | --- | --- | --- | -| `name` | `?string` | Optional | The discount's name. | getName(): ?string | setName(?string name): void | -| `appliedMoney` | [`?V1Money`](../../doc/models/v1-money.md) | Optional | - | getAppliedMoney(): ?V1Money | setAppliedMoney(?V1Money appliedMoney): void | -| `discountId` | `?string` | Optional | The ID of the applied discount, if available. Discounts applied in older versions of Square Register might not have an ID. | getDiscountId(): ?string | setDiscountId(?string discountId): void | - -## Example (as JSON) - -```json -{ - "name": "name4", - "applied_money": { - "amount": 196, - "currency_code": "IQD" - }, - "discount_id": "discount_id2" -} -``` - diff --git a/doc/models/v1-payment-item-detail.md b/doc/models/v1-payment-item-detail.md deleted file mode 100644 index 2f62c4a4..00000000 --- a/doc/models/v1-payment-item-detail.md +++ /dev/null @@ -1,29 +0,0 @@ - -# V1 Payment Item Detail - -V1PaymentItemDetail - -## Structure - -`V1PaymentItemDetail` - -## Fields - -| Name | Type | Tags | Description | Getter | Setter | -| --- | --- | --- | --- | --- | --- | -| `categoryName` | `?string` | Optional | The name of the item's merchant-defined category, if any. | getCategoryName(): ?string | setCategoryName(?string categoryName): void | -| `sku` | `?string` | Optional | The item's merchant-defined SKU, if any. | getSku(): ?string | setSku(?string sku): void | -| `itemId` | `?string` | Optional | The unique ID of the item purchased, if any. | getItemId(): ?string | setItemId(?string itemId): void | -| `itemVariationId` | `?string` | Optional | The unique ID of the item variation purchased, if any. | getItemVariationId(): ?string | setItemVariationId(?string itemVariationId): void | - -## Example (as JSON) - -```json -{ - "category_name": "category_name4", - "sku": "sku0", - "item_id": "item_id4", - "item_variation_id": "item_variation_id8" -} -``` - diff --git a/doc/models/v1-payment-itemization-itemization-type.md b/doc/models/v1-payment-itemization-itemization-type.md deleted file mode 100644 index 2838c08e..00000000 --- a/doc/models/v1-payment-itemization-itemization-type.md +++ /dev/null @@ -1,18 +0,0 @@ - -# V1 Payment Itemization Itemization Type - -## Enumeration - -`V1PaymentItemizationItemizationType` - -## Fields - -| Name | -| --- | -| `ITEM` | -| `CUSTOM_AMOUNT` | -| `GIFT_CARD_ACTIVATION` | -| `GIFT_CARD_RELOAD` | -| `GIFT_CARD_UNKNOWN` | -| `OTHER` | - diff --git a/doc/models/v1-payment-itemization.md b/doc/models/v1-payment-itemization.md deleted file mode 100644 index 0d4c0de8..00000000 --- a/doc/models/v1-payment-itemization.md +++ /dev/null @@ -1,60 +0,0 @@ - -# V1 Payment Itemization - -Payment include an`itemizations` field that lists the items purchased, -along with associated fees, modifiers, and discounts. Each itemization has an -`itemization_type` field that indicates which of the following the itemization -represents: - -
    -
  • An item variation from the merchant's item library
  • -
  • A custom monetary amount
  • -
  • -An action performed on a Square gift card, such as activating or -reloading it. -
  • -
-*Note**: itemization information included in a `Payment` object reflects -details collected **at the time of the payment**. Details such as the name or -price of items might have changed since the payment was processed. - -## Structure - -`V1PaymentItemization` - -## Fields - -| Name | Type | Tags | Description | Getter | Setter | -| --- | --- | --- | --- | --- | --- | -| `name` | `?string` | Optional | The item's name. | getName(): ?string | setName(?string name): void | -| `quantity` | `?float` | Optional | The quantity of the item purchased. This can be a decimal value. | getQuantity(): ?float | setQuantity(?float quantity): void | -| `itemizationType` | [`?string(V1PaymentItemizationItemizationType)`](../../doc/models/v1-payment-itemization-itemization-type.md) | Optional | - | getItemizationType(): ?string | setItemizationType(?string itemizationType): void | -| `itemDetail` | [`?V1PaymentItemDetail`](../../doc/models/v1-payment-item-detail.md) | Optional | V1PaymentItemDetail | getItemDetail(): ?V1PaymentItemDetail | setItemDetail(?V1PaymentItemDetail itemDetail): void | -| `notes` | `?string` | Optional | Notes entered by the merchant about the item at the time of payment, if any. | getNotes(): ?string | setNotes(?string notes): void | -| `itemVariationName` | `?string` | Optional | The name of the item variation purchased, if any. | getItemVariationName(): ?string | setItemVariationName(?string itemVariationName): void | -| `totalMoney` | [`?V1Money`](../../doc/models/v1-money.md) | Optional | - | getTotalMoney(): ?V1Money | setTotalMoney(?V1Money totalMoney): void | -| `singleQuantityMoney` | [`?V1Money`](../../doc/models/v1-money.md) | Optional | - | getSingleQuantityMoney(): ?V1Money | setSingleQuantityMoney(?V1Money singleQuantityMoney): void | -| `grossSalesMoney` | [`?V1Money`](../../doc/models/v1-money.md) | Optional | - | getGrossSalesMoney(): ?V1Money | setGrossSalesMoney(?V1Money grossSalesMoney): void | -| `discountMoney` | [`?V1Money`](../../doc/models/v1-money.md) | Optional | - | getDiscountMoney(): ?V1Money | setDiscountMoney(?V1Money discountMoney): void | -| `netSalesMoney` | [`?V1Money`](../../doc/models/v1-money.md) | Optional | - | getNetSalesMoney(): ?V1Money | setNetSalesMoney(?V1Money netSalesMoney): void | -| `taxes` | [`?(V1PaymentTax[])`](../../doc/models/v1-payment-tax.md) | Optional | All taxes applied to this itemization. | getTaxes(): ?array | setTaxes(?array taxes): void | -| `discounts` | [`?(V1PaymentDiscount[])`](../../doc/models/v1-payment-discount.md) | Optional | All discounts applied to this itemization. | getDiscounts(): ?array | setDiscounts(?array discounts): void | -| `modifiers` | [`?(V1PaymentModifier[])`](../../doc/models/v1-payment-modifier.md) | Optional | All modifier options applied to this itemization. | getModifiers(): ?array | setModifiers(?array modifiers): void | - -## Example (as JSON) - -```json -{ - "name": "name4", - "quantity": 253.5, - "itemization_type": "GIFT_CARD_UNKNOWN", - "item_detail": { - "category_name": "category_name0", - "sku": "sku6", - "item_id": "item_id2", - "item_variation_id": "item_variation_id2" - }, - "notes": "notes4" -} -``` - diff --git a/doc/models/v1-payment-modifier.md b/doc/models/v1-payment-modifier.md deleted file mode 100644 index e9c65241..00000000 --- a/doc/models/v1-payment-modifier.md +++ /dev/null @@ -1,30 +0,0 @@ - -# V1 Payment Modifier - -V1PaymentModifier - -## Structure - -`V1PaymentModifier` - -## Fields - -| Name | Type | Tags | Description | Getter | Setter | -| --- | --- | --- | --- | --- | --- | -| `name` | `?string` | Optional | The modifier option's name. | getName(): ?string | setName(?string name): void | -| `appliedMoney` | [`?V1Money`](../../doc/models/v1-money.md) | Optional | - | getAppliedMoney(): ?V1Money | setAppliedMoney(?V1Money appliedMoney): void | -| `modifierOptionId` | `?string` | Optional | The ID of the applied modifier option, if available. Modifier options applied in older versions of Square Register might not have an ID. | getModifierOptionId(): ?string | setModifierOptionId(?string modifierOptionId): void | - -## Example (as JSON) - -```json -{ - "name": "name0", - "applied_money": { - "amount": 196, - "currency_code": "IQD" - }, - "modifier_option_id": "modifier_option_id6" -} -``` - diff --git a/doc/models/v1-payment-surcharge-type.md b/doc/models/v1-payment-surcharge-type.md deleted file mode 100644 index 52348c75..00000000 --- a/doc/models/v1-payment-surcharge-type.md +++ /dev/null @@ -1,15 +0,0 @@ - -# V1 Payment Surcharge Type - -## Enumeration - -`V1PaymentSurchargeType` - -## Fields - -| Name | -| --- | -| `UNKNOWN` | -| `AUTO_GRATUITY` | -| `CUSTOM` | - diff --git a/doc/models/v1-payment-surcharge.md b/doc/models/v1-payment-surcharge.md deleted file mode 100644 index 8f72ad08..00000000 --- a/doc/models/v1-payment-surcharge.md +++ /dev/null @@ -1,40 +0,0 @@ - -# V1 Payment Surcharge - -V1PaymentSurcharge - -## Structure - -`V1PaymentSurcharge` - -## Fields - -| Name | Type | Tags | Description | Getter | Setter | -| --- | --- | --- | --- | --- | --- | -| `name` | `?string` | Optional | The name of the surcharge. | getName(): ?string | setName(?string name): void | -| `appliedMoney` | [`?V1Money`](../../doc/models/v1-money.md) | Optional | - | getAppliedMoney(): ?V1Money | setAppliedMoney(?V1Money appliedMoney): void | -| `rate` | `?string` | Optional | The amount of the surcharge as a percentage. The percentage is provided as a string representing the decimal equivalent of the percentage. For example, "0.7" corresponds to a 7% surcharge. Exactly one of rate or amount_money should be set. | getRate(): ?string | setRate(?string rate): void | -| `amountMoney` | [`?V1Money`](../../doc/models/v1-money.md) | Optional | - | getAmountMoney(): ?V1Money | setAmountMoney(?V1Money amountMoney): void | -| `type` | [`?string(V1PaymentSurchargeType)`](../../doc/models/v1-payment-surcharge-type.md) | Optional | - | getType(): ?string | setType(?string type): void | -| `taxable` | `?bool` | Optional | Indicates whether the surcharge is taxable. | getTaxable(): ?bool | setTaxable(?bool taxable): void | -| `taxes` | [`?(V1PaymentTax[])`](../../doc/models/v1-payment-tax.md) | Optional | The list of taxes that should be applied to the surcharge. | getTaxes(): ?array | setTaxes(?array taxes): void | -| `surchargeId` | `?string` | Optional | A Square-issued unique identifier associated with the surcharge. | getSurchargeId(): ?string | setSurchargeId(?string surchargeId): void | - -## Example (as JSON) - -```json -{ - "name": "name6", - "applied_money": { - "amount": 196, - "currency_code": "IQD" - }, - "rate": "rate4", - "amount_money": { - "amount": 186, - "currency_code": "UZS" - }, - "type": "AUTO_GRATUITY" -} -``` - diff --git a/doc/models/v1-payment-tax-inclusion-type.md b/doc/models/v1-payment-tax-inclusion-type.md deleted file mode 100644 index 6564c7e5..00000000 --- a/doc/models/v1-payment-tax-inclusion-type.md +++ /dev/null @@ -1,14 +0,0 @@ - -# V1 Payment Tax Inclusion Type - -## Enumeration - -`V1PaymentTaxInclusionType` - -## Fields - -| Name | -| --- | -| `ADDITIVE` | -| `INCLUSIVE` | - diff --git a/doc/models/v1-payment-tax.md b/doc/models/v1-payment-tax.md deleted file mode 100644 index 88550f5a..00000000 --- a/doc/models/v1-payment-tax.md +++ /dev/null @@ -1,42 +0,0 @@ - -# V1 Payment Tax - -V1PaymentTax - -## Structure - -`V1PaymentTax` - -## Fields - -| Name | Type | Tags | Description | Getter | Setter | -| --- | --- | --- | --- | --- | --- | -| `errors` | [`?(Error[])`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | getErrors(): ?array | setErrors(?array errors): void | -| `name` | `?string` | Optional | The merchant-defined name of the tax. | getName(): ?string | setName(?string name): void | -| `appliedMoney` | [`?V1Money`](../../doc/models/v1-money.md) | Optional | - | getAppliedMoney(): ?V1Money | setAppliedMoney(?V1Money appliedMoney): void | -| `rate` | `?string` | Optional | The rate of the tax, as a string representation of a decimal number. A value of 0.07 corresponds to a rate of 7%. | getRate(): ?string | setRate(?string rate): void | -| `inclusionType` | [`?string(V1PaymentTaxInclusionType)`](../../doc/models/v1-payment-tax-inclusion-type.md) | Optional | - | getInclusionType(): ?string | setInclusionType(?string inclusionType): void | -| `feeId` | `?string` | Optional | The ID of the tax, if available. Taxes applied in older versions of Square Register might not have an ID. | getFeeId(): ?string | setFeeId(?string feeId): void | - -## Example (as JSON) - -```json -{ - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "MAP_KEY_LENGTH_TOO_LONG", - "detail": "detail6", - "field": "field4" - } - ], - "name": "name6", - "applied_money": { - "amount": 196, - "currency_code": "IQD" - }, - "rate": "rate4", - "inclusion_type": "ADDITIVE" -} -``` - diff --git a/doc/models/v1-payment.md b/doc/models/v1-payment.md deleted file mode 100644 index fa6004c4..00000000 --- a/doc/models/v1-payment.md +++ /dev/null @@ -1,75 +0,0 @@ - -# V1 Payment - -A payment represents a paid transaction between a Square merchant and a -customer. Payment details are usually available from Connect API endpoints -within a few minutes after the transaction completes. - -Each Payment object includes several fields that end in `_money`. These fields -describe the various amounts of money that contribute to the payment total: - -
    -
  • -Monetary values are positive if they represent an -increase in the amount of money the merchant receives (e.g., -tax_money, tip_money). -
  • -
  • -Monetary values are negative if they represent an -decrease in the amount of money the merchant receives (e.g., -discount_money, refunded_money). -
  • -
- - -## Structure - -`V1Payment` - -## Fields - -| Name | Type | Tags | Description | Getter | Setter | -| --- | --- | --- | --- | --- | --- | -| `id` | `?string` | Optional | The payment's unique identifier. | getId(): ?string | setId(?string id): void | -| `merchantId` | `?string` | Optional | The unique identifier of the merchant that took the payment. | getMerchantId(): ?string | setMerchantId(?string merchantId): void | -| `createdAt` | `?string` | Optional | The time when the payment was created, in ISO 8601 format. Reflects the time of the first payment if the object represents an incomplete partial payment, and the time of the last or complete payment otherwise. | getCreatedAt(): ?string | setCreatedAt(?string createdAt): void | -| `creatorId` | `?string` | Optional | The unique identifier of the Square account that took the payment. | getCreatorId(): ?string | setCreatorId(?string creatorId): void | -| `device` | [`?V1Device`](../../doc/models/v1-device.md) | Optional | - | getDevice(): ?V1Device | setDevice(?V1Device device): void | -| `paymentUrl` | `?string` | Optional | The URL of the payment's detail page in the merchant dashboard. The merchant must be signed in to the merchant dashboard to view this page. | getPaymentUrl(): ?string | setPaymentUrl(?string paymentUrl): void | -| `receiptUrl` | `?string` | Optional | The URL of the receipt for the payment. Note that for split tender
payments, this URL corresponds to the receipt for the first tender
listed in the payment's tender field. Each Tender object has its own
receipt_url field you can use to get the other receipts associated with
a split tender payment. | getReceiptUrl(): ?string | setReceiptUrl(?string receiptUrl): void | -| `inclusiveTaxMoney` | [`?V1Money`](../../doc/models/v1-money.md) | Optional | - | getInclusiveTaxMoney(): ?V1Money | setInclusiveTaxMoney(?V1Money inclusiveTaxMoney): void | -| `additiveTaxMoney` | [`?V1Money`](../../doc/models/v1-money.md) | Optional | - | getAdditiveTaxMoney(): ?V1Money | setAdditiveTaxMoney(?V1Money additiveTaxMoney): void | -| `taxMoney` | [`?V1Money`](../../doc/models/v1-money.md) | Optional | - | getTaxMoney(): ?V1Money | setTaxMoney(?V1Money taxMoney): void | -| `tipMoney` | [`?V1Money`](../../doc/models/v1-money.md) | Optional | - | getTipMoney(): ?V1Money | setTipMoney(?V1Money tipMoney): void | -| `discountMoney` | [`?V1Money`](../../doc/models/v1-money.md) | Optional | - | getDiscountMoney(): ?V1Money | setDiscountMoney(?V1Money discountMoney): void | -| `totalCollectedMoney` | [`?V1Money`](../../doc/models/v1-money.md) | Optional | - | getTotalCollectedMoney(): ?V1Money | setTotalCollectedMoney(?V1Money totalCollectedMoney): void | -| `processingFeeMoney` | [`?V1Money`](../../doc/models/v1-money.md) | Optional | - | getProcessingFeeMoney(): ?V1Money | setProcessingFeeMoney(?V1Money processingFeeMoney): void | -| `netTotalMoney` | [`?V1Money`](../../doc/models/v1-money.md) | Optional | - | getNetTotalMoney(): ?V1Money | setNetTotalMoney(?V1Money netTotalMoney): void | -| `refundedMoney` | [`?V1Money`](../../doc/models/v1-money.md) | Optional | - | getRefundedMoney(): ?V1Money | setRefundedMoney(?V1Money refundedMoney): void | -| `swedishRoundingMoney` | [`?V1Money`](../../doc/models/v1-money.md) | Optional | - | getSwedishRoundingMoney(): ?V1Money | setSwedishRoundingMoney(?V1Money swedishRoundingMoney): void | -| `grossSalesMoney` | [`?V1Money`](../../doc/models/v1-money.md) | Optional | - | getGrossSalesMoney(): ?V1Money | setGrossSalesMoney(?V1Money grossSalesMoney): void | -| `netSalesMoney` | [`?V1Money`](../../doc/models/v1-money.md) | Optional | - | getNetSalesMoney(): ?V1Money | setNetSalesMoney(?V1Money netSalesMoney): void | -| `inclusiveTax` | [`?(V1PaymentTax[])`](../../doc/models/v1-payment-tax.md) | Optional | All of the inclusive taxes associated with the payment. | getInclusiveTax(): ?array | setInclusiveTax(?array inclusiveTax): void | -| `additiveTax` | [`?(V1PaymentTax[])`](../../doc/models/v1-payment-tax.md) | Optional | All of the additive taxes associated with the payment. | getAdditiveTax(): ?array | setAdditiveTax(?array additiveTax): void | -| `tender` | [`?(V1Tender[])`](../../doc/models/v1-tender.md) | Optional | All of the tenders associated with the payment. | getTender(): ?array | setTender(?array tender): void | -| `refunds` | [`?(V1Refund[])`](../../doc/models/v1-refund.md) | Optional | All of the refunds applied to the payment. Note that the value of all refunds on a payment can exceed the value of all tenders if a merchant chooses to refund money to a tender after previously accepting returned goods as part of an exchange. | getRefunds(): ?array | setRefunds(?array refunds): void | -| `itemizations` | [`?(V1PaymentItemization[])`](../../doc/models/v1-payment-itemization.md) | Optional | The items purchased in the payment. | getItemizations(): ?array | setItemizations(?array itemizations): void | -| `surchargeMoney` | [`?V1Money`](../../doc/models/v1-money.md) | Optional | - | getSurchargeMoney(): ?V1Money | setSurchargeMoney(?V1Money surchargeMoney): void | -| `surcharges` | [`?(V1PaymentSurcharge[])`](../../doc/models/v1-payment-surcharge.md) | Optional | A list of all surcharges associated with the payment. | getSurcharges(): ?array | setSurcharges(?array surcharges): void | -| `isPartial` | `?bool` | Optional | Indicates whether or not the payment is only partially paid for.
If true, this payment will have the tenders collected so far, but the
itemizations will be empty until the payment is completed. | getIsPartial(): ?bool | setIsPartial(?bool isPartial): void | - -## Example (as JSON) - -```json -{ - "id": "id2", - "merchant_id": "merchant_id8", - "created_at": "created_at0", - "creator_id": "creator_id2", - "device": { - "id": "id6", - "name": "name6" - } -} -``` - diff --git a/doc/models/v1-refund-type.md b/doc/models/v1-refund-type.md deleted file mode 100644 index 0cd3137d..00000000 --- a/doc/models/v1-refund-type.md +++ /dev/null @@ -1,14 +0,0 @@ - -# V1 Refund Type - -## Enumeration - -`V1RefundType` - -## Fields - -| Name | -| --- | -| `FULL` | -| `PARTIAL` | - diff --git a/doc/models/v1-refund.md b/doc/models/v1-refund.md deleted file mode 100644 index 94a3debf..00000000 --- a/doc/models/v1-refund.md +++ /dev/null @@ -1,53 +0,0 @@ - -# V1 Refund - -V1Refund - -## Structure - -`V1Refund` - -## Fields - -| Name | Type | Tags | Description | Getter | Setter | -| --- | --- | --- | --- | --- | --- | -| `type` | [`?string(V1RefundType)`](../../doc/models/v1-refund-type.md) | Optional | - | getType(): ?string | setType(?string type): void | -| `reason` | `?string` | Optional | The merchant-specified reason for the refund. | getReason(): ?string | setReason(?string reason): void | -| `refundedMoney` | [`?V1Money`](../../doc/models/v1-money.md) | Optional | - | getRefundedMoney(): ?V1Money | setRefundedMoney(?V1Money refundedMoney): void | -| `refundedProcessingFeeMoney` | [`?V1Money`](../../doc/models/v1-money.md) | Optional | - | getRefundedProcessingFeeMoney(): ?V1Money | setRefundedProcessingFeeMoney(?V1Money refundedProcessingFeeMoney): void | -| `refundedTaxMoney` | [`?V1Money`](../../doc/models/v1-money.md) | Optional | - | getRefundedTaxMoney(): ?V1Money | setRefundedTaxMoney(?V1Money refundedTaxMoney): void | -| `refundedAdditiveTaxMoney` | [`?V1Money`](../../doc/models/v1-money.md) | Optional | - | getRefundedAdditiveTaxMoney(): ?V1Money | setRefundedAdditiveTaxMoney(?V1Money refundedAdditiveTaxMoney): void | -| `refundedAdditiveTax` | [`?(V1PaymentTax[])`](../../doc/models/v1-payment-tax.md) | Optional | All of the additive taxes associated with the refund. | getRefundedAdditiveTax(): ?array | setRefundedAdditiveTax(?array refundedAdditiveTax): void | -| `refundedInclusiveTaxMoney` | [`?V1Money`](../../doc/models/v1-money.md) | Optional | - | getRefundedInclusiveTaxMoney(): ?V1Money | setRefundedInclusiveTaxMoney(?V1Money refundedInclusiveTaxMoney): void | -| `refundedInclusiveTax` | [`?(V1PaymentTax[])`](../../doc/models/v1-payment-tax.md) | Optional | All of the inclusive taxes associated with the refund. | getRefundedInclusiveTax(): ?array | setRefundedInclusiveTax(?array refundedInclusiveTax): void | -| `refundedTipMoney` | [`?V1Money`](../../doc/models/v1-money.md) | Optional | - | getRefundedTipMoney(): ?V1Money | setRefundedTipMoney(?V1Money refundedTipMoney): void | -| `refundedDiscountMoney` | [`?V1Money`](../../doc/models/v1-money.md) | Optional | - | getRefundedDiscountMoney(): ?V1Money | setRefundedDiscountMoney(?V1Money refundedDiscountMoney): void | -| `refundedSurchargeMoney` | [`?V1Money`](../../doc/models/v1-money.md) | Optional | - | getRefundedSurchargeMoney(): ?V1Money | setRefundedSurchargeMoney(?V1Money refundedSurchargeMoney): void | -| `refundedSurcharges` | [`?(V1PaymentSurcharge[])`](../../doc/models/v1-payment-surcharge.md) | Optional | A list of all surcharges associated with the refund. | getRefundedSurcharges(): ?array | setRefundedSurcharges(?array refundedSurcharges): void | -| `createdAt` | `?string` | Optional | The time when the merchant initiated the refund for Square to process, in ISO 8601 format. | getCreatedAt(): ?string | setCreatedAt(?string createdAt): void | -| `processedAt` | `?string` | Optional | The time when Square processed the refund on behalf of the merchant, in ISO 8601 format. | getProcessedAt(): ?string | setProcessedAt(?string processedAt): void | -| `paymentId` | `?string` | Optional | A Square-issued ID associated with the refund. For single-tender refunds, payment_id is the ID of the original payment ID. For split-tender refunds, payment_id is the ID of the original tender. For exchange-based refunds (is_exchange == true), payment_id is the ID of the original payment ID even if the payment includes other tenders. | getPaymentId(): ?string | setPaymentId(?string paymentId): void | -| `merchantId` | `?string` | Optional | - | getMerchantId(): ?string | setMerchantId(?string merchantId): void | -| `isExchange` | `?bool` | Optional | Indicates whether or not the refund is associated with an exchange. If is_exchange is true, the refund reflects the value of goods returned in the exchange not the total money refunded. | getIsExchange(): ?bool | setIsExchange(?bool isExchange): void | - -## Example (as JSON) - -```json -{ - "type": "FULL", - "reason": "reason4", - "refunded_money": { - "amount": 214, - "currency_code": "SRD" - }, - "refunded_processing_fee_money": { - "amount": 0, - "currency_code": "BGN" - }, - "refunded_tax_money": { - "amount": 148, - "currency_code": "SRD" - } -} -``` - diff --git a/doc/models/v1-settlement-entry-type.md b/doc/models/v1-settlement-entry-type.md deleted file mode 100644 index 9ca3794b..00000000 --- a/doc/models/v1-settlement-entry-type.md +++ /dev/null @@ -1,33 +0,0 @@ - -# V1 Settlement Entry Type - -## Enumeration - -`V1SettlementEntryType` - -## Fields - -| Name | Description | -| --- | --- | -| `ADJUSTMENT` | A manual adjustment applied to the merchant's account by Square | -| `BALANCE_CHARGE` | A payment from an existing Square balance, such as a gift card | -| `CHARGE` | A credit card payment CAPTURE | -| `FREE_PROCESSING` | Square offers Free Payments Processing for a variety of business scenarios including seller referral or when we want to apologize for a bug, customer service, repricing complication, etc. This entry represents a credit to the merchant for the purposes of Free Processing. | -| `HOLD_ADJUSTMENT` | An adjustment made by Square related to holding/releasing a payment | -| `PAID_SERVICE_FEE` | a fee paid to a 3rd party merchant | -| `PAID_SERVICE_FEE_REFUND` | a refund for a 3rd party merchant fee | -| `REDEMPTION_CODE` | Repayment for a redemption code | -| `REFUND` | A refund for an existing card payment | -| `RETURNED_PAYOUT` | An entry created when we receive a response for the ACH file we sent indicating that the settlement of the original entry failed. | -| `SQUARE_CAPITAL_ADVANCE` | Initial deposit to a merchant for a Capital merchant cash advance (MCA). | -| `SQUARE_CAPITAL_PAYMENT` | Capital merchant cash advance (MCA) assessment. These are, generally, proportional to the merchant's sales but may be issued for other reasons related to the MCA. | -| `SQUARE_CAPITAL_REVERSED_PAYMENT` | Capital merchant cash advance (MCA) assessment refund. These are, generally, proportional to the merchant's refunds but may be issued for other reasons related to the MCA. | -| `SUBSCRIPTION_FEE` | Fee charged for subscription to a Square product | -| `SUBSCRIPTION_FEE_REFUND` | Refund of a previously charged Square product subscription fee. | -| `OTHER` | | -| `INCENTED_PAYMENT` | A payment in which Square covers part of the funds for a purchase | -| `RETURNED_ACH_ENTRY` | A settlement failed to be processed and the settlement amount has been returned to the account | -| `RETURNED_SQUARE_275` | Refund for cancelling a Square Plus subscription | -| `SQUARE_275` | Fee charged for a Square Plus subscription ($275) | -| `SQUARE_CARD` | Settlements to or withdrawals from the Square Card (an asset) | - diff --git a/doc/models/v1-settlement-entry.md b/doc/models/v1-settlement-entry.md deleted file mode 100644 index 25aec87b..00000000 --- a/doc/models/v1-settlement-entry.md +++ /dev/null @@ -1,35 +0,0 @@ - -# V1 Settlement Entry - -V1SettlementEntry - -## Structure - -`V1SettlementEntry` - -## Fields - -| Name | Type | Tags | Description | Getter | Setter | -| --- | --- | --- | --- | --- | --- | -| `paymentId` | `?string` | Optional | The settlement's unique identifier. | getPaymentId(): ?string | setPaymentId(?string paymentId): void | -| `type` | [`?string(V1SettlementEntryType)`](../../doc/models/v1-settlement-entry-type.md) | Optional | - | getType(): ?string | setType(?string type): void | -| `amountMoney` | [`?V1Money`](../../doc/models/v1-money.md) | Optional | - | getAmountMoney(): ?V1Money | setAmountMoney(?V1Money amountMoney): void | -| `feeMoney` | [`?V1Money`](../../doc/models/v1-money.md) | Optional | - | getFeeMoney(): ?V1Money | setFeeMoney(?V1Money feeMoney): void | - -## Example (as JSON) - -```json -{ - "payment_id": "payment_id0", - "type": "RETURNED_PAYOUT", - "amount_money": { - "amount": 186, - "currency_code": "UZS" - }, - "fee_money": { - "amount": 108, - "currency_code": "ILS" - } -} -``` - diff --git a/doc/models/v1-settlement-status.md b/doc/models/v1-settlement-status.md deleted file mode 100644 index 1c8e14a3..00000000 --- a/doc/models/v1-settlement-status.md +++ /dev/null @@ -1,14 +0,0 @@ - -# V1 Settlement Status - -## Enumeration - -`V1SettlementStatus` - -## Fields - -| Name | -| --- | -| `FAILED` | -| `SENT` | - diff --git a/doc/models/v1-settlement.md b/doc/models/v1-settlement.md deleted file mode 100644 index e9747b0f..00000000 --- a/doc/models/v1-settlement.md +++ /dev/null @@ -1,35 +0,0 @@ - -# V1 Settlement - -V1Settlement - -## Structure - -`V1Settlement` - -## Fields - -| Name | Type | Tags | Description | Getter | Setter | -| --- | --- | --- | --- | --- | --- | -| `id` | `?string` | Optional | The settlement's unique identifier. | getId(): ?string | setId(?string id): void | -| `status` | [`?string(V1SettlementStatus)`](../../doc/models/v1-settlement-status.md) | Optional | - | getStatus(): ?string | setStatus(?string status): void | -| `totalMoney` | [`?V1Money`](../../doc/models/v1-money.md) | Optional | - | getTotalMoney(): ?V1Money | setTotalMoney(?V1Money totalMoney): void | -| `initiatedAt` | `?string` | Optional | The time when the settlement was submitted for deposit or withdrawal, in ISO 8601 format. | getInitiatedAt(): ?string | setInitiatedAt(?string initiatedAt): void | -| `bankAccountId` | `?string` | Optional | The Square-issued unique identifier for the bank account associated with the settlement. | getBankAccountId(): ?string | setBankAccountId(?string bankAccountId): void | -| `entries` | [`?(V1SettlementEntry[])`](../../doc/models/v1-settlement-entry.md) | Optional | The entries included in this settlement. | getEntries(): ?array | setEntries(?array entries): void | - -## Example (as JSON) - -```json -{ - "id": "id2", - "status": "FAILED", - "total_money": { - "amount": 250, - "currency_code": "KZT" - }, - "initiated_at": "initiated_at4", - "bank_account_id": "bank_account_id2" -} -``` - diff --git a/src/Apis/CheckoutApi.php b/src/Apis/CheckoutApi.php index 88690f05..42cc2ab7 100644 --- a/src/Apis/CheckoutApi.php +++ b/src/Apis/CheckoutApi.php @@ -153,8 +153,8 @@ public function updateMerchantSettings(UpdateMerchantSettingsRequest $body): Api * @param string|null $cursor A pagination cursor returned by a previous call to this endpoint. * Provide this cursor to retrieve the next set of results for the original query. * If a cursor is not provided, the endpoint returns the first page of the results. - * For more information, see [Pagination](https://developer.squareup. - * com/docs/basics/api101/pagination). + * For more information, see [Pagination](https://developer.squareup.com/docs/build- + * basics/common-api-patterns/pagination). * @param int|null $limit A limit on the number of results to return per page. The limit is * advisory and * the implementation might return more or less results. If the supplied limit is diff --git a/src/Apis/CustomersApi.php b/src/Apis/CustomersApi.php index e37365ad..c91549dd 100644 --- a/src/Apis/CustomersApi.php +++ b/src/Apis/CustomersApi.php @@ -11,6 +11,14 @@ use CoreInterfaces\Core\Request\RequestMethod; use Square\Http\ApiResponse; use Square\Models\AddGroupToCustomerResponse; +use Square\Models\BulkCreateCustomersRequest; +use Square\Models\BulkCreateCustomersResponse; +use Square\Models\BulkDeleteCustomersRequest; +use Square\Models\BulkDeleteCustomersResponse; +use Square\Models\BulkRetrieveCustomersRequest; +use Square\Models\BulkRetrieveCustomersResponse; +use Square\Models\BulkUpdateCustomersRequest; +use Square\Models\BulkUpdateCustomersResponse; use Square\Models\CreateCustomerCardRequest; use Square\Models\CreateCustomerCardResponse; use Square\Models\CreateCustomerRequest; @@ -110,6 +118,109 @@ public function createCustomer(CreateCustomerRequest $body): ApiResponse return $this->execute($_reqBuilder, $_resHandler); } + /** + * Creates multiple [customer profiles]($m/Customer) for a business. + * + * This endpoint takes a map of individual create requests and returns a map of responses. + * + * You must provide at least one of the following values in each create request: + * + * - `given_name` + * - `family_name` + * - `company_name` + * - `email_address` + * - `phone_number` + * + * @param BulkCreateCustomersRequest $body An object containing the fields to POST for the + * request. + * + * See the corresponding object definition for field details. + * + * @return ApiResponse Response from the API call + */ + public function bulkCreateCustomers(BulkCreateCustomersRequest $body): ApiResponse + { + $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/v2/customers/bulk-create') + ->auth('global') + ->parameters(HeaderParam::init('Content-Type', 'application/json'), BodyParam::init($body)); + + $_resHandler = $this->responseHandler()->type(BulkCreateCustomersResponse::class)->returnApiResponse(); + + return $this->execute($_reqBuilder, $_resHandler); + } + + /** + * Deletes multiple customer profiles. + * + * The endpoint takes a list of customer IDs and returns a map of responses. + * + * @param BulkDeleteCustomersRequest $body An object containing the fields to POST for the + * request. + * + * See the corresponding object definition for field details. + * + * @return ApiResponse Response from the API call + */ + public function bulkDeleteCustomers(BulkDeleteCustomersRequest $body): ApiResponse + { + $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/v2/customers/bulk-delete') + ->auth('global') + ->parameters(HeaderParam::init('Content-Type', 'application/json'), BodyParam::init($body)); + + $_resHandler = $this->responseHandler()->type(BulkDeleteCustomersResponse::class)->returnApiResponse(); + + return $this->execute($_reqBuilder, $_resHandler); + } + + /** + * Retrieves multiple customer profiles. + * + * This endpoint takes a list of customer IDs and returns a map of responses. + * + * @param BulkRetrieveCustomersRequest $body An object containing the fields to POST for the + * request. + * + * See the corresponding object definition for field details. + * + * @return ApiResponse Response from the API call + */ + public function bulkRetrieveCustomers(BulkRetrieveCustomersRequest $body): ApiResponse + { + $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/v2/customers/bulk-retrieve') + ->auth('global') + ->parameters(HeaderParam::init('Content-Type', 'application/json'), BodyParam::init($body)); + + $_resHandler = $this->responseHandler()->type(BulkRetrieveCustomersResponse::class)->returnApiResponse(); + + return $this->execute($_reqBuilder, $_resHandler); + } + + /** + * Updates multiple customer profiles. + * + * This endpoint takes a map of individual update requests and returns a map of responses. + * + * You cannot use this endpoint to change cards on file. To make changes, use the [Cards API]($e/Cards) + * or [Gift Cards API]($e/GiftCards). + * + * @param BulkUpdateCustomersRequest $body An object containing the fields to POST for the + * request. + * + * See the corresponding object definition for field details. + * + * @return ApiResponse Response from the API call + */ + public function bulkUpdateCustomers(BulkUpdateCustomersRequest $body): ApiResponse + { + $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/v2/customers/bulk-update') + ->auth('global') + ->parameters(HeaderParam::init('Content-Type', 'application/json'), BodyParam::init($body)); + + $_resHandler = $this->responseHandler()->type(BulkUpdateCustomersResponse::class)->returnApiResponse(); + + return $this->execute($_reqBuilder, $_resHandler); + } + /** * Searches the customer profiles associated with a Square account using one or more supported query * filters. @@ -141,11 +252,6 @@ public function searchCustomers(SearchCustomersRequest $body): ApiResponse /** * Deletes a customer profile from a business. This operation also unlinks any associated cards on file. * - * As a best practice, include the `version` field in the request to enable [optimistic - * concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic- - * concurrency) control. - * If included, the value must be set to the current version of the customer profile. - * * To delete a customer profile that was created by merging existing profiles, you must use the ID of * the newly created profile. * @@ -190,13 +296,7 @@ public function retrieveCustomer(string $customerId): ApiResponse /** * Updates a customer profile. This endpoint supports sparse updates, so only new or changed fields are * required in the request. - * To add or update a field, specify the new value. To remove a field, specify `null` - * (recommended) or specify an empty string (string fields only). - * - * As a best practice, include the `version` field in the request to enable [optimistic - * concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic- - * concurrency) control. - * If included, the value must be set to the current version of the customer profile. + * To add or update a field, specify the new value. To remove a field, specify `null`. * * To update a customer profile that was created by merging existing profiles, you must use the ID of * the newly created profile. diff --git a/src/Apis/InvoicesApi.php b/src/Apis/InvoicesApi.php index 2cd58f2a..38418f67 100644 --- a/src/Apis/InvoicesApi.php +++ b/src/Apis/InvoicesApi.php @@ -286,9 +286,12 @@ public function cancelInvoice(string $invoiceId, CancelInvoiceRequest $body): Ap * * The invoice `status` also changes from `DRAFT` to a status * based on the invoice configuration. For example, the status changes to `UNPAID` if - * Square emails the invoice or `PARTIALLY_PAID` if Square charge a card on file for a portion of the + * Square emails the invoice or `PARTIALLY_PAID` if Square charges a card on file for a portion of the * invoice amount. * + * In addition to the required `ORDERS_WRITE` and `INVOICES_WRITE` permissions, `CUSTOMERS_READ` + * and `PAYMENTS_WRITE` are required when publishing invoices configured for card-on-file payments. + * * @param string $invoiceId The ID of the invoice to publish. * @param PublishInvoiceRequest $body An object containing the fields to POST for the request. * See the corresponding object definition for field details. diff --git a/src/Apis/LocationsApi.php b/src/Apis/LocationsApi.php index b9b7e094..f87dda87 100644 --- a/src/Apis/LocationsApi.php +++ b/src/Apis/LocationsApi.php @@ -21,7 +21,7 @@ class LocationsApi extends BaseApi /** * Provides details about all of the seller's [locations](https://developer.squareup.com/docs/locations- * api), - * including those with an inactive status. + * including those with an inactive status. Locations are listed alphabetically by `name`. * * @return ApiResponse Response from the API call */ diff --git a/src/Apis/V1TransactionsApi.php b/src/Apis/V1TransactionsApi.php index a127ebb8..5f099029 100644 --- a/src/Apis/V1TransactionsApi.php +++ b/src/Apis/V1TransactionsApi.php @@ -10,11 +10,7 @@ use Core\Request\Parameters\TemplateParam; use CoreInterfaces\Core\Request\RequestMethod; use Square\Http\ApiResponse; -use Square\Models\V1CreateRefundRequest; use Square\Models\V1Order; -use Square\Models\V1Payment; -use Square\Models\V1Refund; -use Square\Models\V1Settlement; use Square\Models\V1UpdateOrderRequest; class V1TransactionsApi extends BaseApi @@ -114,284 +110,4 @@ public function v1UpdateOrder(string $locationId, string $orderId, V1UpdateOrder return $this->execute($_reqBuilder, $_resHandler); } - - /** - * Provides summary information for all payments taken for a given - * Square account during a date range. Date ranges cannot exceed 1 year in - * length. See Date ranges for details of inclusive and exclusive dates. - * - * *Note**: Details for payments processed with Square Point of Sale while - * in offline mode may not be transmitted to Square for up to 72 hours. - * Offline payments have a `created_at` value that reflects the time the - * payment was originally processed, not the time it was subsequently - * transmitted to Square. Consequently, the ListPayments endpoint might - * list an offline payment chronologically between online payments that - * were seen in a previous request. - * - * @deprecated - * - * @param string $locationId The ID of the location to list payments for. If you specify me, - * this endpoint returns payments aggregated from all of the business's locations. - * @param string|null $order The order in which payments are listed in the response. - * @param string|null $beginTime The beginning of the requested reporting period, in ISO 8601 - * format. If this value is before January 1, 2013 (2013-01-01T00:00:00Z), this - * endpoint returns an error. Default value: The current time minus one year. - * @param string|null $endTime The end of the requested reporting period, in ISO 8601 format. If - * this value is more than one year greater than begin_time, this endpoint returns an - * error. Default value: The current time. - * @param int|null $limit The maximum number of payments to return in a single response. This - * value cannot exceed 200. - * @param string|null $batchToken A pagination cursor to retrieve the next set of results for - * your - * original query to the endpoint. - * @param bool|null $includePartial Indicates whether or not to include partial payments in the - * response. Partial payments will have the tenders collected so far, but the - * itemizations will be empty until the payment is completed. - * - * @return ApiResponse Response from the API call - */ - public function v1ListPayments( - string $locationId, - ?string $order = null, - ?string $beginTime = null, - ?string $endTime = null, - ?int $limit = null, - ?string $batchToken = null, - ?bool $includePartial = false - ): ApiResponse { - trigger_error('Method ' . __METHOD__ . ' is deprecated.', E_USER_DEPRECATED); - - $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/v1/{location_id}/payments') - ->auth('global') - ->parameters( - TemplateParam::init('location_id', $locationId), - QueryParam::init('order', $order), - QueryParam::init('begin_time', $beginTime), - QueryParam::init('end_time', $endTime), - QueryParam::init('limit', $limit), - QueryParam::init('batch_token', $batchToken), - QueryParam::init('include_partial', $includePartial) - ); - - $_resHandler = $this->responseHandler()->type(V1Payment::class, 1)->returnApiResponse(); - - return $this->execute($_reqBuilder, $_resHandler); - } - - /** - * Provides comprehensive information for a single payment. - * - * @deprecated - * - * @param string $locationId The ID of the payment's associated location. - * @param string $paymentId The Square-issued payment ID. payment_id comes from Payment objects - * returned by the List Payments endpoint, Settlement objects returned by the List - * Settlements endpoint, or Refund objects returned by the List Refunds endpoint. - * - * @return ApiResponse Response from the API call - */ - public function v1RetrievePayment(string $locationId, string $paymentId): ApiResponse - { - trigger_error('Method ' . __METHOD__ . ' is deprecated.', E_USER_DEPRECATED); - - $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/v1/{location_id}/payments/{payment_id}') - ->auth('global') - ->parameters( - TemplateParam::init('location_id', $locationId), - TemplateParam::init('payment_id', $paymentId) - ); - - $_resHandler = $this->responseHandler()->type(V1Payment::class)->returnApiResponse(); - - return $this->execute($_reqBuilder, $_resHandler); - } - - /** - * 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. - * - * @deprecated - * - * @param string $locationId The ID of the location to list refunds for. - * @param string|null $order The order in which payments are listed in the response. - * @param string|null $beginTime The beginning of the requested reporting period, in ISO 8601 - * format. If this value is before January 1, 2013 (2013-01-01T00:00:00Z), this - * endpoint returns an error. Default value: The current time minus one year. - * @param string|null $endTime The end of the requested reporting period, in ISO 8601 format. If - * this value is more than one year greater than begin_time, this endpoint returns an - * error. Default value: The current time. - * @param int|null $limit The approximate number of refunds to return in a single response. - * Default: 100. Max: 200. Response may contain more results than the prescribed limit - * when refunds are made simultaneously to multiple tenders in a payment or when - * refunds are generated in an exchange to account for the value of returned goods. - * @param string|null $batchToken A pagination cursor to retrieve the next set of results for - * your - * original query to the endpoint. - * - * @return ApiResponse Response from the API call - */ - public function v1ListRefunds( - string $locationId, - ?string $order = null, - ?string $beginTime = null, - ?string $endTime = null, - ?int $limit = null, - ?string $batchToken = null - ): ApiResponse { - trigger_error('Method ' . __METHOD__ . ' is deprecated.', E_USER_DEPRECATED); - - $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/v1/{location_id}/refunds') - ->auth('global') - ->parameters( - TemplateParam::init('location_id', $locationId), - QueryParam::init('order', $order), - QueryParam::init('begin_time', $beginTime), - QueryParam::init('end_time', $endTime), - QueryParam::init('limit', $limit), - QueryParam::init('batch_token', $batchToken) - ); - - $_resHandler = $this->responseHandler()->type(V1Refund::class, 1)->returnApiResponse(); - - return $this->execute($_reqBuilder, $_resHandler); - } - - /** - * Issues a refund for a previously processed payment. You must issue - * a refund within 60 days of the associated payment. - * - * You cannot issue a partial refund for a split tender payment. You must - * instead issue a full or partial refund for a particular tender, by - * providing the applicable tender id to the V1CreateRefund endpoint. - * Issuing a full refund for a split tender payment refunds all tenders - * associated with the payment. - * - * Issuing a refund for a card payment is not reversible. For development - * purposes, you can create fake cash payments in Square Point of Sale and - * refund them. - * - * @deprecated - * - * @param string $locationId The ID of the original payment's associated location. - * @param V1CreateRefundRequest $body An object containing the fields to POST for the request. - * See the corresponding object definition for field details. - * - * @return ApiResponse Response from the API call - */ - public function v1CreateRefund(string $locationId, V1CreateRefundRequest $body): ApiResponse - { - trigger_error('Method ' . __METHOD__ . ' is deprecated.', E_USER_DEPRECATED); - - $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/v1/{location_id}/refunds') - ->auth('global') - ->parameters( - TemplateParam::init('location_id', $locationId), - HeaderParam::init('Content-Type', 'application/json'), - BodyParam::init($body) - ); - - $_resHandler = $this->responseHandler()->type(V1Refund::class)->returnApiResponse(); - - return $this->execute($_reqBuilder, $_resHandler); - } - - /** - * Provides summary information for all deposits and withdrawals - * initiated by Square to a linked bank account during a date range. Date - * ranges cannot exceed one year in length. - * - * *Note**: the ListSettlements endpoint does not provide entry - * information. - * - * @deprecated - * - * @param string $locationId The ID of the location to list settlements for. If you specify me, - * this endpoint returns settlements aggregated from all of the business's locations. - * @param string|null $order The order in which settlements are listed in the response. - * @param string|null $beginTime The beginning of the requested reporting period, in ISO 8601 - * format. If this value is before January 1, 2013 (2013-01-01T00:00:00Z), this - * endpoint returns an error. Default value: The current time minus one year. - * @param string|null $endTime The end of the requested reporting period, in ISO 8601 format. If - * this value is more than one year greater than begin_time, this endpoint returns an - * error. Default value: The current time. - * @param int|null $limit The maximum number of settlements to return in a single response. This - * value cannot exceed 200. - * @param string|null $status Provide this parameter to retrieve only settlements with a - * particular status (SENT or FAILED). - * @param string|null $batchToken A pagination cursor to retrieve the next set of results for - * your - * original query to the endpoint. - * - * @return ApiResponse Response from the API call - */ - public function v1ListSettlements( - string $locationId, - ?string $order = null, - ?string $beginTime = null, - ?string $endTime = null, - ?int $limit = null, - ?string $status = null, - ?string $batchToken = null - ): ApiResponse { - trigger_error('Method ' . __METHOD__ . ' is deprecated.', E_USER_DEPRECATED); - - $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/v1/{location_id}/settlements') - ->auth('global') - ->parameters( - TemplateParam::init('location_id', $locationId), - QueryParam::init('order', $order), - QueryParam::init('begin_time', $beginTime), - QueryParam::init('end_time', $endTime), - QueryParam::init('limit', $limit), - QueryParam::init('status', $status), - QueryParam::init('batch_token', $batchToken) - ); - - $_resHandler = $this->responseHandler()->type(V1Settlement::class, 1)->returnApiResponse(); - - return $this->execute($_reqBuilder, $_resHandler); - } - - /** - * Provides comprehensive information for a single settlement. - * - * The returned `Settlement` objects include an `entries` field that lists - * the transactions that contribute to the settlement total. Most - * settlement entries correspond to a payment payout, but settlement - * entries are also generated for less common events, like refunds, manual - * adjustments, or chargeback holds. - * - * Square initiates its regular deposits as indicated in the - * [Deposit Options with Square](https://squareup.com/help/us/en/article/3807) - * help article. Details for a regular deposit are usually not available - * from Connect API endpoints before 10 p.m. PST the same day. - * - * Square does not know when an initiated settlement **completes**, only - * whether it has failed. A completed settlement is typically reflected in - * a bank account within 3 business days, but in exceptional cases it may - * take longer. - * - * @deprecated - * - * @param string $locationId The ID of the settlements's associated location. - * @param string $settlementId The settlement's Square-issued ID. You obtain this value from - * Settlement objects returned by the List Settlements endpoint. - * - * @return ApiResponse Response from the API call - */ - public function v1RetrieveSettlement(string $locationId, string $settlementId): ApiResponse - { - trigger_error('Method ' . __METHOD__ . ' is deprecated.', E_USER_DEPRECATED); - - $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/v1/{location_id}/settlements/{settlement_id}') - ->auth('global') - ->parameters( - TemplateParam::init('location_id', $locationId), - TemplateParam::init('settlement_id', $settlementId) - ); - - $_resHandler = $this->responseHandler()->type(V1Settlement::class)->returnApiResponse(); - - return $this->execute($_reqBuilder, $_resHandler); - } } diff --git a/src/Authentication/BearerAuthCredentialsBuilder.php b/src/Authentication/BearerAuthCredentialsBuilder.php new file mode 100644 index 00000000..38c8b1ca --- /dev/null +++ b/src/Authentication/BearerAuthCredentialsBuilder.php @@ -0,0 +1,51 @@ +config = $config; + } + + /** + * Initializer for BearerAuthCredentialsBuilder + * + * @param string $accessToken + */ + public static function init(string $accessToken): self + { + return new self(['accessToken' => $accessToken]); + } + + /** + * Setter for AccessToken. + * + * @param string $accessToken + * + * @return $this + */ + public function accessToken(string $accessToken): self + { + $this->config['accessToken'] = $accessToken; + return $this; + } + + public function getConfiguration(): array + { + return CoreHelper::clone($this->config); + } +} diff --git a/src/BearerAuthManager.php b/src/Authentication/BearerAuthManager.php similarity index 94% rename from src/BearerAuthManager.php rename to src/Authentication/BearerAuthManager.php index f34d72ba..c4a877bd 100644 --- a/src/BearerAuthManager.php +++ b/src/Authentication/BearerAuthManager.php @@ -2,10 +2,11 @@ declare(strict_types=1); -namespace Square; +namespace Square\Authentication; use Core\Authentication\CoreAuth; use Core\Request\Parameters\HeaderParam; +use Square\BearerAuthCredentials; /** * Utility class for authorization and token management. diff --git a/src/ConfigurationDefaults.php b/src/ConfigurationDefaults.php index b645d9ec..863dde05 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-01-18'; + public const SQUARE_VERSION = '2024-02-22'; public const ADDITIONAL_HEADERS = []; diff --git a/src/ConfigurationInterface.php b/src/ConfigurationInterface.php index 26f6c353..e68b412f 100644 --- a/src/ConfigurationInterface.php +++ b/src/ConfigurationInterface.php @@ -5,6 +5,7 @@ namespace Square; use CoreInterfaces\Http\HttpConfigurations; +use Square\Authentication\BearerAuthCredentialsBuilder; /** * An interface for all configuration parameters required by the SDK. @@ -39,7 +40,12 @@ public function getCustomUrl(): string; /** * Get the credentials to use with BearerAuth */ - public function getBearerAuthCredentials(): ?BearerAuthCredentials; + public function getBearerAuthCredentials(): BearerAuthCredentials; + + /** + * Get the credentials builder instance to update credentials for BearerAuth + */ + public function getBearerAuthCredentialsBuilder(): ?BearerAuthCredentialsBuilder; /** * Get the base uri for a given server in the current environment. diff --git a/src/Models/ActivityType.php b/src/Models/ActivityType.php index ffffeb63..32037c75 100644 --- a/src/Models/ActivityType.php +++ b/src/Models/ActivityType.php @@ -22,14 +22,14 @@ class ActivityType public const APP_FEE_REVENUE = 'APP_FEE_REVENUE'; /** - * An automatic transfer from the payment processing balance to the Square Savings account. - * These are, generally, proportional to the seller's sales. + * An automatic transfer from the payment processing balance to the Square Savings account. These are + * generally proportional to the seller's sales. */ public const AUTOMATIC_SAVINGS = 'AUTOMATIC_SAVINGS'; /** - * An automatic transfer from the Square Savings account back to the processing balance. - * These are, generally, proportional to the seller's refunds. + * An automatic transfer from the Square Savings account back to the processing balance. These are + * generally proportional to the seller's refunds. */ public const AUTOMATIC_SAVINGS_REVERSED = 'AUTOMATIC_SAVINGS_REVERSED'; @@ -54,7 +54,7 @@ class ActivityType public const ESCHEATMENT = 'ESCHEATMENT'; /** - * The Square processing fee. + * The cost plus adjustment fee. */ public const FEE = 'FEE'; @@ -72,8 +72,8 @@ class ActivityType public const HOLD_ADJUSTMENT = 'HOLD_ADJUSTMENT'; /** - * An external change to a seller's balance. Initial, in the sense that it - * causes the creation of the other activity types, such as hold and refund. + * An external change to a seller's balance (initial, in the sense that it causes the creation of the + * other activity types, such as a hold and refund). */ public const INITIAL_BALANCE_CHANGE = 'INITIAL_BALANCE_CHANGE'; @@ -88,27 +88,27 @@ class ActivityType public const MONEY_TRANSFER_REVERSAL = 'MONEY_TRANSFER_REVERSAL'; /** - * The balance change for a chargeback that has been filed. + * The balance change for a chargeback that's been filed. */ public const OPEN_DISPUTE = 'OPEN_DISPUTE'; /** - * Any other type that does not belong in the rest of the types. + * Any other type that doesn't belong in the rest of the types. */ public const OTHER = 'OTHER'; /** - * Any other type of adjustment that does not fall under existing types. + * Any other type of adjustment that doesn't fall under existing types. */ public const OTHER_ADJUSTMENT = 'OTHER_ADJUSTMENT'; /** - * A fee paid to a third-party merchant. + * A fee paid to a third-party seller. */ public const PAID_SERVICE_FEE = 'PAID_SERVICE_FEE'; /** - * A fee paid to a third-party merchant. + * A fee refunded to a third-party seller. */ public const PAID_SERVICE_FEE_REFUND = 'PAID_SERVICE_FEE_REFUND'; @@ -128,12 +128,12 @@ class ActivityType public const RELEASE_ADJUSTMENT = 'RELEASE_ADJUSTMENT'; /** - * Fees paid for funding risk reserve. + * Fees paid for a funding risk reserve. */ public const RESERVE_HOLD = 'RESERVE_HOLD'; /** - * Fees released from risk reserve. + * Fees released from a risk reserve. */ public const RESERVE_RELEASE = 'RESERVE_RELEASE'; @@ -145,14 +145,14 @@ class ActivityType public const RETURNED_PAYOUT = 'RETURNED_PAYOUT'; /** - * A capital merchant cash advance (MCA) assessment. These are, generally, - * proportional to the merchant's sales but can be issued for other reasons related to the MCA. + * A capital merchant cash advance (MCA) assessment. These are generally proportional to the merchant's + * sales but can be issued for other reasons related to the MCA. */ public const SQUARE_CAPITAL_PAYMENT = 'SQUARE_CAPITAL_PAYMENT'; /** - * A capital merchant cash advance (MCA) assessment refund. These are, generally, - * proportional to the merchant's refunds but can be issued for other reasons related to the MCA. + * A capital merchant cash advance (MCA) assessment refund. These are generally proportional to the + * merchant's refunds but can be issued for other reasons related to the MCA. */ public const SQUARE_CAPITAL_REVERSED_PAYMENT = 'SQUARE_CAPITAL_REVERSED_PAYMENT'; @@ -162,7 +162,7 @@ class ActivityType public const SUBSCRIPTION_FEE = 'SUBSCRIPTION_FEE'; /** - * A Square subscription fee that has been refunded. + * A Square subscription fee that's been refunded. */ public const SUBSCRIPTION_FEE_PAID_REFUND = 'SUBSCRIPTION_FEE_PAID_REFUND'; @@ -187,31 +187,124 @@ class ActivityType public const THIRD_PARTY_FEE_REFUND = 'THIRD_PARTY_FEE_REFUND'; /** - * Balance change due to money transfer. + * The balance change due to money transfer. */ public const PAYOUT = 'PAYOUT'; /** - * Indicates the withholding of a portion of each payment by Square that has been - * automatically converted into bitcoin using Cash App. The seller manages their bitcoin in - * their Cash App account. + * Indicates that the portion of each payment withheld by Square was automatically converted into + * bitcoin using Cash App. The seller manages their bitcoin in their Cash App account. */ public const AUTOMATIC_BITCOIN_CONVERSIONS = 'AUTOMATIC_BITCOIN_CONVERSIONS'; /** - * Indicates a return of the payment withholding that had been scheduled to be converted - * into bitcoin using Cash App to the Square payments balance. + * Indicates that a withheld payment, which was scheduled to be converted into bitcoin using Cash App, + * was deposited back to the Square payments balance. */ public const AUTOMATIC_BITCOIN_CONVERSIONS_REVERSED = 'AUTOMATIC_BITCOIN_CONVERSIONS_REVERSED'; /** - * The repayment made toward the outstanding balance on the seller's Square credit card. + * Indicates that a repayment toward the outstanding balance on the seller's Square credit card was + * made. */ public const CREDIT_CARD_REPAYMENT = 'CREDIT_CARD_REPAYMENT'; /** - * The reversal of the repayment made toward the outstanding balance on the seller's - * Square credit card. + * Indicates that a repayment toward the outstanding balance on the seller's Square credit card was + * reversed. */ public const CREDIT_CARD_REPAYMENT_REVERSED = 'CREDIT_CARD_REPAYMENT_REVERSED'; + + /** + * Cashback amount given by a Square Local Offers seller to their customer for a purchase. + */ + public const LOCAL_OFFERS_CASHBACK = 'LOCAL_OFFERS_CASHBACK'; + + /** + * A commission fee paid by a Square Local Offers seller to Square for a purchase discovered through + * Square Local Offers. + */ + public const LOCAL_OFFERS_FEE = 'LOCAL_OFFERS_FEE'; + + /** + * When activating Percentage Processing, a credit is applied to the seller’s account to offset any + * negative balance caused by a dispute. + */ + public const PERCENTAGE_PROCESSING_ENROLLMENT = 'PERCENTAGE_PROCESSING_ENROLLMENT'; + + /** + * Deducting the outstanding Percentage Processing balance from the seller’s account. It's the final + * installment in repaying the dispute-induced negative balance through percentage processing. + */ + public const PERCENTAGE_PROCESSING_DEACTIVATION = 'PERCENTAGE_PROCESSING_DEACTIVATION'; + + /** + * Withheld funds from a payment to cover a negative balance. It's an installment to repay the amount + * from a dispute that had been offset during Percentage Processing enrollment. + */ + public const PERCENTAGE_PROCESSING_REPAYMENT = 'PERCENTAGE_PROCESSING_REPAYMENT'; + + /** + * The reversal of a percentage processing repayment that happens for example when a refund is issued + * for a payment. + */ + public const PERCENTAGE_PROCESSING_REPAYMENT_REVERSED = 'PERCENTAGE_PROCESSING_REPAYMENT_REVERSED'; + + /** + * The processing fee for a payment. If sellers opt for Gross Settlement, i.e., direct bank withdrawal + * instead of deducting fees from daily sales, the processing fee is recorded separately as a new + * payout entry, not part of the CHARGE payout entry. + */ + public const PROCESSING_FEE = 'PROCESSING_FEE'; + + /** + * The processing fee for a payment refund issued by sellers enrolled in Gross Settlement. The refunded + * processing fee is recorded separately as a new payout entry, not part of the REFUND payout entry. + */ + public const PROCESSING_FEE_REFUND = 'PROCESSING_FEE_REFUND'; + + /** + * When undoing a processing fee refund in a Gross Settlement payment, this payout entry type is used. + */ + public const UNDO_PROCESSING_FEE_REFUND = 'UNDO_PROCESSING_FEE_REFUND'; + + /** + * Fee collected during the sale or reload of a gift card. This fee, which is a portion of the amount + * loaded on the gift card, is deducted from the merchant's payment balance. + */ + public const GIFT_CARD_LOAD_FEE = 'GIFT_CARD_LOAD_FEE'; + + /** + * Refund for fee charged during the sale or reload of a gift card. + */ + public const GIFT_CARD_LOAD_FEE_REFUND = 'GIFT_CARD_LOAD_FEE_REFUND'; + + /** + * The undo of a refund for a fee charged during the sale or reload of a gift card. + */ + public const UNDO_GIFT_CARD_LOAD_FEE_REFUND = 'UNDO_GIFT_CARD_LOAD_FEE_REFUND'; + + /** + * A transfer of funds to a banking folder. In the United States, the folder name is 'Checking Folder'; + * in Canada, it's 'Balance Folder.' + */ + public const BALANCE_FOLDERS_TRANSFER = 'BALANCE_FOLDERS_TRANSFER'; + + /** + * A reversal of transfer of funds from a banking folder. In the United States, the folder name is + * 'Checking Folder'; in Canada, it's 'Balance Folder.' + */ + public const BALANCE_FOLDERS_TRANSFER_REVERSED = 'BALANCE_FOLDERS_TRANSFER_REVERSED'; + + /** + * A transfer of gift card funds to a central gift card pool account. In franchises, when gift cards + * are loaded or reloaded at any location, the money transfers to the franchisor's account. + */ + public const GIFT_CARD_POOL_TRANSFER = 'GIFT_CARD_POOL_TRANSFER'; + + /** + * A reversal of transfer of gift card funds from a central gift card pool account. In franchises, when + * gift cards are loaded or reloaded at any location, the money transfers to the franchisor's account. + */ + public const GIFT_CARD_POOL_TRANSFER_REVERSED = 'GIFT_CARD_POOL_TRANSFER_REVERSED'; } diff --git a/src/Models/Builders/BulkCreateCustomerDataBuilder.php b/src/Models/Builders/BulkCreateCustomerDataBuilder.php new file mode 100644 index 00000000..211dcf3e --- /dev/null +++ b/src/Models/Builders/BulkCreateCustomerDataBuilder.php @@ -0,0 +1,224 @@ +instance = $instance; + } + + /** + * Initializes a new bulk create customer data Builder object. + */ + public static function init(): self + { + return new self(new BulkCreateCustomerData()); + } + + /** + * Sets given name field. + */ + public function givenName(?string $value): self + { + $this->instance->setGivenName($value); + return $this; + } + + /** + * Unsets given name field. + */ + public function unsetGivenName(): self + { + $this->instance->unsetGivenName(); + return $this; + } + + /** + * Sets family name field. + */ + public function familyName(?string $value): self + { + $this->instance->setFamilyName($value); + return $this; + } + + /** + * Unsets family name field. + */ + public function unsetFamilyName(): self + { + $this->instance->unsetFamilyName(); + return $this; + } + + /** + * Sets company name field. + */ + public function companyName(?string $value): self + { + $this->instance->setCompanyName($value); + return $this; + } + + /** + * Unsets company name field. + */ + public function unsetCompanyName(): self + { + $this->instance->unsetCompanyName(); + return $this; + } + + /** + * Sets nickname field. + */ + public function nickname(?string $value): self + { + $this->instance->setNickname($value); + return $this; + } + + /** + * Unsets nickname field. + */ + public function unsetNickname(): self + { + $this->instance->unsetNickname(); + return $this; + } + + /** + * Sets email address field. + */ + public function emailAddress(?string $value): self + { + $this->instance->setEmailAddress($value); + return $this; + } + + /** + * Unsets email address field. + */ + public function unsetEmailAddress(): self + { + $this->instance->unsetEmailAddress(); + return $this; + } + + /** + * Sets address field. + */ + public function address(?Address $value): self + { + $this->instance->setAddress($value); + return $this; + } + + /** + * Sets phone number field. + */ + public function phoneNumber(?string $value): self + { + $this->instance->setPhoneNumber($value); + return $this; + } + + /** + * Unsets phone number field. + */ + public function unsetPhoneNumber(): self + { + $this->instance->unsetPhoneNumber(); + return $this; + } + + /** + * Sets reference id field. + */ + public function referenceId(?string $value): self + { + $this->instance->setReferenceId($value); + return $this; + } + + /** + * Unsets reference id field. + */ + public function unsetReferenceId(): self + { + $this->instance->unsetReferenceId(); + return $this; + } + + /** + * Sets note field. + */ + public function note(?string $value): self + { + $this->instance->setNote($value); + return $this; + } + + /** + * Unsets note field. + */ + public function unsetNote(): self + { + $this->instance->unsetNote(); + return $this; + } + + /** + * Sets birthday field. + */ + public function birthday(?string $value): self + { + $this->instance->setBirthday($value); + return $this; + } + + /** + * Unsets birthday field. + */ + public function unsetBirthday(): self + { + $this->instance->unsetBirthday(); + return $this; + } + + /** + * Sets tax ids field. + */ + public function taxIds(?CustomerTaxIds $value): self + { + $this->instance->setTaxIds($value); + return $this; + } + + /** + * Initializes a new bulk create customer data object. + */ + public function build(): BulkCreateCustomerData + { + return CoreHelper::clone($this->instance); + } +} diff --git a/src/Models/Builders/BulkCreateCustomersRequestBuilder.php b/src/Models/Builders/BulkCreateCustomersRequestBuilder.php new file mode 100644 index 00000000..b0064e05 --- /dev/null +++ b/src/Models/Builders/BulkCreateCustomersRequestBuilder.php @@ -0,0 +1,42 @@ +instance = $instance; + } + + /** + * Initializes a new bulk create customers request Builder object. + */ + public static function init(array $customers): self + { + return new self(new BulkCreateCustomersRequest($customers)); + } + + /** + * Initializes a new bulk create customers request object. + */ + public function build(): BulkCreateCustomersRequest + { + return CoreHelper::clone($this->instance); + } +} diff --git a/src/Models/Builders/BulkCreateCustomersResponseBuilder.php b/src/Models/Builders/BulkCreateCustomersResponseBuilder.php new file mode 100644 index 00000000..50e3f79e --- /dev/null +++ b/src/Models/Builders/BulkCreateCustomersResponseBuilder.php @@ -0,0 +1,60 @@ +instance = $instance; + } + + /** + * Initializes a new bulk create customers response Builder object. + */ + public static function init(): self + { + return new self(new BulkCreateCustomersResponse()); + } + + /** + * Sets responses field. + */ + public function responses(?array $value): self + { + $this->instance->setResponses($value); + return $this; + } + + /** + * Sets errors field. + */ + public function errors(?array $value): self + { + $this->instance->setErrors($value); + return $this; + } + + /** + * Initializes a new bulk create customers response object. + */ + public function build(): BulkCreateCustomersResponse + { + return CoreHelper::clone($this->instance); + } +} diff --git a/src/Models/Builders/BulkDeleteCustomersRequestBuilder.php b/src/Models/Builders/BulkDeleteCustomersRequestBuilder.php new file mode 100644 index 00000000..2376d16c --- /dev/null +++ b/src/Models/Builders/BulkDeleteCustomersRequestBuilder.php @@ -0,0 +1,42 @@ +instance = $instance; + } + + /** + * Initializes a new bulk delete customers request Builder object. + */ + public static function init(array $customerIds): self + { + return new self(new BulkDeleteCustomersRequest($customerIds)); + } + + /** + * Initializes a new bulk delete customers request object. + */ + public function build(): BulkDeleteCustomersRequest + { + return CoreHelper::clone($this->instance); + } +} diff --git a/src/Models/Builders/BulkDeleteCustomersResponseBuilder.php b/src/Models/Builders/BulkDeleteCustomersResponseBuilder.php new file mode 100644 index 00000000..531cb1f6 --- /dev/null +++ b/src/Models/Builders/BulkDeleteCustomersResponseBuilder.php @@ -0,0 +1,60 @@ +instance = $instance; + } + + /** + * Initializes a new bulk delete customers response Builder object. + */ + public static function init(): self + { + return new self(new BulkDeleteCustomersResponse()); + } + + /** + * Sets responses field. + */ + public function responses(?array $value): self + { + $this->instance->setResponses($value); + return $this; + } + + /** + * Sets errors field. + */ + public function errors(?array $value): self + { + $this->instance->setErrors($value); + return $this; + } + + /** + * Initializes a new bulk delete customers response object. + */ + public function build(): BulkDeleteCustomersResponse + { + return CoreHelper::clone($this->instance); + } +} diff --git a/src/Models/Builders/BulkRetrieveCustomersRequestBuilder.php b/src/Models/Builders/BulkRetrieveCustomersRequestBuilder.php new file mode 100644 index 00000000..0fb60858 --- /dev/null +++ b/src/Models/Builders/BulkRetrieveCustomersRequestBuilder.php @@ -0,0 +1,42 @@ +instance = $instance; + } + + /** + * Initializes a new bulk retrieve customers request Builder object. + */ + public static function init(array $customerIds): self + { + return new self(new BulkRetrieveCustomersRequest($customerIds)); + } + + /** + * Initializes a new bulk retrieve customers request object. + */ + public function build(): BulkRetrieveCustomersRequest + { + return CoreHelper::clone($this->instance); + } +} diff --git a/src/Models/Builders/BulkRetrieveCustomersResponseBuilder.php b/src/Models/Builders/BulkRetrieveCustomersResponseBuilder.php new file mode 100644 index 00000000..13e8038c --- /dev/null +++ b/src/Models/Builders/BulkRetrieveCustomersResponseBuilder.php @@ -0,0 +1,60 @@ +instance = $instance; + } + + /** + * Initializes a new bulk retrieve customers response Builder object. + */ + public static function init(): self + { + return new self(new BulkRetrieveCustomersResponse()); + } + + /** + * Sets responses field. + */ + public function responses(?array $value): self + { + $this->instance->setResponses($value); + return $this; + } + + /** + * Sets errors field. + */ + public function errors(?array $value): self + { + $this->instance->setErrors($value); + return $this; + } + + /** + * Initializes a new bulk retrieve customers response object. + */ + public function build(): BulkRetrieveCustomersResponse + { + return CoreHelper::clone($this->instance); + } +} diff --git a/src/Models/Builders/BulkUpdateCustomerDataBuilder.php b/src/Models/Builders/BulkUpdateCustomerDataBuilder.php new file mode 100644 index 00000000..e174a23e --- /dev/null +++ b/src/Models/Builders/BulkUpdateCustomerDataBuilder.php @@ -0,0 +1,233 @@ +instance = $instance; + } + + /** + * Initializes a new bulk update customer data Builder object. + */ + public static function init(): self + { + return new self(new BulkUpdateCustomerData()); + } + + /** + * Sets given name field. + */ + public function givenName(?string $value): self + { + $this->instance->setGivenName($value); + return $this; + } + + /** + * Unsets given name field. + */ + public function unsetGivenName(): self + { + $this->instance->unsetGivenName(); + return $this; + } + + /** + * Sets family name field. + */ + public function familyName(?string $value): self + { + $this->instance->setFamilyName($value); + return $this; + } + + /** + * Unsets family name field. + */ + public function unsetFamilyName(): self + { + $this->instance->unsetFamilyName(); + return $this; + } + + /** + * Sets company name field. + */ + public function companyName(?string $value): self + { + $this->instance->setCompanyName($value); + return $this; + } + + /** + * Unsets company name field. + */ + public function unsetCompanyName(): self + { + $this->instance->unsetCompanyName(); + return $this; + } + + /** + * Sets nickname field. + */ + public function nickname(?string $value): self + { + $this->instance->setNickname($value); + return $this; + } + + /** + * Unsets nickname field. + */ + public function unsetNickname(): self + { + $this->instance->unsetNickname(); + return $this; + } + + /** + * Sets email address field. + */ + public function emailAddress(?string $value): self + { + $this->instance->setEmailAddress($value); + return $this; + } + + /** + * Unsets email address field. + */ + public function unsetEmailAddress(): self + { + $this->instance->unsetEmailAddress(); + return $this; + } + + /** + * Sets address field. + */ + public function address(?Address $value): self + { + $this->instance->setAddress($value); + return $this; + } + + /** + * Sets phone number field. + */ + public function phoneNumber(?string $value): self + { + $this->instance->setPhoneNumber($value); + return $this; + } + + /** + * Unsets phone number field. + */ + public function unsetPhoneNumber(): self + { + $this->instance->unsetPhoneNumber(); + return $this; + } + + /** + * Sets reference id field. + */ + public function referenceId(?string $value): self + { + $this->instance->setReferenceId($value); + return $this; + } + + /** + * Unsets reference id field. + */ + public function unsetReferenceId(): self + { + $this->instance->unsetReferenceId(); + return $this; + } + + /** + * Sets note field. + */ + public function note(?string $value): self + { + $this->instance->setNote($value); + return $this; + } + + /** + * Unsets note field. + */ + public function unsetNote(): self + { + $this->instance->unsetNote(); + return $this; + } + + /** + * Sets birthday field. + */ + public function birthday(?string $value): self + { + $this->instance->setBirthday($value); + return $this; + } + + /** + * Unsets birthday field. + */ + public function unsetBirthday(): self + { + $this->instance->unsetBirthday(); + return $this; + } + + /** + * Sets tax ids field. + */ + public function taxIds(?CustomerTaxIds $value): self + { + $this->instance->setTaxIds($value); + return $this; + } + + /** + * Sets version field. + */ + public function version(?int $value): self + { + $this->instance->setVersion($value); + return $this; + } + + /** + * Initializes a new bulk update customer data object. + */ + public function build(): BulkUpdateCustomerData + { + return CoreHelper::clone($this->instance); + } +} diff --git a/src/Models/Builders/BulkUpdateCustomersRequestBuilder.php b/src/Models/Builders/BulkUpdateCustomersRequestBuilder.php new file mode 100644 index 00000000..50638164 --- /dev/null +++ b/src/Models/Builders/BulkUpdateCustomersRequestBuilder.php @@ -0,0 +1,42 @@ +instance = $instance; + } + + /** + * Initializes a new bulk update customers request Builder object. + */ + public static function init(array $customers): self + { + return new self(new BulkUpdateCustomersRequest($customers)); + } + + /** + * Initializes a new bulk update customers request object. + */ + public function build(): BulkUpdateCustomersRequest + { + return CoreHelper::clone($this->instance); + } +} diff --git a/src/Models/Builders/BulkUpdateCustomersResponseBuilder.php b/src/Models/Builders/BulkUpdateCustomersResponseBuilder.php new file mode 100644 index 00000000..77680a81 --- /dev/null +++ b/src/Models/Builders/BulkUpdateCustomersResponseBuilder.php @@ -0,0 +1,60 @@ +instance = $instance; + } + + /** + * Initializes a new bulk update customers response Builder object. + */ + public static function init(): self + { + return new self(new BulkUpdateCustomersResponse()); + } + + /** + * Sets responses field. + */ + public function responses(?array $value): self + { + $this->instance->setResponses($value); + return $this; + } + + /** + * Sets errors field. + */ + public function errors(?array $value): self + { + $this->instance->setErrors($value); + return $this; + } + + /** + * Initializes a new bulk update customers response object. + */ + public function build(): BulkUpdateCustomersResponse + { + return CoreHelper::clone($this->instance); + } +} diff --git a/src/Models/Builders/CatalogItemModifierListInfoBuilder.php b/src/Models/Builders/CatalogItemModifierListInfoBuilder.php index 71b7000e..5d46a53a 100644 --- a/src/Models/Builders/CatalogItemModifierListInfoBuilder.php +++ b/src/Models/Builders/CatalogItemModifierListInfoBuilder.php @@ -104,6 +104,24 @@ public function unsetEnabled(): self return $this; } + /** + * Sets ordinal field. + */ + public function ordinal(?int $value): self + { + $this->instance->setOrdinal($value); + return $this; + } + + /** + * Unsets ordinal field. + */ + public function unsetOrdinal(): self + { + $this->instance->unsetOrdinal(); + return $this; + } + /** * Initializes a new catalog item modifier list info object. */ diff --git a/src/Models/Builders/CatalogModifierListBuilder.php b/src/Models/Builders/CatalogModifierListBuilder.php index 69b31db0..b17a4830 100644 --- a/src/Models/Builders/CatalogModifierListBuilder.php +++ b/src/Models/Builders/CatalogModifierListBuilder.php @@ -113,6 +113,69 @@ public function unsetImageIds(): self return $this; } + /** + * Sets modifier type field. + */ + public function modifierType(?string $value): self + { + $this->instance->setModifierType($value); + return $this; + } + + /** + * Sets max length field. + */ + public function maxLength(?int $value): self + { + $this->instance->setMaxLength($value); + return $this; + } + + /** + * Unsets max length field. + */ + public function unsetMaxLength(): self + { + $this->instance->unsetMaxLength(); + return $this; + } + + /** + * Sets text required field. + */ + public function textRequired(?bool $value): self + { + $this->instance->setTextRequired($value); + return $this; + } + + /** + * Unsets text required field. + */ + public function unsetTextRequired(): self + { + $this->instance->unsetTextRequired(); + return $this; + } + + /** + * Sets internal name field. + */ + public function internalName(?string $value): self + { + $this->instance->setInternalName($value); + return $this; + } + + /** + * Unsets internal name field. + */ + public function unsetInternalName(): self + { + $this->instance->unsetInternalName(); + return $this; + } + /** * Initializes a new catalog modifier list object. */ diff --git a/src/Models/Builders/V1CreateRefundRequestBuilder.php b/src/Models/Builders/V1CreateRefundRequestBuilder.php deleted file mode 100644 index 02942bab..00000000 --- a/src/Models/Builders/V1CreateRefundRequestBuilder.php +++ /dev/null @@ -1,70 +0,0 @@ -instance = $instance; - } - - /** - * Initializes a new v1 create refund request Builder object. - */ - public static function init(string $paymentId, string $type, string $reason): self - { - return new self(new V1CreateRefundRequest($paymentId, $type, $reason)); - } - - /** - * Sets refunded money field. - */ - public function refundedMoney(?V1Money $value): self - { - $this->instance->setRefundedMoney($value); - return $this; - } - - /** - * Sets request idempotence key field. - */ - public function requestIdempotenceKey(?string $value): self - { - $this->instance->setRequestIdempotenceKey($value); - return $this; - } - - /** - * Unsets request idempotence key field. - */ - public function unsetRequestIdempotenceKey(): self - { - $this->instance->unsetRequestIdempotenceKey(); - return $this; - } - - /** - * Initializes a new v1 create refund request object. - */ - public function build(): V1CreateRefundRequest - { - return CoreHelper::clone($this->instance); - } -} diff --git a/src/Models/Builders/V1ListPaymentsRequestBuilder.php b/src/Models/Builders/V1ListPaymentsRequestBuilder.php deleted file mode 100644 index d974e5b4..00000000 --- a/src/Models/Builders/V1ListPaymentsRequestBuilder.php +++ /dev/null @@ -1,141 +0,0 @@ -instance = $instance; - } - - /** - * Initializes a new v1 list payments request Builder object. - */ - public static function init(): self - { - return new self(new V1ListPaymentsRequest()); - } - - /** - * Sets order field. - */ - public function order(?string $value): self - { - $this->instance->setOrder($value); - return $this; - } - - /** - * Sets begin time field. - */ - public function beginTime(?string $value): self - { - $this->instance->setBeginTime($value); - return $this; - } - - /** - * Unsets begin time field. - */ - public function unsetBeginTime(): self - { - $this->instance->unsetBeginTime(); - return $this; - } - - /** - * Sets end time field. - */ - public function endTime(?string $value): self - { - $this->instance->setEndTime($value); - return $this; - } - - /** - * Unsets end time field. - */ - public function unsetEndTime(): self - { - $this->instance->unsetEndTime(); - return $this; - } - - /** - * Sets limit field. - */ - public function limit(?int $value): self - { - $this->instance->setLimit($value); - return $this; - } - - /** - * Unsets limit field. - */ - public function unsetLimit(): self - { - $this->instance->unsetLimit(); - return $this; - } - - /** - * Sets batch token field. - */ - public function batchToken(?string $value): self - { - $this->instance->setBatchToken($value); - return $this; - } - - /** - * Unsets batch token field. - */ - public function unsetBatchToken(): self - { - $this->instance->unsetBatchToken(); - return $this; - } - - /** - * Sets include partial field. - */ - public function includePartial(?bool $value): self - { - $this->instance->setIncludePartial($value); - return $this; - } - - /** - * Unsets include partial field. - */ - public function unsetIncludePartial(): self - { - $this->instance->unsetIncludePartial(); - return $this; - } - - /** - * Initializes a new v1 list payments request object. - */ - public function build(): V1ListPaymentsRequest - { - return CoreHelper::clone($this->instance); - } -} diff --git a/src/Models/Builders/V1ListPaymentsResponseBuilder.php b/src/Models/Builders/V1ListPaymentsResponseBuilder.php deleted file mode 100644 index 0d1ccb79..00000000 --- a/src/Models/Builders/V1ListPaymentsResponseBuilder.php +++ /dev/null @@ -1,51 +0,0 @@ -instance = $instance; - } - - /** - * Initializes a new v1 list payments response Builder object. - */ - public static function init(): self - { - return new self(new V1ListPaymentsResponse()); - } - - /** - * Sets items field. - */ - public function items(?array $value): self - { - $this->instance->setItems($value); - return $this; - } - - /** - * Initializes a new v1 list payments response object. - */ - public function build(): V1ListPaymentsResponse - { - return CoreHelper::clone($this->instance); - } -} diff --git a/src/Models/Builders/V1ListRefundsRequestBuilder.php b/src/Models/Builders/V1ListRefundsRequestBuilder.php deleted file mode 100644 index 442f59c9..00000000 --- a/src/Models/Builders/V1ListRefundsRequestBuilder.php +++ /dev/null @@ -1,123 +0,0 @@ -instance = $instance; - } - - /** - * Initializes a new v1 list refunds request Builder object. - */ - public static function init(): self - { - return new self(new V1ListRefundsRequest()); - } - - /** - * Sets order field. - */ - public function order(?string $value): self - { - $this->instance->setOrder($value); - return $this; - } - - /** - * Sets begin time field. - */ - public function beginTime(?string $value): self - { - $this->instance->setBeginTime($value); - return $this; - } - - /** - * Unsets begin time field. - */ - public function unsetBeginTime(): self - { - $this->instance->unsetBeginTime(); - return $this; - } - - /** - * Sets end time field. - */ - public function endTime(?string $value): self - { - $this->instance->setEndTime($value); - return $this; - } - - /** - * Unsets end time field. - */ - public function unsetEndTime(): self - { - $this->instance->unsetEndTime(); - return $this; - } - - /** - * Sets limit field. - */ - public function limit(?int $value): self - { - $this->instance->setLimit($value); - return $this; - } - - /** - * Unsets limit field. - */ - public function unsetLimit(): self - { - $this->instance->unsetLimit(); - return $this; - } - - /** - * Sets batch token field. - */ - public function batchToken(?string $value): self - { - $this->instance->setBatchToken($value); - return $this; - } - - /** - * Unsets batch token field. - */ - public function unsetBatchToken(): self - { - $this->instance->unsetBatchToken(); - return $this; - } - - /** - * Initializes a new v1 list refunds request object. - */ - public function build(): V1ListRefundsRequest - { - return CoreHelper::clone($this->instance); - } -} diff --git a/src/Models/Builders/V1ListRefundsResponseBuilder.php b/src/Models/Builders/V1ListRefundsResponseBuilder.php deleted file mode 100644 index 9a0ebe10..00000000 --- a/src/Models/Builders/V1ListRefundsResponseBuilder.php +++ /dev/null @@ -1,51 +0,0 @@ -instance = $instance; - } - - /** - * Initializes a new v1 list refunds response Builder object. - */ - public static function init(): self - { - return new self(new V1ListRefundsResponse()); - } - - /** - * Sets items field. - */ - public function items(?array $value): self - { - $this->instance->setItems($value); - return $this; - } - - /** - * Initializes a new v1 list refunds response object. - */ - public function build(): V1ListRefundsResponse - { - return CoreHelper::clone($this->instance); - } -} diff --git a/src/Models/Builders/V1ListSettlementsRequestBuilder.php b/src/Models/Builders/V1ListSettlementsRequestBuilder.php deleted file mode 100644 index 3bdb03c4..00000000 --- a/src/Models/Builders/V1ListSettlementsRequestBuilder.php +++ /dev/null @@ -1,132 +0,0 @@ -instance = $instance; - } - - /** - * Initializes a new v1 list settlements request Builder object. - */ - public static function init(): self - { - return new self(new V1ListSettlementsRequest()); - } - - /** - * Sets order field. - */ - public function order(?string $value): self - { - $this->instance->setOrder($value); - return $this; - } - - /** - * Sets begin time field. - */ - public function beginTime(?string $value): self - { - $this->instance->setBeginTime($value); - return $this; - } - - /** - * Unsets begin time field. - */ - public function unsetBeginTime(): self - { - $this->instance->unsetBeginTime(); - return $this; - } - - /** - * Sets end time field. - */ - public function endTime(?string $value): self - { - $this->instance->setEndTime($value); - return $this; - } - - /** - * Unsets end time field. - */ - public function unsetEndTime(): self - { - $this->instance->unsetEndTime(); - return $this; - } - - /** - * Sets limit field. - */ - public function limit(?int $value): self - { - $this->instance->setLimit($value); - return $this; - } - - /** - * Unsets limit field. - */ - public function unsetLimit(): self - { - $this->instance->unsetLimit(); - return $this; - } - - /** - * Sets status field. - */ - public function status(?string $value): self - { - $this->instance->setStatus($value); - return $this; - } - - /** - * Sets batch token field. - */ - public function batchToken(?string $value): self - { - $this->instance->setBatchToken($value); - return $this; - } - - /** - * Unsets batch token field. - */ - public function unsetBatchToken(): self - { - $this->instance->unsetBatchToken(); - return $this; - } - - /** - * Initializes a new v1 list settlements request object. - */ - public function build(): V1ListSettlementsRequest - { - return CoreHelper::clone($this->instance); - } -} diff --git a/src/Models/Builders/V1ListSettlementsResponseBuilder.php b/src/Models/Builders/V1ListSettlementsResponseBuilder.php deleted file mode 100644 index bf2db599..00000000 --- a/src/Models/Builders/V1ListSettlementsResponseBuilder.php +++ /dev/null @@ -1,51 +0,0 @@ -instance = $instance; - } - - /** - * Initializes a new v1 list settlements response Builder object. - */ - public static function init(): self - { - return new self(new V1ListSettlementsResponse()); - } - - /** - * Sets items field. - */ - public function items(?array $value): self - { - $this->instance->setItems($value); - return $this; - } - - /** - * Initializes a new v1 list settlements response object. - */ - public function build(): V1ListSettlementsResponse - { - return CoreHelper::clone($this->instance); - } -} diff --git a/src/Models/Builders/V1PaymentBuilder.php b/src/Models/Builders/V1PaymentBuilder.php deleted file mode 100644 index 558e9232..00000000 --- a/src/Models/Builders/V1PaymentBuilder.php +++ /dev/null @@ -1,386 +0,0 @@ -instance = $instance; - } - - /** - * Initializes a new v1 payment Builder object. - */ - public static function init(): self - { - return new self(new V1Payment()); - } - - /** - * Sets id field. - */ - public function id(?string $value): self - { - $this->instance->setId($value); - return $this; - } - - /** - * Sets merchant id field. - */ - public function merchantId(?string $value): self - { - $this->instance->setMerchantId($value); - return $this; - } - - /** - * Unsets merchant id field. - */ - public function unsetMerchantId(): self - { - $this->instance->unsetMerchantId(); - return $this; - } - - /** - * Sets created at field. - */ - public function createdAt(?string $value): self - { - $this->instance->setCreatedAt($value); - return $this; - } - - /** - * Sets creator id field. - */ - public function creatorId(?string $value): self - { - $this->instance->setCreatorId($value); - return $this; - } - - /** - * Unsets creator id field. - */ - public function unsetCreatorId(): self - { - $this->instance->unsetCreatorId(); - return $this; - } - - /** - * Sets device field. - */ - public function device(?V1Device $value): self - { - $this->instance->setDevice($value); - return $this; - } - - /** - * Sets payment url field. - */ - public function paymentUrl(?string $value): self - { - $this->instance->setPaymentUrl($value); - return $this; - } - - /** - * Unsets payment url field. - */ - public function unsetPaymentUrl(): self - { - $this->instance->unsetPaymentUrl(); - return $this; - } - - /** - * Sets receipt url field. - */ - public function receiptUrl(?string $value): self - { - $this->instance->setReceiptUrl($value); - return $this; - } - - /** - * Unsets receipt url field. - */ - public function unsetReceiptUrl(): self - { - $this->instance->unsetReceiptUrl(); - return $this; - } - - /** - * Sets inclusive tax money field. - */ - public function inclusiveTaxMoney(?V1Money $value): self - { - $this->instance->setInclusiveTaxMoney($value); - return $this; - } - - /** - * Sets additive tax money field. - */ - public function additiveTaxMoney(?V1Money $value): self - { - $this->instance->setAdditiveTaxMoney($value); - return $this; - } - - /** - * Sets tax money field. - */ - public function taxMoney(?V1Money $value): self - { - $this->instance->setTaxMoney($value); - return $this; - } - - /** - * Sets tip money field. - */ - public function tipMoney(?V1Money $value): self - { - $this->instance->setTipMoney($value); - return $this; - } - - /** - * Sets discount money field. - */ - public function discountMoney(?V1Money $value): self - { - $this->instance->setDiscountMoney($value); - return $this; - } - - /** - * Sets total collected money field. - */ - public function totalCollectedMoney(?V1Money $value): self - { - $this->instance->setTotalCollectedMoney($value); - return $this; - } - - /** - * Sets processing fee money field. - */ - public function processingFeeMoney(?V1Money $value): self - { - $this->instance->setProcessingFeeMoney($value); - return $this; - } - - /** - * Sets net total money field. - */ - public function netTotalMoney(?V1Money $value): self - { - $this->instance->setNetTotalMoney($value); - return $this; - } - - /** - * Sets refunded money field. - */ - public function refundedMoney(?V1Money $value): self - { - $this->instance->setRefundedMoney($value); - return $this; - } - - /** - * Sets swedish rounding money field. - */ - public function swedishRoundingMoney(?V1Money $value): self - { - $this->instance->setSwedishRoundingMoney($value); - return $this; - } - - /** - * Sets gross sales money field. - */ - public function grossSalesMoney(?V1Money $value): self - { - $this->instance->setGrossSalesMoney($value); - return $this; - } - - /** - * Sets net sales money field. - */ - public function netSalesMoney(?V1Money $value): self - { - $this->instance->setNetSalesMoney($value); - return $this; - } - - /** - * Sets inclusive tax field. - */ - public function inclusiveTax(?array $value): self - { - $this->instance->setInclusiveTax($value); - return $this; - } - - /** - * Unsets inclusive tax field. - */ - public function unsetInclusiveTax(): self - { - $this->instance->unsetInclusiveTax(); - return $this; - } - - /** - * Sets additive tax field. - */ - public function additiveTax(?array $value): self - { - $this->instance->setAdditiveTax($value); - return $this; - } - - /** - * Unsets additive tax field. - */ - public function unsetAdditiveTax(): self - { - $this->instance->unsetAdditiveTax(); - return $this; - } - - /** - * Sets tender field. - */ - public function tender(?array $value): self - { - $this->instance->setTender($value); - return $this; - } - - /** - * Unsets tender field. - */ - public function unsetTender(): self - { - $this->instance->unsetTender(); - return $this; - } - - /** - * Sets refunds field. - */ - public function refunds(?array $value): self - { - $this->instance->setRefunds($value); - return $this; - } - - /** - * Unsets refunds field. - */ - public function unsetRefunds(): self - { - $this->instance->unsetRefunds(); - return $this; - } - - /** - * Sets itemizations field. - */ - public function itemizations(?array $value): self - { - $this->instance->setItemizations($value); - return $this; - } - - /** - * Unsets itemizations field. - */ - public function unsetItemizations(): self - { - $this->instance->unsetItemizations(); - return $this; - } - - /** - * Sets surcharge money field. - */ - public function surchargeMoney(?V1Money $value): self - { - $this->instance->setSurchargeMoney($value); - return $this; - } - - /** - * Sets surcharges field. - */ - public function surcharges(?array $value): self - { - $this->instance->setSurcharges($value); - return $this; - } - - /** - * Unsets surcharges field. - */ - public function unsetSurcharges(): self - { - $this->instance->unsetSurcharges(); - return $this; - } - - /** - * Sets is partial field. - */ - public function isPartial(?bool $value): self - { - $this->instance->setIsPartial($value); - return $this; - } - - /** - * Unsets is partial field. - */ - public function unsetIsPartial(): self - { - $this->instance->unsetIsPartial(); - return $this; - } - - /** - * Initializes a new v1 payment object. - */ - public function build(): V1Payment - { - return CoreHelper::clone($this->instance); - } -} diff --git a/src/Models/Builders/V1PaymentDiscountBuilder.php b/src/Models/Builders/V1PaymentDiscountBuilder.php deleted file mode 100644 index cba91382..00000000 --- a/src/Models/Builders/V1PaymentDiscountBuilder.php +++ /dev/null @@ -1,88 +0,0 @@ -instance = $instance; - } - - /** - * Initializes a new v1 payment discount Builder object. - */ - public static function init(): self - { - return new self(new V1PaymentDiscount()); - } - - /** - * Sets name field. - */ - public function name(?string $value): self - { - $this->instance->setName($value); - return $this; - } - - /** - * Unsets name field. - */ - public function unsetName(): self - { - $this->instance->unsetName(); - return $this; - } - - /** - * Sets applied money field. - */ - public function appliedMoney(?V1Money $value): self - { - $this->instance->setAppliedMoney($value); - return $this; - } - - /** - * Sets discount id field. - */ - public function discountId(?string $value): self - { - $this->instance->setDiscountId($value); - return $this; - } - - /** - * Unsets discount id field. - */ - public function unsetDiscountId(): self - { - $this->instance->unsetDiscountId(); - return $this; - } - - /** - * Initializes a new v1 payment discount object. - */ - public function build(): V1PaymentDiscount - { - return CoreHelper::clone($this->instance); - } -} diff --git a/src/Models/Builders/V1PaymentItemDetailBuilder.php b/src/Models/Builders/V1PaymentItemDetailBuilder.php deleted file mode 100644 index 7152a664..00000000 --- a/src/Models/Builders/V1PaymentItemDetailBuilder.php +++ /dev/null @@ -1,114 +0,0 @@ -instance = $instance; - } - - /** - * Initializes a new v1 payment item detail Builder object. - */ - public static function init(): self - { - return new self(new V1PaymentItemDetail()); - } - - /** - * Sets category name field. - */ - public function categoryName(?string $value): self - { - $this->instance->setCategoryName($value); - return $this; - } - - /** - * Unsets category name field. - */ - public function unsetCategoryName(): self - { - $this->instance->unsetCategoryName(); - return $this; - } - - /** - * Sets sku field. - */ - public function sku(?string $value): self - { - $this->instance->setSku($value); - return $this; - } - - /** - * Unsets sku field. - */ - public function unsetSku(): self - { - $this->instance->unsetSku(); - return $this; - } - - /** - * Sets item id field. - */ - public function itemId(?string $value): self - { - $this->instance->setItemId($value); - return $this; - } - - /** - * Unsets item id field. - */ - public function unsetItemId(): self - { - $this->instance->unsetItemId(); - return $this; - } - - /** - * Sets item variation id field. - */ - public function itemVariationId(?string $value): self - { - $this->instance->setItemVariationId($value); - return $this; - } - - /** - * Unsets item variation id field. - */ - public function unsetItemVariationId(): self - { - $this->instance->unsetItemVariationId(); - return $this; - } - - /** - * Initializes a new v1 payment item detail object. - */ - public function build(): V1PaymentItemDetail - { - return CoreHelper::clone($this->instance); - } -} diff --git a/src/Models/Builders/V1PaymentItemizationBuilder.php b/src/Models/Builders/V1PaymentItemizationBuilder.php deleted file mode 100644 index 1c62654f..00000000 --- a/src/Models/Builders/V1PaymentItemizationBuilder.php +++ /dev/null @@ -1,233 +0,0 @@ -instance = $instance; - } - - /** - * Initializes a new v1 payment itemization Builder object. - */ - public static function init(): self - { - return new self(new V1PaymentItemization()); - } - - /** - * Sets name field. - */ - public function name(?string $value): self - { - $this->instance->setName($value); - return $this; - } - - /** - * Unsets name field. - */ - public function unsetName(): self - { - $this->instance->unsetName(); - return $this; - } - - /** - * Sets quantity field. - */ - public function quantity(?float $value): self - { - $this->instance->setQuantity($value); - return $this; - } - - /** - * Unsets quantity field. - */ - public function unsetQuantity(): self - { - $this->instance->unsetQuantity(); - return $this; - } - - /** - * Sets itemization type field. - */ - public function itemizationType(?string $value): self - { - $this->instance->setItemizationType($value); - return $this; - } - - /** - * Sets item detail field. - */ - public function itemDetail(?V1PaymentItemDetail $value): self - { - $this->instance->setItemDetail($value); - return $this; - } - - /** - * Sets notes field. - */ - public function notes(?string $value): self - { - $this->instance->setNotes($value); - return $this; - } - - /** - * Unsets notes field. - */ - public function unsetNotes(): self - { - $this->instance->unsetNotes(); - return $this; - } - - /** - * Sets item variation name field. - */ - public function itemVariationName(?string $value): self - { - $this->instance->setItemVariationName($value); - return $this; - } - - /** - * Unsets item variation name field. - */ - public function unsetItemVariationName(): self - { - $this->instance->unsetItemVariationName(); - return $this; - } - - /** - * Sets total money field. - */ - public function totalMoney(?V1Money $value): self - { - $this->instance->setTotalMoney($value); - return $this; - } - - /** - * Sets single quantity money field. - */ - public function singleQuantityMoney(?V1Money $value): self - { - $this->instance->setSingleQuantityMoney($value); - return $this; - } - - /** - * Sets gross sales money field. - */ - public function grossSalesMoney(?V1Money $value): self - { - $this->instance->setGrossSalesMoney($value); - return $this; - } - - /** - * Sets discount money field. - */ - public function discountMoney(?V1Money $value): self - { - $this->instance->setDiscountMoney($value); - return $this; - } - - /** - * Sets net sales money field. - */ - public function netSalesMoney(?V1Money $value): self - { - $this->instance->setNetSalesMoney($value); - return $this; - } - - /** - * Sets taxes field. - */ - public function taxes(?array $value): self - { - $this->instance->setTaxes($value); - return $this; - } - - /** - * Unsets taxes field. - */ - public function unsetTaxes(): self - { - $this->instance->unsetTaxes(); - return $this; - } - - /** - * Sets discounts field. - */ - public function discounts(?array $value): self - { - $this->instance->setDiscounts($value); - return $this; - } - - /** - * Unsets discounts field. - */ - public function unsetDiscounts(): self - { - $this->instance->unsetDiscounts(); - return $this; - } - - /** - * Sets modifiers field. - */ - public function modifiers(?array $value): self - { - $this->instance->setModifiers($value); - return $this; - } - - /** - * Unsets modifiers field. - */ - public function unsetModifiers(): self - { - $this->instance->unsetModifiers(); - return $this; - } - - /** - * Initializes a new v1 payment itemization object. - */ - public function build(): V1PaymentItemization - { - return CoreHelper::clone($this->instance); - } -} diff --git a/src/Models/Builders/V1PaymentModifierBuilder.php b/src/Models/Builders/V1PaymentModifierBuilder.php deleted file mode 100644 index b9848fa0..00000000 --- a/src/Models/Builders/V1PaymentModifierBuilder.php +++ /dev/null @@ -1,88 +0,0 @@ -instance = $instance; - } - - /** - * Initializes a new v1 payment modifier Builder object. - */ - public static function init(): self - { - return new self(new V1PaymentModifier()); - } - - /** - * Sets name field. - */ - public function name(?string $value): self - { - $this->instance->setName($value); - return $this; - } - - /** - * Unsets name field. - */ - public function unsetName(): self - { - $this->instance->unsetName(); - return $this; - } - - /** - * Sets applied money field. - */ - public function appliedMoney(?V1Money $value): self - { - $this->instance->setAppliedMoney($value); - return $this; - } - - /** - * Sets modifier option id field. - */ - public function modifierOptionId(?string $value): self - { - $this->instance->setModifierOptionId($value); - return $this; - } - - /** - * Unsets modifier option id field. - */ - public function unsetModifierOptionId(): self - { - $this->instance->unsetModifierOptionId(); - return $this; - } - - /** - * Initializes a new v1 payment modifier object. - */ - public function build(): V1PaymentModifier - { - return CoreHelper::clone($this->instance); - } -} diff --git a/src/Models/Builders/V1PaymentSurchargeBuilder.php b/src/Models/Builders/V1PaymentSurchargeBuilder.php deleted file mode 100644 index 446f4289..00000000 --- a/src/Models/Builders/V1PaymentSurchargeBuilder.php +++ /dev/null @@ -1,160 +0,0 @@ -instance = $instance; - } - - /** - * Initializes a new v1 payment surcharge Builder object. - */ - public static function init(): self - { - return new self(new V1PaymentSurcharge()); - } - - /** - * Sets name field. - */ - public function name(?string $value): self - { - $this->instance->setName($value); - return $this; - } - - /** - * Unsets name field. - */ - public function unsetName(): self - { - $this->instance->unsetName(); - return $this; - } - - /** - * Sets applied money field. - */ - public function appliedMoney(?V1Money $value): self - { - $this->instance->setAppliedMoney($value); - return $this; - } - - /** - * Sets rate field. - */ - public function rate(?string $value): self - { - $this->instance->setRate($value); - return $this; - } - - /** - * Unsets rate field. - */ - public function unsetRate(): self - { - $this->instance->unsetRate(); - return $this; - } - - /** - * Sets amount money field. - */ - public function amountMoney(?V1Money $value): self - { - $this->instance->setAmountMoney($value); - return $this; - } - - /** - * Sets type field. - */ - public function type(?string $value): self - { - $this->instance->setType($value); - return $this; - } - - /** - * Sets taxable field. - */ - public function taxable(?bool $value): self - { - $this->instance->setTaxable($value); - return $this; - } - - /** - * Unsets taxable field. - */ - public function unsetTaxable(): self - { - $this->instance->unsetTaxable(); - return $this; - } - - /** - * Sets taxes field. - */ - public function taxes(?array $value): self - { - $this->instance->setTaxes($value); - return $this; - } - - /** - * Unsets taxes field. - */ - public function unsetTaxes(): self - { - $this->instance->unsetTaxes(); - return $this; - } - - /** - * Sets surcharge id field. - */ - public function surchargeId(?string $value): self - { - $this->instance->setSurchargeId($value); - return $this; - } - - /** - * Unsets surcharge id field. - */ - public function unsetSurchargeId(): self - { - $this->instance->unsetSurchargeId(); - return $this; - } - - /** - * Initializes a new v1 payment surcharge object. - */ - public function build(): V1PaymentSurcharge - { - return CoreHelper::clone($this->instance); - } -} diff --git a/src/Models/Builders/V1PaymentTaxBuilder.php b/src/Models/Builders/V1PaymentTaxBuilder.php deleted file mode 100644 index 2a63e868..00000000 --- a/src/Models/Builders/V1PaymentTaxBuilder.php +++ /dev/null @@ -1,133 +0,0 @@ -instance = $instance; - } - - /** - * Initializes a new v1 payment tax Builder object. - */ - public static function init(): self - { - return new self(new V1PaymentTax()); - } - - /** - * Sets errors field. - */ - public function errors(?array $value): self - { - $this->instance->setErrors($value); - return $this; - } - - /** - * Unsets errors field. - */ - public function unsetErrors(): self - { - $this->instance->unsetErrors(); - return $this; - } - - /** - * Sets name field. - */ - public function name(?string $value): self - { - $this->instance->setName($value); - return $this; - } - - /** - * Unsets name field. - */ - public function unsetName(): self - { - $this->instance->unsetName(); - return $this; - } - - /** - * Sets applied money field. - */ - public function appliedMoney(?V1Money $value): self - { - $this->instance->setAppliedMoney($value); - return $this; - } - - /** - * Sets rate field. - */ - public function rate(?string $value): self - { - $this->instance->setRate($value); - return $this; - } - - /** - * Unsets rate field. - */ - public function unsetRate(): self - { - $this->instance->unsetRate(); - return $this; - } - - /** - * Sets inclusion type field. - */ - public function inclusionType(?string $value): self - { - $this->instance->setInclusionType($value); - return $this; - } - - /** - * Sets fee id field. - */ - public function feeId(?string $value): self - { - $this->instance->setFeeId($value); - return $this; - } - - /** - * Unsets fee id field. - */ - public function unsetFeeId(): self - { - $this->instance->unsetFeeId(); - return $this; - } - - /** - * Initializes a new v1 payment tax object. - */ - public function build(): V1PaymentTax - { - return CoreHelper::clone($this->instance); - } -} diff --git a/src/Models/Builders/V1RefundBuilder.php b/src/Models/Builders/V1RefundBuilder.php deleted file mode 100644 index 3b11311c..00000000 --- a/src/Models/Builders/V1RefundBuilder.php +++ /dev/null @@ -1,277 +0,0 @@ -instance = $instance; - } - - /** - * Initializes a new v1 refund Builder object. - */ - public static function init(): self - { - return new self(new V1Refund()); - } - - /** - * Sets type field. - */ - public function type(?string $value): self - { - $this->instance->setType($value); - return $this; - } - - /** - * Sets reason field. - */ - public function reason(?string $value): self - { - $this->instance->setReason($value); - return $this; - } - - /** - * Unsets reason field. - */ - public function unsetReason(): self - { - $this->instance->unsetReason(); - return $this; - } - - /** - * Sets refunded money field. - */ - public function refundedMoney(?V1Money $value): self - { - $this->instance->setRefundedMoney($value); - return $this; - } - - /** - * Sets refunded processing fee money field. - */ - public function refundedProcessingFeeMoney(?V1Money $value): self - { - $this->instance->setRefundedProcessingFeeMoney($value); - return $this; - } - - /** - * Sets refunded tax money field. - */ - public function refundedTaxMoney(?V1Money $value): self - { - $this->instance->setRefundedTaxMoney($value); - return $this; - } - - /** - * Sets refunded additive tax money field. - */ - public function refundedAdditiveTaxMoney(?V1Money $value): self - { - $this->instance->setRefundedAdditiveTaxMoney($value); - return $this; - } - - /** - * Sets refunded additive tax field. - */ - public function refundedAdditiveTax(?array $value): self - { - $this->instance->setRefundedAdditiveTax($value); - return $this; - } - - /** - * Unsets refunded additive tax field. - */ - public function unsetRefundedAdditiveTax(): self - { - $this->instance->unsetRefundedAdditiveTax(); - return $this; - } - - /** - * Sets refunded inclusive tax money field. - */ - public function refundedInclusiveTaxMoney(?V1Money $value): self - { - $this->instance->setRefundedInclusiveTaxMoney($value); - return $this; - } - - /** - * Sets refunded inclusive tax field. - */ - public function refundedInclusiveTax(?array $value): self - { - $this->instance->setRefundedInclusiveTax($value); - return $this; - } - - /** - * Unsets refunded inclusive tax field. - */ - public function unsetRefundedInclusiveTax(): self - { - $this->instance->unsetRefundedInclusiveTax(); - return $this; - } - - /** - * Sets refunded tip money field. - */ - public function refundedTipMoney(?V1Money $value): self - { - $this->instance->setRefundedTipMoney($value); - return $this; - } - - /** - * Sets refunded discount money field. - */ - public function refundedDiscountMoney(?V1Money $value): self - { - $this->instance->setRefundedDiscountMoney($value); - return $this; - } - - /** - * Sets refunded surcharge money field. - */ - public function refundedSurchargeMoney(?V1Money $value): self - { - $this->instance->setRefundedSurchargeMoney($value); - return $this; - } - - /** - * Sets refunded surcharges field. - */ - public function refundedSurcharges(?array $value): self - { - $this->instance->setRefundedSurcharges($value); - return $this; - } - - /** - * Unsets refunded surcharges field. - */ - public function unsetRefundedSurcharges(): self - { - $this->instance->unsetRefundedSurcharges(); - return $this; - } - - /** - * Sets created at field. - */ - public function createdAt(?string $value): self - { - $this->instance->setCreatedAt($value); - return $this; - } - - /** - * Sets processed at field. - */ - public function processedAt(?string $value): self - { - $this->instance->setProcessedAt($value); - return $this; - } - - /** - * Unsets processed at field. - */ - public function unsetProcessedAt(): self - { - $this->instance->unsetProcessedAt(); - return $this; - } - - /** - * Sets payment id field. - */ - public function paymentId(?string $value): self - { - $this->instance->setPaymentId($value); - return $this; - } - - /** - * Unsets payment id field. - */ - public function unsetPaymentId(): self - { - $this->instance->unsetPaymentId(); - return $this; - } - - /** - * Sets merchant id field. - */ - public function merchantId(?string $value): self - { - $this->instance->setMerchantId($value); - return $this; - } - - /** - * Unsets merchant id field. - */ - public function unsetMerchantId(): self - { - $this->instance->unsetMerchantId(); - return $this; - } - - /** - * Sets is exchange field. - */ - public function isExchange(?bool $value): self - { - $this->instance->setIsExchange($value); - return $this; - } - - /** - * Unsets is exchange field. - */ - public function unsetIsExchange(): self - { - $this->instance->unsetIsExchange(); - return $this; - } - - /** - * Initializes a new v1 refund object. - */ - public function build(): V1Refund - { - return CoreHelper::clone($this->instance); - } -} diff --git a/src/Models/Builders/V1SettlementBuilder.php b/src/Models/Builders/V1SettlementBuilder.php deleted file mode 100644 index 21640ca2..00000000 --- a/src/Models/Builders/V1SettlementBuilder.php +++ /dev/null @@ -1,124 +0,0 @@ -instance = $instance; - } - - /** - * Initializes a new v1 settlement Builder object. - */ - public static function init(): self - { - return new self(new V1Settlement()); - } - - /** - * Sets id field. - */ - public function id(?string $value): self - { - $this->instance->setId($value); - return $this; - } - - /** - * Sets status field. - */ - public function status(?string $value): self - { - $this->instance->setStatus($value); - return $this; - } - - /** - * Sets total money field. - */ - public function totalMoney(?V1Money $value): self - { - $this->instance->setTotalMoney($value); - return $this; - } - - /** - * Sets initiated at field. - */ - public function initiatedAt(?string $value): self - { - $this->instance->setInitiatedAt($value); - return $this; - } - - /** - * Unsets initiated at field. - */ - public function unsetInitiatedAt(): self - { - $this->instance->unsetInitiatedAt(); - return $this; - } - - /** - * Sets bank account id field. - */ - public function bankAccountId(?string $value): self - { - $this->instance->setBankAccountId($value); - return $this; - } - - /** - * Unsets bank account id field. - */ - public function unsetBankAccountId(): self - { - $this->instance->unsetBankAccountId(); - return $this; - } - - /** - * Sets entries field. - */ - public function entries(?array $value): self - { - $this->instance->setEntries($value); - return $this; - } - - /** - * Unsets entries field. - */ - public function unsetEntries(): self - { - $this->instance->unsetEntries(); - return $this; - } - - /** - * Initializes a new v1 settlement object. - */ - public function build(): V1Settlement - { - return CoreHelper::clone($this->instance); - } -} diff --git a/src/Models/Builders/V1SettlementEntryBuilder.php b/src/Models/Builders/V1SettlementEntryBuilder.php deleted file mode 100644 index 2a2aa198..00000000 --- a/src/Models/Builders/V1SettlementEntryBuilder.php +++ /dev/null @@ -1,88 +0,0 @@ -instance = $instance; - } - - /** - * Initializes a new v1 settlement entry Builder object. - */ - public static function init(): self - { - return new self(new V1SettlementEntry()); - } - - /** - * Sets payment id field. - */ - public function paymentId(?string $value): self - { - $this->instance->setPaymentId($value); - return $this; - } - - /** - * Unsets payment id field. - */ - public function unsetPaymentId(): self - { - $this->instance->unsetPaymentId(); - return $this; - } - - /** - * Sets type field. - */ - public function type(?string $value): self - { - $this->instance->setType($value); - return $this; - } - - /** - * Sets amount money field. - */ - public function amountMoney(?V1Money $value): self - { - $this->instance->setAmountMoney($value); - return $this; - } - - /** - * Sets fee money field. - */ - public function feeMoney(?V1Money $value): self - { - $this->instance->setFeeMoney($value); - return $this; - } - - /** - * Initializes a new v1 settlement entry object. - */ - public function build(): V1SettlementEntry - { - return CoreHelper::clone($this->instance); - } -} diff --git a/src/Models/BulkCreateCustomerData.php b/src/Models/BulkCreateCustomerData.php new file mode 100644 index 00000000..fe2a2733 --- /dev/null +++ b/src/Models/BulkCreateCustomerData.php @@ -0,0 +1,480 @@ +givenName) == 0) { + return null; + } + return $this->givenName['value']; + } + + /** + * Sets Given Name. + * The given name (that is, the first name) associated with the customer profile. + * + * @maps given_name + */ + public function setGivenName(?string $givenName): void + { + $this->givenName['value'] = $givenName; + } + + /** + * Unsets Given Name. + * The given name (that is, the first name) associated with the customer profile. + */ + public function unsetGivenName(): void + { + $this->givenName = []; + } + + /** + * Returns Family Name. + * The family name (that is, the last name) associated with the customer profile. + */ + public function getFamilyName(): ?string + { + if (count($this->familyName) == 0) { + return null; + } + return $this->familyName['value']; + } + + /** + * Sets Family Name. + * The family name (that is, the last name) associated with the customer profile. + * + * @maps family_name + */ + public function setFamilyName(?string $familyName): void + { + $this->familyName['value'] = $familyName; + } + + /** + * Unsets Family Name. + * The family name (that is, the last name) associated with the customer profile. + */ + public function unsetFamilyName(): void + { + $this->familyName = []; + } + + /** + * Returns Company Name. + * A business name associated with the customer profile. + */ + public function getCompanyName(): ?string + { + if (count($this->companyName) == 0) { + return null; + } + return $this->companyName['value']; + } + + /** + * Sets Company Name. + * A business name associated with the customer profile. + * + * @maps company_name + */ + public function setCompanyName(?string $companyName): void + { + $this->companyName['value'] = $companyName; + } + + /** + * Unsets Company Name. + * A business name associated with the customer profile. + */ + public function unsetCompanyName(): void + { + $this->companyName = []; + } + + /** + * Returns Nickname. + * A nickname for the customer profile. + */ + public function getNickname(): ?string + { + if (count($this->nickname) == 0) { + return null; + } + return $this->nickname['value']; + } + + /** + * Sets Nickname. + * A nickname for the customer profile. + * + * @maps nickname + */ + public function setNickname(?string $nickname): void + { + $this->nickname['value'] = $nickname; + } + + /** + * Unsets Nickname. + * A nickname for the customer profile. + */ + public function unsetNickname(): void + { + $this->nickname = []; + } + + /** + * Returns Email Address. + * The email address associated with the customer profile. + */ + public function getEmailAddress(): ?string + { + if (count($this->emailAddress) == 0) { + return null; + } + return $this->emailAddress['value']; + } + + /** + * Sets Email Address. + * The email address associated with the customer profile. + * + * @maps email_address + */ + public function setEmailAddress(?string $emailAddress): void + { + $this->emailAddress['value'] = $emailAddress; + } + + /** + * Unsets Email Address. + * The email address associated with the customer profile. + */ + public function unsetEmailAddress(): void + { + $this->emailAddress = []; + } + + /** + * Returns Address. + * Represents a postal address in a country. + * For more information, see [Working with Addresses](https://developer.squareup.com/docs/build- + * basics/working-with-addresses). + */ + public function getAddress(): ?Address + { + return $this->address; + } + + /** + * Sets Address. + * Represents a postal address in a country. + * For more information, see [Working with Addresses](https://developer.squareup.com/docs/build- + * basics/working-with-addresses). + * + * @maps address + */ + public function setAddress(?Address $address): void + { + $this->address = $address; + } + + /** + * Returns Phone Number. + * The phone number associated with the customer profile. The phone number must be valid + * and can contain 9–16 digits, with an optional `+` prefix and country code. For more information, + * see [Customer phone numbers](https://developer.squareup.com/docs/customers-api/use-the-api/keep- + * records#phone-number). + */ + public function getPhoneNumber(): ?string + { + if (count($this->phoneNumber) == 0) { + return null; + } + return $this->phoneNumber['value']; + } + + /** + * Sets Phone Number. + * The phone number associated with the customer profile. The phone number must be valid + * and can contain 9–16 digits, with an optional `+` prefix and country code. For more information, + * see [Customer phone numbers](https://developer.squareup.com/docs/customers-api/use-the-api/keep- + * records#phone-number). + * + * @maps phone_number + */ + public function setPhoneNumber(?string $phoneNumber): void + { + $this->phoneNumber['value'] = $phoneNumber; + } + + /** + * Unsets Phone Number. + * The phone number associated with the customer profile. The phone number must be valid + * and can contain 9–16 digits, with an optional `+` prefix and country code. For more information, + * see [Customer phone numbers](https://developer.squareup.com/docs/customers-api/use-the-api/keep- + * records#phone-number). + */ + public function unsetPhoneNumber(): void + { + $this->phoneNumber = []; + } + + /** + * Returns Reference Id. + * An optional second ID used to associate the customer profile with an + * entity in another system. + */ + public function getReferenceId(): ?string + { + if (count($this->referenceId) == 0) { + return null; + } + return $this->referenceId['value']; + } + + /** + * Sets Reference Id. + * An optional second ID used to associate the customer profile with an + * entity in another system. + * + * @maps reference_id + */ + public function setReferenceId(?string $referenceId): void + { + $this->referenceId['value'] = $referenceId; + } + + /** + * Unsets Reference Id. + * An optional second ID used to associate the customer profile with an + * entity in another system. + */ + public function unsetReferenceId(): void + { + $this->referenceId = []; + } + + /** + * Returns Note. + * A custom note associated with the customer profile. + */ + public function getNote(): ?string + { + if (count($this->note) == 0) { + return null; + } + return $this->note['value']; + } + + /** + * Sets Note. + * A custom note associated with the customer profile. + * + * @maps note + */ + public function setNote(?string $note): void + { + $this->note['value'] = $note; + } + + /** + * Unsets Note. + * A custom note associated with the customer profile. + */ + public function unsetNote(): void + { + $this->note = []; + } + + /** + * Returns Birthday. + * The birthday associated with the customer profile, in `YYYY-MM-DD` or `MM-DD` format. + * For example, specify `1998-09-21` for September 21, 1998, or `09-21` for September 21. + * Birthdays are returned in `YYYY-MM-DD` format, where `YYYY` is the specified birth year or + * `0000` if a birth year is not specified. + */ + public function getBirthday(): ?string + { + if (count($this->birthday) == 0) { + return null; + } + return $this->birthday['value']; + } + + /** + * Sets Birthday. + * The birthday associated with the customer profile, in `YYYY-MM-DD` or `MM-DD` format. + * For example, specify `1998-09-21` for September 21, 1998, or `09-21` for September 21. + * Birthdays are returned in `YYYY-MM-DD` format, where `YYYY` is the specified birth year or + * `0000` if a birth year is not specified. + * + * @maps birthday + */ + public function setBirthday(?string $birthday): void + { + $this->birthday['value'] = $birthday; + } + + /** + * Unsets Birthday. + * The birthday associated with the customer profile, in `YYYY-MM-DD` or `MM-DD` format. + * For example, specify `1998-09-21` for September 21, 1998, or `09-21` for September 21. + * Birthdays are returned in `YYYY-MM-DD` format, where `YYYY` is the specified birth year or + * `0000` if a birth year is not specified. + */ + public function unsetBirthday(): void + { + $this->birthday = []; + } + + /** + * Returns Tax Ids. + * Represents the tax ID associated with a [customer profile]($m/Customer). The corresponding `tax_ids` + * field is available only for customers of sellers in EU countries or the United Kingdom. + * For more information, see [Customer tax IDs](https://developer.squareup.com/docs/customers-api/what- + * it-does#customer-tax-ids). + */ + public function getTaxIds(): ?CustomerTaxIds + { + return $this->taxIds; + } + + /** + * Sets Tax Ids. + * Represents the tax ID associated with a [customer profile]($m/Customer). The corresponding `tax_ids` + * field is available only for customers of sellers in EU countries or the United Kingdom. + * For more information, see [Customer tax IDs](https://developer.squareup.com/docs/customers-api/what- + * it-does#customer-tax-ids). + * + * @maps tax_ids + */ + public function setTaxIds(?CustomerTaxIds $taxIds): void + { + $this->taxIds = $taxIds; + } + + /** + * 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->givenName)) { + $json['given_name'] = $this->givenName['value']; + } + if (!empty($this->familyName)) { + $json['family_name'] = $this->familyName['value']; + } + if (!empty($this->companyName)) { + $json['company_name'] = $this->companyName['value']; + } + if (!empty($this->nickname)) { + $json['nickname'] = $this->nickname['value']; + } + if (!empty($this->emailAddress)) { + $json['email_address'] = $this->emailAddress['value']; + } + if (isset($this->address)) { + $json['address'] = $this->address; + } + if (!empty($this->phoneNumber)) { + $json['phone_number'] = $this->phoneNumber['value']; + } + if (!empty($this->referenceId)) { + $json['reference_id'] = $this->referenceId['value']; + } + if (!empty($this->note)) { + $json['note'] = $this->note['value']; + } + if (!empty($this->birthday)) { + $json['birthday'] = $this->birthday['value']; + } + if (isset($this->taxIds)) { + $json['tax_ids'] = $this->taxIds; + } + $json = array_filter($json, function ($val) { + return $val !== null; + }); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/BulkCreateCustomersRequest.php b/src/Models/BulkCreateCustomersRequest.php new file mode 100644 index 00000000..45958661 --- /dev/null +++ b/src/Models/BulkCreateCustomersRequest.php @@ -0,0 +1,86 @@ + + */ + private $customers; + + /** + * @param array $customers + */ + public function __construct(array $customers) + { + $this->customers = $customers; + } + + /** + * Returns Customers. + * A map of 1 to 100 individual create requests, represented by `idempotency key: { customer data }` + * key-value pairs. + * + * Each key is an [idempotency key](https://developer.squareup.com/docs/build-basics/common-api- + * patterns/idempotency) + * that uniquely identifies the create request. Each value contains the customer data used to create + * the + * customer profile. + * + * @return array + */ + public function getCustomers(): array + { + return $this->customers; + } + + /** + * Sets Customers. + * A map of 1 to 100 individual create requests, represented by `idempotency key: { customer data }` + * key-value pairs. + * + * Each key is an [idempotency key](https://developer.squareup.com/docs/build-basics/common-api- + * patterns/idempotency) + * that uniquely identifies the create request. Each value contains the customer data used to create + * the + * customer profile. + * + * @required + * @maps customers + * + * @param array $customers + */ + public function setCustomers(array $customers): void + { + $this->customers = $customers; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + $json['customers'] = $this->customers; + $json = array_filter($json, function ($val) { + return $val !== null; + }); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/BulkCreateCustomersResponse.php b/src/Models/BulkCreateCustomersResponse.php new file mode 100644 index 00000000..5a52eda1 --- /dev/null +++ b/src/Models/BulkCreateCustomersResponse.php @@ -0,0 +1,109 @@ +|null + */ + private $responses; + + /** + * @var Error[]|null + */ + private $errors; + + /** + * Returns Responses. + * A map of responses that correspond to individual create requests, represented by + * key-value pairs. + * + * Each key is the idempotency key that was provided for a create request and each value + * is the corresponding response. + * If the request succeeds, the value is the new customer profile. + * If the request fails, the value contains any errors that occurred during the request. + * + * @return array|null + */ + public function getResponses(): ?array + { + return $this->responses; + } + + /** + * Sets Responses. + * A map of responses that correspond to individual create requests, represented by + * key-value pairs. + * + * Each key is the idempotency key that was provided for a create request and each value + * is the corresponding response. + * If the request succeeds, the value is the new customer profile. + * If the request fails, the value contains any errors that occurred during the request. + * + * @maps responses + * + * @param array|null $responses + */ + public function setResponses(?array $responses): void + { + $this->responses = $responses; + } + + /** + * Returns Errors. + * Any top-level errors that prevented the bulk operation from running. + * + * @return Error[]|null + */ + public function getErrors(): ?array + { + return $this->errors; + } + + /** + * Sets Errors. + * Any top-level errors that prevented the bulk operation from running. + * + * @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->responses)) { + $json['responses'] = $this->responses; + } + 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/Models/BulkDeleteCustomersRequest.php b/src/Models/BulkDeleteCustomersRequest.php new file mode 100644 index 00000000..ba20c431 --- /dev/null +++ b/src/Models/BulkDeleteCustomersRequest.php @@ -0,0 +1,72 @@ +customerIds = $customerIds; + } + + /** + * Returns Customer Ids. + * The IDs of the [customer profiles](entity:Customer) to delete. + * + * @return string[] + */ + public function getCustomerIds(): array + { + return $this->customerIds; + } + + /** + * Sets Customer Ids. + * The IDs of the [customer profiles](entity:Customer) to delete. + * + * @required + * @maps customer_ids + * + * @param string[] $customerIds + */ + public function setCustomerIds(array $customerIds): void + { + $this->customerIds = $customerIds; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + $json['customer_ids'] = $this->customerIds; + $json = array_filter($json, function ($val) { + return $val !== null; + }); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/BulkDeleteCustomersResponse.php b/src/Models/BulkDeleteCustomersResponse.php new file mode 100644 index 00000000..55999a67 --- /dev/null +++ b/src/Models/BulkDeleteCustomersResponse.php @@ -0,0 +1,109 @@ +|null + */ + private $responses; + + /** + * @var Error[]|null + */ + private $errors; + + /** + * Returns Responses. + * A map of responses that correspond to individual delete requests, represented by + * key-value pairs. + * + * Each key is the customer ID that was specified for a delete request and each value + * is the corresponding response. + * If the request succeeds, the value is an empty object (`{ }`). + * If the request fails, the value contains any errors that occurred during the request. + * + * @return array|null + */ + public function getResponses(): ?array + { + return $this->responses; + } + + /** + * Sets Responses. + * A map of responses that correspond to individual delete requests, represented by + * key-value pairs. + * + * Each key is the customer ID that was specified for a delete request and each value + * is the corresponding response. + * If the request succeeds, the value is an empty object (`{ }`). + * If the request fails, the value contains any errors that occurred during the request. + * + * @maps responses + * + * @param array|null $responses + */ + public function setResponses(?array $responses): void + { + $this->responses = $responses; + } + + /** + * Returns Errors. + * Any top-level errors that prevented the bulk operation from running. + * + * @return Error[]|null + */ + public function getErrors(): ?array + { + return $this->errors; + } + + /** + * Sets Errors. + * Any top-level errors that prevented the bulk operation from running. + * + * @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->responses)) { + $json['responses'] = $this->responses; + } + 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/Models/BulkRetrieveCustomersRequest.php b/src/Models/BulkRetrieveCustomersRequest.php new file mode 100644 index 00000000..4e132165 --- /dev/null +++ b/src/Models/BulkRetrieveCustomersRequest.php @@ -0,0 +1,72 @@ +customerIds = $customerIds; + } + + /** + * Returns Customer Ids. + * The IDs of the [customer profiles](entity:Customer) to retrieve. + * + * @return string[] + */ + public function getCustomerIds(): array + { + return $this->customerIds; + } + + /** + * Sets Customer Ids. + * The IDs of the [customer profiles](entity:Customer) to retrieve. + * + * @required + * @maps customer_ids + * + * @param string[] $customerIds + */ + public function setCustomerIds(array $customerIds): void + { + $this->customerIds = $customerIds; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + $json['customer_ids'] = $this->customerIds; + $json = array_filter($json, function ($val) { + return $val !== null; + }); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/BulkRetrieveCustomersResponse.php b/src/Models/BulkRetrieveCustomersResponse.php new file mode 100644 index 00000000..14dca84c --- /dev/null +++ b/src/Models/BulkRetrieveCustomersResponse.php @@ -0,0 +1,109 @@ +|null + */ + private $responses; + + /** + * @var Error[]|null + */ + private $errors; + + /** + * Returns Responses. + * A map of responses that correspond to individual retrieve requests, represented by + * key-value pairs. + * + * Each key is the customer ID that was specified for a retrieve request and each value + * is the corresponding response. + * If the request succeeds, the value is the requested customer profile. + * If the request fails, the value contains any errors that occurred during the request. + * + * @return array|null + */ + public function getResponses(): ?array + { + return $this->responses; + } + + /** + * Sets Responses. + * A map of responses that correspond to individual retrieve requests, represented by + * key-value pairs. + * + * Each key is the customer ID that was specified for a retrieve request and each value + * is the corresponding response. + * If the request succeeds, the value is the requested customer profile. + * If the request fails, the value contains any errors that occurred during the request. + * + * @maps responses + * + * @param array|null $responses + */ + public function setResponses(?array $responses): void + { + $this->responses = $responses; + } + + /** + * Returns Errors. + * Any top-level errors that prevented the bulk operation from running. + * + * @return Error[]|null + */ + public function getErrors(): ?array + { + return $this->errors; + } + + /** + * Sets Errors. + * Any top-level errors that prevented the bulk operation from running. + * + * @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->responses)) { + $json['responses'] = $this->responses; + } + 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/Models/BulkUpdateCustomerData.php b/src/Models/BulkUpdateCustomerData.php new file mode 100644 index 00000000..d035ed29 --- /dev/null +++ b/src/Models/BulkUpdateCustomerData.php @@ -0,0 +1,518 @@ +givenName) == 0) { + return null; + } + return $this->givenName['value']; + } + + /** + * Sets Given Name. + * The given name (that is, the first name) associated with the customer profile. + * + * @maps given_name + */ + public function setGivenName(?string $givenName): void + { + $this->givenName['value'] = $givenName; + } + + /** + * Unsets Given Name. + * The given name (that is, the first name) associated with the customer profile. + */ + public function unsetGivenName(): void + { + $this->givenName = []; + } + + /** + * Returns Family Name. + * The family name (that is, the last name) associated with the customer profile. + */ + public function getFamilyName(): ?string + { + if (count($this->familyName) == 0) { + return null; + } + return $this->familyName['value']; + } + + /** + * Sets Family Name. + * The family name (that is, the last name) associated with the customer profile. + * + * @maps family_name + */ + public function setFamilyName(?string $familyName): void + { + $this->familyName['value'] = $familyName; + } + + /** + * Unsets Family Name. + * The family name (that is, the last name) associated with the customer profile. + */ + public function unsetFamilyName(): void + { + $this->familyName = []; + } + + /** + * Returns Company Name. + * A business name associated with the customer profile. + */ + public function getCompanyName(): ?string + { + if (count($this->companyName) == 0) { + return null; + } + return $this->companyName['value']; + } + + /** + * Sets Company Name. + * A business name associated with the customer profile. + * + * @maps company_name + */ + public function setCompanyName(?string $companyName): void + { + $this->companyName['value'] = $companyName; + } + + /** + * Unsets Company Name. + * A business name associated with the customer profile. + */ + public function unsetCompanyName(): void + { + $this->companyName = []; + } + + /** + * Returns Nickname. + * A nickname for the customer profile. + */ + public function getNickname(): ?string + { + if (count($this->nickname) == 0) { + return null; + } + return $this->nickname['value']; + } + + /** + * Sets Nickname. + * A nickname for the customer profile. + * + * @maps nickname + */ + public function setNickname(?string $nickname): void + { + $this->nickname['value'] = $nickname; + } + + /** + * Unsets Nickname. + * A nickname for the customer profile. + */ + public function unsetNickname(): void + { + $this->nickname = []; + } + + /** + * Returns Email Address. + * The email address associated with the customer profile. + */ + public function getEmailAddress(): ?string + { + if (count($this->emailAddress) == 0) { + return null; + } + return $this->emailAddress['value']; + } + + /** + * Sets Email Address. + * The email address associated with the customer profile. + * + * @maps email_address + */ + public function setEmailAddress(?string $emailAddress): void + { + $this->emailAddress['value'] = $emailAddress; + } + + /** + * Unsets Email Address. + * The email address associated with the customer profile. + */ + public function unsetEmailAddress(): void + { + $this->emailAddress = []; + } + + /** + * Returns Address. + * Represents a postal address in a country. + * For more information, see [Working with Addresses](https://developer.squareup.com/docs/build- + * basics/working-with-addresses). + */ + public function getAddress(): ?Address + { + return $this->address; + } + + /** + * Sets Address. + * Represents a postal address in a country. + * For more information, see [Working with Addresses](https://developer.squareup.com/docs/build- + * basics/working-with-addresses). + * + * @maps address + */ + public function setAddress(?Address $address): void + { + $this->address = $address; + } + + /** + * Returns Phone Number. + * The phone number associated with the customer profile. The phone number must be valid + * and can contain 9–16 digits, with an optional `+` prefix and country code. For more information, + * see [Customer phone numbers](https://developer.squareup.com/docs/customers-api/use-the-api/keep- + * records#phone-number). + */ + public function getPhoneNumber(): ?string + { + if (count($this->phoneNumber) == 0) { + return null; + } + return $this->phoneNumber['value']; + } + + /** + * Sets Phone Number. + * The phone number associated with the customer profile. The phone number must be valid + * and can contain 9–16 digits, with an optional `+` prefix and country code. For more information, + * see [Customer phone numbers](https://developer.squareup.com/docs/customers-api/use-the-api/keep- + * records#phone-number). + * + * @maps phone_number + */ + public function setPhoneNumber(?string $phoneNumber): void + { + $this->phoneNumber['value'] = $phoneNumber; + } + + /** + * Unsets Phone Number. + * The phone number associated with the customer profile. The phone number must be valid + * and can contain 9–16 digits, with an optional `+` prefix and country code. For more information, + * see [Customer phone numbers](https://developer.squareup.com/docs/customers-api/use-the-api/keep- + * records#phone-number). + */ + public function unsetPhoneNumber(): void + { + $this->phoneNumber = []; + } + + /** + * Returns Reference Id. + * An optional second ID used to associate the customer profile with an + * entity in another system. + */ + public function getReferenceId(): ?string + { + if (count($this->referenceId) == 0) { + return null; + } + return $this->referenceId['value']; + } + + /** + * Sets Reference Id. + * An optional second ID used to associate the customer profile with an + * entity in another system. + * + * @maps reference_id + */ + public function setReferenceId(?string $referenceId): void + { + $this->referenceId['value'] = $referenceId; + } + + /** + * Unsets Reference Id. + * An optional second ID used to associate the customer profile with an + * entity in another system. + */ + public function unsetReferenceId(): void + { + $this->referenceId = []; + } + + /** + * Returns Note. + * An custom note associates with the customer profile. + */ + public function getNote(): ?string + { + if (count($this->note) == 0) { + return null; + } + return $this->note['value']; + } + + /** + * Sets Note. + * An custom note associates with the customer profile. + * + * @maps note + */ + public function setNote(?string $note): void + { + $this->note['value'] = $note; + } + + /** + * Unsets Note. + * An custom note associates with the customer profile. + */ + public function unsetNote(): void + { + $this->note = []; + } + + /** + * Returns Birthday. + * The birthday associated with the customer profile, in `YYYY-MM-DD` or `MM-DD` format. + * For example, specify `1998-09-21` for September 21, 1998, or `09-21` for September 21. + * Birthdays are returned in `YYYY-MM-DD` format, where `YYYY` is the specified birth year or + * `0000` if a birth year is not specified. + */ + public function getBirthday(): ?string + { + if (count($this->birthday) == 0) { + return null; + } + return $this->birthday['value']; + } + + /** + * Sets Birthday. + * The birthday associated with the customer profile, in `YYYY-MM-DD` or `MM-DD` format. + * For example, specify `1998-09-21` for September 21, 1998, or `09-21` for September 21. + * Birthdays are returned in `YYYY-MM-DD` format, where `YYYY` is the specified birth year or + * `0000` if a birth year is not specified. + * + * @maps birthday + */ + public function setBirthday(?string $birthday): void + { + $this->birthday['value'] = $birthday; + } + + /** + * Unsets Birthday. + * The birthday associated with the customer profile, in `YYYY-MM-DD` or `MM-DD` format. + * For example, specify `1998-09-21` for September 21, 1998, or `09-21` for September 21. + * Birthdays are returned in `YYYY-MM-DD` format, where `YYYY` is the specified birth year or + * `0000` if a birth year is not specified. + */ + public function unsetBirthday(): void + { + $this->birthday = []; + } + + /** + * Returns Tax Ids. + * Represents the tax ID associated with a [customer profile]($m/Customer). The corresponding `tax_ids` + * field is available only for customers of sellers in EU countries or the United Kingdom. + * For more information, see [Customer tax IDs](https://developer.squareup.com/docs/customers-api/what- + * it-does#customer-tax-ids). + */ + public function getTaxIds(): ?CustomerTaxIds + { + return $this->taxIds; + } + + /** + * Sets Tax Ids. + * Represents the tax ID associated with a [customer profile]($m/Customer). The corresponding `tax_ids` + * field is available only for customers of sellers in EU countries or the United Kingdom. + * For more information, see [Customer tax IDs](https://developer.squareup.com/docs/customers-api/what- + * it-does#customer-tax-ids). + * + * @maps tax_ids + */ + public function setTaxIds(?CustomerTaxIds $taxIds): void + { + $this->taxIds = $taxIds; + } + + /** + * Returns Version. + * The current version of the customer profile. + * + * As a best practice, you should include this field to enable + * [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api- + * patterns/optimistic-concurrency) + * control. + */ + public function getVersion(): ?int + { + return $this->version; + } + + /** + * Sets Version. + * The current version of the customer profile. + * + * As a best practice, you should include this field to enable + * [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api- + * patterns/optimistic-concurrency) + * control. + * + * @maps version + */ + public function setVersion(?int $version): void + { + $this->version = $version; + } + + /** + * 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->givenName)) { + $json['given_name'] = $this->givenName['value']; + } + if (!empty($this->familyName)) { + $json['family_name'] = $this->familyName['value']; + } + if (!empty($this->companyName)) { + $json['company_name'] = $this->companyName['value']; + } + if (!empty($this->nickname)) { + $json['nickname'] = $this->nickname['value']; + } + if (!empty($this->emailAddress)) { + $json['email_address'] = $this->emailAddress['value']; + } + if (isset($this->address)) { + $json['address'] = $this->address; + } + if (!empty($this->phoneNumber)) { + $json['phone_number'] = $this->phoneNumber['value']; + } + if (!empty($this->referenceId)) { + $json['reference_id'] = $this->referenceId['value']; + } + if (!empty($this->note)) { + $json['note'] = $this->note['value']; + } + if (!empty($this->birthday)) { + $json['birthday'] = $this->birthday['value']; + } + if (isset($this->taxIds)) { + $json['tax_ids'] = $this->taxIds; + } + if (isset($this->version)) { + $json['version'] = $this->version; + } + $json = array_filter($json, function ($val) { + return $val !== null; + }); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/BulkUpdateCustomersRequest.php b/src/Models/BulkUpdateCustomersRequest.php new file mode 100644 index 00000000..b8b302a4 --- /dev/null +++ b/src/Models/BulkUpdateCustomersRequest.php @@ -0,0 +1,88 @@ + + */ + private $customers; + + /** + * @param array $customers + */ + public function __construct(array $customers) + { + $this->customers = $customers; + } + + /** + * Returns Customers. + * A map of 1 to 100 individual update requests, represented by `customer ID: { customer data }` + * key-value pairs. + * + * Each key is the ID of the [customer profile](entity:Customer) to update. To update a customer + * profile + * that was created by merging existing profiles, provide the ID of the newly created profile. + * + * Each value contains the updated customer data. Only new or changed fields are required. To add or + * update a field, specify the new value. To remove a field, specify `null`. + * + * @return array + */ + public function getCustomers(): array + { + return $this->customers; + } + + /** + * Sets Customers. + * A map of 1 to 100 individual update requests, represented by `customer ID: { customer data }` + * key-value pairs. + * + * Each key is the ID of the [customer profile](entity:Customer) to update. To update a customer + * profile + * that was created by merging existing profiles, provide the ID of the newly created profile. + * + * Each value contains the updated customer data. Only new or changed fields are required. To add or + * update a field, specify the new value. To remove a field, specify `null`. + * + * @required + * @maps customers + * + * @param array $customers + */ + public function setCustomers(array $customers): void + { + $this->customers = $customers; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + $json['customers'] = $this->customers; + $json = array_filter($json, function ($val) { + return $val !== null; + }); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/BulkUpdateCustomersResponse.php b/src/Models/BulkUpdateCustomersResponse.php new file mode 100644 index 00000000..b754e2f6 --- /dev/null +++ b/src/Models/BulkUpdateCustomersResponse.php @@ -0,0 +1,109 @@ +|null + */ + private $responses; + + /** + * @var Error[]|null + */ + private $errors; + + /** + * Returns Responses. + * A map of responses that correspond to individual update requests, represented by + * key-value pairs. + * + * Each key is the customer ID that was specified for an update request and each value + * is the corresponding response. + * If the request succeeds, the value is the updated customer profile. + * If the request fails, the value contains any errors that occurred during the request. + * + * @return array|null + */ + public function getResponses(): ?array + { + return $this->responses; + } + + /** + * Sets Responses. + * A map of responses that correspond to individual update requests, represented by + * key-value pairs. + * + * Each key is the customer ID that was specified for an update request and each value + * is the corresponding response. + * If the request succeeds, the value is the updated customer profile. + * If the request fails, the value contains any errors that occurred during the request. + * + * @maps responses + * + * @param array|null $responses + */ + public function setResponses(?array $responses): void + { + $this->responses = $responses; + } + + /** + * Returns Errors. + * Any top-level errors that prevented the bulk operation from running. + * + * @return Error[]|null + */ + public function getErrors(): ?array + { + return $this->errors; + } + + /** + * Sets Errors. + * Any top-level errors that prevented the bulk operation from running. + * + * @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->responses)) { + $json['responses'] = $this->responses; + } + 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/Models/CatalogInfoResponseLimits.php b/src/Models/CatalogInfoResponseLimits.php index 3da93155..448e2017 100644 --- a/src/Models/CatalogInfoResponseLimits.php +++ b/src/Models/CatalogInfoResponseLimits.php @@ -401,7 +401,8 @@ public function getUpdateItemModifierListsMaxModifierListsToEnable(): ?int public function setUpdateItemModifierListsMaxModifierListsToEnable( ?int $updateItemModifierListsMaxModifierListsToEnable ): void { - $this->updateItemModifierListsMaxModifierListsToEnable['value'] = $updateItemModifierListsMaxModifierListsToEnable; + $this->updateItemModifierListsMaxModifierListsToEnable['value'] = + $updateItemModifierListsMaxModifierListsToEnable; } /** @@ -437,7 +438,8 @@ public function getUpdateItemModifierListsMaxModifierListsToDisable(): ?int public function setUpdateItemModifierListsMaxModifierListsToDisable( ?int $updateItemModifierListsMaxModifierListsToDisable ): void { - $this->updateItemModifierListsMaxModifierListsToDisable['value'] = $updateItemModifierListsMaxModifierListsToDisable; + $this->updateItemModifierListsMaxModifierListsToDisable['value'] = + $updateItemModifierListsMaxModifierListsToDisable; } /** diff --git a/src/Models/CatalogItemModifierListInfo.php b/src/Models/CatalogItemModifierListInfo.php index 32a004b2..a59c43d7 100644 --- a/src/Models/CatalogItemModifierListInfo.php +++ b/src/Models/CatalogItemModifierListInfo.php @@ -7,7 +7,9 @@ use stdClass; /** - * Options to control the properties of a `CatalogModifierList` applied to a `CatalogItem` instance. + * References a text-based modifier or a list of non text-based modifiers applied to a `CatalogItem` + * instance + * and specifies supported behaviors of the application. */ class CatalogItemModifierListInfo implements \JsonSerializable { @@ -36,6 +38,11 @@ class CatalogItemModifierListInfo implements \JsonSerializable */ private $enabled = []; + /** + * @var array + */ + private $ordinal = []; + /** * @param string $modifierListId */ @@ -206,6 +213,44 @@ public function unsetEnabled(): void $this->enabled = []; } + /** + * Returns Ordinal. + * The position of this `CatalogItemModifierListInfo` object within the `modifier_list_info` list + * applied + * to a `CatalogItem` instance. + */ + public function getOrdinal(): ?int + { + if (count($this->ordinal) == 0) { + return null; + } + return $this->ordinal['value']; + } + + /** + * Sets Ordinal. + * The position of this `CatalogItemModifierListInfo` object within the `modifier_list_info` list + * applied + * to a `CatalogItem` instance. + * + * @maps ordinal + */ + public function setOrdinal(?int $ordinal): void + { + $this->ordinal['value'] = $ordinal; + } + + /** + * Unsets Ordinal. + * The position of this `CatalogItemModifierListInfo` object within the `modifier_list_info` list + * applied + * to a `CatalogItem` instance. + */ + public function unsetOrdinal(): void + { + $this->ordinal = []; + } + /** * Encode this object to JSON * @@ -231,6 +276,9 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) if (!empty($this->enabled)) { $json['enabled'] = $this->enabled['value']; } + if (!empty($this->ordinal)) { + $json['ordinal'] = $this->ordinal['value']; + } $json = array_filter($json, function ($val) { return $val !== null; }); diff --git a/src/Models/CatalogModifierList.php b/src/Models/CatalogModifierList.php index 97ec47a3..3218cf76 100644 --- a/src/Models/CatalogModifierList.php +++ b/src/Models/CatalogModifierList.php @@ -7,12 +7,22 @@ use stdClass; /** - * A list of modifiers applicable to items at the time of sale. + * For a text-based modifier, this encapsulates the modifier's text when its `modifier_type` is `TEXT`. + * For example, to sell T-shirts with custom prints, a text-based modifier can be used to capture the + * buyer-supplied + * text string to be selected for the T-shirt at the time of sale. * + * For non text-based modifiers, this encapsulates a non-empty list of modifiers applicable to items + * at the time of sale. Each element of the modifier list is a `CatalogObject` instance of the + * `MODIFIER` type. * For example, a "Condiments" modifier list applicable to a "Hot Dog" item * may contain "Ketchup", "Mustard", and "Relish" modifiers. - * Use the `selection_type` field to specify whether or not multiple selections from - * the modifier list are allowed. + * + * A non text-based modifier can be applied to the modified item once or multiple times, if the + * `selection_type` field + * is set to `SINGLE` or `MULTIPLE`, respectively. On the other hand, a text-based modifier can be + * applied to the item + * only once and the `selection_type` field is always set to `SINGLE`. */ class CatalogModifierList implements \JsonSerializable { @@ -41,10 +51,31 @@ class CatalogModifierList implements \JsonSerializable */ private $imageIds = []; + /** + * @var string|null + */ + private $modifierType; + + /** + * @var array + */ + private $maxLength = []; + + /** + * @var array + */ + private $textRequired = []; + + /** + * @var array + */ + private $internalName = []; + /** * Returns Name. - * The name for the `CatalogModifierList` instance. This is a searchable attribute for use in - * applicable query filters, and its value length is of Unicode code points. + * The name of the `CatalogModifierList` instance. This is a searchable attribute for use in applicable + * query filters, and its value length is of + * Unicode code points. */ public function getName(): ?string { @@ -56,8 +87,9 @@ public function getName(): ?string /** * Sets Name. - * The name for the `CatalogModifierList` instance. This is a searchable attribute for use in - * applicable query filters, and its value length is of Unicode code points. + * The name of the `CatalogModifierList` instance. This is a searchable attribute for use in applicable + * query filters, and its value length is of + * Unicode code points. * * @maps name */ @@ -68,8 +100,9 @@ public function setName(?string $name): void /** * Unsets Name. - * The name for the `CatalogModifierList` instance. This is a searchable attribute for use in - * applicable query filters, and its value length is of Unicode code points. + * The name of the `CatalogModifierList` instance. This is a searchable attribute for use in applicable + * query filters, and its value length is of + * Unicode code points. */ public function unsetName(): void { @@ -78,7 +111,7 @@ public function unsetName(): void /** * Returns Ordinal. - * Determines where this modifier list appears in a list of `CatalogModifierList` values. + * The position of this `CatalogModifierList` within a list of `CatalogModifierList` instances. */ public function getOrdinal(): ?int { @@ -90,7 +123,7 @@ public function getOrdinal(): ?int /** * Sets Ordinal. - * Determines where this modifier list appears in a list of `CatalogModifierList` values. + * The position of this `CatalogModifierList` within a list of `CatalogModifierList` instances. * * @maps ordinal */ @@ -101,7 +134,7 @@ public function setOrdinal(?int $ordinal): void /** * Unsets Ordinal. - * Determines where this modifier list appears in a list of `CatalogModifierList` values. + * The position of this `CatalogModifierList` within a list of `CatalogModifierList` instances. */ public function unsetOrdinal(): void { @@ -130,10 +163,16 @@ public function setSelectionType(?string $selectionType): void /** * Returns Modifiers. - * The options included in the `CatalogModifierList`. - * You must include at least one `CatalogModifier`. - * Each CatalogObject must have type `MODIFIER` and contain - * `CatalogModifier` data. + * A non-empty list of `CatalogModifier` objects to be included in the `CatalogModifierList`, + * for non text-based modifiers when the `modifier_type` attribute is `LIST`. Each element of this list + * is a `CatalogObject` instance of the `MODIFIER` type, containing the following attributes: + * ``` + * { + * "id": "{{catalog_modifier_id}}", + * "type": "MODIFIER", + * "modifier_data": {{a CatalogModifier instance>}} + * } + * ``` * * @return CatalogObject[]|null */ @@ -147,10 +186,16 @@ public function getModifiers(): ?array /** * Sets Modifiers. - * The options included in the `CatalogModifierList`. - * You must include at least one `CatalogModifier`. - * Each CatalogObject must have type `MODIFIER` and contain - * `CatalogModifier` data. + * A non-empty list of `CatalogModifier` objects to be included in the `CatalogModifierList`, + * for non text-based modifiers when the `modifier_type` attribute is `LIST`. Each element of this list + * is a `CatalogObject` instance of the `MODIFIER` type, containing the following attributes: + * ``` + * { + * "id": "{{catalog_modifier_id}}", + * "type": "MODIFIER", + * "modifier_data": {{a CatalogModifier instance>}} + * } + * ``` * * @maps modifiers * @@ -163,10 +208,16 @@ public function setModifiers(?array $modifiers): void /** * Unsets Modifiers. - * The options included in the `CatalogModifierList`. - * You must include at least one `CatalogModifier`. - * Each CatalogObject must have type `MODIFIER` and contain - * `CatalogModifier` data. + * A non-empty list of `CatalogModifier` objects to be included in the `CatalogModifierList`, + * for non text-based modifiers when the `modifier_type` attribute is `LIST`. Each element of this list + * is a `CatalogObject` instance of the `MODIFIER` type, containing the following attributes: + * ``` + * { + * "id": "{{catalog_modifier_id}}", + * "type": "MODIFIER", + * "modifier_data": {{a CatalogModifier instance>}} + * } + * ``` */ public function unsetModifiers(): void { @@ -176,7 +227,7 @@ public function unsetModifiers(): void /** * Returns Image Ids. * The IDs of images associated with this `CatalogModifierList` instance. - * Currently these images are not displayed by Square, but are free to be displayed in 3rd party + * Currently these images are not displayed on Square products, but may be displayed in 3rd-party * applications. * * @return string[]|null @@ -192,7 +243,7 @@ public function getImageIds(): ?array /** * Sets Image Ids. * The IDs of images associated with this `CatalogModifierList` instance. - * Currently these images are not displayed by Square, but are free to be displayed in 3rd party + * Currently these images are not displayed on Square products, but may be displayed in 3rd-party * applications. * * @maps image_ids @@ -207,7 +258,7 @@ public function setImageIds(?array $imageIds): void /** * Unsets Image Ids. * The IDs of images associated with this `CatalogModifierList` instance. - * Currently these images are not displayed by Square, but are free to be displayed in 3rd party + * Currently these images are not displayed on Square products, but may be displayed in 3rd-party * applications. */ public function unsetImageIds(): void @@ -215,6 +266,158 @@ public function unsetImageIds(): void $this->imageIds = []; } + /** + * Returns Modifier Type. + * Defines the type of `CatalogModifierList`. + */ + public function getModifierType(): ?string + { + return $this->modifierType; + } + + /** + * Sets Modifier Type. + * Defines the type of `CatalogModifierList`. + * + * @maps modifier_type + */ + public function setModifierType(?string $modifierType): void + { + $this->modifierType = $modifierType; + } + + /** + * Returns Max Length. + * The maximum length, in Unicode points, of the text string of the text-based modifier as represented + * by + * this `CatalogModifierList` object with the `modifier_type` set to `TEXT`. + */ + public function getMaxLength(): ?int + { + if (count($this->maxLength) == 0) { + return null; + } + return $this->maxLength['value']; + } + + /** + * Sets Max Length. + * The maximum length, in Unicode points, of the text string of the text-based modifier as represented + * by + * this `CatalogModifierList` object with the `modifier_type` set to `TEXT`. + * + * @maps max_length + */ + public function setMaxLength(?int $maxLength): void + { + $this->maxLength['value'] = $maxLength; + } + + /** + * Unsets Max Length. + * The maximum length, in Unicode points, of the text string of the text-based modifier as represented + * by + * this `CatalogModifierList` object with the `modifier_type` set to `TEXT`. + */ + public function unsetMaxLength(): void + { + $this->maxLength = []; + } + + /** + * Returns Text Required. + * Whether the text string must be a non-empty string (`true`) or not (`false`) for a text-based + * modifier + * as represented by this `CatalogModifierList` object with the `modifier_type` set to `TEXT`. + */ + public function getTextRequired(): ?bool + { + if (count($this->textRequired) == 0) { + return null; + } + return $this->textRequired['value']; + } + + /** + * Sets Text Required. + * Whether the text string must be a non-empty string (`true`) or not (`false`) for a text-based + * modifier + * as represented by this `CatalogModifierList` object with the `modifier_type` set to `TEXT`. + * + * @maps text_required + */ + public function setTextRequired(?bool $textRequired): void + { + $this->textRequired['value'] = $textRequired; + } + + /** + * Unsets Text Required. + * Whether the text string must be a non-empty string (`true`) or not (`false`) for a text-based + * modifier + * as represented by this `CatalogModifierList` object with the `modifier_type` set to `TEXT`. + */ + public function unsetTextRequired(): void + { + $this->textRequired = []; + } + + /** + * Returns Internal Name. + * A note for internal use by the business. + * + * For example, for a text-based modifier applied to a T-shirt item, if the buyer-supplied text of + * "Hello, Kitty!" + * is to be printed on the T-shirt, this `internal_name` attribute can be "Use italic face" as + * an instruction for the business to follow. + * + * For non text-based modifiers, this `internal_name` attribute can be + * used to include SKUs, internal codes, or supplemental descriptions for internal use. + */ + public function getInternalName(): ?string + { + if (count($this->internalName) == 0) { + return null; + } + return $this->internalName['value']; + } + + /** + * Sets Internal Name. + * A note for internal use by the business. + * + * For example, for a text-based modifier applied to a T-shirt item, if the buyer-supplied text of + * "Hello, Kitty!" + * is to be printed on the T-shirt, this `internal_name` attribute can be "Use italic face" as + * an instruction for the business to follow. + * + * For non text-based modifiers, this `internal_name` attribute can be + * used to include SKUs, internal codes, or supplemental descriptions for internal use. + * + * @maps internal_name + */ + public function setInternalName(?string $internalName): void + { + $this->internalName['value'] = $internalName; + } + + /** + * Unsets Internal Name. + * A note for internal use by the business. + * + * For example, for a text-based modifier applied to a T-shirt item, if the buyer-supplied text of + * "Hello, Kitty!" + * is to be printed on the T-shirt, this `internal_name` attribute can be "Use italic face" as + * an instruction for the business to follow. + * + * For non text-based modifiers, this `internal_name` attribute can be + * used to include SKUs, internal codes, or supplemental descriptions for internal use. + */ + public function unsetInternalName(): void + { + $this->internalName = []; + } + /** * Encode this object to JSON * @@ -242,6 +445,18 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) if (!empty($this->imageIds)) { $json['image_ids'] = $this->imageIds['value']; } + if (isset($this->modifierType)) { + $json['modifier_type'] = $this->modifierType; + } + if (!empty($this->maxLength)) { + $json['max_length'] = $this->maxLength['value']; + } + if (!empty($this->textRequired)) { + $json['text_required'] = $this->textRequired['value']; + } + if (!empty($this->internalName)) { + $json['internal_name'] = $this->internalName['value']; + } $json = array_filter($json, function ($val) { return $val !== null; }); diff --git a/src/Models/CatalogModifierListModifierType.php b/src/Models/CatalogModifierListModifierType.php new file mode 100644 index 00000000..74623556 --- /dev/null +++ b/src/Models/CatalogModifierListModifierType.php @@ -0,0 +1,21 @@ +paymentId = $paymentId; - $this->type = $type; - $this->reason = $reason; - } - - /** - * Returns Payment Id. - * The ID of the payment to refund. If you are creating a `PARTIAL` - * refund for a split tender payment, instead provide the id of the - * particular tender you want to refund. - */ - public function getPaymentId(): string - { - return $this->paymentId; - } - - /** - * Sets Payment Id. - * The ID of the payment to refund. If you are creating a `PARTIAL` - * refund for a split tender payment, instead provide the id of the - * particular tender you want to refund. - * - * @required - * @maps payment_id - */ - public function setPaymentId(string $paymentId): void - { - $this->paymentId = $paymentId; - } - - /** - * Returns Type. - */ - public function getType(): string - { - return $this->type; - } - - /** - * Sets Type. - * - * @required - * @maps type - */ - public function setType(string $type): void - { - $this->type = $type; - } - - /** - * Returns Reason. - * The reason for the refund. - */ - public function getReason(): string - { - return $this->reason; - } - - /** - * Sets Reason. - * The reason for the refund. - * - * @required - * @maps reason - */ - public function setReason(string $reason): void - { - $this->reason = $reason; - } - - /** - * Returns Refunded Money. - */ - public function getRefundedMoney(): ?V1Money - { - return $this->refundedMoney; - } - - /** - * Sets Refunded Money. - * - * @maps refunded_money - */ - public function setRefundedMoney(?V1Money $refundedMoney): void - { - $this->refundedMoney = $refundedMoney; - } - - /** - * Returns Request Idempotence Key. - * An optional key to ensure idempotence if you issue the same PARTIAL refund request more than once. - */ - public function getRequestIdempotenceKey(): ?string - { - if (count($this->requestIdempotenceKey) == 0) { - return null; - } - return $this->requestIdempotenceKey['value']; - } - - /** - * Sets Request Idempotence Key. - * An optional key to ensure idempotence if you issue the same PARTIAL refund request more than once. - * - * @maps request_idempotence_key - */ - public function setRequestIdempotenceKey(?string $requestIdempotenceKey): void - { - $this->requestIdempotenceKey['value'] = $requestIdempotenceKey; - } - - /** - * Unsets Request Idempotence Key. - * An optional key to ensure idempotence if you issue the same PARTIAL refund request more than once. - */ - public function unsetRequestIdempotenceKey(): void - { - $this->requestIdempotenceKey = []; - } - - /** - * Encode this object to JSON - * - * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields - * are set. (default: false) - * - * @return array|stdClass - */ - #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) - public function jsonSerialize(bool $asArrayWhenEmpty = false) - { - $json = []; - $json['payment_id'] = $this->paymentId; - $json['type'] = $this->type; - $json['reason'] = $this->reason; - if (isset($this->refundedMoney)) { - $json['refunded_money'] = $this->refundedMoney; - } - if (!empty($this->requestIdempotenceKey)) { - $json['request_idempotence_key'] = $this->requestIdempotenceKey['value']; - } - $json = array_filter($json, function ($val) { - return $val !== null; - }); - - return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; - } -} diff --git a/src/Models/V1CreateRefundRequestType.php b/src/Models/V1CreateRefundRequestType.php deleted file mode 100644 index eb69b2d6..00000000 --- a/src/Models/V1CreateRefundRequestType.php +++ /dev/null @@ -1,12 +0,0 @@ -order; - } - - /** - * Sets Order. - * The order (e.g., chronological or alphabetical) in which results from a request are returned. - * - * @maps order - */ - public function setOrder(?string $order): void - { - $this->order = $order; - } - - /** - * Returns Begin Time. - * The beginning of the requested reporting period, in ISO 8601 format. If this value is before January - * 1, 2013 (2013-01-01T00:00:00Z), this endpoint returns an error. Default value: The current time - * minus one year. - */ - public function getBeginTime(): ?string - { - if (count($this->beginTime) == 0) { - return null; - } - return $this->beginTime['value']; - } - - /** - * Sets Begin Time. - * The beginning of the requested reporting period, in ISO 8601 format. If this value is before January - * 1, 2013 (2013-01-01T00:00:00Z), this endpoint returns an error. Default value: The current time - * minus one year. - * - * @maps begin_time - */ - public function setBeginTime(?string $beginTime): void - { - $this->beginTime['value'] = $beginTime; - } - - /** - * Unsets Begin Time. - * The beginning of the requested reporting period, in ISO 8601 format. If this value is before January - * 1, 2013 (2013-01-01T00:00:00Z), this endpoint returns an error. Default value: The current time - * minus one year. - */ - public function unsetBeginTime(): void - { - $this->beginTime = []; - } - - /** - * Returns End Time. - * The end of the requested reporting period, in ISO 8601 format. If this value is more than one year - * greater than begin_time, this endpoint returns an error. Default value: The current time. - */ - public function getEndTime(): ?string - { - if (count($this->endTime) == 0) { - return null; - } - return $this->endTime['value']; - } - - /** - * Sets End Time. - * The end of the requested reporting period, in ISO 8601 format. If this value is more than one year - * greater than begin_time, this endpoint returns an error. Default value: The current time. - * - * @maps end_time - */ - public function setEndTime(?string $endTime): void - { - $this->endTime['value'] = $endTime; - } - - /** - * Unsets End Time. - * The end of the requested reporting period, in ISO 8601 format. If this value is more than one year - * greater than begin_time, this endpoint returns an error. Default value: The current time. - */ - public function unsetEndTime(): void - { - $this->endTime = []; - } - - /** - * Returns Limit. - * The maximum number of payments to return in a single response. This value cannot exceed 200. - */ - public function getLimit(): ?int - { - if (count($this->limit) == 0) { - return null; - } - return $this->limit['value']; - } - - /** - * Sets Limit. - * The maximum number of payments to return in a single response. This value cannot exceed 200. - * - * @maps limit - */ - public function setLimit(?int $limit): void - { - $this->limit['value'] = $limit; - } - - /** - * Unsets Limit. - * The maximum number of payments to return in a single response. This value cannot exceed 200. - */ - public function unsetLimit(): void - { - $this->limit = []; - } - - /** - * Returns Batch Token. - * A pagination cursor to retrieve the next set of results for your - * original query to the endpoint. - */ - public function getBatchToken(): ?string - { - if (count($this->batchToken) == 0) { - return null; - } - return $this->batchToken['value']; - } - - /** - * Sets Batch Token. - * A pagination cursor to retrieve the next set of results for your - * original query to the endpoint. - * - * @maps batch_token - */ - public function setBatchToken(?string $batchToken): void - { - $this->batchToken['value'] = $batchToken; - } - - /** - * Unsets Batch Token. - * A pagination cursor to retrieve the next set of results for your - * original query to the endpoint. - */ - public function unsetBatchToken(): void - { - $this->batchToken = []; - } - - /** - * Returns Include Partial. - * Indicates whether or not to include partial payments in the response. Partial payments will have the - * tenders collected so far, but the itemizations will be empty until the payment is completed. - */ - public function getIncludePartial(): ?bool - { - if (count($this->includePartial) == 0) { - return null; - } - return $this->includePartial['value']; - } - - /** - * Sets Include Partial. - * Indicates whether or not to include partial payments in the response. Partial payments will have the - * tenders collected so far, but the itemizations will be empty until the payment is completed. - * - * @maps include_partial - */ - public function setIncludePartial(?bool $includePartial): void - { - $this->includePartial['value'] = $includePartial; - } - - /** - * Unsets Include Partial. - * Indicates whether or not to include partial payments in the response. Partial payments will have the - * tenders collected so far, but the itemizations will be empty until the payment is completed. - */ - public function unsetIncludePartial(): void - { - $this->includePartial = []; - } - - /** - * 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->order)) { - $json['order'] = $this->order; - } - if (!empty($this->beginTime)) { - $json['begin_time'] = $this->beginTime['value']; - } - if (!empty($this->endTime)) { - $json['end_time'] = $this->endTime['value']; - } - if (!empty($this->limit)) { - $json['limit'] = $this->limit['value']; - } - if (!empty($this->batchToken)) { - $json['batch_token'] = $this->batchToken['value']; - } - if (!empty($this->includePartial)) { - $json['include_partial'] = $this->includePartial['value']; - } - $json = array_filter($json, function ($val) { - return $val !== null; - }); - - return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; - } -} diff --git a/src/Models/V1ListPaymentsResponse.php b/src/Models/V1ListPaymentsResponse.php deleted file mode 100644 index 6b8f980c..00000000 --- a/src/Models/V1ListPaymentsResponse.php +++ /dev/null @@ -1,59 +0,0 @@ -items; - } - - /** - * Sets Items. - * - * @maps items - * - * @param V1Payment[]|null $items - */ - public function setItems(?array $items): void - { - $this->items = $items; - } - - /** - * 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->items)) { - $json['items'] = $this->items; - } - $json = array_filter($json, function ($val) { - return $val !== null; - }); - - return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; - } -} diff --git a/src/Models/V1ListRefundsRequest.php b/src/Models/V1ListRefundsRequest.php deleted file mode 100644 index ac22f1ce..00000000 --- a/src/Models/V1ListRefundsRequest.php +++ /dev/null @@ -1,238 +0,0 @@ -order; - } - - /** - * Sets Order. - * The order (e.g., chronological or alphabetical) in which results from a request are returned. - * - * @maps order - */ - public function setOrder(?string $order): void - { - $this->order = $order; - } - - /** - * Returns Begin Time. - * The beginning of the requested reporting period, in ISO 8601 format. If this value is before January - * 1, 2013 (2013-01-01T00:00:00Z), this endpoint returns an error. Default value: The current time - * minus one year. - */ - public function getBeginTime(): ?string - { - if (count($this->beginTime) == 0) { - return null; - } - return $this->beginTime['value']; - } - - /** - * Sets Begin Time. - * The beginning of the requested reporting period, in ISO 8601 format. If this value is before January - * 1, 2013 (2013-01-01T00:00:00Z), this endpoint returns an error. Default value: The current time - * minus one year. - * - * @maps begin_time - */ - public function setBeginTime(?string $beginTime): void - { - $this->beginTime['value'] = $beginTime; - } - - /** - * Unsets Begin Time. - * The beginning of the requested reporting period, in ISO 8601 format. If this value is before January - * 1, 2013 (2013-01-01T00:00:00Z), this endpoint returns an error. Default value: The current time - * minus one year. - */ - public function unsetBeginTime(): void - { - $this->beginTime = []; - } - - /** - * Returns End Time. - * The end of the requested reporting period, in ISO 8601 format. If this value is more than one year - * greater than begin_time, this endpoint returns an error. Default value: The current time. - */ - public function getEndTime(): ?string - { - if (count($this->endTime) == 0) { - return null; - } - return $this->endTime['value']; - } - - /** - * Sets End Time. - * The end of the requested reporting period, in ISO 8601 format. If this value is more than one year - * greater than begin_time, this endpoint returns an error. Default value: The current time. - * - * @maps end_time - */ - public function setEndTime(?string $endTime): void - { - $this->endTime['value'] = $endTime; - } - - /** - * Unsets End Time. - * The end of the requested reporting period, in ISO 8601 format. If this value is more than one year - * greater than begin_time, this endpoint returns an error. Default value: The current time. - */ - public function unsetEndTime(): void - { - $this->endTime = []; - } - - /** - * Returns Limit. - * The approximate number of refunds to return in a single response. Default: 100. Max: 200. Response - * may contain more results than the prescribed limit when refunds are made simultaneously to multiple - * tenders in a payment or when refunds are generated in an exchange to account for the value of - * returned goods. - */ - public function getLimit(): ?int - { - if (count($this->limit) == 0) { - return null; - } - return $this->limit['value']; - } - - /** - * Sets Limit. - * The approximate number of refunds to return in a single response. Default: 100. Max: 200. Response - * may contain more results than the prescribed limit when refunds are made simultaneously to multiple - * tenders in a payment or when refunds are generated in an exchange to account for the value of - * returned goods. - * - * @maps limit - */ - public function setLimit(?int $limit): void - { - $this->limit['value'] = $limit; - } - - /** - * Unsets Limit. - * The approximate number of refunds to return in a single response. Default: 100. Max: 200. Response - * may contain more results than the prescribed limit when refunds are made simultaneously to multiple - * tenders in a payment or when refunds are generated in an exchange to account for the value of - * returned goods. - */ - public function unsetLimit(): void - { - $this->limit = []; - } - - /** - * Returns Batch Token. - * A pagination cursor to retrieve the next set of results for your - * original query to the endpoint. - */ - public function getBatchToken(): ?string - { - if (count($this->batchToken) == 0) { - return null; - } - return $this->batchToken['value']; - } - - /** - * Sets Batch Token. - * A pagination cursor to retrieve the next set of results for your - * original query to the endpoint. - * - * @maps batch_token - */ - public function setBatchToken(?string $batchToken): void - { - $this->batchToken['value'] = $batchToken; - } - - /** - * Unsets Batch Token. - * A pagination cursor to retrieve the next set of results for your - * original query to the endpoint. - */ - public function unsetBatchToken(): void - { - $this->batchToken = []; - } - - /** - * 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->order)) { - $json['order'] = $this->order; - } - if (!empty($this->beginTime)) { - $json['begin_time'] = $this->beginTime['value']; - } - if (!empty($this->endTime)) { - $json['end_time'] = $this->endTime['value']; - } - if (!empty($this->limit)) { - $json['limit'] = $this->limit['value']; - } - if (!empty($this->batchToken)) { - $json['batch_token'] = $this->batchToken['value']; - } - $json = array_filter($json, function ($val) { - return $val !== null; - }); - - return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; - } -} diff --git a/src/Models/V1ListRefundsResponse.php b/src/Models/V1ListRefundsResponse.php deleted file mode 100644 index befc0e7b..00000000 --- a/src/Models/V1ListRefundsResponse.php +++ /dev/null @@ -1,59 +0,0 @@ -items; - } - - /** - * Sets Items. - * - * @maps items - * - * @param V1Refund[]|null $items - */ - public function setItems(?array $items): void - { - $this->items = $items; - } - - /** - * 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->items)) { - $json['items'] = $this->items; - } - $json = array_filter($json, function ($val) { - return $val !== null; - }); - - return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; - } -} diff --git a/src/Models/V1ListSettlementsRequest.php b/src/Models/V1ListSettlementsRequest.php deleted file mode 100644 index d998689d..00000000 --- a/src/Models/V1ListSettlementsRequest.php +++ /dev/null @@ -1,255 +0,0 @@ -order; - } - - /** - * Sets Order. - * The order (e.g., chronological or alphabetical) in which results from a request are returned. - * - * @maps order - */ - public function setOrder(?string $order): void - { - $this->order = $order; - } - - /** - * Returns Begin Time. - * The beginning of the requested reporting period, in ISO 8601 format. If this value is before January - * 1, 2013 (2013-01-01T00:00:00Z), this endpoint returns an error. Default value: The current time - * minus one year. - */ - public function getBeginTime(): ?string - { - if (count($this->beginTime) == 0) { - return null; - } - return $this->beginTime['value']; - } - - /** - * Sets Begin Time. - * The beginning of the requested reporting period, in ISO 8601 format. If this value is before January - * 1, 2013 (2013-01-01T00:00:00Z), this endpoint returns an error. Default value: The current time - * minus one year. - * - * @maps begin_time - */ - public function setBeginTime(?string $beginTime): void - { - $this->beginTime['value'] = $beginTime; - } - - /** - * Unsets Begin Time. - * The beginning of the requested reporting period, in ISO 8601 format. If this value is before January - * 1, 2013 (2013-01-01T00:00:00Z), this endpoint returns an error. Default value: The current time - * minus one year. - */ - public function unsetBeginTime(): void - { - $this->beginTime = []; - } - - /** - * Returns End Time. - * The end of the requested reporting period, in ISO 8601 format. If this value is more than one year - * greater than begin_time, this endpoint returns an error. Default value: The current time. - */ - public function getEndTime(): ?string - { - if (count($this->endTime) == 0) { - return null; - } - return $this->endTime['value']; - } - - /** - * Sets End Time. - * The end of the requested reporting period, in ISO 8601 format. If this value is more than one year - * greater than begin_time, this endpoint returns an error. Default value: The current time. - * - * @maps end_time - */ - public function setEndTime(?string $endTime): void - { - $this->endTime['value'] = $endTime; - } - - /** - * Unsets End Time. - * The end of the requested reporting period, in ISO 8601 format. If this value is more than one year - * greater than begin_time, this endpoint returns an error. Default value: The current time. - */ - public function unsetEndTime(): void - { - $this->endTime = []; - } - - /** - * Returns Limit. - * The maximum number of settlements to return in a single response. This value cannot exceed 200. - */ - public function getLimit(): ?int - { - if (count($this->limit) == 0) { - return null; - } - return $this->limit['value']; - } - - /** - * Sets Limit. - * The maximum number of settlements to return in a single response. This value cannot exceed 200. - * - * @maps limit - */ - public function setLimit(?int $limit): void - { - $this->limit['value'] = $limit; - } - - /** - * Unsets Limit. - * The maximum number of settlements to return in a single response. This value cannot exceed 200. - */ - public function unsetLimit(): void - { - $this->limit = []; - } - - /** - * Returns Status. - */ - public function getStatus(): ?string - { - return $this->status; - } - - /** - * Sets Status. - * - * @maps status - */ - public function setStatus(?string $status): void - { - $this->status = $status; - } - - /** - * Returns Batch Token. - * A pagination cursor to retrieve the next set of results for your - * original query to the endpoint. - */ - public function getBatchToken(): ?string - { - if (count($this->batchToken) == 0) { - return null; - } - return $this->batchToken['value']; - } - - /** - * Sets Batch Token. - * A pagination cursor to retrieve the next set of results for your - * original query to the endpoint. - * - * @maps batch_token - */ - public function setBatchToken(?string $batchToken): void - { - $this->batchToken['value'] = $batchToken; - } - - /** - * Unsets Batch Token. - * A pagination cursor to retrieve the next set of results for your - * original query to the endpoint. - */ - public function unsetBatchToken(): void - { - $this->batchToken = []; - } - - /** - * 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->order)) { - $json['order'] = $this->order; - } - if (!empty($this->beginTime)) { - $json['begin_time'] = $this->beginTime['value']; - } - if (!empty($this->endTime)) { - $json['end_time'] = $this->endTime['value']; - } - if (!empty($this->limit)) { - $json['limit'] = $this->limit['value']; - } - if (isset($this->status)) { - $json['status'] = $this->status; - } - if (!empty($this->batchToken)) { - $json['batch_token'] = $this->batchToken['value']; - } - $json = array_filter($json, function ($val) { - return $val !== null; - }); - - return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; - } -} diff --git a/src/Models/V1ListSettlementsRequestStatus.php b/src/Models/V1ListSettlementsRequestStatus.php deleted file mode 100644 index 880975c4..00000000 --- a/src/Models/V1ListSettlementsRequestStatus.php +++ /dev/null @@ -1,12 +0,0 @@ -items; - } - - /** - * Sets Items. - * - * @maps items - * - * @param V1Settlement[]|null $items - */ - public function setItems(?array $items): void - { - $this->items = $items; - } - - /** - * 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->items)) { - $json['items'] = $this->items; - } - $json = array_filter($json, function ($val) { - return $val !== null; - }); - - return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; - } -} diff --git a/src/Models/V1Payment.php b/src/Models/V1Payment.php deleted file mode 100644 index c627591f..00000000 --- a/src/Models/V1Payment.php +++ /dev/null @@ -1,965 +0,0 @@ - - *
  • - * Monetary values are positive if they represent an - * increase in the amount of money the merchant receives (e.g., - * tax_money, tip_money). - *
  • - *
  • - * Monetary values are negative if they represent an - * decrease in the amount of money the merchant receives (e.g., - * discount_money, refunded_money). - *
  • - * - */ -class V1Payment implements \JsonSerializable -{ - /** - * @var string|null - */ - private $id; - - /** - * @var array - */ - private $merchantId = []; - - /** - * @var string|null - */ - private $createdAt; - - /** - * @var array - */ - private $creatorId = []; - - /** - * @var V1Device|null - */ - private $device; - - /** - * @var array - */ - private $paymentUrl = []; - - /** - * @var array - */ - private $receiptUrl = []; - - /** - * @var V1Money|null - */ - private $inclusiveTaxMoney; - - /** - * @var V1Money|null - */ - private $additiveTaxMoney; - - /** - * @var V1Money|null - */ - private $taxMoney; - - /** - * @var V1Money|null - */ - private $tipMoney; - - /** - * @var V1Money|null - */ - private $discountMoney; - - /** - * @var V1Money|null - */ - private $totalCollectedMoney; - - /** - * @var V1Money|null - */ - private $processingFeeMoney; - - /** - * @var V1Money|null - */ - private $netTotalMoney; - - /** - * @var V1Money|null - */ - private $refundedMoney; - - /** - * @var V1Money|null - */ - private $swedishRoundingMoney; - - /** - * @var V1Money|null - */ - private $grossSalesMoney; - - /** - * @var V1Money|null - */ - private $netSalesMoney; - - /** - * @var array - */ - private $inclusiveTax = []; - - /** - * @var array - */ - private $additiveTax = []; - - /** - * @var array - */ - private $tender = []; - - /** - * @var array - */ - private $refunds = []; - - /** - * @var array - */ - private $itemizations = []; - - /** - * @var V1Money|null - */ - private $surchargeMoney; - - /** - * @var array - */ - private $surcharges = []; - - /** - * @var array - */ - private $isPartial = []; - - /** - * Returns Id. - * The payment's unique identifier. - */ - public function getId(): ?string - { - return $this->id; - } - - /** - * Sets Id. - * The payment's unique identifier. - * - * @maps id - */ - public function setId(?string $id): void - { - $this->id = $id; - } - - /** - * Returns Merchant Id. - * The unique identifier of the merchant that took the payment. - */ - public function getMerchantId(): ?string - { - if (count($this->merchantId) == 0) { - return null; - } - return $this->merchantId['value']; - } - - /** - * Sets Merchant Id. - * The unique identifier of the merchant that took the payment. - * - * @maps merchant_id - */ - public function setMerchantId(?string $merchantId): void - { - $this->merchantId['value'] = $merchantId; - } - - /** - * Unsets Merchant Id. - * The unique identifier of the merchant that took the payment. - */ - public function unsetMerchantId(): void - { - $this->merchantId = []; - } - - /** - * Returns Created At. - * The time when the payment was created, in ISO 8601 format. Reflects the time of the first payment if - * the object represents an incomplete partial payment, and the time of the last or complete payment - * otherwise. - */ - public function getCreatedAt(): ?string - { - return $this->createdAt; - } - - /** - * Sets Created At. - * The time when the payment was created, in ISO 8601 format. Reflects the time of the first payment if - * the object represents an incomplete partial payment, and the time of the last or complete payment - * otherwise. - * - * @maps created_at - */ - public function setCreatedAt(?string $createdAt): void - { - $this->createdAt = $createdAt; - } - - /** - * Returns Creator Id. - * The unique identifier of the Square account that took the payment. - */ - public function getCreatorId(): ?string - { - if (count($this->creatorId) == 0) { - return null; - } - return $this->creatorId['value']; - } - - /** - * Sets Creator Id. - * The unique identifier of the Square account that took the payment. - * - * @maps creator_id - */ - public function setCreatorId(?string $creatorId): void - { - $this->creatorId['value'] = $creatorId; - } - - /** - * Unsets Creator Id. - * The unique identifier of the Square account that took the payment. - */ - public function unsetCreatorId(): void - { - $this->creatorId = []; - } - - /** - * Returns Device. - */ - public function getDevice(): ?V1Device - { - return $this->device; - } - - /** - * Sets Device. - * - * @maps device - */ - public function setDevice(?V1Device $device): void - { - $this->device = $device; - } - - /** - * Returns Payment Url. - * The URL of the payment's detail page in the merchant dashboard. The merchant must be signed in to - * the merchant dashboard to view this page. - */ - public function getPaymentUrl(): ?string - { - if (count($this->paymentUrl) == 0) { - return null; - } - return $this->paymentUrl['value']; - } - - /** - * Sets Payment Url. - * The URL of the payment's detail page in the merchant dashboard. The merchant must be signed in to - * the merchant dashboard to view this page. - * - * @maps payment_url - */ - public function setPaymentUrl(?string $paymentUrl): void - { - $this->paymentUrl['value'] = $paymentUrl; - } - - /** - * Unsets Payment Url. - * The URL of the payment's detail page in the merchant dashboard. The merchant must be signed in to - * the merchant dashboard to view this page. - */ - public function unsetPaymentUrl(): void - { - $this->paymentUrl = []; - } - - /** - * Returns Receipt Url. - * The URL of the receipt for the payment. Note that for split tender - * payments, this URL corresponds to the receipt for the first tender - * listed in the payment's tender field. Each Tender object has its own - * receipt_url field you can use to get the other receipts associated with - * a split tender payment. - */ - public function getReceiptUrl(): ?string - { - if (count($this->receiptUrl) == 0) { - return null; - } - return $this->receiptUrl['value']; - } - - /** - * Sets Receipt Url. - * The URL of the receipt for the payment. Note that for split tender - * payments, this URL corresponds to the receipt for the first tender - * listed in the payment's tender field. Each Tender object has its own - * receipt_url field you can use to get the other receipts associated with - * a split tender payment. - * - * @maps receipt_url - */ - public function setReceiptUrl(?string $receiptUrl): void - { - $this->receiptUrl['value'] = $receiptUrl; - } - - /** - * Unsets Receipt Url. - * The URL of the receipt for the payment. Note that for split tender - * payments, this URL corresponds to the receipt for the first tender - * listed in the payment's tender field. Each Tender object has its own - * receipt_url field you can use to get the other receipts associated with - * a split tender payment. - */ - public function unsetReceiptUrl(): void - { - $this->receiptUrl = []; - } - - /** - * Returns Inclusive Tax Money. - */ - public function getInclusiveTaxMoney(): ?V1Money - { - return $this->inclusiveTaxMoney; - } - - /** - * Sets Inclusive Tax Money. - * - * @maps inclusive_tax_money - */ - public function setInclusiveTaxMoney(?V1Money $inclusiveTaxMoney): void - { - $this->inclusiveTaxMoney = $inclusiveTaxMoney; - } - - /** - * Returns Additive Tax Money. - */ - public function getAdditiveTaxMoney(): ?V1Money - { - return $this->additiveTaxMoney; - } - - /** - * Sets Additive Tax Money. - * - * @maps additive_tax_money - */ - public function setAdditiveTaxMoney(?V1Money $additiveTaxMoney): void - { - $this->additiveTaxMoney = $additiveTaxMoney; - } - - /** - * Returns Tax Money. - */ - public function getTaxMoney(): ?V1Money - { - return $this->taxMoney; - } - - /** - * Sets Tax Money. - * - * @maps tax_money - */ - public function setTaxMoney(?V1Money $taxMoney): void - { - $this->taxMoney = $taxMoney; - } - - /** - * Returns Tip Money. - */ - public function getTipMoney(): ?V1Money - { - return $this->tipMoney; - } - - /** - * Sets Tip Money. - * - * @maps tip_money - */ - public function setTipMoney(?V1Money $tipMoney): void - { - $this->tipMoney = $tipMoney; - } - - /** - * Returns Discount Money. - */ - public function getDiscountMoney(): ?V1Money - { - return $this->discountMoney; - } - - /** - * Sets Discount Money. - * - * @maps discount_money - */ - public function setDiscountMoney(?V1Money $discountMoney): void - { - $this->discountMoney = $discountMoney; - } - - /** - * Returns Total Collected Money. - */ - public function getTotalCollectedMoney(): ?V1Money - { - return $this->totalCollectedMoney; - } - - /** - * Sets Total Collected Money. - * - * @maps total_collected_money - */ - public function setTotalCollectedMoney(?V1Money $totalCollectedMoney): void - { - $this->totalCollectedMoney = $totalCollectedMoney; - } - - /** - * Returns Processing Fee Money. - */ - public function getProcessingFeeMoney(): ?V1Money - { - return $this->processingFeeMoney; - } - - /** - * Sets Processing Fee Money. - * - * @maps processing_fee_money - */ - public function setProcessingFeeMoney(?V1Money $processingFeeMoney): void - { - $this->processingFeeMoney = $processingFeeMoney; - } - - /** - * Returns Net Total Money. - */ - public function getNetTotalMoney(): ?V1Money - { - return $this->netTotalMoney; - } - - /** - * Sets Net Total Money. - * - * @maps net_total_money - */ - public function setNetTotalMoney(?V1Money $netTotalMoney): void - { - $this->netTotalMoney = $netTotalMoney; - } - - /** - * Returns Refunded Money. - */ - public function getRefundedMoney(): ?V1Money - { - return $this->refundedMoney; - } - - /** - * Sets Refunded Money. - * - * @maps refunded_money - */ - public function setRefundedMoney(?V1Money $refundedMoney): void - { - $this->refundedMoney = $refundedMoney; - } - - /** - * Returns Swedish Rounding Money. - */ - public function getSwedishRoundingMoney(): ?V1Money - { - return $this->swedishRoundingMoney; - } - - /** - * Sets Swedish Rounding Money. - * - * @maps swedish_rounding_money - */ - public function setSwedishRoundingMoney(?V1Money $swedishRoundingMoney): void - { - $this->swedishRoundingMoney = $swedishRoundingMoney; - } - - /** - * Returns Gross Sales Money. - */ - public function getGrossSalesMoney(): ?V1Money - { - return $this->grossSalesMoney; - } - - /** - * Sets Gross Sales Money. - * - * @maps gross_sales_money - */ - public function setGrossSalesMoney(?V1Money $grossSalesMoney): void - { - $this->grossSalesMoney = $grossSalesMoney; - } - - /** - * Returns Net Sales Money. - */ - public function getNetSalesMoney(): ?V1Money - { - return $this->netSalesMoney; - } - - /** - * Sets Net Sales Money. - * - * @maps net_sales_money - */ - public function setNetSalesMoney(?V1Money $netSalesMoney): void - { - $this->netSalesMoney = $netSalesMoney; - } - - /** - * Returns Inclusive Tax. - * All of the inclusive taxes associated with the payment. - * - * @return V1PaymentTax[]|null - */ - public function getInclusiveTax(): ?array - { - if (count($this->inclusiveTax) == 0) { - return null; - } - return $this->inclusiveTax['value']; - } - - /** - * Sets Inclusive Tax. - * All of the inclusive taxes associated with the payment. - * - * @maps inclusive_tax - * - * @param V1PaymentTax[]|null $inclusiveTax - */ - public function setInclusiveTax(?array $inclusiveTax): void - { - $this->inclusiveTax['value'] = $inclusiveTax; - } - - /** - * Unsets Inclusive Tax. - * All of the inclusive taxes associated with the payment. - */ - public function unsetInclusiveTax(): void - { - $this->inclusiveTax = []; - } - - /** - * Returns Additive Tax. - * All of the additive taxes associated with the payment. - * - * @return V1PaymentTax[]|null - */ - public function getAdditiveTax(): ?array - { - if (count($this->additiveTax) == 0) { - return null; - } - return $this->additiveTax['value']; - } - - /** - * Sets Additive Tax. - * All of the additive taxes associated with the payment. - * - * @maps additive_tax - * - * @param V1PaymentTax[]|null $additiveTax - */ - public function setAdditiveTax(?array $additiveTax): void - { - $this->additiveTax['value'] = $additiveTax; - } - - /** - * Unsets Additive Tax. - * All of the additive taxes associated with the payment. - */ - public function unsetAdditiveTax(): void - { - $this->additiveTax = []; - } - - /** - * Returns Tender. - * All of the tenders associated with the payment. - * - * @return V1Tender[]|null - */ - public function getTender(): ?array - { - if (count($this->tender) == 0) { - return null; - } - return $this->tender['value']; - } - - /** - * Sets Tender. - * All of the tenders associated with the payment. - * - * @maps tender - * - * @param V1Tender[]|null $tender - */ - public function setTender(?array $tender): void - { - $this->tender['value'] = $tender; - } - - /** - * Unsets Tender. - * All of the tenders associated with the payment. - */ - public function unsetTender(): void - { - $this->tender = []; - } - - /** - * Returns Refunds. - * All of the refunds applied to the payment. Note that the value of all refunds on a payment can - * exceed the value of all tenders if a merchant chooses to refund money to a tender after previously - * accepting returned goods as part of an exchange. - * - * @return V1Refund[]|null - */ - public function getRefunds(): ?array - { - if (count($this->refunds) == 0) { - return null; - } - return $this->refunds['value']; - } - - /** - * Sets Refunds. - * All of the refunds applied to the payment. Note that the value of all refunds on a payment can - * exceed the value of all tenders if a merchant chooses to refund money to a tender after previously - * accepting returned goods as part of an exchange. - * - * @maps refunds - * - * @param V1Refund[]|null $refunds - */ - public function setRefunds(?array $refunds): void - { - $this->refunds['value'] = $refunds; - } - - /** - * Unsets Refunds. - * All of the refunds applied to the payment. Note that the value of all refunds on a payment can - * exceed the value of all tenders if a merchant chooses to refund money to a tender after previously - * accepting returned goods as part of an exchange. - */ - public function unsetRefunds(): void - { - $this->refunds = []; - } - - /** - * Returns Itemizations. - * The items purchased in the payment. - * - * @return V1PaymentItemization[]|null - */ - public function getItemizations(): ?array - { - if (count($this->itemizations) == 0) { - return null; - } - return $this->itemizations['value']; - } - - /** - * Sets Itemizations. - * The items purchased in the payment. - * - * @maps itemizations - * - * @param V1PaymentItemization[]|null $itemizations - */ - public function setItemizations(?array $itemizations): void - { - $this->itemizations['value'] = $itemizations; - } - - /** - * Unsets Itemizations. - * The items purchased in the payment. - */ - public function unsetItemizations(): void - { - $this->itemizations = []; - } - - /** - * Returns Surcharge Money. - */ - public function getSurchargeMoney(): ?V1Money - { - return $this->surchargeMoney; - } - - /** - * Sets Surcharge Money. - * - * @maps surcharge_money - */ - public function setSurchargeMoney(?V1Money $surchargeMoney): void - { - $this->surchargeMoney = $surchargeMoney; - } - - /** - * Returns Surcharges. - * A list of all surcharges associated with the payment. - * - * @return V1PaymentSurcharge[]|null - */ - public function getSurcharges(): ?array - { - if (count($this->surcharges) == 0) { - return null; - } - return $this->surcharges['value']; - } - - /** - * Sets Surcharges. - * A list of all surcharges associated with the payment. - * - * @maps surcharges - * - * @param V1PaymentSurcharge[]|null $surcharges - */ - public function setSurcharges(?array $surcharges): void - { - $this->surcharges['value'] = $surcharges; - } - - /** - * Unsets Surcharges. - * A list of all surcharges associated with the payment. - */ - public function unsetSurcharges(): void - { - $this->surcharges = []; - } - - /** - * Returns Is Partial. - * Indicates whether or not the payment is only partially paid for. - * If true, this payment will have the tenders collected so far, but the - * itemizations will be empty until the payment is completed. - */ - public function getIsPartial(): ?bool - { - if (count($this->isPartial) == 0) { - return null; - } - return $this->isPartial['value']; - } - - /** - * Sets Is Partial. - * Indicates whether or not the payment is only partially paid for. - * If true, this payment will have the tenders collected so far, but the - * itemizations will be empty until the payment is completed. - * - * @maps is_partial - */ - public function setIsPartial(?bool $isPartial): void - { - $this->isPartial['value'] = $isPartial; - } - - /** - * Unsets Is Partial. - * Indicates whether or not the payment is only partially paid for. - * If true, this payment will have the tenders collected so far, but the - * itemizations will be empty until the payment is completed. - */ - public function unsetIsPartial(): void - { - $this->isPartial = []; - } - - /** - * 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->id)) { - $json['id'] = $this->id; - } - if (!empty($this->merchantId)) { - $json['merchant_id'] = $this->merchantId['value']; - } - if (isset($this->createdAt)) { - $json['created_at'] = $this->createdAt; - } - if (!empty($this->creatorId)) { - $json['creator_id'] = $this->creatorId['value']; - } - if (isset($this->device)) { - $json['device'] = $this->device; - } - if (!empty($this->paymentUrl)) { - $json['payment_url'] = $this->paymentUrl['value']; - } - if (!empty($this->receiptUrl)) { - $json['receipt_url'] = $this->receiptUrl['value']; - } - if (isset($this->inclusiveTaxMoney)) { - $json['inclusive_tax_money'] = $this->inclusiveTaxMoney; - } - if (isset($this->additiveTaxMoney)) { - $json['additive_tax_money'] = $this->additiveTaxMoney; - } - if (isset($this->taxMoney)) { - $json['tax_money'] = $this->taxMoney; - } - if (isset($this->tipMoney)) { - $json['tip_money'] = $this->tipMoney; - } - if (isset($this->discountMoney)) { - $json['discount_money'] = $this->discountMoney; - } - if (isset($this->totalCollectedMoney)) { - $json['total_collected_money'] = $this->totalCollectedMoney; - } - if (isset($this->processingFeeMoney)) { - $json['processing_fee_money'] = $this->processingFeeMoney; - } - if (isset($this->netTotalMoney)) { - $json['net_total_money'] = $this->netTotalMoney; - } - if (isset($this->refundedMoney)) { - $json['refunded_money'] = $this->refundedMoney; - } - if (isset($this->swedishRoundingMoney)) { - $json['swedish_rounding_money'] = $this->swedishRoundingMoney; - } - if (isset($this->grossSalesMoney)) { - $json['gross_sales_money'] = $this->grossSalesMoney; - } - if (isset($this->netSalesMoney)) { - $json['net_sales_money'] = $this->netSalesMoney; - } - if (!empty($this->inclusiveTax)) { - $json['inclusive_tax'] = $this->inclusiveTax['value']; - } - if (!empty($this->additiveTax)) { - $json['additive_tax'] = $this->additiveTax['value']; - } - if (!empty($this->tender)) { - $json['tender'] = $this->tender['value']; - } - if (!empty($this->refunds)) { - $json['refunds'] = $this->refunds['value']; - } - if (!empty($this->itemizations)) { - $json['itemizations'] = $this->itemizations['value']; - } - if (isset($this->surchargeMoney)) { - $json['surcharge_money'] = $this->surchargeMoney; - } - if (!empty($this->surcharges)) { - $json['surcharges'] = $this->surcharges['value']; - } - if (!empty($this->isPartial)) { - $json['is_partial'] = $this->isPartial['value']; - } - $json = array_filter($json, function ($val) { - return $val !== null; - }); - - return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; - } -} diff --git a/src/Models/V1PaymentDiscount.php b/src/Models/V1PaymentDiscount.php deleted file mode 100644 index 12b6d92d..00000000 --- a/src/Models/V1PaymentDiscount.php +++ /dev/null @@ -1,141 +0,0 @@ -name) == 0) { - return null; - } - return $this->name['value']; - } - - /** - * Sets Name. - * The discount's name. - * - * @maps name - */ - public function setName(?string $name): void - { - $this->name['value'] = $name; - } - - /** - * Unsets Name. - * The discount's name. - */ - public function unsetName(): void - { - $this->name = []; - } - - /** - * Returns Applied Money. - */ - public function getAppliedMoney(): ?V1Money - { - return $this->appliedMoney; - } - - /** - * Sets Applied Money. - * - * @maps applied_money - */ - public function setAppliedMoney(?V1Money $appliedMoney): void - { - $this->appliedMoney = $appliedMoney; - } - - /** - * Returns Discount Id. - * The ID of the applied discount, if available. Discounts applied in older versions of Square Register - * might not have an ID. - */ - public function getDiscountId(): ?string - { - if (count($this->discountId) == 0) { - return null; - } - return $this->discountId['value']; - } - - /** - * Sets Discount Id. - * The ID of the applied discount, if available. Discounts applied in older versions of Square Register - * might not have an ID. - * - * @maps discount_id - */ - public function setDiscountId(?string $discountId): void - { - $this->discountId['value'] = $discountId; - } - - /** - * Unsets Discount Id. - * The ID of the applied discount, if available. Discounts applied in older versions of Square Register - * might not have an ID. - */ - public function unsetDiscountId(): void - { - $this->discountId = []; - } - - /** - * Encode this object to JSON - * - * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields - * are set. (default: false) - * - * @return array|stdClass - */ - #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) - public function jsonSerialize(bool $asArrayWhenEmpty = false) - { - $json = []; - if (!empty($this->name)) { - $json['name'] = $this->name['value']; - } - if (isset($this->appliedMoney)) { - $json['applied_money'] = $this->appliedMoney; - } - if (!empty($this->discountId)) { - $json['discount_id'] = $this->discountId['value']; - } - $json = array_filter($json, function ($val) { - return $val !== null; - }); - - return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; - } -} diff --git a/src/Models/V1PaymentItemDetail.php b/src/Models/V1PaymentItemDetail.php deleted file mode 100644 index 543340e3..00000000 --- a/src/Models/V1PaymentItemDetail.php +++ /dev/null @@ -1,192 +0,0 @@ -categoryName) == 0) { - return null; - } - return $this->categoryName['value']; - } - - /** - * Sets Category Name. - * The name of the item's merchant-defined category, if any. - * - * @maps category_name - */ - public function setCategoryName(?string $categoryName): void - { - $this->categoryName['value'] = $categoryName; - } - - /** - * Unsets Category Name. - * The name of the item's merchant-defined category, if any. - */ - public function unsetCategoryName(): void - { - $this->categoryName = []; - } - - /** - * Returns Sku. - * The item's merchant-defined SKU, if any. - */ - public function getSku(): ?string - { - if (count($this->sku) == 0) { - return null; - } - return $this->sku['value']; - } - - /** - * Sets Sku. - * The item's merchant-defined SKU, if any. - * - * @maps sku - */ - public function setSku(?string $sku): void - { - $this->sku['value'] = $sku; - } - - /** - * Unsets Sku. - * The item's merchant-defined SKU, if any. - */ - public function unsetSku(): void - { - $this->sku = []; - } - - /** - * Returns Item Id. - * The unique ID of the item purchased, if any. - */ - public function getItemId(): ?string - { - if (count($this->itemId) == 0) { - return null; - } - return $this->itemId['value']; - } - - /** - * Sets Item Id. - * The unique ID of the item purchased, if any. - * - * @maps item_id - */ - public function setItemId(?string $itemId): void - { - $this->itemId['value'] = $itemId; - } - - /** - * Unsets Item Id. - * The unique ID of the item purchased, if any. - */ - public function unsetItemId(): void - { - $this->itemId = []; - } - - /** - * Returns Item Variation Id. - * The unique ID of the item variation purchased, if any. - */ - public function getItemVariationId(): ?string - { - if (count($this->itemVariationId) == 0) { - return null; - } - return $this->itemVariationId['value']; - } - - /** - * Sets Item Variation Id. - * The unique ID of the item variation purchased, if any. - * - * @maps item_variation_id - */ - public function setItemVariationId(?string $itemVariationId): void - { - $this->itemVariationId['value'] = $itemVariationId; - } - - /** - * Unsets Item Variation Id. - * The unique ID of the item variation purchased, if any. - */ - public function unsetItemVariationId(): void - { - $this->itemVariationId = []; - } - - /** - * 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->categoryName)) { - $json['category_name'] = $this->categoryName['value']; - } - if (!empty($this->sku)) { - $json['sku'] = $this->sku['value']; - } - if (!empty($this->itemId)) { - $json['item_id'] = $this->itemId['value']; - } - if (!empty($this->itemVariationId)) { - $json['item_variation_id'] = $this->itemVariationId['value']; - } - $json = array_filter($json, function ($val) { - return $val !== null; - }); - - return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; - } -} diff --git a/src/Models/V1PaymentItemization.php b/src/Models/V1PaymentItemization.php deleted file mode 100644 index bf62516e..00000000 --- a/src/Models/V1PaymentItemization.php +++ /dev/null @@ -1,524 +0,0 @@ - - *
  • An item variation from the merchant's item library
  • - *
  • A custom monetary amount
  • - *
  • - * An action performed on a Square gift card, such as activating or - * reloading it. - *
  • - * - * - * *Note**: itemization information included in a `Payment` object reflects - * details collected **at the time of the payment**. Details such as the name or - * price of items might have changed since the payment was processed. - */ -class V1PaymentItemization implements \JsonSerializable -{ - /** - * @var array - */ - private $name = []; - - /** - * @var array - */ - private $quantity = []; - - /** - * @var string|null - */ - private $itemizationType; - - /** - * @var V1PaymentItemDetail|null - */ - private $itemDetail; - - /** - * @var array - */ - private $notes = []; - - /** - * @var array - */ - private $itemVariationName = []; - - /** - * @var V1Money|null - */ - private $totalMoney; - - /** - * @var V1Money|null - */ - private $singleQuantityMoney; - - /** - * @var V1Money|null - */ - private $grossSalesMoney; - - /** - * @var V1Money|null - */ - private $discountMoney; - - /** - * @var V1Money|null - */ - private $netSalesMoney; - - /** - * @var array - */ - private $taxes = []; - - /** - * @var array - */ - private $discounts = []; - - /** - * @var array - */ - private $modifiers = []; - - /** - * Returns Name. - * The item's name. - */ - public function getName(): ?string - { - if (count($this->name) == 0) { - return null; - } - return $this->name['value']; - } - - /** - * Sets Name. - * The item's name. - * - * @maps name - */ - public function setName(?string $name): void - { - $this->name['value'] = $name; - } - - /** - * Unsets Name. - * The item's name. - */ - public function unsetName(): void - { - $this->name = []; - } - - /** - * Returns Quantity. - * The quantity of the item purchased. This can be a decimal value. - */ - public function getQuantity(): ?float - { - if (count($this->quantity) == 0) { - return null; - } - return $this->quantity['value']; - } - - /** - * Sets Quantity. - * The quantity of the item purchased. This can be a decimal value. - * - * @maps quantity - */ - public function setQuantity(?float $quantity): void - { - $this->quantity['value'] = $quantity; - } - - /** - * Unsets Quantity. - * The quantity of the item purchased. This can be a decimal value. - */ - public function unsetQuantity(): void - { - $this->quantity = []; - } - - /** - * Returns Itemization Type. - */ - public function getItemizationType(): ?string - { - return $this->itemizationType; - } - - /** - * Sets Itemization Type. - * - * @maps itemization_type - */ - public function setItemizationType(?string $itemizationType): void - { - $this->itemizationType = $itemizationType; - } - - /** - * Returns Item Detail. - * V1PaymentItemDetail - */ - public function getItemDetail(): ?V1PaymentItemDetail - { - return $this->itemDetail; - } - - /** - * Sets Item Detail. - * V1PaymentItemDetail - * - * @maps item_detail - */ - public function setItemDetail(?V1PaymentItemDetail $itemDetail): void - { - $this->itemDetail = $itemDetail; - } - - /** - * Returns Notes. - * Notes entered by the merchant about the item at the time of payment, if any. - */ - public function getNotes(): ?string - { - if (count($this->notes) == 0) { - return null; - } - return $this->notes['value']; - } - - /** - * Sets Notes. - * Notes entered by the merchant about the item at the time of payment, if any. - * - * @maps notes - */ - public function setNotes(?string $notes): void - { - $this->notes['value'] = $notes; - } - - /** - * Unsets Notes. - * Notes entered by the merchant about the item at the time of payment, if any. - */ - public function unsetNotes(): void - { - $this->notes = []; - } - - /** - * Returns Item Variation Name. - * The name of the item variation purchased, if any. - */ - public function getItemVariationName(): ?string - { - if (count($this->itemVariationName) == 0) { - return null; - } - return $this->itemVariationName['value']; - } - - /** - * Sets Item Variation Name. - * The name of the item variation purchased, if any. - * - * @maps item_variation_name - */ - public function setItemVariationName(?string $itemVariationName): void - { - $this->itemVariationName['value'] = $itemVariationName; - } - - /** - * Unsets Item Variation Name. - * The name of the item variation purchased, if any. - */ - public function unsetItemVariationName(): void - { - $this->itemVariationName = []; - } - - /** - * Returns Total Money. - */ - public function getTotalMoney(): ?V1Money - { - return $this->totalMoney; - } - - /** - * Sets Total Money. - * - * @maps total_money - */ - public function setTotalMoney(?V1Money $totalMoney): void - { - $this->totalMoney = $totalMoney; - } - - /** - * Returns Single Quantity Money. - */ - public function getSingleQuantityMoney(): ?V1Money - { - return $this->singleQuantityMoney; - } - - /** - * Sets Single Quantity Money. - * - * @maps single_quantity_money - */ - public function setSingleQuantityMoney(?V1Money $singleQuantityMoney): void - { - $this->singleQuantityMoney = $singleQuantityMoney; - } - - /** - * Returns Gross Sales Money. - */ - public function getGrossSalesMoney(): ?V1Money - { - return $this->grossSalesMoney; - } - - /** - * Sets Gross Sales Money. - * - * @maps gross_sales_money - */ - public function setGrossSalesMoney(?V1Money $grossSalesMoney): void - { - $this->grossSalesMoney = $grossSalesMoney; - } - - /** - * Returns Discount Money. - */ - public function getDiscountMoney(): ?V1Money - { - return $this->discountMoney; - } - - /** - * Sets Discount Money. - * - * @maps discount_money - */ - public function setDiscountMoney(?V1Money $discountMoney): void - { - $this->discountMoney = $discountMoney; - } - - /** - * Returns Net Sales Money. - */ - public function getNetSalesMoney(): ?V1Money - { - return $this->netSalesMoney; - } - - /** - * Sets Net Sales Money. - * - * @maps net_sales_money - */ - public function setNetSalesMoney(?V1Money $netSalesMoney): void - { - $this->netSalesMoney = $netSalesMoney; - } - - /** - * Returns Taxes. - * All taxes applied to this itemization. - * - * @return V1PaymentTax[]|null - */ - public function getTaxes(): ?array - { - if (count($this->taxes) == 0) { - return null; - } - return $this->taxes['value']; - } - - /** - * Sets Taxes. - * All taxes applied to this itemization. - * - * @maps taxes - * - * @param V1PaymentTax[]|null $taxes - */ - public function setTaxes(?array $taxes): void - { - $this->taxes['value'] = $taxes; - } - - /** - * Unsets Taxes. - * All taxes applied to this itemization. - */ - public function unsetTaxes(): void - { - $this->taxes = []; - } - - /** - * Returns Discounts. - * All discounts applied to this itemization. - * - * @return V1PaymentDiscount[]|null - */ - public function getDiscounts(): ?array - { - if (count($this->discounts) == 0) { - return null; - } - return $this->discounts['value']; - } - - /** - * Sets Discounts. - * All discounts applied to this itemization. - * - * @maps discounts - * - * @param V1PaymentDiscount[]|null $discounts - */ - public function setDiscounts(?array $discounts): void - { - $this->discounts['value'] = $discounts; - } - - /** - * Unsets Discounts. - * All discounts applied to this itemization. - */ - public function unsetDiscounts(): void - { - $this->discounts = []; - } - - /** - * Returns Modifiers. - * All modifier options applied to this itemization. - * - * @return V1PaymentModifier[]|null - */ - public function getModifiers(): ?array - { - if (count($this->modifiers) == 0) { - return null; - } - return $this->modifiers['value']; - } - - /** - * Sets Modifiers. - * All modifier options applied to this itemization. - * - * @maps modifiers - * - * @param V1PaymentModifier[]|null $modifiers - */ - public function setModifiers(?array $modifiers): void - { - $this->modifiers['value'] = $modifiers; - } - - /** - * Unsets Modifiers. - * All modifier options applied to this itemization. - */ - public function unsetModifiers(): void - { - $this->modifiers = []; - } - - /** - * Encode this object to JSON - * - * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields - * are set. (default: false) - * - * @return array|stdClass - */ - #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) - public function jsonSerialize(bool $asArrayWhenEmpty = false) - { - $json = []; - if (!empty($this->name)) { - $json['name'] = $this->name['value']; - } - if (!empty($this->quantity)) { - $json['quantity'] = $this->quantity['value']; - } - if (isset($this->itemizationType)) { - $json['itemization_type'] = $this->itemizationType; - } - if (isset($this->itemDetail)) { - $json['item_detail'] = $this->itemDetail; - } - if (!empty($this->notes)) { - $json['notes'] = $this->notes['value']; - } - if (!empty($this->itemVariationName)) { - $json['item_variation_name'] = $this->itemVariationName['value']; - } - if (isset($this->totalMoney)) { - $json['total_money'] = $this->totalMoney; - } - if (isset($this->singleQuantityMoney)) { - $json['single_quantity_money'] = $this->singleQuantityMoney; - } - if (isset($this->grossSalesMoney)) { - $json['gross_sales_money'] = $this->grossSalesMoney; - } - if (isset($this->discountMoney)) { - $json['discount_money'] = $this->discountMoney; - } - if (isset($this->netSalesMoney)) { - $json['net_sales_money'] = $this->netSalesMoney; - } - if (!empty($this->taxes)) { - $json['taxes'] = $this->taxes['value']; - } - if (!empty($this->discounts)) { - $json['discounts'] = $this->discounts['value']; - } - if (!empty($this->modifiers)) { - $json['modifiers'] = $this->modifiers['value']; - } - $json = array_filter($json, function ($val) { - return $val !== null; - }); - - return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; - } -} diff --git a/src/Models/V1PaymentItemizationItemizationType.php b/src/Models/V1PaymentItemizationItemizationType.php deleted file mode 100644 index 36f96b90..00000000 --- a/src/Models/V1PaymentItemizationItemizationType.php +++ /dev/null @@ -1,20 +0,0 @@ -name) == 0) { - return null; - } - return $this->name['value']; - } - - /** - * Sets Name. - * The modifier option's name. - * - * @maps name - */ - public function setName(?string $name): void - { - $this->name['value'] = $name; - } - - /** - * Unsets Name. - * The modifier option's name. - */ - public function unsetName(): void - { - $this->name = []; - } - - /** - * Returns Applied Money. - */ - public function getAppliedMoney(): ?V1Money - { - return $this->appliedMoney; - } - - /** - * Sets Applied Money. - * - * @maps applied_money - */ - public function setAppliedMoney(?V1Money $appliedMoney): void - { - $this->appliedMoney = $appliedMoney; - } - - /** - * Returns Modifier Option Id. - * The ID of the applied modifier option, if available. Modifier options applied in older versions of - * Square Register might not have an ID. - */ - public function getModifierOptionId(): ?string - { - if (count($this->modifierOptionId) == 0) { - return null; - } - return $this->modifierOptionId['value']; - } - - /** - * Sets Modifier Option Id. - * The ID of the applied modifier option, if available. Modifier options applied in older versions of - * Square Register might not have an ID. - * - * @maps modifier_option_id - */ - public function setModifierOptionId(?string $modifierOptionId): void - { - $this->modifierOptionId['value'] = $modifierOptionId; - } - - /** - * Unsets Modifier Option Id. - * The ID of the applied modifier option, if available. Modifier options applied in older versions of - * Square Register might not have an ID. - */ - public function unsetModifierOptionId(): void - { - $this->modifierOptionId = []; - } - - /** - * Encode this object to JSON - * - * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields - * are set. (default: false) - * - * @return array|stdClass - */ - #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) - public function jsonSerialize(bool $asArrayWhenEmpty = false) - { - $json = []; - if (!empty($this->name)) { - $json['name'] = $this->name['value']; - } - if (isset($this->appliedMoney)) { - $json['applied_money'] = $this->appliedMoney; - } - if (!empty($this->modifierOptionId)) { - $json['modifier_option_id'] = $this->modifierOptionId['value']; - } - $json = array_filter($json, function ($val) { - return $val !== null; - }); - - return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; - } -} diff --git a/src/Models/V1PaymentSurcharge.php b/src/Models/V1PaymentSurcharge.php deleted file mode 100644 index 26c4a5c7..00000000 --- a/src/Models/V1PaymentSurcharge.php +++ /dev/null @@ -1,320 +0,0 @@ -name) == 0) { - return null; - } - return $this->name['value']; - } - - /** - * Sets Name. - * The name of the surcharge. - * - * @maps name - */ - public function setName(?string $name): void - { - $this->name['value'] = $name; - } - - /** - * Unsets Name. - * The name of the surcharge. - */ - public function unsetName(): void - { - $this->name = []; - } - - /** - * Returns Applied Money. - */ - public function getAppliedMoney(): ?V1Money - { - return $this->appliedMoney; - } - - /** - * Sets Applied Money. - * - * @maps applied_money - */ - public function setAppliedMoney(?V1Money $appliedMoney): void - { - $this->appliedMoney = $appliedMoney; - } - - /** - * Returns Rate. - * The amount of the surcharge as a percentage. The percentage is provided as a string representing the - * decimal equivalent of the percentage. For example, "0.7" corresponds to a 7% surcharge. Exactly one - * of rate or amount_money should be set. - */ - public function getRate(): ?string - { - if (count($this->rate) == 0) { - return null; - } - return $this->rate['value']; - } - - /** - * Sets Rate. - * The amount of the surcharge as a percentage. The percentage is provided as a string representing the - * decimal equivalent of the percentage. For example, "0.7" corresponds to a 7% surcharge. Exactly one - * of rate or amount_money should be set. - * - * @maps rate - */ - public function setRate(?string $rate): void - { - $this->rate['value'] = $rate; - } - - /** - * Unsets Rate. - * The amount of the surcharge as a percentage. The percentage is provided as a string representing the - * decimal equivalent of the percentage. For example, "0.7" corresponds to a 7% surcharge. Exactly one - * of rate or amount_money should be set. - */ - public function unsetRate(): void - { - $this->rate = []; - } - - /** - * Returns Amount Money. - */ - public function getAmountMoney(): ?V1Money - { - return $this->amountMoney; - } - - /** - * Sets Amount Money. - * - * @maps amount_money - */ - public function setAmountMoney(?V1Money $amountMoney): void - { - $this->amountMoney = $amountMoney; - } - - /** - * Returns Type. - */ - public function getType(): ?string - { - return $this->type; - } - - /** - * Sets Type. - * - * @maps type - */ - public function setType(?string $type): void - { - $this->type = $type; - } - - /** - * Returns Taxable. - * Indicates whether the surcharge is taxable. - */ - public function getTaxable(): ?bool - { - if (count($this->taxable) == 0) { - return null; - } - return $this->taxable['value']; - } - - /** - * Sets Taxable. - * Indicates whether the surcharge is taxable. - * - * @maps taxable - */ - public function setTaxable(?bool $taxable): void - { - $this->taxable['value'] = $taxable; - } - - /** - * Unsets Taxable. - * Indicates whether the surcharge is taxable. - */ - public function unsetTaxable(): void - { - $this->taxable = []; - } - - /** - * Returns Taxes. - * The list of taxes that should be applied to the surcharge. - * - * @return V1PaymentTax[]|null - */ - public function getTaxes(): ?array - { - if (count($this->taxes) == 0) { - return null; - } - return $this->taxes['value']; - } - - /** - * Sets Taxes. - * The list of taxes that should be applied to the surcharge. - * - * @maps taxes - * - * @param V1PaymentTax[]|null $taxes - */ - public function setTaxes(?array $taxes): void - { - $this->taxes['value'] = $taxes; - } - - /** - * Unsets Taxes. - * The list of taxes that should be applied to the surcharge. - */ - public function unsetTaxes(): void - { - $this->taxes = []; - } - - /** - * Returns Surcharge Id. - * A Square-issued unique identifier associated with the surcharge. - */ - public function getSurchargeId(): ?string - { - if (count($this->surchargeId) == 0) { - return null; - } - return $this->surchargeId['value']; - } - - /** - * Sets Surcharge Id. - * A Square-issued unique identifier associated with the surcharge. - * - * @maps surcharge_id - */ - public function setSurchargeId(?string $surchargeId): void - { - $this->surchargeId['value'] = $surchargeId; - } - - /** - * Unsets Surcharge Id. - * A Square-issued unique identifier associated with the surcharge. - */ - public function unsetSurchargeId(): void - { - $this->surchargeId = []; - } - - /** - * Encode this object to JSON - * - * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields - * are set. (default: false) - * - * @return array|stdClass - */ - #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) - public function jsonSerialize(bool $asArrayWhenEmpty = false) - { - $json = []; - if (!empty($this->name)) { - $json['name'] = $this->name['value']; - } - if (isset($this->appliedMoney)) { - $json['applied_money'] = $this->appliedMoney; - } - if (!empty($this->rate)) { - $json['rate'] = $this->rate['value']; - } - if (isset($this->amountMoney)) { - $json['amount_money'] = $this->amountMoney; - } - if (isset($this->type)) { - $json['type'] = $this->type; - } - if (!empty($this->taxable)) { - $json['taxable'] = $this->taxable['value']; - } - if (!empty($this->taxes)) { - $json['taxes'] = $this->taxes['value']; - } - if (!empty($this->surchargeId)) { - $json['surcharge_id'] = $this->surchargeId['value']; - } - $json = array_filter($json, function ($val) { - return $val !== null; - }); - - return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; - } -} diff --git a/src/Models/V1PaymentSurchargeType.php b/src/Models/V1PaymentSurchargeType.php deleted file mode 100644 index 08e790cc..00000000 --- a/src/Models/V1PaymentSurchargeType.php +++ /dev/null @@ -1,14 +0,0 @@ -errors) == 0) { - return null; - } - return $this->errors['value']; - } - - /** - * Sets Errors. - * Any errors that occurred during the request. - * - * @maps errors - * - * @param Error[]|null $errors - */ - public function setErrors(?array $errors): void - { - $this->errors['value'] = $errors; - } - - /** - * Unsets Errors. - * Any errors that occurred during the request. - */ - public function unsetErrors(): void - { - $this->errors = []; - } - - /** - * Returns Name. - * The merchant-defined name of the tax. - */ - public function getName(): ?string - { - if (count($this->name) == 0) { - return null; - } - return $this->name['value']; - } - - /** - * Sets Name. - * The merchant-defined name of the tax. - * - * @maps name - */ - public function setName(?string $name): void - { - $this->name['value'] = $name; - } - - /** - * Unsets Name. - * The merchant-defined name of the tax. - */ - public function unsetName(): void - { - $this->name = []; - } - - /** - * Returns Applied Money. - */ - public function getAppliedMoney(): ?V1Money - { - return $this->appliedMoney; - } - - /** - * Sets Applied Money. - * - * @maps applied_money - */ - public function setAppliedMoney(?V1Money $appliedMoney): void - { - $this->appliedMoney = $appliedMoney; - } - - /** - * Returns Rate. - * The rate of the tax, as a string representation of a decimal number. A value of 0.07 corresponds to - * a rate of 7%. - */ - public function getRate(): ?string - { - if (count($this->rate) == 0) { - return null; - } - return $this->rate['value']; - } - - /** - * Sets Rate. - * The rate of the tax, as a string representation of a decimal number. A value of 0.07 corresponds to - * a rate of 7%. - * - * @maps rate - */ - public function setRate(?string $rate): void - { - $this->rate['value'] = $rate; - } - - /** - * Unsets Rate. - * The rate of the tax, as a string representation of a decimal number. A value of 0.07 corresponds to - * a rate of 7%. - */ - public function unsetRate(): void - { - $this->rate = []; - } - - /** - * Returns Inclusion Type. - */ - public function getInclusionType(): ?string - { - return $this->inclusionType; - } - - /** - * Sets Inclusion Type. - * - * @maps inclusion_type - */ - public function setInclusionType(?string $inclusionType): void - { - $this->inclusionType = $inclusionType; - } - - /** - * Returns Fee Id. - * The ID of the tax, if available. Taxes applied in older versions of Square Register might not have - * an ID. - */ - public function getFeeId(): ?string - { - if (count($this->feeId) == 0) { - return null; - } - return $this->feeId['value']; - } - - /** - * Sets Fee Id. - * The ID of the tax, if available. Taxes applied in older versions of Square Register might not have - * an ID. - * - * @maps fee_id - */ - public function setFeeId(?string $feeId): void - { - $this->feeId['value'] = $feeId; - } - - /** - * Unsets Fee Id. - * The ID of the tax, if available. Taxes applied in older versions of Square Register might not have - * an ID. - */ - public function unsetFeeId(): void - { - $this->feeId = []; - } - - /** - * 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->errors)) { - $json['errors'] = $this->errors['value']; - } - if (!empty($this->name)) { - $json['name'] = $this->name['value']; - } - if (isset($this->appliedMoney)) { - $json['applied_money'] = $this->appliedMoney; - } - if (!empty($this->rate)) { - $json['rate'] = $this->rate['value']; - } - if (isset($this->inclusionType)) { - $json['inclusion_type'] = $this->inclusionType; - } - if (!empty($this->feeId)) { - $json['fee_id'] = $this->feeId['value']; - } - $json = array_filter($json, function ($val) { - return $val !== null; - }); - - return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; - } -} diff --git a/src/Models/V1PaymentTaxInclusionType.php b/src/Models/V1PaymentTaxInclusionType.php deleted file mode 100644 index 47d7108f..00000000 --- a/src/Models/V1PaymentTaxInclusionType.php +++ /dev/null @@ -1,12 +0,0 @@ -type; - } - - /** - * Sets Type. - * - * @maps type - */ - public function setType(?string $type): void - { - $this->type = $type; - } - - /** - * Returns Reason. - * The merchant-specified reason for the refund. - */ - public function getReason(): ?string - { - if (count($this->reason) == 0) { - return null; - } - return $this->reason['value']; - } - - /** - * Sets Reason. - * The merchant-specified reason for the refund. - * - * @maps reason - */ - public function setReason(?string $reason): void - { - $this->reason['value'] = $reason; - } - - /** - * Unsets Reason. - * The merchant-specified reason for the refund. - */ - public function unsetReason(): void - { - $this->reason = []; - } - - /** - * Returns Refunded Money. - */ - public function getRefundedMoney(): ?V1Money - { - return $this->refundedMoney; - } - - /** - * Sets Refunded Money. - * - * @maps refunded_money - */ - public function setRefundedMoney(?V1Money $refundedMoney): void - { - $this->refundedMoney = $refundedMoney; - } - - /** - * Returns Refunded Processing Fee Money. - */ - public function getRefundedProcessingFeeMoney(): ?V1Money - { - return $this->refundedProcessingFeeMoney; - } - - /** - * Sets Refunded Processing Fee Money. - * - * @maps refunded_processing_fee_money - */ - public function setRefundedProcessingFeeMoney(?V1Money $refundedProcessingFeeMoney): void - { - $this->refundedProcessingFeeMoney = $refundedProcessingFeeMoney; - } - - /** - * Returns Refunded Tax Money. - */ - public function getRefundedTaxMoney(): ?V1Money - { - return $this->refundedTaxMoney; - } - - /** - * Sets Refunded Tax Money. - * - * @maps refunded_tax_money - */ - public function setRefundedTaxMoney(?V1Money $refundedTaxMoney): void - { - $this->refundedTaxMoney = $refundedTaxMoney; - } - - /** - * Returns Refunded Additive Tax Money. - */ - public function getRefundedAdditiveTaxMoney(): ?V1Money - { - return $this->refundedAdditiveTaxMoney; - } - - /** - * Sets Refunded Additive Tax Money. - * - * @maps refunded_additive_tax_money - */ - public function setRefundedAdditiveTaxMoney(?V1Money $refundedAdditiveTaxMoney): void - { - $this->refundedAdditiveTaxMoney = $refundedAdditiveTaxMoney; - } - - /** - * Returns Refunded Additive Tax. - * All of the additive taxes associated with the refund. - * - * @return V1PaymentTax[]|null - */ - public function getRefundedAdditiveTax(): ?array - { - if (count($this->refundedAdditiveTax) == 0) { - return null; - } - return $this->refundedAdditiveTax['value']; - } - - /** - * Sets Refunded Additive Tax. - * All of the additive taxes associated with the refund. - * - * @maps refunded_additive_tax - * - * @param V1PaymentTax[]|null $refundedAdditiveTax - */ - public function setRefundedAdditiveTax(?array $refundedAdditiveTax): void - { - $this->refundedAdditiveTax['value'] = $refundedAdditiveTax; - } - - /** - * Unsets Refunded Additive Tax. - * All of the additive taxes associated with the refund. - */ - public function unsetRefundedAdditiveTax(): void - { - $this->refundedAdditiveTax = []; - } - - /** - * Returns Refunded Inclusive Tax Money. - */ - public function getRefundedInclusiveTaxMoney(): ?V1Money - { - return $this->refundedInclusiveTaxMoney; - } - - /** - * Sets Refunded Inclusive Tax Money. - * - * @maps refunded_inclusive_tax_money - */ - public function setRefundedInclusiveTaxMoney(?V1Money $refundedInclusiveTaxMoney): void - { - $this->refundedInclusiveTaxMoney = $refundedInclusiveTaxMoney; - } - - /** - * Returns Refunded Inclusive Tax. - * All of the inclusive taxes associated with the refund. - * - * @return V1PaymentTax[]|null - */ - public function getRefundedInclusiveTax(): ?array - { - if (count($this->refundedInclusiveTax) == 0) { - return null; - } - return $this->refundedInclusiveTax['value']; - } - - /** - * Sets Refunded Inclusive Tax. - * All of the inclusive taxes associated with the refund. - * - * @maps refunded_inclusive_tax - * - * @param V1PaymentTax[]|null $refundedInclusiveTax - */ - public function setRefundedInclusiveTax(?array $refundedInclusiveTax): void - { - $this->refundedInclusiveTax['value'] = $refundedInclusiveTax; - } - - /** - * Unsets Refunded Inclusive Tax. - * All of the inclusive taxes associated with the refund. - */ - public function unsetRefundedInclusiveTax(): void - { - $this->refundedInclusiveTax = []; - } - - /** - * Returns Refunded Tip Money. - */ - public function getRefundedTipMoney(): ?V1Money - { - return $this->refundedTipMoney; - } - - /** - * Sets Refunded Tip Money. - * - * @maps refunded_tip_money - */ - public function setRefundedTipMoney(?V1Money $refundedTipMoney): void - { - $this->refundedTipMoney = $refundedTipMoney; - } - - /** - * Returns Refunded Discount Money. - */ - public function getRefundedDiscountMoney(): ?V1Money - { - return $this->refundedDiscountMoney; - } - - /** - * Sets Refunded Discount Money. - * - * @maps refunded_discount_money - */ - public function setRefundedDiscountMoney(?V1Money $refundedDiscountMoney): void - { - $this->refundedDiscountMoney = $refundedDiscountMoney; - } - - /** - * Returns Refunded Surcharge Money. - */ - public function getRefundedSurchargeMoney(): ?V1Money - { - return $this->refundedSurchargeMoney; - } - - /** - * Sets Refunded Surcharge Money. - * - * @maps refunded_surcharge_money - */ - public function setRefundedSurchargeMoney(?V1Money $refundedSurchargeMoney): void - { - $this->refundedSurchargeMoney = $refundedSurchargeMoney; - } - - /** - * Returns Refunded Surcharges. - * A list of all surcharges associated with the refund. - * - * @return V1PaymentSurcharge[]|null - */ - public function getRefundedSurcharges(): ?array - { - if (count($this->refundedSurcharges) == 0) { - return null; - } - return $this->refundedSurcharges['value']; - } - - /** - * Sets Refunded Surcharges. - * A list of all surcharges associated with the refund. - * - * @maps refunded_surcharges - * - * @param V1PaymentSurcharge[]|null $refundedSurcharges - */ - public function setRefundedSurcharges(?array $refundedSurcharges): void - { - $this->refundedSurcharges['value'] = $refundedSurcharges; - } - - /** - * Unsets Refunded Surcharges. - * A list of all surcharges associated with the refund. - */ - public function unsetRefundedSurcharges(): void - { - $this->refundedSurcharges = []; - } - - /** - * Returns Created At. - * The time when the merchant initiated the refund for Square to process, in ISO 8601 format. - */ - public function getCreatedAt(): ?string - { - return $this->createdAt; - } - - /** - * Sets Created At. - * The time when the merchant initiated the refund for Square to process, in ISO 8601 format. - * - * @maps created_at - */ - public function setCreatedAt(?string $createdAt): void - { - $this->createdAt = $createdAt; - } - - /** - * Returns Processed At. - * The time when Square processed the refund on behalf of the merchant, in ISO 8601 format. - */ - public function getProcessedAt(): ?string - { - if (count($this->processedAt) == 0) { - return null; - } - return $this->processedAt['value']; - } - - /** - * Sets Processed At. - * The time when Square processed the refund on behalf of the merchant, in ISO 8601 format. - * - * @maps processed_at - */ - public function setProcessedAt(?string $processedAt): void - { - $this->processedAt['value'] = $processedAt; - } - - /** - * Unsets Processed At. - * The time when Square processed the refund on behalf of the merchant, in ISO 8601 format. - */ - public function unsetProcessedAt(): void - { - $this->processedAt = []; - } - - /** - * Returns Payment Id. - * A Square-issued ID associated with the refund. For single-tender refunds, payment_id is the ID of - * the original payment ID. For split-tender refunds, payment_id is the ID of the original tender. For - * exchange-based refunds (is_exchange == true), payment_id is the ID of the original payment ID even - * if the payment includes other tenders. - */ - public function getPaymentId(): ?string - { - if (count($this->paymentId) == 0) { - return null; - } - return $this->paymentId['value']; - } - - /** - * Sets Payment Id. - * A Square-issued ID associated with the refund. For single-tender refunds, payment_id is the ID of - * the original payment ID. For split-tender refunds, payment_id is the ID of the original tender. For - * exchange-based refunds (is_exchange == true), payment_id is the ID of the original payment ID even - * if the payment includes other tenders. - * - * @maps payment_id - */ - public function setPaymentId(?string $paymentId): void - { - $this->paymentId['value'] = $paymentId; - } - - /** - * Unsets Payment Id. - * A Square-issued ID associated with the refund. For single-tender refunds, payment_id is the ID of - * the original payment ID. For split-tender refunds, payment_id is the ID of the original tender. For - * exchange-based refunds (is_exchange == true), payment_id is the ID of the original payment ID even - * if the payment includes other tenders. - */ - public function unsetPaymentId(): void - { - $this->paymentId = []; - } - - /** - * Returns Merchant Id. - */ - public function getMerchantId(): ?string - { - if (count($this->merchantId) == 0) { - return null; - } - return $this->merchantId['value']; - } - - /** - * Sets Merchant Id. - * - * @maps merchant_id - */ - public function setMerchantId(?string $merchantId): void - { - $this->merchantId['value'] = $merchantId; - } - - /** - * Unsets Merchant Id. - */ - public function unsetMerchantId(): void - { - $this->merchantId = []; - } - - /** - * Returns Is Exchange. - * Indicates whether or not the refund is associated with an exchange. If is_exchange is true, the - * refund reflects the value of goods returned in the exchange not the total money refunded. - */ - public function getIsExchange(): ?bool - { - if (count($this->isExchange) == 0) { - return null; - } - return $this->isExchange['value']; - } - - /** - * Sets Is Exchange. - * Indicates whether or not the refund is associated with an exchange. If is_exchange is true, the - * refund reflects the value of goods returned in the exchange not the total money refunded. - * - * @maps is_exchange - */ - public function setIsExchange(?bool $isExchange): void - { - $this->isExchange['value'] = $isExchange; - } - - /** - * Unsets Is Exchange. - * Indicates whether or not the refund is associated with an exchange. If is_exchange is true, the - * refund reflects the value of goods returned in the exchange not the total money refunded. - */ - public function unsetIsExchange(): void - { - $this->isExchange = []; - } - - /** - * 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->type)) { - $json['type'] = $this->type; - } - if (!empty($this->reason)) { - $json['reason'] = $this->reason['value']; - } - if (isset($this->refundedMoney)) { - $json['refunded_money'] = $this->refundedMoney; - } - if (isset($this->refundedProcessingFeeMoney)) { - $json['refunded_processing_fee_money'] = $this->refundedProcessingFeeMoney; - } - if (isset($this->refundedTaxMoney)) { - $json['refunded_tax_money'] = $this->refundedTaxMoney; - } - if (isset($this->refundedAdditiveTaxMoney)) { - $json['refunded_additive_tax_money'] = $this->refundedAdditiveTaxMoney; - } - if (!empty($this->refundedAdditiveTax)) { - $json['refunded_additive_tax'] = $this->refundedAdditiveTax['value']; - } - if (isset($this->refundedInclusiveTaxMoney)) { - $json['refunded_inclusive_tax_money'] = $this->refundedInclusiveTaxMoney; - } - if (!empty($this->refundedInclusiveTax)) { - $json['refunded_inclusive_tax'] = $this->refundedInclusiveTax['value']; - } - if (isset($this->refundedTipMoney)) { - $json['refunded_tip_money'] = $this->refundedTipMoney; - } - if (isset($this->refundedDiscountMoney)) { - $json['refunded_discount_money'] = $this->refundedDiscountMoney; - } - if (isset($this->refundedSurchargeMoney)) { - $json['refunded_surcharge_money'] = $this->refundedSurchargeMoney; - } - if (!empty($this->refundedSurcharges)) { - $json['refunded_surcharges'] = $this->refundedSurcharges['value']; - } - if (isset($this->createdAt)) { - $json['created_at'] = $this->createdAt; - } - if (!empty($this->processedAt)) { - $json['processed_at'] = $this->processedAt['value']; - } - if (!empty($this->paymentId)) { - $json['payment_id'] = $this->paymentId['value']; - } - if (!empty($this->merchantId)) { - $json['merchant_id'] = $this->merchantId['value']; - } - if (!empty($this->isExchange)) { - $json['is_exchange'] = $this->isExchange['value']; - } - $json = array_filter($json, function ($val) { - return $val !== null; - }); - - return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; - } -} diff --git a/src/Models/V1RefundType.php b/src/Models/V1RefundType.php deleted file mode 100644 index 694eed4f..00000000 --- a/src/Models/V1RefundType.php +++ /dev/null @@ -1,12 +0,0 @@ -id; - } - - /** - * Sets Id. - * The settlement's unique identifier. - * - * @maps id - */ - public function setId(?string $id): void - { - $this->id = $id; - } - - /** - * Returns Status. - */ - public function getStatus(): ?string - { - return $this->status; - } - - /** - * Sets Status. - * - * @maps status - */ - public function setStatus(?string $status): void - { - $this->status = $status; - } - - /** - * Returns Total Money. - */ - public function getTotalMoney(): ?V1Money - { - return $this->totalMoney; - } - - /** - * Sets Total Money. - * - * @maps total_money - */ - public function setTotalMoney(?V1Money $totalMoney): void - { - $this->totalMoney = $totalMoney; - } - - /** - * Returns Initiated At. - * The time when the settlement was submitted for deposit or withdrawal, in ISO 8601 format. - */ - public function getInitiatedAt(): ?string - { - if (count($this->initiatedAt) == 0) { - return null; - } - return $this->initiatedAt['value']; - } - - /** - * Sets Initiated At. - * The time when the settlement was submitted for deposit or withdrawal, in ISO 8601 format. - * - * @maps initiated_at - */ - public function setInitiatedAt(?string $initiatedAt): void - { - $this->initiatedAt['value'] = $initiatedAt; - } - - /** - * Unsets Initiated At. - * The time when the settlement was submitted for deposit or withdrawal, in ISO 8601 format. - */ - public function unsetInitiatedAt(): void - { - $this->initiatedAt = []; - } - - /** - * Returns Bank Account Id. - * The Square-issued unique identifier for the bank account associated with the settlement. - */ - public function getBankAccountId(): ?string - { - if (count($this->bankAccountId) == 0) { - return null; - } - return $this->bankAccountId['value']; - } - - /** - * Sets Bank Account Id. - * The Square-issued unique identifier for the bank account associated with the settlement. - * - * @maps bank_account_id - */ - public function setBankAccountId(?string $bankAccountId): void - { - $this->bankAccountId['value'] = $bankAccountId; - } - - /** - * Unsets Bank Account Id. - * The Square-issued unique identifier for the bank account associated with the settlement. - */ - public function unsetBankAccountId(): void - { - $this->bankAccountId = []; - } - - /** - * Returns Entries. - * The entries included in this settlement. - * - * @return V1SettlementEntry[]|null - */ - public function getEntries(): ?array - { - if (count($this->entries) == 0) { - return null; - } - return $this->entries['value']; - } - - /** - * Sets Entries. - * The entries included in this settlement. - * - * @maps entries - * - * @param V1SettlementEntry[]|null $entries - */ - public function setEntries(?array $entries): void - { - $this->entries['value'] = $entries; - } - - /** - * Unsets Entries. - * The entries included in this settlement. - */ - public function unsetEntries(): void - { - $this->entries = []; - } - - /** - * 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->id)) { - $json['id'] = $this->id; - } - if (isset($this->status)) { - $json['status'] = $this->status; - } - if (isset($this->totalMoney)) { - $json['total_money'] = $this->totalMoney; - } - if (!empty($this->initiatedAt)) { - $json['initiated_at'] = $this->initiatedAt['value']; - } - if (!empty($this->bankAccountId)) { - $json['bank_account_id'] = $this->bankAccountId['value']; - } - if (!empty($this->entries)) { - $json['entries'] = $this->entries['value']; - } - $json = array_filter($json, function ($val) { - return $val !== null; - }); - - return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; - } -} diff --git a/src/Models/V1SettlementEntry.php b/src/Models/V1SettlementEntry.php deleted file mode 100644 index 419c7025..00000000 --- a/src/Models/V1SettlementEntry.php +++ /dev/null @@ -1,150 +0,0 @@ -paymentId) == 0) { - return null; - } - return $this->paymentId['value']; - } - - /** - * Sets Payment Id. - * The settlement's unique identifier. - * - * @maps payment_id - */ - public function setPaymentId(?string $paymentId): void - { - $this->paymentId['value'] = $paymentId; - } - - /** - * Unsets Payment Id. - * The settlement's unique identifier. - */ - public function unsetPaymentId(): void - { - $this->paymentId = []; - } - - /** - * Returns Type. - */ - public function getType(): ?string - { - return $this->type; - } - - /** - * Sets Type. - * - * @maps type - */ - public function setType(?string $type): void - { - $this->type = $type; - } - - /** - * Returns Amount Money. - */ - public function getAmountMoney(): ?V1Money - { - return $this->amountMoney; - } - - /** - * Sets Amount Money. - * - * @maps amount_money - */ - public function setAmountMoney(?V1Money $amountMoney): void - { - $this->amountMoney = $amountMoney; - } - - /** - * Returns Fee Money. - */ - public function getFeeMoney(): ?V1Money - { - return $this->feeMoney; - } - - /** - * Sets Fee Money. - * - * @maps fee_money - */ - public function setFeeMoney(?V1Money $feeMoney): void - { - $this->feeMoney = $feeMoney; - } - - /** - * 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->paymentId)) { - $json['payment_id'] = $this->paymentId['value']; - } - if (isset($this->type)) { - $json['type'] = $this->type; - } - if (isset($this->amountMoney)) { - $json['amount_money'] = $this->amountMoney; - } - if (isset($this->feeMoney)) { - $json['fee_money'] = $this->feeMoney; - } - $json = array_filter($json, function ($val) { - return $val !== null; - }); - - return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; - } -} diff --git a/src/Models/V1SettlementEntryType.php b/src/Models/V1SettlementEntryType.php deleted file mode 100644 index feb3e935..00000000 --- a/src/Models/V1SettlementEntryType.php +++ /dev/null @@ -1,115 +0,0 @@ -jsonHelper(ApiHelper::getJsonHelper()) ->apiCallback($this->config['httpCallback'] ?? null) ->userAgent( - 'Square-PHP-SDK/34.0.1.20240118 ({api-version}) {engine}/{engine-version} ({os-' . + 'Square-PHP-SDK/35.0.0.20240222 ({api-version}) {engine}/{engine-version} ({os-' . 'info}) {detail}' ) ->userAgentConfig( @@ -185,7 +187,7 @@ public function __construct(array $config = []) */ public function toBuilder(): SquareClientBuilder { - return SquareClientBuilder::init() + $builder = SquareClientBuilder::init() ->timeout($this->getTimeout()) ->enableRetries($this->shouldEnableRetries()) ->numberOfRetries($this->getNumberOfRetries()) @@ -200,8 +202,13 @@ public function toBuilder(): SquareClientBuilder ->userAgentDetail($this->getUserAgentDetail()) ->environment($this->getEnvironment()) ->customUrl($this->getCustomUrl()) - ->accessToken($this->bearerAuthManager->getAccessToken()) ->httpCallback($this->config['httpCallback'] ?? null); + + $bearerAuth = $this->getBearerAuthCredentialsBuilder(); + if ($bearerAuth != null) { + $builder->bearerAuthCredentials($bearerAuth); + } + return $builder; } public function getTimeout(): int @@ -274,11 +281,19 @@ public function getCustomUrl(): string return $this->config['customUrl'] ?? ConfigurationDefaults::CUSTOM_URL; } - public function getBearerAuthCredentials(): ?BearerAuthCredentials + public function getBearerAuthCredentials(): BearerAuthCredentials { return $this->bearerAuthManager; } + public function getBearerAuthCredentialsBuilder(): ?BearerAuthCredentialsBuilder + { + if (empty($this->bearerAuthManager->getAccessToken())) { + return null; + } + return BearerAuthCredentialsBuilder::init($this->bearerAuthManager->getAccessToken()); + } + /** * Get the client configuration as an associative array * @@ -304,7 +319,7 @@ public function withConfiguration(array $config): self */ public function getSdkVersion(): string { - return '34.0.1.20240118'; + return '35.0.0.20240222'; } /** diff --git a/src/SquareClientBuilder.php b/src/SquareClientBuilder.php index 33788a1d..4e12efb2 100644 --- a/src/SquareClientBuilder.php +++ b/src/SquareClientBuilder.php @@ -6,6 +6,7 @@ use Core\Types\Sdk\CoreCallback; use Core\Utils\CoreHelper; +use Square\Authentication\BearerAuthCredentialsBuilder; class SquareClientBuilder { @@ -131,12 +132,28 @@ public function customUrl(string $customUrl): self return $this; } + /** + * @see SquareClientBuilder::bearerAuthCredentials + * + * @deprecated This builder setter is deprecated. Checkout the see also section for its + * alternate. + * + * @param string $accessToken + * + * @return $this + */ public function accessToken(string $accessToken): self { $this->config['accessToken'] = $accessToken; return $this; } + public function bearerAuthCredentials(BearerAuthCredentialsBuilder $bearerAuth): self + { + $this->config = array_merge($this->config, $bearerAuth->getConfiguration()); + return $this; + } + public function httpCallback($httpCallback): self { if (!$httpCallback instanceof CoreCallback) { diff --git a/tests/ClientFactory.php b/tests/ClientFactory.php index fe159f33..7d594cfa 100644 --- a/tests/ClientFactory.php +++ b/tests/ClientFactory.php @@ -5,25 +5,27 @@ namespace Square\Tests; use Core\Types\CallbackCatcher; +use Square\Authentication\BearerAuthCredentialsBuilder; +use Square\SquareClient; +use Square\SquareClientBuilder; class ClientFactory { - public static function create(CallbackCatcher $httpCallback): \Square\SquareClient + public static function create(CallbackCatcher $httpCallback): SquareClient { - $clientBuilder = \Square\SquareClientBuilder::init(); + $clientBuilder = SquareClientBuilder::init(); $clientBuilder = self::addConfigurationFromEnvironment($clientBuilder); $clientBuilder = self::addTestConfiguration($clientBuilder); return $clientBuilder->httpCallback($httpCallback)->build(); } - public static function addTestConfiguration(\Square\SquareClientBuilder $builder): \Square\SquareClientBuilder + public static function addTestConfiguration(SquareClientBuilder $builder): SquareClientBuilder { return $builder; } - public static function addConfigurationFromEnvironment( - \Square\SquareClientBuilder $builder - ): \Square\SquareClientBuilder { + public static function addConfigurationFromEnvironment(SquareClientBuilder $builder): SquareClientBuilder + { $timeout = getenv('SQUARE_TIMEOUT'); $numberOfRetries = getenv('SQUARE_NUMBER_OF_RETRIES'); $maximumRetryWaitTime = getenv('SQUARE_MAXIMUM_RETRY_WAIT_TIME'); @@ -33,36 +35,36 @@ public static function addConfigurationFromEnvironment( $customUrl = getenv('SQUARE_CUSTOM_URL'); $accessToken = getenv('SQUARE_ACCESS_TOKEN'); - if ($timeout !== false && \is_numeric($timeout)) { + if (!empty($timeout) && \is_numeric($timeout)) { $builder->timeout(intval($timeout)); } - if ($numberOfRetries !== false && \is_numeric($numberOfRetries)) { + if (!empty($numberOfRetries) && \is_numeric($numberOfRetries)) { $builder->numberOfRetries(intval($numberOfRetries)); } - if ($maximumRetryWaitTime !== false && \is_numeric($maximumRetryWaitTime)) { + if (!empty($maximumRetryWaitTime) && \is_numeric($maximumRetryWaitTime)) { $builder->maximumRetryWaitTime(intval($maximumRetryWaitTime)); } - if ($squareVersion !== false) { + if (!empty($squareVersion)) { $builder->squareVersion($squareVersion); } - if ($userAgentDetail !== false) { + if (!empty($userAgentDetail)) { $builder->userAgentDetail($userAgentDetail); } - if ($environment !== false) { + if (!empty($environment)) { $builder->environment($environment); } - if ($customUrl !== false) { + if (!empty($customUrl)) { $builder->customUrl($customUrl); } - if ($accessToken !== false) { - $builder->accessToken($accessToken); + if (!empty($accessToken)) { + $builder->bearerAuthCredentials(BearerAuthCredentialsBuilder::init($accessToken)); } return $builder;