diff --git a/composer.json b/composer.json index 6da480ae..e864c6ef 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": "31.0.0.20230925", + "version": "32.0.0.20231018", "type": "library", "keywords": [ "Square", diff --git a/doc/apis/bookings.md b/doc/apis/bookings.md index 7b1ed6ab..466a849d 100644 --- a/doc/apis/bookings.md +++ b/doc/apis/bookings.md @@ -15,6 +15,8 @@ $bookingsApi = $client->getBookingsApi(); * [Search Availability](../../doc/apis/bookings.md#search-availability) * [Bulk Retrieve Bookings](../../doc/apis/bookings.md#bulk-retrieve-bookings) * [Retrieve Business Booking Profile](../../doc/apis/bookings.md#retrieve-business-booking-profile) +* [List Location Booking Profiles](../../doc/apis/bookings.md#list-location-booking-profiles) +* [Retrieve Location Booking Profile](../../doc/apis/bookings.md#retrieve-location-booking-profile) * [List Team Member Booking Profiles](../../doc/apis/bookings.md#list-team-member-booking-profiles) * [Bulk Retrieve Team Member Booking Profiles](../../doc/apis/bookings.md#bulk-retrieve-team-member-booking-profiles) * [Retrieve Team Member Booking Profile](../../doc/apis/bookings.md#retrieve-team-member-booking-profile) @@ -249,6 +251,79 @@ var_dump($apiResponse->getHeaders()); ``` +# List Location Booking Profiles + +Lists location booking profiles of a seller. + +```php +function listLocationBookingProfiles(?int $limit = null, ?string $cursor = null): ApiResponse +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `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. | + +## Response Type + +This method returns a `Square\Utils\ApiResponse` instance. The `getResult()` method on this instance returns the response data which is of type [`ListLocationBookingProfilesResponse`](../../doc/models/list-location-booking-profiles-response.md). + +## Example Usage + +```php +$apiResponse = $bookingsApi->listLocationBookingProfiles(); + +if ($apiResponse->isSuccess()) { + $listLocationBookingProfilesResponse = $apiResponse->getResult(); +} else { + $errors = $apiResponse->getErrors(); +} + +// Getting more response information +var_dump($apiResponse->getStatusCode()); +var_dump($apiResponse->getHeaders()); +``` + + +# Retrieve Location Booking Profile + +Retrieves a seller's location booking profile. + +```php +function retrieveLocationBookingProfile(string $locationId): ApiResponse +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `locationId` | `string` | Template, Required | The ID of the location to retrieve the booking profile. | + +## Response Type + +This method returns a `Square\Utils\ApiResponse` instance. The `getResult()` method on this instance returns the response data which is of type [`RetrieveLocationBookingProfileResponse`](../../doc/models/retrieve-location-booking-profile-response.md). + +## Example Usage + +```php +$locationId = 'location_id4'; + +$apiResponse = $bookingsApi->retrieveLocationBookingProfile($locationId); + +if ($apiResponse->isSuccess()) { + $retrieveLocationBookingProfileResponse = $apiResponse->getResult(); +} else { + $errors = $apiResponse->getErrors(); +} + +// Getting more response information +var_dump($apiResponse->getStatusCode()); +var_dump($apiResponse->getHeaders()); +``` + + # List Team Member Booking Profiles Lists booking profiles for team members. diff --git a/doc/apis/employees.md b/doc/apis/employees.md index 96fb229c..a6f18aff 100644 --- a/doc/apis/employees.md +++ b/doc/apis/employees.md @@ -18,8 +18,6 @@ $employeesApi = $client->getEmployeesApi(); **This endpoint is deprecated.** -ListEmployees - ```php function listEmployees( ?string $locationId = null, @@ -63,8 +61,6 @@ var_dump($apiResponse->getHeaders()); **This endpoint is deprecated.** -RetrieveEmployee - ```php function retrieveEmployee(string $id): ApiResponse ``` diff --git a/doc/apis/subscriptions.md b/doc/apis/subscriptions.md index 5e403baa..8cbfaa5c 100644 --- a/doc/apis/subscriptions.md +++ b/doc/apis/subscriptions.md @@ -11,10 +11,12 @@ $subscriptionsApi = $client->getSubscriptionsApi(); ## Methods * [Create Subscription](../../doc/apis/subscriptions.md#create-subscription) +* [Bulk Swap Plan](../../doc/apis/subscriptions.md#bulk-swap-plan) * [Search Subscriptions](../../doc/apis/subscriptions.md#search-subscriptions) * [Retrieve Subscription](../../doc/apis/subscriptions.md#retrieve-subscription) * [Update Subscription](../../doc/apis/subscriptions.md#update-subscription) * [Delete Subscription Action](../../doc/apis/subscriptions.md#delete-subscription-action) +* [Change Billing Anchor Date](../../doc/apis/subscriptions.md#change-billing-anchor-date) * [Cancel Subscription](../../doc/apis/subscriptions.md#cancel-subscription) * [List Subscription Events](../../doc/apis/subscriptions.md#list-subscription-events) * [Pause Subscription](../../doc/apis/subscriptions.md#pause-subscription) @@ -88,6 +90,48 @@ var_dump($apiResponse->getHeaders()); ``` +# Bulk Swap Plan + +Schedules a plan variation change for all active subscriptions under a given plan +variation. For more information, see [Swap Subscription Plan Variations](https://developer.squareup.com/docs/subscriptions-api/swap-plan-variations). + +```php +function bulkSwapPlan(BulkSwapPlanRequest $body): ApiResponse +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `body` | [`BulkSwapPlanRequest`](../../doc/models/bulk-swap-plan-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | + +## Response Type + +This method returns a `Square\Utils\ApiResponse` instance. The `getResult()` method on this instance returns the response data which is of type [`BulkSwapPlanResponse`](../../doc/models/bulk-swap-plan-response.md). + +## Example Usage + +```php +$body = BulkSwapPlanRequestBuilder::init( + 'FQ7CDXXWSLUJRPM3GFJSJGZ7', + '6JHXF3B2CW3YKHDV4XEM674H', + 'S8GWD5R9QB376' +)->build(); + +$apiResponse = $subscriptionsApi->bulkSwapPlan($body); + +if ($apiResponse->isSuccess()) { + $bulkSwapPlanResponse = $apiResponse->getResult(); +} else { + $errors = $apiResponse->getErrors(); +} + +// Getting more response information +var_dump($apiResponse->getStatusCode()); +var_dump($apiResponse->getHeaders()); +``` + + # Search Subscriptions Searches for subscriptions. @@ -294,6 +338,52 @@ var_dump($apiResponse->getHeaders()); ``` +# Change Billing Anchor Date + +Changes the [billing anchor date](https://developer.squareup.com/docs/subscriptions-api/subscription-billing#billing-dates) +for a subscription. + +```php +function changeBillingAnchorDate(string $subscriptionId, ChangeBillingAnchorDateRequest $body): ApiResponse +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `subscriptionId` | `string` | Template, Required | The ID of the subscription to update the billing anchor date. | +| `body` | [`ChangeBillingAnchorDateRequest`](../../doc/models/change-billing-anchor-date-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | + +## Response Type + +This method returns a `Square\Utils\ApiResponse` instance. The `getResult()` method on this instance returns the response data which is of type [`ChangeBillingAnchorDateResponse`](../../doc/models/change-billing-anchor-date-response.md). + +## Example Usage + +```php +$subscriptionId = 'subscription_id0'; + +$body = ChangeBillingAnchorDateRequestBuilder::init() + ->monthlyBillingAnchorDate(1) + ->build(); + +$apiResponse = $subscriptionsApi->changeBillingAnchorDate( + $subscriptionId, + $body +); + +if ($apiResponse->isSuccess()) { + $changeBillingAnchorDateResponse = $apiResponse->getResult(); +} else { + $errors = $apiResponse->getErrors(); +} + +// Getting more response information +var_dump($apiResponse->getStatusCode()); +var_dump($apiResponse->getHeaders()); +``` + + # Cancel Subscription Schedules a `CANCEL` action to cancel an active subscription. This diff --git a/doc/client.md b/doc/client.md index b9f71e68..40a13289 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-09-25'` | +| `squareVersion` | `string` | Square Connect API versions
*Default*: `'2023-10-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-09-25') + ->squareVersion('2023-10-18') ->environment('production') ->customUrl('https://connect.squareup.com') ->build(); @@ -51,7 +51,7 @@ use Square\SquareClientBuilder; $client = SquareClientBuilder::init() ->accessToken('AccessToken') - ->squareVersion('2023-09-25') + ->squareVersion('2023-10-18') ->build(); $apiResponse = $client->getLocationsApi()->listLocations(); diff --git a/doc/models/bulk-swap-plan-request.md b/doc/models/bulk-swap-plan-request.md new file mode 100644 index 00000000..ef34c6a1 --- /dev/null +++ b/doc/models/bulk-swap-plan-request.md @@ -0,0 +1,28 @@ + +# Bulk Swap Plan Request + +Defines input parameters in a call to the +[BulkSwapPlan](../../doc/apis/subscriptions.md#bulk-swap-plan) endpoint. + +## Structure + +`BulkSwapPlanRequest` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `newPlanVariationId` | `string` | Required | The ID of the new subscription plan variation.

This field is required.
**Constraints**: *Minimum Length*: `1` | getNewPlanVariationId(): string | setNewPlanVariationId(string newPlanVariationId): void | +| `oldPlanVariationId` | `string` | Required | The ID of the plan variation whose subscriptions should be swapped. Active subscriptions
using this plan variation will be subscribed to the new plan variation on their next billing
day.
**Constraints**: *Minimum Length*: `1` | getOldPlanVariationId(): string | setOldPlanVariationId(string oldPlanVariationId): void | +| `locationId` | `string` | Required | The ID of the location to associate with the swapped subscriptions.
**Constraints**: *Minimum Length*: `1` | getLocationId(): string | setLocationId(string locationId): void | + +## Example (as JSON) + +```json +{ + "location_id": "S8GWD5R9QB376", + "new_plan_variation_id": "FQ7CDXXWSLUJRPM3GFJSJGZ7", + "old_plan_variation_id": "6JHXF3B2CW3YKHDV4XEM674H" +} +``` + diff --git a/doc/models/bulk-swap-plan-response.md b/doc/models/bulk-swap-plan-response.md new file mode 100644 index 00000000..a31d6b11 --- /dev/null +++ b/doc/models/bulk-swap-plan-response.md @@ -0,0 +1,39 @@ + +# Bulk Swap Plan Response + +Defines output parameters in a response of the +[BulkSwapPlan](../../doc/apis/subscriptions.md#bulk-swap-plan) endpoint. + +## Structure + +`BulkSwapPlanResponse` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `errors` | [`?(Error[])`](../../doc/models/error.md) | Optional | Errors encountered during the request. | getErrors(): ?array | setErrors(?array errors): void | +| `affectedSubscriptions` | `?int` | Optional | The number of affected subscriptions. | getAffectedSubscriptions(): ?int | setAffectedSubscriptions(?int affectedSubscriptions): void | + +## Example (as JSON) + +```json +{ + "affected_subscriptions": 12, + "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/business-booking-profile.md b/doc/models/business-booking-profile.md index b96f5924..48fa3abe 100644 --- a/doc/models/business-booking-profile.md +++ b/doc/models/business-booking-profile.md @@ -1,6 +1,8 @@ # Business Booking Profile +A seller's business booking profile, including booking policy, appointment settings, etc. + ## Structure `BusinessBookingProfile` diff --git a/doc/models/cancel-subscription-response.md b/doc/models/cancel-subscription-response.md index 3aeb13da..28bfbb71 100644 --- a/doc/models/cancel-subscription-response.md +++ b/doc/models/cancel-subscription-response.md @@ -64,8 +64,9 @@ Defines output parameters in a response from the "actions": [ { "id": "id8", - "type": "CANCEL", + "type": "RESUME", "effective_date": "effective_date8", + "monthly_billing_anchor_date": 186, "phases": [ { "uid": "uid0", @@ -85,13 +86,13 @@ Defines output parameters in a response from the "order_template_id": "order_template_id2", "plan_phase_uid": "plan_phase_uid6" } - ], - "new_plan_variation_id": "new_plan_variation_id8" + ] }, { "id": "id8", - "type": "CANCEL", + "type": "RESUME", "effective_date": "effective_date8", + "monthly_billing_anchor_date": 186, "phases": [ { "uid": "uid0", @@ -111,13 +112,13 @@ Defines output parameters in a response from the "order_template_id": "order_template_id2", "plan_phase_uid": "plan_phase_uid6" } - ], - "new_plan_variation_id": "new_plan_variation_id8" + ] }, { "id": "id8", - "type": "CANCEL", + "type": "RESUME", "effective_date": "effective_date8", + "monthly_billing_anchor_date": 186, "phases": [ { "uid": "uid0", @@ -137,8 +138,7 @@ Defines output parameters in a response from the "order_template_id": "order_template_id2", "plan_phase_uid": "plan_phase_uid6" } - ], - "new_plan_variation_id": "new_plan_variation_id8" + ] } ] } diff --git a/doc/models/catalog-query-text.md b/doc/models/catalog-query-text.md index b77b6a30..1fddbdfb 100644 --- a/doc/models/catalog-query-text.md +++ b/doc/models/catalog-query-text.md @@ -11,7 +11,7 @@ The query filter to return the search result whose searchable attribute values c | Name | Type | Tags | Description | Getter | Setter | | --- | --- | --- | --- | --- | --- | -| `keywords` | `string[]` | Required | A list of 1, 2, or 3 search keywords. Keywords with fewer than 3 characters are ignored. | getKeywords(): array | setKeywords(array keywords): void | +| `keywords` | `string[]` | Required | A list of 1, 2, or 3 search keywords. Keywords with fewer than 3 alphanumeric characters are ignored. | getKeywords(): array | setKeywords(array keywords): void | ## Example (as JSON) diff --git a/doc/models/catalog-subscription-plan-variation.md b/doc/models/catalog-subscription-plan-variation.md index e928e1bb..729f95b3 100644 --- a/doc/models/catalog-subscription-plan-variation.md +++ b/doc/models/catalog-subscription-plan-variation.md @@ -15,6 +15,9 @@ For more information, see [Subscription Plans and Variations](https://developer. | `name` | `string` | Required | The name of the plan variation. | getName(): string | setName(string name): void | | `phases` | [`SubscriptionPhase[]`](../../doc/models/subscription-phase.md) | Required | A list containing each [SubscriptionPhase](entity:SubscriptionPhase) for this plan variation. | getPhases(): array | setPhases(array phases): void | | `subscriptionPlanId` | `?string` | Optional | The id of the subscription plan, if there is one. | getSubscriptionPlanId(): ?string | setSubscriptionPlanId(?string subscriptionPlanId): void | +| `monthlyBillingAnchorDate` | `?int` | Optional | The day of the month the billing period starts.
**Constraints**: `>= 1`, `<= 31` | getMonthlyBillingAnchorDate(): ?int | setMonthlyBillingAnchorDate(?int monthlyBillingAnchorDate): void | +| `canProrate` | `?bool` | Optional | Whether bills for this plan variation can be split for proration. | getCanProrate(): ?bool | setCanProrate(?bool canProrate): void | +| `successorPlanVariationId` | `?string` | Optional | 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. | getSuccessorPlanVariationId(): ?string | setSuccessorPlanVariationId(?string successorPlanVariationId): void | ## Example (as JSON) @@ -44,7 +47,10 @@ For more information, see [Subscription Plans and Variations](https://developer. } } ], - "subscription_plan_id": "subscription_plan_id0" + "subscription_plan_id": "subscription_plan_id0", + "monthly_billing_anchor_date": 38, + "can_prorate": false, + "successor_plan_variation_id": "successor_plan_variation_id2" } ``` diff --git a/doc/models/change-billing-anchor-date-request.md b/doc/models/change-billing-anchor-date-request.md new file mode 100644 index 00000000..fcb20075 --- /dev/null +++ b/doc/models/change-billing-anchor-date-request.md @@ -0,0 +1,26 @@ + +# Change Billing Anchor Date Request + +Defines input parameters in a request to the +[ChangeBillingAnchorDate](../../doc/apis/subscriptions.md#change-billing-anchor-date) endpoint. + +## Structure + +`ChangeBillingAnchorDateRequest` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `monthlyBillingAnchorDate` | `?int` | Optional | The anchor day for the billing cycle.
**Constraints**: `>= 1`, `<= 31` | getMonthlyBillingAnchorDate(): ?int | setMonthlyBillingAnchorDate(?int monthlyBillingAnchorDate): void | +| `effectiveDate` | `?string` | Optional | The `YYYY-MM-DD`-formatted date when the scheduled `BILLING_ANCHOR_CHANGE` action takes
place on the subscription.

When this date is unspecified or falls within the current billing cycle, the billing anchor date
is changed immediately. | getEffectiveDate(): ?string | setEffectiveDate(?string effectiveDate): void | + +## Example (as JSON) + +```json +{ + "monthly_billing_anchor_date": 1, + "effective_date": "effective_date8" +} +``` + diff --git a/doc/models/change-billing-anchor-date-response.md b/doc/models/change-billing-anchor-date-response.md new file mode 100644 index 00000000..89587389 --- /dev/null +++ b/doc/models/change-billing-anchor-date-response.md @@ -0,0 +1,74 @@ + +# Change Billing Anchor Date Response + +Defines output parameters in a request to the +[ChangeBillingAnchorDate](../../doc/apis/subscriptions.md#change-billing-anchor-date) endpoint. + +## Structure + +`ChangeBillingAnchorDateResponse` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `errors` | [`?(Error[])`](../../doc/models/error.md) | Optional | Errors encountered during the request. | getErrors(): ?array | setErrors(?array errors): void | +| `subscription` | [`?Subscription`](../../doc/models/subscription.md) | Optional | Represents a subscription purchased by a customer.

For more information, see
[Manage Subscriptions](https://developer.squareup.com/docs/subscriptions-api/manage-subscriptions). | getSubscription(): ?Subscription | setSubscription(?Subscription subscription): void | +| `actions` | [`?(SubscriptionAction[])`](../../doc/models/subscription-action.md) | Optional | A list of a single billing anchor date change for the subscription. | getActions(): ?array | setActions(?array actions): 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" + } + ], + "subscription": { + "id": "id4", + "location_id": "location_id8", + "plan_variation_id": "plan_variation_id8", + "customer_id": "customer_id2", + "start_date": "start_date8" + }, + "actions": [ + { + "id": "id8", + "type": "RESUME", + "effective_date": "effective_date8", + "monthly_billing_anchor_date": 186, + "phases": [ + { + "uid": "uid0", + "ordinal": 78, + "order_template_id": "order_template_id2", + "plan_phase_uid": "plan_phase_uid6" + }, + { + "uid": "uid0", + "ordinal": 78, + "order_template_id": "order_template_id2", + "plan_phase_uid": "plan_phase_uid6" + }, + { + "uid": "uid0", + "ordinal": 78, + "order_template_id": "order_template_id2", + "plan_phase_uid": "plan_phase_uid6" + } + ] + } + ] +} +``` + diff --git a/doc/models/create-subscription-request.md b/doc/models/create-subscription-request.md index f5591bb3..45c0e815 100644 --- a/doc/models/create-subscription-request.md +++ b/doc/models/create-subscription-request.md @@ -23,6 +23,7 @@ Defines input parameters in a request to the | `cardId` | `?string` | Optional | The ID of the [subscriber's](entity:Customer) [card](entity:Card) to charge.
If it is not specified, the subscriber receives an invoice via email with a link to pay for their subscription. | getCardId(): ?string | setCardId(?string cardId): void | | `timezone` | `?string` | Optional | The timezone that is used in date calculations for the subscription. If unset, defaults to
the location timezone. If a timezone is not configured for the location, defaults to "America/New_York".
Format: the IANA Timezone Database identifier for the location timezone. For
a list of time zones, see [List of tz database time zones](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). | getTimezone(): ?string | setTimezone(?string timezone): void | | `source` | [`?SubscriptionSource`](../../doc/models/subscription-source.md) | Optional | The origination details of the subscription. | getSource(): ?SubscriptionSource | setSource(?SubscriptionSource source): void | +| `monthlyBillingAnchorDate` | `?int` | Optional | The day-of-the-month to change the billing date to.
**Constraints**: `>= 1`, `<= 31` | getMonthlyBillingAnchorDate(): ?int | setMonthlyBillingAnchorDate(?int monthlyBillingAnchorDate): void | | `phases` | [`?(Phase[])`](../../doc/models/phase.md) | Optional | array of phases for this subscription | getPhases(): ?array | setPhases(?array phases): void | ## Example (as JSON) diff --git a/doc/models/device-status-category.md b/doc/models/device-status-category.md index 038f5582..96ca1c67 100644 --- a/doc/models/device-status-category.md +++ b/doc/models/device-status-category.md @@ -11,4 +11,5 @@ | --- | | `AVAILABLE` | | `NEEDS_ATTENTION` | +| `OFFLINE` | diff --git a/doc/models/device-status.md b/doc/models/device-status.md index 6898d117..936a5898 100644 --- a/doc/models/device-status.md +++ b/doc/models/device-status.md @@ -15,7 +15,7 @@ ```json { - "category": "AVAILABLE" + "category": "NEEDS_ATTENTION" } ``` diff --git a/doc/models/get-device-response.md b/doc/models/get-device-response.md index 9e79b3ca..c835fe49 100644 --- a/doc/models/get-device-response.md +++ b/doc/models/get-device-response.md @@ -16,34 +16,26 @@ ```json { - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "MAP_KEY_LENGTH_TOO_LONG", - "detail": "detail6", - "field": "field4" - } - ], "device": { - "id": "id6", "attributes": { - "type": "type4", - "manufacturer": "manufacturer2", - "model": "model2", - "name": "name4", - "manufacturers_id": "manufacturers_id0", - "updated_at": "updated_at0", - "version": "version0" + "manufacturer": "Square", + "manufacturers_id": "995CS397A6475287", + "merchant_token": "MLCHXZCBWFGDW", + "model": "T2", + "name": "Square Terminal 995", + "type": "TERMINAL", + "updated_at": "2023-09-29T13:12:22.365049321Z", + "version": "5.41.0085" }, "components": [ { - "type": "BATTERY", "application_details": { "application_type": "TERMINAL_API", - "version": "version4", - "session_location": "session_location0", + "session_location": "LMN2K7S3RTOU3", + "version": "6.25", "device_code_id": "device_code_id2" }, + "type": "APPLICATION", "card_reader_details": { "version": "version0" }, @@ -66,16 +58,16 @@ } }, { - "type": "BATTERY", + "card_reader_details": { + "version": "3.53.70" + }, + "type": "CARD_READER", "application_details": { "application_type": "TERMINAL_API", "version": "version4", "session_location": "session_location0", "device_code_id": "device_code_id2" }, - "card_reader_details": { - "version": "version0" - }, "battery_details": { "visible_percent": 108, "external_power": "AVAILABLE_CHARGING" @@ -95,6 +87,10 @@ } }, { + "battery_details": { + "external_power": "AVAILABLE_CHARGING", + "visible_percent": 5 + }, "type": "BATTERY", "application_details": { "application_type": "TERMINAL_API", @@ -105,10 +101,6 @@ "card_reader_details": { "version": "version0" }, - "battery_details": { - "visible_percent": 108, - "external_power": "AVAILABLE_CHARGING" - }, "wifi_details": { "active": false, "ssid": "ssid8", @@ -122,12 +114,78 @@ "active": false, "ip_address_v4": "ip_address_v42" } + }, + { + "type": "WIFI", + "wifi_details": { + "active": true, + "ip_address_v4": "10.0.0.7", + "secure_connection": "WPA/WPA2 PSK", + "signal_strength": { + "value": 2 + }, + "ssid": "Staff Network" + }, + "application_details": { + "application_type": "TERMINAL_API", + "version": "version4", + "session_location": "session_location0", + "device_code_id": "device_code_id2" + }, + "card_reader_details": { + "version": "version0" + }, + "battery_details": { + "visible_percent": 108, + "external_power": "AVAILABLE_CHARGING" + }, + "ethernet_details": { + "active": false, + "ip_address_v4": "ip_address_v42" + } + }, + { + "ethernet_details": { + "active": false + }, + "type": "ETHERNET", + "application_details": { + "application_type": "TERMINAL_API", + "version": "version4", + "session_location": "session_location0", + "device_code_id": "device_code_id2" + }, + "card_reader_details": { + "version": "version0" + }, + "battery_details": { + "visible_percent": 108, + "external_power": "AVAILABLE_CHARGING" + }, + "wifi_details": { + "active": false, + "ssid": "ssid8", + "ip_address_v4": "ip_address_v42", + "secure_connection": "secure_connection8", + "signal_strength": { + "value": 222 + } + } } ], + "id": "device:995CS397A6475287", "status": { "category": "AVAILABLE" } - } + }, + "errors": [ + { + "category": "MERCHANT_SUBSCRIPTION_ERROR", + "code": "MAP_KEY_LENGTH_TOO_LONG", + "detail": "detail6", + "field": "field4" + } + ] } ``` diff --git a/doc/models/list-devices-response.md b/doc/models/list-devices-response.md index 223bf9ea..7f6f2388 100644 --- a/doc/models/list-devices-response.md +++ b/doc/models/list-devices-response.md @@ -17,47 +17,28 @@ ```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" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "MAP_KEY_LENGTH_TOO_LONG", - "detail": "detail6", - "field": "field4" - } - ], + "cursor": "GcXjlV2iaizH7R0fMT6wUDbw6l4otigjzx8XOOspUKHo9EPLRByM", "devices": [ { - "id": "id4", "attributes": { - "type": "type4", - "manufacturer": "manufacturer2", - "model": "model2", - "name": "name4", - "manufacturers_id": "manufacturers_id0", - "updated_at": "updated_at0", - "version": "version0" + "manufacturer": "Square", + "manufacturers_id": "995CS397A6475287", + "merchant_token": "MLCHNZCBWFDZB", + "model": "T2", + "name": "Square Terminal 995", + "type": "TERMINAL", + "updated_at": "2023-09-29T13:04:56.335762883Z", + "version": "5.41.0085" }, "components": [ { - "type": "BATTERY", "application_details": { "application_type": "TERMINAL_API", - "version": "version4", - "session_location": "session_location0", + "session_location": "LMN2K7S3RTOU3", + "version": "6.25", "device_code_id": "device_code_id2" }, + "type": "APPLICATION", "card_reader_details": { "version": "version0" }, @@ -80,16 +61,16 @@ } }, { - "type": "BATTERY", + "card_reader_details": { + "version": "3.53.70" + }, + "type": "CARD_READER", "application_details": { "application_type": "TERMINAL_API", "version": "version4", "session_location": "session_location0", "device_code_id": "device_code_id2" }, - "card_reader_details": { - "version": "version0" - }, "battery_details": { "visible_percent": 108, "external_power": "AVAILABLE_CHARGING" @@ -107,32 +88,118 @@ "active": false, "ip_address_v4": "ip_address_v42" } + }, + { + "battery_details": { + "external_power": "AVAILABLE_CHARGING", + "visible_percent": 5 + }, + "type": "BATTERY", + "application_details": { + "application_type": "TERMINAL_API", + "version": "version4", + "session_location": "session_location0", + "device_code_id": "device_code_id2" + }, + "card_reader_details": { + "version": "version0" + }, + "wifi_details": { + "active": false, + "ssid": "ssid8", + "ip_address_v4": "ip_address_v42", + "secure_connection": "secure_connection8", + "signal_strength": { + "value": 222 + } + }, + "ethernet_details": { + "active": false, + "ip_address_v4": "ip_address_v42" + } + }, + { + "type": "WIFI", + "wifi_details": { + "active": true, + "ip_address_v4": "10.0.0.7", + "secure_connection": "WPA/WPA2 PSK", + "signal_strength": { + "value": 2 + }, + "ssid": "Staff Network" + }, + "application_details": { + "application_type": "TERMINAL_API", + "version": "version4", + "session_location": "session_location0", + "device_code_id": "device_code_id2" + }, + "card_reader_details": { + "version": "version0" + }, + "battery_details": { + "visible_percent": 108, + "external_power": "AVAILABLE_CHARGING" + }, + "ethernet_details": { + "active": false, + "ip_address_v4": "ip_address_v42" + } + }, + { + "ethernet_details": { + "active": false + }, + "type": "ETHERNET", + "application_details": { + "application_type": "TERMINAL_API", + "version": "version4", + "session_location": "session_location0", + "device_code_id": "device_code_id2" + }, + "card_reader_details": { + "version": "version0" + }, + "battery_details": { + "visible_percent": 108, + "external_power": "AVAILABLE_CHARGING" + }, + "wifi_details": { + "active": false, + "ssid": "ssid8", + "ip_address_v4": "ip_address_v42", + "secure_connection": "secure_connection8", + "signal_strength": { + "value": 222 + } + } } ], + "id": "device:995CS397A6475287", "status": { "category": "AVAILABLE" } }, { - "id": "id4", "attributes": { - "type": "type4", - "manufacturer": "manufacturer2", - "model": "model2", - "name": "name4", - "manufacturers_id": "manufacturers_id0", - "updated_at": "updated_at0", - "version": "version0" + "manufacturer": "Square", + "manufacturers_id": "995CS234B5493559", + "merchant_token": "MLCHXZCBWFGDW", + "model": "T2", + "name": "Square Terminal 995", + "type": "TERMINAL", + "updated_at": "2023-09-29T12:39:56.335742073Z", + "version": "5.41.0085" }, "components": [ { - "type": "BATTERY", "application_details": { "application_type": "TERMINAL_API", - "version": "version4", - "session_location": "session_location0", - "device_code_id": "device_code_id2" + "session_location": "LMN2K7S3RTOU3", + "version": "6.25" }, + "type": "APPLICATION", "card_reader_details": { "version": "version0" }, @@ -155,16 +222,16 @@ } }, { - "type": "BATTERY", + "card_reader_details": { + "version": "3.53.70" + }, + "type": "CARD_READER", "application_details": { "application_type": "TERMINAL_API", "version": "version4", "session_location": "session_location0", "device_code_id": "device_code_id2" }, - "card_reader_details": { - "version": "version0" - }, "battery_details": { "visible_percent": 108, "external_power": "AVAILABLE_CHARGING" @@ -182,14 +249,120 @@ "active": false, "ip_address_v4": "ip_address_v42" } + }, + { + "battery_details": { + "external_power": "AVAILABLE_CHARGING", + "visible_percent": 24 + }, + "type": "BATTERY", + "application_details": { + "application_type": "TERMINAL_API", + "version": "version4", + "session_location": "session_location0", + "device_code_id": "device_code_id2" + }, + "card_reader_details": { + "version": "version0" + }, + "wifi_details": { + "active": false, + "ssid": "ssid8", + "ip_address_v4": "ip_address_v42", + "secure_connection": "secure_connection8", + "signal_strength": { + "value": 222 + } + }, + "ethernet_details": { + "active": false, + "ip_address_v4": "ip_address_v42" + } + }, + { + "type": "WIFI", + "wifi_details": { + "active": true, + "ip_address_v4": "10.0.0.7", + "secure_connection": "WPA/WPA2 PSK", + "signal_strength": { + "value": 2 + }, + "ssid": "Staff Network" + }, + "application_details": { + "application_type": "TERMINAL_API", + "version": "version4", + "session_location": "session_location0", + "device_code_id": "device_code_id2" + }, + "card_reader_details": { + "version": "version0" + }, + "battery_details": { + "visible_percent": 108, + "external_power": "AVAILABLE_CHARGING" + }, + "ethernet_details": { + "active": false, + "ip_address_v4": "ip_address_v42" + } + }, + { + "ethernet_details": { + "active": false + }, + "type": "ETHERNET", + "application_details": { + "application_type": "TERMINAL_API", + "version": "version4", + "session_location": "session_location0", + "device_code_id": "device_code_id2" + }, + "card_reader_details": { + "version": "version0" + }, + "battery_details": { + "visible_percent": 108, + "external_power": "AVAILABLE_CHARGING" + }, + "wifi_details": { + "active": false, + "ssid": "ssid8", + "ip_address_v4": "ip_address_v42", + "secure_connection": "secure_connection8", + "signal_strength": { + "value": 222 + } + } } ], + "id": "device:995CS234B5493559", "status": { - "category": "AVAILABLE" + "category": "NEEDS_ATTENTION" } } ], - "cursor": "cursor6" + "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/list-location-booking-profiles-request.md b/doc/models/list-location-booking-profiles-request.md new file mode 100644 index 00000000..de573209 --- /dev/null +++ b/doc/models/list-location-booking-profiles-request.md @@ -0,0 +1,23 @@ + +# List Location Booking Profiles Request + +## Structure + +`ListLocationBookingProfilesRequest` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `limit` | `?int` | Optional | The maximum number of results to return in a paged response.
**Constraints**: `>= 1`, `<= 100` | getLimit(): ?int | setLimit(?int limit): void | +| `cursor` | `?string` | 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.
**Constraints**: *Maximum Length*: `65536` | getCursor(): ?string | setCursor(?string cursor): void | + +## Example (as JSON) + +```json +{ + "limit": 134, + "cursor": "cursor2" +} +``` + diff --git a/doc/models/list-location-booking-profiles-response.md b/doc/models/list-location-booking-profiles-response.md new file mode 100644 index 00000000..ac4bbf2c --- /dev/null +++ b/doc/models/list-location-booking-profiles-response.md @@ -0,0 +1,60 @@ + +# List Location Booking Profiles Response + +## Structure + +`ListLocationBookingProfilesResponse` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `locationBookingProfiles` | [`?(LocationBookingProfile[])`](../../doc/models/location-booking-profile.md) | Optional | The list of a seller's location booking profiles. | getLocationBookingProfiles(): ?array | setLocationBookingProfiles(?array locationBookingProfiles): void | +| `cursor` | `?string` | Optional | The pagination cursor to be used in the subsequent request to get the next page of the results. Stop retrieving the next page of the results when the cursor is not set. | getCursor(): ?string | setCursor(?string cursor): void | +| `errors` | [`?(Error[])`](../../doc/models/error.md) | Optional | Errors that occurred during the request. | getErrors(): ?array | setErrors(?array errors): void | + +## Example (as JSON) + +```json +{ + "location_booking_profiles": [ + { + "location_id": "location_id0", + "booking_site_url": "booking_site_url2", + "online_booking_enabled": false + }, + { + "location_id": "location_id0", + "booking_site_url": "booking_site_url2", + "online_booking_enabled": false + }, + { + "location_id": "location_id0", + "booking_site_url": "booking_site_url2", + "online_booking_enabled": false + } + ], + "cursor": "cursor8", + "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/list-subscription-events-response.md b/doc/models/list-subscription-events-response.md index 75374e40..0dff1f4b 100644 --- a/doc/models/list-subscription-events-response.md +++ b/doc/models/list-subscription-events-response.md @@ -26,6 +26,7 @@ Defines output parameters in a response from the "id": "06809161-3867-4598-8269-8aea5be4f9de", "plan_variation_id": "6JHXF3B2CW3YKHDV4XEM674H", "subscription_event_type": "START_SUBSCRIPTION", + "monthly_billing_anchor_date": 16, "info": { "detail": "detail6", "code": "CUSTOMER_DELETED" @@ -48,6 +49,7 @@ Defines output parameters in a response from the }, "plan_variation_id": "6JHXF3B2CW3YKHDV4XEM674H", "subscription_event_type": "DEACTIVATE_SUBSCRIPTION", + "monthly_billing_anchor_date": 16, "phases": [ { "uid": "uid0", @@ -62,6 +64,7 @@ Defines output parameters in a response from the "id": "b426fc85-6859-450b-b0d0-fe3a5d1b565f", "plan_variation_id": "6JHXF3B2CW3YKHDV4XEM674H", "subscription_event_type": "RESUME_SUBSCRIPTION", + "monthly_billing_anchor_date": 16, "info": { "detail": "detail6", "code": "CUSTOMER_DELETED" @@ -80,6 +83,7 @@ Defines output parameters in a response from the "id": "09f14de1-2f53-4dae-9091-49aa53f83d01", "plan_variation_id": "6JHXF3B2CW3YKHDV4XEM674H", "subscription_event_type": "PAUSE_SUBSCRIPTION", + "monthly_billing_anchor_date": 16, "info": { "detail": "detail6", "code": "CUSTOMER_DELETED" @@ -98,6 +102,7 @@ Defines output parameters in a response from the "id": "f28a73ac-1a1b-4b0f-8eeb-709a72945776", "plan_variation_id": "6JHXF3B2CW3YKHDV4XEM674H", "subscription_event_type": "RESUME_SUBSCRIPTION", + "monthly_billing_anchor_date": 16, "info": { "detail": "detail6", "code": "CUSTOMER_DELETED" @@ -116,6 +121,7 @@ Defines output parameters in a response from the "id": "1eee8790-472d-4efe-8c69-8ad84e9cefe0", "plan_variation_id": "02CD53CFA4d1498AFAD42", "subscription_event_type": "PLAN_CHANGE", + "monthly_billing_anchor_date": 16, "info": { "detail": "detail6", "code": "CUSTOMER_DELETED" @@ -134,6 +140,7 @@ Defines output parameters in a response from the "id": "a0c08083-5db0-4800-85c7-d398de4fbb6e", "plan_variation_id": "6JHXF3B2CW3YKHDV4XEM674H", "subscription_event_type": "STOP_SUBSCRIPTION", + "monthly_billing_anchor_date": 16, "info": { "detail": "detail6", "code": "CUSTOMER_DELETED" diff --git a/doc/models/location-booking-profile.md b/doc/models/location-booking-profile.md new file mode 100644 index 00000000..cddbb9af --- /dev/null +++ b/doc/models/location-booking-profile.md @@ -0,0 +1,27 @@ + +# Location Booking Profile + +The booking profile of a seller's location, including the location's ID and whether the location is enabled for online booking. + +## Structure + +`LocationBookingProfile` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `locationId` | `?string` | Optional | The ID of the [location](entity:Location). | getLocationId(): ?string | setLocationId(?string locationId): void | +| `bookingSiteUrl` | `?string` | Optional | Url for the online booking site for this location. | getBookingSiteUrl(): ?string | setBookingSiteUrl(?string bookingSiteUrl): void | +| `onlineBookingEnabled` | `?bool` | Optional | Indicates whether the location is enabled for online booking. | getOnlineBookingEnabled(): ?bool | setOnlineBookingEnabled(?bool onlineBookingEnabled): void | + +## Example (as JSON) + +```json +{ + "location_id": "location_id8", + "booking_site_url": "booking_site_url4", + "online_booking_enabled": false +} +``` + diff --git a/doc/models/pause-subscription-response.md b/doc/models/pause-subscription-response.md index fb0192d5..2a3ff0b2 100644 --- a/doc/models/pause-subscription-response.md +++ b/doc/models/pause-subscription-response.md @@ -25,6 +25,7 @@ Defines output parameters in a response from the "effective_date": "2023-11-17", "id": "99b2439e-63f7-3ad5-95f7-ab2447a80673", "type": "PAUSE", + "monthly_billing_anchor_date": 186, "phases": [ { "uid": "uid0", @@ -44,8 +45,7 @@ Defines output parameters in a response from the "order_template_id": "order_template_id2", "plan_phase_uid": "plan_phase_uid6" } - ], - "new_plan_variation_id": "new_plan_variation_id8" + ] } ], "subscription": { diff --git a/doc/models/resume-subscription-response.md b/doc/models/resume-subscription-response.md index 9c081e28..ac460152 100644 --- a/doc/models/resume-subscription-response.md +++ b/doc/models/resume-subscription-response.md @@ -25,6 +25,7 @@ Defines output parameters in a response from the "effective_date": "2023-09-01", "id": "18ff74f4-3da4-30c5-929f-7d6fca84f115", "type": "RESUME", + "monthly_billing_anchor_date": 186, "phases": [ { "uid": "uid0", @@ -44,8 +45,7 @@ Defines output parameters in a response from the "order_template_id": "order_template_id2", "plan_phase_uid": "plan_phase_uid6" } - ], - "new_plan_variation_id": "new_plan_variation_id8" + ] } ], "subscription": { diff --git a/doc/models/retrieve-business-booking-profile-response.md b/doc/models/retrieve-business-booking-profile-response.md index c7ad4890..6afae13d 100644 --- a/doc/models/retrieve-business-booking-profile-response.md +++ b/doc/models/retrieve-business-booking-profile-response.md @@ -9,7 +9,7 @@ | Name | Type | Tags | Description | Getter | Setter | | --- | --- | --- | --- | --- | --- | -| `businessBookingProfile` | [`?BusinessBookingProfile`](../../doc/models/business-booking-profile.md) | Optional | - | getBusinessBookingProfile(): ?BusinessBookingProfile | setBusinessBookingProfile(?BusinessBookingProfile businessBookingProfile): void | +| `businessBookingProfile` | [`?BusinessBookingProfile`](../../doc/models/business-booking-profile.md) | Optional | A seller's business booking profile, including booking policy, appointment settings, etc. | getBusinessBookingProfile(): ?BusinessBookingProfile | setBusinessBookingProfile(?BusinessBookingProfile businessBookingProfile): void | | `errors` | [`?(Error[])`](../../doc/models/error.md) | Optional | Errors that occurred during the request. | getErrors(): ?array | setErrors(?array errors): void | ## Example (as JSON) diff --git a/doc/models/retrieve-location-booking-profile-response.md b/doc/models/retrieve-location-booking-profile-response.md new file mode 100644 index 00000000..ba83d810 --- /dev/null +++ b/doc/models/retrieve-location-booking-profile-response.md @@ -0,0 +1,28 @@ + +# Retrieve Location Booking Profile Response + +## Structure + +`RetrieveLocationBookingProfileResponse` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `locationBookingProfile` | [`?LocationBookingProfile`](../../doc/models/location-booking-profile.md) | Optional | The booking profile of a seller's location, including the location's ID and whether the location is enabled for online booking. | getLocationBookingProfile(): ?LocationBookingProfile | setLocationBookingProfile(?LocationBookingProfile locationBookingProfile): void | +| `errors` | [`?(Error[])`](../../doc/models/error.md) | Optional | Errors that occurred during the request. | getErrors(): ?array | setErrors(?array errors): void | + +## Example (as JSON) + +```json +{ + "errors": [], + "location_booking_profile": { + "booking_enabled": true, + "booking_site_url": "https://square.site/book/L3HETDGYQ4A2C/prod-business", + "location_id": "L3HETDGYQ4A2C", + "online_booking_enabled": false + } +} +``` + diff --git a/doc/models/subscription-action-type.md b/doc/models/subscription-action-type.md index 52b940df..bff9f231 100644 --- a/doc/models/subscription-action-type.md +++ b/doc/models/subscription-action-type.md @@ -15,4 +15,5 @@ Supported types of an action as a pending change to a subscription. | `PAUSE` | The action to execute a scheduled pause of a subscription. | | `RESUME` | The action to execute a scheduled resumption of a subscription. | | `SWAP_PLAN` | The action to execute a scheduled swap of a subscription plan in a subscription. | +| `CHANGE_BILLING_ANCHOR_DATE` | A billing anchor date change action. | diff --git a/doc/models/subscription-action.md b/doc/models/subscription-action.md index 238ace85..9fb4e066 100644 --- a/doc/models/subscription-action.md +++ b/doc/models/subscription-action.md @@ -14,6 +14,7 @@ Represents an action as a pending change to a subscription. | `id` | `?string` | Optional | The ID of an action scoped to a subscription. | getId(): ?string | setId(?string id): void | | `type` | [`?string(SubscriptionActionType)`](../../doc/models/subscription-action-type.md) | Optional | Supported types of an action as a pending change to a subscription. | getType(): ?string | setType(?string type): void | | `effectiveDate` | `?string` | Optional | The `YYYY-MM-DD`-formatted date when the action occurs on the subscription. | getEffectiveDate(): ?string | setEffectiveDate(?string effectiveDate): void | +| `monthlyBillingAnchorDate` | `?int` | Optional | The new billing anchor day value, for a `CHANGE_BILLING_ANCHOR_DATE` action. | getMonthlyBillingAnchorDate(): ?int | setMonthlyBillingAnchorDate(?int monthlyBillingAnchorDate): void | | `phases` | [`?(Phase[])`](../../doc/models/phase.md) | Optional | A list of Phases, to pass phase-specific information used in the swap. | getPhases(): ?array | setPhases(?array phases): void | | `newPlanVariationId` | `?string` | Optional | The target subscription plan variation that a subscription switches to, for a `SWAP_PLAN` action. | getNewPlanVariationId(): ?string | setNewPlanVariationId(?string newPlanVariationId): void | @@ -22,8 +23,9 @@ Represents an action as a pending change to a subscription. ```json { "id": "id2", - "type": "CANCEL", + "type": "SWAP_PLAN", "effective_date": "effective_date2", + "monthly_billing_anchor_date": 18, "phases": [ { "uid": "uid0", @@ -37,8 +39,7 @@ Represents an action as a pending change to a subscription. "order_template_id": "order_template_id2", "plan_phase_uid": "plan_phase_uid6" } - ], - "new_plan_variation_id": "new_plan_variation_id2" + ] } ``` diff --git a/doc/models/subscription-event-subscription-event-type.md b/doc/models/subscription-event-subscription-event-type.md index 1b2a2278..8ca123a4 100644 --- a/doc/models/subscription-event-subscription-event-type.md +++ b/doc/models/subscription-event-subscription-event-type.md @@ -17,4 +17,5 @@ Supported types of an event occurred to a subscription. | `DEACTIVATE_SUBSCRIPTION` | The subscription was deactivated | | `RESUME_SUBSCRIPTION` | The subscription was resumed. | | `PAUSE_SUBSCRIPTION` | The subscription was paused. | +| `BILLING_ANCHOR_DATE_CHANGED` | The billing anchor date was changed. | diff --git a/doc/models/subscription-event.md b/doc/models/subscription-event.md index 344c24c9..cb3dc9b5 100644 --- a/doc/models/subscription-event.md +++ b/doc/models/subscription-event.md @@ -14,6 +14,7 @@ Describes changes to a subscription and the subscription status. | `id` | `string` | Required | The ID of the subscription event. | getId(): string | setId(string id): void | | `subscriptionEventType` | [`string(SubscriptionEventSubscriptionEventType)`](../../doc/models/subscription-event-subscription-event-type.md) | Required | Supported types of an event occurred to a subscription. | getSubscriptionEventType(): string | setSubscriptionEventType(string subscriptionEventType): void | | `effectiveDate` | `string` | Required | The `YYYY-MM-DD`-formatted date (for example, 2013-01-15) when the subscription event occurred. | getEffectiveDate(): string | setEffectiveDate(string effectiveDate): void | +| `monthlyBillingAnchorDate` | `?int` | Optional | The day-of-the-month the billing anchor date was changed to, if applicable. | getMonthlyBillingAnchorDate(): ?int | setMonthlyBillingAnchorDate(?int monthlyBillingAnchorDate): void | | `info` | [`?SubscriptionEventInfo`](../../doc/models/subscription-event-info.md) | Optional | Provides information about the subscription event. | getInfo(): ?SubscriptionEventInfo | setInfo(?SubscriptionEventInfo info): void | | `phases` | [`?(Phase[])`](../../doc/models/phase.md) | Optional | A list of Phases, to pass phase-specific information used in the swap. | getPhases(): ?array | setPhases(?array phases): void | | `planVariationId` | `string` | Required | The ID of the subscription plan variation associated with the subscription. | getPlanVariationId(): string | setPlanVariationId(string planVariationId): void | @@ -25,6 +26,7 @@ Describes changes to a subscription and the subscription status. "id": "id6", "subscription_event_type": "RESUME_SUBSCRIPTION", "effective_date": "effective_date4", + "monthly_billing_anchor_date": 54, "info": { "detail": "detail6", "code": "CUSTOMER_DELETED" diff --git a/doc/models/subscription.md b/doc/models/subscription.md index 81ff51bb..75e12179 100644 --- a/doc/models/subscription.md +++ b/doc/models/subscription.md @@ -31,6 +31,7 @@ For more information, see | `timezone` | `?string` | Optional | Timezone that will be used in date calculations for the subscription.
Defaults to the timezone of the location based on `location_id`.
Format: the IANA Timezone Database identifier for the location timezone (for example, `America/Los_Angeles`). | getTimezone(): ?string | setTimezone(?string timezone): void | | `source` | [`?SubscriptionSource`](../../doc/models/subscription-source.md) | Optional | The origination details of the subscription. | getSource(): ?SubscriptionSource | setSource(?SubscriptionSource source): void | | `actions` | [`?(SubscriptionAction[])`](../../doc/models/subscription-action.md) | Optional | The list of scheduled actions on this subscription. It is set only in the response from
[RetrieveSubscription](../../doc/apis/subscriptions.md#retrieve-subscription) with the query parameter
of `include=actions` or from
[SearchSubscriptions](../../doc/apis/subscriptions.md#search-subscriptions) with the input parameter
of `include:["actions"]`. | getActions(): ?array | setActions(?array actions): void | +| `monthlyBillingAnchorDate` | `?int` | Optional | The day of the month on which the subscription will issue invoices and publish orders. | getMonthlyBillingAnchorDate(): ?int | setMonthlyBillingAnchorDate(?int monthlyBillingAnchorDate): void | | `phases` | [`?(Phase[])`](../../doc/models/phase.md) | Optional | array of phases for this subscription | getPhases(): ?array | setPhases(?array phases): void | ## Example (as JSON) diff --git a/doc/models/swap-plan-response.md b/doc/models/swap-plan-response.md index 45173c98..31aac870 100644 --- a/doc/models/swap-plan-response.md +++ b/doc/models/swap-plan-response.md @@ -33,7 +33,8 @@ Defines output parameters in a response of the "plan_phase_uid": "plan_phase_uid6" } ], - "type": "SWAP_PLAN" + "type": "SWAP_PLAN", + "monthly_billing_anchor_date": 186 } ], "subscription": { diff --git a/src/Apis/BookingsApi.php b/src/Apis/BookingsApi.php index 6e64345f..c44b5c6f 100644 --- a/src/Apis/BookingsApi.php +++ b/src/Apis/BookingsApi.php @@ -19,9 +19,11 @@ use Square\Models\CreateBookingRequest; use Square\Models\CreateBookingResponse; use Square\Models\ListBookingsResponse; +use Square\Models\ListLocationBookingProfilesResponse; use Square\Models\ListTeamMemberBookingProfilesResponse; use Square\Models\RetrieveBookingResponse; use Square\Models\RetrieveBusinessBookingProfileResponse; +use Square\Models\RetrieveLocationBookingProfileResponse; use Square\Models\RetrieveTeamMemberBookingProfileResponse; use Square\Models\SearchAvailabilityRequest; use Square\Models\SearchAvailabilityResponse; @@ -181,6 +183,48 @@ public function retrieveBusinessBookingProfile(): ApiResponse return $this->execute($_reqBuilder, $_resHandler); } + /** + * Lists location booking profiles of a seller. + * + * @param int|null $limit The maximum number of results to return in a paged response. + * @param string|null $cursor 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. + * + * @return ApiResponse Response from the API call + */ + public function listLocationBookingProfiles(?int $limit = null, ?string $cursor = null): ApiResponse + { + $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/v2/bookings/location-booking-profiles') + ->auth('global') + ->parameters(QueryParam::init('limit', $limit), QueryParam::init('cursor', $cursor)); + + $_resHandler = $this->responseHandler()->type(ListLocationBookingProfilesResponse::class)->returnApiResponse(); + + return $this->execute($_reqBuilder, $_resHandler); + } + + /** + * Retrieves a seller's location booking profile. + * + * @param string $locationId The ID of the location to retrieve the booking profile. + * + * @return ApiResponse Response from the API call + */ + public function retrieveLocationBookingProfile(string $locationId): ApiResponse + { + $_reqBuilder = $this->requestBuilder( + RequestMethod::GET, + '/v2/bookings/location-booking-profiles/{location_id}' + )->auth('global')->parameters(TemplateParam::init('location_id', $locationId)); + + $_resHandler = $this->responseHandler() + ->type(RetrieveLocationBookingProfileResponse::class) + ->returnApiResponse(); + + return $this->execute($_reqBuilder, $_resHandler); + } + /** * Lists booking profiles for team members. * diff --git a/src/Apis/EmployeesApi.php b/src/Apis/EmployeesApi.php index 2fa4950c..a41602bf 100644 --- a/src/Apis/EmployeesApi.php +++ b/src/Apis/EmployeesApi.php @@ -14,8 +14,6 @@ class EmployeesApi extends BaseApi { /** - * ListEmployees - * * @deprecated * * @param string|null $locationId @@ -48,8 +46,6 @@ public function listEmployees( } /** - * RetrieveEmployee - * * @deprecated * * @param string $id UUID for the employee that was requested. diff --git a/src/Apis/SubscriptionsApi.php b/src/Apis/SubscriptionsApi.php index f7736838..04507e74 100644 --- a/src/Apis/SubscriptionsApi.php +++ b/src/Apis/SubscriptionsApi.php @@ -10,7 +10,11 @@ use Core\Request\Parameters\TemplateParam; use CoreInterfaces\Core\Request\RequestMethod; use Square\Http\ApiResponse; +use Square\Models\BulkSwapPlanRequest; +use Square\Models\BulkSwapPlanResponse; use Square\Models\CancelSubscriptionResponse; +use Square\Models\ChangeBillingAnchorDateRequest; +use Square\Models\ChangeBillingAnchorDateResponse; use Square\Models\CreateSubscriptionRequest; use Square\Models\CreateSubscriptionResponse; use Square\Models\DeleteSubscriptionActionResponse; @@ -58,6 +62,27 @@ public function createSubscription(CreateSubscriptionRequest $body): ApiResponse return $this->execute($_reqBuilder, $_resHandler); } + /** + * Schedules a plan variation change for all active subscriptions under a given plan + * variation. For more information, see [Swap Subscription Plan Variations](https://developer.squareup. + * com/docs/subscriptions-api/swap-plan-variations). + * + * @param BulkSwapPlanRequest $body An object containing the fields to POST for the request. See + * the corresponding object definition for field details. + * + * @return ApiResponse Response from the API call + */ + public function bulkSwapPlan(BulkSwapPlanRequest $body): ApiResponse + { + $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/v2/subscriptions/bulk-swap-plan') + ->auth('global') + ->parameters(HeaderParam::init('Content-Type', 'application/json'), BodyParam::init($body)); + + $_resHandler = $this->responseHandler()->type(BulkSwapPlanResponse::class)->returnApiResponse(); + + return $this->execute($_reqBuilder, $_resHandler); + } + /** * Searches for subscriptions. * @@ -171,6 +196,37 @@ public function deleteSubscriptionAction(string $subscriptionId, string $actionI return $this->execute($_reqBuilder, $_resHandler); } + /** + * Changes the [billing anchor date](https://developer.squareup.com/docs/subscriptions-api/subscription- + * billing#billing-dates) + * for a subscription. + * + * @param string $subscriptionId The ID of the subscription to update the billing anchor date. + * @param ChangeBillingAnchorDateRequest $body An object containing the fields to POST for the + * request. + * + * See the corresponding object definition for field details. + * + * @return ApiResponse Response from the API call + */ + public function changeBillingAnchorDate(string $subscriptionId, ChangeBillingAnchorDateRequest $body): ApiResponse + { + $_reqBuilder = $this->requestBuilder( + RequestMethod::POST, + '/v2/subscriptions/{subscription_id}/billing-anchor' + ) + ->auth('global') + ->parameters( + TemplateParam::init('subscription_id', $subscriptionId), + HeaderParam::init('Content-Type', 'application/json'), + BodyParam::init($body) + ); + + $_resHandler = $this->responseHandler()->type(ChangeBillingAnchorDateResponse::class)->returnApiResponse(); + + return $this->execute($_reqBuilder, $_resHandler); + } + /** * Schedules a `CANCEL` action to cancel an active subscription. This * sets the `canceled_date` field to the end of the active billing period. After this date, diff --git a/src/ConfigurationDefaults.php b/src/ConfigurationDefaults.php index b816ba39..a4410518 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-09-25'; + public const SQUARE_VERSION = '2023-10-18'; public const ADDITIONAL_HEADERS = []; diff --git a/src/Models/Builders/BulkSwapPlanRequestBuilder.php b/src/Models/Builders/BulkSwapPlanRequestBuilder.php new file mode 100644 index 00000000..4c592d39 --- /dev/null +++ b/src/Models/Builders/BulkSwapPlanRequestBuilder.php @@ -0,0 +1,42 @@ +instance = $instance; + } + + /** + * Initializes a new bulk swap plan request Builder object. + */ + public static function init(string $newPlanVariationId, string $oldPlanVariationId, string $locationId): self + { + return new self(new BulkSwapPlanRequest($newPlanVariationId, $oldPlanVariationId, $locationId)); + } + + /** + * Initializes a new bulk swap plan request object. + */ + public function build(): BulkSwapPlanRequest + { + return CoreHelper::clone($this->instance); + } +} diff --git a/src/Models/Builders/BulkSwapPlanResponseBuilder.php b/src/Models/Builders/BulkSwapPlanResponseBuilder.php new file mode 100644 index 00000000..9ab743fe --- /dev/null +++ b/src/Models/Builders/BulkSwapPlanResponseBuilder.php @@ -0,0 +1,60 @@ +instance = $instance; + } + + /** + * Initializes a new bulk swap plan response Builder object. + */ + public static function init(): self + { + return new self(new BulkSwapPlanResponse()); + } + + /** + * Sets errors field. + */ + public function errors(?array $value): self + { + $this->instance->setErrors($value); + return $this; + } + + /** + * Sets affected subscriptions field. + */ + public function affectedSubscriptions(?int $value): self + { + $this->instance->setAffectedSubscriptions($value); + return $this; + } + + /** + * Initializes a new bulk swap plan response object. + */ + public function build(): BulkSwapPlanResponse + { + return CoreHelper::clone($this->instance); + } +} diff --git a/src/Models/Builders/CatalogSubscriptionPlanVariationBuilder.php b/src/Models/Builders/CatalogSubscriptionPlanVariationBuilder.php index d540c1f8..d35c8c50 100644 --- a/src/Models/Builders/CatalogSubscriptionPlanVariationBuilder.php +++ b/src/Models/Builders/CatalogSubscriptionPlanVariationBuilder.php @@ -50,6 +50,60 @@ public function unsetSubscriptionPlanId(): self return $this; } + /** + * Sets monthly billing anchor date field. + */ + public function monthlyBillingAnchorDate(?int $value): self + { + $this->instance->setMonthlyBillingAnchorDate($value); + return $this; + } + + /** + * Unsets monthly billing anchor date field. + */ + public function unsetMonthlyBillingAnchorDate(): self + { + $this->instance->unsetMonthlyBillingAnchorDate(); + return $this; + } + + /** + * Sets can prorate field. + */ + public function canProrate(?bool $value): self + { + $this->instance->setCanProrate($value); + return $this; + } + + /** + * Unsets can prorate field. + */ + public function unsetCanProrate(): self + { + $this->instance->unsetCanProrate(); + return $this; + } + + /** + * Sets successor plan variation id field. + */ + public function successorPlanVariationId(?string $value): self + { + $this->instance->setSuccessorPlanVariationId($value); + return $this; + } + + /** + * Unsets successor plan variation id field. + */ + public function unsetSuccessorPlanVariationId(): self + { + $this->instance->unsetSuccessorPlanVariationId(); + return $this; + } + /** * Initializes a new catalog subscription plan variation object. */ diff --git a/src/Models/Builders/ChangeBillingAnchorDateRequestBuilder.php b/src/Models/Builders/ChangeBillingAnchorDateRequestBuilder.php new file mode 100644 index 00000000..255438a1 --- /dev/null +++ b/src/Models/Builders/ChangeBillingAnchorDateRequestBuilder.php @@ -0,0 +1,78 @@ +instance = $instance; + } + + /** + * Initializes a new change billing anchor date request Builder object. + */ + public static function init(): self + { + return new self(new ChangeBillingAnchorDateRequest()); + } + + /** + * Sets monthly billing anchor date field. + */ + public function monthlyBillingAnchorDate(?int $value): self + { + $this->instance->setMonthlyBillingAnchorDate($value); + return $this; + } + + /** + * Unsets monthly billing anchor date field. + */ + public function unsetMonthlyBillingAnchorDate(): self + { + $this->instance->unsetMonthlyBillingAnchorDate(); + return $this; + } + + /** + * Sets effective date field. + */ + public function effectiveDate(?string $value): self + { + $this->instance->setEffectiveDate($value); + return $this; + } + + /** + * Unsets effective date field. + */ + public function unsetEffectiveDate(): self + { + $this->instance->unsetEffectiveDate(); + return $this; + } + + /** + * Initializes a new change billing anchor date request object. + */ + public function build(): ChangeBillingAnchorDateRequest + { + return CoreHelper::clone($this->instance); + } +} diff --git a/src/Models/Builders/ChangeBillingAnchorDateResponseBuilder.php b/src/Models/Builders/ChangeBillingAnchorDateResponseBuilder.php new file mode 100644 index 00000000..ef5d3834 --- /dev/null +++ b/src/Models/Builders/ChangeBillingAnchorDateResponseBuilder.php @@ -0,0 +1,70 @@ +instance = $instance; + } + + /** + * Initializes a new change billing anchor date response Builder object. + */ + public static function init(): self + { + return new self(new ChangeBillingAnchorDateResponse()); + } + + /** + * Sets errors field. + */ + public function errors(?array $value): self + { + $this->instance->setErrors($value); + return $this; + } + + /** + * Sets subscription field. + */ + public function subscription(?Subscription $value): self + { + $this->instance->setSubscription($value); + return $this; + } + + /** + * Sets actions field. + */ + public function actions(?array $value): self + { + $this->instance->setActions($value); + return $this; + } + + /** + * Initializes a new change billing anchor date response object. + */ + public function build(): ChangeBillingAnchorDateResponse + { + return CoreHelper::clone($this->instance); + } +} diff --git a/src/Models/Builders/CreateSubscriptionRequestBuilder.php b/src/Models/Builders/CreateSubscriptionRequestBuilder.php index e9b4d652..2c81d73a 100644 --- a/src/Models/Builders/CreateSubscriptionRequestBuilder.php +++ b/src/Models/Builders/CreateSubscriptionRequestBuilder.php @@ -115,6 +115,15 @@ public function source(?SubscriptionSource $value): self return $this; } + /** + * Sets monthly billing anchor date field. + */ + public function monthlyBillingAnchorDate(?int $value): self + { + $this->instance->setMonthlyBillingAnchorDate($value); + return $this; + } + /** * Sets phases field. */ diff --git a/src/Models/Builders/ListLocationBookingProfilesRequestBuilder.php b/src/Models/Builders/ListLocationBookingProfilesRequestBuilder.php new file mode 100644 index 00000000..c37d630f --- /dev/null +++ b/src/Models/Builders/ListLocationBookingProfilesRequestBuilder.php @@ -0,0 +1,78 @@ +instance = $instance; + } + + /** + * Initializes a new list location booking profiles request Builder object. + */ + public static function init(): self + { + return new self(new ListLocationBookingProfilesRequest()); + } + + /** + * Sets limit field. + */ + public function limit(?int $value): self + { + $this->instance->setLimit($value); + return $this; + } + + /** + * Unsets limit field. + */ + public function unsetLimit(): self + { + $this->instance->unsetLimit(); + return $this; + } + + /** + * Sets cursor field. + */ + public function cursor(?string $value): self + { + $this->instance->setCursor($value); + return $this; + } + + /** + * Unsets cursor field. + */ + public function unsetCursor(): self + { + $this->instance->unsetCursor(); + return $this; + } + + /** + * Initializes a new list location booking profiles request object. + */ + public function build(): ListLocationBookingProfilesRequest + { + return CoreHelper::clone($this->instance); + } +} diff --git a/src/Models/Builders/ListLocationBookingProfilesResponseBuilder.php b/src/Models/Builders/ListLocationBookingProfilesResponseBuilder.php new file mode 100644 index 00000000..af093a46 --- /dev/null +++ b/src/Models/Builders/ListLocationBookingProfilesResponseBuilder.php @@ -0,0 +1,69 @@ +instance = $instance; + } + + /** + * Initializes a new list location booking profiles response Builder object. + */ + public static function init(): self + { + return new self(new ListLocationBookingProfilesResponse()); + } + + /** + * Sets location booking profiles field. + */ + public function locationBookingProfiles(?array $value): self + { + $this->instance->setLocationBookingProfiles($value); + return $this; + } + + /** + * Sets cursor field. + */ + public function cursor(?string $value): self + { + $this->instance->setCursor($value); + return $this; + } + + /** + * Sets errors field. + */ + public function errors(?array $value): self + { + $this->instance->setErrors($value); + return $this; + } + + /** + * Initializes a new list location booking profiles response object. + */ + public function build(): ListLocationBookingProfilesResponse + { + return CoreHelper::clone($this->instance); + } +} diff --git a/src/Models/Builders/LocationBookingProfileBuilder.php b/src/Models/Builders/LocationBookingProfileBuilder.php new file mode 100644 index 00000000..0978314a --- /dev/null +++ b/src/Models/Builders/LocationBookingProfileBuilder.php @@ -0,0 +1,96 @@ +instance = $instance; + } + + /** + * Initializes a new location booking profile Builder object. + */ + public static function init(): self + { + return new self(new LocationBookingProfile()); + } + + /** + * Sets location id field. + */ + public function locationId(?string $value): self + { + $this->instance->setLocationId($value); + return $this; + } + + /** + * Unsets location id field. + */ + public function unsetLocationId(): self + { + $this->instance->unsetLocationId(); + return $this; + } + + /** + * Sets booking site url field. + */ + public function bookingSiteUrl(?string $value): self + { + $this->instance->setBookingSiteUrl($value); + return $this; + } + + /** + * Unsets booking site url field. + */ + public function unsetBookingSiteUrl(): self + { + $this->instance->unsetBookingSiteUrl(); + return $this; + } + + /** + * Sets online booking enabled field. + */ + public function onlineBookingEnabled(?bool $value): self + { + $this->instance->setOnlineBookingEnabled($value); + return $this; + } + + /** + * Unsets online booking enabled field. + */ + public function unsetOnlineBookingEnabled(): self + { + $this->instance->unsetOnlineBookingEnabled(); + return $this; + } + + /** + * Initializes a new location booking profile object. + */ + public function build(): LocationBookingProfile + { + return CoreHelper::clone($this->instance); + } +} diff --git a/src/Models/Builders/RetrieveLocationBookingProfileResponseBuilder.php b/src/Models/Builders/RetrieveLocationBookingProfileResponseBuilder.php new file mode 100644 index 00000000..8ff2f8a1 --- /dev/null +++ b/src/Models/Builders/RetrieveLocationBookingProfileResponseBuilder.php @@ -0,0 +1,61 @@ +instance = $instance; + } + + /** + * Initializes a new retrieve location booking profile response Builder object. + */ + public static function init(): self + { + return new self(new RetrieveLocationBookingProfileResponse()); + } + + /** + * Sets location booking profile field. + */ + public function locationBookingProfile(?LocationBookingProfile $value): self + { + $this->instance->setLocationBookingProfile($value); + return $this; + } + + /** + * Sets errors field. + */ + public function errors(?array $value): self + { + $this->instance->setErrors($value); + return $this; + } + + /** + * Initializes a new retrieve location booking profile response object. + */ + public function build(): RetrieveLocationBookingProfileResponse + { + return CoreHelper::clone($this->instance); + } +} diff --git a/src/Models/Builders/SubscriptionActionBuilder.php b/src/Models/Builders/SubscriptionActionBuilder.php index 87cabeb9..2ae7e5bf 100644 --- a/src/Models/Builders/SubscriptionActionBuilder.php +++ b/src/Models/Builders/SubscriptionActionBuilder.php @@ -68,6 +68,24 @@ public function unsetEffectiveDate(): self return $this; } + /** + * Sets monthly billing anchor date field. + */ + public function monthlyBillingAnchorDate(?int $value): self + { + $this->instance->setMonthlyBillingAnchorDate($value); + return $this; + } + + /** + * Unsets monthly billing anchor date field. + */ + public function unsetMonthlyBillingAnchorDate(): self + { + $this->instance->unsetMonthlyBillingAnchorDate(); + return $this; + } + /** * Sets phases field. */ diff --git a/src/Models/Builders/SubscriptionBuilder.php b/src/Models/Builders/SubscriptionBuilder.php index 6786954b..4edb6f6f 100644 --- a/src/Models/Builders/SubscriptionBuilder.php +++ b/src/Models/Builders/SubscriptionBuilder.php @@ -223,6 +223,15 @@ public function unsetActions(): self return $this; } + /** + * Sets monthly billing anchor date field. + */ + public function monthlyBillingAnchorDate(?int $value): self + { + $this->instance->setMonthlyBillingAnchorDate($value); + return $this; + } + /** * Sets phases field. */ diff --git a/src/Models/Builders/SubscriptionEventBuilder.php b/src/Models/Builders/SubscriptionEventBuilder.php index 1dea4975..fc8d1a3f 100644 --- a/src/Models/Builders/SubscriptionEventBuilder.php +++ b/src/Models/Builders/SubscriptionEventBuilder.php @@ -37,6 +37,15 @@ public static function init( return new self(new SubscriptionEvent($id, $subscriptionEventType, $effectiveDate, $planVariationId)); } + /** + * Sets monthly billing anchor date field. + */ + public function monthlyBillingAnchorDate(?int $value): self + { + $this->instance->setMonthlyBillingAnchorDate($value); + return $this; + } + /** * Sets info field. */ diff --git a/src/Models/BulkSwapPlanRequest.php b/src/Models/BulkSwapPlanRequest.php new file mode 100644 index 00000000..a0af1a88 --- /dev/null +++ b/src/Models/BulkSwapPlanRequest.php @@ -0,0 +1,134 @@ +newPlanVariationId = $newPlanVariationId; + $this->oldPlanVariationId = $oldPlanVariationId; + $this->locationId = $locationId; + } + + /** + * Returns New Plan Variation Id. + * The ID of the new subscription plan variation. + * + * This field is required. + */ + public function getNewPlanVariationId(): string + { + return $this->newPlanVariationId; + } + + /** + * Sets New Plan Variation Id. + * The ID of the new subscription plan variation. + * + * This field is required. + * + * @required + * @maps new_plan_variation_id + */ + public function setNewPlanVariationId(string $newPlanVariationId): void + { + $this->newPlanVariationId = $newPlanVariationId; + } + + /** + * Returns Old Plan Variation Id. + * The ID of the plan variation whose subscriptions should be swapped. Active subscriptions + * using this plan variation will be subscribed to the new plan variation on their next billing + * day. + */ + public function getOldPlanVariationId(): string + { + return $this->oldPlanVariationId; + } + + /** + * Sets Old Plan Variation Id. + * The ID of the plan variation whose subscriptions should be swapped. Active subscriptions + * using this plan variation will be subscribed to the new plan variation on their next billing + * day. + * + * @required + * @maps old_plan_variation_id + */ + public function setOldPlanVariationId(string $oldPlanVariationId): void + { + $this->oldPlanVariationId = $oldPlanVariationId; + } + + /** + * Returns Location Id. + * The ID of the location to associate with the swapped subscriptions. + */ + public function getLocationId(): string + { + return $this->locationId; + } + + /** + * Sets Location Id. + * The ID of the location to associate with the swapped subscriptions. + * + * @required + * @maps location_id + */ + public function setLocationId(string $locationId): void + { + $this->locationId = $locationId; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + $json['new_plan_variation_id'] = $this->newPlanVariationId; + $json['old_plan_variation_id'] = $this->oldPlanVariationId; + $json['location_id'] = $this->locationId; + $json = array_filter($json, function ($val) { + return $val !== null; + }); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/BulkSwapPlanResponse.php b/src/Models/BulkSwapPlanResponse.php new file mode 100644 index 00000000..048861b9 --- /dev/null +++ b/src/Models/BulkSwapPlanResponse.php @@ -0,0 +1,93 @@ +errors; + } + + /** + * Sets Errors. + * Errors encountered during the request. + * + * @maps errors + * + * @param Error[]|null $errors + */ + public function setErrors(?array $errors): void + { + $this->errors = $errors; + } + + /** + * Returns Affected Subscriptions. + * The number of affected subscriptions. + */ + public function getAffectedSubscriptions(): ?int + { + return $this->affectedSubscriptions; + } + + /** + * Sets Affected Subscriptions. + * The number of affected subscriptions. + * + * @maps affected_subscriptions + */ + public function setAffectedSubscriptions(?int $affectedSubscriptions): void + { + $this->affectedSubscriptions = $affectedSubscriptions; + } + + /** + * 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; + } + if (isset($this->affectedSubscriptions)) { + $json['affected_subscriptions'] = $this->affectedSubscriptions; + } + $json = array_filter($json, function ($val) { + return $val !== null; + }); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/BusinessBookingProfile.php b/src/Models/BusinessBookingProfile.php index e18d1c40..2dc4ee2f 100644 --- a/src/Models/BusinessBookingProfile.php +++ b/src/Models/BusinessBookingProfile.php @@ -6,6 +6,9 @@ use stdClass; +/** + * A seller's business booking profile, including booking policy, appointment settings, etc. + */ class BusinessBookingProfile implements \JsonSerializable { /** diff --git a/src/Models/CatalogQueryText.php b/src/Models/CatalogQueryText.php index bddcd49d..adaf48b9 100644 --- a/src/Models/CatalogQueryText.php +++ b/src/Models/CatalogQueryText.php @@ -27,7 +27,7 @@ public function __construct(array $keywords) /** * Returns Keywords. - * A list of 1, 2, or 3 search keywords. Keywords with fewer than 3 characters are ignored. + * A list of 1, 2, or 3 search keywords. Keywords with fewer than 3 alphanumeric characters are ignored. * * @return string[] */ @@ -38,7 +38,7 @@ public function getKeywords(): array /** * Sets Keywords. - * A list of 1, 2, or 3 search keywords. Keywords with fewer than 3 characters are ignored. + * A list of 1, 2, or 3 search keywords. Keywords with fewer than 3 alphanumeric characters are ignored. * * @required * @maps keywords diff --git a/src/Models/CatalogSubscriptionPlanVariation.php b/src/Models/CatalogSubscriptionPlanVariation.php index 12fed603..46477dd3 100644 --- a/src/Models/CatalogSubscriptionPlanVariation.php +++ b/src/Models/CatalogSubscriptionPlanVariation.php @@ -29,6 +29,21 @@ class CatalogSubscriptionPlanVariation implements \JsonSerializable */ private $subscriptionPlanId = []; + /** + * @var array + */ + private $monthlyBillingAnchorDate = []; + + /** + * @var array + */ + private $canProrate = []; + + /** + * @var array + */ + private $successorPlanVariationId = []; + /** * @param string $name * @param SubscriptionPhase[] $phases @@ -117,6 +132,114 @@ public function unsetSubscriptionPlanId(): void $this->subscriptionPlanId = []; } + /** + * Returns Monthly Billing Anchor Date. + * The day of the month the billing period starts. + */ + public function getMonthlyBillingAnchorDate(): ?int + { + if (count($this->monthlyBillingAnchorDate) == 0) { + return null; + } + return $this->monthlyBillingAnchorDate['value']; + } + + /** + * Sets Monthly Billing Anchor Date. + * The day of the month the billing period starts. + * + * @maps monthly_billing_anchor_date + */ + public function setMonthlyBillingAnchorDate(?int $monthlyBillingAnchorDate): void + { + $this->monthlyBillingAnchorDate['value'] = $monthlyBillingAnchorDate; + } + + /** + * Unsets Monthly Billing Anchor Date. + * The day of the month the billing period starts. + */ + public function unsetMonthlyBillingAnchorDate(): void + { + $this->monthlyBillingAnchorDate = []; + } + + /** + * Returns Can Prorate. + * Whether bills for this plan variation can be split for proration. + */ + public function getCanProrate(): ?bool + { + if (count($this->canProrate) == 0) { + return null; + } + return $this->canProrate['value']; + } + + /** + * Sets Can Prorate. + * Whether bills for this plan variation can be split for proration. + * + * @maps can_prorate + */ + public function setCanProrate(?bool $canProrate): void + { + $this->canProrate['value'] = $canProrate; + } + + /** + * Unsets Can Prorate. + * Whether bills for this plan variation can be split for proration. + */ + public function unsetCanProrate(): void + { + $this->canProrate = []; + } + + /** + * Returns Successor Plan Variation Id. + * 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. + */ + public function getSuccessorPlanVariationId(): ?string + { + if (count($this->successorPlanVariationId) == 0) { + return null; + } + return $this->successorPlanVariationId['value']; + } + + /** + * Sets Successor Plan Variation Id. + * 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. + * + * @maps successor_plan_variation_id + */ + public function setSuccessorPlanVariationId(?string $successorPlanVariationId): void + { + $this->successorPlanVariationId['value'] = $successorPlanVariationId; + } + + /** + * Unsets Successor Plan Variation Id. + * 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. + */ + public function unsetSuccessorPlanVariationId(): void + { + $this->successorPlanVariationId = []; + } + /** * Encode this object to JSON * @@ -129,10 +252,19 @@ public function unsetSubscriptionPlanId(): void public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; - $json['name'] = $this->name; - $json['phases'] = $this->phases; + $json['name'] = $this->name; + $json['phases'] = $this->phases; if (!empty($this->subscriptionPlanId)) { - $json['subscription_plan_id'] = $this->subscriptionPlanId['value']; + $json['subscription_plan_id'] = $this->subscriptionPlanId['value']; + } + if (!empty($this->monthlyBillingAnchorDate)) { + $json['monthly_billing_anchor_date'] = $this->monthlyBillingAnchorDate['value']; + } + if (!empty($this->canProrate)) { + $json['can_prorate'] = $this->canProrate['value']; + } + if (!empty($this->successorPlanVariationId)) { + $json['successor_plan_variation_id'] = $this->successorPlanVariationId['value']; } $json = array_filter($json, function ($val) { return $val !== null; diff --git a/src/Models/ChangeBillingAnchorDateRequest.php b/src/Models/ChangeBillingAnchorDateRequest.php new file mode 100644 index 00000000..024e8ead --- /dev/null +++ b/src/Models/ChangeBillingAnchorDateRequest.php @@ -0,0 +1,125 @@ +monthlyBillingAnchorDate) == 0) { + return null; + } + return $this->monthlyBillingAnchorDate['value']; + } + + /** + * Sets Monthly Billing Anchor Date. + * The anchor day for the billing cycle. + * + * @maps monthly_billing_anchor_date + */ + public function setMonthlyBillingAnchorDate(?int $monthlyBillingAnchorDate): void + { + $this->monthlyBillingAnchorDate['value'] = $monthlyBillingAnchorDate; + } + + /** + * Unsets Monthly Billing Anchor Date. + * The anchor day for the billing cycle. + */ + public function unsetMonthlyBillingAnchorDate(): void + { + $this->monthlyBillingAnchorDate = []; + } + + /** + * Returns Effective Date. + * The `YYYY-MM-DD`-formatted date when the scheduled `BILLING_ANCHOR_CHANGE` action takes + * place on the subscription. + * + * When this date is unspecified or falls within the current billing cycle, the billing anchor date + * is changed immediately. + */ + public function getEffectiveDate(): ?string + { + if (count($this->effectiveDate) == 0) { + return null; + } + return $this->effectiveDate['value']; + } + + /** + * Sets Effective Date. + * The `YYYY-MM-DD`-formatted date when the scheduled `BILLING_ANCHOR_CHANGE` action takes + * place on the subscription. + * + * When this date is unspecified or falls within the current billing cycle, the billing anchor date + * is changed immediately. + * + * @maps effective_date + */ + public function setEffectiveDate(?string $effectiveDate): void + { + $this->effectiveDate['value'] = $effectiveDate; + } + + /** + * Unsets Effective Date. + * The `YYYY-MM-DD`-formatted date when the scheduled `BILLING_ANCHOR_CHANGE` action takes + * place on the subscription. + * + * When this date is unspecified or falls within the current billing cycle, the billing anchor date + * is changed immediately. + */ + public function unsetEffectiveDate(): void + { + $this->effectiveDate = []; + } + + /** + * 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->monthlyBillingAnchorDate)) { + $json['monthly_billing_anchor_date'] = $this->monthlyBillingAnchorDate['value']; + } + if (!empty($this->effectiveDate)) { + $json['effective_date'] = $this->effectiveDate['value']; + } + $json = array_filter($json, function ($val) { + return $val !== null; + }); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/ChangeBillingAnchorDateResponse.php b/src/Models/ChangeBillingAnchorDateResponse.php new file mode 100644 index 00000000..a0a6342f --- /dev/null +++ b/src/Models/ChangeBillingAnchorDateResponse.php @@ -0,0 +1,131 @@ +errors; + } + + /** + * Sets Errors. + * Errors encountered during the request. + * + * @maps errors + * + * @param Error[]|null $errors + */ + public function setErrors(?array $errors): void + { + $this->errors = $errors; + } + + /** + * Returns Subscription. + * Represents a subscription purchased by a customer. + * + * For more information, see + * [Manage Subscriptions](https://developer.squareup.com/docs/subscriptions-api/manage-subscriptions). + */ + public function getSubscription(): ?Subscription + { + return $this->subscription; + } + + /** + * Sets Subscription. + * Represents a subscription purchased by a customer. + * + * For more information, see + * [Manage Subscriptions](https://developer.squareup.com/docs/subscriptions-api/manage-subscriptions). + * + * @maps subscription + */ + public function setSubscription(?Subscription $subscription): void + { + $this->subscription = $subscription; + } + + /** + * Returns Actions. + * A list of a single billing anchor date change for the subscription. + * + * @return SubscriptionAction[]|null + */ + public function getActions(): ?array + { + return $this->actions; + } + + /** + * Sets Actions. + * A list of a single billing anchor date change for the subscription. + * + * @maps actions + * + * @param SubscriptionAction[]|null $actions + */ + public function setActions(?array $actions): void + { + $this->actions = $actions; + } + + /** + * 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; + } + if (isset($this->subscription)) { + $json['subscription'] = $this->subscription; + } + if (isset($this->actions)) { + $json['actions'] = $this->actions; + } + $json = array_filter($json, function ($val) { + return $val !== null; + }); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/CreateSubscriptionRequest.php b/src/Models/CreateSubscriptionRequest.php index 7a7fb59f..b4a6f425 100644 --- a/src/Models/CreateSubscriptionRequest.php +++ b/src/Models/CreateSubscriptionRequest.php @@ -67,6 +67,11 @@ class CreateSubscriptionRequest implements \JsonSerializable */ private $source; + /** + * @var int|null + */ + private $monthlyBillingAnchorDate; + /** * @var Phase[]|null */ @@ -374,6 +379,26 @@ public function setSource(?SubscriptionSource $source): void $this->source = $source; } + /** + * Returns Monthly Billing Anchor Date. + * The day-of-the-month to change the billing date to. + */ + public function getMonthlyBillingAnchorDate(): ?int + { + return $this->monthlyBillingAnchorDate; + } + + /** + * Sets Monthly Billing Anchor Date. + * The day-of-the-month to change the billing date to. + * + * @maps monthly_billing_anchor_date + */ + public function setMonthlyBillingAnchorDate(?int $monthlyBillingAnchorDate): void + { + $this->monthlyBillingAnchorDate = $monthlyBillingAnchorDate; + } + /** * Returns Phases. * array of phases for this subscription @@ -411,36 +436,39 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; if (isset($this->idempotencyKey)) { - $json['idempotency_key'] = $this->idempotencyKey; + $json['idempotency_key'] = $this->idempotencyKey; } - $json['location_id'] = $this->locationId; + $json['location_id'] = $this->locationId; if (isset($this->planVariationId)) { - $json['plan_variation_id'] = $this->planVariationId; + $json['plan_variation_id'] = $this->planVariationId; } - $json['customer_id'] = $this->customerId; + $json['customer_id'] = $this->customerId; if (isset($this->startDate)) { - $json['start_date'] = $this->startDate; + $json['start_date'] = $this->startDate; } if (isset($this->canceledDate)) { - $json['canceled_date'] = $this->canceledDate; + $json['canceled_date'] = $this->canceledDate; } if (isset($this->taxPercentage)) { - $json['tax_percentage'] = $this->taxPercentage; + $json['tax_percentage'] = $this->taxPercentage; } if (isset($this->priceOverrideMoney)) { - $json['price_override_money'] = $this->priceOverrideMoney; + $json['price_override_money'] = $this->priceOverrideMoney; } if (isset($this->cardId)) { - $json['card_id'] = $this->cardId; + $json['card_id'] = $this->cardId; } if (isset($this->timezone)) { - $json['timezone'] = $this->timezone; + $json['timezone'] = $this->timezone; } if (isset($this->source)) { - $json['source'] = $this->source; + $json['source'] = $this->source; + } + if (isset($this->monthlyBillingAnchorDate)) { + $json['monthly_billing_anchor_date'] = $this->monthlyBillingAnchorDate; } if (isset($this->phases)) { - $json['phases'] = $this->phases; + $json['phases'] = $this->phases; } $json = array_filter($json, function ($val) { return $val !== null; diff --git a/src/Models/DeviceStatusCategory.php b/src/Models/DeviceStatusCategory.php index 2e57dcbc..363b770a 100644 --- a/src/Models/DeviceStatusCategory.php +++ b/src/Models/DeviceStatusCategory.php @@ -9,4 +9,6 @@ class DeviceStatusCategory public const AVAILABLE = 'AVAILABLE'; public const NEEDS_ATTENTION = 'NEEDS_ATTENTION'; + + public const OFFLINE = 'OFFLINE'; } diff --git a/src/Models/ListLocationBookingProfilesRequest.php b/src/Models/ListLocationBookingProfilesRequest.php new file mode 100644 index 00000000..3bfa422b --- /dev/null +++ b/src/Models/ListLocationBookingProfilesRequest.php @@ -0,0 +1,112 @@ +limit) == 0) { + return null; + } + return $this->limit['value']; + } + + /** + * Sets Limit. + * The maximum number of results to return in a paged response. + * + * @maps limit + */ + public function setLimit(?int $limit): void + { + $this->limit['value'] = $limit; + } + + /** + * Unsets Limit. + * The maximum number of results to return in a paged response. + */ + public function unsetLimit(): void + { + $this->limit = []; + } + + /** + * Returns Cursor. + * 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. + */ + public function getCursor(): ?string + { + if (count($this->cursor) == 0) { + return null; + } + return $this->cursor['value']; + } + + /** + * Sets Cursor. + * 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. + * + * @maps cursor + */ + public function setCursor(?string $cursor): void + { + $this->cursor['value'] = $cursor; + } + + /** + * Unsets Cursor. + * 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. + */ + public function unsetCursor(): void + { + $this->cursor = []; + } + + /** + * 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->limit)) { + $json['limit'] = $this->limit['value']; + } + if (!empty($this->cursor)) { + $json['cursor'] = $this->cursor['value']; + } + $json = array_filter($json, function ($val) { + return $val !== null; + }); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/ListLocationBookingProfilesResponse.php b/src/Models/ListLocationBookingProfilesResponse.php new file mode 100644 index 00000000..0fe1a5b6 --- /dev/null +++ b/src/Models/ListLocationBookingProfilesResponse.php @@ -0,0 +1,123 @@ +locationBookingProfiles; + } + + /** + * Sets Location Booking Profiles. + * The list of a seller's location booking profiles. + * + * @maps location_booking_profiles + * + * @param LocationBookingProfile[]|null $locationBookingProfiles + */ + public function setLocationBookingProfiles(?array $locationBookingProfiles): void + { + $this->locationBookingProfiles = $locationBookingProfiles; + } + + /** + * Returns Cursor. + * The pagination cursor to be used in the subsequent request to get the next page of the results. Stop + * retrieving the next page of the results when the cursor is not set. + */ + public function getCursor(): ?string + { + return $this->cursor; + } + + /** + * Sets Cursor. + * The pagination cursor to be used in the subsequent request to get the next page of the results. Stop + * retrieving the next page of the results when the cursor is not set. + * + * @maps cursor + */ + public function setCursor(?string $cursor): void + { + $this->cursor = $cursor; + } + + /** + * Returns Errors. + * Errors that occurred during the request. + * + * @return Error[]|null + */ + public function getErrors(): ?array + { + return $this->errors; + } + + /** + * Sets Errors. + * Errors that occurred 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->locationBookingProfiles)) { + $json['location_booking_profiles'] = $this->locationBookingProfiles; + } + if (isset($this->cursor)) { + $json['cursor'] = $this->cursor; + } + if (isset($this->errors)) { + $json['errors'] = $this->errors; + } + $json = array_filter($json, function ($val) { + return $val !== null; + }); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/LocationBookingProfile.php b/src/Models/LocationBookingProfile.php new file mode 100644 index 00000000..e8c731ca --- /dev/null +++ b/src/Models/LocationBookingProfile.php @@ -0,0 +1,153 @@ +locationId) == 0) { + return null; + } + return $this->locationId['value']; + } + + /** + * Sets Location Id. + * The ID of the [location](entity:Location). + * + * @maps location_id + */ + public function setLocationId(?string $locationId): void + { + $this->locationId['value'] = $locationId; + } + + /** + * Unsets Location Id. + * The ID of the [location](entity:Location). + */ + public function unsetLocationId(): void + { + $this->locationId = []; + } + + /** + * Returns Booking Site Url. + * Url for the online booking site for this location. + */ + public function getBookingSiteUrl(): ?string + { + if (count($this->bookingSiteUrl) == 0) { + return null; + } + return $this->bookingSiteUrl['value']; + } + + /** + * Sets Booking Site Url. + * Url for the online booking site for this location. + * + * @maps booking_site_url + */ + public function setBookingSiteUrl(?string $bookingSiteUrl): void + { + $this->bookingSiteUrl['value'] = $bookingSiteUrl; + } + + /** + * Unsets Booking Site Url. + * Url for the online booking site for this location. + */ + public function unsetBookingSiteUrl(): void + { + $this->bookingSiteUrl = []; + } + + /** + * Returns Online Booking Enabled. + * Indicates whether the location is enabled for online booking. + */ + public function getOnlineBookingEnabled(): ?bool + { + if (count($this->onlineBookingEnabled) == 0) { + return null; + } + return $this->onlineBookingEnabled['value']; + } + + /** + * Sets Online Booking Enabled. + * Indicates whether the location is enabled for online booking. + * + * @maps online_booking_enabled + */ + public function setOnlineBookingEnabled(?bool $onlineBookingEnabled): void + { + $this->onlineBookingEnabled['value'] = $onlineBookingEnabled; + } + + /** + * Unsets Online Booking Enabled. + * Indicates whether the location is enabled for online booking. + */ + public function unsetOnlineBookingEnabled(): void + { + $this->onlineBookingEnabled = []; + } + + /** + * 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->locationId)) { + $json['location_id'] = $this->locationId['value']; + } + if (!empty($this->bookingSiteUrl)) { + $json['booking_site_url'] = $this->bookingSiteUrl['value']; + } + if (!empty($this->onlineBookingEnabled)) { + $json['online_booking_enabled'] = $this->onlineBookingEnabled['value']; + } + $json = array_filter($json, function ($val) { + return $val !== null; + }); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/RetrieveBusinessBookingProfileResponse.php b/src/Models/RetrieveBusinessBookingProfileResponse.php index 8d3a95c4..09e83faf 100644 --- a/src/Models/RetrieveBusinessBookingProfileResponse.php +++ b/src/Models/RetrieveBusinessBookingProfileResponse.php @@ -20,6 +20,7 @@ class RetrieveBusinessBookingProfileResponse implements \JsonSerializable /** * Returns Business Booking Profile. + * A seller's business booking profile, including booking policy, appointment settings, etc. */ public function getBusinessBookingProfile(): ?BusinessBookingProfile { @@ -28,6 +29,7 @@ public function getBusinessBookingProfile(): ?BusinessBookingProfile /** * Sets Business Booking Profile. + * A seller's business booking profile, including booking policy, appointment settings, etc. * * @maps business_booking_profile */ diff --git a/src/Models/RetrieveLocationBookingProfileResponse.php b/src/Models/RetrieveLocationBookingProfileResponse.php new file mode 100644 index 00000000..e55fba21 --- /dev/null +++ b/src/Models/RetrieveLocationBookingProfileResponse.php @@ -0,0 +1,91 @@ +locationBookingProfile; + } + + /** + * Sets Location Booking Profile. + * The booking profile of a seller's location, including the location's ID and whether the location is + * enabled for online booking. + * + * @maps location_booking_profile + */ + public function setLocationBookingProfile(?LocationBookingProfile $locationBookingProfile): void + { + $this->locationBookingProfile = $locationBookingProfile; + } + + /** + * Returns Errors. + * Errors that occurred during the request. + * + * @return Error[]|null + */ + public function getErrors(): ?array + { + return $this->errors; + } + + /** + * Sets Errors. + * Errors that occurred 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->locationBookingProfile)) { + $json['location_booking_profile'] = $this->locationBookingProfile; + } + 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/Subscription.php b/src/Models/Subscription.php index 98507559..c8c4b1b8 100644 --- a/src/Models/Subscription.php +++ b/src/Models/Subscription.php @@ -99,6 +99,11 @@ class Subscription implements \JsonSerializable */ private $actions = []; + /** + * @var int|null + */ + private $monthlyBillingAnchorDate; + /** * @var Phase[]|null */ @@ -581,6 +586,26 @@ public function unsetActions(): void $this->actions = []; } + /** + * Returns Monthly Billing Anchor Date. + * The day of the month on which the subscription will issue invoices and publish orders. + */ + public function getMonthlyBillingAnchorDate(): ?int + { + return $this->monthlyBillingAnchorDate; + } + + /** + * Sets Monthly Billing Anchor Date. + * The day of the month on which the subscription will issue invoices and publish orders. + * + * @maps monthly_billing_anchor_date + */ + public function setMonthlyBillingAnchorDate(?int $monthlyBillingAnchorDate): void + { + $this->monthlyBillingAnchorDate = $monthlyBillingAnchorDate; + } + /** * Returns Phases. * array of phases for this subscription @@ -618,58 +643,61 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; if (isset($this->id)) { - $json['id'] = $this->id; + $json['id'] = $this->id; } if (isset($this->locationId)) { - $json['location_id'] = $this->locationId; + $json['location_id'] = $this->locationId; } if (isset($this->planVariationId)) { - $json['plan_variation_id'] = $this->planVariationId; + $json['plan_variation_id'] = $this->planVariationId; } if (isset($this->customerId)) { - $json['customer_id'] = $this->customerId; + $json['customer_id'] = $this->customerId; } if (isset($this->startDate)) { - $json['start_date'] = $this->startDate; + $json['start_date'] = $this->startDate; } if (!empty($this->canceledDate)) { - $json['canceled_date'] = $this->canceledDate['value']; + $json['canceled_date'] = $this->canceledDate['value']; } if (isset($this->chargedThroughDate)) { - $json['charged_through_date'] = $this->chargedThroughDate; + $json['charged_through_date'] = $this->chargedThroughDate; } if (isset($this->status)) { - $json['status'] = $this->status; + $json['status'] = $this->status; } if (!empty($this->taxPercentage)) { - $json['tax_percentage'] = $this->taxPercentage['value']; + $json['tax_percentage'] = $this->taxPercentage['value']; } if (isset($this->invoiceIds)) { - $json['invoice_ids'] = $this->invoiceIds; + $json['invoice_ids'] = $this->invoiceIds; } if (isset($this->priceOverrideMoney)) { - $json['price_override_money'] = $this->priceOverrideMoney; + $json['price_override_money'] = $this->priceOverrideMoney; } if (isset($this->version)) { - $json['version'] = $this->version; + $json['version'] = $this->version; } if (isset($this->createdAt)) { - $json['created_at'] = $this->createdAt; + $json['created_at'] = $this->createdAt; } if (!empty($this->cardId)) { - $json['card_id'] = $this->cardId['value']; + $json['card_id'] = $this->cardId['value']; } if (isset($this->timezone)) { - $json['timezone'] = $this->timezone; + $json['timezone'] = $this->timezone; } if (isset($this->source)) { - $json['source'] = $this->source; + $json['source'] = $this->source; } if (!empty($this->actions)) { - $json['actions'] = $this->actions['value']; + $json['actions'] = $this->actions['value']; + } + if (isset($this->monthlyBillingAnchorDate)) { + $json['monthly_billing_anchor_date'] = $this->monthlyBillingAnchorDate; } if (isset($this->phases)) { - $json['phases'] = $this->phases; + $json['phases'] = $this->phases; } $json = array_filter($json, function ($val) { return $val !== null; diff --git a/src/Models/SubscriptionAction.php b/src/Models/SubscriptionAction.php index ba29b0e0..2a95f272 100644 --- a/src/Models/SubscriptionAction.php +++ b/src/Models/SubscriptionAction.php @@ -26,6 +26,11 @@ class SubscriptionAction implements \JsonSerializable */ private $effectiveDate = []; + /** + * @var array + */ + private $monthlyBillingAnchorDate = []; + /** * @var array */ @@ -108,6 +113,38 @@ public function unsetEffectiveDate(): void $this->effectiveDate = []; } + /** + * Returns Monthly Billing Anchor Date. + * The new billing anchor day value, for a `CHANGE_BILLING_ANCHOR_DATE` action. + */ + public function getMonthlyBillingAnchorDate(): ?int + { + if (count($this->monthlyBillingAnchorDate) == 0) { + return null; + } + return $this->monthlyBillingAnchorDate['value']; + } + + /** + * Sets Monthly Billing Anchor Date. + * The new billing anchor day value, for a `CHANGE_BILLING_ANCHOR_DATE` action. + * + * @maps monthly_billing_anchor_date + */ + public function setMonthlyBillingAnchorDate(?int $monthlyBillingAnchorDate): void + { + $this->monthlyBillingAnchorDate['value'] = $monthlyBillingAnchorDate; + } + + /** + * Unsets Monthly Billing Anchor Date. + * The new billing anchor day value, for a `CHANGE_BILLING_ANCHOR_DATE` action. + */ + public function unsetMonthlyBillingAnchorDate(): void + { + $this->monthlyBillingAnchorDate = []; + } + /** * Returns Phases. * A list of Phases, to pass phase-specific information used in the swap. @@ -189,19 +226,22 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; if (isset($this->id)) { - $json['id'] = $this->id; + $json['id'] = $this->id; } if (isset($this->type)) { - $json['type'] = $this->type; + $json['type'] = $this->type; } if (!empty($this->effectiveDate)) { - $json['effective_date'] = $this->effectiveDate['value']; + $json['effective_date'] = $this->effectiveDate['value']; + } + if (!empty($this->monthlyBillingAnchorDate)) { + $json['monthly_billing_anchor_date'] = $this->monthlyBillingAnchorDate['value']; } if (!empty($this->phases)) { - $json['phases'] = $this->phases['value']; + $json['phases'] = $this->phases['value']; } if (!empty($this->newPlanVariationId)) { - $json['new_plan_variation_id'] = $this->newPlanVariationId['value']; + $json['new_plan_variation_id'] = $this->newPlanVariationId['value']; } $json = array_filter($json, function ($val) { return $val !== null; diff --git a/src/Models/SubscriptionActionType.php b/src/Models/SubscriptionActionType.php index 6b26800b..bc6f2646 100644 --- a/src/Models/SubscriptionActionType.php +++ b/src/Models/SubscriptionActionType.php @@ -28,4 +28,9 @@ class SubscriptionActionType * The action to execute a scheduled swap of a subscription plan in a subscription. */ public const SWAP_PLAN = 'SWAP_PLAN'; + + /** + * A billing anchor date change action. + */ + public const CHANGE_BILLING_ANCHOR_DATE = 'CHANGE_BILLING_ANCHOR_DATE'; } diff --git a/src/Models/SubscriptionEvent.php b/src/Models/SubscriptionEvent.php index 0b011800..b6d6340e 100644 --- a/src/Models/SubscriptionEvent.php +++ b/src/Models/SubscriptionEvent.php @@ -26,6 +26,11 @@ class SubscriptionEvent implements \JsonSerializable */ private $effectiveDate; + /** + * @var int|null + */ + private $monthlyBillingAnchorDate; + /** * @var SubscriptionEventInfo|null */ @@ -122,6 +127,26 @@ public function setEffectiveDate(string $effectiveDate): void $this->effectiveDate = $effectiveDate; } + /** + * Returns Monthly Billing Anchor Date. + * The day-of-the-month the billing anchor date was changed to, if applicable. + */ + public function getMonthlyBillingAnchorDate(): ?int + { + return $this->monthlyBillingAnchorDate; + } + + /** + * Sets Monthly Billing Anchor Date. + * The day-of-the-month the billing anchor date was changed to, if applicable. + * + * @maps monthly_billing_anchor_date + */ + public function setMonthlyBillingAnchorDate(?int $monthlyBillingAnchorDate): void + { + $this->monthlyBillingAnchorDate = $monthlyBillingAnchorDate; + } + /** * Returns Info. * Provides information about the subscription event. @@ -211,16 +236,19 @@ public function setPlanVariationId(string $planVariationId): void public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; - $json['id'] = $this->id; - $json['subscription_event_type'] = $this->subscriptionEventType; - $json['effective_date'] = $this->effectiveDate; + $json['id'] = $this->id; + $json['subscription_event_type'] = $this->subscriptionEventType; + $json['effective_date'] = $this->effectiveDate; + if (isset($this->monthlyBillingAnchorDate)) { + $json['monthly_billing_anchor_date'] = $this->monthlyBillingAnchorDate; + } if (isset($this->info)) { - $json['info'] = $this->info; + $json['info'] = $this->info; } if (!empty($this->phases)) { - $json['phases'] = $this->phases['value']; + $json['phases'] = $this->phases['value']; } - $json['plan_variation_id'] = $this->planVariationId; + $json['plan_variation_id'] = $this->planVariationId; $json = array_filter($json, function ($val) { return $val !== null; }); diff --git a/src/Models/SubscriptionEventSubscriptionEventType.php b/src/Models/SubscriptionEventSubscriptionEventType.php index 5431beff..9e47fa46 100644 --- a/src/Models/SubscriptionEventSubscriptionEventType.php +++ b/src/Models/SubscriptionEventSubscriptionEventType.php @@ -38,4 +38,9 @@ class SubscriptionEventSubscriptionEventType * The subscription was paused. */ public const PAUSE_SUBSCRIPTION = 'PAUSE_SUBSCRIPTION'; + + /** + * The billing anchor date was changed. + */ + public const BILLING_ANCHOR_DATE_CHANGED = 'BILLING_ANCHOR_DATE_CHANGED'; } diff --git a/src/SquareClient.php b/src/SquareClient.php index 73ea1384..6bf6d0ca 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/31.0.0.20230925 ({api-version}) {engine}/{engine-version} ({os-' . + 'Square-PHP-SDK/32.0.0.20231018 ({api-version}) {engine}/{engine-version} ({os-' . 'info}) {detail}' ) ->userAgentConfig( @@ -304,7 +304,7 @@ public function withConfiguration(array $config): self */ public function getSdkVersion(): string { - return '31.0.0.20230925'; + return '32.0.0.20231018'; } /**