diff --git a/.mock/definition/__package__.yml b/.mock/definition/__package__.yml index adc854da..154cd91d 100644 --- a/.mock/definition/__package__.yml +++ b/.mock/definition/__package__.yml @@ -3378,6 +3378,38 @@ types: from the `amount_money` and `buyer_supplied_money` fields. source: openapi: openapi/openapi.json + CatalogAvailabilityPeriod: + docs: Represents a time period of availability. + properties: + start_local_time: + type: optional> + docs: >- + The start time of an availability period, specified in local time + using partial-time + + RFC 3339 format. For example, `8:30:00` for a period starting at 8:30 + in the morning. + + Note that the seconds value is always :00, but it is appended for + conformance to the RFC. + end_local_time: + type: optional> + docs: >- + The end time of an availability period, specified in local time using + partial-time + + RFC 3339 format. For example, `21:00:00` for a period ending at 9:00 + in the evening. + + Note that the seconds value is always :00, but it is appended for + conformance to the RFC. + day_of_week: + type: optional + docs: |- + The day of the week for this availability period. + See [DayOfWeek](#type-dayofweek) for possible values + source: + openapi: openapi/openapi.json CatalogCategory: docs: A category to which a `CatalogItem` instance belongs. properties: @@ -5129,6 +5161,8 @@ types: CHECKOUT_LINK: CatalogObjectCheckoutLink ADDRESS: CatalogObjectAddress SUBSCRIPTION_PRODUCT: CatalogObjectSubscriptionProduct + SUBSCRIPTION_PLAN_VARIATION: CatalogObjectSubscriptionPlanVariation + AVAILABILITY_PERIOD: CatalogObjectAvailabilityPeriod source: openapi: openapi/openapi.json CatalogObjectBatch: @@ -6156,6 +6190,43 @@ types: SubscriptionPlan. source: openapi: openapi/openapi.json + CatalogSubscriptionPlanVariation: + docs: >- + Describes a subscription plan variation. A subscription plan variation + represents how the subscription for a product or service is sold. + + For more information, see [Subscription Plans and + Variations](https://developer.squareup.com/docs/subscriptions-api/plans-and-variations). + properties: + name: + type: string + docs: The name of the plan variation. + phases: + docs: >- + A list containing each [SubscriptionPhase](entity:SubscriptionPhase) + for this plan variation. + type: list + subscription_plan_id: + type: optional> + docs: The id of the subscription plan, if there is one. + monthly_billing_anchor_date: + type: optional> + docs: The day of the month the billing period starts. + can_prorate: + type: optional> + docs: Whether bills for this plan variation can be split for proration. + successor_plan_variation_id: + type: optional> + docs: >- + The ID of a "successor" plan variation to this one. If the field is + set, and this object is disabled at all + + locations, it indicates that this variation is deprecated and the + object identified by the successor ID be used in + + its stead. + source: + openapi: openapi/openapi.json CatalogTax: docs: A tax applicable to an item. properties: @@ -26939,6 +27010,28 @@ types: - CatalogObjectBase source: openapi: openapi/openapi.json + CatalogObjectSubscriptionPlanVariation: + properties: + subscription_plan_variation_data: + type: optional + docs: >- + Structured data for a `CatalogSubscriptionPlanVariation`, set for + CatalogObjects of type `SUBSCRIPTION_PLAN_VARIATION`. + extends: + - CatalogObjectBase + source: + openapi: openapi/openapi.json + CatalogObjectAvailabilityPeriod: + properties: + availability_period_data: + type: optional + docs: >- + Structured data for a `CatalogAvailabilityPeriod`, set for + CatalogObjects of type `AVAILABILITY_PERIOD`. + extends: + - CatalogObjectBase + source: + openapi: openapi/openapi.json CatalogObjectComponent: properties: {} extends: diff --git a/.mock/fern.config.json b/.mock/fern.config.json index 3a435fe9..7ca1996f 100644 --- a/.mock/fern.config.json +++ b/.mock/fern.config.json @@ -1,4 +1,4 @@ { "organization" : "square", - "version" : "0.56.24" + "version" : "0.57.11" } \ No newline at end of file diff --git a/composer.json b/composer.json index 74d8d5df..20966229 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "square/square", - "version": "42.0.0.20250319", + "version": "42.0.1.20250319", "description": "Use Square APIs to manage and run business including payment, customer, product, inventory, and employee management.", "keywords": [ "square", diff --git a/src/SquareClient.php b/src/SquareClient.php index cd3d5b72..f91b30e8 100644 --- a/src/SquareClient.php +++ b/src/SquareClient.php @@ -250,8 +250,8 @@ public function __construct( 'Square-Version' => '2025-03-19', 'X-Fern-Language' => 'PHP', 'X-Fern-SDK-Name' => 'Square', - 'X-Fern-SDK-Version' => '42.0.0.20250319', - 'User-Agent' => 'square/square/42.0.0.20250319', + 'X-Fern-SDK-Version' => '42.0.1.20250319', + 'User-Agent' => 'square/square/42.0.1.20250319', ]; if ($version != null) { $defaultHeaders['Square-Version'] = $version; diff --git a/src/Types/CatalogAvailabilityPeriod.php b/src/Types/CatalogAvailabilityPeriod.php new file mode 100644 index 00000000..7cb80ea0 --- /dev/null +++ b/src/Types/CatalogAvailabilityPeriod.php @@ -0,0 +1,115 @@ + $dayOfWeek + */ + #[JsonProperty('day_of_week')] + private ?string $dayOfWeek; + + /** + * @param array{ + * startLocalTime?: ?string, + * endLocalTime?: ?string, + * dayOfWeek?: ?value-of, + * } $values + */ + public function __construct( + array $values = [], + ) { + $this->startLocalTime = $values['startLocalTime'] ?? null; + $this->endLocalTime = $values['endLocalTime'] ?? null; + $this->dayOfWeek = $values['dayOfWeek'] ?? null; + } + + /** + * @return ?string + */ + public function getStartLocalTime(): ?string + { + return $this->startLocalTime; + } + + /** + * @param ?string $value + */ + public function setStartLocalTime(?string $value = null): self + { + $this->startLocalTime = $value; + return $this; + } + + /** + * @return ?string + */ + public function getEndLocalTime(): ?string + { + return $this->endLocalTime; + } + + /** + * @param ?string $value + */ + public function setEndLocalTime(?string $value = null): self + { + $this->endLocalTime = $value; + return $this; + } + + /** + * @return ?value-of + */ + public function getDayOfWeek(): ?string + { + return $this->dayOfWeek; + } + + /** + * @param ?value-of $value + */ + public function setDayOfWeek(?string $value = null): self + { + $this->dayOfWeek = $value; + return $this; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Types/CatalogObject.php b/src/Types/CatalogObject.php index 9f4b04ad..c4be09b5 100644 --- a/src/Types/CatalogObject.php +++ b/src/Types/CatalogObject.php @@ -48,6 +48,8 @@ class CatalogObject extends JsonSerializableType * |'CHECKOUT_LINK' * |'ADDRESS' * |'SUBSCRIPTION_PRODUCT' + * |'SUBSCRIPTION_PLAN_VARIATION' + * |'AVAILABILITY_PERIOD' * |'_unknown' * ) $type */ @@ -81,6 +83,8 @@ class CatalogObject extends JsonSerializableType * |CatalogObjectCheckoutLink * |CatalogObjectAddress * |CatalogObjectSubscriptionProduct + * |CatalogObjectSubscriptionPlanVariation + * |CatalogObjectAvailabilityPeriod * |mixed * ) $value */ @@ -115,6 +119,8 @@ class CatalogObject extends JsonSerializableType * |'CHECKOUT_LINK' * |'ADDRESS' * |'SUBSCRIPTION_PRODUCT' + * |'SUBSCRIPTION_PLAN_VARIATION' + * |'AVAILABILITY_PERIOD' * |'_unknown' * ), * value: ( @@ -144,6 +150,8 @@ class CatalogObject extends JsonSerializableType * |CatalogObjectCheckoutLink * |CatalogObjectAddress * |CatalogObjectSubscriptionProduct + * |CatalogObjectSubscriptionPlanVariation + * |CatalogObjectAvailabilityPeriod * |mixed * ), * } $values @@ -183,6 +191,8 @@ private function __construct( * |'CHECKOUT_LINK' * |'ADDRESS' * |'SUBSCRIPTION_PRODUCT' + * |'SUBSCRIPTION_PLAN_VARIATION' + * |'AVAILABILITY_PERIOD' * |'_unknown' * ) */ @@ -219,6 +229,8 @@ public function getType(): string * |CatalogObjectCheckoutLink * |CatalogObjectAddress * |CatalogObjectSubscriptionProduct + * |CatalogObjectSubscriptionPlanVariation + * |CatalogObjectAvailabilityPeriod * |mixed * ) */ @@ -539,6 +551,30 @@ public static function subscriptionProduct(CatalogObjectSubscriptionProduct $sub ]); } + /** + * @param CatalogObjectSubscriptionPlanVariation $subscriptionPlanVariation + * @return CatalogObject + */ + public static function subscriptionPlanVariation(CatalogObjectSubscriptionPlanVariation $subscriptionPlanVariation): CatalogObject + { + return new CatalogObject([ + 'type' => 'SUBSCRIPTION_PLAN_VARIATION', + 'value' => $subscriptionPlanVariation, + ]); + } + + /** + * @param CatalogObjectAvailabilityPeriod $availabilityPeriod + * @return CatalogObject + */ + public static function availabilityPeriod(CatalogObjectAvailabilityPeriod $availabilityPeriod): CatalogObject + { + return new CatalogObject([ + 'type' => 'AVAILABILITY_PERIOD', + 'value' => $availabilityPeriod, + ]); + } + /** * @return bool */ @@ -1111,6 +1147,50 @@ public function asSubscriptionProduct(): CatalogObjectSubscriptionProduct return $this->value; } + /** + * @return bool + */ + public function isSubscriptionPlanVariation(): bool + { + return $this->value instanceof CatalogObjectSubscriptionPlanVariation && $this->type === 'SUBSCRIPTION_PLAN_VARIATION'; + } + + /** + * @return CatalogObjectSubscriptionPlanVariation + */ + public function asSubscriptionPlanVariation(): CatalogObjectSubscriptionPlanVariation + { + if (!($this->value instanceof CatalogObjectSubscriptionPlanVariation && $this->type === 'SUBSCRIPTION_PLAN_VARIATION')) { + throw new Exception( + "Expected SUBSCRIPTION_PLAN_VARIATION; got " . $this->type . " with value of type " . get_debug_type($this->value), + ); + } + + return $this->value; + } + + /** + * @return bool + */ + public function isAvailabilityPeriod(): bool + { + return $this->value instanceof CatalogObjectAvailabilityPeriod && $this->type === 'AVAILABILITY_PERIOD'; + } + + /** + * @return CatalogObjectAvailabilityPeriod + */ + public function asAvailabilityPeriod(): CatalogObjectAvailabilityPeriod + { + if (!($this->value instanceof CatalogObjectAvailabilityPeriod && $this->type === 'AVAILABILITY_PERIOD')) { + throw new Exception( + "Expected AVAILABILITY_PERIOD; got " . $this->type . " with value of type " . get_debug_type($this->value), + ); + } + + return $this->value; + } + /** * @return string */ @@ -1235,6 +1315,14 @@ public function jsonSerialize(): array $value = $this->asSubscriptionProduct()->jsonSerialize(); $result = array_merge($value, $result); break; + case 'SUBSCRIPTION_PLAN_VARIATION': + $value = $this->asSubscriptionPlanVariation()->jsonSerialize(); + $result = array_merge($value, $result); + break; + case 'AVAILABILITY_PERIOD': + $value = $this->asAvailabilityPeriod()->jsonSerialize(); + $result = array_merge($value, $result); + break; case '_unknown': default: if (is_null($this->value)) { @@ -1361,6 +1449,12 @@ public static function jsonDeserialize(array $data): static case 'SUBSCRIPTION_PRODUCT': $args['value'] = CatalogObjectSubscriptionProduct::jsonDeserialize($data); break; + case 'SUBSCRIPTION_PLAN_VARIATION': + $args['value'] = CatalogObjectSubscriptionPlanVariation::jsonDeserialize($data); + break; + case 'AVAILABILITY_PERIOD': + $args['value'] = CatalogObjectAvailabilityPeriod::jsonDeserialize($data); + break; case '_unknown': default: $args['type'] = '_unknown'; diff --git a/src/Types/CatalogObjectAvailabilityPeriod.php b/src/Types/CatalogObjectAvailabilityPeriod.php new file mode 100644 index 00000000..78a558a4 --- /dev/null +++ b/src/Types/CatalogObjectAvailabilityPeriod.php @@ -0,0 +1,74 @@ +, + * catalogV1Ids?: ?array, + * presentAtAllLocations?: ?bool, + * presentAtLocationIds?: ?array, + * absentAtLocationIds?: ?array, + * imageId?: ?string, + * availabilityPeriodData?: ?CatalogAvailabilityPeriod, + * } $values + */ + public function __construct( + array $values, + ) { + $this->id = $values['id']; + $this->updatedAt = $values['updatedAt'] ?? null; + $this->version = $values['version'] ?? null; + $this->isDeleted = $values['isDeleted'] ?? null; + $this->customAttributeValues = $values['customAttributeValues'] ?? null; + $this->catalogV1Ids = $values['catalogV1Ids'] ?? null; + $this->presentAtAllLocations = $values['presentAtAllLocations'] ?? null; + $this->presentAtLocationIds = $values['presentAtLocationIds'] ?? null; + $this->absentAtLocationIds = $values['absentAtLocationIds'] ?? null; + $this->imageId = $values['imageId'] ?? null; + $this->availabilityPeriodData = $values['availabilityPeriodData'] ?? null; + } + + /** + * @return ?CatalogAvailabilityPeriod + */ + public function getAvailabilityPeriodData(): ?CatalogAvailabilityPeriod + { + return $this->availabilityPeriodData; + } + + /** + * @param ?CatalogAvailabilityPeriod $value + */ + public function setAvailabilityPeriodData(?CatalogAvailabilityPeriod $value = null): self + { + $this->availabilityPeriodData = $value; + return $this; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Types/CatalogObjectSubscriptionPlanVariation.php b/src/Types/CatalogObjectSubscriptionPlanVariation.php new file mode 100644 index 00000000..dd5f27aa --- /dev/null +++ b/src/Types/CatalogObjectSubscriptionPlanVariation.php @@ -0,0 +1,74 @@ +, + * catalogV1Ids?: ?array, + * presentAtAllLocations?: ?bool, + * presentAtLocationIds?: ?array, + * absentAtLocationIds?: ?array, + * imageId?: ?string, + * subscriptionPlanVariationData?: ?CatalogSubscriptionPlanVariation, + * } $values + */ + public function __construct( + array $values, + ) { + $this->id = $values['id']; + $this->updatedAt = $values['updatedAt'] ?? null; + $this->version = $values['version'] ?? null; + $this->isDeleted = $values['isDeleted'] ?? null; + $this->customAttributeValues = $values['customAttributeValues'] ?? null; + $this->catalogV1Ids = $values['catalogV1Ids'] ?? null; + $this->presentAtAllLocations = $values['presentAtAllLocations'] ?? null; + $this->presentAtLocationIds = $values['presentAtLocationIds'] ?? null; + $this->absentAtLocationIds = $values['absentAtLocationIds'] ?? null; + $this->imageId = $values['imageId'] ?? null; + $this->subscriptionPlanVariationData = $values['subscriptionPlanVariationData'] ?? null; + } + + /** + * @return ?CatalogSubscriptionPlanVariation + */ + public function getSubscriptionPlanVariationData(): ?CatalogSubscriptionPlanVariation + { + return $this->subscriptionPlanVariationData; + } + + /** + * @param ?CatalogSubscriptionPlanVariation $value + */ + public function setSubscriptionPlanVariationData(?CatalogSubscriptionPlanVariation $value = null): self + { + $this->subscriptionPlanVariationData = $value; + return $this; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Types/CatalogSubscriptionPlanVariation.php b/src/Types/CatalogSubscriptionPlanVariation.php new file mode 100644 index 00000000..ace0d144 --- /dev/null +++ b/src/Types/CatalogSubscriptionPlanVariation.php @@ -0,0 +1,185 @@ + $phases A list containing each [SubscriptionPhase](entity:SubscriptionPhase) for this plan variation. + */ + #[JsonProperty('phases'), ArrayType([SubscriptionPhase::class])] + private array $phases; + + /** + * @var ?string $subscriptionPlanId The id of the subscription plan, if there is one. + */ + #[JsonProperty('subscription_plan_id')] + private ?string $subscriptionPlanId; + + /** + * @var ?int $monthlyBillingAnchorDate The day of the month the billing period starts. + */ + #[JsonProperty('monthly_billing_anchor_date')] + private ?int $monthlyBillingAnchorDate; + + /** + * @var ?bool $canProrate Whether bills for this plan variation can be split for proration. + */ + #[JsonProperty('can_prorate')] + private ?bool $canProrate; + + /** + * The ID of a "successor" plan variation to this one. If the field is set, and this object is disabled at all + * locations, it indicates that this variation is deprecated and the object identified by the successor ID be used in + * its stead. + * + * @var ?string $successorPlanVariationId + */ + #[JsonProperty('successor_plan_variation_id')] + private ?string $successorPlanVariationId; + + /** + * @param array{ + * name: string, + * phases: array, + * subscriptionPlanId?: ?string, + * monthlyBillingAnchorDate?: ?int, + * canProrate?: ?bool, + * successorPlanVariationId?: ?string, + * } $values + */ + public function __construct( + array $values, + ) { + $this->name = $values['name']; + $this->phases = $values['phases']; + $this->subscriptionPlanId = $values['subscriptionPlanId'] ?? null; + $this->monthlyBillingAnchorDate = $values['monthlyBillingAnchorDate'] ?? null; + $this->canProrate = $values['canProrate'] ?? null; + $this->successorPlanVariationId = $values['successorPlanVariationId'] ?? null; + } + + /** + * @return string + */ + public function getName(): string + { + return $this->name; + } + + /** + * @param string $value + */ + public function setName(string $value): self + { + $this->name = $value; + return $this; + } + + /** + * @return array + */ + public function getPhases(): array + { + return $this->phases; + } + + /** + * @param array $value + */ + public function setPhases(array $value): self + { + $this->phases = $value; + return $this; + } + + /** + * @return ?string + */ + public function getSubscriptionPlanId(): ?string + { + return $this->subscriptionPlanId; + } + + /** + * @param ?string $value + */ + public function setSubscriptionPlanId(?string $value = null): self + { + $this->subscriptionPlanId = $value; + return $this; + } + + /** + * @return ?int + */ + public function getMonthlyBillingAnchorDate(): ?int + { + return $this->monthlyBillingAnchorDate; + } + + /** + * @param ?int $value + */ + public function setMonthlyBillingAnchorDate(?int $value = null): self + { + $this->monthlyBillingAnchorDate = $value; + return $this; + } + + /** + * @return ?bool + */ + public function getCanProrate(): ?bool + { + return $this->canProrate; + } + + /** + * @param ?bool $value + */ + public function setCanProrate(?bool $value = null): self + { + $this->canProrate = $value; + return $this; + } + + /** + * @return ?string + */ + public function getSuccessorPlanVariationId(): ?string + { + return $this->successorPlanVariationId; + } + + /** + * @param ?string $value + */ + public function setSuccessorPlanVariationId(?string $value = null): self + { + $this->successorPlanVariationId = $value; + return $this; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +}