diff --git a/.mock/definition/__package__.yml b/.mock/definition/__package__.yml index adc854da..e313afeb 100644 --- a/.mock/definition/__package__.yml +++ b/.mock/definition/__package__.yml @@ -3378,6 +3378,38 @@ types: from the `amount_money` and `buyer_supplied_money` fields. source: openapi: openapi/openapi.json + CatalogAvailabilityPeriod: + docs: Represents a time period of availability. + properties: + start_local_time: + type: optional> + docs: >- + The start time of an availability period, specified in local time + using partial-time + + RFC 3339 format. For example, `8:30:00` for a period starting at 8:30 + in the morning. + + Note that the seconds value is always :00, but it is appended for + conformance to the RFC. + end_local_time: + type: optional> + docs: >- + The end time of an availability period, specified in local time using + partial-time + + RFC 3339 format. For example, `21:00:00` for a period ending at 9:00 + in the evening. + + Note that the seconds value is always :00, but it is appended for + conformance to the RFC. + day_of_week: + type: optional + docs: |- + The day of the week for this availability period. + See [DayOfWeek](#type-dayofweek) for possible values + source: + openapi: openapi/openapi.json CatalogCategory: docs: A category to which a `CatalogItem` instance belongs. properties: @@ -4188,6 +4220,16 @@ types: variations in a specified order. Maximum: 6 item options. + ecom_uri: + type: optional> + docs: >- + Deprecated; see go/ecomUriUseCases. A URI pointing to a published + e-commerce product page for the Item. + ecom_image_uris: + type: optional>> + docs: >- + Deprecated; see go/ecomUriUseCases. A comma-separated list of encoded + URIs pointing to a set of published e-commerce images for the Item. image_ids: type: optional>> docs: |- @@ -4287,6 +4329,9 @@ types: reporting_category: type: optional docs: The item's reporting category. + is_alcoholic: + type: optional> + docs: Indicates whether this item is alcoholic (`true`) or not (`false`). source: openapi: openapi/openapi.json CatalogItemFoodAndBeverageDetails: @@ -5129,6 +5174,8 @@ types: CHECKOUT_LINK: CatalogObjectCheckoutLink ADDRESS: CatalogObjectAddress SUBSCRIPTION_PRODUCT: CatalogObjectSubscriptionProduct + SUBSCRIPTION_PLAN_VARIATION: CatalogObjectSubscriptionPlanVariation + AVAILABILITY_PERIOD: CatalogObjectAvailabilityPeriod source: openapi: openapi/openapi.json CatalogObjectBatch: @@ -6156,6 +6203,43 @@ types: SubscriptionPlan. source: openapi: openapi/openapi.json + CatalogSubscriptionPlanVariation: + docs: >- + Describes a subscription plan variation. A subscription plan variation + represents how the subscription for a product or service is sold. + + For more information, see [Subscription Plans and + Variations](https://developer.squareup.com/docs/subscriptions-api/plans-and-variations). + properties: + name: + type: string + docs: The name of the plan variation. + phases: + docs: >- + A list containing each [SubscriptionPhase](entity:SubscriptionPhase) + for this plan variation. + type: list + subscription_plan_id: + type: optional> + docs: The id of the subscription plan, if there is one. + monthly_billing_anchor_date: + type: optional> + docs: The day of the month the billing period starts. + can_prorate: + type: optional> + docs: Whether bills for this plan variation can be split for proration. + successor_plan_variation_id: + type: optional> + docs: >- + The ID of a "successor" plan variation to this one. If the field is + set, and this object is disabled at all + + locations, it indicates that this variation is deprecated and the + object identified by the successor ID be used in + + its stead. + source: + openapi: openapi/openapi.json CatalogTax: docs: A tax applicable to an item. properties: @@ -13464,12 +13548,20 @@ types: public_url: type: optional docs: >- - The URL of the Square-hosted invoice page. + A temporary link to the Square-hosted payment page where the customer + can pay the + + invoice. If the link expires, customers can provide the email address + or phone number + + associated with the invoice and request a new link directly from the + expired payment page. - After you publish the invoice using the `PublishInvoice` endpoint, - Square hosts the invoice - page and returns the page URL in the response. + This field is added after the invoice is published and reaches the + scheduled date + + (if one is defined). access: read-only next_payment_amount_money: type: optional @@ -14181,7 +14273,7 @@ types: - CANCELED - FAILED - PAYMENT_PENDING - docs: Indicates the status of an invoice. + docs: Indicates the status of an [invoice](entity:Invoice). source: openapi: openapi/openapi.json ItemVariationLocationOverrides: @@ -20691,9 +20783,10 @@ types: type: optional> docs: >- Indicates whether the `Payment` objects created from this - `TerminalCheckout` are automatically + `TerminalCheckout` are - `COMPLETED` or left in an `APPROVED` state for later modification. + automatically `COMPLETED` or left in an `APPROVED` state for later + modification. Default: true @@ -25001,9 +25094,7 @@ types: docs: The reference to the Square order ID for the checkout request. payment_options: type: optional - docs: >- - Payment-specific options for the checkout request. Supported only in - the US. + docs: Payment-specific options for the checkout request. device_options: type: DeviceCheckoutOptions docs: >- @@ -25114,9 +25205,6 @@ types: To set this field, PAYMENTS_WRITE_ADDITIONAL_RECIPIENTS OAuth permission is required. For more information, see [Permissions](https://developer.squareup.com/docs/payments-api/take-payments-and-collect-fees#permissions). - - - Supported only in the US. statement_description_identifier: type: optional> docs: >- @@ -25126,8 +25214,7 @@ types: part of the statement description. This can be, for example, an invoice number, ticket number, - or short description that uniquely identifies the purchase. Supported - only in the US. + or short description that uniquely identifies the purchase. validation: maxLength: 20 tip_money: @@ -25137,9 +25224,7 @@ types: may only be set for a checkout that has tipping disabled (`tip_settings.allow_tipping` is - `false`). Supported only in - - the US. + `false`). source: openapi: openapi/openapi.json TerminalCheckoutQuery: @@ -26939,6 +27024,28 @@ types: - CatalogObjectBase source: openapi: openapi/openapi.json + CatalogObjectSubscriptionPlanVariation: + properties: + subscription_plan_variation_data: + type: optional + docs: >- + Structured data for a `CatalogSubscriptionPlanVariation`, set for + CatalogObjects of type `SUBSCRIPTION_PLAN_VARIATION`. + extends: + - CatalogObjectBase + source: + openapi: openapi/openapi.json + CatalogObjectAvailabilityPeriod: + properties: + availability_period_data: + type: optional + docs: >- + Structured data for a `CatalogAvailabilityPeriod`, set for + CatalogObjects of type `AVAILABILITY_PERIOD`. + extends: + - CatalogObjectBase + source: + openapi: openapi/openapi.json CatalogObjectComponent: properties: {} extends: diff --git a/.mock/definition/api.yml b/.mock/definition/api.yml index 4cdd7a00..28aa10da 100644 --- a/.mock/definition/api.yml +++ b/.mock/definition/api.yml @@ -10,7 +10,7 @@ headers: Square-Version: name: version env: VERSION - type: literal<"2025-03-19"> + type: literal<"2025-04-16"> auth-schemes: Bearer: scheme: bearer diff --git a/.mock/definition/catalog.yml b/.mock/definition/catalog.yml index 784fb2ce..91e8d86b 100644 --- a/.mock/definition/catalog.yml +++ b/.mock/definition/catalog.yml @@ -49,7 +49,6 @@ service: body: properties: object_ids: - type: optional>> docs: >- The IDs of the CatalogObjects to be deleted. When an object is deleted, other objects @@ -58,6 +57,7 @@ service: (for example, deleting a CatalogItem will delete its CatalogItemVariation. + type: list content-type: application/json response: docs: Success diff --git a/.mock/definition/catalog/object.yml b/.mock/definition/catalog/object.yml index 275afd08..d5819e02 100644 --- a/.mock/definition/catalog/object.yml +++ b/.mock/definition/catalog/object.yml @@ -111,6 +111,9 @@ service: skip_modifier_screen: true item_options: - {} + ecom_uri: ecom_uri + ecom_image_uris: + - ecom_image_uris image_ids: - image_ids sort_name: sort_name @@ -119,6 +122,7 @@ service: channels: - channels is_archived: true + is_alcoholic: true type: ITEM id_mappings: - client_object_id: '#Cocoa' @@ -269,6 +273,9 @@ service: skip_modifier_screen: true item_options: - {} + ecom_uri: ecom_uri + ecom_image_uris: + - ecom_image_uris image_ids: - image_ids sort_name: sort_name @@ -277,6 +284,7 @@ service: channels: - channels is_archived: true + is_alcoholic: true type: ITEM related_objects: - id: id diff --git a/.mock/definition/invoices.yml b/.mock/definition/invoices.yml index e886e382..969d6381 100644 --- a/.mock/definition/invoices.yml +++ b/.mock/definition/invoices.yml @@ -160,7 +160,8 @@ service: title: title description: description scheduled_at: scheduled_at - public_url: https://squareup.com/pay-invoice/h9sfsfTGTSnYEhISUDBhEQ + public_url: >- + https://squareup.com/pay-invoice/invtmp:5e22a2c2-47c1-46d6-b061-808764dfe2b9 next_payment_amount_money: amount: 3000 currency: USD @@ -508,7 +509,8 @@ service: title: title description: description scheduled_at: scheduled_at - public_url: https://squareup.com/pay-invoice/h9sfsfTGTSnYEhISUDBhEQ + public_url: >- + https://squareup.com/pay-invoice/invtmp:5e22a2c2-47c1-46d6-b061-808764dfe2b9 next_payment_amount_money: amount: 3000 currency: USD @@ -1148,7 +1150,7 @@ service: description: We appreciate your business! scheduled_at: '2030-01-13T10:00:00Z' public_url: >- - https://squareup.com/pay-invoice/inv:0-ChCHu2mZEabLeeHahQnXDjZQECY + https://squareup.com/pay-invoice/invtmp:5e22a2c2-47c1-46d6-b061-808764dfe2b9 next_payment_amount_money: amount: 1000000 currency: UNKNOWN_CURRENCY diff --git a/.mock/fern.config.json b/.mock/fern.config.json index 3a435fe9..2414e804 100644 --- a/.mock/fern.config.json +++ b/.mock/fern.config.json @@ -1,4 +1,4 @@ { "organization" : "square", - "version" : "0.56.24" + "version" : "0.57.17" } \ No newline at end of file diff --git a/.mock/openapi/openapi.json b/.mock/openapi/openapi.json index e98d67cb..cbb5c9be 100644 --- a/.mock/openapi/openapi.json +++ b/.mock/openapi/openapi.json @@ -146,7 +146,7 @@ "name": "Square-Version", "description": "Square Connect API versions", "schema": { - "default": "2025-03-19" + "default": "2025-04-16" } } ], @@ -1437,14 +1437,16 @@ "BatchDeleteCatalogObjectsRequest": { "type": "object", "x-release-status": "PUBLIC", + "required": [ + "object_ids" + ], "properties": { "object_ids": { "type": "array", "items": { "type": "string" }, - "description": "The IDs of the CatalogObjects to be deleted. When an object is deleted, other objects\nin the graph that depend on that object will be deleted as well (for example, deleting a\nCatalogItem will delete its CatalogItemVariation.", - "nullable": true + "description": "The IDs of the CatalogObjects to be deleted. When an object is deleted, other objects\nin the graph that depend on that object will be deleted as well (for example, deleting a\nCatalogItem will delete its CatalogItemVariation." } }, "example": { @@ -7841,6 +7843,21 @@ "description": "List of item options IDs for this item. Used to manage and group item\nvariations in a specified order.\n\nMaximum: 6 item options.", "nullable": true }, + "ecom_uri": { + "type": "string", + "description": "Deprecated; see go/ecomUriUseCases. A URI pointing to a published e-commerce product page for the Item.", + "x-release-status": "DEPRECATED", + "nullable": true + }, + "ecom_image_uris": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Deprecated; see go/ecomUriUseCases. A comma-separated list of encoded URIs pointing to a set of published e-commerce images for the Item.", + "x-release-status": "DEPRECATED", + "nullable": true + }, "image_ids": { "type": "array", "items": { @@ -7903,6 +7920,11 @@ "$ref": "#/components/schemas/CatalogObjectCategory", "description": "The item's reporting category.", "nullable": true + }, + "is_alcoholic": { + "type": "boolean", + "description": "Indicates whether this item is alcoholic (`true`) or not (`false`).", + "nullable": true } }, "example": { @@ -24011,7 +24033,7 @@ }, "public_url": { "type": "string", - "description": "The URL of the Square-hosted invoice page.\nAfter you publish the invoice using the `PublishInvoice` endpoint, Square hosts the invoice\npage and returns the page URL in the response.", + "description": "A temporary link to the Square-hosted payment page where the customer can pay the\ninvoice. If the link expires, customers can provide the email address or phone number\nassociated with the invoice and request a new link directly from the expired payment page. \n\nThis field is added after the invoice is published and reaches the scheduled date\n(if one is defined).", "readOnly": true }, "next_payment_amount_money": { @@ -24645,7 +24667,7 @@ }, { "name": "CANCELED", - "description": "The invoice is canceled. Square no longer requests payments from the customer.\nThe `public_url` page remains and is accessible, but it displays the invoice\nas canceled and does not accept payment." + "description": "The invoice is canceled. Square no longer requests payments from the customer.\nThe Square-hosted payment page is still accessible using the temporary `public_url`\nlink, but the invoice is shown as canceled and does not accept payment." }, { "name": "FAILED", @@ -24656,7 +24678,7 @@ "description": "A payment on the invoice was initiated but has not yet been processed.\n\nWhen in this state, invoices cannot be updated and other payments cannot be initiated." } ], - "description": "Indicates the status of an invoice.", + "description": "Indicates the status of an [invoice](entity:Invoice).", "x-release-status": "PUBLIC" }, "ItemVariationLocationOverrides": { @@ -27052,7 +27074,7 @@ "given_name": "Amelia", "phone_number": "1-212-555-4240" }, - "public_url": "https://squareup.com/pay-invoice/h9sfsfTGTSnYEhISUDBhEQ", + "public_url": "https://squareup.com/pay-invoice/invtmp:5e22a2c2-47c1-46d6-b061-808764dfe2b9", "sale_or_service_date": "2030-01-24", "status": "PARTIALLY_PAID", "store_payment_method_enabled": false, @@ -35081,7 +35103,7 @@ "properties": { "autocomplete": { "type": "boolean", - "description": "Indicates whether the `Payment` objects created from this `TerminalCheckout` are automatically\n`COMPLETED` or left in an `APPROVED` state for later modification.\n\nDefault: true", + "description": "Indicates whether the `Payment` objects created from this `TerminalCheckout` are\nautomatically `COMPLETED` or left in an `APPROVED` state for later modification.\n\nDefault: true", "nullable": true }, "delay_duration": { @@ -35097,7 +35119,6 @@ "delay_action": { "$ref": "#/components/schemas/PaymentOptionsDelayAction", "description": "The action to be applied to the `Payment` when the delay_duration has elapsed.\nThe action must be CANCEL or COMPLETE.\n\nThe action cannot be set to COMPLETE if an `order_id` is present on the TerminalCheckout.\n\nThis parameter can only be set for a delayed capture payment (`autocomplete=false`). For more\ninformation, see [Delayed Capture](https://developer.squareup.com/docs/payments-api/take-payments/card-payments/delayed-capture#time-threshold).\n\nDefault: CANCEL\nSee [DelayAction](#type-delayaction) for possible values", - "x-release-status": "BETA", "nullable": true } } @@ -35119,7 +35140,7 @@ } ], "description": "Describes the action to be applied to a delayed capture payment when the delay_duration\nhas elapsed.", - "x-release-status": "BETA" + "x-release-status": "PUBLIC" }, "PaymentRefund": { "type": "object", @@ -35818,7 +35839,7 @@ "given_name": "Amelia", "phone_number": "1-212-555-4240" }, - "public_url": "https://squareup.com/pay-invoice/inv:0-ChCHu2mZEabLeeHahQnXDjZQECY", + "public_url": "https://squareup.com/pay-invoice/invtmp:5e22a2c2-47c1-46d6-b061-808764dfe2b9", "sale_or_service_date": "2030-01-24", "scheduled_at": "2030-01-13T10:00:00Z", "status": "SCHEDULED", @@ -40485,7 +40506,7 @@ "given_name": "Amelia", "phone_number": "1-212-555-4240" }, - "public_url": "https://squareup.com/pay-invoice/h9sfsfTGTSnYEhISUDBhEQ", + "public_url": "https://squareup.com/pay-invoice/invtmp:5e22a2c2-47c1-46d6-b061-808764dfe2b9", "sale_or_service_date": "2030-01-24", "status": "PARTIALLY_PAID", "store_payment_method_enabled": false, @@ -44512,7 +44533,7 @@ }, "payment_options": { "$ref": "#/components/schemas/PaymentOptions", - "description": "Payment-specific options for the checkout request. Supported only in the US.", + "description": "Payment-specific options for the checkout request.", "nullable": true }, "device_options": { @@ -44572,7 +44593,6 @@ "team_member_id": { "type": "string", "description": "An optional ID of the team member associated with creating the checkout.", - "x-release-status": "BETA", "nullable": true }, "customer_id": { @@ -44582,20 +44602,18 @@ }, "app_fee_money": { "$ref": "#/components/schemas/Money", - "description": "The amount the developer is taking as a fee for facilitating the payment on behalf\nof the seller.\n\nThe amount cannot be more than 90% of the total amount of the payment.\n\nThe amount must be specified in the smallest denomination of the applicable currency (for example, US dollar amounts are specified in cents). For more information, see [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts).\n\nThe fee currency code must match the currency associated with the seller that is accepting the payment. The application must be from a developer account in the same country and using the same currency code as the seller.\n\nFor more information about the application fee scenario, see [Take Payments and Collect Fees](https://developer.squareup.com/docs/payments-api/take-payments-and-collect-fees).\n\nTo set this field, PAYMENTS_WRITE_ADDITIONAL_RECIPIENTS OAuth permission is required. For more information, see [Permissions](https://developer.squareup.com/docs/payments-api/take-payments-and-collect-fees#permissions).\n\nSupported only in the US.", + "description": "The amount the developer is taking as a fee for facilitating the payment on behalf\nof the seller.\n\nThe amount cannot be more than 90% of the total amount of the payment.\n\nThe amount must be specified in the smallest denomination of the applicable currency (for example, US dollar amounts are specified in cents). For more information, see [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts).\n\nThe fee currency code must match the currency associated with the seller that is accepting the payment. The application must be from a developer account in the same country and using the same currency code as the seller.\n\nFor more information about the application fee scenario, see [Take Payments and Collect Fees](https://developer.squareup.com/docs/payments-api/take-payments-and-collect-fees).\n\nTo set this field, PAYMENTS_WRITE_ADDITIONAL_RECIPIENTS OAuth permission is required. For more information, see [Permissions](https://developer.squareup.com/docs/payments-api/take-payments-and-collect-fees#permissions).", "nullable": true }, "statement_description_identifier": { "type": "string", - "description": "Optional additional payment information to include on the customer's card statement as\npart of the statement description. This can be, for example, an invoice number, ticket number,\nor short description that uniquely identifies the purchase. Supported only in the US.", + "description": "Optional additional payment information to include on the customer's card statement as\npart of the statement description. This can be, for example, an invoice number, ticket number,\nor short description that uniquely identifies the purchase.", "maxLength": 20, - "x-release-status": "BETA", "nullable": true }, "tip_money": { "$ref": "#/components/schemas/Money", - "description": "The amount designated as a tip, in addition to `amount_money`. This may only be set for a\ncheckout that has tipping disabled (`tip_settings.allow_tipping` is `false`). Supported only in\nthe US.", - "x-release-status": "BETA", + "description": "The amount designated as a tip, in addition to `amount_money`. This may only be set for a\ncheckout that has tipping disabled (`tip_settings.allow_tipping` is `false`).", "nullable": true } } @@ -64759,7 +64777,7 @@ "name": "version", "optional": true, "env": "VERSION", - "type": "literal\u003c\"2025-03-19\"\u003e" + "type": "literal\u003c\"2025-04-16\"\u003e" } ] } \ No newline at end of file diff --git a/composer.json b/composer.json index 74d8d5df..e15fff03 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "square/square", - "version": "42.0.0.20250319", + "version": "42.1.0.20250416", "description": "Use Square APIs to manage and run business including payment, customer, product, inventory, and employee management.", "keywords": [ "square", diff --git a/src/Catalog/CatalogClient.php b/src/Catalog/CatalogClient.php index 68119489..7d4ed18a 100644 --- a/src/Catalog/CatalogClient.php +++ b/src/Catalog/CatalogClient.php @@ -112,7 +112,7 @@ public function __construct( * @throws SquareException * @throws SquareApiException */ - public function batchDelete(BatchDeleteCatalogObjectsRequest $request = new BatchDeleteCatalogObjectsRequest(), ?array $options = null): BatchDeleteCatalogObjectsResponse + public function batchDelete(BatchDeleteCatalogObjectsRequest $request, ?array $options = null): BatchDeleteCatalogObjectsResponse { $options = array_merge($this->options, $options ?? []); try { diff --git a/src/Catalog/Requests/BatchDeleteCatalogObjectsRequest.php b/src/Catalog/Requests/BatchDeleteCatalogObjectsRequest.php index 36f0eb41..1ad8ba2f 100644 --- a/src/Catalog/Requests/BatchDeleteCatalogObjectsRequest.php +++ b/src/Catalog/Requests/BatchDeleteCatalogObjectsRequest.php @@ -13,34 +13,34 @@ class BatchDeleteCatalogObjectsRequest extends JsonSerializableType * in the graph that depend on that object will be deleted as well (for example, deleting a * CatalogItem will delete its CatalogItemVariation. * - * @var ?array $objectIds + * @var array $objectIds */ #[JsonProperty('object_ids'), ArrayType(['string'])] - private ?array $objectIds; + private array $objectIds; /** * @param array{ - * objectIds?: ?array, + * objectIds: array, * } $values */ public function __construct( - array $values = [], + array $values, ) { - $this->objectIds = $values['objectIds'] ?? null; + $this->objectIds = $values['objectIds']; } /** - * @return ?array + * @return array */ - public function getObjectIds(): ?array + public function getObjectIds(): array { return $this->objectIds; } /** - * @param ?array $value + * @param array $value */ - public function setObjectIds(?array $value = null): self + public function setObjectIds(array $value): self { $this->objectIds = $value; return $this; diff --git a/src/SquareClient.php b/src/SquareClient.php index cd3d5b72..a24f00ef 100644 --- a/src/SquareClient.php +++ b/src/SquareClient.php @@ -247,11 +247,11 @@ public function __construct( $token ??= $this->getFromEnvOrThrow('SQUARE_TOKEN', 'Please pass in token or set the environment variable SQUARE_TOKEN.'); $defaultHeaders = [ 'Authorization' => "Bearer $token", - 'Square-Version' => '2025-03-19', + 'Square-Version' => '2025-04-16', 'X-Fern-Language' => 'PHP', 'X-Fern-SDK-Name' => 'Square', - 'X-Fern-SDK-Version' => '42.0.0.20250319', - 'User-Agent' => 'square/square/42.0.0.20250319', + 'X-Fern-SDK-Version' => '42.1.0.20250416', + 'User-Agent' => 'square/square/42.1.0.20250416', ]; if ($version != null) { $defaultHeaders['Square-Version'] = $version; diff --git a/src/Types/CatalogAvailabilityPeriod.php b/src/Types/CatalogAvailabilityPeriod.php new file mode 100644 index 00000000..7cb80ea0 --- /dev/null +++ b/src/Types/CatalogAvailabilityPeriod.php @@ -0,0 +1,115 @@ + $dayOfWeek + */ + #[JsonProperty('day_of_week')] + private ?string $dayOfWeek; + + /** + * @param array{ + * startLocalTime?: ?string, + * endLocalTime?: ?string, + * dayOfWeek?: ?value-of, + * } $values + */ + public function __construct( + array $values = [], + ) { + $this->startLocalTime = $values['startLocalTime'] ?? null; + $this->endLocalTime = $values['endLocalTime'] ?? null; + $this->dayOfWeek = $values['dayOfWeek'] ?? null; + } + + /** + * @return ?string + */ + public function getStartLocalTime(): ?string + { + return $this->startLocalTime; + } + + /** + * @param ?string $value + */ + public function setStartLocalTime(?string $value = null): self + { + $this->startLocalTime = $value; + return $this; + } + + /** + * @return ?string + */ + public function getEndLocalTime(): ?string + { + return $this->endLocalTime; + } + + /** + * @param ?string $value + */ + public function setEndLocalTime(?string $value = null): self + { + $this->endLocalTime = $value; + return $this; + } + + /** + * @return ?value-of + */ + public function getDayOfWeek(): ?string + { + return $this->dayOfWeek; + } + + /** + * @param ?value-of $value + */ + public function setDayOfWeek(?string $value = null): self + { + $this->dayOfWeek = $value; + return $this; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Types/CatalogItem.php b/src/Types/CatalogItem.php index 44d63d5d..4cfa4696 100644 --- a/src/Types/CatalogItem.php +++ b/src/Types/CatalogItem.php @@ -126,6 +126,18 @@ class CatalogItem extends JsonSerializableType #[JsonProperty('item_options'), ArrayType([CatalogItemOptionForItem::class])] private ?array $itemOptions; + /** + * @var ?string $ecomUri Deprecated; see go/ecomUriUseCases. A URI pointing to a published e-commerce product page for the Item. + */ + #[JsonProperty('ecom_uri')] + private ?string $ecomUri; + + /** + * @var ?array $ecomImageUris Deprecated; see go/ecomUriUseCases. A comma-separated list of encoded URIs pointing to a set of published e-commerce images for the Item. + */ + #[JsonProperty('ecom_image_uris'), ArrayType(['string'])] + private ?array $ecomImageUris; + /** * The IDs of images associated with this `CatalogItem` instance. * These images will be shown to customers in Square Online Store. @@ -223,6 +235,12 @@ class CatalogItem extends JsonSerializableType #[JsonProperty('reporting_category')] private ?CatalogObjectCategory $reportingCategory; + /** + * @var ?bool $isAlcoholic Indicates whether this item is alcoholic (`true`) or not (`false`). + */ + #[JsonProperty('is_alcoholic')] + private ?bool $isAlcoholic; + /** * @param array{ * name?: ?string, @@ -237,6 +255,8 @@ class CatalogItem extends JsonSerializableType * productType?: ?value-of, * skipModifierScreen?: ?bool, * itemOptions?: ?array, + * ecomUri?: ?string, + * ecomImageUris?: ?array, * imageIds?: ?array, * sortName?: ?string, * categories?: ?array, @@ -247,6 +267,7 @@ class CatalogItem extends JsonSerializableType * ecomSeoData?: ?CatalogEcomSeoData, * foodAndBeverageDetails?: ?CatalogItemFoodAndBeverageDetails, * reportingCategory?: ?CatalogObjectCategory, + * isAlcoholic?: ?bool, * } $values */ public function __construct( @@ -264,6 +285,8 @@ public function __construct( $this->productType = $values['productType'] ?? null; $this->skipModifierScreen = $values['skipModifierScreen'] ?? null; $this->itemOptions = $values['itemOptions'] ?? null; + $this->ecomUri = $values['ecomUri'] ?? null; + $this->ecomImageUris = $values['ecomImageUris'] ?? null; $this->imageIds = $values['imageIds'] ?? null; $this->sortName = $values['sortName'] ?? null; $this->categories = $values['categories'] ?? null; @@ -274,6 +297,7 @@ public function __construct( $this->ecomSeoData = $values['ecomSeoData'] ?? null; $this->foodAndBeverageDetails = $values['foodAndBeverageDetails'] ?? null; $this->reportingCategory = $values['reportingCategory'] ?? null; + $this->isAlcoholic = $values['isAlcoholic'] ?? null; } /** @@ -480,6 +504,40 @@ public function setItemOptions(?array $value = null): self return $this; } + /** + * @return ?string + */ + public function getEcomUri(): ?string + { + return $this->ecomUri; + } + + /** + * @param ?string $value + */ + public function setEcomUri(?string $value = null): self + { + $this->ecomUri = $value; + return $this; + } + + /** + * @return ?array + */ + public function getEcomImageUris(): ?array + { + return $this->ecomImageUris; + } + + /** + * @param ?array $value + */ + public function setEcomImageUris(?array $value = null): self + { + $this->ecomImageUris = $value; + return $this; + } + /** * @return ?array */ @@ -650,6 +708,23 @@ public function setReportingCategory(?CatalogObjectCategory $value = null): self return $this; } + /** + * @return ?bool + */ + public function getIsAlcoholic(): ?bool + { + return $this->isAlcoholic; + } + + /** + * @param ?bool $value + */ + public function setIsAlcoholic(?bool $value = null): self + { + $this->isAlcoholic = $value; + return $this; + } + /** * @return string */ diff --git a/src/Types/CatalogObject.php b/src/Types/CatalogObject.php index 9f4b04ad..c4be09b5 100644 --- a/src/Types/CatalogObject.php +++ b/src/Types/CatalogObject.php @@ -48,6 +48,8 @@ class CatalogObject extends JsonSerializableType * |'CHECKOUT_LINK' * |'ADDRESS' * |'SUBSCRIPTION_PRODUCT' + * |'SUBSCRIPTION_PLAN_VARIATION' + * |'AVAILABILITY_PERIOD' * |'_unknown' * ) $type */ @@ -81,6 +83,8 @@ class CatalogObject extends JsonSerializableType * |CatalogObjectCheckoutLink * |CatalogObjectAddress * |CatalogObjectSubscriptionProduct + * |CatalogObjectSubscriptionPlanVariation + * |CatalogObjectAvailabilityPeriod * |mixed * ) $value */ @@ -115,6 +119,8 @@ class CatalogObject extends JsonSerializableType * |'CHECKOUT_LINK' * |'ADDRESS' * |'SUBSCRIPTION_PRODUCT' + * |'SUBSCRIPTION_PLAN_VARIATION' + * |'AVAILABILITY_PERIOD' * |'_unknown' * ), * value: ( @@ -144,6 +150,8 @@ class CatalogObject extends JsonSerializableType * |CatalogObjectCheckoutLink * |CatalogObjectAddress * |CatalogObjectSubscriptionProduct + * |CatalogObjectSubscriptionPlanVariation + * |CatalogObjectAvailabilityPeriod * |mixed * ), * } $values @@ -183,6 +191,8 @@ private function __construct( * |'CHECKOUT_LINK' * |'ADDRESS' * |'SUBSCRIPTION_PRODUCT' + * |'SUBSCRIPTION_PLAN_VARIATION' + * |'AVAILABILITY_PERIOD' * |'_unknown' * ) */ @@ -219,6 +229,8 @@ public function getType(): string * |CatalogObjectCheckoutLink * |CatalogObjectAddress * |CatalogObjectSubscriptionProduct + * |CatalogObjectSubscriptionPlanVariation + * |CatalogObjectAvailabilityPeriod * |mixed * ) */ @@ -539,6 +551,30 @@ public static function subscriptionProduct(CatalogObjectSubscriptionProduct $sub ]); } + /** + * @param CatalogObjectSubscriptionPlanVariation $subscriptionPlanVariation + * @return CatalogObject + */ + public static function subscriptionPlanVariation(CatalogObjectSubscriptionPlanVariation $subscriptionPlanVariation): CatalogObject + { + return new CatalogObject([ + 'type' => 'SUBSCRIPTION_PLAN_VARIATION', + 'value' => $subscriptionPlanVariation, + ]); + } + + /** + * @param CatalogObjectAvailabilityPeriod $availabilityPeriod + * @return CatalogObject + */ + public static function availabilityPeriod(CatalogObjectAvailabilityPeriod $availabilityPeriod): CatalogObject + { + return new CatalogObject([ + 'type' => 'AVAILABILITY_PERIOD', + 'value' => $availabilityPeriod, + ]); + } + /** * @return bool */ @@ -1111,6 +1147,50 @@ public function asSubscriptionProduct(): CatalogObjectSubscriptionProduct return $this->value; } + /** + * @return bool + */ + public function isSubscriptionPlanVariation(): bool + { + return $this->value instanceof CatalogObjectSubscriptionPlanVariation && $this->type === 'SUBSCRIPTION_PLAN_VARIATION'; + } + + /** + * @return CatalogObjectSubscriptionPlanVariation + */ + public function asSubscriptionPlanVariation(): CatalogObjectSubscriptionPlanVariation + { + if (!($this->value instanceof CatalogObjectSubscriptionPlanVariation && $this->type === 'SUBSCRIPTION_PLAN_VARIATION')) { + throw new Exception( + "Expected SUBSCRIPTION_PLAN_VARIATION; got " . $this->type . " with value of type " . get_debug_type($this->value), + ); + } + + return $this->value; + } + + /** + * @return bool + */ + public function isAvailabilityPeriod(): bool + { + return $this->value instanceof CatalogObjectAvailabilityPeriod && $this->type === 'AVAILABILITY_PERIOD'; + } + + /** + * @return CatalogObjectAvailabilityPeriod + */ + public function asAvailabilityPeriod(): CatalogObjectAvailabilityPeriod + { + if (!($this->value instanceof CatalogObjectAvailabilityPeriod && $this->type === 'AVAILABILITY_PERIOD')) { + throw new Exception( + "Expected AVAILABILITY_PERIOD; got " . $this->type . " with value of type " . get_debug_type($this->value), + ); + } + + return $this->value; + } + /** * @return string */ @@ -1235,6 +1315,14 @@ public function jsonSerialize(): array $value = $this->asSubscriptionProduct()->jsonSerialize(); $result = array_merge($value, $result); break; + case 'SUBSCRIPTION_PLAN_VARIATION': + $value = $this->asSubscriptionPlanVariation()->jsonSerialize(); + $result = array_merge($value, $result); + break; + case 'AVAILABILITY_PERIOD': + $value = $this->asAvailabilityPeriod()->jsonSerialize(); + $result = array_merge($value, $result); + break; case '_unknown': default: if (is_null($this->value)) { @@ -1361,6 +1449,12 @@ public static function jsonDeserialize(array $data): static case 'SUBSCRIPTION_PRODUCT': $args['value'] = CatalogObjectSubscriptionProduct::jsonDeserialize($data); break; + case 'SUBSCRIPTION_PLAN_VARIATION': + $args['value'] = CatalogObjectSubscriptionPlanVariation::jsonDeserialize($data); + break; + case 'AVAILABILITY_PERIOD': + $args['value'] = CatalogObjectAvailabilityPeriod::jsonDeserialize($data); + break; case '_unknown': default: $args['type'] = '_unknown'; diff --git a/src/Types/CatalogObjectAvailabilityPeriod.php b/src/Types/CatalogObjectAvailabilityPeriod.php new file mode 100644 index 00000000..78a558a4 --- /dev/null +++ b/src/Types/CatalogObjectAvailabilityPeriod.php @@ -0,0 +1,74 @@ +, + * catalogV1Ids?: ?array, + * presentAtAllLocations?: ?bool, + * presentAtLocationIds?: ?array, + * absentAtLocationIds?: ?array, + * imageId?: ?string, + * availabilityPeriodData?: ?CatalogAvailabilityPeriod, + * } $values + */ + public function __construct( + array $values, + ) { + $this->id = $values['id']; + $this->updatedAt = $values['updatedAt'] ?? null; + $this->version = $values['version'] ?? null; + $this->isDeleted = $values['isDeleted'] ?? null; + $this->customAttributeValues = $values['customAttributeValues'] ?? null; + $this->catalogV1Ids = $values['catalogV1Ids'] ?? null; + $this->presentAtAllLocations = $values['presentAtAllLocations'] ?? null; + $this->presentAtLocationIds = $values['presentAtLocationIds'] ?? null; + $this->absentAtLocationIds = $values['absentAtLocationIds'] ?? null; + $this->imageId = $values['imageId'] ?? null; + $this->availabilityPeriodData = $values['availabilityPeriodData'] ?? null; + } + + /** + * @return ?CatalogAvailabilityPeriod + */ + public function getAvailabilityPeriodData(): ?CatalogAvailabilityPeriod + { + return $this->availabilityPeriodData; + } + + /** + * @param ?CatalogAvailabilityPeriod $value + */ + public function setAvailabilityPeriodData(?CatalogAvailabilityPeriod $value = null): self + { + $this->availabilityPeriodData = $value; + return $this; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Types/CatalogObjectSubscriptionPlanVariation.php b/src/Types/CatalogObjectSubscriptionPlanVariation.php new file mode 100644 index 00000000..dd5f27aa --- /dev/null +++ b/src/Types/CatalogObjectSubscriptionPlanVariation.php @@ -0,0 +1,74 @@ +, + * catalogV1Ids?: ?array, + * presentAtAllLocations?: ?bool, + * presentAtLocationIds?: ?array, + * absentAtLocationIds?: ?array, + * imageId?: ?string, + * subscriptionPlanVariationData?: ?CatalogSubscriptionPlanVariation, + * } $values + */ + public function __construct( + array $values, + ) { + $this->id = $values['id']; + $this->updatedAt = $values['updatedAt'] ?? null; + $this->version = $values['version'] ?? null; + $this->isDeleted = $values['isDeleted'] ?? null; + $this->customAttributeValues = $values['customAttributeValues'] ?? null; + $this->catalogV1Ids = $values['catalogV1Ids'] ?? null; + $this->presentAtAllLocations = $values['presentAtAllLocations'] ?? null; + $this->presentAtLocationIds = $values['presentAtLocationIds'] ?? null; + $this->absentAtLocationIds = $values['absentAtLocationIds'] ?? null; + $this->imageId = $values['imageId'] ?? null; + $this->subscriptionPlanVariationData = $values['subscriptionPlanVariationData'] ?? null; + } + + /** + * @return ?CatalogSubscriptionPlanVariation + */ + public function getSubscriptionPlanVariationData(): ?CatalogSubscriptionPlanVariation + { + return $this->subscriptionPlanVariationData; + } + + /** + * @param ?CatalogSubscriptionPlanVariation $value + */ + public function setSubscriptionPlanVariationData(?CatalogSubscriptionPlanVariation $value = null): self + { + $this->subscriptionPlanVariationData = $value; + return $this; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Types/CatalogSubscriptionPlanVariation.php b/src/Types/CatalogSubscriptionPlanVariation.php new file mode 100644 index 00000000..ace0d144 --- /dev/null +++ b/src/Types/CatalogSubscriptionPlanVariation.php @@ -0,0 +1,185 @@ + $phases A list containing each [SubscriptionPhase](entity:SubscriptionPhase) for this plan variation. + */ + #[JsonProperty('phases'), ArrayType([SubscriptionPhase::class])] + private array $phases; + + /** + * @var ?string $subscriptionPlanId The id of the subscription plan, if there is one. + */ + #[JsonProperty('subscription_plan_id')] + private ?string $subscriptionPlanId; + + /** + * @var ?int $monthlyBillingAnchorDate The day of the month the billing period starts. + */ + #[JsonProperty('monthly_billing_anchor_date')] + private ?int $monthlyBillingAnchorDate; + + /** + * @var ?bool $canProrate Whether bills for this plan variation can be split for proration. + */ + #[JsonProperty('can_prorate')] + private ?bool $canProrate; + + /** + * The ID of a "successor" plan variation to this one. If the field is set, and this object is disabled at all + * locations, it indicates that this variation is deprecated and the object identified by the successor ID be used in + * its stead. + * + * @var ?string $successorPlanVariationId + */ + #[JsonProperty('successor_plan_variation_id')] + private ?string $successorPlanVariationId; + + /** + * @param array{ + * name: string, + * phases: array, + * subscriptionPlanId?: ?string, + * monthlyBillingAnchorDate?: ?int, + * canProrate?: ?bool, + * successorPlanVariationId?: ?string, + * } $values + */ + public function __construct( + array $values, + ) { + $this->name = $values['name']; + $this->phases = $values['phases']; + $this->subscriptionPlanId = $values['subscriptionPlanId'] ?? null; + $this->monthlyBillingAnchorDate = $values['monthlyBillingAnchorDate'] ?? null; + $this->canProrate = $values['canProrate'] ?? null; + $this->successorPlanVariationId = $values['successorPlanVariationId'] ?? null; + } + + /** + * @return string + */ + public function getName(): string + { + return $this->name; + } + + /** + * @param string $value + */ + public function setName(string $value): self + { + $this->name = $value; + return $this; + } + + /** + * @return array + */ + public function getPhases(): array + { + return $this->phases; + } + + /** + * @param array $value + */ + public function setPhases(array $value): self + { + $this->phases = $value; + return $this; + } + + /** + * @return ?string + */ + public function getSubscriptionPlanId(): ?string + { + return $this->subscriptionPlanId; + } + + /** + * @param ?string $value + */ + public function setSubscriptionPlanId(?string $value = null): self + { + $this->subscriptionPlanId = $value; + return $this; + } + + /** + * @return ?int + */ + public function getMonthlyBillingAnchorDate(): ?int + { + return $this->monthlyBillingAnchorDate; + } + + /** + * @param ?int $value + */ + public function setMonthlyBillingAnchorDate(?int $value = null): self + { + $this->monthlyBillingAnchorDate = $value; + return $this; + } + + /** + * @return ?bool + */ + public function getCanProrate(): ?bool + { + return $this->canProrate; + } + + /** + * @param ?bool $value + */ + public function setCanProrate(?bool $value = null): self + { + $this->canProrate = $value; + return $this; + } + + /** + * @return ?string + */ + public function getSuccessorPlanVariationId(): ?string + { + return $this->successorPlanVariationId; + } + + /** + * @param ?string $value + */ + public function setSuccessorPlanVariationId(?string $value = null): self + { + $this->successorPlanVariationId = $value; + return $this; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Types/Invoice.php b/src/Types/Invoice.php index 6639b98b..8b1b497c 100644 --- a/src/Types/Invoice.php +++ b/src/Types/Invoice.php @@ -131,9 +131,12 @@ class Invoice extends JsonSerializableType private ?string $scheduledAt; /** - * The URL of the Square-hosted invoice page. - * After you publish the invoice using the `PublishInvoice` endpoint, Square hosts the invoice - * page and returns the page URL in the response. + * A temporary link to the Square-hosted payment page where the customer can pay the + * invoice. If the link expires, customers can provide the email address or phone number + * associated with the invoice and request a new link directly from the expired payment page. + * + * This field is added after the invoice is published and reaches the scheduled date + * (if one is defined). * * @var ?string $publicUrl */ diff --git a/src/Types/PaymentOptions.php b/src/Types/PaymentOptions.php index 5791a2b4..d0a70859 100644 --- a/src/Types/PaymentOptions.php +++ b/src/Types/PaymentOptions.php @@ -8,8 +8,8 @@ class PaymentOptions extends JsonSerializableType { /** - * Indicates whether the `Payment` objects created from this `TerminalCheckout` are automatically - * `COMPLETED` or left in an `APPROVED` state for later modification. + * Indicates whether the `Payment` objects created from this `TerminalCheckout` are + * automatically `COMPLETED` or left in an `APPROVED` state for later modification. * * Default: true * diff --git a/src/Types/TerminalCheckout.php b/src/Types/TerminalCheckout.php index d040de7f..0258f6c7 100644 --- a/src/Types/TerminalCheckout.php +++ b/src/Types/TerminalCheckout.php @@ -50,7 +50,7 @@ class TerminalCheckout extends JsonSerializableType private ?string $orderId; /** - * @var ?PaymentOptions $paymentOptions Payment-specific options for the checkout request. Supported only in the US. + * @var ?PaymentOptions $paymentOptions Payment-specific options for the checkout request. */ #[JsonProperty('payment_options')] private ?PaymentOptions $paymentOptions; @@ -158,8 +158,6 @@ class TerminalCheckout extends JsonSerializableType * * To set this field, PAYMENTS_WRITE_ADDITIONAL_RECIPIENTS OAuth permission is required. For more information, see [Permissions](https://developer.squareup.com/docs/payments-api/take-payments-and-collect-fees#permissions). * - * Supported only in the US. - * * @var ?Money $appFeeMoney */ #[JsonProperty('app_fee_money')] @@ -168,7 +166,7 @@ class TerminalCheckout extends JsonSerializableType /** * Optional additional payment information to include on the customer's card statement as * part of the statement description. This can be, for example, an invoice number, ticket number, - * or short description that uniquely identifies the purchase. Supported only in the US. + * or short description that uniquely identifies the purchase. * * @var ?string $statementDescriptionIdentifier */ @@ -177,8 +175,7 @@ class TerminalCheckout extends JsonSerializableType /** * The amount designated as a tip, in addition to `amount_money`. This may only be set for a - * checkout that has tipping disabled (`tip_settings.allow_tipping` is `false`). Supported only in - * the US. + * checkout that has tipping disabled (`tip_settings.allow_tipping` is `false`). * * @var ?Money $tipMoney */