diff --git a/changes.md b/changes.md
index fe8fca7df90..9cccb8e162d 100644
--- a/changes.md
+++ b/changes.md
@@ -11,19 +11,33 @@
References to Stores the Business Unit is associated with. Only present when If the Business Unit has Stores defined, then all of its Carts, Orders, Quotes, Quote Requests, or Shopping Lists must belong to one of the Business Unit's Stores. If the Business Unit has no Stores, then all of its Carts, Orders, Quotes, Quote Requests, or Shopping Lists must not belong to any Store. If the Business Unit has Stores defined, then all of its Carts, Orders, Recurring Orders, Quotes, Quote Requests, or Shopping Lists must belong to one of the Business Unit's Stores. If the Business Unit has no Stores, then all of its Carts, Orders, Recurring Orders, Quotes, Quote Requests, or Shopping Lists must not belong to any Store. References to Stores the Business Unit is associated with. Only present when If the Business Unit has Stores defined, then all of its Carts, Orders, Quotes, Quote Requests, or Shopping Lists must belong to one of the Business Unit's Stores. If the Business Unit has no Stores, then all of its Carts, Orders, Quotes, Quote Requests, or Shopping Lists must not belong to any Store. If the Business Unit has Stores defined, then all of its Carts, Orders, Recurring Orders, Quotes, Quote Requests, or Shopping Lists must belong to one of the Business Unit's Stores. If the Business Unit has no Stores, then all of its Carts, Orders, Recurring Orders, Quotes, Quote Requests, or Shopping Lists must not belong to any Store. Sets the Stores the Business Unit is associated with. Can only be set when If the Business Unit has Stores defined, then all of its Carts, Orders, Quotes, Quote Requests, or Shopping Lists must belong to one of the Business Unit's Stores. If the Business Unit has no Stores, then all of its Carts, Orders, Quotes, Quote Requests, or Shopping Lists must not belong to any Store. If the Business Unit has Stores defined, then all of its Carts, Orders, Recurring Orders, Quotes, Quote Requests, or Shopping Lists must belong to one of the Business Unit's Stores. If the Business Unit has no Stores, then all of its Carts, Orders, Recurring Orders, Quotes, Quote Requests, or Shopping Lists must not belong to any Store. Sets the Stores the Business Unit is associated with. Can only be set when If the Business Unit has Stores defined, then all of its Carts, Orders, Quotes, Quote Requests, or Shopping Lists must belong to one of the Business Unit's Stores. If the Business Unit has no Stores, then all of its Carts, Orders, Quotes, Quote Requests, or Shopping Lists must not belong to any Store. If the Business Unit has Stores defined, then all of its Carts, Orders, Recurring Orders, Quotes, Quote Requests, or Shopping Lists must belong to one of the Business Unit's Stores. If the Business Unit has no Stores, then all of its Carts, Orders, Recurring Orders, Quotes, Quote Requests, or Shopping Lists must not belong to any Store. Sets the Stores the Business Unit is associated with. Can only be set when If the Business Unit has Stores defined, then all of its Carts, Orders, Quotes, Quote Requests, or Shopping Lists must belong to one of the Business Unit's Stores. If the Business Unit has no Stores, then all of its Carts, Orders, Quotes, Quote Requests, or Shopping Lists must not belong to any Store. If the Business Unit has Stores defined, then all of its Carts, Orders, Recurring Orders, Quotes, Quote Requests, or Shopping Lists must belong to one of the Business Unit's Stores. If the Business Unit has no Stores, then all of its Carts, Orders, Recurring Orders, Quotes, Quote Requests, or Shopping Lists must not belong to any Store. References to Stores the Business Unit is associated with. Only present when If the Business Unit has Stores defined, then all of its Carts, Orders, Quotes, Quote Requests, or Shopping Lists must belong to one of the Business Unit's Stores. If the Business Unit has no Stores, then all of its Carts, Orders, Quotes, Quote Requests, or Shopping Lists must not belong to any Store. If the Business Unit has Stores defined, then all of its Carts, Orders, Recurring Orders, Quotes, Quote Requests, or Shopping Lists must belong to one of the Business Unit's Stores. If the Business Unit has no Stores, then all of its Carts, Orders, Recurring Orders, Quotes, Quote Requests, or Shopping Lists must not belong to any Store. References to Stores the Business Unit is associated with. Only present when If the Business Unit has Stores defined, then all of its Carts, Orders, Quotes, Quote Requests, or Shopping Lists must belong to one of the Business Unit's Stores. If the Business Unit has no Stores, then all of its Carts, Orders, Quotes, Quote Requests, or Shopping Lists must not belong to any Store. If the Business Unit has Stores defined, then all of its Carts, Orders, Recurring Orders, Quotes, Quote Requests, or Shopping Lists must belong to one of the Business Unit's Stores. If the Business Unit has no Stores, then all of its Carts, Orders, Recurring Orders, Quotes, Quote Requests, or Shopping Lists must not belong to any Store. Sets the Stores the Business Unit is associated with. Can only be set when If the Business Unit has Stores defined, then all of its Carts, Orders, Quotes, Quote Requests, or Shopping Lists must belong to one of the Business Unit's Stores. If the Business Unit has no Stores, then all of its Carts, Orders, Quotes, Quote Requests, or Shopping Lists must not belong to any Store. If the Business Unit has Stores defined, then all of its Carts, Orders, Recurring Orders, Quotes, Quote Requests, or Shopping Lists must belong to one of the Business Unit's Stores. If the Business Unit has no Stores, then all of its Carts, Orders, Recurring Orders, Quotes, Quote Requests, or Shopping Lists must not belong to any Store. Sets the Stores the Business Unit is associated with. Can only be set when If the Business Unit has Stores defined, then all of its Carts, Orders, Quotes, Quote Requests, or Shopping Lists must belong to one of the Business Unit's Stores. If the Business Unit has no Stores, then all of its Carts, Orders, Quotes, Quote Requests, or Shopping Lists must not belong to any Store. If the Business Unit has Stores defined, then all of its Carts, Orders, Recurring Orders, Quotes, Quote Requests, or Shopping Lists must belong to one of the Business Unit's Stores. If the Business Unit has no Stores, then all of its Carts, Orders, Recurring Orders, Quotes, Quote Requests, or Shopping Lists must not belong to any Store. References to Stores the Business Unit is associated with. Only present when If the Business Unit has Stores defined, then all of its Carts, Orders, Quotes, Quote Requests, or Shopping Lists must belong to one of the Business Unit's Stores. If the Business Unit has no Stores, then all of its Carts, Orders, Quotes, Quote Requests, or Shopping Lists must not belong to any Store. If the Business Unit has Stores defined, then all of its Carts, Orders, Recurring Orders, Quotes, Quote Requests, or Shopping Lists must belong to one of the Business Unit's Stores. If the Business Unit has no Stores, then all of its Carts, Orders, Recurring Orders, Quotes, Quote Requests, or Shopping Lists must not belong to any Store. References to Stores the Business Unit is associated with. Only present when If the Business Unit has Stores defined, then all of its Carts, Orders, Quotes, Quote Requests, or Shopping Lists must belong to one of the Business Unit's Stores. If the Business Unit has no Stores, then all of its Carts, Orders, Quotes, Quote Requests, or Shopping Lists must not belong to any Store. If the Business Unit has Stores defined, then all of its Carts, Orders, Recurring Orders, Quotes, Quote Requests, or Shopping Lists must belong to one of the Business Unit's Stores. If the Business Unit has no Stores, then all of its Carts, Orders, Recurring Orders, Quotes, Quote Requests, or Shopping Lists must not belong to any Store. Sets the Stores the Business Unit is associated with. Can only be set when If the Business Unit has Stores defined, then all of its Carts, Orders, Quotes, Quote Requests, or Shopping Lists must belong to one of the Business Unit's Stores. If the Business Unit has no Stores, then all of its Carts, Orders, Quotes, Quote Requests, or Shopping Lists must not belong to any Store. If the Business Unit has Stores defined, then all of its Carts, Orders, Recurring Orders, Quotes, Quote Requests, or Shopping Lists must belong to one of the Business Unit's Stores. If the Business Unit has no Stores, then all of its Carts, Orders, Recurring Orders, Quotes, Quote Requests, or Shopping Lists must not belong to any Store. Sets the Stores the Business Unit is associated with. Can only be set when If the Business Unit has Stores defined, then all of its Carts, Orders, Quotes, Quote Requests, or Shopping Lists must belong to one of the Business Unit's Stores. If the Business Unit has no Stores, then all of its Carts, Orders, Quotes, Quote Requests, or Shopping Lists must not belong to any Store. If the Business Unit has Stores defined, then all of its Carts, Orders, Recurring Orders, Quotes, Quote Requests, or Shopping Lists must belong to one of the Business Unit's Stores. If the Business Unit has no Stores, then all of its Carts, Orders, Recurring Orders, Quotes, Quote Requests, or Shopping Lists must not belong to any Store. References to Stores the Business Unit is associated with. Only present when If the Business Unit has Stores defined, then all of its Carts, Orders, Quotes, Quote Requests, or Shopping Lists must belong to one of the Business Unit's Stores. If the Business Unit has no Stores, then all of its Carts, Orders, Quotes, Quote Requests, or Shopping Lists must not belong to any Store. If the Business Unit has Stores defined, then all of its Carts, Orders, Recurring Orders, Quotes, Quote Requests, or Shopping Lists must belong to one of the Business Unit's Stores. If the Business Unit has no Stores, then all of its Carts, Orders, Recurring Orders, Quotes, Quote Requests, or Shopping Lists must not belong to any Store. Money value of the Custom Line Item.
@@ -114,6 +116,14 @@ public function getCustom();
*/
public function getPriceMode();
+ /**
+ * Recurring Order and frequency data. Money value of the Custom Line Item.
* The value can be negative. Recurring Order and frequency data. Recurring Order and frequency data. Recurring Order and frequency data. Custom Fields for the Line Item. Recurring Order and frequency data. Custom Fields for the Line Item. Recurring Order and frequency data. Custom Fields for the Line Item.storeMode is Explicit.storeMode is Explicit.storeMode is Explicit.
* Defaults to empty for Companies and not set for Divisions.storeMode is Explicit.
* Defaults to empty for Companies and not set for Divisions.storeMode is Explicit.
* Defaults to empty for Companies and not set for Divisions.storeMode is Explicit.storeMode is Explicit.storeMode is Explicit.
* Defaults to empty for Companies and not set for Divisions.storeMode is Explicit.
* Defaults to empty for Companies and not set for Divisions.storeMode is Explicit.storeMode is Explicit.storeMode is Explicit.
* Defaults to empty for Companies and not set for Divisions.storeMode is Explicit.
* Defaults to empty for Companies and not set for Divisions.storeMode is Explicit.id of the CustomLineItem to update. Either customLineItemId or customLineItemKey is required.
key of the CustomLineItem to update. Either customLineItemId or customLineItemKey is required.
Value to set. + * If empty, any existing value will be removed.
+ * + + * @return null|CustomLineItemRecurrenceInfoDraft + */ + public function getRecurrenceInfo(); + + /** + * @param ?string $customLineItemId + */ + public function setCustomLineItemId(?string $customLineItemId): void; + + /** + * @param ?string $customLineItemKey + */ + public function setCustomLineItemKey(?string $customLineItemKey): void; + + /** + * @param ?CustomLineItemRecurrenceInfoDraft $recurrenceInfo + */ + public function setRecurrenceInfo(?CustomLineItemRecurrenceInfoDraft $recurrenceInfo): void; +} diff --git a/lib/commercetools-api/src/Models/Cart/CartSetCustomLineItemRecurrenceInfoActionBuilder.php b/lib/commercetools-api/src/Models/Cart/CartSetCustomLineItemRecurrenceInfoActionBuilder.php new file mode 100644 index 00000000000..c05b731aa58 --- /dev/null +++ b/lib/commercetools-api/src/Models/Cart/CartSetCustomLineItemRecurrenceInfoActionBuilder.php @@ -0,0 +1,134 @@ + + */ +final class CartSetCustomLineItemRecurrenceInfoActionBuilder implements Builder +{ + /** + + * @var ?string + */ + private $customLineItemId; + + /** + + * @var ?string + */ + private $customLineItemKey; + + /** + + * @var null|CustomLineItemRecurrenceInfoDraft|CustomLineItemRecurrenceInfoDraftBuilder + */ + private $recurrenceInfo; + + /** + *id of the CustomLineItem to update. Either customLineItemId or customLineItemKey is required.
key of the CustomLineItem to update. Either customLineItemId or customLineItemKey is required.
Value to set. + * If empty, any existing value will be removed.
+ * + + * @return null|CustomLineItemRecurrenceInfoDraft + */ + public function getRecurrenceInfo() + { + return $this->recurrenceInfo instanceof CustomLineItemRecurrenceInfoDraftBuilder ? $this->recurrenceInfo->build() : $this->recurrenceInfo; + } + + /** + * @param ?string $customLineItemId + * @return $this + */ + public function withCustomLineItemId(?string $customLineItemId) + { + $this->customLineItemId = $customLineItemId; + + return $this; + } + + /** + * @param ?string $customLineItemKey + * @return $this + */ + public function withCustomLineItemKey(?string $customLineItemKey) + { + $this->customLineItemKey = $customLineItemKey; + + return $this; + } + + /** + * @param ?CustomLineItemRecurrenceInfoDraft $recurrenceInfo + * @return $this + */ + public function withRecurrenceInfo(?CustomLineItemRecurrenceInfoDraft $recurrenceInfo) + { + $this->recurrenceInfo = $recurrenceInfo; + + return $this; + } + + /** + * @deprecated use withRecurrenceInfo() instead + * @return $this + */ + public function withRecurrenceInfoBuilder(?CustomLineItemRecurrenceInfoDraftBuilder $recurrenceInfo) + { + $this->recurrenceInfo = $recurrenceInfo; + + return $this; + } + + public function build(): CartSetCustomLineItemRecurrenceInfoAction + { + return new CartSetCustomLineItemRecurrenceInfoActionModel( + $this->customLineItemId, + $this->customLineItemKey, + $this->recurrenceInfo instanceof CustomLineItemRecurrenceInfoDraftBuilder ? $this->recurrenceInfo->build() : $this->recurrenceInfo + ); + } + + public static function of(): CartSetCustomLineItemRecurrenceInfoActionBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/Cart/CartSetCustomLineItemRecurrenceInfoActionCollection.php b/lib/commercetools-api/src/Models/Cart/CartSetCustomLineItemRecurrenceInfoActionCollection.php new file mode 100644 index 00000000000..a6d86b00a46 --- /dev/null +++ b/lib/commercetools-api/src/Models/Cart/CartSetCustomLineItemRecurrenceInfoActionCollection.php @@ -0,0 +1,56 @@ + + * @method CartSetCustomLineItemRecurrenceInfoAction current() + * @method CartSetCustomLineItemRecurrenceInfoAction end() + * @method CartSetCustomLineItemRecurrenceInfoAction at($offset) + */ +class CartSetCustomLineItemRecurrenceInfoActionCollection extends CartUpdateActionCollection +{ + /** + * @psalm-assert CartSetCustomLineItemRecurrenceInfoAction $value + * @psalm-param CartSetCustomLineItemRecurrenceInfoAction|stdClass $value + * @throws InvalidArgumentException + * + * @return CartSetCustomLineItemRecurrenceInfoActionCollection + */ + public function add($value) + { + if (!$value instanceof CartSetCustomLineItemRecurrenceInfoAction) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?CartSetCustomLineItemRecurrenceInfoAction + */ + protected function mapper() + { + return function (?int $index): ?CartSetCustomLineItemRecurrenceInfoAction { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var CartSetCustomLineItemRecurrenceInfoAction $data */ + $data = CartSetCustomLineItemRecurrenceInfoActionModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/Cart/CartSetCustomLineItemRecurrenceInfoActionModel.php b/lib/commercetools-api/src/Models/Cart/CartSetCustomLineItemRecurrenceInfoActionModel.php new file mode 100644 index 00000000000..a61946ae5f9 --- /dev/null +++ b/lib/commercetools-api/src/Models/Cart/CartSetCustomLineItemRecurrenceInfoActionModel.php @@ -0,0 +1,169 @@ +customLineItemId = $customLineItemId; + $this->customLineItemKey = $customLineItemKey; + $this->recurrenceInfo = $recurrenceInfo; + $this->action = $action ?? self::DISCRIMINATOR_VALUE; + } + + /** + * + * @return null|string + */ + public function getAction() + { + if (is_null($this->action)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_ACTION); + if (is_null($data)) { + return null; + } + $this->action = (string) $data; + } + + return $this->action; + } + + /** + *id of the CustomLineItem to update. Either customLineItemId or customLineItemKey is required.
key of the CustomLineItem to update. Either customLineItemId or customLineItemKey is required.
Value to set. + * If empty, any existing value will be removed.
+ * + * + * @return null|CustomLineItemRecurrenceInfoDraft + */ + public function getRecurrenceInfo() + { + if (is_null($this->recurrenceInfo)) { + /** @psalm-var stdClass|arrayid of the LineItem to update. Either lineItemId or lineItemKey is required.
+ *
+
+ * @return null|string
+ */
+ public function getLineItemId();
+
+ /**
+ * key of the LineItem to update. Either lineItemId or lineItemKey is required.
Value to set. + * If empty, any existing value will be removed.
+ * + + * @return null|LineItemRecurrenceInfoDraft + */ + public function getRecurrenceInfo(); + + /** + * @param ?string $lineItemId + */ + public function setLineItemId(?string $lineItemId): void; + + /** + * @param ?string $lineItemKey + */ + public function setLineItemKey(?string $lineItemKey): void; + + /** + * @param ?LineItemRecurrenceInfoDraft $recurrenceInfo + */ + public function setRecurrenceInfo(?LineItemRecurrenceInfoDraft $recurrenceInfo): void; +} diff --git a/lib/commercetools-api/src/Models/Cart/CartSetLineItemRecurrenceInfoActionBuilder.php b/lib/commercetools-api/src/Models/Cart/CartSetLineItemRecurrenceInfoActionBuilder.php new file mode 100644 index 00000000000..46bbe4924dc --- /dev/null +++ b/lib/commercetools-api/src/Models/Cart/CartSetLineItemRecurrenceInfoActionBuilder.php @@ -0,0 +1,134 @@ + + */ +final class CartSetLineItemRecurrenceInfoActionBuilder implements Builder +{ + /** + + * @var ?string + */ + private $lineItemId; + + /** + + * @var ?string + */ + private $lineItemKey; + + /** + + * @var null|LineItemRecurrenceInfoDraft|LineItemRecurrenceInfoDraftBuilder + */ + private $recurrenceInfo; + + /** + *id of the LineItem to update. Either lineItemId or lineItemKey is required.
key of the LineItem to update. Either lineItemId or lineItemKey is required.
Value to set. + * If empty, any existing value will be removed.
+ * + + * @return null|LineItemRecurrenceInfoDraft + */ + public function getRecurrenceInfo() + { + return $this->recurrenceInfo instanceof LineItemRecurrenceInfoDraftBuilder ? $this->recurrenceInfo->build() : $this->recurrenceInfo; + } + + /** + * @param ?string $lineItemId + * @return $this + */ + public function withLineItemId(?string $lineItemId) + { + $this->lineItemId = $lineItemId; + + return $this; + } + + /** + * @param ?string $lineItemKey + * @return $this + */ + public function withLineItemKey(?string $lineItemKey) + { + $this->lineItemKey = $lineItemKey; + + return $this; + } + + /** + * @param ?LineItemRecurrenceInfoDraft $recurrenceInfo + * @return $this + */ + public function withRecurrenceInfo(?LineItemRecurrenceInfoDraft $recurrenceInfo) + { + $this->recurrenceInfo = $recurrenceInfo; + + return $this; + } + + /** + * @deprecated use withRecurrenceInfo() instead + * @return $this + */ + public function withRecurrenceInfoBuilder(?LineItemRecurrenceInfoDraftBuilder $recurrenceInfo) + { + $this->recurrenceInfo = $recurrenceInfo; + + return $this; + } + + public function build(): CartSetLineItemRecurrenceInfoAction + { + return new CartSetLineItemRecurrenceInfoActionModel( + $this->lineItemId, + $this->lineItemKey, + $this->recurrenceInfo instanceof LineItemRecurrenceInfoDraftBuilder ? $this->recurrenceInfo->build() : $this->recurrenceInfo + ); + } + + public static function of(): CartSetLineItemRecurrenceInfoActionBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/Cart/CartSetLineItemRecurrenceInfoActionCollection.php b/lib/commercetools-api/src/Models/Cart/CartSetLineItemRecurrenceInfoActionCollection.php new file mode 100644 index 00000000000..1b33c9b5b91 --- /dev/null +++ b/lib/commercetools-api/src/Models/Cart/CartSetLineItemRecurrenceInfoActionCollection.php @@ -0,0 +1,56 @@ + + * @method CartSetLineItemRecurrenceInfoAction current() + * @method CartSetLineItemRecurrenceInfoAction end() + * @method CartSetLineItemRecurrenceInfoAction at($offset) + */ +class CartSetLineItemRecurrenceInfoActionCollection extends CartUpdateActionCollection +{ + /** + * @psalm-assert CartSetLineItemRecurrenceInfoAction $value + * @psalm-param CartSetLineItemRecurrenceInfoAction|stdClass $value + * @throws InvalidArgumentException + * + * @return CartSetLineItemRecurrenceInfoActionCollection + */ + public function add($value) + { + if (!$value instanceof CartSetLineItemRecurrenceInfoAction) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?CartSetLineItemRecurrenceInfoAction + */ + protected function mapper() + { + return function (?int $index): ?CartSetLineItemRecurrenceInfoAction { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var CartSetLineItemRecurrenceInfoAction $data */ + $data = CartSetLineItemRecurrenceInfoActionModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/Cart/CartSetLineItemRecurrenceInfoActionModel.php b/lib/commercetools-api/src/Models/Cart/CartSetLineItemRecurrenceInfoActionModel.php new file mode 100644 index 00000000000..9f1635ead52 --- /dev/null +++ b/lib/commercetools-api/src/Models/Cart/CartSetLineItemRecurrenceInfoActionModel.php @@ -0,0 +1,169 @@ +lineItemId = $lineItemId; + $this->lineItemKey = $lineItemKey; + $this->recurrenceInfo = $recurrenceInfo; + $this->action = $action ?? self::DISCRIMINATOR_VALUE; + } + + /** + * + * @return null|string + */ + public function getAction() + { + if (is_null($this->action)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_ACTION); + if (is_null($data)) { + return null; + } + $this->action = (string) $data; + } + + return $this->action; + } + + /** + *id of the LineItem to update. Either lineItemId or lineItemKey is required.
key of the LineItem to update. Either lineItemId or lineItemKey is required.
Value to set. + * If empty, any existing value will be removed.
+ * + * + * @return null|LineItemRecurrenceInfoDraft + */ + public function getRecurrenceInfo() + { + if (is_null($this->recurrenceInfo)) { + /** @psalm-var stdClass|arrayUnique identifier of the Custom Line Item.
@@ -182,6 +184,14 @@ public function getShippingDetails(); */ public function getPriceMode(); + /** + *Recurring Order and frequency data.
+ * + + * @return null|CustomLineItemRecurrenceInfo + */ + public function getRecurrenceInfo(); + /** * @param ?string $id */ @@ -266,4 +276,9 @@ public function setShippingDetails(?ItemShippingDetails $shippingDetails): void; * @param ?string $priceMode */ public function setPriceMode(?string $priceMode): void; + + /** + * @param ?CustomLineItemRecurrenceInfo $recurrenceInfo + */ + public function setRecurrenceInfo(?CustomLineItemRecurrenceInfo $recurrenceInfo): void; } diff --git a/lib/commercetools-api/src/Models/Cart/CustomLineItemBuilder.php b/lib/commercetools-api/src/Models/Cart/CustomLineItemBuilder.php index 21fa8c89cde..b404c9774ae 100644 --- a/lib/commercetools-api/src/Models/Cart/CustomLineItemBuilder.php +++ b/lib/commercetools-api/src/Models/Cart/CustomLineItemBuilder.php @@ -15,6 +15,8 @@ use Commercetools\Api\Models\Common\TypedMoney; use Commercetools\Api\Models\Common\TypedMoneyBuilder; use Commercetools\Api\Models\Order\ItemStateCollection; +use Commercetools\Api\Models\RecurringOrder\CustomLineItemRecurrenceInfo; +use Commercetools\Api\Models\RecurringOrder\CustomLineItemRecurrenceInfoBuilder; use Commercetools\Api\Models\TaxCategory\TaxCategoryReference; use Commercetools\Api\Models\TaxCategory\TaxCategoryReferenceBuilder; use Commercetools\Api\Models\TaxCategory\TaxRate; @@ -135,6 +137,12 @@ final class CustomLineItemBuilder implements Builder */ private $priceMode; + /** + + * @var null|CustomLineItemRecurrenceInfo|CustomLineItemRecurrenceInfoBuilder + */ + private $recurrenceInfo; + /** *Unique identifier of the Custom Line Item.
* @@ -330,6 +338,17 @@ public function getPriceMode() return $this->priceMode; } + /** + *Recurring Order and frequency data.
+ * + + * @return null|CustomLineItemRecurrenceInfo + */ + public function getRecurrenceInfo() + { + return $this->recurrenceInfo instanceof CustomLineItemRecurrenceInfoBuilder ? $this->recurrenceInfo->build() : $this->recurrenceInfo; + } + /** * @param ?string $id * @return $this @@ -517,6 +536,17 @@ public function withPriceMode(?string $priceMode) return $this; } + /** + * @param ?CustomLineItemRecurrenceInfo $recurrenceInfo + * @return $this + */ + public function withRecurrenceInfo(?CustomLineItemRecurrenceInfo $recurrenceInfo) + { + $this->recurrenceInfo = $recurrenceInfo; + + return $this; + } + /** * @deprecated use withName() instead * @return $this @@ -605,6 +635,17 @@ public function withShippingDetailsBuilder(?ItemShippingDetailsBuilder $shipping return $this; } + /** + * @deprecated use withRecurrenceInfo() instead + * @return $this + */ + public function withRecurrenceInfoBuilder(?CustomLineItemRecurrenceInfoBuilder $recurrenceInfo) + { + $this->recurrenceInfo = $recurrenceInfo; + + return $this; + } + public function build(): CustomLineItem { return new CustomLineItemModel( @@ -624,7 +665,8 @@ public function build(): CustomLineItem $this->discountedPricePerQuantity, $this->custom instanceof CustomFieldsBuilder ? $this->custom->build() : $this->custom, $this->shippingDetails instanceof ItemShippingDetailsBuilder ? $this->shippingDetails->build() : $this->shippingDetails, - $this->priceMode + $this->priceMode, + $this->recurrenceInfo instanceof CustomLineItemRecurrenceInfoBuilder ? $this->recurrenceInfo->build() : $this->recurrenceInfo ); } diff --git a/lib/commercetools-api/src/Models/Cart/CustomLineItemDraft.php b/lib/commercetools-api/src/Models/Cart/CustomLineItemDraft.php index 741bf81dc59..73e5a535f67 100644 --- a/lib/commercetools-api/src/Models/Cart/CustomLineItemDraft.php +++ b/lib/commercetools-api/src/Models/Cart/CustomLineItemDraft.php @@ -10,6 +10,7 @@ use Commercetools\Api\Models\Common\LocalizedString; use Commercetools\Api\Models\Common\Money; +use Commercetools\Api\Models\RecurringOrder\CustomLineItemRecurrenceInfoDraft; use Commercetools\Api\Models\TaxCategory\TaxCategoryResourceIdentifier; use Commercetools\Api\Models\Type\CustomFieldsDraft; use Commercetools\Base\DateTimeImmutableCollection; @@ -27,6 +28,7 @@ interface CustomLineItemDraft extends JsonObject public const FIELD_CUSTOM = 'custom'; public const FIELD_SHIPPING_DETAILS = 'shippingDetails'; public const FIELD_PRICE_MODE = 'priceMode'; + public const FIELD_RECURRENCE_INFO = 'recurrenceInfo'; /** *Name of the Custom Line Item.
@@ -114,6 +116,14 @@ public function getShippingDetails(); */ public function getPriceMode(); + /** + *Recurring Order and frequency data.
+ * + + * @return null|CustomLineItemRecurrenceInfoDraft + */ + public function getRecurrenceInfo(); + /** * @param ?LocalizedString $name */ @@ -163,4 +173,9 @@ public function setShippingDetails(?ItemShippingDetailsDraft $shippingDetails): * @param ?string $priceMode */ public function setPriceMode(?string $priceMode): void; + + /** + * @param ?CustomLineItemRecurrenceInfoDraft $recurrenceInfo + */ + public function setRecurrenceInfo(?CustomLineItemRecurrenceInfoDraft $recurrenceInfo): void; } diff --git a/lib/commercetools-api/src/Models/Cart/CustomLineItemDraftBuilder.php b/lib/commercetools-api/src/Models/Cart/CustomLineItemDraftBuilder.php index 06c71925b52..71310037571 100644 --- a/lib/commercetools-api/src/Models/Cart/CustomLineItemDraftBuilder.php +++ b/lib/commercetools-api/src/Models/Cart/CustomLineItemDraftBuilder.php @@ -12,6 +12,8 @@ use Commercetools\Api\Models\Common\LocalizedStringBuilder; use Commercetools\Api\Models\Common\Money; use Commercetools\Api\Models\Common\MoneyBuilder; +use Commercetools\Api\Models\RecurringOrder\CustomLineItemRecurrenceInfoDraft; +use Commercetools\Api\Models\RecurringOrder\CustomLineItemRecurrenceInfoDraftBuilder; use Commercetools\Api\Models\TaxCategory\TaxCategoryResourceIdentifier; use Commercetools\Api\Models\TaxCategory\TaxCategoryResourceIdentifierBuilder; use Commercetools\Api\Models\Type\CustomFieldsDraft; @@ -88,6 +90,12 @@ final class CustomLineItemDraftBuilder implements Builder */ private $priceMode; + /** + + * @var null|CustomLineItemRecurrenceInfoDraft|CustomLineItemRecurrenceInfoDraftBuilder + */ + private $recurrenceInfo; + /** *Name of the Custom Line Item.
* @@ -204,6 +212,17 @@ public function getPriceMode() return $this->priceMode; } + /** + *Recurring Order and frequency data.
+ * + + * @return null|CustomLineItemRecurrenceInfoDraft + */ + public function getRecurrenceInfo() + { + return $this->recurrenceInfo instanceof CustomLineItemRecurrenceInfoDraftBuilder ? $this->recurrenceInfo->build() : $this->recurrenceInfo; + } + /** * @param ?LocalizedString $name * @return $this @@ -314,6 +333,17 @@ public function withPriceMode(?string $priceMode) return $this; } + /** + * @param ?CustomLineItemRecurrenceInfoDraft $recurrenceInfo + * @return $this + */ + public function withRecurrenceInfo(?CustomLineItemRecurrenceInfoDraft $recurrenceInfo) + { + $this->recurrenceInfo = $recurrenceInfo; + + return $this; + } + /** * @deprecated use withName() instead * @return $this @@ -380,6 +410,17 @@ public function withShippingDetailsBuilder(?ItemShippingDetailsDraftBuilder $shi return $this; } + /** + * @deprecated use withRecurrenceInfo() instead + * @return $this + */ + public function withRecurrenceInfoBuilder(?CustomLineItemRecurrenceInfoDraftBuilder $recurrenceInfo) + { + $this->recurrenceInfo = $recurrenceInfo; + + return $this; + } + public function build(): CustomLineItemDraft { return new CustomLineItemDraftModel( @@ -392,7 +433,8 @@ public function build(): CustomLineItemDraft $this->externalTaxRate instanceof ExternalTaxRateDraftBuilder ? $this->externalTaxRate->build() : $this->externalTaxRate, $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom, $this->shippingDetails instanceof ItemShippingDetailsDraftBuilder ? $this->shippingDetails->build() : $this->shippingDetails, - $this->priceMode + $this->priceMode, + $this->recurrenceInfo instanceof CustomLineItemRecurrenceInfoDraftBuilder ? $this->recurrenceInfo->build() : $this->recurrenceInfo ); } diff --git a/lib/commercetools-api/src/Models/Cart/CustomLineItemDraftModel.php b/lib/commercetools-api/src/Models/Cart/CustomLineItemDraftModel.php index 83c0e98de93..5c022a6dc5e 100644 --- a/lib/commercetools-api/src/Models/Cart/CustomLineItemDraftModel.php +++ b/lib/commercetools-api/src/Models/Cart/CustomLineItemDraftModel.php @@ -12,6 +12,8 @@ use Commercetools\Api\Models\Common\LocalizedStringModel; use Commercetools\Api\Models\Common\Money; use Commercetools\Api\Models\Common\MoneyModel; +use Commercetools\Api\Models\RecurringOrder\CustomLineItemRecurrenceInfoDraft; +use Commercetools\Api\Models\RecurringOrder\CustomLineItemRecurrenceInfoDraftModel; use Commercetools\Api\Models\TaxCategory\TaxCategoryResourceIdentifier; use Commercetools\Api\Models\TaxCategory\TaxCategoryResourceIdentifierModel; use Commercetools\Api\Models\Type\CustomFieldsDraft; @@ -87,6 +89,12 @@ final class CustomLineItemDraftModel extends JsonObjectModel implements CustomLi */ protected $priceMode; + /** + * + * @var ?CustomLineItemRecurrenceInfoDraft + */ + protected $recurrenceInfo; + /** * @psalm-suppress MissingParamType @@ -101,7 +109,8 @@ public function __construct( ?ExternalTaxRateDraft $externalTaxRate = null, ?CustomFieldsDraft $custom = null, ?ItemShippingDetailsDraft $shippingDetails = null, - ?string $priceMode = null + ?string $priceMode = null, + ?CustomLineItemRecurrenceInfoDraft $recurrenceInfo = null ) { $this->name = $name; $this->key = $key; @@ -113,6 +122,7 @@ public function __construct( $this->custom = $custom; $this->shippingDetails = $shippingDetails; $this->priceMode = $priceMode; + $this->recurrenceInfo = $recurrenceInfo; } /** @@ -327,6 +337,27 @@ public function getPriceMode() return $this->priceMode; } + /** + *Recurring Order and frequency data.
+ * + * + * @return null|CustomLineItemRecurrenceInfoDraft + */ + public function getRecurrenceInfo() + { + if (is_null($this->recurrenceInfo)) { + /** @psalm-var stdClass|arrayRecurring Order and frequency data.
+ * + * + * @return null|CustomLineItemRecurrenceInfo + */ + public function getRecurrenceInfo() + { + if (is_null($this->recurrenceInfo)) { + /** @psalm-var stdClass|arrayUnique identifier of the LineItem.
@@ -275,6 +277,14 @@ public function getAddedAt(); */ public function getLastModifiedAt(); + /** + *Recurring Order and frequency data.
+ * + + * @return null|LineItemRecurrenceInfo + */ + public function getRecurrenceInfo(); + /** * @param ?string $id */ @@ -404,4 +414,9 @@ public function setAddedAt(?DateTimeImmutable $addedAt): void; * @param ?DateTimeImmutable $lastModifiedAt */ public function setLastModifiedAt(?DateTimeImmutable $lastModifiedAt): void; + + /** + * @param ?LineItemRecurrenceInfo $recurrenceInfo + */ + public function setRecurrenceInfo(?LineItemRecurrenceInfo $recurrenceInfo): void; } diff --git a/lib/commercetools-api/src/Models/Cart/LineItemBuilder.php b/lib/commercetools-api/src/Models/Cart/LineItemBuilder.php index 931d642d03e..f1e658ab178 100644 --- a/lib/commercetools-api/src/Models/Cart/LineItemBuilder.php +++ b/lib/commercetools-api/src/Models/Cart/LineItemBuilder.php @@ -21,6 +21,8 @@ use Commercetools\Api\Models\Product\ProductVariantBuilder; use Commercetools\Api\Models\ProductType\ProductTypeReference; use Commercetools\Api\Models\ProductType\ProductTypeReferenceBuilder; +use Commercetools\Api\Models\RecurringOrder\LineItemRecurrenceInfo; +use Commercetools\Api\Models\RecurringOrder\LineItemRecurrenceInfoBuilder; use Commercetools\Api\Models\TaxCategory\TaxRate; use Commercetools\Api\Models\TaxCategory\TaxRateBuilder; use Commercetools\Api\Models\Type\CustomFields; @@ -194,6 +196,12 @@ final class LineItemBuilder implements Builder */ private $lastModifiedAt; + /** + + * @var null|LineItemRecurrenceInfo|LineItemRecurrenceInfoBuilder + */ + private $recurrenceInfo; + /** *Unique identifier of the LineItem.
* @@ -497,6 +505,17 @@ public function getLastModifiedAt() return $this->lastModifiedAt; } + /** + *Recurring Order and frequency data.
+ * + + * @return null|LineItemRecurrenceInfo + */ + public function getRecurrenceInfo() + { + return $this->recurrenceInfo instanceof LineItemRecurrenceInfoBuilder ? $this->recurrenceInfo->build() : $this->recurrenceInfo; + } + /** * @param ?string $id * @return $this @@ -783,6 +802,17 @@ public function withLastModifiedAt(?DateTimeImmutable $lastModifiedAt) return $this; } + /** + * @param ?LineItemRecurrenceInfo $recurrenceInfo + * @return $this + */ + public function withRecurrenceInfo(?LineItemRecurrenceInfo $recurrenceInfo) + { + $this->recurrenceInfo = $recurrenceInfo; + + return $this; + } + /** * @deprecated use withName() instead * @return $this @@ -915,6 +945,17 @@ public function withCustomBuilder(?CustomFieldsBuilder $custom) return $this; } + /** + * @deprecated use withRecurrenceInfo() instead + * @return $this + */ + public function withRecurrenceInfoBuilder(?LineItemRecurrenceInfoBuilder $recurrenceInfo) + { + $this->recurrenceInfo = $recurrenceInfo; + + return $this; + } + public function build(): LineItem { return new LineItemModel( @@ -943,7 +984,8 @@ public function build(): LineItem $this->shippingDetails instanceof ItemShippingDetailsBuilder ? $this->shippingDetails->build() : $this->shippingDetails, $this->custom instanceof CustomFieldsBuilder ? $this->custom->build() : $this->custom, $this->addedAt, - $this->lastModifiedAt + $this->lastModifiedAt, + $this->recurrenceInfo instanceof LineItemRecurrenceInfoBuilder ? $this->recurrenceInfo->build() : $this->recurrenceInfo ); } diff --git a/lib/commercetools-api/src/Models/Cart/LineItemDraft.php b/lib/commercetools-api/src/Models/Cart/LineItemDraft.php index 7ea59dd7b40..fa9de381c42 100644 --- a/lib/commercetools-api/src/Models/Cart/LineItemDraft.php +++ b/lib/commercetools-api/src/Models/Cart/LineItemDraft.php @@ -10,6 +10,7 @@ use Commercetools\Api\Models\Channel\ChannelResourceIdentifier; use Commercetools\Api\Models\Common\Money; +use Commercetools\Api\Models\RecurringOrder\LineItemRecurrenceInfoDraft; use Commercetools\Api\Models\Type\CustomFieldsDraft; use Commercetools\Base\DateTimeImmutableCollection; use Commercetools\Base\JsonObject; @@ -32,6 +33,7 @@ interface LineItemDraft extends JsonObject public const FIELD_INVENTORY_MODE = 'inventoryMode'; public const FIELD_SHIPPING_DETAILS = 'shippingDetails'; public const FIELD_CUSTOM = 'custom'; + public const FIELD_RECURRENCE_INFO = 'recurrenceInfo'; /** *User-defined unique identifier of the LineItem.
@@ -161,6 +163,14 @@ public function getShippingDetails(); */ public function getCustom(); + /** + *Recurring Order and frequency data.
+ * + + * @return null|LineItemRecurrenceInfoDraft + */ + public function getRecurrenceInfo(); + /** * @param ?string $key */ @@ -235,4 +245,9 @@ public function setShippingDetails(?ItemShippingDetailsDraft $shippingDetails): * @param ?CustomFieldsDraft $custom */ public function setCustom(?CustomFieldsDraft $custom): void; + + /** + * @param ?LineItemRecurrenceInfoDraft $recurrenceInfo + */ + public function setRecurrenceInfo(?LineItemRecurrenceInfoDraft $recurrenceInfo): void; } diff --git a/lib/commercetools-api/src/Models/Cart/LineItemDraftBuilder.php b/lib/commercetools-api/src/Models/Cart/LineItemDraftBuilder.php index 85394a5a3ae..72cf39a8392 100644 --- a/lib/commercetools-api/src/Models/Cart/LineItemDraftBuilder.php +++ b/lib/commercetools-api/src/Models/Cart/LineItemDraftBuilder.php @@ -12,6 +12,8 @@ use Commercetools\Api\Models\Channel\ChannelResourceIdentifierBuilder; use Commercetools\Api\Models\Common\Money; use Commercetools\Api\Models\Common\MoneyBuilder; +use Commercetools\Api\Models\RecurringOrder\LineItemRecurrenceInfoDraft; +use Commercetools\Api\Models\RecurringOrder\LineItemRecurrenceInfoDraftBuilder; use Commercetools\Api\Models\Type\CustomFieldsDraft; use Commercetools\Api\Models\Type\CustomFieldsDraftBuilder; use Commercetools\Base\Builder; @@ -117,6 +119,12 @@ final class LineItemDraftBuilder implements Builder */ private $custom; + /** + + * @var null|LineItemRecurrenceInfoDraft|LineItemRecurrenceInfoDraftBuilder + */ + private $recurrenceInfo; + /** *User-defined unique identifier of the LineItem.
* @@ -290,6 +298,17 @@ public function getCustom() return $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom; } + /** + *Recurring Order and frequency data.
+ * + + * @return null|LineItemRecurrenceInfoDraft + */ + public function getRecurrenceInfo() + { + return $this->recurrenceInfo instanceof LineItemRecurrenceInfoDraftBuilder ? $this->recurrenceInfo->build() : $this->recurrenceInfo; + } + /** * @param ?string $key * @return $this @@ -455,6 +474,17 @@ public function withCustom(?CustomFieldsDraft $custom) return $this; } + /** + * @param ?LineItemRecurrenceInfoDraft $recurrenceInfo + * @return $this + */ + public function withRecurrenceInfo(?LineItemRecurrenceInfoDraft $recurrenceInfo) + { + $this->recurrenceInfo = $recurrenceInfo; + + return $this; + } + /** * @deprecated use withDistributionChannel() instead * @return $this @@ -532,6 +562,17 @@ public function withCustomBuilder(?CustomFieldsDraftBuilder $custom) return $this; } + /** + * @deprecated use withRecurrenceInfo() instead + * @return $this + */ + public function withRecurrenceInfoBuilder(?LineItemRecurrenceInfoDraftBuilder $recurrenceInfo) + { + $this->recurrenceInfo = $recurrenceInfo; + + return $this; + } + public function build(): LineItemDraft { return new LineItemDraftModel( @@ -549,7 +590,8 @@ public function build(): LineItemDraft $this->perMethodExternalTaxRate, $this->inventoryMode, $this->shippingDetails instanceof ItemShippingDetailsDraftBuilder ? $this->shippingDetails->build() : $this->shippingDetails, - $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom + $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom, + $this->recurrenceInfo instanceof LineItemRecurrenceInfoDraftBuilder ? $this->recurrenceInfo->build() : $this->recurrenceInfo ); } diff --git a/lib/commercetools-api/src/Models/Cart/LineItemDraftModel.php b/lib/commercetools-api/src/Models/Cart/LineItemDraftModel.php index 861efc64ab4..0db88323428 100644 --- a/lib/commercetools-api/src/Models/Cart/LineItemDraftModel.php +++ b/lib/commercetools-api/src/Models/Cart/LineItemDraftModel.php @@ -12,6 +12,8 @@ use Commercetools\Api\Models\Channel\ChannelResourceIdentifierModel; use Commercetools\Api\Models\Common\Money; use Commercetools\Api\Models\Common\MoneyModel; +use Commercetools\Api\Models\RecurringOrder\LineItemRecurrenceInfoDraft; +use Commercetools\Api\Models\RecurringOrder\LineItemRecurrenceInfoDraftModel; use Commercetools\Api\Models\Type\CustomFieldsDraft; use Commercetools\Api\Models\Type\CustomFieldsDraftModel; use Commercetools\Base\DateTimeImmutableCollection; @@ -116,6 +118,12 @@ final class LineItemDraftModel extends JsonObjectModel implements LineItemDraft */ protected $custom; + /** + * + * @var ?LineItemRecurrenceInfoDraft + */ + protected $recurrenceInfo; + /** * @psalm-suppress MissingParamType @@ -135,7 +143,8 @@ public function __construct( ?MethodExternalTaxRateDraftCollection $perMethodExternalTaxRate = null, ?string $inventoryMode = null, ?ItemShippingDetailsDraft $shippingDetails = null, - ?CustomFieldsDraft $custom = null + ?CustomFieldsDraft $custom = null, + ?LineItemRecurrenceInfoDraft $recurrenceInfo = null ) { $this->key = $key; $this->productId = $productId; @@ -152,6 +161,7 @@ public function __construct( $this->inventoryMode = $inventoryMode; $this->shippingDetails = $shippingDetails; $this->custom = $custom; + $this->recurrenceInfo = $recurrenceInfo; } /** @@ -473,6 +483,27 @@ public function getCustom() return $this->custom; } + /** + *Recurring Order and frequency data.
+ * + * + * @return null|LineItemRecurrenceInfoDraft + */ + public function getRecurrenceInfo() + { + if (is_null($this->recurrenceInfo)) { + /** @psalm-var stdClass|arrayRecurring Order and frequency data.
+ * + * + * @return null|LineItemRecurrenceInfo + */ + public function getRecurrenceInfo() + { + if (is_null($this->recurrenceInfo)) { + /** @psalm-var stdClass|arrayUnique identifier of this Price.
@@ -120,6 +122,14 @@ public function getTiers(); */ public function getCustom(); + /** + *Recurrence Policy for which this Price is valid.
+ * + + * @return null|RecurrencePolicyReference + */ + public function getRecurrencePolicy(); + /** * @param ?string $id */ @@ -174,4 +184,9 @@ public function setTiers(?PriceTierCollection $tiers): void; * @param ?CustomFields $custom */ public function setCustom(?CustomFields $custom): void; + + /** + * @param ?RecurrencePolicyReference $recurrencePolicy + */ + public function setRecurrencePolicy(?RecurrencePolicyReference $recurrencePolicy): void; } diff --git a/lib/commercetools-api/src/Models/Common/PriceBuilder.php b/lib/commercetools-api/src/Models/Common/PriceBuilder.php index adb568c44f8..ee70fa17fb2 100644 --- a/lib/commercetools-api/src/Models/Common/PriceBuilder.php +++ b/lib/commercetools-api/src/Models/Common/PriceBuilder.php @@ -12,6 +12,8 @@ use Commercetools\Api\Models\Channel\ChannelReferenceBuilder; use Commercetools\Api\Models\CustomerGroup\CustomerGroupReference; use Commercetools\Api\Models\CustomerGroup\CustomerGroupReferenceBuilder; +use Commercetools\Api\Models\RecurrencePolicy\RecurrencePolicyReference; +use Commercetools\Api\Models\RecurrencePolicy\RecurrencePolicyReferenceBuilder; use Commercetools\Api\Models\Type\CustomFields; use Commercetools\Api\Models\Type\CustomFieldsBuilder; use Commercetools\Base\Builder; @@ -93,6 +95,12 @@ final class PriceBuilder implements Builder */ private $custom; + /** + + * @var null|RecurrencePolicyReference|RecurrencePolicyReferenceBuilder + */ + private $recurrencePolicy; + /** *Unique identifier of this Price.
* @@ -217,6 +225,17 @@ public function getCustom() return $this->custom instanceof CustomFieldsBuilder ? $this->custom->build() : $this->custom; } + /** + *Recurrence Policy for which this Price is valid.
+ * + + * @return null|RecurrencePolicyReference + */ + public function getRecurrencePolicy() + { + return $this->recurrencePolicy instanceof RecurrencePolicyReferenceBuilder ? $this->recurrencePolicy->build() : $this->recurrencePolicy; + } + /** * @param ?string $id * @return $this @@ -338,6 +357,17 @@ public function withCustom(?CustomFields $custom) return $this; } + /** + * @param ?RecurrencePolicyReference $recurrencePolicy + * @return $this + */ + public function withRecurrencePolicy(?RecurrencePolicyReference $recurrencePolicy) + { + $this->recurrencePolicy = $recurrencePolicy; + + return $this; + } + /** * @deprecated use withValue() instead * @return $this @@ -393,6 +423,17 @@ public function withCustomBuilder(?CustomFieldsBuilder $custom) return $this; } + /** + * @deprecated use withRecurrencePolicy() instead + * @return $this + */ + public function withRecurrencePolicyBuilder(?RecurrencePolicyReferenceBuilder $recurrencePolicy) + { + $this->recurrencePolicy = $recurrencePolicy; + + return $this; + } + public function build(): Price { return new PriceModel( @@ -406,7 +447,8 @@ public function build(): Price $this->validUntil, $this->discounted instanceof DiscountedPriceBuilder ? $this->discounted->build() : $this->discounted, $this->tiers, - $this->custom instanceof CustomFieldsBuilder ? $this->custom->build() : $this->custom + $this->custom instanceof CustomFieldsBuilder ? $this->custom->build() : $this->custom, + $this->recurrencePolicy instanceof RecurrencePolicyReferenceBuilder ? $this->recurrencePolicy->build() : $this->recurrencePolicy ); } diff --git a/lib/commercetools-api/src/Models/Common/PriceDraft.php b/lib/commercetools-api/src/Models/Common/PriceDraft.php index a2d63560cc3..9354cf0efe1 100644 --- a/lib/commercetools-api/src/Models/Common/PriceDraft.php +++ b/lib/commercetools-api/src/Models/Common/PriceDraft.php @@ -10,6 +10,7 @@ use Commercetools\Api\Models\Channel\ChannelResourceIdentifier; use Commercetools\Api\Models\CustomerGroup\CustomerGroupResourceIdentifier; +use Commercetools\Api\Models\RecurrencePolicy\RecurrencePolicyResourceIdentifier; use Commercetools\Api\Models\Type\CustomFieldsDraft; use Commercetools\Base\DateTimeImmutableCollection; use Commercetools\Base\JsonObject; @@ -27,6 +28,7 @@ interface PriceDraft extends JsonObject public const FIELD_DISCOUNTED = 'discounted'; public const FIELD_TIERS = 'tiers'; public const FIELD_CUSTOM = 'custom'; + public const FIELD_RECURRENCE_POLICY = 'recurrencePolicy'; /** *User-defined identifier for the Price. It must be unique per ProductVariant.
@@ -117,6 +119,14 @@ public function getTiers(); */ public function getCustom(); + /** + *RecurrencePolicy for which this Price is valid.
+ * + + * @return null|RecurrencePolicyResourceIdentifier + */ + public function getRecurrencePolicy(); + /** * @param ?string $key */ @@ -166,4 +176,9 @@ public function setTiers(?PriceTierDraftCollection $tiers): void; * @param ?CustomFieldsDraft $custom */ public function setCustom(?CustomFieldsDraft $custom): void; + + /** + * @param ?RecurrencePolicyResourceIdentifier $recurrencePolicy + */ + public function setRecurrencePolicy(?RecurrencePolicyResourceIdentifier $recurrencePolicy): void; } diff --git a/lib/commercetools-api/src/Models/Common/PriceDraftBuilder.php b/lib/commercetools-api/src/Models/Common/PriceDraftBuilder.php index 7caab423f75..ec1fb16d441 100644 --- a/lib/commercetools-api/src/Models/Common/PriceDraftBuilder.php +++ b/lib/commercetools-api/src/Models/Common/PriceDraftBuilder.php @@ -12,6 +12,8 @@ use Commercetools\Api\Models\Channel\ChannelResourceIdentifierBuilder; use Commercetools\Api\Models\CustomerGroup\CustomerGroupResourceIdentifier; use Commercetools\Api\Models\CustomerGroup\CustomerGroupResourceIdentifierBuilder; +use Commercetools\Api\Models\RecurrencePolicy\RecurrencePolicyResourceIdentifier; +use Commercetools\Api\Models\RecurrencePolicy\RecurrencePolicyResourceIdentifierBuilder; use Commercetools\Api\Models\Type\CustomFieldsDraft; use Commercetools\Api\Models\Type\CustomFieldsDraftBuilder; use Commercetools\Base\Builder; @@ -87,6 +89,12 @@ final class PriceDraftBuilder implements Builder */ private $custom; + /** + + * @var null|RecurrencePolicyResourceIdentifier|RecurrencePolicyResourceIdentifierBuilder + */ + private $recurrencePolicy; + /** *User-defined identifier for the Price. It must be unique per ProductVariant.
* @@ -206,6 +214,17 @@ public function getCustom() return $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom; } + /** + *RecurrencePolicy for which this Price is valid.
+ * + + * @return null|RecurrencePolicyResourceIdentifier + */ + public function getRecurrencePolicy() + { + return $this->recurrencePolicy instanceof RecurrencePolicyResourceIdentifierBuilder ? $this->recurrencePolicy->build() : $this->recurrencePolicy; + } + /** * @param ?string $key * @return $this @@ -316,6 +335,17 @@ public function withCustom(?CustomFieldsDraft $custom) return $this; } + /** + * @param ?RecurrencePolicyResourceIdentifier $recurrencePolicy + * @return $this + */ + public function withRecurrencePolicy(?RecurrencePolicyResourceIdentifier $recurrencePolicy) + { + $this->recurrencePolicy = $recurrencePolicy; + + return $this; + } + /** * @deprecated use withValue() instead * @return $this @@ -371,6 +401,17 @@ public function withCustomBuilder(?CustomFieldsDraftBuilder $custom) return $this; } + /** + * @deprecated use withRecurrencePolicy() instead + * @return $this + */ + public function withRecurrencePolicyBuilder(?RecurrencePolicyResourceIdentifierBuilder $recurrencePolicy) + { + $this->recurrencePolicy = $recurrencePolicy; + + return $this; + } + public function build(): PriceDraft { return new PriceDraftModel( @@ -383,7 +424,8 @@ public function build(): PriceDraft $this->validUntil, $this->discounted instanceof DiscountedPriceDraftBuilder ? $this->discounted->build() : $this->discounted, $this->tiers, - $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom + $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom, + $this->recurrencePolicy instanceof RecurrencePolicyResourceIdentifierBuilder ? $this->recurrencePolicy->build() : $this->recurrencePolicy ); } diff --git a/lib/commercetools-api/src/Models/Common/PriceDraftModel.php b/lib/commercetools-api/src/Models/Common/PriceDraftModel.php index c7be25630a1..f3c65d1b125 100644 --- a/lib/commercetools-api/src/Models/Common/PriceDraftModel.php +++ b/lib/commercetools-api/src/Models/Common/PriceDraftModel.php @@ -12,6 +12,8 @@ use Commercetools\Api\Models\Channel\ChannelResourceIdentifierModel; use Commercetools\Api\Models\CustomerGroup\CustomerGroupResourceIdentifier; use Commercetools\Api\Models\CustomerGroup\CustomerGroupResourceIdentifierModel; +use Commercetools\Api\Models\RecurrencePolicy\RecurrencePolicyResourceIdentifier; +use Commercetools\Api\Models\RecurrencePolicy\RecurrencePolicyResourceIdentifierModel; use Commercetools\Api\Models\Type\CustomFieldsDraft; use Commercetools\Api\Models\Type\CustomFieldsDraftModel; use Commercetools\Base\DateTimeImmutableCollection; @@ -86,6 +88,12 @@ final class PriceDraftModel extends JsonObjectModel implements PriceDraft */ protected $custom; + /** + * + * @var ?RecurrencePolicyResourceIdentifier + */ + protected $recurrencePolicy; + /** * @psalm-suppress MissingParamType @@ -100,7 +108,8 @@ public function __construct( ?DateTimeImmutable $validUntil = null, ?DiscountedPriceDraft $discounted = null, ?PriceTierDraftCollection $tiers = null, - ?CustomFieldsDraft $custom = null + ?CustomFieldsDraft $custom = null, + ?RecurrencePolicyResourceIdentifier $recurrencePolicy = null ) { $this->key = $key; $this->value = $value; @@ -112,6 +121,7 @@ public function __construct( $this->discounted = $discounted; $this->tiers = $tiers; $this->custom = $custom; + $this->recurrencePolicy = $recurrencePolicy; } /** @@ -336,6 +346,27 @@ public function getCustom() return $this->custom; } + /** + *RecurrencePolicy for which this Price is valid.
+ * + * + * @return null|RecurrencePolicyResourceIdentifier + */ + public function getRecurrencePolicy() + { + if (is_null($this->recurrencePolicy)) { + /** @psalm-var stdClass|arrayRecurrence Policy for which this Price is valid.
+ * + * + * @return null|RecurrencePolicyReference + */ + public function getRecurrencePolicy() + { + if (is_null($this->recurrencePolicy)) { + /** @psalm-var stdClass|arrayRecurring Order and frequency data.
+ * + + * @return null|LineItemRecurrenceInfoDraft + */ + public function getRecurrenceInfo(); + /** *Custom Fields for the Line Item.
* @@ -162,6 +172,11 @@ public function setSupplyChannel(?ChannelResourceIdentifier $supplyChannel): voi */ public function setShippingDetails(?ItemShippingDetailsDraft $shippingDetails): void; + /** + * @param ?LineItemRecurrenceInfoDraft $recurrenceInfo + */ + public function setRecurrenceInfo(?LineItemRecurrenceInfoDraft $recurrenceInfo): void; + /** * @param ?CustomFieldsDraft $custom */ diff --git a/lib/commercetools-api/src/Models/Me/MyCartAddLineItemActionBuilder.php b/lib/commercetools-api/src/Models/Me/MyCartAddLineItemActionBuilder.php index aa149e21a84..ea81c7f78ed 100644 --- a/lib/commercetools-api/src/Models/Me/MyCartAddLineItemActionBuilder.php +++ b/lib/commercetools-api/src/Models/Me/MyCartAddLineItemActionBuilder.php @@ -12,6 +12,8 @@ use Commercetools\Api\Models\Cart\ItemShippingDetailsDraftBuilder; use Commercetools\Api\Models\Channel\ChannelResourceIdentifier; use Commercetools\Api\Models\Channel\ChannelResourceIdentifierBuilder; +use Commercetools\Api\Models\RecurringOrder\LineItemRecurrenceInfoDraft; +use Commercetools\Api\Models\RecurringOrder\LineItemRecurrenceInfoDraftBuilder; use Commercetools\Api\Models\Type\CustomFieldsDraft; use Commercetools\Api\Models\Type\CustomFieldsDraftBuilder; use Commercetools\Base\Builder; @@ -81,6 +83,12 @@ final class MyCartAddLineItemActionBuilder implements Builder */ private $shippingDetails; + /** + + * @var null|LineItemRecurrenceInfoDraft|LineItemRecurrenceInfoDraftBuilder + */ + private $recurrenceInfo; + /** * @var null|CustomFieldsDraft|CustomFieldsDraftBuilder @@ -195,6 +203,17 @@ public function getShippingDetails() return $this->shippingDetails instanceof ItemShippingDetailsDraftBuilder ? $this->shippingDetails->build() : $this->shippingDetails; } + /** + *Recurring Order and frequency data.
+ * + + * @return null|LineItemRecurrenceInfoDraft + */ + public function getRecurrenceInfo() + { + return $this->recurrenceInfo instanceof LineItemRecurrenceInfoDraftBuilder ? $this->recurrenceInfo->build() : $this->recurrenceInfo; + } + /** *Custom Fields for the Line Item.
* @@ -305,6 +324,17 @@ public function withShippingDetails(?ItemShippingDetailsDraft $shippingDetails) return $this; } + /** + * @param ?LineItemRecurrenceInfoDraft $recurrenceInfo + * @return $this + */ + public function withRecurrenceInfo(?LineItemRecurrenceInfoDraft $recurrenceInfo) + { + $this->recurrenceInfo = $recurrenceInfo; + + return $this; + } + /** * @param ?CustomFieldsDraft $custom * @return $this @@ -349,6 +379,17 @@ public function withShippingDetailsBuilder(?ItemShippingDetailsDraftBuilder $shi return $this; } + /** + * @deprecated use withRecurrenceInfo() instead + * @return $this + */ + public function withRecurrenceInfoBuilder(?LineItemRecurrenceInfoDraftBuilder $recurrenceInfo) + { + $this->recurrenceInfo = $recurrenceInfo; + + return $this; + } + /** * @deprecated use withCustom() instead * @return $this @@ -372,6 +413,7 @@ public function build(): MyCartAddLineItemAction $this->distributionChannel instanceof ChannelResourceIdentifierBuilder ? $this->distributionChannel->build() : $this->distributionChannel, $this->supplyChannel instanceof ChannelResourceIdentifierBuilder ? $this->supplyChannel->build() : $this->supplyChannel, $this->shippingDetails instanceof ItemShippingDetailsDraftBuilder ? $this->shippingDetails->build() : $this->shippingDetails, + $this->recurrenceInfo instanceof LineItemRecurrenceInfoDraftBuilder ? $this->recurrenceInfo->build() : $this->recurrenceInfo, $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom ); } diff --git a/lib/commercetools-api/src/Models/Me/MyCartAddLineItemActionModel.php b/lib/commercetools-api/src/Models/Me/MyCartAddLineItemActionModel.php index 50a4e398ddd..edb75d94df8 100644 --- a/lib/commercetools-api/src/Models/Me/MyCartAddLineItemActionModel.php +++ b/lib/commercetools-api/src/Models/Me/MyCartAddLineItemActionModel.php @@ -12,6 +12,8 @@ use Commercetools\Api\Models\Cart\ItemShippingDetailsDraftModel; use Commercetools\Api\Models\Channel\ChannelResourceIdentifier; use Commercetools\Api\Models\Channel\ChannelResourceIdentifierModel; +use Commercetools\Api\Models\RecurringOrder\LineItemRecurrenceInfoDraft; +use Commercetools\Api\Models\RecurringOrder\LineItemRecurrenceInfoDraftModel; use Commercetools\Api\Models\Type\CustomFieldsDraft; use Commercetools\Api\Models\Type\CustomFieldsDraftModel; use Commercetools\Base\DateTimeImmutableCollection; @@ -87,6 +89,12 @@ final class MyCartAddLineItemActionModel extends JsonObjectModel implements MyCa */ protected $shippingDetails; + /** + * + * @var ?LineItemRecurrenceInfoDraft + */ + protected $recurrenceInfo; + /** * * @var ?CustomFieldsDraft @@ -107,6 +115,7 @@ public function __construct( ?ChannelResourceIdentifier $distributionChannel = null, ?ChannelResourceIdentifier $supplyChannel = null, ?ItemShippingDetailsDraft $shippingDetails = null, + ?LineItemRecurrenceInfoDraft $recurrenceInfo = null, ?CustomFieldsDraft $custom = null, ?string $action = null ) { @@ -119,6 +128,7 @@ public function __construct( $this->distributionChannel = $distributionChannel; $this->supplyChannel = $supplyChannel; $this->shippingDetails = $shippingDetails; + $this->recurrenceInfo = $recurrenceInfo; $this->custom = $custom; $this->action = $action ?? self::DISCRIMINATOR_VALUE; } @@ -337,6 +347,27 @@ public function getShippingDetails() return $this->shippingDetails; } + /** + *Recurring Order and frequency data.
+ * + * + * @return null|LineItemRecurrenceInfoDraft + */ + public function getRecurrenceInfo() + { + if (is_null($this->recurrenceInfo)) { + /** @psalm-var stdClass|arrayCustom Fields for the Line Item.
* @@ -431,6 +462,14 @@ public function setShippingDetails(?ItemShippingDetailsDraft $shippingDetails): $this->shippingDetails = $shippingDetails; } + /** + * @param ?LineItemRecurrenceInfoDraft $recurrenceInfo + */ + public function setRecurrenceInfo(?LineItemRecurrenceInfoDraft $recurrenceInfo): void + { + $this->recurrenceInfo = $recurrenceInfo; + } + /** * @param ?CustomFieldsDraft $custom */ diff --git a/lib/commercetools-api/src/Models/Me/MyCartSetCustomLineItemRecurrenceInfoAction.php b/lib/commercetools-api/src/Models/Me/MyCartSetCustomLineItemRecurrenceInfoAction.php new file mode 100644 index 00000000000..eeeefac2359 --- /dev/null +++ b/lib/commercetools-api/src/Models/Me/MyCartSetCustomLineItemRecurrenceInfoAction.php @@ -0,0 +1,60 @@ +id of the CustomLineItem to update. Either customLineItemId or customLineItemKey is required.
+ *
+
+ * @return null|string
+ */
+ public function getCustomLineItemId();
+
+ /**
+ * key of the CustomLineItem to update. Either customLineItemId or customLineItemKey is required.
Value to set. + * If empty, any existing value will be removed.
+ * + + * @return null|CustomLineItemRecurrenceInfoDraft + */ + public function getRecurrenceInfo(); + + /** + * @param ?string $customLineItemId + */ + public function setCustomLineItemId(?string $customLineItemId): void; + + /** + * @param ?string $customLineItemKey + */ + public function setCustomLineItemKey(?string $customLineItemKey): void; + + /** + * @param ?CustomLineItemRecurrenceInfoDraft $recurrenceInfo + */ + public function setRecurrenceInfo(?CustomLineItemRecurrenceInfoDraft $recurrenceInfo): void; +} diff --git a/lib/commercetools-api/src/Models/Me/MyCartSetCustomLineItemRecurrenceInfoActionBuilder.php b/lib/commercetools-api/src/Models/Me/MyCartSetCustomLineItemRecurrenceInfoActionBuilder.php new file mode 100644 index 00000000000..640a9502aff --- /dev/null +++ b/lib/commercetools-api/src/Models/Me/MyCartSetCustomLineItemRecurrenceInfoActionBuilder.php @@ -0,0 +1,134 @@ + + */ +final class MyCartSetCustomLineItemRecurrenceInfoActionBuilder implements Builder +{ + /** + + * @var ?string + */ + private $customLineItemId; + + /** + + * @var ?string + */ + private $customLineItemKey; + + /** + + * @var null|CustomLineItemRecurrenceInfoDraft|CustomLineItemRecurrenceInfoDraftBuilder + */ + private $recurrenceInfo; + + /** + *id of the CustomLineItem to update. Either customLineItemId or customLineItemKey is required.
key of the CustomLineItem to update. Either customLineItemId or customLineItemKey is required.
Value to set. + * If empty, any existing value will be removed.
+ * + + * @return null|CustomLineItemRecurrenceInfoDraft + */ + public function getRecurrenceInfo() + { + return $this->recurrenceInfo instanceof CustomLineItemRecurrenceInfoDraftBuilder ? $this->recurrenceInfo->build() : $this->recurrenceInfo; + } + + /** + * @param ?string $customLineItemId + * @return $this + */ + public function withCustomLineItemId(?string $customLineItemId) + { + $this->customLineItemId = $customLineItemId; + + return $this; + } + + /** + * @param ?string $customLineItemKey + * @return $this + */ + public function withCustomLineItemKey(?string $customLineItemKey) + { + $this->customLineItemKey = $customLineItemKey; + + return $this; + } + + /** + * @param ?CustomLineItemRecurrenceInfoDraft $recurrenceInfo + * @return $this + */ + public function withRecurrenceInfo(?CustomLineItemRecurrenceInfoDraft $recurrenceInfo) + { + $this->recurrenceInfo = $recurrenceInfo; + + return $this; + } + + /** + * @deprecated use withRecurrenceInfo() instead + * @return $this + */ + public function withRecurrenceInfoBuilder(?CustomLineItemRecurrenceInfoDraftBuilder $recurrenceInfo) + { + $this->recurrenceInfo = $recurrenceInfo; + + return $this; + } + + public function build(): MyCartSetCustomLineItemRecurrenceInfoAction + { + return new MyCartSetCustomLineItemRecurrenceInfoActionModel( + $this->customLineItemId, + $this->customLineItemKey, + $this->recurrenceInfo instanceof CustomLineItemRecurrenceInfoDraftBuilder ? $this->recurrenceInfo->build() : $this->recurrenceInfo + ); + } + + public static function of(): MyCartSetCustomLineItemRecurrenceInfoActionBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/Me/MyCartSetCustomLineItemRecurrenceInfoActionCollection.php b/lib/commercetools-api/src/Models/Me/MyCartSetCustomLineItemRecurrenceInfoActionCollection.php new file mode 100644 index 00000000000..f1747b474cd --- /dev/null +++ b/lib/commercetools-api/src/Models/Me/MyCartSetCustomLineItemRecurrenceInfoActionCollection.php @@ -0,0 +1,56 @@ + + * @method MyCartSetCustomLineItemRecurrenceInfoAction current() + * @method MyCartSetCustomLineItemRecurrenceInfoAction end() + * @method MyCartSetCustomLineItemRecurrenceInfoAction at($offset) + */ +class MyCartSetCustomLineItemRecurrenceInfoActionCollection extends MyCartUpdateActionCollection +{ + /** + * @psalm-assert MyCartSetCustomLineItemRecurrenceInfoAction $value + * @psalm-param MyCartSetCustomLineItemRecurrenceInfoAction|stdClass $value + * @throws InvalidArgumentException + * + * @return MyCartSetCustomLineItemRecurrenceInfoActionCollection + */ + public function add($value) + { + if (!$value instanceof MyCartSetCustomLineItemRecurrenceInfoAction) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?MyCartSetCustomLineItemRecurrenceInfoAction + */ + protected function mapper() + { + return function (?int $index): ?MyCartSetCustomLineItemRecurrenceInfoAction { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var MyCartSetCustomLineItemRecurrenceInfoAction $data */ + $data = MyCartSetCustomLineItemRecurrenceInfoActionModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/Me/MyCartSetCustomLineItemRecurrenceInfoActionModel.php b/lib/commercetools-api/src/Models/Me/MyCartSetCustomLineItemRecurrenceInfoActionModel.php new file mode 100644 index 00000000000..735077b4ae6 --- /dev/null +++ b/lib/commercetools-api/src/Models/Me/MyCartSetCustomLineItemRecurrenceInfoActionModel.php @@ -0,0 +1,169 @@ +customLineItemId = $customLineItemId; + $this->customLineItemKey = $customLineItemKey; + $this->recurrenceInfo = $recurrenceInfo; + $this->action = $action ?? self::DISCRIMINATOR_VALUE; + } + + /** + * + * @return null|string + */ + public function getAction() + { + if (is_null($this->action)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_ACTION); + if (is_null($data)) { + return null; + } + $this->action = (string) $data; + } + + return $this->action; + } + + /** + *id of the CustomLineItem to update. Either customLineItemId or customLineItemKey is required.
key of the CustomLineItem to update. Either customLineItemId or customLineItemKey is required.
Value to set. + * If empty, any existing value will be removed.
+ * + * + * @return null|CustomLineItemRecurrenceInfoDraft + */ + public function getRecurrenceInfo() + { + if (is_null($this->recurrenceInfo)) { + /** @psalm-var stdClass|arrayid of the LineItem to update. Either lineItemId or lineItemKey is required.
+ *
+
+ * @return null|string
+ */
+ public function getLineItemId();
+
+ /**
+ * key of the LineItem to update. Either lineItemId or lineItemKey is required.
Value to set. + * If empty, any existing value will be removed.
+ * + + * @return null|LineItemRecurrenceInfoDraft + */ + public function getRecurrenceInfo(); + + /** + * @param ?string $lineItemId + */ + public function setLineItemId(?string $lineItemId): void; + + /** + * @param ?string $lineItemKey + */ + public function setLineItemKey(?string $lineItemKey): void; + + /** + * @param ?LineItemRecurrenceInfoDraft $recurrenceInfo + */ + public function setRecurrenceInfo(?LineItemRecurrenceInfoDraft $recurrenceInfo): void; +} diff --git a/lib/commercetools-api/src/Models/Me/MyCartSetLineItemRecurrenceInfoActionBuilder.php b/lib/commercetools-api/src/Models/Me/MyCartSetLineItemRecurrenceInfoActionBuilder.php new file mode 100644 index 00000000000..f30874674b7 --- /dev/null +++ b/lib/commercetools-api/src/Models/Me/MyCartSetLineItemRecurrenceInfoActionBuilder.php @@ -0,0 +1,134 @@ + + */ +final class MyCartSetLineItemRecurrenceInfoActionBuilder implements Builder +{ + /** + + * @var ?string + */ + private $lineItemId; + + /** + + * @var ?string + */ + private $lineItemKey; + + /** + + * @var null|LineItemRecurrenceInfoDraft|LineItemRecurrenceInfoDraftBuilder + */ + private $recurrenceInfo; + + /** + *id of the LineItem to update. Either lineItemId or lineItemKey is required.
key of the LineItem to update. Either lineItemId or lineItemKey is required.
Value to set. + * If empty, any existing value will be removed.
+ * + + * @return null|LineItemRecurrenceInfoDraft + */ + public function getRecurrenceInfo() + { + return $this->recurrenceInfo instanceof LineItemRecurrenceInfoDraftBuilder ? $this->recurrenceInfo->build() : $this->recurrenceInfo; + } + + /** + * @param ?string $lineItemId + * @return $this + */ + public function withLineItemId(?string $lineItemId) + { + $this->lineItemId = $lineItemId; + + return $this; + } + + /** + * @param ?string $lineItemKey + * @return $this + */ + public function withLineItemKey(?string $lineItemKey) + { + $this->lineItemKey = $lineItemKey; + + return $this; + } + + /** + * @param ?LineItemRecurrenceInfoDraft $recurrenceInfo + * @return $this + */ + public function withRecurrenceInfo(?LineItemRecurrenceInfoDraft $recurrenceInfo) + { + $this->recurrenceInfo = $recurrenceInfo; + + return $this; + } + + /** + * @deprecated use withRecurrenceInfo() instead + * @return $this + */ + public function withRecurrenceInfoBuilder(?LineItemRecurrenceInfoDraftBuilder $recurrenceInfo) + { + $this->recurrenceInfo = $recurrenceInfo; + + return $this; + } + + public function build(): MyCartSetLineItemRecurrenceInfoAction + { + return new MyCartSetLineItemRecurrenceInfoActionModel( + $this->lineItemId, + $this->lineItemKey, + $this->recurrenceInfo instanceof LineItemRecurrenceInfoDraftBuilder ? $this->recurrenceInfo->build() : $this->recurrenceInfo + ); + } + + public static function of(): MyCartSetLineItemRecurrenceInfoActionBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/Me/MyCartSetLineItemRecurrenceInfoActionCollection.php b/lib/commercetools-api/src/Models/Me/MyCartSetLineItemRecurrenceInfoActionCollection.php new file mode 100644 index 00000000000..41a5178fb6f --- /dev/null +++ b/lib/commercetools-api/src/Models/Me/MyCartSetLineItemRecurrenceInfoActionCollection.php @@ -0,0 +1,56 @@ + + * @method MyCartSetLineItemRecurrenceInfoAction current() + * @method MyCartSetLineItemRecurrenceInfoAction end() + * @method MyCartSetLineItemRecurrenceInfoAction at($offset) + */ +class MyCartSetLineItemRecurrenceInfoActionCollection extends MyCartUpdateActionCollection +{ + /** + * @psalm-assert MyCartSetLineItemRecurrenceInfoAction $value + * @psalm-param MyCartSetLineItemRecurrenceInfoAction|stdClass $value + * @throws InvalidArgumentException + * + * @return MyCartSetLineItemRecurrenceInfoActionCollection + */ + public function add($value) + { + if (!$value instanceof MyCartSetLineItemRecurrenceInfoAction) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?MyCartSetLineItemRecurrenceInfoAction + */ + protected function mapper() + { + return function (?int $index): ?MyCartSetLineItemRecurrenceInfoAction { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var MyCartSetLineItemRecurrenceInfoAction $data */ + $data = MyCartSetLineItemRecurrenceInfoActionModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/Me/MyCartSetLineItemRecurrenceInfoActionModel.php b/lib/commercetools-api/src/Models/Me/MyCartSetLineItemRecurrenceInfoActionModel.php new file mode 100644 index 00000000000..df7c9a93cee --- /dev/null +++ b/lib/commercetools-api/src/Models/Me/MyCartSetLineItemRecurrenceInfoActionModel.php @@ -0,0 +1,169 @@ +lineItemId = $lineItemId; + $this->lineItemKey = $lineItemKey; + $this->recurrenceInfo = $recurrenceInfo; + $this->action = $action ?? self::DISCRIMINATOR_VALUE; + } + + /** + * + * @return null|string + */ + public function getAction() + { + if (is_null($this->action)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_ACTION); + if (is_null($data)) { + return null; + } + $this->action = (string) $data; + } + + return $this->action; + } + + /** + *id of the LineItem to update. Either lineItemId or lineItemKey is required.
key of the LineItem to update. Either lineItemId or lineItemKey is required.
Value to set. + * If empty, any existing value will be removed.
+ * + * + * @return null|LineItemRecurrenceInfoDraft + */ + public function getRecurrenceInfo() + { + if (is_null($this->recurrenceInfo)) { + /** @psalm-var stdClass|arrayRecurring Order and frequency data.
+ * + + * @return null|LineItemRecurrenceInfoDraft + */ + public function getRecurrenceInfo(); + /** *Custom Fields for the Cart.
* @@ -160,6 +170,11 @@ public function setDistributionChannel(?ChannelResourceIdentifier $distributionC */ public function setShippingDetails(?ItemShippingDetailsDraft $shippingDetails): void; + /** + * @param ?LineItemRecurrenceInfoDraft $recurrenceInfo + */ + public function setRecurrenceInfo(?LineItemRecurrenceInfoDraft $recurrenceInfo): void; + /** * @param ?CustomFieldsDraft $custom */ diff --git a/lib/commercetools-api/src/Models/Me/MyLineItemDraftBuilder.php b/lib/commercetools-api/src/Models/Me/MyLineItemDraftBuilder.php index f99a45e16a6..ed37e584768 100644 --- a/lib/commercetools-api/src/Models/Me/MyLineItemDraftBuilder.php +++ b/lib/commercetools-api/src/Models/Me/MyLineItemDraftBuilder.php @@ -12,6 +12,8 @@ use Commercetools\Api\Models\Cart\ItemShippingDetailsDraftBuilder; use Commercetools\Api\Models\Channel\ChannelResourceIdentifier; use Commercetools\Api\Models\Channel\ChannelResourceIdentifierBuilder; +use Commercetools\Api\Models\RecurringOrder\LineItemRecurrenceInfoDraft; +use Commercetools\Api\Models\RecurringOrder\LineItemRecurrenceInfoDraftBuilder; use Commercetools\Api\Models\Type\CustomFieldsDraft; use Commercetools\Api\Models\Type\CustomFieldsDraftBuilder; use Commercetools\Base\Builder; @@ -81,6 +83,12 @@ final class MyLineItemDraftBuilder implements Builder */ private $shippingDetails; + /** + + * @var null|LineItemRecurrenceInfoDraft|LineItemRecurrenceInfoDraftBuilder + */ + private $recurrenceInfo; + /** * @var null|CustomFieldsDraft|CustomFieldsDraftBuilder @@ -193,6 +201,17 @@ public function getShippingDetails() return $this->shippingDetails instanceof ItemShippingDetailsDraftBuilder ? $this->shippingDetails->build() : $this->shippingDetails; } + /** + *Recurring Order and frequency data.
+ * + + * @return null|LineItemRecurrenceInfoDraft + */ + public function getRecurrenceInfo() + { + return $this->recurrenceInfo instanceof LineItemRecurrenceInfoDraftBuilder ? $this->recurrenceInfo->build() : $this->recurrenceInfo; + } + /** *Custom Fields for the Cart.
* @@ -303,6 +322,17 @@ public function withShippingDetails(?ItemShippingDetailsDraft $shippingDetails) return $this; } + /** + * @param ?LineItemRecurrenceInfoDraft $recurrenceInfo + * @return $this + */ + public function withRecurrenceInfo(?LineItemRecurrenceInfoDraft $recurrenceInfo) + { + $this->recurrenceInfo = $recurrenceInfo; + + return $this; + } + /** * @param ?CustomFieldsDraft $custom * @return $this @@ -347,6 +377,17 @@ public function withShippingDetailsBuilder(?ItemShippingDetailsDraftBuilder $shi return $this; } + /** + * @deprecated use withRecurrenceInfo() instead + * @return $this + */ + public function withRecurrenceInfoBuilder(?LineItemRecurrenceInfoDraftBuilder $recurrenceInfo) + { + $this->recurrenceInfo = $recurrenceInfo; + + return $this; + } + /** * @deprecated use withCustom() instead * @return $this @@ -370,6 +411,7 @@ public function build(): MyLineItemDraft $this->supplyChannel instanceof ChannelResourceIdentifierBuilder ? $this->supplyChannel->build() : $this->supplyChannel, $this->distributionChannel instanceof ChannelResourceIdentifierBuilder ? $this->distributionChannel->build() : $this->distributionChannel, $this->shippingDetails instanceof ItemShippingDetailsDraftBuilder ? $this->shippingDetails->build() : $this->shippingDetails, + $this->recurrenceInfo instanceof LineItemRecurrenceInfoDraftBuilder ? $this->recurrenceInfo->build() : $this->recurrenceInfo, $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom ); } diff --git a/lib/commercetools-api/src/Models/Me/MyLineItemDraftModel.php b/lib/commercetools-api/src/Models/Me/MyLineItemDraftModel.php index 6d772f6fc07..0f44f31a752 100644 --- a/lib/commercetools-api/src/Models/Me/MyLineItemDraftModel.php +++ b/lib/commercetools-api/src/Models/Me/MyLineItemDraftModel.php @@ -12,6 +12,8 @@ use Commercetools\Api\Models\Cart\ItemShippingDetailsDraftModel; use Commercetools\Api\Models\Channel\ChannelResourceIdentifier; use Commercetools\Api\Models\Channel\ChannelResourceIdentifierModel; +use Commercetools\Api\Models\RecurringOrder\LineItemRecurrenceInfoDraft; +use Commercetools\Api\Models\RecurringOrder\LineItemRecurrenceInfoDraftModel; use Commercetools\Api\Models\Type\CustomFieldsDraft; use Commercetools\Api\Models\Type\CustomFieldsDraftModel; use Commercetools\Base\DateTimeImmutableCollection; @@ -80,6 +82,12 @@ final class MyLineItemDraftModel extends JsonObjectModel implements MyLineItemDr */ protected $shippingDetails; + /** + * + * @var ?LineItemRecurrenceInfoDraft + */ + protected $recurrenceInfo; + /** * * @var ?CustomFieldsDraft @@ -100,6 +108,7 @@ public function __construct( ?ChannelResourceIdentifier $supplyChannel = null, ?ChannelResourceIdentifier $distributionChannel = null, ?ItemShippingDetailsDraft $shippingDetails = null, + ?LineItemRecurrenceInfoDraft $recurrenceInfo = null, ?CustomFieldsDraft $custom = null ) { $this->key = $key; @@ -111,6 +120,7 @@ public function __construct( $this->supplyChannel = $supplyChannel; $this->distributionChannel = $distributionChannel; $this->shippingDetails = $shippingDetails; + $this->recurrenceInfo = $recurrenceInfo; $this->custom = $custom; } @@ -308,6 +318,27 @@ public function getShippingDetails() return $this->shippingDetails; } + /** + *Recurring Order and frequency data.
+ * + * + * @return null|LineItemRecurrenceInfoDraft + */ + public function getRecurrenceInfo() + { + if (is_null($this->recurrenceInfo)) { + /** @psalm-var stdClass|arrayCustom Fields for the Cart.
* @@ -402,6 +433,14 @@ public function setShippingDetails(?ItemShippingDetailsDraft $shippingDetails): $this->shippingDetails = $shippingDetails; } + /** + * @param ?LineItemRecurrenceInfoDraft $recurrenceInfo + */ + public function setRecurrenceInfo(?LineItemRecurrenceInfoDraft $recurrenceInfo): void + { + $this->recurrenceInfo = $recurrenceInfo; + } + /** * @param ?CustomFieldsDraft $custom */ diff --git a/lib/commercetools-api/src/Models/Message/MessageModel.php b/lib/commercetools-api/src/Models/Message/MessageModel.php index 06fc1db029d..b06f1639050 100644 --- a/lib/commercetools-api/src/Models/Message/MessageModel.php +++ b/lib/commercetools-api/src/Models/Message/MessageModel.php @@ -221,6 +221,7 @@ final class MessageModel extends JsonObjectModel implements Message 'OrderBillingAddressSet' => OrderBillingAddressSetMessageModel::class, 'OrderBusinessUnitSet' => OrderBusinessUnitSetMessageModel::class, 'OrderCreated' => OrderCreatedMessageModel::class, + 'OrderCreatedFromRecurringOrder' => OrderCreatedFromRecurringOrderMessageModel::class, 'OrderCustomFieldAdded' => OrderCustomFieldAddedMessageModel::class, 'OrderCustomFieldChanged' => OrderCustomFieldChangedMessageModel::class, 'OrderCustomFieldRemoved' => OrderCustomFieldRemovedMessageModel::class, @@ -344,6 +345,17 @@ final class MessageModel extends JsonObjectModel implements Message 'QuoteRequestStateTransition' => QuoteRequestStateTransitionMessageModel::class, 'QuoteStateChanged' => QuoteStateChangedMessageModel::class, 'QuoteStateTransition' => QuoteStateTransitionMessageModel::class, + 'RecurringOrderCreated' => RecurringOrderCreatedMessageModel::class, + 'RecurringOrderCustomFieldAdded' => RecurringOrderCustomFieldAddedMessageModel::class, + 'RecurringOrderCustomFieldChanged' => RecurringOrderCustomFieldChangedMessageModel::class, + 'RecurringOrderCustomFieldRemoved' => RecurringOrderCustomFieldRemovedMessageModel::class, + 'RecurringOrderCustomTypeRemoved' => RecurringOrderCustomTypeRemovedMessageModel::class, + 'RecurringOrderCustomTypeSet' => RecurringOrderCustomTypeSetMessageModel::class, + 'RecurringOrderKeySet' => RecurringOrderKeySetMessageModel::class, + 'RecurringOrderScheduleSet' => RecurringOrderScheduleSetMessageModel::class, + 'RecurringOrderStartsAtSet' => RecurringOrderStartsAtSetMessageModel::class, + 'RecurringOrderStateChanged' => RecurringOrderStateChangedMessageModel::class, + 'RecurringOrderStateTransition' => RecurringOrderStateTransitionMessageModel::class, 'ReturnInfoAdded' => ReturnInfoAddedMessageModel::class, 'ReturnInfoSet' => ReturnInfoSetMessageModel::class, 'ReviewCreated' => ReviewCreatedMessageModel::class, diff --git a/lib/commercetools-api/src/Models/Message/MessagePayloadModel.php b/lib/commercetools-api/src/Models/Message/MessagePayloadModel.php index 8efd215f8d4..28b6412cc8b 100644 --- a/lib/commercetools-api/src/Models/Message/MessagePayloadModel.php +++ b/lib/commercetools-api/src/Models/Message/MessagePayloadModel.php @@ -152,6 +152,7 @@ final class MessagePayloadModel extends JsonObjectModel implements MessagePayloa 'OrderBillingAddressSet' => OrderBillingAddressSetMessagePayloadModel::class, 'OrderBusinessUnitSet' => OrderBusinessUnitSetMessagePayloadModel::class, 'OrderCreated' => OrderCreatedMessagePayloadModel::class, + 'OrderCreatedFromRecurringOrder' => OrderCreatedFromRecurringOrderMessagePayloadModel::class, 'OrderCustomFieldAdded' => OrderCustomFieldAddedMessagePayloadModel::class, 'OrderCustomFieldChanged' => OrderCustomFieldChangedMessagePayloadModel::class, 'OrderCustomFieldRemoved' => OrderCustomFieldRemovedMessagePayloadModel::class, @@ -275,6 +276,17 @@ final class MessagePayloadModel extends JsonObjectModel implements MessagePayloa 'QuoteRequestStateTransition' => QuoteRequestStateTransitionMessagePayloadModel::class, 'QuoteStateChanged' => QuoteStateChangedMessagePayloadModel::class, 'QuoteStateTransition' => QuoteStateTransitionMessagePayloadModel::class, + 'RecurringOrderCreated' => RecurringOrderCreatedMessagePayloadModel::class, + 'RecurringOrderCustomFieldAdded' => RecurringOrderCustomFieldAddedMessagePayloadModel::class, + 'RecurringOrderCustomFieldChanged' => RecurringOrderCustomFieldChangedMessagePayloadModel::class, + 'RecurringOrderCustomFieldRemoved' => RecurringOrderCustomFieldRemovedMessagePayloadModel::class, + 'RecurringOrderCustomTypeRemoved' => RecurringOrderCustomTypeRemovedMessagePayloadModel::class, + 'RecurringOrderCustomTypeSet' => RecurringOrderCustomTypeSetMessagePayloadModel::class, + 'RecurringOrderKeySet' => RecurringOrderKeySetMessagePayloadModel::class, + 'RecurringOrderScheduleSet' => RecurringOrderScheduleSetMessagePayloadModel::class, + 'RecurringOrderStartsAtSet' => RecurringOrderStartsAtSetMessagePayloadModel::class, + 'RecurringOrderStateChanged' => RecurringOrderStateChangedMessagePayloadModel::class, + 'RecurringOrderStateTransition' => RecurringOrderStateTransitionMessagePayloadModel::class, 'ReturnInfoAdded' => ReturnInfoAddedMessagePayloadModel::class, 'ReturnInfoSet' => ReturnInfoSetMessagePayloadModel::class, 'ReviewCreated' => ReviewCreatedMessagePayloadModel::class, diff --git a/lib/commercetools-api/src/Models/Message/OrderCreatedFromRecurringOrderMessage.php b/lib/commercetools-api/src/Models/Message/OrderCreatedFromRecurringOrderMessage.php new file mode 100644 index 00000000000..ed6292ec1b1 --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/OrderCreatedFromRecurringOrderMessage.php @@ -0,0 +1,46 @@ +Order that was created. + * + + * @return null|Order + */ + public function getOrder(); + + /** + *Reference to the origin Recurring Order.
+ * + + * @return null|RecurringOrderReference + */ + public function getRecurringOrderRef(); + + /** + * @param ?Order $order + */ + public function setOrder(?Order $order): void; + + /** + * @param ?RecurringOrderReference $recurringOrderRef + */ + public function setRecurringOrderRef(?RecurringOrderReference $recurringOrderRef): void; +} diff --git a/lib/commercetools-api/src/Models/Message/OrderCreatedFromRecurringOrderMessageBuilder.php b/lib/commercetools-api/src/Models/Message/OrderCreatedFromRecurringOrderMessageBuilder.php new file mode 100644 index 00000000000..8dba01097d2 --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/OrderCreatedFromRecurringOrderMessageBuilder.php @@ -0,0 +1,459 @@ + + */ +final class OrderCreatedFromRecurringOrderMessageBuilder implements Builder +{ + /** + + * @var ?string + */ + private $id; + + /** + + * @var ?int + */ + private $version; + + /** + + * @var ?DateTimeImmutable + */ + private $createdAt; + + /** + + * @var ?DateTimeImmutable + */ + private $lastModifiedAt; + + /** + + * @var null|LastModifiedBy|LastModifiedByBuilder + */ + private $lastModifiedBy; + + /** + + * @var null|CreatedBy|CreatedByBuilder + */ + private $createdBy; + + /** + + * @var ?int + */ + private $sequenceNumber; + + /** + + * @var null|Reference|ReferenceBuilder + */ + private $resource; + + /** + + * @var ?int + */ + private $resourceVersion; + + /** + + * @var null|UserProvidedIdentifiers|UserProvidedIdentifiersBuilder + */ + private $resourceUserProvidedIdentifiers; + + /** + + * @var null|Order|OrderBuilder + */ + private $order; + + /** + + * @var null|RecurringOrderReference|RecurringOrderReferenceBuilder + */ + private $recurringOrderRef; + + /** + *Unique identifier of the Message. Can be used to track which Messages have been processed.
+ * + + * @return null|string + */ + public function getId() + { + return $this->id; + } + + /** + *Version of a resource. In case of Messages, this is always 1.
Date and time (UTC) the Message was generated.
+ * + + * @return null|DateTimeImmutable + */ + public function getCreatedAt() + { + return $this->createdAt; + } + + /** + *Value of createdAt.
IDs and references that last modified the Message.
+ * + + * @return null|LastModifiedBy + */ + public function getLastModifiedBy() + { + return $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy; + } + + /** + *IDs and references that created the Message.
+ * + + * @return null|CreatedBy + */ + public function getCreatedBy() + { + return $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy; + } + + /** + *Message number in relation to other Messages for a given resource. The sequenceNumber of the next Message for the resource is the successor of the sequenceNumber of the current Message. Meaning, the sequenceNumber of the next Message equals the sequenceNumber of the current Message + 1.
+ * sequenceNumber can be used to ensure that Messages are processed in the correct order for a particular resource.
Reference to the resource on which the change or action was performed.
+ * + + * @return null|Reference + */ + public function getResource() + { + return $this->resource instanceof ReferenceBuilder ? $this->resource->build() : $this->resource; + } + + /** + *Version of the resource on which the change or action was performed.
+ * + + * @return null|int + */ + public function getResourceVersion() + { + return $this->resourceVersion; + } + + /** + *User-provided identifiers of the resource, such as key or externalId. Only present if the resource has such identifiers.
Order that was created.
+ * + + * @return null|Order + */ + public function getOrder() + { + return $this->order instanceof OrderBuilder ? $this->order->build() : $this->order; + } + + /** + *Reference to the origin Recurring Order.
+ * + + * @return null|RecurringOrderReference + */ + public function getRecurringOrderRef() + { + return $this->recurringOrderRef instanceof RecurringOrderReferenceBuilder ? $this->recurringOrderRef->build() : $this->recurringOrderRef; + } + + /** + * @param ?string $id + * @return $this + */ + public function withId(?string $id) + { + $this->id = $id; + + return $this; + } + + /** + * @param ?int $version + * @return $this + */ + public function withVersion(?int $version) + { + $this->version = $version; + + return $this; + } + + /** + * @param ?DateTimeImmutable $createdAt + * @return $this + */ + public function withCreatedAt(?DateTimeImmutable $createdAt) + { + $this->createdAt = $createdAt; + + return $this; + } + + /** + * @param ?DateTimeImmutable $lastModifiedAt + * @return $this + */ + public function withLastModifiedAt(?DateTimeImmutable $lastModifiedAt) + { + $this->lastModifiedAt = $lastModifiedAt; + + return $this; + } + + /** + * @param ?LastModifiedBy $lastModifiedBy + * @return $this + */ + public function withLastModifiedBy(?LastModifiedBy $lastModifiedBy) + { + $this->lastModifiedBy = $lastModifiedBy; + + return $this; + } + + /** + * @param ?CreatedBy $createdBy + * @return $this + */ + public function withCreatedBy(?CreatedBy $createdBy) + { + $this->createdBy = $createdBy; + + return $this; + } + + /** + * @param ?int $sequenceNumber + * @return $this + */ + public function withSequenceNumber(?int $sequenceNumber) + { + $this->sequenceNumber = $sequenceNumber; + + return $this; + } + + /** + * @param ?Reference $resource + * @return $this + */ + public function withResource(?Reference $resource) + { + $this->resource = $resource; + + return $this; + } + + /** + * @param ?int $resourceVersion + * @return $this + */ + public function withResourceVersion(?int $resourceVersion) + { + $this->resourceVersion = $resourceVersion; + + return $this; + } + + /** + * @param ?UserProvidedIdentifiers $resourceUserProvidedIdentifiers + * @return $this + */ + public function withResourceUserProvidedIdentifiers(?UserProvidedIdentifiers $resourceUserProvidedIdentifiers) + { + $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers; + + return $this; + } + + /** + * @param ?Order $order + * @return $this + */ + public function withOrder(?Order $order) + { + $this->order = $order; + + return $this; + } + + /** + * @param ?RecurringOrderReference $recurringOrderRef + * @return $this + */ + public function withRecurringOrderRef(?RecurringOrderReference $recurringOrderRef) + { + $this->recurringOrderRef = $recurringOrderRef; + + return $this; + } + + /** + * @deprecated use withLastModifiedBy() instead + * @return $this + */ + public function withLastModifiedByBuilder(?LastModifiedByBuilder $lastModifiedBy) + { + $this->lastModifiedBy = $lastModifiedBy; + + return $this; + } + + /** + * @deprecated use withCreatedBy() instead + * @return $this + */ + public function withCreatedByBuilder(?CreatedByBuilder $createdBy) + { + $this->createdBy = $createdBy; + + return $this; + } + + /** + * @deprecated use withResource() instead + * @return $this + */ + public function withResourceBuilder(?ReferenceBuilder $resource) + { + $this->resource = $resource; + + return $this; + } + + /** + * @deprecated use withResourceUserProvidedIdentifiers() instead + * @return $this + */ + public function withResourceUserProvidedIdentifiersBuilder(?UserProvidedIdentifiersBuilder $resourceUserProvidedIdentifiers) + { + $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers; + + return $this; + } + + /** + * @deprecated use withOrder() instead + * @return $this + */ + public function withOrderBuilder(?OrderBuilder $order) + { + $this->order = $order; + + return $this; + } + + /** + * @deprecated use withRecurringOrderRef() instead + * @return $this + */ + public function withRecurringOrderRefBuilder(?RecurringOrderReferenceBuilder $recurringOrderRef) + { + $this->recurringOrderRef = $recurringOrderRef; + + return $this; + } + + public function build(): OrderCreatedFromRecurringOrderMessage + { + return new OrderCreatedFromRecurringOrderMessageModel( + $this->id, + $this->version, + $this->createdAt, + $this->lastModifiedAt, + $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy, + $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy, + $this->sequenceNumber, + $this->resource instanceof ReferenceBuilder ? $this->resource->build() : $this->resource, + $this->resourceVersion, + $this->resourceUserProvidedIdentifiers instanceof UserProvidedIdentifiersBuilder ? $this->resourceUserProvidedIdentifiers->build() : $this->resourceUserProvidedIdentifiers, + $this->order instanceof OrderBuilder ? $this->order->build() : $this->order, + $this->recurringOrderRef instanceof RecurringOrderReferenceBuilder ? $this->recurringOrderRef->build() : $this->recurringOrderRef + ); + } + + public static function of(): OrderCreatedFromRecurringOrderMessageBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/Message/OrderCreatedFromRecurringOrderMessageCollection.php b/lib/commercetools-api/src/Models/Message/OrderCreatedFromRecurringOrderMessageCollection.php new file mode 100644 index 00000000000..118c9eecf2e --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/OrderCreatedFromRecurringOrderMessageCollection.php @@ -0,0 +1,56 @@ + + * @method OrderCreatedFromRecurringOrderMessage current() + * @method OrderCreatedFromRecurringOrderMessage end() + * @method OrderCreatedFromRecurringOrderMessage at($offset) + */ +class OrderCreatedFromRecurringOrderMessageCollection extends OrderMessageCollection +{ + /** + * @psalm-assert OrderCreatedFromRecurringOrderMessage $value + * @psalm-param OrderCreatedFromRecurringOrderMessage|stdClass $value + * @throws InvalidArgumentException + * + * @return OrderCreatedFromRecurringOrderMessageCollection + */ + public function add($value) + { + if (!$value instanceof OrderCreatedFromRecurringOrderMessage) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?OrderCreatedFromRecurringOrderMessage + */ + protected function mapper() + { + return function (?int $index): ?OrderCreatedFromRecurringOrderMessage { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var OrderCreatedFromRecurringOrderMessage $data */ + $data = OrderCreatedFromRecurringOrderMessageModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/Message/OrderCreatedFromRecurringOrderMessageModel.php b/lib/commercetools-api/src/Models/Message/OrderCreatedFromRecurringOrderMessageModel.php new file mode 100644 index 00000000000..6ed6418ccaa --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/OrderCreatedFromRecurringOrderMessageModel.php @@ -0,0 +1,532 @@ +id = $id; + $this->version = $version; + $this->createdAt = $createdAt; + $this->lastModifiedAt = $lastModifiedAt; + $this->lastModifiedBy = $lastModifiedBy; + $this->createdBy = $createdBy; + $this->sequenceNumber = $sequenceNumber; + $this->resource = $resource; + $this->resourceVersion = $resourceVersion; + $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers; + $this->order = $order; + $this->recurringOrderRef = $recurringOrderRef; + $this->type = $type ?? self::DISCRIMINATOR_VALUE; + } + + /** + *Unique identifier of the Message. Can be used to track which Messages have been processed.
+ * + * + * @return null|string + */ + public function getId() + { + if (is_null($this->id)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_ID); + if (is_null($data)) { + return null; + } + $this->id = (string) $data; + } + + return $this->id; + } + + /** + *Version of a resource. In case of Messages, this is always 1.
Date and time (UTC) the Message was generated.
+ * + * + * @return null|DateTimeImmutable + */ + public function getCreatedAt() + { + if (is_null($this->createdAt)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CREATED_AT); + if (is_null($data)) { + return null; + } + $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data); + if (false === $data) { + return null; + } + $this->createdAt = $data; + } + + return $this->createdAt; + } + + /** + *Value of createdAt.
IDs and references that last modified the Message.
+ * + * + * @return null|LastModifiedBy + */ + public function getLastModifiedBy() + { + if (is_null($this->lastModifiedBy)) { + /** @psalm-var stdClass|arrayIDs and references that created the Message.
+ * + * + * @return null|CreatedBy + */ + public function getCreatedBy() + { + if (is_null($this->createdBy)) { + /** @psalm-var stdClass|arrayMessage number in relation to other Messages for a given resource. The sequenceNumber of the next Message for the resource is the successor of the sequenceNumber of the current Message. Meaning, the sequenceNumber of the next Message equals the sequenceNumber of the current Message + 1.
+ * sequenceNumber can be used to ensure that Messages are processed in the correct order for a particular resource.
Reference to the resource on which the change or action was performed.
+ * + * + * @return null|Reference + */ + public function getResource() + { + if (is_null($this->resource)) { + /** @psalm-var stdClass|arrayVersion of the resource on which the change or action was performed.
+ * + * + * @return null|int + */ + public function getResourceVersion() + { + if (is_null($this->resourceVersion)) { + /** @psalm-var ?int $data */ + $data = $this->raw(self::FIELD_RESOURCE_VERSION); + if (is_null($data)) { + return null; + } + $this->resourceVersion = (int) $data; + } + + return $this->resourceVersion; + } + + /** + *Message Type of the Message.
+ * + * + * @return null|string + */ + public function getType() + { + if (is_null($this->type)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_TYPE); + if (is_null($data)) { + return null; + } + $this->type = (string) $data; + } + + return $this->type; + } + + /** + *User-provided identifiers of the resource, such as key or externalId. Only present if the resource has such identifiers.
Order that was created.
+ * + * + * @return null|Order + */ + public function getOrder() + { + if (is_null($this->order)) { + /** @psalm-var stdClass|arrayReference to the origin Recurring Order.
+ * + * + * @return null|RecurringOrderReference + */ + public function getRecurringOrderRef() + { + if (is_null($this->recurringOrderRef)) { + /** @psalm-var stdClass|arrayReference to the origin Recurring Order.
+ * + + * @return null|RecurringOrderReference + */ + public function getRecurringOrderRef(); + + /** + * @param ?Order $order + */ + public function setOrder(?Order $order): void; + + /** + * @param ?RecurringOrderReference $recurringOrderRef + */ + public function setRecurringOrderRef(?RecurringOrderReference $recurringOrderRef): void; +} diff --git a/lib/commercetools-api/src/Models/Message/OrderCreatedFromRecurringOrderMessagePayloadBuilder.php b/lib/commercetools-api/src/Models/Message/OrderCreatedFromRecurringOrderMessagePayloadBuilder.php new file mode 100644 index 00000000000..bc248c7a9d3 --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/OrderCreatedFromRecurringOrderMessagePayloadBuilder.php @@ -0,0 +1,117 @@ + + */ +final class OrderCreatedFromRecurringOrderMessagePayloadBuilder implements Builder +{ + /** + + * @var null|Order|OrderBuilder + */ + private $order; + + /** + + * @var null|RecurringOrderReference|RecurringOrderReferenceBuilder + */ + private $recurringOrderRef; + + /** + *Order that was created.
+ * + + * @return null|Order + */ + public function getOrder() + { + return $this->order instanceof OrderBuilder ? $this->order->build() : $this->order; + } + + /** + *Reference to the origin Recurring Order.
+ * + + * @return null|RecurringOrderReference + */ + public function getRecurringOrderRef() + { + return $this->recurringOrderRef instanceof RecurringOrderReferenceBuilder ? $this->recurringOrderRef->build() : $this->recurringOrderRef; + } + + /** + * @param ?Order $order + * @return $this + */ + public function withOrder(?Order $order) + { + $this->order = $order; + + return $this; + } + + /** + * @param ?RecurringOrderReference $recurringOrderRef + * @return $this + */ + public function withRecurringOrderRef(?RecurringOrderReference $recurringOrderRef) + { + $this->recurringOrderRef = $recurringOrderRef; + + return $this; + } + + /** + * @deprecated use withOrder() instead + * @return $this + */ + public function withOrderBuilder(?OrderBuilder $order) + { + $this->order = $order; + + return $this; + } + + /** + * @deprecated use withRecurringOrderRef() instead + * @return $this + */ + public function withRecurringOrderRefBuilder(?RecurringOrderReferenceBuilder $recurringOrderRef) + { + $this->recurringOrderRef = $recurringOrderRef; + + return $this; + } + + public function build(): OrderCreatedFromRecurringOrderMessagePayload + { + return new OrderCreatedFromRecurringOrderMessagePayloadModel( + $this->order instanceof OrderBuilder ? $this->order->build() : $this->order, + $this->recurringOrderRef instanceof RecurringOrderReferenceBuilder ? $this->recurringOrderRef->build() : $this->recurringOrderRef + ); + } + + public static function of(): OrderCreatedFromRecurringOrderMessagePayloadBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/Message/OrderCreatedFromRecurringOrderMessagePayloadCollection.php b/lib/commercetools-api/src/Models/Message/OrderCreatedFromRecurringOrderMessagePayloadCollection.php new file mode 100644 index 00000000000..124983d022d --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/OrderCreatedFromRecurringOrderMessagePayloadCollection.php @@ -0,0 +1,56 @@ + + * @method OrderCreatedFromRecurringOrderMessagePayload current() + * @method OrderCreatedFromRecurringOrderMessagePayload end() + * @method OrderCreatedFromRecurringOrderMessagePayload at($offset) + */ +class OrderCreatedFromRecurringOrderMessagePayloadCollection extends OrderMessagePayloadCollection +{ + /** + * @psalm-assert OrderCreatedFromRecurringOrderMessagePayload $value + * @psalm-param OrderCreatedFromRecurringOrderMessagePayload|stdClass $value + * @throws InvalidArgumentException + * + * @return OrderCreatedFromRecurringOrderMessagePayloadCollection + */ + public function add($value) + { + if (!$value instanceof OrderCreatedFromRecurringOrderMessagePayload) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?OrderCreatedFromRecurringOrderMessagePayload + */ + protected function mapper() + { + return function (?int $index): ?OrderCreatedFromRecurringOrderMessagePayload { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var OrderCreatedFromRecurringOrderMessagePayload $data */ + $data = OrderCreatedFromRecurringOrderMessagePayloadModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/Message/OrderCreatedFromRecurringOrderMessagePayloadModel.php b/lib/commercetools-api/src/Models/Message/OrderCreatedFromRecurringOrderMessagePayloadModel.php new file mode 100644 index 00000000000..7c432c3c737 --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/OrderCreatedFromRecurringOrderMessagePayloadModel.php @@ -0,0 +1,135 @@ +order = $order; + $this->recurringOrderRef = $recurringOrderRef; + $this->type = $type ?? self::DISCRIMINATOR_VALUE; + } + + /** + * + * @return null|string + */ + public function getType() + { + if (is_null($this->type)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_TYPE); + if (is_null($data)) { + return null; + } + $this->type = (string) $data; + } + + return $this->type; + } + + /** + *Order that was created.
+ * + * + * @return null|Order + */ + public function getOrder() + { + if (is_null($this->order)) { + /** @psalm-var stdClass|arrayReference to the origin Recurring Order.
+ * + * + * @return null|RecurringOrderReference + */ + public function getRecurringOrderRef() + { + if (is_null($this->recurringOrderRef)) { + /** @psalm-var stdClass|arrayUnique identifier of the Message. Can be used to track which Messages have been processed.
+ * + + * @return null|string + */ + public function getId() + { + return $this->id; + } + + /** + *Version of a resource. In case of Messages, this is always 1.
Date and time (UTC) the Message was generated.
+ * + + * @return null|DateTimeImmutable + */ + public function getCreatedAt() + { + return $this->createdAt; + } + + /** + *Value of createdAt.
IDs and references that last modified the Message.
+ * + + * @return null|LastModifiedBy + */ + public function getLastModifiedBy() + { + return $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy; + } + + /** + *IDs and references that created the Message.
+ * + + * @return null|CreatedBy + */ + public function getCreatedBy() + { + return $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy; + } + + /** + *Message number in relation to other Messages for a given resource. The sequenceNumber of the next Message for the resource is the successor of the sequenceNumber of the current Message. Meaning, the sequenceNumber of the next Message equals the sequenceNumber of the current Message + 1.
+ * sequenceNumber can be used to ensure that Messages are processed in the correct order for a particular resource.
Reference to the resource on which the change or action was performed.
+ * + + * @return null|Reference + */ + public function getResource() + { + return $this->resource instanceof ReferenceBuilder ? $this->resource->build() : $this->resource; + } + + /** + *Version of the resource on which the change or action was performed.
+ * + + * @return null|int + */ + public function getResourceVersion() + { + return $this->resourceVersion; + } + + /** + *User-provided identifiers of the resource, such as key or externalId. Only present if the resource has such identifiers.
RecurringOrder that was created.
+ * + + * @return null|RecurringOrder + */ + public function getOrder() + { + return $this->order instanceof RecurringOrderBuilder ? $this->order->build() : $this->order; + } + + /** + * @param ?string $id + * @return $this + */ + public function withId(?string $id) + { + $this->id = $id; + + return $this; + } + + /** + * @param ?int $version + * @return $this + */ + public function withVersion(?int $version) + { + $this->version = $version; + + return $this; + } + + /** + * @param ?DateTimeImmutable $createdAt + * @return $this + */ + public function withCreatedAt(?DateTimeImmutable $createdAt) + { + $this->createdAt = $createdAt; + + return $this; + } + + /** + * @param ?DateTimeImmutable $lastModifiedAt + * @return $this + */ + public function withLastModifiedAt(?DateTimeImmutable $lastModifiedAt) + { + $this->lastModifiedAt = $lastModifiedAt; + + return $this; + } + + /** + * @param ?LastModifiedBy $lastModifiedBy + * @return $this + */ + public function withLastModifiedBy(?LastModifiedBy $lastModifiedBy) + { + $this->lastModifiedBy = $lastModifiedBy; + + return $this; + } + + /** + * @param ?CreatedBy $createdBy + * @return $this + */ + public function withCreatedBy(?CreatedBy $createdBy) + { + $this->createdBy = $createdBy; + + return $this; + } + + /** + * @param ?int $sequenceNumber + * @return $this + */ + public function withSequenceNumber(?int $sequenceNumber) + { + $this->sequenceNumber = $sequenceNumber; + + return $this; + } + + /** + * @param ?Reference $resource + * @return $this + */ + public function withResource(?Reference $resource) + { + $this->resource = $resource; + + return $this; + } + + /** + * @param ?int $resourceVersion + * @return $this + */ + public function withResourceVersion(?int $resourceVersion) + { + $this->resourceVersion = $resourceVersion; + + return $this; + } + + /** + * @param ?UserProvidedIdentifiers $resourceUserProvidedIdentifiers + * @return $this + */ + public function withResourceUserProvidedIdentifiers(?UserProvidedIdentifiers $resourceUserProvidedIdentifiers) + { + $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers; + + return $this; + } + + /** + * @param ?RecurringOrder $order + * @return $this + */ + public function withOrder(?RecurringOrder $order) + { + $this->order = $order; + + return $this; + } + + /** + * @deprecated use withLastModifiedBy() instead + * @return $this + */ + public function withLastModifiedByBuilder(?LastModifiedByBuilder $lastModifiedBy) + { + $this->lastModifiedBy = $lastModifiedBy; + + return $this; + } + + /** + * @deprecated use withCreatedBy() instead + * @return $this + */ + public function withCreatedByBuilder(?CreatedByBuilder $createdBy) + { + $this->createdBy = $createdBy; + + return $this; + } + + /** + * @deprecated use withResource() instead + * @return $this + */ + public function withResourceBuilder(?ReferenceBuilder $resource) + { + $this->resource = $resource; + + return $this; + } + + /** + * @deprecated use withResourceUserProvidedIdentifiers() instead + * @return $this + */ + public function withResourceUserProvidedIdentifiersBuilder(?UserProvidedIdentifiersBuilder $resourceUserProvidedIdentifiers) + { + $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers; + + return $this; + } + + /** + * @deprecated use withOrder() instead + * @return $this + */ + public function withOrderBuilder(?RecurringOrderBuilder $order) + { + $this->order = $order; + + return $this; + } + + public function build(): RecurringOrderCreatedMessage + { + return new RecurringOrderCreatedMessageModel( + $this->id, + $this->version, + $this->createdAt, + $this->lastModifiedAt, + $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy, + $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy, + $this->sequenceNumber, + $this->resource instanceof ReferenceBuilder ? $this->resource->build() : $this->resource, + $this->resourceVersion, + $this->resourceUserProvidedIdentifiers instanceof UserProvidedIdentifiersBuilder ? $this->resourceUserProvidedIdentifiers->build() : $this->resourceUserProvidedIdentifiers, + $this->order instanceof RecurringOrderBuilder ? $this->order->build() : $this->order + ); + } + + public static function of(): RecurringOrderCreatedMessageBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/Message/RecurringOrderCreatedMessageCollection.php b/lib/commercetools-api/src/Models/Message/RecurringOrderCreatedMessageCollection.php new file mode 100644 index 00000000000..afd19f8d5e9 --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/RecurringOrderCreatedMessageCollection.php @@ -0,0 +1,56 @@ + + * @method RecurringOrderCreatedMessage current() + * @method RecurringOrderCreatedMessage end() + * @method RecurringOrderCreatedMessage at($offset) + */ +class RecurringOrderCreatedMessageCollection extends MessageCollection +{ + /** + * @psalm-assert RecurringOrderCreatedMessage $value + * @psalm-param RecurringOrderCreatedMessage|stdClass $value + * @throws InvalidArgumentException + * + * @return RecurringOrderCreatedMessageCollection + */ + public function add($value) + { + if (!$value instanceof RecurringOrderCreatedMessage) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?RecurringOrderCreatedMessage + */ + protected function mapper() + { + return function (?int $index): ?RecurringOrderCreatedMessage { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var RecurringOrderCreatedMessage $data */ + $data = RecurringOrderCreatedMessageModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/Message/RecurringOrderCreatedMessageModel.php b/lib/commercetools-api/src/Models/Message/RecurringOrderCreatedMessageModel.php new file mode 100644 index 00000000000..e70bb14c442 --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/RecurringOrderCreatedMessageModel.php @@ -0,0 +1,493 @@ +id = $id; + $this->version = $version; + $this->createdAt = $createdAt; + $this->lastModifiedAt = $lastModifiedAt; + $this->lastModifiedBy = $lastModifiedBy; + $this->createdBy = $createdBy; + $this->sequenceNumber = $sequenceNumber; + $this->resource = $resource; + $this->resourceVersion = $resourceVersion; + $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers; + $this->order = $order; + $this->type = $type ?? self::DISCRIMINATOR_VALUE; + } + + /** + *Unique identifier of the Message. Can be used to track which Messages have been processed.
+ * + * + * @return null|string + */ + public function getId() + { + if (is_null($this->id)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_ID); + if (is_null($data)) { + return null; + } + $this->id = (string) $data; + } + + return $this->id; + } + + /** + *Version of a resource. In case of Messages, this is always 1.
Date and time (UTC) the Message was generated.
+ * + * + * @return null|DateTimeImmutable + */ + public function getCreatedAt() + { + if (is_null($this->createdAt)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CREATED_AT); + if (is_null($data)) { + return null; + } + $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data); + if (false === $data) { + return null; + } + $this->createdAt = $data; + } + + return $this->createdAt; + } + + /** + *Value of createdAt.
IDs and references that last modified the Message.
+ * + * + * @return null|LastModifiedBy + */ + public function getLastModifiedBy() + { + if (is_null($this->lastModifiedBy)) { + /** @psalm-var stdClass|arrayIDs and references that created the Message.
+ * + * + * @return null|CreatedBy + */ + public function getCreatedBy() + { + if (is_null($this->createdBy)) { + /** @psalm-var stdClass|arrayMessage number in relation to other Messages for a given resource. The sequenceNumber of the next Message for the resource is the successor of the sequenceNumber of the current Message. Meaning, the sequenceNumber of the next Message equals the sequenceNumber of the current Message + 1.
+ * sequenceNumber can be used to ensure that Messages are processed in the correct order for a particular resource.
Reference to the resource on which the change or action was performed.
+ * + * + * @return null|Reference + */ + public function getResource() + { + if (is_null($this->resource)) { + /** @psalm-var stdClass|arrayVersion of the resource on which the change or action was performed.
+ * + * + * @return null|int + */ + public function getResourceVersion() + { + if (is_null($this->resourceVersion)) { + /** @psalm-var ?int $data */ + $data = $this->raw(self::FIELD_RESOURCE_VERSION); + if (is_null($data)) { + return null; + } + $this->resourceVersion = (int) $data; + } + + return $this->resourceVersion; + } + + /** + *Message Type of the Message.
+ * + * + * @return null|string + */ + public function getType() + { + if (is_null($this->type)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_TYPE); + if (is_null($data)) { + return null; + } + $this->type = (string) $data; + } + + return $this->type; + } + + /** + *User-provided identifiers of the resource, such as key or externalId. Only present if the resource has such identifiers.
RecurringOrder that was created.
+ * + * + * @return null|RecurringOrder + */ + public function getOrder() + { + if (is_null($this->order)) { + /** @psalm-var stdClass|arrayRecurringOrder that was created.
+ * + + * @return null|RecurringOrder + */ + public function getOrder() + { + return $this->order instanceof RecurringOrderBuilder ? $this->order->build() : $this->order; + } + + /** + * @param ?RecurringOrder $order + * @return $this + */ + public function withOrder(?RecurringOrder $order) + { + $this->order = $order; + + return $this; + } + + /** + * @deprecated use withOrder() instead + * @return $this + */ + public function withOrderBuilder(?RecurringOrderBuilder $order) + { + $this->order = $order; + + return $this; + } + + public function build(): RecurringOrderCreatedMessagePayload + { + return new RecurringOrderCreatedMessagePayloadModel( + $this->order instanceof RecurringOrderBuilder ? $this->order->build() : $this->order + ); + } + + public static function of(): RecurringOrderCreatedMessagePayloadBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/Message/RecurringOrderCreatedMessagePayloadCollection.php b/lib/commercetools-api/src/Models/Message/RecurringOrderCreatedMessagePayloadCollection.php new file mode 100644 index 00000000000..4004f58c5b8 --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/RecurringOrderCreatedMessagePayloadCollection.php @@ -0,0 +1,56 @@ + + * @method RecurringOrderCreatedMessagePayload current() + * @method RecurringOrderCreatedMessagePayload end() + * @method RecurringOrderCreatedMessagePayload at($offset) + */ +class RecurringOrderCreatedMessagePayloadCollection extends MessagePayloadCollection +{ + /** + * @psalm-assert RecurringOrderCreatedMessagePayload $value + * @psalm-param RecurringOrderCreatedMessagePayload|stdClass $value + * @throws InvalidArgumentException + * + * @return RecurringOrderCreatedMessagePayloadCollection + */ + public function add($value) + { + if (!$value instanceof RecurringOrderCreatedMessagePayload) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?RecurringOrderCreatedMessagePayload + */ + protected function mapper() + { + return function (?int $index): ?RecurringOrderCreatedMessagePayload { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var RecurringOrderCreatedMessagePayload $data */ + $data = RecurringOrderCreatedMessagePayloadModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/Message/RecurringOrderCreatedMessagePayloadModel.php b/lib/commercetools-api/src/Models/Message/RecurringOrderCreatedMessagePayloadModel.php new file mode 100644 index 00000000000..e4e757b78d4 --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/RecurringOrderCreatedMessagePayloadModel.php @@ -0,0 +1,96 @@ +order = $order; + $this->type = $type ?? self::DISCRIMINATOR_VALUE; + } + + /** + * + * @return null|string + */ + public function getType() + { + if (is_null($this->type)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_TYPE); + if (is_null($data)) { + return null; + } + $this->type = (string) $data; + } + + return $this->type; + } + + /** + *RecurringOrder that was created.
+ * + * + * @return null|RecurringOrder + */ + public function getOrder() + { + if (is_null($this->order)) { + /** @psalm-var stdClass|arrayThe added CustomFieldValue based on the FieldType.
+ * + + * @return null|mixed + */ + public function getValue(); + + /** + * @param ?string $name + */ + public function setName(?string $name): void; + + /** + * @param mixed $value + */ + public function setValue($value): void; +} diff --git a/lib/commercetools-api/src/Models/Message/RecurringOrderCustomFieldAddedMessageBuilder.php b/lib/commercetools-api/src/Models/Message/RecurringOrderCustomFieldAddedMessageBuilder.php new file mode 100644 index 00000000000..c63a2189744 --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/RecurringOrderCustomFieldAddedMessageBuilder.php @@ -0,0 +1,433 @@ + + */ +final class RecurringOrderCustomFieldAddedMessageBuilder implements Builder +{ + /** + + * @var ?string + */ + private $id; + + /** + + * @var ?int + */ + private $version; + + /** + + * @var ?DateTimeImmutable + */ + private $createdAt; + + /** + + * @var ?DateTimeImmutable + */ + private $lastModifiedAt; + + /** + + * @var null|LastModifiedBy|LastModifiedByBuilder + */ + private $lastModifiedBy; + + /** + + * @var null|CreatedBy|CreatedByBuilder + */ + private $createdBy; + + /** + + * @var ?int + */ + private $sequenceNumber; + + /** + + * @var null|Reference|ReferenceBuilder + */ + private $resource; + + /** + + * @var ?int + */ + private $resourceVersion; + + /** + + * @var null|UserProvidedIdentifiers|UserProvidedIdentifiersBuilder + */ + private $resourceUserProvidedIdentifiers; + + /** + + * @var ?string + */ + private $name; + + /** + + * @var null|mixed|mixed + */ + private $value; + + /** + *Unique identifier of the Message. Can be used to track which Messages have been processed.
+ * + + * @return null|string + */ + public function getId() + { + return $this->id; + } + + /** + *Version of a resource. In case of Messages, this is always 1.
Date and time (UTC) the Message was generated.
+ * + + * @return null|DateTimeImmutable + */ + public function getCreatedAt() + { + return $this->createdAt; + } + + /** + *Value of createdAt.
IDs and references that last modified the Message.
+ * + + * @return null|LastModifiedBy + */ + public function getLastModifiedBy() + { + return $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy; + } + + /** + *IDs and references that created the Message.
+ * + + * @return null|CreatedBy + */ + public function getCreatedBy() + { + return $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy; + } + + /** + *Message number in relation to other Messages for a given resource. The sequenceNumber of the next Message for the resource is the successor of the sequenceNumber of the current Message. Meaning, the sequenceNumber of the next Message equals the sequenceNumber of the current Message + 1.
+ * sequenceNumber can be used to ensure that Messages are processed in the correct order for a particular resource.
Reference to the resource on which the change or action was performed.
+ * + + * @return null|Reference + */ + public function getResource() + { + return $this->resource instanceof ReferenceBuilder ? $this->resource->build() : $this->resource; + } + + /** + *Version of the resource on which the change or action was performed.
+ * + + * @return null|int + */ + public function getResourceVersion() + { + return $this->resourceVersion; + } + + /** + *User-provided identifiers of the resource, such as key or externalId. Only present if the resource has such identifiers.
Name of the Custom Field that was added.
+ * + + * @return null|string + */ + public function getName() + { + return $this->name; + } + + /** + *The added CustomFieldValue based on the FieldType.
+ * + + * @return null|mixed + */ + public function getValue() + { + return $this->value; + } + + /** + * @param ?string $id + * @return $this + */ + public function withId(?string $id) + { + $this->id = $id; + + return $this; + } + + /** + * @param ?int $version + * @return $this + */ + public function withVersion(?int $version) + { + $this->version = $version; + + return $this; + } + + /** + * @param ?DateTimeImmutable $createdAt + * @return $this + */ + public function withCreatedAt(?DateTimeImmutable $createdAt) + { + $this->createdAt = $createdAt; + + return $this; + } + + /** + * @param ?DateTimeImmutable $lastModifiedAt + * @return $this + */ + public function withLastModifiedAt(?DateTimeImmutable $lastModifiedAt) + { + $this->lastModifiedAt = $lastModifiedAt; + + return $this; + } + + /** + * @param ?LastModifiedBy $lastModifiedBy + * @return $this + */ + public function withLastModifiedBy(?LastModifiedBy $lastModifiedBy) + { + $this->lastModifiedBy = $lastModifiedBy; + + return $this; + } + + /** + * @param ?CreatedBy $createdBy + * @return $this + */ + public function withCreatedBy(?CreatedBy $createdBy) + { + $this->createdBy = $createdBy; + + return $this; + } + + /** + * @param ?int $sequenceNumber + * @return $this + */ + public function withSequenceNumber(?int $sequenceNumber) + { + $this->sequenceNumber = $sequenceNumber; + + return $this; + } + + /** + * @param ?Reference $resource + * @return $this + */ + public function withResource(?Reference $resource) + { + $this->resource = $resource; + + return $this; + } + + /** + * @param ?int $resourceVersion + * @return $this + */ + public function withResourceVersion(?int $resourceVersion) + { + $this->resourceVersion = $resourceVersion; + + return $this; + } + + /** + * @param ?UserProvidedIdentifiers $resourceUserProvidedIdentifiers + * @return $this + */ + public function withResourceUserProvidedIdentifiers(?UserProvidedIdentifiers $resourceUserProvidedIdentifiers) + { + $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers; + + return $this; + } + + /** + * @param ?string $name + * @return $this + */ + public function withName(?string $name) + { + $this->name = $name; + + return $this; + } + + /** + * @param mixed $value + * @return $this + */ + public function withValue($value) + { + $this->value = $value; + + return $this; + } + + /** + * @deprecated use withLastModifiedBy() instead + * @return $this + */ + public function withLastModifiedByBuilder(?LastModifiedByBuilder $lastModifiedBy) + { + $this->lastModifiedBy = $lastModifiedBy; + + return $this; + } + + /** + * @deprecated use withCreatedBy() instead + * @return $this + */ + public function withCreatedByBuilder(?CreatedByBuilder $createdBy) + { + $this->createdBy = $createdBy; + + return $this; + } + + /** + * @deprecated use withResource() instead + * @return $this + */ + public function withResourceBuilder(?ReferenceBuilder $resource) + { + $this->resource = $resource; + + return $this; + } + + /** + * @deprecated use withResourceUserProvidedIdentifiers() instead + * @return $this + */ + public function withResourceUserProvidedIdentifiersBuilder(?UserProvidedIdentifiersBuilder $resourceUserProvidedIdentifiers) + { + $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers; + + return $this; + } + + public function build(): RecurringOrderCustomFieldAddedMessage + { + return new RecurringOrderCustomFieldAddedMessageModel( + $this->id, + $this->version, + $this->createdAt, + $this->lastModifiedAt, + $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy, + $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy, + $this->sequenceNumber, + $this->resource instanceof ReferenceBuilder ? $this->resource->build() : $this->resource, + $this->resourceVersion, + $this->resourceUserProvidedIdentifiers instanceof UserProvidedIdentifiersBuilder ? $this->resourceUserProvidedIdentifiers->build() : $this->resourceUserProvidedIdentifiers, + $this->name, + $this->value + ); + } + + public static function of(): RecurringOrderCustomFieldAddedMessageBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/Message/RecurringOrderCustomFieldAddedMessageCollection.php b/lib/commercetools-api/src/Models/Message/RecurringOrderCustomFieldAddedMessageCollection.php new file mode 100644 index 00000000000..6fbdec11ae2 --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/RecurringOrderCustomFieldAddedMessageCollection.php @@ -0,0 +1,56 @@ + + * @method RecurringOrderCustomFieldAddedMessage current() + * @method RecurringOrderCustomFieldAddedMessage end() + * @method RecurringOrderCustomFieldAddedMessage at($offset) + */ +class RecurringOrderCustomFieldAddedMessageCollection extends MessageCollection +{ + /** + * @psalm-assert RecurringOrderCustomFieldAddedMessage $value + * @psalm-param RecurringOrderCustomFieldAddedMessage|stdClass $value + * @throws InvalidArgumentException + * + * @return RecurringOrderCustomFieldAddedMessageCollection + */ + public function add($value) + { + if (!$value instanceof RecurringOrderCustomFieldAddedMessage) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?RecurringOrderCustomFieldAddedMessage + */ + protected function mapper() + { + return function (?int $index): ?RecurringOrderCustomFieldAddedMessage { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var RecurringOrderCustomFieldAddedMessage $data */ + $data = RecurringOrderCustomFieldAddedMessageModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/Message/RecurringOrderCustomFieldAddedMessageModel.php b/lib/commercetools-api/src/Models/Message/RecurringOrderCustomFieldAddedMessageModel.php new file mode 100644 index 00000000000..970aea38843 --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/RecurringOrderCustomFieldAddedMessageModel.php @@ -0,0 +1,526 @@ +id = $id; + $this->version = $version; + $this->createdAt = $createdAt; + $this->lastModifiedAt = $lastModifiedAt; + $this->lastModifiedBy = $lastModifiedBy; + $this->createdBy = $createdBy; + $this->sequenceNumber = $sequenceNumber; + $this->resource = $resource; + $this->resourceVersion = $resourceVersion; + $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers; + $this->name = $name; + $this->value = $value; + $this->type = $type ?? self::DISCRIMINATOR_VALUE; + } + + /** + *Unique identifier of the Message. Can be used to track which Messages have been processed.
+ * + * + * @return null|string + */ + public function getId() + { + if (is_null($this->id)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_ID); + if (is_null($data)) { + return null; + } + $this->id = (string) $data; + } + + return $this->id; + } + + /** + *Version of a resource. In case of Messages, this is always 1.
Date and time (UTC) the Message was generated.
+ * + * + * @return null|DateTimeImmutable + */ + public function getCreatedAt() + { + if (is_null($this->createdAt)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CREATED_AT); + if (is_null($data)) { + return null; + } + $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data); + if (false === $data) { + return null; + } + $this->createdAt = $data; + } + + return $this->createdAt; + } + + /** + *Value of createdAt.
IDs and references that last modified the Message.
+ * + * + * @return null|LastModifiedBy + */ + public function getLastModifiedBy() + { + if (is_null($this->lastModifiedBy)) { + /** @psalm-var stdClass|arrayIDs and references that created the Message.
+ * + * + * @return null|CreatedBy + */ + public function getCreatedBy() + { + if (is_null($this->createdBy)) { + /** @psalm-var stdClass|arrayMessage number in relation to other Messages for a given resource. The sequenceNumber of the next Message for the resource is the successor of the sequenceNumber of the current Message. Meaning, the sequenceNumber of the next Message equals the sequenceNumber of the current Message + 1.
+ * sequenceNumber can be used to ensure that Messages are processed in the correct order for a particular resource.
Reference to the resource on which the change or action was performed.
+ * + * + * @return null|Reference + */ + public function getResource() + { + if (is_null($this->resource)) { + /** @psalm-var stdClass|arrayVersion of the resource on which the change or action was performed.
+ * + * + * @return null|int + */ + public function getResourceVersion() + { + if (is_null($this->resourceVersion)) { + /** @psalm-var ?int $data */ + $data = $this->raw(self::FIELD_RESOURCE_VERSION); + if (is_null($data)) { + return null; + } + $this->resourceVersion = (int) $data; + } + + return $this->resourceVersion; + } + + /** + *Message Type of the Message.
+ * + * + * @return null|string + */ + public function getType() + { + if (is_null($this->type)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_TYPE); + if (is_null($data)) { + return null; + } + $this->type = (string) $data; + } + + return $this->type; + } + + /** + *User-provided identifiers of the resource, such as key or externalId. Only present if the resource has such identifiers.
Name of the Custom Field that was added.
+ * + * + * @return null|string + */ + public function getName() + { + if (is_null($this->name)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_NAME); + if (is_null($data)) { + return null; + } + $this->name = (string) $data; + } + + return $this->name; + } + + /** + *The added CustomFieldValue based on the FieldType.
+ * + * + * @return null|mixed + */ + public function getValue() + { + if (is_null($this->value)) { + /** @psalm-var mixed $data */ + $data = $this->raw(self::FIELD_VALUE); + if (is_null($data)) { + return null; + } + $this->value = $data; + } + + return $this->value; + } + + + /** + * @param ?string $id + */ + public function setId(?string $id): void + { + $this->id = $id; + } + + /** + * @param ?int $version + */ + public function setVersion(?int $version): void + { + $this->version = $version; + } + + /** + * @param ?DateTimeImmutable $createdAt + */ + public function setCreatedAt(?DateTimeImmutable $createdAt): void + { + $this->createdAt = $createdAt; + } + + /** + * @param ?DateTimeImmutable $lastModifiedAt + */ + public function setLastModifiedAt(?DateTimeImmutable $lastModifiedAt): void + { + $this->lastModifiedAt = $lastModifiedAt; + } + + /** + * @param ?LastModifiedBy $lastModifiedBy + */ + public function setLastModifiedBy(?LastModifiedBy $lastModifiedBy): void + { + $this->lastModifiedBy = $lastModifiedBy; + } + + /** + * @param ?CreatedBy $createdBy + */ + public function setCreatedBy(?CreatedBy $createdBy): void + { + $this->createdBy = $createdBy; + } + + /** + * @param ?int $sequenceNumber + */ + public function setSequenceNumber(?int $sequenceNumber): void + { + $this->sequenceNumber = $sequenceNumber; + } + + /** + * @param ?Reference $resource + */ + public function setResource(?Reference $resource): void + { + $this->resource = $resource; + } + + /** + * @param ?int $resourceVersion + */ + public function setResourceVersion(?int $resourceVersion): void + { + $this->resourceVersion = $resourceVersion; + } + + /** + * @param ?UserProvidedIdentifiers $resourceUserProvidedIdentifiers + */ + public function setResourceUserProvidedIdentifiers(?UserProvidedIdentifiers $resourceUserProvidedIdentifiers): void + { + $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers; + } + + /** + * @param ?string $name + */ + public function setName(?string $name): void + { + $this->name = $name; + } + + /** + * @param mixed $value + */ + public function setValue($value): void + { + $this->value = $value; + } + + + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + $data = $this->toArray(); + if (isset($data[Message::FIELD_CREATED_AT]) && $data[Message::FIELD_CREATED_AT] instanceof \DateTimeImmutable) { + $data[Message::FIELD_CREATED_AT] = $data[Message::FIELD_CREATED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c'); + } + + if (isset($data[Message::FIELD_LAST_MODIFIED_AT]) && $data[Message::FIELD_LAST_MODIFIED_AT] instanceof \DateTimeImmutable) { + $data[Message::FIELD_LAST_MODIFIED_AT] = $data[Message::FIELD_LAST_MODIFIED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c'); + } + return (object) $data; + } +} diff --git a/lib/commercetools-api/src/Models/Message/RecurringOrderCustomFieldAddedMessagePayload.php b/lib/commercetools-api/src/Models/Message/RecurringOrderCustomFieldAddedMessagePayload.php new file mode 100644 index 00000000000..6121d2a7413 --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/RecurringOrderCustomFieldAddedMessagePayload.php @@ -0,0 +1,44 @@ +Name of the Custom Field that was added. + * + + * @return null|string + */ + public function getName(); + + /** + *The added CustomFieldValue based on the FieldType.
+ * + + * @return null|mixed + */ + public function getValue(); + + /** + * @param ?string $name + */ + public function setName(?string $name): void; + + /** + * @param mixed $value + */ + public function setValue($value): void; +} diff --git a/lib/commercetools-api/src/Models/Message/RecurringOrderCustomFieldAddedMessagePayloadBuilder.php b/lib/commercetools-api/src/Models/Message/RecurringOrderCustomFieldAddedMessagePayloadBuilder.php new file mode 100644 index 00000000000..920bd044e6f --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/RecurringOrderCustomFieldAddedMessagePayloadBuilder.php @@ -0,0 +1,92 @@ + + */ +final class RecurringOrderCustomFieldAddedMessagePayloadBuilder implements Builder +{ + /** + + * @var ?string + */ + private $name; + + /** + + * @var null|mixed|mixed + */ + private $value; + + /** + *Name of the Custom Field that was added.
+ * + + * @return null|string + */ + public function getName() + { + return $this->name; + } + + /** + *The added CustomFieldValue based on the FieldType.
+ * + + * @return null|mixed + */ + public function getValue() + { + return $this->value; + } + + /** + * @param ?string $name + * @return $this + */ + public function withName(?string $name) + { + $this->name = $name; + + return $this; + } + + /** + * @param mixed $value + * @return $this + */ + public function withValue($value) + { + $this->value = $value; + + return $this; + } + + + public function build(): RecurringOrderCustomFieldAddedMessagePayload + { + return new RecurringOrderCustomFieldAddedMessagePayloadModel( + $this->name, + $this->value + ); + } + + public static function of(): RecurringOrderCustomFieldAddedMessagePayloadBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/Message/RecurringOrderCustomFieldAddedMessagePayloadCollection.php b/lib/commercetools-api/src/Models/Message/RecurringOrderCustomFieldAddedMessagePayloadCollection.php new file mode 100644 index 00000000000..ec8a851dbf5 --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/RecurringOrderCustomFieldAddedMessagePayloadCollection.php @@ -0,0 +1,56 @@ + + * @method RecurringOrderCustomFieldAddedMessagePayload current() + * @method RecurringOrderCustomFieldAddedMessagePayload end() + * @method RecurringOrderCustomFieldAddedMessagePayload at($offset) + */ +class RecurringOrderCustomFieldAddedMessagePayloadCollection extends MessagePayloadCollection +{ + /** + * @psalm-assert RecurringOrderCustomFieldAddedMessagePayload $value + * @psalm-param RecurringOrderCustomFieldAddedMessagePayload|stdClass $value + * @throws InvalidArgumentException + * + * @return RecurringOrderCustomFieldAddedMessagePayloadCollection + */ + public function add($value) + { + if (!$value instanceof RecurringOrderCustomFieldAddedMessagePayload) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?RecurringOrderCustomFieldAddedMessagePayload + */ + protected function mapper() + { + return function (?int $index): ?RecurringOrderCustomFieldAddedMessagePayload { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var RecurringOrderCustomFieldAddedMessagePayload $data */ + $data = RecurringOrderCustomFieldAddedMessagePayloadModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/Message/RecurringOrderCustomFieldAddedMessagePayloadModel.php b/lib/commercetools-api/src/Models/Message/RecurringOrderCustomFieldAddedMessagePayloadModel.php new file mode 100644 index 00000000000..5591ec138f0 --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/RecurringOrderCustomFieldAddedMessagePayloadModel.php @@ -0,0 +1,129 @@ +name = $name; + $this->value = $value; + $this->type = $type ?? self::DISCRIMINATOR_VALUE; + } + + /** + * + * @return null|string + */ + public function getType() + { + if (is_null($this->type)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_TYPE); + if (is_null($data)) { + return null; + } + $this->type = (string) $data; + } + + return $this->type; + } + + /** + *Name of the Custom Field that was added.
+ * + * + * @return null|string + */ + public function getName() + { + if (is_null($this->name)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_NAME); + if (is_null($data)) { + return null; + } + $this->name = (string) $data; + } + + return $this->name; + } + + /** + *The added CustomFieldValue based on the FieldType.
+ * + * + * @return null|mixed + */ + public function getValue() + { + if (is_null($this->value)) { + /** @psalm-var mixed $data */ + $data = $this->raw(self::FIELD_VALUE); + if (is_null($data)) { + return null; + } + $this->value = $data; + } + + return $this->value; + } + + + /** + * @param ?string $name + */ + public function setName(?string $name): void + { + $this->name = $name; + } + + /** + * @param mixed $value + */ + public function setValue($value): void + { + $this->value = $value; + } +} diff --git a/lib/commercetools-api/src/Models/Message/RecurringOrderCustomFieldChangedMessage.php b/lib/commercetools-api/src/Models/Message/RecurringOrderCustomFieldChangedMessage.php new file mode 100644 index 00000000000..0dac78c323d --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/RecurringOrderCustomFieldChangedMessage.php @@ -0,0 +1,59 @@ +Name of the Custom Field that changed. + * + + * @return null|string + */ + public function getName(); + + /** + *CustomFieldValue based on the FieldType after the Set CustomField update action.
+ * + + * @return null|mixed + */ + public function getValue(); + + /** + *CustomFieldValue based on the FieldType before the Set CustomField update action.
+ * When there has not been a Custom Field with the name on the Order before, an Order Custom Field Added Message is generated instead.
Unique identifier of the Message. Can be used to track which Messages have been processed.
+ * + + * @return null|string + */ + public function getId() + { + return $this->id; + } + + /** + *Version of a resource. In case of Messages, this is always 1.
Date and time (UTC) the Message was generated.
+ * + + * @return null|DateTimeImmutable + */ + public function getCreatedAt() + { + return $this->createdAt; + } + + /** + *Value of createdAt.
IDs and references that last modified the Message.
+ * + + * @return null|LastModifiedBy + */ + public function getLastModifiedBy() + { + return $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy; + } + + /** + *IDs and references that created the Message.
+ * + + * @return null|CreatedBy + */ + public function getCreatedBy() + { + return $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy; + } + + /** + *Message number in relation to other Messages for a given resource. The sequenceNumber of the next Message for the resource is the successor of the sequenceNumber of the current Message. Meaning, the sequenceNumber of the next Message equals the sequenceNumber of the current Message + 1.
+ * sequenceNumber can be used to ensure that Messages are processed in the correct order for a particular resource.
Reference to the resource on which the change or action was performed.
+ * + + * @return null|Reference + */ + public function getResource() + { + return $this->resource instanceof ReferenceBuilder ? $this->resource->build() : $this->resource; + } + + /** + *Version of the resource on which the change or action was performed.
+ * + + * @return null|int + */ + public function getResourceVersion() + { + return $this->resourceVersion; + } + + /** + *User-provided identifiers of the resource, such as key or externalId. Only present if the resource has such identifiers.
Name of the Custom Field that changed.
+ * + + * @return null|string + */ + public function getName() + { + return $this->name; + } + + /** + *CustomFieldValue based on the FieldType after the Set CustomField update action.
+ * + + * @return null|mixed + */ + public function getValue() + { + return $this->value; + } + + /** + *CustomFieldValue based on the FieldType before the Set CustomField update action.
+ * When there has not been a Custom Field with the name on the Order before, an Order Custom Field Added Message is generated instead.
Unique identifier of the Message. Can be used to track which Messages have been processed.
+ * + * + * @return null|string + */ + public function getId() + { + if (is_null($this->id)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_ID); + if (is_null($data)) { + return null; + } + $this->id = (string) $data; + } + + return $this->id; + } + + /** + *Version of a resource. In case of Messages, this is always 1.
Date and time (UTC) the Message was generated.
+ * + * + * @return null|DateTimeImmutable + */ + public function getCreatedAt() + { + if (is_null($this->createdAt)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CREATED_AT); + if (is_null($data)) { + return null; + } + $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data); + if (false === $data) { + return null; + } + $this->createdAt = $data; + } + + return $this->createdAt; + } + + /** + *Value of createdAt.
IDs and references that last modified the Message.
+ * + * + * @return null|LastModifiedBy + */ + public function getLastModifiedBy() + { + if (is_null($this->lastModifiedBy)) { + /** @psalm-var stdClass|arrayIDs and references that created the Message.
+ * + * + * @return null|CreatedBy + */ + public function getCreatedBy() + { + if (is_null($this->createdBy)) { + /** @psalm-var stdClass|arrayMessage number in relation to other Messages for a given resource. The sequenceNumber of the next Message for the resource is the successor of the sequenceNumber of the current Message. Meaning, the sequenceNumber of the next Message equals the sequenceNumber of the current Message + 1.
+ * sequenceNumber can be used to ensure that Messages are processed in the correct order for a particular resource.
Reference to the resource on which the change or action was performed.
+ * + * + * @return null|Reference + */ + public function getResource() + { + if (is_null($this->resource)) { + /** @psalm-var stdClass|arrayVersion of the resource on which the change or action was performed.
+ * + * + * @return null|int + */ + public function getResourceVersion() + { + if (is_null($this->resourceVersion)) { + /** @psalm-var ?int $data */ + $data = $this->raw(self::FIELD_RESOURCE_VERSION); + if (is_null($data)) { + return null; + } + $this->resourceVersion = (int) $data; + } + + return $this->resourceVersion; + } + + /** + *Message Type of the Message.
+ * + * + * @return null|string + */ + public function getType() + { + if (is_null($this->type)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_TYPE); + if (is_null($data)) { + return null; + } + $this->type = (string) $data; + } + + return $this->type; + } + + /** + *User-provided identifiers of the resource, such as key or externalId. Only present if the resource has such identifiers.
Name of the Custom Field that changed.
+ * + * + * @return null|string + */ + public function getName() + { + if (is_null($this->name)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_NAME); + if (is_null($data)) { + return null; + } + $this->name = (string) $data; + } + + return $this->name; + } + + /** + *CustomFieldValue based on the FieldType after the Set CustomField update action.
+ * + * + * @return null|mixed + */ + public function getValue() + { + if (is_null($this->value)) { + /** @psalm-var mixed $data */ + $data = $this->raw(self::FIELD_VALUE); + if (is_null($data)) { + return null; + } + $this->value = $data; + } + + return $this->value; + } + + /** + *CustomFieldValue based on the FieldType before the Set CustomField update action.
+ * When there has not been a Custom Field with the name on the Order before, an Order Custom Field Added Message is generated instead.
CustomFieldValue based on the FieldType after the Set CustomField update action.
+ * + + * @return null|mixed + */ + public function getValue(); + + /** + *CustomFieldValue based on the FieldType before the Set CustomField update action.
+ * When there has not been a Custom Field with the name on the Order before, an Order Custom Field Added Message is generated instead.
Name of the Custom Field that changed.
+ * + + * @return null|string + */ + public function getName() + { + return $this->name; + } + + /** + *CustomFieldValue based on the FieldType after the Set CustomField update action.
+ * + + * @return null|mixed + */ + public function getValue() + { + return $this->value; + } + + /** + *CustomFieldValue based on the FieldType before the Set CustomField update action.
+ * When there has not been a Custom Field with the name on the Order before, an Order Custom Field Added Message is generated instead.
Name of the Custom Field that changed.
+ * + * + * @return null|string + */ + public function getName() + { + if (is_null($this->name)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_NAME); + if (is_null($data)) { + return null; + } + $this->name = (string) $data; + } + + return $this->name; + } + + /** + *CustomFieldValue based on the FieldType after the Set CustomField update action.
+ * + * + * @return null|mixed + */ + public function getValue() + { + if (is_null($this->value)) { + /** @psalm-var mixed $data */ + $data = $this->raw(self::FIELD_VALUE); + if (is_null($data)) { + return null; + } + $this->value = $data; + } + + return $this->value; + } + + /** + *CustomFieldValue based on the FieldType before the Set CustomField update action.
+ * When there has not been a Custom Field with the name on the Order before, an Order Custom Field Added Message is generated instead.
Unique identifier of the Message. Can be used to track which Messages have been processed.
+ * + + * @return null|string + */ + public function getId() + { + return $this->id; + } + + /** + *Version of a resource. In case of Messages, this is always 1.
Date and time (UTC) the Message was generated.
+ * + + * @return null|DateTimeImmutable + */ + public function getCreatedAt() + { + return $this->createdAt; + } + + /** + *Value of createdAt.
IDs and references that last modified the Message.
+ * + + * @return null|LastModifiedBy + */ + public function getLastModifiedBy() + { + return $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy; + } + + /** + *IDs and references that created the Message.
+ * + + * @return null|CreatedBy + */ + public function getCreatedBy() + { + return $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy; + } + + /** + *Message number in relation to other Messages for a given resource. The sequenceNumber of the next Message for the resource is the successor of the sequenceNumber of the current Message. Meaning, the sequenceNumber of the next Message equals the sequenceNumber of the current Message + 1.
+ * sequenceNumber can be used to ensure that Messages are processed in the correct order for a particular resource.
Reference to the resource on which the change or action was performed.
+ * + + * @return null|Reference + */ + public function getResource() + { + return $this->resource instanceof ReferenceBuilder ? $this->resource->build() : $this->resource; + } + + /** + *Version of the resource on which the change or action was performed.
+ * + + * @return null|int + */ + public function getResourceVersion() + { + return $this->resourceVersion; + } + + /** + *User-provided identifiers of the resource, such as key or externalId. Only present if the resource has such identifiers.
Name of the Custom Field that was removed.
+ * + + * @return null|string + */ + public function getName() + { + return $this->name; + } + + /** + * @param ?string $id + * @return $this + */ + public function withId(?string $id) + { + $this->id = $id; + + return $this; + } + + /** + * @param ?int $version + * @return $this + */ + public function withVersion(?int $version) + { + $this->version = $version; + + return $this; + } + + /** + * @param ?DateTimeImmutable $createdAt + * @return $this + */ + public function withCreatedAt(?DateTimeImmutable $createdAt) + { + $this->createdAt = $createdAt; + + return $this; + } + + /** + * @param ?DateTimeImmutable $lastModifiedAt + * @return $this + */ + public function withLastModifiedAt(?DateTimeImmutable $lastModifiedAt) + { + $this->lastModifiedAt = $lastModifiedAt; + + return $this; + } + + /** + * @param ?LastModifiedBy $lastModifiedBy + * @return $this + */ + public function withLastModifiedBy(?LastModifiedBy $lastModifiedBy) + { + $this->lastModifiedBy = $lastModifiedBy; + + return $this; + } + + /** + * @param ?CreatedBy $createdBy + * @return $this + */ + public function withCreatedBy(?CreatedBy $createdBy) + { + $this->createdBy = $createdBy; + + return $this; + } + + /** + * @param ?int $sequenceNumber + * @return $this + */ + public function withSequenceNumber(?int $sequenceNumber) + { + $this->sequenceNumber = $sequenceNumber; + + return $this; + } + + /** + * @param ?Reference $resource + * @return $this + */ + public function withResource(?Reference $resource) + { + $this->resource = $resource; + + return $this; + } + + /** + * @param ?int $resourceVersion + * @return $this + */ + public function withResourceVersion(?int $resourceVersion) + { + $this->resourceVersion = $resourceVersion; + + return $this; + } + + /** + * @param ?UserProvidedIdentifiers $resourceUserProvidedIdentifiers + * @return $this + */ + public function withResourceUserProvidedIdentifiers(?UserProvidedIdentifiers $resourceUserProvidedIdentifiers) + { + $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers; + + return $this; + } + + /** + * @param ?string $name + * @return $this + */ + public function withName(?string $name) + { + $this->name = $name; + + return $this; + } + + /** + * @deprecated use withLastModifiedBy() instead + * @return $this + */ + public function withLastModifiedByBuilder(?LastModifiedByBuilder $lastModifiedBy) + { + $this->lastModifiedBy = $lastModifiedBy; + + return $this; + } + + /** + * @deprecated use withCreatedBy() instead + * @return $this + */ + public function withCreatedByBuilder(?CreatedByBuilder $createdBy) + { + $this->createdBy = $createdBy; + + return $this; + } + + /** + * @deprecated use withResource() instead + * @return $this + */ + public function withResourceBuilder(?ReferenceBuilder $resource) + { + $this->resource = $resource; + + return $this; + } + + /** + * @deprecated use withResourceUserProvidedIdentifiers() instead + * @return $this + */ + public function withResourceUserProvidedIdentifiersBuilder(?UserProvidedIdentifiersBuilder $resourceUserProvidedIdentifiers) + { + $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers; + + return $this; + } + + public function build(): RecurringOrderCustomFieldRemovedMessage + { + return new RecurringOrderCustomFieldRemovedMessageModel( + $this->id, + $this->version, + $this->createdAt, + $this->lastModifiedAt, + $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy, + $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy, + $this->sequenceNumber, + $this->resource instanceof ReferenceBuilder ? $this->resource->build() : $this->resource, + $this->resourceVersion, + $this->resourceUserProvidedIdentifiers instanceof UserProvidedIdentifiersBuilder ? $this->resourceUserProvidedIdentifiers->build() : $this->resourceUserProvidedIdentifiers, + $this->name + ); + } + + public static function of(): RecurringOrderCustomFieldRemovedMessageBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/Message/RecurringOrderCustomFieldRemovedMessageCollection.php b/lib/commercetools-api/src/Models/Message/RecurringOrderCustomFieldRemovedMessageCollection.php new file mode 100644 index 00000000000..1ca4d4ad2e0 --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/RecurringOrderCustomFieldRemovedMessageCollection.php @@ -0,0 +1,56 @@ + + * @method RecurringOrderCustomFieldRemovedMessage current() + * @method RecurringOrderCustomFieldRemovedMessage end() + * @method RecurringOrderCustomFieldRemovedMessage at($offset) + */ +class RecurringOrderCustomFieldRemovedMessageCollection extends MessageCollection +{ + /** + * @psalm-assert RecurringOrderCustomFieldRemovedMessage $value + * @psalm-param RecurringOrderCustomFieldRemovedMessage|stdClass $value + * @throws InvalidArgumentException + * + * @return RecurringOrderCustomFieldRemovedMessageCollection + */ + public function add($value) + { + if (!$value instanceof RecurringOrderCustomFieldRemovedMessage) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?RecurringOrderCustomFieldRemovedMessage + */ + protected function mapper() + { + return function (?int $index): ?RecurringOrderCustomFieldRemovedMessage { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var RecurringOrderCustomFieldRemovedMessage $data */ + $data = RecurringOrderCustomFieldRemovedMessageModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/Message/RecurringOrderCustomFieldRemovedMessageModel.php b/lib/commercetools-api/src/Models/Message/RecurringOrderCustomFieldRemovedMessageModel.php new file mode 100644 index 00000000000..6c82521acc7 --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/RecurringOrderCustomFieldRemovedMessageModel.php @@ -0,0 +1,490 @@ +id = $id; + $this->version = $version; + $this->createdAt = $createdAt; + $this->lastModifiedAt = $lastModifiedAt; + $this->lastModifiedBy = $lastModifiedBy; + $this->createdBy = $createdBy; + $this->sequenceNumber = $sequenceNumber; + $this->resource = $resource; + $this->resourceVersion = $resourceVersion; + $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers; + $this->name = $name; + $this->type = $type ?? self::DISCRIMINATOR_VALUE; + } + + /** + *Unique identifier of the Message. Can be used to track which Messages have been processed.
+ * + * + * @return null|string + */ + public function getId() + { + if (is_null($this->id)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_ID); + if (is_null($data)) { + return null; + } + $this->id = (string) $data; + } + + return $this->id; + } + + /** + *Version of a resource. In case of Messages, this is always 1.
Date and time (UTC) the Message was generated.
+ * + * + * @return null|DateTimeImmutable + */ + public function getCreatedAt() + { + if (is_null($this->createdAt)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CREATED_AT); + if (is_null($data)) { + return null; + } + $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data); + if (false === $data) { + return null; + } + $this->createdAt = $data; + } + + return $this->createdAt; + } + + /** + *Value of createdAt.
IDs and references that last modified the Message.
+ * + * + * @return null|LastModifiedBy + */ + public function getLastModifiedBy() + { + if (is_null($this->lastModifiedBy)) { + /** @psalm-var stdClass|arrayIDs and references that created the Message.
+ * + * + * @return null|CreatedBy + */ + public function getCreatedBy() + { + if (is_null($this->createdBy)) { + /** @psalm-var stdClass|arrayMessage number in relation to other Messages for a given resource. The sequenceNumber of the next Message for the resource is the successor of the sequenceNumber of the current Message. Meaning, the sequenceNumber of the next Message equals the sequenceNumber of the current Message + 1.
+ * sequenceNumber can be used to ensure that Messages are processed in the correct order for a particular resource.
Reference to the resource on which the change or action was performed.
+ * + * + * @return null|Reference + */ + public function getResource() + { + if (is_null($this->resource)) { + /** @psalm-var stdClass|arrayVersion of the resource on which the change or action was performed.
+ * + * + * @return null|int + */ + public function getResourceVersion() + { + if (is_null($this->resourceVersion)) { + /** @psalm-var ?int $data */ + $data = $this->raw(self::FIELD_RESOURCE_VERSION); + if (is_null($data)) { + return null; + } + $this->resourceVersion = (int) $data; + } + + return $this->resourceVersion; + } + + /** + *Message Type of the Message.
+ * + * + * @return null|string + */ + public function getType() + { + if (is_null($this->type)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_TYPE); + if (is_null($data)) { + return null; + } + $this->type = (string) $data; + } + + return $this->type; + } + + /** + *User-provided identifiers of the resource, such as key or externalId. Only present if the resource has such identifiers.
Name of the Custom Field that was removed.
+ * + * + * @return null|string + */ + public function getName() + { + if (is_null($this->name)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_NAME); + if (is_null($data)) { + return null; + } + $this->name = (string) $data; + } + + return $this->name; + } + + + /** + * @param ?string $id + */ + public function setId(?string $id): void + { + $this->id = $id; + } + + /** + * @param ?int $version + */ + public function setVersion(?int $version): void + { + $this->version = $version; + } + + /** + * @param ?DateTimeImmutable $createdAt + */ + public function setCreatedAt(?DateTimeImmutable $createdAt): void + { + $this->createdAt = $createdAt; + } + + /** + * @param ?DateTimeImmutable $lastModifiedAt + */ + public function setLastModifiedAt(?DateTimeImmutable $lastModifiedAt): void + { + $this->lastModifiedAt = $lastModifiedAt; + } + + /** + * @param ?LastModifiedBy $lastModifiedBy + */ + public function setLastModifiedBy(?LastModifiedBy $lastModifiedBy): void + { + $this->lastModifiedBy = $lastModifiedBy; + } + + /** + * @param ?CreatedBy $createdBy + */ + public function setCreatedBy(?CreatedBy $createdBy): void + { + $this->createdBy = $createdBy; + } + + /** + * @param ?int $sequenceNumber + */ + public function setSequenceNumber(?int $sequenceNumber): void + { + $this->sequenceNumber = $sequenceNumber; + } + + /** + * @param ?Reference $resource + */ + public function setResource(?Reference $resource): void + { + $this->resource = $resource; + } + + /** + * @param ?int $resourceVersion + */ + public function setResourceVersion(?int $resourceVersion): void + { + $this->resourceVersion = $resourceVersion; + } + + /** + * @param ?UserProvidedIdentifiers $resourceUserProvidedIdentifiers + */ + public function setResourceUserProvidedIdentifiers(?UserProvidedIdentifiers $resourceUserProvidedIdentifiers): void + { + $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers; + } + + /** + * @param ?string $name + */ + public function setName(?string $name): void + { + $this->name = $name; + } + + + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + $data = $this->toArray(); + if (isset($data[Message::FIELD_CREATED_AT]) && $data[Message::FIELD_CREATED_AT] instanceof \DateTimeImmutable) { + $data[Message::FIELD_CREATED_AT] = $data[Message::FIELD_CREATED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c'); + } + + if (isset($data[Message::FIELD_LAST_MODIFIED_AT]) && $data[Message::FIELD_LAST_MODIFIED_AT] instanceof \DateTimeImmutable) { + $data[Message::FIELD_LAST_MODIFIED_AT] = $data[Message::FIELD_LAST_MODIFIED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c'); + } + return (object) $data; + } +} diff --git a/lib/commercetools-api/src/Models/Message/RecurringOrderCustomFieldRemovedMessagePayload.php b/lib/commercetools-api/src/Models/Message/RecurringOrderCustomFieldRemovedMessagePayload.php new file mode 100644 index 00000000000..d65c9880423 --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/RecurringOrderCustomFieldRemovedMessagePayload.php @@ -0,0 +1,30 @@ +Name of the Custom Field that was removed. + * + + * @return null|string + */ + public function getName(); + + /** + * @param ?string $name + */ + public function setName(?string $name): void; +} diff --git a/lib/commercetools-api/src/Models/Message/RecurringOrderCustomFieldRemovedMessagePayloadBuilder.php b/lib/commercetools-api/src/Models/Message/RecurringOrderCustomFieldRemovedMessagePayloadBuilder.php new file mode 100644 index 00000000000..b010a042e6a --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/RecurringOrderCustomFieldRemovedMessagePayloadBuilder.php @@ -0,0 +1,63 @@ + + */ +final class RecurringOrderCustomFieldRemovedMessagePayloadBuilder implements Builder +{ + /** + + * @var ?string + */ + private $name; + + /** + *Name of the Custom Field that was removed.
+ * + + * @return null|string + */ + public function getName() + { + return $this->name; + } + + /** + * @param ?string $name + * @return $this + */ + public function withName(?string $name) + { + $this->name = $name; + + return $this; + } + + + public function build(): RecurringOrderCustomFieldRemovedMessagePayload + { + return new RecurringOrderCustomFieldRemovedMessagePayloadModel( + $this->name + ); + } + + public static function of(): RecurringOrderCustomFieldRemovedMessagePayloadBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/Message/RecurringOrderCustomFieldRemovedMessagePayloadCollection.php b/lib/commercetools-api/src/Models/Message/RecurringOrderCustomFieldRemovedMessagePayloadCollection.php new file mode 100644 index 00000000000..80a24bd1dcd --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/RecurringOrderCustomFieldRemovedMessagePayloadCollection.php @@ -0,0 +1,56 @@ + + * @method RecurringOrderCustomFieldRemovedMessagePayload current() + * @method RecurringOrderCustomFieldRemovedMessagePayload end() + * @method RecurringOrderCustomFieldRemovedMessagePayload at($offset) + */ +class RecurringOrderCustomFieldRemovedMessagePayloadCollection extends MessagePayloadCollection +{ + /** + * @psalm-assert RecurringOrderCustomFieldRemovedMessagePayload $value + * @psalm-param RecurringOrderCustomFieldRemovedMessagePayload|stdClass $value + * @throws InvalidArgumentException + * + * @return RecurringOrderCustomFieldRemovedMessagePayloadCollection + */ + public function add($value) + { + if (!$value instanceof RecurringOrderCustomFieldRemovedMessagePayload) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?RecurringOrderCustomFieldRemovedMessagePayload + */ + protected function mapper() + { + return function (?int $index): ?RecurringOrderCustomFieldRemovedMessagePayload { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var RecurringOrderCustomFieldRemovedMessagePayload $data */ + $data = RecurringOrderCustomFieldRemovedMessagePayloadModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/Message/RecurringOrderCustomFieldRemovedMessagePayloadModel.php b/lib/commercetools-api/src/Models/Message/RecurringOrderCustomFieldRemovedMessagePayloadModel.php new file mode 100644 index 00000000000..1c17a0455a9 --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/RecurringOrderCustomFieldRemovedMessagePayloadModel.php @@ -0,0 +1,93 @@ +name = $name; + $this->type = $type ?? self::DISCRIMINATOR_VALUE; + } + + /** + * + * @return null|string + */ + public function getType() + { + if (is_null($this->type)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_TYPE); + if (is_null($data)) { + return null; + } + $this->type = (string) $data; + } + + return $this->type; + } + + /** + *Name of the Custom Field that was removed.
+ * + * + * @return null|string + */ + public function getName() + { + if (is_null($this->name)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_NAME); + if (is_null($data)) { + return null; + } + $this->name = (string) $data; + } + + return $this->name; + } + + + /** + * @param ?string $name + */ + public function setName(?string $name): void + { + $this->name = $name; + } +} diff --git a/lib/commercetools-api/src/Models/Message/RecurringOrderCustomTypeRemovedMessage.php b/lib/commercetools-api/src/Models/Message/RecurringOrderCustomTypeRemovedMessage.php new file mode 100644 index 00000000000..dc01f61a9ef --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/RecurringOrderCustomTypeRemovedMessage.php @@ -0,0 +1,30 @@ +id of the Custom Type that was removed. Absent if there was no previous Custom Type present.
+ *
+
+ * @return null|string
+ */
+ public function getPreviousTypeId();
+
+ /**
+ * @param ?string $previousTypeId
+ */
+ public function setPreviousTypeId(?string $previousTypeId): void;
+}
diff --git a/lib/commercetools-api/src/Models/Message/RecurringOrderCustomTypeRemovedMessageBuilder.php b/lib/commercetools-api/src/Models/Message/RecurringOrderCustomTypeRemovedMessageBuilder.php
new file mode 100644
index 00000000000..0227a2d1185
--- /dev/null
+++ b/lib/commercetools-api/src/Models/Message/RecurringOrderCustomTypeRemovedMessageBuilder.php
@@ -0,0 +1,404 @@
+
+ */
+final class RecurringOrderCustomTypeRemovedMessageBuilder implements Builder
+{
+ /**
+
+ * @var ?string
+ */
+ private $id;
+
+ /**
+
+ * @var ?int
+ */
+ private $version;
+
+ /**
+
+ * @var ?DateTimeImmutable
+ */
+ private $createdAt;
+
+ /**
+
+ * @var ?DateTimeImmutable
+ */
+ private $lastModifiedAt;
+
+ /**
+
+ * @var null|LastModifiedBy|LastModifiedByBuilder
+ */
+ private $lastModifiedBy;
+
+ /**
+
+ * @var null|CreatedBy|CreatedByBuilder
+ */
+ private $createdBy;
+
+ /**
+
+ * @var ?int
+ */
+ private $sequenceNumber;
+
+ /**
+
+ * @var null|Reference|ReferenceBuilder
+ */
+ private $resource;
+
+ /**
+
+ * @var ?int
+ */
+ private $resourceVersion;
+
+ /**
+
+ * @var null|UserProvidedIdentifiers|UserProvidedIdentifiersBuilder
+ */
+ private $resourceUserProvidedIdentifiers;
+
+ /**
+
+ * @var ?string
+ */
+ private $previousTypeId;
+
+ /**
+ * Unique identifier of the Message. Can be used to track which Messages have been processed.
+ * + + * @return null|string + */ + public function getId() + { + return $this->id; + } + + /** + *Version of a resource. In case of Messages, this is always 1.
Date and time (UTC) the Message was generated.
+ * + + * @return null|DateTimeImmutable + */ + public function getCreatedAt() + { + return $this->createdAt; + } + + /** + *Value of createdAt.
IDs and references that last modified the Message.
+ * + + * @return null|LastModifiedBy + */ + public function getLastModifiedBy() + { + return $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy; + } + + /** + *IDs and references that created the Message.
+ * + + * @return null|CreatedBy + */ + public function getCreatedBy() + { + return $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy; + } + + /** + *Message number in relation to other Messages for a given resource. The sequenceNumber of the next Message for the resource is the successor of the sequenceNumber of the current Message. Meaning, the sequenceNumber of the next Message equals the sequenceNumber of the current Message + 1.
+ * sequenceNumber can be used to ensure that Messages are processed in the correct order for a particular resource.
Reference to the resource on which the change or action was performed.
+ * + + * @return null|Reference + */ + public function getResource() + { + return $this->resource instanceof ReferenceBuilder ? $this->resource->build() : $this->resource; + } + + /** + *Version of the resource on which the change or action was performed.
+ * + + * @return null|int + */ + public function getResourceVersion() + { + return $this->resourceVersion; + } + + /** + *User-provided identifiers of the resource, such as key or externalId. Only present if the resource has such identifiers.
id of the Custom Type that was removed. Absent if there was no previous Custom Type present.
Unique identifier of the Message. Can be used to track which Messages have been processed.
+ * + * + * @return null|string + */ + public function getId() + { + if (is_null($this->id)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_ID); + if (is_null($data)) { + return null; + } + $this->id = (string) $data; + } + + return $this->id; + } + + /** + *Version of a resource. In case of Messages, this is always 1.
Date and time (UTC) the Message was generated.
+ * + * + * @return null|DateTimeImmutable + */ + public function getCreatedAt() + { + if (is_null($this->createdAt)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CREATED_AT); + if (is_null($data)) { + return null; + } + $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data); + if (false === $data) { + return null; + } + $this->createdAt = $data; + } + + return $this->createdAt; + } + + /** + *Value of createdAt.
IDs and references that last modified the Message.
+ * + * + * @return null|LastModifiedBy + */ + public function getLastModifiedBy() + { + if (is_null($this->lastModifiedBy)) { + /** @psalm-var stdClass|arrayIDs and references that created the Message.
+ * + * + * @return null|CreatedBy + */ + public function getCreatedBy() + { + if (is_null($this->createdBy)) { + /** @psalm-var stdClass|arrayMessage number in relation to other Messages for a given resource. The sequenceNumber of the next Message for the resource is the successor of the sequenceNumber of the current Message. Meaning, the sequenceNumber of the next Message equals the sequenceNumber of the current Message + 1.
+ * sequenceNumber can be used to ensure that Messages are processed in the correct order for a particular resource.
Reference to the resource on which the change or action was performed.
+ * + * + * @return null|Reference + */ + public function getResource() + { + if (is_null($this->resource)) { + /** @psalm-var stdClass|arrayVersion of the resource on which the change or action was performed.
+ * + * + * @return null|int + */ + public function getResourceVersion() + { + if (is_null($this->resourceVersion)) { + /** @psalm-var ?int $data */ + $data = $this->raw(self::FIELD_RESOURCE_VERSION); + if (is_null($data)) { + return null; + } + $this->resourceVersion = (int) $data; + } + + return $this->resourceVersion; + } + + /** + *Message Type of the Message.
+ * + * + * @return null|string + */ + public function getType() + { + if (is_null($this->type)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_TYPE); + if (is_null($data)) { + return null; + } + $this->type = (string) $data; + } + + return $this->type; + } + + /** + *User-provided identifiers of the resource, such as key or externalId. Only present if the resource has such identifiers.
id of the Custom Type that was removed. Absent if there was no previous Custom Type present.
id of the Custom Type that was removed. Absent if there was no previous Custom Type present.
+ *
+
+ * @return null|string
+ */
+ public function getPreviousTypeId();
+
+ /**
+ * @param ?string $previousTypeId
+ */
+ public function setPreviousTypeId(?string $previousTypeId): void;
+}
diff --git a/lib/commercetools-api/src/Models/Message/RecurringOrderCustomTypeRemovedMessagePayloadBuilder.php b/lib/commercetools-api/src/Models/Message/RecurringOrderCustomTypeRemovedMessagePayloadBuilder.php
new file mode 100644
index 00000000000..35d5f5bc210
--- /dev/null
+++ b/lib/commercetools-api/src/Models/Message/RecurringOrderCustomTypeRemovedMessagePayloadBuilder.php
@@ -0,0 +1,63 @@
+
+ */
+final class RecurringOrderCustomTypeRemovedMessagePayloadBuilder implements Builder
+{
+ /**
+
+ * @var ?string
+ */
+ private $previousTypeId;
+
+ /**
+ * id of the Custom Type that was removed. Absent if there was no previous Custom Type present.
id of the Custom Type that was removed. Absent if there was no previous Custom Type present.
id of the previous Custom Type. Absent if there was no previous Custom Type present.
Unique identifier of the Message. Can be used to track which Messages have been processed.
+ * + + * @return null|string + */ + public function getId() + { + return $this->id; + } + + /** + *Version of a resource. In case of Messages, this is always 1.
Date and time (UTC) the Message was generated.
+ * + + * @return null|DateTimeImmutable + */ + public function getCreatedAt() + { + return $this->createdAt; + } + + /** + *Value of createdAt.
IDs and references that last modified the Message.
+ * + + * @return null|LastModifiedBy + */ + public function getLastModifiedBy() + { + return $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy; + } + + /** + *IDs and references that created the Message.
+ * + + * @return null|CreatedBy + */ + public function getCreatedBy() + { + return $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy; + } + + /** + *Message number in relation to other Messages for a given resource. The sequenceNumber of the next Message for the resource is the successor of the sequenceNumber of the current Message. Meaning, the sequenceNumber of the next Message equals the sequenceNumber of the current Message + 1.
+ * sequenceNumber can be used to ensure that Messages are processed in the correct order for a particular resource.
Reference to the resource on which the change or action was performed.
+ * + + * @return null|Reference + */ + public function getResource() + { + return $this->resource instanceof ReferenceBuilder ? $this->resource->build() : $this->resource; + } + + /** + *Version of the resource on which the change or action was performed.
+ * + + * @return null|int + */ + public function getResourceVersion() + { + return $this->resourceVersion; + } + + /** + *User-provided identifiers of the resource, such as key or externalId. Only present if the resource has such identifiers.
The Custom Fields that have been set.
+ * + + * @return null|CustomFields + */ + public function getCustomFields() + { + return $this->customFields instanceof CustomFieldsBuilder ? $this->customFields->build() : $this->customFields; + } + + /** + *id of the previous Custom Type. Absent if there was no previous Custom Type present.
Unique identifier of the Message. Can be used to track which Messages have been processed.
+ * + * + * @return null|string + */ + public function getId() + { + if (is_null($this->id)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_ID); + if (is_null($data)) { + return null; + } + $this->id = (string) $data; + } + + return $this->id; + } + + /** + *Version of a resource. In case of Messages, this is always 1.
Date and time (UTC) the Message was generated.
+ * + * + * @return null|DateTimeImmutable + */ + public function getCreatedAt() + { + if (is_null($this->createdAt)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CREATED_AT); + if (is_null($data)) { + return null; + } + $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data); + if (false === $data) { + return null; + } + $this->createdAt = $data; + } + + return $this->createdAt; + } + + /** + *Value of createdAt.
IDs and references that last modified the Message.
+ * + * + * @return null|LastModifiedBy + */ + public function getLastModifiedBy() + { + if (is_null($this->lastModifiedBy)) { + /** @psalm-var stdClass|arrayIDs and references that created the Message.
+ * + * + * @return null|CreatedBy + */ + public function getCreatedBy() + { + if (is_null($this->createdBy)) { + /** @psalm-var stdClass|arrayMessage number in relation to other Messages for a given resource. The sequenceNumber of the next Message for the resource is the successor of the sequenceNumber of the current Message. Meaning, the sequenceNumber of the next Message equals the sequenceNumber of the current Message + 1.
+ * sequenceNumber can be used to ensure that Messages are processed in the correct order for a particular resource.
Reference to the resource on which the change or action was performed.
+ * + * + * @return null|Reference + */ + public function getResource() + { + if (is_null($this->resource)) { + /** @psalm-var stdClass|arrayVersion of the resource on which the change or action was performed.
+ * + * + * @return null|int + */ + public function getResourceVersion() + { + if (is_null($this->resourceVersion)) { + /** @psalm-var ?int $data */ + $data = $this->raw(self::FIELD_RESOURCE_VERSION); + if (is_null($data)) { + return null; + } + $this->resourceVersion = (int) $data; + } + + return $this->resourceVersion; + } + + /** + *Message Type of the Message.
+ * + * + * @return null|string + */ + public function getType() + { + if (is_null($this->type)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_TYPE); + if (is_null($data)) { + return null; + } + $this->type = (string) $data; + } + + return $this->type; + } + + /** + *User-provided identifiers of the resource, such as key or externalId. Only present if the resource has such identifiers.
The Custom Fields that have been set.
+ * + * + * @return null|CustomFields + */ + public function getCustomFields() + { + if (is_null($this->customFields)) { + /** @psalm-var stdClass|arrayid of the previous Custom Type. Absent if there was no previous Custom Type present.
id of the previous Custom Type. Absent if there was no previous Custom Type present.
The Custom Fields that have been set.
+ * + + * @return null|CustomFields + */ + public function getCustomFields() + { + return $this->customFields instanceof CustomFieldsBuilder ? $this->customFields->build() : $this->customFields; + } + + /** + *id of the previous Custom Type. Absent if there was no previous Custom Type present.
The Custom Fields that have been set.
+ * + * + * @return null|CustomFields + */ + public function getCustomFields() + { + if (is_null($this->customFields)) { + /** @psalm-var stdClass|arrayid of the previous Custom Type. Absent if there was no previous Custom Type present.
key value of the RecurringOrder after the Set Key update action.
+ *
+
+ * @return null|string
+ */
+ public function getKey();
+
+ /**
+ * key value of the RecurringOrder before the Set Key update action.
Unique identifier of the Message. Can be used to track which Messages have been processed.
+ * + + * @return null|string + */ + public function getId() + { + return $this->id; + } + + /** + *Version of a resource. In case of Messages, this is always 1.
Date and time (UTC) the Message was generated.
+ * + + * @return null|DateTimeImmutable + */ + public function getCreatedAt() + { + return $this->createdAt; + } + + /** + *Value of createdAt.
IDs and references that last modified the Message.
+ * + + * @return null|LastModifiedBy + */ + public function getLastModifiedBy() + { + return $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy; + } + + /** + *IDs and references that created the Message.
+ * + + * @return null|CreatedBy + */ + public function getCreatedBy() + { + return $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy; + } + + /** + *Message number in relation to other Messages for a given resource. The sequenceNumber of the next Message for the resource is the successor of the sequenceNumber of the current Message. Meaning, the sequenceNumber of the next Message equals the sequenceNumber of the current Message + 1.
+ * sequenceNumber can be used to ensure that Messages are processed in the correct order for a particular resource.
Reference to the resource on which the change or action was performed.
+ * + + * @return null|Reference + */ + public function getResource() + { + return $this->resource instanceof ReferenceBuilder ? $this->resource->build() : $this->resource; + } + + /** + *Version of the resource on which the change or action was performed.
+ * + + * @return null|int + */ + public function getResourceVersion() + { + return $this->resourceVersion; + } + + /** + *User-provided identifiers of the resource, such as key or externalId. Only present if the resource has such identifiers.
key value of the RecurringOrder after the Set Key update action.
key value of the RecurringOrder before the Set Key update action.
Unique identifier of the Message. Can be used to track which Messages have been processed.
+ * + * + * @return null|string + */ + public function getId() + { + if (is_null($this->id)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_ID); + if (is_null($data)) { + return null; + } + $this->id = (string) $data; + } + + return $this->id; + } + + /** + *Version of a resource. In case of Messages, this is always 1.
Date and time (UTC) the Message was generated.
+ * + * + * @return null|DateTimeImmutable + */ + public function getCreatedAt() + { + if (is_null($this->createdAt)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CREATED_AT); + if (is_null($data)) { + return null; + } + $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data); + if (false === $data) { + return null; + } + $this->createdAt = $data; + } + + return $this->createdAt; + } + + /** + *Value of createdAt.
IDs and references that last modified the Message.
+ * + * + * @return null|LastModifiedBy + */ + public function getLastModifiedBy() + { + if (is_null($this->lastModifiedBy)) { + /** @psalm-var stdClass|arrayIDs and references that created the Message.
+ * + * + * @return null|CreatedBy + */ + public function getCreatedBy() + { + if (is_null($this->createdBy)) { + /** @psalm-var stdClass|arrayMessage number in relation to other Messages for a given resource. The sequenceNumber of the next Message for the resource is the successor of the sequenceNumber of the current Message. Meaning, the sequenceNumber of the next Message equals the sequenceNumber of the current Message + 1.
+ * sequenceNumber can be used to ensure that Messages are processed in the correct order for a particular resource.
Reference to the resource on which the change or action was performed.
+ * + * + * @return null|Reference + */ + public function getResource() + { + if (is_null($this->resource)) { + /** @psalm-var stdClass|arrayVersion of the resource on which the change or action was performed.
+ * + * + * @return null|int + */ + public function getResourceVersion() + { + if (is_null($this->resourceVersion)) { + /** @psalm-var ?int $data */ + $data = $this->raw(self::FIELD_RESOURCE_VERSION); + if (is_null($data)) { + return null; + } + $this->resourceVersion = (int) $data; + } + + return $this->resourceVersion; + } + + /** + *Message Type of the Message.
+ * + * + * @return null|string + */ + public function getType() + { + if (is_null($this->type)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_TYPE); + if (is_null($data)) { + return null; + } + $this->type = (string) $data; + } + + return $this->type; + } + + /** + *User-provided identifiers of the resource, such as key or externalId. Only present if the resource has such identifiers.
key value of the RecurringOrder after the Set Key update action.
key value of the RecurringOrder before the Set Key update action.
key value of the RecurringOrder after the Set Key update action.
+ *
+
+ * @return null|string
+ */
+ public function getKey();
+
+ /**
+ * key value of the RecurringOrder before the Set Key update action.
key value of the RecurringOrder after the Set Key update action.
key value of the RecurringOrder before the Set Key update action.
key value of the RecurringOrder after the Set Key update action.
key value of the RecurringOrder before the Set Key update action.
Schedule of the Recurring Order before the Set Schedule update action.
+ * + + * @return null|RecurrencePolicySchedule + */ + public function getOldRecurrencePolicySchedule(); + + /** + * @param ?RecurrencePolicySchedule $recurrencePolicySchedule + */ + public function setRecurrencePolicySchedule(?RecurrencePolicySchedule $recurrencePolicySchedule): void; + + /** + * @param ?RecurrencePolicySchedule $oldRecurrencePolicySchedule + */ + public function setOldRecurrencePolicySchedule(?RecurrencePolicySchedule $oldRecurrencePolicySchedule): void; +} diff --git a/lib/commercetools-api/src/Models/Message/RecurringOrderScheduleSetMessageBuilder.php b/lib/commercetools-api/src/Models/Message/RecurringOrderScheduleSetMessageBuilder.php new file mode 100644 index 00000000000..a63cb8815e5 --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/RecurringOrderScheduleSetMessageBuilder.php @@ -0,0 +1,457 @@ + + */ +final class RecurringOrderScheduleSetMessageBuilder implements Builder +{ + /** + + * @var ?string + */ + private $id; + + /** + + * @var ?int + */ + private $version; + + /** + + * @var ?DateTimeImmutable + */ + private $createdAt; + + /** + + * @var ?DateTimeImmutable + */ + private $lastModifiedAt; + + /** + + * @var null|LastModifiedBy|LastModifiedByBuilder + */ + private $lastModifiedBy; + + /** + + * @var null|CreatedBy|CreatedByBuilder + */ + private $createdBy; + + /** + + * @var ?int + */ + private $sequenceNumber; + + /** + + * @var null|Reference|ReferenceBuilder + */ + private $resource; + + /** + + * @var ?int + */ + private $resourceVersion; + + /** + + * @var null|UserProvidedIdentifiers|UserProvidedIdentifiersBuilder + */ + private $resourceUserProvidedIdentifiers; + + /** + + * @var null|RecurrencePolicySchedule|RecurrencePolicyScheduleBuilder + */ + private $recurrencePolicySchedule; + + /** + + * @var null|RecurrencePolicySchedule|RecurrencePolicyScheduleBuilder + */ + private $oldRecurrencePolicySchedule; + + /** + *Unique identifier of the Message. Can be used to track which Messages have been processed.
+ * + + * @return null|string + */ + public function getId() + { + return $this->id; + } + + /** + *Version of a resource. In case of Messages, this is always 1.
Date and time (UTC) the Message was generated.
+ * + + * @return null|DateTimeImmutable + */ + public function getCreatedAt() + { + return $this->createdAt; + } + + /** + *Value of createdAt.
IDs and references that last modified the Message.
+ * + + * @return null|LastModifiedBy + */ + public function getLastModifiedBy() + { + return $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy; + } + + /** + *IDs and references that created the Message.
+ * + + * @return null|CreatedBy + */ + public function getCreatedBy() + { + return $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy; + } + + /** + *Message number in relation to other Messages for a given resource. The sequenceNumber of the next Message for the resource is the successor of the sequenceNumber of the current Message. Meaning, the sequenceNumber of the next Message equals the sequenceNumber of the current Message + 1.
+ * sequenceNumber can be used to ensure that Messages are processed in the correct order for a particular resource.
Reference to the resource on which the change or action was performed.
+ * + + * @return null|Reference + */ + public function getResource() + { + return $this->resource instanceof ReferenceBuilder ? $this->resource->build() : $this->resource; + } + + /** + *Version of the resource on which the change or action was performed.
+ * + + * @return null|int + */ + public function getResourceVersion() + { + return $this->resourceVersion; + } + + /** + *User-provided identifiers of the resource, such as key or externalId. Only present if the resource has such identifiers.
Schedule of the Recurring Order after the Set Schedule update action.
+ * + + * @return null|RecurrencePolicySchedule + */ + public function getRecurrencePolicySchedule() + { + return $this->recurrencePolicySchedule instanceof RecurrencePolicyScheduleBuilder ? $this->recurrencePolicySchedule->build() : $this->recurrencePolicySchedule; + } + + /** + *Schedule of the Recurring Order before the Set Schedule update action.
+ * + + * @return null|RecurrencePolicySchedule + */ + public function getOldRecurrencePolicySchedule() + { + return $this->oldRecurrencePolicySchedule instanceof RecurrencePolicyScheduleBuilder ? $this->oldRecurrencePolicySchedule->build() : $this->oldRecurrencePolicySchedule; + } + + /** + * @param ?string $id + * @return $this + */ + public function withId(?string $id) + { + $this->id = $id; + + return $this; + } + + /** + * @param ?int $version + * @return $this + */ + public function withVersion(?int $version) + { + $this->version = $version; + + return $this; + } + + /** + * @param ?DateTimeImmutable $createdAt + * @return $this + */ + public function withCreatedAt(?DateTimeImmutable $createdAt) + { + $this->createdAt = $createdAt; + + return $this; + } + + /** + * @param ?DateTimeImmutable $lastModifiedAt + * @return $this + */ + public function withLastModifiedAt(?DateTimeImmutable $lastModifiedAt) + { + $this->lastModifiedAt = $lastModifiedAt; + + return $this; + } + + /** + * @param ?LastModifiedBy $lastModifiedBy + * @return $this + */ + public function withLastModifiedBy(?LastModifiedBy $lastModifiedBy) + { + $this->lastModifiedBy = $lastModifiedBy; + + return $this; + } + + /** + * @param ?CreatedBy $createdBy + * @return $this + */ + public function withCreatedBy(?CreatedBy $createdBy) + { + $this->createdBy = $createdBy; + + return $this; + } + + /** + * @param ?int $sequenceNumber + * @return $this + */ + public function withSequenceNumber(?int $sequenceNumber) + { + $this->sequenceNumber = $sequenceNumber; + + return $this; + } + + /** + * @param ?Reference $resource + * @return $this + */ + public function withResource(?Reference $resource) + { + $this->resource = $resource; + + return $this; + } + + /** + * @param ?int $resourceVersion + * @return $this + */ + public function withResourceVersion(?int $resourceVersion) + { + $this->resourceVersion = $resourceVersion; + + return $this; + } + + /** + * @param ?UserProvidedIdentifiers $resourceUserProvidedIdentifiers + * @return $this + */ + public function withResourceUserProvidedIdentifiers(?UserProvidedIdentifiers $resourceUserProvidedIdentifiers) + { + $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers; + + return $this; + } + + /** + * @param ?RecurrencePolicySchedule $recurrencePolicySchedule + * @return $this + */ + public function withRecurrencePolicySchedule(?RecurrencePolicySchedule $recurrencePolicySchedule) + { + $this->recurrencePolicySchedule = $recurrencePolicySchedule; + + return $this; + } + + /** + * @param ?RecurrencePolicySchedule $oldRecurrencePolicySchedule + * @return $this + */ + public function withOldRecurrencePolicySchedule(?RecurrencePolicySchedule $oldRecurrencePolicySchedule) + { + $this->oldRecurrencePolicySchedule = $oldRecurrencePolicySchedule; + + return $this; + } + + /** + * @deprecated use withLastModifiedBy() instead + * @return $this + */ + public function withLastModifiedByBuilder(?LastModifiedByBuilder $lastModifiedBy) + { + $this->lastModifiedBy = $lastModifiedBy; + + return $this; + } + + /** + * @deprecated use withCreatedBy() instead + * @return $this + */ + public function withCreatedByBuilder(?CreatedByBuilder $createdBy) + { + $this->createdBy = $createdBy; + + return $this; + } + + /** + * @deprecated use withResource() instead + * @return $this + */ + public function withResourceBuilder(?ReferenceBuilder $resource) + { + $this->resource = $resource; + + return $this; + } + + /** + * @deprecated use withResourceUserProvidedIdentifiers() instead + * @return $this + */ + public function withResourceUserProvidedIdentifiersBuilder(?UserProvidedIdentifiersBuilder $resourceUserProvidedIdentifiers) + { + $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers; + + return $this; + } + + /** + * @deprecated use withRecurrencePolicySchedule() instead + * @return $this + */ + public function withRecurrencePolicyScheduleBuilder(?RecurrencePolicyScheduleBuilder $recurrencePolicySchedule) + { + $this->recurrencePolicySchedule = $recurrencePolicySchedule; + + return $this; + } + + /** + * @deprecated use withOldRecurrencePolicySchedule() instead + * @return $this + */ + public function withOldRecurrencePolicyScheduleBuilder(?RecurrencePolicyScheduleBuilder $oldRecurrencePolicySchedule) + { + $this->oldRecurrencePolicySchedule = $oldRecurrencePolicySchedule; + + return $this; + } + + public function build(): RecurringOrderScheduleSetMessage + { + return new RecurringOrderScheduleSetMessageModel( + $this->id, + $this->version, + $this->createdAt, + $this->lastModifiedAt, + $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy, + $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy, + $this->sequenceNumber, + $this->resource instanceof ReferenceBuilder ? $this->resource->build() : $this->resource, + $this->resourceVersion, + $this->resourceUserProvidedIdentifiers instanceof UserProvidedIdentifiersBuilder ? $this->resourceUserProvidedIdentifiers->build() : $this->resourceUserProvidedIdentifiers, + $this->recurrencePolicySchedule instanceof RecurrencePolicyScheduleBuilder ? $this->recurrencePolicySchedule->build() : $this->recurrencePolicySchedule, + $this->oldRecurrencePolicySchedule instanceof RecurrencePolicyScheduleBuilder ? $this->oldRecurrencePolicySchedule->build() : $this->oldRecurrencePolicySchedule + ); + } + + public static function of(): RecurringOrderScheduleSetMessageBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/Message/RecurringOrderScheduleSetMessageCollection.php b/lib/commercetools-api/src/Models/Message/RecurringOrderScheduleSetMessageCollection.php new file mode 100644 index 00000000000..acb529ec0ca --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/RecurringOrderScheduleSetMessageCollection.php @@ -0,0 +1,56 @@ + + * @method RecurringOrderScheduleSetMessage current() + * @method RecurringOrderScheduleSetMessage end() + * @method RecurringOrderScheduleSetMessage at($offset) + */ +class RecurringOrderScheduleSetMessageCollection extends MessageCollection +{ + /** + * @psalm-assert RecurringOrderScheduleSetMessage $value + * @psalm-param RecurringOrderScheduleSetMessage|stdClass $value + * @throws InvalidArgumentException + * + * @return RecurringOrderScheduleSetMessageCollection + */ + public function add($value) + { + if (!$value instanceof RecurringOrderScheduleSetMessage) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?RecurringOrderScheduleSetMessage + */ + protected function mapper() + { + return function (?int $index): ?RecurringOrderScheduleSetMessage { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var RecurringOrderScheduleSetMessage $data */ + $data = RecurringOrderScheduleSetMessageModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/Message/RecurringOrderScheduleSetMessageModel.php b/lib/commercetools-api/src/Models/Message/RecurringOrderScheduleSetMessageModel.php new file mode 100644 index 00000000000..c24046fd7a8 --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/RecurringOrderScheduleSetMessageModel.php @@ -0,0 +1,530 @@ +id = $id; + $this->version = $version; + $this->createdAt = $createdAt; + $this->lastModifiedAt = $lastModifiedAt; + $this->lastModifiedBy = $lastModifiedBy; + $this->createdBy = $createdBy; + $this->sequenceNumber = $sequenceNumber; + $this->resource = $resource; + $this->resourceVersion = $resourceVersion; + $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers; + $this->recurrencePolicySchedule = $recurrencePolicySchedule; + $this->oldRecurrencePolicySchedule = $oldRecurrencePolicySchedule; + $this->type = $type ?? self::DISCRIMINATOR_VALUE; + } + + /** + *Unique identifier of the Message. Can be used to track which Messages have been processed.
+ * + * + * @return null|string + */ + public function getId() + { + if (is_null($this->id)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_ID); + if (is_null($data)) { + return null; + } + $this->id = (string) $data; + } + + return $this->id; + } + + /** + *Version of a resource. In case of Messages, this is always 1.
Date and time (UTC) the Message was generated.
+ * + * + * @return null|DateTimeImmutable + */ + public function getCreatedAt() + { + if (is_null($this->createdAt)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CREATED_AT); + if (is_null($data)) { + return null; + } + $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data); + if (false === $data) { + return null; + } + $this->createdAt = $data; + } + + return $this->createdAt; + } + + /** + *Value of createdAt.
IDs and references that last modified the Message.
+ * + * + * @return null|LastModifiedBy + */ + public function getLastModifiedBy() + { + if (is_null($this->lastModifiedBy)) { + /** @psalm-var stdClass|arrayIDs and references that created the Message.
+ * + * + * @return null|CreatedBy + */ + public function getCreatedBy() + { + if (is_null($this->createdBy)) { + /** @psalm-var stdClass|arrayMessage number in relation to other Messages for a given resource. The sequenceNumber of the next Message for the resource is the successor of the sequenceNumber of the current Message. Meaning, the sequenceNumber of the next Message equals the sequenceNumber of the current Message + 1.
+ * sequenceNumber can be used to ensure that Messages are processed in the correct order for a particular resource.
Reference to the resource on which the change or action was performed.
+ * + * + * @return null|Reference + */ + public function getResource() + { + if (is_null($this->resource)) { + /** @psalm-var stdClass|arrayVersion of the resource on which the change or action was performed.
+ * + * + * @return null|int + */ + public function getResourceVersion() + { + if (is_null($this->resourceVersion)) { + /** @psalm-var ?int $data */ + $data = $this->raw(self::FIELD_RESOURCE_VERSION); + if (is_null($data)) { + return null; + } + $this->resourceVersion = (int) $data; + } + + return $this->resourceVersion; + } + + /** + *Message Type of the Message.
+ * + * + * @return null|string + */ + public function getType() + { + if (is_null($this->type)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_TYPE); + if (is_null($data)) { + return null; + } + $this->type = (string) $data; + } + + return $this->type; + } + + /** + *User-provided identifiers of the resource, such as key or externalId. Only present if the resource has such identifiers.
Schedule of the Recurring Order after the Set Schedule update action.
+ * + * + * @return null|RecurrencePolicySchedule + */ + public function getRecurrencePolicySchedule() + { + if (is_null($this->recurrencePolicySchedule)) { + /** @psalm-var stdClass|arraySchedule of the Recurring Order before the Set Schedule update action.
+ * + * + * @return null|RecurrencePolicySchedule + */ + public function getOldRecurrencePolicySchedule() + { + if (is_null($this->oldRecurrencePolicySchedule)) { + /** @psalm-var stdClass|arraySchedule of the Recurring Order before the Set Schedule update action.
+ * + + * @return null|RecurrencePolicySchedule + */ + public function getOldRecurrencePolicySchedule(); + + /** + * @param ?RecurrencePolicySchedule $recurrencePolicySchedule + */ + public function setRecurrencePolicySchedule(?RecurrencePolicySchedule $recurrencePolicySchedule): void; + + /** + * @param ?RecurrencePolicySchedule $oldRecurrencePolicySchedule + */ + public function setOldRecurrencePolicySchedule(?RecurrencePolicySchedule $oldRecurrencePolicySchedule): void; +} diff --git a/lib/commercetools-api/src/Models/Message/RecurringOrderScheduleSetMessagePayloadBuilder.php b/lib/commercetools-api/src/Models/Message/RecurringOrderScheduleSetMessagePayloadBuilder.php new file mode 100644 index 00000000000..92bfdcec565 --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/RecurringOrderScheduleSetMessagePayloadBuilder.php @@ -0,0 +1,115 @@ + + */ +final class RecurringOrderScheduleSetMessagePayloadBuilder implements Builder +{ + /** + + * @var null|RecurrencePolicySchedule|RecurrencePolicyScheduleBuilder + */ + private $recurrencePolicySchedule; + + /** + + * @var null|RecurrencePolicySchedule|RecurrencePolicyScheduleBuilder + */ + private $oldRecurrencePolicySchedule; + + /** + *Schedule of the Recurring Order after the Set Schedule update action.
+ * + + * @return null|RecurrencePolicySchedule + */ + public function getRecurrencePolicySchedule() + { + return $this->recurrencePolicySchedule instanceof RecurrencePolicyScheduleBuilder ? $this->recurrencePolicySchedule->build() : $this->recurrencePolicySchedule; + } + + /** + *Schedule of the Recurring Order before the Set Schedule update action.
+ * + + * @return null|RecurrencePolicySchedule + */ + public function getOldRecurrencePolicySchedule() + { + return $this->oldRecurrencePolicySchedule instanceof RecurrencePolicyScheduleBuilder ? $this->oldRecurrencePolicySchedule->build() : $this->oldRecurrencePolicySchedule; + } + + /** + * @param ?RecurrencePolicySchedule $recurrencePolicySchedule + * @return $this + */ + public function withRecurrencePolicySchedule(?RecurrencePolicySchedule $recurrencePolicySchedule) + { + $this->recurrencePolicySchedule = $recurrencePolicySchedule; + + return $this; + } + + /** + * @param ?RecurrencePolicySchedule $oldRecurrencePolicySchedule + * @return $this + */ + public function withOldRecurrencePolicySchedule(?RecurrencePolicySchedule $oldRecurrencePolicySchedule) + { + $this->oldRecurrencePolicySchedule = $oldRecurrencePolicySchedule; + + return $this; + } + + /** + * @deprecated use withRecurrencePolicySchedule() instead + * @return $this + */ + public function withRecurrencePolicyScheduleBuilder(?RecurrencePolicyScheduleBuilder $recurrencePolicySchedule) + { + $this->recurrencePolicySchedule = $recurrencePolicySchedule; + + return $this; + } + + /** + * @deprecated use withOldRecurrencePolicySchedule() instead + * @return $this + */ + public function withOldRecurrencePolicyScheduleBuilder(?RecurrencePolicyScheduleBuilder $oldRecurrencePolicySchedule) + { + $this->oldRecurrencePolicySchedule = $oldRecurrencePolicySchedule; + + return $this; + } + + public function build(): RecurringOrderScheduleSetMessagePayload + { + return new RecurringOrderScheduleSetMessagePayloadModel( + $this->recurrencePolicySchedule instanceof RecurrencePolicyScheduleBuilder ? $this->recurrencePolicySchedule->build() : $this->recurrencePolicySchedule, + $this->oldRecurrencePolicySchedule instanceof RecurrencePolicyScheduleBuilder ? $this->oldRecurrencePolicySchedule->build() : $this->oldRecurrencePolicySchedule + ); + } + + public static function of(): RecurringOrderScheduleSetMessagePayloadBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/Message/RecurringOrderScheduleSetMessagePayloadCollection.php b/lib/commercetools-api/src/Models/Message/RecurringOrderScheduleSetMessagePayloadCollection.php new file mode 100644 index 00000000000..d52fdbd0b46 --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/RecurringOrderScheduleSetMessagePayloadCollection.php @@ -0,0 +1,56 @@ + + * @method RecurringOrderScheduleSetMessagePayload current() + * @method RecurringOrderScheduleSetMessagePayload end() + * @method RecurringOrderScheduleSetMessagePayload at($offset) + */ +class RecurringOrderScheduleSetMessagePayloadCollection extends MessagePayloadCollection +{ + /** + * @psalm-assert RecurringOrderScheduleSetMessagePayload $value + * @psalm-param RecurringOrderScheduleSetMessagePayload|stdClass $value + * @throws InvalidArgumentException + * + * @return RecurringOrderScheduleSetMessagePayloadCollection + */ + public function add($value) + { + if (!$value instanceof RecurringOrderScheduleSetMessagePayload) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?RecurringOrderScheduleSetMessagePayload + */ + protected function mapper() + { + return function (?int $index): ?RecurringOrderScheduleSetMessagePayload { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var RecurringOrderScheduleSetMessagePayload $data */ + $data = RecurringOrderScheduleSetMessagePayloadModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/Message/RecurringOrderScheduleSetMessagePayloadModel.php b/lib/commercetools-api/src/Models/Message/RecurringOrderScheduleSetMessagePayloadModel.php new file mode 100644 index 00000000000..3ff86dec0a8 --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/RecurringOrderScheduleSetMessagePayloadModel.php @@ -0,0 +1,133 @@ +recurrencePolicySchedule = $recurrencePolicySchedule; + $this->oldRecurrencePolicySchedule = $oldRecurrencePolicySchedule; + $this->type = $type ?? self::DISCRIMINATOR_VALUE; + } + + /** + * + * @return null|string + */ + public function getType() + { + if (is_null($this->type)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_TYPE); + if (is_null($data)) { + return null; + } + $this->type = (string) $data; + } + + return $this->type; + } + + /** + *Schedule of the Recurring Order after the Set Schedule update action.
+ * + * + * @return null|RecurrencePolicySchedule + */ + public function getRecurrencePolicySchedule() + { + if (is_null($this->recurrencePolicySchedule)) { + /** @psalm-var stdClass|arraySchedule of the Recurring Order before the Set Schedule update action.
+ * + * + * @return null|RecurrencePolicySchedule + */ + public function getOldRecurrencePolicySchedule() + { + if (is_null($this->oldRecurrencePolicySchedule)) { + /** @psalm-var stdClass|arrayStart date and time of the Recurring Order before the Set Starts At update action.
+ * + + * @return null|DateTimeImmutable + */ + public function getOldStartsAt(); + + /** + * @param ?DateTimeImmutable $startsAt + */ + public function setStartsAt(?DateTimeImmutable $startsAt): void; + + /** + * @param ?DateTimeImmutable $oldStartsAt + */ + public function setOldStartsAt(?DateTimeImmutable $oldStartsAt): void; +} diff --git a/lib/commercetools-api/src/Models/Message/RecurringOrderStartsAtSetMessageBuilder.php b/lib/commercetools-api/src/Models/Message/RecurringOrderStartsAtSetMessageBuilder.php new file mode 100644 index 00000000000..fb23ea7037e --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/RecurringOrderStartsAtSetMessageBuilder.php @@ -0,0 +1,433 @@ + + */ +final class RecurringOrderStartsAtSetMessageBuilder implements Builder +{ + /** + + * @var ?string + */ + private $id; + + /** + + * @var ?int + */ + private $version; + + /** + + * @var ?DateTimeImmutable + */ + private $createdAt; + + /** + + * @var ?DateTimeImmutable + */ + private $lastModifiedAt; + + /** + + * @var null|LastModifiedBy|LastModifiedByBuilder + */ + private $lastModifiedBy; + + /** + + * @var null|CreatedBy|CreatedByBuilder + */ + private $createdBy; + + /** + + * @var ?int + */ + private $sequenceNumber; + + /** + + * @var null|Reference|ReferenceBuilder + */ + private $resource; + + /** + + * @var ?int + */ + private $resourceVersion; + + /** + + * @var null|UserProvidedIdentifiers|UserProvidedIdentifiersBuilder + */ + private $resourceUserProvidedIdentifiers; + + /** + + * @var ?DateTimeImmutable + */ + private $startsAt; + + /** + + * @var ?DateTimeImmutable + */ + private $oldStartsAt; + + /** + *Unique identifier of the Message. Can be used to track which Messages have been processed.
+ * + + * @return null|string + */ + public function getId() + { + return $this->id; + } + + /** + *Version of a resource. In case of Messages, this is always 1.
Date and time (UTC) the Message was generated.
+ * + + * @return null|DateTimeImmutable + */ + public function getCreatedAt() + { + return $this->createdAt; + } + + /** + *Value of createdAt.
IDs and references that last modified the Message.
+ * + + * @return null|LastModifiedBy + */ + public function getLastModifiedBy() + { + return $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy; + } + + /** + *IDs and references that created the Message.
+ * + + * @return null|CreatedBy + */ + public function getCreatedBy() + { + return $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy; + } + + /** + *Message number in relation to other Messages for a given resource. The sequenceNumber of the next Message for the resource is the successor of the sequenceNumber of the current Message. Meaning, the sequenceNumber of the next Message equals the sequenceNumber of the current Message + 1.
+ * sequenceNumber can be used to ensure that Messages are processed in the correct order for a particular resource.
Reference to the resource on which the change or action was performed.
+ * + + * @return null|Reference + */ + public function getResource() + { + return $this->resource instanceof ReferenceBuilder ? $this->resource->build() : $this->resource; + } + + /** + *Version of the resource on which the change or action was performed.
+ * + + * @return null|int + */ + public function getResourceVersion() + { + return $this->resourceVersion; + } + + /** + *User-provided identifiers of the resource, such as key or externalId. Only present if the resource has such identifiers.
Start date and time of the Recurring Order after the Set Starts At update action.
+ * + + * @return null|DateTimeImmutable + */ + public function getStartsAt() + { + return $this->startsAt; + } + + /** + *Start date and time of the Recurring Order before the Set Starts At update action.
+ * + + * @return null|DateTimeImmutable + */ + public function getOldStartsAt() + { + return $this->oldStartsAt; + } + + /** + * @param ?string $id + * @return $this + */ + public function withId(?string $id) + { + $this->id = $id; + + return $this; + } + + /** + * @param ?int $version + * @return $this + */ + public function withVersion(?int $version) + { + $this->version = $version; + + return $this; + } + + /** + * @param ?DateTimeImmutable $createdAt + * @return $this + */ + public function withCreatedAt(?DateTimeImmutable $createdAt) + { + $this->createdAt = $createdAt; + + return $this; + } + + /** + * @param ?DateTimeImmutable $lastModifiedAt + * @return $this + */ + public function withLastModifiedAt(?DateTimeImmutable $lastModifiedAt) + { + $this->lastModifiedAt = $lastModifiedAt; + + return $this; + } + + /** + * @param ?LastModifiedBy $lastModifiedBy + * @return $this + */ + public function withLastModifiedBy(?LastModifiedBy $lastModifiedBy) + { + $this->lastModifiedBy = $lastModifiedBy; + + return $this; + } + + /** + * @param ?CreatedBy $createdBy + * @return $this + */ + public function withCreatedBy(?CreatedBy $createdBy) + { + $this->createdBy = $createdBy; + + return $this; + } + + /** + * @param ?int $sequenceNumber + * @return $this + */ + public function withSequenceNumber(?int $sequenceNumber) + { + $this->sequenceNumber = $sequenceNumber; + + return $this; + } + + /** + * @param ?Reference $resource + * @return $this + */ + public function withResource(?Reference $resource) + { + $this->resource = $resource; + + return $this; + } + + /** + * @param ?int $resourceVersion + * @return $this + */ + public function withResourceVersion(?int $resourceVersion) + { + $this->resourceVersion = $resourceVersion; + + return $this; + } + + /** + * @param ?UserProvidedIdentifiers $resourceUserProvidedIdentifiers + * @return $this + */ + public function withResourceUserProvidedIdentifiers(?UserProvidedIdentifiers $resourceUserProvidedIdentifiers) + { + $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers; + + return $this; + } + + /** + * @param ?DateTimeImmutable $startsAt + * @return $this + */ + public function withStartsAt(?DateTimeImmutable $startsAt) + { + $this->startsAt = $startsAt; + + return $this; + } + + /** + * @param ?DateTimeImmutable $oldStartsAt + * @return $this + */ + public function withOldStartsAt(?DateTimeImmutable $oldStartsAt) + { + $this->oldStartsAt = $oldStartsAt; + + return $this; + } + + /** + * @deprecated use withLastModifiedBy() instead + * @return $this + */ + public function withLastModifiedByBuilder(?LastModifiedByBuilder $lastModifiedBy) + { + $this->lastModifiedBy = $lastModifiedBy; + + return $this; + } + + /** + * @deprecated use withCreatedBy() instead + * @return $this + */ + public function withCreatedByBuilder(?CreatedByBuilder $createdBy) + { + $this->createdBy = $createdBy; + + return $this; + } + + /** + * @deprecated use withResource() instead + * @return $this + */ + public function withResourceBuilder(?ReferenceBuilder $resource) + { + $this->resource = $resource; + + return $this; + } + + /** + * @deprecated use withResourceUserProvidedIdentifiers() instead + * @return $this + */ + public function withResourceUserProvidedIdentifiersBuilder(?UserProvidedIdentifiersBuilder $resourceUserProvidedIdentifiers) + { + $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers; + + return $this; + } + + public function build(): RecurringOrderStartsAtSetMessage + { + return new RecurringOrderStartsAtSetMessageModel( + $this->id, + $this->version, + $this->createdAt, + $this->lastModifiedAt, + $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy, + $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy, + $this->sequenceNumber, + $this->resource instanceof ReferenceBuilder ? $this->resource->build() : $this->resource, + $this->resourceVersion, + $this->resourceUserProvidedIdentifiers instanceof UserProvidedIdentifiersBuilder ? $this->resourceUserProvidedIdentifiers->build() : $this->resourceUserProvidedIdentifiers, + $this->startsAt, + $this->oldStartsAt + ); + } + + public static function of(): RecurringOrderStartsAtSetMessageBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/Message/RecurringOrderStartsAtSetMessageCollection.php b/lib/commercetools-api/src/Models/Message/RecurringOrderStartsAtSetMessageCollection.php new file mode 100644 index 00000000000..b4eab0b17e1 --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/RecurringOrderStartsAtSetMessageCollection.php @@ -0,0 +1,56 @@ + + * @method RecurringOrderStartsAtSetMessage current() + * @method RecurringOrderStartsAtSetMessage end() + * @method RecurringOrderStartsAtSetMessage at($offset) + */ +class RecurringOrderStartsAtSetMessageCollection extends MessageCollection +{ + /** + * @psalm-assert RecurringOrderStartsAtSetMessage $value + * @psalm-param RecurringOrderStartsAtSetMessage|stdClass $value + * @throws InvalidArgumentException + * + * @return RecurringOrderStartsAtSetMessageCollection + */ + public function add($value) + { + if (!$value instanceof RecurringOrderStartsAtSetMessage) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?RecurringOrderStartsAtSetMessage + */ + protected function mapper() + { + return function (?int $index): ?RecurringOrderStartsAtSetMessage { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var RecurringOrderStartsAtSetMessage $data */ + $data = RecurringOrderStartsAtSetMessageModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/Message/RecurringOrderStartsAtSetMessageModel.php b/lib/commercetools-api/src/Models/Message/RecurringOrderStartsAtSetMessageModel.php new file mode 100644 index 00000000000..7a744ebc508 --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/RecurringOrderStartsAtSetMessageModel.php @@ -0,0 +1,542 @@ +id = $id; + $this->version = $version; + $this->createdAt = $createdAt; + $this->lastModifiedAt = $lastModifiedAt; + $this->lastModifiedBy = $lastModifiedBy; + $this->createdBy = $createdBy; + $this->sequenceNumber = $sequenceNumber; + $this->resource = $resource; + $this->resourceVersion = $resourceVersion; + $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers; + $this->startsAt = $startsAt; + $this->oldStartsAt = $oldStartsAt; + $this->type = $type ?? self::DISCRIMINATOR_VALUE; + } + + /** + *Unique identifier of the Message. Can be used to track which Messages have been processed.
+ * + * + * @return null|string + */ + public function getId() + { + if (is_null($this->id)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_ID); + if (is_null($data)) { + return null; + } + $this->id = (string) $data; + } + + return $this->id; + } + + /** + *Version of a resource. In case of Messages, this is always 1.
Date and time (UTC) the Message was generated.
+ * + * + * @return null|DateTimeImmutable + */ + public function getCreatedAt() + { + if (is_null($this->createdAt)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CREATED_AT); + if (is_null($data)) { + return null; + } + $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data); + if (false === $data) { + return null; + } + $this->createdAt = $data; + } + + return $this->createdAt; + } + + /** + *Value of createdAt.
IDs and references that last modified the Message.
+ * + * + * @return null|LastModifiedBy + */ + public function getLastModifiedBy() + { + if (is_null($this->lastModifiedBy)) { + /** @psalm-var stdClass|arrayIDs and references that created the Message.
+ * + * + * @return null|CreatedBy + */ + public function getCreatedBy() + { + if (is_null($this->createdBy)) { + /** @psalm-var stdClass|arrayMessage number in relation to other Messages for a given resource. The sequenceNumber of the next Message for the resource is the successor of the sequenceNumber of the current Message. Meaning, the sequenceNumber of the next Message equals the sequenceNumber of the current Message + 1.
+ * sequenceNumber can be used to ensure that Messages are processed in the correct order for a particular resource.
Reference to the resource on which the change or action was performed.
+ * + * + * @return null|Reference + */ + public function getResource() + { + if (is_null($this->resource)) { + /** @psalm-var stdClass|arrayVersion of the resource on which the change or action was performed.
+ * + * + * @return null|int + */ + public function getResourceVersion() + { + if (is_null($this->resourceVersion)) { + /** @psalm-var ?int $data */ + $data = $this->raw(self::FIELD_RESOURCE_VERSION); + if (is_null($data)) { + return null; + } + $this->resourceVersion = (int) $data; + } + + return $this->resourceVersion; + } + + /** + *Message Type of the Message.
+ * + * + * @return null|string + */ + public function getType() + { + if (is_null($this->type)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_TYPE); + if (is_null($data)) { + return null; + } + $this->type = (string) $data; + } + + return $this->type; + } + + /** + *User-provided identifiers of the resource, such as key or externalId. Only present if the resource has such identifiers.
Start date and time of the Recurring Order after the Set Starts At update action.
+ * + * + * @return null|DateTimeImmutable + */ + public function getStartsAt() + { + if (is_null($this->startsAt)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_STARTS_AT); + if (is_null($data)) { + return null; + } + $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data); + if (false === $data) { + return null; + } + $this->startsAt = $data; + } + + return $this->startsAt; + } + + /** + *Start date and time of the Recurring Order before the Set Starts At update action.
+ * + * + * @return null|DateTimeImmutable + */ + public function getOldStartsAt() + { + if (is_null($this->oldStartsAt)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_OLD_STARTS_AT); + if (is_null($data)) { + return null; + } + $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data); + if (false === $data) { + return null; + } + $this->oldStartsAt = $data; + } + + return $this->oldStartsAt; + } + + + /** + * @param ?string $id + */ + public function setId(?string $id): void + { + $this->id = $id; + } + + /** + * @param ?int $version + */ + public function setVersion(?int $version): void + { + $this->version = $version; + } + + /** + * @param ?DateTimeImmutable $createdAt + */ + public function setCreatedAt(?DateTimeImmutable $createdAt): void + { + $this->createdAt = $createdAt; + } + + /** + * @param ?DateTimeImmutable $lastModifiedAt + */ + public function setLastModifiedAt(?DateTimeImmutable $lastModifiedAt): void + { + $this->lastModifiedAt = $lastModifiedAt; + } + + /** + * @param ?LastModifiedBy $lastModifiedBy + */ + public function setLastModifiedBy(?LastModifiedBy $lastModifiedBy): void + { + $this->lastModifiedBy = $lastModifiedBy; + } + + /** + * @param ?CreatedBy $createdBy + */ + public function setCreatedBy(?CreatedBy $createdBy): void + { + $this->createdBy = $createdBy; + } + + /** + * @param ?int $sequenceNumber + */ + public function setSequenceNumber(?int $sequenceNumber): void + { + $this->sequenceNumber = $sequenceNumber; + } + + /** + * @param ?Reference $resource + */ + public function setResource(?Reference $resource): void + { + $this->resource = $resource; + } + + /** + * @param ?int $resourceVersion + */ + public function setResourceVersion(?int $resourceVersion): void + { + $this->resourceVersion = $resourceVersion; + } + + /** + * @param ?UserProvidedIdentifiers $resourceUserProvidedIdentifiers + */ + public function setResourceUserProvidedIdentifiers(?UserProvidedIdentifiers $resourceUserProvidedIdentifiers): void + { + $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers; + } + + /** + * @param ?DateTimeImmutable $startsAt + */ + public function setStartsAt(?DateTimeImmutable $startsAt): void + { + $this->startsAt = $startsAt; + } + + /** + * @param ?DateTimeImmutable $oldStartsAt + */ + public function setOldStartsAt(?DateTimeImmutable $oldStartsAt): void + { + $this->oldStartsAt = $oldStartsAt; + } + + + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + $data = $this->toArray(); + if (isset($data[Message::FIELD_CREATED_AT]) && $data[Message::FIELD_CREATED_AT] instanceof \DateTimeImmutable) { + $data[Message::FIELD_CREATED_AT] = $data[Message::FIELD_CREATED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c'); + } + + if (isset($data[Message::FIELD_LAST_MODIFIED_AT]) && $data[Message::FIELD_LAST_MODIFIED_AT] instanceof \DateTimeImmutable) { + $data[Message::FIELD_LAST_MODIFIED_AT] = $data[Message::FIELD_LAST_MODIFIED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c'); + } + + if (isset($data[RecurringOrderStartsAtSetMessage::FIELD_STARTS_AT]) && $data[RecurringOrderStartsAtSetMessage::FIELD_STARTS_AT] instanceof \DateTimeImmutable) { + $data[RecurringOrderStartsAtSetMessage::FIELD_STARTS_AT] = $data[RecurringOrderStartsAtSetMessage::FIELD_STARTS_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c'); + } + + if (isset($data[RecurringOrderStartsAtSetMessage::FIELD_OLD_STARTS_AT]) && $data[RecurringOrderStartsAtSetMessage::FIELD_OLD_STARTS_AT] instanceof \DateTimeImmutable) { + $data[RecurringOrderStartsAtSetMessage::FIELD_OLD_STARTS_AT] = $data[RecurringOrderStartsAtSetMessage::FIELD_OLD_STARTS_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c'); + } + return (object) $data; + } +} diff --git a/lib/commercetools-api/src/Models/Message/RecurringOrderStartsAtSetMessagePayload.php b/lib/commercetools-api/src/Models/Message/RecurringOrderStartsAtSetMessagePayload.php new file mode 100644 index 00000000000..6f11429752c --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/RecurringOrderStartsAtSetMessagePayload.php @@ -0,0 +1,45 @@ +Start date and time of the Recurring Order after the Set Starts At update action. + * + + * @return null|DateTimeImmutable + */ + public function getStartsAt(); + + /** + *Start date and time of the Recurring Order before the Set Starts At update action.
+ * + + * @return null|DateTimeImmutable + */ + public function getOldStartsAt(); + + /** + * @param ?DateTimeImmutable $startsAt + */ + public function setStartsAt(?DateTimeImmutable $startsAt): void; + + /** + * @param ?DateTimeImmutable $oldStartsAt + */ + public function setOldStartsAt(?DateTimeImmutable $oldStartsAt): void; +} diff --git a/lib/commercetools-api/src/Models/Message/RecurringOrderStartsAtSetMessagePayloadBuilder.php b/lib/commercetools-api/src/Models/Message/RecurringOrderStartsAtSetMessagePayloadBuilder.php new file mode 100644 index 00000000000..07fff0f3a29 --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/RecurringOrderStartsAtSetMessagePayloadBuilder.php @@ -0,0 +1,93 @@ + + */ +final class RecurringOrderStartsAtSetMessagePayloadBuilder implements Builder +{ + /** + + * @var ?DateTimeImmutable + */ + private $startsAt; + + /** + + * @var ?DateTimeImmutable + */ + private $oldStartsAt; + + /** + *Start date and time of the Recurring Order after the Set Starts At update action.
+ * + + * @return null|DateTimeImmutable + */ + public function getStartsAt() + { + return $this->startsAt; + } + + /** + *Start date and time of the Recurring Order before the Set Starts At update action.
+ * + + * @return null|DateTimeImmutable + */ + public function getOldStartsAt() + { + return $this->oldStartsAt; + } + + /** + * @param ?DateTimeImmutable $startsAt + * @return $this + */ + public function withStartsAt(?DateTimeImmutable $startsAt) + { + $this->startsAt = $startsAt; + + return $this; + } + + /** + * @param ?DateTimeImmutable $oldStartsAt + * @return $this + */ + public function withOldStartsAt(?DateTimeImmutable $oldStartsAt) + { + $this->oldStartsAt = $oldStartsAt; + + return $this; + } + + + public function build(): RecurringOrderStartsAtSetMessagePayload + { + return new RecurringOrderStartsAtSetMessagePayloadModel( + $this->startsAt, + $this->oldStartsAt + ); + } + + public static function of(): RecurringOrderStartsAtSetMessagePayloadBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/Message/RecurringOrderStartsAtSetMessagePayloadCollection.php b/lib/commercetools-api/src/Models/Message/RecurringOrderStartsAtSetMessagePayloadCollection.php new file mode 100644 index 00000000000..230f48e8980 --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/RecurringOrderStartsAtSetMessagePayloadCollection.php @@ -0,0 +1,56 @@ + + * @method RecurringOrderStartsAtSetMessagePayload current() + * @method RecurringOrderStartsAtSetMessagePayload end() + * @method RecurringOrderStartsAtSetMessagePayload at($offset) + */ +class RecurringOrderStartsAtSetMessagePayloadCollection extends MessagePayloadCollection +{ + /** + * @psalm-assert RecurringOrderStartsAtSetMessagePayload $value + * @psalm-param RecurringOrderStartsAtSetMessagePayload|stdClass $value + * @throws InvalidArgumentException + * + * @return RecurringOrderStartsAtSetMessagePayloadCollection + */ + public function add($value) + { + if (!$value instanceof RecurringOrderStartsAtSetMessagePayload) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?RecurringOrderStartsAtSetMessagePayload + */ + protected function mapper() + { + return function (?int $index): ?RecurringOrderStartsAtSetMessagePayload { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var RecurringOrderStartsAtSetMessagePayload $data */ + $data = RecurringOrderStartsAtSetMessagePayloadModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/Message/RecurringOrderStartsAtSetMessagePayloadModel.php b/lib/commercetools-api/src/Models/Message/RecurringOrderStartsAtSetMessagePayloadModel.php new file mode 100644 index 00000000000..64ab1b451bd --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/RecurringOrderStartsAtSetMessagePayloadModel.php @@ -0,0 +1,153 @@ +startsAt = $startsAt; + $this->oldStartsAt = $oldStartsAt; + $this->type = $type ?? self::DISCRIMINATOR_VALUE; + } + + /** + * + * @return null|string + */ + public function getType() + { + if (is_null($this->type)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_TYPE); + if (is_null($data)) { + return null; + } + $this->type = (string) $data; + } + + return $this->type; + } + + /** + *Start date and time of the Recurring Order after the Set Starts At update action.
+ * + * + * @return null|DateTimeImmutable + */ + public function getStartsAt() + { + if (is_null($this->startsAt)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_STARTS_AT); + if (is_null($data)) { + return null; + } + $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data); + if (false === $data) { + return null; + } + $this->startsAt = $data; + } + + return $this->startsAt; + } + + /** + *Start date and time of the Recurring Order before the Set Starts At update action.
+ * + * + * @return null|DateTimeImmutable + */ + public function getOldStartsAt() + { + if (is_null($this->oldStartsAt)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_OLD_STARTS_AT); + if (is_null($data)) { + return null; + } + $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data); + if (false === $data) { + return null; + } + $this->oldStartsAt = $data; + } + + return $this->oldStartsAt; + } + + + /** + * @param ?DateTimeImmutable $startsAt + */ + public function setStartsAt(?DateTimeImmutable $startsAt): void + { + $this->startsAt = $startsAt; + } + + /** + * @param ?DateTimeImmutable $oldStartsAt + */ + public function setOldStartsAt(?DateTimeImmutable $oldStartsAt): void + { + $this->oldStartsAt = $oldStartsAt; + } + + + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + $data = $this->toArray(); + if (isset($data[RecurringOrderStartsAtSetMessagePayload::FIELD_STARTS_AT]) && $data[RecurringOrderStartsAtSetMessagePayload::FIELD_STARTS_AT] instanceof \DateTimeImmutable) { + $data[RecurringOrderStartsAtSetMessagePayload::FIELD_STARTS_AT] = $data[RecurringOrderStartsAtSetMessagePayload::FIELD_STARTS_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c'); + } + + if (isset($data[RecurringOrderStartsAtSetMessagePayload::FIELD_OLD_STARTS_AT]) && $data[RecurringOrderStartsAtSetMessagePayload::FIELD_OLD_STARTS_AT] instanceof \DateTimeImmutable) { + $data[RecurringOrderStartsAtSetMessagePayload::FIELD_OLD_STARTS_AT] = $data[RecurringOrderStartsAtSetMessagePayload::FIELD_OLD_STARTS_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c'); + } + return (object) $data; + } +} diff --git a/lib/commercetools-api/src/Models/Message/RecurringOrderStateChangedMessage.php b/lib/commercetools-api/src/Models/Message/RecurringOrderStateChangedMessage.php new file mode 100644 index 00000000000..d8bfd9492e6 --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/RecurringOrderStateChangedMessage.php @@ -0,0 +1,44 @@ +RecurringOrderState after the Set RecurringOrderState update action. + * + + * @return null|string + */ + public function getState(); + + /** + *RecurringOrderState before the Set RecurringOrderState update action.
+ * + + * @return null|string + */ + public function getOldState(); + + /** + * @param ?string $state + */ + public function setState(?string $state): void; + + /** + * @param ?string $oldState + */ + public function setOldState(?string $oldState): void; +} diff --git a/lib/commercetools-api/src/Models/Message/RecurringOrderStateChangedMessageBuilder.php b/lib/commercetools-api/src/Models/Message/RecurringOrderStateChangedMessageBuilder.php new file mode 100644 index 00000000000..189c8289427 --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/RecurringOrderStateChangedMessageBuilder.php @@ -0,0 +1,433 @@ + + */ +final class RecurringOrderStateChangedMessageBuilder implements Builder +{ + /** + + * @var ?string + */ + private $id; + + /** + + * @var ?int + */ + private $version; + + /** + + * @var ?DateTimeImmutable + */ + private $createdAt; + + /** + + * @var ?DateTimeImmutable + */ + private $lastModifiedAt; + + /** + + * @var null|LastModifiedBy|LastModifiedByBuilder + */ + private $lastModifiedBy; + + /** + + * @var null|CreatedBy|CreatedByBuilder + */ + private $createdBy; + + /** + + * @var ?int + */ + private $sequenceNumber; + + /** + + * @var null|Reference|ReferenceBuilder + */ + private $resource; + + /** + + * @var ?int + */ + private $resourceVersion; + + /** + + * @var null|UserProvidedIdentifiers|UserProvidedIdentifiersBuilder + */ + private $resourceUserProvidedIdentifiers; + + /** + + * @var ?string + */ + private $state; + + /** + + * @var ?string + */ + private $oldState; + + /** + *Unique identifier of the Message. Can be used to track which Messages have been processed.
+ * + + * @return null|string + */ + public function getId() + { + return $this->id; + } + + /** + *Version of a resource. In case of Messages, this is always 1.
Date and time (UTC) the Message was generated.
+ * + + * @return null|DateTimeImmutable + */ + public function getCreatedAt() + { + return $this->createdAt; + } + + /** + *Value of createdAt.
IDs and references that last modified the Message.
+ * + + * @return null|LastModifiedBy + */ + public function getLastModifiedBy() + { + return $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy; + } + + /** + *IDs and references that created the Message.
+ * + + * @return null|CreatedBy + */ + public function getCreatedBy() + { + return $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy; + } + + /** + *Message number in relation to other Messages for a given resource. The sequenceNumber of the next Message for the resource is the successor of the sequenceNumber of the current Message. Meaning, the sequenceNumber of the next Message equals the sequenceNumber of the current Message + 1.
+ * sequenceNumber can be used to ensure that Messages are processed in the correct order for a particular resource.
Reference to the resource on which the change or action was performed.
+ * + + * @return null|Reference + */ + public function getResource() + { + return $this->resource instanceof ReferenceBuilder ? $this->resource->build() : $this->resource; + } + + /** + *Version of the resource on which the change or action was performed.
+ * + + * @return null|int + */ + public function getResourceVersion() + { + return $this->resourceVersion; + } + + /** + *User-provided identifiers of the resource, such as key or externalId. Only present if the resource has such identifiers.
RecurringOrderState after the Set RecurringOrderState update action.
+ * + + * @return null|string + */ + public function getState() + { + return $this->state; + } + + /** + *RecurringOrderState before the Set RecurringOrderState update action.
+ * + + * @return null|string + */ + public function getOldState() + { + return $this->oldState; + } + + /** + * @param ?string $id + * @return $this + */ + public function withId(?string $id) + { + $this->id = $id; + + return $this; + } + + /** + * @param ?int $version + * @return $this + */ + public function withVersion(?int $version) + { + $this->version = $version; + + return $this; + } + + /** + * @param ?DateTimeImmutable $createdAt + * @return $this + */ + public function withCreatedAt(?DateTimeImmutable $createdAt) + { + $this->createdAt = $createdAt; + + return $this; + } + + /** + * @param ?DateTimeImmutable $lastModifiedAt + * @return $this + */ + public function withLastModifiedAt(?DateTimeImmutable $lastModifiedAt) + { + $this->lastModifiedAt = $lastModifiedAt; + + return $this; + } + + /** + * @param ?LastModifiedBy $lastModifiedBy + * @return $this + */ + public function withLastModifiedBy(?LastModifiedBy $lastModifiedBy) + { + $this->lastModifiedBy = $lastModifiedBy; + + return $this; + } + + /** + * @param ?CreatedBy $createdBy + * @return $this + */ + public function withCreatedBy(?CreatedBy $createdBy) + { + $this->createdBy = $createdBy; + + return $this; + } + + /** + * @param ?int $sequenceNumber + * @return $this + */ + public function withSequenceNumber(?int $sequenceNumber) + { + $this->sequenceNumber = $sequenceNumber; + + return $this; + } + + /** + * @param ?Reference $resource + * @return $this + */ + public function withResource(?Reference $resource) + { + $this->resource = $resource; + + return $this; + } + + /** + * @param ?int $resourceVersion + * @return $this + */ + public function withResourceVersion(?int $resourceVersion) + { + $this->resourceVersion = $resourceVersion; + + return $this; + } + + /** + * @param ?UserProvidedIdentifiers $resourceUserProvidedIdentifiers + * @return $this + */ + public function withResourceUserProvidedIdentifiers(?UserProvidedIdentifiers $resourceUserProvidedIdentifiers) + { + $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers; + + return $this; + } + + /** + * @param ?string $state + * @return $this + */ + public function withState(?string $state) + { + $this->state = $state; + + return $this; + } + + /** + * @param ?string $oldState + * @return $this + */ + public function withOldState(?string $oldState) + { + $this->oldState = $oldState; + + return $this; + } + + /** + * @deprecated use withLastModifiedBy() instead + * @return $this + */ + public function withLastModifiedByBuilder(?LastModifiedByBuilder $lastModifiedBy) + { + $this->lastModifiedBy = $lastModifiedBy; + + return $this; + } + + /** + * @deprecated use withCreatedBy() instead + * @return $this + */ + public function withCreatedByBuilder(?CreatedByBuilder $createdBy) + { + $this->createdBy = $createdBy; + + return $this; + } + + /** + * @deprecated use withResource() instead + * @return $this + */ + public function withResourceBuilder(?ReferenceBuilder $resource) + { + $this->resource = $resource; + + return $this; + } + + /** + * @deprecated use withResourceUserProvidedIdentifiers() instead + * @return $this + */ + public function withResourceUserProvidedIdentifiersBuilder(?UserProvidedIdentifiersBuilder $resourceUserProvidedIdentifiers) + { + $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers; + + return $this; + } + + public function build(): RecurringOrderStateChangedMessage + { + return new RecurringOrderStateChangedMessageModel( + $this->id, + $this->version, + $this->createdAt, + $this->lastModifiedAt, + $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy, + $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy, + $this->sequenceNumber, + $this->resource instanceof ReferenceBuilder ? $this->resource->build() : $this->resource, + $this->resourceVersion, + $this->resourceUserProvidedIdentifiers instanceof UserProvidedIdentifiersBuilder ? $this->resourceUserProvidedIdentifiers->build() : $this->resourceUserProvidedIdentifiers, + $this->state, + $this->oldState + ); + } + + public static function of(): RecurringOrderStateChangedMessageBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/Message/RecurringOrderStateChangedMessageCollection.php b/lib/commercetools-api/src/Models/Message/RecurringOrderStateChangedMessageCollection.php new file mode 100644 index 00000000000..88a6ab2fe55 --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/RecurringOrderStateChangedMessageCollection.php @@ -0,0 +1,56 @@ + + * @method RecurringOrderStateChangedMessage current() + * @method RecurringOrderStateChangedMessage end() + * @method RecurringOrderStateChangedMessage at($offset) + */ +class RecurringOrderStateChangedMessageCollection extends MessageCollection +{ + /** + * @psalm-assert RecurringOrderStateChangedMessage $value + * @psalm-param RecurringOrderStateChangedMessage|stdClass $value + * @throws InvalidArgumentException + * + * @return RecurringOrderStateChangedMessageCollection + */ + public function add($value) + { + if (!$value instanceof RecurringOrderStateChangedMessage) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?RecurringOrderStateChangedMessage + */ + protected function mapper() + { + return function (?int $index): ?RecurringOrderStateChangedMessage { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var RecurringOrderStateChangedMessage $data */ + $data = RecurringOrderStateChangedMessageModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/Message/RecurringOrderStateChangedMessageModel.php b/lib/commercetools-api/src/Models/Message/RecurringOrderStateChangedMessageModel.php new file mode 100644 index 00000000000..1e36951046b --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/RecurringOrderStateChangedMessageModel.php @@ -0,0 +1,526 @@ +id = $id; + $this->version = $version; + $this->createdAt = $createdAt; + $this->lastModifiedAt = $lastModifiedAt; + $this->lastModifiedBy = $lastModifiedBy; + $this->createdBy = $createdBy; + $this->sequenceNumber = $sequenceNumber; + $this->resource = $resource; + $this->resourceVersion = $resourceVersion; + $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers; + $this->state = $state; + $this->oldState = $oldState; + $this->type = $type ?? self::DISCRIMINATOR_VALUE; + } + + /** + *Unique identifier of the Message. Can be used to track which Messages have been processed.
+ * + * + * @return null|string + */ + public function getId() + { + if (is_null($this->id)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_ID); + if (is_null($data)) { + return null; + } + $this->id = (string) $data; + } + + return $this->id; + } + + /** + *Version of a resource. In case of Messages, this is always 1.
Date and time (UTC) the Message was generated.
+ * + * + * @return null|DateTimeImmutable + */ + public function getCreatedAt() + { + if (is_null($this->createdAt)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CREATED_AT); + if (is_null($data)) { + return null; + } + $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data); + if (false === $data) { + return null; + } + $this->createdAt = $data; + } + + return $this->createdAt; + } + + /** + *Value of createdAt.
IDs and references that last modified the Message.
+ * + * + * @return null|LastModifiedBy + */ + public function getLastModifiedBy() + { + if (is_null($this->lastModifiedBy)) { + /** @psalm-var stdClass|arrayIDs and references that created the Message.
+ * + * + * @return null|CreatedBy + */ + public function getCreatedBy() + { + if (is_null($this->createdBy)) { + /** @psalm-var stdClass|arrayMessage number in relation to other Messages for a given resource. The sequenceNumber of the next Message for the resource is the successor of the sequenceNumber of the current Message. Meaning, the sequenceNumber of the next Message equals the sequenceNumber of the current Message + 1.
+ * sequenceNumber can be used to ensure that Messages are processed in the correct order for a particular resource.
Reference to the resource on which the change or action was performed.
+ * + * + * @return null|Reference + */ + public function getResource() + { + if (is_null($this->resource)) { + /** @psalm-var stdClass|arrayVersion of the resource on which the change or action was performed.
+ * + * + * @return null|int + */ + public function getResourceVersion() + { + if (is_null($this->resourceVersion)) { + /** @psalm-var ?int $data */ + $data = $this->raw(self::FIELD_RESOURCE_VERSION); + if (is_null($data)) { + return null; + } + $this->resourceVersion = (int) $data; + } + + return $this->resourceVersion; + } + + /** + *Message Type of the Message.
+ * + * + * @return null|string + */ + public function getType() + { + if (is_null($this->type)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_TYPE); + if (is_null($data)) { + return null; + } + $this->type = (string) $data; + } + + return $this->type; + } + + /** + *User-provided identifiers of the resource, such as key or externalId. Only present if the resource has such identifiers.
RecurringOrderState after the Set RecurringOrderState update action.
+ * + * + * @return null|string + */ + public function getState() + { + if (is_null($this->state)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_STATE); + if (is_null($data)) { + return null; + } + $this->state = (string) $data; + } + + return $this->state; + } + + /** + *RecurringOrderState before the Set RecurringOrderState update action.
+ * + * + * @return null|string + */ + public function getOldState() + { + if (is_null($this->oldState)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_OLD_STATE); + if (is_null($data)) { + return null; + } + $this->oldState = (string) $data; + } + + return $this->oldState; + } + + + /** + * @param ?string $id + */ + public function setId(?string $id): void + { + $this->id = $id; + } + + /** + * @param ?int $version + */ + public function setVersion(?int $version): void + { + $this->version = $version; + } + + /** + * @param ?DateTimeImmutable $createdAt + */ + public function setCreatedAt(?DateTimeImmutable $createdAt): void + { + $this->createdAt = $createdAt; + } + + /** + * @param ?DateTimeImmutable $lastModifiedAt + */ + public function setLastModifiedAt(?DateTimeImmutable $lastModifiedAt): void + { + $this->lastModifiedAt = $lastModifiedAt; + } + + /** + * @param ?LastModifiedBy $lastModifiedBy + */ + public function setLastModifiedBy(?LastModifiedBy $lastModifiedBy): void + { + $this->lastModifiedBy = $lastModifiedBy; + } + + /** + * @param ?CreatedBy $createdBy + */ + public function setCreatedBy(?CreatedBy $createdBy): void + { + $this->createdBy = $createdBy; + } + + /** + * @param ?int $sequenceNumber + */ + public function setSequenceNumber(?int $sequenceNumber): void + { + $this->sequenceNumber = $sequenceNumber; + } + + /** + * @param ?Reference $resource + */ + public function setResource(?Reference $resource): void + { + $this->resource = $resource; + } + + /** + * @param ?int $resourceVersion + */ + public function setResourceVersion(?int $resourceVersion): void + { + $this->resourceVersion = $resourceVersion; + } + + /** + * @param ?UserProvidedIdentifiers $resourceUserProvidedIdentifiers + */ + public function setResourceUserProvidedIdentifiers(?UserProvidedIdentifiers $resourceUserProvidedIdentifiers): void + { + $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers; + } + + /** + * @param ?string $state + */ + public function setState(?string $state): void + { + $this->state = $state; + } + + /** + * @param ?string $oldState + */ + public function setOldState(?string $oldState): void + { + $this->oldState = $oldState; + } + + + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + $data = $this->toArray(); + if (isset($data[Message::FIELD_CREATED_AT]) && $data[Message::FIELD_CREATED_AT] instanceof \DateTimeImmutable) { + $data[Message::FIELD_CREATED_AT] = $data[Message::FIELD_CREATED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c'); + } + + if (isset($data[Message::FIELD_LAST_MODIFIED_AT]) && $data[Message::FIELD_LAST_MODIFIED_AT] instanceof \DateTimeImmutable) { + $data[Message::FIELD_LAST_MODIFIED_AT] = $data[Message::FIELD_LAST_MODIFIED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c'); + } + return (object) $data; + } +} diff --git a/lib/commercetools-api/src/Models/Message/RecurringOrderStateChangedMessagePayload.php b/lib/commercetools-api/src/Models/Message/RecurringOrderStateChangedMessagePayload.php new file mode 100644 index 00000000000..8bb4cc2ac9d --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/RecurringOrderStateChangedMessagePayload.php @@ -0,0 +1,44 @@ +RecurringOrderState after the Set RecurringOrderState update action. + * + + * @return null|string + */ + public function getState(); + + /** + *RecurringOrderState before the Set RecurringOrderState update action.
+ * + + * @return null|string + */ + public function getOldState(); + + /** + * @param ?string $state + */ + public function setState(?string $state): void; + + /** + * @param ?string $oldState + */ + public function setOldState(?string $oldState): void; +} diff --git a/lib/commercetools-api/src/Models/Message/RecurringOrderStateChangedMessagePayloadBuilder.php b/lib/commercetools-api/src/Models/Message/RecurringOrderStateChangedMessagePayloadBuilder.php new file mode 100644 index 00000000000..8568bea05f0 --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/RecurringOrderStateChangedMessagePayloadBuilder.php @@ -0,0 +1,92 @@ + + */ +final class RecurringOrderStateChangedMessagePayloadBuilder implements Builder +{ + /** + + * @var ?string + */ + private $state; + + /** + + * @var ?string + */ + private $oldState; + + /** + *RecurringOrderState after the Set RecurringOrderState update action.
+ * + + * @return null|string + */ + public function getState() + { + return $this->state; + } + + /** + *RecurringOrderState before the Set RecurringOrderState update action.
+ * + + * @return null|string + */ + public function getOldState() + { + return $this->oldState; + } + + /** + * @param ?string $state + * @return $this + */ + public function withState(?string $state) + { + $this->state = $state; + + return $this; + } + + /** + * @param ?string $oldState + * @return $this + */ + public function withOldState(?string $oldState) + { + $this->oldState = $oldState; + + return $this; + } + + + public function build(): RecurringOrderStateChangedMessagePayload + { + return new RecurringOrderStateChangedMessagePayloadModel( + $this->state, + $this->oldState + ); + } + + public static function of(): RecurringOrderStateChangedMessagePayloadBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/Message/RecurringOrderStateChangedMessagePayloadCollection.php b/lib/commercetools-api/src/Models/Message/RecurringOrderStateChangedMessagePayloadCollection.php new file mode 100644 index 00000000000..b403c477eff --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/RecurringOrderStateChangedMessagePayloadCollection.php @@ -0,0 +1,56 @@ + + * @method RecurringOrderStateChangedMessagePayload current() + * @method RecurringOrderStateChangedMessagePayload end() + * @method RecurringOrderStateChangedMessagePayload at($offset) + */ +class RecurringOrderStateChangedMessagePayloadCollection extends MessagePayloadCollection +{ + /** + * @psalm-assert RecurringOrderStateChangedMessagePayload $value + * @psalm-param RecurringOrderStateChangedMessagePayload|stdClass $value + * @throws InvalidArgumentException + * + * @return RecurringOrderStateChangedMessagePayloadCollection + */ + public function add($value) + { + if (!$value instanceof RecurringOrderStateChangedMessagePayload) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?RecurringOrderStateChangedMessagePayload + */ + protected function mapper() + { + return function (?int $index): ?RecurringOrderStateChangedMessagePayload { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var RecurringOrderStateChangedMessagePayload $data */ + $data = RecurringOrderStateChangedMessagePayloadModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/Message/RecurringOrderStateChangedMessagePayloadModel.php b/lib/commercetools-api/src/Models/Message/RecurringOrderStateChangedMessagePayloadModel.php new file mode 100644 index 00000000000..c441f351468 --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/RecurringOrderStateChangedMessagePayloadModel.php @@ -0,0 +1,129 @@ +state = $state; + $this->oldState = $oldState; + $this->type = $type ?? self::DISCRIMINATOR_VALUE; + } + + /** + * + * @return null|string + */ + public function getType() + { + if (is_null($this->type)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_TYPE); + if (is_null($data)) { + return null; + } + $this->type = (string) $data; + } + + return $this->type; + } + + /** + *RecurringOrderState after the Set RecurringOrderState update action.
+ * + * + * @return null|string + */ + public function getState() + { + if (is_null($this->state)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_STATE); + if (is_null($data)) { + return null; + } + $this->state = (string) $data; + } + + return $this->state; + } + + /** + *RecurringOrderState before the Set RecurringOrderState update action.
+ * + * + * @return null|string + */ + public function getOldState() + { + if (is_null($this->oldState)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_OLD_STATE); + if (is_null($data)) { + return null; + } + $this->oldState = (string) $data; + } + + return $this->oldState; + } + + + /** + * @param ?string $state + */ + public function setState(?string $state): void + { + $this->state = $state; + } + + /** + * @param ?string $oldState + */ + public function setOldState(?string $oldState): void + { + $this->oldState = $oldState; + } +} diff --git a/lib/commercetools-api/src/Models/Message/RecurringOrderStateTransitionMessage.php b/lib/commercetools-api/src/Models/Message/RecurringOrderStateTransitionMessage.php new file mode 100644 index 00000000000..f8b82311cbe --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/RecurringOrderStateTransitionMessage.php @@ -0,0 +1,59 @@ +RecurringOrderState after the Transition State update action. + * + + * @return null|StateReference + */ + public function getState(); + + /** + *RecurringOrderState before the Transition State update action.
+ * + + * @return null|StateReference + */ + public function getOldState(); + + /** + *Whether State transition validations were turned off during the Transition State update action.
+ * + + * @return null|bool + */ + public function getForce(); + + /** + * @param ?StateReference $state + */ + public function setState(?StateReference $state): void; + + /** + * @param ?StateReference $oldState + */ + public function setOldState(?StateReference $oldState): void; + + /** + * @param ?bool $force + */ + public function setForce(?bool $force): void; +} diff --git a/lib/commercetools-api/src/Models/Message/RecurringOrderStateTransitionMessageBuilder.php b/lib/commercetools-api/src/Models/Message/RecurringOrderStateTransitionMessageBuilder.php new file mode 100644 index 00000000000..89aa4c743f2 --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/RecurringOrderStateTransitionMessageBuilder.php @@ -0,0 +1,486 @@ + + */ +final class RecurringOrderStateTransitionMessageBuilder implements Builder +{ + /** + + * @var ?string + */ + private $id; + + /** + + * @var ?int + */ + private $version; + + /** + + * @var ?DateTimeImmutable + */ + private $createdAt; + + /** + + * @var ?DateTimeImmutable + */ + private $lastModifiedAt; + + /** + + * @var null|LastModifiedBy|LastModifiedByBuilder + */ + private $lastModifiedBy; + + /** + + * @var null|CreatedBy|CreatedByBuilder + */ + private $createdBy; + + /** + + * @var ?int + */ + private $sequenceNumber; + + /** + + * @var null|Reference|ReferenceBuilder + */ + private $resource; + + /** + + * @var ?int + */ + private $resourceVersion; + + /** + + * @var null|UserProvidedIdentifiers|UserProvidedIdentifiersBuilder + */ + private $resourceUserProvidedIdentifiers; + + /** + + * @var null|StateReference|StateReferenceBuilder + */ + private $state; + + /** + + * @var null|StateReference|StateReferenceBuilder + */ + private $oldState; + + /** + + * @var ?bool + */ + private $force; + + /** + *Unique identifier of the Message. Can be used to track which Messages have been processed.
+ * + + * @return null|string + */ + public function getId() + { + return $this->id; + } + + /** + *Version of a resource. In case of Messages, this is always 1.
Date and time (UTC) the Message was generated.
+ * + + * @return null|DateTimeImmutable + */ + public function getCreatedAt() + { + return $this->createdAt; + } + + /** + *Value of createdAt.
IDs and references that last modified the Message.
+ * + + * @return null|LastModifiedBy + */ + public function getLastModifiedBy() + { + return $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy; + } + + /** + *IDs and references that created the Message.
+ * + + * @return null|CreatedBy + */ + public function getCreatedBy() + { + return $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy; + } + + /** + *Message number in relation to other Messages for a given resource. The sequenceNumber of the next Message for the resource is the successor of the sequenceNumber of the current Message. Meaning, the sequenceNumber of the next Message equals the sequenceNumber of the current Message + 1.
+ * sequenceNumber can be used to ensure that Messages are processed in the correct order for a particular resource.
Reference to the resource on which the change or action was performed.
+ * + + * @return null|Reference + */ + public function getResource() + { + return $this->resource instanceof ReferenceBuilder ? $this->resource->build() : $this->resource; + } + + /** + *Version of the resource on which the change or action was performed.
+ * + + * @return null|int + */ + public function getResourceVersion() + { + return $this->resourceVersion; + } + + /** + *User-provided identifiers of the resource, such as key or externalId. Only present if the resource has such identifiers.
RecurringOrderState after the Transition State update action.
+ * + + * @return null|StateReference + */ + public function getState() + { + return $this->state instanceof StateReferenceBuilder ? $this->state->build() : $this->state; + } + + /** + *RecurringOrderState before the Transition State update action.
+ * + + * @return null|StateReference + */ + public function getOldState() + { + return $this->oldState instanceof StateReferenceBuilder ? $this->oldState->build() : $this->oldState; + } + + /** + *Whether State transition validations were turned off during the Transition State update action.
+ * + + * @return null|bool + */ + public function getForce() + { + return $this->force; + } + + /** + * @param ?string $id + * @return $this + */ + public function withId(?string $id) + { + $this->id = $id; + + return $this; + } + + /** + * @param ?int $version + * @return $this + */ + public function withVersion(?int $version) + { + $this->version = $version; + + return $this; + } + + /** + * @param ?DateTimeImmutable $createdAt + * @return $this + */ + public function withCreatedAt(?DateTimeImmutable $createdAt) + { + $this->createdAt = $createdAt; + + return $this; + } + + /** + * @param ?DateTimeImmutable $lastModifiedAt + * @return $this + */ + public function withLastModifiedAt(?DateTimeImmutable $lastModifiedAt) + { + $this->lastModifiedAt = $lastModifiedAt; + + return $this; + } + + /** + * @param ?LastModifiedBy $lastModifiedBy + * @return $this + */ + public function withLastModifiedBy(?LastModifiedBy $lastModifiedBy) + { + $this->lastModifiedBy = $lastModifiedBy; + + return $this; + } + + /** + * @param ?CreatedBy $createdBy + * @return $this + */ + public function withCreatedBy(?CreatedBy $createdBy) + { + $this->createdBy = $createdBy; + + return $this; + } + + /** + * @param ?int $sequenceNumber + * @return $this + */ + public function withSequenceNumber(?int $sequenceNumber) + { + $this->sequenceNumber = $sequenceNumber; + + return $this; + } + + /** + * @param ?Reference $resource + * @return $this + */ + public function withResource(?Reference $resource) + { + $this->resource = $resource; + + return $this; + } + + /** + * @param ?int $resourceVersion + * @return $this + */ + public function withResourceVersion(?int $resourceVersion) + { + $this->resourceVersion = $resourceVersion; + + return $this; + } + + /** + * @param ?UserProvidedIdentifiers $resourceUserProvidedIdentifiers + * @return $this + */ + public function withResourceUserProvidedIdentifiers(?UserProvidedIdentifiers $resourceUserProvidedIdentifiers) + { + $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers; + + return $this; + } + + /** + * @param ?StateReference $state + * @return $this + */ + public function withState(?StateReference $state) + { + $this->state = $state; + + return $this; + } + + /** + * @param ?StateReference $oldState + * @return $this + */ + public function withOldState(?StateReference $oldState) + { + $this->oldState = $oldState; + + return $this; + } + + /** + * @param ?bool $force + * @return $this + */ + public function withForce(?bool $force) + { + $this->force = $force; + + return $this; + } + + /** + * @deprecated use withLastModifiedBy() instead + * @return $this + */ + public function withLastModifiedByBuilder(?LastModifiedByBuilder $lastModifiedBy) + { + $this->lastModifiedBy = $lastModifiedBy; + + return $this; + } + + /** + * @deprecated use withCreatedBy() instead + * @return $this + */ + public function withCreatedByBuilder(?CreatedByBuilder $createdBy) + { + $this->createdBy = $createdBy; + + return $this; + } + + /** + * @deprecated use withResource() instead + * @return $this + */ + public function withResourceBuilder(?ReferenceBuilder $resource) + { + $this->resource = $resource; + + return $this; + } + + /** + * @deprecated use withResourceUserProvidedIdentifiers() instead + * @return $this + */ + public function withResourceUserProvidedIdentifiersBuilder(?UserProvidedIdentifiersBuilder $resourceUserProvidedIdentifiers) + { + $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers; + + return $this; + } + + /** + * @deprecated use withState() instead + * @return $this + */ + public function withStateBuilder(?StateReferenceBuilder $state) + { + $this->state = $state; + + return $this; + } + + /** + * @deprecated use withOldState() instead + * @return $this + */ + public function withOldStateBuilder(?StateReferenceBuilder $oldState) + { + $this->oldState = $oldState; + + return $this; + } + + public function build(): RecurringOrderStateTransitionMessage + { + return new RecurringOrderStateTransitionMessageModel( + $this->id, + $this->version, + $this->createdAt, + $this->lastModifiedAt, + $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy, + $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy, + $this->sequenceNumber, + $this->resource instanceof ReferenceBuilder ? $this->resource->build() : $this->resource, + $this->resourceVersion, + $this->resourceUserProvidedIdentifiers instanceof UserProvidedIdentifiersBuilder ? $this->resourceUserProvidedIdentifiers->build() : $this->resourceUserProvidedIdentifiers, + $this->state instanceof StateReferenceBuilder ? $this->state->build() : $this->state, + $this->oldState instanceof StateReferenceBuilder ? $this->oldState->build() : $this->oldState, + $this->force + ); + } + + public static function of(): RecurringOrderStateTransitionMessageBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/Message/RecurringOrderStateTransitionMessageCollection.php b/lib/commercetools-api/src/Models/Message/RecurringOrderStateTransitionMessageCollection.php new file mode 100644 index 00000000000..d6ff5dde904 --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/RecurringOrderStateTransitionMessageCollection.php @@ -0,0 +1,56 @@ + + * @method RecurringOrderStateTransitionMessage current() + * @method RecurringOrderStateTransitionMessage end() + * @method RecurringOrderStateTransitionMessage at($offset) + */ +class RecurringOrderStateTransitionMessageCollection extends MessageCollection +{ + /** + * @psalm-assert RecurringOrderStateTransitionMessage $value + * @psalm-param RecurringOrderStateTransitionMessage|stdClass $value + * @throws InvalidArgumentException + * + * @return RecurringOrderStateTransitionMessageCollection + */ + public function add($value) + { + if (!$value instanceof RecurringOrderStateTransitionMessage) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?RecurringOrderStateTransitionMessage + */ + protected function mapper() + { + return function (?int $index): ?RecurringOrderStateTransitionMessage { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var RecurringOrderStateTransitionMessage $data */ + $data = RecurringOrderStateTransitionMessageModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/Message/RecurringOrderStateTransitionMessageModel.php b/lib/commercetools-api/src/Models/Message/RecurringOrderStateTransitionMessageModel.php new file mode 100644 index 00000000000..193a84af4f9 --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/RecurringOrderStateTransitionMessageModel.php @@ -0,0 +1,566 @@ +id = $id; + $this->version = $version; + $this->createdAt = $createdAt; + $this->lastModifiedAt = $lastModifiedAt; + $this->lastModifiedBy = $lastModifiedBy; + $this->createdBy = $createdBy; + $this->sequenceNumber = $sequenceNumber; + $this->resource = $resource; + $this->resourceVersion = $resourceVersion; + $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers; + $this->state = $state; + $this->oldState = $oldState; + $this->force = $force; + $this->type = $type ?? self::DISCRIMINATOR_VALUE; + } + + /** + *Unique identifier of the Message. Can be used to track which Messages have been processed.
+ * + * + * @return null|string + */ + public function getId() + { + if (is_null($this->id)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_ID); + if (is_null($data)) { + return null; + } + $this->id = (string) $data; + } + + return $this->id; + } + + /** + *Version of a resource. In case of Messages, this is always 1.
Date and time (UTC) the Message was generated.
+ * + * + * @return null|DateTimeImmutable + */ + public function getCreatedAt() + { + if (is_null($this->createdAt)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CREATED_AT); + if (is_null($data)) { + return null; + } + $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data); + if (false === $data) { + return null; + } + $this->createdAt = $data; + } + + return $this->createdAt; + } + + /** + *Value of createdAt.
IDs and references that last modified the Message.
+ * + * + * @return null|LastModifiedBy + */ + public function getLastModifiedBy() + { + if (is_null($this->lastModifiedBy)) { + /** @psalm-var stdClass|arrayIDs and references that created the Message.
+ * + * + * @return null|CreatedBy + */ + public function getCreatedBy() + { + if (is_null($this->createdBy)) { + /** @psalm-var stdClass|arrayMessage number in relation to other Messages for a given resource. The sequenceNumber of the next Message for the resource is the successor of the sequenceNumber of the current Message. Meaning, the sequenceNumber of the next Message equals the sequenceNumber of the current Message + 1.
+ * sequenceNumber can be used to ensure that Messages are processed in the correct order for a particular resource.
Reference to the resource on which the change or action was performed.
+ * + * + * @return null|Reference + */ + public function getResource() + { + if (is_null($this->resource)) { + /** @psalm-var stdClass|arrayVersion of the resource on which the change or action was performed.
+ * + * + * @return null|int + */ + public function getResourceVersion() + { + if (is_null($this->resourceVersion)) { + /** @psalm-var ?int $data */ + $data = $this->raw(self::FIELD_RESOURCE_VERSION); + if (is_null($data)) { + return null; + } + $this->resourceVersion = (int) $data; + } + + return $this->resourceVersion; + } + + /** + *Message Type of the Message.
+ * + * + * @return null|string + */ + public function getType() + { + if (is_null($this->type)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_TYPE); + if (is_null($data)) { + return null; + } + $this->type = (string) $data; + } + + return $this->type; + } + + /** + *User-provided identifiers of the resource, such as key or externalId. Only present if the resource has such identifiers.
RecurringOrderState after the Transition State update action.
+ * + * + * @return null|StateReference + */ + public function getState() + { + if (is_null($this->state)) { + /** @psalm-var stdClass|arrayRecurringOrderState before the Transition State update action.
+ * + * + * @return null|StateReference + */ + public function getOldState() + { + if (is_null($this->oldState)) { + /** @psalm-var stdClass|arrayWhether State transition validations were turned off during the Transition State update action.
+ * + * + * @return null|bool + */ + public function getForce() + { + if (is_null($this->force)) { + /** @psalm-var ?bool $data */ + $data = $this->raw(self::FIELD_FORCE); + if (is_null($data)) { + return null; + } + $this->force = (bool) $data; + } + + return $this->force; + } + + + /** + * @param ?string $id + */ + public function setId(?string $id): void + { + $this->id = $id; + } + + /** + * @param ?int $version + */ + public function setVersion(?int $version): void + { + $this->version = $version; + } + + /** + * @param ?DateTimeImmutable $createdAt + */ + public function setCreatedAt(?DateTimeImmutable $createdAt): void + { + $this->createdAt = $createdAt; + } + + /** + * @param ?DateTimeImmutable $lastModifiedAt + */ + public function setLastModifiedAt(?DateTimeImmutable $lastModifiedAt): void + { + $this->lastModifiedAt = $lastModifiedAt; + } + + /** + * @param ?LastModifiedBy $lastModifiedBy + */ + public function setLastModifiedBy(?LastModifiedBy $lastModifiedBy): void + { + $this->lastModifiedBy = $lastModifiedBy; + } + + /** + * @param ?CreatedBy $createdBy + */ + public function setCreatedBy(?CreatedBy $createdBy): void + { + $this->createdBy = $createdBy; + } + + /** + * @param ?int $sequenceNumber + */ + public function setSequenceNumber(?int $sequenceNumber): void + { + $this->sequenceNumber = $sequenceNumber; + } + + /** + * @param ?Reference $resource + */ + public function setResource(?Reference $resource): void + { + $this->resource = $resource; + } + + /** + * @param ?int $resourceVersion + */ + public function setResourceVersion(?int $resourceVersion): void + { + $this->resourceVersion = $resourceVersion; + } + + /** + * @param ?UserProvidedIdentifiers $resourceUserProvidedIdentifiers + */ + public function setResourceUserProvidedIdentifiers(?UserProvidedIdentifiers $resourceUserProvidedIdentifiers): void + { + $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers; + } + + /** + * @param ?StateReference $state + */ + public function setState(?StateReference $state): void + { + $this->state = $state; + } + + /** + * @param ?StateReference $oldState + */ + public function setOldState(?StateReference $oldState): void + { + $this->oldState = $oldState; + } + + /** + * @param ?bool $force + */ + public function setForce(?bool $force): void + { + $this->force = $force; + } + + + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + $data = $this->toArray(); + if (isset($data[Message::FIELD_CREATED_AT]) && $data[Message::FIELD_CREATED_AT] instanceof \DateTimeImmutable) { + $data[Message::FIELD_CREATED_AT] = $data[Message::FIELD_CREATED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c'); + } + + if (isset($data[Message::FIELD_LAST_MODIFIED_AT]) && $data[Message::FIELD_LAST_MODIFIED_AT] instanceof \DateTimeImmutable) { + $data[Message::FIELD_LAST_MODIFIED_AT] = $data[Message::FIELD_LAST_MODIFIED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c'); + } + return (object) $data; + } +} diff --git a/lib/commercetools-api/src/Models/Message/RecurringOrderStateTransitionMessagePayload.php b/lib/commercetools-api/src/Models/Message/RecurringOrderStateTransitionMessagePayload.php new file mode 100644 index 00000000000..527f94c7260 --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/RecurringOrderStateTransitionMessagePayload.php @@ -0,0 +1,59 @@ +RecurringOrderState after the Transition State update action. + * + + * @return null|StateReference + */ + public function getState(); + + /** + *RecurringOrderState before the Transition State update action.
+ * + + * @return null|StateReference + */ + public function getOldState(); + + /** + *Whether State transition validations were turned off during the Transition State update action.
+ * + + * @return null|bool + */ + public function getForce(); + + /** + * @param ?StateReference $state + */ + public function setState(?StateReference $state): void; + + /** + * @param ?StateReference $oldState + */ + public function setOldState(?StateReference $oldState): void; + + /** + * @param ?bool $force + */ + public function setForce(?bool $force): void; +} diff --git a/lib/commercetools-api/src/Models/Message/RecurringOrderStateTransitionMessagePayloadBuilder.php b/lib/commercetools-api/src/Models/Message/RecurringOrderStateTransitionMessagePayloadBuilder.php new file mode 100644 index 00000000000..f100a6e511f --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/RecurringOrderStateTransitionMessagePayloadBuilder.php @@ -0,0 +1,144 @@ + + */ +final class RecurringOrderStateTransitionMessagePayloadBuilder implements Builder +{ + /** + + * @var null|StateReference|StateReferenceBuilder + */ + private $state; + + /** + + * @var null|StateReference|StateReferenceBuilder + */ + private $oldState; + + /** + + * @var ?bool + */ + private $force; + + /** + *RecurringOrderState after the Transition State update action.
+ * + + * @return null|StateReference + */ + public function getState() + { + return $this->state instanceof StateReferenceBuilder ? $this->state->build() : $this->state; + } + + /** + *RecurringOrderState before the Transition State update action.
+ * + + * @return null|StateReference + */ + public function getOldState() + { + return $this->oldState instanceof StateReferenceBuilder ? $this->oldState->build() : $this->oldState; + } + + /** + *Whether State transition validations were turned off during the Transition State update action.
+ * + + * @return null|bool + */ + public function getForce() + { + return $this->force; + } + + /** + * @param ?StateReference $state + * @return $this + */ + public function withState(?StateReference $state) + { + $this->state = $state; + + return $this; + } + + /** + * @param ?StateReference $oldState + * @return $this + */ + public function withOldState(?StateReference $oldState) + { + $this->oldState = $oldState; + + return $this; + } + + /** + * @param ?bool $force + * @return $this + */ + public function withForce(?bool $force) + { + $this->force = $force; + + return $this; + } + + /** + * @deprecated use withState() instead + * @return $this + */ + public function withStateBuilder(?StateReferenceBuilder $state) + { + $this->state = $state; + + return $this; + } + + /** + * @deprecated use withOldState() instead + * @return $this + */ + public function withOldStateBuilder(?StateReferenceBuilder $oldState) + { + $this->oldState = $oldState; + + return $this; + } + + public function build(): RecurringOrderStateTransitionMessagePayload + { + return new RecurringOrderStateTransitionMessagePayloadModel( + $this->state instanceof StateReferenceBuilder ? $this->state->build() : $this->state, + $this->oldState instanceof StateReferenceBuilder ? $this->oldState->build() : $this->oldState, + $this->force + ); + } + + public static function of(): RecurringOrderStateTransitionMessagePayloadBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/Message/RecurringOrderStateTransitionMessagePayloadCollection.php b/lib/commercetools-api/src/Models/Message/RecurringOrderStateTransitionMessagePayloadCollection.php new file mode 100644 index 00000000000..593cc9475ff --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/RecurringOrderStateTransitionMessagePayloadCollection.php @@ -0,0 +1,56 @@ + + * @method RecurringOrderStateTransitionMessagePayload current() + * @method RecurringOrderStateTransitionMessagePayload end() + * @method RecurringOrderStateTransitionMessagePayload at($offset) + */ +class RecurringOrderStateTransitionMessagePayloadCollection extends MessagePayloadCollection +{ + /** + * @psalm-assert RecurringOrderStateTransitionMessagePayload $value + * @psalm-param RecurringOrderStateTransitionMessagePayload|stdClass $value + * @throws InvalidArgumentException + * + * @return RecurringOrderStateTransitionMessagePayloadCollection + */ + public function add($value) + { + if (!$value instanceof RecurringOrderStateTransitionMessagePayload) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?RecurringOrderStateTransitionMessagePayload + */ + protected function mapper() + { + return function (?int $index): ?RecurringOrderStateTransitionMessagePayload { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var RecurringOrderStateTransitionMessagePayload $data */ + $data = RecurringOrderStateTransitionMessagePayloadModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/Message/RecurringOrderStateTransitionMessagePayloadModel.php b/lib/commercetools-api/src/Models/Message/RecurringOrderStateTransitionMessagePayloadModel.php new file mode 100644 index 00000000000..32c2cc0f393 --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/RecurringOrderStateTransitionMessagePayloadModel.php @@ -0,0 +1,169 @@ +state = $state; + $this->oldState = $oldState; + $this->force = $force; + $this->type = $type ?? self::DISCRIMINATOR_VALUE; + } + + /** + * + * @return null|string + */ + public function getType() + { + if (is_null($this->type)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_TYPE); + if (is_null($data)) { + return null; + } + $this->type = (string) $data; + } + + return $this->type; + } + + /** + *RecurringOrderState after the Transition State update action.
+ * + * + * @return null|StateReference + */ + public function getState() + { + if (is_null($this->state)) { + /** @psalm-var stdClass|arrayRecurringOrderState before the Transition State update action.
+ * + * + * @return null|StateReference + */ + public function getOldState() + { + if (is_null($this->oldState)) { + /** @psalm-var stdClass|arrayWhether State transition validations were turned off during the Transition State update action.
+ * + * + * @return null|bool + */ + public function getForce() + { + if (is_null($this->force)) { + /** @psalm-var ?bool $data */ + $data = $this->raw(self::FIELD_FORCE); + if (is_null($data)) { + return null; + } + $this->force = (bool) $data; + } + + return $this->force; + } + + + /** + * @param ?StateReference $state + */ + public function setState(?StateReference $state): void + { + $this->state = $state; + } + + /** + * @param ?StateReference $oldState + */ + public function setOldState(?StateReference $oldState): void + { + $this->oldState = $oldState; + } + + /** + * @param ?bool $force + */ + public function setForce(?bool $force): void + { + $this->force = $force; + } +} diff --git a/lib/commercetools-api/src/Models/Order/Order.php b/lib/commercetools-api/src/Models/Order/Order.php index 2a0c6c8ebe8..a606fb206c3 100644 --- a/lib/commercetools-api/src/Models/Order/Order.php +++ b/lib/commercetools-api/src/Models/Order/Order.php @@ -30,6 +30,7 @@ use Commercetools\Api\Models\CustomerGroup\CustomerGroupReference; use Commercetools\Api\Models\OrderEdit\StagedOrder; use Commercetools\Api\Models\Quote\QuoteReference; +use Commercetools\Api\Models\RecurringOrder\RecurringOrderReference; use Commercetools\Api\Models\State\StateReference; use Commercetools\Api\Models\Store\StoreKeyReference; use Commercetools\Api\Models\Type\CustomFields; @@ -76,6 +77,7 @@ interface Order extends BaseResource public const FIELD_ORIGIN = 'origin'; public const FIELD_CART = 'cart'; public const FIELD_QUOTE = 'quote'; + public const FIELD_RECURRING_ORDER = 'recurringOrder'; public const FIELD_ORDER_STATE = 'orderState'; public const FIELD_SHIPMENT_STATE = 'shipmentState'; public const FIELD_PAYMENT_STATE = 'paymentState'; @@ -424,6 +426,14 @@ public function getCart(); */ public function getQuote(); + /** + *Reference to the RecurringOrder that generated this Order.
+ * + + * @return null|RecurringOrderReference + */ + public function getRecurringOrder(); + /** *Current status of the Order.
* @@ -734,6 +744,11 @@ public function setCart(?CartReference $cart): void; */ public function setQuote(?QuoteReference $quote): void; + /** + * @param ?RecurringOrderReference $recurringOrder + */ + public function setRecurringOrder(?RecurringOrderReference $recurringOrder): void; + /** * @param ?string $orderState */ diff --git a/lib/commercetools-api/src/Models/Order/OrderBuilder.php b/lib/commercetools-api/src/Models/Order/OrderBuilder.php index b09331fd716..cc0aee88c3c 100644 --- a/lib/commercetools-api/src/Models/Order/OrderBuilder.php +++ b/lib/commercetools-api/src/Models/Order/OrderBuilder.php @@ -45,6 +45,8 @@ use Commercetools\Api\Models\OrderEdit\StagedOrderBuilder; use Commercetools\Api\Models\Quote\QuoteReference; use Commercetools\Api\Models\Quote\QuoteReferenceBuilder; +use Commercetools\Api\Models\RecurringOrder\RecurringOrderReference; +use Commercetools\Api\Models\RecurringOrder\RecurringOrderReferenceBuilder; use Commercetools\Api\Models\State\StateReference; use Commercetools\Api\Models\State\StateReferenceBuilder; use Commercetools\Api\Models\Store\StoreKeyReference; @@ -310,6 +312,12 @@ final class OrderBuilder implements Builder */ private $quote; + /** + + * @var null|RecurringOrderReference|RecurringOrderReferenceBuilder + */ + private $recurringOrder; + /** * @var ?string @@ -856,6 +864,17 @@ public function getQuote() return $this->quote instanceof QuoteReferenceBuilder ? $this->quote->build() : $this->quote; } + /** + *Reference to the RecurringOrder that generated this Order.
+ * + + * @return null|RecurringOrderReference + */ + public function getRecurringOrder() + { + return $this->recurringOrder instanceof RecurringOrderReferenceBuilder ? $this->recurringOrder->build() : $this->recurringOrder; + } + /** *Current status of the Order.
* @@ -1442,6 +1461,17 @@ public function withQuote(?QuoteReference $quote) return $this; } + /** + * @param ?RecurringOrderReference $recurringOrder + * @return $this + */ + public function withRecurringOrder(?RecurringOrderReference $recurringOrder) + { + $this->recurringOrder = $recurringOrder; + + return $this; + } + /** * @param ?string $orderState * @return $this @@ -1739,6 +1769,17 @@ public function withQuoteBuilder(?QuoteReferenceBuilder $quote) return $this; } + /** + * @deprecated use withRecurringOrder() instead + * @return $this + */ + public function withRecurringOrderBuilder(?RecurringOrderReferenceBuilder $recurringOrder) + { + $this->recurringOrder = $recurringOrder; + + return $this; + } + /** * @deprecated use withState() instead * @return $this @@ -1838,6 +1879,7 @@ public function build(): Order $this->origin, $this->cart instanceof CartReferenceBuilder ? $this->cart->build() : $this->cart, $this->quote instanceof QuoteReferenceBuilder ? $this->quote->build() : $this->quote, + $this->recurringOrder instanceof RecurringOrderReferenceBuilder ? $this->recurringOrder->build() : $this->recurringOrder, $this->orderState, $this->shipmentState, $this->paymentState, diff --git a/lib/commercetools-api/src/Models/Order/OrderModel.php b/lib/commercetools-api/src/Models/Order/OrderModel.php index 5ff70123162..06f21cdde0e 100644 --- a/lib/commercetools-api/src/Models/Order/OrderModel.php +++ b/lib/commercetools-api/src/Models/Order/OrderModel.php @@ -45,6 +45,8 @@ use Commercetools\Api\Models\OrderEdit\StagedOrderModel; use Commercetools\Api\Models\Quote\QuoteReference; use Commercetools\Api\Models\Quote\QuoteReferenceModel; +use Commercetools\Api\Models\RecurringOrder\RecurringOrderReference; +use Commercetools\Api\Models\RecurringOrder\RecurringOrderReferenceModel; use Commercetools\Api\Models\State\StateReference; use Commercetools\Api\Models\State\StateReferenceModel; use Commercetools\Api\Models\Store\StoreKeyReference; @@ -309,6 +311,12 @@ final class OrderModel extends JsonObjectModel implements Order */ protected $quote; + /** + * + * @var ?RecurringOrderReference + */ + protected $recurringOrder; + /** * * @var ?string @@ -427,6 +435,7 @@ public function __construct( ?string $origin = null, ?CartReference $cart = null, ?QuoteReference $quote = null, + ?RecurringOrderReference $recurringOrder = null, ?string $orderState = null, ?string $shipmentState = null, ?string $paymentState = null, @@ -481,6 +490,7 @@ public function __construct( $this->origin = $origin; $this->cart = $cart; $this->quote = $quote; + $this->recurringOrder = $recurringOrder; $this->orderState = $orderState; $this->shipmentState = $shipmentState; $this->paymentState = $paymentState; @@ -1361,6 +1371,27 @@ public function getQuote() return $this->quote; } + /** + *Reference to the RecurringOrder that generated this Order.
+ * + * + * @return null|RecurringOrderReference + */ + public function getRecurringOrder() + { + if (is_null($this->recurringOrder)) { + /** @psalm-var stdClass|arrayCurrent status of the Order.
* @@ -1942,6 +1973,14 @@ public function setQuote(?QuoteReference $quote): void $this->quote = $quote; } + /** + * @param ?RecurringOrderReference $recurringOrder + */ + public function setRecurringOrder(?RecurringOrderReference $recurringOrder): void + { + $this->recurringOrder = $recurringOrder; + } + /** * @param ?string $orderState */ diff --git a/lib/commercetools-api/src/Models/OrderEdit/StagedOrderAddCustomLineItemAction.php b/lib/commercetools-api/src/Models/OrderEdit/StagedOrderAddCustomLineItemAction.php index 4f4b8b58779..ed8e515361d 100644 --- a/lib/commercetools-api/src/Models/OrderEdit/StagedOrderAddCustomLineItemAction.php +++ b/lib/commercetools-api/src/Models/OrderEdit/StagedOrderAddCustomLineItemAction.php @@ -13,6 +13,7 @@ use Commercetools\Api\Models\Common\LocalizedString; use Commercetools\Api\Models\Common\Money; use Commercetools\Api\Models\Order\StagedOrderUpdateAction; +use Commercetools\Api\Models\RecurringOrder\CustomLineItemRecurrenceInfoDraft; use Commercetools\Api\Models\TaxCategory\TaxCategoryResourceIdentifier; use Commercetools\Api\Models\Type\CustomFieldsDraft; use Commercetools\Base\DateTimeImmutableCollection; @@ -30,6 +31,7 @@ interface StagedOrderAddCustomLineItemAction extends StagedOrderUpdateAction public const FIELD_SHIPPING_DETAILS = 'shippingDetails'; public const FIELD_PRICE_MODE = 'priceMode'; public const FIELD_CUSTOM = 'custom'; + public const FIELD_RECURRENCE_INFO = 'recurrenceInfo'; /** *Money value of the Custom Line Item. The value can be negative.
@@ -115,6 +117,14 @@ public function getPriceMode(); */ public function getCustom(); + /** + *Recurring Order and frequency data.
+ * + + * @return null|CustomLineItemRecurrenceInfoDraft + */ + public function getRecurrenceInfo(); + /** * @param ?Money $money */ @@ -164,4 +174,9 @@ public function setPriceMode(?string $priceMode): void; * @param ?CustomFieldsDraft $custom */ public function setCustom(?CustomFieldsDraft $custom): void; + + /** + * @param ?CustomLineItemRecurrenceInfoDraft $recurrenceInfo + */ + public function setRecurrenceInfo(?CustomLineItemRecurrenceInfoDraft $recurrenceInfo): void; } diff --git a/lib/commercetools-api/src/Models/OrderEdit/StagedOrderAddCustomLineItemActionBuilder.php b/lib/commercetools-api/src/Models/OrderEdit/StagedOrderAddCustomLineItemActionBuilder.php index 27dab9cbd7b..572a67c6a44 100644 --- a/lib/commercetools-api/src/Models/OrderEdit/StagedOrderAddCustomLineItemActionBuilder.php +++ b/lib/commercetools-api/src/Models/OrderEdit/StagedOrderAddCustomLineItemActionBuilder.php @@ -18,6 +18,8 @@ use Commercetools\Api\Models\Common\MoneyBuilder; use Commercetools\Api\Models\Order\StagedOrderUpdateAction; use Commercetools\Api\Models\Order\StagedOrderUpdateActionBuilder; +use Commercetools\Api\Models\RecurringOrder\CustomLineItemRecurrenceInfoDraft; +use Commercetools\Api\Models\RecurringOrder\CustomLineItemRecurrenceInfoDraftBuilder; use Commercetools\Api\Models\TaxCategory\TaxCategoryResourceIdentifier; use Commercetools\Api\Models\TaxCategory\TaxCategoryResourceIdentifierBuilder; use Commercetools\Api\Models\Type\CustomFieldsDraft; @@ -94,6 +96,12 @@ final class StagedOrderAddCustomLineItemActionBuilder implements Builder */ private $custom; + /** + + * @var null|CustomLineItemRecurrenceInfoDraft|CustomLineItemRecurrenceInfoDraftBuilder + */ + private $recurrenceInfo; + /** *Money value of the Custom Line Item. The value can be negative.
* @@ -208,6 +216,17 @@ public function getCustom() return $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom; } + /** + *Recurring Order and frequency data.
+ * + + * @return null|CustomLineItemRecurrenceInfoDraft + */ + public function getRecurrenceInfo() + { + return $this->recurrenceInfo instanceof CustomLineItemRecurrenceInfoDraftBuilder ? $this->recurrenceInfo->build() : $this->recurrenceInfo; + } + /** * @param ?Money $money * @return $this @@ -318,6 +337,17 @@ public function withCustom(?CustomFieldsDraft $custom) return $this; } + /** + * @param ?CustomLineItemRecurrenceInfoDraft $recurrenceInfo + * @return $this + */ + public function withRecurrenceInfo(?CustomLineItemRecurrenceInfoDraft $recurrenceInfo) + { + $this->recurrenceInfo = $recurrenceInfo; + + return $this; + } + /** * @deprecated use withMoney() instead * @return $this @@ -384,6 +414,17 @@ public function withCustomBuilder(?CustomFieldsDraftBuilder $custom) return $this; } + /** + * @deprecated use withRecurrenceInfo() instead + * @return $this + */ + public function withRecurrenceInfoBuilder(?CustomLineItemRecurrenceInfoDraftBuilder $recurrenceInfo) + { + $this->recurrenceInfo = $recurrenceInfo; + + return $this; + } + public function build(): StagedOrderAddCustomLineItemAction { return new StagedOrderAddCustomLineItemActionModel( @@ -396,7 +437,8 @@ public function build(): StagedOrderAddCustomLineItemAction $this->externalTaxRate instanceof ExternalTaxRateDraftBuilder ? $this->externalTaxRate->build() : $this->externalTaxRate, $this->shippingDetails instanceof ItemShippingDetailsDraftBuilder ? $this->shippingDetails->build() : $this->shippingDetails, $this->priceMode, - $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom + $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom, + $this->recurrenceInfo instanceof CustomLineItemRecurrenceInfoDraftBuilder ? $this->recurrenceInfo->build() : $this->recurrenceInfo ); } diff --git a/lib/commercetools-api/src/Models/OrderEdit/StagedOrderAddCustomLineItemActionModel.php b/lib/commercetools-api/src/Models/OrderEdit/StagedOrderAddCustomLineItemActionModel.php index 518322da13d..428c7397276 100644 --- a/lib/commercetools-api/src/Models/OrderEdit/StagedOrderAddCustomLineItemActionModel.php +++ b/lib/commercetools-api/src/Models/OrderEdit/StagedOrderAddCustomLineItemActionModel.php @@ -18,6 +18,8 @@ use Commercetools\Api\Models\Common\MoneyModel; use Commercetools\Api\Models\Order\StagedOrderUpdateAction; use Commercetools\Api\Models\Order\StagedOrderUpdateActionModel; +use Commercetools\Api\Models\RecurringOrder\CustomLineItemRecurrenceInfoDraft; +use Commercetools\Api\Models\RecurringOrder\CustomLineItemRecurrenceInfoDraftModel; use Commercetools\Api\Models\TaxCategory\TaxCategoryResourceIdentifier; use Commercetools\Api\Models\TaxCategory\TaxCategoryResourceIdentifierModel; use Commercetools\Api\Models\Type\CustomFieldsDraft; @@ -100,6 +102,12 @@ final class StagedOrderAddCustomLineItemActionModel extends JsonObjectModel impl */ protected $custom; + /** + * + * @var ?CustomLineItemRecurrenceInfoDraft + */ + protected $recurrenceInfo; + /** * @psalm-suppress MissingParamType @@ -115,6 +123,7 @@ public function __construct( ?ItemShippingDetailsDraft $shippingDetails = null, ?string $priceMode = null, ?CustomFieldsDraft $custom = null, + ?CustomLineItemRecurrenceInfoDraft $recurrenceInfo = null, ?string $action = null ) { $this->money = $money; @@ -127,6 +136,7 @@ public function __construct( $this->shippingDetails = $shippingDetails; $this->priceMode = $priceMode; $this->custom = $custom; + $this->recurrenceInfo = $recurrenceInfo; $this->action = $action ?? self::DISCRIMINATOR_VALUE; } @@ -358,6 +368,27 @@ public function getCustom() return $this->custom; } + /** + *Recurring Order and frequency data.
+ * + * + * @return null|CustomLineItemRecurrenceInfoDraft + */ + public function getRecurrenceInfo() + { + if (is_null($this->recurrenceInfo)) { + /** @psalm-var stdClass|arrayUser-defined unique identifier of the LineItem.
@@ -158,6 +160,14 @@ public function getShippingDetails(); */ public function getCustom(); + /** + *Recurring Order and frequency data.
+ * + + * @return null|LineItemRecurrenceInfoDraft + */ + public function getRecurrenceInfo(); + /** * @param ?string $key */ @@ -227,4 +237,9 @@ public function setShippingDetails(?ItemShippingDetailsDraft $shippingDetails): * @param ?CustomFieldsDraft $custom */ public function setCustom(?CustomFieldsDraft $custom): void; + + /** + * @param ?LineItemRecurrenceInfoDraft $recurrenceInfo + */ + public function setRecurrenceInfo(?LineItemRecurrenceInfoDraft $recurrenceInfo): void; } diff --git a/lib/commercetools-api/src/Models/OrderEdit/StagedOrderAddLineItemActionBuilder.php b/lib/commercetools-api/src/Models/OrderEdit/StagedOrderAddLineItemActionBuilder.php index 8681811b496..9faeeb572f3 100644 --- a/lib/commercetools-api/src/Models/OrderEdit/StagedOrderAddLineItemActionBuilder.php +++ b/lib/commercetools-api/src/Models/OrderEdit/StagedOrderAddLineItemActionBuilder.php @@ -20,6 +20,8 @@ use Commercetools\Api\Models\Common\MoneyBuilder; use Commercetools\Api\Models\Order\StagedOrderUpdateAction; use Commercetools\Api\Models\Order\StagedOrderUpdateActionBuilder; +use Commercetools\Api\Models\RecurringOrder\LineItemRecurrenceInfoDraft; +use Commercetools\Api\Models\RecurringOrder\LineItemRecurrenceInfoDraftBuilder; use Commercetools\Api\Models\Type\CustomFieldsDraft; use Commercetools\Api\Models\Type\CustomFieldsDraftBuilder; use Commercetools\Base\Builder; @@ -119,6 +121,12 @@ final class StagedOrderAddLineItemActionBuilder implements Builder */ private $custom; + /** + + * @var null|LineItemRecurrenceInfoDraft|LineItemRecurrenceInfoDraftBuilder + */ + private $recurrenceInfo; + /** *User-defined unique identifier of the LineItem.
* @@ -283,6 +291,17 @@ public function getCustom() return $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom; } + /** + *Recurring Order and frequency data.
+ * + + * @return null|LineItemRecurrenceInfoDraft + */ + public function getRecurrenceInfo() + { + return $this->recurrenceInfo instanceof LineItemRecurrenceInfoDraftBuilder ? $this->recurrenceInfo->build() : $this->recurrenceInfo; + } + /** * @param ?string $key * @return $this @@ -437,6 +456,17 @@ public function withCustom(?CustomFieldsDraft $custom) return $this; } + /** + * @param ?LineItemRecurrenceInfoDraft $recurrenceInfo + * @return $this + */ + public function withRecurrenceInfo(?LineItemRecurrenceInfoDraft $recurrenceInfo) + { + $this->recurrenceInfo = $recurrenceInfo; + + return $this; + } + /** * @deprecated use withDistributionChannel() instead * @return $this @@ -514,6 +544,17 @@ public function withCustomBuilder(?CustomFieldsDraftBuilder $custom) return $this; } + /** + * @deprecated use withRecurrenceInfo() instead + * @return $this + */ + public function withRecurrenceInfoBuilder(?LineItemRecurrenceInfoDraftBuilder $recurrenceInfo) + { + $this->recurrenceInfo = $recurrenceInfo; + + return $this; + } + public function build(): StagedOrderAddLineItemAction { return new StagedOrderAddLineItemActionModel( @@ -530,7 +571,8 @@ public function build(): StagedOrderAddLineItemAction $this->externalTaxRate instanceof ExternalTaxRateDraftBuilder ? $this->externalTaxRate->build() : $this->externalTaxRate, $this->inventoryMode, $this->shippingDetails instanceof ItemShippingDetailsDraftBuilder ? $this->shippingDetails->build() : $this->shippingDetails, - $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom + $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom, + $this->recurrenceInfo instanceof LineItemRecurrenceInfoDraftBuilder ? $this->recurrenceInfo->build() : $this->recurrenceInfo ); } diff --git a/lib/commercetools-api/src/Models/OrderEdit/StagedOrderAddLineItemActionModel.php b/lib/commercetools-api/src/Models/OrderEdit/StagedOrderAddLineItemActionModel.php index 1d2a21ef8f0..819539f6a9e 100644 --- a/lib/commercetools-api/src/Models/OrderEdit/StagedOrderAddLineItemActionModel.php +++ b/lib/commercetools-api/src/Models/OrderEdit/StagedOrderAddLineItemActionModel.php @@ -20,6 +20,8 @@ use Commercetools\Api\Models\Common\MoneyModel; use Commercetools\Api\Models\Order\StagedOrderUpdateAction; use Commercetools\Api\Models\Order\StagedOrderUpdateActionModel; +use Commercetools\Api\Models\RecurringOrder\LineItemRecurrenceInfoDraft; +use Commercetools\Api\Models\RecurringOrder\LineItemRecurrenceInfoDraftModel; use Commercetools\Api\Models\Type\CustomFieldsDraft; use Commercetools\Api\Models\Type\CustomFieldsDraftModel; use Commercetools\Base\DateTimeImmutableCollection; @@ -125,6 +127,12 @@ final class StagedOrderAddLineItemActionModel extends JsonObjectModel implements */ protected $custom; + /** + * + * @var ?LineItemRecurrenceInfoDraft + */ + protected $recurrenceInfo; + /** * @psalm-suppress MissingParamType @@ -144,6 +152,7 @@ public function __construct( ?string $inventoryMode = null, ?ItemShippingDetailsDraft $shippingDetails = null, ?CustomFieldsDraft $custom = null, + ?LineItemRecurrenceInfoDraft $recurrenceInfo = null, ?string $action = null ) { $this->key = $key; @@ -160,6 +169,7 @@ public function __construct( $this->inventoryMode = $inventoryMode; $this->shippingDetails = $shippingDetails; $this->custom = $custom; + $this->recurrenceInfo = $recurrenceInfo; $this->action = $action ?? self::DISCRIMINATOR_VALUE; } @@ -482,6 +492,27 @@ public function getCustom() return $this->custom; } + /** + *Recurring Order and frequency data.
+ * + * + * @return null|LineItemRecurrenceInfoDraft + */ + public function getRecurrenceInfo() + { + if (is_null($this->recurrenceInfo)) { + /** @psalm-var stdClass|arrayReference to the RecurringOrder that generated this Order.
+ * + + * @return null|RecurringOrderReference + */ + public function getRecurringOrder() + { + return $this->recurringOrder instanceof RecurringOrderReferenceBuilder ? $this->recurringOrder->build() : $this->recurringOrder; + } + /** *Current status of the Order.
* @@ -1444,6 +1463,17 @@ public function withQuote(?QuoteReference $quote) return $this; } + /** + * @param ?RecurringOrderReference $recurringOrder + * @return $this + */ + public function withRecurringOrder(?RecurringOrderReference $recurringOrder) + { + $this->recurringOrder = $recurringOrder; + + return $this; + } + /** * @param ?string $orderState * @return $this @@ -1741,6 +1771,17 @@ public function withQuoteBuilder(?QuoteReferenceBuilder $quote) return $this; } + /** + * @deprecated use withRecurringOrder() instead + * @return $this + */ + public function withRecurringOrderBuilder(?RecurringOrderReferenceBuilder $recurringOrder) + { + $this->recurringOrder = $recurringOrder; + + return $this; + } + /** * @deprecated use withState() instead * @return $this @@ -1840,6 +1881,7 @@ public function build(): StagedOrder $this->origin, $this->cart instanceof CartReferenceBuilder ? $this->cart->build() : $this->cart, $this->quote instanceof QuoteReferenceBuilder ? $this->quote->build() : $this->quote, + $this->recurringOrder instanceof RecurringOrderReferenceBuilder ? $this->recurringOrder->build() : $this->recurringOrder, $this->orderState, $this->shipmentState, $this->paymentState, diff --git a/lib/commercetools-api/src/Models/OrderEdit/StagedOrderModel.php b/lib/commercetools-api/src/Models/OrderEdit/StagedOrderModel.php index 467e85dc09c..16785272b42 100644 --- a/lib/commercetools-api/src/Models/OrderEdit/StagedOrderModel.php +++ b/lib/commercetools-api/src/Models/OrderEdit/StagedOrderModel.php @@ -47,6 +47,8 @@ use Commercetools\Api\Models\Order\SyncInfoCollection; use Commercetools\Api\Models\Quote\QuoteReference; use Commercetools\Api\Models\Quote\QuoteReferenceModel; +use Commercetools\Api\Models\RecurringOrder\RecurringOrderReference; +use Commercetools\Api\Models\RecurringOrder\RecurringOrderReferenceModel; use Commercetools\Api\Models\State\StateReference; use Commercetools\Api\Models\State\StateReferenceModel; use Commercetools\Api\Models\Store\StoreKeyReference; @@ -311,6 +313,12 @@ final class StagedOrderModel extends JsonObjectModel implements StagedOrder */ protected $quote; + /** + * + * @var ?RecurringOrderReference + */ + protected $recurringOrder; + /** * * @var ?string @@ -429,6 +437,7 @@ public function __construct( ?string $origin = null, ?CartReference $cart = null, ?QuoteReference $quote = null, + ?RecurringOrderReference $recurringOrder = null, ?string $orderState = null, ?string $shipmentState = null, ?string $paymentState = null, @@ -483,6 +492,7 @@ public function __construct( $this->origin = $origin; $this->cart = $cart; $this->quote = $quote; + $this->recurringOrder = $recurringOrder; $this->orderState = $orderState; $this->shipmentState = $shipmentState; $this->paymentState = $paymentState; @@ -1363,6 +1373,27 @@ public function getQuote() return $this->quote; } + /** + *Reference to the RecurringOrder that generated this Order.
+ * + * + * @return null|RecurringOrderReference + */ + public function getRecurringOrder() + { + if (is_null($this->recurringOrder)) { + /** @psalm-var stdClass|arrayCurrent status of the Order.
* @@ -1944,6 +1975,14 @@ public function setQuote(?QuoteReference $quote): void $this->quote = $quote; } + /** + * @param ?RecurringOrderReference $recurringOrder + */ + public function setRecurringOrder(?RecurringOrderReference $recurringOrder): void + { + $this->recurringOrder = $recurringOrder; + } + /** * @param ?string $orderState */ diff --git a/lib/commercetools-api/src/Models/Product/ProductVariant.php b/lib/commercetools-api/src/Models/Product/ProductVariant.php index d662d9682be..1f63305a2d7 100644 --- a/lib/commercetools-api/src/Models/Product/ProductVariant.php +++ b/lib/commercetools-api/src/Models/Product/ProductVariant.php @@ -30,6 +30,7 @@ interface ProductVariant extends JsonObject public const FIELD_IS_MATCHING_VARIANT = 'isMatchingVariant'; public const FIELD_SCOPED_PRICE = 'scopedPrice'; public const FIELD_SCOPED_PRICE_DISCOUNTED = 'scopedPriceDiscounted'; + public const FIELD_RECURRENCE_PRICES = 'recurrencePrices'; /** *A unique, sequential identifier of the Product Variant within the Product.
@@ -136,6 +137,15 @@ public function getScopedPrice(); */ public function getScopedPriceDiscounted(); + /** + *Only available when Product price selection is used. + * Cannot be used in a Query Predicate.
+ * + + * @return null|PriceCollection + */ + public function getRecurrencePrices(); + /** * @param ?int $id */ @@ -195,4 +205,9 @@ public function setScopedPrice(?ScopedPrice $scopedPrice): void; * @param ?bool $scopedPriceDiscounted */ public function setScopedPriceDiscounted(?bool $scopedPriceDiscounted): void; + + /** + * @param ?PriceCollection $recurrencePrices + */ + public function setRecurrencePrices(?PriceCollection $recurrencePrices): void; } diff --git a/lib/commercetools-api/src/Models/Product/ProductVariantBuilder.php b/lib/commercetools-api/src/Models/Product/ProductVariantBuilder.php index 139eb7ab99e..8d47f4bcc54 100644 --- a/lib/commercetools-api/src/Models/Product/ProductVariantBuilder.php +++ b/lib/commercetools-api/src/Models/Product/ProductVariantBuilder.php @@ -99,6 +99,12 @@ final class ProductVariantBuilder implements Builder */ private $scopedPriceDiscounted; + /** + + * @var ?PriceCollection + */ + private $recurrencePrices; + /** *A unique, sequential identifier of the Product Variant within the Product.
* @@ -240,6 +246,18 @@ public function getScopedPriceDiscounted() return $this->scopedPriceDiscounted; } + /** + *Only available when Product price selection is used. + * Cannot be used in a Query Predicate.
+ * + + * @return null|PriceCollection + */ + public function getRecurrencePrices() + { + return $this->recurrencePrices; + } + /** * @param ?int $id * @return $this @@ -372,6 +390,17 @@ public function withScopedPriceDiscounted(?bool $scopedPriceDiscounted) return $this; } + /** + * @param ?PriceCollection $recurrencePrices + * @return $this + */ + public function withRecurrencePrices(?PriceCollection $recurrencePrices) + { + $this->recurrencePrices = $recurrencePrices; + + return $this; + } + /** * @deprecated use withPrice() instead * @return $this @@ -419,7 +448,8 @@ public function build(): ProductVariant $this->availability instanceof ProductVariantAvailabilityBuilder ? $this->availability->build() : $this->availability, $this->isMatchingVariant, $this->scopedPrice instanceof ScopedPriceBuilder ? $this->scopedPrice->build() : $this->scopedPrice, - $this->scopedPriceDiscounted + $this->scopedPriceDiscounted, + $this->recurrencePrices ); } diff --git a/lib/commercetools-api/src/Models/Product/ProductVariantModel.php b/lib/commercetools-api/src/Models/Product/ProductVariantModel.php index 7daceee73f0..bb05bfecbfe 100644 --- a/lib/commercetools-api/src/Models/Product/ProductVariantModel.php +++ b/lib/commercetools-api/src/Models/Product/ProductVariantModel.php @@ -98,6 +98,12 @@ final class ProductVariantModel extends JsonObjectModel implements ProductVarian */ protected $scopedPriceDiscounted; + /** + * + * @var ?PriceCollection + */ + protected $recurrencePrices; + /** * @psalm-suppress MissingParamType @@ -114,7 +120,8 @@ public function __construct( ?ProductVariantAvailability $availability = null, ?bool $isMatchingVariant = null, ?ScopedPrice $scopedPrice = null, - ?bool $scopedPriceDiscounted = null + ?bool $scopedPriceDiscounted = null, + ?PriceCollection $recurrencePrices = null ) { $this->id = $id; $this->sku = $sku; @@ -128,6 +135,7 @@ public function __construct( $this->isMatchingVariant = $isMatchingVariant; $this->scopedPrice = $scopedPrice; $this->scopedPriceDiscounted = $scopedPriceDiscounted; + $this->recurrencePrices = $recurrencePrices; } /** @@ -382,6 +390,27 @@ public function getScopedPriceDiscounted() return $this->scopedPriceDiscounted; } + /** + *Only available when Product price selection is used. + * Cannot be used in a Query Predicate.
+ * + * + * @return null|PriceCollection + */ + public function getRecurrencePrices() + { + if (is_null($this->recurrencePrices)) { + /** @psalm-var ?listThe day of the month when the Recurring Order is created. + * If the value is greater than the number of days in a given month, the order is created on the last day of the month.
+ * + + * @return null|int + */ + public function getDay() + { + return $this->day; + } + + /** + * @param ?int $day + * @return $this + */ + public function withDay(?int $day) + { + $this->day = $day; + + return $this; + } + + + public function build(): DayOfMonthSchedule + { + return new DayOfMonthScheduleModel( + $this->day + ); + } + + public static function of(): DayOfMonthScheduleBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/RecurrencePolicy/DayOfMonthScheduleCollection.php b/lib/commercetools-api/src/Models/RecurrencePolicy/DayOfMonthScheduleCollection.php new file mode 100644 index 00000000000..7fe536fe9ac --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurrencePolicy/DayOfMonthScheduleCollection.php @@ -0,0 +1,56 @@ + + * @method DayOfMonthSchedule current() + * @method DayOfMonthSchedule end() + * @method DayOfMonthSchedule at($offset) + */ +class DayOfMonthScheduleCollection extends RecurrencePolicyScheduleCollection +{ + /** + * @psalm-assert DayOfMonthSchedule $value + * @psalm-param DayOfMonthSchedule|stdClass $value + * @throws InvalidArgumentException + * + * @return DayOfMonthScheduleCollection + */ + public function add($value) + { + if (!$value instanceof DayOfMonthSchedule) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?DayOfMonthSchedule + */ + protected function mapper() + { + return function (?int $index): ?DayOfMonthSchedule { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var DayOfMonthSchedule $data */ + $data = DayOfMonthScheduleModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/RecurrencePolicy/DayOfMonthScheduleDraft.php b/lib/commercetools-api/src/Models/RecurrencePolicy/DayOfMonthScheduleDraft.php new file mode 100644 index 00000000000..506e5380ad0 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurrencePolicy/DayOfMonthScheduleDraft.php @@ -0,0 +1,37 @@ +The day of the month when the Recurring Order should be created. + * If the value is greater than the number of days in a given month, the order will be created on the last day of the month. + * + + * @return null|int + */ + public function getDay(); + + /** + * @param ?int $day + */ + public function setDay(?int $day): void; +} diff --git a/lib/commercetools-api/src/Models/RecurrencePolicy/DayOfMonthScheduleDraftBuilder.php b/lib/commercetools-api/src/Models/RecurrencePolicy/DayOfMonthScheduleDraftBuilder.php new file mode 100644 index 00000000000..c6e4aea54e4 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurrencePolicy/DayOfMonthScheduleDraftBuilder.php @@ -0,0 +1,64 @@ + + */ +final class DayOfMonthScheduleDraftBuilder implements Builder +{ + /** + + * @var ?int + */ + private $day; + + /** + *The day of the month when the Recurring Order should be created. + * If the value is greater than the number of days in a given month, the order will be created on the last day of the month.
+ * + + * @return null|int + */ + public function getDay() + { + return $this->day; + } + + /** + * @param ?int $day + * @return $this + */ + public function withDay(?int $day) + { + $this->day = $day; + + return $this; + } + + + public function build(): DayOfMonthScheduleDraft + { + return new DayOfMonthScheduleDraftModel( + $this->day + ); + } + + public static function of(): DayOfMonthScheduleDraftBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/RecurrencePolicy/DayOfMonthScheduleDraftCollection.php b/lib/commercetools-api/src/Models/RecurrencePolicy/DayOfMonthScheduleDraftCollection.php new file mode 100644 index 00000000000..29f72f42d7e --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurrencePolicy/DayOfMonthScheduleDraftCollection.php @@ -0,0 +1,56 @@ + + * @method DayOfMonthScheduleDraft current() + * @method DayOfMonthScheduleDraft end() + * @method DayOfMonthScheduleDraft at($offset) + */ +class DayOfMonthScheduleDraftCollection extends RecurrencePolicyScheduleDraftCollection +{ + /** + * @psalm-assert DayOfMonthScheduleDraft $value + * @psalm-param DayOfMonthScheduleDraft|stdClass $value + * @throws InvalidArgumentException + * + * @return DayOfMonthScheduleDraftCollection + */ + public function add($value) + { + if (!$value instanceof DayOfMonthScheduleDraft) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?DayOfMonthScheduleDraft + */ + protected function mapper() + { + return function (?int $index): ?DayOfMonthScheduleDraft { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var DayOfMonthScheduleDraft $data */ + $data = DayOfMonthScheduleDraftModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/RecurrencePolicy/DayOfMonthScheduleDraftModel.php b/lib/commercetools-api/src/Models/RecurrencePolicy/DayOfMonthScheduleDraftModel.php new file mode 100644 index 00000000000..fb6e87c4fec --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurrencePolicy/DayOfMonthScheduleDraftModel.php @@ -0,0 +1,93 @@ +day = $day; + $this->type = $type; + } + + /** + * + * @return null|string + */ + public function getType() + { + if (is_null($this->type)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_TYPE); + if (is_null($data)) { + return null; + } + $this->type = (string) $data; + } + + return $this->type; + } + + /** + *The day of the month when the Recurring Order should be created. + * If the value is greater than the number of days in a given month, the order will be created on the last day of the month.
+ * + * + * @return null|int + */ + public function getDay() + { + if (is_null($this->day)) { + /** @psalm-var ?int $data */ + $data = $this->raw(self::FIELD_DAY); + if (is_null($data)) { + return null; + } + $this->day = (int) $data; + } + + return $this->day; + } + + + /** + * @param ?int $day + */ + public function setDay(?int $day): void + { + $this->day = $day; + } +} diff --git a/lib/commercetools-api/src/Models/RecurrencePolicy/DayOfMonthScheduleModel.php b/lib/commercetools-api/src/Models/RecurrencePolicy/DayOfMonthScheduleModel.php new file mode 100644 index 00000000000..b35b14117d8 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurrencePolicy/DayOfMonthScheduleModel.php @@ -0,0 +1,94 @@ +day = $day; + $this->type = $type ?? self::DISCRIMINATOR_VALUE; + } + + /** + * + * @return null|string + */ + public function getType() + { + if (is_null($this->type)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_TYPE); + if (is_null($data)) { + return null; + } + $this->type = (string) $data; + } + + return $this->type; + } + + /** + *The day of the month when the Recurring Order is created. + * If the value is greater than the number of days in a given month, the order is created on the last day of the month.
+ * + * + * @return null|int + */ + public function getDay() + { + if (is_null($this->day)) { + /** @psalm-var ?int $data */ + $data = $this->raw(self::FIELD_DAY); + if (is_null($data)) { + return null; + } + $this->day = (int) $data; + } + + return $this->day; + } + + + /** + * @param ?int $day + */ + public function setDay(?int $day): void + { + $this->day = $day; + } +} diff --git a/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicy.php b/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicy.php new file mode 100644 index 00000000000..4d8c631c24c --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicy.php @@ -0,0 +1,157 @@ +Unique identifier of the RecurrencePolicy. + * + + * @return null|string + */ + public function getId(); + + /** + *Current version of the RecurrencePolicy.
+ * + + * @return null|int + */ + public function getVersion(); + + /** + *User-defined unique identifier of the RecurrencePolicy.
+ * + + * @return null|string + */ + public function getKey(); + + /** + *Name of the RecurrencePolicy.
+ * + + * @return null|LocalizedString + */ + public function getName(); + + /** + *Description of the RecurrencePolicy.
+ * + + * @return null|LocalizedString + */ + public function getDescription(); + + /** + *Schedule of the RecurrencePolicy.
+ * + + * @return null|RecurrencePolicySchedule + */ + public function getSchedule(); + + /** + *Date and time (UTC) the RecurrencePolicy was initially created.
+ * + + * @return null|DateTimeImmutable + */ + public function getCreatedAt(); + + /** + *IDs and references that created the RecurrencePolicy.
+ * + + * @return null|CreatedBy + */ + public function getCreatedBy(); + + /** + *Date and time (UTC) the RecurrencePolicy was last updated.
+ * + + * @return null|DateTimeImmutable + */ + public function getLastModifiedAt(); + + /** + *IDs and references that last modified the RecurrencePolicy.
+ * + + * @return null|LastModifiedBy + */ + public function getLastModifiedBy(); + + /** + * @param ?string $id + */ + public function setId(?string $id): void; + + /** + * @param ?int $version + */ + public function setVersion(?int $version): void; + + /** + * @param ?string $key + */ + public function setKey(?string $key): void; + + /** + * @param ?LocalizedString $name + */ + public function setName(?LocalizedString $name): void; + + /** + * @param ?LocalizedString $description + */ + public function setDescription(?LocalizedString $description): void; + + /** + * @param ?RecurrencePolicySchedule $schedule + */ + public function setSchedule(?RecurrencePolicySchedule $schedule): void; + + /** + * @param ?DateTimeImmutable $createdAt + */ + public function setCreatedAt(?DateTimeImmutable $createdAt): void; + + /** + * @param ?CreatedBy $createdBy + */ + public function setCreatedBy(?CreatedBy $createdBy): void; + + /** + * @param ?DateTimeImmutable $lastModifiedAt + */ + public function setLastModifiedAt(?DateTimeImmutable $lastModifiedAt): void; + + /** + * @param ?LastModifiedBy $lastModifiedBy + */ + public function setLastModifiedBy(?LastModifiedBy $lastModifiedBy): void; +} diff --git a/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicyBuilder.php b/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicyBuilder.php new file mode 100644 index 00000000000..70612c77fc1 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicyBuilder.php @@ -0,0 +1,387 @@ + + */ +final class RecurrencePolicyBuilder implements Builder +{ + /** + + * @var ?string + */ + private $id; + + /** + + * @var ?int + */ + private $version; + + /** + + * @var ?DateTimeImmutable + */ + private $createdAt; + + /** + + * @var ?DateTimeImmutable + */ + private $lastModifiedAt; + + /** + + * @var ?string + */ + private $key; + + /** + + * @var null|LocalizedString|LocalizedStringBuilder + */ + private $name; + + /** + + * @var null|LocalizedString|LocalizedStringBuilder + */ + private $description; + + /** + + * @var null|RecurrencePolicySchedule|RecurrencePolicyScheduleBuilder + */ + private $schedule; + + /** + + * @var null|CreatedBy|CreatedByBuilder + */ + private $createdBy; + + /** + + * @var null|LastModifiedBy|LastModifiedByBuilder + */ + private $lastModifiedBy; + + /** + *Unique identifier of the RecurrencePolicy.
+ * + + * @return null|string + */ + public function getId() + { + return $this->id; + } + + /** + *Current version of the RecurrencePolicy.
+ * + + * @return null|int + */ + public function getVersion() + { + return $this->version; + } + + /** + *Date and time (UTC) the RecurrencePolicy was initially created.
+ * + + * @return null|DateTimeImmutable + */ + public function getCreatedAt() + { + return $this->createdAt; + } + + /** + *Date and time (UTC) the RecurrencePolicy was last updated.
+ * + + * @return null|DateTimeImmutable + */ + public function getLastModifiedAt() + { + return $this->lastModifiedAt; + } + + /** + *User-defined unique identifier of the RecurrencePolicy.
+ * + + * @return null|string + */ + public function getKey() + { + return $this->key; + } + + /** + *Name of the RecurrencePolicy.
+ * + + * @return null|LocalizedString + */ + public function getName() + { + return $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name; + } + + /** + *Description of the RecurrencePolicy.
+ * + + * @return null|LocalizedString + */ + public function getDescription() + { + return $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description; + } + + /** + *Schedule of the RecurrencePolicy.
+ * + + * @return null|RecurrencePolicySchedule + */ + public function getSchedule() + { + return $this->schedule instanceof RecurrencePolicyScheduleBuilder ? $this->schedule->build() : $this->schedule; + } + + /** + *IDs and references that created the RecurrencePolicy.
+ * + + * @return null|CreatedBy + */ + public function getCreatedBy() + { + return $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy; + } + + /** + *IDs and references that last modified the RecurrencePolicy.
+ * + + * @return null|LastModifiedBy + */ + public function getLastModifiedBy() + { + return $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy; + } + + /** + * @param ?string $id + * @return $this + */ + public function withId(?string $id) + { + $this->id = $id; + + return $this; + } + + /** + * @param ?int $version + * @return $this + */ + public function withVersion(?int $version) + { + $this->version = $version; + + return $this; + } + + /** + * @param ?DateTimeImmutable $createdAt + * @return $this + */ + public function withCreatedAt(?DateTimeImmutable $createdAt) + { + $this->createdAt = $createdAt; + + return $this; + } + + /** + * @param ?DateTimeImmutable $lastModifiedAt + * @return $this + */ + public function withLastModifiedAt(?DateTimeImmutable $lastModifiedAt) + { + $this->lastModifiedAt = $lastModifiedAt; + + return $this; + } + + /** + * @param ?string $key + * @return $this + */ + public function withKey(?string $key) + { + $this->key = $key; + + return $this; + } + + /** + * @param ?LocalizedString $name + * @return $this + */ + public function withName(?LocalizedString $name) + { + $this->name = $name; + + return $this; + } + + /** + * @param ?LocalizedString $description + * @return $this + */ + public function withDescription(?LocalizedString $description) + { + $this->description = $description; + + return $this; + } + + /** + * @param ?RecurrencePolicySchedule $schedule + * @return $this + */ + public function withSchedule(?RecurrencePolicySchedule $schedule) + { + $this->schedule = $schedule; + + return $this; + } + + /** + * @param ?CreatedBy $createdBy + * @return $this + */ + public function withCreatedBy(?CreatedBy $createdBy) + { + $this->createdBy = $createdBy; + + return $this; + } + + /** + * @param ?LastModifiedBy $lastModifiedBy + * @return $this + */ + public function withLastModifiedBy(?LastModifiedBy $lastModifiedBy) + { + $this->lastModifiedBy = $lastModifiedBy; + + return $this; + } + + /** + * @deprecated use withName() instead + * @return $this + */ + public function withNameBuilder(?LocalizedStringBuilder $name) + { + $this->name = $name; + + return $this; + } + + /** + * @deprecated use withDescription() instead + * @return $this + */ + public function withDescriptionBuilder(?LocalizedStringBuilder $description) + { + $this->description = $description; + + return $this; + } + + /** + * @deprecated use withSchedule() instead + * @return $this + */ + public function withScheduleBuilder(?RecurrencePolicyScheduleBuilder $schedule) + { + $this->schedule = $schedule; + + return $this; + } + + /** + * @deprecated use withCreatedBy() instead + * @return $this + */ + public function withCreatedByBuilder(?CreatedByBuilder $createdBy) + { + $this->createdBy = $createdBy; + + return $this; + } + + /** + * @deprecated use withLastModifiedBy() instead + * @return $this + */ + public function withLastModifiedByBuilder(?LastModifiedByBuilder $lastModifiedBy) + { + $this->lastModifiedBy = $lastModifiedBy; + + return $this; + } + + public function build(): RecurrencePolicy + { + return new RecurrencePolicyModel( + $this->id, + $this->version, + $this->createdAt, + $this->lastModifiedAt, + $this->key, + $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name, + $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description, + $this->schedule instanceof RecurrencePolicyScheduleBuilder ? $this->schedule->build() : $this->schedule, + $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy, + $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy + ); + } + + public static function of(): RecurrencePolicyBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicyCollection.php b/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicyCollection.php new file mode 100644 index 00000000000..85d05e0bce5 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicyCollection.php @@ -0,0 +1,56 @@ + + * @method RecurrencePolicy current() + * @method RecurrencePolicy end() + * @method RecurrencePolicy at($offset) + */ +class RecurrencePolicyCollection extends BaseResourceCollection +{ + /** + * @psalm-assert RecurrencePolicy $value + * @psalm-param RecurrencePolicy|stdClass $value + * @throws InvalidArgumentException + * + * @return RecurrencePolicyCollection + */ + public function add($value) + { + if (!$value instanceof RecurrencePolicy) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?RecurrencePolicy + */ + protected function mapper() + { + return function (?int $index): ?RecurrencePolicy { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var RecurrencePolicy $data */ + $data = RecurrencePolicyModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicyDraft.php b/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicyDraft.php new file mode 100644 index 00000000000..f9abf56b82b --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicyDraft.php @@ -0,0 +1,73 @@ +User-defined unique identifier for the RecurrencePolicy. + * + + * @return null|string + */ + public function getKey(); + + /** + *Name of the RecurrencePolicy.
+ * + + * @return null|LocalizedString + */ + public function getName(); + + /** + *Description of the RecurrencePolicy.
+ * + + * @return null|LocalizedString + */ + public function getDescription(); + + /** + *Schedule where the recurrence is defined.
+ * + + * @return null|RecurrencePolicyScheduleDraft + */ + public function getSchedule(); + + /** + * @param ?string $key + */ + public function setKey(?string $key): void; + + /** + * @param ?LocalizedString $name + */ + public function setName(?LocalizedString $name): void; + + /** + * @param ?LocalizedString $description + */ + public function setDescription(?LocalizedString $description): void; + + /** + * @param ?RecurrencePolicyScheduleDraft $schedule + */ + public function setSchedule(?RecurrencePolicyScheduleDraft $schedule): void; +} diff --git a/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicyDraftBuilder.php b/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicyDraftBuilder.php new file mode 100644 index 00000000000..985b5f22db1 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicyDraftBuilder.php @@ -0,0 +1,184 @@ + + */ +final class RecurrencePolicyDraftBuilder implements Builder +{ + /** + + * @var ?string + */ + private $key; + + /** + + * @var null|LocalizedString|LocalizedStringBuilder + */ + private $name; + + /** + + * @var null|LocalizedString|LocalizedStringBuilder + */ + private $description; + + /** + + * @var null|RecurrencePolicyScheduleDraft|RecurrencePolicyScheduleDraftBuilder + */ + private $schedule; + + /** + *User-defined unique identifier for the RecurrencePolicy.
+ * + + * @return null|string + */ + public function getKey() + { + return $this->key; + } + + /** + *Name of the RecurrencePolicy.
+ * + + * @return null|LocalizedString + */ + public function getName() + { + return $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name; + } + + /** + *Description of the RecurrencePolicy.
+ * + + * @return null|LocalizedString + */ + public function getDescription() + { + return $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description; + } + + /** + *Schedule where the recurrence is defined.
+ * + + * @return null|RecurrencePolicyScheduleDraft + */ + public function getSchedule() + { + return $this->schedule instanceof RecurrencePolicyScheduleDraftBuilder ? $this->schedule->build() : $this->schedule; + } + + /** + * @param ?string $key + * @return $this + */ + public function withKey(?string $key) + { + $this->key = $key; + + return $this; + } + + /** + * @param ?LocalizedString $name + * @return $this + */ + public function withName(?LocalizedString $name) + { + $this->name = $name; + + return $this; + } + + /** + * @param ?LocalizedString $description + * @return $this + */ + public function withDescription(?LocalizedString $description) + { + $this->description = $description; + + return $this; + } + + /** + * @param ?RecurrencePolicyScheduleDraft $schedule + * @return $this + */ + public function withSchedule(?RecurrencePolicyScheduleDraft $schedule) + { + $this->schedule = $schedule; + + return $this; + } + + /** + * @deprecated use withName() instead + * @return $this + */ + public function withNameBuilder(?LocalizedStringBuilder $name) + { + $this->name = $name; + + return $this; + } + + /** + * @deprecated use withDescription() instead + * @return $this + */ + public function withDescriptionBuilder(?LocalizedStringBuilder $description) + { + $this->description = $description; + + return $this; + } + + /** + * @deprecated use withSchedule() instead + * @return $this + */ + public function withScheduleBuilder(?RecurrencePolicyScheduleDraftBuilder $schedule) + { + $this->schedule = $schedule; + + return $this; + } + + public function build(): RecurrencePolicyDraft + { + return new RecurrencePolicyDraftModel( + $this->key, + $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name, + $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description, + $this->schedule instanceof RecurrencePolicyScheduleDraftBuilder ? $this->schedule->build() : $this->schedule + ); + } + + public static function of(): RecurrencePolicyDraftBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicyDraftCollection.php b/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicyDraftCollection.php new file mode 100644 index 00000000000..4dfa348c9b1 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicyDraftCollection.php @@ -0,0 +1,56 @@ + + * @method RecurrencePolicyDraft current() + * @method RecurrencePolicyDraft end() + * @method RecurrencePolicyDraft at($offset) + */ +class RecurrencePolicyDraftCollection extends MapperSequence +{ + /** + * @psalm-assert RecurrencePolicyDraft $value + * @psalm-param RecurrencePolicyDraft|stdClass $value + * @throws InvalidArgumentException + * + * @return RecurrencePolicyDraftCollection + */ + public function add($value) + { + if (!$value instanceof RecurrencePolicyDraft) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?RecurrencePolicyDraft + */ + protected function mapper() + { + return function (?int $index): ?RecurrencePolicyDraft { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var RecurrencePolicyDraft $data */ + $data = RecurrencePolicyDraftModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicyDraftModel.php b/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicyDraftModel.php new file mode 100644 index 00000000000..05a9eef6498 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicyDraftModel.php @@ -0,0 +1,179 @@ +key = $key; + $this->name = $name; + $this->description = $description; + $this->schedule = $schedule; + } + + /** + *User-defined unique identifier for the RecurrencePolicy.
+ * + * + * @return null|string + */ + public function getKey() + { + if (is_null($this->key)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_KEY); + if (is_null($data)) { + return null; + } + $this->key = (string) $data; + } + + return $this->key; + } + + /** + *Name of the RecurrencePolicy.
+ * + * + * @return null|LocalizedString + */ + public function getName() + { + if (is_null($this->name)) { + /** @psalm-var stdClass|arrayDescription of the RecurrencePolicy.
+ * + * + * @return null|LocalizedString + */ + public function getDescription() + { + if (is_null($this->description)) { + /** @psalm-var stdClass|arraySchedule where the recurrence is defined.
+ * + * + * @return null|RecurrencePolicyScheduleDraft + */ + public function getSchedule() + { + if (is_null($this->schedule)) { + /** @psalm-var stdClass|arrayUnique identifier of the RecurrencePolicy.
+ * + * + * @return null|string + */ + public function getId() + { + if (is_null($this->id)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_ID); + if (is_null($data)) { + return null; + } + $this->id = (string) $data; + } + + return $this->id; + } + + /** + *Current version of the RecurrencePolicy.
+ * + * + * @return null|int + */ + public function getVersion() + { + if (is_null($this->version)) { + /** @psalm-var ?int $data */ + $data = $this->raw(self::FIELD_VERSION); + if (is_null($data)) { + return null; + } + $this->version = (int) $data; + } + + return $this->version; + } + + /** + *Date and time (UTC) the RecurrencePolicy was initially created.
+ * + * + * @return null|DateTimeImmutable + */ + public function getCreatedAt() + { + if (is_null($this->createdAt)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CREATED_AT); + if (is_null($data)) { + return null; + } + $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data); + if (false === $data) { + return null; + } + $this->createdAt = $data; + } + + return $this->createdAt; + } + + /** + *Date and time (UTC) the RecurrencePolicy was last updated.
+ * + * + * @return null|DateTimeImmutable + */ + public function getLastModifiedAt() + { + if (is_null($this->lastModifiedAt)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_LAST_MODIFIED_AT); + if (is_null($data)) { + return null; + } + $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data); + if (false === $data) { + return null; + } + $this->lastModifiedAt = $data; + } + + return $this->lastModifiedAt; + } + + /** + *User-defined unique identifier of the RecurrencePolicy.
+ * + * + * @return null|string + */ + public function getKey() + { + if (is_null($this->key)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_KEY); + if (is_null($data)) { + return null; + } + $this->key = (string) $data; + } + + return $this->key; + } + + /** + *Name of the RecurrencePolicy.
+ * + * + * @return null|LocalizedString + */ + public function getName() + { + if (is_null($this->name)) { + /** @psalm-var stdClass|arrayDescription of the RecurrencePolicy.
+ * + * + * @return null|LocalizedString + */ + public function getDescription() + { + if (is_null($this->description)) { + /** @psalm-var stdClass|arraySchedule of the RecurrencePolicy.
+ * + * + * @return null|RecurrencePolicySchedule + */ + public function getSchedule() + { + if (is_null($this->schedule)) { + /** @psalm-var stdClass|arrayIDs and references that created the RecurrencePolicy.
+ * + * + * @return null|CreatedBy + */ + public function getCreatedBy() + { + if (is_null($this->createdBy)) { + /** @psalm-var stdClass|arrayIDs and references that last modified the RecurrencePolicy.
+ * + * + * @return null|LastModifiedBy + */ + public function getLastModifiedBy() + { + if (is_null($this->lastModifiedBy)) { + /** @psalm-var stdClass|arrayNumber of elements skipped.
+ * + + * @return null|int + */ + public function getOffset(); + + /** + *Actual number of results returned.
+ * + + * @return null|int + */ + public function getCount(); + + /** + *Total number of results matching the query.
+ * This number is an estimation that is not strongly consistent.
+ * This field is returned by default.
+ * For improved performance, calculating this field can be deactivated by using the query parameter withTotal=false.
+ * When the results are filtered with a Query Predicate, total is subject to a limit.
RecurrencePolicies matching the query.
+ * + + * @return null|RecurrencePolicyCollection + */ + public function getResults(); + + /** + * @param ?int $limit + */ + public function setLimit(?int $limit): void; + + /** + * @param ?int $offset + */ + public function setOffset(?int $offset): void; + + /** + * @param ?int $count + */ + public function setCount(?int $count): void; + + /** + * @param ?int $total + */ + public function setTotal(?int $total): void; + + /** + * @param ?RecurrencePolicyCollection $results + */ + public function setResults(?RecurrencePolicyCollection $results): void; +} diff --git a/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicyPagedQueryResponseBuilder.php b/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicyPagedQueryResponseBuilder.php new file mode 100644 index 00000000000..4b2353175f2 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicyPagedQueryResponseBuilder.php @@ -0,0 +1,183 @@ + + */ +final class RecurrencePolicyPagedQueryResponseBuilder implements Builder +{ + /** + + * @var ?int + */ + private $limit; + + /** + + * @var ?int + */ + private $offset; + + /** + + * @var ?int + */ + private $count; + + /** + + * @var ?int + */ + private $total; + + /** + + * @var ?RecurrencePolicyCollection + */ + private $results; + + /** + *Number of results requested.
+ * + + * @return null|int + */ + public function getLimit() + { + return $this->limit; + } + + /** + *Number of elements skipped.
+ * + + * @return null|int + */ + public function getOffset() + { + return $this->offset; + } + + /** + *Actual number of results returned.
+ * + + * @return null|int + */ + public function getCount() + { + return $this->count; + } + + /** + *Total number of results matching the query.
+ * This number is an estimation that is not strongly consistent.
+ * This field is returned by default.
+ * For improved performance, calculating this field can be deactivated by using the query parameter withTotal=false.
+ * When the results are filtered with a Query Predicate, total is subject to a limit.
RecurrencePolicies matching the query.
+ * + + * @return null|RecurrencePolicyCollection + */ + public function getResults() + { + return $this->results; + } + + /** + * @param ?int $limit + * @return $this + */ + public function withLimit(?int $limit) + { + $this->limit = $limit; + + return $this; + } + + /** + * @param ?int $offset + * @return $this + */ + public function withOffset(?int $offset) + { + $this->offset = $offset; + + return $this; + } + + /** + * @param ?int $count + * @return $this + */ + public function withCount(?int $count) + { + $this->count = $count; + + return $this; + } + + /** + * @param ?int $total + * @return $this + */ + public function withTotal(?int $total) + { + $this->total = $total; + + return $this; + } + + /** + * @param ?RecurrencePolicyCollection $results + * @return $this + */ + public function withResults(?RecurrencePolicyCollection $results) + { + $this->results = $results; + + return $this; + } + + + public function build(): RecurrencePolicyPagedQueryResponse + { + return new RecurrencePolicyPagedQueryResponseModel( + $this->limit, + $this->offset, + $this->count, + $this->total, + $this->results + ); + } + + public static function of(): RecurrencePolicyPagedQueryResponseBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicyPagedQueryResponseCollection.php b/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicyPagedQueryResponseCollection.php new file mode 100644 index 00000000000..36ed738ec6e --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicyPagedQueryResponseCollection.php @@ -0,0 +1,56 @@ + + * @method RecurrencePolicyPagedQueryResponse current() + * @method RecurrencePolicyPagedQueryResponse end() + * @method RecurrencePolicyPagedQueryResponse at($offset) + */ +class RecurrencePolicyPagedQueryResponseCollection extends MapperSequence +{ + /** + * @psalm-assert RecurrencePolicyPagedQueryResponse $value + * @psalm-param RecurrencePolicyPagedQueryResponse|stdClass $value + * @throws InvalidArgumentException + * + * @return RecurrencePolicyPagedQueryResponseCollection + */ + public function add($value) + { + if (!$value instanceof RecurrencePolicyPagedQueryResponse) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?RecurrencePolicyPagedQueryResponse + */ + protected function mapper() + { + return function (?int $index): ?RecurrencePolicyPagedQueryResponse { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var RecurrencePolicyPagedQueryResponse $data */ + $data = RecurrencePolicyPagedQueryResponseModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicyPagedQueryResponseModel.php b/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicyPagedQueryResponseModel.php new file mode 100644 index 00000000000..5370a412084 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicyPagedQueryResponseModel.php @@ -0,0 +1,214 @@ +limit = $limit; + $this->offset = $offset; + $this->count = $count; + $this->total = $total; + $this->results = $results; + } + + /** + *Number of results requested.
+ * + * + * @return null|int + */ + public function getLimit() + { + if (is_null($this->limit)) { + /** @psalm-var ?int $data */ + $data = $this->raw(self::FIELD_LIMIT); + if (is_null($data)) { + return null; + } + $this->limit = (int) $data; + } + + return $this->limit; + } + + /** + *Number of elements skipped.
+ * + * + * @return null|int + */ + public function getOffset() + { + if (is_null($this->offset)) { + /** @psalm-var ?int $data */ + $data = $this->raw(self::FIELD_OFFSET); + if (is_null($data)) { + return null; + } + $this->offset = (int) $data; + } + + return $this->offset; + } + + /** + *Actual number of results returned.
+ * + * + * @return null|int + */ + public function getCount() + { + if (is_null($this->count)) { + /** @psalm-var ?int $data */ + $data = $this->raw(self::FIELD_COUNT); + if (is_null($data)) { + return null; + } + $this->count = (int) $data; + } + + return $this->count; + } + + /** + *Total number of results matching the query.
+ * This number is an estimation that is not strongly consistent.
+ * This field is returned by default.
+ * For improved performance, calculating this field can be deactivated by using the query parameter withTotal=false.
+ * When the results are filtered with a Query Predicate, total is subject to a limit.
RecurrencePolicies matching the query.
+ * + * + * @return null|RecurrencePolicyCollection + */ + public function getResults() + { + if (is_null($this->results)) { + /** @psalm-var ?listUnique identifier of the referenced RecurrencePolicy.
+ * + + * @return null|string + */ + public function getId(); + + /** + * @param ?RecurrencePolicy $obj + */ + public function setObj(?RecurrencePolicy $obj): void; + + /** + * @param ?string $id + */ + public function setId(?string $id): void; +} diff --git a/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicyReferenceBuilder.php b/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicyReferenceBuilder.php new file mode 100644 index 00000000000..043e82e4987 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicyReferenceBuilder.php @@ -0,0 +1,105 @@ + + */ +final class RecurrencePolicyReferenceBuilder implements Builder +{ + /** + + * @var ?string + */ + private $id; + + /** + + * @var null|RecurrencePolicy|RecurrencePolicyBuilder + */ + private $obj; + + /** + *Unique identifier of the referenced RecurrencePolicy.
+ * + + * @return null|string + */ + public function getId() + { + return $this->id; + } + + /** + *Contains the representation of the expanded RecurrencePolicy. + * Only present in responses to requests with Reference Expansion for RecurrencePolicies.
+ * + + * @return null|RecurrencePolicy + */ + public function getObj() + { + return $this->obj instanceof RecurrencePolicyBuilder ? $this->obj->build() : $this->obj; + } + + /** + * @param ?string $id + * @return $this + */ + public function withId(?string $id) + { + $this->id = $id; + + return $this; + } + + /** + * @param ?RecurrencePolicy $obj + * @return $this + */ + public function withObj(?RecurrencePolicy $obj) + { + $this->obj = $obj; + + return $this; + } + + /** + * @deprecated use withObj() instead + * @return $this + */ + public function withObjBuilder(?RecurrencePolicyBuilder $obj) + { + $this->obj = $obj; + + return $this; + } + + public function build(): RecurrencePolicyReference + { + return new RecurrencePolicyReferenceModel( + $this->id, + $this->obj instanceof RecurrencePolicyBuilder ? $this->obj->build() : $this->obj + ); + } + + public static function of(): RecurrencePolicyReferenceBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicyReferenceCollection.php b/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicyReferenceCollection.php new file mode 100644 index 00000000000..519539a6a05 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicyReferenceCollection.php @@ -0,0 +1,56 @@ + + * @method RecurrencePolicyReference current() + * @method RecurrencePolicyReference end() + * @method RecurrencePolicyReference at($offset) + */ +class RecurrencePolicyReferenceCollection extends ReferenceCollection +{ + /** + * @psalm-assert RecurrencePolicyReference $value + * @psalm-param RecurrencePolicyReference|stdClass $value + * @throws InvalidArgumentException + * + * @return RecurrencePolicyReferenceCollection + */ + public function add($value) + { + if (!$value instanceof RecurrencePolicyReference) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?RecurrencePolicyReference + */ + protected function mapper() + { + return function (?int $index): ?RecurrencePolicyReference { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var RecurrencePolicyReference $data */ + $data = RecurrencePolicyReferenceModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicyReferenceModel.php b/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicyReferenceModel.php new file mode 100644 index 00000000000..1aa99080d9c --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicyReferenceModel.php @@ -0,0 +1,135 @@ +id = $id; + $this->obj = $obj; + $this->typeId = $typeId ?? self::DISCRIMINATOR_VALUE; + } + + /** + *Type of referenced resource.
+ * + * + * @return null|string + */ + public function getTypeId() + { + if (is_null($this->typeId)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_TYPE_ID); + if (is_null($data)) { + return null; + } + $this->typeId = (string) $data; + } + + return $this->typeId; + } + + /** + *Unique identifier of the referenced RecurrencePolicy.
+ * + * + * @return null|string + */ + public function getId() + { + if (is_null($this->id)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_ID); + if (is_null($data)) { + return null; + } + $this->id = (string) $data; + } + + return $this->id; + } + + /** + *Contains the representation of the expanded RecurrencePolicy. + * Only present in responses to requests with Reference Expansion for RecurrencePolicies.
+ * + * + * @return null|RecurrencePolicy + */ + public function getObj() + { + if (is_null($this->obj)) { + /** @psalm-var stdClass|arraykey is absent.
+ *
+
+ * @return null|string
+ */
+ public function getId();
+
+ /**
+ * User-defined unique identifier of the referenced RecurrencePolicy. Required if id is absent.
Unique identifier of the referenced RecurrencePolicy. Required if key is absent.
User-defined unique identifier of the referenced RecurrencePolicy. Required if id is absent.
Type of referenced resource. If given, it must match the expected ReferenceTypeId of the referenced resource.
+ * + * + * @return null|string + */ + public function getTypeId() + { + if (is_null($this->typeId)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_TYPE_ID); + if (is_null($data)) { + return null; + } + $this->typeId = (string) $data; + } + + return $this->typeId; + } + + /** + *Unique identifier of the referenced RecurrencePolicy. Required if key is absent.
User-defined unique identifier of the referenced RecurrencePolicy. Required if id is absent.
Value to set. + * If empty, any existing value will be removed.
+ * + + * @return null|LocalizedString + */ + public function getDescription() + { + return $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description; + } + + /** + * @param ?LocalizedString $description + * @return $this + */ + public function withDescription(?LocalizedString $description) + { + $this->description = $description; + + return $this; + } + + /** + * @deprecated use withDescription() instead + * @return $this + */ + public function withDescriptionBuilder(?LocalizedStringBuilder $description) + { + $this->description = $description; + + return $this; + } + + public function build(): RecurrencePolicySetDescriptionAction + { + return new RecurrencePolicySetDescriptionActionModel( + $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description + ); + } + + public static function of(): RecurrencePolicySetDescriptionActionBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicySetDescriptionActionCollection.php b/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicySetDescriptionActionCollection.php new file mode 100644 index 00000000000..240476c79f0 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicySetDescriptionActionCollection.php @@ -0,0 +1,56 @@ + + * @method RecurrencePolicySetDescriptionAction current() + * @method RecurrencePolicySetDescriptionAction end() + * @method RecurrencePolicySetDescriptionAction at($offset) + */ +class RecurrencePolicySetDescriptionActionCollection extends RecurrencePolicyUpdateActionCollection +{ + /** + * @psalm-assert RecurrencePolicySetDescriptionAction $value + * @psalm-param RecurrencePolicySetDescriptionAction|stdClass $value + * @throws InvalidArgumentException + * + * @return RecurrencePolicySetDescriptionActionCollection + */ + public function add($value) + { + if (!$value instanceof RecurrencePolicySetDescriptionAction) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?RecurrencePolicySetDescriptionAction + */ + protected function mapper() + { + return function (?int $index): ?RecurrencePolicySetDescriptionAction { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var RecurrencePolicySetDescriptionAction $data */ + $data = RecurrencePolicySetDescriptionActionModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicySetDescriptionActionModel.php b/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicySetDescriptionActionModel.php new file mode 100644 index 00000000000..11f600c68c3 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicySetDescriptionActionModel.php @@ -0,0 +1,97 @@ +description = $description; + $this->action = $action ?? self::DISCRIMINATOR_VALUE; + } + + /** + * + * @return null|string + */ + public function getAction() + { + if (is_null($this->action)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_ACTION); + if (is_null($data)) { + return null; + } + $this->action = (string) $data; + } + + return $this->action; + } + + /** + *Value to set. + * If empty, any existing value will be removed.
+ * + * + * @return null|LocalizedString + */ + public function getDescription() + { + if (is_null($this->description)) { + /** @psalm-var stdClass|arrayValue to set. + * If empty, any existing value will be removed.
+ * + + * @return null|string + */ + public function getKey() + { + return $this->key; + } + + /** + * @param ?string $key + * @return $this + */ + public function withKey(?string $key) + { + $this->key = $key; + + return $this; + } + + + public function build(): RecurrencePolicySetKeyAction + { + return new RecurrencePolicySetKeyActionModel( + $this->key + ); + } + + public static function of(): RecurrencePolicySetKeyActionBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicySetKeyActionCollection.php b/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicySetKeyActionCollection.php new file mode 100644 index 00000000000..e5a1127d7c4 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicySetKeyActionCollection.php @@ -0,0 +1,56 @@ + + * @method RecurrencePolicySetKeyAction current() + * @method RecurrencePolicySetKeyAction end() + * @method RecurrencePolicySetKeyAction at($offset) + */ +class RecurrencePolicySetKeyActionCollection extends RecurrencePolicyUpdateActionCollection +{ + /** + * @psalm-assert RecurrencePolicySetKeyAction $value + * @psalm-param RecurrencePolicySetKeyAction|stdClass $value + * @throws InvalidArgumentException + * + * @return RecurrencePolicySetKeyActionCollection + */ + public function add($value) + { + if (!$value instanceof RecurrencePolicySetKeyAction) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?RecurrencePolicySetKeyAction + */ + protected function mapper() + { + return function (?int $index): ?RecurrencePolicySetKeyAction { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var RecurrencePolicySetKeyAction $data */ + $data = RecurrencePolicySetKeyActionModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicySetKeyActionModel.php b/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicySetKeyActionModel.php new file mode 100644 index 00000000000..f43de448aa8 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicySetKeyActionModel.php @@ -0,0 +1,94 @@ +key = $key; + $this->action = $action ?? self::DISCRIMINATOR_VALUE; + } + + /** + * + * @return null|string + */ + public function getAction() + { + if (is_null($this->action)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_ACTION); + if (is_null($data)) { + return null; + } + $this->action = (string) $data; + } + + return $this->action; + } + + /** + *Value to set. + * If empty, any existing value will be removed.
+ * + * + * @return null|string + */ + public function getKey() + { + if (is_null($this->key)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_KEY); + if (is_null($data)) { + return null; + } + $this->key = (string) $data; + } + + return $this->key; + } + + + /** + * @param ?string $key + */ + public function setKey(?string $key): void + { + $this->key = $key; + } +} diff --git a/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicySetNameAction.php b/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicySetNameAction.php new file mode 100644 index 00000000000..e74be9b03a7 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicySetNameAction.php @@ -0,0 +1,32 @@ +Value to set. + * If empty, any existing value will be removed. + * + + * @return null|LocalizedString + */ + public function getName(); + + /** + * @param ?LocalizedString $name + */ + public function setName(?LocalizedString $name): void; +} diff --git a/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicySetNameActionBuilder.php b/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicySetNameActionBuilder.php new file mode 100644 index 00000000000..e8869b24995 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicySetNameActionBuilder.php @@ -0,0 +1,76 @@ + + */ +final class RecurrencePolicySetNameActionBuilder implements Builder +{ + /** + + * @var null|LocalizedString|LocalizedStringBuilder + */ + private $name; + + /** + *Value to set. + * If empty, any existing value will be removed.
+ * + + * @return null|LocalizedString + */ + public function getName() + { + return $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name; + } + + /** + * @param ?LocalizedString $name + * @return $this + */ + public function withName(?LocalizedString $name) + { + $this->name = $name; + + return $this; + } + + /** + * @deprecated use withName() instead + * @return $this + */ + public function withNameBuilder(?LocalizedStringBuilder $name) + { + $this->name = $name; + + return $this; + } + + public function build(): RecurrencePolicySetNameAction + { + return new RecurrencePolicySetNameActionModel( + $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name + ); + } + + public static function of(): RecurrencePolicySetNameActionBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicySetNameActionCollection.php b/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicySetNameActionCollection.php new file mode 100644 index 00000000000..b806da00777 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicySetNameActionCollection.php @@ -0,0 +1,56 @@ + + * @method RecurrencePolicySetNameAction current() + * @method RecurrencePolicySetNameAction end() + * @method RecurrencePolicySetNameAction at($offset) + */ +class RecurrencePolicySetNameActionCollection extends RecurrencePolicyUpdateActionCollection +{ + /** + * @psalm-assert RecurrencePolicySetNameAction $value + * @psalm-param RecurrencePolicySetNameAction|stdClass $value + * @throws InvalidArgumentException + * + * @return RecurrencePolicySetNameActionCollection + */ + public function add($value) + { + if (!$value instanceof RecurrencePolicySetNameAction) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?RecurrencePolicySetNameAction + */ + protected function mapper() + { + return function (?int $index): ?RecurrencePolicySetNameAction { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var RecurrencePolicySetNameAction $data */ + $data = RecurrencePolicySetNameActionModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicySetNameActionModel.php b/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicySetNameActionModel.php new file mode 100644 index 00000000000..e7f68777300 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicySetNameActionModel.php @@ -0,0 +1,97 @@ +name = $name; + $this->action = $action ?? self::DISCRIMINATOR_VALUE; + } + + /** + * + * @return null|string + */ + public function getAction() + { + if (is_null($this->action)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_ACTION); + if (is_null($data)) { + return null; + } + $this->action = (string) $data; + } + + return $this->action; + } + + /** + *Value to set. + * If empty, any existing value will be removed.
+ * + * + * @return null|LocalizedString + */ + public function getName() + { + if (is_null($this->name)) { + /** @psalm-var stdClass|arraySchedule where the recurrence is defined.
+ * + + * @return null|RecurrencePolicyScheduleDraft + */ + public function getSchedule() + { + return $this->schedule instanceof RecurrencePolicyScheduleDraftBuilder ? $this->schedule->build() : $this->schedule; + } + + /** + * @param ?RecurrencePolicyScheduleDraft $schedule + * @return $this + */ + public function withSchedule(?RecurrencePolicyScheduleDraft $schedule) + { + $this->schedule = $schedule; + + return $this; + } + + /** + * @deprecated use withSchedule() instead + * @return $this + */ + public function withScheduleBuilder(?RecurrencePolicyScheduleDraftBuilder $schedule) + { + $this->schedule = $schedule; + + return $this; + } + + public function build(): RecurrencePolicySetScheduleAction + { + return new RecurrencePolicySetScheduleActionModel( + $this->schedule instanceof RecurrencePolicyScheduleDraftBuilder ? $this->schedule->build() : $this->schedule + ); + } + + public static function of(): RecurrencePolicySetScheduleActionBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicySetScheduleActionCollection.php b/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicySetScheduleActionCollection.php new file mode 100644 index 00000000000..7115645ebbf --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicySetScheduleActionCollection.php @@ -0,0 +1,56 @@ + + * @method RecurrencePolicySetScheduleAction current() + * @method RecurrencePolicySetScheduleAction end() + * @method RecurrencePolicySetScheduleAction at($offset) + */ +class RecurrencePolicySetScheduleActionCollection extends RecurrencePolicyUpdateActionCollection +{ + /** + * @psalm-assert RecurrencePolicySetScheduleAction $value + * @psalm-param RecurrencePolicySetScheduleAction|stdClass $value + * @throws InvalidArgumentException + * + * @return RecurrencePolicySetScheduleActionCollection + */ + public function add($value) + { + if (!$value instanceof RecurrencePolicySetScheduleAction) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?RecurrencePolicySetScheduleAction + */ + protected function mapper() + { + return function (?int $index): ?RecurrencePolicySetScheduleAction { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var RecurrencePolicySetScheduleAction $data */ + $data = RecurrencePolicySetScheduleActionModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicySetScheduleActionModel.php b/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicySetScheduleActionModel.php new file mode 100644 index 00000000000..2c3330e84c0 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicySetScheduleActionModel.php @@ -0,0 +1,94 @@ +schedule = $schedule; + $this->action = $action ?? self::DISCRIMINATOR_VALUE; + } + + /** + * + * @return null|string + */ + public function getAction() + { + if (is_null($this->action)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_ACTION); + if (is_null($data)) { + return null; + } + $this->action = (string) $data; + } + + return $this->action; + } + + /** + *Schedule where the recurrence is defined.
+ * + * + * @return null|RecurrencePolicyScheduleDraft + */ + public function getSchedule() + { + if (is_null($this->schedule)) { + /** @psalm-var stdClass|arrayUpdate actions to be performed on the RecurrencePolicy.
+ * + + * @return null|RecurrencePolicyUpdateActionCollection + */ + public function getActions(); + + /** + * @param ?int $version + */ + public function setVersion(?int $version): void; + + /** + * @param ?RecurrencePolicyUpdateActionCollection $actions + */ + public function setActions(?RecurrencePolicyUpdateActionCollection $actions): void; +} diff --git a/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicyUpdateAction.php b/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicyUpdateAction.php new file mode 100644 index 00000000000..52bdebe7a10 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicyUpdateAction.php @@ -0,0 +1,24 @@ + + */ +final class RecurrencePolicyUpdateActionBuilder implements Builder +{ + public function build(): RecurrencePolicyUpdateAction + { + return new RecurrencePolicyUpdateActionModel( + ); + } + + public static function of(): RecurrencePolicyUpdateActionBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicyUpdateActionCollection.php b/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicyUpdateActionCollection.php new file mode 100644 index 00000000000..de0b4220944 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicyUpdateActionCollection.php @@ -0,0 +1,60 @@ + + * @psalm-method T current() + * @psalm-method T end() + * @psalm-method T at($offset) + * @method RecurrencePolicyUpdateAction current() + * @method RecurrencePolicyUpdateAction end() + * @method RecurrencePolicyUpdateAction at($offset) + */ +class RecurrencePolicyUpdateActionCollection extends MapperSequence +{ + /** + * @psalm-assert T $value + * @psalm-param T|stdClass $value + * @throws InvalidArgumentException + * + * @return RecurrencePolicyUpdateActionCollection + */ + public function add($value) + { + if (!$value instanceof RecurrencePolicyUpdateAction) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?T + */ + protected function mapper() + { + return function (?int $index): ?RecurrencePolicyUpdateAction { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var T $data */ + $data = RecurrencePolicyUpdateActionModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicyUpdateActionModel.php b/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicyUpdateActionModel.php new file mode 100644 index 00000000000..d7b92207303 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicyUpdateActionModel.php @@ -0,0 +1,97 @@ + > + * + */ + private static $discriminatorClasses = [ + 'setDescription' => RecurrencePolicySetDescriptionActionModel::class, + 'setKey' => RecurrencePolicySetKeyActionModel::class, + 'setName' => RecurrencePolicySetNameActionModel::class, + 'setSchedule' => RecurrencePolicySetScheduleActionModel::class, + ]; + + /** + * @psalm-suppress MissingParamType + */ + public function __construct( + ?string $action = null + ) { + $this->action = $action; + } + + /** + * + * @return null|string + */ + public function getAction() + { + if (is_null($this->action)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_ACTION); + if (is_null($data)) { + return null; + } + $this->action = (string) $data; + } + + return $this->action; + } + + + + + + /** + * @psalm-param stdClass|arrayExpected version of the RecurrencePolicy on which the changes should be applied. + * If the expected version does not match the actual version, a ConcurrentModification error will be returned.
+ * + + * @return null|int + */ + public function getVersion() + { + return $this->version; + } + + /** + *Update actions to be performed on the RecurrencePolicy.
+ * + + * @return null|RecurrencePolicyUpdateActionCollection + */ + public function getActions() + { + return $this->actions; + } + + /** + * @param ?int $version + * @return $this + */ + public function withVersion(?int $version) + { + $this->version = $version; + + return $this; + } + + /** + * @param ?RecurrencePolicyUpdateActionCollection $actions + * @return $this + */ + public function withActions(?RecurrencePolicyUpdateActionCollection $actions) + { + $this->actions = $actions; + + return $this; + } + + + public function build(): RecurrencePolicyUpdate + { + return new RecurrencePolicyUpdateModel( + $this->version, + $this->actions + ); + } + + public static function of(): RecurrencePolicyUpdateBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicyUpdateCollection.php b/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicyUpdateCollection.php new file mode 100644 index 00000000000..ed6a6397b06 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicyUpdateCollection.php @@ -0,0 +1,56 @@ + + * @method RecurrencePolicyUpdate current() + * @method RecurrencePolicyUpdate end() + * @method RecurrencePolicyUpdate at($offset) + */ +class RecurrencePolicyUpdateCollection extends MapperSequence +{ + /** + * @psalm-assert RecurrencePolicyUpdate $value + * @psalm-param RecurrencePolicyUpdate|stdClass $value + * @throws InvalidArgumentException + * + * @return RecurrencePolicyUpdateCollection + */ + public function add($value) + { + if (!$value instanceof RecurrencePolicyUpdate) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?RecurrencePolicyUpdate + */ + protected function mapper() + { + return function (?int $index): ?RecurrencePolicyUpdate { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var RecurrencePolicyUpdate $data */ + $data = RecurrencePolicyUpdateModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicyUpdateModel.php b/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicyUpdateModel.php new file mode 100644 index 00000000000..f67561414c7 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurrencePolicy/RecurrencePolicyUpdateModel.php @@ -0,0 +1,103 @@ +version = $version; + $this->actions = $actions; + } + + /** + *Expected version of the RecurrencePolicy on which the changes should be applied. + * If the expected version does not match the actual version, a ConcurrentModification error will be returned.
+ * + * + * @return null|int + */ + public function getVersion() + { + if (is_null($this->version)) { + /** @psalm-var ?int $data */ + $data = $this->raw(self::FIELD_VERSION); + if (is_null($data)) { + return null; + } + $this->version = (int) $data; + } + + return $this->version; + } + + /** + *Update actions to be performed on the RecurrencePolicy.
+ * + * + * @return null|RecurrencePolicyUpdateActionCollection + */ + public function getActions() + { + if (is_null($this->actions)) { + /** @psalm-var ?listInterval of this schedule.
+ * + + * @return null|string + */ + public function getIntervalUnit(); + + /** + * @param ?int $value + */ + public function setValue(?int $value): void; + + /** + * @param ?string $intervalUnit + */ + public function setIntervalUnit(?string $intervalUnit): void; +} diff --git a/lib/commercetools-api/src/Models/RecurrencePolicy/StandardScheduleBuilder.php b/lib/commercetools-api/src/Models/RecurrencePolicy/StandardScheduleBuilder.php new file mode 100644 index 00000000000..6d45f9e3875 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurrencePolicy/StandardScheduleBuilder.php @@ -0,0 +1,92 @@ + + */ +final class StandardScheduleBuilder implements Builder +{ + /** + + * @var ?int + */ + private $value; + + /** + + * @var ?string + */ + private $intervalUnit; + + /** + *Number of intervals between orders.
+ * + + * @return null|int + */ + public function getValue() + { + return $this->value; + } + + /** + *Interval of this schedule.
+ * + + * @return null|string + */ + public function getIntervalUnit() + { + return $this->intervalUnit; + } + + /** + * @param ?int $value + * @return $this + */ + public function withValue(?int $value) + { + $this->value = $value; + + return $this; + } + + /** + * @param ?string $intervalUnit + * @return $this + */ + public function withIntervalUnit(?string $intervalUnit) + { + $this->intervalUnit = $intervalUnit; + + return $this; + } + + + public function build(): StandardSchedule + { + return new StandardScheduleModel( + $this->value, + $this->intervalUnit + ); + } + + public static function of(): StandardScheduleBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/RecurrencePolicy/StandardScheduleCollection.php b/lib/commercetools-api/src/Models/RecurrencePolicy/StandardScheduleCollection.php new file mode 100644 index 00000000000..1623a4587b1 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurrencePolicy/StandardScheduleCollection.php @@ -0,0 +1,56 @@ + + * @method StandardSchedule current() + * @method StandardSchedule end() + * @method StandardSchedule at($offset) + */ +class StandardScheduleCollection extends RecurrencePolicyScheduleCollection +{ + /** + * @psalm-assert StandardSchedule $value + * @psalm-param StandardSchedule|stdClass $value + * @throws InvalidArgumentException + * + * @return StandardScheduleCollection + */ + public function add($value) + { + if (!$value instanceof StandardSchedule) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?StandardSchedule + */ + protected function mapper() + { + return function (?int $index): ?StandardSchedule { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var StandardSchedule $data */ + $data = StandardScheduleModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/RecurrencePolicy/StandardScheduleDraft.php b/lib/commercetools-api/src/Models/RecurrencePolicy/StandardScheduleDraft.php new file mode 100644 index 00000000000..38d20d96682 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurrencePolicy/StandardScheduleDraft.php @@ -0,0 +1,44 @@ +Number of intervals between orders. + * + + * @return null|int + */ + public function getValue(); + + /** + *Interval for this schedule.
+ * + + * @return null|string + */ + public function getIntervalUnit(); + + /** + * @param ?int $value + */ + public function setValue(?int $value): void; + + /** + * @param ?string $intervalUnit + */ + public function setIntervalUnit(?string $intervalUnit): void; +} diff --git a/lib/commercetools-api/src/Models/RecurrencePolicy/StandardScheduleDraftBuilder.php b/lib/commercetools-api/src/Models/RecurrencePolicy/StandardScheduleDraftBuilder.php new file mode 100644 index 00000000000..fab0b1ce377 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurrencePolicy/StandardScheduleDraftBuilder.php @@ -0,0 +1,92 @@ + + */ +final class StandardScheduleDraftBuilder implements Builder +{ + /** + + * @var ?int + */ + private $value; + + /** + + * @var ?string + */ + private $intervalUnit; + + /** + *Number of intervals between orders.
+ * + + * @return null|int + */ + public function getValue() + { + return $this->value; + } + + /** + *Interval for this schedule.
+ * + + * @return null|string + */ + public function getIntervalUnit() + { + return $this->intervalUnit; + } + + /** + * @param ?int $value + * @return $this + */ + public function withValue(?int $value) + { + $this->value = $value; + + return $this; + } + + /** + * @param ?string $intervalUnit + * @return $this + */ + public function withIntervalUnit(?string $intervalUnit) + { + $this->intervalUnit = $intervalUnit; + + return $this; + } + + + public function build(): StandardScheduleDraft + { + return new StandardScheduleDraftModel( + $this->value, + $this->intervalUnit + ); + } + + public static function of(): StandardScheduleDraftBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/RecurrencePolicy/StandardScheduleDraftCollection.php b/lib/commercetools-api/src/Models/RecurrencePolicy/StandardScheduleDraftCollection.php new file mode 100644 index 00000000000..46ea0d63a8c --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurrencePolicy/StandardScheduleDraftCollection.php @@ -0,0 +1,56 @@ + + * @method StandardScheduleDraft current() + * @method StandardScheduleDraft end() + * @method StandardScheduleDraft at($offset) + */ +class StandardScheduleDraftCollection extends RecurrencePolicyScheduleDraftCollection +{ + /** + * @psalm-assert StandardScheduleDraft $value + * @psalm-param StandardScheduleDraft|stdClass $value + * @throws InvalidArgumentException + * + * @return StandardScheduleDraftCollection + */ + public function add($value) + { + if (!$value instanceof StandardScheduleDraft) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?StandardScheduleDraft + */ + protected function mapper() + { + return function (?int $index): ?StandardScheduleDraft { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var StandardScheduleDraft $data */ + $data = StandardScheduleDraftModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/RecurrencePolicy/StandardScheduleDraftModel.php b/lib/commercetools-api/src/Models/RecurrencePolicy/StandardScheduleDraftModel.php new file mode 100644 index 00000000000..47eb8862a39 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurrencePolicy/StandardScheduleDraftModel.php @@ -0,0 +1,129 @@ +value = $value; + $this->intervalUnit = $intervalUnit; + $this->type = $type ?? self::DISCRIMINATOR_VALUE; + } + + /** + * + * @return null|string + */ + public function getType() + { + if (is_null($this->type)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_TYPE); + if (is_null($data)) { + return null; + } + $this->type = (string) $data; + } + + return $this->type; + } + + /** + *Number of intervals between orders.
+ * + * + * @return null|int + */ + public function getValue() + { + if (is_null($this->value)) { + /** @psalm-var ?int $data */ + $data = $this->raw(self::FIELD_VALUE); + if (is_null($data)) { + return null; + } + $this->value = (int) $data; + } + + return $this->value; + } + + /** + *Interval for this schedule.
+ * + * + * @return null|string + */ + public function getIntervalUnit() + { + if (is_null($this->intervalUnit)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_INTERVAL_UNIT); + if (is_null($data)) { + return null; + } + $this->intervalUnit = (string) $data; + } + + return $this->intervalUnit; + } + + + /** + * @param ?int $value + */ + public function setValue(?int $value): void + { + $this->value = $value; + } + + /** + * @param ?string $intervalUnit + */ + public function setIntervalUnit(?string $intervalUnit): void + { + $this->intervalUnit = $intervalUnit; + } +} diff --git a/lib/commercetools-api/src/Models/RecurrencePolicy/StandardScheduleModel.php b/lib/commercetools-api/src/Models/RecurrencePolicy/StandardScheduleModel.php new file mode 100644 index 00000000000..535823efebd --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurrencePolicy/StandardScheduleModel.php @@ -0,0 +1,129 @@ +value = $value; + $this->intervalUnit = $intervalUnit; + $this->type = $type ?? self::DISCRIMINATOR_VALUE; + } + + /** + * + * @return null|string + */ + public function getType() + { + if (is_null($this->type)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_TYPE); + if (is_null($data)) { + return null; + } + $this->type = (string) $data; + } + + return $this->type; + } + + /** + *Number of intervals between orders.
+ * + * + * @return null|int + */ + public function getValue() + { + if (is_null($this->value)) { + /** @psalm-var ?int $data */ + $data = $this->raw(self::FIELD_VALUE); + if (is_null($data)) { + return null; + } + $this->value = (int) $data; + } + + return $this->value; + } + + /** + *Interval of this schedule.
+ * + * + * @return null|string + */ + public function getIntervalUnit() + { + if (is_null($this->intervalUnit)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_INTERVAL_UNIT); + if (is_null($data)) { + return null; + } + $this->intervalUnit = (string) $data; + } + + return $this->intervalUnit; + } + + + /** + * @param ?int $value + */ + public function setValue(?int $value): void + { + $this->value = $value; + } + + /** + * @param ?string $intervalUnit + */ + public function setIntervalUnit(?string $intervalUnit): void + { + $this->intervalUnit = $intervalUnit; + } +} diff --git a/lib/commercetools-api/src/Models/RecurringOrder/Counter.php b/lib/commercetools-api/src/Models/RecurringOrder/Counter.php new file mode 100644 index 00000000000..13676798f28 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurringOrder/Counter.php @@ -0,0 +1,59 @@ +Number of Orders that will be skipped. + * + + * @return null|int + */ + public function getTotalToSkip(); + + /** + *Number of Orders that were already skipped.
+ * + + * @return null|int + */ + public function getSkipped(); + + /** + *Date and time (UTC) when the last Order creation was skipped.
+ * + + * @return null|DateTimeImmutable + */ + public function getLastSkippedAt(); + + /** + * @param ?int $totalToSkip + */ + public function setTotalToSkip(?int $totalToSkip): void; + + /** + * @param ?int $skipped + */ + public function setSkipped(?int $skipped): void; + + /** + * @param ?DateTimeImmutable $lastSkippedAt + */ + public function setLastSkippedAt(?DateTimeImmutable $lastSkippedAt): void; +} diff --git a/lib/commercetools-api/src/Models/RecurringOrder/CounterBuilder.php b/lib/commercetools-api/src/Models/RecurringOrder/CounterBuilder.php new file mode 100644 index 00000000000..6362a720b74 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurringOrder/CounterBuilder.php @@ -0,0 +1,122 @@ + + */ +final class CounterBuilder implements Builder +{ + /** + + * @var ?int + */ + private $totalToSkip; + + /** + + * @var ?int + */ + private $skipped; + + /** + + * @var ?DateTimeImmutable + */ + private $lastSkippedAt; + + /** + *Number of Orders that will be skipped.
+ * + + * @return null|int + */ + public function getTotalToSkip() + { + return $this->totalToSkip; + } + + /** + *Number of Orders that were already skipped.
+ * + + * @return null|int + */ + public function getSkipped() + { + return $this->skipped; + } + + /** + *Date and time (UTC) when the last Order creation was skipped.
+ * + + * @return null|DateTimeImmutable + */ + public function getLastSkippedAt() + { + return $this->lastSkippedAt; + } + + /** + * @param ?int $totalToSkip + * @return $this + */ + public function withTotalToSkip(?int $totalToSkip) + { + $this->totalToSkip = $totalToSkip; + + return $this; + } + + /** + * @param ?int $skipped + * @return $this + */ + public function withSkipped(?int $skipped) + { + $this->skipped = $skipped; + + return $this; + } + + /** + * @param ?DateTimeImmutable $lastSkippedAt + * @return $this + */ + public function withLastSkippedAt(?DateTimeImmutable $lastSkippedAt) + { + $this->lastSkippedAt = $lastSkippedAt; + + return $this; + } + + + public function build(): Counter + { + return new CounterModel( + $this->totalToSkip, + $this->skipped, + $this->lastSkippedAt + ); + } + + public static function of(): CounterBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/RecurringOrder/CounterCollection.php b/lib/commercetools-api/src/Models/RecurringOrder/CounterCollection.php new file mode 100644 index 00000000000..57bb0e7fbf7 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurringOrder/CounterCollection.php @@ -0,0 +1,56 @@ + + * @method Counter current() + * @method Counter end() + * @method Counter at($offset) + */ +class CounterCollection extends SkipConfigurationCollection +{ + /** + * @psalm-assert Counter $value + * @psalm-param Counter|stdClass $value + * @throws InvalidArgumentException + * + * @return CounterCollection + */ + public function add($value) + { + if (!$value instanceof Counter) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?Counter + */ + protected function mapper() + { + return function (?int $index): ?Counter { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var Counter $data */ + $data = CounterModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/RecurringOrder/CounterDraft.php b/lib/commercetools-api/src/Models/RecurringOrder/CounterDraft.php new file mode 100644 index 00000000000..40fd9fb6667 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurringOrder/CounterDraft.php @@ -0,0 +1,30 @@ +Number of Orders that will be skipped. + * + + * @return null|int + */ + public function getTotalToSkip(); + + /** + * @param ?int $totalToSkip + */ + public function setTotalToSkip(?int $totalToSkip): void; +} diff --git a/lib/commercetools-api/src/Models/RecurringOrder/CounterDraftBuilder.php b/lib/commercetools-api/src/Models/RecurringOrder/CounterDraftBuilder.php new file mode 100644 index 00000000000..c0ee47105a4 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurringOrder/CounterDraftBuilder.php @@ -0,0 +1,63 @@ + + */ +final class CounterDraftBuilder implements Builder +{ + /** + + * @var ?int + */ + private $totalToSkip; + + /** + *Number of Orders that will be skipped.
+ * + + * @return null|int + */ + public function getTotalToSkip() + { + return $this->totalToSkip; + } + + /** + * @param ?int $totalToSkip + * @return $this + */ + public function withTotalToSkip(?int $totalToSkip) + { + $this->totalToSkip = $totalToSkip; + + return $this; + } + + + public function build(): CounterDraft + { + return new CounterDraftModel( + $this->totalToSkip + ); + } + + public static function of(): CounterDraftBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/RecurringOrder/CounterDraftCollection.php b/lib/commercetools-api/src/Models/RecurringOrder/CounterDraftCollection.php new file mode 100644 index 00000000000..4d4341b0228 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurringOrder/CounterDraftCollection.php @@ -0,0 +1,56 @@ + + * @method CounterDraft current() + * @method CounterDraft end() + * @method CounterDraft at($offset) + */ +class CounterDraftCollection extends SkipConfigurationDraftCollection +{ + /** + * @psalm-assert CounterDraft $value + * @psalm-param CounterDraft|stdClass $value + * @throws InvalidArgumentException + * + * @return CounterDraftCollection + */ + public function add($value) + { + if (!$value instanceof CounterDraft) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?CounterDraft + */ + protected function mapper() + { + return function (?int $index): ?CounterDraft { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var CounterDraft $data */ + $data = CounterDraftModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/RecurringOrder/CounterDraftModel.php b/lib/commercetools-api/src/Models/RecurringOrder/CounterDraftModel.php new file mode 100644 index 00000000000..00c0ed1445a --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurringOrder/CounterDraftModel.php @@ -0,0 +1,93 @@ +totalToSkip = $totalToSkip; + $this->type = $type ?? self::DISCRIMINATOR_VALUE; + } + + /** + * + * @return null|string + */ + public function getType() + { + if (is_null($this->type)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_TYPE); + if (is_null($data)) { + return null; + } + $this->type = (string) $data; + } + + return $this->type; + } + + /** + *Number of Orders that will be skipped.
+ * + * + * @return null|int + */ + public function getTotalToSkip() + { + if (is_null($this->totalToSkip)) { + /** @psalm-var ?int $data */ + $data = $this->raw(self::FIELD_TOTAL_TO_SKIP); + if (is_null($data)) { + return null; + } + $this->totalToSkip = (int) $data; + } + + return $this->totalToSkip; + } + + + /** + * @param ?int $totalToSkip + */ + public function setTotalToSkip(?int $totalToSkip): void + { + $this->totalToSkip = $totalToSkip; + } +} diff --git a/lib/commercetools-api/src/Models/RecurringOrder/CounterModel.php b/lib/commercetools-api/src/Models/RecurringOrder/CounterModel.php new file mode 100644 index 00000000000..3b7fb0f03e5 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurringOrder/CounterModel.php @@ -0,0 +1,181 @@ +totalToSkip = $totalToSkip; + $this->skipped = $skipped; + $this->lastSkippedAt = $lastSkippedAt; + $this->type = $type ?? self::DISCRIMINATOR_VALUE; + } + + /** + * + * @return null|string + */ + public function getType() + { + if (is_null($this->type)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_TYPE); + if (is_null($data)) { + return null; + } + $this->type = (string) $data; + } + + return $this->type; + } + + /** + *Number of Orders that will be skipped.
+ * + * + * @return null|int + */ + public function getTotalToSkip() + { + if (is_null($this->totalToSkip)) { + /** @psalm-var ?int $data */ + $data = $this->raw(self::FIELD_TOTAL_TO_SKIP); + if (is_null($data)) { + return null; + } + $this->totalToSkip = (int) $data; + } + + return $this->totalToSkip; + } + + /** + *Number of Orders that were already skipped.
+ * + * + * @return null|int + */ + public function getSkipped() + { + if (is_null($this->skipped)) { + /** @psalm-var ?int $data */ + $data = $this->raw(self::FIELD_SKIPPED); + if (is_null($data)) { + return null; + } + $this->skipped = (int) $data; + } + + return $this->skipped; + } + + /** + *Date and time (UTC) when the last Order creation was skipped.
+ * + * + * @return null|DateTimeImmutable + */ + public function getLastSkippedAt() + { + if (is_null($this->lastSkippedAt)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_LAST_SKIPPED_AT); + if (is_null($data)) { + return null; + } + $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data); + if (false === $data) { + return null; + } + $this->lastSkippedAt = $data; + } + + return $this->lastSkippedAt; + } + + + /** + * @param ?int $totalToSkip + */ + public function setTotalToSkip(?int $totalToSkip): void + { + $this->totalToSkip = $totalToSkip; + } + + /** + * @param ?int $skipped + */ + public function setSkipped(?int $skipped): void + { + $this->skipped = $skipped; + } + + /** + * @param ?DateTimeImmutable $lastSkippedAt + */ + public function setLastSkippedAt(?DateTimeImmutable $lastSkippedAt): void + { + $this->lastSkippedAt = $lastSkippedAt; + } + + + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + $data = $this->toArray(); + if (isset($data[Counter::FIELD_LAST_SKIPPED_AT]) && $data[Counter::FIELD_LAST_SKIPPED_AT] instanceof \DateTimeImmutable) { + $data[Counter::FIELD_LAST_SKIPPED_AT] = $data[Counter::FIELD_LAST_SKIPPED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c'); + } + return (object) $data; + } +} diff --git a/lib/commercetools-api/src/Models/RecurringOrder/CustomLineItemRecurrenceInfo.php b/lib/commercetools-api/src/Models/RecurringOrder/CustomLineItemRecurrenceInfo.php new file mode 100644 index 00000000000..2ff0c87f683 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurringOrder/CustomLineItemRecurrenceInfo.php @@ -0,0 +1,31 @@ +Reference to a RecurrencePolicy. + * + + * @return null|RecurrencePolicyReference + */ + public function getRecurrencePolicy(); + + /** + * @param ?RecurrencePolicyReference $recurrencePolicy + */ + public function setRecurrencePolicy(?RecurrencePolicyReference $recurrencePolicy): void; +} diff --git a/lib/commercetools-api/src/Models/RecurringOrder/CustomLineItemRecurrenceInfoBuilder.php b/lib/commercetools-api/src/Models/RecurringOrder/CustomLineItemRecurrenceInfoBuilder.php new file mode 100644 index 00000000000..741f9ae7de6 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurringOrder/CustomLineItemRecurrenceInfoBuilder.php @@ -0,0 +1,75 @@ + + */ +final class CustomLineItemRecurrenceInfoBuilder implements Builder +{ + /** + + * @var null|RecurrencePolicyReference|RecurrencePolicyReferenceBuilder + */ + private $recurrencePolicy; + + /** + *Reference to a RecurrencePolicy.
+ * + + * @return null|RecurrencePolicyReference + */ + public function getRecurrencePolicy() + { + return $this->recurrencePolicy instanceof RecurrencePolicyReferenceBuilder ? $this->recurrencePolicy->build() : $this->recurrencePolicy; + } + + /** + * @param ?RecurrencePolicyReference $recurrencePolicy + * @return $this + */ + public function withRecurrencePolicy(?RecurrencePolicyReference $recurrencePolicy) + { + $this->recurrencePolicy = $recurrencePolicy; + + return $this; + } + + /** + * @deprecated use withRecurrencePolicy() instead + * @return $this + */ + public function withRecurrencePolicyBuilder(?RecurrencePolicyReferenceBuilder $recurrencePolicy) + { + $this->recurrencePolicy = $recurrencePolicy; + + return $this; + } + + public function build(): CustomLineItemRecurrenceInfo + { + return new CustomLineItemRecurrenceInfoModel( + $this->recurrencePolicy instanceof RecurrencePolicyReferenceBuilder ? $this->recurrencePolicy->build() : $this->recurrencePolicy + ); + } + + public static function of(): CustomLineItemRecurrenceInfoBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/RecurringOrder/CustomLineItemRecurrenceInfoCollection.php b/lib/commercetools-api/src/Models/RecurringOrder/CustomLineItemRecurrenceInfoCollection.php new file mode 100644 index 00000000000..b6137f4fb37 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurringOrder/CustomLineItemRecurrenceInfoCollection.php @@ -0,0 +1,56 @@ + + * @method CustomLineItemRecurrenceInfo current() + * @method CustomLineItemRecurrenceInfo end() + * @method CustomLineItemRecurrenceInfo at($offset) + */ +class CustomLineItemRecurrenceInfoCollection extends MapperSequence +{ + /** + * @psalm-assert CustomLineItemRecurrenceInfo $value + * @psalm-param CustomLineItemRecurrenceInfo|stdClass $value + * @throws InvalidArgumentException + * + * @return CustomLineItemRecurrenceInfoCollection + */ + public function add($value) + { + if (!$value instanceof CustomLineItemRecurrenceInfo) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?CustomLineItemRecurrenceInfo + */ + protected function mapper() + { + return function (?int $index): ?CustomLineItemRecurrenceInfo { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var CustomLineItemRecurrenceInfo $data */ + $data = CustomLineItemRecurrenceInfoModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/RecurringOrder/CustomLineItemRecurrenceInfoDraft.php b/lib/commercetools-api/src/Models/RecurringOrder/CustomLineItemRecurrenceInfoDraft.php new file mode 100644 index 00000000000..a403ad3c674 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurringOrder/CustomLineItemRecurrenceInfoDraft.php @@ -0,0 +1,31 @@ +ResourceIdentifier to a RecurrencePolicy. + * + + * @return null|RecurrencePolicyResourceIdentifier + */ + public function getRecurrencePolicy(); + + /** + * @param ?RecurrencePolicyResourceIdentifier $recurrencePolicy + */ + public function setRecurrencePolicy(?RecurrencePolicyResourceIdentifier $recurrencePolicy): void; +} diff --git a/lib/commercetools-api/src/Models/RecurringOrder/CustomLineItemRecurrenceInfoDraftBuilder.php b/lib/commercetools-api/src/Models/RecurringOrder/CustomLineItemRecurrenceInfoDraftBuilder.php new file mode 100644 index 00000000000..6c15ef51477 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurringOrder/CustomLineItemRecurrenceInfoDraftBuilder.php @@ -0,0 +1,75 @@ + + */ +final class CustomLineItemRecurrenceInfoDraftBuilder implements Builder +{ + /** + + * @var null|RecurrencePolicyResourceIdentifier|RecurrencePolicyResourceIdentifierBuilder + */ + private $recurrencePolicy; + + /** + *ResourceIdentifier to a RecurrencePolicy.
+ * + + * @return null|RecurrencePolicyResourceIdentifier + */ + public function getRecurrencePolicy() + { + return $this->recurrencePolicy instanceof RecurrencePolicyResourceIdentifierBuilder ? $this->recurrencePolicy->build() : $this->recurrencePolicy; + } + + /** + * @param ?RecurrencePolicyResourceIdentifier $recurrencePolicy + * @return $this + */ + public function withRecurrencePolicy(?RecurrencePolicyResourceIdentifier $recurrencePolicy) + { + $this->recurrencePolicy = $recurrencePolicy; + + return $this; + } + + /** + * @deprecated use withRecurrencePolicy() instead + * @return $this + */ + public function withRecurrencePolicyBuilder(?RecurrencePolicyResourceIdentifierBuilder $recurrencePolicy) + { + $this->recurrencePolicy = $recurrencePolicy; + + return $this; + } + + public function build(): CustomLineItemRecurrenceInfoDraft + { + return new CustomLineItemRecurrenceInfoDraftModel( + $this->recurrencePolicy instanceof RecurrencePolicyResourceIdentifierBuilder ? $this->recurrencePolicy->build() : $this->recurrencePolicy + ); + } + + public static function of(): CustomLineItemRecurrenceInfoDraftBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/RecurringOrder/CustomLineItemRecurrenceInfoDraftCollection.php b/lib/commercetools-api/src/Models/RecurringOrder/CustomLineItemRecurrenceInfoDraftCollection.php new file mode 100644 index 00000000000..4dc934d3ae4 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurringOrder/CustomLineItemRecurrenceInfoDraftCollection.php @@ -0,0 +1,56 @@ + + * @method CustomLineItemRecurrenceInfoDraft current() + * @method CustomLineItemRecurrenceInfoDraft end() + * @method CustomLineItemRecurrenceInfoDraft at($offset) + */ +class CustomLineItemRecurrenceInfoDraftCollection extends MapperSequence +{ + /** + * @psalm-assert CustomLineItemRecurrenceInfoDraft $value + * @psalm-param CustomLineItemRecurrenceInfoDraft|stdClass $value + * @throws InvalidArgumentException + * + * @return CustomLineItemRecurrenceInfoDraftCollection + */ + public function add($value) + { + if (!$value instanceof CustomLineItemRecurrenceInfoDraft) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?CustomLineItemRecurrenceInfoDraft + */ + protected function mapper() + { + return function (?int $index): ?CustomLineItemRecurrenceInfoDraft { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var CustomLineItemRecurrenceInfoDraft $data */ + $data = CustomLineItemRecurrenceInfoDraftModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/RecurringOrder/CustomLineItemRecurrenceInfoDraftModel.php b/lib/commercetools-api/src/Models/RecurringOrder/CustomLineItemRecurrenceInfoDraftModel.php new file mode 100644 index 00000000000..512b848fde6 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurringOrder/CustomLineItemRecurrenceInfoDraftModel.php @@ -0,0 +1,69 @@ +recurrencePolicy = $recurrencePolicy; + } + + /** + *ResourceIdentifier to a RecurrencePolicy.
+ * + * + * @return null|RecurrencePolicyResourceIdentifier + */ + public function getRecurrencePolicy() + { + if (is_null($this->recurrencePolicy)) { + /** @psalm-var stdClass|arrayReference to a RecurrencePolicy.
+ * + * + * @return null|RecurrencePolicyReference + */ + public function getRecurrencePolicy() + { + if (is_null($this->recurrencePolicy)) { + /** @psalm-var stdClass|arrayIndicates how the price of a line item will be selected during order creation.
+ * + + * @return null|string + */ + public function getPriceSelectionMode(); + + /** + * @param ?RecurrencePolicyReference $recurrencePolicy + */ + public function setRecurrencePolicy(?RecurrencePolicyReference $recurrencePolicy): void; + + /** + * @param ?string $priceSelectionMode + */ + public function setPriceSelectionMode(?string $priceSelectionMode): void; +} diff --git a/lib/commercetools-api/src/Models/RecurringOrder/LineItemRecurrenceInfoBuilder.php b/lib/commercetools-api/src/Models/RecurringOrder/LineItemRecurrenceInfoBuilder.php new file mode 100644 index 00000000000..79b3b7f797d --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurringOrder/LineItemRecurrenceInfoBuilder.php @@ -0,0 +1,104 @@ + + */ +final class LineItemRecurrenceInfoBuilder implements Builder +{ + /** + + * @var null|RecurrencePolicyReference|RecurrencePolicyReferenceBuilder + */ + private $recurrencePolicy; + + /** + + * @var ?string + */ + private $priceSelectionMode; + + /** + *Reference to a RecurrencePolicy.
+ * + + * @return null|RecurrencePolicyReference + */ + public function getRecurrencePolicy() + { + return $this->recurrencePolicy instanceof RecurrencePolicyReferenceBuilder ? $this->recurrencePolicy->build() : $this->recurrencePolicy; + } + + /** + *Indicates how the price of a line item will be selected during order creation.
+ * + + * @return null|string + */ + public function getPriceSelectionMode() + { + return $this->priceSelectionMode; + } + + /** + * @param ?RecurrencePolicyReference $recurrencePolicy + * @return $this + */ + public function withRecurrencePolicy(?RecurrencePolicyReference $recurrencePolicy) + { + $this->recurrencePolicy = $recurrencePolicy; + + return $this; + } + + /** + * @param ?string $priceSelectionMode + * @return $this + */ + public function withPriceSelectionMode(?string $priceSelectionMode) + { + $this->priceSelectionMode = $priceSelectionMode; + + return $this; + } + + /** + * @deprecated use withRecurrencePolicy() instead + * @return $this + */ + public function withRecurrencePolicyBuilder(?RecurrencePolicyReferenceBuilder $recurrencePolicy) + { + $this->recurrencePolicy = $recurrencePolicy; + + return $this; + } + + public function build(): LineItemRecurrenceInfo + { + return new LineItemRecurrenceInfoModel( + $this->recurrencePolicy instanceof RecurrencePolicyReferenceBuilder ? $this->recurrencePolicy->build() : $this->recurrencePolicy, + $this->priceSelectionMode + ); + } + + public static function of(): LineItemRecurrenceInfoBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/RecurringOrder/LineItemRecurrenceInfoCollection.php b/lib/commercetools-api/src/Models/RecurringOrder/LineItemRecurrenceInfoCollection.php new file mode 100644 index 00000000000..45360f5d458 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurringOrder/LineItemRecurrenceInfoCollection.php @@ -0,0 +1,56 @@ + + * @method LineItemRecurrenceInfo current() + * @method LineItemRecurrenceInfo end() + * @method LineItemRecurrenceInfo at($offset) + */ +class LineItemRecurrenceInfoCollection extends MapperSequence +{ + /** + * @psalm-assert LineItemRecurrenceInfo $value + * @psalm-param LineItemRecurrenceInfo|stdClass $value + * @throws InvalidArgumentException + * + * @return LineItemRecurrenceInfoCollection + */ + public function add($value) + { + if (!$value instanceof LineItemRecurrenceInfo) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?LineItemRecurrenceInfo + */ + protected function mapper() + { + return function (?int $index): ?LineItemRecurrenceInfo { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var LineItemRecurrenceInfo $data */ + $data = LineItemRecurrenceInfoModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/RecurringOrder/LineItemRecurrenceInfoDraft.php b/lib/commercetools-api/src/Models/RecurringOrder/LineItemRecurrenceInfoDraft.php new file mode 100644 index 00000000000..86d1372fb12 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurringOrder/LineItemRecurrenceInfoDraft.php @@ -0,0 +1,45 @@ +ResourceIdentifier to a RecurrencePolicy. + * + + * @return null|RecurrencePolicyResourceIdentifier + */ + public function getRecurrencePolicy(); + + /** + *Determines how the price of a line item will be selected during order creation.
+ * + + * @return null|string + */ + public function getPriceSelectionMode(); + + /** + * @param ?RecurrencePolicyResourceIdentifier $recurrencePolicy + */ + public function setRecurrencePolicy(?RecurrencePolicyResourceIdentifier $recurrencePolicy): void; + + /** + * @param ?string $priceSelectionMode + */ + public function setPriceSelectionMode(?string $priceSelectionMode): void; +} diff --git a/lib/commercetools-api/src/Models/RecurringOrder/LineItemRecurrenceInfoDraftBuilder.php b/lib/commercetools-api/src/Models/RecurringOrder/LineItemRecurrenceInfoDraftBuilder.php new file mode 100644 index 00000000000..4826f2759da --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurringOrder/LineItemRecurrenceInfoDraftBuilder.php @@ -0,0 +1,104 @@ + + */ +final class LineItemRecurrenceInfoDraftBuilder implements Builder +{ + /** + + * @var null|RecurrencePolicyResourceIdentifier|RecurrencePolicyResourceIdentifierBuilder + */ + private $recurrencePolicy; + + /** + + * @var ?string + */ + private $priceSelectionMode; + + /** + *ResourceIdentifier to a RecurrencePolicy.
+ * + + * @return null|RecurrencePolicyResourceIdentifier + */ + public function getRecurrencePolicy() + { + return $this->recurrencePolicy instanceof RecurrencePolicyResourceIdentifierBuilder ? $this->recurrencePolicy->build() : $this->recurrencePolicy; + } + + /** + *Determines how the price of a line item will be selected during order creation.
+ * + + * @return null|string + */ + public function getPriceSelectionMode() + { + return $this->priceSelectionMode; + } + + /** + * @param ?RecurrencePolicyResourceIdentifier $recurrencePolicy + * @return $this + */ + public function withRecurrencePolicy(?RecurrencePolicyResourceIdentifier $recurrencePolicy) + { + $this->recurrencePolicy = $recurrencePolicy; + + return $this; + } + + /** + * @param ?string $priceSelectionMode + * @return $this + */ + public function withPriceSelectionMode(?string $priceSelectionMode) + { + $this->priceSelectionMode = $priceSelectionMode; + + return $this; + } + + /** + * @deprecated use withRecurrencePolicy() instead + * @return $this + */ + public function withRecurrencePolicyBuilder(?RecurrencePolicyResourceIdentifierBuilder $recurrencePolicy) + { + $this->recurrencePolicy = $recurrencePolicy; + + return $this; + } + + public function build(): LineItemRecurrenceInfoDraft + { + return new LineItemRecurrenceInfoDraftModel( + $this->recurrencePolicy instanceof RecurrencePolicyResourceIdentifierBuilder ? $this->recurrencePolicy->build() : $this->recurrencePolicy, + $this->priceSelectionMode + ); + } + + public static function of(): LineItemRecurrenceInfoDraftBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/RecurringOrder/LineItemRecurrenceInfoDraftCollection.php b/lib/commercetools-api/src/Models/RecurringOrder/LineItemRecurrenceInfoDraftCollection.php new file mode 100644 index 00000000000..a4c64965caf --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurringOrder/LineItemRecurrenceInfoDraftCollection.php @@ -0,0 +1,56 @@ + + * @method LineItemRecurrenceInfoDraft current() + * @method LineItemRecurrenceInfoDraft end() + * @method LineItemRecurrenceInfoDraft at($offset) + */ +class LineItemRecurrenceInfoDraftCollection extends MapperSequence +{ + /** + * @psalm-assert LineItemRecurrenceInfoDraft $value + * @psalm-param LineItemRecurrenceInfoDraft|stdClass $value + * @throws InvalidArgumentException + * + * @return LineItemRecurrenceInfoDraftCollection + */ + public function add($value) + { + if (!$value instanceof LineItemRecurrenceInfoDraft) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?LineItemRecurrenceInfoDraft + */ + protected function mapper() + { + return function (?int $index): ?LineItemRecurrenceInfoDraft { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var LineItemRecurrenceInfoDraft $data */ + $data = LineItemRecurrenceInfoDraftModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/RecurringOrder/LineItemRecurrenceInfoDraftModel.php b/lib/commercetools-api/src/Models/RecurringOrder/LineItemRecurrenceInfoDraftModel.php new file mode 100644 index 00000000000..d6694d7b701 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurringOrder/LineItemRecurrenceInfoDraftModel.php @@ -0,0 +1,105 @@ +recurrencePolicy = $recurrencePolicy; + $this->priceSelectionMode = $priceSelectionMode; + } + + /** + *ResourceIdentifier to a RecurrencePolicy.
+ * + * + * @return null|RecurrencePolicyResourceIdentifier + */ + public function getRecurrencePolicy() + { + if (is_null($this->recurrencePolicy)) { + /** @psalm-var stdClass|arrayDetermines how the price of a line item will be selected during order creation.
+ * + * + * @return null|string + */ + public function getPriceSelectionMode() + { + if (is_null($this->priceSelectionMode)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_PRICE_SELECTION_MODE); + if (is_null($data)) { + return null; + } + $this->priceSelectionMode = (string) $data; + } + + return $this->priceSelectionMode; + } + + + /** + * @param ?RecurrencePolicyResourceIdentifier $recurrencePolicy + */ + public function setRecurrencePolicy(?RecurrencePolicyResourceIdentifier $recurrencePolicy): void + { + $this->recurrencePolicy = $recurrencePolicy; + } + + /** + * @param ?string $priceSelectionMode + */ + public function setPriceSelectionMode(?string $priceSelectionMode): void + { + $this->priceSelectionMode = $priceSelectionMode; + } +} diff --git a/lib/commercetools-api/src/Models/RecurringOrder/LineItemRecurrenceInfoModel.php b/lib/commercetools-api/src/Models/RecurringOrder/LineItemRecurrenceInfoModel.php new file mode 100644 index 00000000000..6de09ac8ecb --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurringOrder/LineItemRecurrenceInfoModel.php @@ -0,0 +1,105 @@ +recurrencePolicy = $recurrencePolicy; + $this->priceSelectionMode = $priceSelectionMode; + } + + /** + *Reference to a RecurrencePolicy.
+ * + * + * @return null|RecurrencePolicyReference + */ + public function getRecurrencePolicy() + { + if (is_null($this->recurrencePolicy)) { + /** @psalm-var stdClass|arrayIndicates how the price of a line item will be selected during order creation.
+ * + * + * @return null|string + */ + public function getPriceSelectionMode() + { + if (is_null($this->priceSelectionMode)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_PRICE_SELECTION_MODE); + if (is_null($data)) { + return null; + } + $this->priceSelectionMode = (string) $data; + } + + return $this->priceSelectionMode; + } + + + /** + * @param ?RecurrencePolicyReference $recurrencePolicy + */ + public function setRecurrencePolicy(?RecurrencePolicyReference $recurrencePolicy): void + { + $this->recurrencePolicy = $recurrencePolicy; + } + + /** + * @param ?string $priceSelectionMode + */ + public function setPriceSelectionMode(?string $priceSelectionMode): void + { + $this->priceSelectionMode = $priceSelectionMode; + } +} diff --git a/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrder.php b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrder.php new file mode 100644 index 00000000000..a8498f39f01 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrder.php @@ -0,0 +1,347 @@ +Unique identifier of the RecurringOrder. + * + + * @return null|string + */ + public function getId(); + + /** + *User-defined unique identifier of the RecurringOrder.
+ * + + * @return null|string + */ + public function getKey(); + + /** + *Current version of the RecurringOrder.
+ * + + * @return null|int + */ + public function getVersion(); + + /** + *Reference to the Cart for a RecurringOrder.
+ * The referenced Cart will have the RecurringOrder CartOrigin.
Reference to the original Order that generated this RecurringOrder.
+ * + + * @return null|OrderReference + */ + public function getOriginOrder(); + + /** + *Date and time (UTC) when the RecurringOrder starts creating new Orders.
+ * + + * @return null|DateTimeImmutable + */ + public function getStartsAt(); + + /** + *Date and time (UTC) when the RecurringOrder resumes creating Orders after being unpaused.
+ * + + * @return null|DateTimeImmutable + */ + public function getResumesAt(); + + /** + *Date and time (UTC) when the RecurringOrder expires.
+ * + + * @return null|DateTimeImmutable + */ + public function getExpiresAt(); + + /** + *Date and time (UTC) when the last Order was created from this RecurringOrder.
+ * + + * @return null|DateTimeImmutable + */ + public function getLastOrderAt(); + + /** + *Date and time (UTC) when the next Order will be created from this RecurringOrder.
+ * + + * @return null|DateTimeImmutable + */ + public function getNextOrderAt(); + + /** + *Information about current and future skips for this RecurringOrder.
+ * + + * @return null|SkipConfiguration + */ + public function getSkipConfiguration(); + + /** + *Reference to a Store.
+ * + + * @return null|StoreKeyReference + */ + public function getStore(); + + /** + *Reference to the Business Unit that the RecurringOrder belongs to.
+ * + + * @return null|BusinessUnitKeyReference + */ + public function getBusinessUnit(); + + /** + *State of the RecurringOrder in a custom workflow.
+ * + + * @return null|StateReference + */ + public function getState(); + + /** + *Current state of the RecurringOrder.
+ * + + * @return null|string + */ + public function getRecurringOrderState(); + + /** + *Schedule of the RecurringOrder.
+ * + + * @return null|RecurrencePolicySchedule + */ + public function getSchedule(); + + /** + *The Customer that the RecurringOrder belongs to.
+ * + + * @return null|CustomerReference + */ + public function getCustomer(); + + /** + *Email address of the Customer that the RecurringOrder belongs to.
+ * + + * @return null|string + */ + public function getCustomerEmail(); + + /** + *Custom Fields of the RecurringOrder.
+ * + + * @return null|CustomFields + */ + public function getCustom(); + + /** + *Date and time (UTC) when the RecurringOrder was created.
+ * + + * @return null|DateTimeImmutable + */ + public function getCreatedAt(); + + /** + *Date and time (UTC) when the RecurringOrder was last updated.
+ * + + * @return null|DateTimeImmutable + */ + public function getLastModifiedAt(); + + /** + *IDs and references that last modified the RecurringOrder.
+ * + + * @return null|LastModifiedBy + */ + public function getLastModifiedBy(); + + /** + *IDs and references that created the RecurringOrder.
+ * + + * @return null|CreatedBy + */ + public function getCreatedBy(); + + /** + * @param ?string $id + */ + public function setId(?string $id): void; + + /** + * @param ?string $key + */ + public function setKey(?string $key): void; + + /** + * @param ?int $version + */ + public function setVersion(?int $version): void; + + /** + * @param ?CartReference $cart + */ + public function setCart(?CartReference $cart): void; + + /** + * @param ?OrderReference $originOrder + */ + public function setOriginOrder(?OrderReference $originOrder): void; + + /** + * @param ?DateTimeImmutable $startsAt + */ + public function setStartsAt(?DateTimeImmutable $startsAt): void; + + /** + * @param ?DateTimeImmutable $resumesAt + */ + public function setResumesAt(?DateTimeImmutable $resumesAt): void; + + /** + * @param ?DateTimeImmutable $expiresAt + */ + public function setExpiresAt(?DateTimeImmutable $expiresAt): void; + + /** + * @param ?DateTimeImmutable $lastOrderAt + */ + public function setLastOrderAt(?DateTimeImmutable $lastOrderAt): void; + + /** + * @param ?DateTimeImmutable $nextOrderAt + */ + public function setNextOrderAt(?DateTimeImmutable $nextOrderAt): void; + + /** + * @param ?SkipConfiguration $skipConfiguration + */ + public function setSkipConfiguration(?SkipConfiguration $skipConfiguration): void; + + /** + * @param ?StoreKeyReference $store + */ + public function setStore(?StoreKeyReference $store): void; + + /** + * @param ?BusinessUnitKeyReference $businessUnit + */ + public function setBusinessUnit(?BusinessUnitKeyReference $businessUnit): void; + + /** + * @param ?StateReference $state + */ + public function setState(?StateReference $state): void; + + /** + * @param ?string $recurringOrderState + */ + public function setRecurringOrderState(?string $recurringOrderState): void; + + /** + * @param ?RecurrencePolicySchedule $schedule + */ + public function setSchedule(?RecurrencePolicySchedule $schedule): void; + + /** + * @param ?CustomerReference $customer + */ + public function setCustomer(?CustomerReference $customer): void; + + /** + * @param ?string $customerEmail + */ + public function setCustomerEmail(?string $customerEmail): void; + + /** + * @param ?CustomFields $custom + */ + public function setCustom(?CustomFields $custom): void; + + /** + * @param ?DateTimeImmutable $createdAt + */ + public function setCreatedAt(?DateTimeImmutable $createdAt): void; + + /** + * @param ?DateTimeImmutable $lastModifiedAt + */ + public function setLastModifiedAt(?DateTimeImmutable $lastModifiedAt): void; + + /** + * @param ?LastModifiedBy $lastModifiedBy + */ + public function setLastModifiedBy(?LastModifiedBy $lastModifiedBy): void; + + /** + * @param ?CreatedBy $createdBy + */ + public function setCreatedBy(?CreatedBy $createdBy): void; +} diff --git a/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderActive.php b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderActive.php new file mode 100644 index 00000000000..865929fc506 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderActive.php @@ -0,0 +1,31 @@ +If set, the Recurring Order will automatically resume at the date and time (UTC) specified. + * + + * @return null|DateTimeImmutable + */ + public function getResumesAt(); + + /** + * @param ?DateTimeImmutable $resumesAt + */ + public function setResumesAt(?DateTimeImmutable $resumesAt): void; +} diff --git a/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderActiveBuilder.php b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderActiveBuilder.php new file mode 100644 index 00000000000..dc3c5d106c9 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderActiveBuilder.php @@ -0,0 +1,64 @@ + + */ +final class RecurringOrderActiveBuilder implements Builder +{ + /** + + * @var ?DateTimeImmutable + */ + private $resumesAt; + + /** + *If set, the Recurring Order will automatically resume at the date and time (UTC) specified.
+ * + + * @return null|DateTimeImmutable + */ + public function getResumesAt() + { + return $this->resumesAt; + } + + /** + * @param ?DateTimeImmutable $resumesAt + * @return $this + */ + public function withResumesAt(?DateTimeImmutable $resumesAt) + { + $this->resumesAt = $resumesAt; + + return $this; + } + + + public function build(): RecurringOrderActive + { + return new RecurringOrderActiveModel( + $this->resumesAt + ); + } + + public static function of(): RecurringOrderActiveBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderActiveCollection.php b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderActiveCollection.php new file mode 100644 index 00000000000..8ad20420974 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderActiveCollection.php @@ -0,0 +1,56 @@ + + * @method RecurringOrderActive current() + * @method RecurringOrderActive end() + * @method RecurringOrderActive at($offset) + */ +class RecurringOrderActiveCollection extends RecurringOrderStateDraftCollection +{ + /** + * @psalm-assert RecurringOrderActive $value + * @psalm-param RecurringOrderActive|stdClass $value + * @throws InvalidArgumentException + * + * @return RecurringOrderActiveCollection + */ + public function add($value) + { + if (!$value instanceof RecurringOrderActive) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?RecurringOrderActive + */ + protected function mapper() + { + return function (?int $index): ?RecurringOrderActive { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var RecurringOrderActive $data */ + $data = RecurringOrderActiveModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderActiveModel.php b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderActiveModel.php new file mode 100644 index 00000000000..fdc74469f30 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderActiveModel.php @@ -0,0 +1,109 @@ +resumesAt = $resumesAt; + $this->type = $type ?? self::DISCRIMINATOR_VALUE; + } + + /** + * + * @return null|string + */ + public function getType() + { + if (is_null($this->type)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_TYPE); + if (is_null($data)) { + return null; + } + $this->type = (string) $data; + } + + return $this->type; + } + + /** + *If set, the Recurring Order will automatically resume at the date and time (UTC) specified.
+ * + * + * @return null|DateTimeImmutable + */ + public function getResumesAt() + { + if (is_null($this->resumesAt)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_RESUMES_AT); + if (is_null($data)) { + return null; + } + $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data); + if (false === $data) { + return null; + } + $this->resumesAt = $data; + } + + return $this->resumesAt; + } + + + /** + * @param ?DateTimeImmutable $resumesAt + */ + public function setResumesAt(?DateTimeImmutable $resumesAt): void + { + $this->resumesAt = $resumesAt; + } + + + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + $data = $this->toArray(); + if (isset($data[RecurringOrderActive::FIELD_RESUMES_AT]) && $data[RecurringOrderActive::FIELD_RESUMES_AT] instanceof \DateTimeImmutable) { + $data[RecurringOrderActive::FIELD_RESUMES_AT] = $data[RecurringOrderActive::FIELD_RESUMES_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c'); + } + return (object) $data; + } +} diff --git a/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderBuilder.php b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderBuilder.php new file mode 100644 index 00000000000..e30b789b02e --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderBuilder.php @@ -0,0 +1,845 @@ + + */ +final class RecurringOrderBuilder implements Builder +{ + /** + + * @var ?string + */ + private $id; + + /** + + * @var ?int + */ + private $version; + + /** + + * @var ?DateTimeImmutable + */ + private $createdAt; + + /** + + * @var ?DateTimeImmutable + */ + private $lastModifiedAt; + + /** + + * @var ?string + */ + private $key; + + /** + + * @var null|CartReference|CartReferenceBuilder + */ + private $cart; + + /** + + * @var null|OrderReference|OrderReferenceBuilder + */ + private $originOrder; + + /** + + * @var ?DateTimeImmutable + */ + private $startsAt; + + /** + + * @var ?DateTimeImmutable + */ + private $resumesAt; + + /** + + * @var ?DateTimeImmutable + */ + private $expiresAt; + + /** + + * @var ?DateTimeImmutable + */ + private $lastOrderAt; + + /** + + * @var ?DateTimeImmutable + */ + private $nextOrderAt; + + /** + + * @var null|SkipConfiguration|SkipConfigurationBuilder + */ + private $skipConfiguration; + + /** + + * @var null|StoreKeyReference|StoreKeyReferenceBuilder + */ + private $store; + + /** + + * @var null|BusinessUnitKeyReference|BusinessUnitKeyReferenceBuilder + */ + private $businessUnit; + + /** + + * @var null|StateReference|StateReferenceBuilder + */ + private $state; + + /** + + * @var ?string + */ + private $recurringOrderState; + + /** + + * @var null|RecurrencePolicySchedule|RecurrencePolicyScheduleBuilder + */ + private $schedule; + + /** + + * @var null|CustomerReference|CustomerReferenceBuilder + */ + private $customer; + + /** + + * @var ?string + */ + private $customerEmail; + + /** + + * @var null|CustomFields|CustomFieldsBuilder + */ + private $custom; + + /** + + * @var null|LastModifiedBy|LastModifiedByBuilder + */ + private $lastModifiedBy; + + /** + + * @var null|CreatedBy|CreatedByBuilder + */ + private $createdBy; + + /** + *Unique identifier of the RecurringOrder.
+ * + + * @return null|string + */ + public function getId() + { + return $this->id; + } + + /** + *Current version of the RecurringOrder.
+ * + + * @return null|int + */ + public function getVersion() + { + return $this->version; + } + + /** + *Date and time (UTC) when the RecurringOrder was created.
+ * + + * @return null|DateTimeImmutable + */ + public function getCreatedAt() + { + return $this->createdAt; + } + + /** + *Date and time (UTC) when the RecurringOrder was last updated.
+ * + + * @return null|DateTimeImmutable + */ + public function getLastModifiedAt() + { + return $this->lastModifiedAt; + } + + /** + *User-defined unique identifier of the RecurringOrder.
+ * + + * @return null|string + */ + public function getKey() + { + return $this->key; + } + + /** + *Reference to the Cart for a RecurringOrder.
+ * The referenced Cart will have the RecurringOrder CartOrigin.
Reference to the original Order that generated this RecurringOrder.
+ * + + * @return null|OrderReference + */ + public function getOriginOrder() + { + return $this->originOrder instanceof OrderReferenceBuilder ? $this->originOrder->build() : $this->originOrder; + } + + /** + *Date and time (UTC) when the RecurringOrder starts creating new Orders.
+ * + + * @return null|DateTimeImmutable + */ + public function getStartsAt() + { + return $this->startsAt; + } + + /** + *Date and time (UTC) when the RecurringOrder resumes creating Orders after being unpaused.
+ * + + * @return null|DateTimeImmutable + */ + public function getResumesAt() + { + return $this->resumesAt; + } + + /** + *Date and time (UTC) when the RecurringOrder expires.
+ * + + * @return null|DateTimeImmutable + */ + public function getExpiresAt() + { + return $this->expiresAt; + } + + /** + *Date and time (UTC) when the last Order was created from this RecurringOrder.
+ * + + * @return null|DateTimeImmutable + */ + public function getLastOrderAt() + { + return $this->lastOrderAt; + } + + /** + *Date and time (UTC) when the next Order will be created from this RecurringOrder.
+ * + + * @return null|DateTimeImmutable + */ + public function getNextOrderAt() + { + return $this->nextOrderAt; + } + + /** + *Information about current and future skips for this RecurringOrder.
+ * + + * @return null|SkipConfiguration + */ + public function getSkipConfiguration() + { + return $this->skipConfiguration instanceof SkipConfigurationBuilder ? $this->skipConfiguration->build() : $this->skipConfiguration; + } + + /** + *Reference to a Store.
+ * + + * @return null|StoreKeyReference + */ + public function getStore() + { + return $this->store instanceof StoreKeyReferenceBuilder ? $this->store->build() : $this->store; + } + + /** + *Reference to the Business Unit that the RecurringOrder belongs to.
+ * + + * @return null|BusinessUnitKeyReference + */ + public function getBusinessUnit() + { + return $this->businessUnit instanceof BusinessUnitKeyReferenceBuilder ? $this->businessUnit->build() : $this->businessUnit; + } + + /** + *State of the RecurringOrder in a custom workflow.
+ * + + * @return null|StateReference + */ + public function getState() + { + return $this->state instanceof StateReferenceBuilder ? $this->state->build() : $this->state; + } + + /** + *Current state of the RecurringOrder.
+ * + + * @return null|string + */ + public function getRecurringOrderState() + { + return $this->recurringOrderState; + } + + /** + *Schedule of the RecurringOrder.
+ * + + * @return null|RecurrencePolicySchedule + */ + public function getSchedule() + { + return $this->schedule instanceof RecurrencePolicyScheduleBuilder ? $this->schedule->build() : $this->schedule; + } + + /** + *The Customer that the RecurringOrder belongs to.
+ * + + * @return null|CustomerReference + */ + public function getCustomer() + { + return $this->customer instanceof CustomerReferenceBuilder ? $this->customer->build() : $this->customer; + } + + /** + *Email address of the Customer that the RecurringOrder belongs to.
+ * + + * @return null|string + */ + public function getCustomerEmail() + { + return $this->customerEmail; + } + + /** + *Custom Fields of the RecurringOrder.
+ * + + * @return null|CustomFields + */ + public function getCustom() + { + return $this->custom instanceof CustomFieldsBuilder ? $this->custom->build() : $this->custom; + } + + /** + *IDs and references that last modified the RecurringOrder.
+ * + + * @return null|LastModifiedBy + */ + public function getLastModifiedBy() + { + return $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy; + } + + /** + *IDs and references that created the RecurringOrder.
+ * + + * @return null|CreatedBy + */ + public function getCreatedBy() + { + return $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy; + } + + /** + * @param ?string $id + * @return $this + */ + public function withId(?string $id) + { + $this->id = $id; + + return $this; + } + + /** + * @param ?int $version + * @return $this + */ + public function withVersion(?int $version) + { + $this->version = $version; + + return $this; + } + + /** + * @param ?DateTimeImmutable $createdAt + * @return $this + */ + public function withCreatedAt(?DateTimeImmutable $createdAt) + { + $this->createdAt = $createdAt; + + return $this; + } + + /** + * @param ?DateTimeImmutable $lastModifiedAt + * @return $this + */ + public function withLastModifiedAt(?DateTimeImmutable $lastModifiedAt) + { + $this->lastModifiedAt = $lastModifiedAt; + + return $this; + } + + /** + * @param ?string $key + * @return $this + */ + public function withKey(?string $key) + { + $this->key = $key; + + return $this; + } + + /** + * @param ?CartReference $cart + * @return $this + */ + public function withCart(?CartReference $cart) + { + $this->cart = $cart; + + return $this; + } + + /** + * @param ?OrderReference $originOrder + * @return $this + */ + public function withOriginOrder(?OrderReference $originOrder) + { + $this->originOrder = $originOrder; + + return $this; + } + + /** + * @param ?DateTimeImmutable $startsAt + * @return $this + */ + public function withStartsAt(?DateTimeImmutable $startsAt) + { + $this->startsAt = $startsAt; + + return $this; + } + + /** + * @param ?DateTimeImmutable $resumesAt + * @return $this + */ + public function withResumesAt(?DateTimeImmutable $resumesAt) + { + $this->resumesAt = $resumesAt; + + return $this; + } + + /** + * @param ?DateTimeImmutable $expiresAt + * @return $this + */ + public function withExpiresAt(?DateTimeImmutable $expiresAt) + { + $this->expiresAt = $expiresAt; + + return $this; + } + + /** + * @param ?DateTimeImmutable $lastOrderAt + * @return $this + */ + public function withLastOrderAt(?DateTimeImmutable $lastOrderAt) + { + $this->lastOrderAt = $lastOrderAt; + + return $this; + } + + /** + * @param ?DateTimeImmutable $nextOrderAt + * @return $this + */ + public function withNextOrderAt(?DateTimeImmutable $nextOrderAt) + { + $this->nextOrderAt = $nextOrderAt; + + return $this; + } + + /** + * @param ?SkipConfiguration $skipConfiguration + * @return $this + */ + public function withSkipConfiguration(?SkipConfiguration $skipConfiguration) + { + $this->skipConfiguration = $skipConfiguration; + + return $this; + } + + /** + * @param ?StoreKeyReference $store + * @return $this + */ + public function withStore(?StoreKeyReference $store) + { + $this->store = $store; + + return $this; + } + + /** + * @param ?BusinessUnitKeyReference $businessUnit + * @return $this + */ + public function withBusinessUnit(?BusinessUnitKeyReference $businessUnit) + { + $this->businessUnit = $businessUnit; + + return $this; + } + + /** + * @param ?StateReference $state + * @return $this + */ + public function withState(?StateReference $state) + { + $this->state = $state; + + return $this; + } + + /** + * @param ?string $recurringOrderState + * @return $this + */ + public function withRecurringOrderState(?string $recurringOrderState) + { + $this->recurringOrderState = $recurringOrderState; + + return $this; + } + + /** + * @param ?RecurrencePolicySchedule $schedule + * @return $this + */ + public function withSchedule(?RecurrencePolicySchedule $schedule) + { + $this->schedule = $schedule; + + return $this; + } + + /** + * @param ?CustomerReference $customer + * @return $this + */ + public function withCustomer(?CustomerReference $customer) + { + $this->customer = $customer; + + return $this; + } + + /** + * @param ?string $customerEmail + * @return $this + */ + public function withCustomerEmail(?string $customerEmail) + { + $this->customerEmail = $customerEmail; + + return $this; + } + + /** + * @param ?CustomFields $custom + * @return $this + */ + public function withCustom(?CustomFields $custom) + { + $this->custom = $custom; + + return $this; + } + + /** + * @param ?LastModifiedBy $lastModifiedBy + * @return $this + */ + public function withLastModifiedBy(?LastModifiedBy $lastModifiedBy) + { + $this->lastModifiedBy = $lastModifiedBy; + + return $this; + } + + /** + * @param ?CreatedBy $createdBy + * @return $this + */ + public function withCreatedBy(?CreatedBy $createdBy) + { + $this->createdBy = $createdBy; + + return $this; + } + + /** + * @deprecated use withCart() instead + * @return $this + */ + public function withCartBuilder(?CartReferenceBuilder $cart) + { + $this->cart = $cart; + + return $this; + } + + /** + * @deprecated use withOriginOrder() instead + * @return $this + */ + public function withOriginOrderBuilder(?OrderReferenceBuilder $originOrder) + { + $this->originOrder = $originOrder; + + return $this; + } + + /** + * @deprecated use withSkipConfiguration() instead + * @return $this + */ + public function withSkipConfigurationBuilder(?SkipConfigurationBuilder $skipConfiguration) + { + $this->skipConfiguration = $skipConfiguration; + + return $this; + } + + /** + * @deprecated use withStore() instead + * @return $this + */ + public function withStoreBuilder(?StoreKeyReferenceBuilder $store) + { + $this->store = $store; + + return $this; + } + + /** + * @deprecated use withBusinessUnit() instead + * @return $this + */ + public function withBusinessUnitBuilder(?BusinessUnitKeyReferenceBuilder $businessUnit) + { + $this->businessUnit = $businessUnit; + + return $this; + } + + /** + * @deprecated use withState() instead + * @return $this + */ + public function withStateBuilder(?StateReferenceBuilder $state) + { + $this->state = $state; + + return $this; + } + + /** + * @deprecated use withSchedule() instead + * @return $this + */ + public function withScheduleBuilder(?RecurrencePolicyScheduleBuilder $schedule) + { + $this->schedule = $schedule; + + return $this; + } + + /** + * @deprecated use withCustomer() instead + * @return $this + */ + public function withCustomerBuilder(?CustomerReferenceBuilder $customer) + { + $this->customer = $customer; + + return $this; + } + + /** + * @deprecated use withCustom() instead + * @return $this + */ + public function withCustomBuilder(?CustomFieldsBuilder $custom) + { + $this->custom = $custom; + + return $this; + } + + /** + * @deprecated use withLastModifiedBy() instead + * @return $this + */ + public function withLastModifiedByBuilder(?LastModifiedByBuilder $lastModifiedBy) + { + $this->lastModifiedBy = $lastModifiedBy; + + return $this; + } + + /** + * @deprecated use withCreatedBy() instead + * @return $this + */ + public function withCreatedByBuilder(?CreatedByBuilder $createdBy) + { + $this->createdBy = $createdBy; + + return $this; + } + + public function build(): RecurringOrder + { + return new RecurringOrderModel( + $this->id, + $this->version, + $this->createdAt, + $this->lastModifiedAt, + $this->key, + $this->cart instanceof CartReferenceBuilder ? $this->cart->build() : $this->cart, + $this->originOrder instanceof OrderReferenceBuilder ? $this->originOrder->build() : $this->originOrder, + $this->startsAt, + $this->resumesAt, + $this->expiresAt, + $this->lastOrderAt, + $this->nextOrderAt, + $this->skipConfiguration instanceof SkipConfigurationBuilder ? $this->skipConfiguration->build() : $this->skipConfiguration, + $this->store instanceof StoreKeyReferenceBuilder ? $this->store->build() : $this->store, + $this->businessUnit instanceof BusinessUnitKeyReferenceBuilder ? $this->businessUnit->build() : $this->businessUnit, + $this->state instanceof StateReferenceBuilder ? $this->state->build() : $this->state, + $this->recurringOrderState, + $this->schedule instanceof RecurrencePolicyScheduleBuilder ? $this->schedule->build() : $this->schedule, + $this->customer instanceof CustomerReferenceBuilder ? $this->customer->build() : $this->customer, + $this->customerEmail, + $this->custom instanceof CustomFieldsBuilder ? $this->custom->build() : $this->custom, + $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy, + $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy + ); + } + + public static function of(): RecurringOrderBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderCanceled.php b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderCanceled.php new file mode 100644 index 00000000000..4e222fb3651 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderCanceled.php @@ -0,0 +1,30 @@ +The reason for the cancelation. + * + + * @return null|string + */ + public function getReason(); + + /** + * @param ?string $reason + */ + public function setReason(?string $reason): void; +} diff --git a/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderCanceledBuilder.php b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderCanceledBuilder.php new file mode 100644 index 00000000000..f43706baacd --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderCanceledBuilder.php @@ -0,0 +1,63 @@ + + */ +final class RecurringOrderCanceledBuilder implements Builder +{ + /** + + * @var ?string + */ + private $reason; + + /** + *The reason for the cancelation.
+ * + + * @return null|string + */ + public function getReason() + { + return $this->reason; + } + + /** + * @param ?string $reason + * @return $this + */ + public function withReason(?string $reason) + { + $this->reason = $reason; + + return $this; + } + + + public function build(): RecurringOrderCanceled + { + return new RecurringOrderCanceledModel( + $this->reason + ); + } + + public static function of(): RecurringOrderCanceledBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderCanceledCollection.php b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderCanceledCollection.php new file mode 100644 index 00000000000..5af097dc67d --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderCanceledCollection.php @@ -0,0 +1,56 @@ + + * @method RecurringOrderCanceled current() + * @method RecurringOrderCanceled end() + * @method RecurringOrderCanceled at($offset) + */ +class RecurringOrderCanceledCollection extends RecurringOrderStateDraftCollection +{ + /** + * @psalm-assert RecurringOrderCanceled $value + * @psalm-param RecurringOrderCanceled|stdClass $value + * @throws InvalidArgumentException + * + * @return RecurringOrderCanceledCollection + */ + public function add($value) + { + if (!$value instanceof RecurringOrderCanceled) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?RecurringOrderCanceled + */ + protected function mapper() + { + return function (?int $index): ?RecurringOrderCanceled { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var RecurringOrderCanceled $data */ + $data = RecurringOrderCanceledModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderCanceledModel.php b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderCanceledModel.php new file mode 100644 index 00000000000..9cc9a4582fa --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderCanceledModel.php @@ -0,0 +1,93 @@ +reason = $reason; + $this->type = $type ?? self::DISCRIMINATOR_VALUE; + } + + /** + * + * @return null|string + */ + public function getType() + { + if (is_null($this->type)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_TYPE); + if (is_null($data)) { + return null; + } + $this->type = (string) $data; + } + + return $this->type; + } + + /** + *The reason for the cancelation.
+ * + * + * @return null|string + */ + public function getReason() + { + if (is_null($this->reason)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_REASON); + if (is_null($data)) { + return null; + } + $this->reason = (string) $data; + } + + return $this->reason; + } + + + /** + * @param ?string $reason + */ + public function setReason(?string $reason): void + { + $this->reason = $reason; + } +} diff --git a/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderCollection.php b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderCollection.php new file mode 100644 index 00000000000..c76e75ba165 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderCollection.php @@ -0,0 +1,56 @@ + + * @method RecurringOrder current() + * @method RecurringOrder end() + * @method RecurringOrder at($offset) + */ +class RecurringOrderCollection extends BaseResourceCollection +{ + /** + * @psalm-assert RecurringOrder $value + * @psalm-param RecurringOrder|stdClass $value + * @throws InvalidArgumentException + * + * @return RecurringOrderCollection + */ + public function add($value) + { + if (!$value instanceof RecurringOrder) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?RecurringOrder + */ + protected function mapper() + { + return function (?int $index): ?RecurringOrder { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var RecurringOrder $data */ + $data = RecurringOrderModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderDraft.php b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderDraft.php new file mode 100644 index 00000000000..3918a0d5242 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderDraft.php @@ -0,0 +1,104 @@ +User-defined unique identifier of the RecurringOrder. + * + + * @return null|string + */ + public function getKey(); + + /** + *ResourceIdentifier to the Cart from which the RecurringOrder is created.
+ * + + * @return null|CartResourceIdentifier + */ + public function getCart(); + + /** + *Current version of the referenced Cart.
+ * + + * @return null|int + */ + public function getCartVersion(); + + /** + *Date and time (UTC) when the RecurringOrder will start.
+ * + + * @return null|DateTimeImmutable + */ + public function getStartsAt(); + + /** + *State for the RecurringOrder in a custom workflow.
+ * + + * @return null|StateResourceIdentifier + */ + public function getState(); + + /** + *Custom Fields for the RecurringOrder.
+ * + + * @return null|CustomFieldsDraft + */ + public function getCustom(); + + /** + * @param ?string $key + */ + public function setKey(?string $key): void; + + /** + * @param ?CartResourceIdentifier $cart + */ + public function setCart(?CartResourceIdentifier $cart): void; + + /** + * @param ?int $cartVersion + */ + public function setCartVersion(?int $cartVersion): void; + + /** + * @param ?DateTimeImmutable $startsAt + */ + public function setStartsAt(?DateTimeImmutable $startsAt): void; + + /** + * @param ?StateResourceIdentifier $state + */ + public function setState(?StateResourceIdentifier $state): void; + + /** + * @param ?CustomFieldsDraft $custom + */ + public function setCustom(?CustomFieldsDraft $custom): void; +} diff --git a/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderDraftBuilder.php b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderDraftBuilder.php new file mode 100644 index 00000000000..2fc1e4e4c80 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderDraftBuilder.php @@ -0,0 +1,247 @@ + + */ +final class RecurringOrderDraftBuilder implements Builder +{ + /** + + * @var ?string + */ + private $key; + + /** + + * @var null|CartResourceIdentifier|CartResourceIdentifierBuilder + */ + private $cart; + + /** + + * @var ?int + */ + private $cartVersion; + + /** + + * @var ?DateTimeImmutable + */ + private $startsAt; + + /** + + * @var null|StateResourceIdentifier|StateResourceIdentifierBuilder + */ + private $state; + + /** + + * @var null|CustomFieldsDraft|CustomFieldsDraftBuilder + */ + private $custom; + + /** + *User-defined unique identifier of the RecurringOrder.
+ * + + * @return null|string + */ + public function getKey() + { + return $this->key; + } + + /** + *ResourceIdentifier to the Cart from which the RecurringOrder is created.
+ * + + * @return null|CartResourceIdentifier + */ + public function getCart() + { + return $this->cart instanceof CartResourceIdentifierBuilder ? $this->cart->build() : $this->cart; + } + + /** + *Current version of the referenced Cart.
+ * + + * @return null|int + */ + public function getCartVersion() + { + return $this->cartVersion; + } + + /** + *Date and time (UTC) when the RecurringOrder will start.
+ * + + * @return null|DateTimeImmutable + */ + public function getStartsAt() + { + return $this->startsAt; + } + + /** + *State for the RecurringOrder in a custom workflow.
+ * + + * @return null|StateResourceIdentifier + */ + public function getState() + { + return $this->state instanceof StateResourceIdentifierBuilder ? $this->state->build() : $this->state; + } + + /** + *Custom Fields for the RecurringOrder.
+ * + + * @return null|CustomFieldsDraft + */ + public function getCustom() + { + return $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom; + } + + /** + * @param ?string $key + * @return $this + */ + public function withKey(?string $key) + { + $this->key = $key; + + return $this; + } + + /** + * @param ?CartResourceIdentifier $cart + * @return $this + */ + public function withCart(?CartResourceIdentifier $cart) + { + $this->cart = $cart; + + return $this; + } + + /** + * @param ?int $cartVersion + * @return $this + */ + public function withCartVersion(?int $cartVersion) + { + $this->cartVersion = $cartVersion; + + return $this; + } + + /** + * @param ?DateTimeImmutable $startsAt + * @return $this + */ + public function withStartsAt(?DateTimeImmutable $startsAt) + { + $this->startsAt = $startsAt; + + return $this; + } + + /** + * @param ?StateResourceIdentifier $state + * @return $this + */ + public function withState(?StateResourceIdentifier $state) + { + $this->state = $state; + + return $this; + } + + /** + * @param ?CustomFieldsDraft $custom + * @return $this + */ + public function withCustom(?CustomFieldsDraft $custom) + { + $this->custom = $custom; + + return $this; + } + + /** + * @deprecated use withCart() instead + * @return $this + */ + public function withCartBuilder(?CartResourceIdentifierBuilder $cart) + { + $this->cart = $cart; + + return $this; + } + + /** + * @deprecated use withState() instead + * @return $this + */ + public function withStateBuilder(?StateResourceIdentifierBuilder $state) + { + $this->state = $state; + + return $this; + } + + /** + * @deprecated use withCustom() instead + * @return $this + */ + public function withCustomBuilder(?CustomFieldsDraftBuilder $custom) + { + $this->custom = $custom; + + return $this; + } + + public function build(): RecurringOrderDraft + { + return new RecurringOrderDraftModel( + $this->key, + $this->cart instanceof CartResourceIdentifierBuilder ? $this->cart->build() : $this->cart, + $this->cartVersion, + $this->startsAt, + $this->state instanceof StateResourceIdentifierBuilder ? $this->state->build() : $this->state, + $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom + ); + } + + public static function of(): RecurringOrderDraftBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderDraftCollection.php b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderDraftCollection.php new file mode 100644 index 00000000000..3fb1c74eb8a --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderDraftCollection.php @@ -0,0 +1,56 @@ + + * @method RecurringOrderDraft current() + * @method RecurringOrderDraft end() + * @method RecurringOrderDraft at($offset) + */ +class RecurringOrderDraftCollection extends MapperSequence +{ + /** + * @psalm-assert RecurringOrderDraft $value + * @psalm-param RecurringOrderDraft|stdClass $value + * @throws InvalidArgumentException + * + * @return RecurringOrderDraftCollection + */ + public function add($value) + { + if (!$value instanceof RecurringOrderDraft) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?RecurringOrderDraft + */ + protected function mapper() + { + return function (?int $index): ?RecurringOrderDraft { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var RecurringOrderDraft $data */ + $data = RecurringOrderDraftModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderDraftModel.php b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderDraftModel.php new file mode 100644 index 00000000000..667f5fce76d --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderDraftModel.php @@ -0,0 +1,271 @@ +key = $key; + $this->cart = $cart; + $this->cartVersion = $cartVersion; + $this->startsAt = $startsAt; + $this->state = $state; + $this->custom = $custom; + } + + /** + *User-defined unique identifier of the RecurringOrder.
+ * + * + * @return null|string + */ + public function getKey() + { + if (is_null($this->key)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_KEY); + if (is_null($data)) { + return null; + } + $this->key = (string) $data; + } + + return $this->key; + } + + /** + *ResourceIdentifier to the Cart from which the RecurringOrder is created.
+ * + * + * @return null|CartResourceIdentifier + */ + public function getCart() + { + if (is_null($this->cart)) { + /** @psalm-var stdClass|arrayCurrent version of the referenced Cart.
+ * + * + * @return null|int + */ + public function getCartVersion() + { + if (is_null($this->cartVersion)) { + /** @psalm-var ?int $data */ + $data = $this->raw(self::FIELD_CART_VERSION); + if (is_null($data)) { + return null; + } + $this->cartVersion = (int) $data; + } + + return $this->cartVersion; + } + + /** + *Date and time (UTC) when the RecurringOrder will start.
+ * + * + * @return null|DateTimeImmutable + */ + public function getStartsAt() + { + if (is_null($this->startsAt)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_STARTS_AT); + if (is_null($data)) { + return null; + } + $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data); + if (false === $data) { + return null; + } + $this->startsAt = $data; + } + + return $this->startsAt; + } + + /** + *State for the RecurringOrder in a custom workflow.
+ * + * + * @return null|StateResourceIdentifier + */ + public function getState() + { + if (is_null($this->state)) { + /** @psalm-var stdClass|arrayCustom Fields for the RecurringOrder.
+ * + * + * @return null|CustomFieldsDraft + */ + public function getCustom() + { + if (is_null($this->custom)) { + /** @psalm-var stdClass|arrayUnique identifier of the RecurringOrder.
+ * + * + * @return null|string + */ + public function getId() + { + if (is_null($this->id)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_ID); + if (is_null($data)) { + return null; + } + $this->id = (string) $data; + } + + return $this->id; + } + + /** + *Current version of the RecurringOrder.
+ * + * + * @return null|int + */ + public function getVersion() + { + if (is_null($this->version)) { + /** @psalm-var ?int $data */ + $data = $this->raw(self::FIELD_VERSION); + if (is_null($data)) { + return null; + } + $this->version = (int) $data; + } + + return $this->version; + } + + /** + *Date and time (UTC) when the RecurringOrder was created.
+ * + * + * @return null|DateTimeImmutable + */ + public function getCreatedAt() + { + if (is_null($this->createdAt)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CREATED_AT); + if (is_null($data)) { + return null; + } + $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data); + if (false === $data) { + return null; + } + $this->createdAt = $data; + } + + return $this->createdAt; + } + + /** + *Date and time (UTC) when the RecurringOrder was last updated.
+ * + * + * @return null|DateTimeImmutable + */ + public function getLastModifiedAt() + { + if (is_null($this->lastModifiedAt)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_LAST_MODIFIED_AT); + if (is_null($data)) { + return null; + } + $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data); + if (false === $data) { + return null; + } + $this->lastModifiedAt = $data; + } + + return $this->lastModifiedAt; + } + + /** + *User-defined unique identifier of the RecurringOrder.
+ * + * + * @return null|string + */ + public function getKey() + { + if (is_null($this->key)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_KEY); + if (is_null($data)) { + return null; + } + $this->key = (string) $data; + } + + return $this->key; + } + + /** + *Reference to the Cart for a RecurringOrder.
+ * The referenced Cart will have the RecurringOrder CartOrigin.
Reference to the original Order that generated this RecurringOrder.
+ * + * + * @return null|OrderReference + */ + public function getOriginOrder() + { + if (is_null($this->originOrder)) { + /** @psalm-var stdClass|arrayDate and time (UTC) when the RecurringOrder starts creating new Orders.
+ * + * + * @return null|DateTimeImmutable + */ + public function getStartsAt() + { + if (is_null($this->startsAt)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_STARTS_AT); + if (is_null($data)) { + return null; + } + $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data); + if (false === $data) { + return null; + } + $this->startsAt = $data; + } + + return $this->startsAt; + } + + /** + *Date and time (UTC) when the RecurringOrder resumes creating Orders after being unpaused.
+ * + * + * @return null|DateTimeImmutable + */ + public function getResumesAt() + { + if (is_null($this->resumesAt)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_RESUMES_AT); + if (is_null($data)) { + return null; + } + $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data); + if (false === $data) { + return null; + } + $this->resumesAt = $data; + } + + return $this->resumesAt; + } + + /** + *Date and time (UTC) when the RecurringOrder expires.
+ * + * + * @return null|DateTimeImmutable + */ + public function getExpiresAt() + { + if (is_null($this->expiresAt)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_EXPIRES_AT); + if (is_null($data)) { + return null; + } + $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data); + if (false === $data) { + return null; + } + $this->expiresAt = $data; + } + + return $this->expiresAt; + } + + /** + *Date and time (UTC) when the last Order was created from this RecurringOrder.
+ * + * + * @return null|DateTimeImmutable + */ + public function getLastOrderAt() + { + if (is_null($this->lastOrderAt)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_LAST_ORDER_AT); + if (is_null($data)) { + return null; + } + $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data); + if (false === $data) { + return null; + } + $this->lastOrderAt = $data; + } + + return $this->lastOrderAt; + } + + /** + *Date and time (UTC) when the next Order will be created from this RecurringOrder.
+ * + * + * @return null|DateTimeImmutable + */ + public function getNextOrderAt() + { + if (is_null($this->nextOrderAt)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_NEXT_ORDER_AT); + if (is_null($data)) { + return null; + } + $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data); + if (false === $data) { + return null; + } + $this->nextOrderAt = $data; + } + + return $this->nextOrderAt; + } + + /** + *Information about current and future skips for this RecurringOrder.
+ * + * + * @return null|SkipConfiguration + */ + public function getSkipConfiguration() + { + if (is_null($this->skipConfiguration)) { + /** @psalm-var stdClass|arrayReference to a Store.
+ * + * + * @return null|StoreKeyReference + */ + public function getStore() + { + if (is_null($this->store)) { + /** @psalm-var stdClass|arrayReference to the Business Unit that the RecurringOrder belongs to.
+ * + * + * @return null|BusinessUnitKeyReference + */ + public function getBusinessUnit() + { + if (is_null($this->businessUnit)) { + /** @psalm-var stdClass|arrayState of the RecurringOrder in a custom workflow.
+ * + * + * @return null|StateReference + */ + public function getState() + { + if (is_null($this->state)) { + /** @psalm-var stdClass|arrayCurrent state of the RecurringOrder.
+ * + * + * @return null|string + */ + public function getRecurringOrderState() + { + if (is_null($this->recurringOrderState)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_RECURRING_ORDER_STATE); + if (is_null($data)) { + return null; + } + $this->recurringOrderState = (string) $data; + } + + return $this->recurringOrderState; + } + + /** + *Schedule of the RecurringOrder.
+ * + * + * @return null|RecurrencePolicySchedule + */ + public function getSchedule() + { + if (is_null($this->schedule)) { + /** @psalm-var stdClass|arrayThe Customer that the RecurringOrder belongs to.
+ * + * + * @return null|CustomerReference + */ + public function getCustomer() + { + if (is_null($this->customer)) { + /** @psalm-var stdClass|arrayEmail address of the Customer that the RecurringOrder belongs to.
+ * + * + * @return null|string + */ + public function getCustomerEmail() + { + if (is_null($this->customerEmail)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CUSTOMER_EMAIL); + if (is_null($data)) { + return null; + } + $this->customerEmail = (string) $data; + } + + return $this->customerEmail; + } + + /** + *Custom Fields of the RecurringOrder.
+ * + * + * @return null|CustomFields + */ + public function getCustom() + { + if (is_null($this->custom)) { + /** @psalm-var stdClass|arrayIDs and references that last modified the RecurringOrder.
+ * + * + * @return null|LastModifiedBy + */ + public function getLastModifiedBy() + { + if (is_null($this->lastModifiedBy)) { + /** @psalm-var stdClass|arrayIDs and references that created the RecurringOrder.
+ * + * + * @return null|CreatedBy + */ + public function getCreatedBy() + { + if (is_null($this->createdBy)) { + /** @psalm-var stdClass|arrayNumber of elements skipped.
+ * + + * @return null|int + */ + public function getOffset(); + + /** + *Actual number of results returned.
+ * + + * @return null|int + */ + public function getCount(); + + /** + *Total number of results matching the query.
+ * This number is an estimation that is not strongly consistent.
+ * This field is returned by default.
+ * For improved performance, calculating this field can be deactivated by using the query parameter withTotal=false.
+ * When the results are filtered with a Query Predicate, total is subject to a limit.
RecurringOrders matching the query.
+ * + + * @return null|RecurringOrderCollection + */ + public function getResults(); + + /** + * @param ?int $limit + */ + public function setLimit(?int $limit): void; + + /** + * @param ?int $offset + */ + public function setOffset(?int $offset): void; + + /** + * @param ?int $count + */ + public function setCount(?int $count): void; + + /** + * @param ?int $total + */ + public function setTotal(?int $total): void; + + /** + * @param ?RecurringOrderCollection $results + */ + public function setResults(?RecurringOrderCollection $results): void; +} diff --git a/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderPagedQueryResponseBuilder.php b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderPagedQueryResponseBuilder.php new file mode 100644 index 00000000000..049900475b5 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderPagedQueryResponseBuilder.php @@ -0,0 +1,183 @@ + + */ +final class RecurringOrderPagedQueryResponseBuilder implements Builder +{ + /** + + * @var ?int + */ + private $limit; + + /** + + * @var ?int + */ + private $offset; + + /** + + * @var ?int + */ + private $count; + + /** + + * @var ?int + */ + private $total; + + /** + + * @var ?RecurringOrderCollection + */ + private $results; + + /** + *Number of results requested.
+ * + + * @return null|int + */ + public function getLimit() + { + return $this->limit; + } + + /** + *Number of elements skipped.
+ * + + * @return null|int + */ + public function getOffset() + { + return $this->offset; + } + + /** + *Actual number of results returned.
+ * + + * @return null|int + */ + public function getCount() + { + return $this->count; + } + + /** + *Total number of results matching the query.
+ * This number is an estimation that is not strongly consistent.
+ * This field is returned by default.
+ * For improved performance, calculating this field can be deactivated by using the query parameter withTotal=false.
+ * When the results are filtered with a Query Predicate, total is subject to a limit.
RecurringOrders matching the query.
+ * + + * @return null|RecurringOrderCollection + */ + public function getResults() + { + return $this->results; + } + + /** + * @param ?int $limit + * @return $this + */ + public function withLimit(?int $limit) + { + $this->limit = $limit; + + return $this; + } + + /** + * @param ?int $offset + * @return $this + */ + public function withOffset(?int $offset) + { + $this->offset = $offset; + + return $this; + } + + /** + * @param ?int $count + * @return $this + */ + public function withCount(?int $count) + { + $this->count = $count; + + return $this; + } + + /** + * @param ?int $total + * @return $this + */ + public function withTotal(?int $total) + { + $this->total = $total; + + return $this; + } + + /** + * @param ?RecurringOrderCollection $results + * @return $this + */ + public function withResults(?RecurringOrderCollection $results) + { + $this->results = $results; + + return $this; + } + + + public function build(): RecurringOrderPagedQueryResponse + { + return new RecurringOrderPagedQueryResponseModel( + $this->limit, + $this->offset, + $this->count, + $this->total, + $this->results + ); + } + + public static function of(): RecurringOrderPagedQueryResponseBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderPagedQueryResponseCollection.php b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderPagedQueryResponseCollection.php new file mode 100644 index 00000000000..cc5b06bb2d6 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderPagedQueryResponseCollection.php @@ -0,0 +1,56 @@ + + * @method RecurringOrderPagedQueryResponse current() + * @method RecurringOrderPagedQueryResponse end() + * @method RecurringOrderPagedQueryResponse at($offset) + */ +class RecurringOrderPagedQueryResponseCollection extends MapperSequence +{ + /** + * @psalm-assert RecurringOrderPagedQueryResponse $value + * @psalm-param RecurringOrderPagedQueryResponse|stdClass $value + * @throws InvalidArgumentException + * + * @return RecurringOrderPagedQueryResponseCollection + */ + public function add($value) + { + if (!$value instanceof RecurringOrderPagedQueryResponse) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?RecurringOrderPagedQueryResponse + */ + protected function mapper() + { + return function (?int $index): ?RecurringOrderPagedQueryResponse { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var RecurringOrderPagedQueryResponse $data */ + $data = RecurringOrderPagedQueryResponseModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderPagedQueryResponseModel.php b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderPagedQueryResponseModel.php new file mode 100644 index 00000000000..842fb55205b --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderPagedQueryResponseModel.php @@ -0,0 +1,214 @@ +limit = $limit; + $this->offset = $offset; + $this->count = $count; + $this->total = $total; + $this->results = $results; + } + + /** + *Number of results requested.
+ * + * + * @return null|int + */ + public function getLimit() + { + if (is_null($this->limit)) { + /** @psalm-var ?int $data */ + $data = $this->raw(self::FIELD_LIMIT); + if (is_null($data)) { + return null; + } + $this->limit = (int) $data; + } + + return $this->limit; + } + + /** + *Number of elements skipped.
+ * + * + * @return null|int + */ + public function getOffset() + { + if (is_null($this->offset)) { + /** @psalm-var ?int $data */ + $data = $this->raw(self::FIELD_OFFSET); + if (is_null($data)) { + return null; + } + $this->offset = (int) $data; + } + + return $this->offset; + } + + /** + *Actual number of results returned.
+ * + * + * @return null|int + */ + public function getCount() + { + if (is_null($this->count)) { + /** @psalm-var ?int $data */ + $data = $this->raw(self::FIELD_COUNT); + if (is_null($data)) { + return null; + } + $this->count = (int) $data; + } + + return $this->count; + } + + /** + *Total number of results matching the query.
+ * This number is an estimation that is not strongly consistent.
+ * This field is returned by default.
+ * For improved performance, calculating this field can be deactivated by using the query parameter withTotal=false.
+ * When the results are filtered with a Query Predicate, total is subject to a limit.
RecurringOrders matching the query.
+ * + * + * @return null|RecurringOrderCollection + */ + public function getResults() + { + if (is_null($this->results)) { + /** @psalm-var ?listUnique identifier of the referenced RecurringOrder.
+ * + + * @return null|string + */ + public function getId(); + + /** + * @param ?RecurringOrder $obj + */ + public function setObj(?RecurringOrder $obj): void; + + /** + * @param ?string $id + */ + public function setId(?string $id): void; +} diff --git a/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderReferenceBuilder.php b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderReferenceBuilder.php new file mode 100644 index 00000000000..302d8443949 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderReferenceBuilder.php @@ -0,0 +1,105 @@ + + */ +final class RecurringOrderReferenceBuilder implements Builder +{ + /** + + * @var ?string + */ + private $id; + + /** + + * @var null|RecurringOrder|RecurringOrderBuilder + */ + private $obj; + + /** + *Unique identifier of the referenced RecurringOrder.
+ * + + * @return null|string + */ + public function getId() + { + return $this->id; + } + + /** + *Contains the representation of the expanded RecurringOrder. + * Only present in responses to requests with Reference Expansion for RecurringOrders.
+ * + + * @return null|RecurringOrder + */ + public function getObj() + { + return $this->obj instanceof RecurringOrderBuilder ? $this->obj->build() : $this->obj; + } + + /** + * @param ?string $id + * @return $this + */ + public function withId(?string $id) + { + $this->id = $id; + + return $this; + } + + /** + * @param ?RecurringOrder $obj + * @return $this + */ + public function withObj(?RecurringOrder $obj) + { + $this->obj = $obj; + + return $this; + } + + /** + * @deprecated use withObj() instead + * @return $this + */ + public function withObjBuilder(?RecurringOrderBuilder $obj) + { + $this->obj = $obj; + + return $this; + } + + public function build(): RecurringOrderReference + { + return new RecurringOrderReferenceModel( + $this->id, + $this->obj instanceof RecurringOrderBuilder ? $this->obj->build() : $this->obj + ); + } + + public static function of(): RecurringOrderReferenceBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderReferenceCollection.php b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderReferenceCollection.php new file mode 100644 index 00000000000..539c4df64c2 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderReferenceCollection.php @@ -0,0 +1,56 @@ + + * @method RecurringOrderReference current() + * @method RecurringOrderReference end() + * @method RecurringOrderReference at($offset) + */ +class RecurringOrderReferenceCollection extends ReferenceCollection +{ + /** + * @psalm-assert RecurringOrderReference $value + * @psalm-param RecurringOrderReference|stdClass $value + * @throws InvalidArgumentException + * + * @return RecurringOrderReferenceCollection + */ + public function add($value) + { + if (!$value instanceof RecurringOrderReference) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?RecurringOrderReference + */ + protected function mapper() + { + return function (?int $index): ?RecurringOrderReference { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var RecurringOrderReference $data */ + $data = RecurringOrderReferenceModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderReferenceModel.php b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderReferenceModel.php new file mode 100644 index 00000000000..9f9cf582bd9 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderReferenceModel.php @@ -0,0 +1,135 @@ +id = $id; + $this->obj = $obj; + $this->typeId = $typeId ?? self::DISCRIMINATOR_VALUE; + } + + /** + *Type of referenced resource.
+ * + * + * @return null|string + */ + public function getTypeId() + { + if (is_null($this->typeId)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_TYPE_ID); + if (is_null($data)) { + return null; + } + $this->typeId = (string) $data; + } + + return $this->typeId; + } + + /** + *Unique identifier of the referenced RecurringOrder.
+ * + * + * @return null|string + */ + public function getId() + { + if (is_null($this->id)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_ID); + if (is_null($data)) { + return null; + } + $this->id = (string) $data; + } + + return $this->id; + } + + /** + *Contains the representation of the expanded RecurringOrder. + * Only present in responses to requests with Reference Expansion for RecurringOrders.
+ * + * + * @return null|RecurringOrder + */ + public function getObj() + { + if (is_null($this->obj)) { + /** @psalm-var stdClass|arraykey is absent.
+ *
+
+ * @return null|string
+ */
+ public function getId();
+
+ /**
+ * User-defined unique identifier of the referenced RecurringOrder. Required if id is absent.
Unique identifier of the referenced RecurringOrder. Required if key is absent.
User-defined unique identifier of the referenced RecurringOrder. Required if id is absent.
Type of referenced resource. If given, it must match the expected ReferenceTypeId of the referenced resource.
+ * + * + * @return null|string + */ + public function getTypeId() + { + if (is_null($this->typeId)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_TYPE_ID); + if (is_null($data)) { + return null; + } + $this->typeId = (string) $data; + } + + return $this->typeId; + } + + /** + *Unique identifier of the referenced RecurringOrder. Required if key is absent.
User-defined unique identifier of the referenced RecurringOrder. Required if id is absent.
If value is absent or null, this field will be removed if it exists.
+ * Removing a field that does not exist returns an InvalidOperation error.
+ * If value is provided, it is set for the field defined by name.
Name of the Custom Field.
+ * + + * @return null|string + */ + public function getName() + { + return $this->name; + } + + /** + *If value is absent or null, this field will be removed if it exists.
+ * Removing a field that does not exist returns an InvalidOperation error.
+ * If value is provided, it is set for the field defined by name.
Name of the Custom Field.
+ * + * + * @return null|string + */ + public function getName() + { + if (is_null($this->name)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_NAME); + if (is_null($data)) { + return null; + } + $this->name = (string) $data; + } + + return $this->name; + } + + /** + *If value is absent or null, this field will be removed if it exists.
+ * Removing a field that does not exist returns an InvalidOperation error.
+ * If value is provided, it is set for the field defined by name.
Sets the Custom Fields fields for the RecurringOrder.
+ * + + * @return null|FieldContainer + */ + public function getFields(); + + /** + * @param ?TypeResourceIdentifier $type + */ + public function setType(?TypeResourceIdentifier $type): void; + + /** + * @param ?FieldContainer $fields + */ + public function setFields(?FieldContainer $fields): void; +} diff --git a/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderSetCustomTypeActionBuilder.php b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderSetCustomTypeActionBuilder.php new file mode 100644 index 00000000000..702034e2682 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderSetCustomTypeActionBuilder.php @@ -0,0 +1,118 @@ + + */ +final class RecurringOrderSetCustomTypeActionBuilder implements Builder +{ + /** + + * @var null|TypeResourceIdentifier|TypeResourceIdentifierBuilder + */ + private $type; + + /** + + * @var null|FieldContainer|FieldContainerBuilder + */ + private $fields; + + /** + *Defines the Type that extends the RecurringOrder with Custom Fields. + * If absent, any existing Type and Custom Fields are removed from the RecurringOrder.
+ * + + * @return null|TypeResourceIdentifier + */ + public function getType() + { + return $this->type instanceof TypeResourceIdentifierBuilder ? $this->type->build() : $this->type; + } + + /** + *Sets the Custom Fields fields for the RecurringOrder.
+ * + + * @return null|FieldContainer + */ + public function getFields() + { + return $this->fields instanceof FieldContainerBuilder ? $this->fields->build() : $this->fields; + } + + /** + * @param ?TypeResourceIdentifier $type + * @return $this + */ + public function withType(?TypeResourceIdentifier $type) + { + $this->type = $type; + + return $this; + } + + /** + * @param ?FieldContainer $fields + * @return $this + */ + public function withFields(?FieldContainer $fields) + { + $this->fields = $fields; + + return $this; + } + + /** + * @deprecated use withType() instead + * @return $this + */ + public function withTypeBuilder(?TypeResourceIdentifierBuilder $type) + { + $this->type = $type; + + return $this; + } + + /** + * @deprecated use withFields() instead + * @return $this + */ + public function withFieldsBuilder(?FieldContainerBuilder $fields) + { + $this->fields = $fields; + + return $this; + } + + public function build(): RecurringOrderSetCustomTypeAction + { + return new RecurringOrderSetCustomTypeActionModel( + $this->type instanceof TypeResourceIdentifierBuilder ? $this->type->build() : $this->type, + $this->fields instanceof FieldContainerBuilder ? $this->fields->build() : $this->fields + ); + } + + public static function of(): RecurringOrderSetCustomTypeActionBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderSetCustomTypeActionCollection.php b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderSetCustomTypeActionCollection.php new file mode 100644 index 00000000000..326de18b654 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderSetCustomTypeActionCollection.php @@ -0,0 +1,56 @@ + + * @method RecurringOrderSetCustomTypeAction current() + * @method RecurringOrderSetCustomTypeAction end() + * @method RecurringOrderSetCustomTypeAction at($offset) + */ +class RecurringOrderSetCustomTypeActionCollection extends RecurringOrderUpdateActionCollection +{ + /** + * @psalm-assert RecurringOrderSetCustomTypeAction $value + * @psalm-param RecurringOrderSetCustomTypeAction|stdClass $value + * @throws InvalidArgumentException + * + * @return RecurringOrderSetCustomTypeActionCollection + */ + public function add($value) + { + if (!$value instanceof RecurringOrderSetCustomTypeAction) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?RecurringOrderSetCustomTypeAction + */ + protected function mapper() + { + return function (?int $index): ?RecurringOrderSetCustomTypeAction { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var RecurringOrderSetCustomTypeAction $data */ + $data = RecurringOrderSetCustomTypeActionModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderSetCustomTypeActionModel.php b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderSetCustomTypeActionModel.php new file mode 100644 index 00000000000..d0d7682cecf --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderSetCustomTypeActionModel.php @@ -0,0 +1,136 @@ +type = $type; + $this->fields = $fields; + $this->action = $action ?? self::DISCRIMINATOR_VALUE; + } + + /** + * + * @return null|string + */ + public function getAction() + { + if (is_null($this->action)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_ACTION); + if (is_null($data)) { + return null; + } + $this->action = (string) $data; + } + + return $this->action; + } + + /** + *Defines the Type that extends the RecurringOrder with Custom Fields. + * If absent, any existing Type and Custom Fields are removed from the RecurringOrder.
+ * + * + * @return null|TypeResourceIdentifier + */ + public function getType() + { + if (is_null($this->type)) { + /** @psalm-var stdClass|arraySets the Custom Fields fields for the RecurringOrder.
+ * + * + * @return null|FieldContainer + */ + public function getFields() + { + if (is_null($this->fields)) { + /** @psalm-var stdClass|arrayValue to set. + * If empty, any existing key will be removed.
+ * + + * @return null|string + */ + public function getKey() + { + return $this->key; + } + + /** + * @param ?string $key + * @return $this + */ + public function withKey(?string $key) + { + $this->key = $key; + + return $this; + } + + + public function build(): RecurringOrderSetKeyAction + { + return new RecurringOrderSetKeyActionModel( + $this->key + ); + } + + public static function of(): RecurringOrderSetKeyActionBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderSetKeyActionCollection.php b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderSetKeyActionCollection.php new file mode 100644 index 00000000000..75a1a989f24 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderSetKeyActionCollection.php @@ -0,0 +1,56 @@ + + * @method RecurringOrderSetKeyAction current() + * @method RecurringOrderSetKeyAction end() + * @method RecurringOrderSetKeyAction at($offset) + */ +class RecurringOrderSetKeyActionCollection extends RecurringOrderUpdateActionCollection +{ + /** + * @psalm-assert RecurringOrderSetKeyAction $value + * @psalm-param RecurringOrderSetKeyAction|stdClass $value + * @throws InvalidArgumentException + * + * @return RecurringOrderSetKeyActionCollection + */ + public function add($value) + { + if (!$value instanceof RecurringOrderSetKeyAction) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?RecurringOrderSetKeyAction + */ + protected function mapper() + { + return function (?int $index): ?RecurringOrderSetKeyAction { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var RecurringOrderSetKeyAction $data */ + $data = RecurringOrderSetKeyActionModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderSetKeyActionModel.php b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderSetKeyActionModel.php new file mode 100644 index 00000000000..479c0e04e05 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderSetKeyActionModel.php @@ -0,0 +1,94 @@ +key = $key; + $this->action = $action ?? self::DISCRIMINATOR_VALUE; + } + + /** + * + * @return null|string + */ + public function getAction() + { + if (is_null($this->action)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_ACTION); + if (is_null($data)) { + return null; + } + $this->action = (string) $data; + } + + return $this->action; + } + + /** + *Value to set. + * If empty, any existing key will be removed.
+ * + * + * @return null|string + */ + public function getKey() + { + if (is_null($this->key)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_KEY); + if (is_null($data)) { + return null; + } + $this->key = (string) $data; + } + + return $this->key; + } + + + /** + * @param ?string $key + */ + public function setKey(?string $key): void + { + $this->key = $key; + } +} diff --git a/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderSetOrderSkipConfigurationAction.php b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderSetOrderSkipConfigurationAction.php new file mode 100644 index 00000000000..fb276ab581f --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderSetOrderSkipConfigurationAction.php @@ -0,0 +1,45 @@ +Configuration for skipping the next orders of the Recurring Order. + * + + * @return null|SkipConfigurationDraft + */ + public function getSkipConfiguration(); + + /** + *Date and time (UTC) the Recurring Order will resume and start to generate new orders.
+ * + + * @return null|DateTimeImmutable + */ + public function getUpdatedExpiresAt(); + + /** + * @param ?SkipConfigurationDraft $skipConfiguration + */ + public function setSkipConfiguration(?SkipConfigurationDraft $skipConfiguration): void; + + /** + * @param ?DateTimeImmutable $updatedExpiresAt + */ + public function setUpdatedExpiresAt(?DateTimeImmutable $updatedExpiresAt): void; +} diff --git a/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderSetOrderSkipConfigurationActionBuilder.php b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderSetOrderSkipConfigurationActionBuilder.php new file mode 100644 index 00000000000..e711b0aa44a --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderSetOrderSkipConfigurationActionBuilder.php @@ -0,0 +1,103 @@ + + */ +final class RecurringOrderSetOrderSkipConfigurationActionBuilder implements Builder +{ + /** + + * @var null|SkipConfigurationDraft|SkipConfigurationDraftBuilder + */ + private $skipConfiguration; + + /** + + * @var ?DateTimeImmutable + */ + private $updatedExpiresAt; + + /** + *Configuration for skipping the next orders of the Recurring Order.
+ * + + * @return null|SkipConfigurationDraft + */ + public function getSkipConfiguration() + { + return $this->skipConfiguration instanceof SkipConfigurationDraftBuilder ? $this->skipConfiguration->build() : $this->skipConfiguration; + } + + /** + *Date and time (UTC) the Recurring Order will resume and start to generate new orders.
+ * + + * @return null|DateTimeImmutable + */ + public function getUpdatedExpiresAt() + { + return $this->updatedExpiresAt; + } + + /** + * @param ?SkipConfigurationDraft $skipConfiguration + * @return $this + */ + public function withSkipConfiguration(?SkipConfigurationDraft $skipConfiguration) + { + $this->skipConfiguration = $skipConfiguration; + + return $this; + } + + /** + * @param ?DateTimeImmutable $updatedExpiresAt + * @return $this + */ + public function withUpdatedExpiresAt(?DateTimeImmutable $updatedExpiresAt) + { + $this->updatedExpiresAt = $updatedExpiresAt; + + return $this; + } + + /** + * @deprecated use withSkipConfiguration() instead + * @return $this + */ + public function withSkipConfigurationBuilder(?SkipConfigurationDraftBuilder $skipConfiguration) + { + $this->skipConfiguration = $skipConfiguration; + + return $this; + } + + public function build(): RecurringOrderSetOrderSkipConfigurationAction + { + return new RecurringOrderSetOrderSkipConfigurationActionModel( + $this->skipConfiguration instanceof SkipConfigurationDraftBuilder ? $this->skipConfiguration->build() : $this->skipConfiguration, + $this->updatedExpiresAt + ); + } + + public static function of(): RecurringOrderSetOrderSkipConfigurationActionBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderSetOrderSkipConfigurationActionCollection.php b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderSetOrderSkipConfigurationActionCollection.php new file mode 100644 index 00000000000..a2a59600fcb --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderSetOrderSkipConfigurationActionCollection.php @@ -0,0 +1,56 @@ + + * @method RecurringOrderSetOrderSkipConfigurationAction current() + * @method RecurringOrderSetOrderSkipConfigurationAction end() + * @method RecurringOrderSetOrderSkipConfigurationAction at($offset) + */ +class RecurringOrderSetOrderSkipConfigurationActionCollection extends RecurringOrderUpdateActionCollection +{ + /** + * @psalm-assert RecurringOrderSetOrderSkipConfigurationAction $value + * @psalm-param RecurringOrderSetOrderSkipConfigurationAction|stdClass $value + * @throws InvalidArgumentException + * + * @return RecurringOrderSetOrderSkipConfigurationActionCollection + */ + public function add($value) + { + if (!$value instanceof RecurringOrderSetOrderSkipConfigurationAction) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?RecurringOrderSetOrderSkipConfigurationAction + */ + protected function mapper() + { + return function (?int $index): ?RecurringOrderSetOrderSkipConfigurationAction { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var RecurringOrderSetOrderSkipConfigurationAction $data */ + $data = RecurringOrderSetOrderSkipConfigurationActionModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderSetOrderSkipConfigurationActionModel.php b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderSetOrderSkipConfigurationActionModel.php new file mode 100644 index 00000000000..0d386111724 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderSetOrderSkipConfigurationActionModel.php @@ -0,0 +1,146 @@ +skipConfiguration = $skipConfiguration; + $this->updatedExpiresAt = $updatedExpiresAt; + $this->action = $action ?? self::DISCRIMINATOR_VALUE; + } + + /** + * + * @return null|string + */ + public function getAction() + { + if (is_null($this->action)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_ACTION); + if (is_null($data)) { + return null; + } + $this->action = (string) $data; + } + + return $this->action; + } + + /** + *Configuration for skipping the next orders of the Recurring Order.
+ * + * + * @return null|SkipConfigurationDraft + */ + public function getSkipConfiguration() + { + if (is_null($this->skipConfiguration)) { + /** @psalm-var stdClass|arrayDate and time (UTC) the Recurring Order will resume and start to generate new orders.
+ * + * + * @return null|DateTimeImmutable + */ + public function getUpdatedExpiresAt() + { + if (is_null($this->updatedExpiresAt)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_UPDATED_EXPIRES_AT); + if (is_null($data)) { + return null; + } + $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data); + if (false === $data) { + return null; + } + $this->updatedExpiresAt = $data; + } + + return $this->updatedExpiresAt; + } + + + /** + * @param ?SkipConfigurationDraft $skipConfiguration + */ + public function setSkipConfiguration(?SkipConfigurationDraft $skipConfiguration): void + { + $this->skipConfiguration = $skipConfiguration; + } + + /** + * @param ?DateTimeImmutable $updatedExpiresAt + */ + public function setUpdatedExpiresAt(?DateTimeImmutable $updatedExpiresAt): void + { + $this->updatedExpiresAt = $updatedExpiresAt; + } + + + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + $data = $this->toArray(); + if (isset($data[RecurringOrderSetOrderSkipConfigurationAction::FIELD_UPDATED_EXPIRES_AT]) && $data[RecurringOrderSetOrderSkipConfigurationAction::FIELD_UPDATED_EXPIRES_AT] instanceof \DateTimeImmutable) { + $data[RecurringOrderSetOrderSkipConfigurationAction::FIELD_UPDATED_EXPIRES_AT] = $data[RecurringOrderSetOrderSkipConfigurationAction::FIELD_UPDATED_EXPIRES_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c'); + } + return (object) $data; + } +} diff --git a/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderSetScheduleAction.php b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderSetScheduleAction.php new file mode 100644 index 00000000000..a90ae2e1d0e --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderSetScheduleAction.php @@ -0,0 +1,31 @@ +Value to set. + * + + * @return null|RecurrencePolicyResourceIdentifier + */ + public function getRecurrencePolicy(); + + /** + * @param ?RecurrencePolicyResourceIdentifier $recurrencePolicy + */ + public function setRecurrencePolicy(?RecurrencePolicyResourceIdentifier $recurrencePolicy): void; +} diff --git a/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderSetScheduleActionBuilder.php b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderSetScheduleActionBuilder.php new file mode 100644 index 00000000000..cb5e9ddf1d9 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderSetScheduleActionBuilder.php @@ -0,0 +1,75 @@ + + */ +final class RecurringOrderSetScheduleActionBuilder implements Builder +{ + /** + + * @var null|RecurrencePolicyResourceIdentifier|RecurrencePolicyResourceIdentifierBuilder + */ + private $recurrencePolicy; + + /** + *Value to set.
+ * + + * @return null|RecurrencePolicyResourceIdentifier + */ + public function getRecurrencePolicy() + { + return $this->recurrencePolicy instanceof RecurrencePolicyResourceIdentifierBuilder ? $this->recurrencePolicy->build() : $this->recurrencePolicy; + } + + /** + * @param ?RecurrencePolicyResourceIdentifier $recurrencePolicy + * @return $this + */ + public function withRecurrencePolicy(?RecurrencePolicyResourceIdentifier $recurrencePolicy) + { + $this->recurrencePolicy = $recurrencePolicy; + + return $this; + } + + /** + * @deprecated use withRecurrencePolicy() instead + * @return $this + */ + public function withRecurrencePolicyBuilder(?RecurrencePolicyResourceIdentifierBuilder $recurrencePolicy) + { + $this->recurrencePolicy = $recurrencePolicy; + + return $this; + } + + public function build(): RecurringOrderSetScheduleAction + { + return new RecurringOrderSetScheduleActionModel( + $this->recurrencePolicy instanceof RecurrencePolicyResourceIdentifierBuilder ? $this->recurrencePolicy->build() : $this->recurrencePolicy + ); + } + + public static function of(): RecurringOrderSetScheduleActionBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderSetScheduleActionCollection.php b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderSetScheduleActionCollection.php new file mode 100644 index 00000000000..4ff3c446c82 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderSetScheduleActionCollection.php @@ -0,0 +1,56 @@ + + * @method RecurringOrderSetScheduleAction current() + * @method RecurringOrderSetScheduleAction end() + * @method RecurringOrderSetScheduleAction at($offset) + */ +class RecurringOrderSetScheduleActionCollection extends RecurringOrderUpdateActionCollection +{ + /** + * @psalm-assert RecurringOrderSetScheduleAction $value + * @psalm-param RecurringOrderSetScheduleAction|stdClass $value + * @throws InvalidArgumentException + * + * @return RecurringOrderSetScheduleActionCollection + */ + public function add($value) + { + if (!$value instanceof RecurringOrderSetScheduleAction) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?RecurringOrderSetScheduleAction + */ + protected function mapper() + { + return function (?int $index): ?RecurringOrderSetScheduleAction { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var RecurringOrderSetScheduleAction $data */ + $data = RecurringOrderSetScheduleActionModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderSetScheduleActionModel.php b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderSetScheduleActionModel.php new file mode 100644 index 00000000000..0c0549cc2d9 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderSetScheduleActionModel.php @@ -0,0 +1,96 @@ +recurrencePolicy = $recurrencePolicy; + $this->action = $action ?? self::DISCRIMINATOR_VALUE; + } + + /** + * + * @return null|string + */ + public function getAction() + { + if (is_null($this->action)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_ACTION); + if (is_null($data)) { + return null; + } + $this->action = (string) $data; + } + + return $this->action; + } + + /** + *Value to set.
+ * + * + * @return null|RecurrencePolicyResourceIdentifier + */ + public function getRecurrencePolicy() + { + if (is_null($this->recurrencePolicy)) { + /** @psalm-var stdClass|arrayDate and time (UTC) the Recurring Order should be started. The date and time must be in the future.
+ * + + * @return null|DateTimeImmutable + */ + public function getStartsAt() + { + return $this->startsAt; + } + + /** + * @param ?DateTimeImmutable $startsAt + * @return $this + */ + public function withStartsAt(?DateTimeImmutable $startsAt) + { + $this->startsAt = $startsAt; + + return $this; + } + + + public function build(): RecurringOrderSetStartsAtAction + { + return new RecurringOrderSetStartsAtActionModel( + $this->startsAt + ); + } + + public static function of(): RecurringOrderSetStartsAtActionBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderSetStartsAtActionCollection.php b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderSetStartsAtActionCollection.php new file mode 100644 index 00000000000..3e37b7ec4a4 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderSetStartsAtActionCollection.php @@ -0,0 +1,56 @@ + + * @method RecurringOrderSetStartsAtAction current() + * @method RecurringOrderSetStartsAtAction end() + * @method RecurringOrderSetStartsAtAction at($offset) + */ +class RecurringOrderSetStartsAtActionCollection extends RecurringOrderUpdateActionCollection +{ + /** + * @psalm-assert RecurringOrderSetStartsAtAction $value + * @psalm-param RecurringOrderSetStartsAtAction|stdClass $value + * @throws InvalidArgumentException + * + * @return RecurringOrderSetStartsAtActionCollection + */ + public function add($value) + { + if (!$value instanceof RecurringOrderSetStartsAtAction) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?RecurringOrderSetStartsAtAction + */ + protected function mapper() + { + return function (?int $index): ?RecurringOrderSetStartsAtAction { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var RecurringOrderSetStartsAtAction $data */ + $data = RecurringOrderSetStartsAtActionModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderSetStartsAtActionModel.php b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderSetStartsAtActionModel.php new file mode 100644 index 00000000000..53cc18796b2 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderSetStartsAtActionModel.php @@ -0,0 +1,109 @@ +startsAt = $startsAt; + $this->action = $action ?? self::DISCRIMINATOR_VALUE; + } + + /** + * + * @return null|string + */ + public function getAction() + { + if (is_null($this->action)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_ACTION); + if (is_null($data)) { + return null; + } + $this->action = (string) $data; + } + + return $this->action; + } + + /** + *Date and time (UTC) the Recurring Order should be started. The date and time must be in the future.
+ * + * + * @return null|DateTimeImmutable + */ + public function getStartsAt() + { + if (is_null($this->startsAt)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_STARTS_AT); + if (is_null($data)) { + return null; + } + $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data); + if (false === $data) { + return null; + } + $this->startsAt = $data; + } + + return $this->startsAt; + } + + + /** + * @param ?DateTimeImmutable $startsAt + */ + public function setStartsAt(?DateTimeImmutable $startsAt): void + { + $this->startsAt = $startsAt; + } + + + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + $data = $this->toArray(); + if (isset($data[RecurringOrderSetStartsAtAction::FIELD_STARTS_AT]) && $data[RecurringOrderSetStartsAtAction::FIELD_STARTS_AT] instanceof \DateTimeImmutable) { + $data[RecurringOrderSetStartsAtAction::FIELD_STARTS_AT] = $data[RecurringOrderSetStartsAtAction::FIELD_STARTS_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c'); + } + return (object) $data; + } +} diff --git a/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderSetStateAction.php b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderSetStateAction.php new file mode 100644 index 00000000000..e2ad9fa53be --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderSetStateAction.php @@ -0,0 +1,30 @@ +New state of the RecurringOrder. + * + + * @return null|RecurringOrderStateDraft + */ + public function getRecurringOrderState(); + + /** + * @param ?RecurringOrderStateDraft $recurringOrderState + */ + public function setRecurringOrderState(?RecurringOrderStateDraft $recurringOrderState): void; +} diff --git a/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderSetStateActionBuilder.php b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderSetStateActionBuilder.php new file mode 100644 index 00000000000..cef5a0da40f --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderSetStateActionBuilder.php @@ -0,0 +1,73 @@ + + */ +final class RecurringOrderSetStateActionBuilder implements Builder +{ + /** + + * @var null|RecurringOrderStateDraft|RecurringOrderStateDraftBuilder + */ + private $recurringOrderState; + + /** + *New state of the RecurringOrder.
+ * + + * @return null|RecurringOrderStateDraft + */ + public function getRecurringOrderState() + { + return $this->recurringOrderState instanceof RecurringOrderStateDraftBuilder ? $this->recurringOrderState->build() : $this->recurringOrderState; + } + + /** + * @param ?RecurringOrderStateDraft $recurringOrderState + * @return $this + */ + public function withRecurringOrderState(?RecurringOrderStateDraft $recurringOrderState) + { + $this->recurringOrderState = $recurringOrderState; + + return $this; + } + + /** + * @deprecated use withRecurringOrderState() instead + * @return $this + */ + public function withRecurringOrderStateBuilder(?RecurringOrderStateDraftBuilder $recurringOrderState) + { + $this->recurringOrderState = $recurringOrderState; + + return $this; + } + + public function build(): RecurringOrderSetStateAction + { + return new RecurringOrderSetStateActionModel( + $this->recurringOrderState instanceof RecurringOrderStateDraftBuilder ? $this->recurringOrderState->build() : $this->recurringOrderState + ); + } + + public static function of(): RecurringOrderSetStateActionBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderSetStateActionCollection.php b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderSetStateActionCollection.php new file mode 100644 index 00000000000..2dc0b331bb7 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderSetStateActionCollection.php @@ -0,0 +1,56 @@ + + * @method RecurringOrderSetStateAction current() + * @method RecurringOrderSetStateAction end() + * @method RecurringOrderSetStateAction at($offset) + */ +class RecurringOrderSetStateActionCollection extends RecurringOrderUpdateActionCollection +{ + /** + * @psalm-assert RecurringOrderSetStateAction $value + * @psalm-param RecurringOrderSetStateAction|stdClass $value + * @throws InvalidArgumentException + * + * @return RecurringOrderSetStateActionCollection + */ + public function add($value) + { + if (!$value instanceof RecurringOrderSetStateAction) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?RecurringOrderSetStateAction + */ + protected function mapper() + { + return function (?int $index): ?RecurringOrderSetStateAction { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var RecurringOrderSetStateAction $data */ + $data = RecurringOrderSetStateActionModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderSetStateActionModel.php b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderSetStateActionModel.php new file mode 100644 index 00000000000..f4e174b0835 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderSetStateActionModel.php @@ -0,0 +1,94 @@ +recurringOrderState = $recurringOrderState; + $this->action = $action ?? self::DISCRIMINATOR_VALUE; + } + + /** + * + * @return null|string + */ + public function getAction() + { + if (is_null($this->action)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_ACTION); + if (is_null($data)) { + return null; + } + $this->action = (string) $data; + } + + return $this->action; + } + + /** + *New state of the RecurringOrder.
+ * + * + * @return null|RecurringOrderStateDraft + */ + public function getRecurringOrderState() + { + if (is_null($this->recurringOrderState)) { + /** @psalm-var stdClass|arraySet to true to turn off validation.
Value to set. + * If there is no State yet, the new State must be an initial State.
+ * + + * @return null|StateResourceIdentifier + */ + public function getState() + { + return $this->state instanceof StateResourceIdentifierBuilder ? $this->state->build() : $this->state; + } + + /** + *Set to true to turn off validation.
Value to set. + * If there is no State yet, the new State must be an initial State.
+ * + * + * @return null|StateResourceIdentifier + */ + public function getState() + { + if (is_null($this->state)) { + /** @psalm-var stdClass|arraySet to true to turn off validation.
Update actions to be performed on the RecurringOrder.
+ * + + * @return null|RecurringOrderUpdateActionCollection + */ + public function getActions(); + + /** + * @param ?int $version + */ + public function setVersion(?int $version): void; + + /** + * @param ?RecurringOrderUpdateActionCollection $actions + */ + public function setActions(?RecurringOrderUpdateActionCollection $actions): void; +} diff --git a/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderUpdateAction.php b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderUpdateAction.php new file mode 100644 index 00000000000..9074e058d97 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderUpdateAction.php @@ -0,0 +1,24 @@ + + */ +final class RecurringOrderUpdateActionBuilder implements Builder +{ + public function build(): RecurringOrderUpdateAction + { + return new RecurringOrderUpdateActionModel( + ); + } + + public static function of(): RecurringOrderUpdateActionBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderUpdateActionCollection.php b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderUpdateActionCollection.php new file mode 100644 index 00000000000..5439559d3a4 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderUpdateActionCollection.php @@ -0,0 +1,60 @@ + + * @psalm-method T current() + * @psalm-method T end() + * @psalm-method T at($offset) + * @method RecurringOrderUpdateAction current() + * @method RecurringOrderUpdateAction end() + * @method RecurringOrderUpdateAction at($offset) + */ +class RecurringOrderUpdateActionCollection extends MapperSequence +{ + /** + * @psalm-assert T $value + * @psalm-param T|stdClass $value + * @throws InvalidArgumentException + * + * @return RecurringOrderUpdateActionCollection + */ + public function add($value) + { + if (!$value instanceof RecurringOrderUpdateAction) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?T + */ + protected function mapper() + { + return function (?int $index): ?RecurringOrderUpdateAction { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var T $data */ + $data = RecurringOrderUpdateActionModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderUpdateActionModel.php b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderUpdateActionModel.php new file mode 100644 index 00000000000..7837dcfb268 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderUpdateActionModel.php @@ -0,0 +1,101 @@ + > + * + */ + private static $discriminatorClasses = [ + 'setCustomField' => RecurringOrderSetCustomFieldActionModel::class, + 'setCustomType' => RecurringOrderSetCustomTypeActionModel::class, + 'setKey' => RecurringOrderSetKeyActionModel::class, + 'setOrderSkipConfiguration' => RecurringOrderSetOrderSkipConfigurationActionModel::class, + 'setRecurringOrderState' => RecurringOrderSetStateActionModel::class, + 'setSchedule' => RecurringOrderSetScheduleActionModel::class, + 'setStartsAt' => RecurringOrderSetStartsAtActionModel::class, + 'transitionState' => RecurringOrderTransitionStateActionModel::class, + ]; + + /** + * @psalm-suppress MissingParamType + */ + public function __construct( + ?string $action = null + ) { + $this->action = $action; + } + + /** + * + * @return null|string + */ + public function getAction() + { + if (is_null($this->action)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_ACTION); + if (is_null($data)) { + return null; + } + $this->action = (string) $data; + } + + return $this->action; + } + + + + + + /** + * @psalm-param stdClass|arrayExpected version of the RecurringOrder on which the changes should be applied. + * If the expected version does not match the actual version, a ConcurrentModification error will be returned.
+ * + + * @return null|int + */ + public function getVersion() + { + return $this->version; + } + + /** + *Update actions to be performed on the RecurringOrder.
+ * + + * @return null|RecurringOrderUpdateActionCollection + */ + public function getActions() + { + return $this->actions; + } + + /** + * @param ?int $version + * @return $this + */ + public function withVersion(?int $version) + { + $this->version = $version; + + return $this; + } + + /** + * @param ?RecurringOrderUpdateActionCollection $actions + * @return $this + */ + public function withActions(?RecurringOrderUpdateActionCollection $actions) + { + $this->actions = $actions; + + return $this; + } + + + public function build(): RecurringOrderUpdate + { + return new RecurringOrderUpdateModel( + $this->version, + $this->actions + ); + } + + public static function of(): RecurringOrderUpdateBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderUpdateCollection.php b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderUpdateCollection.php new file mode 100644 index 00000000000..25e63c65138 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderUpdateCollection.php @@ -0,0 +1,56 @@ + + * @method RecurringOrderUpdate current() + * @method RecurringOrderUpdate end() + * @method RecurringOrderUpdate at($offset) + */ +class RecurringOrderUpdateCollection extends MapperSequence +{ + /** + * @psalm-assert RecurringOrderUpdate $value + * @psalm-param RecurringOrderUpdate|stdClass $value + * @throws InvalidArgumentException + * + * @return RecurringOrderUpdateCollection + */ + public function add($value) + { + if (!$value instanceof RecurringOrderUpdate) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?RecurringOrderUpdate + */ + protected function mapper() + { + return function (?int $index): ?RecurringOrderUpdate { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var RecurringOrderUpdate $data */ + $data = RecurringOrderUpdateModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderUpdateModel.php b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderUpdateModel.php new file mode 100644 index 00000000000..533ed2013e8 --- /dev/null +++ b/lib/commercetools-api/src/Models/RecurringOrder/RecurringOrderUpdateModel.php @@ -0,0 +1,103 @@ +version = $version; + $this->actions = $actions; + } + + /** + *Expected version of the RecurringOrder on which the changes should be applied. + * If the expected version does not match the actual version, a ConcurrentModification error will be returned.
+ * + * + * @return null|int + */ + public function getVersion() + { + if (is_null($this->version)) { + /** @psalm-var ?int $data */ + $data = $this->raw(self::FIELD_VERSION); + if (is_null($data)) { + return null; + } + $this->version = (int) $data; + } + + return $this->version; + } + + /** + *Update actions to be performed on the RecurringOrder.
+ * + * + * @return null|RecurringOrderUpdateActionCollection + */ + public function getActions() + { + if (is_null($this->actions)) { + /** @psalm-var ?listUnique identifier of the StandalonePrice.
@@ -194,6 +196,14 @@ public function getStaged(); */ public function getActive(); + /** + *RecurrencePolicy for which this Price is valid.
+ * + + * @return null|RecurrencePolicyReference + */ + public function getRecurrencePolicy(); + /** * @param ?string $id */ @@ -288,4 +298,9 @@ public function setStaged(?StagedStandalonePrice $staged): void; * @param ?bool $active */ public function setActive(?bool $active): void; + + /** + * @param ?RecurrencePolicyReference $recurrencePolicy + */ + public function setRecurrencePolicy(?RecurrencePolicyReference $recurrencePolicy): void; } diff --git a/lib/commercetools-api/src/Models/StandalonePrice/StandalonePriceBuilder.php b/lib/commercetools-api/src/Models/StandalonePrice/StandalonePriceBuilder.php index adad8f97266..c5b68c10619 100644 --- a/lib/commercetools-api/src/Models/StandalonePrice/StandalonePriceBuilder.php +++ b/lib/commercetools-api/src/Models/StandalonePrice/StandalonePriceBuilder.php @@ -23,6 +23,8 @@ use Commercetools\Api\Models\Common\TypedMoneyBuilder; use Commercetools\Api\Models\CustomerGroup\CustomerGroupReference; use Commercetools\Api\Models\CustomerGroup\CustomerGroupReferenceBuilder; +use Commercetools\Api\Models\RecurrencePolicy\RecurrencePolicyReference; +use Commercetools\Api\Models\RecurrencePolicy\RecurrencePolicyReferenceBuilder; use Commercetools\Api\Models\Type\CustomFields; use Commercetools\Api\Models\Type\CustomFieldsBuilder; use Commercetools\Base\Builder; @@ -152,6 +154,12 @@ final class StandalonePriceBuilder implements Builder */ private $active; + /** + + * @var null|RecurrencePolicyReference|RecurrencePolicyReferenceBuilder + */ + private $recurrencePolicy; + /** *Unique identifier of the StandalonePrice.
* @@ -364,6 +372,17 @@ public function getActive() return $this->active; } + /** + *RecurrencePolicy for which this Price is valid.
+ * + + * @return null|RecurrencePolicyReference + */ + public function getRecurrencePolicy() + { + return $this->recurrencePolicy instanceof RecurrencePolicyReferenceBuilder ? $this->recurrencePolicy->build() : $this->recurrencePolicy; + } + /** * @param ?string $id * @return $this @@ -573,6 +592,17 @@ public function withActive(?bool $active) return $this; } + /** + * @param ?RecurrencePolicyReference $recurrencePolicy + * @return $this + */ + public function withRecurrencePolicy(?RecurrencePolicyReference $recurrencePolicy) + { + $this->recurrencePolicy = $recurrencePolicy; + + return $this; + } + /** * @deprecated use withLastModifiedBy() instead * @return $this @@ -661,6 +691,17 @@ public function withStagedBuilder(?StagedStandalonePriceBuilder $staged) return $this; } + /** + * @deprecated use withRecurrencePolicy() instead + * @return $this + */ + public function withRecurrencePolicyBuilder(?RecurrencePolicyReferenceBuilder $recurrencePolicy) + { + $this->recurrencePolicy = $recurrencePolicy; + + return $this; + } + public function build(): StandalonePrice { return new StandalonePriceModel( @@ -682,7 +723,8 @@ public function build(): StandalonePrice $this->discounted instanceof DiscountedPriceBuilder ? $this->discounted->build() : $this->discounted, $this->custom instanceof CustomFieldsBuilder ? $this->custom->build() : $this->custom, $this->staged instanceof StagedStandalonePriceBuilder ? $this->staged->build() : $this->staged, - $this->active + $this->active, + $this->recurrencePolicy instanceof RecurrencePolicyReferenceBuilder ? $this->recurrencePolicy->build() : $this->recurrencePolicy ); } diff --git a/lib/commercetools-api/src/Models/StandalonePrice/StandalonePriceDraft.php b/lib/commercetools-api/src/Models/StandalonePrice/StandalonePriceDraft.php index 3e3ab222f58..78fa7121db8 100644 --- a/lib/commercetools-api/src/Models/StandalonePrice/StandalonePriceDraft.php +++ b/lib/commercetools-api/src/Models/StandalonePrice/StandalonePriceDraft.php @@ -13,6 +13,7 @@ use Commercetools\Api\Models\Common\Money; use Commercetools\Api\Models\Common\PriceTierDraftCollection; use Commercetools\Api\Models\CustomerGroup\CustomerGroupResourceIdentifier; +use Commercetools\Api\Models\RecurrencePolicy\RecurrencePolicyResourceIdentifier; use Commercetools\Api\Models\Type\CustomFieldsDraft; use Commercetools\Base\DateTimeImmutableCollection; use Commercetools\Base\JsonObject; @@ -31,6 +32,7 @@ interface StandalonePriceDraft extends JsonObject public const FIELD_TIERS = 'tiers'; public const FIELD_DISCOUNTED = 'discounted'; public const FIELD_CUSTOM = 'custom'; + public const FIELD_RECURRENCE_POLICY = 'recurrencePolicy'; public const FIELD_STAGED = 'staged'; public const FIELD_ACTIVE = 'active'; @@ -125,6 +127,14 @@ public function getDiscounted(); */ public function getCustom(); + /** + *RecurrencePolicy for which this Price is valid.
+ * + + * @return null|RecurrencePolicyResourceIdentifier + */ + public function getRecurrencePolicy(); + /** *Staged changes for the StandalonePrice.
* @@ -196,6 +206,11 @@ public function setDiscounted(?DiscountedPriceDraft $discounted): void; */ public function setCustom(?CustomFieldsDraft $custom): void; + /** + * @param ?RecurrencePolicyResourceIdentifier $recurrencePolicy + */ + public function setRecurrencePolicy(?RecurrencePolicyResourceIdentifier $recurrencePolicy): void; + /** * @param ?StagedPriceDraft $staged */ diff --git a/lib/commercetools-api/src/Models/StandalonePrice/StandalonePriceDraftBuilder.php b/lib/commercetools-api/src/Models/StandalonePrice/StandalonePriceDraftBuilder.php index 50afe265ea0..2f74d1803e1 100644 --- a/lib/commercetools-api/src/Models/StandalonePrice/StandalonePriceDraftBuilder.php +++ b/lib/commercetools-api/src/Models/StandalonePrice/StandalonePriceDraftBuilder.php @@ -17,6 +17,8 @@ use Commercetools\Api\Models\Common\PriceTierDraftCollection; use Commercetools\Api\Models\CustomerGroup\CustomerGroupResourceIdentifier; use Commercetools\Api\Models\CustomerGroup\CustomerGroupResourceIdentifierBuilder; +use Commercetools\Api\Models\RecurrencePolicy\RecurrencePolicyResourceIdentifier; +use Commercetools\Api\Models\RecurrencePolicy\RecurrencePolicyResourceIdentifierBuilder; use Commercetools\Api\Models\Type\CustomFieldsDraft; use Commercetools\Api\Models\Type\CustomFieldsDraftBuilder; use Commercetools\Base\Builder; @@ -98,6 +100,12 @@ final class StandalonePriceDraftBuilder implements Builder */ private $custom; + /** + + * @var null|RecurrencePolicyResourceIdentifier|RecurrencePolicyResourceIdentifierBuilder + */ + private $recurrencePolicy; + /** * @var null|StagedPriceDraft|StagedPriceDraftBuilder @@ -234,6 +242,17 @@ public function getCustom() return $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom; } + /** + *RecurrencePolicy for which this Price is valid.
+ * + + * @return null|RecurrencePolicyResourceIdentifier + */ + public function getRecurrencePolicy() + { + return $this->recurrencePolicy instanceof RecurrencePolicyResourceIdentifierBuilder ? $this->recurrencePolicy->build() : $this->recurrencePolicy; + } + /** *Staged changes for the StandalonePrice.
* @@ -377,6 +396,17 @@ public function withCustom(?CustomFieldsDraft $custom) return $this; } + /** + * @param ?RecurrencePolicyResourceIdentifier $recurrencePolicy + * @return $this + */ + public function withRecurrencePolicy(?RecurrencePolicyResourceIdentifier $recurrencePolicy) + { + $this->recurrencePolicy = $recurrencePolicy; + + return $this; + } + /** * @param ?StagedPriceDraft $staged * @return $this @@ -454,6 +484,17 @@ public function withCustomBuilder(?CustomFieldsDraftBuilder $custom) return $this; } + /** + * @deprecated use withRecurrencePolicy() instead + * @return $this + */ + public function withRecurrencePolicyBuilder(?RecurrencePolicyResourceIdentifierBuilder $recurrencePolicy) + { + $this->recurrencePolicy = $recurrencePolicy; + + return $this; + } + /** * @deprecated use withStaged() instead * @return $this @@ -479,6 +520,7 @@ public function build(): StandalonePriceDraft $this->tiers, $this->discounted instanceof DiscountedPriceDraftBuilder ? $this->discounted->build() : $this->discounted, $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom, + $this->recurrencePolicy instanceof RecurrencePolicyResourceIdentifierBuilder ? $this->recurrencePolicy->build() : $this->recurrencePolicy, $this->staged instanceof StagedPriceDraftBuilder ? $this->staged->build() : $this->staged, $this->active ); diff --git a/lib/commercetools-api/src/Models/StandalonePrice/StandalonePriceDraftModel.php b/lib/commercetools-api/src/Models/StandalonePrice/StandalonePriceDraftModel.php index 8c66f931853..1175926c377 100644 --- a/lib/commercetools-api/src/Models/StandalonePrice/StandalonePriceDraftModel.php +++ b/lib/commercetools-api/src/Models/StandalonePrice/StandalonePriceDraftModel.php @@ -17,6 +17,8 @@ use Commercetools\Api\Models\Common\PriceTierDraftCollection; use Commercetools\Api\Models\CustomerGroup\CustomerGroupResourceIdentifier; use Commercetools\Api\Models\CustomerGroup\CustomerGroupResourceIdentifierModel; +use Commercetools\Api\Models\RecurrencePolicy\RecurrencePolicyResourceIdentifier; +use Commercetools\Api\Models\RecurrencePolicy\RecurrencePolicyResourceIdentifierModel; use Commercetools\Api\Models\Type\CustomFieldsDraft; use Commercetools\Api\Models\Type\CustomFieldsDraftModel; use Commercetools\Base\DateTimeImmutableCollection; @@ -97,6 +99,12 @@ final class StandalonePriceDraftModel extends JsonObjectModel implements Standal */ protected $custom; + /** + * + * @var ?RecurrencePolicyResourceIdentifier + */ + protected $recurrencePolicy; + /** * * @var ?StagedPriceDraft @@ -125,6 +133,7 @@ public function __construct( ?PriceTierDraftCollection $tiers = null, ?DiscountedPriceDraft $discounted = null, ?CustomFieldsDraft $custom = null, + ?RecurrencePolicyResourceIdentifier $recurrencePolicy = null, ?StagedPriceDraft $staged = null, ?bool $active = null ) { @@ -139,6 +148,7 @@ public function __construct( $this->tiers = $tiers; $this->discounted = $discounted; $this->custom = $custom; + $this->recurrencePolicy = $recurrencePolicy; $this->staged = $staged; $this->active = $active; } @@ -379,6 +389,27 @@ public function getCustom() return $this->custom; } + /** + *RecurrencePolicy for which this Price is valid.
+ * + * + * @return null|RecurrencePolicyResourceIdentifier + */ + public function getRecurrencePolicy() + { + if (is_null($this->recurrencePolicy)) { + /** @psalm-var stdClass|arrayStaged changes for the StandalonePrice.
* @@ -509,6 +540,14 @@ public function setCustom(?CustomFieldsDraft $custom): void $this->custom = $custom; } + /** + * @param ?RecurrencePolicyResourceIdentifier $recurrencePolicy + */ + public function setRecurrencePolicy(?RecurrencePolicyResourceIdentifier $recurrencePolicy): void + { + $this->recurrencePolicy = $recurrencePolicy; + } + /** * @param ?StagedPriceDraft $staged */ diff --git a/lib/commercetools-api/src/Models/StandalonePrice/StandalonePriceModel.php b/lib/commercetools-api/src/Models/StandalonePrice/StandalonePriceModel.php index 65e89a927c7..16924968778 100644 --- a/lib/commercetools-api/src/Models/StandalonePrice/StandalonePriceModel.php +++ b/lib/commercetools-api/src/Models/StandalonePrice/StandalonePriceModel.php @@ -23,6 +23,8 @@ use Commercetools\Api\Models\Common\TypedMoneyModel; use Commercetools\Api\Models\CustomerGroup\CustomerGroupReference; use Commercetools\Api\Models\CustomerGroup\CustomerGroupReferenceModel; +use Commercetools\Api\Models\RecurrencePolicy\RecurrencePolicyReference; +use Commercetools\Api\Models\RecurrencePolicy\RecurrencePolicyReferenceModel; use Commercetools\Api\Models\Type\CustomFields; use Commercetools\Api\Models\Type\CustomFieldsModel; use Commercetools\Base\DateTimeImmutableCollection; @@ -151,6 +153,12 @@ final class StandalonePriceModel extends JsonObjectModel implements StandalonePr */ protected $active; + /** + * + * @var ?RecurrencePolicyReference + */ + protected $recurrencePolicy; + /** * @psalm-suppress MissingParamType @@ -174,7 +182,8 @@ public function __construct( ?DiscountedPrice $discounted = null, ?CustomFields $custom = null, ?StagedStandalonePrice $staged = null, - ?bool $active = null + ?bool $active = null, + ?RecurrencePolicyReference $recurrencePolicy = null ) { $this->id = $id; $this->version = $version; @@ -195,6 +204,7 @@ public function __construct( $this->custom = $custom; $this->staged = $staged; $this->active = $active; + $this->recurrencePolicy = $recurrencePolicy; } /** @@ -604,6 +614,27 @@ public function getActive() return $this->active; } + /** + *RecurrencePolicy for which this Price is valid.
+ * + * + * @return null|RecurrencePolicyReference + */ + public function getRecurrencePolicy() + { + if (is_null($this->recurrencePolicy)) { + /** @psalm-var stdClass|array