From c8721b0796c84a1687667cf4848d55350bed4919 Mon Sep 17 00:00:00 2001 From: autobot Date: Tue, 19 Apr 2022 22:25:39 +0000 Subject: [PATCH] Generated PR for Release: 18.0.0.20220420 --- composer.json | 4 +- doc/apis/catalog.md | 1 + doc/apis/locations.md | 6 +- doc/apis/orders.md | 6 +- doc/apis/payouts.md | 162 ++++ doc/apis/subscriptions.md | 1 - doc/apis/terminal.md | 21 +- doc/client.md | 7 +- doc/models/activity-type.md | 46 + .../batch-retrieve-catalog-objects-request.md | 1 + doc/models/bulk-create-vendors-request.md | 4 +- doc/models/bulk-create-vendors-response.md | 4 +- doc/models/bulk-retrieve-vendors-request.md | 2 +- doc/models/bulk-retrieve-vendors-response.md | 2 +- doc/models/bulk-update-vendors-request.md | 2 +- doc/models/bulk-update-vendors-response.md | 2 +- doc/models/business-hours-period.md | 4 +- doc/models/business-hours.md | 2 +- .../cancel-terminal-checkout-response.md | 2 +- doc/models/cancel-terminal-refund-response.md | 2 +- doc/models/catalog-item-variation.md | 3 +- doc/models/catalog-modifier.md | 1 + doc/models/catalog-object.md | 2 +- doc/models/create-location-request.md | 4 +- doc/models/create-location-response.md | 6 +- .../create-terminal-checkout-request.md | 2 +- .../create-terminal-checkout-response.md | 2 +- doc/models/create-terminal-refund-request.md | 2 +- doc/models/create-terminal-refund-response.md | 2 +- doc/models/create-vendor-request.md | 2 +- doc/models/create-vendor-response.md | 8 +- doc/models/destination-type.md | 18 + doc/models/destination.md | 25 + doc/models/device-checkout-options.md | 2 + doc/models/error-code.md | 1 + doc/models/error.md | 2 +- doc/models/get-payout-response.md | 39 + doc/models/get-terminal-checkout-response.md | 2 +- doc/models/get-terminal-refund-response.md | 2 +- doc/models/inventory-adjustment.md | 4 +- .../item-variation-location-overrides.md | 2 + doc/models/list-employees-response.md | 6 +- doc/models/list-locations-response.md | 2 +- doc/models/list-payout-entries-request.md | 21 + doc/models/list-payout-entries-response.md | 70 ++ doc/models/list-payouts-request.md | 27 + doc/models/list-payouts-response.md | 73 ++ .../list-subscription-events-response.md | 28 + doc/models/location-capability.md | 2 +- doc/models/location.md | 14 +- doc/models/order-line-item-modifier.md | 6 +- ...lance-activity-automatic-savings-detail.md | 23 + ...ivity-automatic-savings-reversed-detail.md | 23 + .../payment-balance-activity-charge-detail.md | 23 + ...ent-balance-activity-deposit-fee-detail.md | 21 + ...payment-balance-activity-dispute-detail.md | 23 + .../payment-balance-activity-fee-detail.md | 21 + ...balance-activity-free-processing-detail.md | 21 + ...balance-activity-hold-adjustment-detail.md | 21 + ...nt-balance-activity-open-dispute-detail.md | 23 + ...alance-activity-other-adjustment-detail.md | 21 + .../payment-balance-activity-other-detail.md | 21 + .../payment-balance-activity-refund-detail.md | 23 + ...ance-activity-release-adjustment-detail.md | 21 + ...nt-balance-activity-reserve-hold-detail.md | 21 + ...balance-activity-reserve-release-detail.md | 21 + ...-activity-square-capital-payment-detail.md | 21 + ...-square-capital-reversed-payment-detail.md | 21 + ...ment-balance-activity-tax-on-fee-detail.md | 21 + ...balance-activity-third-party-fee-detail.md | 21 + ...-activity-third-party-fee-refund-detail.md | 21 + doc/models/payment-options.md | 21 - doc/models/payout-entry.md | 65 ++ doc/models/payout-fee-type.md | 16 + doc/models/payout-fee.md | 30 + doc/models/payout-status.md | 17 + doc/models/payout-type.md | 19 + doc/models/payout.md | 46 + doc/models/refund.md | 2 +- doc/models/retrieve-employee-response.md | 6 +- doc/models/retrieve-location-response.md | 4 +- doc/models/retrieve-vendor-response.md | 8 +- doc/models/search-catalog-items-response.md | 6 +- doc/models/search-vendors-request.md | 2 +- doc/models/search-vendors-response.md | 8 +- doc/models/snippet-response.md | 6 +- doc/models/subscription.md | 2 +- doc/models/tax-ids.md | 4 +- doc/models/tender.md | 2 +- doc/models/terminal-checkout.md | 5 +- .../terminal-device-checkout-options.md | 31 - doc/models/terminal-refund.md | 12 +- doc/models/update-location-request.md | 4 +- doc/models/update-location-response.md | 6 +- doc/models/update-vendor-request.md | 2 +- doc/models/update-vendor-response.md | 2 +- doc/models/v1-list-orders-response.md | 8 +- doc/models/v1-order.md | 6 +- doc/models/v1-payment-tax.md | 6 +- src/ApiHelper.php | 54 +- src/Apis/ApplePayApi.php | 7 +- src/Apis/BankAccountsApi.php | 29 +- src/Apis/BaseApi.php | 2 +- src/Apis/BookingsApi.php | 72 +- src/Apis/CardsApi.php | 34 +- src/Apis/CashDrawersApi.php | 37 +- src/Apis/CatalogApi.php | 96 +-- src/Apis/CheckoutApi.php | 11 +- src/Apis/CustomerGroupsApi.php | 43 +- src/Apis/CustomerSegmentsApi.php | 20 +- src/Apis/CustomersApi.php | 88 +- src/Apis/DevicesApi.php | 25 +- src/Apis/DisputesApi.php | 89 +- src/Apis/EmployeesApi.php | 20 +- src/Apis/GiftCardActivitiesApi.php | 16 +- src/Apis/GiftCardsApi.php | 53 +- src/Apis/InventoryApi.php | 104 +-- src/Apis/InvoicesApi.php | 70 +- src/Apis/LaborApi.php | 134 +-- src/Apis/LocationsApi.php | 36 +- src/Apis/LoyaltyApi.php | 104 +-- src/Apis/MerchantsApi.php | 20 +- src/Apis/MobileAuthorizationApi.php | 7 +- src/Apis/OAuthApi.php | 21 +- src/Apis/OrdersApi.php | 56 +- src/Apis/PaymentsApi.php | 57 +- src/Apis/PayoutsApi.php | 286 +++++++ src/Apis/RefundsApi.php | 25 +- src/Apis/SitesApi.php | 7 +- src/Apis/SnippetsApi.php | 29 +- src/Apis/SubscriptionsApi.php | 95 +-- src/Apis/TeamApi.php | 58 +- src/Apis/TerminalApi.php | 76 +- src/Apis/TransactionsApi.php | 45 +- src/Apis/V1TransactionsApi.php | 99 +-- src/Apis/VendorsApi.php | 45 +- src/ConfigurationDefaults.php | 2 +- src/Models/ActivityType.php | 188 ++++ .../BatchRetrieveCatalogObjectsRequest.php | 30 + src/Models/BulkCreateVendorsRequest.php | 6 +- src/Models/BulkCreateVendorsResponse.php | 10 +- src/Models/BulkRetrieveVendorsRequest.php | 2 +- src/Models/BulkRetrieveVendorsResponse.php | 2 +- src/Models/BulkUpdateVendorsRequest.php | 2 +- src/Models/BulkUpdateVendorsResponse.php | 2 +- src/Models/BusinessHours.php | 6 +- src/Models/BusinessHoursPeriod.php | 8 +- src/Models/CancelTerminalCheckoutResponse.php | 2 + src/Models/CancelTerminalRefundResponse.php | 4 + src/Models/CatalogItemVariation.php | 30 +- src/Models/CatalogModifier.php | 36 + src/Models/CatalogObject.php | 4 +- src/Models/CreateLocationRequest.php | 6 +- src/Models/CreateLocationResponse.php | 10 +- src/Models/CreateTerminalCheckoutRequest.php | 2 + src/Models/CreateTerminalCheckoutResponse.php | 2 + src/Models/CreateTerminalRefundRequest.php | 4 + src/Models/CreateTerminalRefundResponse.php | 4 + src/Models/CreateVendorRequest.php | 2 +- src/Models/CreateVendorResponse.php | 2 +- src/Models/Destination.php | 88 ++ src/Models/DestinationType.php | 29 + src/Models/DeviceCheckoutOptions.php | 28 + src/Models/ErrorCode.php | 5 + src/Models/GetPayoutResponse.php | 91 ++ src/Models/GetTerminalCheckoutResponse.php | 2 + src/Models/GetTerminalRefundResponse.php | 4 + src/Models/InventoryAdjustment.php | 8 +- src/Models/ItemVariationLocationOverrides.php | 82 ++ src/Models/ListLocationsResponse.php | 2 +- src/Models/ListPayoutEntriesRequest.php | 129 +++ src/Models/ListPayoutEntriesResponse.php | 126 +++ src/Models/ListPayoutsRequest.php | 250 ++++++ src/Models/ListPayoutsResponse.php | 126 +++ src/Models/Location.php | 52 +- src/Models/LocationCapability.php | 2 +- src/Models/OrderLineItemModifier.php | 40 + ...tBalanceActivityAutomaticSavingsDetail.php | 85 ++ ...ActivityAutomaticSavingsReversedDetail.php | 85 ++ .../PaymentBalanceActivityChargeDetail.php | 60 ++ ...PaymentBalanceActivityDepositFeeDetail.php | 57 ++ .../PaymentBalanceActivityDisputeDetail.php | 85 ++ .../PaymentBalanceActivityFeeDetail.php | 57 ++ ...entBalanceActivityFreeProcessingDetail.php | 57 ++ ...entBalanceActivityHoldAdjustmentDetail.php | 57 ++ ...aymentBalanceActivityOpenDisputeDetail.php | 85 ++ ...ntBalanceActivityOtherAdjustmentDetail.php | 57 ++ .../PaymentBalanceActivityOtherDetail.php | 57 ++ .../PaymentBalanceActivityRefundDetail.php | 85 ++ ...BalanceActivityReleaseAdjustmentDetail.php | 57 ++ ...aymentBalanceActivityReserveHoldDetail.php | 57 ++ ...entBalanceActivityReserveReleaseDetail.php | 57 ++ ...anceActivitySquareCapitalPaymentDetail.php | 57 ++ ...vitySquareCapitalReversedPaymentDetail.php | 57 ++ .../PaymentBalanceActivityTaxOnFeeDetail.php | 57 ++ ...mentBalanceActivityThirdPartyFeeDetail.php | 57 ++ ...lanceActivityThirdPartyFeeRefundDetail.php | 57 ++ src/Models/PaymentOptions.php | 59 -- src/Models/Payout.php | 377 ++++++++ src/Models/PayoutEntry.php | 804 ++++++++++++++++++ src/Models/PayoutFee.php | 128 +++ src/Models/PayoutFeeType.php | 21 + src/Models/PayoutStatus.php | 26 + src/Models/PayoutType.php | 25 + src/Models/Refund.php | 14 +- src/Models/RetrieveLocationResponse.php | 8 +- src/Models/RetrieveVendorResponse.php | 2 +- src/Models/SearchVendorsRequest.php | 2 +- src/Models/SearchVendorsResponse.php | 2 +- src/Models/Subscription.php | 4 +- src/Models/TaxIds.php | 8 +- src/Models/Tender.php | 4 +- src/Models/TerminalCheckout.php | 5 + src/Models/TerminalDeviceCheckoutOptions.php | 83 -- src/Models/TerminalRefund.php | 38 +- src/Models/UpdateLocationRequest.php | 6 +- src/Models/UpdateLocationResponse.php | 10 +- src/Models/UpdateVendorRequest.php | 2 +- src/Models/UpdateVendorResponse.php | 2 +- src/SquareClient.php | 14 +- 220 files changed, 6229 insertions(+), 1637 deletions(-) create mode 100644 doc/apis/payouts.md create mode 100644 doc/models/activity-type.md create mode 100644 doc/models/destination-type.md create mode 100644 doc/models/destination.md create mode 100644 doc/models/get-payout-response.md create mode 100644 doc/models/list-payout-entries-request.md create mode 100644 doc/models/list-payout-entries-response.md create mode 100644 doc/models/list-payouts-request.md create mode 100644 doc/models/list-payouts-response.md create mode 100644 doc/models/payment-balance-activity-automatic-savings-detail.md create mode 100644 doc/models/payment-balance-activity-automatic-savings-reversed-detail.md create mode 100644 doc/models/payment-balance-activity-charge-detail.md create mode 100644 doc/models/payment-balance-activity-deposit-fee-detail.md create mode 100644 doc/models/payment-balance-activity-dispute-detail.md create mode 100644 doc/models/payment-balance-activity-fee-detail.md create mode 100644 doc/models/payment-balance-activity-free-processing-detail.md create mode 100644 doc/models/payment-balance-activity-hold-adjustment-detail.md create mode 100644 doc/models/payment-balance-activity-open-dispute-detail.md create mode 100644 doc/models/payment-balance-activity-other-adjustment-detail.md create mode 100644 doc/models/payment-balance-activity-other-detail.md create mode 100644 doc/models/payment-balance-activity-refund-detail.md create mode 100644 doc/models/payment-balance-activity-release-adjustment-detail.md create mode 100644 doc/models/payment-balance-activity-reserve-hold-detail.md create mode 100644 doc/models/payment-balance-activity-reserve-release-detail.md create mode 100644 doc/models/payment-balance-activity-square-capital-payment-detail.md create mode 100644 doc/models/payment-balance-activity-square-capital-reversed-payment-detail.md create mode 100644 doc/models/payment-balance-activity-tax-on-fee-detail.md create mode 100644 doc/models/payment-balance-activity-third-party-fee-detail.md create mode 100644 doc/models/payment-balance-activity-third-party-fee-refund-detail.md delete mode 100644 doc/models/payment-options.md create mode 100644 doc/models/payout-entry.md create mode 100644 doc/models/payout-fee-type.md create mode 100644 doc/models/payout-fee.md create mode 100644 doc/models/payout-status.md create mode 100644 doc/models/payout-type.md create mode 100644 doc/models/payout.md delete mode 100644 doc/models/terminal-device-checkout-options.md create mode 100644 src/Apis/PayoutsApi.php create mode 100644 src/Models/ActivityType.php create mode 100644 src/Models/Destination.php create mode 100644 src/Models/DestinationType.php create mode 100644 src/Models/GetPayoutResponse.php create mode 100644 src/Models/ListPayoutEntriesRequest.php create mode 100644 src/Models/ListPayoutEntriesResponse.php create mode 100644 src/Models/ListPayoutsRequest.php create mode 100644 src/Models/ListPayoutsResponse.php create mode 100644 src/Models/PaymentBalanceActivityAutomaticSavingsDetail.php create mode 100644 src/Models/PaymentBalanceActivityAutomaticSavingsReversedDetail.php create mode 100644 src/Models/PaymentBalanceActivityChargeDetail.php create mode 100644 src/Models/PaymentBalanceActivityDepositFeeDetail.php create mode 100644 src/Models/PaymentBalanceActivityDisputeDetail.php create mode 100644 src/Models/PaymentBalanceActivityFeeDetail.php create mode 100644 src/Models/PaymentBalanceActivityFreeProcessingDetail.php create mode 100644 src/Models/PaymentBalanceActivityHoldAdjustmentDetail.php create mode 100644 src/Models/PaymentBalanceActivityOpenDisputeDetail.php create mode 100644 src/Models/PaymentBalanceActivityOtherAdjustmentDetail.php create mode 100644 src/Models/PaymentBalanceActivityOtherDetail.php create mode 100644 src/Models/PaymentBalanceActivityRefundDetail.php create mode 100644 src/Models/PaymentBalanceActivityReleaseAdjustmentDetail.php create mode 100644 src/Models/PaymentBalanceActivityReserveHoldDetail.php create mode 100644 src/Models/PaymentBalanceActivityReserveReleaseDetail.php create mode 100644 src/Models/PaymentBalanceActivitySquareCapitalPaymentDetail.php create mode 100644 src/Models/PaymentBalanceActivitySquareCapitalReversedPaymentDetail.php create mode 100644 src/Models/PaymentBalanceActivityTaxOnFeeDetail.php create mode 100644 src/Models/PaymentBalanceActivityThirdPartyFeeDetail.php create mode 100644 src/Models/PaymentBalanceActivityThirdPartyFeeRefundDetail.php delete mode 100644 src/Models/PaymentOptions.php create mode 100644 src/Models/Payout.php create mode 100644 src/Models/PayoutEntry.php create mode 100644 src/Models/PayoutFee.php create mode 100644 src/Models/PayoutFeeType.php create mode 100644 src/Models/PayoutStatus.php create mode 100644 src/Models/PayoutType.php delete mode 100644 src/Models/TerminalDeviceCheckoutOptions.php diff --git a/composer.json b/composer.json index 728dd759..abe12db6 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": "17.3.0.20220316", + "version": "18.0.0.20220420", "type": "library", "keywords": [ "Square", @@ -22,7 +22,7 @@ "ext-curl": "*", "ext-json": "*", "ext-mbstring": "*", - "apimatic/unirest-php": "^2.2.1", + "apimatic/unirest-php": "^2.2.2", "apimatic/jsonmapper": "^3.0.0" }, "require-dev": { diff --git a/doc/apis/catalog.md b/doc/apis/catalog.md index 58141f42..fcf3652b 100644 --- a/doc/apis/catalog.md +++ b/doc/apis/catalog.md @@ -105,6 +105,7 @@ $body = new Models\BatchRetrieveCatalogObjectsRequest( ); $body->setIncludeRelatedObjects(true); $body->setCatalogVersion(118); +$body->setIncludeDeletedObjects(false); $apiResponse = $catalogApi->batchRetrieveCatalogObjects($body); diff --git a/doc/apis/locations.md b/doc/apis/locations.md index 33ff921d..e024412e 100644 --- a/doc/apis/locations.md +++ b/doc/apis/locations.md @@ -50,10 +50,10 @@ if ($apiResponse->isSuccess()) { Creates a [location](https://developer.squareup.com/docs/locations-api). Creating new locations allows for separate configuration of receipt layouts, item prices, -and sales reports. Developers can use locations to separate sales activity via applications +and sales reports. Developers can use locations to separate sales activity through applications that integrate with Square from sales activity elsewhere in a seller's account. -Locations created programmatically with the Locations API will last forever and -are visible to the seller for their own management, so ensure that +Locations created programmatically with the Locations API last forever and +are visible to the seller for their own management. Therefore, ensure that each location has a sensible and unique name. ```php diff --git a/doc/apis/orders.md b/doc/apis/orders.md index e84456b9..a687cbcb 100644 --- a/doc/apis/orders.md +++ b/doc/apis/orders.md @@ -116,9 +116,7 @@ $body_order_lineItems_1_modifiers[0]->setUid('uid1'); $body_order_lineItems_1_modifiers[0]->setCatalogObjectId('CHQX7Y4KY6N5KINJKZCFURPZ'); $body_order_lineItems_1_modifiers[0]->setCatalogVersion(69); $body_order_lineItems_1_modifiers[0]->setName('name1'); -$body_order_lineItems_1_modifiers[0]->setBasePriceMoney(new Models\Money); -$body_order_lineItems_1_modifiers[0]->getBasePriceMoney()->setAmount(53); -$body_order_lineItems_1_modifiers[0]->getBasePriceMoney()->setCurrency(Models\Currency::TTD); +$body_order_lineItems_1_modifiers[0]->setQuantity('quantity7'); $body_order_lineItems[1]->setModifiers($body_order_lineItems_1_modifiers); $body_order_lineItems_1_appliedDiscounts = []; @@ -672,7 +670,7 @@ To be used with `PayOrder`, a payment must: - Reference the order by specifying the `order_id` when [creating the payment](../../doc/apis/payments.md#create-payment). Any approved payments that reference the same `order_id` not specified in the `payment_ids` is canceled. -- Be approved with [delayed capture](https://developer.squareup.com/docs/payments-api/take-payments#delayed-capture). +- Be approved with [delayed capture](https://developer.squareup.com/docs/payments-api/take-payments/card-payments/delayed-capture). Using a delayed capture payment with `PayOrder` completes the approved payment. ```php diff --git a/doc/apis/payouts.md b/doc/apis/payouts.md new file mode 100644 index 00000000..284849db --- /dev/null +++ b/doc/apis/payouts.md @@ -0,0 +1,162 @@ +# Payouts + +```php +$payoutsApi = $client->getPayoutsApi(); +``` + +## Class Name + +`PayoutsApi` + +## Methods + +* [List Payouts](../../doc/apis/payouts.md#list-payouts) +* [Get Payout](../../doc/apis/payouts.md#get-payout) +* [List Payout Entries](../../doc/apis/payouts.md#list-payout-entries) + + +# List Payouts + +Retrieves a list of all payouts for the default location. +You can filter payouts by location ID, status, time range, and order them in ascending or descending order. +To call this endpoint, set `PAYOUTS_READ` for the OAuth scope. + +```php +function listPayouts( + ?string $locationId = null, + ?string $status = null, + ?string $beginTime = null, + ?string $endTime = null, + ?string $sortOrder = null, + ?string $cursor = null, + ?int $limit = null +): ApiResponse +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `locationId` | `?string` | Query, Optional | The ID of the location for which to list the payouts.
By default, payouts are returned for the default (main) location associated with the seller. | +| `status` | [`?string (PayoutStatus)`](../../doc/models/payout-status.md) | Query, Optional | If provided, only payouts with the given status are returned. | +| `beginTime` | `?string` | Query, Optional | The timestamp for the beginning of the payout creation time, in RFC 3339 format.
Inclusive. Default: The current time minus one year. | +| `endTime` | `?string` | Query, Optional | The timestamp for the end of the payout creation time, in RFC 3339 format.
Default: The current time. | +| `sortOrder` | [`?string (SortOrder)`](../../doc/models/sort-order.md) | Query, Optional | The order in which payouts are listed. | +| `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.
For more information, see [Pagination](https://developer.squareup.com/docs/basics/api101/pagination).
If request parameters change between requests, subsequent results may contain duplicates or missing records. | +| `limit` | `?int` | Query, Optional | The maximum number of results to be returned in a single page.
It is possible to receive fewer results than the specified limit on a given page.
The default value of 100 is also the maximum allowed value. If the provided value is
greater than 100, it is ignored and the default value is used instead.
Default: `100` | + +## Response Type + +[`ListPayoutsResponse`](../../doc/models/list-payouts-response.md) + +## Example Usage + +```php +$locationId = 'location_id4'; +$status = Models\PayoutStatus::PAID; +$beginTime = 'begin_time2'; +$endTime = 'end_time2'; +$sortOrder = Models\SortOrder::DESC; +$cursor = 'cursor6'; +$limit = 172; + +$apiResponse = $payoutsApi->listPayouts($locationId, $status, $beginTime, $endTime, $sortOrder, $cursor, $limit); + +if ($apiResponse->isSuccess()) { + $listPayoutsResponse = $apiResponse->getResult(); +} else { + $errors = $apiResponse->getErrors(); +} + +// Get more response info... +// $statusCode = $apiResponse->getStatusCode(); +// $headers = $apiResponse->getHeaders(); +``` + + +# Get Payout + +Retrieves details of a specific payout identified by a payout ID. +To call this endpoint, set `PAYOUTS_READ` for the OAuth scope. + +```php +function getPayout(string $payoutId): ApiResponse +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `payoutId` | `string` | Template, Required | The ID of the payout to retrieve the information for. | + +## Response Type + +[`GetPayoutResponse`](../../doc/models/get-payout-response.md) + +## Example Usage + +```php +$payoutId = 'payout_id6'; + +$apiResponse = $payoutsApi->getPayout($payoutId); + +if ($apiResponse->isSuccess()) { + $getPayoutResponse = $apiResponse->getResult(); +} else { + $errors = $apiResponse->getErrors(); +} + +// Get more response info... +// $statusCode = $apiResponse->getStatusCode(); +// $headers = $apiResponse->getHeaders(); +``` + + +# List Payout Entries + +Retrieves a list of all payout entries for a specific payout. +To call this endpoint, set `PAYOUTS_READ` for the OAuth scope. + +```php +function listPayoutEntries( + string $payoutId, + ?string $sortOrder = null, + ?string $cursor = null, + ?int $limit = null +): ApiResponse +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `payoutId` | `string` | Template, Required | The ID of the payout to retrieve the information for. | +| `sortOrder` | [`?string (SortOrder)`](../../doc/models/sort-order.md) | Query, Optional | The order in which payout entries are listed. | +| `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.
For more information, see [Pagination](https://developer.squareup.com/docs/basics/api101/pagination).
If request parameters change between requests, subsequent results may contain duplicates or missing records. | +| `limit` | `?int` | Query, Optional | The maximum number of results to be returned in a single page.
It is possible to receive fewer results than the specified limit on a given page.
The default value of 100 is also the maximum allowed value. If the provided value is
greater than 100, it is ignored and the default value is used instead.
Default: `100` | + +## Response Type + +[`ListPayoutEntriesResponse`](../../doc/models/list-payout-entries-response.md) + +## Example Usage + +```php +$payoutId = 'payout_id6'; +$sortOrder = Models\SortOrder::DESC; +$cursor = 'cursor6'; +$limit = 172; + +$apiResponse = $payoutsApi->listPayoutEntries($payoutId, $sortOrder, $cursor, $limit); + +if ($apiResponse->isSuccess()) { + $listPayoutEntriesResponse = $apiResponse->getResult(); +} else { + $errors = $apiResponse->getErrors(); +} + +// Get more response info... +// $statusCode = $apiResponse->getStatusCode(); +// $headers = $apiResponse->getHeaders(); +``` + diff --git a/doc/apis/subscriptions.md b/doc/apis/subscriptions.md index d3b67be9..a898d939 100644 --- a/doc/apis/subscriptions.md +++ b/doc/apis/subscriptions.md @@ -314,7 +314,6 @@ if ($apiResponse->isSuccess()) { # List Subscription Events Lists all events for a specific subscription. -In the current implementation, only `START_SUBSCRIPTION` and `STOP_SUBSCRIPTION` (when the subscription was canceled) events are returned. ```php function listSubscriptionEvents(string $subscriptionId, ?string $cursor = null, ?int $limit = null): ApiResponse diff --git a/doc/apis/terminal.md b/doc/apis/terminal.md index 367f50f1..8cbf55d0 100644 --- a/doc/apis/terminal.md +++ b/doc/apis/terminal.md @@ -51,6 +51,7 @@ $body_checkout_deviceOptions = new Models\DeviceCheckoutOptions( $body_checkout_deviceOptions_deviceId ); $body_checkout_deviceOptions->setSkipReceiptScreen(false); +$body_checkout_deviceOptions->setCollectSignature(false); $body_checkout_deviceOptions->setTipSettings(new Models\TipSettings); $body_checkout_deviceOptions->getTipSettings()->setAllowTipping(false); $body_checkout_deviceOptions->getTipSettings()->setSeparateTipScreen(false); @@ -87,7 +88,7 @@ if ($apiResponse->isSuccess()) { # Search Terminal Checkouts -Retrieves a filtered list of Terminal checkout requests created by the account making the request. +Returns a filtered list of Terminal checkout requests created by the application making the request. Only Terminal checkout requests created for the merchant scoped to the OAuth token are returned. Terminal checkout requests are available for 30 days. ```php function searchTerminalCheckouts(SearchTerminalCheckoutsRequest $body): ApiResponse @@ -135,7 +136,7 @@ if ($apiResponse->isSuccess()) { # Get Terminal Checkout -Retrieves a Terminal checkout request by `checkout_id`. +Retrieves a Terminal checkout request by `checkout_id`. Terminal checkout requests are available for 30 days. ```php function getTerminalCheckout(string $checkoutId): ApiResponse @@ -209,7 +210,7 @@ if ($apiResponse->isSuccess()) { # Create Terminal Refund -Creates a request to refund an Interac payment completed on a Square Terminal. +Creates a request to refund an Interac payment completed on a Square Terminal. Refunds for Interac payments on a Square Terminal are supported only for Interac debit cards in Canada. Other refunds for Terminal payments should use the Refunds API. For more information, see [Refunds API](../../doc/apis/refunds.md). ```php function createTerminalRefund(CreateTerminalRefundRequest $body): ApiResponse @@ -236,15 +237,19 @@ $body_refund_paymentId = '5O5OvgkcNUhl7JBuINflcjKqUzXZY'; $body_refund_amountMoney = new Models\Money; $body_refund_amountMoney->setAmount(111); $body_refund_amountMoney->setCurrency(Models\Currency::CAD); +$body_refund_reason = 'Returning items'; +$body_refund_deviceId = 'f72dfb8e-4d65-4e56-aade-ec3fb8d33291'; $body->setRefund(new Models\TerminalRefund( $body_refund_paymentId, - $body_refund_amountMoney + $body_refund_amountMoney, + $body_refund_reason, + $body_refund_deviceId )); $body->getRefund()->setId('id4'); $body->getRefund()->setRefundId('refund_id8'); $body->getRefund()->setOrderId('order_id8'); -$body->getRefund()->setReason('Returning items'); -$body->getRefund()->setDeviceId('f72dfb8e-4d65-4e56-aade-ec3fb8d33291'); +$body->getRefund()->setDeadlineDuration('deadline_duration6'); +$body->getRefund()->setStatus('status6'); $apiResponse = $terminalApi->createTerminalRefund($body); @@ -262,7 +267,7 @@ if ($apiResponse->isSuccess()) { # Search Terminal Refunds -Retrieves a filtered list of Interac Terminal refund requests created by the seller making the request. +Retrieves a filtered list of Interac Terminal refund requests created by the seller making the request. Terminal refund requests are available for 30 days. ```php function searchTerminalRefunds(SearchTerminalRefundsRequest $body): ApiResponse @@ -310,7 +315,7 @@ if ($apiResponse->isSuccess()) { # Get Terminal Refund -Retrieves an Interac Terminal refund object by ID. +Retrieves an Interac Terminal refund object by ID. Terminal refund objects are available for 30 days. ```php function getTerminalRefund(string $terminalRefundId): ApiResponse diff --git a/doc/client.md b/doc/client.md index b136a9a3..5e9f9019 100644 --- a/doc/client.md +++ b/doc/client.md @@ -5,7 +5,7 @@ The following parameters are configurable for the API Client: | Parameter | Type | Description | | --- | --- | --- | -| `squareVersion` | `string` | Square Connect API versions
*Default*: `'2022-03-16'` | +| `squareVersion` | `string` | Square Connect API versions
*Default*: `'2022-04-20'` | | `customUrl` | `string` | Sets the base URL requests are made to. Defaults to `https://connect.squareup.com`
*Default*: `'https://connect.squareup.com'` | | `environment` | `string` | The API environment.
**Default: `production`** | | `timeout` | `int` | Timeout for API calls in seconds.
*Default*: `60` | @@ -27,7 +27,7 @@ The API client can be initialized as follows: $client = new Square\SquareClient([ // Set authentication parameters 'accessToken' => 'AccessToken', - 'squareVersion' => '2022-03-16', + 'squareVersion' => '2022-04-20', // Set the environment 'environment' => 'production', @@ -54,7 +54,7 @@ require_once "vendor/autoload.php"; $client = new Square\SquareClient([ 'accessToken' => 'AccessToken', - 'squareVersion' => '2022-03-16', + 'squareVersion' => '2022-04-20', ]); $locationsApi = $client->getLocationsApi(); @@ -107,6 +107,7 @@ The gateway for the SDK. This class acts as a factory for the Apis and also hold | getMerchantsApi() | Gets MerchantsApi | | getOrdersApi() | Gets OrdersApi | | getPaymentsApi() | Gets PaymentsApi | +| getPayoutsApi() | Gets PayoutsApi | | getRefundsApi() | Gets RefundsApi | | getSitesApi() | Gets SitesApi | | getSnippetsApi() | Gets SnippetsApi | diff --git a/doc/models/activity-type.md b/doc/models/activity-type.md new file mode 100644 index 00000000..d12ffb79 --- /dev/null +++ b/doc/models/activity-type.md @@ -0,0 +1,46 @@ + +# Activity Type + +## Enumeration + +`ActivityType` + +## Fields + +| Name | Description | +| --- | --- | +| `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. | +| `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. | +| `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. | +| `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. | +| `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. | +| `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. | +| `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_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. | + diff --git a/doc/models/batch-retrieve-catalog-objects-request.md b/doc/models/batch-retrieve-catalog-objects-request.md index d9e20969..1a531645 100644 --- a/doc/models/batch-retrieve-catalog-objects-request.md +++ b/doc/models/batch-retrieve-catalog-objects-request.md @@ -12,6 +12,7 @@ | `objectIds` | `string[]` | Required | The IDs of the CatalogObjects to be retrieved. | getObjectIds(): array | setObjectIds(array objectIds): void | | `includeRelatedObjects` | `?bool` | Optional | If `true`, the response will include additional objects that are related to the
requested objects. Related objects are defined as any objects referenced by ID by the results in the `objects` field
of the response. These objects are put in the `related_objects` field. Setting this to `true` is
helpful when the objects are needed for immediate display to a user.
This process only goes one level deep. Objects referenced by the related objects will not be included. For example,

if the `objects` field of the response contains a CatalogItem, its associated
CatalogCategory objects, CatalogTax objects, CatalogImage objects and
CatalogModifierLists will be returned in the `related_objects` field of the
response. If the `objects` field of the response contains a CatalogItemVariation,
its parent CatalogItem will be returned in the `related_objects` field of
the response.

Default value: `false` | getIncludeRelatedObjects(): ?bool | setIncludeRelatedObjects(?bool includeRelatedObjects): void | | `catalogVersion` | `?int` | Optional | The specific version of the catalog objects to be included in the response.
This allows you to retrieve historical versions of objects. The specified version value is matched against
the [CatalogObject](../../doc/models/catalog-object.md)s' `version` attribute. If not included, results will
be from the current version of the catalog. | getCatalogVersion(): ?int | setCatalogVersion(?int catalogVersion): void | +| `includeDeletedObjects` | `?bool` | Optional | Indicates whether to include (`true`) or not (`false`) in the response deleted objects, namely, those with the `is_deleted` attribute set to `true`. | getIncludeDeletedObjects(): ?bool | setIncludeDeletedObjects(?bool includeDeletedObjects): void | ## Example (as JSON) diff --git a/doc/models/bulk-create-vendors-request.md b/doc/models/bulk-create-vendors-request.md index 57931f4a..fc9ebc07 100644 --- a/doc/models/bulk-create-vendors-request.md +++ b/doc/models/bulk-create-vendors-request.md @@ -1,7 +1,7 @@ # Bulk Create Vendors Request -Represents an input to a call to [BulkCreateVendors.](../../doc/apis/vendors.md#bulk-create-vendors) +Represents an input to a call to [BulkCreateVendors](../../doc/apis/vendors.md#bulk-create-vendors). ## Structure @@ -11,7 +11,7 @@ Represents an input to a call to [BulkCreateVendors.](../../doc/apis/vendors.md# | Name | Type | Tags | Description | Getter | Setter | | --- | --- | --- | --- | --- | --- | -| `vendors` | [`array`](../../doc/models/vendor.md) | Required | Specifies a set of new [Vendor](entity:Vendor] objects as represented by a collection of idempotency-key/`Vendor`-object pairs. | getVendors(): array | setVendors(array vendors): void | +| `vendors` | [`array`](../../doc/models/vendor.md) | Required | Specifies a set of new [Vendor](../../doc/models/vendor.md) objects as represented by a collection of idempotency-key/`Vendor`-object pairs. | getVendors(): array | setVendors(array vendors): void | ## Example (as JSON) diff --git a/doc/models/bulk-create-vendors-response.md b/doc/models/bulk-create-vendors-response.md index 4200abb2..a7c1fe70 100644 --- a/doc/models/bulk-create-vendors-response.md +++ b/doc/models/bulk-create-vendors-response.md @@ -1,7 +1,7 @@ # Bulk Create Vendors Response -Represents an output from a call to [BulkCreateVendors.](../../doc/apis/vendors.md#bulk-create-vendors) +Represents an output from a call to [BulkCreateVendors](../../doc/apis/vendors.md#bulk-create-vendors). ## Structure @@ -12,7 +12,7 @@ Represents an output from a call to [BulkCreateVendors.](../../doc/apis/vendors. | 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 | -| `responses` | [`?array`](../../doc/models/create-vendor-response.md) | Optional | A set of [CreateVendorResponse](../../doc/models/create-vendor-response.md) objects encapsulating successfully created [Vendor](../../doc/models/vendor.md)
objects or error responses for failed attempts. The set is represented by
a collection of idempotency-key/`Vendor`-object or idempotency-key/error-object pairs. The impotency keys correspond to those specified
in the input. | getResponses(): ?array | setResponses(?array responses): void | +| `responses` | [`?array`](../../doc/models/create-vendor-response.md) | Optional | A set of [CreateVendorResponse](../../doc/models/create-vendor-response.md) objects encapsulating successfully created [Vendor](../../doc/models/vendor.md)
objects or error responses for failed attempts. The set is represented by
a collection of idempotency-key/`Vendor`-object or idempotency-key/error-object pairs. The idempotency keys correspond to those specified
in the input. | getResponses(): ?array | setResponses(?array responses): void | ## Example (as JSON) diff --git a/doc/models/bulk-retrieve-vendors-request.md b/doc/models/bulk-retrieve-vendors-request.md index 95e26e81..7ddf504d 100644 --- a/doc/models/bulk-retrieve-vendors-request.md +++ b/doc/models/bulk-retrieve-vendors-request.md @@ -1,7 +1,7 @@ # Bulk Retrieve Vendors Request -Represents an input to a call to [BulkRetrieveVendors.](../../doc/apis/vendors.md#bulk-retrieve-vendors) +Represents an input to a call to [BulkRetrieveVendors](../../doc/apis/vendors.md#bulk-retrieve-vendors). ## Structure diff --git a/doc/models/bulk-retrieve-vendors-response.md b/doc/models/bulk-retrieve-vendors-response.md index 3f06148b..cc4be46e 100644 --- a/doc/models/bulk-retrieve-vendors-response.md +++ b/doc/models/bulk-retrieve-vendors-response.md @@ -1,7 +1,7 @@ # Bulk Retrieve Vendors Response -Represents an output from a call to [BulkRetrieveVendors.](../../doc/apis/vendors.md#bulk-retrieve-vendors) +Represents an output from a call to [BulkRetrieveVendors](../../doc/apis/vendors.md#bulk-retrieve-vendors). ## Structure diff --git a/doc/models/bulk-update-vendors-request.md b/doc/models/bulk-update-vendors-request.md index 5e7bd832..11cecb04 100644 --- a/doc/models/bulk-update-vendors-request.md +++ b/doc/models/bulk-update-vendors-request.md @@ -1,7 +1,7 @@ # Bulk Update Vendors Request -Represents an input to a call to [BulkUpdateVendors.](../../doc/apis/vendors.md#bulk-update-vendors) +Represents an input to a call to [BulkUpdateVendors](../../doc/apis/vendors.md#bulk-update-vendors). ## Structure diff --git a/doc/models/bulk-update-vendors-response.md b/doc/models/bulk-update-vendors-response.md index c57d4312..61e32220 100644 --- a/doc/models/bulk-update-vendors-response.md +++ b/doc/models/bulk-update-vendors-response.md @@ -1,7 +1,7 @@ # Bulk Update Vendors Response -Represents an output from a call to [BulkUpdateVendors.](../../doc/apis/vendors.md#bulk-update-vendors) +Represents an output from a call to [BulkUpdateVendors](../../doc/apis/vendors.md#bulk-update-vendors). ## Structure diff --git a/doc/models/business-hours-period.md b/doc/models/business-hours-period.md index 027a4420..c33c738a 100644 --- a/doc/models/business-hours-period.md +++ b/doc/models/business-hours-period.md @@ -12,8 +12,8 @@ Represents a period of time during which a business location is open. | Name | Type | Tags | Description | Getter | Setter | | --- | --- | --- | --- | --- | --- | | `dayOfWeek` | [`?string (DayOfWeek)`](../../doc/models/day-of-week.md) | Optional | Indicates the specific day of the week. | getDayOfWeek(): ?string | setDayOfWeek(?string dayOfWeek): void | -| `startLocalTime` | `?string` | Optional | The start time of a business hours period, specified in local time using partial-time
RFC 3339 format. For example, `8:30:00` for a period starting at 8:30 in the morning.
Note that the seconds value will always be :00, but it is appended for conformance to the RFC. | getStartLocalTime(): ?string | setStartLocalTime(?string startLocalTime): void | -| `endLocalTime` | `?string` | Optional | The end time of a business hours period, specified in local time using partial-time
RFC 3339 format. For example, `21:00:00` for a period ending at 9:00 in the evening.
Note that the seconds value will always be :00, but it is appended for conformance to the RFC. | getEndLocalTime(): ?string | setEndLocalTime(?string endLocalTime): void | +| `startLocalTime` | `?string` | Optional | The start time of a business hours period, specified in local time using partial-time
RFC 3339 format. For example, `8:30:00` for a period starting at 8:30 in the morning.
Note that the seconds value is always :00, but it is appended for conformance to the RFC. | getStartLocalTime(): ?string | setStartLocalTime(?string startLocalTime): void | +| `endLocalTime` | `?string` | Optional | The end time of a business hours period, specified in local time using partial-time
RFC 3339 format. For example, `21:00:00` for a period ending at 9:00 in the evening.
Note that the seconds value is always :00, but it is appended for conformance to the RFC. | getEndLocalTime(): ?string | setEndLocalTime(?string endLocalTime): void | ## Example (as JSON) diff --git a/doc/models/business-hours.md b/doc/models/business-hours.md index 2c725670..99b59da4 100644 --- a/doc/models/business-hours.md +++ b/doc/models/business-hours.md @@ -11,7 +11,7 @@ The hours of operation for a location. | Name | Type | Tags | Description | Getter | Setter | | --- | --- | --- | --- | --- | --- | -| `periods` | [`?(BusinessHoursPeriod[])`](../../doc/models/business-hours-period.md) | Optional | The list of time periods during which the business is open. There may be at most 10
periods per day. | getPeriods(): ?array | setPeriods(?array periods): void | +| `periods` | [`?(BusinessHoursPeriod[])`](../../doc/models/business-hours-period.md) | Optional | The list of time periods during which the business is open. There can be at most 10 periods per day. | getPeriods(): ?array | setPeriods(?array periods): void | ## Example (as JSON) diff --git a/doc/models/cancel-terminal-checkout-response.md b/doc/models/cancel-terminal-checkout-response.md index 2d1c96fe..31ac30cd 100644 --- a/doc/models/cancel-terminal-checkout-response.md +++ b/doc/models/cancel-terminal-checkout-response.md @@ -10,7 +10,7 @@ | Name | Type | Tags | Description | Getter | Setter | | --- | --- | --- | --- | --- | --- | | `errors` | [`?(Error[])`](../../doc/models/error.md) | Optional | Information about errors encountered during the request. | getErrors(): ?array | setErrors(?array errors): void | -| `checkout` | [`?TerminalCheckout`](../../doc/models/terminal-checkout.md) | Optional | - | getCheckout(): ?TerminalCheckout | setCheckout(?TerminalCheckout checkout): void | +| `checkout` | [`?TerminalCheckout`](../../doc/models/terminal-checkout.md) | Optional | Represents a checkout processed by the Square Terminal. | getCheckout(): ?TerminalCheckout | setCheckout(?TerminalCheckout checkout): void | ## Example (as JSON) diff --git a/doc/models/cancel-terminal-refund-response.md b/doc/models/cancel-terminal-refund-response.md index 20384c59..b226e41a 100644 --- a/doc/models/cancel-terminal-refund-response.md +++ b/doc/models/cancel-terminal-refund-response.md @@ -10,7 +10,7 @@ | Name | Type | Tags | Description | Getter | Setter | | --- | --- | --- | --- | --- | --- | | `errors` | [`?(Error[])`](../../doc/models/error.md) | Optional | Information about errors encountered during the request. | getErrors(): ?array | setErrors(?array errors): void | -| `refund` | [`?TerminalRefund`](../../doc/models/terminal-refund.md) | Optional | - | getRefund(): ?TerminalRefund | setRefund(?TerminalRefund refund): void | +| `refund` | [`?TerminalRefund`](../../doc/models/terminal-refund.md) | Optional | Represents a payment refund processed by the Square Terminal. Only supports Interac (Canadian debit network) payment refunds. | getRefund(): ?TerminalRefund | setRefund(?TerminalRefund refund): void | ## Example (as JSON) diff --git a/doc/models/catalog-item-variation.md b/doc/models/catalog-item-variation.md index dc164c55..7939f085 100644 --- a/doc/models/catalog-item-variation.md +++ b/doc/models/catalog-item-variation.md @@ -28,7 +28,8 @@ may have a maximum of 250 item variations. | `availableForBooking` | `?bool` | Optional | If the `CatalogItem` that owns this item variation is of type
`APPOINTMENTS_SERVICE`, a bool representing whether this service is available for booking. | getAvailableForBooking(): ?bool | setAvailableForBooking(?bool availableForBooking): void | | `itemOptionValues` | [`?(CatalogItemOptionValueForItemVariation[])`](../../doc/models/catalog-item-option-value-for-item-variation.md) | Optional | List of item option values associated with this item variation. Listed
in the same order as the item options of the parent item. | getItemOptionValues(): ?array | setItemOptionValues(?array itemOptionValues): void | | `measurementUnitId` | `?string` | Optional | ID of the ‘CatalogMeasurementUnit’ that is used to measure the quantity
sold of this item variation. If left unset, the item will be sold in
whole quantities. | getMeasurementUnitId(): ?string | setMeasurementUnitId(?string measurementUnitId): void | -| `stockable` | `?bool` | Optional | Whether stock is counted directly on this variation (TRUE) or only on its components (FALSE).
For backward compatibility missing values will be interpreted as TRUE. | getStockable(): ?bool | setStockable(?bool stockable): void | +| `sellable` | `?bool` | Optional | Whether this variation can be sold. | getSellable(): ?bool | setSellable(?bool sellable): void | +| `stockable` | `?bool` | Optional | Whether stock is counted directly on this variation (TRUE) or only on its components (FALSE). | getStockable(): ?bool | setStockable(?bool stockable): void | | `imageIds` | `?(string[])` | Optional | The IDs of images associated with this `CatalogItemVariation` instance.
These images will be shown to customers in Square Online Store. | getImageIds(): ?array | setImageIds(?array imageIds): void | | `teamMemberIds` | `?(string[])` | Optional | Tokens of employees that can perform the service represented by this variation. Only valid for
variations of type `APPOINTMENTS_SERVICE`. | getTeamMemberIds(): ?array | setTeamMemberIds(?array teamMemberIds): void | | `stockableConversion` | [`?CatalogStockConversion`](../../doc/models/catalog-stock-conversion.md) | Optional | Represents the rule of conversion between a stockable [CatalogItemVariation](../../doc/models/catalog-item-variation.md)
and a non-stockable sell-by or receive-by `CatalogItemVariation` that
share the same underlying stock. | getStockableConversion(): ?CatalogStockConversion | setStockableConversion(?CatalogStockConversion stockableConversion): void | diff --git a/doc/models/catalog-modifier.md b/doc/models/catalog-modifier.md index 7a3ab7cc..a4c84713 100644 --- a/doc/models/catalog-modifier.md +++ b/doc/models/catalog-modifier.md @@ -15,6 +15,7 @@ A modifier applicable to items at the time of sale. | `priceMoney` | [`?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. | getPriceMoney(): ?Money | setPriceMoney(?Money priceMoney): void | | `ordinal` | `?int` | Optional | Determines where this `CatalogModifier` appears in the `CatalogModifierList`. | getOrdinal(): ?int | setOrdinal(?int ordinal): void | | `modifierListId` | `?string` | Optional | The ID of the `CatalogModifierList` associated with this modifier. | getModifierListId(): ?string | setModifierListId(?string modifierListId): void | +| `imageIds` | `?(string[])` | Optional | The IDs of images associated with this `CatalogModifier` 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 | ## Example (as JSON) diff --git a/doc/models/catalog-object.md b/doc/models/catalog-object.md index 96174343..64e0a1f8 100644 --- a/doc/models/catalog-object.md +++ b/doc/models/catalog-object.md @@ -25,7 +25,7 @@ For a more detailed discussion of the Catalog data model, please see the | `updatedAt` | `?string` | Optional | Last modification [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) in RFC 3339 format, e.g., `"2016-08-15T23:59:33.123Z"`
would indicate the UTC time (denoted by `Z`) of August 15, 2016 at 23:59:33 and 123 milliseconds. | getUpdatedAt(): ?string | setUpdatedAt(?string updatedAt): void | | `version` | `?int` | Optional | The version of the object. When updating an object, the version supplied
must match the version in the database, otherwise the write will be rejected as conflicting. | getVersion(): ?int | setVersion(?int version): void | | `isDeleted` | `?bool` | Optional | If `true`, the object has been deleted from the database. Must be `false` for new objects
being inserted. When deleted, the `updated_at` field will equal the deletion time. | getIsDeleted(): ?bool | setIsDeleted(?bool isDeleted): void | -| `customAttributeValues` | [`?array`](../../doc/models/catalog-custom-attribute-value.md) | Optional | A map (key-value pairs) of application-defined custom attribute values. The value of a key-value pair
is a [CatalogCustomAttributeValue](../../doc/models/catalog-custom-attribute-value.md) object. The key is the `key` attribute
value defined in the associated [CatalogCustomAttributeDefinition](../../doc/models/catalog-custom-attribute-definition.md)
object defined by the application making the request.

If the `CatalogCustomAttributeDefinition` object is
defined by another application, the `CatalogCustomAttributeDefinition`'s key attribute value is prefixed by
the defining application ID. For example, if the `CatalogCustomAttributeDefinition` has a `key` attribute of
`"cocoa_brand"` and the defining application ID is `"abcd1234"`, the key in the map is `"abcd1234:cocoa_brand"`
if the application making the request is different from the application defining the custom attribute definition.
Otherwise, the key used in the map is simply `"cocoa_brand"`.

Application-defined custom attributes that are set at a global (location-independent) level.
Custom attribute values are intended to store additional information about a catalog object
or associations with an entity in another system. Do not use custom attributes
to store any sensitive information (personally identifiable information, card details, etc.). | getCustomAttributeValues(): ?array | setCustomAttributeValues(?array customAttributeValues): void | +| `customAttributeValues` | [`?array`](../../doc/models/catalog-custom-attribute-value.md) | Optional | A map (key-value pairs) of application-defined custom attribute values. The value of a key-value pair
is a [CatalogCustomAttributeValue](../../doc/models/catalog-custom-attribute-value.md) object. The key is the `key` attribute
value defined in the associated [CatalogCustomAttributeDefinition](../../doc/models/catalog-custom-attribute-definition.md)
object defined by the application making the request.

If the `CatalogCustomAttributeDefinition` object is
defined by another application, the `CatalogCustomAttributeDefinition`'s key attribute value is prefixed by
the defining application ID. For example, if the `CatalogCustomAttributeDefinition` has a `key` attribute of
`"cocoa_brand"` and the defining application ID is `"abcd1234"`, the key in the map is `"abcd1234:cocoa_brand"`
if the application making the request is different from the application defining the custom attribute definition.
Otherwise, the key used in the map is simply `"cocoa_brand"`.

Application-defined custom attributes are set at a global (location-independent) level.
Custom attribute values are intended to store additional information about a catalog object
or associations with an entity in another system. Do not use custom attributes
to store any sensitive information (personally identifiable information, card details, etc.). | getCustomAttributeValues(): ?array | setCustomAttributeValues(?array customAttributeValues): void | | `catalogV1Ids` | [`?(CatalogV1Id[])`](../../doc/models/catalog-v1-id.md) | Optional | The Connect v1 IDs for this object at each location where it is present, where they
differ from the object's Connect V2 ID. The field will only be present for objects that
have been created or modified by legacy APIs. | getCatalogV1Ids(): ?array | setCatalogV1Ids(?array catalogV1Ids): void | | `presentAtAllLocations` | `?bool` | Optional | If `true`, this object is present at all locations (including future locations), except where specified in
the `absent_at_location_ids` field. If `false`, this object is not present at any locations (including future locations),
except where specified in the `present_at_location_ids` field. If not specified, defaults to `true`. | getPresentAtAllLocations(): ?bool | setPresentAtAllLocations(?bool presentAtAllLocations): void | | `presentAtLocationIds` | `?(string[])` | Optional | A list of locations where the object is present, even if `present_at_all_locations` is `false`.
This can include locations that are deactivated. | getPresentAtLocationIds(): ?array | setPresentAtLocationIds(?array presentAtLocationIds): void | diff --git a/doc/models/create-location-request.md b/doc/models/create-location-request.md index 5b7ab2a0..b8c4e7c1 100644 --- a/doc/models/create-location-request.md +++ b/doc/models/create-location-request.md @@ -1,7 +1,7 @@ # Create Location Request -Request object for the [CreateLocation](../../doc/apis/locations.md#create-location) endpoint. +The request object for the [CreateLocation](../../doc/apis/locations.md#create-location) endpoint. ## Structure @@ -11,7 +11,7 @@ Request object for the [CreateLocation](../../doc/apis/locations.md#create-locat | Name | Type | Tags | Description | Getter | Setter | | --- | --- | --- | --- | --- | --- | -| `location` | [`?Location`](../../doc/models/location.md) | Optional | Represents one of a business's [locations](https://developer.squareup.com/docs/locations-api). | getLocation(): ?Location | setLocation(?Location location): void | +| `location` | [`?Location`](../../doc/models/location.md) | Optional | Represents one of a business' [locations](https://developer.squareup.com/docs/locations-api). | getLocation(): ?Location | setLocation(?Location location): void | ## Example (as JSON) diff --git a/doc/models/create-location-response.md b/doc/models/create-location-response.md index 5bf0617d..11c0eae5 100644 --- a/doc/models/create-location-response.md +++ b/doc/models/create-location-response.md @@ -1,7 +1,7 @@ # Create Location Response -Response object returned by the [CreateLocation](../../doc/apis/locations.md#create-location) endpoint. +The response object returned by the [CreateLocation](../../doc/apis/locations.md#create-location) endpoint. ## Structure @@ -11,8 +11,8 @@ Response object returned by the [CreateLocation](../../doc/apis/locations.md#cre | Name | Type | Tags | Description | Getter | Setter | | --- | --- | --- | --- | --- | --- | -| `errors` | [`?(Error[])`](../../doc/models/error.md) | Optional | Information on [errors](https://developer.squareup.com/docs/build-basics/handling-errors) encountered during the request. | getErrors(): ?array | setErrors(?array errors): void | -| `location` | [`?Location`](../../doc/models/location.md) | Optional | Represents one of a business's [locations](https://developer.squareup.com/docs/locations-api). | getLocation(): ?Location | setLocation(?Location location): void | +| `errors` | [`?(Error[])`](../../doc/models/error.md) | Optional | Information about [errors](https://developer.squareup.com/docs/build-basics/handling-errors) encountered during the request. | getErrors(): ?array | setErrors(?array errors): void | +| `location` | [`?Location`](../../doc/models/location.md) | Optional | Represents one of a business' [locations](https://developer.squareup.com/docs/locations-api). | getLocation(): ?Location | setLocation(?Location location): void | ## Example (as JSON) diff --git a/doc/models/create-terminal-checkout-request.md b/doc/models/create-terminal-checkout-request.md index dcd86a97..2f0be947 100644 --- a/doc/models/create-terminal-checkout-request.md +++ b/doc/models/create-terminal-checkout-request.md @@ -10,7 +10,7 @@ | Name | Type | Tags | Description | Getter | Setter | | --- | --- | --- | --- | --- | --- | | `idempotencyKey` | `string` | Required | A unique string that identifies this `CreateCheckout` request. Keys can be any valid string but
must be unique for every `CreateCheckout` request.

See [Idempotency keys](https://developer.squareup.com/docs/basics/api101/idempotency) for more information.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `64` | getIdempotencyKey(): string | setIdempotencyKey(string idempotencyKey): void | -| `checkout` | [`TerminalCheckout`](../../doc/models/terminal-checkout.md) | Required | - | getCheckout(): TerminalCheckout | setCheckout(TerminalCheckout checkout): void | +| `checkout` | [`TerminalCheckout`](../../doc/models/terminal-checkout.md) | Required | Represents a checkout processed by the Square Terminal. | getCheckout(): TerminalCheckout | setCheckout(TerminalCheckout checkout): void | ## Example (as JSON) diff --git a/doc/models/create-terminal-checkout-response.md b/doc/models/create-terminal-checkout-response.md index f835ed8f..374a0421 100644 --- a/doc/models/create-terminal-checkout-response.md +++ b/doc/models/create-terminal-checkout-response.md @@ -10,7 +10,7 @@ | Name | Type | Tags | Description | Getter | Setter | | --- | --- | --- | --- | --- | --- | | `errors` | [`?(Error[])`](../../doc/models/error.md) | Optional | Information about errors encountered during the request. | getErrors(): ?array | setErrors(?array errors): void | -| `checkout` | [`?TerminalCheckout`](../../doc/models/terminal-checkout.md) | Optional | - | getCheckout(): ?TerminalCheckout | setCheckout(?TerminalCheckout checkout): void | +| `checkout` | [`?TerminalCheckout`](../../doc/models/terminal-checkout.md) | Optional | Represents a checkout processed by the Square Terminal. | getCheckout(): ?TerminalCheckout | setCheckout(?TerminalCheckout checkout): void | ## Example (as JSON) diff --git a/doc/models/create-terminal-refund-request.md b/doc/models/create-terminal-refund-request.md index d31ac130..ea3b63b8 100644 --- a/doc/models/create-terminal-refund-request.md +++ b/doc/models/create-terminal-refund-request.md @@ -10,7 +10,7 @@ | Name | Type | Tags | Description | Getter | Setter | | --- | --- | --- | --- | --- | --- | | `idempotencyKey` | `string` | Required | A unique string that identifies this `CreateRefund` request. Keys can be any valid string but
must be unique for every `CreateRefund` request.

See [Idempotency keys](https://developer.squareup.com/docs/basics/api101/idempotency) for more information.
**Constraints**: *Minimum Length*: `1` | getIdempotencyKey(): string | setIdempotencyKey(string idempotencyKey): void | -| `refund` | [`?TerminalRefund`](../../doc/models/terminal-refund.md) | Optional | - | getRefund(): ?TerminalRefund | setRefund(?TerminalRefund refund): void | +| `refund` | [`?TerminalRefund`](../../doc/models/terminal-refund.md) | Optional | Represents a payment refund processed by the Square Terminal. Only supports Interac (Canadian debit network) payment refunds. | getRefund(): ?TerminalRefund | setRefund(?TerminalRefund refund): void | ## Example (as JSON) diff --git a/doc/models/create-terminal-refund-response.md b/doc/models/create-terminal-refund-response.md index 969d8531..e0a5050c 100644 --- a/doc/models/create-terminal-refund-response.md +++ b/doc/models/create-terminal-refund-response.md @@ -10,7 +10,7 @@ | Name | Type | Tags | Description | Getter | Setter | | --- | --- | --- | --- | --- | --- | | `errors` | [`?(Error[])`](../../doc/models/error.md) | Optional | Information about errors encountered during the request. | getErrors(): ?array | setErrors(?array errors): void | -| `refund` | [`?TerminalRefund`](../../doc/models/terminal-refund.md) | Optional | - | getRefund(): ?TerminalRefund | setRefund(?TerminalRefund refund): void | +| `refund` | [`?TerminalRefund`](../../doc/models/terminal-refund.md) | Optional | Represents a payment refund processed by the Square Terminal. Only supports Interac (Canadian debit network) payment refunds. | getRefund(): ?TerminalRefund | setRefund(?TerminalRefund refund): void | ## Example (as JSON) diff --git a/doc/models/create-vendor-request.md b/doc/models/create-vendor-request.md index 29f484d0..d9d8b74e 100644 --- a/doc/models/create-vendor-request.md +++ b/doc/models/create-vendor-request.md @@ -1,7 +1,7 @@ # Create Vendor Request -Represents an input to a call to [CreateVendor.](../../doc/apis/vendors.md#create-vendor) +Represents an input to a call to [CreateVendor](../../doc/apis/vendors.md#create-vendor). ## Structure diff --git a/doc/models/create-vendor-response.md b/doc/models/create-vendor-response.md index 148d3a55..8483328e 100644 --- a/doc/models/create-vendor-response.md +++ b/doc/models/create-vendor-response.md @@ -1,7 +1,7 @@ # Create Vendor Response -Represents an output from a call to [CreateVendor.](../../doc/apis/vendors.md#create-vendor) +Represents an output from a call to [CreateVendor](../../doc/apis/vendors.md#create-vendor). ## Structure @@ -21,19 +21,19 @@ Represents an output from a call to [CreateVendor.](../../doc/apis/vendors.md#cr "errors": [ { "category": "AUTHENTICATION_ERROR", - "code": "MISSING_PIN", + "code": "VERIFY_CVV_FAILURE", "detail": "detail1", "field": "field9" }, { "category": "INVALID_REQUEST_ERROR", - "code": "MISSING_ACCOUNT_TYPE", + "code": "VERIFY_AVS_FAILURE", "detail": "detail2", "field": "field0" }, { "category": "RATE_LIMIT_ERROR", - "code": "INVALID_POSTAL_CODE", + "code": "CARD_DECLINED_CALL_ISSUER", "detail": "detail3", "field": "field1" } diff --git a/doc/models/destination-type.md b/doc/models/destination-type.md new file mode 100644 index 00000000..5b913e26 --- /dev/null +++ b/doc/models/destination-type.md @@ -0,0 +1,18 @@ + +# Destination Type + +List of possible destinations against which a payout can be made. + +## Enumeration + +`DestinationType` + +## Fields + +| Name | Description | +| --- | --- | +| `BANK_ACCOUNT` | An external bank account outside of Square. | +| `CARD` | An external card outside of Square used for the transfer. | +| `SQUARE_BALANCE` | | +| `SQUARE_STORED_BALANCE` | Square Checking or Savings account (US), Square Card (CA), Square Current account (UK),
Square Compte Courant (FR), Cuenta Corriente Square (ES) | + diff --git a/doc/models/destination.md b/doc/models/destination.md new file mode 100644 index 00000000..3c5cb138 --- /dev/null +++ b/doc/models/destination.md @@ -0,0 +1,25 @@ + +# Destination + +Information about the destination against which the payout was made. + +## Structure + +`Destination` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `type` | [`?string (DestinationType)`](../../doc/models/destination-type.md) | Optional | List of possible destinations against which a payout can be made. | getType(): ?string | setType(?string type): void | +| `id` | `?string` | Optional | Square issued unique ID (also known as the instrument ID) associated with this destination. | getId(): ?string | setId(?string id): void | + +## Example (as JSON) + +```json +{ + "type": "SQUARE_BALANCE", + "id": "id0" +} +``` + diff --git a/doc/models/device-checkout-options.md b/doc/models/device-checkout-options.md index 38d78c8a..ba2de61a 100644 --- a/doc/models/device-checkout-options.md +++ b/doc/models/device-checkout-options.md @@ -11,6 +11,7 @@ | --- | --- | --- | --- | --- | --- | | `deviceId` | `string` | Required | The unique ID of the device intended for this `TerminalCheckout`.
A list of `DeviceCode` objects can be retrieved from the /v2/devices/codes endpoint.
Match a `DeviceCode.device_id` value with `device_id` to get the associated device code. | getDeviceId(): string | setDeviceId(string deviceId): void | | `skipReceiptScreen` | `?bool` | Optional | Instructs the device to skip the receipt screen. Defaults to false. | getSkipReceiptScreen(): ?bool | setSkipReceiptScreen(?bool skipReceiptScreen): void | +| `collectSignature` | `?bool` | Optional | Indicates that signature collection is desired during checkout. Defaults to false. | getCollectSignature(): ?bool | setCollectSignature(?bool collectSignature): void | | `tipSettings` | [`?TipSettings`](../../doc/models/tip-settings.md) | Optional | - | getTipSettings(): ?TipSettings | setTipSettings(?TipSettings tipSettings): void | ## Example (as JSON) @@ -19,6 +20,7 @@ { "device_id": "device_id6", "skip_receipt_screen": false, + "collect_signature": false, "tip_settings": { "allow_tipping": false, "separate_tip_screen": false, diff --git a/doc/models/error-code.md b/doc/models/error-code.md index 912ce195..eb3a01a3 100644 --- a/doc/models/error-code.md +++ b/doc/models/error-code.md @@ -133,6 +133,7 @@ Square API. | `CHIP_INSERTION_REQUIRED` | The card issuer requires that the card be read
using a chip reader. | | `ALLOWABLE_PIN_TRIES_EXCEEDED` | The card has exhausted its available pin entry
retries set by the card issuer. Resolving the error typically requires the
card holder to contact the card issuer. | | `RESERVATION_DECLINED` | The card issuer declined the refund. | +| `UNKNOWN_BODY_PARAMETER` | The body parameter is not recognized by the requested endpoint. | | `NOT_FOUND` | Not Found - a general error occurred. | | `APPLE_PAYMENT_PROCESSING_CERTIFICATE_HASH_NOT_FOUND` | Square could not find the associated Apple Pay certificate. | | `METHOD_NOT_ALLOWED` | Method Not Allowed - a general error occurred. | diff --git a/doc/models/error.md b/doc/models/error.md index a490c769..20616e94 100644 --- a/doc/models/error.md +++ b/doc/models/error.md @@ -23,7 +23,7 @@ See [Handling errors](https://developer.squareup.com/docs/build-basics/handling- ```json { "category": "RATE_LIMIT_ERROR", - "code": "INVALID_EXPIRATION_DATE", + "code": "ACCESS_TOKEN_EXPIRED", "detail": "detail6", "field": "field6" } diff --git a/doc/models/get-payout-response.md b/doc/models/get-payout-response.md new file mode 100644 index 00000000..eae77cc9 --- /dev/null +++ b/doc/models/get-payout-response.md @@ -0,0 +1,39 @@ + +# Get Payout Response + +## Structure + +`GetPayoutResponse` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `payout` | [`?Payout`](../../doc/models/payout.md) | Optional | An accounting of the amount owed the seller and record of the actual transfer to their
external bank account or to the Square balance. | getPayout(): ?Payout | setPayout(?Payout payout): void | +| `errors` | [`?(Error[])`](../../doc/models/error.md) | Optional | Information about errors encountered during the request. | getErrors(): ?array | setErrors(?array errors): void | + +## Example (as JSON) + +```json +{ + "payout": { + "amount_money": { + "amount": -103, + "currency_code": "USD" + }, + "arrival_date": "2022-03-24", + "created_at": "2022-03-24T03:07:09Z", + "destination": { + "id": "bact:ZPp3oedR3AeEUNd3z7", + "type": "BANK_ACCOUNT" + }, + "id": "po_f3c0fb38-a5ce-427d-b858-52b925b72e45", + "location_id": "L88917AVBK2S5", + "status": "PAID", + "type": "BATCH", + "updated_at": "2022-03-24T03:07:09Z", + "version": 1 + } +} +``` + diff --git a/doc/models/get-terminal-checkout-response.md b/doc/models/get-terminal-checkout-response.md index f582dece..9645e0f1 100644 --- a/doc/models/get-terminal-checkout-response.md +++ b/doc/models/get-terminal-checkout-response.md @@ -10,7 +10,7 @@ | Name | Type | Tags | Description | Getter | Setter | | --- | --- | --- | --- | --- | --- | | `errors` | [`?(Error[])`](../../doc/models/error.md) | Optional | Information about errors encountered during the request. | getErrors(): ?array | setErrors(?array errors): void | -| `checkout` | [`?TerminalCheckout`](../../doc/models/terminal-checkout.md) | Optional | - | getCheckout(): ?TerminalCheckout | setCheckout(?TerminalCheckout checkout): void | +| `checkout` | [`?TerminalCheckout`](../../doc/models/terminal-checkout.md) | Optional | Represents a checkout processed by the Square Terminal. | getCheckout(): ?TerminalCheckout | setCheckout(?TerminalCheckout checkout): void | ## Example (as JSON) diff --git a/doc/models/get-terminal-refund-response.md b/doc/models/get-terminal-refund-response.md index 60f8d864..fea8f2b7 100644 --- a/doc/models/get-terminal-refund-response.md +++ b/doc/models/get-terminal-refund-response.md @@ -10,7 +10,7 @@ | Name | Type | Tags | Description | Getter | Setter | | --- | --- | --- | --- | --- | --- | | `errors` | [`?(Error[])`](../../doc/models/error.md) | Optional | Information about errors encountered during the request. | getErrors(): ?array | setErrors(?array errors): void | -| `refund` | [`?TerminalRefund`](../../doc/models/terminal-refund.md) | Optional | - | getRefund(): ?TerminalRefund | setRefund(?TerminalRefund refund): void | +| `refund` | [`?TerminalRefund`](../../doc/models/terminal-refund.md) | Optional | Represents a payment refund processed by the Square Terminal. Only supports Interac (Canadian debit network) payment refunds. | getRefund(): ?TerminalRefund | setRefund(?TerminalRefund refund): void | ## Example (as JSON) diff --git a/doc/models/inventory-adjustment.md b/doc/models/inventory-adjustment.md index 09bb9aea..373f0c1e 100644 --- a/doc/models/inventory-adjustment.md +++ b/doc/models/inventory-adjustment.md @@ -26,8 +26,8 @@ particular time and location. | `source` | [`?SourceApplication`](../../doc/models/source-application.md) | Optional | Provides information about the application used to generate a change. | getSource(): ?SourceApplication | setSource(?SourceApplication source): void | | `employeeId` | `?string` | Optional | The Square-generated ID of the [Employee](../../doc/models/employee.md) responsible for the
inventory adjustment.
**Constraints**: *Maximum Length*: `100` | getEmployeeId(): ?string | setEmployeeId(?string employeeId): void | | `teamMemberId` | `?string` | Optional | The Square-generated ID of the [Team Member](../../doc/models/team-member.md) responsible for the
inventory adjustment.
**Constraints**: *Maximum Length*: `100` | getTeamMemberId(): ?string | setTeamMemberId(?string teamMemberId): void | -| `transactionId` | `?string` | Optional | The Square-generated ID of the [Transaction][#type-transaction] that
caused the adjustment. Only relevant for payment-related state
transitions.
**Constraints**: *Maximum Length*: `255` | getTransactionId(): ?string | setTransactionId(?string transactionId): void | -| `refundId` | `?string` | Optional | The Square-generated ID of the [Refund][#type-refund] that
caused the adjustment. Only relevant for refund-related state
transitions.
**Constraints**: *Maximum Length*: `255` | getRefundId(): ?string | setRefundId(?string refundId): void | +| `transactionId` | `?string` | Optional | The Square-generated ID of the [Transaction](../../doc/models/transaction.md) that
caused the adjustment. Only relevant for payment-related state
transitions.
**Constraints**: *Maximum Length*: `255` | getTransactionId(): ?string | setTransactionId(?string transactionId): void | +| `refundId` | `?string` | Optional | The Square-generated ID of the [Refund](../../doc/models/refund.md) that
caused the adjustment. Only relevant for refund-related state
transitions.
**Constraints**: *Maximum Length*: `255` | getRefundId(): ?string | setRefundId(?string refundId): void | | `purchaseOrderId` | `?string` | Optional | The Square-generated ID of the purchase order that caused the
adjustment. Only relevant for state transitions from the Square for Retail
app.
**Constraints**: *Maximum Length*: `100` | getPurchaseOrderId(): ?string | setPurchaseOrderId(?string purchaseOrderId): void | | `goodsReceiptId` | `?string` | Optional | The Square-generated ID of the goods receipt that caused the
adjustment. Only relevant for state transitions from the Square for Retail
app.
**Constraints**: *Maximum Length*: `100` | getGoodsReceiptId(): ?string | setGoodsReceiptId(?string goodsReceiptId): void | | `adjustmentGroup` | [`?InventoryAdjustmentGroup`](../../doc/models/inventory-adjustment-group.md) | Optional | - | getAdjustmentGroup(): ?InventoryAdjustmentGroup | setAdjustmentGroup(?InventoryAdjustmentGroup adjustmentGroup): void | diff --git a/doc/models/item-variation-location-overrides.md b/doc/models/item-variation-location-overrides.md index 50f2200a..a2ede11f 100644 --- a/doc/models/item-variation-location-overrides.md +++ b/doc/models/item-variation-location-overrides.md @@ -17,6 +17,8 @@ Price and inventory alerting overrides for a `CatalogItemVariation` at a specifi | `trackInventory` | `?bool` | Optional | If `true`, inventory tracking is active for the `CatalogItemVariation` at this `Location`. | getTrackInventory(): ?bool | setTrackInventory(?bool trackInventory): void | | `inventoryAlertType` | [`?string (InventoryAlertType)`](../../doc/models/inventory-alert-type.md) | Optional | Indicates whether Square should alert the merchant when the inventory quantity of a CatalogItemVariation is low. | getInventoryAlertType(): ?string | setInventoryAlertType(?string inventoryAlertType): void | | `inventoryAlertThreshold` | `?int` | Optional | If the inventory quantity for the variation is less than or equal to this value and `inventory_alert_type`
is `LOW_QUANTITY`, the variation displays an alert in the merchant dashboard.

This value is always an integer. | getInventoryAlertThreshold(): ?int | setInventoryAlertThreshold(?int inventoryAlertThreshold): void | +| `soldOut` | `?bool` | Optional | Indicates whether the overridden item variation is sold out at the specified location.

When inventory tracking is enabled on the item variation either globally or at the specified location,
the item variation is automatically marked as sold out when its inventory count reaches zero. The seller
can manually set the item variation as sold out even when the inventory count is greater than zero.
Attempts by an application to set this attribute are ignored. Regardless how the sold-out status is set,
applications should treat its inventory count as zero when this attribute value is `true`. | getSoldOut(): ?bool | setSoldOut(?bool soldOut): void | +| `soldOutValidUntil` | `?string` | Optional | The seller-assigned timestamp, of the RFC 3339 format, to indicate when this sold-out variation
becomes available again at the specified location. Attempts by an application to set this attribute are ignored.
When the current time is later than this attribute value, the affected item variation is no longer sold out. | getSoldOutValidUntil(): ?string | setSoldOutValidUntil(?string soldOutValidUntil): void | ## Example (as JSON) diff --git a/doc/models/list-employees-response.md b/doc/models/list-employees-response.md index 53e3afa2..2d8f3337 100644 --- a/doc/models/list-employees-response.md +++ b/doc/models/list-employees-response.md @@ -30,19 +30,19 @@ "errors": [ { "category": "AUTHENTICATION_ERROR", - "code": "MISSING_PIN", + "code": "VERIFY_CVV_FAILURE", "detail": "detail1", "field": "field9" }, { "category": "INVALID_REQUEST_ERROR", - "code": "MISSING_ACCOUNT_TYPE", + "code": "VERIFY_AVS_FAILURE", "detail": "detail2", "field": "field0" }, { "category": "RATE_LIMIT_ERROR", - "code": "INVALID_POSTAL_CODE", + "code": "CARD_DECLINED_CALL_ISSUER", "detail": "detail3", "field": "field1" } diff --git a/doc/models/list-locations-response.md b/doc/models/list-locations-response.md index dd33d838..dfa43f78 100644 --- a/doc/models/list-locations-response.md +++ b/doc/models/list-locations-response.md @@ -4,7 +4,7 @@ Defines the fields that are included in the response body of a request to the [ListLocations](../../doc/apis/locations.md#list-locations) endpoint. -One of `errors` or `locations` is present in a given response (never both). +Either `errors` or `locations` is present in a given response (never both). ## Structure diff --git a/doc/models/list-payout-entries-request.md b/doc/models/list-payout-entries-request.md new file mode 100644 index 00000000..e13e1201 --- /dev/null +++ b/doc/models/list-payout-entries-request.md @@ -0,0 +1,21 @@ + +# List Payout Entries Request + +## Structure + +`ListPayoutEntriesRequest` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `sortOrder` | [`?string (SortOrder)`](../../doc/models/sort-order.md) | Optional | The order (e.g., chronological or alphabetical) in which results from a request are returned. | getSortOrder(): ?string | setSortOrder(?string sortOrder): void | +| `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.
For more information, see [Pagination](https://developer.squareup.com/docs/basics/api101/pagination).
If request parameters change between requests, subsequent results may contain duplicates or missing records. | getCursor(): ?string | setCursor(?string cursor): void | +| `limit` | `?int` | Optional | The maximum number of results to be returned in a single page.
It is possible to receive fewer results than the specified limit on a given page.
The default value of 100 is also the maximum allowed value. If the provided value is
greater than 100, it is ignored and the default value is used instead.
Default: `100` | getLimit(): ?int | setLimit(?int limit): void | + +## Example (as JSON) + +```json +{} +``` + diff --git a/doc/models/list-payout-entries-response.md b/doc/models/list-payout-entries-response.md new file mode 100644 index 00000000..e6626451 --- /dev/null +++ b/doc/models/list-payout-entries-response.md @@ -0,0 +1,70 @@ + +# List Payout Entries Response + +The response to retrieve payout records entries. + +## Structure + +`ListPayoutEntriesResponse` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `payoutEntries` | [`?(PayoutEntry[])`](../../doc/models/payout-entry.md) | Optional | The requested list of payout entries, ordered with the given or default sort order. | getPayoutEntries(): ?array | setPayoutEntries(?array payoutEntries): void | +| `cursor` | `?string` | Optional | The pagination cursor to be used in a subsequent request. If empty, this is the final response.
For more information, see [Pagination](https://developer.squareup.com/docs/basics/api101/pagination). | getCursor(): ?string | setCursor(?string cursor): void | +| `errors` | [`?(Error[])`](../../doc/models/error.md) | Optional | Information about errors encountered during the request. | getErrors(): ?array | setErrors(?array errors): void | + +## Example (as JSON) + +```json +{ + "cursor": "TbfI80z98Xc2LdApCyZ2NvCYLpkPurYLR16GRIttpMJ55mrSIMzHgtkcRQdT0mOnTtfHO", + "payout_entries": [ + { + "effective_at": "2021-12-14T23:31:49Z", + "fee_amount_money": { + "amount": -2, + "currency_code": "USD" + }, + "gross_amount_money": { + "amount": -50, + "currency_code": "USD" + }, + "id": "poe_ZQWcw41d0SGJS6IWd4cSi8mKHk", + "net_amount_money": { + "amount": -48, + "currency_code": "USD" + }, + "payout_id": "po_4d28e6c4-7dd5-4de4-8ec9-a059277646a6", + "type": "REFUND", + "type_refund_details": { + "payment_id": "HVdG62HeMlti8YYf94oxrN", + "refund_id": "HVdG62HeMlti8YYf94oxrN_dR8Nztxg7umf94oxrN12Ji5r2KW14FAY" + } + }, + { + "effective_at": "2021-12-14T23:31:49Z", + "fee_amount_money": { + "amount": 19, + "currency_code": "USD" + }, + "gross_amount_money": { + "amount": 100, + "currency_code": "USD" + }, + "id": "poe_EibbY9Ob1d0SGJS6IWd4cSiSi6wkaPk", + "net_amount_money": { + "amount": 81, + "currency_code": "USD" + }, + "payout_id": "po_4d28e6c4-7dd5-4de4-8ec9-a059277646a6", + "type": "CHARGE", + "type_charge_details": { + "payment_id": "HVdG62H5K3291d0SGJS6IWd4cSi8YY" + } + } + ] +} +``` + diff --git a/doc/models/list-payouts-request.md b/doc/models/list-payouts-request.md new file mode 100644 index 00000000..42e2f93f --- /dev/null +++ b/doc/models/list-payouts-request.md @@ -0,0 +1,27 @@ + +# List Payouts Request + +A request to retrieve payout records. + +## Structure + +`ListPayoutsRequest` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `locationId` | `?string` | Optional | The ID of the location for which to list the payouts.
By default, payouts are returned for the default (main) location associated with the seller.
**Constraints**: *Maximum Length*: `255` | getLocationId(): ?string | setLocationId(?string locationId): void | +| `status` | [`?string (PayoutStatus)`](../../doc/models/payout-status.md) | Optional | Payout status types | getStatus(): ?string | setStatus(?string status): void | +| `beginTime` | `?string` | Optional | The timestamp for the beginning of the payout creation time, in RFC 3339 format.
Inclusive. Default: The current time minus one year. | getBeginTime(): ?string | setBeginTime(?string beginTime): void | +| `endTime` | `?string` | Optional | The timestamp for the end of the payout creation time, in RFC 3339 format.
Default: The current time. | getEndTime(): ?string | setEndTime(?string endTime): void | +| `sortOrder` | [`?string (SortOrder)`](../../doc/models/sort-order.md) | Optional | The order (e.g., chronological or alphabetical) in which results from a request are returned. | getSortOrder(): ?string | setSortOrder(?string sortOrder): void | +| `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.
For more information, see [Pagination](https://developer.squareup.com/docs/basics/api101/pagination).
If request parameters change between requests, subsequent results may contain duplicates or missing records. | getCursor(): ?string | setCursor(?string cursor): void | +| `limit` | `?int` | Optional | The maximum number of results to be returned in a single page.
It is possible to receive fewer results than the specified limit on a given page.
The default value of 100 is also the maximum allowed value. If the provided value is
greater than 100, it is ignored and the default value is used instead.
Default: `100` | getLimit(): ?int | setLimit(?int limit): void | + +## Example (as JSON) + +```json +{} +``` + diff --git a/doc/models/list-payouts-response.md b/doc/models/list-payouts-response.md new file mode 100644 index 00000000..013929b4 --- /dev/null +++ b/doc/models/list-payouts-response.md @@ -0,0 +1,73 @@ + +# List Payouts Response + +The response to retrieve payout records entries. + +## Structure + +`ListPayoutsResponse` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `payouts` | [`?(Payout[])`](../../doc/models/payout.md) | Optional | The requested list of payouts. | getPayouts(): ?array | setPayouts(?array payouts): void | +| `cursor` | `?string` | Optional | The pagination cursor to be used in a subsequent request. If empty, this is the final response.
For more information, see [Pagination](https://developer.squareup.com/docs/basics/api101/pagination). | getCursor(): ?string | setCursor(?string cursor): void | +| `errors` | [`?(Error[])`](../../doc/models/error.md) | Optional | Information about errors encountered during the request. | getErrors(): ?array | setErrors(?array errors): void | + +## Example (as JSON) + +```json +{ + "cursor": "EMPCyStibo64hS8wLayZPp3oedR3AeEUNd3z7u6zphi72LQZFIEMbkKVvot9eefpU", + "payouts": [ + { + "amount_money": { + "amount": 6259, + "currency_code": "USD" + }, + "arrival_date": "2022-03-29", + "created_at": "2022-03-29T16:12:31Z", + "destination": { + "id": "ccof:ZPp3oedR3AeEUNd3z7", + "type": "CARD" + }, + "id": "po_b345d2c7-90b3-4f0b-a2aa-df1def7f8afc", + "location_id": "L88917AVBK2S5", + "payout_fee": [ + { + "amount_money": { + "amount": 95, + "currency_code": "USD" + }, + "effective_at": "2022-03-29T16:12:31Z", + "type": "TRANSFER_FEE" + } + ], + "status": "PAID", + "type": "BATCH", + "updated_at": "2022-03-30T01:07:22.875Z", + "version": 2 + }, + { + "amount_money": { + "amount": -103, + "currency_code": "USD" + }, + "arrival_date": "2022-03-24", + "created_at": "2022-03-24T03:07:09Z", + "destination": { + "id": "bact:ZPp3oedR3AeEUNd3z7", + "type": "BANK_ACCOUNT" + }, + "id": "po_f3c0fb38-a5ce-427d-b858-52b925b72e45", + "location_id": "L88917AVBK2S5", + "status": "PAID", + "type": "BATCH", + "updated_at": "2022-03-24T03:07:09Z", + "version": 1 + } + ] +} +``` + diff --git a/doc/models/list-subscription-events-response.md b/doc/models/list-subscription-events-response.md index c040c90f..09e3cd0c 100644 --- a/doc/models/list-subscription-events-response.md +++ b/doc/models/list-subscription-events-response.md @@ -27,6 +27,34 @@ Defines output parameters in a response from the "plan_id": "6JHXF3B2CW3YKHDV4XEM674H", "subscription_event_type": "START_SUBSCRIPTION" }, + { + "effective_date": "2020-05-01", + "id": "f2736603-cd2e-47ec-8675-f815fff54f88", + "info": { + "code": "CUSTOMER_NO_NAME", + "detail": "The customer with ID `V74BMG0GPS2KNCWJE1BTYJ37Y0` does not have a name on record." + }, + "plan_id": "6JHXF3B2CW3YKHDV4XEM674H", + "subscription_event_type": "DEACTIVATE_SUBSCRIPTION" + }, + { + "effective_date": "2022-05-01", + "id": "b426fc85-6859-450b-b0d0-fe3a5d1b565f", + "plan_id": "6JHXF3B2CW3YKHDV4XEM674H", + "subscription_event_type": "RESUME_SUBSCRIPTION" + }, + { + "effective_date": "2022-05-02", + "id": "09f14de1-2f53-4dae-9091-49aa53f83d01", + "plan_id": "6JHXF3B2CW3YKHDV4XEM674H", + "subscription_event_type": "PAUSE_SUBSCRIPTION" + }, + { + "effective_date": "2020-05-02", + "id": "f28a73ac-1a1b-4b0f-8eeb-709a72945776", + "plan_id": "6JHXF3B2CW3YKHDV4XEM674H", + "subscription_event_type": "RESUME_SUBSCRIPTION" + }, { "effective_date": "2020-05-06", "id": "a0c08083-5db0-4800-85c7-d398de4fbb6e", diff --git a/doc/models/location-capability.md b/doc/models/location-capability.md index 57be5a63..7ddc7b1b 100644 --- a/doc/models/location-capability.md +++ b/doc/models/location-capability.md @@ -1,7 +1,7 @@ # Location Capability -The capabilities a location may have. +The capabilities a location might have. ## Enumeration diff --git a/doc/models/location.md b/doc/models/location.md index 33aee121..aa98ecee 100644 --- a/doc/models/location.md +++ b/doc/models/location.md @@ -1,7 +1,7 @@ # Location -Represents one of a business's [locations](https://developer.squareup.com/docs/locations-api). +Represents one of a business' [locations](https://developer.squareup.com/docs/locations-api). ## Structure @@ -11,10 +11,10 @@ Represents one of a business's [locations](https://developer.squareup.com/docs/l | Name | Type | Tags | Description | Getter | Setter | | --- | --- | --- | --- | --- | --- | -| `id` | `?string` | Optional | A short, generated string of letters and numbers that uniquely identifies this location instance.
**Constraints**: *Maximum Length*: `32` | getId(): ?string | setId(?string id): void | -| `name` | `?string` | Optional | The name of the location.
This information appears in the dashboard as the nickname.
A location name must be unique within a seller account.
**Constraints**: *Maximum Length*: `255` | getName(): ?string | setName(?string name): void | +| `id` | `?string` | Optional | A short generated string of letters and numbers that uniquely identifies this location instance.
**Constraints**: *Maximum Length*: `32` | getId(): ?string | setId(?string id): void | +| `name` | `?string` | Optional | The name of the location.
This information appears in the Seller Dashboard as the nickname.
A location name must be unique within a seller account.
**Constraints**: *Maximum Length*: `255` | getName(): ?string | setName(?string name): 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 | -| `timezone` | `?string` | Optional | The [IANA Timezone](https://www.iana.org/time-zones) identifier for
the timezone of the location. For example, `America/Los_Angeles`.
**Constraints**: *Maximum Length*: `30` | getTimezone(): ?string | setTimezone(?string timezone): void | +| `timezone` | `?string` | Optional | The [IANA time zone](https://www.iana.org/time-zones) identifier for
the time zone of the location. For example, `America/Los_Angeles`.
**Constraints**: *Maximum Length*: `30` | getTimezone(): ?string | setTimezone(?string timezone): void | | `capabilities` | [`?(string[]) (LocationCapability)`](../../doc/models/location-capability.md) | Optional | The Square features that are enabled for the location.
See [LocationCapability](../../doc/models/location-capability.md) for possible values.
See [LocationCapability](#type-locationcapability) for possible values | getCapabilities(): ?array | setCapabilities(?array capabilities): void | | `status` | [`?string (LocationStatus)`](../../doc/models/location-status.md) | Optional | A location's status. | getStatus(): ?string | setStatus(?string status): void | | `createdAt` | `?string` | Optional | The time when the location was created, in RFC 3339 format.
For more information, see [Working with Dates](https://developer.squareup.com/docs/build-basics/working-with-dates).
**Constraints**: *Minimum Length*: `20`, *Maximum Length*: `25` | getCreatedAt(): ?string | setCreatedAt(?string createdAt): void | @@ -27,16 +27,16 @@ Represents one of a business's [locations](https://developer.squareup.com/docs/l | `type` | [`?string (LocationType)`](../../doc/models/location-type.md) | Optional | A location's type. | getType(): ?string | setType(?string type): void | | `websiteUrl` | `?string` | Optional | The website URL of the location. For example, `https://squareup.com`.
**Constraints**: *Maximum Length*: `255` | getWebsiteUrl(): ?string | setWebsiteUrl(?string websiteUrl): void | | `businessHours` | [`?BusinessHours`](../../doc/models/business-hours.md) | Optional | The hours of operation for a location. | getBusinessHours(): ?BusinessHours | setBusinessHours(?BusinessHours businessHours): void | -| `businessEmail` | `?string` | Optional | The email address of the location. This can be unique to the location, and is not always the email address for the business owner or admin.
**Constraints**: *Maximum Length*: `255` | getBusinessEmail(): ?string | setBusinessEmail(?string businessEmail): void | +| `businessEmail` | `?string` | Optional | The email address of the location. This can be unique to the location and is not always the email address for the business owner or administrator.
**Constraints**: *Maximum Length*: `255` | getBusinessEmail(): ?string | setBusinessEmail(?string businessEmail): void | | `description` | `?string` | Optional | The description of the location. For example, `Main Street location`.
**Constraints**: *Maximum Length*: `1024` | getDescription(): ?string | setDescription(?string description): void | | `twitterUsername` | `?string` | Optional | The Twitter username of the location without the '@' symbol. For example, `Square`.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `15` | getTwitterUsername(): ?string | setTwitterUsername(?string twitterUsername): void | | `instagramUsername` | `?string` | Optional | The Instagram username of the location without the '@' symbol. For example, `square`.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `30` | getInstagramUsername(): ?string | setInstagramUsername(?string instagramUsername): void | | `facebookUrl` | `?string` | Optional | The Facebook profile URL of the location. The URL should begin with 'facebook.com/'. For example, `https://www.facebook.com/square`.
**Constraints**: *Maximum Length*: `255` | getFacebookUrl(): ?string | setFacebookUrl(?string facebookUrl): void | | `coordinates` | [`?Coordinates`](../../doc/models/coordinates.md) | Optional | Latitude and longitude coordinates. | getCoordinates(): ?Coordinates | setCoordinates(?Coordinates coordinates): void | -| `logoUrl` | `?string` | Optional | The URL of the logo image for the location. When configured in the Seller
dashboard (Receipts section), the logo appears on transactions (such as receipts and invoices)
that Square generates on behalf of the Seller. This image should have a roughly square (1:1) aspect ratio
and is recommended to be at least 200x200 pixels.
**Constraints**: *Maximum Length*: `255` | getLogoUrl(): ?string | setLogoUrl(?string logoUrl): void | +| `logoUrl` | `?string` | Optional | The URL of the logo image for the location. When configured in the Seller
Dashboard (Receipts section), the logo appears on transactions (such as receipts and invoices) that Square generates on behalf of the seller.
This image should have a roughly square (1:1) aspect ratio and should be at least 200x200 pixels.
**Constraints**: *Maximum Length*: `255` | getLogoUrl(): ?string | setLogoUrl(?string logoUrl): void | | `posBackgroundUrl` | `?string` | Optional | The URL of the Point of Sale background image for the location.
**Constraints**: *Maximum Length*: `255` | getPosBackgroundUrl(): ?string | setPosBackgroundUrl(?string posBackgroundUrl): void | | `mcc` | `?string` | Optional | A four-digit number that describes the kind of goods or services sold at the location.
The [merchant category code (MCC)](https://developer.squareup.com/docs/locations-api#initialize-a-merchant-category-code) of the location as standardized by ISO 18245.
For example, `5045`, for a location that sells computer goods and software.
**Constraints**: *Minimum Length*: `4`, *Maximum Length*: `4` | getMcc(): ?string | setMcc(?string mcc): void | -| `fullFormatLogoUrl` | `?string` | Optional | The URL of a full-format logo image for the location. When configured in the Seller
dashboard (Receipts section), the logo appears on transactions (such as receipts and invoices)
that Square generates on behalf of the Seller. This image can be wider than it is tall,
and is recommended to be at least 1280x648 pixels. | getFullFormatLogoUrl(): ?string | setFullFormatLogoUrl(?string fullFormatLogoUrl): void | +| `fullFormatLogoUrl` | `?string` | Optional | The URL of a full-format logo image for the location. When configured in the Seller
Dashboard (Receipts section), the logo appears on transactions (such as receipts and invoices) that Square generates on behalf of the seller.
This image can be wider than it is tall and should be at least 1280x648 pixels. | getFullFormatLogoUrl(): ?string | setFullFormatLogoUrl(?string fullFormatLogoUrl): void | | `taxIds` | [`?TaxIds`](../../doc/models/tax-ids.md) | Optional | Identifiers for the location used by various governments for tax purposes. | getTaxIds(): ?TaxIds | setTaxIds(?TaxIds taxIds): void | ## Example (as JSON) diff --git a/doc/models/order-line-item-modifier.md b/doc/models/order-line-item-modifier.md index 54268ac4..090d73b4 100644 --- a/doc/models/order-line-item-modifier.md +++ b/doc/models/order-line-item-modifier.md @@ -15,6 +15,7 @@ A [CatalogModifier](../../doc/models/catalog-modifier.md). | `catalogObjectId` | `?string` | Optional | The catalog object ID referencing [CatalogModifier](../../doc/models/catalog-modifier.md).
**Constraints**: *Maximum Length*: `192` | getCatalogObjectId(): ?string | setCatalogObjectId(?string catalogObjectId): void | | `catalogVersion` | `?int` | Optional | The version of the catalog object that this modifier references. | getCatalogVersion(): ?int | setCatalogVersion(?int catalogVersion): void | | `name` | `?string` | Optional | The name of the item modifier.
**Constraints**: *Maximum Length*: `255` | getName(): ?string | setName(?string name): void | +| `quantity` | `?string` | Optional | The quantity of the line item modifier. The modifier quantity can be 0 or more.
For example, suppose a restaurant offers a cheeseburger on the menu. When a buyer orders
this item, the restaurant records the purchase by creating an `Order` object with a line item
for a burger. The line item includes a line item modifier: the name is cheese and the quantity
is 1. The buyer has the option to order extra cheese (or no cheese). If the buyer chooses
the extra cheese option, the modifier quantity increases to 2. If the buyer does not want
any cheese, the modifier quantity is set to 0. | getQuantity(): ?string | setQuantity(?string quantity): void | | `basePriceMoney` | [`?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. | getBasePriceMoney(): ?Money | setBasePriceMoney(?Money basePriceMoney): void | | `totalPriceMoney` | [`?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. | getTotalPriceMoney(): ?Money | setTotalPriceMoney(?Money totalPriceMoney): void | | `metadata` | `?array` | Optional | Application-defined data attached to this order. Metadata fields are intended
to store descriptive references or associations with an entity in another system or store brief
information about the object. Square does not process this field; it only stores and returns it
in relevant API calls. Do not use metadata to store any sensitive information (such as personally
identifiable information or card details).

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

Values have a maximum length of 255 characters.

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

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

For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata). | getMetadata(): ?array | setMetadata(?array metadata): void | @@ -27,10 +28,7 @@ A [CatalogModifier](../../doc/models/catalog-modifier.md). "catalog_object_id": "catalog_object_id6", "catalog_version": 126, "name": "name0", - "base_price_money": { - "amount": 114, - "currency": "ALL" - } + "quantity": "quantity6" } ``` diff --git a/doc/models/payment-balance-activity-automatic-savings-detail.md b/doc/models/payment-balance-activity-automatic-savings-detail.md new file mode 100644 index 00000000..ed72214d --- /dev/null +++ b/doc/models/payment-balance-activity-automatic-savings-detail.md @@ -0,0 +1,23 @@ + +# Payment Balance Activity Automatic Savings Detail + +## Structure + +`PaymentBalanceActivityAutomaticSavingsDetail` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `paymentId` | `?string` | Optional | The ID of the payment associated with this activity. | getPaymentId(): ?string | setPaymentId(?string paymentId): void | +| `payoutId` | `?string` | Optional | The ID of the payout associated with this activity. | getPayoutId(): ?string | setPayoutId(?string payoutId): void | + +## Example (as JSON) + +```json +{ + "payment_id": "payment_id0", + "payout_id": "payout_id6" +} +``` + diff --git a/doc/models/payment-balance-activity-automatic-savings-reversed-detail.md b/doc/models/payment-balance-activity-automatic-savings-reversed-detail.md new file mode 100644 index 00000000..2f42b446 --- /dev/null +++ b/doc/models/payment-balance-activity-automatic-savings-reversed-detail.md @@ -0,0 +1,23 @@ + +# Payment Balance Activity Automatic Savings Reversed Detail + +## Structure + +`PaymentBalanceActivityAutomaticSavingsReversedDetail` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `paymentId` | `?string` | Optional | The ID of the payment associated with this activity. | getPaymentId(): ?string | setPaymentId(?string paymentId): void | +| `payoutId` | `?string` | Optional | The ID of the payout associated with this activity. | getPayoutId(): ?string | setPayoutId(?string payoutId): void | + +## Example (as JSON) + +```json +{ + "payment_id": "payment_id0", + "payout_id": "payout_id6" +} +``` + diff --git a/doc/models/payment-balance-activity-charge-detail.md b/doc/models/payment-balance-activity-charge-detail.md new file mode 100644 index 00000000..e2a79f5d --- /dev/null +++ b/doc/models/payment-balance-activity-charge-detail.md @@ -0,0 +1,23 @@ + +# Payment Balance Activity Charge Detail + +DESCRIPTION OF PaymentBalanceActivityChargeDetail + +## Structure + +`PaymentBalanceActivityChargeDetail` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `paymentId` | `?string` | Optional | The ID of the payment associated with this activity. | getPaymentId(): ?string | setPaymentId(?string paymentId): void | + +## Example (as JSON) + +```json +{ + "payment_id": "payment_id0" +} +``` + diff --git a/doc/models/payment-balance-activity-deposit-fee-detail.md b/doc/models/payment-balance-activity-deposit-fee-detail.md new file mode 100644 index 00000000..022b7bc7 --- /dev/null +++ b/doc/models/payment-balance-activity-deposit-fee-detail.md @@ -0,0 +1,21 @@ + +# Payment Balance Activity Deposit Fee Detail + +## Structure + +`PaymentBalanceActivityDepositFeeDetail` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `payoutId` | `?string` | Optional | The ID of the payout that triggered this deposit fee activity. | getPayoutId(): ?string | setPayoutId(?string payoutId): void | + +## Example (as JSON) + +```json +{ + "payout_id": "payout_id6" +} +``` + diff --git a/doc/models/payment-balance-activity-dispute-detail.md b/doc/models/payment-balance-activity-dispute-detail.md new file mode 100644 index 00000000..2511d3e4 --- /dev/null +++ b/doc/models/payment-balance-activity-dispute-detail.md @@ -0,0 +1,23 @@ + +# Payment Balance Activity Dispute Detail + +## Structure + +`PaymentBalanceActivityDisputeDetail` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `paymentId` | `?string` | Optional | The ID of the payment associated with this activity. | getPaymentId(): ?string | setPaymentId(?string paymentId): void | +| `disputeId` | `?string` | Optional | The ID of the dispute associated with this activity. | getDisputeId(): ?string | setDisputeId(?string disputeId): void | + +## Example (as JSON) + +```json +{ + "payment_id": "payment_id0", + "dispute_id": "dispute_id2" +} +``` + diff --git a/doc/models/payment-balance-activity-fee-detail.md b/doc/models/payment-balance-activity-fee-detail.md new file mode 100644 index 00000000..2dc42760 --- /dev/null +++ b/doc/models/payment-balance-activity-fee-detail.md @@ -0,0 +1,21 @@ + +# Payment Balance Activity Fee Detail + +## Structure + +`PaymentBalanceActivityFeeDetail` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `paymentId` | `?string` | Optional | The ID of the payment associated with this activity. | getPaymentId(): ?string | setPaymentId(?string paymentId): void | + +## Example (as JSON) + +```json +{ + "payment_id": "payment_id0" +} +``` + diff --git a/doc/models/payment-balance-activity-free-processing-detail.md b/doc/models/payment-balance-activity-free-processing-detail.md new file mode 100644 index 00000000..ecfdac1d --- /dev/null +++ b/doc/models/payment-balance-activity-free-processing-detail.md @@ -0,0 +1,21 @@ + +# Payment Balance Activity Free Processing Detail + +## Structure + +`PaymentBalanceActivityFreeProcessingDetail` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `paymentId` | `?string` | Optional | The ID of the payment associated with this activity. | getPaymentId(): ?string | setPaymentId(?string paymentId): void | + +## Example (as JSON) + +```json +{ + "payment_id": "payment_id0" +} +``` + diff --git a/doc/models/payment-balance-activity-hold-adjustment-detail.md b/doc/models/payment-balance-activity-hold-adjustment-detail.md new file mode 100644 index 00000000..3b1f65d3 --- /dev/null +++ b/doc/models/payment-balance-activity-hold-adjustment-detail.md @@ -0,0 +1,21 @@ + +# Payment Balance Activity Hold Adjustment Detail + +## Structure + +`PaymentBalanceActivityHoldAdjustmentDetail` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `paymentId` | `?string` | Optional | The ID of the payment associated with this activity. | getPaymentId(): ?string | setPaymentId(?string paymentId): void | + +## Example (as JSON) + +```json +{ + "payment_id": "payment_id0" +} +``` + diff --git a/doc/models/payment-balance-activity-open-dispute-detail.md b/doc/models/payment-balance-activity-open-dispute-detail.md new file mode 100644 index 00000000..0f9ac852 --- /dev/null +++ b/doc/models/payment-balance-activity-open-dispute-detail.md @@ -0,0 +1,23 @@ + +# Payment Balance Activity Open Dispute Detail + +## Structure + +`PaymentBalanceActivityOpenDisputeDetail` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `paymentId` | `?string` | Optional | The ID of the payment associated with this activity. | getPaymentId(): ?string | setPaymentId(?string paymentId): void | +| `disputeId` | `?string` | Optional | The ID of the dispute associated with this activity. | getDisputeId(): ?string | setDisputeId(?string disputeId): void | + +## Example (as JSON) + +```json +{ + "payment_id": "payment_id0", + "dispute_id": "dispute_id2" +} +``` + diff --git a/doc/models/payment-balance-activity-other-adjustment-detail.md b/doc/models/payment-balance-activity-other-adjustment-detail.md new file mode 100644 index 00000000..cf8bb021 --- /dev/null +++ b/doc/models/payment-balance-activity-other-adjustment-detail.md @@ -0,0 +1,21 @@ + +# Payment Balance Activity Other Adjustment Detail + +## Structure + +`PaymentBalanceActivityOtherAdjustmentDetail` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `paymentId` | `?string` | Optional | The ID of the payment associated with this activity. | getPaymentId(): ?string | setPaymentId(?string paymentId): void | + +## Example (as JSON) + +```json +{ + "payment_id": "payment_id0" +} +``` + diff --git a/doc/models/payment-balance-activity-other-detail.md b/doc/models/payment-balance-activity-other-detail.md new file mode 100644 index 00000000..cdb5a651 --- /dev/null +++ b/doc/models/payment-balance-activity-other-detail.md @@ -0,0 +1,21 @@ + +# Payment Balance Activity Other Detail + +## Structure + +`PaymentBalanceActivityOtherDetail` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `paymentId` | `?string` | Optional | The ID of the payment associated with this activity. | getPaymentId(): ?string | setPaymentId(?string paymentId): void | + +## Example (as JSON) + +```json +{ + "payment_id": "payment_id0" +} +``` + diff --git a/doc/models/payment-balance-activity-refund-detail.md b/doc/models/payment-balance-activity-refund-detail.md new file mode 100644 index 00000000..1c018e20 --- /dev/null +++ b/doc/models/payment-balance-activity-refund-detail.md @@ -0,0 +1,23 @@ + +# Payment Balance Activity Refund Detail + +## Structure + +`PaymentBalanceActivityRefundDetail` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `paymentId` | `?string` | Optional | The ID of the payment associated with this activity. | getPaymentId(): ?string | setPaymentId(?string paymentId): void | +| `refundId` | `?string` | Optional | The ID of the refund associated with this activity. | getRefundId(): ?string | setRefundId(?string refundId): void | + +## Example (as JSON) + +```json +{ + "payment_id": "payment_id0", + "refund_id": "refund_id4" +} +``` + diff --git a/doc/models/payment-balance-activity-release-adjustment-detail.md b/doc/models/payment-balance-activity-release-adjustment-detail.md new file mode 100644 index 00000000..7c8d31d2 --- /dev/null +++ b/doc/models/payment-balance-activity-release-adjustment-detail.md @@ -0,0 +1,21 @@ + +# Payment Balance Activity Release Adjustment Detail + +## Structure + +`PaymentBalanceActivityReleaseAdjustmentDetail` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `paymentId` | `?string` | Optional | The ID of the payment associated with this activity. | getPaymentId(): ?string | setPaymentId(?string paymentId): void | + +## Example (as JSON) + +```json +{ + "payment_id": "payment_id0" +} +``` + diff --git a/doc/models/payment-balance-activity-reserve-hold-detail.md b/doc/models/payment-balance-activity-reserve-hold-detail.md new file mode 100644 index 00000000..dcce145e --- /dev/null +++ b/doc/models/payment-balance-activity-reserve-hold-detail.md @@ -0,0 +1,21 @@ + +# Payment Balance Activity Reserve Hold Detail + +## Structure + +`PaymentBalanceActivityReserveHoldDetail` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `paymentId` | `?string` | Optional | The ID of the payment associated with this activity. | getPaymentId(): ?string | setPaymentId(?string paymentId): void | + +## Example (as JSON) + +```json +{ + "payment_id": "payment_id0" +} +``` + diff --git a/doc/models/payment-balance-activity-reserve-release-detail.md b/doc/models/payment-balance-activity-reserve-release-detail.md new file mode 100644 index 00000000..208006b5 --- /dev/null +++ b/doc/models/payment-balance-activity-reserve-release-detail.md @@ -0,0 +1,21 @@ + +# Payment Balance Activity Reserve Release Detail + +## Structure + +`PaymentBalanceActivityReserveReleaseDetail` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `paymentId` | `?string` | Optional | The ID of the payment associated with this activity. | getPaymentId(): ?string | setPaymentId(?string paymentId): void | + +## Example (as JSON) + +```json +{ + "payment_id": "payment_id0" +} +``` + diff --git a/doc/models/payment-balance-activity-square-capital-payment-detail.md b/doc/models/payment-balance-activity-square-capital-payment-detail.md new file mode 100644 index 00000000..204df46d --- /dev/null +++ b/doc/models/payment-balance-activity-square-capital-payment-detail.md @@ -0,0 +1,21 @@ + +# Payment Balance Activity Square Capital Payment Detail + +## Structure + +`PaymentBalanceActivitySquareCapitalPaymentDetail` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `paymentId` | `?string` | Optional | The ID of the payment associated with this activity. | getPaymentId(): ?string | setPaymentId(?string paymentId): void | + +## Example (as JSON) + +```json +{ + "payment_id": "payment_id0" +} +``` + diff --git a/doc/models/payment-balance-activity-square-capital-reversed-payment-detail.md b/doc/models/payment-balance-activity-square-capital-reversed-payment-detail.md new file mode 100644 index 00000000..5d7224de --- /dev/null +++ b/doc/models/payment-balance-activity-square-capital-reversed-payment-detail.md @@ -0,0 +1,21 @@ + +# Payment Balance Activity Square Capital Reversed Payment Detail + +## Structure + +`PaymentBalanceActivitySquareCapitalReversedPaymentDetail` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `paymentId` | `?string` | Optional | The ID of the payment associated with this activity. | getPaymentId(): ?string | setPaymentId(?string paymentId): void | + +## Example (as JSON) + +```json +{ + "payment_id": "payment_id0" +} +``` + diff --git a/doc/models/payment-balance-activity-tax-on-fee-detail.md b/doc/models/payment-balance-activity-tax-on-fee-detail.md new file mode 100644 index 00000000..c37f38fa --- /dev/null +++ b/doc/models/payment-balance-activity-tax-on-fee-detail.md @@ -0,0 +1,21 @@ + +# Payment Balance Activity Tax on Fee Detail + +## Structure + +`PaymentBalanceActivityTaxOnFeeDetail` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `paymentId` | `?string` | Optional | The ID of the payment associated with this activity. | getPaymentId(): ?string | setPaymentId(?string paymentId): void | + +## Example (as JSON) + +```json +{ + "payment_id": "payment_id0" +} +``` + diff --git a/doc/models/payment-balance-activity-third-party-fee-detail.md b/doc/models/payment-balance-activity-third-party-fee-detail.md new file mode 100644 index 00000000..dfcb21c6 --- /dev/null +++ b/doc/models/payment-balance-activity-third-party-fee-detail.md @@ -0,0 +1,21 @@ + +# Payment Balance Activity Third Party Fee Detail + +## Structure + +`PaymentBalanceActivityThirdPartyFeeDetail` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `paymentId` | `?string` | Optional | The ID of the payment associated with this activity. | getPaymentId(): ?string | setPaymentId(?string paymentId): void | + +## Example (as JSON) + +```json +{ + "payment_id": "payment_id0" +} +``` + diff --git a/doc/models/payment-balance-activity-third-party-fee-refund-detail.md b/doc/models/payment-balance-activity-third-party-fee-refund-detail.md new file mode 100644 index 00000000..d04a927e --- /dev/null +++ b/doc/models/payment-balance-activity-third-party-fee-refund-detail.md @@ -0,0 +1,21 @@ + +# Payment Balance Activity Third Party Fee Refund Detail + +## Structure + +`PaymentBalanceActivityThirdPartyFeeRefundDetail` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `paymentId` | `?string` | Optional | The ID of the payment associated with this activity. | getPaymentId(): ?string | setPaymentId(?string paymentId): void | + +## Example (as JSON) + +```json +{ + "payment_id": "payment_id0" +} +``` + diff --git a/doc/models/payment-options.md b/doc/models/payment-options.md deleted file mode 100644 index 199cfdee..00000000 --- a/doc/models/payment-options.md +++ /dev/null @@ -1,21 +0,0 @@ - -# Payment Options - -## Structure - -`PaymentOptions` - -## Fields - -| Name | Type | Tags | Description | Getter | Setter | -| --- | --- | --- | --- | --- | --- | -| `autocomplete` | `?bool` | Optional | Indicates whether the `Payment` objects created from this `TerminalCheckout` are automatically
`COMPLETED` or left in an `APPROVED` state for later modification. | getAutocomplete(): ?bool | setAutocomplete(?bool autocomplete): void | - -## Example (as JSON) - -```json -{ - "autocomplete": false -} -``` - diff --git a/doc/models/payout-entry.md b/doc/models/payout-entry.md new file mode 100644 index 00000000..9c537d5c --- /dev/null +++ b/doc/models/payout-entry.md @@ -0,0 +1,65 @@ + +# Payout Entry + +One or more PayoutEntries that make up a Payout. Each one has a date, amount, and type of activity. +The total amount of the payout will equal the sum of the payout entries for a batch payout + +## Structure + +`PayoutEntry` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `id` | `string` | Required | A unique ID for the payout entry.
**Constraints**: *Minimum Length*: `1` | getId(): string | setId(string id): void | +| `payoutId` | `string` | Required | The ID of the payout entries’ associated payout.
**Constraints**: *Minimum Length*: `1` | getPayoutId(): string | setPayoutId(string payoutId): void | +| `effectiveAt` | `?string` | Optional | The timestamp of when the payout entry affected the balance, in RFC 3339 format. | getEffectiveAt(): ?string | setEffectiveAt(?string effectiveAt): void | +| `type` | [`?string (ActivityType)`](../../doc/models/activity-type.md) | Optional | - | getType(): ?string | setType(?string type): void | +| `grossAmountMoney` | [`?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. | getGrossAmountMoney(): ?Money | setGrossAmountMoney(?Money grossAmountMoney): void | +| `feeAmountMoney` | [`?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. | getFeeAmountMoney(): ?Money | setFeeAmountMoney(?Money feeAmountMoney): void | +| `netAmountMoney` | [`?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. | getNetAmountMoney(): ?Money | setNetAmountMoney(?Money netAmountMoney): void | +| `typeAutomaticSavingsDetails` | [`?PaymentBalanceActivityAutomaticSavingsDetail`](../../doc/models/payment-balance-activity-automatic-savings-detail.md) | Optional | - | getTypeAutomaticSavingsDetails(): ?PaymentBalanceActivityAutomaticSavingsDetail | setTypeAutomaticSavingsDetails(?PaymentBalanceActivityAutomaticSavingsDetail typeAutomaticSavingsDetails): void | +| `typeAutomaticSavingsReversedDetails` | [`?PaymentBalanceActivityAutomaticSavingsReversedDetail`](../../doc/models/payment-balance-activity-automatic-savings-reversed-detail.md) | Optional | - | getTypeAutomaticSavingsReversedDetails(): ?PaymentBalanceActivityAutomaticSavingsReversedDetail | setTypeAutomaticSavingsReversedDetails(?PaymentBalanceActivityAutomaticSavingsReversedDetail typeAutomaticSavingsReversedDetails): void | +| `typeChargeDetails` | [`?PaymentBalanceActivityChargeDetail`](../../doc/models/payment-balance-activity-charge-detail.md) | Optional | DESCRIPTION OF PaymentBalanceActivityChargeDetail | getTypeChargeDetails(): ?PaymentBalanceActivityChargeDetail | setTypeChargeDetails(?PaymentBalanceActivityChargeDetail typeChargeDetails): void | +| `typeDepositFeeDetails` | [`?PaymentBalanceActivityDepositFeeDetail`](../../doc/models/payment-balance-activity-deposit-fee-detail.md) | Optional | - | getTypeDepositFeeDetails(): ?PaymentBalanceActivityDepositFeeDetail | setTypeDepositFeeDetails(?PaymentBalanceActivityDepositFeeDetail typeDepositFeeDetails): void | +| `typeDisputeDetails` | [`?PaymentBalanceActivityDisputeDetail`](../../doc/models/payment-balance-activity-dispute-detail.md) | Optional | - | getTypeDisputeDetails(): ?PaymentBalanceActivityDisputeDetail | setTypeDisputeDetails(?PaymentBalanceActivityDisputeDetail typeDisputeDetails): void | +| `typeFeeDetails` | [`?PaymentBalanceActivityFeeDetail`](../../doc/models/payment-balance-activity-fee-detail.md) | Optional | - | getTypeFeeDetails(): ?PaymentBalanceActivityFeeDetail | setTypeFeeDetails(?PaymentBalanceActivityFeeDetail typeFeeDetails): void | +| `typeFreeProcessingDetails` | [`?PaymentBalanceActivityFreeProcessingDetail`](../../doc/models/payment-balance-activity-free-processing-detail.md) | Optional | - | getTypeFreeProcessingDetails(): ?PaymentBalanceActivityFreeProcessingDetail | setTypeFreeProcessingDetails(?PaymentBalanceActivityFreeProcessingDetail typeFreeProcessingDetails): void | +| `typeHoldAdjustmentDetails` | [`?PaymentBalanceActivityHoldAdjustmentDetail`](../../doc/models/payment-balance-activity-hold-adjustment-detail.md) | Optional | - | getTypeHoldAdjustmentDetails(): ?PaymentBalanceActivityHoldAdjustmentDetail | setTypeHoldAdjustmentDetails(?PaymentBalanceActivityHoldAdjustmentDetail typeHoldAdjustmentDetails): void | +| `typeOpenDisputeDetails` | [`?PaymentBalanceActivityOpenDisputeDetail`](../../doc/models/payment-balance-activity-open-dispute-detail.md) | Optional | - | getTypeOpenDisputeDetails(): ?PaymentBalanceActivityOpenDisputeDetail | setTypeOpenDisputeDetails(?PaymentBalanceActivityOpenDisputeDetail typeOpenDisputeDetails): void | +| `typeOtherDetails` | [`?PaymentBalanceActivityOtherDetail`](../../doc/models/payment-balance-activity-other-detail.md) | Optional | - | getTypeOtherDetails(): ?PaymentBalanceActivityOtherDetail | setTypeOtherDetails(?PaymentBalanceActivityOtherDetail typeOtherDetails): void | +| `typeOtherAdjustmentDetails` | [`?PaymentBalanceActivityOtherAdjustmentDetail`](../../doc/models/payment-balance-activity-other-adjustment-detail.md) | Optional | - | getTypeOtherAdjustmentDetails(): ?PaymentBalanceActivityOtherAdjustmentDetail | setTypeOtherAdjustmentDetails(?PaymentBalanceActivityOtherAdjustmentDetail typeOtherAdjustmentDetails): void | +| `typeRefundDetails` | [`?PaymentBalanceActivityRefundDetail`](../../doc/models/payment-balance-activity-refund-detail.md) | Optional | - | getTypeRefundDetails(): ?PaymentBalanceActivityRefundDetail | setTypeRefundDetails(?PaymentBalanceActivityRefundDetail typeRefundDetails): void | +| `typeReleaseAdjustmentDetails` | [`?PaymentBalanceActivityReleaseAdjustmentDetail`](../../doc/models/payment-balance-activity-release-adjustment-detail.md) | Optional | - | getTypeReleaseAdjustmentDetails(): ?PaymentBalanceActivityReleaseAdjustmentDetail | setTypeReleaseAdjustmentDetails(?PaymentBalanceActivityReleaseAdjustmentDetail typeReleaseAdjustmentDetails): void | +| `typeReserveHoldDetails` | [`?PaymentBalanceActivityReserveHoldDetail`](../../doc/models/payment-balance-activity-reserve-hold-detail.md) | Optional | - | getTypeReserveHoldDetails(): ?PaymentBalanceActivityReserveHoldDetail | setTypeReserveHoldDetails(?PaymentBalanceActivityReserveHoldDetail typeReserveHoldDetails): void | +| `typeReserveReleaseDetails` | [`?PaymentBalanceActivityReserveReleaseDetail`](../../doc/models/payment-balance-activity-reserve-release-detail.md) | Optional | - | getTypeReserveReleaseDetails(): ?PaymentBalanceActivityReserveReleaseDetail | setTypeReserveReleaseDetails(?PaymentBalanceActivityReserveReleaseDetail typeReserveReleaseDetails): void | +| `typeSquareCapitalPaymentDetails` | [`?PaymentBalanceActivitySquareCapitalPaymentDetail`](../../doc/models/payment-balance-activity-square-capital-payment-detail.md) | Optional | - | getTypeSquareCapitalPaymentDetails(): ?PaymentBalanceActivitySquareCapitalPaymentDetail | setTypeSquareCapitalPaymentDetails(?PaymentBalanceActivitySquareCapitalPaymentDetail typeSquareCapitalPaymentDetails): void | +| `typeSquareCapitalReversedPaymentDetails` | [`?PaymentBalanceActivitySquareCapitalReversedPaymentDetail`](../../doc/models/payment-balance-activity-square-capital-reversed-payment-detail.md) | Optional | - | getTypeSquareCapitalReversedPaymentDetails(): ?PaymentBalanceActivitySquareCapitalReversedPaymentDetail | setTypeSquareCapitalReversedPaymentDetails(?PaymentBalanceActivitySquareCapitalReversedPaymentDetail typeSquareCapitalReversedPaymentDetails): void | +| `typeTaxOnFeeDetails` | [`?PaymentBalanceActivityTaxOnFeeDetail`](../../doc/models/payment-balance-activity-tax-on-fee-detail.md) | Optional | - | getTypeTaxOnFeeDetails(): ?PaymentBalanceActivityTaxOnFeeDetail | setTypeTaxOnFeeDetails(?PaymentBalanceActivityTaxOnFeeDetail typeTaxOnFeeDetails): void | +| `typeThirdPartyFeeDetails` | [`?PaymentBalanceActivityThirdPartyFeeDetail`](../../doc/models/payment-balance-activity-third-party-fee-detail.md) | Optional | - | getTypeThirdPartyFeeDetails(): ?PaymentBalanceActivityThirdPartyFeeDetail | setTypeThirdPartyFeeDetails(?PaymentBalanceActivityThirdPartyFeeDetail typeThirdPartyFeeDetails): void | +| `typeThirdPartyFeeRefundDetails` | [`?PaymentBalanceActivityThirdPartyFeeRefundDetail`](../../doc/models/payment-balance-activity-third-party-fee-refund-detail.md) | Optional | - | getTypeThirdPartyFeeRefundDetails(): ?PaymentBalanceActivityThirdPartyFeeRefundDetail | setTypeThirdPartyFeeRefundDetails(?PaymentBalanceActivityThirdPartyFeeRefundDetail typeThirdPartyFeeRefundDetails): void | + +## Example (as JSON) + +```json +{ + "id": "id0", + "payout_id": "payout_id6", + "effective_at": "effective_at6", + "type": "REDEMPTION_CODE", + "gross_amount_money": { + "amount": 186, + "currency": "SVC" + }, + "fee_amount_money": { + "amount": 126, + "currency": "ANG" + }, + "net_amount_money": { + "amount": 6, + "currency": "AOA" + } +} +``` + diff --git a/doc/models/payout-fee-type.md b/doc/models/payout-fee-type.md new file mode 100644 index 00000000..afc863d6 --- /dev/null +++ b/doc/models/payout-fee-type.md @@ -0,0 +1,16 @@ + +# Payout Fee Type + +Represents the type of payout fee that can incur as part of a payout. + +## Enumeration + +`PayoutFeeType` + +## Fields + +| Name | Description | +| --- | --- | +| `TRANSFER_FEE` | Fee type associated with transfers. | +| `TAX_ON_TRANSFER_FEE` | Taxes associated with the transfer fee. | + diff --git a/doc/models/payout-fee.md b/doc/models/payout-fee.md new file mode 100644 index 00000000..688b9efe --- /dev/null +++ b/doc/models/payout-fee.md @@ -0,0 +1,30 @@ + +# Payout Fee + +Represents a payout fee that can incur as part of a payout. + +## Structure + +`PayoutFee` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `amountMoney` | [`?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. | getAmountMoney(): ?Money | setAmountMoney(?Money amountMoney): void | +| `effectiveAt` | `?string` | Optional | The timestamp of when the fee takes effect, in RFC 3339 format. | getEffectiveAt(): ?string | setEffectiveAt(?string effectiveAt): void | +| `type` | [`?string (PayoutFeeType)`](../../doc/models/payout-fee-type.md) | Optional | Represents the type of payout fee that can incur as part of a payout. | getType(): ?string | setType(?string type): void | + +## Example (as JSON) + +```json +{ + "amount_money": { + "amount": 186, + "currency": "NGN" + }, + "effective_at": "effective_at6", + "type": "TRANSFER_FEE" +} +``` + diff --git a/doc/models/payout-status.md b/doc/models/payout-status.md new file mode 100644 index 00000000..c46bf5af --- /dev/null +++ b/doc/models/payout-status.md @@ -0,0 +1,17 @@ + +# Payout Status + +Payout status types + +## Enumeration + +`PayoutStatus` + +## Fields + +| Name | Description | +| --- | --- | +| `SENT` | Indicates that the payout was successfully sent to the banking destination. | +| `FAILED` | Indicates that the payout was rejected by the banking destination. | +| `PAID` | Indicates that the payout has successfully completed. | + diff --git a/doc/models/payout-type.md b/doc/models/payout-type.md new file mode 100644 index 00000000..88d9aff0 --- /dev/null +++ b/doc/models/payout-type.md @@ -0,0 +1,19 @@ + +# Payout Type + +The type of payout: “BATCH” or “SIMPLE”. +BATCH payouts include a list of payout entries that can be considered settled. +SIMPLE payouts do not have any payout entries associated with them +and will show up as one of the payout entries in a future BATCH payout. + +## Enumeration + +`PayoutType` + +## Fields + +| Name | Description | +| --- | --- | +| `BATCH` | Payouts that include a list of payout entries that can be considered settled. | +| `SIMPLE` | Payouts that do not have any payout entries associated with them and will
show up as one of the payout entries in a future BATCH payout. | + diff --git a/doc/models/payout.md b/doc/models/payout.md new file mode 100644 index 00000000..1b3b4921 --- /dev/null +++ b/doc/models/payout.md @@ -0,0 +1,46 @@ + +# Payout + +An accounting of the amount owed the seller and record of the actual transfer to their +external bank account or to the Square balance. + +## Structure + +`Payout` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `id` | `string` | Required | A unique ID for the payout.
**Constraints**: *Minimum Length*: `1` | getId(): string | setId(string id): void | +| `status` | [`?string (PayoutStatus)`](../../doc/models/payout-status.md) | Optional | Payout status types | getStatus(): ?string | setStatus(?string status): void | +| `locationId` | `string` | Required | The ID of the location associated with the payout.
**Constraints**: *Minimum Length*: `1` | getLocationId(): string | setLocationId(string locationId): void | +| `createdAt` | `?string` | Optional | The timestamp of when the payout was created and submitted for deposit to the seller's banking destination, in RFC 3339 format. | getCreatedAt(): ?string | setCreatedAt(?string createdAt): void | +| `updatedAt` | `?string` | Optional | The timestamp of when the payout was last updated, in RFC 3339 format. | getUpdatedAt(): ?string | setUpdatedAt(?string updatedAt): void | +| `amountMoney` | [`?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. | getAmountMoney(): ?Money | setAmountMoney(?Money amountMoney): void | +| `destination` | [`?Destination`](../../doc/models/destination.md) | Optional | Information about the destination against which the payout was made. | getDestination(): ?Destination | setDestination(?Destination destination): void | +| `version` | `?int` | Optional | The version number, which is incremented each time an update is made to this payout record.
The version number helps developers receive event notifications or feeds out of order. | getVersion(): ?int | setVersion(?int version): void | +| `type` | [`?string (PayoutType)`](../../doc/models/payout-type.md) | Optional | The type of payout: “BATCH” or “SIMPLE”.
BATCH payouts include a list of payout entries that can be considered settled.
SIMPLE payouts do not have any payout entries associated with them
and will show up as one of the payout entries in a future BATCH payout. | getType(): ?string | setType(?string type): void | +| `payoutFee` | [`?(PayoutFee[])`](../../doc/models/payout-fee.md) | Optional | A list of processing fees and any taxes on the fees assessed by Square for this payout. | getPayoutFee(): ?array | setPayoutFee(?array payoutFee): void | +| `arrivalDate` | `?string` | Optional | The calendar date, in ISO 8601 format (YYYY-MM-DD), when the payout is due to arrive in the seller’s banking destination. | getArrivalDate(): ?string | setArrivalDate(?string arrivalDate): void | + +## Example (as JSON) + +```json +{ + "id": "id0", + "status": "PAID", + "location_id": "location_id4", + "created_at": "created_at2", + "updated_at": "updated_at4", + "amount_money": { + "amount": 186, + "currency": "NGN" + }, + "destination": { + "type": "BANK_ACCOUNT", + "id": "id4" + } +} +``` + diff --git a/doc/models/refund.md b/doc/models/refund.md index 67887ee9..109a48ec 100644 --- a/doc/models/refund.md +++ b/doc/models/refund.md @@ -13,7 +13,7 @@ Represents a refund processed for a Square transaction. | --- | --- | --- | --- | --- | --- | | `id` | `string` | Required | The refund's unique ID.
**Constraints**: *Maximum Length*: `255` | getId(): string | setId(string id): void | | `locationId` | `string` | Required | The ID of the refund's associated location.
**Constraints**: *Maximum Length*: `50` | getLocationId(): string | setLocationId(string locationId): void | -| `transactionId` | `string` | Required | The ID of the transaction that the refunded tender is part of.
**Constraints**: *Maximum Length*: `192` | getTransactionId(): string | setTransactionId(string transactionId): void | +| `transactionId` | `?string` | Optional | The ID of the transaction that the refunded tender is part of.
**Constraints**: *Maximum Length*: `192` | getTransactionId(): ?string | setTransactionId(?string transactionId): void | | `tenderId` | `string` | Required | The ID of the refunded tender.
**Constraints**: *Maximum Length*: `192` | getTenderId(): string | setTenderId(string tenderId): void | | `createdAt` | `?string` | Optional | The timestamp for when the refund was created, in RFC 3339 format.
**Constraints**: *Maximum Length*: `32` | getCreatedAt(): ?string | setCreatedAt(?string createdAt): void | | `reason` | `string` | Required | The reason for the refund being issued.
**Constraints**: *Maximum Length*: `192` | getReason(): string | setReason(string reason): void | diff --git a/doc/models/retrieve-employee-response.md b/doc/models/retrieve-employee-response.md index 71e3e3da..d615cc4b 100644 --- a/doc/models/retrieve-employee-response.md +++ b/doc/models/retrieve-employee-response.md @@ -26,19 +26,19 @@ "errors": [ { "category": "AUTHENTICATION_ERROR", - "code": "MISSING_PIN", + "code": "VERIFY_CVV_FAILURE", "detail": "detail1", "field": "field9" }, { "category": "INVALID_REQUEST_ERROR", - "code": "MISSING_ACCOUNT_TYPE", + "code": "VERIFY_AVS_FAILURE", "detail": "detail2", "field": "field0" }, { "category": "RATE_LIMIT_ERROR", - "code": "INVALID_POSTAL_CODE", + "code": "CARD_DECLINED_CALL_ISSUER", "detail": "detail3", "field": "field1" } diff --git a/doc/models/retrieve-location-response.md b/doc/models/retrieve-location-response.md index 57cec1b1..b14270c6 100644 --- a/doc/models/retrieve-location-response.md +++ b/doc/models/retrieve-location-response.md @@ -12,8 +12,8 @@ endpoint returns in a response. | Name | Type | Tags | Description | Getter | Setter | | --- | --- | --- | --- | --- | --- | -| `errors` | [`?(Error[])`](../../doc/models/error.md) | Optional | Information on errors encountered during the request. | getErrors(): ?array | setErrors(?array errors): void | -| `location` | [`?Location`](../../doc/models/location.md) | Optional | Represents one of a business's [locations](https://developer.squareup.com/docs/locations-api). | getLocation(): ?Location | setLocation(?Location location): void | +| `errors` | [`?(Error[])`](../../doc/models/error.md) | Optional | Information about errors encountered during the request. | getErrors(): ?array | setErrors(?array errors): void | +| `location` | [`?Location`](../../doc/models/location.md) | Optional | Represents one of a business' [locations](https://developer.squareup.com/docs/locations-api). | getLocation(): ?Location | setLocation(?Location location): void | ## Example (as JSON) diff --git a/doc/models/retrieve-vendor-response.md b/doc/models/retrieve-vendor-response.md index 7353c63d..16d68d42 100644 --- a/doc/models/retrieve-vendor-response.md +++ b/doc/models/retrieve-vendor-response.md @@ -1,7 +1,7 @@ # Retrieve Vendor Response -Represents an output from a call to [RetrieveVendor.](../../doc/apis/vendors.md#retrieve-vendor) +Represents an output from a call to [RetrieveVendor](../../doc/apis/vendors.md#retrieve-vendor). ## Structure @@ -21,19 +21,19 @@ Represents an output from a call to [RetrieveVendor.](../../doc/apis/vendors.md# "errors": [ { "category": "AUTHENTICATION_ERROR", - "code": "MISSING_PIN", + "code": "VERIFY_CVV_FAILURE", "detail": "detail1", "field": "field9" }, { "category": "INVALID_REQUEST_ERROR", - "code": "MISSING_ACCOUNT_TYPE", + "code": "VERIFY_AVS_FAILURE", "detail": "detail2", "field": "field0" }, { "category": "RATE_LIMIT_ERROR", - "code": "INVALID_POSTAL_CODE", + "code": "CARD_DECLINED_CALL_ISSUER", "detail": "detail3", "field": "field1" } diff --git a/doc/models/search-catalog-items-response.md b/doc/models/search-catalog-items-response.md index f8506874..01fb8267 100644 --- a/doc/models/search-catalog-items-response.md +++ b/doc/models/search-catalog-items-response.md @@ -23,19 +23,19 @@ Defines the response body returned from the [SearchCatalogItems](../../doc/apis/ "errors": [ { "category": "AUTHENTICATION_ERROR", - "code": "MISSING_PIN", + "code": "VERIFY_CVV_FAILURE", "detail": "detail1", "field": "field9" }, { "category": "INVALID_REQUEST_ERROR", - "code": "MISSING_ACCOUNT_TYPE", + "code": "VERIFY_AVS_FAILURE", "detail": "detail2", "field": "field0" }, { "category": "RATE_LIMIT_ERROR", - "code": "INVALID_POSTAL_CODE", + "code": "CARD_DECLINED_CALL_ISSUER", "detail": "detail3", "field": "field1" } diff --git a/doc/models/search-vendors-request.md b/doc/models/search-vendors-request.md index c6fce5a1..72f0102c 100644 --- a/doc/models/search-vendors-request.md +++ b/doc/models/search-vendors-request.md @@ -1,7 +1,7 @@ # Search Vendors Request -Represents an input into a call to [SearchVendors.](../../doc/apis/vendors.md#search-vendors) +Represents an input into a call to [SearchVendors](../../doc/apis/vendors.md#search-vendors). ## Structure diff --git a/doc/models/search-vendors-response.md b/doc/models/search-vendors-response.md index c6eda187..056b5dff 100644 --- a/doc/models/search-vendors-response.md +++ b/doc/models/search-vendors-response.md @@ -1,7 +1,7 @@ # Search Vendors Response -Represents an output from a call to [SearchVendors.](../../doc/apis/vendors.md#search-vendors) +Represents an output from a call to [SearchVendors](../../doc/apis/vendors.md#search-vendors). ## Structure @@ -22,19 +22,19 @@ Represents an output from a call to [SearchVendors.](../../doc/apis/vendors.md#s "errors": [ { "category": "AUTHENTICATION_ERROR", - "code": "MISSING_PIN", + "code": "VERIFY_CVV_FAILURE", "detail": "detail1", "field": "field9" }, { "category": "INVALID_REQUEST_ERROR", - "code": "MISSING_ACCOUNT_TYPE", + "code": "VERIFY_AVS_FAILURE", "detail": "detail2", "field": "field0" }, { "category": "RATE_LIMIT_ERROR", - "code": "INVALID_POSTAL_CODE", + "code": "CARD_DECLINED_CALL_ISSUER", "detail": "detail3", "field": "field1" } diff --git a/doc/models/snippet-response.md b/doc/models/snippet-response.md index 88ea1f8b..3e89408a 100644 --- a/doc/models/snippet-response.md +++ b/doc/models/snippet-response.md @@ -19,19 +19,19 @@ "errors": [ { "category": "AUTHENTICATION_ERROR", - "code": "MISSING_PIN", + "code": "VERIFY_CVV_FAILURE", "detail": "detail1", "field": "field9" }, { "category": "INVALID_REQUEST_ERROR", - "code": "MISSING_ACCOUNT_TYPE", + "code": "VERIFY_AVS_FAILURE", "detail": "detail2", "field": "field0" }, { "category": "RATE_LIMIT_ERROR", - "code": "INVALID_POSTAL_CODE", + "code": "CARD_DECLINED_CALL_ISSUER", "detail": "detail3", "field": "field1" } diff --git a/doc/models/subscription.md b/doc/models/subscription.md index af0675e1..3156c869 100644 --- a/doc/models/subscription.md +++ b/doc/models/subscription.md @@ -23,7 +23,7 @@ For an overview of the `Subscription` type, see | `chargedThroughDate` | `?string` | Optional | The `YYYY-MM-DD`-formatted date up to when the subscriber is invoiced for the
subscription.

After the invoice is sent for a given billing period,
this date will be the last day of the billing period.
For example,
suppose for the month of May a subscriber gets an invoice
(or charged the card) on May 1. For the monthly billing scenario,
this date is then set to May 31. | getChargedThroughDate(): ?string | setChargedThroughDate(?string chargedThroughDate): void | | `status` | [`?string (SubscriptionStatus)`](../../doc/models/subscription-status.md) | Optional | Supported subscription statuses. | getStatus(): ?string | setStatus(?string status): void | | `taxPercentage` | `?string` | Optional | The tax amount applied when billing the subscription. The
percentage is expressed in decimal form, using a `'.'` as the decimal
separator and without a `'%'` sign. For example, a value of `7.5`
corresponds to 7.5%. | getTaxPercentage(): ?string | setTaxPercentage(?string taxPercentage): void | -| `invoiceIds` | `?(string[])` | Optional | The IDs of the [invoices](../../doc/models/invoice.md) created for the
subscription, listed in order when the invoices were created
(oldest invoices appear first). | getInvoiceIds(): ?array | setInvoiceIds(?array invoiceIds): void | +| `invoiceIds` | `?(string[])` | Optional | The IDs of the [invoices](../../doc/models/invoice.md) created for the
subscription, listed in order when the invoices were created
(newest invoices appear first). | getInvoiceIds(): ?array | setInvoiceIds(?array invoiceIds): void | | `priceOverrideMoney` | [`?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. | getPriceOverrideMoney(): ?Money | setPriceOverrideMoney(?Money priceOverrideMoney): void | | `version` | `?int` | Optional | The version of the object. When updating an object, the version
supplied must match the version in the database, otherwise the write will
be rejected as conflicting. | getVersion(): ?int | setVersion(?int version): void | | `createdAt` | `?string` | Optional | The timestamp when the subscription was created, in RFC 3339 format. | getCreatedAt(): ?string | setCreatedAt(?string createdAt): void | diff --git a/doc/models/tax-ids.md b/doc/models/tax-ids.md index a9f4454f..cb0d8e93 100644 --- a/doc/models/tax-ids.md +++ b/doc/models/tax-ids.md @@ -12,9 +12,9 @@ Identifiers for the location used by various governments for tax purposes. | Name | Type | Tags | Description | Getter | Setter | | --- | --- | --- | --- | --- | --- | | `euVat` | `?string` | Optional | The EU VAT number for this location. For example, `IE3426675K`.
If the EU VAT number is present, it is well-formed and has been
validated with VIES, the VAT Information Exchange System. | getEuVat(): ?string | setEuVat(?string euVat): void | -| `frSiret` | `?string` | Optional | The SIRET (Système d'Identification du Répertoire des Entreprises et de leurs Etablissements)
number is a 14 digit code issued by the French INSEE. For example, `39922799000021`. | getFrSiret(): ?string | setFrSiret(?string frSiret): void | +| `frSiret` | `?string` | Optional | The SIRET (Système d'Identification du Répertoire des Entreprises et de leurs Etablissements)
number is a 14-digit code issued by the French INSEE. For example, `39922799000021`. | getFrSiret(): ?string | setFrSiret(?string frSiret): void | | `frNaf` | `?string` | Optional | The French government uses the NAF (Nomenclature des Activités Françaises) to display and
track economic statistical data. This is also called the APE (Activite Principale de l’Entreprise) code.
For example, `6910Z`. | getFrNaf(): ?string | setFrNaf(?string frNaf): void | -| `esNif` | `?string` | Optional | The NIF (Numero de Identificacion Fiscal) number is a 9 character tax identifier used in Spain.
If it is present, it has been validated. For example, `73628495A`. | getEsNif(): ?string | setEsNif(?string esNif): void | +| `esNif` | `?string` | Optional | The NIF (Numero de Identificacion Fiscal) number is a nine-character tax identifier used in Spain.
If it is present, it has been validated. For example, `73628495A`. | getEsNif(): ?string | setEsNif(?string esNif): void | ## Example (as JSON) diff --git a/doc/models/tender.md b/doc/models/tender.md index 72eddba8..29c12ba5 100644 --- a/doc/models/tender.md +++ b/doc/models/tender.md @@ -11,7 +11,7 @@ Represents a tender (i.e., a method of payment) used in a Square transaction. | Name | Type | Tags | Description | Getter | Setter | | --- | --- | --- | --- | --- | --- | -| `id` | `?string` | Optional | The tender's unique ID.
**Constraints**: *Maximum Length*: `192` | getId(): ?string | setId(?string id): void | +| `id` | `?string` | Optional | The tender's unique ID. It is the associated payment ID.
**Constraints**: *Maximum Length*: `192` | getId(): ?string | setId(?string id): void | | `locationId` | `?string` | Optional | The ID of the transaction's associated location.
**Constraints**: *Maximum Length*: `50` | getLocationId(): ?string | setLocationId(?string locationId): void | | `transactionId` | `?string` | Optional | The ID of the tender's associated transaction.
**Constraints**: *Maximum Length*: `192` | getTransactionId(): ?string | setTransactionId(?string transactionId): void | | `createdAt` | `?string` | Optional | The timestamp for when the tender was created, in RFC 3339 format.
**Constraints**: *Maximum Length*: `32` | getCreatedAt(): ?string | setCreatedAt(?string createdAt): void | diff --git a/doc/models/terminal-checkout.md b/doc/models/terminal-checkout.md index 6a0b7443..dc924057 100644 --- a/doc/models/terminal-checkout.md +++ b/doc/models/terminal-checkout.md @@ -1,6 +1,8 @@ # Terminal Checkout +Represents a checkout processed by the Square Terminal. + ## Structure `TerminalCheckout` @@ -12,7 +14,7 @@ | `id` | `?string` | Optional | A unique ID for this `TerminalCheckout`.
**Constraints**: *Minimum Length*: `10`, *Maximum Length*: `255` | getId(): ?string | setId(?string id): 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 | | `referenceId` | `?string` | Optional | An optional user-defined reference ID that can be used to associate
this `TerminalCheckout` to another entity in an external system. For example, an order
ID generated by a third-party shopping cart. The ID is also associated with any payments
used to complete the checkout.
**Constraints**: *Maximum Length*: `40` | getReferenceId(): ?string | setReferenceId(?string referenceId): void | -| `note` | `?string` | Optional | An optional note to associate with the checkout, as well as with any payments used to complete the checkout.
**Constraints**: *Maximum Length*: `250` | getNote(): ?string | setNote(?string note): void | +| `note` | `?string` | Optional | An optional note to associate with the checkout, as well as with any payments used to complete the checkout.
Note: maximum 500 characters
**Constraints**: *Maximum Length*: `500` | getNote(): ?string | setNote(?string note): void | | `deviceOptions` | [`DeviceCheckoutOptions`](../../doc/models/device-checkout-options.md) | Required | - | getDeviceOptions(): DeviceCheckoutOptions | setDeviceOptions(DeviceCheckoutOptions deviceOptions): void | | `deadlineDuration` | `?string` | Optional | An RFC 3339 duration, after which the checkout is automatically canceled.
A `TerminalCheckout` that is `PENDING` is automatically `CANCELED` and has a cancellation reason
of `TIMED_OUT`.

Default: 5 minutes from creation

Maximum: 5 minutes | getDeadlineDuration(): ?string | setDeadlineDuration(?string deadlineDuration): void | | `status` | `?string` | Optional | The status of the `TerminalCheckout`.
Options: `PENDING`, `IN_PROGRESS`, `CANCEL_REQUESTED`, `CANCELED`, `COMPLETED` | getStatus(): ?string | setStatus(?string status): void | @@ -39,6 +41,7 @@ "device_options": { "device_id": "device_id6", "skip_receipt_screen": false, + "collect_signature": false, "tip_settings": { "allow_tipping": false, "separate_tip_screen": false, diff --git a/doc/models/terminal-device-checkout-options.md b/doc/models/terminal-device-checkout-options.md deleted file mode 100644 index 2a92cce5..00000000 --- a/doc/models/terminal-device-checkout-options.md +++ /dev/null @@ -1,31 +0,0 @@ - -# Terminal Device Checkout Options - -## Structure - -`TerminalDeviceCheckoutOptions` - -## Fields - -| Name | Type | Tags | Description | Getter | Setter | -| --- | --- | --- | --- | --- | --- | -| `skipReceiptScreen` | `?bool` | Optional | Instructs the device to skip the receipt screen. Defaults to false. | getSkipReceiptScreen(): ?bool | setSkipReceiptScreen(?bool skipReceiptScreen): void | -| `tipSettings` | [`?TipSettings`](../../doc/models/tip-settings.md) | Optional | - | getTipSettings(): ?TipSettings | setTipSettings(?TipSettings tipSettings): void | - -## Example (as JSON) - -```json -{ - "skip_receipt_screen": false, - "tip_settings": { - "allow_tipping": false, - "separate_tip_screen": false, - "custom_tip_field": false, - "tip_percentages": [ - 48 - ], - "smart_tipping": false - } -} -``` - diff --git a/doc/models/terminal-refund.md b/doc/models/terminal-refund.md index b8ce7f46..526a903f 100644 --- a/doc/models/terminal-refund.md +++ b/doc/models/terminal-refund.md @@ -1,6 +1,8 @@ # Terminal Refund +Represents a payment refund processed by the Square Terminal. Only supports Interac (Canadian debit network) payment refunds. + ## Structure `TerminalRefund` @@ -14,10 +16,10 @@ | `paymentId` | `string` | Required | The unique ID of the payment being refunded.
**Constraints**: *Minimum Length*: `1` | getPaymentId(): string | setPaymentId(string paymentId): void | | `orderId` | `?string` | Optional | The reference to the Square order ID for the payment identified by the `payment_id`. | getOrderId(): ?string | setOrderId(?string orderId): 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 | -| `reason` | `?string` | Optional | A description of the reason for the refund.
Note: maximum 192 characters
**Constraints**: *Maximum Length*: `192` | getReason(): ?string | setReason(?string reason): void | -| `deviceId` | `?string` | Optional | The unique ID of the device intended for this `TerminalRefund`.
The Id can be retrieved from /v2/devices api. | getDeviceId(): ?string | setDeviceId(?string deviceId): void | +| `reason` | `string` | Required | A description of the reason for the refund.
**Constraints**: *Maximum Length*: `192` | getReason(): string | setReason(string reason): void | +| `deviceId` | `string` | Required | The unique ID of the device intended for this `TerminalRefund`.
The Id can be retrieved from /v2/devices api. | getDeviceId(): string | setDeviceId(string deviceId): void | | `deadlineDuration` | `?string` | Optional | The RFC 3339 duration, after which the refund is automatically canceled.
A `TerminalRefund` that is `PENDING` is automatically `CANCELED` and has a cancellation reason
of `TIMED_OUT`.

Default: 5 minutes from creation.

Maximum: 5 minutes | getDeadlineDuration(): ?string | setDeadlineDuration(?string deadlineDuration): void | -| `status` | `?string` | Optional | The status of the `TerminalRefund`.
Options: `PENDING`, `IN_PROGRESS`, `CANCELED`, or `COMPLETED`. | getStatus(): ?string | setStatus(?string status): void | +| `status` | `?string` | Optional | The status of the `TerminalRefund`.
Options: `PENDING`, `IN_PROGRESS`, `CANCEL_REQUESTED`, `CANCELED`, or `COMPLETED`. | getStatus(): ?string | setStatus(?string status): void | | `cancelReason` | [`?string (ActionCancelReason)`](../../doc/models/action-cancel-reason.md) | Optional | - | getCancelReason(): ?string | setCancelReason(?string cancelReason): void | | `createdAt` | `?string` | Optional | The time when the `TerminalRefund` was created, as an RFC 3339 timestamp. | getCreatedAt(): ?string | setCreatedAt(?string createdAt): void | | `updatedAt` | `?string` | Optional | The time when the `TerminalRefund` was last updated, as an RFC 3339 timestamp. | getUpdatedAt(): ?string | setUpdatedAt(?string updatedAt): void | @@ -37,7 +39,9 @@ "currency": "NGN" }, "reason": "reason4", - "device_id": "device_id6" + "device_id": "device_id6", + "deadline_duration": "deadline_duration8", + "status": "status8" } ``` diff --git a/doc/models/update-location-request.md b/doc/models/update-location-request.md index 21b1b60c..1bd6ab62 100644 --- a/doc/models/update-location-request.md +++ b/doc/models/update-location-request.md @@ -1,7 +1,7 @@ # Update Location Request -Request object for the [UpdateLocation](../../doc/apis/locations.md#update-location) endpoint. +The request object for the [UpdateLocation](../../doc/apis/locations.md#update-location) endpoint. ## Structure @@ -11,7 +11,7 @@ Request object for the [UpdateLocation](../../doc/apis/locations.md#update-locat | Name | Type | Tags | Description | Getter | Setter | | --- | --- | --- | --- | --- | --- | -| `location` | [`?Location`](../../doc/models/location.md) | Optional | Represents one of a business's [locations](https://developer.squareup.com/docs/locations-api). | getLocation(): ?Location | setLocation(?Location location): void | +| `location` | [`?Location`](../../doc/models/location.md) | Optional | Represents one of a business' [locations](https://developer.squareup.com/docs/locations-api). | getLocation(): ?Location | setLocation(?Location location): void | ## Example (as JSON) diff --git a/doc/models/update-location-response.md b/doc/models/update-location-response.md index 69c7e120..5d271ef4 100644 --- a/doc/models/update-location-response.md +++ b/doc/models/update-location-response.md @@ -1,7 +1,7 @@ # Update Location Response -Response object returned by the [UpdateLocation](../../doc/apis/locations.md#update-location) endpoint. +The response object returned by the [UpdateLocation](../../doc/apis/locations.md#update-location) endpoint. ## Structure @@ -11,8 +11,8 @@ Response object returned by the [UpdateLocation](../../doc/apis/locations.md#upd | Name | Type | Tags | Description | Getter | Setter | | --- | --- | --- | --- | --- | --- | -| `errors` | [`?(Error[])`](../../doc/models/error.md) | Optional | Information on errors encountered during the request. | getErrors(): ?array | setErrors(?array errors): void | -| `location` | [`?Location`](../../doc/models/location.md) | Optional | Represents one of a business's [locations](https://developer.squareup.com/docs/locations-api). | getLocation(): ?Location | setLocation(?Location location): void | +| `errors` | [`?(Error[])`](../../doc/models/error.md) | Optional | Information about errors encountered during the request. | getErrors(): ?array | setErrors(?array errors): void | +| `location` | [`?Location`](../../doc/models/location.md) | Optional | Represents one of a business' [locations](https://developer.squareup.com/docs/locations-api). | getLocation(): ?Location | setLocation(?Location location): void | ## Example (as JSON) diff --git a/doc/models/update-vendor-request.md b/doc/models/update-vendor-request.md index 384dc407..d7fc82b9 100644 --- a/doc/models/update-vendor-request.md +++ b/doc/models/update-vendor-request.md @@ -1,7 +1,7 @@ # Update Vendor Request -Represents an input to a call to [UpdateVendor.](../../doc/apis/vendors.md#update-vendor) +Represents an input to a call to [UpdateVendor](../../doc/apis/vendors.md#update-vendor). ## Structure diff --git a/doc/models/update-vendor-response.md b/doc/models/update-vendor-response.md index 23691b14..ce26b612 100644 --- a/doc/models/update-vendor-response.md +++ b/doc/models/update-vendor-response.md @@ -1,7 +1,7 @@ # Update Vendor Response -Represents an output from a call to [UpdateVendor.](../../doc/apis/vendors.md#update-vendor) +Represents an output from a call to [UpdateVendor](../../doc/apis/vendors.md#update-vendor). ## Structure diff --git a/doc/models/v1-list-orders-response.md b/doc/models/v1-list-orders-response.md index 293b965f..bce71869 100644 --- a/doc/models/v1-list-orders-response.md +++ b/doc/models/v1-list-orders-response.md @@ -20,19 +20,19 @@ "errors": [ { "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "UNSUPPORTED_ENTRY_METHOD", + "code": "INSUFFICIENT_PERMISSIONS", "detail": "detail8", "field": "field6" }, { "category": "API_ERROR", - "code": "INVALID_ENCRYPTED_CARD", + "code": "CARDHOLDER_INSUFFICIENT_PERMISSIONS", "detail": "detail9", "field": "field7" }, { "category": "AUTHENTICATION_ERROR", - "code": "INVALID_CARD", + "code": "INVALID_LOCATION", "detail": "detail0", "field": "field8" } @@ -46,7 +46,7 @@ "errors": [ { "category": "API_ERROR", - "code": "INVALID_ENCRYPTED_CARD", + "code": "CARDHOLDER_INSUFFICIENT_PERMISSIONS", "detail": "detail9", "field": "field7" } diff --git a/doc/models/v1-order.md b/doc/models/v1-order.md index 1da9da8a..fd41e8d6 100644 --- a/doc/models/v1-order.md +++ b/doc/models/v1-order.md @@ -44,19 +44,19 @@ V1Order "errors": [ { "category": "AUTHENTICATION_ERROR", - "code": "MISSING_PIN", + "code": "VERIFY_CVV_FAILURE", "detail": "detail1", "field": "field9" }, { "category": "INVALID_REQUEST_ERROR", - "code": "MISSING_ACCOUNT_TYPE", + "code": "VERIFY_AVS_FAILURE", "detail": "detail2", "field": "field0" }, { "category": "RATE_LIMIT_ERROR", - "code": "INVALID_POSTAL_CODE", + "code": "CARD_DECLINED_CALL_ISSUER", "detail": "detail3", "field": "field1" } diff --git a/doc/models/v1-payment-tax.md b/doc/models/v1-payment-tax.md index 8fa4015c..1b64a494 100644 --- a/doc/models/v1-payment-tax.md +++ b/doc/models/v1-payment-tax.md @@ -25,19 +25,19 @@ V1PaymentTax "errors": [ { "category": "AUTHENTICATION_ERROR", - "code": "MISSING_PIN", + "code": "VERIFY_CVV_FAILURE", "detail": "detail1", "field": "field9" }, { "category": "INVALID_REQUEST_ERROR", - "code": "MISSING_ACCOUNT_TYPE", + "code": "VERIFY_AVS_FAILURE", "detail": "detail2", "field": "field0" }, { "category": "RATE_LIMIT_ERROR", - "code": "INVALID_POSTAL_CODE", + "code": "CARD_DECLINED_CALL_ISSUER", "detail": "detail3", "field": "field1" } diff --git a/src/ApiHelper.php b/src/ApiHelper.php index c2e6734d..385bd8ea 100644 --- a/src/ApiHelper.php +++ b/src/ApiHelper.php @@ -67,28 +67,28 @@ public static function appendUrlWithTemplateParameters(string $url, array $param } /** - * Appends the given set of parameters to the given query string + * Appends the given set of parameters to the given query string. * - * @param string $queryBuilder The query url string to append the parameters - * @param array $parameters The parameters to append + * @param string $queryUrl The query url string to append the parameters + * @param array $parameters The parameters to append */ - public static function appendUrlWithQueryParameters(string &$queryBuilder, array $parameters): void + public static function appendUrlWithQueryParameters(string &$queryUrl, array $parameters): void { //perform parameter validation - if (is_null($queryBuilder) || !is_string($queryBuilder)) { + if (is_null($queryUrl) || !is_string($queryUrl)) { throw new InvalidArgumentException('Given value for parameter "queryBuilder" is invalid.'); } if (is_null($parameters)) { return; } //does the query string already has parameters - $hasParams = (strrpos($queryBuilder, '?') > 0); + $hasParams = (strrpos($queryUrl, '?') > 0); //if already has parameters, use the & to append new parameters - $queryBuilder .= (($hasParams) ? '&' : '?'); + $queryUrl .= (($hasParams) ? '&' : '?'); //append parameters - $queryBuilder .= http_build_query($parameters); + $queryUrl .= http_build_query($parameters); } /** @@ -140,7 +140,8 @@ public static function verifyClass( string $namespace = 'Square\Models' ) { try { - self::getJsonMapper()->mapClass(json_decode(json_encode($json)), "$namespace\\$classname"); + $value = empty($json) ? new stdClass() : json_decode(json_encode($json)); + self::getJsonMapper()->mapClass($value, "$namespace\\$classname"); } catch (\Exception $e) { throw new InvalidArgumentException($e->getMessage()); } @@ -280,11 +281,11 @@ public static function applySerializationMethods($value, array $serializationMet * * @param mixed $value Any value to be serialized * - * @return string serialized value + * @return string|null serialized value */ - public static function serialize($value): string + public static function serialize($value): ?string { - if (is_string($value)) { + if (is_string($value) || is_null($value)) { return $value; } return json_encode($value); @@ -374,35 +375,6 @@ public static function decodeJsonArray($json, string $name, bool $asMap = false) throw new InvalidArgumentException("Invalid json $type value for argument: '$name'"); } - /** - * Validates and processes the given Url - * - * @param string $url The given Url to process - * - * @return string Pre-processed Url as string - */ - public static function cleanUrl(string $url): string - { - //perform parameter validation - if (is_null($url) || !is_string($url)) { - throw new InvalidArgumentException('Invalid Url.'); - } - //ensure that the urls are absolute - $matchCount = preg_match("#^(https?://[^/]+)#", $url, $matches); - if ($matchCount == 0) { - throw new InvalidArgumentException('Invalid Url format.'); - } - //get the http protocol match - $protocol = $matches[1]; - - //remove redundant forward slashes - $query = substr($url, strlen($protocol)); - $query = preg_replace("#//+#", "/", $query); - - //return process url - return $protocol . $query; - } - /** * Check if an array isAssociative (has string keys) * diff --git a/src/Apis/ApplePayApi.php b/src/Apis/ApplePayApi.php index c9b07a6f..4c3f2d45 100644 --- a/src/Apis/ApplePayApi.php +++ b/src/Apis/ApplePayApi.php @@ -5,8 +5,8 @@ namespace Square\Apis; use Square\Exceptions\ApiException; -use Square\ApiHelper; use Square\ConfigurationInterface; +use Square\ApiHelper; use Square\Models; use Square\Http\ApiResponse; use Square\Http\HttpRequest; @@ -47,10 +47,7 @@ public function __construct(ConfigurationInterface $config, array $authManagers, public function registerDomain(Models\RegisterDomainRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/apple-pay/domains'; - - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); + $_queryUrl = $this->config->getBaseUri() . '/v2/apple-pay/domains'; //prepare headers $_headers = [ diff --git a/src/Apis/BankAccountsApi.php b/src/Apis/BankAccountsApi.php index dd680fc3..5b49c731 100644 --- a/src/Apis/BankAccountsApi.php +++ b/src/Apis/BankAccountsApi.php @@ -5,8 +5,8 @@ namespace Square\Apis; use Square\Exceptions\ApiException; -use Square\ApiHelper; use Square\ConfigurationInterface; +use Square\ApiHelper; use Square\Http\ApiResponse; use Square\Http\HttpRequest; use Square\Http\HttpResponse; @@ -48,18 +48,15 @@ public function listBankAccounts( ?string $locationId = null ): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/bank-accounts'; + $_queryUrl = $this->config->getBaseUri() . '/v2/bank-accounts'; - //process optional query parameters - ApiHelper::appendUrlWithQueryParameters($_queryBuilder, [ + //process query parameters + ApiHelper::appendUrlWithQueryParameters($_queryUrl, [ 'cursor' => $cursor, 'limit' => $limit, 'location_id' => $locationId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -123,16 +120,13 @@ public function listBankAccounts( public function getBankAccountByV1Id(string $v1BankAccountId): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/bank-accounts/by-v1-id/{v1_bank_account_id}'; + $_queryUrl = $this->config->getBaseUri() . '/v2/bank-accounts/by-v1-id/{v1_bank_account_id}'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'v1_bank_account_id' => $v1BankAccountId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -193,16 +187,13 @@ public function getBankAccountByV1Id(string $v1BankAccountId): ApiResponse public function getBankAccount(string $bankAccountId): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/bank-accounts/{bank_account_id}'; + $_queryUrl = $this->config->getBaseUri() . '/v2/bank-accounts/{bank_account_id}'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'bank_account_id' => $bankAccountId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, diff --git a/src/Apis/BaseApi.php b/src/Apis/BaseApi.php index e069f577..3438564d 100644 --- a/src/Apis/BaseApi.php +++ b/src/Apis/BaseApi.php @@ -43,7 +43,7 @@ class BaseApi */ protected $internalUserAgent; - private static $userAgent = 'Square-PHP-SDK/17.3.0.20220316 ({api-version}) {engine}/{engine-version} ({os-info}) {detail}'; + private static $userAgent = 'Square-PHP-SDK/18.0.0.20220420 ({api-version}) {engine}/{engine-version} ({os-info}) {detail}'; /** * Constructor that sets the timeout of requests diff --git a/src/Apis/BookingsApi.php b/src/Apis/BookingsApi.php index e228b4f4..1eb28d52 100644 --- a/src/Apis/BookingsApi.php +++ b/src/Apis/BookingsApi.php @@ -5,8 +5,8 @@ namespace Square\Apis; use Square\Exceptions\ApiException; -use Square\ApiHelper; use Square\ConfigurationInterface; +use Square\ApiHelper; use Square\Models; use Square\Http\ApiResponse; use Square\Http\HttpRequest; @@ -56,10 +56,10 @@ public function listBookings( ?string $startAtMax = null ): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/bookings'; + $_queryUrl = $this->config->getBaseUri() . '/v2/bookings'; - //process optional query parameters - ApiHelper::appendUrlWithQueryParameters($_queryBuilder, [ + //process query parameters + ApiHelper::appendUrlWithQueryParameters($_queryUrl, [ 'limit' => $limit, 'cursor' => $cursor, 'team_member_id' => $teamMemberId, @@ -68,9 +68,6 @@ public function listBookings( 'start_at_max' => $startAtMax, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -137,10 +134,7 @@ public function listBookings( public function createBooking(Models\CreateBookingRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/bookings'; - - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); + $_queryUrl = $this->config->getBaseUri() . '/v2/bookings'; //prepare headers $_headers = [ @@ -212,10 +206,7 @@ public function createBooking(Models\CreateBookingRequest $body): ApiResponse public function searchAvailability(Models\SearchAvailabilityRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/bookings/availability/search'; - - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); + $_queryUrl = $this->config->getBaseUri() . '/v2/bookings/availability/search'; //prepare headers $_headers = [ @@ -278,10 +269,7 @@ public function searchAvailability(Models\SearchAvailabilityRequest $body): ApiR public function retrieveBusinessBookingProfile(): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/bookings/business-booking-profile'; - - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); + $_queryUrl = $this->config->getBaseUri() . '/v2/bookings/business-booking-profile'; //prepare headers $_headers = [ @@ -353,10 +341,10 @@ public function listTeamMemberBookingProfiles( ?string $locationId = null ): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/bookings/team-member-booking-profiles'; + $_queryUrl = $this->config->getBaseUri() . '/v2/bookings/team-member-booking-profiles'; - //process optional query parameters - ApiHelper::appendUrlWithQueryParameters($_queryBuilder, [ + //process query parameters + ApiHelper::appendUrlWithQueryParameters($_queryUrl, [ 'bookable_only' => (null != $bookableOnly) ? var_export($bookableOnly, true) : false, 'limit' => $limit, @@ -364,9 +352,6 @@ public function listTeamMemberBookingProfiles( 'location_id' => $locationId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -426,16 +411,14 @@ public function listTeamMemberBookingProfiles( public function retrieveTeamMemberBookingProfile(string $teamMemberId): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/bookings/team-member-booking-profiles/{team_member_id}'; + $_queryUrl = $this->config->getBaseUri() . + '/v2/bookings/team-member-booking-profiles/{team_member_id}'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'team_member_id' => $teamMemberId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -500,16 +483,13 @@ public function retrieveTeamMemberBookingProfile(string $teamMemberId): ApiRespo public function retrieveBooking(string $bookingId): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/bookings/{booking_id}'; + $_queryUrl = $this->config->getBaseUri() . '/v2/bookings/{booking_id}'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'booking_id' => $bookingId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -578,16 +558,13 @@ public function retrieveBooking(string $bookingId): ApiResponse public function updateBooking(string $bookingId, Models\UpdateBookingRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/bookings/{booking_id}'; + $_queryUrl = $this->config->getBaseUri() . '/v2/bookings/{booking_id}'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'booking_id' => $bookingId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -660,16 +637,13 @@ public function updateBooking(string $bookingId, Models\UpdateBookingRequest $bo public function cancelBooking(string $bookingId, Models\CancelBookingRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/bookings/{booking_id}/cancel'; + $_queryUrl = $this->config->getBaseUri() . '/v2/bookings/{booking_id}/cancel'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'booking_id' => $bookingId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, diff --git a/src/Apis/CardsApi.php b/src/Apis/CardsApi.php index 71e7395d..cdd9eb02 100644 --- a/src/Apis/CardsApi.php +++ b/src/Apis/CardsApi.php @@ -5,8 +5,8 @@ namespace Square\Apis; use Square\Exceptions\ApiException; -use Square\ApiHelper; use Square\ConfigurationInterface; +use Square\ApiHelper; use Square\Models; use Square\Http\ApiResponse; use Square\Http\HttpRequest; @@ -54,10 +54,10 @@ public function listCards( ?string $sortOrder = null ): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/cards'; + $_queryUrl = $this->config->getBaseUri() . '/v2/cards'; - //process optional query parameters - ApiHelper::appendUrlWithQueryParameters($_queryBuilder, [ + //process query parameters + ApiHelper::appendUrlWithQueryParameters($_queryUrl, [ 'cursor' => $cursor, 'customer_id' => $customerId, 'include_disabled' => (null != $includeDisabled) ? @@ -66,9 +66,6 @@ public function listCards( 'sort_order' => $sortOrder, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -131,10 +128,7 @@ public function listCards( public function createCard(Models\CreateCardRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/cards'; - - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); + $_queryUrl = $this->config->getBaseUri() . '/v2/cards'; //prepare headers $_headers = [ @@ -199,16 +193,13 @@ public function createCard(Models\CreateCardRequest $body): ApiResponse public function retrieveCard(string $cardId): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/cards/{card_id}'; + $_queryUrl = $this->config->getBaseUri() . '/v2/cards/{card_id}'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'card_id' => $cardId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -269,16 +260,13 @@ public function retrieveCard(string $cardId): ApiResponse public function disableCard(string $cardId): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/cards/{card_id}/disable'; + $_queryUrl = $this->config->getBaseUri() . '/v2/cards/{card_id}/disable'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'card_id' => $cardId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, diff --git a/src/Apis/CashDrawersApi.php b/src/Apis/CashDrawersApi.php index 0fbcd093..bbe68cb3 100644 --- a/src/Apis/CashDrawersApi.php +++ b/src/Apis/CashDrawersApi.php @@ -5,8 +5,8 @@ namespace Square\Apis; use Square\Exceptions\ApiException; -use Square\ApiHelper; use Square\ConfigurationInterface; +use Square\ApiHelper; use Square\Http\ApiResponse; use Square\Http\HttpRequest; use Square\Http\HttpResponse; @@ -51,10 +51,10 @@ public function listCashDrawerShifts( ?string $cursor = null ): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/cash-drawers/shifts'; + $_queryUrl = $this->config->getBaseUri() . '/v2/cash-drawers/shifts'; - //process optional query parameters - ApiHelper::appendUrlWithQueryParameters($_queryBuilder, [ + //process query parameters + ApiHelper::appendUrlWithQueryParameters($_queryUrl, [ 'location_id' => $locationId, 'sort_order' => $sortOrder, 'begin_time' => $beginTime, @@ -63,9 +63,6 @@ public function listCashDrawerShifts( 'cursor' => $cursor, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -128,21 +125,18 @@ public function listCashDrawerShifts( public function retrieveCashDrawerShift(string $locationId, string $shiftId): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/cash-drawers/shifts/{shift_id}'; + $_queryUrl = $this->config->getBaseUri() . '/v2/cash-drawers/shifts/{shift_id}'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'shift_id' => $shiftId, ]); - //process optional query parameters - ApiHelper::appendUrlWithQueryParameters($_queryBuilder, [ + //process query parameters + ApiHelper::appendUrlWithQueryParameters($_queryUrl, [ 'location_id' => $locationId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -210,23 +204,20 @@ public function listCashDrawerShiftEvents( ?string $cursor = null ): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/cash-drawers/shifts/{shift_id}/events'; + $_queryUrl = $this->config->getBaseUri() . '/v2/cash-drawers/shifts/{shift_id}/events'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'shift_id' => $shiftId, ]); - //process optional query parameters - ApiHelper::appendUrlWithQueryParameters($_queryBuilder, [ + //process query parameters + ApiHelper::appendUrlWithQueryParameters($_queryUrl, [ 'location_id' => $locationId, 'limit' => $limit, 'cursor' => $cursor, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, diff --git a/src/Apis/CatalogApi.php b/src/Apis/CatalogApi.php index b2c20f24..11d7e75b 100644 --- a/src/Apis/CatalogApi.php +++ b/src/Apis/CatalogApi.php @@ -5,8 +5,8 @@ namespace Square\Apis; use Square\Exceptions\ApiException; -use Square\ApiHelper; use Square\ConfigurationInterface; +use Square\ApiHelper; use Square\Models; use Square\Utils\FileWrapper; use Square\Http\ApiResponse; @@ -48,10 +48,7 @@ public function __construct(ConfigurationInterface $config, array $authManagers, public function batchDeleteCatalogObjects(Models\BatchDeleteCatalogObjectsRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/catalog/batch-delete'; - - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); + $_queryUrl = $this->config->getBaseUri() . '/v2/catalog/batch-delete'; //prepare headers $_headers = [ @@ -124,10 +121,7 @@ public function batchDeleteCatalogObjects(Models\BatchDeleteCatalogObjectsReques public function batchRetrieveCatalogObjects(Models\BatchRetrieveCatalogObjectsRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/catalog/batch-retrieve'; - - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); + $_queryUrl = $this->config->getBaseUri() . '/v2/catalog/batch-retrieve'; //prepare headers $_headers = [ @@ -203,10 +197,7 @@ public function batchRetrieveCatalogObjects(Models\BatchRetrieveCatalogObjectsRe public function batchUpsertCatalogObjects(Models\BatchUpsertCatalogObjectsRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/catalog/batch-upsert'; - - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); + $_queryUrl = $this->config->getBaseUri() . '/v2/catalog/batch-upsert'; //prepare headers $_headers = [ @@ -282,10 +273,7 @@ public function createCatalogImage( ?FileWrapper $imageFile = null ): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/catalog/images'; - - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); + $_queryUrl = $this->config->getBaseUri() . '/v2/catalog/images'; //prepare headers $_headers = [ @@ -297,7 +285,7 @@ public function createCatalogImage( //prepare parameters $_parameters = [ - 'request' => json_encode($request), + 'request' => ApiHelper::serialize($request), 'image_file' => $imageFile === null ? null : $imageFile->createCurlFileInstance('image/jpeg') ]; @@ -367,16 +355,13 @@ public function updateCatalogImage( ?FileWrapper $imageFile = null ): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/catalog/images/{image_id}'; + $_queryUrl = $this->config->getBaseUri() . '/v2/catalog/images/{image_id}'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'image_id' => $imageId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -387,7 +372,7 @@ public function updateCatalogImage( //prepare parameters $_parameters = [ - 'request' => json_encode($request), + 'request' => ApiHelper::serialize($request), 'image_file' => $imageFile === null ? null : $imageFile->createCurlFileInstance('image/jpeg') ]; @@ -445,10 +430,7 @@ public function updateCatalogImage( public function catalogInfo(): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/catalog/info'; - - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); + $_queryUrl = $this->config->getBaseUri() . '/v2/catalog/info'; //prepare headers $_headers = [ @@ -550,18 +532,15 @@ public function listCatalog( ?int $catalogVersion = null ): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/catalog/list'; + $_queryUrl = $this->config->getBaseUri() . '/v2/catalog/list'; - //process optional query parameters - ApiHelper::appendUrlWithQueryParameters($_queryBuilder, [ + //process query parameters + ApiHelper::appendUrlWithQueryParameters($_queryUrl, [ 'cursor' => $cursor, 'types' => $types, 'catalog_version' => $catalogVersion, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -624,10 +603,7 @@ public function listCatalog( public function upsertCatalogObject(Models\UpsertCatalogObjectRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/catalog/object'; - - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); + $_queryUrl = $this->config->getBaseUri() . '/v2/catalog/object'; //prepare headers $_headers = [ @@ -701,16 +677,13 @@ public function upsertCatalogObject(Models\UpsertCatalogObjectRequest $body): Ap public function deleteCatalogObject(string $objectId): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/catalog/object/{object_id}'; + $_queryUrl = $this->config->getBaseUri() . '/v2/catalog/object/{object_id}'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'object_id' => $objectId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -804,23 +777,20 @@ public function retrieveCatalogObject( ?int $catalogVersion = null ): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/catalog/object/{object_id}'; + $_queryUrl = $this->config->getBaseUri() . '/v2/catalog/object/{object_id}'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'object_id' => $objectId, ]); - //process optional query parameters - ApiHelper::appendUrlWithQueryParameters($_queryBuilder, [ + //process query parameters + ApiHelper::appendUrlWithQueryParameters($_queryUrl, [ 'include_related_objects' => (null != $includeRelatedObjects) ? var_export($includeRelatedObjects, true) : false, 'catalog_version' => $catalogVersion, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -898,10 +868,7 @@ public function retrieveCatalogObject( public function searchCatalogObjects(Models\SearchCatalogObjectsRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/catalog/search'; - - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); + $_queryUrl = $this->config->getBaseUri() . '/v2/catalog/search'; //prepare headers $_headers = [ @@ -983,10 +950,7 @@ public function searchCatalogObjects(Models\SearchCatalogObjectsRequest $body): public function searchCatalogItems(Models\SearchCatalogItemsRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/catalog/search-catalog-items'; - - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); + $_queryUrl = $this->config->getBaseUri() . '/v2/catalog/search-catalog-items'; //prepare headers $_headers = [ @@ -1056,10 +1020,7 @@ public function searchCatalogItems(Models\SearchCatalogItemsRequest $body): ApiR public function updateItemModifierLists(Models\UpdateItemModifierListsRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/catalog/update-item-modifier-lists'; - - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); + $_queryUrl = $this->config->getBaseUri() . '/v2/catalog/update-item-modifier-lists'; //prepare headers $_headers = [ @@ -1129,10 +1090,7 @@ public function updateItemModifierLists(Models\UpdateItemModifierListsRequest $b public function updateItemTaxes(Models\UpdateItemTaxesRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/catalog/update-item-taxes'; - - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); + $_queryUrl = $this->config->getBaseUri() . '/v2/catalog/update-item-taxes'; //prepare headers $_headers = [ diff --git a/src/Apis/CheckoutApi.php b/src/Apis/CheckoutApi.php index 0c2b11d1..070a79ed 100644 --- a/src/Apis/CheckoutApi.php +++ b/src/Apis/CheckoutApi.php @@ -5,8 +5,8 @@ namespace Square\Apis; use Square\Exceptions\ApiException; -use Square\ApiHelper; use Square\ConfigurationInterface; +use Square\ApiHelper; use Square\Models; use Square\Http\ApiResponse; use Square\Http\HttpRequest; @@ -41,16 +41,13 @@ public function __construct(ConfigurationInterface $config, array $authManagers, public function createCheckout(string $locationId, Models\CreateCheckoutRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/locations/{location_id}/checkouts'; + $_queryUrl = $this->config->getBaseUri() . '/v2/locations/{location_id}/checkouts'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'location_id' => $locationId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, diff --git a/src/Apis/CustomerGroupsApi.php b/src/Apis/CustomerGroupsApi.php index 8b42a2be..2906aaec 100644 --- a/src/Apis/CustomerGroupsApi.php +++ b/src/Apis/CustomerGroupsApi.php @@ -5,8 +5,8 @@ namespace Square\Apis; use Square\Exceptions\ApiException; -use Square\ApiHelper; use Square\ConfigurationInterface; +use Square\ApiHelper; use Square\Models; use Square\Http\ApiResponse; use Square\Http\HttpRequest; @@ -46,17 +46,14 @@ public function __construct(ConfigurationInterface $config, array $authManagers, public function listCustomerGroups(?string $cursor = null, ?int $limit = null): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/customers/groups'; + $_queryUrl = $this->config->getBaseUri() . '/v2/customers/groups'; - //process optional query parameters - ApiHelper::appendUrlWithQueryParameters($_queryBuilder, [ + //process query parameters + ApiHelper::appendUrlWithQueryParameters($_queryUrl, [ 'cursor' => $cursor, 'limit' => $limit, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -121,10 +118,7 @@ public function listCustomerGroups(?string $cursor = null, ?int $limit = null): public function createCustomerGroup(Models\CreateCustomerGroupRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/customers/groups'; - - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); + $_queryUrl = $this->config->getBaseUri() . '/v2/customers/groups'; //prepare headers $_headers = [ @@ -189,16 +183,13 @@ public function createCustomerGroup(Models\CreateCustomerGroupRequest $body): Ap public function deleteCustomerGroup(string $groupId): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/customers/groups/{group_id}'; + $_queryUrl = $this->config->getBaseUri() . '/v2/customers/groups/{group_id}'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'group_id' => $groupId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -258,16 +249,13 @@ public function deleteCustomerGroup(string $groupId): ApiResponse public function retrieveCustomerGroup(string $groupId): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/customers/groups/{group_id}'; + $_queryUrl = $this->config->getBaseUri() . '/v2/customers/groups/{group_id}'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'group_id' => $groupId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -331,16 +319,13 @@ public function retrieveCustomerGroup(string $groupId): ApiResponse public function updateCustomerGroup(string $groupId, Models\UpdateCustomerGroupRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/customers/groups/{group_id}'; + $_queryUrl = $this->config->getBaseUri() . '/v2/customers/groups/{group_id}'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'group_id' => $groupId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, diff --git a/src/Apis/CustomerSegmentsApi.php b/src/Apis/CustomerSegmentsApi.php index a35dcded..8019de71 100644 --- a/src/Apis/CustomerSegmentsApi.php +++ b/src/Apis/CustomerSegmentsApi.php @@ -5,8 +5,8 @@ namespace Square\Apis; use Square\Exceptions\ApiException; -use Square\ApiHelper; use Square\ConfigurationInterface; +use Square\ApiHelper; use Square\Http\ApiResponse; use Square\Http\HttpRequest; use Square\Http\HttpResponse; @@ -46,17 +46,14 @@ public function __construct(ConfigurationInterface $config, array $authManagers, public function listCustomerSegments(?string $cursor = null, ?int $limit = null): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/customers/segments'; + $_queryUrl = $this->config->getBaseUri() . '/v2/customers/segments'; - //process optional query parameters - ApiHelper::appendUrlWithQueryParameters($_queryBuilder, [ + //process query parameters + ApiHelper::appendUrlWithQueryParameters($_queryUrl, [ 'cursor' => $cursor, 'limit' => $limit, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -116,16 +113,13 @@ public function listCustomerSegments(?string $cursor = null, ?int $limit = null) public function retrieveCustomerSegment(string $segmentId): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/customers/segments/{segment_id}'; + $_queryUrl = $this->config->getBaseUri() . '/v2/customers/segments/{segment_id}'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'segment_id' => $segmentId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, diff --git a/src/Apis/CustomersApi.php b/src/Apis/CustomersApi.php index a6923e1c..86213cec 100644 --- a/src/Apis/CustomersApi.php +++ b/src/Apis/CustomersApi.php @@ -5,8 +5,8 @@ namespace Square\Apis; use Square\Exceptions\ApiException; -use Square\ApiHelper; use Square\ConfigurationInterface; +use Square\ApiHelper; use Square\Models; use Square\Http\ApiResponse; use Square\Http\HttpRequest; @@ -61,19 +61,16 @@ public function listCustomers( ?string $sortOrder = null ): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/customers'; + $_queryUrl = $this->config->getBaseUri() . '/v2/customers'; - //process optional query parameters - ApiHelper::appendUrlWithQueryParameters($_queryBuilder, [ + //process query parameters + ApiHelper::appendUrlWithQueryParameters($_queryUrl, [ 'cursor' => $cursor, 'limit' => $limit, 'sort_field' => $sortField, 'sort_order' => $sortOrder, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -145,10 +142,7 @@ public function listCustomers( public function createCustomer(Models\CreateCustomerRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/customers'; - - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); + $_queryUrl = $this->config->getBaseUri() . '/v2/customers'; //prepare headers $_headers = [ @@ -224,10 +218,7 @@ public function createCustomer(Models\CreateCustomerRequest $body): ApiResponse public function searchCustomers(Models\SearchCustomersRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/customers/search'; - - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); + $_queryUrl = $this->config->getBaseUri() . '/v2/customers/search'; //prepare headers $_headers = [ @@ -305,21 +296,18 @@ public function searchCustomers(Models\SearchCustomersRequest $body): ApiRespons public function deleteCustomer(string $customerId, ?int $version = null): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/customers/{customer_id}'; + $_queryUrl = $this->config->getBaseUri() . '/v2/customers/{customer_id}'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'customer_id' => $customerId, ]); - //process optional query parameters - ApiHelper::appendUrlWithQueryParameters($_queryBuilder, [ + //process query parameters + ApiHelper::appendUrlWithQueryParameters($_queryUrl, [ 'version' => $version, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -379,16 +367,13 @@ public function deleteCustomer(string $customerId, ?int $version = null): ApiRes public function retrieveCustomer(string $customerId): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/customers/{customer_id}'; + $_queryUrl = $this->config->getBaseUri() . '/v2/customers/{customer_id}'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'customer_id' => $customerId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -463,16 +448,13 @@ public function retrieveCustomer(string $customerId): ApiResponse public function updateCustomer(string $customerId, Models\UpdateCustomerRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/customers/{customer_id}'; + $_queryUrl = $this->config->getBaseUri() . '/v2/customers/{customer_id}'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'customer_id' => $customerId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -548,16 +530,13 @@ public function createCustomerCard(string $customerId, Models\CreateCustomerCard trigger_error('Method ' . __METHOD__ . ' is deprecated.', E_USER_DEPRECATED); //prepare query string for API call - $_queryBuilder = '/v2/customers/{customer_id}/cards'; + $_queryUrl = $this->config->getBaseUri() . '/v2/customers/{customer_id}/cards'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'customer_id' => $customerId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -626,17 +605,14 @@ public function deleteCustomerCard(string $customerId, string $cardId): ApiRespo trigger_error('Method ' . __METHOD__ . ' is deprecated.', E_USER_DEPRECATED); //prepare query string for API call - $_queryBuilder = '/v2/customers/{customer_id}/cards/{card_id}'; + $_queryUrl = $this->config->getBaseUri() . '/v2/customers/{customer_id}/cards/{card_id}'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'customer_id' => $customerId, 'card_id' => $cardId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -700,17 +676,14 @@ public function deleteCustomerCard(string $customerId, string $cardId): ApiRespo public function removeGroupFromCustomer(string $customerId, string $groupId): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/customers/{customer_id}/groups/{group_id}'; + $_queryUrl = $this->config->getBaseUri() . '/v2/customers/{customer_id}/groups/{group_id}'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'customer_id' => $customerId, 'group_id' => $groupId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -774,17 +747,14 @@ public function removeGroupFromCustomer(string $customerId, string $groupId): Ap public function addGroupToCustomer(string $customerId, string $groupId): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/customers/{customer_id}/groups/{group_id}'; + $_queryUrl = $this->config->getBaseUri() . '/v2/customers/{customer_id}/groups/{group_id}'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'customer_id' => $customerId, 'group_id' => $groupId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, diff --git a/src/Apis/DevicesApi.php b/src/Apis/DevicesApi.php index 568619d8..af59a4a1 100644 --- a/src/Apis/DevicesApi.php +++ b/src/Apis/DevicesApi.php @@ -5,8 +5,8 @@ namespace Square\Apis; use Square\Exceptions\ApiException; -use Square\ApiHelper; use Square\ConfigurationInterface; +use Square\ApiHelper; use Square\Models; use Square\Http\ApiResponse; use Square\Http\HttpRequest; @@ -51,19 +51,16 @@ public function listDeviceCodes( ?string $status = null ): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/devices/codes'; + $_queryUrl = $this->config->getBaseUri() . '/v2/devices/codes'; - //process optional query parameters - ApiHelper::appendUrlWithQueryParameters($_queryBuilder, [ + //process query parameters + ApiHelper::appendUrlWithQueryParameters($_queryUrl, [ 'cursor' => $cursor, 'location_id' => $locationId, 'product_type' => $productType, 'status' => $status, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -127,10 +124,7 @@ public function listDeviceCodes( public function createDeviceCode(Models\CreateDeviceCodeRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/devices/codes'; - - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); + $_queryUrl = $this->config->getBaseUri() . '/v2/devices/codes'; //prepare headers $_headers = [ @@ -195,16 +189,13 @@ public function createDeviceCode(Models\CreateDeviceCodeRequest $body): ApiRespo public function getDeviceCode(string $id): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/devices/codes/{id}'; + $_queryUrl = $this->config->getBaseUri() . '/v2/devices/codes/{id}'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'id' => $id, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, diff --git a/src/Apis/DisputesApi.php b/src/Apis/DisputesApi.php index 3c993036..3ce58d49 100644 --- a/src/Apis/DisputesApi.php +++ b/src/Apis/DisputesApi.php @@ -5,8 +5,8 @@ namespace Square\Apis; use Square\Exceptions\ApiException; -use Square\ApiHelper; use Square\ConfigurationInterface; +use Square\ApiHelper; use Square\Models; use Square\Utils\FileWrapper; use Square\Http\ApiResponse; @@ -50,18 +50,15 @@ public function listDisputes( ?string $locationId = null ): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/disputes'; + $_queryUrl = $this->config->getBaseUri() . '/v2/disputes'; - //process optional query parameters - ApiHelper::appendUrlWithQueryParameters($_queryBuilder, [ + //process query parameters + ApiHelper::appendUrlWithQueryParameters($_queryUrl, [ 'cursor' => $cursor, 'states' => $states, 'location_id' => $locationId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -121,16 +118,13 @@ public function listDisputes( public function retrieveDispute(string $disputeId): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/disputes/{dispute_id}'; + $_queryUrl = $this->config->getBaseUri() . '/v2/disputes/{dispute_id}'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'dispute_id' => $disputeId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -194,16 +188,13 @@ public function retrieveDispute(string $disputeId): ApiResponse public function acceptDispute(string $disputeId): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/disputes/{dispute_id}/accept'; + $_queryUrl = $this->config->getBaseUri() . '/v2/disputes/{dispute_id}/accept'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'dispute_id' => $disputeId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -267,21 +258,18 @@ public function acceptDispute(string $disputeId): ApiResponse public function listDisputeEvidence(string $disputeId, ?string $cursor = null): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/disputes/{dispute_id}/evidence'; + $_queryUrl = $this->config->getBaseUri() . '/v2/disputes/{dispute_id}/evidence'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'dispute_id' => $disputeId, ]); - //process optional query parameters - ApiHelper::appendUrlWithQueryParameters($_queryBuilder, [ + //process query parameters + ApiHelper::appendUrlWithQueryParameters($_queryUrl, [ 'cursor' => $cursor, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -348,16 +336,13 @@ public function createDisputeEvidenceFile( ?FileWrapper $imageFile = null ): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/disputes/{dispute_id}/evidence-files'; + $_queryUrl = $this->config->getBaseUri() . '/v2/disputes/{dispute_id}/evidence-files'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'dispute_id' => $disputeId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -368,7 +353,7 @@ public function createDisputeEvidenceFile( //prepare parameters $_parameters = [ - 'request' => json_encode($request), + 'request' => ApiHelper::serialize($request), 'image_file' => $imageFile === null ? null : $imageFile->createCurlFileInstance('image/jpeg') ]; @@ -433,16 +418,13 @@ public function createDisputeEvidenceText( Models\CreateDisputeEvidenceTextRequest $body ): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/disputes/{dispute_id}/evidence-text'; + $_queryUrl = $this->config->getBaseUri() . '/v2/disputes/{dispute_id}/evidence-text'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'dispute_id' => $disputeId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -510,17 +492,14 @@ public function createDisputeEvidenceText( public function deleteDisputeEvidence(string $disputeId, string $evidenceId): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/disputes/{dispute_id}/evidence/{evidence_id}'; + $_queryUrl = $this->config->getBaseUri() . '/v2/disputes/{dispute_id}/evidence/{evidence_id}'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'dispute_id' => $disputeId, 'evidence_id' => $evidenceId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -584,17 +563,14 @@ public function deleteDisputeEvidence(string $disputeId, string $evidenceId): Ap public function retrieveDisputeEvidence(string $disputeId, string $evidenceId): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/disputes/{dispute_id}/evidence/{evidence_id}'; + $_queryUrl = $this->config->getBaseUri() . '/v2/disputes/{dispute_id}/evidence/{evidence_id}'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'dispute_id' => $disputeId, 'evidence_id' => $evidenceId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -659,16 +635,13 @@ public function retrieveDisputeEvidence(string $disputeId, string $evidenceId): public function submitEvidence(string $disputeId): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/disputes/{dispute_id}/submit-evidence'; + $_queryUrl = $this->config->getBaseUri() . '/v2/disputes/{dispute_id}/submit-evidence'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'dispute_id' => $disputeId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, diff --git a/src/Apis/EmployeesApi.php b/src/Apis/EmployeesApi.php index ea31f9ed..ec930193 100644 --- a/src/Apis/EmployeesApi.php +++ b/src/Apis/EmployeesApi.php @@ -5,8 +5,8 @@ namespace Square\Apis; use Square\Exceptions\ApiException; -use Square\ApiHelper; use Square\ConfigurationInterface; +use Square\ApiHelper; use Square\Http\ApiResponse; use Square\Http\HttpRequest; use Square\Http\HttpResponse; @@ -45,19 +45,16 @@ public function listEmployees( trigger_error('Method ' . __METHOD__ . ' is deprecated.', E_USER_DEPRECATED); //prepare query string for API call - $_queryBuilder = '/v2/employees'; + $_queryUrl = $this->config->getBaseUri() . '/v2/employees'; - //process optional query parameters - ApiHelper::appendUrlWithQueryParameters($_queryBuilder, [ + //process query parameters + ApiHelper::appendUrlWithQueryParameters($_queryUrl, [ 'location_id' => $locationId, 'status' => $status, 'limit' => $limit, 'cursor' => $cursor, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -121,16 +118,13 @@ public function retrieveEmployee(string $id): ApiResponse trigger_error('Method ' . __METHOD__ . ' is deprecated.', E_USER_DEPRECATED); //prepare query string for API call - $_queryBuilder = '/v2/employees/{id}'; + $_queryUrl = $this->config->getBaseUri() . '/v2/employees/{id}'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'id' => $id, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, diff --git a/src/Apis/GiftCardActivitiesApi.php b/src/Apis/GiftCardActivitiesApi.php index 8be8ccdf..466d6776 100644 --- a/src/Apis/GiftCardActivitiesApi.php +++ b/src/Apis/GiftCardActivitiesApi.php @@ -5,8 +5,8 @@ namespace Square\Apis; use Square\Exceptions\ApiException; -use Square\ApiHelper; use Square\ConfigurationInterface; +use Square\ApiHelper; use Square\Models; use Square\Http\ApiResponse; use Square\Http\HttpRequest; @@ -75,10 +75,10 @@ public function listGiftCardActivities( ?string $sortOrder = null ): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/gift-cards/activities'; + $_queryUrl = $this->config->getBaseUri() . '/v2/gift-cards/activities'; - //process optional query parameters - ApiHelper::appendUrlWithQueryParameters($_queryBuilder, [ + //process query parameters + ApiHelper::appendUrlWithQueryParameters($_queryUrl, [ 'gift_card_id' => $giftCardId, 'type' => $type, 'location_id' => $locationId, @@ -89,9 +89,6 @@ public function listGiftCardActivities( 'sort_order' => $sortOrder, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -158,10 +155,7 @@ public function listGiftCardActivities( public function createGiftCardActivity(Models\CreateGiftCardActivityRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/gift-cards/activities'; - - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); + $_queryUrl = $this->config->getBaseUri() . '/v2/gift-cards/activities'; //prepare headers $_headers = [ diff --git a/src/Apis/GiftCardsApi.php b/src/Apis/GiftCardsApi.php index 9390f0b2..92391092 100644 --- a/src/Apis/GiftCardsApi.php +++ b/src/Apis/GiftCardsApi.php @@ -5,8 +5,8 @@ namespace Square\Apis; use Square\Exceptions\ApiException; -use Square\ApiHelper; use Square\ConfigurationInterface; +use Square\ApiHelper; use Square\Models; use Square\Http\ApiResponse; use Square\Http\HttpRequest; @@ -58,10 +58,10 @@ public function listGiftCards( ?string $customerId = null ): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/gift-cards'; + $_queryUrl = $this->config->getBaseUri() . '/v2/gift-cards'; - //process optional query parameters - ApiHelper::appendUrlWithQueryParameters($_queryBuilder, [ + //process query parameters + ApiHelper::appendUrlWithQueryParameters($_queryUrl, [ 'type' => $type, 'state' => $state, 'limit' => $limit, @@ -69,9 +69,6 @@ public function listGiftCards( 'customer_id' => $customerId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -138,10 +135,7 @@ public function listGiftCards( public function createGiftCard(Models\CreateGiftCardRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/gift-cards'; - - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); + $_queryUrl = $this->config->getBaseUri() . '/v2/gift-cards'; //prepare headers $_headers = [ @@ -209,10 +203,7 @@ public function createGiftCard(Models\CreateGiftCardRequest $body): ApiResponse public function retrieveGiftCardFromGAN(Models\RetrieveGiftCardFromGANRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/gift-cards/from-gan'; - - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); + $_queryUrl = $this->config->getBaseUri() . '/v2/gift-cards/from-gan'; //prepare headers $_headers = [ @@ -280,10 +271,7 @@ public function retrieveGiftCardFromGAN(Models\RetrieveGiftCardFromGANRequest $b public function retrieveGiftCardFromNonce(Models\RetrieveGiftCardFromNonceRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/gift-cards/from-nonce'; - - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); + $_queryUrl = $this->config->getBaseUri() . '/v2/gift-cards/from-nonce'; //prepare headers $_headers = [ @@ -352,16 +340,13 @@ public function retrieveGiftCardFromNonce(Models\RetrieveGiftCardFromNonceReques public function linkCustomerToGiftCard(string $giftCardId, Models\LinkCustomerToGiftCardRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/gift-cards/{gift_card_id}/link-customer'; + $_queryUrl = $this->config->getBaseUri() . '/v2/gift-cards/{gift_card_id}/link-customer'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'gift_card_id' => $giftCardId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -431,16 +416,13 @@ public function unlinkCustomerFromGiftCard( Models\UnlinkCustomerFromGiftCardRequest $body ): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/gift-cards/{gift_card_id}/unlink-customer'; + $_queryUrl = $this->config->getBaseUri() . '/v2/gift-cards/{gift_card_id}/unlink-customer'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'gift_card_id' => $giftCardId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -504,16 +486,13 @@ public function unlinkCustomerFromGiftCard( public function retrieveGiftCard(string $id): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/gift-cards/{id}'; + $_queryUrl = $this->config->getBaseUri() . '/v2/gift-cards/{id}'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'id' => $id, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, diff --git a/src/Apis/InventoryApi.php b/src/Apis/InventoryApi.php index 527c4f17..9b755bb7 100644 --- a/src/Apis/InventoryApi.php +++ b/src/Apis/InventoryApi.php @@ -5,8 +5,8 @@ namespace Square\Apis; use Square\Exceptions\ApiException; -use Square\ApiHelper; use Square\ConfigurationInterface; +use Square\ApiHelper; use Square\Models; use Square\Http\ApiResponse; use Square\Http\HttpRequest; @@ -42,16 +42,13 @@ public function deprecatedRetrieveInventoryAdjustment(string $adjustmentId): Api trigger_error('Method ' . __METHOD__ . ' is deprecated.', E_USER_DEPRECATED); //prepare query string for API call - $_queryBuilder = '/v2/inventory/adjustment/{adjustment_id}'; + $_queryUrl = $this->config->getBaseUri() . '/v2/inventory/adjustment/{adjustment_id}'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'adjustment_id' => $adjustmentId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -113,16 +110,13 @@ public function deprecatedRetrieveInventoryAdjustment(string $adjustmentId): Api public function retrieveInventoryAdjustment(string $adjustmentId): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/inventory/adjustments/{adjustment_id}'; + $_queryUrl = $this->config->getBaseUri() . '/v2/inventory/adjustments/{adjustment_id}'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'adjustment_id' => $adjustmentId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -191,10 +185,7 @@ public function deprecatedBatchChangeInventory(Models\BatchChangeInventoryReques trigger_error('Method ' . __METHOD__ . ' is deprecated.', E_USER_DEPRECATED); //prepare query string for API call - $_queryBuilder = '/v2/inventory/batch-change'; - - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); + $_queryUrl = $this->config->getBaseUri() . '/v2/inventory/batch-change'; //prepare headers $_headers = [ @@ -269,10 +260,7 @@ public function deprecatedBatchRetrieveInventoryChanges( trigger_error('Method ' . __METHOD__ . ' is deprecated.', E_USER_DEPRECATED); //prepare query string for API call - $_queryBuilder = '/v2/inventory/batch-retrieve-changes'; - - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); + $_queryUrl = $this->config->getBaseUri() . '/v2/inventory/batch-retrieve-changes'; //prepare headers $_headers = [ @@ -347,10 +335,7 @@ public function deprecatedBatchRetrieveInventoryCounts( trigger_error('Method ' . __METHOD__ . ' is deprecated.', E_USER_DEPRECATED); //prepare query string for API call - $_queryBuilder = '/v2/inventory/batch-retrieve-counts'; - - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); + $_queryUrl = $this->config->getBaseUri() . '/v2/inventory/batch-retrieve-counts'; //prepare headers $_headers = [ @@ -422,10 +407,7 @@ public function deprecatedBatchRetrieveInventoryCounts( public function batchChangeInventory(Models\BatchChangeInventoryRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/inventory/changes/batch-create'; - - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); + $_queryUrl = $this->config->getBaseUri() . '/v2/inventory/changes/batch-create'; //prepare headers $_headers = [ @@ -500,10 +482,7 @@ public function batchChangeInventory(Models\BatchChangeInventoryRequest $body): public function batchRetrieveInventoryChanges(Models\BatchRetrieveInventoryChangesRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/inventory/changes/batch-retrieve'; - - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); + $_queryUrl = $this->config->getBaseUri() . '/v2/inventory/changes/batch-retrieve'; //prepare headers $_headers = [ @@ -581,10 +560,7 @@ public function batchRetrieveInventoryChanges(Models\BatchRetrieveInventoryChang public function batchRetrieveInventoryCounts(Models\BatchRetrieveInventoryCountsRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/inventory/counts/batch-retrieve'; - - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); + $_queryUrl = $this->config->getBaseUri() . '/v2/inventory/counts/batch-retrieve'; //prepare headers $_headers = [ @@ -656,16 +632,13 @@ public function deprecatedRetrieveInventoryPhysicalCount(string $physicalCountId trigger_error('Method ' . __METHOD__ . ' is deprecated.', E_USER_DEPRECATED); //prepare query string for API call - $_queryBuilder = '/v2/inventory/physical-count/{physical_count_id}'; + $_queryUrl = $this->config->getBaseUri() . '/v2/inventory/physical-count/{physical_count_id}'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'physical_count_id' => $physicalCountId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -727,16 +700,14 @@ public function deprecatedRetrieveInventoryPhysicalCount(string $physicalCountId public function retrieveInventoryPhysicalCount(string $physicalCountId): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/inventory/physical-counts/{physical_count_id}'; + $_queryUrl = $this->config->getBaseUri() . + '/v2/inventory/physical-counts/{physical_count_id}'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'physical_count_id' => $physicalCountId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -797,16 +768,13 @@ public function retrieveInventoryPhysicalCount(string $physicalCountId): ApiResp public function retrieveInventoryTransfer(string $transferId): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/inventory/transfers/{transfer_id}'; + $_queryUrl = $this->config->getBaseUri() . '/v2/inventory/transfers/{transfer_id}'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'transfer_id' => $transferId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -880,22 +848,19 @@ public function retrieveInventoryCount( ?string $cursor = null ): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/inventory/{catalog_object_id}'; + $_queryUrl = $this->config->getBaseUri() . '/v2/inventory/{catalog_object_id}'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'catalog_object_id' => $catalogObjectId, ]); - //process optional query parameters - ApiHelper::appendUrlWithQueryParameters($_queryBuilder, [ + //process query parameters + ApiHelper::appendUrlWithQueryParameters($_queryUrl, [ 'location_ids' => $locationIds, 'cursor' => $cursor, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -983,22 +948,19 @@ public function retrieveInventoryChanges( trigger_error('Method ' . __METHOD__ . ' is deprecated.', E_USER_DEPRECATED); //prepare query string for API call - $_queryBuilder = '/v2/inventory/{catalog_object_id}/changes'; + $_queryUrl = $this->config->getBaseUri() . '/v2/inventory/{catalog_object_id}/changes'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'catalog_object_id' => $catalogObjectId, ]); - //process optional query parameters - ApiHelper::appendUrlWithQueryParameters($_queryBuilder, [ + //process query parameters + ApiHelper::appendUrlWithQueryParameters($_queryUrl, [ 'location_ids' => $locationIds, 'cursor' => $cursor, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, diff --git a/src/Apis/InvoicesApi.php b/src/Apis/InvoicesApi.php index 9070e605..537795ce 100644 --- a/src/Apis/InvoicesApi.php +++ b/src/Apis/InvoicesApi.php @@ -5,8 +5,8 @@ namespace Square\Apis; use Square\Exceptions\ApiException; -use Square\ApiHelper; use Square\ConfigurationInterface; +use Square\ApiHelper; use Square\Models; use Square\Http\ApiResponse; use Square\Http\HttpRequest; @@ -44,18 +44,15 @@ public function __construct(ConfigurationInterface $config, array $authManagers, public function listInvoices(string $locationId, ?string $cursor = null, ?int $limit = null): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/invoices'; + $_queryUrl = $this->config->getBaseUri() . '/v2/invoices'; - //process optional query parameters - ApiHelper::appendUrlWithQueryParameters($_queryBuilder, [ + //process query parameters + ApiHelper::appendUrlWithQueryParameters($_queryUrl, [ 'location_id' => $locationId, 'cursor' => $cursor, 'limit' => $limit, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -123,10 +120,7 @@ public function listInvoices(string $locationId, ?string $cursor = null, ?int $l public function createInvoice(Models\CreateInvoiceRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/invoices'; - - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); + $_queryUrl = $this->config->getBaseUri() . '/v2/invoices'; //prepare headers $_headers = [ @@ -200,10 +194,7 @@ public function createInvoice(Models\CreateInvoiceRequest $body): ApiResponse public function searchInvoices(Models\SearchInvoicesRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/invoices/search'; - - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); + $_queryUrl = $this->config->getBaseUri() . '/v2/invoices/search'; //prepare headers $_headers = [ @@ -273,21 +264,18 @@ public function searchInvoices(Models\SearchInvoicesRequest $body): ApiResponse public function deleteInvoice(string $invoiceId, ?int $version = null): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/invoices/{invoice_id}'; + $_queryUrl = $this->config->getBaseUri() . '/v2/invoices/{invoice_id}'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'invoice_id' => $invoiceId, ]); - //process optional query parameters - ApiHelper::appendUrlWithQueryParameters($_queryBuilder, [ + //process query parameters + ApiHelper::appendUrlWithQueryParameters($_queryUrl, [ 'version' => $version, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -347,16 +335,13 @@ public function deleteInvoice(string $invoiceId, ?int $version = null): ApiRespo public function getInvoice(string $invoiceId): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/invoices/{invoice_id}'; + $_queryUrl = $this->config->getBaseUri() . '/v2/invoices/{invoice_id}'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'invoice_id' => $invoiceId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -427,16 +412,13 @@ public function getInvoice(string $invoiceId): ApiResponse public function updateInvoice(string $invoiceId, Models\UpdateInvoiceRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/invoices/{invoice_id}'; + $_queryUrl = $this->config->getBaseUri() . '/v2/invoices/{invoice_id}'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'invoice_id' => $invoiceId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -508,16 +490,13 @@ public function updateInvoice(string $invoiceId, Models\UpdateInvoiceRequest $bo public function cancelInvoice(string $invoiceId, Models\CancelInvoiceRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/invoices/{invoice_id}/cancel'; + $_queryUrl = $this->config->getBaseUri() . '/v2/invoices/{invoice_id}/cancel'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'invoice_id' => $invoiceId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -595,16 +574,13 @@ public function cancelInvoice(string $invoiceId, Models\CancelInvoiceRequest $bo public function publishInvoice(string $invoiceId, Models\PublishInvoiceRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/invoices/{invoice_id}/publish'; + $_queryUrl = $this->config->getBaseUri() . '/v2/invoices/{invoice_id}/publish'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'invoice_id' => $invoiceId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, diff --git a/src/Apis/LaborApi.php b/src/Apis/LaborApi.php index c7d7e996..404ab05e 100644 --- a/src/Apis/LaborApi.php +++ b/src/Apis/LaborApi.php @@ -5,8 +5,8 @@ namespace Square\Apis; use Square\Exceptions\ApiException; -use Square\ApiHelper; use Square\ConfigurationInterface; +use Square\ApiHelper; use Square\Models; use Square\Http\ApiResponse; use Square\Http\HttpRequest; @@ -41,18 +41,15 @@ public function __construct(ConfigurationInterface $config, array $authManagers, public function listBreakTypes(?string $locationId = null, ?int $limit = null, ?string $cursor = null): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/labor/break-types'; + $_queryUrl = $this->config->getBaseUri() . '/v2/labor/break-types'; - //process optional query parameters - ApiHelper::appendUrlWithQueryParameters($_queryBuilder, [ + //process query parameters + ApiHelper::appendUrlWithQueryParameters($_queryUrl, [ 'location_id' => $locationId, 'limit' => $limit, 'cursor' => $cursor, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -128,10 +125,7 @@ public function listBreakTypes(?string $locationId = null, ?int $limit = null, ? public function createBreakType(Models\CreateBreakTypeRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/labor/break-types'; - - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); + $_queryUrl = $this->config->getBaseUri() . '/v2/labor/break-types'; //prepare headers $_headers = [ @@ -198,16 +192,13 @@ public function createBreakType(Models\CreateBreakTypeRequest $body): ApiRespons public function deleteBreakType(string $id): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/labor/break-types/{id}'; + $_queryUrl = $this->config->getBaseUri() . '/v2/labor/break-types/{id}'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'id' => $id, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -267,16 +258,13 @@ public function deleteBreakType(string $id): ApiResponse public function getBreakType(string $id): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/labor/break-types/{id}'; + $_queryUrl = $this->config->getBaseUri() . '/v2/labor/break-types/{id}'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'id' => $id, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -340,16 +328,13 @@ public function getBreakType(string $id): ApiResponse public function updateBreakType(string $id, Models\UpdateBreakTypeRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/labor/break-types/{id}'; + $_queryUrl = $this->config->getBaseUri() . '/v2/labor/break-types/{id}'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'id' => $id, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -425,18 +410,15 @@ public function listEmployeeWages( trigger_error('Method ' . __METHOD__ . ' is deprecated.', E_USER_DEPRECATED); //prepare query string for API call - $_queryBuilder = '/v2/labor/employee-wages'; + $_queryUrl = $this->config->getBaseUri() . '/v2/labor/employee-wages'; - //process optional query parameters - ApiHelper::appendUrlWithQueryParameters($_queryBuilder, [ + //process query parameters + ApiHelper::appendUrlWithQueryParameters($_queryUrl, [ 'employee_id' => $employeeId, 'limit' => $limit, 'cursor' => $cursor, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -500,16 +482,13 @@ public function getEmployeeWage(string $id): ApiResponse trigger_error('Method ' . __METHOD__ . ' is deprecated.', E_USER_DEPRECATED); //prepare query string for API call - $_queryBuilder = '/v2/labor/employee-wages/{id}'; + $_queryUrl = $this->config->getBaseUri() . '/v2/labor/employee-wages/{id}'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'id' => $id, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -589,10 +568,7 @@ public function getEmployeeWage(string $id): ApiResponse public function createShift(Models\CreateShiftRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/labor/shifts'; - - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); + $_queryUrl = $this->config->getBaseUri() . '/v2/labor/shifts'; //prepare headers $_headers = [ @@ -673,10 +649,7 @@ public function createShift(Models\CreateShiftRequest $body): ApiResponse public function searchShifts(Models\SearchShiftsRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/labor/shifts/search'; - - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); + $_queryUrl = $this->config->getBaseUri() . '/v2/labor/shifts/search'; //prepare headers $_headers = [ @@ -741,16 +714,13 @@ public function searchShifts(Models\SearchShiftsRequest $body): ApiResponse public function deleteShift(string $id): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/labor/shifts/{id}'; + $_queryUrl = $this->config->getBaseUri() . '/v2/labor/shifts/{id}'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'id' => $id, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -810,16 +780,13 @@ public function deleteShift(string $id): ApiResponse public function getShift(string $id): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/labor/shifts/{id}'; + $_queryUrl = $this->config->getBaseUri() . '/v2/labor/shifts/{id}'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'id' => $id, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -884,16 +851,13 @@ public function getShift(string $id): ApiResponse public function updateShift(string $id, Models\UpdateShiftRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/labor/shifts/{id}'; + $_queryUrl = $this->config->getBaseUri() . '/v2/labor/shifts/{id}'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'id' => $id, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -966,18 +930,15 @@ public function listTeamMemberWages( ?string $cursor = null ): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/labor/team-member-wages'; + $_queryUrl = $this->config->getBaseUri() . '/v2/labor/team-member-wages'; - //process optional query parameters - ApiHelper::appendUrlWithQueryParameters($_queryBuilder, [ + //process query parameters + ApiHelper::appendUrlWithQueryParameters($_queryUrl, [ 'team_member_id' => $teamMemberId, 'limit' => $limit, 'cursor' => $cursor, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -1037,16 +998,13 @@ public function listTeamMemberWages( public function getTeamMemberWage(string $id): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/labor/team-member-wages/{id}'; + $_queryUrl = $this->config->getBaseUri() . '/v2/labor/team-member-wages/{id}'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'id' => $id, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -1107,17 +1065,14 @@ public function getTeamMemberWage(string $id): ApiResponse public function listWorkweekConfigs(?int $limit = null, ?string $cursor = null): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/labor/workweek-configs'; + $_queryUrl = $this->config->getBaseUri() . '/v2/labor/workweek-configs'; - //process optional query parameters - ApiHelper::appendUrlWithQueryParameters($_queryBuilder, [ + //process query parameters + ApiHelper::appendUrlWithQueryParameters($_queryUrl, [ 'limit' => $limit, 'cursor' => $cursor, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -1181,16 +1136,13 @@ public function listWorkweekConfigs(?int $limit = null, ?string $cursor = null): public function updateWorkweekConfig(string $id, Models\UpdateWorkweekConfigRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/labor/workweek-configs/{id}'; + $_queryUrl = $this->config->getBaseUri() . '/v2/labor/workweek-configs/{id}'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'id' => $id, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, diff --git a/src/Apis/LocationsApi.php b/src/Apis/LocationsApi.php index 870a27d9..d73d52f5 100644 --- a/src/Apis/LocationsApi.php +++ b/src/Apis/LocationsApi.php @@ -5,8 +5,8 @@ namespace Square\Apis; use Square\Exceptions\ApiException; -use Square\ApiHelper; use Square\ConfigurationInterface; +use Square\ApiHelper; use Square\Models; use Square\Http\ApiResponse; use Square\Http\HttpRequest; @@ -35,10 +35,7 @@ public function __construct(ConfigurationInterface $config, array $authManagers, public function listLocations(): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/locations'; - - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); + $_queryUrl = $this->config->getBaseUri() . '/v2/locations'; //prepare headers $_headers = [ @@ -90,10 +87,10 @@ public function listLocations(): ApiResponse /** * Creates a [location](https://developer.squareup.com/docs/locations-api). * Creating new locations allows for separate configuration of receipt layouts, item prices, - * and sales reports. Developers can use locations to separate sales activity via applications + * and sales reports. Developers can use locations to separate sales activity through applications * that integrate with Square from sales activity elsewhere in a seller's account. - * Locations created programmatically with the Locations API will last forever and - * are visible to the seller for their own management, so ensure that + * Locations created programmatically with the Locations API last forever and + * are visible to the seller for their own management. Therefore, ensure that * each location has a sensible and unique name. * * @param Models\CreateLocationRequest $body An object containing the fields to POST for the @@ -108,10 +105,7 @@ public function listLocations(): ApiResponse public function createLocation(Models\CreateLocationRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/locations'; - - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); + $_queryUrl = $this->config->getBaseUri() . '/v2/locations'; //prepare headers $_headers = [ @@ -179,16 +173,13 @@ public function createLocation(Models\CreateLocationRequest $body): ApiResponse public function retrieveLocation(string $locationId): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/locations/{location_id}'; + $_queryUrl = $this->config->getBaseUri() . '/v2/locations/{location_id}'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'location_id' => $locationId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -252,16 +243,13 @@ public function retrieveLocation(string $locationId): ApiResponse public function updateLocation(string $locationId, Models\UpdateLocationRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/locations/{location_id}'; + $_queryUrl = $this->config->getBaseUri() . '/v2/locations/{location_id}'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'location_id' => $locationId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, diff --git a/src/Apis/LoyaltyApi.php b/src/Apis/LoyaltyApi.php index 0025063e..aeee6315 100644 --- a/src/Apis/LoyaltyApi.php +++ b/src/Apis/LoyaltyApi.php @@ -5,8 +5,8 @@ namespace Square\Apis; use Square\Exceptions\ApiException; -use Square\ApiHelper; use Square\ConfigurationInterface; +use Square\ApiHelper; use Square\Models; use Square\Http\ApiResponse; use Square\Http\HttpRequest; @@ -39,10 +39,7 @@ public function __construct(ConfigurationInterface $config, array $authManagers, public function createLoyaltyAccount(Models\CreateLoyaltyAccountRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/loyalty/accounts'; - - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); + $_queryUrl = $this->config->getBaseUri() . '/v2/loyalty/accounts'; //prepare headers $_headers = [ @@ -115,10 +112,7 @@ public function createLoyaltyAccount(Models\CreateLoyaltyAccountRequest $body): public function searchLoyaltyAccounts(Models\SearchLoyaltyAccountsRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/loyalty/accounts/search'; - - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); + $_queryUrl = $this->config->getBaseUri() . '/v2/loyalty/accounts/search'; //prepare headers $_headers = [ @@ -183,16 +177,13 @@ public function searchLoyaltyAccounts(Models\SearchLoyaltyAccountsRequest $body) public function retrieveLoyaltyAccount(string $accountId): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/loyalty/accounts/{account_id}'; + $_queryUrl = $this->config->getBaseUri() . '/v2/loyalty/accounts/{account_id}'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'account_id' => $accountId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -267,16 +258,13 @@ public function accumulateLoyaltyPoints( Models\AccumulateLoyaltyPointsRequest $body ): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/loyalty/accounts/{account_id}/accumulate'; + $_queryUrl = $this->config->getBaseUri() . '/v2/loyalty/accounts/{account_id}/accumulate'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'account_id' => $accountId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -350,16 +338,13 @@ public function accumulateLoyaltyPoints( public function adjustLoyaltyPoints(string $accountId, Models\AdjustLoyaltyPointsRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/loyalty/accounts/{account_id}/adjust'; + $_queryUrl = $this->config->getBaseUri() . '/v2/loyalty/accounts/{account_id}/adjust'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'account_id' => $accountId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -433,10 +418,7 @@ public function adjustLoyaltyPoints(string $accountId, Models\AdjustLoyaltyPoint public function searchLoyaltyEvents(Models\SearchLoyaltyEventsRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/loyalty/events/search'; - - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); + $_queryUrl = $this->config->getBaseUri() . '/v2/loyalty/events/search'; //prepare headers $_headers = [ @@ -510,10 +492,7 @@ public function listLoyaltyPrograms(): ApiResponse trigger_error('Method ' . __METHOD__ . ' is deprecated.', E_USER_DEPRECATED); //prepare query string for API call - $_queryBuilder = '/v2/loyalty/programs'; - - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); + $_queryUrl = $this->config->getBaseUri() . '/v2/loyalty/programs'; //prepare headers $_headers = [ @@ -580,16 +559,13 @@ public function listLoyaltyPrograms(): ApiResponse public function retrieveLoyaltyProgram(string $programId): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/loyalty/programs/{program_id}'; + $_queryUrl = $this->config->getBaseUri() . '/v2/loyalty/programs/{program_id}'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'program_id' => $programId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -665,16 +641,13 @@ public function retrieveLoyaltyProgram(string $programId): ApiResponse public function calculateLoyaltyPoints(string $programId, Models\CalculateLoyaltyPointsRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/loyalty/programs/{program_id}/calculate'; + $_queryUrl = $this->config->getBaseUri() . '/v2/loyalty/programs/{program_id}/calculate'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'program_id' => $programId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -748,10 +721,7 @@ public function calculateLoyaltyPoints(string $programId, Models\CalculateLoyalt public function createLoyaltyReward(Models\CreateLoyaltyRewardRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/loyalty/rewards'; - - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); + $_queryUrl = $this->config->getBaseUri() . '/v2/loyalty/rewards'; //prepare headers $_headers = [ @@ -826,10 +796,7 @@ public function createLoyaltyReward(Models\CreateLoyaltyRewardRequest $body): Ap public function searchLoyaltyRewards(Models\SearchLoyaltyRewardsRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/loyalty/rewards/search'; - - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); + $_queryUrl = $this->config->getBaseUri() . '/v2/loyalty/rewards/search'; //prepare headers $_headers = [ @@ -902,16 +869,13 @@ public function searchLoyaltyRewards(Models\SearchLoyaltyRewardsRequest $body): public function deleteLoyaltyReward(string $rewardId): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/loyalty/rewards/{reward_id}'; + $_queryUrl = $this->config->getBaseUri() . '/v2/loyalty/rewards/{reward_id}'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'reward_id' => $rewardId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -971,16 +935,13 @@ public function deleteLoyaltyReward(string $rewardId): ApiResponse public function retrieveLoyaltyReward(string $rewardId): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/loyalty/rewards/{reward_id}'; + $_queryUrl = $this->config->getBaseUri() . '/v2/loyalty/rewards/{reward_id}'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'reward_id' => $rewardId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -1054,16 +1015,13 @@ public function retrieveLoyaltyReward(string $rewardId): ApiResponse public function redeemLoyaltyReward(string $rewardId, Models\RedeemLoyaltyRewardRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/loyalty/rewards/{reward_id}/redeem'; + $_queryUrl = $this->config->getBaseUri() . '/v2/loyalty/rewards/{reward_id}/redeem'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'reward_id' => $rewardId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, diff --git a/src/Apis/MerchantsApi.php b/src/Apis/MerchantsApi.php index 168c2fcc..2b0db9a4 100644 --- a/src/Apis/MerchantsApi.php +++ b/src/Apis/MerchantsApi.php @@ -5,8 +5,8 @@ namespace Square\Apis; use Square\Exceptions\ApiException; -use Square\ApiHelper; use Square\ConfigurationInterface; +use Square\ApiHelper; use Square\Http\ApiResponse; use Square\Http\HttpRequest; use Square\Http\HttpResponse; @@ -43,16 +43,13 @@ public function __construct(ConfigurationInterface $config, array $authManagers, public function listMerchants(?int $cursor = null): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/merchants'; + $_queryUrl = $this->config->getBaseUri() . '/v2/merchants'; - //process optional query parameters - ApiHelper::appendUrlWithQueryParameters($_queryBuilder, [ + //process query parameters + ApiHelper::appendUrlWithQueryParameters($_queryUrl, [ 'cursor' => $cursor, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -114,16 +111,13 @@ public function listMerchants(?int $cursor = null): ApiResponse public function retrieveMerchant(string $merchantId): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/merchants/{merchant_id}'; + $_queryUrl = $this->config->getBaseUri() . '/v2/merchants/{merchant_id}'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'merchant_id' => $merchantId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, diff --git a/src/Apis/MobileAuthorizationApi.php b/src/Apis/MobileAuthorizationApi.php index ab5df8b7..05d92d46 100644 --- a/src/Apis/MobileAuthorizationApi.php +++ b/src/Apis/MobileAuthorizationApi.php @@ -5,8 +5,8 @@ namespace Square\Apis; use Square\Exceptions\ApiException; -use Square\ApiHelper; use Square\ConfigurationInterface; +use Square\ApiHelper; use Square\Models; use Square\Http\ApiResponse; use Square\Http\HttpRequest; @@ -51,10 +51,7 @@ public function __construct(ConfigurationInterface $config, array $authManagers, public function createMobileAuthorizationCode(Models\CreateMobileAuthorizationCodeRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/mobile/authorization-code'; - - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); + $_queryUrl = $this->config->getBaseUri() . '/mobile/authorization-code'; //prepare headers $_headers = [ diff --git a/src/Apis/OAuthApi.php b/src/Apis/OAuthApi.php index b3eb2c54..a8690e47 100644 --- a/src/Apis/OAuthApi.php +++ b/src/Apis/OAuthApi.php @@ -5,8 +5,8 @@ namespace Square\Apis; use Square\Exceptions\ApiException; -use Square\ApiHelper; use Square\ConfigurationInterface; +use Square\ApiHelper; use Square\Models; use Square\Http\ApiResponse; use Square\Http\HttpRequest; @@ -64,16 +64,13 @@ public function renewToken(string $clientId, Models\RenewTokenRequest $body, str trigger_error('Method ' . __METHOD__ . ' is deprecated.', E_USER_DEPRECATED); //prepare query string for API call - $_queryBuilder = '/oauth2/clients/{client_id}/access-token/renew'; + $_queryUrl = $this->config->getBaseUri() . '/oauth2/clients/{client_id}/access-token/renew'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'client_id' => $clientId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -154,10 +151,7 @@ public function renewToken(string $clientId, Models\RenewTokenRequest $body, str public function revokeToken(Models\RevokeTokenRequest $body, string $authorization): ApiResponse { //prepare query string for API call - $_queryBuilder = '/oauth2/revoke'; - - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); + $_queryUrl = $this->config->getBaseUri() . '/oauth2/revoke'; //prepare headers $_headers = [ @@ -239,10 +233,7 @@ public function revokeToken(Models\RevokeTokenRequest $body, string $authorizati public function obtainToken(Models\ObtainTokenRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/oauth2/token'; - - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); + $_queryUrl = $this->config->getBaseUri() . '/oauth2/token'; //prepare headers $_headers = [ diff --git a/src/Apis/OrdersApi.php b/src/Apis/OrdersApi.php index f32ec108..bb895855 100644 --- a/src/Apis/OrdersApi.php +++ b/src/Apis/OrdersApi.php @@ -5,8 +5,8 @@ namespace Square\Apis; use Square\Exceptions\ApiException; -use Square\ApiHelper; use Square\ConfigurationInterface; +use Square\ApiHelper; use Square\Models; use Square\Http\ApiResponse; use Square\Http\HttpRequest; @@ -44,10 +44,7 @@ public function __construct(ConfigurationInterface $config, array $authManagers, public function createOrder(Models\CreateOrderRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/orders'; - - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); + $_queryUrl = $this->config->getBaseUri() . '/v2/orders'; //prepare headers $_headers = [ @@ -117,10 +114,7 @@ public function createOrder(Models\CreateOrderRequest $body): ApiResponse public function batchRetrieveOrders(Models\BatchRetrieveOrdersRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/orders/batch-retrieve'; - - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); + $_queryUrl = $this->config->getBaseUri() . '/v2/orders/batch-retrieve'; //prepare headers $_headers = [ @@ -188,10 +182,7 @@ public function batchRetrieveOrders(Models\BatchRetrieveOrdersRequest $body): Ap public function calculateOrder(Models\CalculateOrderRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/orders/calculate'; - - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); + $_queryUrl = $this->config->getBaseUri() . '/v2/orders/calculate'; //prepare headers $_headers = [ @@ -261,10 +252,7 @@ public function calculateOrder(Models\CalculateOrderRequest $body): ApiResponse public function cloneOrder(Models\CloneOrderRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/orders/clone'; - - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); + $_queryUrl = $this->config->getBaseUri() . '/v2/orders/clone'; //prepare headers $_headers = [ @@ -348,10 +336,7 @@ public function cloneOrder(Models\CloneOrderRequest $body): ApiResponse public function searchOrders(Models\SearchOrdersRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/orders/search'; - - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); + $_queryUrl = $this->config->getBaseUri() . '/v2/orders/search'; //prepare headers $_headers = [ @@ -416,16 +401,13 @@ public function searchOrders(Models\SearchOrdersRequest $body): ApiResponse public function retrieveOrder(string $orderId): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/orders/{order_id}'; + $_queryUrl = $this->config->getBaseUri() . '/v2/orders/{order_id}'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'order_id' => $orderId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -505,16 +487,13 @@ public function retrieveOrder(string $orderId): ApiResponse public function updateOrder(string $orderId, Models\UpdateOrderRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/orders/{order_id}'; + $_queryUrl = $this->config->getBaseUri() . '/v2/orders/{order_id}'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'order_id' => $orderId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -581,7 +560,7 @@ public function updateOrder(string $orderId, Models\UpdateOrderRequest $body): A * Any approved payments that reference the same `order_id` not specified in the * `payment_ids` is canceled. * - Be approved with [delayed capture](https://developer.squareup.com/docs/payments-api/take- - * payments#delayed-capture). + * payments/card-payments/delayed-capture). * Using a delayed capture payment with `PayOrder` completes the approved payment. * * @param string $orderId The ID of the order being paid. @@ -595,16 +574,13 @@ public function updateOrder(string $orderId, Models\UpdateOrderRequest $body): A public function payOrder(string $orderId, Models\PayOrderRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/orders/{order_id}/pay'; + $_queryUrl = $this->config->getBaseUri() . '/v2/orders/{order_id}/pay'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'order_id' => $orderId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, diff --git a/src/Apis/PaymentsApi.php b/src/Apis/PaymentsApi.php index 524d83b5..b5792816 100644 --- a/src/Apis/PaymentsApi.php +++ b/src/Apis/PaymentsApi.php @@ -5,8 +5,8 @@ namespace Square\Apis; use Square\Exceptions\ApiException; -use Square\ApiHelper; use Square\ConfigurationInterface; +use Square\ApiHelper; use Square\Models; use Square\Http\ApiResponse; use Square\Http\HttpRequest; @@ -76,10 +76,10 @@ public function listPayments( ?int $limit = null ): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/payments'; + $_queryUrl = $this->config->getBaseUri() . '/v2/payments'; - //process optional query parameters - ApiHelper::appendUrlWithQueryParameters($_queryBuilder, [ + //process query parameters + ApiHelper::appendUrlWithQueryParameters($_queryUrl, [ 'begin_time' => $beginTime, 'end_time' => $endTime, 'sort_order' => $sortOrder, @@ -91,9 +91,6 @@ public function listPayments( 'limit' => $limit, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -163,10 +160,7 @@ public function listPayments( public function createPayment(Models\CreatePaymentRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/payments'; - - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); + $_queryUrl = $this->config->getBaseUri() . '/v2/payments'; //prepare headers $_headers = [ @@ -247,10 +241,7 @@ public function createPayment(Models\CreatePaymentRequest $body): ApiResponse public function cancelPaymentByIdempotencyKey(Models\CancelPaymentByIdempotencyKeyRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/payments/cancel'; - - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); + $_queryUrl = $this->config->getBaseUri() . '/v2/payments/cancel'; //prepare headers $_headers = [ @@ -315,16 +306,13 @@ public function cancelPaymentByIdempotencyKey(Models\CancelPaymentByIdempotencyK public function getPayment(string $paymentId): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/payments/{payment_id}'; + $_queryUrl = $this->config->getBaseUri() . '/v2/payments/{payment_id}'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'payment_id' => $paymentId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -389,16 +377,13 @@ public function getPayment(string $paymentId): ApiResponse public function updatePayment(string $paymentId, Models\UpdatePaymentRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/payments/{payment_id}'; + $_queryUrl = $this->config->getBaseUri() . '/v2/payments/{payment_id}'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'payment_id' => $paymentId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -463,16 +448,13 @@ public function updatePayment(string $paymentId, Models\UpdatePaymentRequest $bo public function cancelPayment(string $paymentId): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/payments/{payment_id}/cancel'; + $_queryUrl = $this->config->getBaseUri() . '/v2/payments/{payment_id}/cancel'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'payment_id' => $paymentId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -539,16 +521,13 @@ public function cancelPayment(string $paymentId): ApiResponse public function completePayment(string $paymentId, Models\CompletePaymentRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/payments/{payment_id}/complete'; + $_queryUrl = $this->config->getBaseUri() . '/v2/payments/{payment_id}/complete'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'payment_id' => $paymentId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, diff --git a/src/Apis/PayoutsApi.php b/src/Apis/PayoutsApi.php new file mode 100644 index 00000000..1488fd4a --- /dev/null +++ b/src/Apis/PayoutsApi.php @@ -0,0 +1,286 @@ +config->getBaseUri() . '/v2/payouts'; + + //process query parameters + ApiHelper::appendUrlWithQueryParameters($_queryUrl, [ + 'location_id' => $locationId, + 'status' => $status, + 'begin_time' => $beginTime, + 'end_time' => $endTime, + 'sort_order' => $sortOrder, + 'cursor' => $cursor, + 'limit' => $limit, + ]); + + //prepare headers + $_headers = [ + 'user-agent' => $this->internalUserAgent, + 'Accept' => 'application/json', + 'Square-Version' => $this->config->getSquareVersion() + ]; + $_headers = ApiHelper::mergeHeaders($_headers, $this->config->getAdditionalHeaders()); + + $_httpRequest = new HttpRequest(HttpMethod::GET, $_headers, $_queryUrl); + + // Apply authorization to request + $this->getAuthManager('global')->apply($_httpRequest); + + //call on-before Http callback + if ($this->getHttpCallBack() != null) { + $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); + } + + // and invoke the API call request to fetch the response + try { + $response = Request::get($_httpRequest->getQueryUrl(), $_httpRequest->getHeaders()); + } catch (\Unirest\Exception $ex) { + throw new ApiException($ex->getMessage(), $_httpRequest); + } + + + $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); + $_httpContext = new HttpContext($_httpRequest, $_httpResponse); + + //call on-after Http callback + if ($this->getHttpCallBack() != null) { + $this->getHttpCallBack()->callOnAfterRequest($_httpContext); + } + + if (!$this->isValidResponse($_httpResponse)) { + return ApiResponse::createFromContext($response->body, null, $_httpContext); + } + + $deserializedResponse = ApiHelper::mapClass( + $_httpRequest, + $_httpResponse, + $response->body, + 'ListPayoutsResponse' + ); + return ApiResponse::createFromContext($response->body, $deserializedResponse, $_httpContext); + } + + /** + * Retrieves details of a specific payout identified by a payout ID. + * To call this endpoint, set `PAYOUTS_READ` for the OAuth scope. + * + * @param string $payoutId The ID of the payout to retrieve the information for. + * + * @return ApiResponse Response from the API call + * + * @throws ApiException Thrown if API call fails + */ + public function getPayout(string $payoutId): ApiResponse + { + //prepare query string for API call + $_queryUrl = $this->config->getBaseUri() . '/v2/payouts/{payout_id}'; + + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ + 'payout_id' => $payoutId, + ]); + + //prepare headers + $_headers = [ + 'user-agent' => $this->internalUserAgent, + 'Accept' => 'application/json', + 'Square-Version' => $this->config->getSquareVersion() + ]; + $_headers = ApiHelper::mergeHeaders($_headers, $this->config->getAdditionalHeaders()); + + $_httpRequest = new HttpRequest(HttpMethod::GET, $_headers, $_queryUrl); + + // Apply authorization to request + $this->getAuthManager('global')->apply($_httpRequest); + + //call on-before Http callback + if ($this->getHttpCallBack() != null) { + $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); + } + + // and invoke the API call request to fetch the response + try { + $response = Request::get($_httpRequest->getQueryUrl(), $_httpRequest->getHeaders()); + } catch (\Unirest\Exception $ex) { + throw new ApiException($ex->getMessage(), $_httpRequest); + } + + + $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); + $_httpContext = new HttpContext($_httpRequest, $_httpResponse); + + //call on-after Http callback + if ($this->getHttpCallBack() != null) { + $this->getHttpCallBack()->callOnAfterRequest($_httpContext); + } + + if (!$this->isValidResponse($_httpResponse)) { + return ApiResponse::createFromContext($response->body, null, $_httpContext); + } + + $deserializedResponse = ApiHelper::mapClass( + $_httpRequest, + $_httpResponse, + $response->body, + 'GetPayoutResponse' + ); + return ApiResponse::createFromContext($response->body, $deserializedResponse, $_httpContext); + } + + /** + * Retrieves a list of all payout entries for a specific payout. + * To call this endpoint, set `PAYOUTS_READ` for the OAuth scope. + * + * @param string $payoutId The ID of the payout to retrieve the information for. + * @param string|null $sortOrder The order in which payout entries are listed. + * @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. + * For more information, see [Pagination](https://developer.squareup. + * com/docs/basics/api101/pagination). + * If request parameters change between requests, subsequent results may contain + * duplicates or missing records. + * @param int|null $limit The maximum number of results to be returned in a single page. It is + * possible to receive fewer results than the specified limit on a given page. + * The default value of 100 is also the maximum allowed value. If the provided value + * is + * greater than 100, it is ignored and the default value is used instead. + * Default: `100` + * + * @return ApiResponse Response from the API call + * + * @throws ApiException Thrown if API call fails + */ + public function listPayoutEntries( + string $payoutId, + ?string $sortOrder = null, + ?string $cursor = null, + ?int $limit = null + ): ApiResponse { + //prepare query string for API call + $_queryUrl = $this->config->getBaseUri() . '/v2/payouts/{payout_id}/payout-entries'; + + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ + 'payout_id' => $payoutId, + ]); + + //process query parameters + ApiHelper::appendUrlWithQueryParameters($_queryUrl, [ + 'sort_order' => $sortOrder, + 'cursor' => $cursor, + 'limit' => $limit, + ]); + + //prepare headers + $_headers = [ + 'user-agent' => $this->internalUserAgent, + 'Accept' => 'application/json', + 'Square-Version' => $this->config->getSquareVersion() + ]; + $_headers = ApiHelper::mergeHeaders($_headers, $this->config->getAdditionalHeaders()); + + $_httpRequest = new HttpRequest(HttpMethod::GET, $_headers, $_queryUrl); + + // Apply authorization to request + $this->getAuthManager('global')->apply($_httpRequest); + + //call on-before Http callback + if ($this->getHttpCallBack() != null) { + $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); + } + + // and invoke the API call request to fetch the response + try { + $response = Request::get($_httpRequest->getQueryUrl(), $_httpRequest->getHeaders()); + } catch (\Unirest\Exception $ex) { + throw new ApiException($ex->getMessage(), $_httpRequest); + } + + + $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); + $_httpContext = new HttpContext($_httpRequest, $_httpResponse); + + //call on-after Http callback + if ($this->getHttpCallBack() != null) { + $this->getHttpCallBack()->callOnAfterRequest($_httpContext); + } + + if (!$this->isValidResponse($_httpResponse)) { + return ApiResponse::createFromContext($response->body, null, $_httpContext); + } + + $deserializedResponse = ApiHelper::mapClass( + $_httpRequest, + $_httpResponse, + $response->body, + 'ListPayoutEntriesResponse' + ); + return ApiResponse::createFromContext($response->body, $deserializedResponse, $_httpContext); + } +} diff --git a/src/Apis/RefundsApi.php b/src/Apis/RefundsApi.php index 938b6ace..e725f628 100644 --- a/src/Apis/RefundsApi.php +++ b/src/Apis/RefundsApi.php @@ -5,8 +5,8 @@ namespace Square\Apis; use Square\Exceptions\ApiException; -use Square\ApiHelper; use Square\ConfigurationInterface; +use Square\ApiHelper; use Square\Models; use Square\Http\ApiResponse; use Square\Http\HttpRequest; @@ -83,10 +83,10 @@ public function listPaymentRefunds( ?int $limit = null ): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/refunds'; + $_queryUrl = $this->config->getBaseUri() . '/v2/refunds'; - //process optional query parameters - ApiHelper::appendUrlWithQueryParameters($_queryBuilder, [ + //process query parameters + ApiHelper::appendUrlWithQueryParameters($_queryUrl, [ 'begin_time' => $beginTime, 'end_time' => $endTime, 'sort_order' => $sortOrder, @@ -97,9 +97,6 @@ public function listPaymentRefunds( 'limit' => $limit, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -165,10 +162,7 @@ public function listPaymentRefunds( public function refundPayment(Models\RefundPaymentRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/refunds'; - - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); + $_queryUrl = $this->config->getBaseUri() . '/v2/refunds'; //prepare headers $_headers = [ @@ -233,16 +227,13 @@ public function refundPayment(Models\RefundPaymentRequest $body): ApiResponse public function getPaymentRefund(string $refundId): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/refunds/{refund_id}'; + $_queryUrl = $this->config->getBaseUri() . '/v2/refunds/{refund_id}'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'refund_id' => $refundId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, diff --git a/src/Apis/SitesApi.php b/src/Apis/SitesApi.php index 6da9be37..195360b2 100644 --- a/src/Apis/SitesApi.php +++ b/src/Apis/SitesApi.php @@ -5,8 +5,8 @@ namespace Square\Apis; use Square\Exceptions\ApiException; -use Square\ApiHelper; use Square\ConfigurationInterface; +use Square\ApiHelper; use Square\Http\ApiResponse; use Square\Http\HttpRequest; use Square\Http\HttpResponse; @@ -38,10 +38,7 @@ public function __construct(ConfigurationInterface $config, array $authManagers, public function listSites(): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/sites'; - - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); + $_queryUrl = $this->config->getBaseUri() . '/v2/sites'; //prepare headers $_headers = [ diff --git a/src/Apis/SnippetsApi.php b/src/Apis/SnippetsApi.php index 2cd54fab..af98c287 100644 --- a/src/Apis/SnippetsApi.php +++ b/src/Apis/SnippetsApi.php @@ -5,8 +5,8 @@ namespace Square\Apis; use Square\Exceptions\ApiException; -use Square\ApiHelper; use Square\ConfigurationInterface; +use Square\ApiHelper; use Square\Models; use Square\Http\ApiResponse; use Square\Http\HttpRequest; @@ -42,16 +42,13 @@ public function __construct(ConfigurationInterface $config, array $authManagers, public function deleteSnippet(string $siteId): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/sites/{site_id}/snippet'; + $_queryUrl = $this->config->getBaseUri() . '/v2/sites/{site_id}/snippet'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'site_id' => $siteId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -119,16 +116,13 @@ public function deleteSnippet(string $siteId): ApiResponse public function retrieveSnippet(string $siteId): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/sites/{site_id}/snippet'; + $_queryUrl = $this->config->getBaseUri() . '/v2/sites/{site_id}/snippet'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'site_id' => $siteId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -201,16 +195,13 @@ public function retrieveSnippet(string $siteId): ApiResponse public function upsertSnippet(string $siteId, Models\UpsertSnippetRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/sites/{site_id}/snippet'; + $_queryUrl = $this->config->getBaseUri() . '/v2/sites/{site_id}/snippet'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'site_id' => $siteId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, diff --git a/src/Apis/SubscriptionsApi.php b/src/Apis/SubscriptionsApi.php index 5e99ab3a..8c2cd353 100644 --- a/src/Apis/SubscriptionsApi.php +++ b/src/Apis/SubscriptionsApi.php @@ -5,8 +5,8 @@ namespace Square\Apis; use Square\Exceptions\ApiException; -use Square\ApiHelper; use Square\ConfigurationInterface; +use Square\ApiHelper; use Square\Models; use Square\Http\ApiResponse; use Square\Http\HttpRequest; @@ -43,10 +43,7 @@ public function __construct(ConfigurationInterface $config, array $authManagers, public function createSubscription(Models\CreateSubscriptionRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/subscriptions'; - - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); + $_queryUrl = $this->config->getBaseUri() . '/v2/subscriptions'; //prepare headers $_headers = [ @@ -131,10 +128,7 @@ public function createSubscription(Models\CreateSubscriptionRequest $body): ApiR public function searchSubscriptions(Models\SearchSubscriptionsRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/subscriptions/search'; - - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); + $_queryUrl = $this->config->getBaseUri() . '/v2/subscriptions/search'; //prepare headers $_headers = [ @@ -205,21 +199,18 @@ public function searchSubscriptions(Models\SearchSubscriptionsRequest $body): Ap public function retrieveSubscription(string $subscriptionId, ?string $mInclude = null): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/subscriptions/{subscription_id}'; + $_queryUrl = $this->config->getBaseUri() . '/v2/subscriptions/{subscription_id}'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'subscription_id' => $subscriptionId, ]); - //process optional query parameters - ApiHelper::appendUrlWithQueryParameters($_queryBuilder, [ + //process query parameters + ApiHelper::appendUrlWithQueryParameters($_queryUrl, [ 'include' => $mInclude, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -284,16 +275,13 @@ public function retrieveSubscription(string $subscriptionId, ?string $mInclude = public function updateSubscription(string $subscriptionId, Models\UpdateSubscriptionRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/subscriptions/{subscription_id}'; + $_queryUrl = $this->config->getBaseUri() . '/v2/subscriptions/{subscription_id}'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'subscription_id' => $subscriptionId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -358,17 +346,15 @@ public function updateSubscription(string $subscriptionId, Models\UpdateSubscrip public function deleteSubscriptionAction(string $subscriptionId, string $actionId): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/subscriptions/{subscription_id}/actions/{action_id}'; + $_queryUrl = $this->config->getBaseUri() . + '/v2/subscriptions/{subscription_id}/actions/{action_id}'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'subscription_id' => $subscriptionId, 'action_id' => $actionId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -430,16 +416,13 @@ public function deleteSubscriptionAction(string $subscriptionId, string $actionI public function cancelSubscription(string $subscriptionId): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/subscriptions/{subscription_id}/cancel'; + $_queryUrl = $this->config->getBaseUri() . '/v2/subscriptions/{subscription_id}/cancel'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'subscription_id' => $subscriptionId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -489,8 +472,6 @@ public function cancelSubscription(string $subscriptionId): ApiResponse /** * Lists all events for a specific subscription. - * In the current implementation, only `START_SUBSCRIPTION` and `STOP_SUBSCRIPTION` (when the - * subscription was canceled) events are returned. * * @param string $subscriptionId The ID of the subscription to retrieve the events for. * @param string|null $cursor When the total number of resulting subscription events exceeds the @@ -514,22 +495,19 @@ public function listSubscriptionEvents( ?int $limit = null ): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/subscriptions/{subscription_id}/events'; + $_queryUrl = $this->config->getBaseUri() . '/v2/subscriptions/{subscription_id}/events'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'subscription_id' => $subscriptionId, ]); - //process optional query parameters - ApiHelper::appendUrlWithQueryParameters($_queryBuilder, [ + //process query parameters + ApiHelper::appendUrlWithQueryParameters($_queryUrl, [ 'cursor' => $cursor, 'limit' => $limit, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -593,16 +571,13 @@ public function listSubscriptionEvents( public function pauseSubscription(string $subscriptionId, Models\PauseSubscriptionRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/subscriptions/{subscription_id}/pause'; + $_queryUrl = $this->config->getBaseUri() . '/v2/subscriptions/{subscription_id}/pause'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'subscription_id' => $subscriptionId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -670,16 +645,13 @@ public function pauseSubscription(string $subscriptionId, Models\PauseSubscripti public function resumeSubscription(string $subscriptionId, Models\ResumeSubscriptionRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/subscriptions/{subscription_id}/resume'; + $_queryUrl = $this->config->getBaseUri() . '/v2/subscriptions/{subscription_id}/resume'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'subscription_id' => $subscriptionId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -745,16 +717,13 @@ public function resumeSubscription(string $subscriptionId, Models\ResumeSubscrip public function swapPlan(string $subscriptionId, Models\SwapPlanRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/subscriptions/{subscription_id}/swap-plan'; + $_queryUrl = $this->config->getBaseUri() . '/v2/subscriptions/{subscription_id}/swap-plan'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'subscription_id' => $subscriptionId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, diff --git a/src/Apis/TeamApi.php b/src/Apis/TeamApi.php index b1322fe2..49c02cf7 100644 --- a/src/Apis/TeamApi.php +++ b/src/Apis/TeamApi.php @@ -5,8 +5,8 @@ namespace Square\Apis; use Square\Exceptions\ApiException; -use Square\ApiHelper; use Square\ConfigurationInterface; +use Square\ApiHelper; use Square\Models; use Square\Http\ApiResponse; use Square\Http\HttpRequest; @@ -44,10 +44,7 @@ public function __construct(ConfigurationInterface $config, array $authManagers, public function createTeamMember(Models\CreateTeamMemberRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/team-members'; - - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); + $_queryUrl = $this->config->getBaseUri() . '/v2/team-members'; //prepare headers $_headers = [ @@ -124,10 +121,7 @@ public function createTeamMember(Models\CreateTeamMemberRequest $body): ApiRespo public function bulkCreateTeamMembers(Models\BulkCreateTeamMembersRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/team-members/bulk-create'; - - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); + $_queryUrl = $this->config->getBaseUri() . '/v2/team-members/bulk-create'; //prepare headers $_headers = [ @@ -203,10 +197,7 @@ public function bulkCreateTeamMembers(Models\BulkCreateTeamMembersRequest $body) public function bulkUpdateTeamMembers(Models\BulkUpdateTeamMembersRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/team-members/bulk-update'; - - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); + $_queryUrl = $this->config->getBaseUri() . '/v2/team-members/bulk-update'; //prepare headers $_headers = [ @@ -277,10 +268,7 @@ public function bulkUpdateTeamMembers(Models\BulkUpdateTeamMembersRequest $body) public function searchTeamMembers(Models\SearchTeamMembersRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/team-members/search'; - - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); + $_queryUrl = $this->config->getBaseUri() . '/v2/team-members/search'; //prepare headers $_headers = [ @@ -347,16 +335,13 @@ public function searchTeamMembers(Models\SearchTeamMembersRequest $body): ApiRes public function retrieveTeamMember(string $teamMemberId): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/team-members/{team_member_id}'; + $_queryUrl = $this->config->getBaseUri() . '/v2/team-members/{team_member_id}'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'team_member_id' => $teamMemberId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -422,16 +407,13 @@ public function retrieveTeamMember(string $teamMemberId): ApiResponse public function updateTeamMember(string $teamMemberId, Models\UpdateTeamMemberRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/team-members/{team_member_id}'; + $_queryUrl = $this->config->getBaseUri() . '/v2/team-members/{team_member_id}'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'team_member_id' => $teamMemberId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -498,16 +480,13 @@ public function updateTeamMember(string $teamMemberId, Models\UpdateTeamMemberRe public function retrieveWageSetting(string $teamMemberId): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/team-members/{team_member_id}/wage-setting'; + $_queryUrl = $this->config->getBaseUri() . '/v2/team-members/{team_member_id}/wage-setting'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'team_member_id' => $teamMemberId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -577,16 +556,13 @@ public function retrieveWageSetting(string $teamMemberId): ApiResponse public function updateWageSetting(string $teamMemberId, Models\UpdateWageSettingRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/team-members/{team_member_id}/wage-setting'; + $_queryUrl = $this->config->getBaseUri() . '/v2/team-members/{team_member_id}/wage-setting'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'team_member_id' => $teamMemberId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, diff --git a/src/Apis/TerminalApi.php b/src/Apis/TerminalApi.php index c18051ec..6b7bad2b 100644 --- a/src/Apis/TerminalApi.php +++ b/src/Apis/TerminalApi.php @@ -5,8 +5,8 @@ namespace Square\Apis; use Square\Exceptions\ApiException; -use Square\ApiHelper; use Square\ConfigurationInterface; +use Square\ApiHelper; use Square\Models; use Square\Http\ApiResponse; use Square\Http\HttpRequest; @@ -39,10 +39,7 @@ public function __construct(ConfigurationInterface $config, array $authManagers, public function createTerminalCheckout(Models\CreateTerminalCheckoutRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/terminals/checkouts'; - - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); + $_queryUrl = $this->config->getBaseUri() . '/v2/terminals/checkouts'; //prepare headers $_headers = [ @@ -96,7 +93,9 @@ public function createTerminalCheckout(Models\CreateTerminalCheckoutRequest $bod } /** - * Retrieves a filtered list of Terminal checkout requests created by the account making the request. + * Returns a filtered list of Terminal checkout requests created by the application making the request. + * Only Terminal checkout requests created for the merchant scoped to the OAuth token are returned. + * Terminal checkout requests are available for 30 days. * * @param Models\SearchTerminalCheckoutsRequest $body An object containing the fields to POST * for the request. @@ -110,10 +109,7 @@ public function createTerminalCheckout(Models\CreateTerminalCheckoutRequest $bod public function searchTerminalCheckouts(Models\SearchTerminalCheckoutsRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/terminals/checkouts/search'; - - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); + $_queryUrl = $this->config->getBaseUri() . '/v2/terminals/checkouts/search'; //prepare headers $_headers = [ @@ -167,7 +163,8 @@ public function searchTerminalCheckouts(Models\SearchTerminalCheckoutsRequest $b } /** - * Retrieves a Terminal checkout request by `checkout_id`. + * Retrieves a Terminal checkout request by `checkout_id`. Terminal checkout requests are available + * for 30 days. * * @param string $checkoutId The unique ID for the desired `TerminalCheckout`. * @@ -178,16 +175,13 @@ public function searchTerminalCheckouts(Models\SearchTerminalCheckoutsRequest $b public function getTerminalCheckout(string $checkoutId): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/terminals/checkouts/{checkout_id}'; + $_queryUrl = $this->config->getBaseUri() . '/v2/terminals/checkouts/{checkout_id}'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'checkout_id' => $checkoutId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -247,16 +241,13 @@ public function getTerminalCheckout(string $checkoutId): ApiResponse public function cancelTerminalCheckout(string $checkoutId): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/terminals/checkouts/{checkout_id}/cancel'; + $_queryUrl = $this->config->getBaseUri() . '/v2/terminals/checkouts/{checkout_id}/cancel'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'checkout_id' => $checkoutId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -305,7 +296,10 @@ public function cancelTerminalCheckout(string $checkoutId): ApiResponse } /** - * Creates a request to refund an Interac payment completed on a Square Terminal. + * Creates a request to refund an Interac payment completed on a Square Terminal. Refunds for Interac + * payments on a Square Terminal are supported only for Interac debit cards in Canada. Other refunds + * for Terminal payments should use the Refunds API. For more information, see [Refunds + * API]($e/Refunds). * * @param Models\CreateTerminalRefundRequest $body An object containing the fields to POST for * the request. @@ -319,10 +313,7 @@ public function cancelTerminalCheckout(string $checkoutId): ApiResponse public function createTerminalRefund(Models\CreateTerminalRefundRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/terminals/refunds'; - - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); + $_queryUrl = $this->config->getBaseUri() . '/v2/terminals/refunds'; //prepare headers $_headers = [ @@ -377,7 +368,7 @@ public function createTerminalRefund(Models\CreateTerminalRefundRequest $body): /** * Retrieves a filtered list of Interac Terminal refund requests created by the seller making the - * request. + * request. Terminal refund requests are available for 30 days. * * @param Models\SearchTerminalRefundsRequest $body An object containing the fields to POST for * the request. @@ -391,10 +382,7 @@ public function createTerminalRefund(Models\CreateTerminalRefundRequest $body): public function searchTerminalRefunds(Models\SearchTerminalRefundsRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/terminals/refunds/search'; - - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); + $_queryUrl = $this->config->getBaseUri() . '/v2/terminals/refunds/search'; //prepare headers $_headers = [ @@ -448,7 +436,8 @@ public function searchTerminalRefunds(Models\SearchTerminalRefundsRequest $body) } /** - * Retrieves an Interac Terminal refund object by ID. + * Retrieves an Interac Terminal refund object by ID. Terminal refund objects are available for 30 + * days. * * @param string $terminalRefundId The unique ID for the desired `TerminalRefund`. * @@ -459,16 +448,13 @@ public function searchTerminalRefunds(Models\SearchTerminalRefundsRequest $body) public function getTerminalRefund(string $terminalRefundId): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/terminals/refunds/{terminal_refund_id}'; + $_queryUrl = $this->config->getBaseUri() . '/v2/terminals/refunds/{terminal_refund_id}'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'terminal_refund_id' => $terminalRefundId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -529,16 +515,14 @@ public function getTerminalRefund(string $terminalRefundId): ApiResponse public function cancelTerminalRefund(string $terminalRefundId): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/terminals/refunds/{terminal_refund_id}/cancel'; + $_queryUrl = $this->config->getBaseUri() . + '/v2/terminals/refunds/{terminal_refund_id}/cancel'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'terminal_refund_id' => $terminalRefundId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, diff --git a/src/Apis/TransactionsApi.php b/src/Apis/TransactionsApi.php index 5f3864e8..d99ff874 100644 --- a/src/Apis/TransactionsApi.php +++ b/src/Apis/TransactionsApi.php @@ -5,8 +5,8 @@ namespace Square\Apis; use Square\Exceptions\ApiException; -use Square\ApiHelper; use Square\ConfigurationInterface; +use Square\ApiHelper; use Square\Http\ApiResponse; use Square\Http\HttpRequest; use Square\Http\HttpResponse; @@ -70,24 +70,21 @@ public function listTransactions( trigger_error('Method ' . __METHOD__ . ' is deprecated.', E_USER_DEPRECATED); //prepare query string for API call - $_queryBuilder = '/v2/locations/{location_id}/transactions'; + $_queryUrl = $this->config->getBaseUri() . '/v2/locations/{location_id}/transactions'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'location_id' => $locationId, ]); - //process optional query parameters - ApiHelper::appendUrlWithQueryParameters($_queryBuilder, [ + //process query parameters + ApiHelper::appendUrlWithQueryParameters($_queryUrl, [ 'begin_time' => $beginTime, 'end_time' => $endTime, 'sort_order' => $sortOrder, 'cursor' => $cursor, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -152,17 +149,15 @@ public function retrieveTransaction(string $locationId, string $transactionId): trigger_error('Method ' . __METHOD__ . ' is deprecated.', E_USER_DEPRECATED); //prepare query string for API call - $_queryBuilder = '/v2/locations/{location_id}/transactions/{transaction_id}'; + $_queryUrl = $this->config->getBaseUri() . + '/v2/locations/{location_id}/transactions/{transaction_id}'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'location_id' => $locationId, 'transaction_id' => $transactionId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -233,17 +228,15 @@ public function captureTransaction(string $locationId, string $transactionId): A trigger_error('Method ' . __METHOD__ . ' is deprecated.', E_USER_DEPRECATED); //prepare query string for API call - $_queryBuilder = '/v2/locations/{location_id}/transactions/{transaction_id}/capture'; + $_queryUrl = $this->config->getBaseUri() . + '/v2/locations/{location_id}/transactions/{transaction_id}/capture'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'location_id' => $locationId, 'transaction_id' => $transactionId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -314,17 +307,15 @@ public function voidTransaction(string $locationId, string $transactionId): ApiR trigger_error('Method ' . __METHOD__ . ' is deprecated.', E_USER_DEPRECATED); //prepare query string for API call - $_queryBuilder = '/v2/locations/{location_id}/transactions/{transaction_id}/void'; + $_queryUrl = $this->config->getBaseUri() . + '/v2/locations/{location_id}/transactions/{transaction_id}/void'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'location_id' => $locationId, 'transaction_id' => $transactionId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, diff --git a/src/Apis/V1TransactionsApi.php b/src/Apis/V1TransactionsApi.php index 24a47d98..ba53927f 100644 --- a/src/Apis/V1TransactionsApi.php +++ b/src/Apis/V1TransactionsApi.php @@ -5,8 +5,8 @@ namespace Square\Apis; use Square\Exceptions\ApiException; -use Square\ApiHelper; use Square\ConfigurationInterface; +use Square\ApiHelper; use Square\Models; use Square\Http\ApiResponse; use Square\Http\HttpRequest; @@ -49,23 +49,20 @@ public function listOrders( trigger_error('Method ' . __METHOD__ . ' is deprecated.', E_USER_DEPRECATED); //prepare query string for API call - $_queryBuilder = '/v1/{location_id}/orders'; + $_queryUrl = $this->config->getBaseUri() . '/v1/{location_id}/orders'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'location_id' => $locationId, ]); - //process optional query parameters - ApiHelper::appendUrlWithQueryParameters($_queryBuilder, [ + //process query parameters + ApiHelper::appendUrlWithQueryParameters($_queryUrl, [ 'order' => $order, 'limit' => $limit, 'batch_token' => $batchToken, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -126,17 +123,14 @@ public function retrieveOrder(string $locationId, string $orderId): ApiResponse trigger_error('Method ' . __METHOD__ . ' is deprecated.', E_USER_DEPRECATED); //prepare query string for API call - $_queryBuilder = '/v1/{location_id}/orders/{order_id}'; + $_queryUrl = $this->config->getBaseUri() . '/v1/{location_id}/orders/{order_id}'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'location_id' => $locationId, 'order_id' => $orderId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -202,17 +196,14 @@ public function updateOrder(string $locationId, string $orderId, Models\V1Update trigger_error('Method ' . __METHOD__ . ' is deprecated.', E_USER_DEPRECATED); //prepare query string for API call - $_queryBuilder = '/v1/{location_id}/orders/{order_id}'; + $_queryUrl = $this->config->getBaseUri() . '/v1/{location_id}/orders/{order_id}'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'location_id' => $locationId, 'order_id' => $orderId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -308,15 +299,15 @@ public function listPayments( trigger_error('Method ' . __METHOD__ . ' is deprecated.', E_USER_DEPRECATED); //prepare query string for API call - $_queryBuilder = '/v1/{location_id}/payments'; + $_queryUrl = $this->config->getBaseUri() . '/v1/{location_id}/payments'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'location_id' => $locationId, ]); - //process optional query parameters - ApiHelper::appendUrlWithQueryParameters($_queryBuilder, [ + //process query parameters + ApiHelper::appendUrlWithQueryParameters($_queryUrl, [ 'order' => $order, 'begin_time' => $beginTime, 'end_time' => $endTime, @@ -326,9 +317,6 @@ public function listPayments( var_export($includePartial, true) : false, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -390,17 +378,14 @@ public function retrievePayment(string $locationId, string $paymentId): ApiRespo trigger_error('Method ' . __METHOD__ . ' is deprecated.', E_USER_DEPRECATED); //prepare query string for API call - $_queryBuilder = '/v1/{location_id}/payments/{payment_id}'; + $_queryUrl = $this->config->getBaseUri() . '/v1/{location_id}/payments/{payment_id}'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'location_id' => $locationId, 'payment_id' => $paymentId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -480,15 +465,15 @@ public function listRefunds( trigger_error('Method ' . __METHOD__ . ' is deprecated.', E_USER_DEPRECATED); //prepare query string for API call - $_queryBuilder = '/v1/{location_id}/refunds'; + $_queryUrl = $this->config->getBaseUri() . '/v1/{location_id}/refunds'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'location_id' => $locationId, ]); - //process optional query parameters - ApiHelper::appendUrlWithQueryParameters($_queryBuilder, [ + //process query parameters + ApiHelper::appendUrlWithQueryParameters($_queryUrl, [ 'order' => $order, 'begin_time' => $beginTime, 'end_time' => $endTime, @@ -496,9 +481,6 @@ public function listRefunds( 'batch_token' => $batchToken, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -572,16 +554,13 @@ public function createRefund(string $locationId, Models\V1CreateRefundRequest $b trigger_error('Method ' . __METHOD__ . ' is deprecated.', E_USER_DEPRECATED); //prepare query string for API call - $_queryBuilder = '/v1/{location_id}/refunds'; + $_queryUrl = $this->config->getBaseUri() . '/v1/{location_id}/refunds'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'location_id' => $locationId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -671,15 +650,15 @@ public function listSettlements( trigger_error('Method ' . __METHOD__ . ' is deprecated.', E_USER_DEPRECATED); //prepare query string for API call - $_queryBuilder = '/v1/{location_id}/settlements'; + $_queryUrl = $this->config->getBaseUri() . '/v1/{location_id}/settlements'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'location_id' => $locationId, ]); - //process optional query parameters - ApiHelper::appendUrlWithQueryParameters($_queryBuilder, [ + //process query parameters + ApiHelper::appendUrlWithQueryParameters($_queryUrl, [ 'order' => $order, 'begin_time' => $beginTime, 'end_time' => $endTime, @@ -688,9 +667,6 @@ public function listSettlements( 'batch_token' => $batchToken, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -767,17 +743,14 @@ public function retrieveSettlement(string $locationId, string $settlementId): Ap trigger_error('Method ' . __METHOD__ . ' is deprecated.', E_USER_DEPRECATED); //prepare query string for API call - $_queryBuilder = '/v1/{location_id}/settlements/{settlement_id}'; + $_queryUrl = $this->config->getBaseUri() . '/v1/{location_id}/settlements/{settlement_id}'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'location_id' => $locationId, 'settlement_id' => $settlementId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, diff --git a/src/Apis/VendorsApi.php b/src/Apis/VendorsApi.php index e894c0d1..61a1dd9e 100644 --- a/src/Apis/VendorsApi.php +++ b/src/Apis/VendorsApi.php @@ -5,8 +5,8 @@ namespace Square\Apis; use Square\Exceptions\ApiException; -use Square\ApiHelper; use Square\ConfigurationInterface; +use Square\ApiHelper; use Square\Models; use Square\Http\ApiResponse; use Square\Http\HttpRequest; @@ -38,10 +38,7 @@ public function __construct(ConfigurationInterface $config, array $authManagers, public function bulkCreateVendors(Models\BulkCreateVendorsRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/vendors/bulk-create'; - - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); + $_queryUrl = $this->config->getBaseUri() . '/v2/vendors/bulk-create'; //prepare headers $_headers = [ @@ -109,10 +106,7 @@ public function bulkCreateVendors(Models\BulkCreateVendorsRequest $body): ApiRes public function bulkRetrieveVendors(Models\BulkRetrieveVendorsRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/vendors/bulk-retrieve'; - - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); + $_queryUrl = $this->config->getBaseUri() . '/v2/vendors/bulk-retrieve'; //prepare headers $_headers = [ @@ -180,10 +174,7 @@ public function bulkRetrieveVendors(Models\BulkRetrieveVendorsRequest $body): Ap public function bulkUpdateVendors(Models\BulkUpdateVendorsRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/vendors/bulk-update'; - - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); + $_queryUrl = $this->config->getBaseUri() . '/v2/vendors/bulk-update'; //prepare headers $_headers = [ @@ -251,10 +242,7 @@ public function bulkUpdateVendors(Models\BulkUpdateVendorsRequest $body): ApiRes public function createVendor(Models\CreateVendorRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/vendors/create'; - - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); + $_queryUrl = $this->config->getBaseUri() . '/v2/vendors/create'; //prepare headers $_headers = [ @@ -323,10 +311,7 @@ public function createVendor(Models\CreateVendorRequest $body): ApiResponse public function searchVendors(Models\SearchVendorsRequest $body): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/vendors/search'; - - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); + $_queryUrl = $this->config->getBaseUri() . '/v2/vendors/search'; //prepare headers $_headers = [ @@ -391,16 +376,13 @@ public function searchVendors(Models\SearchVendorsRequest $body): ApiResponse public function retrieveVendor(string $vendorId): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/vendors/{vendor_id}'; + $_queryUrl = $this->config->getBaseUri() . '/v2/vendors/{vendor_id}'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'vendor_id' => $vendorId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, @@ -464,16 +446,13 @@ public function retrieveVendor(string $vendorId): ApiResponse public function updateVendor(Models\UpdateVendorRequest $body, string $vendorId): ApiResponse { //prepare query string for API call - $_queryBuilder = '/v2/vendors/{vendor_id}'; + $_queryUrl = $this->config->getBaseUri() . '/v2/vendors/{vendor_id}'; - //process optional query parameters - $_queryBuilder = ApiHelper::appendUrlWithTemplateParameters($_queryBuilder, [ + //process template parameters + $_queryUrl = ApiHelper::appendUrlWithTemplateParameters($_queryUrl, [ 'vendor_id' => $vendorId, ]); - //validate and preprocess url - $_queryUrl = ApiHelper::cleanUrl($this->config->getBaseUri() . $_queryBuilder); - //prepare headers $_headers = [ 'user-agent' => $this->internalUserAgent, diff --git a/src/ConfigurationDefaults.php b/src/ConfigurationDefaults.php index 0def5dc9..d6e361a9 100644 --- a/src/ConfigurationDefaults.php +++ b/src/ConfigurationDefaults.php @@ -27,7 +27,7 @@ class ConfigurationDefaults public const HTTP_METHODS_TO_RETRY = ['GET', 'PUT']; - public const SQUARE_VERSION = '2022-03-16'; + public const SQUARE_VERSION = '2022-04-20'; public const ADDITIONAL_HEADERS = []; diff --git a/src/Models/ActivityType.php b/src/Models/ActivityType.php new file mode 100644 index 00000000..38aca679 --- /dev/null +++ b/src/Models/ActivityType.php @@ -0,0 +1,188 @@ +catalogVersion = $catalogVersion; } + /** + * Returns Include Deleted Objects. + * Indicates whether to include (`true`) or not (`false`) in the response deleted objects, namely, + * those with the `is_deleted` attribute set to `true`. + */ + public function getIncludeDeletedObjects(): ?bool + { + return $this->includeDeletedObjects; + } + + /** + * Sets Include Deleted Objects. + * Indicates whether to include (`true`) or not (`false`) in the response deleted objects, namely, + * those with the `is_deleted` attribute set to `true`. + * + * @maps include_deleted_objects + */ + public function setIncludeDeletedObjects(?bool $includeDeletedObjects): void + { + $this->includeDeletedObjects = $includeDeletedObjects; + } + /** * Encode this object to JSON * @@ -153,6 +180,9 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) if (isset($this->catalogVersion)) { $json['catalog_version'] = $this->catalogVersion; } + if (isset($this->includeDeletedObjects)) { + $json['include_deleted_objects'] = $this->includeDeletedObjects; + } $json = array_filter($json, function ($val) { return $val !== null; }); diff --git a/src/Models/BulkCreateVendorsRequest.php b/src/Models/BulkCreateVendorsRequest.php index 16d992ac..5edac8ac 100644 --- a/src/Models/BulkCreateVendorsRequest.php +++ b/src/Models/BulkCreateVendorsRequest.php @@ -7,7 +7,7 @@ use stdClass; /** - * Represents an input to a call to [BulkCreateVendors.]($e/Vendors/BulkCreateVendors) + * Represents an input to a call to [BulkCreateVendors]($e/Vendors/BulkCreateVendors). */ class BulkCreateVendorsRequest implements \JsonSerializable { @@ -26,7 +26,7 @@ public function __construct(array $vendors) /** * Returns Vendors. - * Specifies a set of new [Vendor](entity:Vendor] objects as represented by a collection of idempotency- + * Specifies a set of new [Vendor]($m/Vendor) objects as represented by a collection of idempotency- * key/`Vendor`-object pairs. * * @return array @@ -38,7 +38,7 @@ public function getVendors(): array /** * Sets Vendors. - * Specifies a set of new [Vendor](entity:Vendor] objects as represented by a collection of idempotency- + * Specifies a set of new [Vendor]($m/Vendor) objects as represented by a collection of idempotency- * key/`Vendor`-object pairs. * * @required diff --git a/src/Models/BulkCreateVendorsResponse.php b/src/Models/BulkCreateVendorsResponse.php index 801a4426..3df2bebc 100644 --- a/src/Models/BulkCreateVendorsResponse.php +++ b/src/Models/BulkCreateVendorsResponse.php @@ -7,7 +7,7 @@ use stdClass; /** - * Represents an output from a call to [BulkCreateVendors.]($e/Vendors/BulkCreateVendors) + * Represents an output from a call to [BulkCreateVendors]($e/Vendors/BulkCreateVendors). */ class BulkCreateVendorsResponse implements \JsonSerializable { @@ -50,8 +50,8 @@ public function setErrors(?array $errors): void * A set of [CreateVendorResponse]($m/CreateVendorResponse) objects encapsulating successfully created * [Vendor]($m/Vendor) * objects or error responses for failed attempts. The set is represented by - * a collection of idempotency-key/`Vendor`-object or idempotency-key/error-object pairs. The impotency - * keys correspond to those specified + * a collection of idempotency-key/`Vendor`-object or idempotency-key/error-object pairs. The + * idempotency keys correspond to those specified * in the input. * * @return array|null @@ -66,8 +66,8 @@ public function getResponses(): ?array * A set of [CreateVendorResponse]($m/CreateVendorResponse) objects encapsulating successfully created * [Vendor]($m/Vendor) * objects or error responses for failed attempts. The set is represented by - * a collection of idempotency-key/`Vendor`-object or idempotency-key/error-object pairs. The impotency - * keys correspond to those specified + * a collection of idempotency-key/`Vendor`-object or idempotency-key/error-object pairs. The + * idempotency keys correspond to those specified * in the input. * * @maps responses diff --git a/src/Models/BulkRetrieveVendorsRequest.php b/src/Models/BulkRetrieveVendorsRequest.php index ff17fca9..9078658a 100644 --- a/src/Models/BulkRetrieveVendorsRequest.php +++ b/src/Models/BulkRetrieveVendorsRequest.php @@ -7,7 +7,7 @@ use stdClass; /** - * Represents an input to a call to [BulkRetrieveVendors.]($e/Vendors/BulkRetrieveVendors) + * Represents an input to a call to [BulkRetrieveVendors]($e/Vendors/BulkRetrieveVendors). */ class BulkRetrieveVendorsRequest implements \JsonSerializable { diff --git a/src/Models/BulkRetrieveVendorsResponse.php b/src/Models/BulkRetrieveVendorsResponse.php index 3b2dbf9b..94698458 100644 --- a/src/Models/BulkRetrieveVendorsResponse.php +++ b/src/Models/BulkRetrieveVendorsResponse.php @@ -7,7 +7,7 @@ use stdClass; /** - * Represents an output from a call to [BulkRetrieveVendors.]($e/Vendors/BulkRetrieveVendors) + * Represents an output from a call to [BulkRetrieveVendors]($e/Vendors/BulkRetrieveVendors). */ class BulkRetrieveVendorsResponse implements \JsonSerializable { diff --git a/src/Models/BulkUpdateVendorsRequest.php b/src/Models/BulkUpdateVendorsRequest.php index e9000d95..b1d4c4db 100644 --- a/src/Models/BulkUpdateVendorsRequest.php +++ b/src/Models/BulkUpdateVendorsRequest.php @@ -7,7 +7,7 @@ use stdClass; /** - * Represents an input to a call to [BulkUpdateVendors.]($e/Vendors/BulkUpdateVendors) + * Represents an input to a call to [BulkUpdateVendors]($e/Vendors/BulkUpdateVendors). */ class BulkUpdateVendorsRequest implements \JsonSerializable { diff --git a/src/Models/BulkUpdateVendorsResponse.php b/src/Models/BulkUpdateVendorsResponse.php index 042e10d7..b5448ac6 100644 --- a/src/Models/BulkUpdateVendorsResponse.php +++ b/src/Models/BulkUpdateVendorsResponse.php @@ -7,7 +7,7 @@ use stdClass; /** - * Represents an output from a call to [BulkUpdateVendors.]($e/Vendors/BulkUpdateVendors) + * Represents an output from a call to [BulkUpdateVendors]($e/Vendors/BulkUpdateVendors). */ class BulkUpdateVendorsResponse implements \JsonSerializable { diff --git a/src/Models/BusinessHours.php b/src/Models/BusinessHours.php index 2c8ac3bb..03756089 100644 --- a/src/Models/BusinessHours.php +++ b/src/Models/BusinessHours.php @@ -18,8 +18,7 @@ class BusinessHours implements \JsonSerializable /** * Returns Periods. - * The list of time periods during which the business is open. There may be at most 10 - * periods per day. + * The list of time periods during which the business is open. There can be at most 10 periods per day. * * @return BusinessHoursPeriod[]|null */ @@ -30,8 +29,7 @@ public function getPeriods(): ?array /** * Sets Periods. - * The list of time periods during which the business is open. There may be at most 10 - * periods per day. + * The list of time periods during which the business is open. There can be at most 10 periods per day. * * @maps periods * diff --git a/src/Models/BusinessHoursPeriod.php b/src/Models/BusinessHoursPeriod.php index 057561ee..4898066e 100644 --- a/src/Models/BusinessHoursPeriod.php +++ b/src/Models/BusinessHoursPeriod.php @@ -50,7 +50,7 @@ public function setDayOfWeek(?string $dayOfWeek): void * Returns Start Local Time. * The start time of a business hours period, specified in local time using partial-time * RFC 3339 format. For example, `8:30:00` for a period starting at 8:30 in the morning. - * Note that the seconds value will always be :00, but it is appended for conformance to the RFC. + * Note that the seconds value is always :00, but it is appended for conformance to the RFC. */ public function getStartLocalTime(): ?string { @@ -61,7 +61,7 @@ public function getStartLocalTime(): ?string * Sets Start Local Time. * The start time of a business hours period, specified in local time using partial-time * RFC 3339 format. For example, `8:30:00` for a period starting at 8:30 in the morning. - * Note that the seconds value will always be :00, but it is appended for conformance to the RFC. + * Note that the seconds value is always :00, but it is appended for conformance to the RFC. * * @maps start_local_time */ @@ -74,7 +74,7 @@ public function setStartLocalTime(?string $startLocalTime): void * Returns End Local Time. * The end time of a business hours period, specified in local time using partial-time * RFC 3339 format. For example, `21:00:00` for a period ending at 9:00 in the evening. - * Note that the seconds value will always be :00, but it is appended for conformance to the RFC. + * Note that the seconds value is always :00, but it is appended for conformance to the RFC. */ public function getEndLocalTime(): ?string { @@ -85,7 +85,7 @@ public function getEndLocalTime(): ?string * Sets End Local Time. * The end time of a business hours period, specified in local time using partial-time * RFC 3339 format. For example, `21:00:00` for a period ending at 9:00 in the evening. - * Note that the seconds value will always be :00, but it is appended for conformance to the RFC. + * Note that the seconds value is always :00, but it is appended for conformance to the RFC. * * @maps end_local_time */ diff --git a/src/Models/CancelTerminalCheckoutResponse.php b/src/Models/CancelTerminalCheckoutResponse.php index 87f01585..36089144 100644 --- a/src/Models/CancelTerminalCheckoutResponse.php +++ b/src/Models/CancelTerminalCheckoutResponse.php @@ -44,6 +44,7 @@ public function setErrors(?array $errors): void /** * Returns Checkout. + * Represents a checkout processed by the Square Terminal. */ public function getCheckout(): ?TerminalCheckout { @@ -52,6 +53,7 @@ public function getCheckout(): ?TerminalCheckout /** * Sets Checkout. + * Represents a checkout processed by the Square Terminal. * * @maps checkout */ diff --git a/src/Models/CancelTerminalRefundResponse.php b/src/Models/CancelTerminalRefundResponse.php index 013feed1..1dcfa1d7 100644 --- a/src/Models/CancelTerminalRefundResponse.php +++ b/src/Models/CancelTerminalRefundResponse.php @@ -44,6 +44,8 @@ public function setErrors(?array $errors): void /** * Returns Refund. + * Represents a payment refund processed by the Square Terminal. Only supports Interac (Canadian debit + * network) payment refunds. */ public function getRefund(): ?TerminalRefund { @@ -52,6 +54,8 @@ public function getRefund(): ?TerminalRefund /** * Sets Refund. + * Represents a payment refund processed by the Square Terminal. Only supports Interac (Canadian debit + * network) payment refunds. * * @maps refund */ diff --git a/src/Models/CatalogItemVariation.php b/src/Models/CatalogItemVariation.php index 495c9c70..33c8173f 100644 --- a/src/Models/CatalogItemVariation.php +++ b/src/Models/CatalogItemVariation.php @@ -92,6 +92,11 @@ class CatalogItemVariation implements \JsonSerializable */ private $measurementUnitId; + /** + * @var bool|null + */ + private $sellable; + /** * @var bool|null */ @@ -504,10 +509,29 @@ public function setMeasurementUnitId(?string $measurementUnitId): void $this->measurementUnitId = $measurementUnitId; } + /** + * Returns Sellable. + * Whether this variation can be sold. + */ + public function getSellable(): ?bool + { + return $this->sellable; + } + + /** + * Sets Sellable. + * Whether this variation can be sold. + * + * @maps sellable + */ + public function setSellable(?bool $sellable): void + { + $this->sellable = $sellable; + } + /** * Returns Stockable. * Whether stock is counted directly on this variation (TRUE) or only on its components (FALSE). - * For backward compatibility missing values will be interpreted as TRUE. */ public function getStockable(): ?bool { @@ -517,7 +541,6 @@ public function getStockable(): ?bool /** * Sets Stockable. * Whether stock is counted directly on this variation (TRUE) or only on its components (FALSE). - * For backward compatibility missing values will be interpreted as TRUE. * * @maps stockable */ @@ -664,6 +687,9 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) if (isset($this->measurementUnitId)) { $json['measurement_unit_id'] = $this->measurementUnitId; } + if (isset($this->sellable)) { + $json['sellable'] = $this->sellable; + } if (isset($this->stockable)) { $json['stockable'] = $this->stockable; } diff --git a/src/Models/CatalogModifier.php b/src/Models/CatalogModifier.php index c378f9da..07917673 100644 --- a/src/Models/CatalogModifier.php +++ b/src/Models/CatalogModifier.php @@ -31,6 +31,11 @@ class CatalogModifier implements \JsonSerializable */ private $modifierListId; + /** + * @var string[]|null + */ + private $imageIds; + /** * Returns Name. * The modifier name. This is a searchable attribute for use in applicable query filters, and its @@ -125,6 +130,34 @@ public function setModifierListId(?string $modifierListId): void $this->modifierListId = $modifierListId; } + /** + * Returns Image Ids. + * The IDs of images associated with this `CatalogModifier` instance. + * Currently these images are not displayed by Square, but are free to be displayed in 3rd party + * applications. + * + * @return string[]|null + */ + public function getImageIds(): ?array + { + return $this->imageIds; + } + + /** + * Sets Image Ids. + * The IDs of images associated with this `CatalogModifier` instance. + * Currently these images are not displayed by Square, but are free to be displayed in 3rd party + * applications. + * + * @maps image_ids + * + * @param string[]|null $imageIds + */ + public function setImageIds(?array $imageIds): void + { + $this->imageIds = $imageIds; + } + /** * Encode this object to JSON * @@ -149,6 +182,9 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) if (isset($this->modifierListId)) { $json['modifier_list_id'] = $this->modifierListId; } + if (isset($this->imageIds)) { + $json['image_ids'] = $this->imageIds; + } $json = array_filter($json, function ($val) { return $val !== null; }); diff --git a/src/Models/CatalogObject.php b/src/Models/CatalogObject.php index bd63f3e2..97e6b3e5 100644 --- a/src/Models/CatalogObject.php +++ b/src/Models/CatalogObject.php @@ -314,7 +314,7 @@ public function setIsDeleted(?bool $isDeleted): void * attribute definition. * Otherwise, the key used in the map is simply `"cocoa_brand"`. * - * Application-defined custom attributes that are set at a global (location-independent) level. + * Application-defined custom attributes are set at a global (location-independent) level. * Custom attribute values are intended to store additional information about a catalog object * or associations with an entity in another system. Do not use custom attributes * to store any sensitive information (personally identifiable information, card details, etc.). @@ -347,7 +347,7 @@ public function getCustomAttributeValues(): ?array * attribute definition. * Otherwise, the key used in the map is simply `"cocoa_brand"`. * - * Application-defined custom attributes that are set at a global (location-independent) level. + * Application-defined custom attributes are set at a global (location-independent) level. * Custom attribute values are intended to store additional information about a catalog object * or associations with an entity in another system. Do not use custom attributes * to store any sensitive information (personally identifiable information, card details, etc.). diff --git a/src/Models/CreateLocationRequest.php b/src/Models/CreateLocationRequest.php index 5e4fca27..f90507aa 100644 --- a/src/Models/CreateLocationRequest.php +++ b/src/Models/CreateLocationRequest.php @@ -7,7 +7,7 @@ use stdClass; /** - * Request object for the [CreateLocation]($e/Locations/CreateLocation) endpoint. + * The request object for the [CreateLocation]($e/Locations/CreateLocation) endpoint. */ class CreateLocationRequest implements \JsonSerializable { @@ -18,7 +18,7 @@ class CreateLocationRequest implements \JsonSerializable /** * Returns Location. - * Represents one of a business's [locations](https://developer.squareup.com/docs/locations-api). + * Represents one of a business' [locations](https://developer.squareup.com/docs/locations-api). */ public function getLocation(): ?Location { @@ -27,7 +27,7 @@ public function getLocation(): ?Location /** * Sets Location. - * Represents one of a business's [locations](https://developer.squareup.com/docs/locations-api). + * Represents one of a business' [locations](https://developer.squareup.com/docs/locations-api). * * @maps location */ diff --git a/src/Models/CreateLocationResponse.php b/src/Models/CreateLocationResponse.php index 9d5c8f18..f746093a 100644 --- a/src/Models/CreateLocationResponse.php +++ b/src/Models/CreateLocationResponse.php @@ -7,7 +7,7 @@ use stdClass; /** - * Response object returned by the [CreateLocation]($e/Locations/CreateLocation) endpoint. + * The response object returned by the [CreateLocation]($e/Locations/CreateLocation) endpoint. */ class CreateLocationResponse implements \JsonSerializable { @@ -23,7 +23,7 @@ class CreateLocationResponse implements \JsonSerializable /** * Returns Errors. - * Information on [errors](https://developer.squareup.com/docs/build-basics/handling-errors) + * Information about [errors](https://developer.squareup.com/docs/build-basics/handling-errors) * encountered during the request. * * @return Error[]|null @@ -35,7 +35,7 @@ public function getErrors(): ?array /** * Sets Errors. - * Information on [errors](https://developer.squareup.com/docs/build-basics/handling-errors) + * Information about [errors](https://developer.squareup.com/docs/build-basics/handling-errors) * encountered during the request. * * @maps errors @@ -49,7 +49,7 @@ public function setErrors(?array $errors): void /** * Returns Location. - * Represents one of a business's [locations](https://developer.squareup.com/docs/locations-api). + * Represents one of a business' [locations](https://developer.squareup.com/docs/locations-api). */ public function getLocation(): ?Location { @@ -58,7 +58,7 @@ public function getLocation(): ?Location /** * Sets Location. - * Represents one of a business's [locations](https://developer.squareup.com/docs/locations-api). + * Represents one of a business' [locations](https://developer.squareup.com/docs/locations-api). * * @maps location */ diff --git a/src/Models/CreateTerminalCheckoutRequest.php b/src/Models/CreateTerminalCheckoutRequest.php index bb7dc716..02e5f256 100644 --- a/src/Models/CreateTerminalCheckoutRequest.php +++ b/src/Models/CreateTerminalCheckoutRequest.php @@ -59,6 +59,7 @@ public function setIdempotencyKey(string $idempotencyKey): void /** * Returns Checkout. + * Represents a checkout processed by the Square Terminal. */ public function getCheckout(): TerminalCheckout { @@ -67,6 +68,7 @@ public function getCheckout(): TerminalCheckout /** * Sets Checkout. + * Represents a checkout processed by the Square Terminal. * * @required * @maps checkout diff --git a/src/Models/CreateTerminalCheckoutResponse.php b/src/Models/CreateTerminalCheckoutResponse.php index 4fd82460..39145ca9 100644 --- a/src/Models/CreateTerminalCheckoutResponse.php +++ b/src/Models/CreateTerminalCheckoutResponse.php @@ -44,6 +44,7 @@ public function setErrors(?array $errors): void /** * Returns Checkout. + * Represents a checkout processed by the Square Terminal. */ public function getCheckout(): ?TerminalCheckout { @@ -52,6 +53,7 @@ public function getCheckout(): ?TerminalCheckout /** * Sets Checkout. + * Represents a checkout processed by the Square Terminal. * * @maps checkout */ diff --git a/src/Models/CreateTerminalRefundRequest.php b/src/Models/CreateTerminalRefundRequest.php index f27c3af9..04188512 100644 --- a/src/Models/CreateTerminalRefundRequest.php +++ b/src/Models/CreateTerminalRefundRequest.php @@ -57,6 +57,8 @@ public function setIdempotencyKey(string $idempotencyKey): void /** * Returns Refund. + * Represents a payment refund processed by the Square Terminal. Only supports Interac (Canadian debit + * network) payment refunds. */ public function getRefund(): ?TerminalRefund { @@ -65,6 +67,8 @@ public function getRefund(): ?TerminalRefund /** * Sets Refund. + * Represents a payment refund processed by the Square Terminal. Only supports Interac (Canadian debit + * network) payment refunds. * * @maps refund */ diff --git a/src/Models/CreateTerminalRefundResponse.php b/src/Models/CreateTerminalRefundResponse.php index ac750ddf..2c7c89ba 100644 --- a/src/Models/CreateTerminalRefundResponse.php +++ b/src/Models/CreateTerminalRefundResponse.php @@ -44,6 +44,8 @@ public function setErrors(?array $errors): void /** * Returns Refund. + * Represents a payment refund processed by the Square Terminal. Only supports Interac (Canadian debit + * network) payment refunds. */ public function getRefund(): ?TerminalRefund { @@ -52,6 +54,8 @@ public function getRefund(): ?TerminalRefund /** * Sets Refund. + * Represents a payment refund processed by the Square Terminal. Only supports Interac (Canadian debit + * network) payment refunds. * * @maps refund */ diff --git a/src/Models/CreateVendorRequest.php b/src/Models/CreateVendorRequest.php index 4c3a597c..2f1a9a65 100644 --- a/src/Models/CreateVendorRequest.php +++ b/src/Models/CreateVendorRequest.php @@ -7,7 +7,7 @@ use stdClass; /** - * Represents an input to a call to [CreateVendor.]($e/Vendors/CreateVendor) + * Represents an input to a call to [CreateVendor]($e/Vendors/CreateVendor). */ class CreateVendorRequest implements \JsonSerializable { diff --git a/src/Models/CreateVendorResponse.php b/src/Models/CreateVendorResponse.php index 3b3f0457..5f28cd42 100644 --- a/src/Models/CreateVendorResponse.php +++ b/src/Models/CreateVendorResponse.php @@ -7,7 +7,7 @@ use stdClass; /** - * Represents an output from a call to [CreateVendor.]($e/Vendors/CreateVendor) + * Represents an output from a call to [CreateVendor]($e/Vendors/CreateVendor). */ class CreateVendorResponse implements \JsonSerializable { diff --git a/src/Models/Destination.php b/src/Models/Destination.php new file mode 100644 index 00000000..2a270d0e --- /dev/null +++ b/src/Models/Destination.php @@ -0,0 +1,88 @@ +type; + } + + /** + * Sets Type. + * List of possible destinations against which a payout can be made. + * + * @maps type + */ + public function setType(?string $type): void + { + $this->type = $type; + } + + /** + * Returns Id. + * Square issued unique ID (also known as the instrument ID) associated with this destination. + */ + public function getId(): ?string + { + return $this->id; + } + + /** + * Sets Id. + * Square issued unique ID (also known as the instrument ID) associated with this destination. + * + * @maps id + */ + public function setId(?string $id): void + { + $this->id = $id; + } + + /** + * 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 (isset($this->id)) { + $json['id'] = $this->id; + } + $json = array_filter($json, function ($val) { + return $val !== null; + }); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/DestinationType.php b/src/Models/DestinationType.php new file mode 100644 index 00000000..81d06f4c --- /dev/null +++ b/src/Models/DestinationType.php @@ -0,0 +1,29 @@ +skipReceiptScreen = $skipReceiptScreen; } + /** + * Returns Collect Signature. + * Indicates that signature collection is desired during checkout. Defaults to false. + */ + public function getCollectSignature(): ?bool + { + return $this->collectSignature; + } + + /** + * Sets Collect Signature. + * Indicates that signature collection is desired during checkout. Defaults to false. + * + * @maps collect_signature + */ + public function setCollectSignature(?bool $collectSignature): void + { + $this->collectSignature = $collectSignature; + } + /** * Returns Tip Settings. */ @@ -110,6 +135,9 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) if (isset($this->skipReceiptScreen)) { $json['skip_receipt_screen'] = $this->skipReceiptScreen; } + if (isset($this->collectSignature)) { + $json['collect_signature'] = $this->collectSignature; + } if (isset($this->tipSettings)) { $json['tip_settings'] = $this->tipSettings; } diff --git a/src/Models/ErrorCode.php b/src/Models/ErrorCode.php index 9da73e2a..baca63ab 100644 --- a/src/Models/ErrorCode.php +++ b/src/Models/ErrorCode.php @@ -683,6 +683,11 @@ class ErrorCode */ public const RESERVATION_DECLINED = 'RESERVATION_DECLINED'; + /** + * The body parameter is not recognized by the requested endpoint. + */ + public const UNKNOWN_BODY_PARAMETER = 'UNKNOWN_BODY_PARAMETER'; + /** * Not Found - a general error occurred. */ diff --git a/src/Models/GetPayoutResponse.php b/src/Models/GetPayoutResponse.php new file mode 100644 index 00000000..bc8a1966 --- /dev/null +++ b/src/Models/GetPayoutResponse.php @@ -0,0 +1,91 @@ +payout; + } + + /** + * Sets Payout. + * An accounting of the amount owed the seller and record of the actual transfer to their + * external bank account or to the Square balance. + * + * @maps payout + */ + public function setPayout(?Payout $payout): void + { + $this->payout = $payout; + } + + /** + * Returns Errors. + * Information about errors encountered during the request. + * + * @return Error[]|null + */ + public function getErrors(): ?array + { + return $this->errors; + } + + /** + * Sets Errors. + * Information about errors encountered during the request. + * + * @maps errors + * + * @param Error[]|null $errors + */ + public function setErrors(?array $errors): void + { + $this->errors = $errors; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + if (isset($this->payout)) { + $json['payout'] = $this->payout; + } + 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/GetTerminalCheckoutResponse.php b/src/Models/GetTerminalCheckoutResponse.php index 5f1c84fa..b0c42389 100644 --- a/src/Models/GetTerminalCheckoutResponse.php +++ b/src/Models/GetTerminalCheckoutResponse.php @@ -44,6 +44,7 @@ public function setErrors(?array $errors): void /** * Returns Checkout. + * Represents a checkout processed by the Square Terminal. */ public function getCheckout(): ?TerminalCheckout { @@ -52,6 +53,7 @@ public function getCheckout(): ?TerminalCheckout /** * Sets Checkout. + * Represents a checkout processed by the Square Terminal. * * @maps checkout */ diff --git a/src/Models/GetTerminalRefundResponse.php b/src/Models/GetTerminalRefundResponse.php index 5f67eeee..8ba58fdf 100644 --- a/src/Models/GetTerminalRefundResponse.php +++ b/src/Models/GetTerminalRefundResponse.php @@ -44,6 +44,8 @@ public function setErrors(?array $errors): void /** * Returns Refund. + * Represents a payment refund processed by the Square Terminal. Only supports Interac (Canadian debit + * network) payment refunds. */ public function getRefund(): ?TerminalRefund { @@ -52,6 +54,8 @@ public function getRefund(): ?TerminalRefund /** * Sets Refund. + * Represents a payment refund processed by the Square Terminal. Only supports Interac (Canadian debit + * network) payment refunds. * * @maps refund */ diff --git a/src/Models/InventoryAdjustment.php b/src/Models/InventoryAdjustment.php index dde83d2d..c1c8dd26 100644 --- a/src/Models/InventoryAdjustment.php +++ b/src/Models/InventoryAdjustment.php @@ -433,7 +433,7 @@ public function setTeamMemberId(?string $teamMemberId): void /** * Returns Transaction Id. - * The Square-generated ID of the [Transaction][#type-transaction] that + * The Square-generated ID of the [Transaction]($m/Transaction) that * caused the adjustment. Only relevant for payment-related state * transitions. */ @@ -444,7 +444,7 @@ public function getTransactionId(): ?string /** * Sets Transaction Id. - * The Square-generated ID of the [Transaction][#type-transaction] that + * The Square-generated ID of the [Transaction]($m/Transaction) that * caused the adjustment. Only relevant for payment-related state * transitions. * @@ -457,7 +457,7 @@ public function setTransactionId(?string $transactionId): void /** * Returns Refund Id. - * The Square-generated ID of the [Refund][#type-refund] that + * The Square-generated ID of the [Refund]($m/Refund) that * caused the adjustment. Only relevant for refund-related state * transitions. */ @@ -468,7 +468,7 @@ public function getRefundId(): ?string /** * Sets Refund Id. - * The Square-generated ID of the [Refund][#type-refund] that + * The Square-generated ID of the [Refund]($m/Refund) that * caused the adjustment. Only relevant for refund-related state * transitions. * diff --git a/src/Models/ItemVariationLocationOverrides.php b/src/Models/ItemVariationLocationOverrides.php index b3c7735e..fa6f93bb 100644 --- a/src/Models/ItemVariationLocationOverrides.php +++ b/src/Models/ItemVariationLocationOverrides.php @@ -41,6 +41,16 @@ class ItemVariationLocationOverrides implements \JsonSerializable */ private $inventoryAlertThreshold; + /** + * @var bool|null + */ + private $soldOut; + + /** + * @var string|null + */ + private $soldOutValidUntil; + /** * Returns Location Id. * The ID of the `Location`. This can include locations that are deactivated. @@ -183,6 +193,72 @@ public function setInventoryAlertThreshold(?int $inventoryAlertThreshold): void $this->inventoryAlertThreshold = $inventoryAlertThreshold; } + /** + * Returns Sold Out. + * Indicates whether the overridden item variation is sold out at the specified location. + * + * When inventory tracking is enabled on the item variation either globally or at the specified + * location, + * the item variation is automatically marked as sold out when its inventory count reaches zero. The + * seller + * can manually set the item variation as sold out even when the inventory count is greater than zero. + * Attempts by an application to set this attribute are ignored. Regardless how the sold-out status is + * set, + * applications should treat its inventory count as zero when this attribute value is `true`. + */ + public function getSoldOut(): ?bool + { + return $this->soldOut; + } + + /** + * Sets Sold Out. + * Indicates whether the overridden item variation is sold out at the specified location. + * + * When inventory tracking is enabled on the item variation either globally or at the specified + * location, + * the item variation is automatically marked as sold out when its inventory count reaches zero. The + * seller + * can manually set the item variation as sold out even when the inventory count is greater than zero. + * Attempts by an application to set this attribute are ignored. Regardless how the sold-out status is + * set, + * applications should treat its inventory count as zero when this attribute value is `true`. + * + * @maps sold_out + */ + public function setSoldOut(?bool $soldOut): void + { + $this->soldOut = $soldOut; + } + + /** + * Returns Sold Out Valid Until. + * The seller-assigned timestamp, of the RFC 3339 format, to indicate when this sold-out variation + * becomes available again at the specified location. Attempts by an application to set this attribute + * are ignored. + * When the current time is later than this attribute value, the affected item variation is no longer + * sold out. + */ + public function getSoldOutValidUntil(): ?string + { + return $this->soldOutValidUntil; + } + + /** + * Sets Sold Out Valid Until. + * The seller-assigned timestamp, of the RFC 3339 format, to indicate when this sold-out variation + * becomes available again at the specified location. Attempts by an application to set this attribute + * are ignored. + * When the current time is later than this attribute value, the affected item variation is no longer + * sold out. + * + * @maps sold_out_valid_until + */ + public function setSoldOutValidUntil(?string $soldOutValidUntil): void + { + $this->soldOutValidUntil = $soldOutValidUntil; + } + /** * Encode this object to JSON * @@ -213,6 +289,12 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) if (isset($this->inventoryAlertThreshold)) { $json['inventory_alert_threshold'] = $this->inventoryAlertThreshold; } + if (isset($this->soldOut)) { + $json['sold_out'] = $this->soldOut; + } + if (isset($this->soldOutValidUntil)) { + $json['sold_out_valid_until'] = $this->soldOutValidUntil; + } $json = array_filter($json, function ($val) { return $val !== null; }); diff --git a/src/Models/ListLocationsResponse.php b/src/Models/ListLocationsResponse.php index 9ea88fa4..bec2b8b4 100644 --- a/src/Models/ListLocationsResponse.php +++ b/src/Models/ListLocationsResponse.php @@ -10,7 +10,7 @@ * Defines the fields that are included in the response body of a request * to the [ListLocations]($e/Locations/ListLocations) endpoint. * - * One of `errors` or `locations` is present in a given response (never both). + * Either `errors` or `locations` is present in a given response (never both). */ class ListLocationsResponse implements \JsonSerializable { diff --git a/src/Models/ListPayoutEntriesRequest.php b/src/Models/ListPayoutEntriesRequest.php new file mode 100644 index 00000000..43dd85fe --- /dev/null +++ b/src/Models/ListPayoutEntriesRequest.php @@ -0,0 +1,129 @@ +sortOrder; + } + + /** + * Sets Sort Order. + * The order (e.g., chronological or alphabetical) in which results from a request are returned. + * + * @maps sort_order + */ + public function setSortOrder(?string $sortOrder): void + { + $this->sortOrder = $sortOrder; + } + + /** + * Returns 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. + * For more information, see [Pagination](https://developer.squareup.com/docs/basics/api101/pagination). + * If request parameters change between requests, subsequent results may contain duplicates or missing + * records. + */ + public function getCursor(): ?string + { + return $this->cursor; + } + + /** + * Sets 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. + * For more information, see [Pagination](https://developer.squareup.com/docs/basics/api101/pagination). + * If request parameters change between requests, subsequent results may contain duplicates or missing + * records. + * + * @maps cursor + */ + public function setCursor(?string $cursor): void + { + $this->cursor = $cursor; + } + + /** + * Returns Limit. + * The maximum number of results to be returned in a single page. + * It is possible to receive fewer results than the specified limit on a given page. + * The default value of 100 is also the maximum allowed value. If the provided value is + * greater than 100, it is ignored and the default value is used instead. + * Default: `100` + */ + public function getLimit(): ?int + { + return $this->limit; + } + + /** + * Sets Limit. + * The maximum number of results to be returned in a single page. + * It is possible to receive fewer results than the specified limit on a given page. + * The default value of 100 is also the maximum allowed value. If the provided value is + * greater than 100, it is ignored and the default value is used instead. + * Default: `100` + * + * @maps limit + */ + public function setLimit(?int $limit): void + { + $this->limit = $limit; + } + + /** + * 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->sortOrder)) { + $json['sort_order'] = $this->sortOrder; + } + if (isset($this->cursor)) { + $json['cursor'] = $this->cursor; + } + if (isset($this->limit)) { + $json['limit'] = $this->limit; + } + $json = array_filter($json, function ($val) { + return $val !== null; + }); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/ListPayoutEntriesResponse.php b/src/Models/ListPayoutEntriesResponse.php new file mode 100644 index 00000000..92e628b3 --- /dev/null +++ b/src/Models/ListPayoutEntriesResponse.php @@ -0,0 +1,126 @@ +payoutEntries; + } + + /** + * Sets Payout Entries. + * The requested list of payout entries, ordered with the given or default sort order. + * + * @maps payout_entries + * + * @param PayoutEntry[]|null $payoutEntries + */ + public function setPayoutEntries(?array $payoutEntries): void + { + $this->payoutEntries = $payoutEntries; + } + + /** + * Returns Cursor. + * The pagination cursor to be used in a subsequent request. If empty, this is the final response. + * For more information, see [Pagination](https://developer.squareup.com/docs/basics/api101/pagination). + */ + public function getCursor(): ?string + { + return $this->cursor; + } + + /** + * Sets Cursor. + * The pagination cursor to be used in a subsequent request. If empty, this is the final response. + * For more information, see [Pagination](https://developer.squareup.com/docs/basics/api101/pagination). + * + * @maps cursor + */ + public function setCursor(?string $cursor): void + { + $this->cursor = $cursor; + } + + /** + * Returns Errors. + * Information about errors encountered during the request. + * + * @return Error[]|null + */ + public function getErrors(): ?array + { + return $this->errors; + } + + /** + * Sets Errors. + * Information about errors encountered during the request. + * + * @maps errors + * + * @param Error[]|null $errors + */ + public function setErrors(?array $errors): void + { + $this->errors = $errors; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + if (isset($this->payoutEntries)) { + $json['payout_entries'] = $this->payoutEntries; + } + if (isset($this->cursor)) { + $json['cursor'] = $this->cursor; + } + 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/ListPayoutsRequest.php b/src/Models/ListPayoutsRequest.php new file mode 100644 index 00000000..4fabe760 --- /dev/null +++ b/src/Models/ListPayoutsRequest.php @@ -0,0 +1,250 @@ +locationId; + } + + /** + * Sets Location Id. + * The ID of the location for which to list the payouts. + * By default, payouts are returned for the default (main) location associated with the seller. + * + * @maps location_id + */ + public function setLocationId(?string $locationId): void + { + $this->locationId = $locationId; + } + + /** + * Returns Status. + * Payout status types + */ + public function getStatus(): ?string + { + return $this->status; + } + + /** + * Sets Status. + * Payout status types + * + * @maps status + */ + public function setStatus(?string $status): void + { + $this->status = $status; + } + + /** + * Returns Begin Time. + * The timestamp for the beginning of the payout creation time, in RFC 3339 format. + * Inclusive. Default: The current time minus one year. + */ + public function getBeginTime(): ?string + { + return $this->beginTime; + } + + /** + * Sets Begin Time. + * The timestamp for the beginning of the payout creation time, in RFC 3339 format. + * Inclusive. Default: The current time minus one year. + * + * @maps begin_time + */ + public function setBeginTime(?string $beginTime): void + { + $this->beginTime = $beginTime; + } + + /** + * Returns End Time. + * The timestamp for the end of the payout creation time, in RFC 3339 format. + * Default: The current time. + */ + public function getEndTime(): ?string + { + return $this->endTime; + } + + /** + * Sets End Time. + * The timestamp for the end of the payout creation time, in RFC 3339 format. + * Default: The current time. + * + * @maps end_time + */ + public function setEndTime(?string $endTime): void + { + $this->endTime = $endTime; + } + + /** + * Returns Sort Order. + * The order (e.g., chronological or alphabetical) in which results from a request are returned. + */ + public function getSortOrder(): ?string + { + return $this->sortOrder; + } + + /** + * Sets Sort Order. + * The order (e.g., chronological or alphabetical) in which results from a request are returned. + * + * @maps sort_order + */ + public function setSortOrder(?string $sortOrder): void + { + $this->sortOrder = $sortOrder; + } + + /** + * Returns 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. + * For more information, see [Pagination](https://developer.squareup.com/docs/basics/api101/pagination). + * If request parameters change between requests, subsequent results may contain duplicates or missing + * records. + */ + public function getCursor(): ?string + { + return $this->cursor; + } + + /** + * Sets 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. + * For more information, see [Pagination](https://developer.squareup.com/docs/basics/api101/pagination). + * If request parameters change between requests, subsequent results may contain duplicates or missing + * records. + * + * @maps cursor + */ + public function setCursor(?string $cursor): void + { + $this->cursor = $cursor; + } + + /** + * Returns Limit. + * The maximum number of results to be returned in a single page. + * It is possible to receive fewer results than the specified limit on a given page. + * The default value of 100 is also the maximum allowed value. If the provided value is + * greater than 100, it is ignored and the default value is used instead. + * Default: `100` + */ + public function getLimit(): ?int + { + return $this->limit; + } + + /** + * Sets Limit. + * The maximum number of results to be returned in a single page. + * It is possible to receive fewer results than the specified limit on a given page. + * The default value of 100 is also the maximum allowed value. If the provided value is + * greater than 100, it is ignored and the default value is used instead. + * Default: `100` + * + * @maps limit + */ + public function setLimit(?int $limit): void + { + $this->limit = $limit; + } + + /** + * 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->locationId)) { + $json['location_id'] = $this->locationId; + } + if (isset($this->status)) { + $json['status'] = $this->status; + } + if (isset($this->beginTime)) { + $json['begin_time'] = $this->beginTime; + } + if (isset($this->endTime)) { + $json['end_time'] = $this->endTime; + } + if (isset($this->sortOrder)) { + $json['sort_order'] = $this->sortOrder; + } + if (isset($this->cursor)) { + $json['cursor'] = $this->cursor; + } + if (isset($this->limit)) { + $json['limit'] = $this->limit; + } + $json = array_filter($json, function ($val) { + return $val !== null; + }); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/ListPayoutsResponse.php b/src/Models/ListPayoutsResponse.php new file mode 100644 index 00000000..738d4a5a --- /dev/null +++ b/src/Models/ListPayoutsResponse.php @@ -0,0 +1,126 @@ +payouts; + } + + /** + * Sets Payouts. + * The requested list of payouts. + * + * @maps payouts + * + * @param Payout[]|null $payouts + */ + public function setPayouts(?array $payouts): void + { + $this->payouts = $payouts; + } + + /** + * Returns Cursor. + * The pagination cursor to be used in a subsequent request. If empty, this is the final response. + * For more information, see [Pagination](https://developer.squareup.com/docs/basics/api101/pagination). + */ + public function getCursor(): ?string + { + return $this->cursor; + } + + /** + * Sets Cursor. + * The pagination cursor to be used in a subsequent request. If empty, this is the final response. + * For more information, see [Pagination](https://developer.squareup.com/docs/basics/api101/pagination). + * + * @maps cursor + */ + public function setCursor(?string $cursor): void + { + $this->cursor = $cursor; + } + + /** + * Returns Errors. + * Information about errors encountered during the request. + * + * @return Error[]|null + */ + public function getErrors(): ?array + { + return $this->errors; + } + + /** + * Sets Errors. + * Information about errors encountered during the request. + * + * @maps errors + * + * @param Error[]|null $errors + */ + public function setErrors(?array $errors): void + { + $this->errors = $errors; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + if (isset($this->payouts)) { + $json['payouts'] = $this->payouts; + } + if (isset($this->cursor)) { + $json['cursor'] = $this->cursor; + } + 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/Location.php b/src/Models/Location.php index 45d1685c..c1ed8b6f 100644 --- a/src/Models/Location.php +++ b/src/Models/Location.php @@ -7,7 +7,7 @@ use stdClass; /** - * Represents one of a business's [locations](https://developer.squareup.com/docs/locations-api). + * Represents one of a business' [locations](https://developer.squareup.com/docs/locations-api). */ class Location implements \JsonSerializable { @@ -148,7 +148,7 @@ class Location implements \JsonSerializable /** * Returns Id. - * A short, generated string of letters and numbers that uniquely identifies this location instance. + * A short generated string of letters and numbers that uniquely identifies this location instance. */ public function getId(): ?string { @@ -157,7 +157,7 @@ public function getId(): ?string /** * Sets Id. - * A short, generated string of letters and numbers that uniquely identifies this location instance. + * A short generated string of letters and numbers that uniquely identifies this location instance. * * @maps id */ @@ -169,7 +169,7 @@ public function setId(?string $id): void /** * Returns Name. * The name of the location. - * This information appears in the dashboard as the nickname. + * This information appears in the Seller Dashboard as the nickname. * A location name must be unique within a seller account. */ public function getName(): ?string @@ -180,7 +180,7 @@ public function getName(): ?string /** * Sets Name. * The name of the location. - * This information appears in the dashboard as the nickname. + * This information appears in the Seller Dashboard as the nickname. * A location name must be unique within a seller account. * * @maps name @@ -216,8 +216,8 @@ public function setAddress(?Address $address): void /** * Returns Timezone. - * The [IANA Timezone](https://www.iana.org/time-zones) identifier for - * the timezone of the location. For example, `America/Los_Angeles`. + * The [IANA time zone](https://www.iana.org/time-zones) identifier for + * the time zone of the location. For example, `America/Los_Angeles`. */ public function getTimezone(): ?string { @@ -226,8 +226,8 @@ public function getTimezone(): ?string /** * Sets Timezone. - * The [IANA Timezone](https://www.iana.org/time-zones) identifier for - * the timezone of the location. For example, `America/Los_Angeles`. + * The [IANA time zone](https://www.iana.org/time-zones) identifier for + * the time zone of the location. For example, `America/Los_Angeles`. * * @maps timezone */ @@ -502,8 +502,8 @@ public function setBusinessHours(?BusinessHours $businessHours): void /** * Returns Business Email. - * The email address of the location. This can be unique to the location, and is not always the email - * address for the business owner or admin. + * The email address of the location. This can be unique to the location and is not always the email + * address for the business owner or administrator. */ public function getBusinessEmail(): ?string { @@ -512,8 +512,8 @@ public function getBusinessEmail(): ?string /** * Sets Business Email. - * The email address of the location. This can be unique to the location, and is not always the email - * address for the business owner or admin. + * The email address of the location. This can be unique to the location and is not always the email + * address for the business owner or administrator. * * @maps business_email */ @@ -627,10 +627,9 @@ public function setCoordinates(?Coordinates $coordinates): void /** * Returns Logo Url. * The URL of the logo image for the location. When configured in the Seller - * dashboard (Receipts section), the logo appears on transactions (such as receipts and invoices) - * that Square generates on behalf of the Seller. This image should have a roughly square (1:1) aspect - * ratio - * and is recommended to be at least 200x200 pixels. + * Dashboard (Receipts section), the logo appears on transactions (such as receipts and invoices) that + * Square generates on behalf of the seller. + * This image should have a roughly square (1:1) aspect ratio and should be at least 200x200 pixels. */ public function getLogoUrl(): ?string { @@ -640,10 +639,9 @@ public function getLogoUrl(): ?string /** * Sets Logo Url. * The URL of the logo image for the location. When configured in the Seller - * dashboard (Receipts section), the logo appears on transactions (such as receipts and invoices) - * that Square generates on behalf of the Seller. This image should have a roughly square (1:1) aspect - * ratio - * and is recommended to be at least 200x200 pixels. + * Dashboard (Receipts section), the logo appears on transactions (such as receipts and invoices) that + * Square generates on behalf of the seller. + * This image should have a roughly square (1:1) aspect ratio and should be at least 200x200 pixels. * * @maps logo_url */ @@ -701,9 +699,9 @@ public function setMcc(?string $mcc): void /** * Returns Full Format Logo Url. * The URL of a full-format logo image for the location. When configured in the Seller - * dashboard (Receipts section), the logo appears on transactions (such as receipts and invoices) - * that Square generates on behalf of the Seller. This image can be wider than it is tall, - * and is recommended to be at least 1280x648 pixels. + * Dashboard (Receipts section), the logo appears on transactions (such as receipts and invoices) that + * Square generates on behalf of the seller. + * This image can be wider than it is tall and should be at least 1280x648 pixels. */ public function getFullFormatLogoUrl(): ?string { @@ -713,9 +711,9 @@ public function getFullFormatLogoUrl(): ?string /** * Sets Full Format Logo Url. * The URL of a full-format logo image for the location. When configured in the Seller - * dashboard (Receipts section), the logo appears on transactions (such as receipts and invoices) - * that Square generates on behalf of the Seller. This image can be wider than it is tall, - * and is recommended to be at least 1280x648 pixels. + * Dashboard (Receipts section), the logo appears on transactions (such as receipts and invoices) that + * Square generates on behalf of the seller. + * This image can be wider than it is tall and should be at least 1280x648 pixels. * * @maps full_format_logo_url */ diff --git a/src/Models/LocationCapability.php b/src/Models/LocationCapability.php index 0362171e..84daaa90 100644 --- a/src/Models/LocationCapability.php +++ b/src/Models/LocationCapability.php @@ -5,7 +5,7 @@ namespace Square\Models; /** - * The capabilities a location may have. + * The capabilities a location might have. */ class LocationCapability { diff --git a/src/Models/OrderLineItemModifier.php b/src/Models/OrderLineItemModifier.php index 757b6303..876e0825 100644 --- a/src/Models/OrderLineItemModifier.php +++ b/src/Models/OrderLineItemModifier.php @@ -31,6 +31,11 @@ class OrderLineItemModifier implements \JsonSerializable */ private $name; + /** + * @var string|null + */ + private $quantity; + /** * @var Money|null */ @@ -126,6 +131,38 @@ public function setName(?string $name): void $this->name = $name; } + /** + * Returns Quantity. + * The quantity of the line item modifier. The modifier quantity can be 0 or more. + * For example, suppose a restaurant offers a cheeseburger on the menu. When a buyer orders + * this item, the restaurant records the purchase by creating an `Order` object with a line item + * for a burger. The line item includes a line item modifier: the name is cheese and the quantity + * is 1. The buyer has the option to order extra cheese (or no cheese). If the buyer chooses + * the extra cheese option, the modifier quantity increases to 2. If the buyer does not want + * any cheese, the modifier quantity is set to 0. + */ + public function getQuantity(): ?string + { + return $this->quantity; + } + + /** + * Sets Quantity. + * The quantity of the line item modifier. The modifier quantity can be 0 or more. + * For example, suppose a restaurant offers a cheeseburger on the menu. When a buyer orders + * this item, the restaurant records the purchase by creating an `Order` object with a line item + * for a burger. The line item includes a line item modifier: the name is cheese and the quantity + * is 1. The buyer has the option to order extra cheese (or no cheese). If the buyer chooses + * the extra cheese option, the modifier quantity increases to 2. If the buyer does not want + * any cheese, the modifier quantity is set to 0. + * + * @maps quantity + */ + public function setQuantity(?string $quantity): void + { + $this->quantity = $quantity; + } + /** * Returns Base Price Money. * Represents an amount of money. `Money` fields can be signed or unsigned. @@ -272,6 +309,9 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) if (isset($this->name)) { $json['name'] = $this->name; } + if (isset($this->quantity)) { + $json['quantity'] = $this->quantity; + } if (isset($this->basePriceMoney)) { $json['base_price_money'] = $this->basePriceMoney; } diff --git a/src/Models/PaymentBalanceActivityAutomaticSavingsDetail.php b/src/Models/PaymentBalanceActivityAutomaticSavingsDetail.php new file mode 100644 index 00000000..a68aedc1 --- /dev/null +++ b/src/Models/PaymentBalanceActivityAutomaticSavingsDetail.php @@ -0,0 +1,85 @@ +paymentId; + } + + /** + * Sets Payment Id. + * The ID of the payment associated with this activity. + * + * @maps payment_id + */ + public function setPaymentId(?string $paymentId): void + { + $this->paymentId = $paymentId; + } + + /** + * Returns Payout Id. + * The ID of the payout associated with this activity. + */ + public function getPayoutId(): ?string + { + return $this->payoutId; + } + + /** + * Sets Payout Id. + * The ID of the payout associated with this activity. + * + * @maps payout_id + */ + public function setPayoutId(?string $payoutId): void + { + $this->payoutId = $payoutId; + } + + /** + * 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->paymentId)) { + $json['payment_id'] = $this->paymentId; + } + if (isset($this->payoutId)) { + $json['payout_id'] = $this->payoutId; + } + $json = array_filter($json, function ($val) { + return $val !== null; + }); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/PaymentBalanceActivityAutomaticSavingsReversedDetail.php b/src/Models/PaymentBalanceActivityAutomaticSavingsReversedDetail.php new file mode 100644 index 00000000..a6236e01 --- /dev/null +++ b/src/Models/PaymentBalanceActivityAutomaticSavingsReversedDetail.php @@ -0,0 +1,85 @@ +paymentId; + } + + /** + * Sets Payment Id. + * The ID of the payment associated with this activity. + * + * @maps payment_id + */ + public function setPaymentId(?string $paymentId): void + { + $this->paymentId = $paymentId; + } + + /** + * Returns Payout Id. + * The ID of the payout associated with this activity. + */ + public function getPayoutId(): ?string + { + return $this->payoutId; + } + + /** + * Sets Payout Id. + * The ID of the payout associated with this activity. + * + * @maps payout_id + */ + public function setPayoutId(?string $payoutId): void + { + $this->payoutId = $payoutId; + } + + /** + * 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->paymentId)) { + $json['payment_id'] = $this->paymentId; + } + if (isset($this->payoutId)) { + $json['payout_id'] = $this->payoutId; + } + $json = array_filter($json, function ($val) { + return $val !== null; + }); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/PaymentBalanceActivityChargeDetail.php b/src/Models/PaymentBalanceActivityChargeDetail.php new file mode 100644 index 00000000..692a7cb7 --- /dev/null +++ b/src/Models/PaymentBalanceActivityChargeDetail.php @@ -0,0 +1,60 @@ +paymentId; + } + + /** + * Sets Payment Id. + * The ID of the payment associated with this activity. + * + * @maps payment_id + */ + public function setPaymentId(?string $paymentId): void + { + $this->paymentId = $paymentId; + } + + /** + * 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->paymentId)) { + $json['payment_id'] = $this->paymentId; + } + $json = array_filter($json, function ($val) { + return $val !== null; + }); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/PaymentBalanceActivityDepositFeeDetail.php b/src/Models/PaymentBalanceActivityDepositFeeDetail.php new file mode 100644 index 00000000..9e7ee072 --- /dev/null +++ b/src/Models/PaymentBalanceActivityDepositFeeDetail.php @@ -0,0 +1,57 @@ +payoutId; + } + + /** + * Sets Payout Id. + * The ID of the payout that triggered this deposit fee activity. + * + * @maps payout_id + */ + public function setPayoutId(?string $payoutId): void + { + $this->payoutId = $payoutId; + } + + /** + * 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->payoutId)) { + $json['payout_id'] = $this->payoutId; + } + $json = array_filter($json, function ($val) { + return $val !== null; + }); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/PaymentBalanceActivityDisputeDetail.php b/src/Models/PaymentBalanceActivityDisputeDetail.php new file mode 100644 index 00000000..a3d03710 --- /dev/null +++ b/src/Models/PaymentBalanceActivityDisputeDetail.php @@ -0,0 +1,85 @@ +paymentId; + } + + /** + * Sets Payment Id. + * The ID of the payment associated with this activity. + * + * @maps payment_id + */ + public function setPaymentId(?string $paymentId): void + { + $this->paymentId = $paymentId; + } + + /** + * Returns Dispute Id. + * The ID of the dispute associated with this activity. + */ + public function getDisputeId(): ?string + { + return $this->disputeId; + } + + /** + * Sets Dispute Id. + * The ID of the dispute associated with this activity. + * + * @maps dispute_id + */ + public function setDisputeId(?string $disputeId): void + { + $this->disputeId = $disputeId; + } + + /** + * 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->paymentId)) { + $json['payment_id'] = $this->paymentId; + } + if (isset($this->disputeId)) { + $json['dispute_id'] = $this->disputeId; + } + $json = array_filter($json, function ($val) { + return $val !== null; + }); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/PaymentBalanceActivityFeeDetail.php b/src/Models/PaymentBalanceActivityFeeDetail.php new file mode 100644 index 00000000..1f3805f4 --- /dev/null +++ b/src/Models/PaymentBalanceActivityFeeDetail.php @@ -0,0 +1,57 @@ +paymentId; + } + + /** + * Sets Payment Id. + * The ID of the payment associated with this activity. + * + * @maps payment_id + */ + public function setPaymentId(?string $paymentId): void + { + $this->paymentId = $paymentId; + } + + /** + * 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->paymentId)) { + $json['payment_id'] = $this->paymentId; + } + $json = array_filter($json, function ($val) { + return $val !== null; + }); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/PaymentBalanceActivityFreeProcessingDetail.php b/src/Models/PaymentBalanceActivityFreeProcessingDetail.php new file mode 100644 index 00000000..bf552ec4 --- /dev/null +++ b/src/Models/PaymentBalanceActivityFreeProcessingDetail.php @@ -0,0 +1,57 @@ +paymentId; + } + + /** + * Sets Payment Id. + * The ID of the payment associated with this activity. + * + * @maps payment_id + */ + public function setPaymentId(?string $paymentId): void + { + $this->paymentId = $paymentId; + } + + /** + * 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->paymentId)) { + $json['payment_id'] = $this->paymentId; + } + $json = array_filter($json, function ($val) { + return $val !== null; + }); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/PaymentBalanceActivityHoldAdjustmentDetail.php b/src/Models/PaymentBalanceActivityHoldAdjustmentDetail.php new file mode 100644 index 00000000..440135ee --- /dev/null +++ b/src/Models/PaymentBalanceActivityHoldAdjustmentDetail.php @@ -0,0 +1,57 @@ +paymentId; + } + + /** + * Sets Payment Id. + * The ID of the payment associated with this activity. + * + * @maps payment_id + */ + public function setPaymentId(?string $paymentId): void + { + $this->paymentId = $paymentId; + } + + /** + * 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->paymentId)) { + $json['payment_id'] = $this->paymentId; + } + $json = array_filter($json, function ($val) { + return $val !== null; + }); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/PaymentBalanceActivityOpenDisputeDetail.php b/src/Models/PaymentBalanceActivityOpenDisputeDetail.php new file mode 100644 index 00000000..0980491f --- /dev/null +++ b/src/Models/PaymentBalanceActivityOpenDisputeDetail.php @@ -0,0 +1,85 @@ +paymentId; + } + + /** + * Sets Payment Id. + * The ID of the payment associated with this activity. + * + * @maps payment_id + */ + public function setPaymentId(?string $paymentId): void + { + $this->paymentId = $paymentId; + } + + /** + * Returns Dispute Id. + * The ID of the dispute associated with this activity. + */ + public function getDisputeId(): ?string + { + return $this->disputeId; + } + + /** + * Sets Dispute Id. + * The ID of the dispute associated with this activity. + * + * @maps dispute_id + */ + public function setDisputeId(?string $disputeId): void + { + $this->disputeId = $disputeId; + } + + /** + * 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->paymentId)) { + $json['payment_id'] = $this->paymentId; + } + if (isset($this->disputeId)) { + $json['dispute_id'] = $this->disputeId; + } + $json = array_filter($json, function ($val) { + return $val !== null; + }); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/PaymentBalanceActivityOtherAdjustmentDetail.php b/src/Models/PaymentBalanceActivityOtherAdjustmentDetail.php new file mode 100644 index 00000000..e74b9c85 --- /dev/null +++ b/src/Models/PaymentBalanceActivityOtherAdjustmentDetail.php @@ -0,0 +1,57 @@ +paymentId; + } + + /** + * Sets Payment Id. + * The ID of the payment associated with this activity. + * + * @maps payment_id + */ + public function setPaymentId(?string $paymentId): void + { + $this->paymentId = $paymentId; + } + + /** + * 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->paymentId)) { + $json['payment_id'] = $this->paymentId; + } + $json = array_filter($json, function ($val) { + return $val !== null; + }); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/PaymentBalanceActivityOtherDetail.php b/src/Models/PaymentBalanceActivityOtherDetail.php new file mode 100644 index 00000000..cb719940 --- /dev/null +++ b/src/Models/PaymentBalanceActivityOtherDetail.php @@ -0,0 +1,57 @@ +paymentId; + } + + /** + * Sets Payment Id. + * The ID of the payment associated with this activity. + * + * @maps payment_id + */ + public function setPaymentId(?string $paymentId): void + { + $this->paymentId = $paymentId; + } + + /** + * 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->paymentId)) { + $json['payment_id'] = $this->paymentId; + } + $json = array_filter($json, function ($val) { + return $val !== null; + }); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/PaymentBalanceActivityRefundDetail.php b/src/Models/PaymentBalanceActivityRefundDetail.php new file mode 100644 index 00000000..38726ca9 --- /dev/null +++ b/src/Models/PaymentBalanceActivityRefundDetail.php @@ -0,0 +1,85 @@ +paymentId; + } + + /** + * Sets Payment Id. + * The ID of the payment associated with this activity. + * + * @maps payment_id + */ + public function setPaymentId(?string $paymentId): void + { + $this->paymentId = $paymentId; + } + + /** + * Returns Refund Id. + * The ID of the refund associated with this activity. + */ + public function getRefundId(): ?string + { + return $this->refundId; + } + + /** + * Sets Refund Id. + * The ID of the refund associated with this activity. + * + * @maps refund_id + */ + public function setRefundId(?string $refundId): void + { + $this->refundId = $refundId; + } + + /** + * 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->paymentId)) { + $json['payment_id'] = $this->paymentId; + } + if (isset($this->refundId)) { + $json['refund_id'] = $this->refundId; + } + $json = array_filter($json, function ($val) { + return $val !== null; + }); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/PaymentBalanceActivityReleaseAdjustmentDetail.php b/src/Models/PaymentBalanceActivityReleaseAdjustmentDetail.php new file mode 100644 index 00000000..86f7c941 --- /dev/null +++ b/src/Models/PaymentBalanceActivityReleaseAdjustmentDetail.php @@ -0,0 +1,57 @@ +paymentId; + } + + /** + * Sets Payment Id. + * The ID of the payment associated with this activity. + * + * @maps payment_id + */ + public function setPaymentId(?string $paymentId): void + { + $this->paymentId = $paymentId; + } + + /** + * 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->paymentId)) { + $json['payment_id'] = $this->paymentId; + } + $json = array_filter($json, function ($val) { + return $val !== null; + }); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/PaymentBalanceActivityReserveHoldDetail.php b/src/Models/PaymentBalanceActivityReserveHoldDetail.php new file mode 100644 index 00000000..d76c0fea --- /dev/null +++ b/src/Models/PaymentBalanceActivityReserveHoldDetail.php @@ -0,0 +1,57 @@ +paymentId; + } + + /** + * Sets Payment Id. + * The ID of the payment associated with this activity. + * + * @maps payment_id + */ + public function setPaymentId(?string $paymentId): void + { + $this->paymentId = $paymentId; + } + + /** + * 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->paymentId)) { + $json['payment_id'] = $this->paymentId; + } + $json = array_filter($json, function ($val) { + return $val !== null; + }); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/PaymentBalanceActivityReserveReleaseDetail.php b/src/Models/PaymentBalanceActivityReserveReleaseDetail.php new file mode 100644 index 00000000..b8e56ad7 --- /dev/null +++ b/src/Models/PaymentBalanceActivityReserveReleaseDetail.php @@ -0,0 +1,57 @@ +paymentId; + } + + /** + * Sets Payment Id. + * The ID of the payment associated with this activity. + * + * @maps payment_id + */ + public function setPaymentId(?string $paymentId): void + { + $this->paymentId = $paymentId; + } + + /** + * 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->paymentId)) { + $json['payment_id'] = $this->paymentId; + } + $json = array_filter($json, function ($val) { + return $val !== null; + }); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/PaymentBalanceActivitySquareCapitalPaymentDetail.php b/src/Models/PaymentBalanceActivitySquareCapitalPaymentDetail.php new file mode 100644 index 00000000..5c8b16fb --- /dev/null +++ b/src/Models/PaymentBalanceActivitySquareCapitalPaymentDetail.php @@ -0,0 +1,57 @@ +paymentId; + } + + /** + * Sets Payment Id. + * The ID of the payment associated with this activity. + * + * @maps payment_id + */ + public function setPaymentId(?string $paymentId): void + { + $this->paymentId = $paymentId; + } + + /** + * 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->paymentId)) { + $json['payment_id'] = $this->paymentId; + } + $json = array_filter($json, function ($val) { + return $val !== null; + }); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/PaymentBalanceActivitySquareCapitalReversedPaymentDetail.php b/src/Models/PaymentBalanceActivitySquareCapitalReversedPaymentDetail.php new file mode 100644 index 00000000..7311de17 --- /dev/null +++ b/src/Models/PaymentBalanceActivitySquareCapitalReversedPaymentDetail.php @@ -0,0 +1,57 @@ +paymentId; + } + + /** + * Sets Payment Id. + * The ID of the payment associated with this activity. + * + * @maps payment_id + */ + public function setPaymentId(?string $paymentId): void + { + $this->paymentId = $paymentId; + } + + /** + * 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->paymentId)) { + $json['payment_id'] = $this->paymentId; + } + $json = array_filter($json, function ($val) { + return $val !== null; + }); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/PaymentBalanceActivityTaxOnFeeDetail.php b/src/Models/PaymentBalanceActivityTaxOnFeeDetail.php new file mode 100644 index 00000000..fc9ec31b --- /dev/null +++ b/src/Models/PaymentBalanceActivityTaxOnFeeDetail.php @@ -0,0 +1,57 @@ +paymentId; + } + + /** + * Sets Payment Id. + * The ID of the payment associated with this activity. + * + * @maps payment_id + */ + public function setPaymentId(?string $paymentId): void + { + $this->paymentId = $paymentId; + } + + /** + * 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->paymentId)) { + $json['payment_id'] = $this->paymentId; + } + $json = array_filter($json, function ($val) { + return $val !== null; + }); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/PaymentBalanceActivityThirdPartyFeeDetail.php b/src/Models/PaymentBalanceActivityThirdPartyFeeDetail.php new file mode 100644 index 00000000..e210f6bb --- /dev/null +++ b/src/Models/PaymentBalanceActivityThirdPartyFeeDetail.php @@ -0,0 +1,57 @@ +paymentId; + } + + /** + * Sets Payment Id. + * The ID of the payment associated with this activity. + * + * @maps payment_id + */ + public function setPaymentId(?string $paymentId): void + { + $this->paymentId = $paymentId; + } + + /** + * 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->paymentId)) { + $json['payment_id'] = $this->paymentId; + } + $json = array_filter($json, function ($val) { + return $val !== null; + }); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/PaymentBalanceActivityThirdPartyFeeRefundDetail.php b/src/Models/PaymentBalanceActivityThirdPartyFeeRefundDetail.php new file mode 100644 index 00000000..d3fc6710 --- /dev/null +++ b/src/Models/PaymentBalanceActivityThirdPartyFeeRefundDetail.php @@ -0,0 +1,57 @@ +paymentId; + } + + /** + * Sets Payment Id. + * The ID of the payment associated with this activity. + * + * @maps payment_id + */ + public function setPaymentId(?string $paymentId): void + { + $this->paymentId = $paymentId; + } + + /** + * 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->paymentId)) { + $json['payment_id'] = $this->paymentId; + } + $json = array_filter($json, function ($val) { + return $val !== null; + }); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/PaymentOptions.php b/src/Models/PaymentOptions.php deleted file mode 100644 index a5f1002e..00000000 --- a/src/Models/PaymentOptions.php +++ /dev/null @@ -1,59 +0,0 @@ -autocomplete; - } - - /** - * Sets Autocomplete. - * Indicates whether the `Payment` objects created from this `TerminalCheckout` are automatically - * `COMPLETED` or left in an `APPROVED` state for later modification. - * - * @maps autocomplete - */ - public function setAutocomplete(?bool $autocomplete): void - { - $this->autocomplete = $autocomplete; - } - - /** - * 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->autocomplete)) { - $json['autocomplete'] = $this->autocomplete; - } - $json = array_filter($json, function ($val) { - return $val !== null; - }); - - return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; - } -} diff --git a/src/Models/Payout.php b/src/Models/Payout.php new file mode 100644 index 00000000..0ff652de --- /dev/null +++ b/src/Models/Payout.php @@ -0,0 +1,377 @@ +id = $id; + $this->locationId = $locationId; + } + + /** + * Returns Id. + * A unique ID for the payout. + */ + public function getId(): string + { + return $this->id; + } + + /** + * Sets Id. + * A unique ID for the payout. + * + * @required + * @maps id + */ + public function setId(string $id): void + { + $this->id = $id; + } + + /** + * Returns Status. + * Payout status types + */ + public function getStatus(): ?string + { + return $this->status; + } + + /** + * Sets Status. + * Payout status types + * + * @maps status + */ + public function setStatus(?string $status): void + { + $this->status = $status; + } + + /** + * Returns Location Id. + * The ID of the location associated with the payout. + */ + public function getLocationId(): string + { + return $this->locationId; + } + + /** + * Sets Location Id. + * The ID of the location associated with the payout. + * + * @required + * @maps location_id + */ + public function setLocationId(string $locationId): void + { + $this->locationId = $locationId; + } + + /** + * Returns Created At. + * The timestamp of when the payout was created and submitted for deposit to the seller's banking + * destination, in RFC 3339 format. + */ + public function getCreatedAt(): ?string + { + return $this->createdAt; + } + + /** + * Sets Created At. + * The timestamp of when the payout was created and submitted for deposit to the seller's banking + * destination, in RFC 3339 format. + * + * @maps created_at + */ + public function setCreatedAt(?string $createdAt): void + { + $this->createdAt = $createdAt; + } + + /** + * Returns Updated At. + * The timestamp of when the payout was last updated, in RFC 3339 format. + */ + public function getUpdatedAt(): ?string + { + return $this->updatedAt; + } + + /** + * Sets Updated At. + * The timestamp of when the payout was last updated, in RFC 3339 format. + * + * @maps updated_at + */ + public function setUpdatedAt(?string $updatedAt): void + { + $this->updatedAt = $updatedAt; + } + + /** + * Returns Amount Money. + * 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. + */ + public function getAmountMoney(): ?Money + { + return $this->amountMoney; + } + + /** + * Sets Amount Money. + * 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. + * + * @maps amount_money + */ + public function setAmountMoney(?Money $amountMoney): void + { + $this->amountMoney = $amountMoney; + } + + /** + * Returns Destination. + * Information about the destination against which the payout was made. + */ + public function getDestination(): ?Destination + { + return $this->destination; + } + + /** + * Sets Destination. + * Information about the destination against which the payout was made. + * + * @maps destination + */ + public function setDestination(?Destination $destination): void + { + $this->destination = $destination; + } + + /** + * Returns Version. + * The version number, which is incremented each time an update is made to this payout record. + * The version number helps developers receive event notifications or feeds out of order. + */ + public function getVersion(): ?int + { + return $this->version; + } + + /** + * Sets Version. + * The version number, which is incremented each time an update is made to this payout record. + * The version number helps developers receive event notifications or feeds out of order. + * + * @maps version + */ + public function setVersion(?int $version): void + { + $this->version = $version; + } + + /** + * Returns Type. + * The type of payout: “BATCH” or “SIMPLE”. + * BATCH payouts include a list of payout entries that can be considered settled. + * SIMPLE payouts do not have any payout entries associated with them + * and will show up as one of the payout entries in a future BATCH payout. + */ + public function getType(): ?string + { + return $this->type; + } + + /** + * Sets Type. + * The type of payout: “BATCH” or “SIMPLE”. + * BATCH payouts include a list of payout entries that can be considered settled. + * SIMPLE payouts do not have any payout entries associated with them + * and will show up as one of the payout entries in a future BATCH payout. + * + * @maps type + */ + public function setType(?string $type): void + { + $this->type = $type; + } + + /** + * Returns Payout Fee. + * A list of processing fees and any taxes on the fees assessed by Square for this payout. + * + * @return PayoutFee[]|null + */ + public function getPayoutFee(): ?array + { + return $this->payoutFee; + } + + /** + * Sets Payout Fee. + * A list of processing fees and any taxes on the fees assessed by Square for this payout. + * + * @maps payout_fee + * + * @param PayoutFee[]|null $payoutFee + */ + public function setPayoutFee(?array $payoutFee): void + { + $this->payoutFee = $payoutFee; + } + + /** + * Returns Arrival Date. + * The calendar date, in ISO 8601 format (YYYY-MM-DD), when the payout is due to arrive in the seller’s + * banking destination. + */ + public function getArrivalDate(): ?string + { + return $this->arrivalDate; + } + + /** + * Sets Arrival Date. + * The calendar date, in ISO 8601 format (YYYY-MM-DD), when the payout is due to arrive in the seller’s + * banking destination. + * + * @maps arrival_date + */ + public function setArrivalDate(?string $arrivalDate): void + { + $this->arrivalDate = $arrivalDate; + } + + /** + * 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['id'] = $this->id; + if (isset($this->status)) { + $json['status'] = $this->status; + } + $json['location_id'] = $this->locationId; + if (isset($this->createdAt)) { + $json['created_at'] = $this->createdAt; + } + if (isset($this->updatedAt)) { + $json['updated_at'] = $this->updatedAt; + } + if (isset($this->amountMoney)) { + $json['amount_money'] = $this->amountMoney; + } + if (isset($this->destination)) { + $json['destination'] = $this->destination; + } + if (isset($this->version)) { + $json['version'] = $this->version; + } + if (isset($this->type)) { + $json['type'] = $this->type; + } + if (isset($this->payoutFee)) { + $json['payout_fee'] = $this->payoutFee; + } + if (isset($this->arrivalDate)) { + $json['arrival_date'] = $this->arrivalDate; + } + $json = array_filter($json, function ($val) { + return $val !== null; + }); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/PayoutEntry.php b/src/Models/PayoutEntry.php new file mode 100644 index 00000000..243878fd --- /dev/null +++ b/src/Models/PayoutEntry.php @@ -0,0 +1,804 @@ +id = $id; + $this->payoutId = $payoutId; + } + + /** + * Returns Id. + * A unique ID for the payout entry. + */ + public function getId(): string + { + return $this->id; + } + + /** + * Sets Id. + * A unique ID for the payout entry. + * + * @required + * @maps id + */ + public function setId(string $id): void + { + $this->id = $id; + } + + /** + * Returns Payout Id. + * The ID of the payout entries’ associated payout. + */ + public function getPayoutId(): string + { + return $this->payoutId; + } + + /** + * Sets Payout Id. + * The ID of the payout entries’ associated payout. + * + * @required + * @maps payout_id + */ + public function setPayoutId(string $payoutId): void + { + $this->payoutId = $payoutId; + } + + /** + * Returns Effective At. + * The timestamp of when the payout entry affected the balance, in RFC 3339 format. + */ + public function getEffectiveAt(): ?string + { + return $this->effectiveAt; + } + + /** + * Sets Effective At. + * The timestamp of when the payout entry affected the balance, in RFC 3339 format. + * + * @maps effective_at + */ + public function setEffectiveAt(?string $effectiveAt): void + { + $this->effectiveAt = $effectiveAt; + } + + /** + * Returns Type. + */ + public function getType(): ?string + { + return $this->type; + } + + /** + * Sets Type. + * + * @maps type + */ + public function setType(?string $type): void + { + $this->type = $type; + } + + /** + * Returns Gross Amount Money. + * 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. + */ + public function getGrossAmountMoney(): ?Money + { + return $this->grossAmountMoney; + } + + /** + * Sets Gross Amount Money. + * 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. + * + * @maps gross_amount_money + */ + public function setGrossAmountMoney(?Money $grossAmountMoney): void + { + $this->grossAmountMoney = $grossAmountMoney; + } + + /** + * Returns Fee Amount Money. + * 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. + */ + public function getFeeAmountMoney(): ?Money + { + return $this->feeAmountMoney; + } + + /** + * Sets Fee Amount Money. + * 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. + * + * @maps fee_amount_money + */ + public function setFeeAmountMoney(?Money $feeAmountMoney): void + { + $this->feeAmountMoney = $feeAmountMoney; + } + + /** + * Returns Net Amount Money. + * 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. + */ + public function getNetAmountMoney(): ?Money + { + return $this->netAmountMoney; + } + + /** + * Sets Net Amount Money. + * 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. + * + * @maps net_amount_money + */ + public function setNetAmountMoney(?Money $netAmountMoney): void + { + $this->netAmountMoney = $netAmountMoney; + } + + /** + * Returns Type Automatic Savings Details. + */ + public function getTypeAutomaticSavingsDetails(): ?PaymentBalanceActivityAutomaticSavingsDetail + { + return $this->typeAutomaticSavingsDetails; + } + + /** + * Sets Type Automatic Savings Details. + * + * @maps type_automatic_savings_details + */ + public function setTypeAutomaticSavingsDetails( + ?PaymentBalanceActivityAutomaticSavingsDetail $typeAutomaticSavingsDetails + ): void { + $this->typeAutomaticSavingsDetails = $typeAutomaticSavingsDetails; + } + + /** + * Returns Type Automatic Savings Reversed Details. + */ + public function getTypeAutomaticSavingsReversedDetails(): ?PaymentBalanceActivityAutomaticSavingsReversedDetail + { + return $this->typeAutomaticSavingsReversedDetails; + } + + /** + * Sets Type Automatic Savings Reversed Details. + * + * @maps type_automatic_savings_reversed_details + */ + public function setTypeAutomaticSavingsReversedDetails( + ?PaymentBalanceActivityAutomaticSavingsReversedDetail $typeAutomaticSavingsReversedDetails + ): void { + $this->typeAutomaticSavingsReversedDetails = $typeAutomaticSavingsReversedDetails; + } + + /** + * Returns Type Charge Details. + * DESCRIPTION OF PaymentBalanceActivityChargeDetail + */ + public function getTypeChargeDetails(): ?PaymentBalanceActivityChargeDetail + { + return $this->typeChargeDetails; + } + + /** + * Sets Type Charge Details. + * DESCRIPTION OF PaymentBalanceActivityChargeDetail + * + * @maps type_charge_details + */ + public function setTypeChargeDetails(?PaymentBalanceActivityChargeDetail $typeChargeDetails): void + { + $this->typeChargeDetails = $typeChargeDetails; + } + + /** + * Returns Type Deposit Fee Details. + */ + public function getTypeDepositFeeDetails(): ?PaymentBalanceActivityDepositFeeDetail + { + return $this->typeDepositFeeDetails; + } + + /** + * Sets Type Deposit Fee Details. + * + * @maps type_deposit_fee_details + */ + public function setTypeDepositFeeDetails(?PaymentBalanceActivityDepositFeeDetail $typeDepositFeeDetails): void + { + $this->typeDepositFeeDetails = $typeDepositFeeDetails; + } + + /** + * Returns Type Dispute Details. + */ + public function getTypeDisputeDetails(): ?PaymentBalanceActivityDisputeDetail + { + return $this->typeDisputeDetails; + } + + /** + * Sets Type Dispute Details. + * + * @maps type_dispute_details + */ + public function setTypeDisputeDetails(?PaymentBalanceActivityDisputeDetail $typeDisputeDetails): void + { + $this->typeDisputeDetails = $typeDisputeDetails; + } + + /** + * Returns Type Fee Details. + */ + public function getTypeFeeDetails(): ?PaymentBalanceActivityFeeDetail + { + return $this->typeFeeDetails; + } + + /** + * Sets Type Fee Details. + * + * @maps type_fee_details + */ + public function setTypeFeeDetails(?PaymentBalanceActivityFeeDetail $typeFeeDetails): void + { + $this->typeFeeDetails = $typeFeeDetails; + } + + /** + * Returns Type Free Processing Details. + */ + public function getTypeFreeProcessingDetails(): ?PaymentBalanceActivityFreeProcessingDetail + { + return $this->typeFreeProcessingDetails; + } + + /** + * Sets Type Free Processing Details. + * + * @maps type_free_processing_details + */ + public function setTypeFreeProcessingDetails( + ?PaymentBalanceActivityFreeProcessingDetail $typeFreeProcessingDetails + ): void { + $this->typeFreeProcessingDetails = $typeFreeProcessingDetails; + } + + /** + * Returns Type Hold Adjustment Details. + */ + public function getTypeHoldAdjustmentDetails(): ?PaymentBalanceActivityHoldAdjustmentDetail + { + return $this->typeHoldAdjustmentDetails; + } + + /** + * Sets Type Hold Adjustment Details. + * + * @maps type_hold_adjustment_details + */ + public function setTypeHoldAdjustmentDetails( + ?PaymentBalanceActivityHoldAdjustmentDetail $typeHoldAdjustmentDetails + ): void { + $this->typeHoldAdjustmentDetails = $typeHoldAdjustmentDetails; + } + + /** + * Returns Type Open Dispute Details. + */ + public function getTypeOpenDisputeDetails(): ?PaymentBalanceActivityOpenDisputeDetail + { + return $this->typeOpenDisputeDetails; + } + + /** + * Sets Type Open Dispute Details. + * + * @maps type_open_dispute_details + */ + public function setTypeOpenDisputeDetails(?PaymentBalanceActivityOpenDisputeDetail $typeOpenDisputeDetails): void + { + $this->typeOpenDisputeDetails = $typeOpenDisputeDetails; + } + + /** + * Returns Type Other Details. + */ + public function getTypeOtherDetails(): ?PaymentBalanceActivityOtherDetail + { + return $this->typeOtherDetails; + } + + /** + * Sets Type Other Details. + * + * @maps type_other_details + */ + public function setTypeOtherDetails(?PaymentBalanceActivityOtherDetail $typeOtherDetails): void + { + $this->typeOtherDetails = $typeOtherDetails; + } + + /** + * Returns Type Other Adjustment Details. + */ + public function getTypeOtherAdjustmentDetails(): ?PaymentBalanceActivityOtherAdjustmentDetail + { + return $this->typeOtherAdjustmentDetails; + } + + /** + * Sets Type Other Adjustment Details. + * + * @maps type_other_adjustment_details + */ + public function setTypeOtherAdjustmentDetails( + ?PaymentBalanceActivityOtherAdjustmentDetail $typeOtherAdjustmentDetails + ): void { + $this->typeOtherAdjustmentDetails = $typeOtherAdjustmentDetails; + } + + /** + * Returns Type Refund Details. + */ + public function getTypeRefundDetails(): ?PaymentBalanceActivityRefundDetail + { + return $this->typeRefundDetails; + } + + /** + * Sets Type Refund Details. + * + * @maps type_refund_details + */ + public function setTypeRefundDetails(?PaymentBalanceActivityRefundDetail $typeRefundDetails): void + { + $this->typeRefundDetails = $typeRefundDetails; + } + + /** + * Returns Type Release Adjustment Details. + */ + public function getTypeReleaseAdjustmentDetails(): ?PaymentBalanceActivityReleaseAdjustmentDetail + { + return $this->typeReleaseAdjustmentDetails; + } + + /** + * Sets Type Release Adjustment Details. + * + * @maps type_release_adjustment_details + */ + public function setTypeReleaseAdjustmentDetails( + ?PaymentBalanceActivityReleaseAdjustmentDetail $typeReleaseAdjustmentDetails + ): void { + $this->typeReleaseAdjustmentDetails = $typeReleaseAdjustmentDetails; + } + + /** + * Returns Type Reserve Hold Details. + */ + public function getTypeReserveHoldDetails(): ?PaymentBalanceActivityReserveHoldDetail + { + return $this->typeReserveHoldDetails; + } + + /** + * Sets Type Reserve Hold Details. + * + * @maps type_reserve_hold_details + */ + public function setTypeReserveHoldDetails(?PaymentBalanceActivityReserveHoldDetail $typeReserveHoldDetails): void + { + $this->typeReserveHoldDetails = $typeReserveHoldDetails; + } + + /** + * Returns Type Reserve Release Details. + */ + public function getTypeReserveReleaseDetails(): ?PaymentBalanceActivityReserveReleaseDetail + { + return $this->typeReserveReleaseDetails; + } + + /** + * Sets Type Reserve Release Details. + * + * @maps type_reserve_release_details + */ + public function setTypeReserveReleaseDetails( + ?PaymentBalanceActivityReserveReleaseDetail $typeReserveReleaseDetails + ): void { + $this->typeReserveReleaseDetails = $typeReserveReleaseDetails; + } + + /** + * Returns Type Square Capital Payment Details. + */ + public function getTypeSquareCapitalPaymentDetails(): ?PaymentBalanceActivitySquareCapitalPaymentDetail + { + return $this->typeSquareCapitalPaymentDetails; + } + + /** + * Sets Type Square Capital Payment Details. + * + * @maps type_square_capital_payment_details + */ + public function setTypeSquareCapitalPaymentDetails( + ?PaymentBalanceActivitySquareCapitalPaymentDetail $typeSquareCapitalPaymentDetails + ): void { + $this->typeSquareCapitalPaymentDetails = $typeSquareCapitalPaymentDetails; + } + + /** + * Returns Type Square Capital Reversed Payment Details. + */ + public function getTypeSquareCapitalReversedPaymentDetails(): ?PaymentBalanceActivitySquareCapitalReversedPaymentDetail + { + return $this->typeSquareCapitalReversedPaymentDetails; + } + + /** + * Sets Type Square Capital Reversed Payment Details. + * + * @maps type_square_capital_reversed_payment_details + */ + public function setTypeSquareCapitalReversedPaymentDetails( + ?PaymentBalanceActivitySquareCapitalReversedPaymentDetail $typeSquareCapitalReversedPaymentDetails + ): void { + $this->typeSquareCapitalReversedPaymentDetails = $typeSquareCapitalReversedPaymentDetails; + } + + /** + * Returns Type Tax on Fee Details. + */ + public function getTypeTaxOnFeeDetails(): ?PaymentBalanceActivityTaxOnFeeDetail + { + return $this->typeTaxOnFeeDetails; + } + + /** + * Sets Type Tax on Fee Details. + * + * @maps type_tax_on_fee_details + */ + public function setTypeTaxOnFeeDetails(?PaymentBalanceActivityTaxOnFeeDetail $typeTaxOnFeeDetails): void + { + $this->typeTaxOnFeeDetails = $typeTaxOnFeeDetails; + } + + /** + * Returns Type Third Party Fee Details. + */ + public function getTypeThirdPartyFeeDetails(): ?PaymentBalanceActivityThirdPartyFeeDetail + { + return $this->typeThirdPartyFeeDetails; + } + + /** + * Sets Type Third Party Fee Details. + * + * @maps type_third_party_fee_details + */ + public function setTypeThirdPartyFeeDetails( + ?PaymentBalanceActivityThirdPartyFeeDetail $typeThirdPartyFeeDetails + ): void { + $this->typeThirdPartyFeeDetails = $typeThirdPartyFeeDetails; + } + + /** + * Returns Type Third Party Fee Refund Details. + */ + public function getTypeThirdPartyFeeRefundDetails(): ?PaymentBalanceActivityThirdPartyFeeRefundDetail + { + return $this->typeThirdPartyFeeRefundDetails; + } + + /** + * Sets Type Third Party Fee Refund Details. + * + * @maps type_third_party_fee_refund_details + */ + public function setTypeThirdPartyFeeRefundDetails( + ?PaymentBalanceActivityThirdPartyFeeRefundDetail $typeThirdPartyFeeRefundDetails + ): void { + $this->typeThirdPartyFeeRefundDetails = $typeThirdPartyFeeRefundDetails; + } + + /** + * 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['id'] = $this->id; + $json['payout_id'] = $this->payoutId; + if (isset($this->effectiveAt)) { + $json['effective_at'] = $this->effectiveAt; + } + if (isset($this->type)) { + $json['type'] = $this->type; + } + if (isset($this->grossAmountMoney)) { + $json['gross_amount_money'] = $this->grossAmountMoney; + } + if (isset($this->feeAmountMoney)) { + $json['fee_amount_money'] = $this->feeAmountMoney; + } + if (isset($this->netAmountMoney)) { + $json['net_amount_money'] = $this->netAmountMoney; + } + if (isset($this->typeAutomaticSavingsDetails)) { + $json['type_automatic_savings_details'] = $this->typeAutomaticSavingsDetails; + } + if (isset($this->typeAutomaticSavingsReversedDetails)) { + $json['type_automatic_savings_reversed_details'] = $this->typeAutomaticSavingsReversedDetails; + } + if (isset($this->typeChargeDetails)) { + $json['type_charge_details'] = $this->typeChargeDetails; + } + if (isset($this->typeDepositFeeDetails)) { + $json['type_deposit_fee_details'] = $this->typeDepositFeeDetails; + } + if (isset($this->typeDisputeDetails)) { + $json['type_dispute_details'] = $this->typeDisputeDetails; + } + if (isset($this->typeFeeDetails)) { + $json['type_fee_details'] = $this->typeFeeDetails; + } + if (isset($this->typeFreeProcessingDetails)) { + $json['type_free_processing_details'] = $this->typeFreeProcessingDetails; + } + if (isset($this->typeHoldAdjustmentDetails)) { + $json['type_hold_adjustment_details'] = $this->typeHoldAdjustmentDetails; + } + if (isset($this->typeOpenDisputeDetails)) { + $json['type_open_dispute_details'] = $this->typeOpenDisputeDetails; + } + if (isset($this->typeOtherDetails)) { + $json['type_other_details'] = $this->typeOtherDetails; + } + if (isset($this->typeOtherAdjustmentDetails)) { + $json['type_other_adjustment_details'] = $this->typeOtherAdjustmentDetails; + } + if (isset($this->typeRefundDetails)) { + $json['type_refund_details'] = $this->typeRefundDetails; + } + if (isset($this->typeReleaseAdjustmentDetails)) { + $json['type_release_adjustment_details'] = $this->typeReleaseAdjustmentDetails; + } + if (isset($this->typeReserveHoldDetails)) { + $json['type_reserve_hold_details'] = $this->typeReserveHoldDetails; + } + if (isset($this->typeReserveReleaseDetails)) { + $json['type_reserve_release_details'] = $this->typeReserveReleaseDetails; + } + if (isset($this->typeSquareCapitalPaymentDetails)) { + $json['type_square_capital_payment_details'] = $this->typeSquareCapitalPaymentDetails; + } + if (isset($this->typeSquareCapitalReversedPaymentDetails)) { + $json['type_square_capital_reversed_payment_details'] = $this->typeSquareCapitalReversedPaymentDetails; + } + if (isset($this->typeTaxOnFeeDetails)) { + $json['type_tax_on_fee_details'] = $this->typeTaxOnFeeDetails; + } + if (isset($this->typeThirdPartyFeeDetails)) { + $json['type_third_party_fee_details'] = $this->typeThirdPartyFeeDetails; + } + if (isset($this->typeThirdPartyFeeRefundDetails)) { + $json['type_third_party_fee_refund_details'] = $this->typeThirdPartyFeeRefundDetails; + } + $json = array_filter($json, function ($val) { + return $val !== null; + }); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/PayoutFee.php b/src/Models/PayoutFee.php new file mode 100644 index 00000000..792e736c --- /dev/null +++ b/src/Models/PayoutFee.php @@ -0,0 +1,128 @@ +amountMoney; + } + + /** + * Sets Amount Money. + * 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. + * + * @maps amount_money + */ + public function setAmountMoney(?Money $amountMoney): void + { + $this->amountMoney = $amountMoney; + } + + /** + * Returns Effective At. + * The timestamp of when the fee takes effect, in RFC 3339 format. + */ + public function getEffectiveAt(): ?string + { + return $this->effectiveAt; + } + + /** + * Sets Effective At. + * The timestamp of when the fee takes effect, in RFC 3339 format. + * + * @maps effective_at + */ + public function setEffectiveAt(?string $effectiveAt): void + { + $this->effectiveAt = $effectiveAt; + } + + /** + * Returns Type. + * Represents the type of payout fee that can incur as part of a payout. + */ + public function getType(): ?string + { + return $this->type; + } + + /** + * Sets Type. + * Represents the type of payout fee that can incur as part of a payout. + * + * @maps type + */ + public function setType(?string $type): void + { + $this->type = $type; + } + + /** + * 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->amountMoney)) { + $json['amount_money'] = $this->amountMoney; + } + if (isset($this->effectiveAt)) { + $json['effective_at'] = $this->effectiveAt; + } + if (isset($this->type)) { + $json['type'] = $this->type; + } + $json = array_filter($json, function ($val) { + return $val !== null; + }); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/PayoutFeeType.php b/src/Models/PayoutFeeType.php new file mode 100644 index 00000000..910c75b2 --- /dev/null +++ b/src/Models/PayoutFeeType.php @@ -0,0 +1,21 @@ +id = $id; $this->locationId = $locationId; - $this->transactionId = $transactionId; $this->tenderId = $tenderId; $this->reason = $reason; $this->amountMoney = $amountMoney; @@ -134,7 +131,7 @@ public function setLocationId(string $locationId): void * Returns Transaction Id. * The ID of the transaction that the refunded tender is part of. */ - public function getTransactionId(): string + public function getTransactionId(): ?string { return $this->transactionId; } @@ -143,10 +140,9 @@ public function getTransactionId(): string * Sets Transaction Id. * The ID of the transaction that the refunded tender is part of. * - * @required * @maps transaction_id */ - public function setTransactionId(string $transactionId): void + public function setTransactionId(?string $transactionId): void { $this->transactionId = $transactionId; } @@ -339,7 +335,9 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json = []; $json['id'] = $this->id; $json['location_id'] = $this->locationId; - $json['transaction_id'] = $this->transactionId; + if (isset($this->transactionId)) { + $json['transaction_id'] = $this->transactionId; + } $json['tender_id'] = $this->tenderId; if (isset($this->createdAt)) { $json['created_at'] = $this->createdAt; diff --git a/src/Models/RetrieveLocationResponse.php b/src/Models/RetrieveLocationResponse.php index ab9c22d7..0f729bd1 100644 --- a/src/Models/RetrieveLocationResponse.php +++ b/src/Models/RetrieveLocationResponse.php @@ -24,7 +24,7 @@ class RetrieveLocationResponse implements \JsonSerializable /** * Returns Errors. - * Information on errors encountered during the request. + * Information about errors encountered during the request. * * @return Error[]|null */ @@ -35,7 +35,7 @@ public function getErrors(): ?array /** * Sets Errors. - * Information on errors encountered during the request. + * Information about errors encountered during the request. * * @maps errors * @@ -48,7 +48,7 @@ public function setErrors(?array $errors): void /** * Returns Location. - * Represents one of a business's [locations](https://developer.squareup.com/docs/locations-api). + * Represents one of a business' [locations](https://developer.squareup.com/docs/locations-api). */ public function getLocation(): ?Location { @@ -57,7 +57,7 @@ public function getLocation(): ?Location /** * Sets Location. - * Represents one of a business's [locations](https://developer.squareup.com/docs/locations-api). + * Represents one of a business' [locations](https://developer.squareup.com/docs/locations-api). * * @maps location */ diff --git a/src/Models/RetrieveVendorResponse.php b/src/Models/RetrieveVendorResponse.php index dbde628b..5b2de130 100644 --- a/src/Models/RetrieveVendorResponse.php +++ b/src/Models/RetrieveVendorResponse.php @@ -7,7 +7,7 @@ use stdClass; /** - * Represents an output from a call to [RetrieveVendor.]($e/Vendors/RetrieveVendor) + * Represents an output from a call to [RetrieveVendor]($e/Vendors/RetrieveVendor). */ class RetrieveVendorResponse implements \JsonSerializable { diff --git a/src/Models/SearchVendorsRequest.php b/src/Models/SearchVendorsRequest.php index 31d8e4a2..28712419 100644 --- a/src/Models/SearchVendorsRequest.php +++ b/src/Models/SearchVendorsRequest.php @@ -7,7 +7,7 @@ use stdClass; /** - * Represents an input into a call to [SearchVendors.]($e/Vendors/SearchVendors) + * Represents an input into a call to [SearchVendors]($e/Vendors/SearchVendors). */ class SearchVendorsRequest implements \JsonSerializable { diff --git a/src/Models/SearchVendorsResponse.php b/src/Models/SearchVendorsResponse.php index d96e54b0..ecff46f1 100644 --- a/src/Models/SearchVendorsResponse.php +++ b/src/Models/SearchVendorsResponse.php @@ -7,7 +7,7 @@ use stdClass; /** - * Represents an output from a call to [SearchVendors.]($e/Vendors/SearchVendors) + * Represents an output from a call to [SearchVendors]($e/Vendors/SearchVendors). */ class SearchVendorsResponse implements \JsonSerializable { diff --git a/src/Models/Subscription.php b/src/Models/Subscription.php index 7a7acb02..3ab30a26 100644 --- a/src/Models/Subscription.php +++ b/src/Models/Subscription.php @@ -316,7 +316,7 @@ public function setTaxPercentage(?string $taxPercentage): void * Returns Invoice Ids. * The IDs of the [invoices]($m/Invoice) created for the * subscription, listed in order when the invoices were created - * (oldest invoices appear first). + * (newest invoices appear first). * * @return string[]|null */ @@ -329,7 +329,7 @@ public function getInvoiceIds(): ?array * Sets Invoice Ids. * The IDs of the [invoices]($m/Invoice) created for the * subscription, listed in order when the invoices were created - * (oldest invoices appear first). + * (newest invoices appear first). * * @maps invoice_ids * diff --git a/src/Models/TaxIds.php b/src/Models/TaxIds.php index 92873223..cd0ad152 100644 --- a/src/Models/TaxIds.php +++ b/src/Models/TaxIds.php @@ -58,7 +58,7 @@ public function setEuVat(?string $euVat): void /** * Returns Fr Siret. * The SIRET (Système d'Identification du Répertoire des Entreprises et de leurs Etablissements) - * number is a 14 digit code issued by the French INSEE. For example, `39922799000021`. + * number is a 14-digit code issued by the French INSEE. For example, `39922799000021`. */ public function getFrSiret(): ?string { @@ -68,7 +68,7 @@ public function getFrSiret(): ?string /** * Sets Fr Siret. * The SIRET (Système d'Identification du Répertoire des Entreprises et de leurs Etablissements) - * number is a 14 digit code issued by the French INSEE. For example, `39922799000021`. + * number is a 14-digit code issued by the French INSEE. For example, `39922799000021`. * * @maps fr_siret */ @@ -105,7 +105,7 @@ public function setFrNaf(?string $frNaf): void /** * Returns Es Nif. - * The NIF (Numero de Identificacion Fiscal) number is a 9 character tax identifier used in Spain. + * The NIF (Numero de Identificacion Fiscal) number is a nine-character tax identifier used in Spain. * If it is present, it has been validated. For example, `73628495A`. */ public function getEsNif(): ?string @@ -115,7 +115,7 @@ public function getEsNif(): ?string /** * Sets Es Nif. - * The NIF (Numero de Identificacion Fiscal) number is a 9 character tax identifier used in Spain. + * The NIF (Numero de Identificacion Fiscal) number is a nine-character tax identifier used in Spain. * If it is present, it has been validated. For example, `73628495A`. * * @maps es_nif diff --git a/src/Models/Tender.php b/src/Models/Tender.php index 8356e053..5b6b5c00 100644 --- a/src/Models/Tender.php +++ b/src/Models/Tender.php @@ -91,7 +91,7 @@ public function __construct(string $type) /** * Returns Id. - * The tender's unique ID. + * The tender's unique ID. It is the associated payment ID. */ public function getId(): ?string { @@ -100,7 +100,7 @@ public function getId(): ?string /** * Sets Id. - * The tender's unique ID. + * The tender's unique ID. It is the associated payment ID. * * @maps id */ diff --git a/src/Models/TerminalCheckout.php b/src/Models/TerminalCheckout.php index ef2de718..f13305a6 100644 --- a/src/Models/TerminalCheckout.php +++ b/src/Models/TerminalCheckout.php @@ -6,6 +6,9 @@ use stdClass; +/** + * Represents a checkout processed by the Square Terminal. + */ class TerminalCheckout implements \JsonSerializable { /** @@ -176,6 +179,7 @@ public function setReferenceId(?string $referenceId): void * Returns Note. * An optional note to associate with the checkout, as well as with any payments used to complete the * checkout. + * Note: maximum 500 characters */ public function getNote(): ?string { @@ -186,6 +190,7 @@ public function getNote(): ?string * Sets Note. * An optional note to associate with the checkout, as well as with any payments used to complete the * checkout. + * Note: maximum 500 characters * * @maps note */ diff --git a/src/Models/TerminalDeviceCheckoutOptions.php b/src/Models/TerminalDeviceCheckoutOptions.php deleted file mode 100644 index 126e6d44..00000000 --- a/src/Models/TerminalDeviceCheckoutOptions.php +++ /dev/null @@ -1,83 +0,0 @@ -skipReceiptScreen; - } - - /** - * Sets Skip Receipt Screen. - * Instructs the device to skip the receipt screen. Defaults to false. - * - * @maps skip_receipt_screen - */ - public function setSkipReceiptScreen(?bool $skipReceiptScreen): void - { - $this->skipReceiptScreen = $skipReceiptScreen; - } - - /** - * Returns Tip Settings. - */ - public function getTipSettings(): ?TipSettings - { - return $this->tipSettings; - } - - /** - * Sets Tip Settings. - * - * @maps tip_settings - */ - public function setTipSettings(?TipSettings $tipSettings): void - { - $this->tipSettings = $tipSettings; - } - - /** - * 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->skipReceiptScreen)) { - $json['skip_receipt_screen'] = $this->skipReceiptScreen; - } - if (isset($this->tipSettings)) { - $json['tip_settings'] = $this->tipSettings; - } - $json = array_filter($json, function ($val) { - return $val !== null; - }); - - return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; - } -} diff --git a/src/Models/TerminalRefund.php b/src/Models/TerminalRefund.php index 09ff0cd3..553bd9b1 100644 --- a/src/Models/TerminalRefund.php +++ b/src/Models/TerminalRefund.php @@ -6,6 +6,10 @@ use stdClass; +/** + * Represents a payment refund processed by the Square Terminal. Only supports Interac (Canadian debit + * network) payment refunds. + */ class TerminalRefund implements \JsonSerializable { /** @@ -34,12 +38,12 @@ class TerminalRefund implements \JsonSerializable private $amountMoney; /** - * @var string|null + * @var string */ private $reason; /** - * @var string|null + * @var string */ private $deviceId; @@ -81,11 +85,15 @@ class TerminalRefund implements \JsonSerializable /** * @param string $paymentId * @param Money $amountMoney + * @param string $reason + * @param string $deviceId */ - public function __construct(string $paymentId, Money $amountMoney) + public function __construct(string $paymentId, Money $amountMoney, string $reason, string $deviceId) { $this->paymentId = $paymentId; $this->amountMoney = $amountMoney; + $this->reason = $reason; + $this->deviceId = $deviceId; } /** @@ -205,9 +213,8 @@ public function setAmountMoney(Money $amountMoney): void /** * Returns Reason. * A description of the reason for the refund. - * Note: maximum 192 characters */ - public function getReason(): ?string + public function getReason(): string { return $this->reason; } @@ -215,11 +222,11 @@ public function getReason(): ?string /** * Sets Reason. * A description of the reason for the refund. - * Note: maximum 192 characters * + * @required * @maps reason */ - public function setReason(?string $reason): void + public function setReason(string $reason): void { $this->reason = $reason; } @@ -229,7 +236,7 @@ public function setReason(?string $reason): void * The unique ID of the device intended for this `TerminalRefund`. * The Id can be retrieved from /v2/devices api. */ - public function getDeviceId(): ?string + public function getDeviceId(): string { return $this->deviceId; } @@ -239,9 +246,10 @@ public function getDeviceId(): ?string * The unique ID of the device intended for this `TerminalRefund`. * The Id can be retrieved from /v2/devices api. * + * @required * @maps device_id */ - public function setDeviceId(?string $deviceId): void + public function setDeviceId(string $deviceId): void { $this->deviceId = $deviceId; } @@ -281,7 +289,7 @@ public function setDeadlineDuration(?string $deadlineDuration): void /** * Returns Status. * The status of the `TerminalRefund`. - * Options: `PENDING`, `IN_PROGRESS`, `CANCELED`, or `COMPLETED`. + * Options: `PENDING`, `IN_PROGRESS`, `CANCEL_REQUESTED`, `CANCELED`, or `COMPLETED`. */ public function getStatus(): ?string { @@ -291,7 +299,7 @@ public function getStatus(): ?string /** * Sets Status. * The status of the `TerminalRefund`. - * Options: `PENDING`, `IN_PROGRESS`, `CANCELED`, or `COMPLETED`. + * Options: `PENDING`, `IN_PROGRESS`, `CANCEL_REQUESTED`, `CANCELED`, or `COMPLETED`. * * @maps status */ @@ -421,12 +429,8 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['order_id'] = $this->orderId; } $json['amount_money'] = $this->amountMoney; - if (isset($this->reason)) { - $json['reason'] = $this->reason; - } - if (isset($this->deviceId)) { - $json['device_id'] = $this->deviceId; - } + $json['reason'] = $this->reason; + $json['device_id'] = $this->deviceId; if (isset($this->deadlineDuration)) { $json['deadline_duration'] = $this->deadlineDuration; } diff --git a/src/Models/UpdateLocationRequest.php b/src/Models/UpdateLocationRequest.php index 078b3d5a..9a523977 100644 --- a/src/Models/UpdateLocationRequest.php +++ b/src/Models/UpdateLocationRequest.php @@ -7,7 +7,7 @@ use stdClass; /** - * Request object for the [UpdateLocation]($e/Locations/UpdateLocation) endpoint. + * The request object for the [UpdateLocation]($e/Locations/UpdateLocation) endpoint. */ class UpdateLocationRequest implements \JsonSerializable { @@ -18,7 +18,7 @@ class UpdateLocationRequest implements \JsonSerializable /** * Returns Location. - * Represents one of a business's [locations](https://developer.squareup.com/docs/locations-api). + * Represents one of a business' [locations](https://developer.squareup.com/docs/locations-api). */ public function getLocation(): ?Location { @@ -27,7 +27,7 @@ public function getLocation(): ?Location /** * Sets Location. - * Represents one of a business's [locations](https://developer.squareup.com/docs/locations-api). + * Represents one of a business' [locations](https://developer.squareup.com/docs/locations-api). * * @maps location */ diff --git a/src/Models/UpdateLocationResponse.php b/src/Models/UpdateLocationResponse.php index ea2bcc33..f0899730 100644 --- a/src/Models/UpdateLocationResponse.php +++ b/src/Models/UpdateLocationResponse.php @@ -7,7 +7,7 @@ use stdClass; /** - * Response object returned by the [UpdateLocation]($e/Locations/UpdateLocation) endpoint. + * The response object returned by the [UpdateLocation]($e/Locations/UpdateLocation) endpoint. */ class UpdateLocationResponse implements \JsonSerializable { @@ -23,7 +23,7 @@ class UpdateLocationResponse implements \JsonSerializable /** * Returns Errors. - * Information on errors encountered during the request. + * Information about errors encountered during the request. * * @return Error[]|null */ @@ -34,7 +34,7 @@ public function getErrors(): ?array /** * Sets Errors. - * Information on errors encountered during the request. + * Information about errors encountered during the request. * * @maps errors * @@ -47,7 +47,7 @@ public function setErrors(?array $errors): void /** * Returns Location. - * Represents one of a business's [locations](https://developer.squareup.com/docs/locations-api). + * Represents one of a business' [locations](https://developer.squareup.com/docs/locations-api). */ public function getLocation(): ?Location { @@ -56,7 +56,7 @@ public function getLocation(): ?Location /** * Sets Location. - * Represents one of a business's [locations](https://developer.squareup.com/docs/locations-api). + * Represents one of a business' [locations](https://developer.squareup.com/docs/locations-api). * * @maps location */ diff --git a/src/Models/UpdateVendorRequest.php b/src/Models/UpdateVendorRequest.php index d434025a..bb952277 100644 --- a/src/Models/UpdateVendorRequest.php +++ b/src/Models/UpdateVendorRequest.php @@ -7,7 +7,7 @@ use stdClass; /** - * Represents an input to a call to [UpdateVendor.]($e/Vendors/UpdateVendor) + * Represents an input to a call to [UpdateVendor]($e/Vendors/UpdateVendor). */ class UpdateVendorRequest implements \JsonSerializable { diff --git a/src/Models/UpdateVendorResponse.php b/src/Models/UpdateVendorResponse.php index 2d378ea2..2425fdc1 100644 --- a/src/Models/UpdateVendorResponse.php +++ b/src/Models/UpdateVendorResponse.php @@ -7,7 +7,7 @@ use stdClass; /** - * Represents an output from a call to [UpdateVendor.]($e/Vendors/UpdateVendor) + * Represents an output from a call to [UpdateVendor]($e/Vendors/UpdateVendor). */ class UpdateVendorResponse implements \JsonSerializable { diff --git a/src/SquareClient.php b/src/SquareClient.php index cece66e2..27dbff24 100644 --- a/src/SquareClient.php +++ b/src/SquareClient.php @@ -38,6 +38,7 @@ class SquareClient implements ConfigurationInterface private $merchants; private $orders; private $payments; + private $payouts; private $refunds; private $sites; private $snippets; @@ -269,7 +270,7 @@ public function getBearerAuthCredentials(): ?BearerAuthCredentials */ public function getSdkVersion(): string { - return '17.3.0.20220316'; + return '18.0.0.20220420'; } /** @@ -621,6 +622,17 @@ public function getPaymentsApi(): Apis\PaymentsApi return $this->payments; } + /** + * Returns Payouts Api + */ + public function getPayoutsApi(): Apis\PayoutsApi + { + if ($this->payouts == null) { + $this->payouts = new Apis\PayoutsApi($this, $this->authManagers, $this->httpCallback); + } + return $this->payouts; + } + /** * Returns Refunds Api */