diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 89ed5a69..5c6efcd1 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -8,7 +8,7 @@ assignees: '' --- ## **ATTENTION** -This issue template is for **bugs** or **documentation** errors in this SDK Repo. Please direct all technical support questions, feature requests, API-related issues, and general discussions to our Square-supported developer channels. For public support, [join us in our BuildWithSquare Slack](https://squ.re/slack) or [post in our Developer Forums](https://developer.squareup.com/forums). For private support, [contact our Developer Success Engineers](https://squareup.com/help/us/en/contact?panel=BF53A9C8EF68) directly. +This issue template is for **bugs** or **documentation** errors in this SDK Repo. Please direct all technical support questions, feature requests, API-related issues, and general discussions to our Square-supported developer channels. For public support, [join us in our Square Developer Discord server](https://discord.com/invite/squaredev) or [post in our Developer Forums](https://developer.squareup.com/forums). For private support, [contact our Developer Success Engineers](https://squareup.com/help/us/en/contact?panel=BF53A9C8EF68) directly. **Describe the bug** A clear and concise description of what the bug is. diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 6b2ddfeb..f38eff76 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -3,8 +3,8 @@ contact_links: - name: Square Developer Forums url: https://developer.squareup.com/forums about: Public discussion threads for technical support, feature requests, api discussion, and all things related to square development. - - name: BuildWithSquare Slack Channel - url: https://squ.re/slack + - name: Square Developer Discord Server + url: https://discord.com/invite/squaredev about: Community slack channel for real time support and conversations about building with square. - name: Developer Support url: https://squareup.com/help/us/en/contact?panel=BF53A9C8EF68 diff --git a/LICENSE b/LICENSE index ae39372e..71fb2ce0 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright 2023 Square, Inc. +Copyright 2024 Square, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/composer.json b/composer.json index d5a540e3..fc772c78 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": "33.1.0.20231213", + "version": "34.0.0.20240118", "type": "library", "keywords": [ "Square", diff --git a/doc/apis/booking-custom-attributes.md b/doc/apis/booking-custom-attributes.md index 3c8b06bf..b0654ccf 100644 --- a/doc/apis/booking-custom-attributes.md +++ b/doc/apis/booking-custom-attributes.md @@ -378,7 +378,7 @@ function listBookingCustomAttributes( | `bookingId` | `string` | Template, Required | The ID of the target [booking](entity:Booking). | | `limit` | `?int` | Query, Optional | The maximum number of results to return in a single paged response. This limit is advisory.
The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100.
The default value is 20. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | | `cursor` | `?string` | Query, Optional | The cursor returned in the paged response from the previous call to this endpoint.
Provide this cursor to retrieve the next page of results for your original request. For more
information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | -| `withDefinitions` | `?bool` | Query, Optional | Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of each
custom attribute. Set this parameter to `true` to get the name and description of each custom
attribute, information about the data type, or other definition details. The default value is `false`.
**Default**: `false` | +| `withDefinitions` | `?bool` | Query, Optional | Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of each
custom attribute. Set this parameter to `true` to get the name and description of each custom
attribute, information about the data type, or other definition details. The default value is `false`. | ## Response Type @@ -481,7 +481,7 @@ function retrieveBookingCustomAttribute( | --- | --- | --- | --- | | `bookingId` | `string` | Template, Required | The ID of the target [booking](entity:Booking). | | `key` | `string` | Template, Required | The key of the custom attribute to retrieve. This key must match the `key` of a custom
attribute definition in the Square seller account. If the requesting application is not the
definition owner, you must use the qualified key. | -| `withDefinition` | `?bool` | Query, Optional | Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of
the custom attribute. Set this parameter to `true` to get the name and description of the custom
attribute, information about the data type, or other definition details. The default value is `false`.
**Default**: `false` | +| `withDefinition` | `?bool` | Query, Optional | Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of
the custom attribute. Set this parameter to `true` to get the name and description of the custom
attribute, information about the data type, or other definition details. The default value is `false`. | | `version` | `?int` | Query, Optional | The current version of the custom attribute, which is used for strongly consistent reads to
guarantee that you receive the most up-to-date data. When included in the request, Square
returns the specified version or a higher version if one exists. If the specified version is
higher than the current version, Square returns a `BAD_REQUEST` error. | ## Response Type diff --git a/doc/apis/bookings.md b/doc/apis/bookings.md index 466a849d..d1493983 100644 --- a/doc/apis/bookings.md +++ b/doc/apis/bookings.md @@ -341,7 +341,7 @@ function listTeamMemberBookingProfiles( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `bookableOnly` | `?bool` | Query, Optional | Indicates whether to include only bookable team members in the returned result (`true`) or not (`false`).
**Default**: `false` | +| `bookableOnly` | `?bool` | Query, Optional | Indicates whether to include only bookable team members in the returned result (`true`) or not (`false`). | | `limit` | `?int` | Query, Optional | The maximum number of results to return in a paged response. | | `cursor` | `?string` | Query, Optional | The pagination cursor from the preceding response to return the next page of the results. Do not set this when retrieving the first page of the results. | | `locationId` | `?string` | Query, Optional | Indicates whether to include only team members enabled at the given location in the returned result. | diff --git a/doc/apis/cards.md b/doc/apis/cards.md index 9d8838b5..849039c0 100644 --- a/doc/apis/cards.md +++ b/doc/apis/cards.md @@ -37,7 +37,7 @@ function listCards( | --- | --- | --- | --- | | `cursor` | `?string` | Query, Optional | A pagination cursor returned by a previous call to this endpoint.
Provide this to retrieve the next set of results for your original query.

See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information. | | `customerId` | `?string` | Query, Optional | Limit results to cards associated with the customer supplied.
By default, all cards owned by the merchant are returned. | -| `includeDisabled` | `?bool` | Query, Optional | Includes disabled cards.
By default, all enabled cards owned by the merchant are returned.
**Default**: `false` | +| `includeDisabled` | `?bool` | Query, Optional | Includes disabled cards.
By default, all enabled cards owned by the merchant are returned. | | `referenceId` | `?string` | Query, Optional | Limit results to cards associated with the reference_id supplied. | | `sortOrder` | [`?string(SortOrder)`](../../doc/models/sort-order.md) | Query, Optional | Sorts the returned list by when the card was created with the specified order.
This field defaults to ASC. | diff --git a/doc/apis/catalog.md b/doc/apis/catalog.md index 75e8adeb..b5a2422f 100644 --- a/doc/apis/catalog.md +++ b/doc/apis/catalog.md @@ -675,9 +675,9 @@ function retrieveCatalogObject( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `objectId` | `string` | Template, Required | The object ID of any type of catalog objects to be retrieved. | -| `includeRelatedObjects` | `?bool` | Query, 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`
**Default**: `false` | +| `includeRelatedObjects` | `?bool` | Query, 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` | | `catalogVersion` | `?int` | Query, Optional | Requests objects as of a specific version of the catalog. This allows you to retrieve historical
versions of objects. The value to retrieve a specific version of an object can be found
in the version field of [CatalogObject](../../doc/models/catalog-object.md)s. If not included, results will
be from the current version of the catalog. | -| `includeCategoryPathToRoot` | `?bool` | Query, Optional | Specifies whether or not to include the `path_to_root` list for each returned category instance. The `path_to_root` list consists
of `CategoryPathToRootNode` objects and specifies the path that starts with the immediate parent category of the returned category
and ends with its root category. If the returned category is a top-level category, the `path_to_root` list is empty and is not returned
in the response payload.
**Default**: `false` | +| `includeCategoryPathToRoot` | `?bool` | Query, Optional | Specifies whether or not to include the `path_to_root` list for each returned category instance. The `path_to_root` list consists
of `CategoryPathToRootNode` objects and specifies the path that starts with the immediate parent category of the returned category
and ends with its root category. If the returned category is a top-level category, the `path_to_root` list is empty and is not returned
in the response payload. | ## Response Type diff --git a/doc/apis/customer-custom-attributes.md b/doc/apis/customer-custom-attributes.md index f0fe8785..7dbd66c8 100644 --- a/doc/apis/customer-custom-attributes.md +++ b/doc/apis/customer-custom-attributes.md @@ -348,7 +348,7 @@ function listCustomerCustomAttributes( | `customerId` | `string` | Template, Required | The ID of the target [customer profile](entity:Customer). | | `limit` | `?int` | Query, Optional | The maximum number of results to return in a single paged response. This limit is advisory.
The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100.
The default value is 20. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | | `cursor` | `?string` | Query, Optional | The cursor returned in the paged response from the previous call to this endpoint.
Provide this cursor to retrieve the next page of results for your original request. For more
information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | -| `withDefinitions` | `?bool` | Query, Optional | Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of each
custom attribute. Set this parameter to `true` to get the name and description of each custom
attribute, information about the data type, or other definition details. The default value is `false`.
**Default**: `false` | +| `withDefinitions` | `?bool` | Query, Optional | Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of each
custom attribute. Set this parameter to `true` to get the name and description of each custom
attribute, information about the data type, or other definition details. The default value is `false`. | ## Response Type @@ -453,7 +453,7 @@ function retrieveCustomerCustomAttribute( | --- | --- | --- | --- | | `customerId` | `string` | Template, Required | The ID of the target [customer profile](entity:Customer). | | `key` | `string` | Template, Required | The key of the custom attribute to retrieve. This key must match the `key` of a custom
attribute definition in the Square seller account. If the requesting application is not the
definition owner, you must use the qualified key. | -| `withDefinition` | `?bool` | Query, Optional | Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of
the custom attribute. Set this parameter to `true` to get the name and description of the custom
attribute, information about the data type, or other definition details. The default value is `false`.
**Default**: `false` | +| `withDefinition` | `?bool` | Query, Optional | Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of
the custom attribute. Set this parameter to `true` to get the name and description of the custom
attribute, information about the data type, or other definition details. The default value is `false`. | | `version` | `?int` | Query, Optional | The current version of the custom attribute, which is used for strongly consistent reads to
guarantee that you receive the most up-to-date data. When included in the request, Square
returns the specified version or a higher version if one exists. If the specified version is
higher than the current version, Square returns a `BAD_REQUEST` error. | ## Response Type diff --git a/doc/apis/customers.md b/doc/apis/customers.md index 3cb0bda6..b4b03c39 100644 --- a/doc/apis/customers.md +++ b/doc/apis/customers.md @@ -48,7 +48,7 @@ function listCustomers( | `limit` | `?int` | Query, Optional | The maximum number of results to return in a single page. This limit is advisory. The response might contain more or fewer results.
If the specified limit is less than 1 or greater than 100, Square returns a `400 VALUE_TOO_LOW` or `400 VALUE_TOO_HIGH` error. The default value is 100.

For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | | `sortField` | [`?string(CustomerSortField)`](../../doc/models/customer-sort-field.md) | Query, Optional | Indicates how customers should be sorted.

The default value is `DEFAULT`. | | `sortOrder` | [`?string(SortOrder)`](../../doc/models/sort-order.md) | Query, Optional | Indicates whether customers should be sorted in ascending (`ASC`) or
descending (`DESC`) order.

The default value is `ASC`. | -| `count` | `?bool` | Query, Optional | Indicates whether to return the total count of customers in the `count` field of the response.

The default value is `false`.
**Default**: `false` | +| `count` | `?bool` | Query, Optional | Indicates whether to return the total count of customers in the `count` field of the response.

The default value is `false`. | ## Response Type @@ -316,7 +316,7 @@ var_dump($apiResponse->getHeaders()); # Update Customer Updates a customer profile. This endpoint supports sparse updates, so only new or changed fields are required in the request. -To add or update a field, specify the new value. To remove a field, specify `null` and include the `X-Clear-Null` header set to `true` +To add or update a field, specify the new value. To remove a field, specify `null` (recommended) or specify an empty string (string fields only). As a best practice, include the `version` field in the request to enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) control. diff --git a/doc/apis/invoices.md b/doc/apis/invoices.md index cd163481..5bb32702 100644 --- a/doc/apis/invoices.md +++ b/doc/apis/invoices.md @@ -16,6 +16,8 @@ $invoicesApi = $client->getInvoicesApi(); * [Delete Invoice](../../doc/apis/invoices.md#delete-invoice) * [Get Invoice](../../doc/apis/invoices.md#get-invoice) * [Update Invoice](../../doc/apis/invoices.md#update-invoice) +* [Create Invoice Attachment](../../doc/apis/invoices.md#create-invoice-attachment) +* [Delete Invoice Attachment](../../doc/apis/invoices.md#delete-invoice-attachment) * [Cancel Invoice](../../doc/apis/invoices.md#cancel-invoice) * [Publish Invoice](../../doc/apis/invoices.md#publish-invoice) @@ -367,6 +369,106 @@ var_dump($apiResponse->getHeaders()); ``` +# Create Invoice Attachment + +Uploads a file and attaches it to an invoice. This endpoint accepts HTTP multipart/form-data file uploads +with a JSON `request` part and a `file` part. The `file` part must be a `readable stream` that contains a file +in a supported format: GIF, JPEG, PNG, TIFF, BMP, or PDF. + +Invoices can have up to 10 attachments with a total file size of 25 MB. Attachments can be added only to invoices +in the `DRAFT`, `SCHEDULED`, `UNPAID`, or `PARTIALLY_PAID` state. + +```php +function createInvoiceAttachment( + string $invoiceId, + ?CreateInvoiceAttachmentRequest $request = null, + ?FileWrapper $imageFile = null +): ApiResponse +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `invoiceId` | `string` | Template, Required | The ID of the [invoice](entity:Invoice) to attach the file to. | +| `request` | [`?CreateInvoiceAttachmentRequest`](../../doc/models/create-invoice-attachment-request.md) | Form (JSON-Encoded), Optional | Represents a [CreateInvoiceAttachment](../../doc/apis/invoices.md#create-invoice-attachment) request. | +| `imageFile` | `?FileWrapper` | Form, Optional | - | + +## Response Type + +This method returns a `Square\Utils\ApiResponse` instance. The `getResult()` method on this instance returns the response data which is of type [`CreateInvoiceAttachmentResponse`](../../doc/models/create-invoice-attachment-response.md). + +## Example Usage + +```php +$invoiceId = 'invoice_id0'; + +$request = CreateInvoiceAttachmentRequestBuilder::init() + ->idempotencyKey('ae5e84f9-4742-4fc1-ba12-a3ce3748f1c3') + ->description('Service contract') + ->build(); + +$apiResponse = $invoicesApi->createInvoiceAttachment( + $invoiceId, + $request +); + +if ($apiResponse->isSuccess()) { + $createInvoiceAttachmentResponse = $apiResponse->getResult(); +} else { + $errors = $apiResponse->getErrors(); +} + +// Getting more response information +var_dump($apiResponse->getStatusCode()); +var_dump($apiResponse->getHeaders()); +``` + + +# Delete Invoice Attachment + +Removes an attachment from an invoice and permanently deletes the file. Attachments can be removed only +from invoices in the `DRAFT`, `SCHEDULED`, `UNPAID`, or `PARTIALLY_PAID` state. + +```php +function deleteInvoiceAttachment(string $invoiceId, string $attachmentId): ApiResponse +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `invoiceId` | `string` | Template, Required | The ID of the [invoice](entity:Invoice) to delete the attachment from. | +| `attachmentId` | `string` | Template, Required | The ID of the [attachment](entity:InvoiceAttachment) to delete. | + +## Response Type + +This method returns a `Square\Utils\ApiResponse` instance. The `getResult()` method on this instance returns the response data which is of type [`DeleteInvoiceAttachmentResponse`](../../doc/models/delete-invoice-attachment-response.md). + +## Example Usage + +```php +$invoiceId = 'invoice_id0'; + +$attachmentId = 'attachment_id6'; + +$apiResponse = $invoicesApi->deleteInvoiceAttachment( + $invoiceId, + $attachmentId +); + +if ($apiResponse->isSuccess()) { + $deleteInvoiceAttachmentResponse = $apiResponse->getResult(); +} else { + $errors = $apiResponse->getErrors(); +} + +// Getting more response information +var_dump($apiResponse->getStatusCode()); +var_dump($apiResponse->getHeaders()); +``` + + # Cancel Invoice Cancels an invoice. The seller cannot collect payments for diff --git a/doc/apis/location-custom-attributes.md b/doc/apis/location-custom-attributes.md index cd99947f..10b71dec 100644 --- a/doc/apis/location-custom-attributes.md +++ b/doc/apis/location-custom-attributes.md @@ -388,7 +388,7 @@ function listLocationCustomAttributes( | `visibilityFilter` | [`?string(VisibilityFilter)`](../../doc/models/visibility-filter.md) | Query, Optional | Filters the `CustomAttributeDefinition` results by their `visibility` values. | | `limit` | `?int` | Query, Optional | The maximum number of results to return in a single paged response. This limit is advisory.
The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100.
The default value is 20. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | | `cursor` | `?string` | Query, Optional | The cursor returned in the paged response from the previous call to this endpoint.
Provide this cursor to retrieve the next page of results for your original request. For more
information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | -| `withDefinitions` | `?bool` | Query, Optional | Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of each
custom attribute. Set this parameter to `true` to get the name and description of each custom
attribute, information about the data type, or other definition details. The default value is `false`.
**Default**: `false` | +| `withDefinitions` | `?bool` | Query, Optional | Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of each
custom attribute. Set this parameter to `true` to get the name and description of each custom
attribute, information about the data type, or other definition details. The default value is `false`. | ## Response Type @@ -489,7 +489,7 @@ function retrieveLocationCustomAttribute( | --- | --- | --- | --- | | `locationId` | `string` | Template, Required | The ID of the target [location](entity:Location). | | `key` | `string` | Template, Required | The key of the custom attribute to retrieve. This key must match the `key` of a custom
attribute definition in the Square seller account. If the requesting application is not the
definition owner, you must use the qualified key. | -| `withDefinition` | `?bool` | Query, Optional | Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of
the custom attribute. Set this parameter to `true` to get the name and description of the custom
attribute, information about the data type, or other definition details. The default value is `false`.
**Default**: `false` | +| `withDefinition` | `?bool` | Query, Optional | Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of
the custom attribute. Set this parameter to `true` to get the name and description of the custom
attribute, information about the data type, or other definition details. The default value is `false`. | | `version` | `?int` | Query, Optional | The current version of the custom attribute, which is used for strongly consistent reads to
guarantee that you receive the most up-to-date data. When included in the request, Square
returns the specified version or a higher version if one exists. If the specified version is
higher than the current version, Square returns a `BAD_REQUEST` error. | ## Response Type diff --git a/doc/apis/merchant-custom-attributes.md b/doc/apis/merchant-custom-attributes.md index 3d5b6b11..198985fe 100644 --- a/doc/apis/merchant-custom-attributes.md +++ b/doc/apis/merchant-custom-attributes.md @@ -385,7 +385,7 @@ function listMerchantCustomAttributes( | `visibilityFilter` | [`?string(VisibilityFilter)`](../../doc/models/visibility-filter.md) | Query, Optional | Filters the `CustomAttributeDefinition` results by their `visibility` values. | | `limit` | `?int` | Query, Optional | The maximum number of results to return in a single paged response. This limit is advisory.
The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100.
The default value is 20. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | | `cursor` | `?string` | Query, Optional | The cursor returned in the paged response from the previous call to this endpoint.
Provide this cursor to retrieve the next page of results for your original request. For more
information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | -| `withDefinitions` | `?bool` | Query, Optional | Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of each
custom attribute. Set this parameter to `true` to get the name and description of each custom
attribute, information about the data type, or other definition details. The default value is `false`.
**Default**: `false` | +| `withDefinitions` | `?bool` | Query, Optional | Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of each
custom attribute. Set this parameter to `true` to get the name and description of each custom
attribute, information about the data type, or other definition details. The default value is `false`. | ## Response Type @@ -486,7 +486,7 @@ function retrieveMerchantCustomAttribute( | --- | --- | --- | --- | | `merchantId` | `string` | Template, Required | The ID of the target [merchant](entity:Merchant). | | `key` | `string` | Template, Required | The key of the custom attribute to retrieve. This key must match the `key` of a custom
attribute definition in the Square seller account. If the requesting application is not the
definition owner, you must use the qualified key. | -| `withDefinition` | `?bool` | Query, Optional | Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of
the custom attribute. Set this parameter to `true` to get the name and description of the custom
attribute, information about the data type, or other definition details. The default value is `false`.
**Default**: `false` | +| `withDefinition` | `?bool` | Query, Optional | Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of
the custom attribute. Set this parameter to `true` to get the name and description of the custom
attribute, information about the data type, or other definition details. The default value is `false`. | | `version` | `?int` | Query, Optional | The current version of the custom attribute, which is used for strongly consistent reads to
guarantee that you receive the most up-to-date data. When included in the request, Square
returns the specified version or a higher version if one exists. If the specified version is
higher than the current version, Square returns a `BAD_REQUEST` error. | ## Response Type diff --git a/doc/apis/order-custom-attributes.md b/doc/apis/order-custom-attributes.md index a887fe5b..b0ea7c98 100644 --- a/doc/apis/order-custom-attributes.md +++ b/doc/apis/order-custom-attributes.md @@ -409,7 +409,7 @@ function listOrderCustomAttributes( | `visibilityFilter` | [`?string(VisibilityFilter)`](../../doc/models/visibility-filter.md) | Query, Optional | Requests that all of the custom attributes be returned, or only those that are read-only or read-write. | | `cursor` | `?string` | Query, Optional | The cursor returned in the paged response from the previous call to this endpoint.
Provide this cursor to retrieve the next page of results for your original request.
For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). | | `limit` | `?int` | Query, Optional | The maximum number of results to return in a single paged response. This limit is advisory.
The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100.
The default value is 20.
For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). | -| `withDefinitions` | `?bool` | Query, Optional | Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of each
custom attribute. Set this parameter to `true` to get the name and description of each custom attribute,
information about the data type, or other definition details. The default value is `false`.
**Default**: `false` | +| `withDefinitions` | `?bool` | Query, Optional | Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of each
custom attribute. Set this parameter to `true` to get the name and description of each custom attribute,
information about the data type, or other definition details. The default value is `false`. | ## Response Type @@ -516,7 +516,7 @@ function retrieveOrderCustomAttribute( | `orderId` | `string` | Template, Required | The ID of the target [order](entity:Order). | | `customAttributeKey` | `string` | Template, Required | The key of the custom attribute to retrieve. This key must match the key of an
existing custom attribute definition. | | `version` | `?int` | Query, Optional | To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)
control, include this optional field and specify the current version of the custom attribute. | -| `withDefinition` | `?bool` | Query, Optional | Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of each
custom attribute. Set this parameter to `true` to get the name and description of each custom attribute,
information about the data type, or other definition details. The default value is `false`.
**Default**: `false` | +| `withDefinition` | `?bool` | Query, Optional | Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of each
custom attribute. Set this parameter to `true` to get the name and description of each custom attribute,
information about the data type, or other definition details. The default value is `false`. | ## Response Type diff --git a/doc/apis/v1-transactions.md b/doc/apis/v1-transactions.md index a5a204cd..61068898 100644 --- a/doc/apis/v1-transactions.md +++ b/doc/apis/v1-transactions.md @@ -202,7 +202,7 @@ function v1ListPayments( | `endTime` | `?string` | Query, Optional | The end of the requested reporting period, in ISO 8601 format. If this value is more than one year greater than begin_time, this endpoint returns an error. Default value: The current time. | | `limit` | `?int` | Query, Optional | The maximum number of payments to return in a single response. This value cannot exceed 200. | | `batchToken` | `?string` | Query, Optional | A pagination cursor to retrieve the next set of results for your
original query to the endpoint. | -| `includePartial` | `?bool` | Query, Optional | Indicates whether or not to include partial payments in the response. Partial payments will have the tenders collected so far, but the itemizations will be empty until the payment is completed.
**Default**: `false` | +| `includePartial` | `?bool` | Query, Optional | Indicates whether or not to include partial payments in the response. Partial payments will have the tenders collected so far, but the itemizations will be empty until the payment is completed. | ## Response Type diff --git a/doc/apis/webhook-subscriptions.md b/doc/apis/webhook-subscriptions.md index 651a9d25..31c63e2b 100644 --- a/doc/apis/webhook-subscriptions.md +++ b/doc/apis/webhook-subscriptions.md @@ -73,7 +73,7 @@ function listWebhookSubscriptions( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `cursor` | `?string` | Query, Optional | A pagination cursor returned by a previous call to this endpoint.
Provide this to retrieve the next set of results for your original query.

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

Default: 100 | diff --git a/doc/client.md b/doc/client.md index 8fbf3f26..16aec1e2 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*: `'2023-12-13'` | +| `squareVersion` | `string` | Square Connect API versions
*Default*: `'2024-01-18'` | | `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` | @@ -26,7 +26,7 @@ The API client can be initialized as follows: ```php $client = SquareClientBuilder::init() ->accessToken('AccessToken') - ->squareVersion('2023-12-13') + ->squareVersion('2024-01-18') ->environment('production') ->customUrl('https://connect.squareup.com') ->build(); @@ -51,7 +51,7 @@ use Square\SquareClientBuilder; $client = SquareClientBuilder::init() ->accessToken('AccessToken') - ->squareVersion('2023-12-13') + ->squareVersion('2024-01-18') ->build(); $apiResponse = $client->getLocationsApi()->listLocations(); diff --git a/doc/models/catalog-custom-attribute-definition.md b/doc/models/catalog-custom-attribute-definition.md index 0d814f37..e84096d9 100644 --- a/doc/models/catalog-custom-attribute-definition.md +++ b/doc/models/catalog-custom-attribute-definition.md @@ -41,8 +41,8 @@ to store any sensitive information (personally identifiable information, card de "name": "name2" }, "allowed_object_types": [ - "ITEM", - "SUBSCRIPTION_PLAN" + "CATEGORY", + "IMAGE" ], "seller_visibility": "SELLER_VISIBILITY_HIDDEN", "app_visibility": "APP_VISIBILITY_HIDDEN", diff --git a/doc/models/catalog-item-food-and-beverage-details-dietary-preference-standard-dietary-preference.md b/doc/models/catalog-item-food-and-beverage-details-dietary-preference-standard-dietary-preference.md new file mode 100644 index 00000000..5e8f2401 --- /dev/null +++ b/doc/models/catalog-item-food-and-beverage-details-dietary-preference-standard-dietary-preference.md @@ -0,0 +1,21 @@ + +# Catalog Item Food and Beverage Details Dietary Preference Standard Dietary Preference + +Standard dietary preferences for food and beverage items that are recommended on item creation. + +## Enumeration + +`CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreference` + +## Fields + +| Name | +| --- | +| `DAIRY_FREE` | +| `GLUTEN_FREE` | +| `HALAL` | +| `KOSHER` | +| `NUT_FREE` | +| `VEGAN` | +| `VEGETARIAN` | + diff --git a/doc/models/catalog-item-food-and-beverage-details-dietary-preference-type.md b/doc/models/catalog-item-food-and-beverage-details-dietary-preference-type.md new file mode 100644 index 00000000..8f40ee6b --- /dev/null +++ b/doc/models/catalog-item-food-and-beverage-details-dietary-preference-type.md @@ -0,0 +1,16 @@ + +# Catalog Item Food and Beverage Details Dietary Preference Type + +The type of dietary preference for the `FOOD_AND_BEV` type of items and integredients. + +## Enumeration + +`CatalogItemFoodAndBeverageDetailsDietaryPreferenceType` + +## Fields + +| Name | Description | +| --- | --- | +| `STANDARD` | A standard value from a pre-determined list. | +| `CUSTOM` | A user-defined custom value. | + diff --git a/doc/models/catalog-item-food-and-beverage-details-dietary-preference.md b/doc/models/catalog-item-food-and-beverage-details-dietary-preference.md new file mode 100644 index 00000000..7d89ec32 --- /dev/null +++ b/doc/models/catalog-item-food-and-beverage-details-dietary-preference.md @@ -0,0 +1,27 @@ + +# Catalog Item Food and Beverage Details Dietary Preference + +Dietary preferences that can be assigned to an `FOOD_AND_BEV` item and its ingredients. + +## Structure + +`CatalogItemFoodAndBeverageDetailsDietaryPreference` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `type` | [`?string(CatalogItemFoodAndBeverageDetailsDietaryPreferenceType)`](../../doc/models/catalog-item-food-and-beverage-details-dietary-preference-type.md) | Optional | The type of dietary preference for the `FOOD_AND_BEV` type of items and integredients. | getType(): ?string | setType(?string type): void | +| `standardName` | [`?string(CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreference)`](../../doc/models/catalog-item-food-and-beverage-details-dietary-preference-standard-dietary-preference.md) | Optional | Standard dietary preferences for food and beverage items that are recommended on item creation. | getStandardName(): ?string | setStandardName(?string standardName): void | +| `customName` | `?string` | Optional | The name of a user-defined custom dietary preference. This should be null if it's a standard dietary preference. | getCustomName(): ?string | setCustomName(?string customName): void | + +## Example (as JSON) + +```json +{ + "type": "STANDARD", + "standard_name": "GLUTEN_FREE", + "custom_name": "custom_name4" +} +``` + diff --git a/doc/models/catalog-item-food-and-beverage-details-ingredient-standard-ingredient.md b/doc/models/catalog-item-food-and-beverage-details-ingredient-standard-ingredient.md new file mode 100644 index 00000000..d5275f45 --- /dev/null +++ b/doc/models/catalog-item-food-and-beverage-details-ingredient-standard-ingredient.md @@ -0,0 +1,28 @@ + +# Catalog Item Food and Beverage Details Ingredient Standard Ingredient + +Standard ingredients for food and beverage items that are recommended on item creation. + +## Enumeration + +`CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient` + +## Fields + +| Name | +| --- | +| `CELERY` | +| `CRUSTACEANS` | +| `EGGS` | +| `FISH` | +| `GLUTEN` | +| `LUPIN` | +| `MILK` | +| `MOLLUSCS` | +| `MUSTARD` | +| `PEANUTS` | +| `SESAME` | +| `SOY` | +| `SULPHITES` | +| `TREE_NUTS` | + diff --git a/doc/models/catalog-item-food-and-beverage-details-ingredient.md b/doc/models/catalog-item-food-and-beverage-details-ingredient.md new file mode 100644 index 00000000..9862b10b --- /dev/null +++ b/doc/models/catalog-item-food-and-beverage-details-ingredient.md @@ -0,0 +1,27 @@ + +# Catalog Item Food and Beverage Details Ingredient + +Describes the ingredient used in a `FOOD_AND_BEV` item. + +## Structure + +`CatalogItemFoodAndBeverageDetailsIngredient` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `type` | [`?string(CatalogItemFoodAndBeverageDetailsDietaryPreferenceType)`](../../doc/models/catalog-item-food-and-beverage-details-dietary-preference-type.md) | Optional | The type of dietary preference for the `FOOD_AND_BEV` type of items and integredients. | getType(): ?string | setType(?string type): void | +| `standardName` | [`?string(CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient)`](../../doc/models/catalog-item-food-and-beverage-details-ingredient-standard-ingredient.md) | Optional | Standard ingredients for food and beverage items that are recommended on item creation. | getStandardName(): ?string | setStandardName(?string standardName): void | +| `customName` | `?string` | Optional | The name of a custom user-defined ingredient. This should be null if it's a standard dietary preference. | getCustomName(): ?string | setCustomName(?string customName): void | + +## Example (as JSON) + +```json +{ + "type": "STANDARD", + "standard_name": "GLUTEN", + "custom_name": "custom_name6" +} +``` + diff --git a/doc/models/catalog-item-food-and-beverage-details.md b/doc/models/catalog-item-food-and-beverage-details.md new file mode 100644 index 00000000..2a388005 --- /dev/null +++ b/doc/models/catalog-item-food-and-beverage-details.md @@ -0,0 +1,44 @@ + +# Catalog Item Food and Beverage Details + +The food and beverage-specific details of a `FOOD_AND_BEV` item. + +## Structure + +`CatalogItemFoodAndBeverageDetails` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `calorieCount` | `?int` | Optional | The calorie count (in the unit of kcal) for the `FOOD_AND_BEV` type of items. | getCalorieCount(): ?int | setCalorieCount(?int calorieCount): void | +| `dietaryPreferences` | [`?(CatalogItemFoodAndBeverageDetailsDietaryPreference[])`](../../doc/models/catalog-item-food-and-beverage-details-dietary-preference.md) | Optional | The dietary preferences for the `FOOD_AND_BEV` item. | getDietaryPreferences(): ?array | setDietaryPreferences(?array dietaryPreferences): void | +| `ingredients` | [`?(CatalogItemFoodAndBeverageDetailsIngredient[])`](../../doc/models/catalog-item-food-and-beverage-details-ingredient.md) | Optional | The ingredients for the `FOOD_AND_BEV` type item. | getIngredients(): ?array | setIngredients(?array ingredients): void | + +## Example (as JSON) + +```json +{ + "calorie_count": 36, + "dietary_preferences": [ + { + "type": "STANDARD", + "standard_name": "VEGETARIAN", + "custom_name": "custom_name8" + } + ], + "ingredients": [ + { + "type": "STANDARD", + "standard_name": "MILK", + "custom_name": "custom_name8" + }, + { + "type": "STANDARD", + "standard_name": "MILK", + "custom_name": "custom_name8" + } + ] +} +``` + diff --git a/doc/models/catalog-item-option.md b/doc/models/catalog-item-option.md index fa850dfe..92d179d4 100644 --- a/doc/models/catalog-item-option.md +++ b/doc/models/catalog-item-option.md @@ -27,7 +27,7 @@ A group of variations for a `CatalogItem`. "show_colors": false, "values": [ { - "type": "SUBSCRIPTION_PLAN_VARIATION", + "type": "IMAGE", "id": "id0", "updated_at": "updated_at6", "version": 116, @@ -63,7 +63,7 @@ A group of variations for a `CatalogItem`. ] }, { - "type": "SUBSCRIPTION_PLAN_VARIATION", + "type": "IMAGE", "id": "id0", "updated_at": "updated_at6", "version": 116, diff --git a/doc/models/catalog-item-product-type.md b/doc/models/catalog-item-product-type.md index eb8e43a7..e08694ef 100644 --- a/doc/models/catalog-item-product-type.md +++ b/doc/models/catalog-item-product-type.md @@ -14,4 +14,10 @@ The type of a CatalogItem. Connect V2 only allows the creation of `REGULAR` or ` | `REGULAR` | An ordinary item. | | `GIFT_CARD` | A Square gift card. | | `APPOINTMENTS_SERVICE` | A service that can be booked using the Square Appointments app. | +| `FOOD_AND_BEV` | A food or beverage item that can be sold by restaurants and other food venues. | +| `EVENT` | An event which tickets can be sold for, including location, address, and times. | +| `DIGITAL` | A digital item like an ebook or song. | +| `DONATION` | A donation which site visitors can send for any cause. | +| `LEGACY_SQUARE_ONLINE_SERVICE` | A legacy Square Online service that is manually fulfilled. This corresponds to the `Other` item type displayed in the Square Seller Dashboard and Square POS apps. | +| `LEGACY_SQUARE_ONLINE_MEMBERSHIP` | A legacy Square Online membership that is manually fulfilled. This corresponds to the `Membership` item type displayed in the Square Seller Dashboard and Square POS apps. | diff --git a/doc/models/catalog-item.md b/doc/models/catalog-item.md index 57ca5f0b..f67ba758 100644 --- a/doc/models/catalog-item.md +++ b/doc/models/catalog-item.md @@ -33,6 +33,7 @@ A [CatalogObject](../../doc/models/catalog-object.md) instance of the `ITEM` typ | `channels` | `?(string[])` | Optional | A list of IDs representing channels, such as a Square Online site, where the item can be made visible or available. | getChannels(): ?array | setChannels(?array channels): void | | `isArchived` | `?bool` | Optional | Indicates whether this item is archived (`true`) or not (`false`). | getIsArchived(): ?bool | setIsArchived(?bool isArchived): void | | `ecomSeoData` | [`?CatalogEcomSeoData`](../../doc/models/catalog-ecom-seo-data.md) | Optional | SEO data for for a seller's Square Online store. | getEcomSeoData(): ?CatalogEcomSeoData | setEcomSeoData(?CatalogEcomSeoData ecomSeoData): void | +| `foodAndBeverageDetails` | [`?CatalogItemFoodAndBeverageDetails`](../../doc/models/catalog-item-food-and-beverage-details.md) | Optional | The food and beverage-specific details of a `FOOD_AND_BEV` item. | getFoodAndBeverageDetails(): ?CatalogItemFoodAndBeverageDetails | setFoodAndBeverageDetails(?CatalogItemFoodAndBeverageDetails foodAndBeverageDetails): void | | `reportingCategory` | [`?CatalogObjectCategory`](../../doc/models/catalog-object-category.md) | Optional | A category that can be assigned to an item or a parent category that can be assigned
to another category. For example, a clothing category can be assigned to a t-shirt item or
be made as the parent category to the pants category. | getReportingCategory(): ?CatalogObjectCategory | setReportingCategory(?CatalogObjectCategory reportingCategory): void | ## Example (as JSON) diff --git a/doc/models/catalog-modifier-list.md b/doc/models/catalog-modifier-list.md index 031f7bd3..222ed27b 100644 --- a/doc/models/catalog-modifier-list.md +++ b/doc/models/catalog-modifier-list.md @@ -31,7 +31,7 @@ the modifier list are allowed. "selection_type": "SINGLE", "modifiers": [ { - "type": "QUICK_AMOUNTS_SETTINGS", + "type": "TAX", "id": "id4", "updated_at": "updated_at0", "version": 210, diff --git a/doc/models/catalog-object-batch.md b/doc/models/catalog-object-batch.md index 308d3bbf..6d766461 100644 --- a/doc/models/catalog-object-batch.md +++ b/doc/models/catalog-object-batch.md @@ -19,7 +19,7 @@ A batch of catalog objects. { "objects": [ { - "type": "PRICING_RULE", + "type": "PRODUCT_SET", "id": "id6", "category_data": { "object": { diff --git a/doc/models/catalog-object-type.md b/doc/models/catalog-object-type.md index 6ef39c2e..ada605a9 100644 --- a/doc/models/catalog-object-type.md +++ b/doc/models/catalog-object-type.md @@ -30,4 +30,5 @@ containing type-specific properties in the `*_data` field corresponding to the s | `CUSTOM_ATTRIBUTE_DEFINITION` | The `CatalogObject` instance is of the [CatalogCustomAttributeDefinition](../../doc/models/catalog-custom-attribute-definition.md) type and represents the definition of a custom attribute.
The custom-attribute-definition-specific data must be set on the `custom_attribute_definition_data` field. | | `QUICK_AMOUNTS_SETTINGS` | The `CatalogObject` instance is of the [CatalogQuickAmountsSettings](../../doc/models/catalog-quick-amounts-settings.md) type and represents settings to configure preset charges for quick payments at each location.
For example, a location may have a list of both AUTO and MANUAL quick amounts that are set to DISABLED.
The quick-amounts-settings-specific data must be set on the `quick_amounts_settings_data` field. | | `SUBSCRIPTION_PLAN` | The `CatalogObject` instance is of the [CatalogSubscriptionPlan](../../doc/models/catalog-subscription-plan.md) type and represents a subscription plan.
The subscription plan specific data must be stored on the `subscription_plan_data` field. | +| `AVAILABILITY_PERIOD` | The `CatalogObject` instance is of the [CatalogAvailabilityPeriod](../../doc/models/catalog-availability-period.md) type and represents an availability period.
The availability period specific data must be stored on the `availability_period_data` field. | diff --git a/doc/models/catalog-object.md b/doc/models/catalog-object.md index b03cf5a8..478c4c5e 100644 --- a/doc/models/catalog-object.md +++ b/doc/models/catalog-object.md @@ -54,7 +54,7 @@ For a more detailed discussion of the Catalog data model, please see the ```json { - "type": "TAX", + "type": "TIME_PERIOD", "id": "id4", "category_data": { "object": { diff --git a/doc/models/catalog-subscription-plan.md b/doc/models/catalog-subscription-plan.md index 8281e622..009b616a 100644 --- a/doc/models/catalog-subscription-plan.md +++ b/doc/models/catalog-subscription-plan.md @@ -91,7 +91,7 @@ For more information, see [Subscription Plans and Variations](https://developer. ], "subscription_plan_variations": [ { - "type": "TIME_PERIOD", + "type": "MODIFIER", "id": "id4", "updated_at": "updated_at0", "version": 208, @@ -135,7 +135,7 @@ For more information, see [Subscription Plans and Variations](https://developer. ] }, { - "type": "TIME_PERIOD", + "type": "MODIFIER", "id": "id4", "updated_at": "updated_at0", "version": 208, diff --git a/doc/models/create-invoice-attachment-request.md b/doc/models/create-invoice-attachment-request.md new file mode 100644 index 00000000..4ccbc8c0 --- /dev/null +++ b/doc/models/create-invoice-attachment-request.md @@ -0,0 +1,25 @@ + +# Create Invoice Attachment Request + +Represents a [CreateInvoiceAttachment](../../doc/apis/invoices.md#create-invoice-attachment) request. + +## Structure + +`CreateInvoiceAttachmentRequest` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `idempotencyKey` | `?string` | Optional | A unique string that identifies the `CreateInvoiceAttachment` request.
For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
**Constraints**: *Maximum Length*: `128` | getIdempotencyKey(): ?string | setIdempotencyKey(?string idempotencyKey): void | +| `description` | `?string` | Optional | The description of the attachment to display on the invoice.
**Constraints**: *Maximum Length*: `128` | getDescription(): ?string | setDescription(?string description): void | + +## Example (as JSON) + +```json +{ + "description": "Service contract", + "idempotency_key": "ae5e84f9-4742-4fc1-ba12-a3ce3748f1c3" +} +``` + diff --git a/doc/models/create-invoice-attachment-response.md b/doc/models/create-invoice-attachment-response.md new file mode 100644 index 00000000..7b944881 --- /dev/null +++ b/doc/models/create-invoice-attachment-response.md @@ -0,0 +1,52 @@ + +# Create Invoice Attachment Response + +Represents a [CreateInvoiceAttachment](../../doc/apis/invoices.md#create-invoice-attachment) response. + +## Structure + +`CreateInvoiceAttachmentResponse` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `attachment` | [`?InvoiceAttachment`](../../doc/models/invoice-attachment.md) | Optional | Represents a file attached to an [invoice](../../doc/models/invoice.md). | getAttachment(): ?InvoiceAttachment | setAttachment(?InvoiceAttachment attachment): 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 +{ + "attachment": { + "description": "Service contract", + "filename": "file.jpg", + "filesize": 102705, + "hash": "273ee02cb6f5f8a3a8ca23604930dd53", + "id": "inva:0-3bB9ZuDHiziThQhuC4fwWt", + "mime_type": "image/jpeg", + "uploaded_at": "2023-02-03T20:28:14Z" + }, + "errors": [ + { + "category": "MERCHANT_SUBSCRIPTION_ERROR", + "code": "MAP_KEY_LENGTH_TOO_LONG", + "detail": "detail6", + "field": "field4" + }, + { + "category": "MERCHANT_SUBSCRIPTION_ERROR", + "code": "MAP_KEY_LENGTH_TOO_LONG", + "detail": "detail6", + "field": "field4" + }, + { + "category": "MERCHANT_SUBSCRIPTION_ERROR", + "code": "MAP_KEY_LENGTH_TOO_LONG", + "detail": "detail6", + "field": "field4" + } + ] +} +``` + diff --git a/doc/models/create-payment-link-response.md b/doc/models/create-payment-link-response.md index 0ce4a66c..c84fb5da 100644 --- a/doc/models/create-payment-link-response.md +++ b/doc/models/create-payment-link-response.md @@ -128,7 +128,7 @@ ], "subscription_plans": [ { - "type": "QUICK_AMOUNTS_SETTINGS", + "type": "ITEM_OPTION", "id": "id4", "updated_at": "updated_at0", "version": 112, @@ -172,7 +172,7 @@ ] }, { - "type": "QUICK_AMOUNTS_SETTINGS", + "type": "ITEM_OPTION", "id": "id4", "updated_at": "updated_at0", "version": 112, @@ -216,7 +216,7 @@ ] }, { - "type": "QUICK_AMOUNTS_SETTINGS", + "type": "ITEM_OPTION", "id": "id4", "updated_at": "updated_at0", "version": 112, diff --git a/doc/models/delete-invoice-attachment-response.md b/doc/models/delete-invoice-attachment-response.md new file mode 100644 index 00000000..b1ce3c03 --- /dev/null +++ b/doc/models/delete-invoice-attachment-response.md @@ -0,0 +1,36 @@ + +# Delete Invoice Attachment Response + +Represents a [DeleteInvoiceAttachment](../../doc/apis/invoices.md#delete-invoice-attachment) response. + +## Structure + +`DeleteInvoiceAttachmentResponse` + +## Fields + +| 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 | + +## Example (as JSON) + +```json +{ + "errors": [ + { + "category": "MERCHANT_SUBSCRIPTION_ERROR", + "code": "MAP_KEY_LENGTH_TOO_LONG", + "detail": "detail6", + "field": "field4" + }, + { + "category": "MERCHANT_SUBSCRIPTION_ERROR", + "code": "MAP_KEY_LENGTH_TOO_LONG", + "detail": "detail6", + "field": "field4" + } + ] +} +``` + diff --git a/doc/models/fulfillment-delivery-details.md b/doc/models/fulfillment-delivery-details.md index 94c57624..0edfc240 100644 --- a/doc/models/fulfillment-delivery-details.md +++ b/doc/models/fulfillment-delivery-details.md @@ -15,8 +15,8 @@ Describes delivery details of an order fulfillment. | `scheduleType` | [`?string(FulfillmentDeliveryDetailsOrderFulfillmentDeliveryDetailsScheduleType)`](../../doc/models/fulfillment-delivery-details-order-fulfillment-delivery-details-schedule-type.md) | Optional | The schedule type of the delivery fulfillment. | getScheduleType(): ?string | setScheduleType(?string scheduleType): void | | `placedAt` | `?string` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicating when the fulfillment was placed.
The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z").

Must be in RFC 3339 timestamp format, e.g., "2016-09-04T23:59:33.123Z". | getPlacedAt(): ?string | setPlacedAt(?string placedAt): void | | `deliverAt` | `?string` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
that represents the start of the delivery period.
When the fulfillment `schedule_type` is `ASAP`, the field is automatically
set to the current time plus the `prep_time_duration`.
Otherwise, the application can set this field while the fulfillment `state` is
`PROPOSED`, `RESERVED`, or `PREPARED` (any time before the
terminal state such as `COMPLETED`, `CANCELED`, and `FAILED`).

The timestamp must be in RFC 3339 format
(for example, "2016-09-04T23:59:33.123Z"). | getDeliverAt(): ?string | setDeliverAt(?string deliverAt): void | -| `prepTimeDuration` | `?string` | Optional | The duration of time it takes to prepare and deliver this fulfillment.
The timestamp must be in RFC 3339 format (for example, "P1W3D"). | getPrepTimeDuration(): ?string | setPrepTimeDuration(?string prepTimeDuration): void | -| `deliveryWindowDuration` | `?string` | Optional | The time period after the `deliver_at` timestamp in which to deliver the order.
Applications can set this field when the fulfillment `state` is
`PROPOSED`, `RESERVED`, or `PREPARED` (any time before the terminal state
such as `COMPLETED`, `CANCELED`, and `FAILED`).

The timestamp must be in RFC 3339 format (for example, "P1W3D"). | getDeliveryWindowDuration(): ?string | setDeliveryWindowDuration(?string deliveryWindowDuration): void | +| `prepTimeDuration` | `?string` | Optional | The duration of time it takes to prepare and deliver this fulfillment.
The duration must be in RFC 3339 format (for example, "P1W3D"). | getPrepTimeDuration(): ?string | setPrepTimeDuration(?string prepTimeDuration): void | +| `deliveryWindowDuration` | `?string` | Optional | The time period after `deliver_at` in which to deliver the order.
Applications can set this field when the fulfillment `state` is
`PROPOSED`, `RESERVED`, or `PREPARED` (any time before the terminal state
such as `COMPLETED`, `CANCELED`, and `FAILED`).

The duration must be in RFC 3339 format (for example, "P1W3D"). | getDeliveryWindowDuration(): ?string | setDeliveryWindowDuration(?string deliveryWindowDuration): void | | `note` | `?string` | Optional | Provides additional instructions about the delivery fulfillment.
It is displayed in the Square Point of Sale application and set by the API.
**Constraints**: *Maximum Length*: `550` | getNote(): ?string | setNote(?string note): void | | `completedAt` | `?string` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicates when the seller completed the fulfillment.
This field is automatically set when fulfillment `state` changes to `COMPLETED`.
The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). | getCompletedAt(): ?string | setCompletedAt(?string completedAt): void | | `inProgressAt` | `?string` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicates when the seller started processing the fulfillment.
This field is automatically set when the fulfillment `state` changes to `RESERVED`.
The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). | getInProgressAt(): ?string | setInProgressAt(?string inProgressAt): void | @@ -26,7 +26,7 @@ Describes delivery details of an order fulfillment. | `canceledAt` | `?string` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicating when the fulfillment was canceled. This field is automatically
set when the fulfillment `state` changes to `CANCELED`.

The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). | getCanceledAt(): ?string | setCanceledAt(?string canceledAt): void | | `cancelReason` | `?string` | Optional | The delivery cancellation reason. Max length: 100 characters.
**Constraints**: *Maximum Length*: `100` | getCancelReason(): ?string | setCancelReason(?string cancelReason): void | | `courierPickupAt` | `?string` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicating when an order can be picked up by the courier for delivery.
The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). | getCourierPickupAt(): ?string | setCourierPickupAt(?string courierPickupAt): void | -| `courierPickupWindowDuration` | `?string` | Optional | The period of time in which the order should be picked up by the courier after the
`courier_pickup_at` timestamp.
The time must be in RFC 3339 format (for example, "P1W3D"). | getCourierPickupWindowDuration(): ?string | setCourierPickupWindowDuration(?string courierPickupWindowDuration): void | +| `courierPickupWindowDuration` | `?string` | Optional | The time period after `courier_pickup_at` in which the courier should pick up the order.
The duration must be in RFC 3339 format (for example, "P1W3D"). | getCourierPickupWindowDuration(): ?string | setCourierPickupWindowDuration(?string courierPickupWindowDuration): void | | `isNoContactDelivery` | `?bool` | Optional | Whether the delivery is preferred to be no contact. | getIsNoContactDelivery(): ?bool | setIsNoContactDelivery(?bool isNoContactDelivery): void | | `dropoffNotes` | `?string` | Optional | A note to provide additional instructions about how to deliver the order.
**Constraints**: *Maximum Length*: `550` | getDropoffNotes(): ?string | setDropoffNotes(?string dropoffNotes): void | | `courierProviderName` | `?string` | Optional | The name of the courier provider.
**Constraints**: *Maximum Length*: `255` | getCourierProviderName(): ?string | setCourierProviderName(?string courierProviderName): void | diff --git a/doc/models/fulfillment-pickup-details.md b/doc/models/fulfillment-pickup-details.md index 1eb0a64a..350355ea 100644 --- a/doc/models/fulfillment-pickup-details.md +++ b/doc/models/fulfillment-pickup-details.md @@ -12,15 +12,15 @@ Contains details necessary to fulfill a pickup order. | Name | Type | Tags | Description | Getter | Setter | | --- | --- | --- | --- | --- | --- | | `recipient` | [`?FulfillmentRecipient`](../../doc/models/fulfillment-recipient.md) | Optional | Information about the fulfillment recipient. | getRecipient(): ?FulfillmentRecipient | setRecipient(?FulfillmentRecipient recipient): void | -| `expiresAt` | `?string` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicating when this fulfillment expires if it is not accepted. The timestamp must be in RFC 3339 format
(for example, "2016-09-04T23:59:33.123Z"). The expiration time can only be set up to 7 days in the future.
If `expires_at` is not set, this pickup fulfillment is automatically accepted when
placed. | getExpiresAt(): ?string | setExpiresAt(?string expiresAt): void | -| `autoCompleteDuration` | `?string` | Optional | The duration of time after which an open and accepted pickup fulfillment
is automatically moved to the `COMPLETED` state. The duration must be in RFC 3339
format (for example, "P1W3D").

If not set, this pickup fulfillment remains accepted until it is canceled or completed. | getAutoCompleteDuration(): ?string | setAutoCompleteDuration(?string autoCompleteDuration): void | +| `expiresAt` | `?string` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicating when this fulfillment expires if it is not marked in progress. The timestamp must be
in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). The expiration time can only be set
up to 7 days in the future. If `expires_at` is not set, any new payments attached to the order
are automatically completed. | getExpiresAt(): ?string | setExpiresAt(?string expiresAt): void | +| `autoCompleteDuration` | `?string` | Optional | The duration of time after which an in progress pickup fulfillment is automatically moved
to the `COMPLETED` state. The duration must be in RFC 3339 format (for example, "P1W3D").

If not set, this pickup fulfillment remains in progress until it is canceled or completed. | getAutoCompleteDuration(): ?string | setAutoCompleteDuration(?string autoCompleteDuration): void | | `scheduleType` | [`?string(FulfillmentPickupDetailsScheduleType)`](../../doc/models/fulfillment-pickup-details-schedule-type.md) | Optional | The schedule type of the pickup fulfillment. | getScheduleType(): ?string | setScheduleType(?string scheduleType): void | | `pickupAt` | `?string` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
that represents the start of the pickup window. Must be in RFC 3339 timestamp format, e.g.,
"2016-09-04T23:59:33.123Z".

For fulfillments with the schedule type `ASAP`, this is automatically set
to the current time plus the expected duration to prepare the fulfillment. | getPickupAt(): ?string | setPickupAt(?string pickupAt): void | | `pickupWindowDuration` | `?string` | Optional | The window of time in which the order should be picked up after the `pickup_at` timestamp.
Must be in RFC 3339 duration format, e.g., "P1W3D". Can be used as an
informational guideline for merchants. | getPickupWindowDuration(): ?string | setPickupWindowDuration(?string pickupWindowDuration): void | | `prepTimeDuration` | `?string` | Optional | The duration of time it takes to prepare this fulfillment.
The duration must be in RFC 3339 format (for example, "P1W3D"). | getPrepTimeDuration(): ?string | setPrepTimeDuration(?string prepTimeDuration): void | | `note` | `?string` | Optional | A note to provide additional instructions about the pickup
fulfillment displayed in the Square Point of Sale application and set by the API.
**Constraints**: *Maximum Length*: `500` | getNote(): ?string | setNote(?string note): void | | `placedAt` | `?string` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicating when the fulfillment was placed. The timestamp must be in RFC 3339 format
(for example, "2016-09-04T23:59:33.123Z"). | getPlacedAt(): ?string | setPlacedAt(?string placedAt): void | -| `acceptedAt` | `?string` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicating when the fulfillment was accepted. The timestamp must be in RFC 3339 format
(for example, "2016-09-04T23:59:33.123Z"). | getAcceptedAt(): ?string | setAcceptedAt(?string acceptedAt): void | +| `acceptedAt` | `?string` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicating when the fulfillment was marked in progress. The timestamp must be in RFC 3339 format
(for example, "2016-09-04T23:59:33.123Z"). | getAcceptedAt(): ?string | setAcceptedAt(?string acceptedAt): void | | `rejectedAt` | `?string` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicating when the fulfillment was rejected. The timestamp must be in RFC 3339 format
(for example, "2016-09-04T23:59:33.123Z"). | getRejectedAt(): ?string | setRejectedAt(?string rejectedAt): void | | `readyAt` | `?string` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicating when the fulfillment is marked as ready for pickup. The timestamp must be in RFC 3339 format
(for example, "2016-09-04T23:59:33.123Z"). | getReadyAt(): ?string | setReadyAt(?string readyAt): void | | `expiredAt` | `?string` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicating when the fulfillment expired. The timestamp must be in RFC 3339 format
(for example, "2016-09-04T23:59:33.123Z"). | getExpiredAt(): ?string | setExpiredAt(?string expiredAt): void | diff --git a/doc/models/fulfillment.md b/doc/models/fulfillment.md index fe5f709e..5f8f0c41 100644 --- a/doc/models/fulfillment.md +++ b/doc/models/fulfillment.md @@ -22,6 +22,7 @@ However, orders returned by the Orders API might contain multiple fulfillments b | `pickupDetails` | [`?FulfillmentPickupDetails`](../../doc/models/fulfillment-pickup-details.md) | Optional | Contains details necessary to fulfill a pickup order. | getPickupDetails(): ?FulfillmentPickupDetails | setPickupDetails(?FulfillmentPickupDetails pickupDetails): void | | `shipmentDetails` | [`?FulfillmentShipmentDetails`](../../doc/models/fulfillment-shipment-details.md) | Optional | Contains the details necessary to fulfill a shipment order. | getShipmentDetails(): ?FulfillmentShipmentDetails | setShipmentDetails(?FulfillmentShipmentDetails shipmentDetails): void | | `deliveryDetails` | [`?FulfillmentDeliveryDetails`](../../doc/models/fulfillment-delivery-details.md) | Optional | Describes delivery details of an order fulfillment. | getDeliveryDetails(): ?FulfillmentDeliveryDetails | setDeliveryDetails(?FulfillmentDeliveryDetails deliveryDetails): void | +| `version` | `?int` | Optional | The version number attributed to the fulfillment and incremented every time there is a
fulfillment-related update. The fulfillment version is an internal field only for use
between Orders and the Fulfillment service. | getVersion(): ?int | setVersion(?int version): void | ## Example (as JSON) diff --git a/doc/models/invoice-attachment.md b/doc/models/invoice-attachment.md new file mode 100644 index 00000000..054cffd6 --- /dev/null +++ b/doc/models/invoice-attachment.md @@ -0,0 +1,33 @@ + +# Invoice Attachment + +Represents a file attached to an [invoice](../../doc/models/invoice.md). + +## Structure + +`InvoiceAttachment` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `id` | `?string` | Optional | The Square-assigned ID of the attachment. | getId(): ?string | setId(?string id): void | +| `filename` | `?string` | Optional | The file name of the attachment, which is displayed on the invoice. | getFilename(): ?string | setFilename(?string filename): void | +| `description` | `?string` | Optional | The description of the attachment, which is displayed on the invoice.
This field maps to the seller-defined **Message** field. | getDescription(): ?string | setDescription(?string description): void | +| `filesize` | `?int` | Optional | The file size of the attachment in bytes. | getFilesize(): ?int | setFilesize(?int filesize): void | +| `hash` | `?string` | Optional | The MD5 hash that was generated from the file contents. | getHash(): ?string | setHash(?string hash): void | +| `mimeType` | `?string` | Optional | The mime type of the attachment.
The following mime types are supported:
image/gif, image/jpeg, image/png, image/tiff, image/bmp, application/pdf. | getMimeType(): ?string | setMimeType(?string mimeType): void | +| `uploadedAt` | `?string` | Optional | The timestamp when the attachment was uploaded, in RFC 3339 format. | getUploadedAt(): ?string | setUploadedAt(?string uploadedAt): void | + +## Example (as JSON) + +```json +{ + "id": "id4", + "filename": "filename6", + "description": "description6", + "filesize": 164, + "hash": "hash0" +} +``` + diff --git a/doc/models/invoice.md b/doc/models/invoice.md index 154e5f44..e2844f7c 100644 --- a/doc/models/invoice.md +++ b/doc/models/invoice.md @@ -35,6 +35,7 @@ invoices. For more information, see [Invoices API Overview](https://developer.sq | `saleOrServiceDate` | `?string` | Optional | The date of the sale or the date that the service is rendered, in `YYYY-MM-DD` format.
This field can be used to specify a past or future date which is displayed on the invoice. | getSaleOrServiceDate(): ?string | setSaleOrServiceDate(?string saleOrServiceDate): void | | `paymentConditions` | `?string` | Optional | **France only.** The payment terms and conditions that are displayed on the invoice. For more information,
see [Payment conditions](https://developer.squareup.com/docs/invoices-api/overview#payment-conditions).

For countries other than France, Square returns an `INVALID_REQUEST_ERROR` with a `BAD_REQUEST` code and
"Payment conditions are not supported for this location's country" detail if this field is included in `CreateInvoice` or `UpdateInvoice` requests.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `2000` | getPaymentConditions(): ?string | setPaymentConditions(?string paymentConditions): void | | `storePaymentMethodEnabled` | `?bool` | Optional | Indicates whether to allow a customer to save a credit or debit card as a card on file or a bank transfer as a
bank account on file. If `true`, Square displays a __Save my card on file__ or __Save my bank on file__ checkbox on the
invoice payment page. Stored payment information can be used for future automatic payments. The default value is `false`. | getStorePaymentMethodEnabled(): ?bool | setStorePaymentMethodEnabled(?bool storePaymentMethodEnabled): void | +| `attachments` | [`?(InvoiceAttachment[])`](../../doc/models/invoice-attachment.md) | Optional | Metadata about the attachments on the invoice. Invoice attachments are managed using the
[CreateInvoiceAttachment](api-endpoint:Invoices-CreateInvoiceAttachment) and [DeleteInvoiceAttachment](api-endpoint:Invoices-DeleteInvoiceAttachment) endpoints. | getAttachments(): ?array | setAttachments(?array attachments): void | ## Example (as JSON) diff --git a/doc/models/list-invoices-response.md b/doc/models/list-invoices-response.md index d15522cd..ce8ae088 100644 --- a/doc/models/list-invoices-response.md +++ b/doc/models/list-invoices-response.md @@ -29,7 +29,18 @@ Describes a `ListInvoice` response. "cash_app_pay": false, "square_gift_card": false }, - "created_at": "2020-06-18T17:45:13Z", + "attachments": [ + { + "description": "Service contract", + "filename": "file.jpg", + "filesize": 102705, + "hash": "273ee02cb6f5f8a3a8ca23604930dd53", + "id": "inva:0-3bB9ZuDHiziThQhuC4fwWt", + "mime_type": "image/jpeg", + "uploaded_at": "2030-01-13T21:24:10Z" + } + ], + "created_at": "2030-01-13T17:45:13Z", "custom_fields": [ { "label": "Event Reference Number", @@ -93,8 +104,8 @@ Describes a `ListInvoice` response. "store_payment_method_enabled": false, "timezone": "America/Los_Angeles", "title": "Event Planning Services", - "updated_at": "2020-06-18T17:45:13Z", - "version": 0 + "updated_at": "2030-01-13T21:24:10Z", + "version": 1 }, { "accepted_payment_methods": { diff --git a/doc/models/loyalty-promotion.md b/doc/models/loyalty-promotion.md index c15e85e3..f88372a9 100644 --- a/doc/models/loyalty-promotion.md +++ b/doc/models/loyalty-promotion.md @@ -15,7 +15,7 @@ A loyalty program can have a maximum of 10 loyalty promotions with an `ACTIVE` o | Name | Type | Tags | Description | Getter | Setter | | --- | --- | --- | --- | --- | --- | | `id` | `?string` | Optional | The Square-assigned ID of the promotion.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `255` | getId(): ?string | setId(?string id): void | -| `name` | `string` | Required | The name of the promotion.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `50` | getName(): string | setName(string name): void | +| `name` | `string` | Required | The name of the promotion.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `70` | getName(): string | setName(string name): void | | `incentive` | [`LoyaltyPromotionIncentive`](../../doc/models/loyalty-promotion-incentive.md) | Required | Represents how points for a [loyalty promotion](../../doc/models/loyalty-promotion.md) are calculated,
either by multiplying the points earned from the base program or by adding a specified number
of points to the points earned from the base program. | getIncentive(): LoyaltyPromotionIncentive | setIncentive(LoyaltyPromotionIncentive incentive): void | | `availableTime` | [`LoyaltyPromotionAvailableTimeData`](../../doc/models/loyalty-promotion-available-time-data.md) | Required | Represents scheduling information that determines when purchases can qualify to earn points
from a [loyalty promotion](../../doc/models/loyalty-promotion.md). | getAvailableTime(): LoyaltyPromotionAvailableTimeData | setAvailableTime(LoyaltyPromotionAvailableTimeData availableTime): void | | `triggerLimit` | [`?LoyaltyPromotionTriggerLimit`](../../doc/models/loyalty-promotion-trigger-limit.md) | Optional | Represents the number of times a buyer can earn points during a [loyalty promotion](../../doc/models/loyalty-promotion.md).
If this field is not set, buyers can trigger the promotion an unlimited number of times to earn points during
the time that the promotion is available.

A purchase that is disqualified from earning points because of this limit might qualify for another active promotion. | getTriggerLimit(): ?LoyaltyPromotionTriggerLimit | setTriggerLimit(?LoyaltyPromotionTriggerLimit triggerLimit): void | diff --git a/doc/models/order-fulfillment-delivery-details.md b/doc/models/order-fulfillment-delivery-details.md index c131bf87..07aab339 100644 --- a/doc/models/order-fulfillment-delivery-details.md +++ b/doc/models/order-fulfillment-delivery-details.md @@ -15,8 +15,8 @@ Describes delivery details of an order fulfillment. | `scheduleType` | [`?string(OrderFulfillmentDeliveryDetailsScheduleType)`](../../doc/models/order-fulfillment-delivery-details-schedule-type.md) | Optional | The schedule type of the delivery fulfillment. | getScheduleType(): ?string | setScheduleType(?string scheduleType): void | | `placedAt` | `?string` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicating when the fulfillment was placed.
The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z").
Must be in RFC 3339 timestamp format, e.g., "2016-09-04T23:59:33.123Z". | getPlacedAt(): ?string | setPlacedAt(?string placedAt): void | | `deliverAt` | `?string` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
that represents the start of the delivery period.
When the fulfillment `schedule_type` is `ASAP`, the field is automatically
set to the current time plus the `prep_time_duration`.
Otherwise, the application can set this field while the fulfillment `state` is
`PROPOSED`, `RESERVED`, or `PREPARED` (any time before the
terminal state such as `COMPLETED`, `CANCELED`, and `FAILED`).

The timestamp must be in RFC 3339 format
(for example, "2016-09-04T23:59:33.123Z"). | getDeliverAt(): ?string | setDeliverAt(?string deliverAt): void | -| `prepTimeDuration` | `?string` | Optional | The duration of time it takes to prepare and deliver this fulfillment.
The timestamp must be in RFC 3339 format (for example, "P1W3D"). | getPrepTimeDuration(): ?string | setPrepTimeDuration(?string prepTimeDuration): void | -| `deliveryWindowDuration` | `?string` | Optional | The time period after the `deliver_at` timestamp in which to deliver the order.
Applications can set this field when the fulfillment `state` is
`PROPOSED`, `RESERVED`, or `PREPARED` (any time before the terminal state
such as `COMPLETED`, `CANCELED`, and `FAILED`).
The timestamp must be in RFC 3339 format (for example, "P1W3D"). | getDeliveryWindowDuration(): ?string | setDeliveryWindowDuration(?string deliveryWindowDuration): void | +| `prepTimeDuration` | `?string` | Optional | The duration of time it takes to prepare and deliver this fulfillment.
The duration must be in RFC 3339 format (for example, "P1W3D"). | getPrepTimeDuration(): ?string | setPrepTimeDuration(?string prepTimeDuration): void | +| `deliveryWindowDuration` | `?string` | Optional | The time period after `deliver_at` in which to deliver the order.
Applications can set this field when the fulfillment `state` is
`PROPOSED`, `RESERVED`, or `PREPARED` (any time before the terminal state
such as `COMPLETED`, `CANCELED`, and `FAILED`).
The duration must be in RFC 3339 format (for example, "P1W3D"). | getDeliveryWindowDuration(): ?string | setDeliveryWindowDuration(?string deliveryWindowDuration): void | | `note` | `?string` | Optional | Provides additional instructions about the delivery fulfillment.
It is displayed in the Square Point of Sale application and set by the API.
**Constraints**: *Maximum Length*: `550` | getNote(): ?string | setNote(?string note): void | | `completedAt` | `?string` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicates when the seller completed the fulfillment.
This field is automatically set when fulfillment `state` changes to `COMPLETED`.
The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). | getCompletedAt(): ?string | setCompletedAt(?string completedAt): void | | `inProgressAt` | `?string` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicates when the seller started processing the fulfillment.
This field is automatically set when the fulfillment `state` changes to `RESERVED`.
The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). | getInProgressAt(): ?string | setInProgressAt(?string inProgressAt): void | @@ -26,7 +26,7 @@ Describes delivery details of an order fulfillment. | `canceledAt` | `?string` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicating when the fulfillment was canceled. This field is automatically
set when the fulfillment `state` changes to `CANCELED`.

The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). | getCanceledAt(): ?string | setCanceledAt(?string canceledAt): void | | `cancelReason` | `?string` | Optional | The delivery cancellation reason. Max length: 100 characters.
**Constraints**: *Maximum Length*: `100` | getCancelReason(): ?string | setCancelReason(?string cancelReason): void | | `courierPickupAt` | `?string` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicating when an order can be picked up by the courier for delivery.
The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). | getCourierPickupAt(): ?string | setCourierPickupAt(?string courierPickupAt): void | -| `courierPickupWindowDuration` | `?string` | Optional | The period of time in which the order should be picked up by the courier after the
`courier_pickup_at` timestamp.
The time must be in RFC 3339 format (for example, "P1W3D"). | getCourierPickupWindowDuration(): ?string | setCourierPickupWindowDuration(?string courierPickupWindowDuration): void | +| `courierPickupWindowDuration` | `?string` | Optional | The time period after `courier_pickup_at` in which the courier should pick up the order.
The duration must be in RFC 3339 format (for example, "P1W3D"). | getCourierPickupWindowDuration(): ?string | setCourierPickupWindowDuration(?string courierPickupWindowDuration): void | | `isNoContactDelivery` | `?bool` | Optional | Whether the delivery is preferred to be no contact. | getIsNoContactDelivery(): ?bool | setIsNoContactDelivery(?bool isNoContactDelivery): void | | `dropoffNotes` | `?string` | Optional | A note to provide additional instructions about how to deliver the order.
**Constraints**: *Maximum Length*: `550` | getDropoffNotes(): ?string | setDropoffNotes(?string dropoffNotes): void | | `courierProviderName` | `?string` | Optional | The name of the courier provider.
**Constraints**: *Maximum Length*: `255` | getCourierProviderName(): ?string | setCourierProviderName(?string courierProviderName): void | diff --git a/doc/models/order-fulfillment-pickup-details.md b/doc/models/order-fulfillment-pickup-details.md index cb81cd66..9dcc6db7 100644 --- a/doc/models/order-fulfillment-pickup-details.md +++ b/doc/models/order-fulfillment-pickup-details.md @@ -12,15 +12,15 @@ Contains details necessary to fulfill a pickup order. | Name | Type | Tags | Description | Getter | Setter | | --- | --- | --- | --- | --- | --- | | `recipient` | [`?OrderFulfillmentRecipient`](../../doc/models/order-fulfillment-recipient.md) | Optional | Information about the fulfillment recipient. | getRecipient(): ?OrderFulfillmentRecipient | setRecipient(?OrderFulfillmentRecipient recipient): void | -| `expiresAt` | `?string` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicating when this fulfillment expires if it is not accepted. The timestamp must be in RFC 3339 format
(for example, "2016-09-04T23:59:33.123Z"). The expiration time can only be set up to 7 days in the future.
If `expires_at` is not set, this pickup fulfillment is automatically accepted when
placed. | getExpiresAt(): ?string | setExpiresAt(?string expiresAt): void | -| `autoCompleteDuration` | `?string` | Optional | The duration of time after which an open and accepted pickup fulfillment
is automatically moved to the `COMPLETED` state. The duration must be in RFC 3339
format (for example, "P1W3D").
If not set, this pickup fulfillment remains accepted until it is canceled or completed. | getAutoCompleteDuration(): ?string | setAutoCompleteDuration(?string autoCompleteDuration): void | +| `expiresAt` | `?string` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicating when this fulfillment expires if it is not marked in progress. The timestamp must be
in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). The expiration time can only be set
up to 7 days in the future. If `expires_at` is not set, any new payments attached to the order
are automatically completed. | getExpiresAt(): ?string | setExpiresAt(?string expiresAt): void | +| `autoCompleteDuration` | `?string` | Optional | The duration of time after which an in progress pickup fulfillment is automatically moved
to the `COMPLETED` state. The duration must be in RFC 3339 format (for example, "P1W3D").

If not set, this pickup fulfillment remains in progress until it is canceled or completed. | getAutoCompleteDuration(): ?string | setAutoCompleteDuration(?string autoCompleteDuration): void | | `scheduleType` | [`?string(OrderFulfillmentPickupDetailsScheduleType)`](../../doc/models/order-fulfillment-pickup-details-schedule-type.md) | Optional | The schedule type of the pickup fulfillment. | getScheduleType(): ?string | setScheduleType(?string scheduleType): void | | `pickupAt` | `?string` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
that represents the start of the pickup window. Must be in RFC 3339 timestamp format, e.g.,
"2016-09-04T23:59:33.123Z".
For fulfillments with the schedule type `ASAP`, this is automatically set
to the current time plus the expected duration to prepare the fulfillment. | getPickupAt(): ?string | setPickupAt(?string pickupAt): void | | `pickupWindowDuration` | `?string` | Optional | The window of time in which the order should be picked up after the `pickup_at` timestamp.
Must be in RFC 3339 duration format, e.g., "P1W3D". Can be used as an
informational guideline for merchants. | getPickupWindowDuration(): ?string | setPickupWindowDuration(?string pickupWindowDuration): void | | `prepTimeDuration` | `?string` | Optional | The duration of time it takes to prepare this fulfillment.
The duration must be in RFC 3339 format (for example, "P1W3D"). | getPrepTimeDuration(): ?string | setPrepTimeDuration(?string prepTimeDuration): void | | `note` | `?string` | Optional | A note to provide additional instructions about the pickup
fulfillment displayed in the Square Point of Sale application and set by the API.
**Constraints**: *Maximum Length*: `500` | getNote(): ?string | setNote(?string note): void | | `placedAt` | `?string` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicating when the fulfillment was placed. The timestamp must be in RFC 3339 format
(for example, "2016-09-04T23:59:33.123Z"). | getPlacedAt(): ?string | setPlacedAt(?string placedAt): void | -| `acceptedAt` | `?string` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicating when the fulfillment was accepted. The timestamp must be in RFC 3339 format
(for example, "2016-09-04T23:59:33.123Z"). | getAcceptedAt(): ?string | setAcceptedAt(?string acceptedAt): void | +| `acceptedAt` | `?string` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicating when the fulfillment was marked in progress. The timestamp must be in RFC 3339 format
(for example, "2016-09-04T23:59:33.123Z"). | getAcceptedAt(): ?string | setAcceptedAt(?string acceptedAt): void | | `rejectedAt` | `?string` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicating when the fulfillment was rejected. The timestamp must be in RFC 3339 format
(for example, "2016-09-04T23:59:33.123Z"). | getRejectedAt(): ?string | setRejectedAt(?string rejectedAt): void | | `readyAt` | `?string` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicating when the fulfillment is marked as ready for pickup. The timestamp must be in RFC 3339 format
(for example, "2016-09-04T23:59:33.123Z"). | getReadyAt(): ?string | setReadyAt(?string readyAt): void | | `expiredAt` | `?string` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicating when the fulfillment expired. The timestamp must be in RFC 3339 format
(for example, "2016-09-04T23:59:33.123Z"). | getExpiredAt(): ?string | setExpiredAt(?string expiredAt): void | diff --git a/doc/models/order-line-item.md b/doc/models/order-line-item.md index eff1f243..22d74059 100644 --- a/doc/models/order-line-item.md +++ b/doc/models/order-line-item.md @@ -14,9 +14,9 @@ product to purchase, with its own quantity and price details. | --- | --- | --- | --- | --- | --- | | `uid` | `?string` | Optional | A unique ID that identifies the line item only within this order.
**Constraints**: *Maximum Length*: `60` | getUid(): ?string | setUid(?string uid): void | | `name` | `?string` | Optional | The name of the line item.
**Constraints**: *Maximum Length*: `512` | getName(): ?string | setName(?string name): void | -| `quantity` | `string` | Required | The quantity purchased, formatted as a decimal number.
For example, `"3"`.

Line items with a quantity of `"0"` are automatically removed
when paying for or otherwise completing the order.

Line items with a `quantity_unit` can have non-integer quantities.
For example, `"1.70000"`.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `12` | getQuantity(): string | setQuantity(string quantity): void | +| `quantity` | `string` | Required | The count, or measurement, of a line item being purchased:

If `quantity` is a whole number, and `quantity_unit` is not specified, then `quantity` denotes an item count. For example: `3` apples.

If `quantity` is a whole or decimal number, and `quantity_unit` is also specified, then `quantity` denotes a measurement. For example: `2.25` pounds of broccoli.

For more information, see [Specify item quantity and measurement unit](https://developer.squareup.com/docs/orders-api/create-orders#specify-item-quantity-and-measurement-unit).

Line items with a quantity of `0` are automatically removed
when paying for or otherwise completing the order.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `12` | getQuantity(): string | setQuantity(string quantity): void | | `quantityUnit` | [`?OrderQuantityUnit`](../../doc/models/order-quantity-unit.md) | Optional | Contains the measurement unit for a quantity and a precision that
specifies the number of digits after the decimal point for decimal quantities. | getQuantityUnit(): ?OrderQuantityUnit | setQuantityUnit(?OrderQuantityUnit quantityUnit): void | -| `note` | `?string` | Optional | The note of the line item.
**Constraints**: *Maximum Length*: `2000` | getNote(): ?string | setNote(?string note): void | +| `note` | `?string` | Optional | An optional note associated with the line item.
**Constraints**: *Maximum Length*: `2000` | getNote(): ?string | setNote(?string note): void | | `catalogObjectId` | `?string` | Optional | The [CatalogItemVariation](entity:CatalogItemVariation) ID applied to this line item.
**Constraints**: *Maximum Length*: `192` | getCatalogObjectId(): ?string | setCatalogObjectId(?string catalogObjectId): void | | `catalogVersion` | `?int` | Optional | The version of the catalog object that this line item references. | getCatalogVersion(): ?int | setCatalogVersion(?int catalogVersion): void | | `variationName` | `?string` | Optional | The name of the variation applied to this line item.
**Constraints**: *Maximum Length*: `400` | getVariationName(): ?string | setVariationName(?string variationName): void | diff --git a/doc/models/order-return-service-charge.md b/doc/models/order-return-service-charge.md index 13ca452a..7ecc9e9a 100644 --- a/doc/models/order-return-service-charge.md +++ b/doc/models/order-return-service-charge.md @@ -26,6 +26,8 @@ Represents the service charge applied to the original order. | `appliedTaxes` | [`?(OrderLineItemAppliedTax[])`](../../doc/models/order-line-item-applied-tax.md) | Optional | The list of references to `OrderReturnTax` entities applied to the
`OrderReturnServiceCharge`. Each `OrderLineItemAppliedTax` has a `tax_uid`
that references the `uid` of a top-level `OrderReturnTax` that is being
applied to the `OrderReturnServiceCharge`. On reads, the applied amount is
populated. | getAppliedTaxes(): ?array | setAppliedTaxes(?array appliedTaxes): void | | `treatmentType` | [`?string(OrderServiceChargeTreatmentType)`](../../doc/models/order-service-charge-treatment-type.md) | Optional | Indicates whether the service charge will be treated as a value-holding line item or
apportioned toward a line item. | getTreatmentType(): ?string | setTreatmentType(?string treatmentType): void | | `scope` | [`?string(OrderServiceChargeScope)`](../../doc/models/order-service-charge-scope.md) | Optional | Indicates whether this is a line-item or order-level apportioned
service charge. | getScope(): ?string | setScope(?string scope): void | +| `appliedServiceCharges` | [`?(OrderLineItemAppliedServiceCharge[])`](../../doc/models/order-line-item-applied-service-charge.md) | Optional | The list of references to service charges applied to the`OrderReturnServiceCharge`. Each
`OrderLineItemAppliedServiceCharge` has a `service_charge_id` that references the `uid` of a
top-level `OrderReturnServiceCharge`. On reads, the amount applied is populated. | getAppliedServiceCharges(): ?array | setAppliedServiceCharges(?array appliedServiceCharges): void | +| `totalServiceChargeMoney` | [`?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. | getTotalServiceChargeMoney(): ?Money | setTotalServiceChargeMoney(?Money totalServiceChargeMoney): void | ## Example (as JSON) diff --git a/doc/models/order-return-tip.md b/doc/models/order-return-tip.md new file mode 100644 index 00000000..5560f9bf --- /dev/null +++ b/doc/models/order-return-tip.md @@ -0,0 +1,32 @@ + +# Order Return Tip + +A tip being returned. + +## Structure + +`OrderReturnTip` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `uid` | `?string` | Optional | A unique ID that identifies the tip only within this order.
**Constraints**: *Maximum Length*: `60` | getUid(): ?string | setUid(?string uid): void | +| `appliedMoney` | [`?Money`](../../doc/models/money.md) | Optional | Represents an amount of money. `Money` fields can be signed or unsigned.
Fields that do not explicitly define whether they are signed or unsigned are
considered unsigned and can only hold positive amounts. For signed fields, the
sign of the value indicates the purpose of the money transfer. See
[Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts)
for more information. | getAppliedMoney(): ?Money | setAppliedMoney(?Money appliedMoney): void | +| `sourceTenderUid` | `?string` | Optional | The tender `uid` from the order that contains the original application of this tip.
**Constraints**: *Maximum Length*: `192` | getSourceTenderUid(): ?string | setSourceTenderUid(?string sourceTenderUid): void | +| `sourceTenderId` | `?string` | Optional | The tender `id` from the order that contains the original application of this tip.
**Constraints**: *Maximum Length*: `192` | getSourceTenderId(): ?string | setSourceTenderId(?string sourceTenderId): void | + +## Example (as JSON) + +```json +{ + "uid": "uid4", + "applied_money": { + "amount": 196, + "currency": "HKD" + }, + "source_tender_uid": "source_tender_uid6", + "source_tender_id": "source_tender_id0" +} +``` + diff --git a/doc/models/order-return.md b/doc/models/order-return.md index 1684be2a..73455eda 100644 --- a/doc/models/order-return.md +++ b/doc/models/order-return.md @@ -17,6 +17,7 @@ The set of line items, service charges, taxes, discounts, tips, and other items | `returnServiceCharges` | [`?(OrderReturnServiceCharge[])`](../../doc/models/order-return-service-charge.md) | Optional | A collection of service charges that are being returned. | getReturnServiceCharges(): ?array | setReturnServiceCharges(?array returnServiceCharges): void | | `returnTaxes` | [`?(OrderReturnTax[])`](../../doc/models/order-return-tax.md) | Optional | A collection of references to taxes being returned for an order, including the total
applied tax amount to be returned. The taxes must reference a top-level tax ID from the source
order. | getReturnTaxes(): ?array | setReturnTaxes(?array returnTaxes): void | | `returnDiscounts` | [`?(OrderReturnDiscount[])`](../../doc/models/order-return-discount.md) | Optional | A collection of references to discounts being returned for an order, including the total
applied discount amount to be returned. The discounts must reference a top-level discount ID
from the source order. | getReturnDiscounts(): ?array | setReturnDiscounts(?array returnDiscounts): void | +| `returnTips` | [`?(OrderReturnTip[])`](../../doc/models/order-return-tip.md) | Optional | A collection of references to tips being returned for an order. | getReturnTips(): ?array | setReturnTips(?array returnTips): void | | `roundingAdjustment` | [`?OrderRoundingAdjustment`](../../doc/models/order-rounding-adjustment.md) | Optional | A rounding adjustment of the money being returned. Commonly used to apply cash rounding
when the minimum unit of the account is smaller than the lowest physical denomination of the currency. | getRoundingAdjustment(): ?OrderRoundingAdjustment | setRoundingAdjustment(?OrderRoundingAdjustment roundingAdjustment): void | | `returnAmounts` | [`?OrderMoneyAmounts`](../../doc/models/order-money-amounts.md) | Optional | A collection of various money amounts. | getReturnAmounts(): ?OrderMoneyAmounts | setReturnAmounts(?OrderMoneyAmounts returnAmounts): void | diff --git a/doc/models/order-service-charge.md b/doc/models/order-service-charge.md index df4b3561..5df66da4 100644 --- a/doc/models/order-service-charge.md +++ b/doc/models/order-service-charge.md @@ -27,6 +27,8 @@ Represents a service charge applied to an order. | `type` | [`?string(OrderServiceChargeType)`](../../doc/models/order-service-charge-type.md) | Optional | - | getType(): ?string | setType(?string type): void | | `treatmentType` | [`?string(OrderServiceChargeTreatmentType)`](../../doc/models/order-service-charge-treatment-type.md) | Optional | Indicates whether the service charge will be treated as a value-holding line item or
apportioned toward a line item. | getTreatmentType(): ?string | setTreatmentType(?string treatmentType): void | | `scope` | [`?string(OrderServiceChargeScope)`](../../doc/models/order-service-charge-scope.md) | Optional | Indicates whether this is a line-item or order-level apportioned
service charge. | getScope(): ?string | setScope(?string scope): void | +| `appliedServiceCharges` | [`?(OrderLineItemAppliedServiceCharge[])`](../../doc/models/order-line-item-applied-service-charge.md) | Optional | The list of references to service charges applied to this service charge. Each
`OrderLineItemAppliedServiceCharge` has a `service_charge_id` that references the `uid` of a
top-level `OrderServiceCharge`. On reads, the amount applied is populated.

To change the amount of a service charge, modify the referenced top-level service charge. | getAppliedServiceCharges(): ?array | setAppliedServiceCharges(?array appliedServiceCharges): void | +| `totalServiceChargeMoney` | [`?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. | getTotalServiceChargeMoney(): ?Money | setTotalServiceChargeMoney(?Money totalServiceChargeMoney): void | ## Example (as JSON) diff --git a/doc/models/payment-link-related-resources.md b/doc/models/payment-link-related-resources.md index 383f7952..92be9a97 100644 --- a/doc/models/payment-link-related-resources.md +++ b/doc/models/payment-link-related-resources.md @@ -130,7 +130,7 @@ ], "subscription_plans": [ { - "type": "QUICK_AMOUNTS_SETTINGS", + "type": "ITEM_OPTION", "id": "id4", "updated_at": "updated_at0", "version": 112, @@ -174,7 +174,7 @@ ] }, { - "type": "QUICK_AMOUNTS_SETTINGS", + "type": "ITEM_OPTION", "id": "id4", "updated_at": "updated_at0", "version": 112, diff --git a/doc/models/search-catalog-items-response.md b/doc/models/search-catalog-items-response.md index 85c378b5..b4dbdca4 100644 --- a/doc/models/search-catalog-items-response.md +++ b/doc/models/search-catalog-items-response.md @@ -36,7 +36,7 @@ Defines the response body returned from the [SearchCatalogItems](../../doc/apis/ ], "items": [ { - "type": "TIME_PERIOD", + "type": "SUBSCRIPTION_PLAN", "id": "id8", "updated_at": "updated_at6", "version": 38, diff --git a/doc/models/search-catalog-objects-response.md b/doc/models/search-catalog-objects-response.md index aebff61d..3057ac74 100644 --- a/doc/models/search-catalog-objects-response.md +++ b/doc/models/search-catalog-objects-response.md @@ -196,7 +196,7 @@ "cursor": "cursor6", "related_objects": [ { - "type": "MODIFIER_LIST", + "type": "SUBSCRIPTION_PLAN_VARIATION", "id": "id2", "updated_at": "updated_at2", "version": 0, diff --git a/doc/models/search-orders-customer-filter.md b/doc/models/search-orders-customer-filter.md index 2ce66c7d..19197c26 100644 --- a/doc/models/search-orders-customer-filter.md +++ b/doc/models/search-orders-customer-filter.md @@ -13,7 +13,7 @@ associated with the order. It does not filter based on the | Name | Type | Tags | Description | Getter | Setter | | --- | --- | --- | --- | --- | --- | -| `customerIds` | `?(string[])` | Optional | A list of customer IDs to filter by.

Max: 10 customer IDs. | getCustomerIds(): ?array | setCustomerIds(?array customerIds): void | +| `customerIds` | `?(string[])` | Optional | A list of customer IDs to filter by.

Max: 10 customer ids. | getCustomerIds(): ?array | setCustomerIds(?array customerIds): void | ## Example (as JSON) diff --git a/doc/models/search-orders-request.md b/doc/models/search-orders-request.md index e01050a3..dca014f7 100644 --- a/doc/models/search-orders-request.md +++ b/doc/models/search-orders-request.md @@ -1,11 +1,6 @@ # Search Orders Request -The request does not have any required fields. When given no query criteria, -`SearchOrders` returns all results for all of the seller's locations. When retrieving additional -pages using a `cursor`, the `query` must be equal to the `query` used to retrieve the first page of -results. - ## Structure `SearchOrdersRequest` @@ -14,10 +9,10 @@ results. | Name | Type | Tags | Description | Getter | Setter | | --- | --- | --- | --- | --- | --- | -| `locationIds` | `?(string[])` | Optional | The location IDs for the orders to query. All locations must belong to
the same merchant.

Min: 1 location ID.

Max: 10 location IDs. | getLocationIds(): ?array | setLocationIds(?array locationIds): void | +| `locationIds` | `?(string[])` | Optional | The location IDs for the orders to query. All locations must belong to
the same merchant.

Max: 10 location IDs. | getLocationIds(): ?array | setLocationIds(?array locationIds): 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 your original query.
For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | getCursor(): ?string | setCursor(?string cursor): void | | `query` | [`?SearchOrdersQuery`](../../doc/models/search-orders-query.md) | Optional | Contains query criteria for the search. | getQuery(): ?SearchOrdersQuery | setQuery(?SearchOrdersQuery query): 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.

Default: `500`
**Constraints**: `>= 1` | getLimit(): ?int | setLimit(?int limit): void | +| `limit` | `?int` | Optional | The maximum number of results to be returned in a single page.

Default: `500`
Max: `1000` | getLimit(): ?int | setLimit(?int limit): void | | `returnEntries` | `?bool` | Optional | A Boolean that controls the format of the search results. If `true`,
`SearchOrders` returns [OrderEntry](entity:OrderEntry) objects. If `false`, `SearchOrders`
returns complete order objects.

Default: `false`. | getReturnEntries(): ?bool | setReturnEntries(?bool returnEntries): void | ## Example (as JSON) diff --git a/doc/models/search-orders-response.md b/doc/models/search-orders-response.md index 78a40786..b14456dc 100644 --- a/doc/models/search-orders-response.md +++ b/doc/models/search-orders-response.md @@ -14,7 +14,7 @@ Either the `order_entries` or `orders` field is set, depending on whether | --- | --- | --- | --- | --- | --- | | `orderEntries` | [`?(OrderEntry[])`](../../doc/models/order-entry.md) | Optional | A list of [OrderEntries](entity:OrderEntry) that fit the query
conditions. The list is populated only if `return_entries` is set to `true` in the request. | getOrderEntries(): ?array | setOrderEntries(?array orderEntries): void | | `orders` | [`?(Order[])`](../../doc/models/order.md) | Optional | A list of
[Order](entity:Order) objects that match the query conditions. The list is populated only if
`return_entries` is set to `false` in the request. | getOrders(): ?array | setOrders(?array orders): void | -| `cursor` | `?string` | Optional | The pagination cursor to be used in a subsequent request. If unset,
this is the final response.
For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | getCursor(): ?string | setCursor(?string cursor): void | +| `cursor` | `?string` | Optional | The pagination cursor to be used in a subsequent request. If unset,
this is the final response.
For more information, see [Pagination](https://developer.squareup.com/docs/basics/build-basics/common-api-patterns/pagination). | getCursor(): ?string | setCursor(?string cursor): void | | `errors` | [`?(Error[])`](../../doc/models/error.md) | Optional | [Errors](entity:Error) encountered during the search. | getErrors(): ?array | setErrors(?array errors): void | ## Example (as JSON) diff --git a/src/Apis/CustomersApi.php b/src/Apis/CustomersApi.php index a9cc3710..e37365ad 100644 --- a/src/Apis/CustomersApi.php +++ b/src/Apis/CustomersApi.php @@ -141,7 +141,6 @@ public function searchCustomers(SearchCustomersRequest $body): ApiResponse /** * Deletes a customer profile from a business. This operation also unlinks any associated cards on file. * - * * As a best practice, include the `version` field in the request to enable [optimistic * concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic- * concurrency) control. @@ -191,8 +190,7 @@ public function retrieveCustomer(string $customerId): ApiResponse /** * Updates a customer profile. This endpoint supports sparse updates, so only new or changed fields are * required in the request. - * To add or update a field, specify the new value. To remove a field, specify `null` and include the - * `X-Clear-Null` header set to `true` + * To add or update a field, specify the new value. To remove a field, specify `null` * (recommended) or specify an empty string (string fields only). * * As a best practice, include the `version` field in the request to enable [optimistic diff --git a/src/Apis/InvoicesApi.php b/src/Apis/InvoicesApi.php index d63f97a2..2cd58f2a 100644 --- a/src/Apis/InvoicesApi.php +++ b/src/Apis/InvoicesApi.php @@ -5,6 +5,7 @@ namespace Square\Apis; use Core\Request\Parameters\BodyParam; +use Core\Request\Parameters\FormParam; use Core\Request\Parameters\HeaderParam; use Core\Request\Parameters\QueryParam; use Core\Request\Parameters\TemplateParam; @@ -12,8 +13,11 @@ use Square\Http\ApiResponse; use Square\Models\CancelInvoiceRequest; use Square\Models\CancelInvoiceResponse; +use Square\Models\CreateInvoiceAttachmentRequest; +use Square\Models\CreateInvoiceAttachmentResponse; use Square\Models\CreateInvoiceRequest; use Square\Models\CreateInvoiceResponse; +use Square\Models\DeleteInvoiceAttachmentResponse; use Square\Models\DeleteInvoiceResponse; use Square\Models\GetInvoiceResponse; use Square\Models\ListInvoicesResponse; @@ -23,6 +27,7 @@ use Square\Models\SearchInvoicesResponse; use Square\Models\UpdateInvoiceRequest; use Square\Models\UpdateInvoiceResponse; +use Square\Utils\FileWrapper; class InvoicesApi extends BaseApi { @@ -178,6 +183,71 @@ public function updateInvoice(string $invoiceId, UpdateInvoiceRequest $body): Ap return $this->execute($_reqBuilder, $_resHandler); } + /** + * Uploads a file and attaches it to an invoice. This endpoint accepts HTTP multipart/form-data file + * uploads + * with a JSON `request` part and a `file` part. The `file` part must be a `readable stream` that + * contains a file + * in a supported format: GIF, JPEG, PNG, TIFF, BMP, or PDF. + * + * Invoices can have up to 10 attachments with a total file size of 25 MB. Attachments can be added + * only to invoices + * in the `DRAFT`, `SCHEDULED`, `UNPAID`, or `PARTIALLY_PAID` state. + * + * @param string $invoiceId The ID of the [invoice](entity:Invoice) to attach the file to. + * @param CreateInvoiceAttachmentRequest|null $request Represents a + * [CreateInvoiceAttachment]($e/Invoices/CreateInvoiceAttachment) request. + * @param FileWrapper|null $imageFile + * + * @return ApiResponse Response from the API call + */ + public function createInvoiceAttachment( + string $invoiceId, + ?CreateInvoiceAttachmentRequest $request = null, + ?FileWrapper $imageFile = null + ): ApiResponse { + $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/v2/invoices/{invoice_id}/attachments') + ->auth('global') + ->parameters( + TemplateParam::init('invoice_id', $invoiceId), + FormParam::init('request', $request) + ->encodingHeader('Content-Type', 'application/json; charset=utf-8'), + FormParam::init('image_file', $imageFile)->encodingHeader('Content-Type', 'image/jpeg') + ); + + $_resHandler = $this->responseHandler()->type(CreateInvoiceAttachmentResponse::class)->returnApiResponse(); + + return $this->execute($_reqBuilder, $_resHandler); + } + + /** + * Removes an attachment from an invoice and permanently deletes the file. Attachments can be removed + * only + * from invoices in the `DRAFT`, `SCHEDULED`, `UNPAID`, or `PARTIALLY_PAID` state. + * + * @param string $invoiceId The ID of the [invoice](entity:Invoice) to delete the attachment + * from. + * @param string $attachmentId The ID of the [attachment](entity:InvoiceAttachment) to delete. + * + * @return ApiResponse Response from the API call + */ + public function deleteInvoiceAttachment(string $invoiceId, string $attachmentId): ApiResponse + { + $_reqBuilder = $this->requestBuilder( + RequestMethod::DELETE, + '/v2/invoices/{invoice_id}/attachments/{attachment_id}' + ) + ->auth('global') + ->parameters( + TemplateParam::init('invoice_id', $invoiceId), + TemplateParam::init('attachment_id', $attachmentId) + ); + + $_resHandler = $this->responseHandler()->type(DeleteInvoiceAttachmentResponse::class)->returnApiResponse(); + + return $this->execute($_reqBuilder, $_resHandler); + } + /** * Cancels an invoice. The seller cannot collect payments for * the canceled invoice. diff --git a/src/ConfigurationDefaults.php b/src/ConfigurationDefaults.php index ef84e26b..b645d9ec 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 = '2023-12-13'; + public const SQUARE_VERSION = '2024-01-18'; public const ADDITIONAL_HEADERS = []; diff --git a/src/Models/Builders/CatalogItemBuilder.php b/src/Models/Builders/CatalogItemBuilder.php index 85422e76..c6aff2b3 100644 --- a/src/Models/Builders/CatalogItemBuilder.php +++ b/src/Models/Builders/CatalogItemBuilder.php @@ -7,6 +7,7 @@ use Core\Utils\CoreHelper; use Square\Models\CatalogEcomSeoData; use Square\Models\CatalogItem; +use Square\Models\CatalogItemFoodAndBeverageDetails; use Square\Models\CatalogObjectCategory; /** @@ -403,6 +404,15 @@ public function ecomSeoData(?CatalogEcomSeoData $value): self return $this; } + /** + * Sets food and beverage details field. + */ + public function foodAndBeverageDetails(?CatalogItemFoodAndBeverageDetails $value): self + { + $this->instance->setFoodAndBeverageDetails($value); + return $this; + } + /** * Sets reporting category field. */ diff --git a/src/Models/Builders/CatalogItemFoodAndBeverageDetailsBuilder.php b/src/Models/Builders/CatalogItemFoodAndBeverageDetailsBuilder.php new file mode 100644 index 00000000..3c6e0808 --- /dev/null +++ b/src/Models/Builders/CatalogItemFoodAndBeverageDetailsBuilder.php @@ -0,0 +1,96 @@ +instance = $instance; + } + + /** + * Initializes a new catalog item food and beverage details Builder object. + */ + public static function init(): self + { + return new self(new CatalogItemFoodAndBeverageDetails()); + } + + /** + * Sets calorie count field. + */ + public function calorieCount(?int $value): self + { + $this->instance->setCalorieCount($value); + return $this; + } + + /** + * Unsets calorie count field. + */ + public function unsetCalorieCount(): self + { + $this->instance->unsetCalorieCount(); + return $this; + } + + /** + * Sets dietary preferences field. + */ + public function dietaryPreferences(?array $value): self + { + $this->instance->setDietaryPreferences($value); + return $this; + } + + /** + * Unsets dietary preferences field. + */ + public function unsetDietaryPreferences(): self + { + $this->instance->unsetDietaryPreferences(); + return $this; + } + + /** + * Sets ingredients field. + */ + public function ingredients(?array $value): self + { + $this->instance->setIngredients($value); + return $this; + } + + /** + * Unsets ingredients field. + */ + public function unsetIngredients(): self + { + $this->instance->unsetIngredients(); + return $this; + } + + /** + * Initializes a new catalog item food and beverage details object. + */ + public function build(): CatalogItemFoodAndBeverageDetails + { + return CoreHelper::clone($this->instance); + } +} diff --git a/src/Models/Builders/CatalogItemFoodAndBeverageDetailsDietaryPreferenceBuilder.php b/src/Models/Builders/CatalogItemFoodAndBeverageDetailsDietaryPreferenceBuilder.php new file mode 100644 index 00000000..2463bf20 --- /dev/null +++ b/src/Models/Builders/CatalogItemFoodAndBeverageDetailsDietaryPreferenceBuilder.php @@ -0,0 +1,78 @@ +instance = $instance; + } + + /** + * Initializes a new catalog item food and beverage details dietary preference Builder object. + */ + public static function init(): self + { + return new self(new CatalogItemFoodAndBeverageDetailsDietaryPreference()); + } + + /** + * Sets type field. + */ + public function type(?string $value): self + { + $this->instance->setType($value); + return $this; + } + + /** + * Sets standard name field. + */ + public function standardName(?string $value): self + { + $this->instance->setStandardName($value); + return $this; + } + + /** + * Sets custom name field. + */ + public function customName(?string $value): self + { + $this->instance->setCustomName($value); + return $this; + } + + /** + * Unsets custom name field. + */ + public function unsetCustomName(): self + { + $this->instance->unsetCustomName(); + return $this; + } + + /** + * Initializes a new catalog item food and beverage details dietary preference object. + */ + public function build(): CatalogItemFoodAndBeverageDetailsDietaryPreference + { + return CoreHelper::clone($this->instance); + } +} diff --git a/src/Models/Builders/CatalogItemFoodAndBeverageDetailsIngredientBuilder.php b/src/Models/Builders/CatalogItemFoodAndBeverageDetailsIngredientBuilder.php new file mode 100644 index 00000000..9c2f007a --- /dev/null +++ b/src/Models/Builders/CatalogItemFoodAndBeverageDetailsIngredientBuilder.php @@ -0,0 +1,78 @@ +instance = $instance; + } + + /** + * Initializes a new catalog item food and beverage details ingredient Builder object. + */ + public static function init(): self + { + return new self(new CatalogItemFoodAndBeverageDetailsIngredient()); + } + + /** + * Sets type field. + */ + public function type(?string $value): self + { + $this->instance->setType($value); + return $this; + } + + /** + * Sets standard name field. + */ + public function standardName(?string $value): self + { + $this->instance->setStandardName($value); + return $this; + } + + /** + * Sets custom name field. + */ + public function customName(?string $value): self + { + $this->instance->setCustomName($value); + return $this; + } + + /** + * Unsets custom name field. + */ + public function unsetCustomName(): self + { + $this->instance->unsetCustomName(); + return $this; + } + + /** + * Initializes a new catalog item food and beverage details ingredient object. + */ + public function build(): CatalogItemFoodAndBeverageDetailsIngredient + { + return CoreHelper::clone($this->instance); + } +} diff --git a/src/Models/Builders/CreateInvoiceAttachmentRequestBuilder.php b/src/Models/Builders/CreateInvoiceAttachmentRequestBuilder.php new file mode 100644 index 00000000..96207dbb --- /dev/null +++ b/src/Models/Builders/CreateInvoiceAttachmentRequestBuilder.php @@ -0,0 +1,60 @@ +instance = $instance; + } + + /** + * Initializes a new create invoice attachment request Builder object. + */ + public static function init(): self + { + return new self(new CreateInvoiceAttachmentRequest()); + } + + /** + * Sets idempotency key field. + */ + public function idempotencyKey(?string $value): self + { + $this->instance->setIdempotencyKey($value); + return $this; + } + + /** + * Sets description field. + */ + public function description(?string $value): self + { + $this->instance->setDescription($value); + return $this; + } + + /** + * Initializes a new create invoice attachment request object. + */ + public function build(): CreateInvoiceAttachmentRequest + { + return CoreHelper::clone($this->instance); + } +} diff --git a/src/Models/Builders/CreateInvoiceAttachmentResponseBuilder.php b/src/Models/Builders/CreateInvoiceAttachmentResponseBuilder.php new file mode 100644 index 00000000..0b315133 --- /dev/null +++ b/src/Models/Builders/CreateInvoiceAttachmentResponseBuilder.php @@ -0,0 +1,61 @@ +instance = $instance; + } + + /** + * Initializes a new create invoice attachment response Builder object. + */ + public static function init(): self + { + return new self(new CreateInvoiceAttachmentResponse()); + } + + /** + * Sets attachment field. + */ + public function attachment(?InvoiceAttachment $value): self + { + $this->instance->setAttachment($value); + return $this; + } + + /** + * Sets errors field. + */ + public function errors(?array $value): self + { + $this->instance->setErrors($value); + return $this; + } + + /** + * Initializes a new create invoice attachment response object. + */ + public function build(): CreateInvoiceAttachmentResponse + { + return CoreHelper::clone($this->instance); + } +} diff --git a/src/Models/Builders/DeleteInvoiceAttachmentResponseBuilder.php b/src/Models/Builders/DeleteInvoiceAttachmentResponseBuilder.php new file mode 100644 index 00000000..47bb704f --- /dev/null +++ b/src/Models/Builders/DeleteInvoiceAttachmentResponseBuilder.php @@ -0,0 +1,51 @@ +instance = $instance; + } + + /** + * Initializes a new delete invoice attachment response Builder object. + */ + public static function init(): self + { + return new self(new DeleteInvoiceAttachmentResponse()); + } + + /** + * Sets errors field. + */ + public function errors(?array $value): self + { + $this->instance->setErrors($value); + return $this; + } + + /** + * Initializes a new delete invoice attachment response object. + */ + public function build(): DeleteInvoiceAttachmentResponse + { + return CoreHelper::clone($this->instance); + } +} diff --git a/src/Models/Builders/FulfillmentBuilder.php b/src/Models/Builders/FulfillmentBuilder.php index 5469b533..cc10c9a3 100644 --- a/src/Models/Builders/FulfillmentBuilder.php +++ b/src/Models/Builders/FulfillmentBuilder.php @@ -134,6 +134,15 @@ public function deliveryDetails(?FulfillmentDeliveryDetails $value): self return $this; } + /** + * Sets version field. + */ + public function version(?int $value): self + { + $this->instance->setVersion($value); + return $this; + } + /** * Initializes a new fulfillment object. */ diff --git a/src/Models/Builders/InvoiceAttachmentBuilder.php b/src/Models/Builders/InvoiceAttachmentBuilder.php new file mode 100644 index 00000000..5eaa34f0 --- /dev/null +++ b/src/Models/Builders/InvoiceAttachmentBuilder.php @@ -0,0 +1,105 @@ +instance = $instance; + } + + /** + * Initializes a new invoice attachment Builder object. + */ + public static function init(): self + { + return new self(new InvoiceAttachment()); + } + + /** + * Sets id field. + */ + public function id(?string $value): self + { + $this->instance->setId($value); + return $this; + } + + /** + * Sets filename field. + */ + public function filename(?string $value): self + { + $this->instance->setFilename($value); + return $this; + } + + /** + * Sets description field. + */ + public function description(?string $value): self + { + $this->instance->setDescription($value); + return $this; + } + + /** + * Sets filesize field. + */ + public function filesize(?int $value): self + { + $this->instance->setFilesize($value); + return $this; + } + + /** + * Sets hash field. + */ + public function hash(?string $value): self + { + $this->instance->setHash($value); + return $this; + } + + /** + * Sets mime type field. + */ + public function mimeType(?string $value): self + { + $this->instance->setMimeType($value); + return $this; + } + + /** + * Sets uploaded at field. + */ + public function uploadedAt(?string $value): self + { + $this->instance->setUploadedAt($value); + return $this; + } + + /** + * Initializes a new invoice attachment object. + */ + public function build(): InvoiceAttachment + { + return CoreHelper::clone($this->instance); + } +} diff --git a/src/Models/Builders/InvoiceBuilder.php b/src/Models/Builders/InvoiceBuilder.php index 4f9a955e..680c6905 100644 --- a/src/Models/Builders/InvoiceBuilder.php +++ b/src/Models/Builders/InvoiceBuilder.php @@ -341,6 +341,15 @@ public function unsetStorePaymentMethodEnabled(): self return $this; } + /** + * Sets attachments field. + */ + public function attachments(?array $value): self + { + $this->instance->setAttachments($value); + return $this; + } + /** * Initializes a new invoice object. */ diff --git a/src/Models/Builders/OrderReturnBuilder.php b/src/Models/Builders/OrderReturnBuilder.php index 0ec6a14e..8715a2df 100644 --- a/src/Models/Builders/OrderReturnBuilder.php +++ b/src/Models/Builders/OrderReturnBuilder.php @@ -98,20 +98,20 @@ public function returnServiceCharges(?array $value): self } /** - * Sets return taxes field. + * Unsets return service charges field. */ - public function returnTaxes(?array $value): self + public function unsetReturnServiceCharges(): self { - $this->instance->setReturnTaxes($value); + $this->instance->unsetReturnServiceCharges(); return $this; } /** - * Unsets return taxes field. + * Sets return taxes field. */ - public function unsetReturnTaxes(): self + public function returnTaxes(?array $value): self { - $this->instance->unsetReturnTaxes(); + $this->instance->setReturnTaxes($value); return $this; } @@ -125,11 +125,20 @@ public function returnDiscounts(?array $value): self } /** - * Unsets return discounts field. + * Sets return tips field. + */ + public function returnTips(?array $value): self + { + $this->instance->setReturnTips($value); + return $this; + } + + /** + * Unsets return tips field. */ - public function unsetReturnDiscounts(): self + public function unsetReturnTips(): self { - $this->instance->unsetReturnDiscounts(); + $this->instance->unsetReturnTips(); return $this; } diff --git a/src/Models/Builders/OrderReturnServiceChargeBuilder.php b/src/Models/Builders/OrderReturnServiceChargeBuilder.php index dc7eaef2..036b3995 100644 --- a/src/Models/Builders/OrderReturnServiceChargeBuilder.php +++ b/src/Models/Builders/OrderReturnServiceChargeBuilder.php @@ -240,6 +240,33 @@ public function scope(?string $value): self return $this; } + /** + * Sets applied service charges field. + */ + public function appliedServiceCharges(?array $value): self + { + $this->instance->setAppliedServiceCharges($value); + return $this; + } + + /** + * Unsets applied service charges field. + */ + public function unsetAppliedServiceCharges(): self + { + $this->instance->unsetAppliedServiceCharges(); + return $this; + } + + /** + * Sets total service charge money field. + */ + public function totalServiceChargeMoney(?Money $value): self + { + $this->instance->setTotalServiceChargeMoney($value); + return $this; + } + /** * Initializes a new order return service charge object. */ diff --git a/src/Models/Builders/OrderReturnTipBuilder.php b/src/Models/Builders/OrderReturnTipBuilder.php new file mode 100644 index 00000000..ad6694da --- /dev/null +++ b/src/Models/Builders/OrderReturnTipBuilder.php @@ -0,0 +1,106 @@ +instance = $instance; + } + + /** + * Initializes a new order return tip Builder object. + */ + public static function init(): self + { + return new self(new OrderReturnTip()); + } + + /** + * Sets uid field. + */ + public function uid(?string $value): self + { + $this->instance->setUid($value); + return $this; + } + + /** + * Unsets uid field. + */ + public function unsetUid(): self + { + $this->instance->unsetUid(); + return $this; + } + + /** + * Sets applied money field. + */ + public function appliedMoney(?Money $value): self + { + $this->instance->setAppliedMoney($value); + return $this; + } + + /** + * Sets source tender uid field. + */ + public function sourceTenderUid(?string $value): self + { + $this->instance->setSourceTenderUid($value); + return $this; + } + + /** + * Unsets source tender uid field. + */ + public function unsetSourceTenderUid(): self + { + $this->instance->unsetSourceTenderUid(); + return $this; + } + + /** + * Sets source tender id field. + */ + public function sourceTenderId(?string $value): self + { + $this->instance->setSourceTenderId($value); + return $this; + } + + /** + * Unsets source tender id field. + */ + public function unsetSourceTenderId(): self + { + $this->instance->unsetSourceTenderId(); + return $this; + } + + /** + * Initializes a new order return tip object. + */ + public function build(): OrderReturnTip + { + return CoreHelper::clone($this->instance); + } +} diff --git a/src/Models/Builders/OrderServiceChargeBuilder.php b/src/Models/Builders/OrderServiceChargeBuilder.php index c7fff2bb..e8c2dcfe 100644 --- a/src/Models/Builders/OrderServiceChargeBuilder.php +++ b/src/Models/Builders/OrderServiceChargeBuilder.php @@ -249,6 +249,33 @@ public function scope(?string $value): self return $this; } + /** + * Sets applied service charges field. + */ + public function appliedServiceCharges(?array $value): self + { + $this->instance->setAppliedServiceCharges($value); + return $this; + } + + /** + * Unsets applied service charges field. + */ + public function unsetAppliedServiceCharges(): self + { + $this->instance->unsetAppliedServiceCharges(); + return $this; + } + + /** + * Sets total service charge money field. + */ + public function totalServiceChargeMoney(?Money $value): self + { + $this->instance->setTotalServiceChargeMoney($value); + return $this; + } + /** * Initializes a new order service charge object. */ diff --git a/src/Models/CatalogItem.php b/src/Models/CatalogItem.php index 822cf5a3..7ef0a450 100644 --- a/src/Models/CatalogItem.php +++ b/src/Models/CatalogItem.php @@ -122,6 +122,11 @@ class CatalogItem implements \JsonSerializable */ private $ecomSeoData; + /** + * @var CatalogItemFoodAndBeverageDetails|null + */ + private $foodAndBeverageDetails; + /** * @var CatalogObjectCategory|null */ @@ -1023,6 +1028,26 @@ public function setEcomSeoData(?CatalogEcomSeoData $ecomSeoData): void $this->ecomSeoData = $ecomSeoData; } + /** + * Returns Food and Beverage Details. + * The food and beverage-specific details of a `FOOD_AND_BEV` item. + */ + public function getFoodAndBeverageDetails(): ?CatalogItemFoodAndBeverageDetails + { + return $this->foodAndBeverageDetails; + } + + /** + * Sets Food and Beverage Details. + * The food and beverage-specific details of a `FOOD_AND_BEV` item. + * + * @maps food_and_beverage_details + */ + public function setFoodAndBeverageDetails(?CatalogItemFoodAndBeverageDetails $foodAndBeverageDetails): void + { + $this->foodAndBeverageDetails = $foodAndBeverageDetails; + } + /** * Returns Reporting Category. * A category that can be assigned to an item or a parent category that can be assigned @@ -1060,73 +1085,76 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; if (!empty($this->name)) { - $json['name'] = $this->name['value']; + $json['name'] = $this->name['value']; } if (!empty($this->description)) { - $json['description'] = $this->description['value']; + $json['description'] = $this->description['value']; } if (!empty($this->abbreviation)) { - $json['abbreviation'] = $this->abbreviation['value']; + $json['abbreviation'] = $this->abbreviation['value']; } if (!empty($this->labelColor)) { - $json['label_color'] = $this->labelColor['value']; + $json['label_color'] = $this->labelColor['value']; } if (!empty($this->availableOnline)) { - $json['available_online'] = $this->availableOnline['value']; + $json['available_online'] = $this->availableOnline['value']; } if (!empty($this->availableForPickup)) { - $json['available_for_pickup'] = $this->availableForPickup['value']; + $json['available_for_pickup'] = $this->availableForPickup['value']; } if (!empty($this->availableElectronically)) { - $json['available_electronically'] = $this->availableElectronically['value']; + $json['available_electronically'] = $this->availableElectronically['value']; } if (!empty($this->categoryId)) { - $json['category_id'] = $this->categoryId['value']; + $json['category_id'] = $this->categoryId['value']; } if (!empty($this->taxIds)) { - $json['tax_ids'] = $this->taxIds['value']; + $json['tax_ids'] = $this->taxIds['value']; } if (!empty($this->modifierListInfo)) { - $json['modifier_list_info'] = $this->modifierListInfo['value']; + $json['modifier_list_info'] = $this->modifierListInfo['value']; } if (!empty($this->variations)) { - $json['variations'] = $this->variations['value']; + $json['variations'] = $this->variations['value']; } if (isset($this->productType)) { - $json['product_type'] = $this->productType; + $json['product_type'] = $this->productType; } if (!empty($this->skipModifierScreen)) { - $json['skip_modifier_screen'] = $this->skipModifierScreen['value']; + $json['skip_modifier_screen'] = $this->skipModifierScreen['value']; } if (!empty($this->itemOptions)) { - $json['item_options'] = $this->itemOptions['value']; + $json['item_options'] = $this->itemOptions['value']; } if (!empty($this->imageIds)) { - $json['image_ids'] = $this->imageIds['value']; + $json['image_ids'] = $this->imageIds['value']; } if (!empty($this->sortName)) { - $json['sort_name'] = $this->sortName['value']; + $json['sort_name'] = $this->sortName['value']; } if (!empty($this->categories)) { - $json['categories'] = $this->categories['value']; + $json['categories'] = $this->categories['value']; } if (!empty($this->descriptionHtml)) { - $json['description_html'] = $this->descriptionHtml['value']; + $json['description_html'] = $this->descriptionHtml['value']; } if (isset($this->descriptionPlaintext)) { - $json['description_plaintext'] = $this->descriptionPlaintext; + $json['description_plaintext'] = $this->descriptionPlaintext; } if (!empty($this->channels)) { - $json['channels'] = $this->channels['value']; + $json['channels'] = $this->channels['value']; } if (!empty($this->isArchived)) { - $json['is_archived'] = $this->isArchived['value']; + $json['is_archived'] = $this->isArchived['value']; } if (isset($this->ecomSeoData)) { - $json['ecom_seo_data'] = $this->ecomSeoData; + $json['ecom_seo_data'] = $this->ecomSeoData; + } + if (isset($this->foodAndBeverageDetails)) { + $json['food_and_beverage_details'] = $this->foodAndBeverageDetails; } if (isset($this->reportingCategory)) { - $json['reporting_category'] = $this->reportingCategory; + $json['reporting_category'] = $this->reportingCategory; } $json = array_filter($json, function ($val) { return $val !== null; diff --git a/src/Models/CatalogItemFoodAndBeverageDetails.php b/src/Models/CatalogItemFoodAndBeverageDetails.php new file mode 100644 index 00000000..20b3ca21 --- /dev/null +++ b/src/Models/CatalogItemFoodAndBeverageDetails.php @@ -0,0 +1,160 @@ +calorieCount) == 0) { + return null; + } + return $this->calorieCount['value']; + } + + /** + * Sets Calorie Count. + * The calorie count (in the unit of kcal) for the `FOOD_AND_BEV` type of items. + * + * @maps calorie_count + */ + public function setCalorieCount(?int $calorieCount): void + { + $this->calorieCount['value'] = $calorieCount; + } + + /** + * Unsets Calorie Count. + * The calorie count (in the unit of kcal) for the `FOOD_AND_BEV` type of items. + */ + public function unsetCalorieCount(): void + { + $this->calorieCount = []; + } + + /** + * Returns Dietary Preferences. + * The dietary preferences for the `FOOD_AND_BEV` item. + * + * @return CatalogItemFoodAndBeverageDetailsDietaryPreference[]|null + */ + public function getDietaryPreferences(): ?array + { + if (count($this->dietaryPreferences) == 0) { + return null; + } + return $this->dietaryPreferences['value']; + } + + /** + * Sets Dietary Preferences. + * The dietary preferences for the `FOOD_AND_BEV` item. + * + * @maps dietary_preferences + * + * @param CatalogItemFoodAndBeverageDetailsDietaryPreference[]|null $dietaryPreferences + */ + public function setDietaryPreferences(?array $dietaryPreferences): void + { + $this->dietaryPreferences['value'] = $dietaryPreferences; + } + + /** + * Unsets Dietary Preferences. + * The dietary preferences for the `FOOD_AND_BEV` item. + */ + public function unsetDietaryPreferences(): void + { + $this->dietaryPreferences = []; + } + + /** + * Returns Ingredients. + * The ingredients for the `FOOD_AND_BEV` type item. + * + * @return CatalogItemFoodAndBeverageDetailsIngredient[]|null + */ + public function getIngredients(): ?array + { + if (count($this->ingredients) == 0) { + return null; + } + return $this->ingredients['value']; + } + + /** + * Sets Ingredients. + * The ingredients for the `FOOD_AND_BEV` type item. + * + * @maps ingredients + * + * @param CatalogItemFoodAndBeverageDetailsIngredient[]|null $ingredients + */ + public function setIngredients(?array $ingredients): void + { + $this->ingredients['value'] = $ingredients; + } + + /** + * Unsets Ingredients. + * The ingredients for the `FOOD_AND_BEV` type item. + */ + public function unsetIngredients(): void + { + $this->ingredients = []; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + if (!empty($this->calorieCount)) { + $json['calorie_count'] = $this->calorieCount['value']; + } + if (!empty($this->dietaryPreferences)) { + $json['dietary_preferences'] = $this->dietaryPreferences['value']; + } + if (!empty($this->ingredients)) { + $json['ingredients'] = $this->ingredients['value']; + } + $json = array_filter($json, function ($val) { + return $val !== null; + }); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/CatalogItemFoodAndBeverageDetailsDietaryPreference.php b/src/Models/CatalogItemFoodAndBeverageDetailsDietaryPreference.php new file mode 100644 index 00000000..eacb6bf1 --- /dev/null +++ b/src/Models/CatalogItemFoodAndBeverageDetailsDietaryPreference.php @@ -0,0 +1,131 @@ +type; + } + + /** + * Sets Type. + * The type of dietary preference for the `FOOD_AND_BEV` type of items and integredients. + * + * @maps type + */ + public function setType(?string $type): void + { + $this->type = $type; + } + + /** + * Returns Standard Name. + * Standard dietary preferences for food and beverage items that are recommended on item creation. + */ + public function getStandardName(): ?string + { + return $this->standardName; + } + + /** + * Sets Standard Name. + * Standard dietary preferences for food and beverage items that are recommended on item creation. + * + * @maps standard_name + */ + public function setStandardName(?string $standardName): void + { + $this->standardName = $standardName; + } + + /** + * Returns Custom Name. + * The name of a user-defined custom dietary preference. This should be null if it's a standard dietary + * preference. + */ + public function getCustomName(): ?string + { + if (count($this->customName) == 0) { + return null; + } + return $this->customName['value']; + } + + /** + * Sets Custom Name. + * The name of a user-defined custom dietary preference. This should be null if it's a standard dietary + * preference. + * + * @maps custom_name + */ + public function setCustomName(?string $customName): void + { + $this->customName['value'] = $customName; + } + + /** + * Unsets Custom Name. + * The name of a user-defined custom dietary preference. This should be null if it's a standard dietary + * preference. + */ + public function unsetCustomName(): void + { + $this->customName = []; + } + + /** + * 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->standardName)) { + $json['standard_name'] = $this->standardName; + } + if (!empty($this->customName)) { + $json['custom_name'] = $this->customName['value']; + } + $json = array_filter($json, function ($val) { + return $val !== null; + }); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreference.php b/src/Models/CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreference.php new file mode 100644 index 00000000..7640fbfb --- /dev/null +++ b/src/Models/CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreference.php @@ -0,0 +1,25 @@ +type; + } + + /** + * Sets Type. + * The type of dietary preference for the `FOOD_AND_BEV` type of items and integredients. + * + * @maps type + */ + public function setType(?string $type): void + { + $this->type = $type; + } + + /** + * Returns Standard Name. + * Standard ingredients for food and beverage items that are recommended on item creation. + */ + public function getStandardName(): ?string + { + return $this->standardName; + } + + /** + * Sets Standard Name. + * Standard ingredients for food and beverage items that are recommended on item creation. + * + * @maps standard_name + */ + public function setStandardName(?string $standardName): void + { + $this->standardName = $standardName; + } + + /** + * Returns Custom Name. + * The name of a custom user-defined ingredient. This should be null if it's a standard dietary + * preference. + */ + public function getCustomName(): ?string + { + if (count($this->customName) == 0) { + return null; + } + return $this->customName['value']; + } + + /** + * Sets Custom Name. + * The name of a custom user-defined ingredient. This should be null if it's a standard dietary + * preference. + * + * @maps custom_name + */ + public function setCustomName(?string $customName): void + { + $this->customName['value'] = $customName; + } + + /** + * Unsets Custom Name. + * The name of a custom user-defined ingredient. This should be null if it's a standard dietary + * preference. + */ + public function unsetCustomName(): void + { + $this->customName = []; + } + + /** + * 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->standardName)) { + $json['standard_name'] = $this->standardName; + } + if (!empty($this->customName)) { + $json['custom_name'] = $this->customName['value']; + } + $json = array_filter($json, function ($val) { + return $val !== null; + }); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient.php b/src/Models/CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient.php new file mode 100644 index 00000000..b3fc63c2 --- /dev/null +++ b/src/Models/CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient.php @@ -0,0 +1,39 @@ +idempotencyKey; + } + + /** + * Sets Idempotency Key. + * A unique string that identifies the `CreateInvoiceAttachment` request. + * For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api- + * patterns/idempotency). + * + * @maps idempotency_key + */ + public function setIdempotencyKey(?string $idempotencyKey): void + { + $this->idempotencyKey = $idempotencyKey; + } + + /** + * Returns Description. + * The description of the attachment to display on the invoice. + */ + public function getDescription(): ?string + { + return $this->description; + } + + /** + * Sets Description. + * The description of the attachment to display on the invoice. + * + * @maps description + */ + public function setDescription(?string $description): void + { + $this->description = $description; + } + + /** + * 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->idempotencyKey)) { + $json['idempotency_key'] = $this->idempotencyKey; + } + if (isset($this->description)) { + $json['description'] = $this->description; + } + $json = array_filter($json, function ($val) { + return $val !== null; + }); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/CreateInvoiceAttachmentResponse.php b/src/Models/CreateInvoiceAttachmentResponse.php new file mode 100644 index 00000000..24b71440 --- /dev/null +++ b/src/Models/CreateInvoiceAttachmentResponse.php @@ -0,0 +1,92 @@ +attachment; + } + + /** + * Sets Attachment. + * Represents a file attached to an [invoice]($m/Invoice). + * + * @maps attachment + */ + public function setAttachment(?InvoiceAttachment $attachment): void + { + $this->attachment = $attachment; + } + + /** + * 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->attachment)) { + $json['attachment'] = $this->attachment; + } + 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/DeleteInvoiceAttachmentResponse.php b/src/Models/DeleteInvoiceAttachmentResponse.php new file mode 100644 index 00000000..41b58522 --- /dev/null +++ b/src/Models/DeleteInvoiceAttachmentResponse.php @@ -0,0 +1,64 @@ +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->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/Fulfillment.php b/src/Models/Fulfillment.php index a7c771ab..b42f1481 100644 --- a/src/Models/Fulfillment.php +++ b/src/Models/Fulfillment.php @@ -59,6 +59,11 @@ class Fulfillment implements \JsonSerializable */ private $deliveryDetails; + /** + * @var int|null + */ + private $version; + /** * Returns Uid. * A unique ID that identifies the fulfillment only within this order. @@ -344,6 +349,30 @@ public function setDeliveryDetails(?FulfillmentDeliveryDetails $deliveryDetails) $this->deliveryDetails = $deliveryDetails; } + /** + * Returns Version. + * The version number attributed to the fulfillment and incremented every time there is a + * fulfillment-related update. The fulfillment version is an internal field only for use + * between Orders and the Fulfillment service. + */ + public function getVersion(): ?int + { + return $this->version; + } + + /** + * Sets Version. + * The version number attributed to the fulfillment and incremented every time there is a + * fulfillment-related update. The fulfillment version is an internal field only for use + * between Orders and the Fulfillment service. + * + * @maps version + */ + public function setVersion(?int $version): void + { + $this->version = $version; + } + /** * Encode this object to JSON * @@ -383,6 +412,9 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) if (isset($this->deliveryDetails)) { $json['delivery_details'] = $this->deliveryDetails; } + if (isset($this->version)) { + $json['version'] = $this->version; + } $json = array_filter($json, function ($val) { return $val !== null; }); diff --git a/src/Models/FulfillmentDeliveryDetails.php b/src/Models/FulfillmentDeliveryDetails.php index 93671fc0..385fc1b1 100644 --- a/src/Models/FulfillmentDeliveryDetails.php +++ b/src/Models/FulfillmentDeliveryDetails.php @@ -256,7 +256,7 @@ public function unsetDeliverAt(): void /** * Returns Prep Time Duration. * The duration of time it takes to prepare and deliver this fulfillment. - * The timestamp must be in RFC 3339 format (for example, "P1W3D"). + * The duration must be in RFC 3339 format (for example, "P1W3D"). */ public function getPrepTimeDuration(): ?string { @@ -269,7 +269,7 @@ public function getPrepTimeDuration(): ?string /** * Sets Prep Time Duration. * The duration of time it takes to prepare and deliver this fulfillment. - * The timestamp must be in RFC 3339 format (for example, "P1W3D"). + * The duration must be in RFC 3339 format (for example, "P1W3D"). * * @maps prep_time_duration */ @@ -281,7 +281,7 @@ public function setPrepTimeDuration(?string $prepTimeDuration): void /** * Unsets Prep Time Duration. * The duration of time it takes to prepare and deliver this fulfillment. - * The timestamp must be in RFC 3339 format (for example, "P1W3D"). + * The duration must be in RFC 3339 format (for example, "P1W3D"). */ public function unsetPrepTimeDuration(): void { @@ -290,12 +290,12 @@ public function unsetPrepTimeDuration(): void /** * Returns Delivery Window Duration. - * The time period after the `deliver_at` timestamp in which to deliver the order. + * The time period after `deliver_at` in which to deliver the order. * Applications can set this field when the fulfillment `state` is * `PROPOSED`, `RESERVED`, or `PREPARED` (any time before the terminal state * such as `COMPLETED`, `CANCELED`, and `FAILED`). * - * The timestamp must be in RFC 3339 format (for example, "P1W3D"). + * The duration must be in RFC 3339 format (for example, "P1W3D"). */ public function getDeliveryWindowDuration(): ?string { @@ -307,12 +307,12 @@ public function getDeliveryWindowDuration(): ?string /** * Sets Delivery Window Duration. - * The time period after the `deliver_at` timestamp in which to deliver the order. + * The time period after `deliver_at` in which to deliver the order. * Applications can set this field when the fulfillment `state` is * `PROPOSED`, `RESERVED`, or `PREPARED` (any time before the terminal state * such as `COMPLETED`, `CANCELED`, and `FAILED`). * - * The timestamp must be in RFC 3339 format (for example, "P1W3D"). + * The duration must be in RFC 3339 format (for example, "P1W3D"). * * @maps delivery_window_duration */ @@ -323,12 +323,12 @@ public function setDeliveryWindowDuration(?string $deliveryWindowDuration): void /** * Unsets Delivery Window Duration. - * The time period after the `deliver_at` timestamp in which to deliver the order. + * The time period after `deliver_at` in which to deliver the order. * Applications can set this field when the fulfillment `state` is * `PROPOSED`, `RESERVED`, or `PREPARED` (any time before the terminal state * such as `COMPLETED`, `CANCELED`, and `FAILED`). * - * The timestamp must be in RFC 3339 format (for example, "P1W3D"). + * The duration must be in RFC 3339 format (for example, "P1W3D"). */ public function unsetDeliveryWindowDuration(): void { @@ -615,9 +615,8 @@ public function unsetCourierPickupAt(): void /** * Returns Courier Pickup Window Duration. - * The period of time in which the order should be picked up by the courier after the - * `courier_pickup_at` timestamp. - * The time must be in RFC 3339 format (for example, "P1W3D"). + * The time period after `courier_pickup_at` in which the courier should pick up the order. + * The duration must be in RFC 3339 format (for example, "P1W3D"). */ public function getCourierPickupWindowDuration(): ?string { @@ -629,9 +628,8 @@ public function getCourierPickupWindowDuration(): ?string /** * Sets Courier Pickup Window Duration. - * The period of time in which the order should be picked up by the courier after the - * `courier_pickup_at` timestamp. - * The time must be in RFC 3339 format (for example, "P1W3D"). + * The time period after `courier_pickup_at` in which the courier should pick up the order. + * The duration must be in RFC 3339 format (for example, "P1W3D"). * * @maps courier_pickup_window_duration */ @@ -642,9 +640,8 @@ public function setCourierPickupWindowDuration(?string $courierPickupWindowDurat /** * Unsets Courier Pickup Window Duration. - * The period of time in which the order should be picked up by the courier after the - * `courier_pickup_at` timestamp. - * The time must be in RFC 3339 format (for example, "P1W3D"). + * The time period after `courier_pickup_at` in which the courier should pick up the order. + * The duration must be in RFC 3339 format (for example, "P1W3D"). */ public function unsetCourierPickupWindowDuration(): void { diff --git a/src/Models/FulfillmentPickupDetails.php b/src/Models/FulfillmentPickupDetails.php index 4e67144b..8e4d2994 100644 --- a/src/Models/FulfillmentPickupDetails.php +++ b/src/Models/FulfillmentPickupDetails.php @@ -124,12 +124,10 @@ public function setRecipient(?FulfillmentRecipient $recipient): void /** * Returns Expires At. * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - * indicating when this fulfillment expires if it is not accepted. The timestamp must be in RFC 3339 - * format - * (for example, "2016-09-04T23:59:33.123Z"). The expiration time can only be set up to 7 days in the - * future. - * If `expires_at` is not set, this pickup fulfillment is automatically accepted when - * placed. + * indicating when this fulfillment expires if it is not marked in progress. The timestamp must be + * in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). The expiration time can only be set + * up to 7 days in the future. If `expires_at` is not set, any new payments attached to the order + * are automatically completed. */ public function getExpiresAt(): ?string { @@ -142,12 +140,10 @@ public function getExpiresAt(): ?string /** * Sets Expires At. * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - * indicating when this fulfillment expires if it is not accepted. The timestamp must be in RFC 3339 - * format - * (for example, "2016-09-04T23:59:33.123Z"). The expiration time can only be set up to 7 days in the - * future. - * If `expires_at` is not set, this pickup fulfillment is automatically accepted when - * placed. + * indicating when this fulfillment expires if it is not marked in progress. The timestamp must be + * in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). The expiration time can only be set + * up to 7 days in the future. If `expires_at` is not set, any new payments attached to the order + * are automatically completed. * * @maps expires_at */ @@ -159,12 +155,10 @@ public function setExpiresAt(?string $expiresAt): void /** * Unsets Expires At. * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - * indicating when this fulfillment expires if it is not accepted. The timestamp must be in RFC 3339 - * format - * (for example, "2016-09-04T23:59:33.123Z"). The expiration time can only be set up to 7 days in the - * future. - * If `expires_at` is not set, this pickup fulfillment is automatically accepted when - * placed. + * indicating when this fulfillment expires if it is not marked in progress. The timestamp must be + * in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). The expiration time can only be set + * up to 7 days in the future. If `expires_at` is not set, any new payments attached to the order + * are automatically completed. */ public function unsetExpiresAt(): void { @@ -173,11 +167,10 @@ public function unsetExpiresAt(): void /** * Returns Auto Complete Duration. - * The duration of time after which an open and accepted pickup fulfillment - * is automatically moved to the `COMPLETED` state. The duration must be in RFC 3339 - * format (for example, "P1W3D"). + * The duration of time after which an in progress pickup fulfillment is automatically moved + * to the `COMPLETED` state. The duration must be in RFC 3339 format (for example, "P1W3D"). * - * If not set, this pickup fulfillment remains accepted until it is canceled or completed. + * If not set, this pickup fulfillment remains in progress until it is canceled or completed. */ public function getAutoCompleteDuration(): ?string { @@ -189,11 +182,10 @@ public function getAutoCompleteDuration(): ?string /** * Sets Auto Complete Duration. - * The duration of time after which an open and accepted pickup fulfillment - * is automatically moved to the `COMPLETED` state. The duration must be in RFC 3339 - * format (for example, "P1W3D"). + * The duration of time after which an in progress pickup fulfillment is automatically moved + * to the `COMPLETED` state. The duration must be in RFC 3339 format (for example, "P1W3D"). * - * If not set, this pickup fulfillment remains accepted until it is canceled or completed. + * If not set, this pickup fulfillment remains in progress until it is canceled or completed. * * @maps auto_complete_duration */ @@ -204,11 +196,10 @@ public function setAutoCompleteDuration(?string $autoCompleteDuration): void /** * Unsets Auto Complete Duration. - * The duration of time after which an open and accepted pickup fulfillment - * is automatically moved to the `COMPLETED` state. The duration must be in RFC 3339 - * format (for example, "P1W3D"). + * The duration of time after which an in progress pickup fulfillment is automatically moved + * to the `COMPLETED` state. The duration must be in RFC 3339 format (for example, "P1W3D"). * - * If not set, this pickup fulfillment remains accepted until it is canceled or completed. + * If not set, this pickup fulfillment remains in progress until it is canceled or completed. */ public function unsetAutoCompleteDuration(): void { @@ -417,7 +408,7 @@ public function setPlacedAt(?string $placedAt): void /** * Returns Accepted At. * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - * indicating when the fulfillment was accepted. The timestamp must be in RFC 3339 format + * indicating when the fulfillment was marked in progress. The timestamp must be in RFC 3339 format * (for example, "2016-09-04T23:59:33.123Z"). */ public function getAcceptedAt(): ?string @@ -428,7 +419,7 @@ public function getAcceptedAt(): ?string /** * Sets Accepted At. * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - * indicating when the fulfillment was accepted. The timestamp must be in RFC 3339 format + * indicating when the fulfillment was marked in progress. The timestamp must be in RFC 3339 format * (for example, "2016-09-04T23:59:33.123Z"). * * @maps accepted_at diff --git a/src/Models/Invoice.php b/src/Models/Invoice.php index 95207a0c..1114ad2b 100644 --- a/src/Models/Invoice.php +++ b/src/Models/Invoice.php @@ -128,6 +128,11 @@ class Invoice implements \JsonSerializable */ private $storePaymentMethodEnabled = []; + /** + * @var InvoiceAttachment[]|null + */ + private $attachments; + /** * Returns Id. * The Square-assigned ID of the invoice. @@ -931,6 +936,34 @@ public function unsetStorePaymentMethodEnabled(): void $this->storePaymentMethodEnabled = []; } + /** + * Returns Attachments. + * Metadata about the attachments on the invoice. Invoice attachments are managed using the + * [CreateInvoiceAttachment](api-endpoint:Invoices-CreateInvoiceAttachment) and + * [DeleteInvoiceAttachment](api-endpoint:Invoices-DeleteInvoiceAttachment) endpoints. + * + * @return InvoiceAttachment[]|null + */ + public function getAttachments(): ?array + { + return $this->attachments; + } + + /** + * Sets Attachments. + * Metadata about the attachments on the invoice. Invoice attachments are managed using the + * [CreateInvoiceAttachment](api-endpoint:Invoices-CreateInvoiceAttachment) and + * [DeleteInvoiceAttachment](api-endpoint:Invoices-DeleteInvoiceAttachment) endpoints. + * + * @maps attachments + * + * @param InvoiceAttachment[]|null $attachments + */ + public function setAttachments(?array $attachments): void + { + $this->attachments = $attachments; + } + /** * Encode this object to JSON * @@ -1012,6 +1045,9 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) if (!empty($this->storePaymentMethodEnabled)) { $json['store_payment_method_enabled'] = $this->storePaymentMethodEnabled['value']; } + if (isset($this->attachments)) { + $json['attachments'] = $this->attachments; + } $json = array_filter($json, function ($val) { return $val !== null; }); diff --git a/src/Models/InvoiceAttachment.php b/src/Models/InvoiceAttachment.php new file mode 100644 index 00000000..06cb4ae2 --- /dev/null +++ b/src/Models/InvoiceAttachment.php @@ -0,0 +1,234 @@ +id; + } + + /** + * Sets Id. + * The Square-assigned ID of the attachment. + * + * @maps id + */ + public function setId(?string $id): void + { + $this->id = $id; + } + + /** + * Returns Filename. + * The file name of the attachment, which is displayed on the invoice. + */ + public function getFilename(): ?string + { + return $this->filename; + } + + /** + * Sets Filename. + * The file name of the attachment, which is displayed on the invoice. + * + * @maps filename + */ + public function setFilename(?string $filename): void + { + $this->filename = $filename; + } + + /** + * Returns Description. + * The description of the attachment, which is displayed on the invoice. + * This field maps to the seller-defined **Message** field. + */ + public function getDescription(): ?string + { + return $this->description; + } + + /** + * Sets Description. + * The description of the attachment, which is displayed on the invoice. + * This field maps to the seller-defined **Message** field. + * + * @maps description + */ + public function setDescription(?string $description): void + { + $this->description = $description; + } + + /** + * Returns Filesize. + * The file size of the attachment in bytes. + */ + public function getFilesize(): ?int + { + return $this->filesize; + } + + /** + * Sets Filesize. + * The file size of the attachment in bytes. + * + * @maps filesize + */ + public function setFilesize(?int $filesize): void + { + $this->filesize = $filesize; + } + + /** + * Returns Hash. + * The MD5 hash that was generated from the file contents. + */ + public function getHash(): ?string + { + return $this->hash; + } + + /** + * Sets Hash. + * The MD5 hash that was generated from the file contents. + * + * @maps hash + */ + public function setHash(?string $hash): void + { + $this->hash = $hash; + } + + /** + * Returns Mime Type. + * The mime type of the attachment. + * The following mime types are supported: + * image/gif, image/jpeg, image/png, image/tiff, image/bmp, application/pdf. + */ + public function getMimeType(): ?string + { + return $this->mimeType; + } + + /** + * Sets Mime Type. + * The mime type of the attachment. + * The following mime types are supported: + * image/gif, image/jpeg, image/png, image/tiff, image/bmp, application/pdf. + * + * @maps mime_type + */ + public function setMimeType(?string $mimeType): void + { + $this->mimeType = $mimeType; + } + + /** + * Returns Uploaded At. + * The timestamp when the attachment was uploaded, in RFC 3339 format. + */ + public function getUploadedAt(): ?string + { + return $this->uploadedAt; + } + + /** + * Sets Uploaded At. + * The timestamp when the attachment was uploaded, in RFC 3339 format. + * + * @maps uploaded_at + */ + public function setUploadedAt(?string $uploadedAt): void + { + $this->uploadedAt = $uploadedAt; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + if (isset($this->id)) { + $json['id'] = $this->id; + } + if (isset($this->filename)) { + $json['filename'] = $this->filename; + } + if (isset($this->description)) { + $json['description'] = $this->description; + } + if (isset($this->filesize)) { + $json['filesize'] = $this->filesize; + } + if (isset($this->hash)) { + $json['hash'] = $this->hash; + } + if (isset($this->mimeType)) { + $json['mime_type'] = $this->mimeType; + } + if (isset($this->uploadedAt)) { + $json['uploaded_at'] = $this->uploadedAt; + } + $json = array_filter($json, function ($val) { + return $val !== null; + }); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/OrderFulfillmentDeliveryDetails.php b/src/Models/OrderFulfillmentDeliveryDetails.php index 3e4cad47..72ab286f 100644 --- a/src/Models/OrderFulfillmentDeliveryDetails.php +++ b/src/Models/OrderFulfillmentDeliveryDetails.php @@ -254,7 +254,7 @@ public function unsetDeliverAt(): void /** * Returns Prep Time Duration. * The duration of time it takes to prepare and deliver this fulfillment. - * The timestamp must be in RFC 3339 format (for example, "P1W3D"). + * The duration must be in RFC 3339 format (for example, "P1W3D"). */ public function getPrepTimeDuration(): ?string { @@ -267,7 +267,7 @@ public function getPrepTimeDuration(): ?string /** * Sets Prep Time Duration. * The duration of time it takes to prepare and deliver this fulfillment. - * The timestamp must be in RFC 3339 format (for example, "P1W3D"). + * The duration must be in RFC 3339 format (for example, "P1W3D"). * * @maps prep_time_duration */ @@ -279,7 +279,7 @@ public function setPrepTimeDuration(?string $prepTimeDuration): void /** * Unsets Prep Time Duration. * The duration of time it takes to prepare and deliver this fulfillment. - * The timestamp must be in RFC 3339 format (for example, "P1W3D"). + * The duration must be in RFC 3339 format (for example, "P1W3D"). */ public function unsetPrepTimeDuration(): void { @@ -288,11 +288,11 @@ public function unsetPrepTimeDuration(): void /** * Returns Delivery Window Duration. - * The time period after the `deliver_at` timestamp in which to deliver the order. + * The time period after `deliver_at` in which to deliver the order. * Applications can set this field when the fulfillment `state` is * `PROPOSED`, `RESERVED`, or `PREPARED` (any time before the terminal state * such as `COMPLETED`, `CANCELED`, and `FAILED`). - * The timestamp must be in RFC 3339 format (for example, "P1W3D"). + * The duration must be in RFC 3339 format (for example, "P1W3D"). */ public function getDeliveryWindowDuration(): ?string { @@ -304,11 +304,11 @@ public function getDeliveryWindowDuration(): ?string /** * Sets Delivery Window Duration. - * The time period after the `deliver_at` timestamp in which to deliver the order. + * The time period after `deliver_at` in which to deliver the order. * Applications can set this field when the fulfillment `state` is * `PROPOSED`, `RESERVED`, or `PREPARED` (any time before the terminal state * such as `COMPLETED`, `CANCELED`, and `FAILED`). - * The timestamp must be in RFC 3339 format (for example, "P1W3D"). + * The duration must be in RFC 3339 format (for example, "P1W3D"). * * @maps delivery_window_duration */ @@ -319,11 +319,11 @@ public function setDeliveryWindowDuration(?string $deliveryWindowDuration): void /** * Unsets Delivery Window Duration. - * The time period after the `deliver_at` timestamp in which to deliver the order. + * The time period after `deliver_at` in which to deliver the order. * Applications can set this field when the fulfillment `state` is * `PROPOSED`, `RESERVED`, or `PREPARED` (any time before the terminal state * such as `COMPLETED`, `CANCELED`, and `FAILED`). - * The timestamp must be in RFC 3339 format (for example, "P1W3D"). + * The duration must be in RFC 3339 format (for example, "P1W3D"). */ public function unsetDeliveryWindowDuration(): void { @@ -610,9 +610,8 @@ public function unsetCourierPickupAt(): void /** * Returns Courier Pickup Window Duration. - * The period of time in which the order should be picked up by the courier after the - * `courier_pickup_at` timestamp. - * The time must be in RFC 3339 format (for example, "P1W3D"). + * The time period after `courier_pickup_at` in which the courier should pick up the order. + * The duration must be in RFC 3339 format (for example, "P1W3D"). */ public function getCourierPickupWindowDuration(): ?string { @@ -624,9 +623,8 @@ public function getCourierPickupWindowDuration(): ?string /** * Sets Courier Pickup Window Duration. - * The period of time in which the order should be picked up by the courier after the - * `courier_pickup_at` timestamp. - * The time must be in RFC 3339 format (for example, "P1W3D"). + * The time period after `courier_pickup_at` in which the courier should pick up the order. + * The duration must be in RFC 3339 format (for example, "P1W3D"). * * @maps courier_pickup_window_duration */ @@ -637,9 +635,8 @@ public function setCourierPickupWindowDuration(?string $courierPickupWindowDurat /** * Unsets Courier Pickup Window Duration. - * The period of time in which the order should be picked up by the courier after the - * `courier_pickup_at` timestamp. - * The time must be in RFC 3339 format (for example, "P1W3D"). + * The time period after `courier_pickup_at` in which the courier should pick up the order. + * The duration must be in RFC 3339 format (for example, "P1W3D"). */ public function unsetCourierPickupWindowDuration(): void { diff --git a/src/Models/OrderFulfillmentPickupDetails.php b/src/Models/OrderFulfillmentPickupDetails.php index 5e7e7e06..fccea837 100644 --- a/src/Models/OrderFulfillmentPickupDetails.php +++ b/src/Models/OrderFulfillmentPickupDetails.php @@ -124,12 +124,10 @@ public function setRecipient(?OrderFulfillmentRecipient $recipient): void /** * Returns Expires At. * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - * indicating when this fulfillment expires if it is not accepted. The timestamp must be in RFC 3339 - * format - * (for example, "2016-09-04T23:59:33.123Z"). The expiration time can only be set up to 7 days in the - * future. - * If `expires_at` is not set, this pickup fulfillment is automatically accepted when - * placed. + * indicating when this fulfillment expires if it is not marked in progress. The timestamp must be + * in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). The expiration time can only be set + * up to 7 days in the future. If `expires_at` is not set, any new payments attached to the order + * are automatically completed. */ public function getExpiresAt(): ?string { @@ -142,12 +140,10 @@ public function getExpiresAt(): ?string /** * Sets Expires At. * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - * indicating when this fulfillment expires if it is not accepted. The timestamp must be in RFC 3339 - * format - * (for example, "2016-09-04T23:59:33.123Z"). The expiration time can only be set up to 7 days in the - * future. - * If `expires_at` is not set, this pickup fulfillment is automatically accepted when - * placed. + * indicating when this fulfillment expires if it is not marked in progress. The timestamp must be + * in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). The expiration time can only be set + * up to 7 days in the future. If `expires_at` is not set, any new payments attached to the order + * are automatically completed. * * @maps expires_at */ @@ -159,12 +155,10 @@ public function setExpiresAt(?string $expiresAt): void /** * Unsets Expires At. * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - * indicating when this fulfillment expires if it is not accepted. The timestamp must be in RFC 3339 - * format - * (for example, "2016-09-04T23:59:33.123Z"). The expiration time can only be set up to 7 days in the - * future. - * If `expires_at` is not set, this pickup fulfillment is automatically accepted when - * placed. + * indicating when this fulfillment expires if it is not marked in progress. The timestamp must be + * in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). The expiration time can only be set + * up to 7 days in the future. If `expires_at` is not set, any new payments attached to the order + * are automatically completed. */ public function unsetExpiresAt(): void { @@ -173,10 +167,10 @@ public function unsetExpiresAt(): void /** * Returns Auto Complete Duration. - * The duration of time after which an open and accepted pickup fulfillment - * is automatically moved to the `COMPLETED` state. The duration must be in RFC 3339 - * format (for example, "P1W3D"). - * If not set, this pickup fulfillment remains accepted until it is canceled or completed. + * The duration of time after which an in progress pickup fulfillment is automatically moved + * to the `COMPLETED` state. The duration must be in RFC 3339 format (for example, "P1W3D"). + * + * If not set, this pickup fulfillment remains in progress until it is canceled or completed. */ public function getAutoCompleteDuration(): ?string { @@ -188,10 +182,10 @@ public function getAutoCompleteDuration(): ?string /** * Sets Auto Complete Duration. - * The duration of time after which an open and accepted pickup fulfillment - * is automatically moved to the `COMPLETED` state. The duration must be in RFC 3339 - * format (for example, "P1W3D"). - * If not set, this pickup fulfillment remains accepted until it is canceled or completed. + * The duration of time after which an in progress pickup fulfillment is automatically moved + * to the `COMPLETED` state. The duration must be in RFC 3339 format (for example, "P1W3D"). + * + * If not set, this pickup fulfillment remains in progress until it is canceled or completed. * * @maps auto_complete_duration */ @@ -202,10 +196,10 @@ public function setAutoCompleteDuration(?string $autoCompleteDuration): void /** * Unsets Auto Complete Duration. - * The duration of time after which an open and accepted pickup fulfillment - * is automatically moved to the `COMPLETED` state. The duration must be in RFC 3339 - * format (for example, "P1W3D"). - * If not set, this pickup fulfillment remains accepted until it is canceled or completed. + * The duration of time after which an in progress pickup fulfillment is automatically moved + * to the `COMPLETED` state. The duration must be in RFC 3339 format (for example, "P1W3D"). + * + * If not set, this pickup fulfillment remains in progress until it is canceled or completed. */ public function unsetAutoCompleteDuration(): void { @@ -411,7 +405,7 @@ public function setPlacedAt(?string $placedAt): void /** * Returns Accepted At. * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - * indicating when the fulfillment was accepted. The timestamp must be in RFC 3339 format + * indicating when the fulfillment was marked in progress. The timestamp must be in RFC 3339 format * (for example, "2016-09-04T23:59:33.123Z"). */ public function getAcceptedAt(): ?string @@ -422,7 +416,7 @@ public function getAcceptedAt(): ?string /** * Sets Accepted At. * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - * indicating when the fulfillment was accepted. The timestamp must be in RFC 3339 format + * indicating when the fulfillment was marked in progress. The timestamp must be in RFC 3339 format * (for example, "2016-09-04T23:59:33.123Z"). * * @maps accepted_at diff --git a/src/Models/OrderLineItem.php b/src/Models/OrderLineItem.php index 215aff33..84e502b9 100644 --- a/src/Models/OrderLineItem.php +++ b/src/Models/OrderLineItem.php @@ -196,14 +196,19 @@ public function unsetName(): void /** * Returns Quantity. - * The quantity purchased, formatted as a decimal number. - * For example, `"3"`. + * The count, or measurement, of a line item being purchased: * - * Line items with a quantity of `"0"` are automatically removed - * when paying for or otherwise completing the order. + * If `quantity` is a whole number, and `quantity_unit` is not specified, then `quantity` denotes an + * item count. For example: `3` apples. + * + * If `quantity` is a whole or decimal number, and `quantity_unit` is also specified, then `quantity` + * denotes a measurement. For example: `2.25` pounds of broccoli. * - * Line items with a `quantity_unit` can have non-integer quantities. - * For example, `"1.70000"`. + * For more information, see [Specify item quantity and measurement unit](https://developer.squareup. + * com/docs/orders-api/create-orders#specify-item-quantity-and-measurement-unit). + * + * Line items with a quantity of `0` are automatically removed + * when paying for or otherwise completing the order. */ public function getQuantity(): string { @@ -212,14 +217,19 @@ public function getQuantity(): string /** * Sets Quantity. - * The quantity purchased, formatted as a decimal number. - * For example, `"3"`. + * The count, or measurement, of a line item being purchased: * - * Line items with a quantity of `"0"` are automatically removed - * when paying for or otherwise completing the order. + * If `quantity` is a whole number, and `quantity_unit` is not specified, then `quantity` denotes an + * item count. For example: `3` apples. + * + * If `quantity` is a whole or decimal number, and `quantity_unit` is also specified, then `quantity` + * denotes a measurement. For example: `2.25` pounds of broccoli. * - * Line items with a `quantity_unit` can have non-integer quantities. - * For example, `"1.70000"`. + * For more information, see [Specify item quantity and measurement unit](https://developer.squareup. + * com/docs/orders-api/create-orders#specify-item-quantity-and-measurement-unit). + * + * Line items with a quantity of `0` are automatically removed + * when paying for or otherwise completing the order. * * @required * @maps quantity @@ -253,7 +263,7 @@ public function setQuantityUnit(?OrderQuantityUnit $quantityUnit): void /** * Returns Note. - * The note of the line item. + * An optional note associated with the line item. */ public function getNote(): ?string { @@ -265,7 +275,7 @@ public function getNote(): ?string /** * Sets Note. - * The note of the line item. + * An optional note associated with the line item. * * @maps note */ @@ -276,7 +286,7 @@ public function setNote(?string $note): void /** * Unsets Note. - * The note of the line item. + * An optional note associated with the line item. */ public function unsetNote(): void { diff --git a/src/Models/OrderReturn.php b/src/Models/OrderReturn.php index aba98650..d7ece5b1 100644 --- a/src/Models/OrderReturn.php +++ b/src/Models/OrderReturn.php @@ -28,19 +28,24 @@ class OrderReturn implements \JsonSerializable private $returnLineItems = []; /** - * @var OrderReturnServiceCharge[]|null + * @var array */ - private $returnServiceCharges; + private $returnServiceCharges = []; /** - * @var array + * @var OrderReturnTax[]|null + */ + private $returnTaxes; + + /** + * @var OrderReturnDiscount[]|null */ - private $returnTaxes = []; + private $returnDiscounts; /** * @var array */ - private $returnDiscounts = []; + private $returnTips = []; /** * @var OrderRoundingAdjustment|null @@ -163,7 +168,10 @@ public function unsetReturnLineItems(): void */ public function getReturnServiceCharges(): ?array { - return $this->returnServiceCharges; + if (count($this->returnServiceCharges) == 0) { + return null; + } + return $this->returnServiceCharges['value']; } /** @@ -176,7 +184,16 @@ public function getReturnServiceCharges(): ?array */ public function setReturnServiceCharges(?array $returnServiceCharges): void { - $this->returnServiceCharges = $returnServiceCharges; + $this->returnServiceCharges['value'] = $returnServiceCharges; + } + + /** + * Unsets Return Service Charges. + * A collection of service charges that are being returned. + */ + public function unsetReturnServiceCharges(): void + { + $this->returnServiceCharges = []; } /** @@ -189,10 +206,7 @@ public function setReturnServiceCharges(?array $returnServiceCharges): void */ public function getReturnTaxes(): ?array { - if (count($this->returnTaxes) == 0) { - return null; - } - return $this->returnTaxes['value']; + return $this->returnTaxes; } /** @@ -207,18 +221,7 @@ public function getReturnTaxes(): ?array */ public function setReturnTaxes(?array $returnTaxes): void { - $this->returnTaxes['value'] = $returnTaxes; - } - - /** - * Unsets Return Taxes. - * A collection of references to taxes being returned for an order, including the total - * applied tax amount to be returned. The taxes must reference a top-level tax ID from the source - * order. - */ - public function unsetReturnTaxes(): void - { - $this->returnTaxes = []; + $this->returnTaxes = $returnTaxes; } /** @@ -231,10 +234,7 @@ public function unsetReturnTaxes(): void */ public function getReturnDiscounts(): ?array { - if (count($this->returnDiscounts) == 0) { - return null; - } - return $this->returnDiscounts['value']; + return $this->returnDiscounts; } /** @@ -249,18 +249,43 @@ public function getReturnDiscounts(): ?array */ public function setReturnDiscounts(?array $returnDiscounts): void { - $this->returnDiscounts['value'] = $returnDiscounts; + $this->returnDiscounts = $returnDiscounts; } /** - * Unsets Return Discounts. - * A collection of references to discounts being returned for an order, including the total - * applied discount amount to be returned. The discounts must reference a top-level discount ID - * from the source order. + * Returns Return Tips. + * A collection of references to tips being returned for an order. + * + * @return OrderReturnTip[]|null + */ + public function getReturnTips(): ?array + { + if (count($this->returnTips) == 0) { + return null; + } + return $this->returnTips['value']; + } + + /** + * Sets Return Tips. + * A collection of references to tips being returned for an order. + * + * @maps return_tips + * + * @param OrderReturnTip[]|null $returnTips */ - public function unsetReturnDiscounts(): void + public function setReturnTips(?array $returnTips): void { - $this->returnDiscounts = []; + $this->returnTips['value'] = $returnTips; + } + + /** + * Unsets Return Tips. + * A collection of references to tips being returned for an order. + */ + public function unsetReturnTips(): void + { + $this->returnTips = []; } /** @@ -328,14 +353,17 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) if (!empty($this->returnLineItems)) { $json['return_line_items'] = $this->returnLineItems['value']; } - if (isset($this->returnServiceCharges)) { - $json['return_service_charges'] = $this->returnServiceCharges; + if (!empty($this->returnServiceCharges)) { + $json['return_service_charges'] = $this->returnServiceCharges['value']; + } + if (isset($this->returnTaxes)) { + $json['return_taxes'] = $this->returnTaxes; } - if (!empty($this->returnTaxes)) { - $json['return_taxes'] = $this->returnTaxes['value']; + if (isset($this->returnDiscounts)) { + $json['return_discounts'] = $this->returnDiscounts; } - if (!empty($this->returnDiscounts)) { - $json['return_discounts'] = $this->returnDiscounts['value']; + if (!empty($this->returnTips)) { + $json['return_tips'] = $this->returnTips['value']; } if (isset($this->roundingAdjustment)) { $json['rounding_adjustment'] = $this->roundingAdjustment; diff --git a/src/Models/OrderReturnServiceCharge.php b/src/Models/OrderReturnServiceCharge.php index 5c0e05cd..df37b900 100644 --- a/src/Models/OrderReturnServiceCharge.php +++ b/src/Models/OrderReturnServiceCharge.php @@ -86,6 +86,16 @@ class OrderReturnServiceCharge implements \JsonSerializable */ private $scope; + /** + * @var array + */ + private $appliedServiceCharges = []; + + /** + * @var Money|null + */ + private $totalServiceChargeMoney; + /** * Returns Uid. * A unique ID that identifies the return service charge only within this order. @@ -579,6 +589,80 @@ public function setScope(?string $scope): void $this->scope = $scope; } + /** + * Returns Applied Service Charges. + * The list of references to service charges applied to the`OrderReturnServiceCharge`. Each + * `OrderLineItemAppliedServiceCharge` has a `service_charge_id` that references the `uid` of a + * top-level `OrderReturnServiceCharge`. On reads, the amount applied is populated. + * + * @return OrderLineItemAppliedServiceCharge[]|null + */ + public function getAppliedServiceCharges(): ?array + { + if (count($this->appliedServiceCharges) == 0) { + return null; + } + return $this->appliedServiceCharges['value']; + } + + /** + * Sets Applied Service Charges. + * The list of references to service charges applied to the`OrderReturnServiceCharge`. Each + * `OrderLineItemAppliedServiceCharge` has a `service_charge_id` that references the `uid` of a + * top-level `OrderReturnServiceCharge`. On reads, the amount applied is populated. + * + * @maps applied_service_charges + * + * @param OrderLineItemAppliedServiceCharge[]|null $appliedServiceCharges + */ + public function setAppliedServiceCharges(?array $appliedServiceCharges): void + { + $this->appliedServiceCharges['value'] = $appliedServiceCharges; + } + + /** + * Unsets Applied Service Charges. + * The list of references to service charges applied to the`OrderReturnServiceCharge`. Each + * `OrderLineItemAppliedServiceCharge` has a `service_charge_id` that references the `uid` of a + * top-level `OrderReturnServiceCharge`. On reads, the amount applied is populated. + */ + public function unsetAppliedServiceCharges(): void + { + $this->appliedServiceCharges = []; + } + + /** + * Returns Total Service Charge 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 getTotalServiceChargeMoney(): ?Money + { + return $this->totalServiceChargeMoney; + } + + /** + * Sets Total Service Charge 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 total_service_charge_money + */ + public function setTotalServiceChargeMoney(?Money $totalServiceChargeMoney): void + { + $this->totalServiceChargeMoney = $totalServiceChargeMoney; + } + /** * Encode this object to JSON * @@ -592,49 +676,55 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; if (!empty($this->uid)) { - $json['uid'] = $this->uid['value']; + $json['uid'] = $this->uid['value']; } if (!empty($this->sourceServiceChargeUid)) { - $json['source_service_charge_uid'] = $this->sourceServiceChargeUid['value']; + $json['source_service_charge_uid'] = $this->sourceServiceChargeUid['value']; } if (!empty($this->name)) { - $json['name'] = $this->name['value']; + $json['name'] = $this->name['value']; } if (!empty($this->catalogObjectId)) { - $json['catalog_object_id'] = $this->catalogObjectId['value']; + $json['catalog_object_id'] = $this->catalogObjectId['value']; } if (!empty($this->catalogVersion)) { - $json['catalog_version'] = $this->catalogVersion['value']; + $json['catalog_version'] = $this->catalogVersion['value']; } if (!empty($this->percentage)) { - $json['percentage'] = $this->percentage['value']; + $json['percentage'] = $this->percentage['value']; } if (isset($this->amountMoney)) { - $json['amount_money'] = $this->amountMoney; + $json['amount_money'] = $this->amountMoney; } if (isset($this->appliedMoney)) { - $json['applied_money'] = $this->appliedMoney; + $json['applied_money'] = $this->appliedMoney; } if (isset($this->totalMoney)) { - $json['total_money'] = $this->totalMoney; + $json['total_money'] = $this->totalMoney; } if (isset($this->totalTaxMoney)) { - $json['total_tax_money'] = $this->totalTaxMoney; + $json['total_tax_money'] = $this->totalTaxMoney; } if (isset($this->calculationPhase)) { - $json['calculation_phase'] = $this->calculationPhase; + $json['calculation_phase'] = $this->calculationPhase; } if (!empty($this->taxable)) { - $json['taxable'] = $this->taxable['value']; + $json['taxable'] = $this->taxable['value']; } if (!empty($this->appliedTaxes)) { - $json['applied_taxes'] = $this->appliedTaxes['value']; + $json['applied_taxes'] = $this->appliedTaxes['value']; } if (isset($this->treatmentType)) { - $json['treatment_type'] = $this->treatmentType; + $json['treatment_type'] = $this->treatmentType; } if (isset($this->scope)) { - $json['scope'] = $this->scope; + $json['scope'] = $this->scope; + } + if (!empty($this->appliedServiceCharges)) { + $json['applied_service_charges'] = $this->appliedServiceCharges['value']; + } + if (isset($this->totalServiceChargeMoney)) { + $json['total_service_charge_money'] = $this->totalServiceChargeMoney; } $json = array_filter($json, function ($val) { return $val !== null; diff --git a/src/Models/OrderReturnTip.php b/src/Models/OrderReturnTip.php new file mode 100644 index 00000000..b5e48809 --- /dev/null +++ b/src/Models/OrderReturnTip.php @@ -0,0 +1,192 @@ +uid) == 0) { + return null; + } + return $this->uid['value']; + } + + /** + * Sets Uid. + * A unique ID that identifies the tip only within this order. + * + * @maps uid + */ + public function setUid(?string $uid): void + { + $this->uid['value'] = $uid; + } + + /** + * Unsets Uid. + * A unique ID that identifies the tip only within this order. + */ + public function unsetUid(): void + { + $this->uid = []; + } + + /** + * Returns Applied 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 getAppliedMoney(): ?Money + { + return $this->appliedMoney; + } + + /** + * Sets Applied 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 applied_money + */ + public function setAppliedMoney(?Money $appliedMoney): void + { + $this->appliedMoney = $appliedMoney; + } + + /** + * Returns Source Tender Uid. + * The tender `uid` from the order that contains the original application of this tip. + */ + public function getSourceTenderUid(): ?string + { + if (count($this->sourceTenderUid) == 0) { + return null; + } + return $this->sourceTenderUid['value']; + } + + /** + * Sets Source Tender Uid. + * The tender `uid` from the order that contains the original application of this tip. + * + * @maps source_tender_uid + */ + public function setSourceTenderUid(?string $sourceTenderUid): void + { + $this->sourceTenderUid['value'] = $sourceTenderUid; + } + + /** + * Unsets Source Tender Uid. + * The tender `uid` from the order that contains the original application of this tip. + */ + public function unsetSourceTenderUid(): void + { + $this->sourceTenderUid = []; + } + + /** + * Returns Source Tender Id. + * The tender `id` from the order that contains the original application of this tip. + */ + public function getSourceTenderId(): ?string + { + if (count($this->sourceTenderId) == 0) { + return null; + } + return $this->sourceTenderId['value']; + } + + /** + * Sets Source Tender Id. + * The tender `id` from the order that contains the original application of this tip. + * + * @maps source_tender_id + */ + public function setSourceTenderId(?string $sourceTenderId): void + { + $this->sourceTenderId['value'] = $sourceTenderId; + } + + /** + * Unsets Source Tender Id. + * The tender `id` from the order that contains the original application of this tip. + */ + public function unsetSourceTenderId(): void + { + $this->sourceTenderId = []; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + if (!empty($this->uid)) { + $json['uid'] = $this->uid['value']; + } + if (isset($this->appliedMoney)) { + $json['applied_money'] = $this->appliedMoney; + } + if (!empty($this->sourceTenderUid)) { + $json['source_tender_uid'] = $this->sourceTenderUid['value']; + } + if (!empty($this->sourceTenderId)) { + $json['source_tender_id'] = $this->sourceTenderId['value']; + } + $json = array_filter($json, function ($val) { + return $val !== null; + }); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/OrderServiceCharge.php b/src/Models/OrderServiceCharge.php index 2ded4726..78e3c2f3 100644 --- a/src/Models/OrderServiceCharge.php +++ b/src/Models/OrderServiceCharge.php @@ -91,6 +91,16 @@ class OrderServiceCharge implements \JsonSerializable */ private $scope; + /** + * @var array + */ + private $appliedServiceCharges = []; + + /** + * @var Money|null + */ + private $totalServiceChargeMoney; + /** * Returns Uid. * A unique ID that identifies the service charge only within this order. @@ -672,6 +682,86 @@ public function setScope(?string $scope): void $this->scope = $scope; } + /** + * Returns Applied Service Charges. + * The list of references to service charges applied to this service charge. Each + * `OrderLineItemAppliedServiceCharge` has a `service_charge_id` that references the `uid` of a + * top-level `OrderServiceCharge`. On reads, the amount applied is populated. + * + * To change the amount of a service charge, modify the referenced top-level service charge. + * + * @return OrderLineItemAppliedServiceCharge[]|null + */ + public function getAppliedServiceCharges(): ?array + { + if (count($this->appliedServiceCharges) == 0) { + return null; + } + return $this->appliedServiceCharges['value']; + } + + /** + * Sets Applied Service Charges. + * The list of references to service charges applied to this service charge. Each + * `OrderLineItemAppliedServiceCharge` has a `service_charge_id` that references the `uid` of a + * top-level `OrderServiceCharge`. On reads, the amount applied is populated. + * + * To change the amount of a service charge, modify the referenced top-level service charge. + * + * @maps applied_service_charges + * + * @param OrderLineItemAppliedServiceCharge[]|null $appliedServiceCharges + */ + public function setAppliedServiceCharges(?array $appliedServiceCharges): void + { + $this->appliedServiceCharges['value'] = $appliedServiceCharges; + } + + /** + * Unsets Applied Service Charges. + * The list of references to service charges applied to this service charge. Each + * `OrderLineItemAppliedServiceCharge` has a `service_charge_id` that references the `uid` of a + * top-level `OrderServiceCharge`. On reads, the amount applied is populated. + * + * To change the amount of a service charge, modify the referenced top-level service charge. + */ + public function unsetAppliedServiceCharges(): void + { + $this->appliedServiceCharges = []; + } + + /** + * Returns Total Service Charge 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 getTotalServiceChargeMoney(): ?Money + { + return $this->totalServiceChargeMoney; + } + + /** + * Sets Total Service Charge 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 total_service_charge_money + */ + public function setTotalServiceChargeMoney(?Money $totalServiceChargeMoney): void + { + $this->totalServiceChargeMoney = $totalServiceChargeMoney; + } + /** * Encode this object to JSON * @@ -685,52 +775,58 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; if (!empty($this->uid)) { - $json['uid'] = $this->uid['value']; + $json['uid'] = $this->uid['value']; } if (!empty($this->name)) { - $json['name'] = $this->name['value']; + $json['name'] = $this->name['value']; } if (!empty($this->catalogObjectId)) { - $json['catalog_object_id'] = $this->catalogObjectId['value']; + $json['catalog_object_id'] = $this->catalogObjectId['value']; } if (!empty($this->catalogVersion)) { - $json['catalog_version'] = $this->catalogVersion['value']; + $json['catalog_version'] = $this->catalogVersion['value']; } if (!empty($this->percentage)) { - $json['percentage'] = $this->percentage['value']; + $json['percentage'] = $this->percentage['value']; } if (isset($this->amountMoney)) { - $json['amount_money'] = $this->amountMoney; + $json['amount_money'] = $this->amountMoney; } if (isset($this->appliedMoney)) { - $json['applied_money'] = $this->appliedMoney; + $json['applied_money'] = $this->appliedMoney; } if (isset($this->totalMoney)) { - $json['total_money'] = $this->totalMoney; + $json['total_money'] = $this->totalMoney; } if (isset($this->totalTaxMoney)) { - $json['total_tax_money'] = $this->totalTaxMoney; + $json['total_tax_money'] = $this->totalTaxMoney; } if (isset($this->calculationPhase)) { - $json['calculation_phase'] = $this->calculationPhase; + $json['calculation_phase'] = $this->calculationPhase; } if (!empty($this->taxable)) { - $json['taxable'] = $this->taxable['value']; + $json['taxable'] = $this->taxable['value']; } if (!empty($this->appliedTaxes)) { - $json['applied_taxes'] = $this->appliedTaxes['value']; + $json['applied_taxes'] = $this->appliedTaxes['value']; } if (!empty($this->metadata)) { - $json['metadata'] = $this->metadata['value']; + $json['metadata'] = $this->metadata['value']; } if (isset($this->type)) { - $json['type'] = $this->type; + $json['type'] = $this->type; } if (isset($this->treatmentType)) { - $json['treatment_type'] = $this->treatmentType; + $json['treatment_type'] = $this->treatmentType; } if (isset($this->scope)) { - $json['scope'] = $this->scope; + $json['scope'] = $this->scope; + } + if (!empty($this->appliedServiceCharges)) { + $json['applied_service_charges'] = $this->appliedServiceCharges['value']; + } + if (isset($this->totalServiceChargeMoney)) { + $json['total_service_charge_money'] = $this->totalServiceChargeMoney; } $json = array_filter($json, function ($val) { return $val !== null; diff --git a/src/Models/SearchOrdersCustomerFilter.php b/src/Models/SearchOrdersCustomerFilter.php index e6de3238..49e3634b 100644 --- a/src/Models/SearchOrdersCustomerFilter.php +++ b/src/Models/SearchOrdersCustomerFilter.php @@ -22,7 +22,7 @@ class SearchOrdersCustomerFilter implements \JsonSerializable * Returns Customer Ids. * A list of customer IDs to filter by. * - * Max: 10 customer IDs. + * Max: 10 customer ids. * * @return string[]|null */ @@ -38,7 +38,7 @@ public function getCustomerIds(): ?array * Sets Customer Ids. * A list of customer IDs to filter by. * - * Max: 10 customer IDs. + * Max: 10 customer ids. * * @maps customer_ids * @@ -53,7 +53,7 @@ public function setCustomerIds(?array $customerIds): void * Unsets Customer Ids. * A list of customer IDs to filter by. * - * Max: 10 customer IDs. + * Max: 10 customer ids. */ public function unsetCustomerIds(): void { diff --git a/src/Models/SearchOrdersRequest.php b/src/Models/SearchOrdersRequest.php index 6f433a71..cadae530 100644 --- a/src/Models/SearchOrdersRequest.php +++ b/src/Models/SearchOrdersRequest.php @@ -6,12 +6,6 @@ use stdClass; -/** - * The request does not have any required fields. When given no query criteria, - * `SearchOrders` returns all results for all of the seller's locations. When retrieving additional - * pages using a `cursor`, the `query` must be equal to the `query` used to retrieve the first page of - * results. - */ class SearchOrdersRequest implements \JsonSerializable { /** @@ -44,8 +38,6 @@ class SearchOrdersRequest implements \JsonSerializable * The location IDs for the orders to query. All locations must belong to * the same merchant. * - * Min: 1 location ID. - * * Max: 10 location IDs. * * @return string[]|null @@ -60,8 +52,6 @@ public function getLocationIds(): ?array * The location IDs for the orders to query. All locations must belong to * the same merchant. * - * Min: 1 location ID. - * * Max: 10 location IDs. * * @maps location_ids @@ -121,10 +111,10 @@ public function setQuery(?SearchOrdersQuery $query): void /** * Returns Limit. - * The maximum number of results to be returned in a single page. It is - * possible to receive fewer results than the specified limit on a given page. + * The maximum number of results to be returned in a single page. * * Default: `500` + * Max: `1000` */ public function getLimit(): ?int { @@ -133,10 +123,10 @@ public function getLimit(): ?int /** * Sets Limit. - * The maximum number of results to be returned in a single page. It is - * possible to receive fewer results than the specified limit on a given page. + * The maximum number of results to be returned in a single page. * * Default: `500` + * Max: `1000` * * @maps limit */ diff --git a/src/Models/SearchOrdersResponse.php b/src/Models/SearchOrdersResponse.php index 7c21793b..cdeea5d7 100644 --- a/src/Models/SearchOrdersResponse.php +++ b/src/Models/SearchOrdersResponse.php @@ -90,8 +90,8 @@ public function setOrders(?array $orders): void * Returns Cursor. * The pagination cursor to be used in a subsequent request. If unset, * this is the final response. - * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api- - * patterns/pagination). + * For more information, see [Pagination](https://developer.squareup.com/docs/basics/build- + * basics/common-api-patterns/pagination). */ public function getCursor(): ?string { @@ -102,8 +102,8 @@ public function getCursor(): ?string * Sets Cursor. * The pagination cursor to be used in a subsequent request. If unset, * this is the final response. - * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api- - * patterns/pagination). + * For more information, see [Pagination](https://developer.squareup.com/docs/basics/build- + * basics/common-api-patterns/pagination). * * @maps cursor */ diff --git a/src/SquareClient.php b/src/SquareClient.php index cdb2ccb4..4b1e6abf 100644 --- a/src/SquareClient.php +++ b/src/SquareClient.php @@ -162,7 +162,7 @@ public function __construct(array $config = []) ->jsonHelper(ApiHelper::getJsonHelper()) ->apiCallback($this->config['httpCallback'] ?? null) ->userAgent( - 'Square-PHP-SDK/33.1.0.20231213 ({api-version}) {engine}/{engine-version} ({os-' . + 'Square-PHP-SDK/34.0.0.20240118 ({api-version}) {engine}/{engine-version} ({os-' . 'info}) {detail}' ) ->userAgentConfig( @@ -304,7 +304,7 @@ public function withConfiguration(array $config): self */ public function getSdkVersion(): string { - return '33.1.0.20231213'; + return '34.0.0.20240118'; } /**