diff --git a/changes.md b/changes.md
index 270731b83ab..ff121811cf2 100644
--- a/changes.md
+++ b/changes.md
@@ -7,7 +7,9 @@
- added type `BusinessUnitSetUnitTypeAction`
- added type `CartDiscountSetDiscountGroupAction`
- added type `BestDeal`
+- added type `CartMergeMode`
- added type `DiscountTypeCombination`
+- added type `MergeCartDraft`
- added type `Stacking`
- added type `CartChangePriceRoundingModeAction`
- added type `CartSetCustomLineItemRecurrenceInfoAction`
@@ -32,9 +34,11 @@
- added type `ExpiredCustomerEmailTokenError`
- added type `ExpiredCustomerPasswordTokenError`
- added type `MaxDiscountGroupsReachedError`
+- added type `RecurringOrderFailureError`
- added type `GraphQLExpiredCustomerEmailTokenError`
- added type `GraphQLExpiredCustomerPasswordTokenError`
- added type `GraphQLMaxDiscountGroupsReachedError`
+- added type `GraphQLRecurringOrderFailureError`
- added type `BaseEvent`
- added type `CheckoutOrderCreationFailedEvent`
- added type `CheckoutPaymentAuthorizationCancelledEvent`
@@ -69,6 +73,8 @@
- added type `AssociateRoleNameSetMessage`
- added type `BusinessUnitTopLevelUnitSetMessage`
- added type `BusinessUnitTypeSetMessage`
+- added type `CartFrozenMessage`
+- added type `CartUnfrozenMessage`
- added type `CustomerDefaultBillingAddressSetMessage`
- added type `CustomerDefaultShippingAddressSetMessage`
- added type `CustomerGroupAssignmentAddedMessage`
@@ -82,6 +88,7 @@
- added type `DiscountGroupSortOrderSetMessage`
- added type `OrderBusinessUnitSetMessage`
- added type `OrderCreatedFromRecurringOrderMessage`
+- added type `OrderPaymentRemovedMessage`
- added type `PaymentInterfaceIdSetMessage`
- added type `PaymentMethodCreatedMessage`
- added type `PaymentMethodCustomFieldAddedMessage`
@@ -116,6 +123,7 @@
- added type `RecurringOrderCustomTypeSetMessage`
- added type `RecurringOrderDeletedMessage`
- added type `RecurringOrderExpiresAtSetMessage`
+- added type `RecurringOrderFailedMessage`
- added type `RecurringOrderKeySetMessage`
- added type `RecurringOrderScheduleSetMessage`
- added type `RecurringOrderStartsAtSetMessage`
@@ -124,6 +132,8 @@
- added type `AssociateRoleNameSetMessagePayload`
- added type `BusinessUnitTopLevelUnitSetMessagePayload`
- added type `BusinessUnitTypeSetMessagePayload`
+- added type `CartFrozenMessagePayload`
+- added type `CartUnfrozenMessagePayload`
- added type `CustomerDefaultBillingAddressSetMessagePayload`
- added type `CustomerDefaultShippingAddressSetMessagePayload`
- added type `CustomerGroupAssignmentAddedMessagePayload`
@@ -137,6 +147,7 @@
- added type `DiscountGroupSortOrderSetMessagePayload`
- added type `OrderBusinessUnitSetMessagePayload`
- added type `OrderCreatedFromRecurringOrderMessagePayload`
+- added type `OrderPaymentRemovedMessagePayload`
- added type `PaymentInterfaceIdSetMessagePayload`
- added type `PaymentMethodCreatedMessagePayload`
- added type `PaymentMethodCustomFieldAddedMessagePayload`
@@ -171,6 +182,7 @@
- added type `RecurringOrderCustomTypeSetMessagePayload`
- added type `RecurringOrderDeletedMessagePayload`
- added type `RecurringOrderExpiresAtSetMessagePayload`
+- added type `RecurringOrderFailedMessagePayload`
- added type `RecurringOrderKeySetMessagePayload`
- added type `RecurringOrderScheduleSetMessagePayload`
- added type `RecurringOrderStartsAtSetMessagePayload`
@@ -282,6 +294,13 @@
+ Amount to subtract from the LineItem's Amount to subtract from the LineItem quantity.
+ * If omitted, the LineItem is removed from the Cart. Amount to subtract from the LineItem's Amount to subtract from the LineItem quantity.
+ * If omitted, the LineItem is removed from the Cart. Amount to subtract from the LineItem's Amount to subtract from the LineItem quantity.
+ * If omitted, the LineItem is removed from the Cart.Deprecated Type(s)
+
+- type `ProductLegacySetSkuAction` is removed
+Removed Type(s)
@@ -407,8 +426,11 @@
Removed Property(s)
+- :warning: removed property `payment` from type `OrderPaymentAddedMessage`
+- :warning: removed property `payment` from type `OrderPaymentAddedMessagePayload`
- :warning: removed property `/[0-9].[0-9]*[1-9]/` from type `CategoryOrderHints`
- :warning: removed property `//` from type `ProductVariantChannelAvailabilityMap`
+- :warning: removed property `tierMinimumQuantity` from type `StandalonePriceRemovePriceTierAction`
Added Method(s)
-- added method `$apiRoot->withProjectKeyValue()->productSelections()->importContainers()->withImportContainerKeyValue()->post()`
- added method `$apiRoot->withProjectKeyValue()->businessUnits()->importContainers()->withImportContainerKeyValue()->post()`
+- added method `$apiRoot->withProjectKeyValue()->productSelections()->importContainers()->withImportContainerKeyValue()->post()`
Added Resource(s)
-- added resource `/{projectKey}/product-selections`
- added resource `/{projectKey}/business-units`
-- added resource `/{projectKey}/product-selections/import-containers`
-- added resource `/{projectKey}/product-selections/import-containers/{importContainerKey}`
+- added resource `/{projectKey}/product-selections`
- added resource `/{projectKey}/business-units/import-containers`
- added resource `/{projectKey}/business-units/import-containers/{importContainerKey}`
+- added resource `/{projectKey}/product-selections/import-containers`
+- added resource `/{projectKey}/product-selections/import-containers/{importContainerKey}`
Changed Type(s)
+
+- :warning: changed type `Address` from type `object` to `BaseAddress`
+- :warning: changed type `GeoLocation` from type `object` to `GeoJson`
+MarkDeprecated Type(s)
+
+- marked type `AddAssociateChange` as deprecated
+- marked type `AddPriceChange` as deprecated
+- marked type `AddProductSelectionChange` as deprecated
+- marked type `AddStateRolesChange` as deprecated
+- marked type `ChangeAmountAuthorizedChange` as deprecated
+- marked type `RemoveAssociateChange` as deprecated
+- marked type `RemovePriceChange` as deprecated
+- marked type `RemoveProductSelectionChange` as deprecated
+- marked type `RemoveStateRolesChange` as deprecated
Added Enum(s)
+- added enum `addInheritedAssociate` to type `PlatformInitiatedChange`
+- added enum `changeIncludedInStatistics` to type `PlatformInitiatedChange`
+- added enum `changeInheritedAssociate` to type `PlatformInitiatedChange`
+- added enum `changeLastVariantId` to type `PlatformInitiatedChange`
+- added enum `changeLineItemPublished` to type `PlatformInitiatedChange`
+- added enum `changeTopLevelUnit` to type `PlatformInitiatedChange`
+- added enum `removeInheritedAssociate` to type `PlatformInitiatedChange`
+- added enum `setAncestors` to type `PlatformInitiatedChange`
+- added enum `setInheritedAssociates` to type `PlatformInitiatedChange`
+- added enum `setInheritedStores` to type `PlatformInitiatedChange`
+- added enum `setLineItemDeactivatedAt` to type `PlatformInitiatedChange`
+- added enum `setProductCount` to type `PlatformInitiatedChange`
+- added enum `setReservations` to type `PlatformInitiatedChange`
- added enum `setAssetKey` to type `UpdateType`
- added enum `ApplicationStoppedByGroupBestDeal` to type `DiscountCodeState`
+- added enum `CreateApprovalRules` to type `Permission`
+- added enum `UpdateApprovalRules` to type `Permission`
+- added enum `UpdateApprovalFlows` to type `Permission`
+- added enum `ViewMyShoppingLists` to type `Permission`
+- added enum `ViewOthersShoppingLists` to type `Permission`
+- added enum `UpdateMyShoppingLists` to type `Permission`
+- added enum `UpdateOthersShoppingLists` to type `Permission`
+- added enum `CreateMyShoppingLists` to type `Permission`
+- added enum `CreateOthersShoppingLists` to type `Permission`
+- added enum `DeleteMyShoppingLists` to type `Permission`
+- added enum `DeleteOthersShoppingLists` to type `Permission`
+- added enum `includeOnly` to type `ProductVariantSelectionTypeEnum`
+- added enum `includeAllExcept` to type `ProductVariantSelectionTypeEnum`
+- added enum `RenegotiationAddressed` to type `QuoteState`
+- added enum `approval-flow` to type `ReferenceTypeId`
+- added enum `approval-rule` to type `ReferenceTypeId`
+- added enum `attribute-group` to type `ReferenceTypeId`
+- added enum `direct-discount` to type `ReferenceTypeId`
+- added enum `discount-group` to type `ReferenceTypeId`
- added enum `payment-method` to type `ReferenceTypeId`
+- added enum `product-price` to type `ReferenceTypeId`
+- added enum `product-tailoring` to type `ReferenceTypeId`
+- added enum `recurrence-policy` to type `ReferenceTypeId`
+- added enum `recurring-order` to type `ReferenceTypeId`
+- added enum `standalone-price` to type `ReferenceTypeId`
+- added enum `Delivered` to type `ShipmentState`
+- added enum `Canceled` to type `ShipmentState`
- added enum `RecurringOrderState` to type `StateTypeEnum`
Removed Enum(s)
+- :warning: removed enum `changeAmountAuthorized` from type `UpdateType`
- :warning: removed enum `setAsssetKey` from type `UpdateType`
+- :warning: removed enum `Failed` from type `QuoteState`
Required Property(s)
+- changed property `id` of type `Address` to be optional
+- changed property `key` of type `Address` to be optional
+- changed property `title` of type `Address` to be optional
+- changed property `salutation` of type `Address` to be optional
+- changed property `firstName` of type `Address` to be optional
+- changed property `lastName` of type `Address` to be optional
+- changed property `streetName` of type `Address` to be optional
+- changed property `streetNumber` of type `Address` to be optional
+- changed property `additionalStreetInfo` of type `Address` to be optional
+- changed property `postalCode` of type `Address` to be optional
+- changed property `city` of type `Address` to be optional
+- changed property `region` of type `Address` to be optional
+- changed property `state` of type `Address` to be optional
+- changed property `company` of type `Address` to be optional
+- changed property `department` of type `Address` to be optional
+- changed property `building` of type `Address` to be optional
+- changed property `apartment` of type `Address` to be optional
+- changed property `pOBox` of type `Address` to be optional
+- changed property `phone` of type `Address` to be optional
+- changed property `mobile` of type `Address` to be optional
+- changed property `email` of type `Address` to be optional
+- changed property `fax` of type `Address` to be optional
+- changed property `additionalAddressInfo` of type `Address` to be optional
+- changed property `externalId` of type `Address` to be optional
+- changed property `description` of type `Asset` to be optional
+- changed property `custom` of type `Asset` to be optional
+- changed property `key` of type `Asset` to be optional
+- changed property `key` of type `AssetSource` to be optional
+- changed property `dimensions` of type `AssetSource` to be optional
+- changed property `contentType` of type `AssetSource` to be optional
+- changed property `inputTip` of type `AttributeDefinition` to be optional
+- changed property `taxedPrice` of type `CustomLineItem` to be optional
+- changed property `inputHint` of type `FieldDefinition` to be optional
+- changed property `label` of type `Image` to be optional
+- changed property `productSlug` of type `LineItem` to be optional
+- changed property `custom` of type `LineItem` to be optional
+- changed property `addedAt` of type `LineItem` to be optional
+- changed property `state` of type `Location` to be optional
+- changed property `measurements` of type `Parcel` to be optional
+- changed property `trackingData` of type `Parcel` to be optional
+- changed property `items` of type `Parcel` to be optional
+- changed property `heightInMillimeter` of type `ParcelMeasurements` to be optional
+- changed property `lengthInMillimeter` of type `ParcelMeasurements` to be optional
+- changed property `widthInMillimeter` of type `ParcelMeasurements` to be optional
+- changed property `weightInGram` of type `ParcelMeasurements` to be optional
+- changed property `channels` of type `ProductVariantAvailability` to be optional
+- changed property `isOnStock` of type `ProductVariantAvailability` to be optional
+- changed property `restockableInDays` of type `ProductVariantAvailability` to be optional
+- changed property `availableQuantity` of type `ProductVariantAvailability` to be optional
+- changed property `isOnStock` of type `ProductVariantChannelAvailability` to be optional
+- changed property `restockableInDays` of type `ProductVariantChannelAvailability` to be optional
+- changed property `availableQuantity` of type `ProductVariantChannelAvailability` to be optional
+- changed property `id` of type `ResourceIdentifier` to be optional
+- changed property `key` of type `ResourceIdentifier` to be optional
+- changed property `returnTrackingId` of type `ReturnInfo` to be optional
+- changed property `returnDate` of type `ReturnInfo` to be optional
+- changed property `comment` of type `ReturnItem` to be optional
+- changed property `suggestTokenizer` of type `SearchKeyword` to be optional
+- changed property `freeAbove` of type `ShippingRate` to be optional
+- changed property `isMatching` of type `ShippingRate` to be optional
+- changed property `externalId` of type `SyncInfo` to be optional
+- changed property `id` of type `TaxRate` to be optional
+- changed property `state` of type `TaxRate` to be optional
+- changed property `subRates` of type `TaxRate` to be optional
+- changed property `custom` of type `TextLineItem` to be optional
+- changed property `description` of type `TextLineItem` to be optional
+- changed property `trackingId` of type `TrackingData` to be optional
+- changed property `carrier` of type `TrackingData` to be optional
+- changed property `provider` of type `TrackingData` to be optional
+- changed property `providerTransaction` of type `TrackingData` to be optional
+- changed property `isReturn` of type `TrackingData` to be optional
+- changed property `timestamp` of type `Transaction` to be optional
+- changed property `interactionId` of type `Transaction` to be optional
- :warning: changed property `triggerPattern` of type `ChangeTargetPatternChangeValue` to be required
Changed Property(s)
+
+- :warning: changed property `nextValue` of type `AddEnumValueChange` from type `EnumValue` to `CustomFieldEnumValue`
+- :warning: changed property `nextValue` of type `AddInterfaceInteractionChange` from type `CustomFieldExpandedValue` to `CustomFields`
+- :warning: changed property `nextValue` of type `AddLocalizedEnumValueChange` from type `AttributeLocalizedEnumValue` to `CustomFieldLocalizedEnumValue`
+- :warning: changed property `previousValue` of type `AddShoppingListLineItemChange` from type `LineItem` to `ShoppingListLineItem`
+- :warning: changed property `nextValue` of type `AddShoppingListLineItemChange` from type `LineItem` to `ShoppingListLineItem`
+- :warning: changed property `w` of type `AssetDimensions` from type `integer` to `number`
+- :warning: changed property `h` of type `AssetDimensions` from type `integer` to `number`
+- :warning: changed property `customer` of type `Associate` from type `Reference` to `CustomerReference`
+- :warning: changed property `associateRole` of type `AssociateRoleAssignment` from type `KeyReference` to `AssociateRoleKeyReference`
+- :warning: changed property `previousValue` of type `ChangeEnumValueOrderChange` from type `EnumValue[]` to `CustomFieldEnumValue[]`
+- :warning: changed property `nextValue` of type `ChangeEnumValueOrderChange` from type `EnumValue[]` to `CustomFieldEnumValue[]`
+- :warning: changed property `previousValue` of type `ChangeInputHintChange` from type `TextInputHint` to `TypeTextInputHint`
+- :warning: changed property `nextValue` of type `ChangeInputHintChange` from type `TextInputHint` to `TypeTextInputHint`
+- :warning: changed property `previousValue` of type `ChangeLocalizedEnumValueOrderChange` from type `LocalizedEnumValue[]` to `AttributeLocalizedEnumValue[]`
+- :warning: changed property `nextValue` of type `ChangeLocalizedEnumValueOrderChange` from type `LocalizedEnumValue[]` to `AttributeLocalizedEnumValue[]`
+- :warning: changed property `previousValue` of type `ChangePlainEnumValueOrderChange` from type `EnumValue[]` to `AttributePlainEnumValue[]`
+- :warning: changed property `nextValue` of type `ChangePlainEnumValueOrderChange` from type `EnumValue[]` to `AttributePlainEnumValue[]`
+- :warning: changed property `type` of type `CustomFields` from type `Reference` to `TypeReference`
+- :warning: changed property `fields` of type `CustomFields` from type `object` to `FieldContainer`
+- :warning: changed property `money` of type `CustomLineItem` from type `Money` to `TypedMoney`
+- :warning: changed property `totalPrice` of type `CustomLineItem` from type `Money` to `CentPrecisionMoney`
+- :warning: changed property `quantity` of type `CustomLineItem` from type `integer` to `number`
+- :warning: changed property `createdAt` of type `Delivery` from type `string` to `datetime`
+- :warning: changed property `quantity` of type `DeliveryItem` from type `integer` to `number`
+- :warning: changed property `discountCode` of type `DiscountCodeInfo` from type `Reference` to `DiscountCodeReference`
+- :warning: changed property `discountedAmount` of type `DiscountedLineItemPortion` from type `Money` to `TypedMoney`
+- :warning: changed property `value` of type `DiscountedLineItemPrice` from type `Money` to `TypedMoney`
+- :warning: changed property `quantity` of type `DiscountedLineItemPriceForQuantity` from type `integer` to `number`
+- :warning: changed property `inputHint` of type `FieldDefinition` from type `TextInputHint` to `TypeTextInputHint`
+- :warning: changed property `w` of type `ImageDimensions` from type `integer` to `number`
+- :warning: changed property `h` of type `ImageDimensions` from type `integer` to `number`
+- :warning: changed property `customer` of type `InheritedAssociate` from type `Reference` to `CustomerReference`
+- :warning: changed property `associateRole` of type `InheritedAssociateRoleAssignment` from type `KeyReference` to `AssociateRoleKeyReference`
+- :warning: changed property `source` of type `InheritedAssociateRoleAssignment` from type `KeyReference` to `BusinessUnitKeyReference`
+- :warning: changed property `quantity` of type `ItemShippingTarget` from type `integer` to `number`
+- :warning: changed property `quantity` of type `ItemState` from type `integer` to `number`
+- :warning: changed property `state` of type `ItemState` from type `Reference` to `StateReference`
+- :warning: changed property `productType` of type `LineItem` from type `Reference` to `ProductTypeReference`
+- :warning: changed property `variant` of type `LineItem` from type `Variant` to `ProductVariant`
+- :warning: changed property `quantity` of type `LineItem` from type `integer` to `number`
+- :warning: changed property `addedAt` of type `LineItem` from type `string` to `datetime`
+- :warning: changed property `centAmount` of type `Money` from type `integer` to `number`
+- :warning: changed property `createdAt` of type `Parcel` from type `string` to `datetime`
+- :warning: changed property `heightInMillimeter` of type `ParcelMeasurements` from type `integer` to `number`
+- :warning: changed property `lengthInMillimeter` of type `ParcelMeasurements` from type `integer` to `number`
+- :warning: changed property `widthInMillimeter` of type `ParcelMeasurements` from type `integer` to `number`
+- :warning: changed property `weightInGram` of type `ParcelMeasurements` from type `integer` to `number`
+- :warning: changed property `payments` of type `PaymentInfo` from type `Reference[]` to `PaymentReference[]`
+- :warning: changed property `value` of type `Price` from type `Money` to `TypedMoney`
+- :warning: changed property `productSelection` of type `ProductSelectionSetting` from type `Reference` to `ProductSelectionReference`
+- :warning: changed property `restockableInDays` of type `ProductVariantAvailability` from type `integer` to `number`
+- :warning: changed property `availableQuantity` of type `ProductVariantAvailability` from type `integer` to `number`
+- :warning: changed property `restockableInDays` of type `ProductVariantChannelAvailability` from type `integer` to `number`
+- :warning: changed property `availableQuantity` of type `ProductVariantChannelAvailability` from type `integer` to `number`
+- :warning: changed property `previousValue` of type `RemoveDeliveryItemsChange` from type `Delivery` to `DeliveryChangeValue`
+- :warning: changed property `previousValue` of type `RemoveEnumValuesChange` from type `EnumValue` to `AttributePlainEnumValue`
+- :warning: changed property `previousValue` of type `RemoveLocalizedEnumValuesChange` from type `LocalizedEnumValue` to `AttributeLocalizedEnumValue`
+- :warning: changed property `previousValue` of type `RemoveShoppingListLineItemChange` from type `LineItem` to `ShoppingListLineItem`
+- :warning: changed property `nextValue` of type `RemoveShoppingListLineItemChange` from type `LineItem` to `ShoppingListLineItem`
+- :warning: changed property `returnDate` of type `ReturnInfo` from type `string` to `datetime`
+- :warning: changed property `quantity` of type `ReturnItem` from type `integer` to `number`
+- :warning: changed property `lastModifiedAt` of type `ReturnItem` from type `string` to `datetime`
+- :warning: changed property `createdAt` of type `ReturnItem` from type `string` to `datetime`
+- :warning: changed property `averageRating` of type `ReviewRatingStatistics` from type `integer` to `number`
+- :warning: changed property `highestRating` of type `ReviewRatingStatistics` from type `integer` to `number`
+- :warning: changed property `lowestRating` of type `ReviewRatingStatistics` from type `integer` to `number`
+- :warning: changed property `previousValue` of type `SetAttributeChange` from type `AttributeValue` to `Attribute`
+- :warning: changed property `nextValue` of type `SetAttributeChange` from type `AttributeValue` to `Attribute`
+- :warning: changed property `previousValue` of type `SetCustomLineItemTaxedPriceChange` from type `Money` to `TaxedItemPrice`
+- :warning: changed property `nextValue` of type `SetCustomLineItemTaxedPriceChange` from type `Money` to `TaxedItemPrice`
+- :warning: changed property `previousValue` of type `SetDiscountedPriceChange` from type `Price` to `DiscountedPrice`
+- :warning: changed property `nextValue` of type `SetDiscountedPriceChange` from type `Price` to `DiscountedPrice`
+- :warning: changed property `previousValue` of type `SetOrderTaxedPriceChange` from type `TaxedItemPrice` to `TaxedPrice`
+- :warning: changed property `nextValue` of type `SetOrderTaxedPriceChange` from type `TaxedItemPrice` to `TaxedPrice`
+- :warning: changed property `previousValue` of type `SetShippingInfoTaxedPriceChange` from type `TaxedPrice` to `TaxedItemPrice`
+- :warning: changed property `nextValue` of type `SetShippingInfoTaxedPriceChange` from type `TaxedPrice` to `TaxedItemPrice`
+- :warning: changed property `previousValue` of type `SetShippingRateChange` from type `Money` to `ShippingRate`
+- :warning: changed property `nextValue` of type `SetShippingRateChange` from type `Money` to `ShippingRate`
+- :warning: changed property `previousValue` of type `SetStoreChange` from type `Reference` to `KeyReference`
+- :warning: changed property `nextValue` of type `SetStoreChange` from type `Reference` to `KeyReference`
+- :warning: changed property `price` of type `ShippingRate` from type `Money` to `CentPrecisionMoney`
+- :warning: changed property `freeAbove` of type `ShippingRate` from type `Money` to `CentPrecisionMoney`
+- :warning: changed property `amount` of type `SubRate` from type `integer` to `number`
+- :warning: changed property `channel` of type `SyncInfo` from type `Reference` to `ChannelReference`
+- :warning: changed property `syncedAt` of type `SyncInfo` from type `string` to `datetime`
+- :warning: changed property `amount` of type `TaxRate` from type `integer` to `number`
+- :warning: changed property `totalNet` of type `TaxedItemPrice` from type `Money` to `CentPrecisionMoney`
+- :warning: changed property `totalGross` of type `TaxedItemPrice` from type `Money` to `CentPrecisionMoney`
+- :warning: changed property `totalNet` of type `TaxedPrice` from type `Money` to `CentPrecisionMoney`
+- :warning: changed property `totalGross` of type `TaxedPrice` from type `Money` to `CentPrecisionMoney`
+- :warning: changed property `addedAt` of type `TextLineItem` from type `string` to `datetime`
+- :warning: changed property `quantity` of type `TextLineItem` from type `integer` to `number`
+- :warning: changed property `timestamp` of type `Transaction` from type `string` to `datetime`
+- :warning: changed property `amount` of type `Transaction` from type `Money` to `CentPrecisionMoney`
+Removed Property(s)
+
+- :warning: removed property `/^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/` from type `CategoryOrderHints`
+- :warning: removed property `variantId` from type `LineItem`
+- :warning: removed property `fractionDigits` from type `Money`
+- :warning: removed property `type` from type `Money`
+- :warning: removed property `//` from type `ProductVariantChannelAvailabilityMap`
+- :warning: removed property `skus` from type `ProductVariantSelection`
+Added Property(s)
+
+- added property `catalogData` to type `AddAssetChange`
+- added property `variant` to type `AddAssetChange`
+- added property `attributeName` to type `AddEnumValueChange`
+- added property `variant` to type `AddExternalImageChange`
+- added property `variant` to type `AddPriceChange`
+- added property `catalogData` to type `AddToCategoryChange`
+- added property `custom` to type `Address`
+- added property `sources` to type `Asset`
+- added property `tags` to type `Asset`
+- added property `roles` to type `Associate`
+- added property `level` to type `AttributeDefinition`
+- added property `/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/` to type `CategoryOrderHints`
+- added property `catalogData` to type `ChangeAssetNameChange`
+- added property `variant` to type `ChangeAssetNameChange`
+- added property `catalogData` to type `ChangeAssetOrderChange`
+- added property `variant` to type `ChangeAssetOrderChange`
+- added property `addedItems` to type `ChangeCartDiscountsChange`
+- added property `removedItems` to type `ChangeCartDiscountsChange`
+- added property `attributeName` to type `ChangeEnumValueLabelChange`
+- added property `attributeName` to type `ChangeEnumValueOrderChange`
+- added property `addedItems` to type `ChangeGroupsChange`
+- added property `removedItems` to type `ChangeGroupsChange`
+- added property `variant` to type `ChangePriceChange`
+- added property `catalogData` to type `ChangeSlugChange`
+- added property `key` to type `CustomLineItem`
+- added property `taxedPricePortions` to type `CustomLineItem`
+- added property `state` to type `CustomLineItem`
+- added property `taxCategory` to type `CustomLineItem`
+- added property `taxRate` to type `CustomLineItem`
+- added property `perMethodTaxRate` to type `CustomLineItem`
+- added property `discountedPricePerQuantity` to type `CustomLineItem`
+- added property `custom` to type `CustomLineItem`
+- added property `shippingDetails` to type `CustomLineItem`
+- added property `priceMode` to type `CustomLineItem`
+- added property `recurrenceInfo` to type `CustomLineItem`
+- added property `key` to type `Delivery`
+- added property `required` to type `FieldDefinition`
+- added property `shippingMethodKey` to type `ItemShippingTarget`
+- added property `key` to type `LineItem`
+- added property `productKey` to type `LineItem`
+- added property `price` to type `LineItem`
+- added property `totalPrice` to type `LineItem`
+- added property `discountedPricePerQuantity` to type `LineItem`
+- added property `taxedPrice` to type `LineItem`
+- added property `taxedPricePortions` to type `LineItem`
+- added property `state` to type `LineItem`
+- added property `taxRate` to type `LineItem`
+- added property `perMethodTaxRate` to type `LineItem`
+- added property `supplyChannel` to type `LineItem`
+- added property `distributionChannel` to type `LineItem`
+- added property `priceMode` to type `LineItem`
+- added property `lineItemMode` to type `LineItem`
+- added property `inventoryMode` to type `LineItem`
+- added property `shippingDetails` to type `LineItem`
+- added property `lastModifiedAt` to type `LineItem`
+- added property `recurrenceInfo` to type `LineItem`
+- added property `variant` to type `MoveImageToPositionChange`
+- added property `key` to type `Parcel`
+- added property `custom` to type `Parcel`
+- added property `key` to type `Price`
+- added property `country` to type `Price`
+- added property `customerGroup` to type `Price`
+- added property `channel` to type `Price`
+- added property `validFrom` to type `Price`
+- added property `validUntil` to type `Price`
+- added property `discounted` to type `Price`
+- added property `tiers` to type `Price`
+- added property `custom` to type `Price`
+- added property `recurrencePolicy` to type `Price`
+- added property `id` to type `ProductVariantAvailability`
+- added property `version` to type `ProductVariantAvailability`
+- added property `id` to type `ProductVariantChannelAvailability`
+- added property `version` to type `ProductVariantChannelAvailability`
+- added property `/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/` to type `ProductVariantChannelAvailabilityMap`
+- added property `catalogData` to type `RemoveAssetChange`
+- added property `variant` to type `RemoveAssetChange`
+- added property `catalogData` to type `RemoveFromCategoryChange`
+- added property `variant` to type `RemoveImageChange`
+- added property `variant` to type `RemovePriceChange`
+- added property `key` to type `ReturnItem`
+- added property `custom` to type `ReturnItem`
+- added property `catalogData` to type `SetAssetCustomFieldChange`
+- added property `variant` to type `SetAssetCustomFieldChange`
+- added property `catalogData` to type `SetAssetCustomTypeChange`
+- added property `variant` to type `SetAssetCustomTypeChange`
+- added property `catalogData` to type `SetAssetDescriptionChange`
+- added property `variant` to type `SetAssetDescriptionChange`
+- added property `catalogData` to type `SetAssetKeyChange`
+- added property `variant` to type `SetAssetKeyChange`
+- added property `catalogData` to type `SetAssetSourcesChange`
+- added property `variant` to type `SetAssetSourcesChange`
+- added property `catalogData` to type `SetAssetTagsChange`
+- added property `variant` to type `SetAssetTagsChange`
+- added property `variant` to type `SetAttributeChange`
+- added property `addedItems` to type `SetChannelRolesChange`
+- added property `removedItems` to type `SetChannelRolesChange`
+- added property `addedItems` to type `SetCountriesChange`
+- added property `removedItems` to type `SetCountriesChange`
+- added property `customTypeId` to type `SetCustomLineItemCustomFieldChange`
+- added property `customLineItem` to type `SetCustomLineItemShippingDetailsChange`
+- added property `price` to type `SetDiscountedPriceChange`
+- added property `addedItems` to type `SetDistributionChannelsChange`
+- added property `removedItems` to type `SetDistributionChannelsChange`
+- added property `variant` to type `SetImageLabelChange`
+- added property `addedItems` to type `SetLanguagesChange`
+- added property `removedItems` to type `SetLanguagesChange`
+- added property `lineItemId` to type `SetLineItemDiscountedPriceChange`
+- added property `lineItemId` to type `SetLineItemDiscountedPricePerQuantityChange`
+- added property `lineItemId` to type `SetLineItemPriceChange`
+- added property `lineItemId` to type `SetLineItemProductSlugChange`
+- added property `lineItem` to type `SetLineItemShippingDetailsChange`
+- added property `variant` to type `SetLineItemShippingDetailsChange`
+- added property `lineItemId` to type `SetLineItemTaxAmountChange`
+- added property `lineItemId` to type `SetLineItemTaxRateChange`
+- added property `variant` to type `SetLineItemTaxedPriceChange`
+- added property `lineItemId` to type `SetLineItemTotalPriceChange`
+- added property `variant` to type `SetLineItemTotalPriceChange`
+- added property `catalogData` to type `SetMetaDescriptionChange`
+- added property `catalogData` to type `SetMetaKeywordsChange`
+- added property `catalogData` to type `SetMetaTitleChange`
+- added property `lineItemId` to type `SetOrderLineItemCustomFieldChange`
+- added property `lineItemId` to type `SetOrderLineItemCustomTypeChange`
+- added property `addedItems` to type `SetPermissionsChange`
+- added property `removedItems` to type `SetPermissionsChange`
+- added property `addedItems` to type `SetPricesChange`
+- added property `removedItems` to type `SetPricesChange`
+- added property `variant` to type `SetProductPriceCustomFieldChange`
+- added property `priceId` to type `SetProductPriceCustomFieldChange`
+- added property `customTypeId` to type `SetProductPriceCustomFieldChange`
+- added property `name` to type `SetProductPriceCustomFieldChange`
+- added property `variant` to type `SetProductPriceCustomTypeChange`
+- added property `priceId` to type `SetProductPriceCustomTypeChange`
+- added property `addedItems` to type `SetProductSelectionsChange`
+- added property `removedItems` to type `SetProductSelectionsChange`
+- added property `variant` to type `SetProductVariantKeyChange`
+- added property `addedItems` to type `SetReservationsChange`
+- added property `removedItems` to type `SetReservationsChange`
+- added property `variant` to type `SetSkuChange`
+- added property `addedItems` to type `SetStateRolesChange`
+- added property `removedItems` to type `SetStateRolesChange`
+- added property `addedItems` to type `SetStoresChange`
+- added property `removedItems` to type `SetStoresChange`
+- added property `addedItems` to type `SetSupplyChannelsChange`
+- added property `removedItems` to type `SetSupplyChannelsChange`
+- added property `addedItems` to type `SetTransitionsChange`
+- added property `removedItems` to type `SetTransitionsChange`
+- added property `key` to type `TaxRate`
+- added property `taxPortions` to type `TaxedItemPrice`
+- added property `totalTax` to type `TaxedItemPrice`
+- added property `taxPortions` to type `TaxedPrice`
+- added property `totalTax` to type `TaxedPrice`
+- added property `key` to type `TextLineItem`
+- added property `custom` to type `Transaction`
+- added property `customLineItemId` to type `TransitionCustomLineItemStateChange`
+Added Type(s)
+- added type `AllowedOrigins`
+- added type `Application`
+- added type `ApplicationAgreement`
+- added type `ApplicationAgreementDraft`
+- added type `ApplicationAgreementStatus`
+- added type `ApplicationAgreementType`
+- added type `ApplicationDraft`
+- added type `ApplicationLogo`
+- added type `ApplicationMode`
+- added type `ApplicationStatus`
+- added type `ApplicationUpdateAction`
+- added type `ApplicationUpdateActions`
+- added type `DiscountsConfiguration`
+- added type `PaginatedApplication`
+- added type `PaymentsConfiguration`
+- added type `AddAllowedOriginUpdateAction`
+- added type `AddApplicationAgreementUpdateAction`
+- added type `AddCountryUpdateAction`
+- added type `RemoveAllowedOriginUpdateAction`
+- added type `RemoveApplicationAgreementUpdateAction`
+- added type `RemoveCountryUpdateAction`
+- added type `ReorderApplicationAgreementUpdateAction`
+- added type `SetActivePaymentComponentTypeUpdateAction`
+- added type `SetAllowAllOriginsUpdateAction`
+- added type `SetAllowedOriginsUpdateAction`
+- added type `SetApplicationAgreementNameUpdateAction`
+- added type `SetApplicationAgreementStatusUpdateAction`
+- added type `SetApplicationAgreementTextUpdateAction`
+- added type `SetApplicationAgreementTypeUpdateAction`
+- added type `SetApplicationAgreementsUpdateAction`
+- added type `SetApplicationLogoUpdateAction`
+- added type `SetApplicationNameUpdateAction`
+- added type `SetApplicationStatusUpdateAction`
+- added type `SetCountriesUpdateAction`
+- added type `SetDescriptionUpdateAction`
+- added type `SetDiscountsConfigurationUpdateAction`
+- added type `SetPaymentReturnUrlUpdateAction`
+- added type `SetPaymentsConfigurationUpdateAction`
+- added type `CreatedBy`
+- added type `LastModifiedBy`
+- added type `LocalizedString`
+- added type `LocalizedUrl`
+- added type `ConcurrentModificationError`
+- added type `DuplicateFieldWithConflictingResourceError`
+- added type `ErrorResponse`
+- added type `InvalidFieldError`
+- added type `InvalidOperationError`
+- added type `MaxResourceLimitExceededError`
+- added type `MissingProjectKeyError`
+- added type `ReferencedResourceNotFoundError`
+- added type `ServiceUnavailableError`
+- added type `SyntaxErrorError`
+- added type `AutomatedReversalConfiguration`
+- added type `ConnectorDeploymentReference`
+- added type `DisplayInfo`
+- added type `PaginatedPaymentIntegration`
+- added type `PaymentComponentType`
+- added type `PaymentIntegration`
+- added type `PaymentIntegrationDraft`
+- added type `PaymentIntegrationStatus`
+- added type `PaymentIntegrationType`
+- added type `SortingInfo`
+- added type `PaymentIntegrationUpdateAction`
+- added type `PaymentIntegrationUpdateActions`
+- added type `SetAutomatedReversalConfigurationPredicateUpdateAction`
+- added type `SetAutomatedReversalConfigurationStatusUpdateAction`
+- added type `SetAutomatedReversalConfigurationUpdateAction`
+- added type `SetConnectorDeploymentUpdateAction`
+- added type `SetDisplayInfoDescriptionUpdateAction`
+- added type `SetDisplayInfoLabelUpdateAction`
+- added type `SetDisplayInfoLogoUrlUpdateAction`
+- added type `SetDisplayInfoPayButtonTextUpdateAction`
+- added type `SetDisplayInfoUpdateAction`
+- added type `SetKeyUpdateAction`
+- added type `SetNameUpdateAction`
+- added type `SetPredicateUpdateAction`
+- added type `SetSortingInfoUpdateAction`
+- added type `SetStatusUpdateAction`
+- added type `SetTypeUpdateAction`
- added type `PaymentIntentReverseAction`
- added type `ConnectorError`
- added type `ErrorLoadingAllPaymentIntegrations`
@@ -794,23 +1429,26 @@
Added Enum(s)
+- added enum `deployment` to type `ReferenceTypeId`
- added enum `reversePayment` to type `PaymentIntentOperation`
Changed Property(s)
+Required Property(s)
-- :warning: changed property `action` of type `PaymentIntentCancelAction` from type `string` to `PaymentIntentOperation`
-- :warning: changed property `action` of type `PaymentIntentCaptureAction` from type `string` to `PaymentIntentOperation`
-- :warning: changed property `action` of type `PaymentIntentRefundAction` from type `string` to `PaymentIntentOperation`
+- changed property `detailedErrorMessage` of type `InvalidJsonInputError` to be optional
+- :warning: changed property `amount` of type `PaymentIntentRefundAction` to be required
Required Property(s)
+Changed Property(s)
-- :warning: changed property `amount` of type `PaymentIntentRefundAction` to be required
+- :warning: changed property `action` of type `PaymentIntentCancelAction` from type `string` to `PaymentIntentOperation`
+- :warning: changed property `action` of type `PaymentIntentCaptureAction` from type `string` to `PaymentIntentOperation`
+- :warning: changed property `action` of type `PaymentIntentRefundAction` from type `string` to `PaymentIntentOperation`
+- :warning: changed property `application` of type `Transaction` from type `ApplicationResourceIdentifier` to `ApplicationReference`
Added Property(s)
+- added property `resourceIdentifier` to type `ResourceNotFoundError`
+- added property `resourceId` to type `ResourceNotFoundError`
- added property `merchantReference` to type `PaymentIntentCancelAction`
- added property `merchantReference` to type `PaymentIntentCaptureAction`
- added property `transactionId` to type `PaymentIntentRefundAction`
@@ -834,3 +1474,51 @@
- added property `payload` to type `PaymentValidationFailed`
Changed MethodResponseBody(s)
+
+- :warning: changed response body for `400: application/json` of method `post /{projectKey}/transactions` from type `null` to `ErrorResponse`
+- :warning: changed response body for `400: application/json` of method `post /{projectKey}/payment-intents/{paymentId}` from type `null` to `ErrorResponse`
+- :warning: changed response body for `400: application/json` of method `get /{projectKey}/transactions/{id}` from type `null` to `ErrorResponse`
+- :warning: changed response body for `400: application/json` of method `get /{projectKey}/transactions/key={key}` from type `null` to `ErrorResponse`
+Added Method(s)
+
+- added method `$apiRoot->withProjectKey()->paymentIntegrations()->get()`
+- added method `$apiRoot->withProjectKey()->paymentIntegrations()->post()`
+- added method `$apiRoot->withProjectKey()->applications()->get()`
+- added method `$apiRoot->withProjectKey()->applications()->post()`
+- added method `$apiRoot->withProjectKey()->paymentIntegrations()->withId()->get()`
+- added method `$apiRoot->withProjectKey()->paymentIntegrations()->withId()->head()`
+- added method `$apiRoot->withProjectKey()->paymentIntegrations()->withId()->post()`
+- added method `$apiRoot->withProjectKey()->paymentIntegrations()->withId()->delete()`
+- added method `$apiRoot->withProjectKey()->paymentIntegrations()->withKey()->get()`
+- added method `$apiRoot->withProjectKey()->paymentIntegrations()->withKey()->post()`
+- added method `$apiRoot->withProjectKey()->paymentIntegrations()->withKey()->head()`
+- added method `$apiRoot->withProjectKey()->paymentIntegrations()->withKey()->delete()`
+- added method `$apiRoot->withProjectKey()->applications()->withId()->get()`
+- added method `$apiRoot->withProjectKey()->applications()->withId()->head()`
+- added method `$apiRoot->withProjectKey()->applications()->withId()->post()`
+- added method `$apiRoot->withProjectKey()->applications()->withId()->delete()`
+- added method `$apiRoot->withProjectKey()->applications()->withKey()->get()`
+- added method `$apiRoot->withProjectKey()->applications()->withKey()->post()`
+- added method `$apiRoot->withProjectKey()->applications()->withKey()->head()`
+- added method `$apiRoot->withProjectKey()->applications()->withKey()->delete()`
+Added Resource(s)
+
+- added resource `/{projectKey}/payment-integrations`
+- added resource `/{projectKey}/applications`
+- added resource `/{projectKey}/payment-integrations/{id}`
+- added resource `/{projectKey}/payment-integrations/key={key}`
+- added resource `/{projectKey}/applications/{id}`
+- added resource `/{projectKey}/applications/key={key}`
+quantity.
- * If absent, the LineItem is removed from the Cart.quantity.
- * If absent, the LineItem is removed from the Cart.quantity.
- * If absent, the LineItem is removed from the Cart.anonymousId is not provided.
Determines how to merge the anonymous Cart with the existing Customer Cart.
+ * + + * @return null|string + */ + public function getMergeMode(); + + /** + *true, the LineItem Product data (name, variant, and productType) of the returned Cart will be updated.false, only the prices, discounts, and tax rates will be updated.Assigns the Customer to the Carts that have the same anonymousId. Required if anonymousCart is not provided.
+ * If both anonymousCart and anonymousId are provided, this value must match the anonymousId of the anonymous Cart otherwise, an InvalidOperation error is returned.
ResourceIdentifier to the anonymous Cart to be merged. Required if anonymousId is not provided.
Determines how to merge the anonymous Cart with the existing Customer Cart.
+ * + + * @return null|string + */ + public function getMergeMode() + { + return $this->mergeMode; + } + + /** + *true, the LineItem Product data (name, variant, and productType) of the returned Cart will be updated.false, only the prices, discounts, and tax rates will be updated.Assigns the Customer to the Carts that have the same anonymousId. Required if anonymousCart is not provided.
+ * If both anonymousCart and anonymousId are provided, this value must match the anonymousId of the anonymous Cart otherwise, an InvalidOperation error is returned.
ResourceIdentifier to the anonymous Cart to be merged. Required if anonymousId is not provided.
Determines how to merge the anonymous Cart with the existing Customer Cart.
+ * + * + * @return null|string + */ + public function getMergeMode() + { + if (is_null($this->mergeMode)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_MERGE_MODE); + if (is_null($data)) { + return null; + } + $this->mergeMode = (string) $data; + } + + return $this->mergeMode; + } + + /** + *true, the LineItem Product data (name, variant, and productType) of the returned Cart will be updated.false, only the prices, discounts, and tax rates will be updated.Assigns the Customer to the Carts that have the same anonymousId. Required if anonymousCart is not provided.
+ * If both anonymousCart and anonymousId are provided, this value must match the anonymousId of the anonymous Cart otherwise, an InvalidOperation error is returned.
References of all resources that are addressed in the predicate. - * The API generates this array from the predicate.
+ *References to all resources addressed in the cartPredicate by their IDs.
+ * This value is generated by the platform.
References of all resources that are addressed in the predicate. - * The API generates this array from the predicate.
+ *References to all resources addressed in the cartPredicate by their IDs.
+ * This value is generated by the platform.
References of all resources that are addressed in the predicate. - * The API generates this array from the predicate.
+ *References to all resources addressed in the cartPredicate by their IDs.
+ * This value is generated by the platform.
Is set if a ProductDiscount has been applied.
* If set, the API uses the DiscountedPrice value for the Line Item price selection.
- * When a relative discount has been applied and the fraction part of the DiscountedPrice value is 0.5, the value is rounded in favor of the customer with half-down rounding.
value is 0.5, the value is rounded in favor of the customer with half-down rounding.
* If an absolute discount value exceeds the price of the Product Variant, the discounted price is a negative value.
* diff --git a/lib/commercetools-api/src/Models/Common/PriceBuilder.php b/lib/commercetools-api/src/Models/Common/PriceBuilder.php index f071f23ba73..d2da28e3825 100644 --- a/lib/commercetools-api/src/Models/Common/PriceBuilder.php +++ b/lib/commercetools-api/src/Models/Common/PriceBuilder.php @@ -192,7 +192,7 @@ public function getValidUntil() /** *Is set if a ProductDiscount has been applied.
* If set, the API uses the DiscountedPrice value for the Line Item price selection.
- * When a relative discount has been applied and the fraction part of the DiscountedPrice value is 0.5, the value is rounded in favor of the customer with half-down rounding.
value is 0.5, the value is rounded in favor of the customer with half-down rounding.
* If an absolute discount value exceeds the price of the Product Variant, the discounted price is a negative value.
* diff --git a/lib/commercetools-api/src/Models/Common/PriceModel.php b/lib/commercetools-api/src/Models/Common/PriceModel.php index f4de6f9f169..367c53e845e 100644 --- a/lib/commercetools-api/src/Models/Common/PriceModel.php +++ b/lib/commercetools-api/src/Models/Common/PriceModel.php @@ -306,7 +306,7 @@ public function getValidUntil() /** *Is set if a ProductDiscount has been applied.
* If set, the API uses the DiscountedPrice value for the Line Item price selection.
- * When a relative discount has been applied and the fraction part of the DiscountedPrice value is 0.5, the value is rounded in favor of the customer with half-down rounding.
value is 0.5, the value is rounded in favor of the customer with half-down rounding.
* If an absolute discount value exceeds the price of the Product Variant, the discounted price is a negative value.
* * diff --git a/lib/commercetools-api/src/Models/Common/ScopedPrice.php b/lib/commercetools-api/src/Models/Common/ScopedPrice.php index 0352edf2714..4b3f3df157b 100644 --- a/lib/commercetools-api/src/Models/Common/ScopedPrice.php +++ b/lib/commercetools-api/src/Models/Common/ScopedPrice.php @@ -94,7 +94,7 @@ public function getValidUntil(); /** *Is set when a matching ProductDiscount exists. If set, the Cart uses the discounted value for the Cart Price calculation.
- *When a relative Product Discount is applied and the fractional part of the discounted Price is 0.5, the discounted Price is rounded half down in favor of the Customer.
+ *When a relative Product Discount is applied and the fractional part of the discounted Price is 0.5, the discounted Price is rounded half down in favor of the Customer.
* * @return null|DiscountedPrice diff --git a/lib/commercetools-api/src/Models/Common/ScopedPriceBuilder.php b/lib/commercetools-api/src/Models/Common/ScopedPriceBuilder.php index d7b78a10b44..83ee84227ba 100644 --- a/lib/commercetools-api/src/Models/Common/ScopedPriceBuilder.php +++ b/lib/commercetools-api/src/Models/Common/ScopedPriceBuilder.php @@ -177,7 +177,7 @@ public function getValidUntil() /** *Is set when a matching ProductDiscount exists. If set, the Cart uses the discounted value for the Cart Price calculation.
- *When a relative Product Discount is applied and the fractional part of the discounted Price is 0.5, the discounted Price is rounded half down in favor of the Customer.
+ *When a relative Product Discount is applied and the fractional part of the discounted Price is 0.5, the discounted Price is rounded half down in favor of the Customer.
* * @return null|DiscountedPrice diff --git a/lib/commercetools-api/src/Models/Common/ScopedPriceModel.php b/lib/commercetools-api/src/Models/Common/ScopedPriceModel.php index c4602e4b6c6..f36001a629e 100644 --- a/lib/commercetools-api/src/Models/Common/ScopedPriceModel.php +++ b/lib/commercetools-api/src/Models/Common/ScopedPriceModel.php @@ -288,7 +288,7 @@ public function getValidUntil() /** *Is set when a matching ProductDiscount exists. If set, the Cart uses the discounted value for the Cart Price calculation.
- *When a relative Product Discount is applied and the fractional part of the discounted Price is 0.5, the discounted Price is rounded half down in favor of the Customer.
+ *When a relative Product Discount is applied and the fractional part of the discounted Price is 0.5, the discounted Price is rounded half down in favor of the Customer.
* * * @return null|DiscountedPrice diff --git a/lib/commercetools-api/src/Models/DiscountCode/DiscountCode.php b/lib/commercetools-api/src/Models/DiscountCode/DiscountCode.php index bc805d40159..1eb3bb2b5ca 100644 --- a/lib/commercetools-api/src/Models/DiscountCode/DiscountCode.php +++ b/lib/commercetools-api/src/Models/DiscountCode/DiscountCode.php @@ -144,8 +144,8 @@ public function getCartPredicate(); public function getIsActive(); /** - *Array generated from the Cart predicate. - * It contains the references of all the resources that are addressed in the predicate.
+ *References to all resources addressed in the cartPredicate by their IDs.
+ * This value is generated by the platform.
Array generated from the Cart predicate. - * It contains the references of all the resources that are addressed in the predicate.
+ *References to all resources addressed in the cartPredicate by their IDs.
+ * This value is generated by the platform.
Array generated from the Cart predicate. - * It contains the references of all the resources that are addressed in the predicate.
+ *References to all resources addressed in the cartPredicate by their IDs.
+ * This value is generated by the platform.
Details about the error's cause and the entities involved.
+ * + + * @return null|mixed + */ + public function getDetails() + { + return $this->details; + } + + /** + * @param mixed $details + * @return $this + */ + public function withDetails($details) + { + $this->details = $details; + + return $this; + } + + + public function build(): GraphQLRecurringOrderFailureError + { + return new GraphQLRecurringOrderFailureErrorModel( + $this->details + ); + } + + public static function of(): GraphQLRecurringOrderFailureErrorBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/Error/GraphQLRecurringOrderFailureErrorCollection.php b/lib/commercetools-api/src/Models/Error/GraphQLRecurringOrderFailureErrorCollection.php new file mode 100644 index 00000000000..8a6de74e3ab --- /dev/null +++ b/lib/commercetools-api/src/Models/Error/GraphQLRecurringOrderFailureErrorCollection.php @@ -0,0 +1,56 @@ + + * @method GraphQLRecurringOrderFailureError current() + * @method GraphQLRecurringOrderFailureError end() + * @method GraphQLRecurringOrderFailureError at($offset) + */ +class GraphQLRecurringOrderFailureErrorCollection extends GraphQLErrorObjectCollection +{ + /** + * @psalm-assert GraphQLRecurringOrderFailureError $value + * @psalm-param GraphQLRecurringOrderFailureError|stdClass $value + * @throws InvalidArgumentException + * + * @return GraphQLRecurringOrderFailureErrorCollection + */ + public function add($value) + { + if (!$value instanceof GraphQLRecurringOrderFailureError) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?GraphQLRecurringOrderFailureError + */ + protected function mapper() + { + return function (?int $index): ?GraphQLRecurringOrderFailureError { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var GraphQLRecurringOrderFailureError $data */ + $data = GraphQLRecurringOrderFailureErrorModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/Error/GraphQLRecurringOrderFailureErrorModel.php b/lib/commercetools-api/src/Models/Error/GraphQLRecurringOrderFailureErrorModel.php new file mode 100644 index 00000000000..babfdca03be --- /dev/null +++ b/lib/commercetools-api/src/Models/Error/GraphQLRecurringOrderFailureErrorModel.php @@ -0,0 +1,106 @@ +details = $details; + $this->code = $code ?? self::DISCRIMINATOR_VALUE; + } + + /** + * + * @return null|string + */ + public function getCode() + { + if (is_null($this->code)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CODE); + if (is_null($data)) { + return null; + } + $this->code = (string) $data; + } + + return $this->code; + } + + /** + *Details about the error's cause and the entities involved.
+ * + * + * @return null|mixed + */ + public function getDetails() + { + if (is_null($this->details)) { + /** @psalm-var mixed $data */ + $data = $this->raw(self::FIELD_DETAILS); + if (is_null($data)) { + return null; + } + $this->details = $data; + } + + return $this->details; + } + + + /** + * @param mixed $details + */ + public function setDetails($details): void + { + $this->details = $details; + } + + /** + * @return mixed + */ + public function by(string $key) + { + $data = $this->raw($key); + if (is_null($data)) { + return null; + } + + return $data; + } +} diff --git a/lib/commercetools-api/src/Models/Error/RecurringOrderFailureError.php b/lib/commercetools-api/src/Models/Error/RecurringOrderFailureError.php new file mode 100644 index 00000000000..268b91dec35 --- /dev/null +++ b/lib/commercetools-api/src/Models/Error/RecurringOrderFailureError.php @@ -0,0 +1,49 @@ +Plain text description of the error. + * + + * @return null|string + */ + public function getMessage(); + + /** + *Details about the error's cause and the entities involved.
+ * + + * @return null|mixed + */ + public function getDetails(); + + /** + * @param ?string $message + */ + public function setMessage(?string $message): void; + + /** + * @param mixed $details + */ + public function setDetails($details): void; +} diff --git a/lib/commercetools-api/src/Models/Error/RecurringOrderFailureErrorBuilder.php b/lib/commercetools-api/src/Models/Error/RecurringOrderFailureErrorBuilder.php new file mode 100644 index 00000000000..2844a0148ae --- /dev/null +++ b/lib/commercetools-api/src/Models/Error/RecurringOrderFailureErrorBuilder.php @@ -0,0 +1,92 @@ + + */ +final class RecurringOrderFailureErrorBuilder implements Builder +{ + /** + + * @var ?string + */ + private $message; + + /** + + * @var null|mixed|mixed + */ + private $details; + + /** + *Plain text description of the error.
+ * + + * @return null|string + */ + public function getMessage() + { + return $this->message; + } + + /** + *Details about the error's cause and the entities involved.
+ * + + * @return null|mixed + */ + public function getDetails() + { + return $this->details; + } + + /** + * @param ?string $message + * @return $this + */ + public function withMessage(?string $message) + { + $this->message = $message; + + return $this; + } + + /** + * @param mixed $details + * @return $this + */ + public function withDetails($details) + { + $this->details = $details; + + return $this; + } + + + public function build(): RecurringOrderFailureError + { + return new RecurringOrderFailureErrorModel( + $this->message, + $this->details + ); + } + + public static function of(): RecurringOrderFailureErrorBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/Error/RecurringOrderFailureErrorCollection.php b/lib/commercetools-api/src/Models/Error/RecurringOrderFailureErrorCollection.php new file mode 100644 index 00000000000..0272041f839 --- /dev/null +++ b/lib/commercetools-api/src/Models/Error/RecurringOrderFailureErrorCollection.php @@ -0,0 +1,56 @@ + + * @method RecurringOrderFailureError current() + * @method RecurringOrderFailureError end() + * @method RecurringOrderFailureError at($offset) + */ +class RecurringOrderFailureErrorCollection extends ErrorObjectCollection +{ + /** + * @psalm-assert RecurringOrderFailureError $value + * @psalm-param RecurringOrderFailureError|stdClass $value + * @throws InvalidArgumentException + * + * @return RecurringOrderFailureErrorCollection + */ + public function add($value) + { + if (!$value instanceof RecurringOrderFailureError) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?RecurringOrderFailureError + */ + protected function mapper() + { + return function (?int $index): ?RecurringOrderFailureError { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var RecurringOrderFailureError $data */ + $data = RecurringOrderFailureErrorModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/Error/RecurringOrderFailureErrorModel.php b/lib/commercetools-api/src/Models/Error/RecurringOrderFailureErrorModel.php new file mode 100644 index 00000000000..e13a4064e25 --- /dev/null +++ b/lib/commercetools-api/src/Models/Error/RecurringOrderFailureErrorModel.php @@ -0,0 +1,142 @@ +message = $message; + $this->details = $details; + $this->code = $code ?? self::DISCRIMINATOR_VALUE; + } + + /** + * + * @return null|string + */ + public function getCode() + { + if (is_null($this->code)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CODE); + if (is_null($data)) { + return null; + } + $this->code = (string) $data; + } + + return $this->code; + } + + /** + *Plain text description of the error.
+ * + * + * @return null|string + */ + public function getMessage() + { + if (is_null($this->message)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_MESSAGE); + if (is_null($data)) { + return null; + } + $this->message = (string) $data; + } + + return $this->message; + } + + /** + *Details about the error's cause and the entities involved.
+ * + * + * @return null|mixed + */ + public function getDetails() + { + if (is_null($this->details)) { + /** @psalm-var mixed $data */ + $data = $this->raw(self::FIELD_DETAILS); + if (is_null($data)) { + return null; + } + $this->details = $data; + } + + return $this->details; + } + + + /** + * @param ?string $message + */ + public function setMessage(?string $message): void + { + $this->message = $message; + } + + /** + * @param mixed $details + */ + public function setDetails($details): void + { + $this->details = $details; + } + + /** + * @return mixed + */ + public function by(string $key) + { + $data = $this->raw($key); + if (is_null($data)) { + return null; + } + + return $data; + } +} diff --git a/lib/commercetools-api/src/Models/Me/MyCartRemoveLineItemAction.php b/lib/commercetools-api/src/Models/Me/MyCartRemoveLineItemAction.php index f0cf71230ea..83fc75662e6 100644 --- a/lib/commercetools-api/src/Models/Me/MyCartRemoveLineItemAction.php +++ b/lib/commercetools-api/src/Models/Me/MyCartRemoveLineItemAction.php @@ -40,8 +40,8 @@ public function getLineItemId(); public function getLineItemKey(); /** - *Amount to subtract from the LineItem's quantity.
- * If absent, the LineItem is removed from the Cart.
Amount to subtract from the LineItem quantity. + * If omitted, the LineItem is removed from the Cart.
* * @return null|int diff --git a/lib/commercetools-api/src/Models/Me/MyCartRemoveLineItemActionBuilder.php b/lib/commercetools-api/src/Models/Me/MyCartRemoveLineItemActionBuilder.php index 00a15a291bb..54855707e6a 100644 --- a/lib/commercetools-api/src/Models/Me/MyCartRemoveLineItemActionBuilder.php +++ b/lib/commercetools-api/src/Models/Me/MyCartRemoveLineItemActionBuilder.php @@ -85,8 +85,8 @@ public function getLineItemKey() } /** - *Amount to subtract from the LineItem's quantity.
- * If absent, the LineItem is removed from the Cart.
Amount to subtract from the LineItem quantity. + * If omitted, the LineItem is removed from the Cart.
* * @return null|int diff --git a/lib/commercetools-api/src/Models/Me/MyCartRemoveLineItemActionModel.php b/lib/commercetools-api/src/Models/Me/MyCartRemoveLineItemActionModel.php index a180ea76aa0..83766758d5d 100644 --- a/lib/commercetools-api/src/Models/Me/MyCartRemoveLineItemActionModel.php +++ b/lib/commercetools-api/src/Models/Me/MyCartRemoveLineItemActionModel.php @@ -149,8 +149,8 @@ public function getLineItemKey() } /** - *Amount to subtract from the LineItem's quantity.
- * If absent, the LineItem is removed from the Cart.
Amount to subtract from the LineItem quantity. + * If omitted, the LineItem is removed from the Cart.
* * * @return null|int diff --git a/lib/commercetools-api/src/Models/Message/CartFrozenMessage.php b/lib/commercetools-api/src/Models/Message/CartFrozenMessage.php new file mode 100644 index 00000000000..39eeb551804 --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/CartFrozenMessage.php @@ -0,0 +1,16 @@ + + */ +final class CartFrozenMessageBuilder 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; + + /** + *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.
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.
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.
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.
SKU of the InventoryEntry for which the quantity was updated.
+ * + + * @return null|string + */ + public function getSku(); + /** *Reference to the Channel where the InventoryEntry quantity was set.
* @@ -80,6 +89,11 @@ public function setOldAvailableQuantity(?int $oldAvailableQuantity): void; */ public function setNewAvailableQuantity(?int $newAvailableQuantity): void; + /** + * @param ?string $sku + */ + public function setSku(?string $sku): void; + /** * @param ?ChannelReference $supplyChannel */ diff --git a/lib/commercetools-api/src/Models/Message/InventoryEntryQuantitySetMessageBuilder.php b/lib/commercetools-api/src/Models/Message/InventoryEntryQuantitySetMessageBuilder.php index 8754530bf48..12550178bd7 100644 --- a/lib/commercetools-api/src/Models/Message/InventoryEntryQuantitySetMessageBuilder.php +++ b/lib/commercetools-api/src/Models/Message/InventoryEntryQuantitySetMessageBuilder.php @@ -113,6 +113,12 @@ final class InventoryEntryQuantitySetMessageBuilder implements Builder */ private $newAvailableQuantity; + /** + + * @var ?string + */ + private $sku; + /** * @var null|ChannelReference|ChannelReferenceBuilder @@ -274,6 +280,17 @@ public function getNewAvailableQuantity() return $this->newAvailableQuantity; } + /** + *SKU of the InventoryEntry for which the quantity was updated.
+ * + + * @return null|string + */ + public function getSku() + { + return $this->sku; + } + /** *Reference to the Channel where the InventoryEntry quantity was set.
* @@ -439,6 +456,17 @@ public function withNewAvailableQuantity(?int $newAvailableQuantity) return $this; } + /** + * @param ?string $sku + * @return $this + */ + public function withSku(?string $sku) + { + $this->sku = $sku; + + return $this; + } + /** * @param ?ChannelReference $supplyChannel * @return $this @@ -522,6 +550,7 @@ public function build(): InventoryEntryQuantitySetMessage $this->newQuantityOnStock, $this->oldAvailableQuantity, $this->newAvailableQuantity, + $this->sku, $this->supplyChannel instanceof ChannelReferenceBuilder ? $this->supplyChannel->build() : $this->supplyChannel ); } diff --git a/lib/commercetools-api/src/Models/Message/InventoryEntryQuantitySetMessageModel.php b/lib/commercetools-api/src/Models/Message/InventoryEntryQuantitySetMessageModel.php index 972a718b8f3..81b65e8e84b 100644 --- a/lib/commercetools-api/src/Models/Message/InventoryEntryQuantitySetMessageModel.php +++ b/lib/commercetools-api/src/Models/Message/InventoryEntryQuantitySetMessageModel.php @@ -119,6 +119,12 @@ final class InventoryEntryQuantitySetMessageModel extends JsonObjectModel implem */ protected $newAvailableQuantity; + /** + * + * @var ?string + */ + protected $sku; + /** * * @var ?ChannelReference @@ -144,6 +150,7 @@ public function __construct( ?int $newQuantityOnStock = null, ?int $oldAvailableQuantity = null, ?int $newAvailableQuantity = null, + ?string $sku = null, ?ChannelReference $supplyChannel = null, ?string $type = null ) { @@ -161,6 +168,7 @@ public function __construct( $this->newQuantityOnStock = $newQuantityOnStock; $this->oldAvailableQuantity = $oldAvailableQuantity; $this->newAvailableQuantity = $newAvailableQuantity; + $this->sku = $sku; $this->supplyChannel = $supplyChannel; $this->type = $type ?? self::DISCRIMINATOR_VALUE; } @@ -478,6 +486,26 @@ public function getNewAvailableQuantity() return $this->newAvailableQuantity; } + /** + *SKU of the InventoryEntry for which the quantity was updated.
+ * + * + * @return null|string + */ + public function getSku() + { + if (is_null($this->sku)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_SKU); + if (is_null($data)) { + return null; + } + $this->sku = (string) $data; + } + + return $this->sku; + } + /** *Reference to the Channel where the InventoryEntry quantity was set.
* @@ -612,6 +640,14 @@ public function setNewAvailableQuantity(?int $newAvailableQuantity): void $this->newAvailableQuantity = $newAvailableQuantity; } + /** + * @param ?string $sku + */ + public function setSku(?string $sku): void + { + $this->sku = $sku; + } + /** * @param ?ChannelReference $supplyChannel */ diff --git a/lib/commercetools-api/src/Models/Message/InventoryEntryQuantitySetMessagePayload.php b/lib/commercetools-api/src/Models/Message/InventoryEntryQuantitySetMessagePayload.php index 9c5569ea6cf..a160b56847d 100644 --- a/lib/commercetools-api/src/Models/Message/InventoryEntryQuantitySetMessagePayload.php +++ b/lib/commercetools-api/src/Models/Message/InventoryEntryQuantitySetMessagePayload.php @@ -18,6 +18,7 @@ interface InventoryEntryQuantitySetMessagePayload extends MessagePayload public const FIELD_NEW_QUANTITY_ON_STOCK = 'newQuantityOnStock'; public const FIELD_OLD_AVAILABLE_QUANTITY = 'oldAvailableQuantity'; public const FIELD_NEW_AVAILABLE_QUANTITY = 'newAvailableQuantity'; + public const FIELD_SKU = 'sku'; public const FIELD_SUPPLY_CHANNEL = 'supplyChannel'; /** @@ -52,6 +53,14 @@ public function getOldAvailableQuantity(); */ public function getNewAvailableQuantity(); + /** + *SKU of the InventoryEntry for which the quantity was updated.
+ * + + * @return null|string + */ + public function getSku(); + /** *Reference to the Channel where the InventoryEntry quantity was set.
* @@ -80,6 +89,11 @@ public function setOldAvailableQuantity(?int $oldAvailableQuantity): void; */ public function setNewAvailableQuantity(?int $newAvailableQuantity): void; + /** + * @param ?string $sku + */ + public function setSku(?string $sku): void; + /** * @param ?ChannelReference $supplyChannel */ diff --git a/lib/commercetools-api/src/Models/Message/InventoryEntryQuantitySetMessagePayloadBuilder.php b/lib/commercetools-api/src/Models/Message/InventoryEntryQuantitySetMessagePayloadBuilder.php index 6695d5dd451..f8c0fcd08a9 100644 --- a/lib/commercetools-api/src/Models/Message/InventoryEntryQuantitySetMessagePayloadBuilder.php +++ b/lib/commercetools-api/src/Models/Message/InventoryEntryQuantitySetMessagePayloadBuilder.php @@ -46,6 +46,12 @@ final class InventoryEntryQuantitySetMessagePayloadBuilder implements Builder */ private $newAvailableQuantity; + /** + + * @var ?string + */ + private $sku; + /** * @var null|ChannelReference|ChannelReferenceBuilder @@ -96,6 +102,17 @@ public function getNewAvailableQuantity() return $this->newAvailableQuantity; } + /** + *SKU of the InventoryEntry for which the quantity was updated.
+ * + + * @return null|string + */ + public function getSku() + { + return $this->sku; + } + /** *Reference to the Channel where the InventoryEntry quantity was set.
* @@ -151,6 +168,17 @@ public function withNewAvailableQuantity(?int $newAvailableQuantity) return $this; } + /** + * @param ?string $sku + * @return $this + */ + public function withSku(?string $sku) + { + $this->sku = $sku; + + return $this; + } + /** * @param ?ChannelReference $supplyChannel * @return $this @@ -180,6 +208,7 @@ public function build(): InventoryEntryQuantitySetMessagePayload $this->newQuantityOnStock, $this->oldAvailableQuantity, $this->newAvailableQuantity, + $this->sku, $this->supplyChannel instanceof ChannelReferenceBuilder ? $this->supplyChannel->build() : $this->supplyChannel ); } diff --git a/lib/commercetools-api/src/Models/Message/InventoryEntryQuantitySetMessagePayloadModel.php b/lib/commercetools-api/src/Models/Message/InventoryEntryQuantitySetMessagePayloadModel.php index ab7345d98df..88999b705f1 100644 --- a/lib/commercetools-api/src/Models/Message/InventoryEntryQuantitySetMessagePayloadModel.php +++ b/lib/commercetools-api/src/Models/Message/InventoryEntryQuantitySetMessagePayloadModel.php @@ -52,6 +52,12 @@ final class InventoryEntryQuantitySetMessagePayloadModel extends JsonObjectModel */ protected $newAvailableQuantity; + /** + * + * @var ?string + */ + protected $sku; + /** * * @var ?ChannelReference @@ -67,6 +73,7 @@ public function __construct( ?int $newQuantityOnStock = null, ?int $oldAvailableQuantity = null, ?int $newAvailableQuantity = null, + ?string $sku = null, ?ChannelReference $supplyChannel = null, ?string $type = null ) { @@ -74,6 +81,7 @@ public function __construct( $this->newQuantityOnStock = $newQuantityOnStock; $this->oldAvailableQuantity = $oldAvailableQuantity; $this->newAvailableQuantity = $newAvailableQuantity; + $this->sku = $sku; $this->supplyChannel = $supplyChannel; $this->type = $type ?? self::DISCRIMINATOR_VALUE; } @@ -176,6 +184,26 @@ public function getNewAvailableQuantity() return $this->newAvailableQuantity; } + /** + *SKU of the InventoryEntry for which the quantity was updated.
+ * + * + * @return null|string + */ + public function getSku() + { + if (is_null($this->sku)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_SKU); + if (is_null($data)) { + return null; + } + $this->sku = (string) $data; + } + + return $this->sku; + } + /** *Reference to the Channel where the InventoryEntry quantity was set.
* @@ -230,6 +258,14 @@ public function setNewAvailableQuantity(?int $newAvailableQuantity): void $this->newAvailableQuantity = $newAvailableQuantity; } + /** + * @param ?string $sku + */ + public function setSku(?string $sku): void + { + $this->sku = $sku; + } + /** * @param ?ChannelReference $supplyChannel */ diff --git a/lib/commercetools-api/src/Models/Message/MessageModel.php b/lib/commercetools-api/src/Models/Message/MessageModel.php index 64ce0dca592..4a022a0a335 100644 --- a/lib/commercetools-api/src/Models/Message/MessageModel.php +++ b/lib/commercetools-api/src/Models/Message/MessageModel.php @@ -161,6 +161,8 @@ final class MessageModel extends JsonObjectModel implements Message 'CartDiscountStoreAdded' => CartDiscountStoreAddedMessageModel::class, 'CartDiscountStoreRemoved' => CartDiscountStoreRemovedMessageModel::class, 'CartDiscountStoresSet' => CartDiscountStoresSetMessageModel::class, + 'CartFrozen' => CartFrozenMessageModel::class, + 'CartUnfrozen' => CartUnfrozenMessageModel::class, 'CategoryCreated' => CategoryCreatedMessageModel::class, 'CategorySlugChanged' => CategorySlugChangedMessageModel::class, 'CustomLineItemStateTransition' => CustomLineItemStateTransitionMessageModel::class, @@ -249,6 +251,7 @@ final class MessageModel extends JsonObjectModel implements Message 'OrderLineItemDistributionChannelSet' => OrderLineItemDistributionChannelSetMessageModel::class, 'OrderLineItemRemoved' => OrderLineItemRemovedMessageModel::class, 'OrderPaymentAdded' => OrderPaymentAddedMessageModel::class, + 'OrderPaymentRemoved' => OrderPaymentRemovedMessageModel::class, 'OrderPaymentStateChanged' => OrderPaymentStateChangedMessageModel::class, 'OrderPurchaseOrderNumberSet' => OrderPurchaseOrderNumberSetMessageModel::class, 'OrderReturnShipmentStateChanged' => OrderReturnShipmentStateChangedMessageModel::class, @@ -358,6 +361,7 @@ final class MessageModel extends JsonObjectModel implements Message 'RecurringOrderCustomTypeSet' => RecurringOrderCustomTypeSetMessageModel::class, 'RecurringOrderDeleted' => RecurringOrderDeletedMessageModel::class, 'RecurringOrderExpiresAtSet' => RecurringOrderExpiresAtSetMessageModel::class, + 'RecurringOrderFailed' => RecurringOrderFailedMessageModel::class, 'RecurringOrderKeySet' => RecurringOrderKeySetMessageModel::class, 'RecurringOrderScheduleSet' => RecurringOrderScheduleSetMessageModel::class, 'RecurringOrderStartsAtSet' => RecurringOrderStartsAtSetMessageModel::class, diff --git a/lib/commercetools-api/src/Models/Message/MessagePayloadModel.php b/lib/commercetools-api/src/Models/Message/MessagePayloadModel.php index 67df04d0f06..1c3bb387b88 100644 --- a/lib/commercetools-api/src/Models/Message/MessagePayloadModel.php +++ b/lib/commercetools-api/src/Models/Message/MessagePayloadModel.php @@ -92,6 +92,8 @@ final class MessagePayloadModel extends JsonObjectModel implements MessagePayloa 'CartDiscountStoreAdded' => CartDiscountStoreAddedMessagePayloadModel::class, 'CartDiscountStoreRemoved' => CartDiscountStoreRemovedMessagePayloadModel::class, 'CartDiscountStoresSet' => CartDiscountStoresSetMessagePayloadModel::class, + 'CartFrozen' => CartFrozenMessagePayloadModel::class, + 'CartUnfrozen' => CartUnfrozenMessagePayloadModel::class, 'CategoryCreated' => CategoryCreatedMessagePayloadModel::class, 'CategorySlugChanged' => CategorySlugChangedMessagePayloadModel::class, 'CustomLineItemStateTransition' => CustomLineItemStateTransitionMessagePayloadModel::class, @@ -180,6 +182,7 @@ final class MessagePayloadModel extends JsonObjectModel implements MessagePayloa 'OrderLineItemDistributionChannelSet' => OrderLineItemDistributionChannelSetMessagePayloadModel::class, 'OrderLineItemRemoved' => OrderLineItemRemovedMessagePayloadModel::class, 'OrderPaymentAdded' => OrderPaymentAddedMessagePayloadModel::class, + 'OrderPaymentRemoved' => OrderPaymentRemovedMessagePayloadModel::class, 'OrderPaymentStateChanged' => OrderPaymentStateChangedMessagePayloadModel::class, 'OrderPurchaseOrderNumberSet' => OrderPurchaseOrderNumberSetMessagePayloadModel::class, 'OrderReturnShipmentStateChanged' => OrderReturnShipmentStateChangedMessagePayloadModel::class, @@ -289,6 +292,7 @@ final class MessagePayloadModel extends JsonObjectModel implements MessagePayloa 'RecurringOrderCustomTypeSet' => RecurringOrderCustomTypeSetMessagePayloadModel::class, 'RecurringOrderDeleted' => RecurringOrderDeletedMessagePayloadModel::class, 'RecurringOrderExpiresAtSet' => RecurringOrderExpiresAtSetMessagePayloadModel::class, + 'RecurringOrderFailed' => RecurringOrderFailedMessagePayloadModel::class, 'RecurringOrderKeySet' => RecurringOrderKeySetMessagePayloadModel::class, 'RecurringOrderScheduleSet' => RecurringOrderScheduleSetMessagePayloadModel::class, 'RecurringOrderStartsAtSet' => RecurringOrderStartsAtSetMessagePayloadModel::class, diff --git a/lib/commercetools-api/src/Models/Message/OrderPaymentAddedMessage.php b/lib/commercetools-api/src/Models/Message/OrderPaymentAddedMessage.php index af80115dc0b..d10d5be8f92 100644 --- a/lib/commercetools-api/src/Models/Message/OrderPaymentAddedMessage.php +++ b/lib/commercetools-api/src/Models/Message/OrderPaymentAddedMessage.php @@ -14,7 +14,7 @@ interface OrderPaymentAddedMessage extends Message { - public const FIELD_PAYMENT = 'payment'; + public const FIELD_PAYMENT_REF = 'paymentRef'; /** *Payment that was added to the Order.
@@ -22,10 +22,10 @@ interface OrderPaymentAddedMessage extends Message * @return null|PaymentReference */ - public function getPayment(); + public function getPaymentRef(); /** - * @param ?PaymentReference $payment + * @param ?PaymentReference $paymentRef */ - public function setPayment(?PaymentReference $payment): void; + public function setPaymentRef(?PaymentReference $paymentRef): void; } diff --git a/lib/commercetools-api/src/Models/Message/OrderPaymentAddedMessageBuilder.php b/lib/commercetools-api/src/Models/Message/OrderPaymentAddedMessageBuilder.php index 32be5012290..afa19432788 100644 --- a/lib/commercetools-api/src/Models/Message/OrderPaymentAddedMessageBuilder.php +++ b/lib/commercetools-api/src/Models/Message/OrderPaymentAddedMessageBuilder.php @@ -93,7 +93,7 @@ final class OrderPaymentAddedMessageBuilder implements Builder * @var null|PaymentReference|PaymentReferenceBuilder */ - private $payment; + private $paymentRef; /** *Unique identifier of the Message. Can be used to track which Messages have been processed.
@@ -212,9 +212,9 @@ public function getResourceUserProvidedIdentifiers() * @return null|PaymentReference */ - public function getPayment() + public function getPaymentRef() { - return $this->payment instanceof PaymentReferenceBuilder ? $this->payment->build() : $this->payment; + return $this->paymentRef instanceof PaymentReferenceBuilder ? $this->paymentRef->build() : $this->paymentRef; } /** @@ -328,12 +328,12 @@ public function withResourceUserProvidedIdentifiers(?UserProvidedIdentifiers $re } /** - * @param ?PaymentReference $payment + * @param ?PaymentReference $paymentRef * @return $this */ - public function withPayment(?PaymentReference $payment) + public function withPaymentRef(?PaymentReference $paymentRef) { - $this->payment = $payment; + $this->paymentRef = $paymentRef; return $this; } @@ -383,12 +383,12 @@ public function withResourceUserProvidedIdentifiersBuilder(?UserProvidedIdentifi } /** - * @deprecated use withPayment() instead + * @deprecated use withPaymentRef() instead * @return $this */ - public function withPaymentBuilder(?PaymentReferenceBuilder $payment) + public function withPaymentRefBuilder(?PaymentReferenceBuilder $paymentRef) { - $this->payment = $payment; + $this->paymentRef = $paymentRef; return $this; } @@ -406,7 +406,7 @@ public function build(): OrderPaymentAddedMessage $this->resource instanceof ReferenceBuilder ? $this->resource->build() : $this->resource, $this->resourceVersion, $this->resourceUserProvidedIdentifiers instanceof UserProvidedIdentifiersBuilder ? $this->resourceUserProvidedIdentifiers->build() : $this->resourceUserProvidedIdentifiers, - $this->payment instanceof PaymentReferenceBuilder ? $this->payment->build() : $this->payment + $this->paymentRef instanceof PaymentReferenceBuilder ? $this->paymentRef->build() : $this->paymentRef ); } diff --git a/lib/commercetools-api/src/Models/Message/OrderPaymentAddedMessageModel.php b/lib/commercetools-api/src/Models/Message/OrderPaymentAddedMessageModel.php index 9bd0c9e42a7..2fad38b7ad6 100644 --- a/lib/commercetools-api/src/Models/Message/OrderPaymentAddedMessageModel.php +++ b/lib/commercetools-api/src/Models/Message/OrderPaymentAddedMessageModel.php @@ -99,7 +99,7 @@ final class OrderPaymentAddedMessageModel extends JsonObjectModel implements Ord * * @var ?PaymentReference */ - protected $payment; + protected $paymentRef; /** @@ -116,7 +116,7 @@ public function __construct( ?Reference $resource = null, ?int $resourceVersion = null, ?UserProvidedIdentifiers $resourceUserProvidedIdentifiers = null, - ?PaymentReference $payment = null, + ?PaymentReference $paymentRef = null, ?string $type = null ) { $this->id = $id; @@ -129,7 +129,7 @@ public function __construct( $this->resource = $resource; $this->resourceVersion = $resourceVersion; $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers; - $this->payment = $payment; + $this->paymentRef = $paymentRef; $this->type = $type ?? self::DISCRIMINATOR_VALUE; } @@ -372,19 +372,19 @@ public function getResourceUserProvidedIdentifiers() * * @return null|PaymentReference */ - public function getPayment() + public function getPaymentRef() { - if (is_null($this->payment)) { + if (is_null($this->paymentRef)) { /** @psalm-var stdClass|arrayPayment that was added to the Order.
@@ -22,10 +22,10 @@ interface OrderPaymentAddedMessagePayload extends MessagePayload * @return null|PaymentReference */ - public function getPayment(); + public function getPaymentRef(); /** - * @param ?PaymentReference $payment + * @param ?PaymentReference $paymentRef */ - public function setPayment(?PaymentReference $payment): void; + public function setPaymentRef(?PaymentReference $paymentRef): void; } diff --git a/lib/commercetools-api/src/Models/Message/OrderPaymentAddedMessagePayloadBuilder.php b/lib/commercetools-api/src/Models/Message/OrderPaymentAddedMessagePayloadBuilder.php index 47ba9b0f8c5..9a475f8edb2 100644 --- a/lib/commercetools-api/src/Models/Message/OrderPaymentAddedMessagePayloadBuilder.php +++ b/lib/commercetools-api/src/Models/Message/OrderPaymentAddedMessagePayloadBuilder.php @@ -26,7 +26,7 @@ final class OrderPaymentAddedMessagePayloadBuilder implements Builder * @var null|PaymentReference|PaymentReferenceBuilder */ - private $payment; + private $paymentRef; /** *Payment that was added to the Order.
@@ -34,29 +34,29 @@ final class OrderPaymentAddedMessagePayloadBuilder implements Builder * @return null|PaymentReference */ - public function getPayment() + public function getPaymentRef() { - return $this->payment instanceof PaymentReferenceBuilder ? $this->payment->build() : $this->payment; + return $this->paymentRef instanceof PaymentReferenceBuilder ? $this->paymentRef->build() : $this->paymentRef; } /** - * @param ?PaymentReference $payment + * @param ?PaymentReference $paymentRef * @return $this */ - public function withPayment(?PaymentReference $payment) + public function withPaymentRef(?PaymentReference $paymentRef) { - $this->payment = $payment; + $this->paymentRef = $paymentRef; return $this; } /** - * @deprecated use withPayment() instead + * @deprecated use withPaymentRef() instead * @return $this */ - public function withPaymentBuilder(?PaymentReferenceBuilder $payment) + public function withPaymentRefBuilder(?PaymentReferenceBuilder $paymentRef) { - $this->payment = $payment; + $this->paymentRef = $paymentRef; return $this; } @@ -64,7 +64,7 @@ public function withPaymentBuilder(?PaymentReferenceBuilder $payment) public function build(): OrderPaymentAddedMessagePayload { return new OrderPaymentAddedMessagePayloadModel( - $this->payment instanceof PaymentReferenceBuilder ? $this->payment->build() : $this->payment + $this->paymentRef instanceof PaymentReferenceBuilder ? $this->paymentRef->build() : $this->paymentRef ); } diff --git a/lib/commercetools-api/src/Models/Message/OrderPaymentAddedMessagePayloadModel.php b/lib/commercetools-api/src/Models/Message/OrderPaymentAddedMessagePayloadModel.php index 56a00eb57d8..49f8034212a 100644 --- a/lib/commercetools-api/src/Models/Message/OrderPaymentAddedMessagePayloadModel.php +++ b/lib/commercetools-api/src/Models/Message/OrderPaymentAddedMessagePayloadModel.php @@ -32,17 +32,17 @@ final class OrderPaymentAddedMessagePayloadModel extends JsonObjectModel impleme * * @var ?PaymentReference */ - protected $payment; + protected $paymentRef; /** * @psalm-suppress MissingParamType */ public function __construct( - ?PaymentReference $payment = null, + ?PaymentReference $paymentRef = null, ?string $type = null ) { - $this->payment = $payment; + $this->paymentRef = $paymentRef; $this->type = $type ?? self::DISCRIMINATOR_VALUE; } @@ -70,27 +70,27 @@ public function getType() * * @return null|PaymentReference */ - public function getPayment() + public function getPaymentRef() { - if (is_null($this->payment)) { + if (is_null($this->paymentRef)) { /** @psalm-var stdClass|arrayIndicates whether the removal of the Payment resulted in no Payments remaining on the Order. The value is true if all Payments have been removed (none remain), and false if there are still Payments associated with the Order after the removal.
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.
Payment that was removed from the Order.
+ * + + * @return null|PaymentReference + */ + public function getPaymentRef() + { + return $this->paymentRef instanceof PaymentReferenceBuilder ? $this->paymentRef->build() : $this->paymentRef; + } + + /** + *Indicates whether the removal of the Payment resulted in no Payments remaining on the Order. The value is true if all Payments have been removed (none remain), and false if there are still Payments associated with the Order after the removal.
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.
Payment that was removed from the Order.
+ * + * + * @return null|PaymentReference + */ + public function getPaymentRef() + { + if (is_null($this->paymentRef)) { + /** @psalm-var stdClass|arrayIndicates whether the removal of the Payment resulted in no Payments remaining on the Order. The value is true if all Payments have been removed (none remain), and false if there are still Payments associated with the Order after the removal.
Indicates whether the removal of the Payment resulted in no Payments remaining on the Order. The value is true if all Payments have been removed (none remain), and false if there are still Payments associated with the Order after the removal.
Payment that was removed from the Order.
+ * + + * @return null|PaymentReference + */ + public function getPaymentRef() + { + return $this->paymentRef instanceof PaymentReferenceBuilder ? $this->paymentRef->build() : $this->paymentRef; + } + + /** + *Indicates whether the removal of the Payment resulted in no Payments remaining on the Order. The value is true if all Payments have been removed (none remain), and false if there are still Payments associated with the Order after the removal.
Payment that was removed from the Order.
+ * + * + * @return null|PaymentReference + */ + public function getPaymentRef() + { + if (is_null($this->paymentRef)) { + /** @psalm-var stdClass|arrayIndicates whether the removal of the Payment resulted in no Payments remaining on the Order. The value is true if all Payments have been removed (none remain), and false if there are still Payments associated with the Order after the removal.
Date and time (UTC) when the Order creation attempt failed.
+ * + + * @return null|DateTimeImmutable + */ + public function getFailedAt(); + + /** + *Description of why the Order creation failed, such as insufficient stock.
+ * + + * @return null|string + */ + public function getFailureReason(); + + /** + *Date and time (UTC) the Order was scheduled to be created.
+ * + + * @return null|DateTimeImmutable + */ + public function getOrderScheduledAt(); + + /** + *Errors due to which the Order creation failed.
+ * + + * @return null|RecurringOrderFailureErrorCollection + */ + public function getErrors(); + + /** + * @param ?string $cartId + */ + public function setCartId(?string $cartId): void; + + /** + * @param ?DateTimeImmutable $failedAt + */ + public function setFailedAt(?DateTimeImmutable $failedAt): void; + + /** + * @param ?string $failureReason + */ + public function setFailureReason(?string $failureReason): void; + + /** + * @param ?DateTimeImmutable $orderScheduledAt + */ + public function setOrderScheduledAt(?DateTimeImmutable $orderScheduledAt): void; + + /** + * @param ?RecurringOrderFailureErrorCollection $errors + */ + public function setErrors(?RecurringOrderFailureErrorCollection $errors): void; +} diff --git a/lib/commercetools-api/src/Models/Message/RecurringOrderFailedMessageBuilder.php b/lib/commercetools-api/src/Models/Message/RecurringOrderFailedMessageBuilder.php new file mode 100644 index 00000000000..c98883b6822 --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/RecurringOrderFailedMessageBuilder.php @@ -0,0 +1,521 @@ + + */ +final class RecurringOrderFailedMessageBuilder 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 $cartId; + + /** + + * @var ?DateTimeImmutable + */ + private $failedAt; + + /** + + * @var ?string + */ + private $failureReason; + + /** + + * @var ?DateTimeImmutable + */ + private $orderScheduledAt; + + /** + + * @var ?RecurringOrderFailureErrorCollection + */ + private $errors; + + /** + *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 Cart used in the failed Order creation attempt.
+ * + + * @return null|string + */ + public function getCartId() + { + return $this->cartId; + } + + /** + *Date and time (UTC) when the Order creation attempt failed.
+ * + + * @return null|DateTimeImmutable + */ + public function getFailedAt() + { + return $this->failedAt; + } + + /** + *Description of why the Order creation failed, such as insufficient stock.
+ * + + * @return null|string + */ + public function getFailureReason() + { + return $this->failureReason; + } + + /** + *Date and time (UTC) the Order was scheduled to be created.
+ * + + * @return null|DateTimeImmutable + */ + public function getOrderScheduledAt() + { + return $this->orderScheduledAt; + } + + /** + *Errors due to which the Order creation failed.
+ * + + * @return null|RecurringOrderFailureErrorCollection + */ + public function getErrors() + { + return $this->errors; + } + + /** + * @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 $cartId + * @return $this + */ + public function withCartId(?string $cartId) + { + $this->cartId = $cartId; + + return $this; + } + + /** + * @param ?DateTimeImmutable $failedAt + * @return $this + */ + public function withFailedAt(?DateTimeImmutable $failedAt) + { + $this->failedAt = $failedAt; + + return $this; + } + + /** + * @param ?string $failureReason + * @return $this + */ + public function withFailureReason(?string $failureReason) + { + $this->failureReason = $failureReason; + + return $this; + } + + /** + * @param ?DateTimeImmutable $orderScheduledAt + * @return $this + */ + public function withOrderScheduledAt(?DateTimeImmutable $orderScheduledAt) + { + $this->orderScheduledAt = $orderScheduledAt; + + return $this; + } + + /** + * @param ?RecurringOrderFailureErrorCollection $errors + * @return $this + */ + public function withErrors(?RecurringOrderFailureErrorCollection $errors) + { + $this->errors = $errors; + + 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(): RecurringOrderFailedMessage + { + return new RecurringOrderFailedMessageModel( + $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->cartId, + $this->failedAt, + $this->failureReason, + $this->orderScheduledAt, + $this->errors + ); + } + + public static function of(): RecurringOrderFailedMessageBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/Message/RecurringOrderFailedMessageCollection.php b/lib/commercetools-api/src/Models/Message/RecurringOrderFailedMessageCollection.php new file mode 100644 index 00000000000..57d4dbea150 --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/RecurringOrderFailedMessageCollection.php @@ -0,0 +1,56 @@ + + * @method RecurringOrderFailedMessage current() + * @method RecurringOrderFailedMessage end() + * @method RecurringOrderFailedMessage at($offset) + */ +class RecurringOrderFailedMessageCollection extends MessageCollection +{ + /** + * @psalm-assert RecurringOrderFailedMessage $value + * @psalm-param RecurringOrderFailedMessage|stdClass $value + * @throws InvalidArgumentException + * + * @return RecurringOrderFailedMessageCollection + */ + public function add($value) + { + if (!$value instanceof RecurringOrderFailedMessage) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?RecurringOrderFailedMessage + */ + protected function mapper() + { + return function (?int $index): ?RecurringOrderFailedMessage { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var RecurringOrderFailedMessage $data */ + $data = RecurringOrderFailedMessageModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/Message/RecurringOrderFailedMessageModel.php b/lib/commercetools-api/src/Models/Message/RecurringOrderFailedMessageModel.php new file mode 100644 index 00000000000..aaaf91515f7 --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/RecurringOrderFailedMessageModel.php @@ -0,0 +1,651 @@ +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->cartId = $cartId; + $this->failedAt = $failedAt; + $this->failureReason = $failureReason; + $this->orderScheduledAt = $orderScheduledAt; + $this->errors = $errors; + $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.
ID of the Cart used in the failed Order creation attempt.
+ * + * + * @return null|string + */ + public function getCartId() + { + if (is_null($this->cartId)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CART_ID); + if (is_null($data)) { + return null; + } + $this->cartId = (string) $data; + } + + return $this->cartId; + } + + /** + *Date and time (UTC) when the Order creation attempt failed.
+ * + * + * @return null|DateTimeImmutable + */ + public function getFailedAt() + { + if (is_null($this->failedAt)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_FAILED_AT); + if (is_null($data)) { + return null; + } + $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data); + if (false === $data) { + return null; + } + $this->failedAt = $data; + } + + return $this->failedAt; + } + + /** + *Description of why the Order creation failed, such as insufficient stock.
+ * + * + * @return null|string + */ + public function getFailureReason() + { + if (is_null($this->failureReason)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_FAILURE_REASON); + if (is_null($data)) { + return null; + } + $this->failureReason = (string) $data; + } + + return $this->failureReason; + } + + /** + *Date and time (UTC) the Order was scheduled to be created.
+ * + * + * @return null|DateTimeImmutable + */ + public function getOrderScheduledAt() + { + if (is_null($this->orderScheduledAt)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_ORDER_SCHEDULED_AT); + if (is_null($data)) { + return null; + } + $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data); + if (false === $data) { + return null; + } + $this->orderScheduledAt = $data; + } + + return $this->orderScheduledAt; + } + + /** + *Errors due to which the Order creation failed.
+ * + * + * @return null|RecurringOrderFailureErrorCollection + */ + public function getErrors() + { + if (is_null($this->errors)) { + /** @psalm-var ?listDate and time (UTC) when the Order creation attempt failed.
+ * + + * @return null|DateTimeImmutable + */ + public function getFailedAt(); + + /** + *Description of why the Order creation failed, such as insufficient stock.
+ * + + * @return null|string + */ + public function getFailureReason(); + + /** + *Date and time (UTC) the Order was scheduled to be created.
+ * + + * @return null|DateTimeImmutable + */ + public function getOrderScheduledAt(); + + /** + *Errors due to which the Order creation failed.
+ * + + * @return null|RecurringOrderFailureErrorCollection + */ + public function getErrors(); + + /** + * @param ?string $cartId + */ + public function setCartId(?string $cartId): void; + + /** + * @param ?DateTimeImmutable $failedAt + */ + public function setFailedAt(?DateTimeImmutable $failedAt): void; + + /** + * @param ?string $failureReason + */ + public function setFailureReason(?string $failureReason): void; + + /** + * @param ?DateTimeImmutable $orderScheduledAt + */ + public function setOrderScheduledAt(?DateTimeImmutable $orderScheduledAt): void; + + /** + * @param ?RecurringOrderFailureErrorCollection $errors + */ + public function setErrors(?RecurringOrderFailureErrorCollection $errors): void; +} diff --git a/lib/commercetools-api/src/Models/Message/RecurringOrderFailedMessagePayloadBuilder.php b/lib/commercetools-api/src/Models/Message/RecurringOrderFailedMessagePayloadBuilder.php new file mode 100644 index 00000000000..dad3eda80e8 --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/RecurringOrderFailedMessagePayloadBuilder.php @@ -0,0 +1,181 @@ + + */ +final class RecurringOrderFailedMessagePayloadBuilder implements Builder +{ + /** + + * @var ?string + */ + private $cartId; + + /** + + * @var ?DateTimeImmutable + */ + private $failedAt; + + /** + + * @var ?string + */ + private $failureReason; + + /** + + * @var ?DateTimeImmutable + */ + private $orderScheduledAt; + + /** + + * @var ?RecurringOrderFailureErrorCollection + */ + private $errors; + + /** + *ID of the Cart used in the failed Order creation attempt.
+ * + + * @return null|string + */ + public function getCartId() + { + return $this->cartId; + } + + /** + *Date and time (UTC) when the Order creation attempt failed.
+ * + + * @return null|DateTimeImmutable + */ + public function getFailedAt() + { + return $this->failedAt; + } + + /** + *Description of why the Order creation failed, such as insufficient stock.
+ * + + * @return null|string + */ + public function getFailureReason() + { + return $this->failureReason; + } + + /** + *Date and time (UTC) the Order was scheduled to be created.
+ * + + * @return null|DateTimeImmutable + */ + public function getOrderScheduledAt() + { + return $this->orderScheduledAt; + } + + /** + *Errors due to which the Order creation failed.
+ * + + * @return null|RecurringOrderFailureErrorCollection + */ + public function getErrors() + { + return $this->errors; + } + + /** + * @param ?string $cartId + * @return $this + */ + public function withCartId(?string $cartId) + { + $this->cartId = $cartId; + + return $this; + } + + /** + * @param ?DateTimeImmutable $failedAt + * @return $this + */ + public function withFailedAt(?DateTimeImmutable $failedAt) + { + $this->failedAt = $failedAt; + + return $this; + } + + /** + * @param ?string $failureReason + * @return $this + */ + public function withFailureReason(?string $failureReason) + { + $this->failureReason = $failureReason; + + return $this; + } + + /** + * @param ?DateTimeImmutable $orderScheduledAt + * @return $this + */ + public function withOrderScheduledAt(?DateTimeImmutable $orderScheduledAt) + { + $this->orderScheduledAt = $orderScheduledAt; + + return $this; + } + + /** + * @param ?RecurringOrderFailureErrorCollection $errors + * @return $this + */ + public function withErrors(?RecurringOrderFailureErrorCollection $errors) + { + $this->errors = $errors; + + return $this; + } + + + public function build(): RecurringOrderFailedMessagePayload + { + return new RecurringOrderFailedMessagePayloadModel( + $this->cartId, + $this->failedAt, + $this->failureReason, + $this->orderScheduledAt, + $this->errors + ); + } + + public static function of(): RecurringOrderFailedMessagePayloadBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/Message/RecurringOrderFailedMessagePayloadCollection.php b/lib/commercetools-api/src/Models/Message/RecurringOrderFailedMessagePayloadCollection.php new file mode 100644 index 00000000000..da0ee79c072 --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/RecurringOrderFailedMessagePayloadCollection.php @@ -0,0 +1,56 @@ + + * @method RecurringOrderFailedMessagePayload current() + * @method RecurringOrderFailedMessagePayload end() + * @method RecurringOrderFailedMessagePayload at($offset) + */ +class RecurringOrderFailedMessagePayloadCollection extends MessagePayloadCollection +{ + /** + * @psalm-assert RecurringOrderFailedMessagePayload $value + * @psalm-param RecurringOrderFailedMessagePayload|stdClass $value + * @throws InvalidArgumentException + * + * @return RecurringOrderFailedMessagePayloadCollection + */ + public function add($value) + { + if (!$value instanceof RecurringOrderFailedMessagePayload) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?RecurringOrderFailedMessagePayload + */ + protected function mapper() + { + return function (?int $index): ?RecurringOrderFailedMessagePayload { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var RecurringOrderFailedMessagePayload $data */ + $data = RecurringOrderFailedMessagePayloadModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/Message/RecurringOrderFailedMessagePayloadModel.php b/lib/commercetools-api/src/Models/Message/RecurringOrderFailedMessagePayloadModel.php new file mode 100644 index 00000000000..ef0f5c3252f --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/RecurringOrderFailedMessagePayloadModel.php @@ -0,0 +1,262 @@ +cartId = $cartId; + $this->failedAt = $failedAt; + $this->failureReason = $failureReason; + $this->orderScheduledAt = $orderScheduledAt; + $this->errors = $errors; + $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; + } + + /** + *ID of the Cart used in the failed Order creation attempt.
+ * + * + * @return null|string + */ + public function getCartId() + { + if (is_null($this->cartId)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CART_ID); + if (is_null($data)) { + return null; + } + $this->cartId = (string) $data; + } + + return $this->cartId; + } + + /** + *Date and time (UTC) when the Order creation attempt failed.
+ * + * + * @return null|DateTimeImmutable + */ + public function getFailedAt() + { + if (is_null($this->failedAt)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_FAILED_AT); + if (is_null($data)) { + return null; + } + $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data); + if (false === $data) { + return null; + } + $this->failedAt = $data; + } + + return $this->failedAt; + } + + /** + *Description of why the Order creation failed, such as insufficient stock.
+ * + * + * @return null|string + */ + public function getFailureReason() + { + if (is_null($this->failureReason)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_FAILURE_REASON); + if (is_null($data)) { + return null; + } + $this->failureReason = (string) $data; + } + + return $this->failureReason; + } + + /** + *Date and time (UTC) the Order was scheduled to be created.
+ * + * + * @return null|DateTimeImmutable + */ + public function getOrderScheduledAt() + { + if (is_null($this->orderScheduledAt)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_ORDER_SCHEDULED_AT); + if (is_null($data)) { + return null; + } + $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data); + if (false === $data) { + return null; + } + $this->orderScheduledAt = $data; + } + + return $this->orderScheduledAt; + } + + /** + *Errors due to which the Order creation failed.
+ * + * + * @return null|RecurringOrderFailureErrorCollection + */ + public function getErrors() + { + if (is_null($this->errors)) { + /** @psalm-var ?listDate and time (UTC) the Return Item was intitially created.
+ *Date and time (UTC) the Return Item was initially created.
* * @return null|DateTimeImmutable diff --git a/lib/commercetools-api/src/Models/Order/CustomLineItemReturnItemModel.php b/lib/commercetools-api/src/Models/Order/CustomLineItemReturnItemModel.php index cd53e829878..b58432aa524 100644 --- a/lib/commercetools-api/src/Models/Order/CustomLineItemReturnItemModel.php +++ b/lib/commercetools-api/src/Models/Order/CustomLineItemReturnItemModel.php @@ -307,7 +307,7 @@ public function getLastModifiedAt() } /** - *Date and time (UTC) the Return Item was intitially created.
+ *Date and time (UTC) the Return Item was initially created.
* * * @return null|DateTimeImmutable diff --git a/lib/commercetools-api/src/Models/Order/LineItemReturnItemBuilder.php b/lib/commercetools-api/src/Models/Order/LineItemReturnItemBuilder.php index 86acf674464..108635f57e2 100644 --- a/lib/commercetools-api/src/Models/Order/LineItemReturnItemBuilder.php +++ b/lib/commercetools-api/src/Models/Order/LineItemReturnItemBuilder.php @@ -176,7 +176,7 @@ public function getLastModifiedAt() } /** - *Date and time (UTC) the Return Item was intitially created.
+ *Date and time (UTC) the Return Item was initially created.
* * @return null|DateTimeImmutable diff --git a/lib/commercetools-api/src/Models/Order/LineItemReturnItemModel.php b/lib/commercetools-api/src/Models/Order/LineItemReturnItemModel.php index 498ee6ec085..083f5cef135 100644 --- a/lib/commercetools-api/src/Models/Order/LineItemReturnItemModel.php +++ b/lib/commercetools-api/src/Models/Order/LineItemReturnItemModel.php @@ -307,7 +307,7 @@ public function getLastModifiedAt() } /** - *Date and time (UTC) the Return Item was intitially created.
+ *Date and time (UTC) the Return Item was initially created.
* * * @return null|DateTimeImmutable diff --git a/lib/commercetools-api/src/Models/Order/ReturnItem.php b/lib/commercetools-api/src/Models/Order/ReturnItem.php index 12e2ac692c0..5f4362f2ac4 100644 --- a/lib/commercetools-api/src/Models/Order/ReturnItem.php +++ b/lib/commercetools-api/src/Models/Order/ReturnItem.php @@ -102,7 +102,7 @@ public function getCustom(); public function getLastModifiedAt(); /** - *Date and time (UTC) the Return Item was intitially created.
+ *Date and time (UTC) the Return Item was initially created.
* * @return null|DateTimeImmutable diff --git a/lib/commercetools-api/src/Models/Order/ReturnItemBuilder.php b/lib/commercetools-api/src/Models/Order/ReturnItemBuilder.php index e796b2acb86..31fd269bdf9 100644 --- a/lib/commercetools-api/src/Models/Order/ReturnItemBuilder.php +++ b/lib/commercetools-api/src/Models/Order/ReturnItemBuilder.php @@ -170,7 +170,7 @@ public function getLastModifiedAt() } /** - *Date and time (UTC) the Return Item was intitially created.
+ *Date and time (UTC) the Return Item was initially created.
* * @return null|DateTimeImmutable diff --git a/lib/commercetools-api/src/Models/Order/ReturnItemModel.php b/lib/commercetools-api/src/Models/Order/ReturnItemModel.php index 4a9ffcb7b23..33f1344e5e1 100644 --- a/lib/commercetools-api/src/Models/Order/ReturnItemModel.php +++ b/lib/commercetools-api/src/Models/Order/ReturnItemModel.php @@ -307,7 +307,7 @@ public function getLastModifiedAt() } /** - *Date and time (UTC) the Return Item was intitially created.
+ *Date and time (UTC) the Return Item was initially created.
* * * @return null|DateTimeImmutable diff --git a/lib/commercetools-api/src/Models/OrderEdit/StagedOrderRemoveLineItemAction.php b/lib/commercetools-api/src/Models/OrderEdit/StagedOrderRemoveLineItemAction.php index dcf7b4d9403..c8897e5e149 100644 --- a/lib/commercetools-api/src/Models/OrderEdit/StagedOrderRemoveLineItemAction.php +++ b/lib/commercetools-api/src/Models/OrderEdit/StagedOrderRemoveLineItemAction.php @@ -41,8 +41,8 @@ public function getLineItemId(); public function getLineItemKey(); /** - *New value to set.
- * If absent or 0, the Line Item is removed from the Cart.
Amount to subtract from the LineItem quantity. + * If omitted, the LineItem is removed from the Order.
* * @return null|int diff --git a/lib/commercetools-api/src/Models/OrderEdit/StagedOrderRemoveLineItemActionBuilder.php b/lib/commercetools-api/src/Models/OrderEdit/StagedOrderRemoveLineItemActionBuilder.php index 5618692084d..99cbdc844e1 100644 --- a/lib/commercetools-api/src/Models/OrderEdit/StagedOrderRemoveLineItemActionBuilder.php +++ b/lib/commercetools-api/src/Models/OrderEdit/StagedOrderRemoveLineItemActionBuilder.php @@ -87,8 +87,8 @@ public function getLineItemKey() } /** - *New value to set.
- * If absent or 0, the Line Item is removed from the Cart.
Amount to subtract from the LineItem quantity. + * If omitted, the LineItem is removed from the Order.
* * @return null|int diff --git a/lib/commercetools-api/src/Models/OrderEdit/StagedOrderRemoveLineItemActionModel.php b/lib/commercetools-api/src/Models/OrderEdit/StagedOrderRemoveLineItemActionModel.php index ba0d0c01e03..b5b387d6ce7 100644 --- a/lib/commercetools-api/src/Models/OrderEdit/StagedOrderRemoveLineItemActionModel.php +++ b/lib/commercetools-api/src/Models/OrderEdit/StagedOrderRemoveLineItemActionModel.php @@ -151,8 +151,8 @@ public function getLineItemKey() } /** - *New value to set.
- * If absent or 0, the Line Item is removed from the Cart.
Amount to subtract from the LineItem quantity. + * If omitted, the LineItem is removed from the Order.
* * * @return null|int diff --git a/lib/commercetools-api/src/Models/Product/ProductLegacySetSkuAction.php b/lib/commercetools-api/src/Models/Product/ProductLegacySetSkuAction.php deleted file mode 100644 index 8bcce652959..00000000000 --- a/lib/commercetools-api/src/Models/Product/ProductLegacySetSkuAction.php +++ /dev/null @@ -1,40 +0,0 @@ - - */ -final class ProductLegacySetSkuActionBuilder implements Builder -{ - /** - - * @var ?string - */ - private $sku; - - /** - - * @var ?int - */ - private $variantId; - - /** - - * @return null|string - */ - public function getSku() - { - return $this->sku; - } - - /** - - * @return null|int - */ - public function getVariantId() - { - return $this->variantId; - } - - /** - * @param ?string $sku - * @return $this - */ - public function withSku(?string $sku) - { - $this->sku = $sku; - - return $this; - } - - /** - * @param ?int $variantId - * @return $this - */ - public function withVariantId(?int $variantId) - { - $this->variantId = $variantId; - - return $this; - } - - - public function build(): ProductLegacySetSkuAction - { - return new ProductLegacySetSkuActionModel( - $this->sku, - $this->variantId - ); - } - - public static function of(): ProductLegacySetSkuActionBuilder - { - return new self(); - } -} diff --git a/lib/commercetools-api/src/Models/Product/ProductLegacySetSkuActionCollection.php b/lib/commercetools-api/src/Models/Product/ProductLegacySetSkuActionCollection.php deleted file mode 100644 index f8d91183d9c..00000000000 --- a/lib/commercetools-api/src/Models/Product/ProductLegacySetSkuActionCollection.php +++ /dev/null @@ -1,56 +0,0 @@ - - * @method ProductLegacySetSkuAction current() - * @method ProductLegacySetSkuAction end() - * @method ProductLegacySetSkuAction at($offset) - */ -class ProductLegacySetSkuActionCollection extends ProductUpdateActionCollection -{ - /** - * @psalm-assert ProductLegacySetSkuAction $value - * @psalm-param ProductLegacySetSkuAction|stdClass $value - * @throws InvalidArgumentException - * - * @return ProductLegacySetSkuActionCollection - */ - public function add($value) - { - if (!$value instanceof ProductLegacySetSkuAction) { - throw new InvalidArgumentException(); - } - $this->store($value); - - return $this; - } - - /** - * @psalm-return callable(int):?ProductLegacySetSkuAction - */ - protected function mapper() - { - return function (?int $index): ?ProductLegacySetSkuAction { - $data = $this->get($index); - if ($data instanceof stdClass) { - /** @var ProductLegacySetSkuAction $data */ - $data = ProductLegacySetSkuActionModel::of($data); - $this->set($data, $index); - } - - return $data; - }; - } -} diff --git a/lib/commercetools-api/src/Models/Product/ProductLegacySetSkuActionModel.php b/lib/commercetools-api/src/Models/Product/ProductLegacySetSkuActionModel.php deleted file mode 100644 index 59fadf6fe0f..00000000000 --- a/lib/commercetools-api/src/Models/Product/ProductLegacySetSkuActionModel.php +++ /dev/null @@ -1,125 +0,0 @@ -sku = $sku; - $this->variantId = $variantId; - $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; - } - - /** - * - * @return null|string - */ - public function getSku() - { - if (is_null($this->sku)) { - /** @psalm-var ?string $data */ - $data = $this->raw(self::FIELD_SKU); - if (is_null($data)) { - return null; - } - $this->sku = (string) $data; - } - - return $this->sku; - } - - /** - * - * @return null|int - */ - public function getVariantId() - { - if (is_null($this->variantId)) { - /** @psalm-var ?int $data */ - $data = $this->raw(self::FIELD_VARIANT_ID); - if (is_null($data)) { - return null; - } - $this->variantId = (int) $data; - } - - return $this->variantId; - } - - - /** - * @param ?string $sku - */ - public function setSku(?string $sku): void - { - $this->sku = $sku; - } - - /** - * @param ?int $variantId - */ - public function setVariantId(?int $variantId): void - { - $this->variantId = $variantId; - } -} diff --git a/lib/commercetools-api/src/Models/Product/ProductUpdateActionModel.php b/lib/commercetools-api/src/Models/Product/ProductUpdateActionModel.php index bf9695a8277..6e7b98950bd 100644 --- a/lib/commercetools-api/src/Models/Product/ProductUpdateActionModel.php +++ b/lib/commercetools-api/src/Models/Product/ProductUpdateActionModel.php @@ -42,7 +42,6 @@ final class ProductUpdateActionModel extends JsonObjectModel implements ProductU 'changeName' => ProductChangeNameActionModel::class, 'changePrice' => ProductChangePriceActionModel::class, 'changeSlug' => ProductChangeSlugActionModel::class, - 'legacySetSku' => ProductLegacySetSkuActionModel::class, 'moveImageToPosition' => ProductMoveImageToPositionActionModel::class, 'publish' => ProductPublishActionModel::class, 'removeAsset' => ProductRemoveAssetActionModel::class, diff --git a/lib/commercetools-api/src/Models/ProductDiscount/ProductDiscount.php b/lib/commercetools-api/src/Models/ProductDiscount/ProductDiscount.php index a686ea5f2cb..ae0935248f2 100644 --- a/lib/commercetools-api/src/Models/ProductDiscount/ProductDiscount.php +++ b/lib/commercetools-api/src/Models/ProductDiscount/ProductDiscount.php @@ -138,7 +138,8 @@ public function getSortOrder(); public function getIsActive(); /** - *References of all the resources that are addressed in the predicate.
References to all resources addressed in the predicate by their IDs.
+ * This value is generated by the platform.
References of all the resources that are addressed in the predicate.
References to all resources addressed in the predicate by their IDs.
+ * This value is generated by the platform.
References of all the resources that are addressed in the predicate.
References to all resources addressed in the predicate by their IDs.
+ * This value is generated by the platform.
Set if a matching ProductDiscount exists. If set, the API uses the discounted value for the Line Item price selection.
- * When a relative discount is applied and the fraction part of the discounted price is 0.5, the discounted price is rounded in favor of the customer with the half down rounding.
discounted price is 0.5, the discounted price is rounded in favor of the customer with the half down rounding.
* If an absolute discount value exceeds the price of the Product Variant, the discounted price is a negative value.
* diff --git a/lib/commercetools-api/src/Models/StandalonePrice/StandalonePriceBuilder.php b/lib/commercetools-api/src/Models/StandalonePrice/StandalonePriceBuilder.php index af607d96df7..d945c202ff4 100644 --- a/lib/commercetools-api/src/Models/StandalonePrice/StandalonePriceBuilder.php +++ b/lib/commercetools-api/src/Models/StandalonePrice/StandalonePriceBuilder.php @@ -328,7 +328,7 @@ public function getTiers() /** *Set if a matching ProductDiscount exists. If set, the API uses the discounted value for the Line Item price selection.
- * When a relative discount is applied and the fraction part of the discounted price is 0.5, the discounted price is rounded in favor of the customer with the half down rounding.
discounted price is 0.5, the discounted price is rounded in favor of the customer with the half down rounding.
* If an absolute discount value exceeds the price of the Product Variant, the discounted price is a negative value.
* diff --git a/lib/commercetools-api/src/Models/StandalonePrice/StandalonePriceModel.php b/lib/commercetools-api/src/Models/StandalonePrice/StandalonePriceModel.php index 51a9b059a37..523863d3a18 100644 --- a/lib/commercetools-api/src/Models/StandalonePrice/StandalonePriceModel.php +++ b/lib/commercetools-api/src/Models/StandalonePrice/StandalonePriceModel.php @@ -531,7 +531,7 @@ public function getTiers() /** *Set if a matching ProductDiscount exists. If set, the API uses the discounted value for the Line Item price selection.
- * When a relative discount is applied and the fraction part of the discounted price is 0.5, the discounted price is rounded in favor of the customer with the half down rounding.
discounted price is 0.5, the discounted price is rounded in favor of the customer with the half down rounding.
* If an absolute discount value exceeds the price of the Product Variant, the discounted price is a negative value.
* * diff --git a/lib/commercetools-api/src/Models/StandalonePrice/StandalonePriceRemovePriceTierAction.php b/lib/commercetools-api/src/Models/StandalonePrice/StandalonePriceRemovePriceTierAction.php index 2c6ee876e42..a0516c3244f 100644 --- a/lib/commercetools-api/src/Models/StandalonePrice/StandalonePriceRemovePriceTierAction.php +++ b/lib/commercetools-api/src/Models/StandalonePrice/StandalonePriceRemovePriceTierAction.php @@ -13,7 +13,7 @@ interface StandalonePriceRemovePriceTierAction extends StandalonePriceUpdateAction { - public const FIELD_TIER_MINIMUM_QUANTITY = 'tierMinimumQuantity'; + public const FIELD_MINIMUM_QUANTITY = 'minimumQuantity'; /** *The minimumQuantity of the PriceTier to be removed from the tiers field of the StandalonePrice.
The minimumQuantity of the PriceTier to be removed from the tiers field of the StandalonePrice.
inactive Product Selections with IndividualExclusion ProductSelectionMode are provided, all the Products are available in this Store.inactive and there's at least a Product Selection of mode Individual, no Product is available in this Store.active Product Selection is provided, only active Product Selections are considered to compute the availlability in this Store.active Product Selection is provided, only active Product Selections are considered to compute the availability in this Store.inactive Product Selections with IndividualExclusion ProductSelectionMode are provided, all the Products are available in this Store.inactive and there's at least a Product Selection of mode Individual, no Product is available in this Store.active Product Selection is provided, only active Product Selections are considered to compute the availlability in this Store.active Product Selection is provided, only active Product Selections are considered to compute the availability in this Store.inactive Product Selections with IndividualExclusion ProductSelectionMode are provided, all the Products are available in this Store.inactive and there's at least a Product Selection of mode Individual, no Product is available in this Store.active Product Selection is provided, only active Product Selections are considered to compute the availlability in this Store.active Product Selection is provided, only active Product Selections are considered to compute the availability in this Store.Discriminator that determines the type of the field.
+ * * * @return null|string */ diff --git a/lib/commercetools-api/src/Models/Type/CustomFieldDateTimeTypeModel.php b/lib/commercetools-api/src/Models/Type/CustomFieldDateTimeTypeModel.php index bbd70dbbc82..6e22ee39444 100644 --- a/lib/commercetools-api/src/Models/Type/CustomFieldDateTimeTypeModel.php +++ b/lib/commercetools-api/src/Models/Type/CustomFieldDateTimeTypeModel.php @@ -37,6 +37,8 @@ public function __construct( } /** + *Discriminator that determines the type of the field.
+ * * * @return null|string */ diff --git a/lib/commercetools-api/src/Models/Type/CustomFieldDateTypeModel.php b/lib/commercetools-api/src/Models/Type/CustomFieldDateTypeModel.php index ce23913ff16..a352c4bd164 100644 --- a/lib/commercetools-api/src/Models/Type/CustomFieldDateTypeModel.php +++ b/lib/commercetools-api/src/Models/Type/CustomFieldDateTypeModel.php @@ -37,6 +37,8 @@ public function __construct( } /** + *Discriminator that determines the type of the field.
+ * * * @return null|string */ diff --git a/lib/commercetools-api/src/Models/Type/CustomFieldEnumTypeModel.php b/lib/commercetools-api/src/Models/Type/CustomFieldEnumTypeModel.php index 9a53b3040e7..840570ddaf9 100644 --- a/lib/commercetools-api/src/Models/Type/CustomFieldEnumTypeModel.php +++ b/lib/commercetools-api/src/Models/Type/CustomFieldEnumTypeModel.php @@ -45,6 +45,8 @@ public function __construct( } /** + *Discriminator that determines the type of the field.
+ * * * @return null|string */ diff --git a/lib/commercetools-api/src/Models/Type/CustomFieldLocalizedEnumTypeModel.php b/lib/commercetools-api/src/Models/Type/CustomFieldLocalizedEnumTypeModel.php index 5b5769f750d..709ecd333f5 100644 --- a/lib/commercetools-api/src/Models/Type/CustomFieldLocalizedEnumTypeModel.php +++ b/lib/commercetools-api/src/Models/Type/CustomFieldLocalizedEnumTypeModel.php @@ -45,6 +45,8 @@ public function __construct( } /** + *Discriminator that determines the type of the field.
+ * * * @return null|string */ diff --git a/lib/commercetools-api/src/Models/Type/CustomFieldLocalizedStringTypeModel.php b/lib/commercetools-api/src/Models/Type/CustomFieldLocalizedStringTypeModel.php index 82dfb2d0a05..25df048c842 100644 --- a/lib/commercetools-api/src/Models/Type/CustomFieldLocalizedStringTypeModel.php +++ b/lib/commercetools-api/src/Models/Type/CustomFieldLocalizedStringTypeModel.php @@ -37,6 +37,8 @@ public function __construct( } /** + *Discriminator that determines the type of the field.
+ * * * @return null|string */ diff --git a/lib/commercetools-api/src/Models/Type/CustomFieldMoneyTypeModel.php b/lib/commercetools-api/src/Models/Type/CustomFieldMoneyTypeModel.php index d3de097b155..5b9258f9bce 100644 --- a/lib/commercetools-api/src/Models/Type/CustomFieldMoneyTypeModel.php +++ b/lib/commercetools-api/src/Models/Type/CustomFieldMoneyTypeModel.php @@ -37,6 +37,8 @@ public function __construct( } /** + *Discriminator that determines the type of the field.
+ * * * @return null|string */ diff --git a/lib/commercetools-api/src/Models/Type/CustomFieldNumberTypeModel.php b/lib/commercetools-api/src/Models/Type/CustomFieldNumberTypeModel.php index f652bea1f11..95793e118d7 100644 --- a/lib/commercetools-api/src/Models/Type/CustomFieldNumberTypeModel.php +++ b/lib/commercetools-api/src/Models/Type/CustomFieldNumberTypeModel.php @@ -37,6 +37,8 @@ public function __construct( } /** + *Discriminator that determines the type of the field.
+ * * * @return null|string */ diff --git a/lib/commercetools-api/src/Models/Type/CustomFieldReferenceTypeModel.php b/lib/commercetools-api/src/Models/Type/CustomFieldReferenceTypeModel.php index baade1f749a..10264c2ca92 100644 --- a/lib/commercetools-api/src/Models/Type/CustomFieldReferenceTypeModel.php +++ b/lib/commercetools-api/src/Models/Type/CustomFieldReferenceTypeModel.php @@ -45,6 +45,8 @@ public function __construct( } /** + *Discriminator that determines the type of the field.
+ * * * @return null|string */ diff --git a/lib/commercetools-api/src/Models/Type/CustomFieldSetTypeModel.php b/lib/commercetools-api/src/Models/Type/CustomFieldSetTypeModel.php index 4351a3b3095..a149079d736 100644 --- a/lib/commercetools-api/src/Models/Type/CustomFieldSetTypeModel.php +++ b/lib/commercetools-api/src/Models/Type/CustomFieldSetTypeModel.php @@ -45,6 +45,8 @@ public function __construct( } /** + *Discriminator that determines the type of the field.
+ * * * @return null|string */ diff --git a/lib/commercetools-api/src/Models/Type/CustomFieldStringTypeModel.php b/lib/commercetools-api/src/Models/Type/CustomFieldStringTypeModel.php index a009ecb2355..5254a68ddc9 100644 --- a/lib/commercetools-api/src/Models/Type/CustomFieldStringTypeModel.php +++ b/lib/commercetools-api/src/Models/Type/CustomFieldStringTypeModel.php @@ -37,6 +37,8 @@ public function __construct( } /** + *Discriminator that determines the type of the field.
+ * * * @return null|string */ diff --git a/lib/commercetools-api/src/Models/Type/CustomFieldTimeTypeModel.php b/lib/commercetools-api/src/Models/Type/CustomFieldTimeTypeModel.php index ec1f3d7924d..417fbbde42a 100644 --- a/lib/commercetools-api/src/Models/Type/CustomFieldTimeTypeModel.php +++ b/lib/commercetools-api/src/Models/Type/CustomFieldTimeTypeModel.php @@ -37,6 +37,8 @@ public function __construct( } /** + *Discriminator that determines the type of the field.
+ * * * @return null|string */ diff --git a/lib/commercetools-api/src/Models/Type/FieldDefinition.php b/lib/commercetools-api/src/Models/Type/FieldDefinition.php index d68516d99a1..9bc76343c89 100644 --- a/lib/commercetools-api/src/Models/Type/FieldDefinition.php +++ b/lib/commercetools-api/src/Models/Type/FieldDefinition.php @@ -31,7 +31,7 @@ public function getType(); /** *Name of the Custom Field to define.
* Must be unique for a given ResourceTypeId.
- * In case there is a FieldDefinition with the same name in another Type, both FieldDefinitions must have the same type.
name is defined in another Type for the same ResourceTypeId, then both FieldDefinitions must have the same type.
*
* @return null|string
diff --git a/lib/commercetools-api/src/Models/Type/FieldDefinitionBuilder.php b/lib/commercetools-api/src/Models/Type/FieldDefinitionBuilder.php
index 84a15312dd9..7ab861f9923 100644
--- a/lib/commercetools-api/src/Models/Type/FieldDefinitionBuilder.php
+++ b/lib/commercetools-api/src/Models/Type/FieldDefinitionBuilder.php
@@ -66,7 +66,7 @@ public function getType()
/**
* Name of the Custom Field to define.
* Must be unique for a given ResourceTypeId.
- * In case there is a FieldDefinition with the same name in another Type, both FieldDefinitions must have the same type.
name is defined in another Type for the same ResourceTypeId, then both FieldDefinitions must have the same type.
*
* @return null|string
diff --git a/lib/commercetools-api/src/Models/Type/FieldDefinitionModel.php b/lib/commercetools-api/src/Models/Type/FieldDefinitionModel.php
index e05522d2a9e..fc2148f656d 100644
--- a/lib/commercetools-api/src/Models/Type/FieldDefinitionModel.php
+++ b/lib/commercetools-api/src/Models/Type/FieldDefinitionModel.php
@@ -93,7 +93,7 @@ public function getType()
/**
* Name of the Custom Field to define.
* Must be unique for a given ResourceTypeId.
- * In case there is a FieldDefinition with the same name in another Type, both FieldDefinitions must have the same type.
name is defined in another Type for the same ResourceTypeId, then both FieldDefinitions must have the same type.
*
*
* @return null|string
diff --git a/lib/commercetools-api/src/Models/Type/FieldType.php b/lib/commercetools-api/src/Models/Type/FieldType.php
index 8ecd30ee78a..6f3aaf9587f 100644
--- a/lib/commercetools-api/src/Models/Type/FieldType.php
+++ b/lib/commercetools-api/src/Models/Type/FieldType.php
@@ -17,6 +17,8 @@ interface FieldType extends JsonObject
public const FIELD_NAME = 'name';
/**
+ * Discriminator that determines the type of the field.
+ * * @return null|string */ diff --git a/lib/commercetools-api/src/Models/Type/FieldTypeModel.php b/lib/commercetools-api/src/Models/Type/FieldTypeModel.php index 6006658d26e..2b6e8fd07a0 100644 --- a/lib/commercetools-api/src/Models/Type/FieldTypeModel.php +++ b/lib/commercetools-api/src/Models/Type/FieldTypeModel.php @@ -55,6 +55,8 @@ public function __construct( } /** + *Discriminator that determines the type of the field.
+ * * * @return null|string */ diff --git a/lib/commercetools-history/src/Models/Change/AddAssetChange.php b/lib/commercetools-history/src/Models/Change/AddAssetChange.php index ddda66f50c8..cd46e291204 100644 --- a/lib/commercetools-history/src/Models/Change/AddAssetChange.php +++ b/lib/commercetools-history/src/Models/Change/AddAssetChange.php @@ -17,6 +17,8 @@ interface AddAssetChange extends Change public const FIELD_PREVIOUS_VALUE = 'previousValue'; public const FIELD_NEXT_VALUE = 'nextValue'; + public const FIELD_CATALOG_DATA = 'catalogData'; + public const FIELD_VARIANT = 'variant'; /** @@ -46,6 +48,27 @@ public function getPreviousValue(); */ public function getNextValue(); + /** + *Product data that was updated.
+ *staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + + * @return null|string + */ + public function getVariant(); + /** * @param ?string $change */ @@ -60,4 +83,14 @@ public function setPreviousValue(?Asset $previousValue): void; * @param ?Asset $nextValue */ public function setNextValue(?Asset $nextValue): void; + + /** + * @param ?string $catalogData + */ + public function setCatalogData(?string $catalogData): void; + + /** + * @param ?string $variant + */ + public function setVariant(?string $variant): void; } diff --git a/lib/commercetools-history/src/Models/Change/AddAssetChangeBuilder.php b/lib/commercetools-history/src/Models/Change/AddAssetChangeBuilder.php index ba3e6bebbb6..266d17c97b1 100644 --- a/lib/commercetools-history/src/Models/Change/AddAssetChangeBuilder.php +++ b/lib/commercetools-history/src/Models/Change/AddAssetChangeBuilder.php @@ -40,6 +40,18 @@ final class AddAssetChangeBuilder implements Builder */ private $nextValue; + /** + + * @var ?string + */ + private $catalogData; + + /** + + * @var ?string + */ + private $variant; + /** * @return null|string @@ -71,6 +83,33 @@ public function getNextValue() return $this->nextValue instanceof AssetBuilder ? $this->nextValue->build() : $this->nextValue; } + /** + *Product data that was updated.
+ *staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + + * @return null|string + */ + public function getVariant() + { + return $this->variant; + } + /** * @param ?string $change * @return $this @@ -104,6 +143,28 @@ public function withNextValue(?Asset $nextValue) return $this; } + /** + * @param ?string $catalogData + * @return $this + */ + public function withCatalogData(?string $catalogData) + { + $this->catalogData = $catalogData; + + return $this; + } + + /** + * @param ?string $variant + * @return $this + */ + public function withVariant(?string $variant) + { + $this->variant = $variant; + + return $this; + } + /** * @deprecated use withPreviousValue() instead * @return $this @@ -131,7 +192,9 @@ public function build(): AddAssetChange return new AddAssetChangeModel( $this->change, $this->previousValue instanceof AssetBuilder ? $this->previousValue->build() : $this->previousValue, - $this->nextValue instanceof AssetBuilder ? $this->nextValue->build() : $this->nextValue + $this->nextValue instanceof AssetBuilder ? $this->nextValue->build() : $this->nextValue, + $this->catalogData, + $this->variant ); } diff --git a/lib/commercetools-history/src/Models/Change/AddAssetChangeModel.php b/lib/commercetools-history/src/Models/Change/AddAssetChangeModel.php index 9638e1d299e..747476d1fbb 100644 --- a/lib/commercetools-history/src/Models/Change/AddAssetChangeModel.php +++ b/lib/commercetools-history/src/Models/Change/AddAssetChangeModel.php @@ -47,6 +47,18 @@ final class AddAssetChangeModel extends JsonObjectModel implements AddAssetChang */ protected $nextValue; + /** + * + * @var ?string + */ + protected $catalogData; + + /** + * + * @var ?string + */ + protected $variant; + /** * @psalm-suppress MissingParamType @@ -55,11 +67,15 @@ public function __construct( ?string $change = null, ?Asset $previousValue = null, ?Asset $nextValue = null, + ?string $catalogData = null, + ?string $variant = null, ?string $type = null ) { $this->change = $change; $this->previousValue = $previousValue; $this->nextValue = $nextValue; + $this->catalogData = $catalogData; + $this->variant = $variant; $this->type = $type ?? self::DISCRIMINATOR_VALUE; } @@ -141,6 +157,51 @@ public function getNextValue() return $this->nextValue; } + /** + *Product data that was updated.
+ *staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + * + * @return null|string + */ + public function getVariant() + { + if (is_null($this->variant)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_VARIANT); + if (is_null($data)) { + return null; + } + $this->variant = (string) $data; + } + + return $this->variant; + } + /** * @param ?string $change @@ -166,6 +227,22 @@ public function setNextValue(?Asset $nextValue): void $this->nextValue = $nextValue; } + /** + * @param ?string $catalogData + */ + public function setCatalogData(?string $catalogData): void + { + $this->catalogData = $catalogData; + } + + /** + * @param ?string $variant + */ + public function setVariant(?string $variant): void + { + $this->variant = $variant; + } + } diff --git a/lib/commercetools-history/src/Models/Change/AddEnumValueChange.php b/lib/commercetools-history/src/Models/Change/AddEnumValueChange.php index 30eaedf8360..f2f57ee743b 100644 --- a/lib/commercetools-history/src/Models/Change/AddEnumValueChange.php +++ b/lib/commercetools-history/src/Models/Change/AddEnumValueChange.php @@ -10,13 +10,14 @@ use Commercetools\Base\JsonObject; use Commercetools\Base\DateTimeImmutableCollection; -use Commercetools\History\Models\ChangeValue\EnumValue; +use Commercetools\History\Models\Common\CustomFieldEnumValue; interface AddEnumValueChange extends Change { public const FIELD_NEXT_VALUE = 'nextValue'; public const FIELD_FIELD_NAME = 'fieldName'; + public const FIELD_ATTRIBUTE_NAME = 'attributeName'; /** @@ -34,7 +35,7 @@ public function getChange(); *Value after the change.
* - * @return null|EnumValue + * @return null|CustomFieldEnumValue */ public function getNextValue(); @@ -46,18 +47,31 @@ public function getNextValue(); */ public function getFieldName(); + /** + *Name of the updated AttributeDefinition.
+ * + + * @return null|string + */ + public function getAttributeName(); + /** * @param ?string $change */ public function setChange(?string $change): void; /** - * @param ?EnumValue $nextValue + * @param ?CustomFieldEnumValue $nextValue */ - public function setNextValue(?EnumValue $nextValue): void; + public function setNextValue(?CustomFieldEnumValue $nextValue): void; /** * @param ?string $fieldName */ public function setFieldName(?string $fieldName): void; + + /** + * @param ?string $attributeName + */ + public function setAttributeName(?string $attributeName): void; } diff --git a/lib/commercetools-history/src/Models/Change/AddEnumValueChangeBuilder.php b/lib/commercetools-history/src/Models/Change/AddEnumValueChangeBuilder.php index fe5ab815d3c..23d35a5d535 100644 --- a/lib/commercetools-history/src/Models/Change/AddEnumValueChangeBuilder.php +++ b/lib/commercetools-history/src/Models/Change/AddEnumValueChangeBuilder.php @@ -14,8 +14,8 @@ use Commercetools\Base\JsonObjectModel; use Commercetools\Base\MapperFactory; use stdClass; -use Commercetools\History\Models\ChangeValue\EnumValue; -use Commercetools\History\Models\ChangeValue\EnumValueBuilder; +use Commercetools\History\Models\Common\CustomFieldEnumValue; +use Commercetools\History\Models\Common\CustomFieldEnumValueBuilder; /** * @implements BuilderValue after the change.
* - * @return null|EnumValue + * @return null|CustomFieldEnumValue */ public function getNextValue() { - return $this->nextValue instanceof EnumValueBuilder ? $this->nextValue->build() : $this->nextValue; + return $this->nextValue instanceof CustomFieldEnumValueBuilder ? $this->nextValue->build() : $this->nextValue; } /** @@ -71,6 +77,17 @@ public function getFieldName() return $this->fieldName; } + /** + *Name of the updated AttributeDefinition.
+ * + + * @return null|string + */ + public function getAttributeName() + { + return $this->attributeName; + } + /** * @param ?string $change * @return $this @@ -83,10 +100,10 @@ public function withChange(?string $change) } /** - * @param ?EnumValue $nextValue + * @param ?CustomFieldEnumValue $nextValue * @return $this */ - public function withNextValue(?EnumValue $nextValue) + public function withNextValue(?CustomFieldEnumValue $nextValue) { $this->nextValue = $nextValue; @@ -104,11 +121,22 @@ public function withFieldName(?string $fieldName) return $this; } + /** + * @param ?string $attributeName + * @return $this + */ + public function withAttributeName(?string $attributeName) + { + $this->attributeName = $attributeName; + + return $this; + } + /** * @deprecated use withNextValue() instead * @return $this */ - public function withNextValueBuilder(?EnumValueBuilder $nextValue) + public function withNextValueBuilder(?CustomFieldEnumValueBuilder $nextValue) { $this->nextValue = $nextValue; @@ -119,8 +147,9 @@ public function build(): AddEnumValueChange { return new AddEnumValueChangeModel( $this->change, - $this->nextValue instanceof EnumValueBuilder ? $this->nextValue->build() : $this->nextValue, - $this->fieldName + $this->nextValue instanceof CustomFieldEnumValueBuilder ? $this->nextValue->build() : $this->nextValue, + $this->fieldName, + $this->attributeName ); } diff --git a/lib/commercetools-history/src/Models/Change/AddEnumValueChangeModel.php b/lib/commercetools-history/src/Models/Change/AddEnumValueChangeModel.php index 4579bad968a..42453c4a25d 100644 --- a/lib/commercetools-history/src/Models/Change/AddEnumValueChangeModel.php +++ b/lib/commercetools-history/src/Models/Change/AddEnumValueChangeModel.php @@ -13,8 +13,8 @@ use Commercetools\Base\JsonObjectModel; use Commercetools\Base\MapperFactory; use stdClass; -use Commercetools\History\Models\ChangeValue\EnumValue; -use Commercetools\History\Models\ChangeValue\EnumValueModel; +use Commercetools\History\Models\Common\CustomFieldEnumValue; +use Commercetools\History\Models\Common\CustomFieldEnumValueModel; /** * @internal @@ -37,7 +37,7 @@ final class AddEnumValueChangeModel extends JsonObjectModel implements AddEnumVa /** * - * @var ?EnumValue + * @var ?CustomFieldEnumValue */ protected $nextValue; @@ -47,19 +47,27 @@ final class AddEnumValueChangeModel extends JsonObjectModel implements AddEnumVa */ protected $fieldName; + /** + * + * @var ?string + */ + protected $attributeName; + /** * @psalm-suppress MissingParamType */ public function __construct( ?string $change = null, - ?EnumValue $nextValue = null, + ?CustomFieldEnumValue $nextValue = null, ?string $fieldName = null, + ?string $attributeName = null, ?string $type = null ) { $this->change = $change; $this->nextValue = $nextValue; $this->fieldName = $fieldName; + $this->attributeName = $attributeName; $this->type = $type ?? self::DISCRIMINATOR_VALUE; } @@ -103,7 +111,7 @@ public function getChange() *Value after the change.
* * - * @return null|EnumValue + * @return null|CustomFieldEnumValue */ public function getNextValue() { @@ -114,7 +122,7 @@ public function getNextValue() return null; } - $this->nextValue = EnumValueModel::of($data); + $this->nextValue = CustomFieldEnumValueModel::of($data); } return $this->nextValue; @@ -140,6 +148,26 @@ public function getFieldName() return $this->fieldName; } + /** + *Name of the updated AttributeDefinition.
+ * + * + * @return null|string + */ + public function getAttributeName() + { + if (is_null($this->attributeName)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_ATTRIBUTE_NAME); + if (is_null($data)) { + return null; + } + $this->attributeName = (string) $data; + } + + return $this->attributeName; + } + /** * @param ?string $change @@ -150,9 +178,9 @@ public function setChange(?string $change): void } /** - * @param ?EnumValue $nextValue + * @param ?CustomFieldEnumValue $nextValue */ - public function setNextValue(?EnumValue $nextValue): void + public function setNextValue(?CustomFieldEnumValue $nextValue): void { $this->nextValue = $nextValue; } @@ -165,6 +193,14 @@ public function setFieldName(?string $fieldName): void $this->fieldName = $fieldName; } + /** + * @param ?string $attributeName + */ + public function setAttributeName(?string $attributeName): void + { + $this->attributeName = $attributeName; + } + } diff --git a/lib/commercetools-history/src/Models/Change/AddExternalImageChange.php b/lib/commercetools-history/src/Models/Change/AddExternalImageChange.php index e149b94d9bb..c58e9f51169 100644 --- a/lib/commercetools-history/src/Models/Change/AddExternalImageChange.php +++ b/lib/commercetools-history/src/Models/Change/AddExternalImageChange.php @@ -18,6 +18,7 @@ interface AddExternalImageChange extends Change public const FIELD_PREVIOUS_VALUE = 'previousValue'; public const FIELD_NEXT_VALUE = 'nextValue'; public const FIELD_CATALOG_DATA = 'catalogData'; + public const FIELD_VARIANT = 'variant'; /** @@ -48,6 +49,7 @@ public function getPreviousValue(); public function getNextValue(); /** + *Product data that was updated.
*staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + + * @return null|string + */ + public function getVariant(); + /** * @param ?string $change */ @@ -77,4 +88,9 @@ public function setNextValue(?ImageCollection $nextValue): void; * @param ?string $catalogData */ public function setCatalogData(?string $catalogData): void; + + /** + * @param ?string $variant + */ + public function setVariant(?string $variant): void; } diff --git a/lib/commercetools-history/src/Models/Change/AddExternalImageChangeBuilder.php b/lib/commercetools-history/src/Models/Change/AddExternalImageChangeBuilder.php index df2e7f6a919..64342dc2d4b 100644 --- a/lib/commercetools-history/src/Models/Change/AddExternalImageChangeBuilder.php +++ b/lib/commercetools-history/src/Models/Change/AddExternalImageChangeBuilder.php @@ -45,6 +45,12 @@ final class AddExternalImageChangeBuilder implements Builder */ private $catalogData; + /** + + * @var ?string + */ + private $variant; + /** * @return null|string @@ -77,6 +83,7 @@ public function getNextValue() } /** + *Product data that was updated.
*staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + + * @return null|string + */ + public function getVariant() + { + return $this->variant; + } + /** * @param ?string $change * @return $this @@ -134,6 +153,17 @@ public function withCatalogData(?string $catalogData) return $this; } + /** + * @param ?string $variant + * @return $this + */ + public function withVariant(?string $variant) + { + $this->variant = $variant; + + return $this; + } + public function build(): AddExternalImageChange { @@ -141,7 +171,8 @@ public function build(): AddExternalImageChange $this->change, $this->previousValue, $this->nextValue, - $this->catalogData + $this->catalogData, + $this->variant ); } diff --git a/lib/commercetools-history/src/Models/Change/AddExternalImageChangeModel.php b/lib/commercetools-history/src/Models/Change/AddExternalImageChangeModel.php index bf5bdef3a8c..434357dc9cb 100644 --- a/lib/commercetools-history/src/Models/Change/AddExternalImageChangeModel.php +++ b/lib/commercetools-history/src/Models/Change/AddExternalImageChangeModel.php @@ -52,6 +52,12 @@ final class AddExternalImageChangeModel extends JsonObjectModel implements AddEx */ protected $catalogData; + /** + * + * @var ?string + */ + protected $variant; + /** * @psalm-suppress MissingParamType @@ -61,12 +67,14 @@ public function __construct( ?ImageCollection $previousValue = null, ?ImageCollection $nextValue = null, ?string $catalogData = null, + ?string $variant = null, ?string $type = null ) { $this->change = $change; $this->previousValue = $previousValue; $this->nextValue = $nextValue; $this->catalogData = $catalogData; + $this->variant = $variant; $this->type = $type ?? self::DISCRIMINATOR_VALUE; } @@ -147,6 +155,7 @@ public function getNextValue() } /** + *Product data that was updated.
*staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + * + * @return null|string + */ + public function getVariant() + { + if (is_null($this->variant)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_VARIANT); + if (is_null($data)) { + return null; + } + $this->variant = (string) $data; + } + + return $this->variant; + } + /** * @param ?string $change @@ -202,6 +232,14 @@ public function setCatalogData(?string $catalogData): void $this->catalogData = $catalogData; } + /** + * @param ?string $variant + */ + public function setVariant(?string $variant): void + { + $this->variant = $variant; + } + } diff --git a/lib/commercetools-history/src/Models/Change/AddInterfaceInteractionChange.php b/lib/commercetools-history/src/Models/Change/AddInterfaceInteractionChange.php index e616cb3760d..917c6cfd407 100644 --- a/lib/commercetools-history/src/Models/Change/AddInterfaceInteractionChange.php +++ b/lib/commercetools-history/src/Models/Change/AddInterfaceInteractionChange.php @@ -10,7 +10,7 @@ use Commercetools\Base\JsonObject; use Commercetools\Base\DateTimeImmutableCollection; -use Commercetools\History\Models\ChangeValue\CustomFieldExpandedValue; +use Commercetools\History\Models\Common\CustomFields; interface AddInterfaceInteractionChange extends Change { @@ -33,7 +33,7 @@ public function getChange(); *Value after the change.
* - * @return null|CustomFieldExpandedValue + * @return null|CustomFields */ public function getNextValue(); @@ -43,7 +43,7 @@ public function getNextValue(); public function setChange(?string $change): void; /** - * @param ?CustomFieldExpandedValue $nextValue + * @param ?CustomFields $nextValue */ - public function setNextValue(?CustomFieldExpandedValue $nextValue): void; + public function setNextValue(?CustomFields $nextValue): void; } diff --git a/lib/commercetools-history/src/Models/Change/AddInterfaceInteractionChangeBuilder.php b/lib/commercetools-history/src/Models/Change/AddInterfaceInteractionChangeBuilder.php index 505c49f55b6..aba25eb4946 100644 --- a/lib/commercetools-history/src/Models/Change/AddInterfaceInteractionChangeBuilder.php +++ b/lib/commercetools-history/src/Models/Change/AddInterfaceInteractionChangeBuilder.php @@ -14,8 +14,8 @@ use Commercetools\Base\JsonObjectModel; use Commercetools\Base\MapperFactory; use stdClass; -use Commercetools\History\Models\ChangeValue\CustomFieldExpandedValue; -use Commercetools\History\Models\ChangeValue\CustomFieldExpandedValueBuilder; +use Commercetools\History\Models\Common\CustomFields; +use Commercetools\History\Models\Common\CustomFieldsBuilder; /** * @implements BuilderValue after the change.
* - * @return null|CustomFieldExpandedValue + * @return null|CustomFields */ public function getNextValue() { - return $this->nextValue instanceof CustomFieldExpandedValueBuilder ? $this->nextValue->build() : $this->nextValue; + return $this->nextValue instanceof CustomFieldsBuilder ? $this->nextValue->build() : $this->nextValue; } /** @@ -66,10 +66,10 @@ public function withChange(?string $change) } /** - * @param ?CustomFieldExpandedValue $nextValue + * @param ?CustomFields $nextValue * @return $this */ - public function withNextValue(?CustomFieldExpandedValue $nextValue) + public function withNextValue(?CustomFields $nextValue) { $this->nextValue = $nextValue; @@ -80,7 +80,7 @@ public function withNextValue(?CustomFieldExpandedValue $nextValue) * @deprecated use withNextValue() instead * @return $this */ - public function withNextValueBuilder(?CustomFieldExpandedValueBuilder $nextValue) + public function withNextValueBuilder(?CustomFieldsBuilder $nextValue) { $this->nextValue = $nextValue; @@ -91,7 +91,7 @@ public function build(): AddInterfaceInteractionChange { return new AddInterfaceInteractionChangeModel( $this->change, - $this->nextValue instanceof CustomFieldExpandedValueBuilder ? $this->nextValue->build() : $this->nextValue + $this->nextValue instanceof CustomFieldsBuilder ? $this->nextValue->build() : $this->nextValue ); } diff --git a/lib/commercetools-history/src/Models/Change/AddInterfaceInteractionChangeModel.php b/lib/commercetools-history/src/Models/Change/AddInterfaceInteractionChangeModel.php index 3c109e0ff54..0a9896de100 100644 --- a/lib/commercetools-history/src/Models/Change/AddInterfaceInteractionChangeModel.php +++ b/lib/commercetools-history/src/Models/Change/AddInterfaceInteractionChangeModel.php @@ -13,8 +13,8 @@ use Commercetools\Base\JsonObjectModel; use Commercetools\Base\MapperFactory; use stdClass; -use Commercetools\History\Models\ChangeValue\CustomFieldExpandedValue; -use Commercetools\History\Models\ChangeValue\CustomFieldExpandedValueModel; +use Commercetools\History\Models\Common\CustomFields; +use Commercetools\History\Models\Common\CustomFieldsModel; /** * @internal @@ -37,7 +37,7 @@ final class AddInterfaceInteractionChangeModel extends JsonObjectModel implement /** * - * @var ?CustomFieldExpandedValue + * @var ?CustomFields */ protected $nextValue; @@ -47,7 +47,7 @@ final class AddInterfaceInteractionChangeModel extends JsonObjectModel implement */ public function __construct( ?string $change = null, - ?CustomFieldExpandedValue $nextValue = null, + ?CustomFields $nextValue = null, ?string $type = null ) { $this->change = $change; @@ -95,7 +95,7 @@ public function getChange() *Value after the change.
* * - * @return null|CustomFieldExpandedValue + * @return null|CustomFields */ public function getNextValue() { @@ -106,7 +106,7 @@ public function getNextValue() return null; } - $this->nextValue = CustomFieldExpandedValueModel::of($data); + $this->nextValue = CustomFieldsModel::of($data); } return $this->nextValue; @@ -122,9 +122,9 @@ public function setChange(?string $change): void } /** - * @param ?CustomFieldExpandedValue $nextValue + * @param ?CustomFields $nextValue */ - public function setNextValue(?CustomFieldExpandedValue $nextValue): void + public function setNextValue(?CustomFields $nextValue): void { $this->nextValue = $nextValue; } diff --git a/lib/commercetools-history/src/Models/Change/AddLocalizedEnumValueChange.php b/lib/commercetools-history/src/Models/Change/AddLocalizedEnumValueChange.php index cf7b3950bc2..bf3f3374b6c 100644 --- a/lib/commercetools-history/src/Models/Change/AddLocalizedEnumValueChange.php +++ b/lib/commercetools-history/src/Models/Change/AddLocalizedEnumValueChange.php @@ -10,7 +10,7 @@ use Commercetools\Base\JsonObject; use Commercetools\Base\DateTimeImmutableCollection; -use Commercetools\History\Models\Common\AttributeLocalizedEnumValue; +use Commercetools\History\Models\Common\CustomFieldLocalizedEnumValue; interface AddLocalizedEnumValueChange extends Change { @@ -35,7 +35,7 @@ public function getChange(); *Value after the change.
* - * @return null|AttributeLocalizedEnumValue + * @return null|CustomFieldLocalizedEnumValue */ public function getNextValue(); @@ -61,9 +61,9 @@ public function getAttributeName(); public function setChange(?string $change): void; /** - * @param ?AttributeLocalizedEnumValue $nextValue + * @param ?CustomFieldLocalizedEnumValue $nextValue */ - public function setNextValue(?AttributeLocalizedEnumValue $nextValue): void; + public function setNextValue(?CustomFieldLocalizedEnumValue $nextValue): void; /** * @param ?string $fieldName diff --git a/lib/commercetools-history/src/Models/Change/AddLocalizedEnumValueChangeBuilder.php b/lib/commercetools-history/src/Models/Change/AddLocalizedEnumValueChangeBuilder.php index 52d919106f6..8874aa8eff7 100644 --- a/lib/commercetools-history/src/Models/Change/AddLocalizedEnumValueChangeBuilder.php +++ b/lib/commercetools-history/src/Models/Change/AddLocalizedEnumValueChangeBuilder.php @@ -14,8 +14,8 @@ use Commercetools\Base\JsonObjectModel; use Commercetools\Base\MapperFactory; use stdClass; -use Commercetools\History\Models\Common\AttributeLocalizedEnumValue; -use Commercetools\History\Models\Common\AttributeLocalizedEnumValueBuilder; +use Commercetools\History\Models\Common\CustomFieldLocalizedEnumValue; +use Commercetools\History\Models\Common\CustomFieldLocalizedEnumValueBuilder; /** * @implements BuilderValue after the change.
* - * @return null|AttributeLocalizedEnumValue + * @return null|CustomFieldLocalizedEnumValue */ public function getNextValue() { - return $this->nextValue instanceof AttributeLocalizedEnumValueBuilder ? $this->nextValue->build() : $this->nextValue; + return $this->nextValue instanceof CustomFieldLocalizedEnumValueBuilder ? $this->nextValue->build() : $this->nextValue; } /** @@ -100,10 +100,10 @@ public function withChange(?string $change) } /** - * @param ?AttributeLocalizedEnumValue $nextValue + * @param ?CustomFieldLocalizedEnumValue $nextValue * @return $this */ - public function withNextValue(?AttributeLocalizedEnumValue $nextValue) + public function withNextValue(?CustomFieldLocalizedEnumValue $nextValue) { $this->nextValue = $nextValue; @@ -136,7 +136,7 @@ public function withAttributeName(?string $attributeName) * @deprecated use withNextValue() instead * @return $this */ - public function withNextValueBuilder(?AttributeLocalizedEnumValueBuilder $nextValue) + public function withNextValueBuilder(?CustomFieldLocalizedEnumValueBuilder $nextValue) { $this->nextValue = $nextValue; @@ -147,7 +147,7 @@ public function build(): AddLocalizedEnumValueChange { return new AddLocalizedEnumValueChangeModel( $this->change, - $this->nextValue instanceof AttributeLocalizedEnumValueBuilder ? $this->nextValue->build() : $this->nextValue, + $this->nextValue instanceof CustomFieldLocalizedEnumValueBuilder ? $this->nextValue->build() : $this->nextValue, $this->fieldName, $this->attributeName ); diff --git a/lib/commercetools-history/src/Models/Change/AddLocalizedEnumValueChangeModel.php b/lib/commercetools-history/src/Models/Change/AddLocalizedEnumValueChangeModel.php index fcbf32abbd2..52ccff9c213 100644 --- a/lib/commercetools-history/src/Models/Change/AddLocalizedEnumValueChangeModel.php +++ b/lib/commercetools-history/src/Models/Change/AddLocalizedEnumValueChangeModel.php @@ -13,8 +13,8 @@ use Commercetools\Base\JsonObjectModel; use Commercetools\Base\MapperFactory; use stdClass; -use Commercetools\History\Models\Common\AttributeLocalizedEnumValue; -use Commercetools\History\Models\Common\AttributeLocalizedEnumValueModel; +use Commercetools\History\Models\Common\CustomFieldLocalizedEnumValue; +use Commercetools\History\Models\Common\CustomFieldLocalizedEnumValueModel; /** * @internal @@ -37,7 +37,7 @@ final class AddLocalizedEnumValueChangeModel extends JsonObjectModel implements /** * - * @var ?AttributeLocalizedEnumValue + * @var ?CustomFieldLocalizedEnumValue */ protected $nextValue; @@ -59,7 +59,7 @@ final class AddLocalizedEnumValueChangeModel extends JsonObjectModel implements */ public function __construct( ?string $change = null, - ?AttributeLocalizedEnumValue $nextValue = null, + ?CustomFieldLocalizedEnumValue $nextValue = null, ?string $fieldName = null, ?string $attributeName = null, ?string $type = null @@ -111,7 +111,7 @@ public function getChange() *Value after the change.
* * - * @return null|AttributeLocalizedEnumValue + * @return null|CustomFieldLocalizedEnumValue */ public function getNextValue() { @@ -122,7 +122,7 @@ public function getNextValue() return null; } - $this->nextValue = AttributeLocalizedEnumValueModel::of($data); + $this->nextValue = CustomFieldLocalizedEnumValueModel::of($data); } return $this->nextValue; @@ -178,9 +178,9 @@ public function setChange(?string $change): void } /** - * @param ?AttributeLocalizedEnumValue $nextValue + * @param ?CustomFieldLocalizedEnumValue $nextValue */ - public function setNextValue(?AttributeLocalizedEnumValue $nextValue): void + public function setNextValue(?CustomFieldLocalizedEnumValue $nextValue): void { $this->nextValue = $nextValue; } diff --git a/lib/commercetools-history/src/Models/Change/AddPriceChange.php b/lib/commercetools-history/src/Models/Change/AddPriceChange.php index 2254f5d0cbb..801ef91c894 100644 --- a/lib/commercetools-history/src/Models/Change/AddPriceChange.php +++ b/lib/commercetools-history/src/Models/Change/AddPriceChange.php @@ -18,6 +18,7 @@ interface AddPriceChange extends Change public const FIELD_NEXT_VALUE = 'nextValue'; public const FIELD_CATALOG_DATA = 'catalogData'; public const FIELD_PRICE_ID = 'priceId'; + public const FIELD_VARIANT = 'variant'; /** @@ -40,6 +41,7 @@ public function getChange(); public function getNextValue(); /** + *Product data that was updated.
*staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + + * @return null|string + */ + public function getVariant(); + /** * @param ?string $change */ @@ -77,4 +88,9 @@ public function setCatalogData(?string $catalogData): void; * @param ?string $priceId */ public function setPriceId(?string $priceId): void; + + /** + * @param ?string $variant + */ + public function setVariant(?string $variant): void; } diff --git a/lib/commercetools-history/src/Models/Change/AddPriceChangeBuilder.php b/lib/commercetools-history/src/Models/Change/AddPriceChangeBuilder.php index fedb03391a5..e6cd55a8f94 100644 --- a/lib/commercetools-history/src/Models/Change/AddPriceChangeBuilder.php +++ b/lib/commercetools-history/src/Models/Change/AddPriceChangeBuilder.php @@ -46,6 +46,12 @@ final class AddPriceChangeBuilder implements Builder */ private $priceId; + /** + + * @var ?string + */ + private $variant; + /** * @return null|string @@ -67,6 +73,7 @@ public function getNextValue() } /** + *Product data that was updated.
*staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + + * @return null|string + */ + public function getVariant() + { + return $this->variant; + } + /** * @param ?string $change * @return $this @@ -135,6 +154,17 @@ public function withPriceId(?string $priceId) return $this; } + /** + * @param ?string $variant + * @return $this + */ + public function withVariant(?string $variant) + { + $this->variant = $variant; + + return $this; + } + /** * @deprecated use withNextValue() instead * @return $this @@ -152,7 +182,8 @@ public function build(): AddPriceChange $this->change, $this->nextValue instanceof PriceBuilder ? $this->nextValue->build() : $this->nextValue, $this->catalogData, - $this->priceId + $this->priceId, + $this->variant ); } diff --git a/lib/commercetools-history/src/Models/Change/AddPriceChangeModel.php b/lib/commercetools-history/src/Models/Change/AddPriceChangeModel.php index 9f9ce0fe99d..59716d53fa2 100644 --- a/lib/commercetools-history/src/Models/Change/AddPriceChangeModel.php +++ b/lib/commercetools-history/src/Models/Change/AddPriceChangeModel.php @@ -53,6 +53,12 @@ final class AddPriceChangeModel extends JsonObjectModel implements AddPriceChang */ protected $priceId; + /** + * + * @var ?string + */ + protected $variant; + /** * @psalm-suppress MissingParamType @@ -62,12 +68,14 @@ public function __construct( ?Price $nextValue = null, ?string $catalogData = null, ?string $priceId = null, + ?string $variant = null, ?string $type = null ) { $this->change = $change; $this->nextValue = $nextValue; $this->catalogData = $catalogData; $this->priceId = $priceId; + $this->variant = $variant; $this->type = $type ?? self::DISCRIMINATOR_VALUE; } @@ -129,6 +137,7 @@ public function getNextValue() } /** + *Product data that was updated.
*staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + * + * @return null|string + */ + public function getVariant() + { + if (is_null($this->variant)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_VARIANT); + if (is_null($data)) { + return null; + } + $this->variant = (string) $data; + } + + return $this->variant; + } + /** * @param ?string $change @@ -204,6 +234,14 @@ public function setPriceId(?string $priceId): void $this->priceId = $priceId; } + /** + * @param ?string $variant + */ + public function setVariant(?string $variant): void + { + $this->variant = $variant; + } + } diff --git a/lib/commercetools-history/src/Models/Change/AddProductChangeModel.php b/lib/commercetools-history/src/Models/Change/AddProductChangeModel.php index e68a84d63a7..d5a121cb370 100644 --- a/lib/commercetools-history/src/Models/Change/AddProductChangeModel.php +++ b/lib/commercetools-history/src/Models/Change/AddProductChangeModel.php @@ -115,8 +115,8 @@ public function getNextValue() if (is_null($data)) { return null; } - - $this->nextValue = ReferenceModel::of($data); + $className = ReferenceModel::resolveDiscriminatorClass($data); + $this->nextValue = $className::of($data); } return $this->nextValue; diff --git a/lib/commercetools-history/src/Models/Change/AddShippingChange.php b/lib/commercetools-history/src/Models/Change/AddShippingChange.php new file mode 100644 index 00000000000..763749a291d --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/AddShippingChange.php @@ -0,0 +1,49 @@ +Value after the change. + * + + * @return null|Shipping + */ + public function getNextValue(); + + /** + * @param ?string $change + */ + public function setChange(?string $change): void; + + /** + * @param ?Shipping $nextValue + */ + public function setNextValue(?Shipping $nextValue): void; +} diff --git a/lib/commercetools-history/src/Models/Change/AddShippingChangeBuilder.php b/lib/commercetools-history/src/Models/Change/AddShippingChangeBuilder.php new file mode 100644 index 00000000000..a619014c69c --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/AddShippingChangeBuilder.php @@ -0,0 +1,102 @@ + + */ +final class AddShippingChangeBuilder implements Builder +{ + /** + + * @var ?string + */ + private $change; + + /** + + * @var null|Shipping|ShippingBuilder + */ + private $nextValue; + + /** + + * @return null|string + */ + public function getChange() + { + return $this->change; + } + + /** + *Value after the change.
+ * + + * @return null|Shipping + */ + public function getNextValue() + { + return $this->nextValue instanceof ShippingBuilder ? $this->nextValue->build() : $this->nextValue; + } + + /** + * @param ?string $change + * @return $this + */ + public function withChange(?string $change) + { + $this->change = $change; + + return $this; + } + + /** + * @param ?Shipping $nextValue + * @return $this + */ + public function withNextValue(?Shipping $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + /** + * @deprecated use withNextValue() instead + * @return $this + */ + public function withNextValueBuilder(?ShippingBuilder $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + public function build(): AddShippingChange + { + return new AddShippingChangeModel( + $this->change, + $this->nextValue instanceof ShippingBuilder ? $this->nextValue->build() : $this->nextValue + ); + } + + public static function of(): AddShippingChangeBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-history/src/Models/Change/AddShippingChangeCollection.php b/lib/commercetools-history/src/Models/Change/AddShippingChangeCollection.php new file mode 100644 index 00000000000..cf3395dd3dc --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/AddShippingChangeCollection.php @@ -0,0 +1,56 @@ + + * @method AddShippingChange current() + * @method AddShippingChange end() + * @method AddShippingChange at($offset) + */ +class AddShippingChangeCollection extends ChangeCollection +{ + /** + * @psalm-assert AddShippingChange $value + * @psalm-param AddShippingChange|stdClass $value + * @throws InvalidArgumentException + * + * @return AddShippingChangeCollection + */ + public function add($value) + { + if (!$value instanceof AddShippingChange) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?AddShippingChange + */ + protected function mapper() + { + return function (?int $index): ?AddShippingChange { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var AddShippingChange $data */ + $data = AddShippingChangeModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-history/src/Models/Change/AddShippingChangeModel.php b/lib/commercetools-history/src/Models/Change/AddShippingChangeModel.php new file mode 100644 index 00000000000..a050a807387 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/AddShippingChangeModel.php @@ -0,0 +1,134 @@ +change = $change; + $this->nextValue = $nextValue; + $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; + } + + /** + * + * @return null|string + */ + public function getChange() + { + if (is_null($this->change)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CHANGE); + if (is_null($data)) { + return null; + } + $this->change = (string) $data; + } + + return $this->change; + } + + /** + *Value after the change.
+ * + * + * @return null|Shipping + */ + public function getNextValue() + { + if (is_null($this->nextValue)) { + /** @psalm-var stdClass|arrayValue before the change.
* - * @return null|LineItem + * @return null|ShoppingListLineItem */ public function getPreviousValue(); @@ -42,7 +42,7 @@ public function getPreviousValue(); *Value after the change.
* - * @return null|LineItem + * @return null|ShoppingListLineItem */ public function getNextValue(); @@ -52,12 +52,12 @@ public function getNextValue(); public function setChange(?string $change): void; /** - * @param ?LineItem $previousValue + * @param ?ShoppingListLineItem $previousValue */ - public function setPreviousValue(?LineItem $previousValue): void; + public function setPreviousValue(?ShoppingListLineItem $previousValue): void; /** - * @param ?LineItem $nextValue + * @param ?ShoppingListLineItem $nextValue */ - public function setNextValue(?LineItem $nextValue): void; + public function setNextValue(?ShoppingListLineItem $nextValue): void; } diff --git a/lib/commercetools-history/src/Models/Change/AddShoppingListLineItemChangeBuilder.php b/lib/commercetools-history/src/Models/Change/AddShoppingListLineItemChangeBuilder.php index 876e5a813eb..65caf6b0cfd 100644 --- a/lib/commercetools-history/src/Models/Change/AddShoppingListLineItemChangeBuilder.php +++ b/lib/commercetools-history/src/Models/Change/AddShoppingListLineItemChangeBuilder.php @@ -14,8 +14,8 @@ use Commercetools\Base\JsonObjectModel; use Commercetools\Base\MapperFactory; use stdClass; -use Commercetools\History\Models\Common\LineItem; -use Commercetools\History\Models\Common\LineItemBuilder; +use Commercetools\History\Models\Common\ShoppingListLineItem; +use Commercetools\History\Models\Common\ShoppingListLineItemBuilder; /** * @implements BuilderValue before the change.
* - * @return null|LineItem + * @return null|ShoppingListLineItem */ public function getPreviousValue() { - return $this->previousValue instanceof LineItemBuilder ? $this->previousValue->build() : $this->previousValue; + return $this->previousValue instanceof ShoppingListLineItemBuilder ? $this->previousValue->build() : $this->previousValue; } /** *Value after the change.
* - * @return null|LineItem + * @return null|ShoppingListLineItem */ public function getNextValue() { - return $this->nextValue instanceof LineItemBuilder ? $this->nextValue->build() : $this->nextValue; + return $this->nextValue instanceof ShoppingListLineItemBuilder ? $this->nextValue->build() : $this->nextValue; } /** @@ -83,10 +83,10 @@ public function withChange(?string $change) } /** - * @param ?LineItem $previousValue + * @param ?ShoppingListLineItem $previousValue * @return $this */ - public function withPreviousValue(?LineItem $previousValue) + public function withPreviousValue(?ShoppingListLineItem $previousValue) { $this->previousValue = $previousValue; @@ -94,10 +94,10 @@ public function withPreviousValue(?LineItem $previousValue) } /** - * @param ?LineItem $nextValue + * @param ?ShoppingListLineItem $nextValue * @return $this */ - public function withNextValue(?LineItem $nextValue) + public function withNextValue(?ShoppingListLineItem $nextValue) { $this->nextValue = $nextValue; @@ -108,7 +108,7 @@ public function withNextValue(?LineItem $nextValue) * @deprecated use withPreviousValue() instead * @return $this */ - public function withPreviousValueBuilder(?LineItemBuilder $previousValue) + public function withPreviousValueBuilder(?ShoppingListLineItemBuilder $previousValue) { $this->previousValue = $previousValue; @@ -119,7 +119,7 @@ public function withPreviousValueBuilder(?LineItemBuilder $previousValue) * @deprecated use withNextValue() instead * @return $this */ - public function withNextValueBuilder(?LineItemBuilder $nextValue) + public function withNextValueBuilder(?ShoppingListLineItemBuilder $nextValue) { $this->nextValue = $nextValue; @@ -130,8 +130,8 @@ public function build(): AddShoppingListLineItemChange { return new AddShoppingListLineItemChangeModel( $this->change, - $this->previousValue instanceof LineItemBuilder ? $this->previousValue->build() : $this->previousValue, - $this->nextValue instanceof LineItemBuilder ? $this->nextValue->build() : $this->nextValue + $this->previousValue instanceof ShoppingListLineItemBuilder ? $this->previousValue->build() : $this->previousValue, + $this->nextValue instanceof ShoppingListLineItemBuilder ? $this->nextValue->build() : $this->nextValue ); } diff --git a/lib/commercetools-history/src/Models/Change/AddShoppingListLineItemChangeModel.php b/lib/commercetools-history/src/Models/Change/AddShoppingListLineItemChangeModel.php index a2d5bffb503..dc7a9c275b2 100644 --- a/lib/commercetools-history/src/Models/Change/AddShoppingListLineItemChangeModel.php +++ b/lib/commercetools-history/src/Models/Change/AddShoppingListLineItemChangeModel.php @@ -13,8 +13,8 @@ use Commercetools\Base\JsonObjectModel; use Commercetools\Base\MapperFactory; use stdClass; -use Commercetools\History\Models\Common\LineItem; -use Commercetools\History\Models\Common\LineItemModel; +use Commercetools\History\Models\Common\ShoppingListLineItem; +use Commercetools\History\Models\Common\ShoppingListLineItemModel; /** * @internal @@ -37,13 +37,13 @@ final class AddShoppingListLineItemChangeModel extends JsonObjectModel implement /** * - * @var ?LineItem + * @var ?ShoppingListLineItem */ protected $previousValue; /** * - * @var ?LineItem + * @var ?ShoppingListLineItem */ protected $nextValue; @@ -53,8 +53,8 @@ final class AddShoppingListLineItemChangeModel extends JsonObjectModel implement */ public function __construct( ?string $change = null, - ?LineItem $previousValue = null, - ?LineItem $nextValue = null, + ?ShoppingListLineItem $previousValue = null, + ?ShoppingListLineItem $nextValue = null, ?string $type = null ) { $this->change = $change; @@ -103,7 +103,7 @@ public function getChange() *Value before the change.
* * - * @return null|LineItem + * @return null|ShoppingListLineItem */ public function getPreviousValue() { @@ -114,7 +114,7 @@ public function getPreviousValue() return null; } - $this->previousValue = LineItemModel::of($data); + $this->previousValue = ShoppingListLineItemModel::of($data); } return $this->previousValue; @@ -124,7 +124,7 @@ public function getPreviousValue() *Value after the change.
* * - * @return null|LineItem + * @return null|ShoppingListLineItem */ public function getNextValue() { @@ -135,7 +135,7 @@ public function getNextValue() return null; } - $this->nextValue = LineItemModel::of($data); + $this->nextValue = ShoppingListLineItemModel::of($data); } return $this->nextValue; @@ -151,17 +151,17 @@ public function setChange(?string $change): void } /** - * @param ?LineItem $previousValue + * @param ?ShoppingListLineItem $previousValue */ - public function setPreviousValue(?LineItem $previousValue): void + public function setPreviousValue(?ShoppingListLineItem $previousValue): void { $this->previousValue = $previousValue; } /** - * @param ?LineItem $nextValue + * @param ?ShoppingListLineItem $nextValue */ - public function setNextValue(?LineItem $nextValue): void + public function setNextValue(?ShoppingListLineItem $nextValue): void { $this->nextValue = $nextValue; } diff --git a/lib/commercetools-history/src/Models/Change/AddToCategoryChange.php b/lib/commercetools-history/src/Models/Change/AddToCategoryChange.php index 468d3abe1ad..5ada7b14772 100644 --- a/lib/commercetools-history/src/Models/Change/AddToCategoryChange.php +++ b/lib/commercetools-history/src/Models/Change/AddToCategoryChange.php @@ -19,6 +19,7 @@ interface AddToCategoryChange extends Change public const FIELD_PREVIOUS_VALUE = 'previousValue'; public const FIELD_NEXT_VALUE = 'nextValue'; public const FIELD_CATEGORY = 'category'; + public const FIELD_CATALOG_DATA = 'catalogData'; /** @@ -56,6 +57,18 @@ public function getNextValue(); */ public function getCategory(); + /** + *Product data that was updated.
+ *staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Product data that was updated.
+ *staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Product data that was updated.
+ *staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Product data that was updated.
*staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Product data that was updated.
*staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Product data that was updated.
*staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Value after the change.
+ * + + * @return null|string + */ + public function getNextValue(); + + /** + * @param ?string $change + */ + public function setChange(?string $change): void; + + /** + * @param ?string $previousValue + */ + public function setPreviousValue(?string $previousValue): void; + + /** + * @param ?string $nextValue + */ + public function setNextValue(?string $nextValue): void; +} diff --git a/lib/commercetools-history/src/Models/Change/ChangeApprovalRuleModeChangeBuilder.php b/lib/commercetools-history/src/Models/Change/ChangeApprovalRuleModeChangeBuilder.php new file mode 100644 index 00000000000..cb4447ad30f --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/ChangeApprovalRuleModeChangeBuilder.php @@ -0,0 +1,119 @@ + + */ +final class ChangeApprovalRuleModeChangeBuilder implements Builder +{ + /** + + * @var ?string + */ + private $change; + + /** + + * @var ?string + */ + private $previousValue; + + /** + + * @var ?string + */ + private $nextValue; + + /** + + * @return null|string + */ + public function getChange() + { + return $this->change; + } + + /** + *Value before the change.
+ * + + * @return null|string + */ + public function getPreviousValue() + { + return $this->previousValue; + } + + /** + *Value after the change.
+ * + + * @return null|string + */ + public function getNextValue() + { + return $this->nextValue; + } + + /** + * @param ?string $change + * @return $this + */ + public function withChange(?string $change) + { + $this->change = $change; + + return $this; + } + + /** + * @param ?string $previousValue + * @return $this + */ + public function withPreviousValue(?string $previousValue) + { + $this->previousValue = $previousValue; + + return $this; + } + + /** + * @param ?string $nextValue + * @return $this + */ + public function withNextValue(?string $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + + public function build(): ChangeApprovalRuleModeChange + { + return new ChangeApprovalRuleModeChangeModel( + $this->change, + $this->previousValue, + $this->nextValue + ); + } + + public static function of(): ChangeApprovalRuleModeChangeBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-history/src/Models/Change/ChangeApprovalRuleModeChangeCollection.php b/lib/commercetools-history/src/Models/Change/ChangeApprovalRuleModeChangeCollection.php new file mode 100644 index 00000000000..e55f68b4742 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/ChangeApprovalRuleModeChangeCollection.php @@ -0,0 +1,56 @@ + + * @method ChangeApprovalRuleModeChange current() + * @method ChangeApprovalRuleModeChange end() + * @method ChangeApprovalRuleModeChange at($offset) + */ +class ChangeApprovalRuleModeChangeCollection extends ChangeCollection +{ + /** + * @psalm-assert ChangeApprovalRuleModeChange $value + * @psalm-param ChangeApprovalRuleModeChange|stdClass $value + * @throws InvalidArgumentException + * + * @return ChangeApprovalRuleModeChangeCollection + */ + public function add($value) + { + if (!$value instanceof ChangeApprovalRuleModeChange) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?ChangeApprovalRuleModeChange + */ + protected function mapper() + { + return function (?int $index): ?ChangeApprovalRuleModeChange { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var ChangeApprovalRuleModeChange $data */ + $data = ChangeApprovalRuleModeChangeModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-history/src/Models/Change/ChangeApprovalRuleModeChangeModel.php b/lib/commercetools-history/src/Models/Change/ChangeApprovalRuleModeChangeModel.php new file mode 100644 index 00000000000..c20ef8dd197 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/ChangeApprovalRuleModeChangeModel.php @@ -0,0 +1,167 @@ +change = $change; + $this->previousValue = $previousValue; + $this->nextValue = $nextValue; + $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; + } + + /** + * + * @return null|string + */ + public function getChange() + { + if (is_null($this->change)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CHANGE); + if (is_null($data)) { + return null; + } + $this->change = (string) $data; + } + + return $this->change; + } + + /** + *Value before the change.
+ * + * + * @return null|string + */ + public function getPreviousValue() + { + if (is_null($this->previousValue)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_PREVIOUS_VALUE); + if (is_null($data)) { + return null; + } + $this->previousValue = (string) $data; + } + + return $this->previousValue; + } + + /** + *Value after the change.
+ * + * + * @return null|string + */ + public function getNextValue() + { + if (is_null($this->nextValue)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_NEXT_VALUE); + if (is_null($data)) { + return null; + } + $this->nextValue = (string) $data; + } + + return $this->nextValue; + } + + + /** + * @param ?string $change + */ + public function setChange(?string $change): void + { + $this->change = $change; + } + + /** + * @param ?string $previousValue + */ + public function setPreviousValue(?string $previousValue): void + { + $this->previousValue = $previousValue; + } + + /** + * @param ?string $nextValue + */ + public function setNextValue(?string $nextValue): void + { + $this->nextValue = $nextValue; + } + + + +} diff --git a/lib/commercetools-history/src/Models/Change/ChangeAssetNameChange.php b/lib/commercetools-history/src/Models/Change/ChangeAssetNameChange.php index 8d1d17f29f0..0367035d2c9 100644 --- a/lib/commercetools-history/src/Models/Change/ChangeAssetNameChange.php +++ b/lib/commercetools-history/src/Models/Change/ChangeAssetNameChange.php @@ -19,6 +19,8 @@ interface ChangeAssetNameChange extends Change public const FIELD_PREVIOUS_VALUE = 'previousValue'; public const FIELD_NEXT_VALUE = 'nextValue'; public const FIELD_ASSET = 'asset'; + public const FIELD_CATALOG_DATA = 'catalogData'; + public const FIELD_VARIANT = 'variant'; /** @@ -56,6 +58,27 @@ public function getNextValue(); */ public function getAsset(); + /** + *Product data that was updated.
+ *staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + + * @return null|string + */ + public function getVariant(); + /** * @param ?string $change */ @@ -75,4 +98,14 @@ public function setNextValue(?LocalizedString $nextValue): void; * @param ?AssetChangeValue $asset */ public function setAsset(?AssetChangeValue $asset): void; + + /** + * @param ?string $catalogData + */ + public function setCatalogData(?string $catalogData): void; + + /** + * @param ?string $variant + */ + public function setVariant(?string $variant): void; } diff --git a/lib/commercetools-history/src/Models/Change/ChangeAssetNameChangeBuilder.php b/lib/commercetools-history/src/Models/Change/ChangeAssetNameChangeBuilder.php index 6980d06d89b..613f461a7b4 100644 --- a/lib/commercetools-history/src/Models/Change/ChangeAssetNameChangeBuilder.php +++ b/lib/commercetools-history/src/Models/Change/ChangeAssetNameChangeBuilder.php @@ -48,6 +48,18 @@ final class ChangeAssetNameChangeBuilder implements Builder */ private $asset; + /** + + * @var ?string + */ + private $catalogData; + + /** + + * @var ?string + */ + private $variant; + /** * @return null|string @@ -90,6 +102,33 @@ public function getAsset() return $this->asset instanceof AssetChangeValueBuilder ? $this->asset->build() : $this->asset; } + /** + *Product data that was updated.
+ *staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + + * @return null|string + */ + public function getVariant() + { + return $this->variant; + } + /** * @param ?string $change * @return $this @@ -134,6 +173,28 @@ public function withAsset(?AssetChangeValue $asset) return $this; } + /** + * @param ?string $catalogData + * @return $this + */ + public function withCatalogData(?string $catalogData) + { + $this->catalogData = $catalogData; + + return $this; + } + + /** + * @param ?string $variant + * @return $this + */ + public function withVariant(?string $variant) + { + $this->variant = $variant; + + return $this; + } + /** * @deprecated use withPreviousValue() instead * @return $this @@ -173,7 +234,9 @@ public function build(): ChangeAssetNameChange $this->change, $this->previousValue instanceof LocalizedStringBuilder ? $this->previousValue->build() : $this->previousValue, $this->nextValue instanceof LocalizedStringBuilder ? $this->nextValue->build() : $this->nextValue, - $this->asset instanceof AssetChangeValueBuilder ? $this->asset->build() : $this->asset + $this->asset instanceof AssetChangeValueBuilder ? $this->asset->build() : $this->asset, + $this->catalogData, + $this->variant ); } diff --git a/lib/commercetools-history/src/Models/Change/ChangeAssetNameChangeModel.php b/lib/commercetools-history/src/Models/Change/ChangeAssetNameChangeModel.php index 573b039c0f0..40f1bdbbed6 100644 --- a/lib/commercetools-history/src/Models/Change/ChangeAssetNameChangeModel.php +++ b/lib/commercetools-history/src/Models/Change/ChangeAssetNameChangeModel.php @@ -55,6 +55,18 @@ final class ChangeAssetNameChangeModel extends JsonObjectModel implements Change */ protected $asset; + /** + * + * @var ?string + */ + protected $catalogData; + + /** + * + * @var ?string + */ + protected $variant; + /** * @psalm-suppress MissingParamType @@ -64,12 +76,16 @@ public function __construct( ?LocalizedString $previousValue = null, ?LocalizedString $nextValue = null, ?AssetChangeValue $asset = null, + ?string $catalogData = null, + ?string $variant = null, ?string $type = null ) { $this->change = $change; $this->previousValue = $previousValue; $this->nextValue = $nextValue; $this->asset = $asset; + $this->catalogData = $catalogData; + $this->variant = $variant; $this->type = $type ?? self::DISCRIMINATOR_VALUE; } @@ -172,6 +188,51 @@ public function getAsset() return $this->asset; } + /** + *Product data that was updated.
+ *staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + * + * @return null|string + */ + public function getVariant() + { + if (is_null($this->variant)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_VARIANT); + if (is_null($data)) { + return null; + } + $this->variant = (string) $data; + } + + return $this->variant; + } + /** * @param ?string $change @@ -205,6 +266,22 @@ public function setAsset(?AssetChangeValue $asset): void $this->asset = $asset; } + /** + * @param ?string $catalogData + */ + public function setCatalogData(?string $catalogData): void + { + $this->catalogData = $catalogData; + } + + /** + * @param ?string $variant + */ + public function setVariant(?string $variant): void + { + $this->variant = $variant; + } + } diff --git a/lib/commercetools-history/src/Models/Change/ChangeAssetOrderChange.php b/lib/commercetools-history/src/Models/Change/ChangeAssetOrderChange.php index fa377becb19..e50648da729 100644 --- a/lib/commercetools-history/src/Models/Change/ChangeAssetOrderChange.php +++ b/lib/commercetools-history/src/Models/Change/ChangeAssetOrderChange.php @@ -17,6 +17,8 @@ interface ChangeAssetOrderChange extends Change public const FIELD_PREVIOUS_VALUE = 'previousValue'; public const FIELD_NEXT_VALUE = 'nextValue'; + public const FIELD_CATALOG_DATA = 'catalogData'; + public const FIELD_VARIANT = 'variant'; /** @@ -46,6 +48,27 @@ public function getPreviousValue(); */ public function getNextValue(); + /** + *Product data that was updated.
+ *staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + + * @return null|string + */ + public function getVariant(); + /** * @param ?string $change */ @@ -60,4 +83,14 @@ public function setPreviousValue(?LocalizedStringCollection $previousValue): voi * @param ?LocalizedStringCollection $nextValue */ public function setNextValue(?LocalizedStringCollection $nextValue): void; + + /** + * @param ?string $catalogData + */ + public function setCatalogData(?string $catalogData): void; + + /** + * @param ?string $variant + */ + public function setVariant(?string $variant): void; } diff --git a/lib/commercetools-history/src/Models/Change/ChangeAssetOrderChangeBuilder.php b/lib/commercetools-history/src/Models/Change/ChangeAssetOrderChangeBuilder.php index 7d5cd9afab6..594e9067956 100644 --- a/lib/commercetools-history/src/Models/Change/ChangeAssetOrderChangeBuilder.php +++ b/lib/commercetools-history/src/Models/Change/ChangeAssetOrderChangeBuilder.php @@ -39,6 +39,18 @@ final class ChangeAssetOrderChangeBuilder implements Builder */ private $nextValue; + /** + + * @var ?string + */ + private $catalogData; + + /** + + * @var ?string + */ + private $variant; + /** * @return null|string @@ -70,6 +82,33 @@ public function getNextValue() return $this->nextValue; } + /** + *Product data that was updated.
+ *staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + + * @return null|string + */ + public function getVariant() + { + return $this->variant; + } + /** * @param ?string $change * @return $this @@ -103,13 +142,37 @@ public function withNextValue(?LocalizedStringCollection $nextValue) return $this; } + /** + * @param ?string $catalogData + * @return $this + */ + public function withCatalogData(?string $catalogData) + { + $this->catalogData = $catalogData; + + return $this; + } + + /** + * @param ?string $variant + * @return $this + */ + public function withVariant(?string $variant) + { + $this->variant = $variant; + + return $this; + } + public function build(): ChangeAssetOrderChange { return new ChangeAssetOrderChangeModel( $this->change, $this->previousValue, - $this->nextValue + $this->nextValue, + $this->catalogData, + $this->variant ); } diff --git a/lib/commercetools-history/src/Models/Change/ChangeAssetOrderChangeModel.php b/lib/commercetools-history/src/Models/Change/ChangeAssetOrderChangeModel.php index 51ce7c65906..a56163bb4ea 100644 --- a/lib/commercetools-history/src/Models/Change/ChangeAssetOrderChangeModel.php +++ b/lib/commercetools-history/src/Models/Change/ChangeAssetOrderChangeModel.php @@ -46,6 +46,18 @@ final class ChangeAssetOrderChangeModel extends JsonObjectModel implements Chang */ protected $nextValue; + /** + * + * @var ?string + */ + protected $catalogData; + + /** + * + * @var ?string + */ + protected $variant; + /** * @psalm-suppress MissingParamType @@ -54,11 +66,15 @@ public function __construct( ?string $change = null, ?LocalizedStringCollection $previousValue = null, ?LocalizedStringCollection $nextValue = null, + ?string $catalogData = null, + ?string $variant = null, ?string $type = null ) { $this->change = $change; $this->previousValue = $previousValue; $this->nextValue = $nextValue; + $this->catalogData = $catalogData; + $this->variant = $variant; $this->type = $type ?? self::DISCRIMINATOR_VALUE; } @@ -138,6 +154,51 @@ public function getNextValue() return $this->nextValue; } + /** + *Product data that was updated.
+ *staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + * + * @return null|string + */ + public function getVariant() + { + if (is_null($this->variant)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_VARIANT); + if (is_null($data)) { + return null; + } + $this->variant = (string) $data; + } + + return $this->variant; + } + /** * @param ?string $change @@ -163,6 +224,22 @@ public function setNextValue(?LocalizedStringCollection $nextValue): void $this->nextValue = $nextValue; } + /** + * @param ?string $catalogData + */ + public function setCatalogData(?string $catalogData): void + { + $this->catalogData = $catalogData; + } + + /** + * @param ?string $variant + */ + public function setVariant(?string $variant): void + { + $this->variant = $variant; + } + } diff --git a/lib/commercetools-history/src/Models/Change/ChangeCartDiscountsChange.php b/lib/commercetools-history/src/Models/Change/ChangeCartDiscountsChange.php index 6192cc08fa0..d916753a823 100644 --- a/lib/commercetools-history/src/Models/Change/ChangeCartDiscountsChange.php +++ b/lib/commercetools-history/src/Models/Change/ChangeCartDiscountsChange.php @@ -17,6 +17,8 @@ interface ChangeCartDiscountsChange extends Change public const FIELD_PREVIOUS_VALUE = 'previousValue'; public const FIELD_NEXT_VALUE = 'nextValue'; + public const FIELD_ADDED_ITEMS = 'addedItems'; + public const FIELD_REMOVED_ITEMS = 'removedItems'; /** @@ -46,6 +48,22 @@ public function getPreviousValue(); */ public function getNextValue(); + /** + *Elements added to the array.
+ * + + * @return null|ReferenceCollection + */ + public function getAddedItems(); + + /** + *Elements removed from the array.
+ * + + * @return null|ReferenceCollection + */ + public function getRemovedItems(); + /** * @param ?string $change */ @@ -60,4 +78,14 @@ public function setPreviousValue(?ReferenceCollection $previousValue): void; * @param ?ReferenceCollection $nextValue */ public function setNextValue(?ReferenceCollection $nextValue): void; + + /** + * @param ?ReferenceCollection $addedItems + */ + public function setAddedItems(?ReferenceCollection $addedItems): void; + + /** + * @param ?ReferenceCollection $removedItems + */ + public function setRemovedItems(?ReferenceCollection $removedItems): void; } diff --git a/lib/commercetools-history/src/Models/Change/ChangeCartDiscountsChangeBuilder.php b/lib/commercetools-history/src/Models/Change/ChangeCartDiscountsChangeBuilder.php index 72046222d0c..2c84a1d0df8 100644 --- a/lib/commercetools-history/src/Models/Change/ChangeCartDiscountsChangeBuilder.php +++ b/lib/commercetools-history/src/Models/Change/ChangeCartDiscountsChangeBuilder.php @@ -39,6 +39,18 @@ final class ChangeCartDiscountsChangeBuilder implements Builder */ private $nextValue; + /** + + * @var ?ReferenceCollection + */ + private $addedItems; + + /** + + * @var ?ReferenceCollection + */ + private $removedItems; + /** * @return null|string @@ -70,6 +82,28 @@ public function getNextValue() return $this->nextValue; } + /** + *Elements added to the array.
+ * + + * @return null|ReferenceCollection + */ + public function getAddedItems() + { + return $this->addedItems; + } + + /** + *Elements removed from the array.
+ * + + * @return null|ReferenceCollection + */ + public function getRemovedItems() + { + return $this->removedItems; + } + /** * @param ?string $change * @return $this @@ -103,13 +137,37 @@ public function withNextValue(?ReferenceCollection $nextValue) return $this; } + /** + * @param ?ReferenceCollection $addedItems + * @return $this + */ + public function withAddedItems(?ReferenceCollection $addedItems) + { + $this->addedItems = $addedItems; + + return $this; + } + + /** + * @param ?ReferenceCollection $removedItems + * @return $this + */ + public function withRemovedItems(?ReferenceCollection $removedItems) + { + $this->removedItems = $removedItems; + + return $this; + } + public function build(): ChangeCartDiscountsChange { return new ChangeCartDiscountsChangeModel( $this->change, $this->previousValue, - $this->nextValue + $this->nextValue, + $this->addedItems, + $this->removedItems ); } diff --git a/lib/commercetools-history/src/Models/Change/ChangeCartDiscountsChangeModel.php b/lib/commercetools-history/src/Models/Change/ChangeCartDiscountsChangeModel.php index ddeb09b8376..c6a8dd4c19c 100644 --- a/lib/commercetools-history/src/Models/Change/ChangeCartDiscountsChangeModel.php +++ b/lib/commercetools-history/src/Models/Change/ChangeCartDiscountsChangeModel.php @@ -46,6 +46,18 @@ final class ChangeCartDiscountsChangeModel extends JsonObjectModel implements Ch */ protected $nextValue; + /** + * + * @var ?ReferenceCollection + */ + protected $addedItems; + + /** + * + * @var ?ReferenceCollection + */ + protected $removedItems; + /** * @psalm-suppress MissingParamType @@ -54,11 +66,15 @@ public function __construct( ?string $change = null, ?ReferenceCollection $previousValue = null, ?ReferenceCollection $nextValue = null, + ?ReferenceCollection $addedItems = null, + ?ReferenceCollection $removedItems = null, ?string $type = null ) { $this->change = $change; $this->previousValue = $previousValue; $this->nextValue = $nextValue; + $this->addedItems = $addedItems; + $this->removedItems = $removedItems; $this->type = $type ?? self::DISCRIMINATOR_VALUE; } @@ -138,6 +154,46 @@ public function getNextValue() return $this->nextValue; } + /** + *Elements added to the array.
+ * + * + * @return null|ReferenceCollection + */ + public function getAddedItems() + { + if (is_null($this->addedItems)) { + /** @psalm-var ?listElements removed from the array.
+ * + * + * @return null|ReferenceCollection + */ + public function getRemovedItems() + { + if (is_null($this->removedItems)) { + /** @psalm-var ?listValue after the change.
+ * + + * @return null|Reference + */ + public function getNextValue(); + + /** + * @param ?string $change + */ + public function setChange(?string $change): void; + + /** + * @param ?Reference $previousValue + */ + public function setPreviousValue(?Reference $previousValue): void; + + /** + * @param ?Reference $nextValue + */ + public function setNextValue(?Reference $nextValue): void; +} diff --git a/lib/commercetools-history/src/Models/Change/ChangeCustomerChangeBuilder.php b/lib/commercetools-history/src/Models/Change/ChangeCustomerChangeBuilder.php new file mode 100644 index 00000000000..802a6c6e191 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/ChangeCustomerChangeBuilder.php @@ -0,0 +1,142 @@ + + */ +final class ChangeCustomerChangeBuilder implements Builder +{ + /** + + * @var ?string + */ + private $change; + + /** + + * @var null|Reference|ReferenceBuilder + */ + private $previousValue; + + /** + + * @var null|Reference|ReferenceBuilder + */ + private $nextValue; + + /** + + * @return null|string + */ + public function getChange() + { + return $this->change; + } + + /** + *Value before the change.
+ * + + * @return null|Reference + */ + public function getPreviousValue() + { + return $this->previousValue instanceof ReferenceBuilder ? $this->previousValue->build() : $this->previousValue; + } + + /** + *Value after the change.
+ * + + * @return null|Reference + */ + public function getNextValue() + { + return $this->nextValue instanceof ReferenceBuilder ? $this->nextValue->build() : $this->nextValue; + } + + /** + * @param ?string $change + * @return $this + */ + public function withChange(?string $change) + { + $this->change = $change; + + return $this; + } + + /** + * @param ?Reference $previousValue + * @return $this + */ + public function withPreviousValue(?Reference $previousValue) + { + $this->previousValue = $previousValue; + + return $this; + } + + /** + * @param ?Reference $nextValue + * @return $this + */ + public function withNextValue(?Reference $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + /** + * @deprecated use withPreviousValue() instead + * @return $this + */ + public function withPreviousValueBuilder(?ReferenceBuilder $previousValue) + { + $this->previousValue = $previousValue; + + return $this; + } + + /** + * @deprecated use withNextValue() instead + * @return $this + */ + public function withNextValueBuilder(?ReferenceBuilder $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + public function build(): ChangeCustomerChange + { + return new ChangeCustomerChangeModel( + $this->change, + $this->previousValue instanceof ReferenceBuilder ? $this->previousValue->build() : $this->previousValue, + $this->nextValue instanceof ReferenceBuilder ? $this->nextValue->build() : $this->nextValue + ); + } + + public static function of(): ChangeCustomerChangeBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-history/src/Models/Change/ChangeCustomerChangeCollection.php b/lib/commercetools-history/src/Models/Change/ChangeCustomerChangeCollection.php new file mode 100644 index 00000000000..f6956a0a4c4 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/ChangeCustomerChangeCollection.php @@ -0,0 +1,56 @@ + + * @method ChangeCustomerChange current() + * @method ChangeCustomerChange end() + * @method ChangeCustomerChange at($offset) + */ +class ChangeCustomerChangeCollection extends ChangeCollection +{ + /** + * @psalm-assert ChangeCustomerChange $value + * @psalm-param ChangeCustomerChange|stdClass $value + * @throws InvalidArgumentException + * + * @return ChangeCustomerChangeCollection + */ + public function add($value) + { + if (!$value instanceof ChangeCustomerChange) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?ChangeCustomerChange + */ + protected function mapper() + { + return function (?int $index): ?ChangeCustomerChange { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var ChangeCustomerChange $data */ + $data = ChangeCustomerChangeModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-history/src/Models/Change/ChangeCustomerChangeModel.php b/lib/commercetools-history/src/Models/Change/ChangeCustomerChangeModel.php new file mode 100644 index 00000000000..c84b059bb5e --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/ChangeCustomerChangeModel.php @@ -0,0 +1,171 @@ +change = $change; + $this->previousValue = $previousValue; + $this->nextValue = $nextValue; + $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; + } + + /** + * + * @return null|string + */ + public function getChange() + { + if (is_null($this->change)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CHANGE); + if (is_null($data)) { + return null; + } + $this->change = (string) $data; + } + + return $this->change; + } + + /** + *Value before the change.
+ * + * + * @return null|Reference + */ + public function getPreviousValue() + { + if (is_null($this->previousValue)) { + /** @psalm-var stdClass|arrayValue after the change.
+ * + * + * @return null|Reference + */ + public function getNextValue() + { + if (is_null($this->nextValue)) { + /** @psalm-var stdClass|arrayName of the updated AttributeDefinition.
+ * + + * @return null|string + */ + public function getAttributeName(); + /** * @param ?string $change */ @@ -87,4 +96,9 @@ public function setFieldName(?string $fieldName): void; * @param ?string $valueKey */ public function setValueKey(?string $valueKey): void; + + /** + * @param ?string $attributeName + */ + public function setAttributeName(?string $attributeName): void; } diff --git a/lib/commercetools-history/src/Models/Change/ChangeEnumValueLabelChangeBuilder.php b/lib/commercetools-history/src/Models/Change/ChangeEnumValueLabelChangeBuilder.php index abdac3fce3d..e84b7205382 100644 --- a/lib/commercetools-history/src/Models/Change/ChangeEnumValueLabelChangeBuilder.php +++ b/lib/commercetools-history/src/Models/Change/ChangeEnumValueLabelChangeBuilder.php @@ -50,6 +50,12 @@ final class ChangeEnumValueLabelChangeBuilder implements Builder */ private $valueKey; + /** + + * @var ?string + */ + private $attributeName; + /** * @return null|string @@ -103,6 +109,17 @@ public function getValueKey() return $this->valueKey; } + /** + *Name of the updated AttributeDefinition.
+ * + + * @return null|string + */ + public function getAttributeName() + { + return $this->attributeName; + } + /** * @param ?string $change * @return $this @@ -158,6 +175,17 @@ public function withValueKey(?string $valueKey) return $this; } + /** + * @param ?string $attributeName + * @return $this + */ + public function withAttributeName(?string $attributeName) + { + $this->attributeName = $attributeName; + + return $this; + } + public function build(): ChangeEnumValueLabelChange { @@ -166,7 +194,8 @@ public function build(): ChangeEnumValueLabelChange $this->previousValue, $this->nextValue, $this->fieldName, - $this->valueKey + $this->valueKey, + $this->attributeName ); } diff --git a/lib/commercetools-history/src/Models/Change/ChangeEnumValueLabelChangeModel.php b/lib/commercetools-history/src/Models/Change/ChangeEnumValueLabelChangeModel.php index 65a49968f9a..93e2e40371a 100644 --- a/lib/commercetools-history/src/Models/Change/ChangeEnumValueLabelChangeModel.php +++ b/lib/commercetools-history/src/Models/Change/ChangeEnumValueLabelChangeModel.php @@ -57,6 +57,12 @@ final class ChangeEnumValueLabelChangeModel extends JsonObjectModel implements C */ protected $valueKey; + /** + * + * @var ?string + */ + protected $attributeName; + /** * @psalm-suppress MissingParamType @@ -67,6 +73,7 @@ public function __construct( ?string $nextValue = null, ?string $fieldName = null, ?string $valueKey = null, + ?string $attributeName = null, ?string $type = null ) { $this->change = $change; @@ -74,6 +81,7 @@ public function __construct( $this->nextValue = $nextValue; $this->fieldName = $fieldName; $this->valueKey = $valueKey; + $this->attributeName = $attributeName; $this->type = $type ?? self::DISCRIMINATOR_VALUE; } @@ -193,6 +201,26 @@ public function getValueKey() return $this->valueKey; } + /** + *Name of the updated AttributeDefinition.
+ * + * + * @return null|string + */ + public function getAttributeName() + { + if (is_null($this->attributeName)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_ATTRIBUTE_NAME); + if (is_null($data)) { + return null; + } + $this->attributeName = (string) $data; + } + + return $this->attributeName; + } + /** * @param ?string $change @@ -234,6 +262,14 @@ public function setValueKey(?string $valueKey): void $this->valueKey = $valueKey; } + /** + * @param ?string $attributeName + */ + public function setAttributeName(?string $attributeName): void + { + $this->attributeName = $attributeName; + } + } diff --git a/lib/commercetools-history/src/Models/Change/ChangeEnumValueOrderChange.php b/lib/commercetools-history/src/Models/Change/ChangeEnumValueOrderChange.php index 15c7d63782f..71b1c9d5504 100644 --- a/lib/commercetools-history/src/Models/Change/ChangeEnumValueOrderChange.php +++ b/lib/commercetools-history/src/Models/Change/ChangeEnumValueOrderChange.php @@ -10,7 +10,7 @@ use Commercetools\Base\JsonObject; use Commercetools\Base\DateTimeImmutableCollection; -use Commercetools\History\Models\ChangeValue\EnumValueCollection; +use Commercetools\History\Models\Common\CustomFieldEnumValueCollection; interface ChangeEnumValueOrderChange extends Change { @@ -18,6 +18,7 @@ interface ChangeEnumValueOrderChange extends Change public const FIELD_PREVIOUS_VALUE = 'previousValue'; public const FIELD_NEXT_VALUE = 'nextValue'; public const FIELD_FIELD_NAME = 'fieldName'; + public const FIELD_ATTRIBUTE_NAME = 'attributeName'; /** @@ -35,7 +36,7 @@ public function getChange(); *Value before the change.
* - * @return null|EnumValueCollection + * @return null|CustomFieldEnumValueCollection */ public function getPreviousValue(); @@ -43,7 +44,7 @@ public function getPreviousValue(); *Value after the change.
* - * @return null|EnumValueCollection + * @return null|CustomFieldEnumValueCollection */ public function getNextValue(); @@ -55,23 +56,36 @@ public function getNextValue(); */ public function getFieldName(); + /** + *Name of the updated AttributeDefinition.
+ * + + * @return null|string + */ + public function getAttributeName(); + /** * @param ?string $change */ public function setChange(?string $change): void; /** - * @param ?EnumValueCollection $previousValue + * @param ?CustomFieldEnumValueCollection $previousValue */ - public function setPreviousValue(?EnumValueCollection $previousValue): void; + public function setPreviousValue(?CustomFieldEnumValueCollection $previousValue): void; /** - * @param ?EnumValueCollection $nextValue + * @param ?CustomFieldEnumValueCollection $nextValue */ - public function setNextValue(?EnumValueCollection $nextValue): void; + public function setNextValue(?CustomFieldEnumValueCollection $nextValue): void; /** * @param ?string $fieldName */ public function setFieldName(?string $fieldName): void; + + /** + * @param ?string $attributeName + */ + public function setAttributeName(?string $attributeName): void; } diff --git a/lib/commercetools-history/src/Models/Change/ChangeEnumValueOrderChangeBuilder.php b/lib/commercetools-history/src/Models/Change/ChangeEnumValueOrderChangeBuilder.php index 4201c883259..532d935a824 100644 --- a/lib/commercetools-history/src/Models/Change/ChangeEnumValueOrderChangeBuilder.php +++ b/lib/commercetools-history/src/Models/Change/ChangeEnumValueOrderChangeBuilder.php @@ -14,7 +14,7 @@ use Commercetools\Base\JsonObjectModel; use Commercetools\Base\MapperFactory; use stdClass; -use Commercetools\History\Models\ChangeValue\EnumValueCollection; +use Commercetools\History\Models\Common\CustomFieldEnumValueCollection; /** * @implements BuilderValue before the change.
* - * @return null|EnumValueCollection + * @return null|CustomFieldEnumValueCollection */ public function getPreviousValue() { @@ -69,7 +75,7 @@ public function getPreviousValue() *Value after the change.
* - * @return null|EnumValueCollection + * @return null|CustomFieldEnumValueCollection */ public function getNextValue() { @@ -87,6 +93,17 @@ public function getFieldName() return $this->fieldName; } + /** + *Name of the updated AttributeDefinition.
+ * + + * @return null|string + */ + public function getAttributeName() + { + return $this->attributeName; + } + /** * @param ?string $change * @return $this @@ -99,10 +116,10 @@ public function withChange(?string $change) } /** - * @param ?EnumValueCollection $previousValue + * @param ?CustomFieldEnumValueCollection $previousValue * @return $this */ - public function withPreviousValue(?EnumValueCollection $previousValue) + public function withPreviousValue(?CustomFieldEnumValueCollection $previousValue) { $this->previousValue = $previousValue; @@ -110,10 +127,10 @@ public function withPreviousValue(?EnumValueCollection $previousValue) } /** - * @param ?EnumValueCollection $nextValue + * @param ?CustomFieldEnumValueCollection $nextValue * @return $this */ - public function withNextValue(?EnumValueCollection $nextValue) + public function withNextValue(?CustomFieldEnumValueCollection $nextValue) { $this->nextValue = $nextValue; @@ -131,6 +148,17 @@ public function withFieldName(?string $fieldName) return $this; } + /** + * @param ?string $attributeName + * @return $this + */ + public function withAttributeName(?string $attributeName) + { + $this->attributeName = $attributeName; + + return $this; + } + public function build(): ChangeEnumValueOrderChange { @@ -138,7 +166,8 @@ public function build(): ChangeEnumValueOrderChange $this->change, $this->previousValue, $this->nextValue, - $this->fieldName + $this->fieldName, + $this->attributeName ); } diff --git a/lib/commercetools-history/src/Models/Change/ChangeEnumValueOrderChangeModel.php b/lib/commercetools-history/src/Models/Change/ChangeEnumValueOrderChangeModel.php index 14433460c15..de3b736db65 100644 --- a/lib/commercetools-history/src/Models/Change/ChangeEnumValueOrderChangeModel.php +++ b/lib/commercetools-history/src/Models/Change/ChangeEnumValueOrderChangeModel.php @@ -13,7 +13,7 @@ use Commercetools\Base\JsonObjectModel; use Commercetools\Base\MapperFactory; use stdClass; -use Commercetools\History\Models\ChangeValue\EnumValueCollection; +use Commercetools\History\Models\Common\CustomFieldEnumValueCollection; /** * @internal @@ -36,13 +36,13 @@ final class ChangeEnumValueOrderChangeModel extends JsonObjectModel implements C /** * - * @var ?EnumValueCollection + * @var ?CustomFieldEnumValueCollection */ protected $previousValue; /** * - * @var ?EnumValueCollection + * @var ?CustomFieldEnumValueCollection */ protected $nextValue; @@ -52,21 +52,29 @@ final class ChangeEnumValueOrderChangeModel extends JsonObjectModel implements C */ protected $fieldName; + /** + * + * @var ?string + */ + protected $attributeName; + /** * @psalm-suppress MissingParamType */ public function __construct( ?string $change = null, - ?EnumValueCollection $previousValue = null, - ?EnumValueCollection $nextValue = null, + ?CustomFieldEnumValueCollection $previousValue = null, + ?CustomFieldEnumValueCollection $nextValue = null, ?string $fieldName = null, + ?string $attributeName = null, ?string $type = null ) { $this->change = $change; $this->previousValue = $previousValue; $this->nextValue = $nextValue; $this->fieldName = $fieldName; + $this->attributeName = $attributeName; $this->type = $type ?? self::DISCRIMINATOR_VALUE; } @@ -110,7 +118,7 @@ public function getChange() *Value before the change.
* * - * @return null|EnumValueCollection + * @return null|CustomFieldEnumValueCollection */ public function getPreviousValue() { @@ -120,7 +128,7 @@ public function getPreviousValue() if (is_null($data)) { return null; } - $this->previousValue = EnumValueCollection::fromArray($data); + $this->previousValue = CustomFieldEnumValueCollection::fromArray($data); } return $this->previousValue; @@ -130,7 +138,7 @@ public function getPreviousValue() *Value after the change.
* * - * @return null|EnumValueCollection + * @return null|CustomFieldEnumValueCollection */ public function getNextValue() { @@ -140,7 +148,7 @@ public function getNextValue() if (is_null($data)) { return null; } - $this->nextValue = EnumValueCollection::fromArray($data); + $this->nextValue = CustomFieldEnumValueCollection::fromArray($data); } return $this->nextValue; @@ -166,6 +174,26 @@ public function getFieldName() return $this->fieldName; } + /** + *Name of the updated AttributeDefinition.
+ * + * + * @return null|string + */ + public function getAttributeName() + { + if (is_null($this->attributeName)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_ATTRIBUTE_NAME); + if (is_null($data)) { + return null; + } + $this->attributeName = (string) $data; + } + + return $this->attributeName; + } + /** * @param ?string $change @@ -176,17 +204,17 @@ public function setChange(?string $change): void } /** - * @param ?EnumValueCollection $previousValue + * @param ?CustomFieldEnumValueCollection $previousValue */ - public function setPreviousValue(?EnumValueCollection $previousValue): void + public function setPreviousValue(?CustomFieldEnumValueCollection $previousValue): void { $this->previousValue = $previousValue; } /** - * @param ?EnumValueCollection $nextValue + * @param ?CustomFieldEnumValueCollection $nextValue */ - public function setNextValue(?EnumValueCollection $nextValue): void + public function setNextValue(?CustomFieldEnumValueCollection $nextValue): void { $this->nextValue = $nextValue; } @@ -199,6 +227,14 @@ public function setFieldName(?string $fieldName): void $this->fieldName = $fieldName; } + /** + * @param ?string $attributeName + */ + public function setAttributeName(?string $attributeName): void + { + $this->attributeName = $attributeName; + } + } diff --git a/lib/commercetools-history/src/Models/Change/ChangeGroupsChange.php b/lib/commercetools-history/src/Models/Change/ChangeGroupsChange.php index b1202edae8b..694431573a4 100644 --- a/lib/commercetools-history/src/Models/Change/ChangeGroupsChange.php +++ b/lib/commercetools-history/src/Models/Change/ChangeGroupsChange.php @@ -16,6 +16,8 @@ interface ChangeGroupsChange extends Change public const FIELD_PREVIOUS_VALUE = 'previousValue'; public const FIELD_NEXT_VALUE = 'nextValue'; + public const FIELD_ADDED_ITEMS = 'addedItems'; + public const FIELD_REMOVED_ITEMS = 'removedItems'; /** @@ -45,6 +47,22 @@ public function getPreviousValue(); */ public function getNextValue(); + /** + *Elements added to the array.
+ * + + * @return null|array + */ + public function getAddedItems(); + + /** + *Elements removed from the array.
+ * + + * @return null|array + */ + public function getRemovedItems(); + /** * @param ?string $change */ @@ -59,4 +77,14 @@ public function setPreviousValue(?array $previousValue): void; * @param ?array $nextValue */ public function setNextValue(?array $nextValue): void; + + /** + * @param ?array $addedItems + */ + public function setAddedItems(?array $addedItems): void; + + /** + * @param ?array $removedItems + */ + public function setRemovedItems(?array $removedItems): void; } diff --git a/lib/commercetools-history/src/Models/Change/ChangeGroupsChangeBuilder.php b/lib/commercetools-history/src/Models/Change/ChangeGroupsChangeBuilder.php index 9a4e7a1abb3..45e4d7e4417 100644 --- a/lib/commercetools-history/src/Models/Change/ChangeGroupsChangeBuilder.php +++ b/lib/commercetools-history/src/Models/Change/ChangeGroupsChangeBuilder.php @@ -38,6 +38,18 @@ final class ChangeGroupsChangeBuilder implements Builder */ private $nextValue; + /** + + * @var ?array + */ + private $addedItems; + + /** + + * @var ?array + */ + private $removedItems; + /** * @return null|string @@ -69,6 +81,28 @@ public function getNextValue() return $this->nextValue; } + /** + *Elements added to the array.
+ * + + * @return null|array + */ + public function getAddedItems() + { + return $this->addedItems; + } + + /** + *Elements removed from the array.
+ * + + * @return null|array + */ + public function getRemovedItems() + { + return $this->removedItems; + } + /** * @param ?string $change * @return $this @@ -102,13 +136,37 @@ public function withNextValue(?array $nextValue) return $this; } + /** + * @param ?array $addedItems + * @return $this + */ + public function withAddedItems(?array $addedItems) + { + $this->addedItems = $addedItems; + + return $this; + } + + /** + * @param ?array $removedItems + * @return $this + */ + public function withRemovedItems(?array $removedItems) + { + $this->removedItems = $removedItems; + + return $this; + } + public function build(): ChangeGroupsChange { return new ChangeGroupsChangeModel( $this->change, $this->previousValue, - $this->nextValue + $this->nextValue, + $this->addedItems, + $this->removedItems ); } diff --git a/lib/commercetools-history/src/Models/Change/ChangeGroupsChangeModel.php b/lib/commercetools-history/src/Models/Change/ChangeGroupsChangeModel.php index 54b0f3bae26..efb1bfdcaa7 100644 --- a/lib/commercetools-history/src/Models/Change/ChangeGroupsChangeModel.php +++ b/lib/commercetools-history/src/Models/Change/ChangeGroupsChangeModel.php @@ -45,6 +45,18 @@ final class ChangeGroupsChangeModel extends JsonObjectModel implements ChangeGro */ protected $nextValue; + /** + * + * @var ?array + */ + protected $addedItems; + + /** + * + * @var ?array + */ + protected $removedItems; + /** * @psalm-suppress MissingParamType @@ -53,11 +65,15 @@ public function __construct( ?string $change = null, ?array $previousValue = null, ?array $nextValue = null, + ?array $addedItems = null, + ?array $removedItems = null, ?string $type = null ) { $this->change = $change; $this->previousValue = $previousValue; $this->nextValue = $nextValue; + $this->addedItems = $addedItems; + $this->removedItems = $removedItems; $this->type = $type ?? self::DISCRIMINATOR_VALUE; } @@ -137,6 +153,46 @@ public function getNextValue() return $this->nextValue; } + /** + *Elements added to the array.
+ * + * + * @return null|array + */ + public function getAddedItems() + { + if (is_null($this->addedItems)) { + /** @psalm-var ?listElements removed from the array.
+ * + * + * @return null|array + */ + public function getRemovedItems() + { + if (is_null($this->removedItems)) { + /** @psalm-var ?listValue after the change.
+ * + + * @return null|bool + */ + public function getNextValue(); + + /** + * @param ?string $change + */ + public function setChange(?string $change): void; + + /** + * @param ?bool $previousValue + */ + public function setPreviousValue(?bool $previousValue): void; + + /** + * @param ?bool $nextValue + */ + public function setNextValue(?bool $nextValue): void; +} diff --git a/lib/commercetools-history/src/Models/Change/ChangeIncludedInStatisticsChangeBuilder.php b/lib/commercetools-history/src/Models/Change/ChangeIncludedInStatisticsChangeBuilder.php new file mode 100644 index 00000000000..9c656880639 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/ChangeIncludedInStatisticsChangeBuilder.php @@ -0,0 +1,119 @@ + + */ +final class ChangeIncludedInStatisticsChangeBuilder implements Builder +{ + /** + + * @var ?string + */ + private $change; + + /** + + * @var ?bool + */ + private $previousValue; + + /** + + * @var ?bool + */ + private $nextValue; + + /** + + * @return null|string + */ + public function getChange() + { + return $this->change; + } + + /** + *Value before the change.
+ * + + * @return null|bool + */ + public function getPreviousValue() + { + return $this->previousValue; + } + + /** + *Value after the change.
+ * + + * @return null|bool + */ + public function getNextValue() + { + return $this->nextValue; + } + + /** + * @param ?string $change + * @return $this + */ + public function withChange(?string $change) + { + $this->change = $change; + + return $this; + } + + /** + * @param ?bool $previousValue + * @return $this + */ + public function withPreviousValue(?bool $previousValue) + { + $this->previousValue = $previousValue; + + return $this; + } + + /** + * @param ?bool $nextValue + * @return $this + */ + public function withNextValue(?bool $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + + public function build(): ChangeIncludedInStatisticsChange + { + return new ChangeIncludedInStatisticsChangeModel( + $this->change, + $this->previousValue, + $this->nextValue + ); + } + + public static function of(): ChangeIncludedInStatisticsChangeBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-history/src/Models/Change/ChangeIncludedInStatisticsChangeCollection.php b/lib/commercetools-history/src/Models/Change/ChangeIncludedInStatisticsChangeCollection.php new file mode 100644 index 00000000000..5102aba1052 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/ChangeIncludedInStatisticsChangeCollection.php @@ -0,0 +1,56 @@ + + * @method ChangeIncludedInStatisticsChange current() + * @method ChangeIncludedInStatisticsChange end() + * @method ChangeIncludedInStatisticsChange at($offset) + */ +class ChangeIncludedInStatisticsChangeCollection extends ChangeCollection +{ + /** + * @psalm-assert ChangeIncludedInStatisticsChange $value + * @psalm-param ChangeIncludedInStatisticsChange|stdClass $value + * @throws InvalidArgumentException + * + * @return ChangeIncludedInStatisticsChangeCollection + */ + public function add($value) + { + if (!$value instanceof ChangeIncludedInStatisticsChange) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?ChangeIncludedInStatisticsChange + */ + protected function mapper() + { + return function (?int $index): ?ChangeIncludedInStatisticsChange { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var ChangeIncludedInStatisticsChange $data */ + $data = ChangeIncludedInStatisticsChangeModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-history/src/Models/Change/ChangeIncludedInStatisticsChangeModel.php b/lib/commercetools-history/src/Models/Change/ChangeIncludedInStatisticsChangeModel.php new file mode 100644 index 00000000000..ae1d1abc566 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/ChangeIncludedInStatisticsChangeModel.php @@ -0,0 +1,167 @@ +change = $change; + $this->previousValue = $previousValue; + $this->nextValue = $nextValue; + $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; + } + + /** + * + * @return null|string + */ + public function getChange() + { + if (is_null($this->change)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CHANGE); + if (is_null($data)) { + return null; + } + $this->change = (string) $data; + } + + return $this->change; + } + + /** + *Value before the change.
+ * + * + * @return null|bool + */ + public function getPreviousValue() + { + if (is_null($this->previousValue)) { + /** @psalm-var ?bool $data */ + $data = $this->raw(self::FIELD_PREVIOUS_VALUE); + if (is_null($data)) { + return null; + } + $this->previousValue = (bool) $data; + } + + return $this->previousValue; + } + + /** + *Value after the change.
+ * + * + * @return null|bool + */ + public function getNextValue() + { + if (is_null($this->nextValue)) { + /** @psalm-var ?bool $data */ + $data = $this->raw(self::FIELD_NEXT_VALUE); + if (is_null($data)) { + return null; + } + $this->nextValue = (bool) $data; + } + + return $this->nextValue; + } + + + /** + * @param ?string $change + */ + public function setChange(?string $change): void + { + $this->change = $change; + } + + /** + * @param ?bool $previousValue + */ + public function setPreviousValue(?bool $previousValue): void + { + $this->previousValue = $previousValue; + } + + /** + * @param ?bool $nextValue + */ + public function setNextValue(?bool $nextValue): void + { + $this->nextValue = $nextValue; + } + + + +} diff --git a/lib/commercetools-history/src/Models/Change/ChangeLastVariantIdChange.php b/lib/commercetools-history/src/Models/Change/ChangeLastVariantIdChange.php new file mode 100644 index 00000000000..19d53199f75 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/ChangeLastVariantIdChange.php @@ -0,0 +1,62 @@ +Value before the change. + * + + * @return null|int + */ + public function getPreviousValue(); + + /** + *Value after the change.
+ * + + * @return null|int + */ + public function getNextValue(); + + /** + * @param ?string $change + */ + public function setChange(?string $change): void; + + /** + * @param ?int $previousValue + */ + public function setPreviousValue(?int $previousValue): void; + + /** + * @param ?int $nextValue + */ + public function setNextValue(?int $nextValue): void; +} diff --git a/lib/commercetools-history/src/Models/Change/ChangeLastVariantIdChangeBuilder.php b/lib/commercetools-history/src/Models/Change/ChangeLastVariantIdChangeBuilder.php new file mode 100644 index 00000000000..f4b3869652c --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/ChangeLastVariantIdChangeBuilder.php @@ -0,0 +1,119 @@ + + */ +final class ChangeLastVariantIdChangeBuilder implements Builder +{ + /** + + * @var ?string + */ + private $change; + + /** + + * @var ?int + */ + private $previousValue; + + /** + + * @var ?int + */ + private $nextValue; + + /** + + * @return null|string + */ + public function getChange() + { + return $this->change; + } + + /** + *Value before the change.
+ * + + * @return null|int + */ + public function getPreviousValue() + { + return $this->previousValue; + } + + /** + *Value after the change.
+ * + + * @return null|int + */ + public function getNextValue() + { + return $this->nextValue; + } + + /** + * @param ?string $change + * @return $this + */ + public function withChange(?string $change) + { + $this->change = $change; + + return $this; + } + + /** + * @param ?int $previousValue + * @return $this + */ + public function withPreviousValue(?int $previousValue) + { + $this->previousValue = $previousValue; + + return $this; + } + + /** + * @param ?int $nextValue + * @return $this + */ + public function withNextValue(?int $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + + public function build(): ChangeLastVariantIdChange + { + return new ChangeLastVariantIdChangeModel( + $this->change, + $this->previousValue, + $this->nextValue + ); + } + + public static function of(): ChangeLastVariantIdChangeBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-history/src/Models/Change/ChangeLastVariantIdChangeCollection.php b/lib/commercetools-history/src/Models/Change/ChangeLastVariantIdChangeCollection.php new file mode 100644 index 00000000000..c25927f7af3 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/ChangeLastVariantIdChangeCollection.php @@ -0,0 +1,56 @@ + + * @method ChangeLastVariantIdChange current() + * @method ChangeLastVariantIdChange end() + * @method ChangeLastVariantIdChange at($offset) + */ +class ChangeLastVariantIdChangeCollection extends ChangeCollection +{ + /** + * @psalm-assert ChangeLastVariantIdChange $value + * @psalm-param ChangeLastVariantIdChange|stdClass $value + * @throws InvalidArgumentException + * + * @return ChangeLastVariantIdChangeCollection + */ + public function add($value) + { + if (!$value instanceof ChangeLastVariantIdChange) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?ChangeLastVariantIdChange + */ + protected function mapper() + { + return function (?int $index): ?ChangeLastVariantIdChange { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var ChangeLastVariantIdChange $data */ + $data = ChangeLastVariantIdChangeModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-history/src/Models/Change/ChangeLastVariantIdChangeModel.php b/lib/commercetools-history/src/Models/Change/ChangeLastVariantIdChangeModel.php new file mode 100644 index 00000000000..1375fad69f6 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/ChangeLastVariantIdChangeModel.php @@ -0,0 +1,167 @@ +change = $change; + $this->previousValue = $previousValue; + $this->nextValue = $nextValue; + $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; + } + + /** + * + * @return null|string + */ + public function getChange() + { + if (is_null($this->change)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CHANGE); + if (is_null($data)) { + return null; + } + $this->change = (string) $data; + } + + return $this->change; + } + + /** + *Value before the change.
+ * + * + * @return null|int + */ + public function getPreviousValue() + { + if (is_null($this->previousValue)) { + /** @psalm-var ?int $data */ + $data = $this->raw(self::FIELD_PREVIOUS_VALUE); + if (is_null($data)) { + return null; + } + $this->previousValue = (int) $data; + } + + return $this->previousValue; + } + + /** + *Value after the change.
+ * + * + * @return null|int + */ + public function getNextValue() + { + if (is_null($this->nextValue)) { + /** @psalm-var ?int $data */ + $data = $this->raw(self::FIELD_NEXT_VALUE); + if (is_null($data)) { + return null; + } + $this->nextValue = (int) $data; + } + + return $this->nextValue; + } + + + /** + * @param ?string $change + */ + public function setChange(?string $change): void + { + $this->change = $change; + } + + /** + * @param ?int $previousValue + */ + public function setPreviousValue(?int $previousValue): void + { + $this->previousValue = $previousValue; + } + + /** + * @param ?int $nextValue + */ + public function setNextValue(?int $nextValue): void + { + $this->nextValue = $nextValue; + } + + + +} diff --git a/lib/commercetools-history/src/Models/Change/ChangeLineItemNameChange.php b/lib/commercetools-history/src/Models/Change/ChangeLineItemNameChange.php new file mode 100644 index 00000000000..1a69a40c59c --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/ChangeLineItemNameChange.php @@ -0,0 +1,78 @@ +Holds information about the updated Shopping List Line Item. + * + + * @return null|ShoppingListLineItemValue + */ + public function getLineItem(); + + /** + *Value before the change.
+ * + + * @return null|LocalizedString + */ + public function getPreviousValue(); + + /** + *Value after the change.
+ * + + * @return null|LocalizedString + */ + public function getNextValue(); + + /** + * @param ?string $change + */ + public function setChange(?string $change): void; + + /** + * @param ?ShoppingListLineItemValue $lineItem + */ + public function setLineItem(?ShoppingListLineItemValue $lineItem): void; + + /** + * @param ?LocalizedString $previousValue + */ + public function setPreviousValue(?LocalizedString $previousValue): void; + + /** + * @param ?LocalizedString $nextValue + */ + public function setNextValue(?LocalizedString $nextValue): void; +} diff --git a/lib/commercetools-history/src/Models/Change/ChangeLineItemNameChangeBuilder.php b/lib/commercetools-history/src/Models/Change/ChangeLineItemNameChangeBuilder.php new file mode 100644 index 00000000000..d9c0450e89d --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/ChangeLineItemNameChangeBuilder.php @@ -0,0 +1,184 @@ + + */ +final class ChangeLineItemNameChangeBuilder implements Builder +{ + /** + + * @var ?string + */ + private $change; + + /** + + * @var null|ShoppingListLineItemValue|ShoppingListLineItemValueBuilder + */ + private $lineItem; + + /** + + * @var null|LocalizedString|LocalizedStringBuilder + */ + private $previousValue; + + /** + + * @var null|LocalizedString|LocalizedStringBuilder + */ + private $nextValue; + + /** + + * @return null|string + */ + public function getChange() + { + return $this->change; + } + + /** + *Holds information about the updated Shopping List Line Item.
+ * + + * @return null|ShoppingListLineItemValue + */ + public function getLineItem() + { + return $this->lineItem instanceof ShoppingListLineItemValueBuilder ? $this->lineItem->build() : $this->lineItem; + } + + /** + *Value before the change.
+ * + + * @return null|LocalizedString + */ + public function getPreviousValue() + { + return $this->previousValue instanceof LocalizedStringBuilder ? $this->previousValue->build() : $this->previousValue; + } + + /** + *Value after the change.
+ * + + * @return null|LocalizedString + */ + public function getNextValue() + { + return $this->nextValue instanceof LocalizedStringBuilder ? $this->nextValue->build() : $this->nextValue; + } + + /** + * @param ?string $change + * @return $this + */ + public function withChange(?string $change) + { + $this->change = $change; + + return $this; + } + + /** + * @param ?ShoppingListLineItemValue $lineItem + * @return $this + */ + public function withLineItem(?ShoppingListLineItemValue $lineItem) + { + $this->lineItem = $lineItem; + + return $this; + } + + /** + * @param ?LocalizedString $previousValue + * @return $this + */ + public function withPreviousValue(?LocalizedString $previousValue) + { + $this->previousValue = $previousValue; + + return $this; + } + + /** + * @param ?LocalizedString $nextValue + * @return $this + */ + public function withNextValue(?LocalizedString $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + /** + * @deprecated use withLineItem() instead + * @return $this + */ + public function withLineItemBuilder(?ShoppingListLineItemValueBuilder $lineItem) + { + $this->lineItem = $lineItem; + + return $this; + } + + /** + * @deprecated use withPreviousValue() instead + * @return $this + */ + public function withPreviousValueBuilder(?LocalizedStringBuilder $previousValue) + { + $this->previousValue = $previousValue; + + return $this; + } + + /** + * @deprecated use withNextValue() instead + * @return $this + */ + public function withNextValueBuilder(?LocalizedStringBuilder $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + public function build(): ChangeLineItemNameChange + { + return new ChangeLineItemNameChangeModel( + $this->change, + $this->lineItem instanceof ShoppingListLineItemValueBuilder ? $this->lineItem->build() : $this->lineItem, + $this->previousValue instanceof LocalizedStringBuilder ? $this->previousValue->build() : $this->previousValue, + $this->nextValue instanceof LocalizedStringBuilder ? $this->nextValue->build() : $this->nextValue + ); + } + + public static function of(): ChangeLineItemNameChangeBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-history/src/Models/Change/ChangeLineItemNameChangeCollection.php b/lib/commercetools-history/src/Models/Change/ChangeLineItemNameChangeCollection.php new file mode 100644 index 00000000000..1ceff8214a8 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/ChangeLineItemNameChangeCollection.php @@ -0,0 +1,56 @@ + + * @method ChangeLineItemNameChange current() + * @method ChangeLineItemNameChange end() + * @method ChangeLineItemNameChange at($offset) + */ +class ChangeLineItemNameChangeCollection extends ChangeCollection +{ + /** + * @psalm-assert ChangeLineItemNameChange $value + * @psalm-param ChangeLineItemNameChange|stdClass $value + * @throws InvalidArgumentException + * + * @return ChangeLineItemNameChangeCollection + */ + public function add($value) + { + if (!$value instanceof ChangeLineItemNameChange) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?ChangeLineItemNameChange + */ + protected function mapper() + { + return function (?int $index): ?ChangeLineItemNameChange { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var ChangeLineItemNameChange $data */ + $data = ChangeLineItemNameChangeModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-history/src/Models/Change/ChangeLineItemNameChangeModel.php b/lib/commercetools-history/src/Models/Change/ChangeLineItemNameChangeModel.php new file mode 100644 index 00000000000..c22848d65c0 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/ChangeLineItemNameChangeModel.php @@ -0,0 +1,210 @@ +change = $change; + $this->lineItem = $lineItem; + $this->previousValue = $previousValue; + $this->nextValue = $nextValue; + $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; + } + + /** + * + * @return null|string + */ + public function getChange() + { + if (is_null($this->change)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CHANGE); + if (is_null($data)) { + return null; + } + $this->change = (string) $data; + } + + return $this->change; + } + + /** + *Holds information about the updated Shopping List Line Item.
+ * + * + * @return null|ShoppingListLineItemValue + */ + public function getLineItem() + { + if (is_null($this->lineItem)) { + /** @psalm-var stdClass|arrayValue before the change.
+ * + * + * @return null|LocalizedString + */ + public function getPreviousValue() + { + if (is_null($this->previousValue)) { + /** @psalm-var stdClass|arrayValue after the change.
+ * + * + * @return null|LocalizedString + */ + public function getNextValue() + { + if (is_null($this->nextValue)) { + /** @psalm-var stdClass|arrayValue before the change.
+ * + + * @return null|bool + */ + public function getPreviousValue(); + + /** + *Value after the change.
+ * + + * @return null|bool + */ + public function getNextValue(); + + /** + * @param ?string $change + */ + public function setChange(?string $change): void; + + /** + * @param ?ShoppingListLineItemValue $lineItem + */ + public function setLineItem(?ShoppingListLineItemValue $lineItem): void; + + /** + * @param ?bool $previousValue + */ + public function setPreviousValue(?bool $previousValue): void; + + /** + * @param ?bool $nextValue + */ + public function setNextValue(?bool $nextValue): void; +} diff --git a/lib/commercetools-history/src/Models/Change/ChangeLineItemPublishedChangeBuilder.php b/lib/commercetools-history/src/Models/Change/ChangeLineItemPublishedChangeBuilder.php new file mode 100644 index 00000000000..db8ca80dce3 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/ChangeLineItemPublishedChangeBuilder.php @@ -0,0 +1,160 @@ + + */ +final class ChangeLineItemPublishedChangeBuilder implements Builder +{ + /** + + * @var ?string + */ + private $change; + + /** + + * @var null|ShoppingListLineItemValue|ShoppingListLineItemValueBuilder + */ + private $lineItem; + + /** + + * @var ?bool + */ + private $previousValue; + + /** + + * @var ?bool + */ + private $nextValue; + + /** + + * @return null|string + */ + public function getChange() + { + return $this->change; + } + + /** + *Holds information about the updated Shopping List Line Item.
+ * + + * @return null|ShoppingListLineItemValue + */ + public function getLineItem() + { + return $this->lineItem instanceof ShoppingListLineItemValueBuilder ? $this->lineItem->build() : $this->lineItem; + } + + /** + *Value before the change.
+ * + + * @return null|bool + */ + public function getPreviousValue() + { + return $this->previousValue; + } + + /** + *Value after the change.
+ * + + * @return null|bool + */ + public function getNextValue() + { + return $this->nextValue; + } + + /** + * @param ?string $change + * @return $this + */ + public function withChange(?string $change) + { + $this->change = $change; + + return $this; + } + + /** + * @param ?ShoppingListLineItemValue $lineItem + * @return $this + */ + public function withLineItem(?ShoppingListLineItemValue $lineItem) + { + $this->lineItem = $lineItem; + + return $this; + } + + /** + * @param ?bool $previousValue + * @return $this + */ + public function withPreviousValue(?bool $previousValue) + { + $this->previousValue = $previousValue; + + return $this; + } + + /** + * @param ?bool $nextValue + * @return $this + */ + public function withNextValue(?bool $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + /** + * @deprecated use withLineItem() instead + * @return $this + */ + public function withLineItemBuilder(?ShoppingListLineItemValueBuilder $lineItem) + { + $this->lineItem = $lineItem; + + return $this; + } + + public function build(): ChangeLineItemPublishedChange + { + return new ChangeLineItemPublishedChangeModel( + $this->change, + $this->lineItem instanceof ShoppingListLineItemValueBuilder ? $this->lineItem->build() : $this->lineItem, + $this->previousValue, + $this->nextValue + ); + } + + public static function of(): ChangeLineItemPublishedChangeBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-history/src/Models/Change/ChangeLineItemPublishedChangeCollection.php b/lib/commercetools-history/src/Models/Change/ChangeLineItemPublishedChangeCollection.php new file mode 100644 index 00000000000..4653d043d8c --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/ChangeLineItemPublishedChangeCollection.php @@ -0,0 +1,56 @@ + + * @method ChangeLineItemPublishedChange current() + * @method ChangeLineItemPublishedChange end() + * @method ChangeLineItemPublishedChange at($offset) + */ +class ChangeLineItemPublishedChangeCollection extends ChangeCollection +{ + /** + * @psalm-assert ChangeLineItemPublishedChange $value + * @psalm-param ChangeLineItemPublishedChange|stdClass $value + * @throws InvalidArgumentException + * + * @return ChangeLineItemPublishedChangeCollection + */ + public function add($value) + { + if (!$value instanceof ChangeLineItemPublishedChange) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?ChangeLineItemPublishedChange + */ + protected function mapper() + { + return function (?int $index): ?ChangeLineItemPublishedChange { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var ChangeLineItemPublishedChange $data */ + $data = ChangeLineItemPublishedChangeModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-history/src/Models/Change/ChangeLineItemPublishedChangeModel.php b/lib/commercetools-history/src/Models/Change/ChangeLineItemPublishedChangeModel.php new file mode 100644 index 00000000000..59440287250 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/ChangeLineItemPublishedChangeModel.php @@ -0,0 +1,206 @@ +change = $change; + $this->lineItem = $lineItem; + $this->previousValue = $previousValue; + $this->nextValue = $nextValue; + $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; + } + + /** + * + * @return null|string + */ + public function getChange() + { + if (is_null($this->change)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CHANGE); + if (is_null($data)) { + return null; + } + $this->change = (string) $data; + } + + return $this->change; + } + + /** + *Holds information about the updated Shopping List Line Item.
+ * + * + * @return null|ShoppingListLineItemValue + */ + public function getLineItem() + { + if (is_null($this->lineItem)) { + /** @psalm-var stdClass|arrayValue before the change.
+ * + * + * @return null|bool + */ + public function getPreviousValue() + { + if (is_null($this->previousValue)) { + /** @psalm-var ?bool $data */ + $data = $this->raw(self::FIELD_PREVIOUS_VALUE); + if (is_null($data)) { + return null; + } + $this->previousValue = (bool) $data; + } + + return $this->previousValue; + } + + /** + *Value after the change.
+ * + * + * @return null|bool + */ + public function getNextValue() + { + if (is_null($this->nextValue)) { + /** @psalm-var ?bool $data */ + $data = $this->raw(self::FIELD_NEXT_VALUE); + if (is_null($data)) { + return null; + } + $this->nextValue = (bool) $data; + } + + return $this->nextValue; + } + + + /** + * @param ?string $change + */ + public function setChange(?string $change): void + { + $this->change = $change; + } + + /** + * @param ?ShoppingListLineItemValue $lineItem + */ + public function setLineItem(?ShoppingListLineItemValue $lineItem): void + { + $this->lineItem = $lineItem; + } + + /** + * @param ?bool $previousValue + */ + public function setPreviousValue(?bool $previousValue): void + { + $this->previousValue = $previousValue; + } + + /** + * @param ?bool $nextValue + */ + public function setNextValue(?bool $nextValue): void + { + $this->nextValue = $nextValue; + } + + + +} diff --git a/lib/commercetools-history/src/Models/Change/ChangeLocalizedEnumValueOrderChange.php b/lib/commercetools-history/src/Models/Change/ChangeLocalizedEnumValueOrderChange.php index c8a830dbfab..b4c146bcdad 100644 --- a/lib/commercetools-history/src/Models/Change/ChangeLocalizedEnumValueOrderChange.php +++ b/lib/commercetools-history/src/Models/Change/ChangeLocalizedEnumValueOrderChange.php @@ -10,7 +10,7 @@ use Commercetools\Base\JsonObject; use Commercetools\Base\DateTimeImmutableCollection; -use Commercetools\History\Models\ChangeValue\LocalizedEnumValueCollection; +use Commercetools\History\Models\Common\AttributeLocalizedEnumValueCollection; interface ChangeLocalizedEnumValueOrderChange extends Change { @@ -36,7 +36,7 @@ public function getChange(); *Value before the change.
* - * @return null|LocalizedEnumValueCollection + * @return null|AttributeLocalizedEnumValueCollection */ public function getPreviousValue(); @@ -44,7 +44,7 @@ public function getPreviousValue(); *Value after the change.
* - * @return null|LocalizedEnumValueCollection + * @return null|AttributeLocalizedEnumValueCollection */ public function getNextValue(); @@ -70,14 +70,14 @@ public function getAttributeName(); public function setChange(?string $change): void; /** - * @param ?LocalizedEnumValueCollection $previousValue + * @param ?AttributeLocalizedEnumValueCollection $previousValue */ - public function setPreviousValue(?LocalizedEnumValueCollection $previousValue): void; + public function setPreviousValue(?AttributeLocalizedEnumValueCollection $previousValue): void; /** - * @param ?LocalizedEnumValueCollection $nextValue + * @param ?AttributeLocalizedEnumValueCollection $nextValue */ - public function setNextValue(?LocalizedEnumValueCollection $nextValue): void; + public function setNextValue(?AttributeLocalizedEnumValueCollection $nextValue): void; /** * @param ?string $fieldName diff --git a/lib/commercetools-history/src/Models/Change/ChangeLocalizedEnumValueOrderChangeBuilder.php b/lib/commercetools-history/src/Models/Change/ChangeLocalizedEnumValueOrderChangeBuilder.php index 113b54d49f4..d94a977e3eb 100644 --- a/lib/commercetools-history/src/Models/Change/ChangeLocalizedEnumValueOrderChangeBuilder.php +++ b/lib/commercetools-history/src/Models/Change/ChangeLocalizedEnumValueOrderChangeBuilder.php @@ -14,7 +14,7 @@ use Commercetools\Base\JsonObjectModel; use Commercetools\Base\MapperFactory; use stdClass; -use Commercetools\History\Models\ChangeValue\LocalizedEnumValueCollection; +use Commercetools\History\Models\Common\AttributeLocalizedEnumValueCollection; /** * @implements BuilderValue before the change.
* - * @return null|LocalizedEnumValueCollection + * @return null|AttributeLocalizedEnumValueCollection */ public function getPreviousValue() { @@ -75,7 +75,7 @@ public function getPreviousValue() *Value after the change.
* - * @return null|LocalizedEnumValueCollection + * @return null|AttributeLocalizedEnumValueCollection */ public function getNextValue() { @@ -116,10 +116,10 @@ public function withChange(?string $change) } /** - * @param ?LocalizedEnumValueCollection $previousValue + * @param ?AttributeLocalizedEnumValueCollection $previousValue * @return $this */ - public function withPreviousValue(?LocalizedEnumValueCollection $previousValue) + public function withPreviousValue(?AttributeLocalizedEnumValueCollection $previousValue) { $this->previousValue = $previousValue; @@ -127,10 +127,10 @@ public function withPreviousValue(?LocalizedEnumValueCollection $previousValue) } /** - * @param ?LocalizedEnumValueCollection $nextValue + * @param ?AttributeLocalizedEnumValueCollection $nextValue * @return $this */ - public function withNextValue(?LocalizedEnumValueCollection $nextValue) + public function withNextValue(?AttributeLocalizedEnumValueCollection $nextValue) { $this->nextValue = $nextValue; diff --git a/lib/commercetools-history/src/Models/Change/ChangeLocalizedEnumValueOrderChangeModel.php b/lib/commercetools-history/src/Models/Change/ChangeLocalizedEnumValueOrderChangeModel.php index 4f179684520..e1a3c485086 100644 --- a/lib/commercetools-history/src/Models/Change/ChangeLocalizedEnumValueOrderChangeModel.php +++ b/lib/commercetools-history/src/Models/Change/ChangeLocalizedEnumValueOrderChangeModel.php @@ -13,7 +13,7 @@ use Commercetools\Base\JsonObjectModel; use Commercetools\Base\MapperFactory; use stdClass; -use Commercetools\History\Models\ChangeValue\LocalizedEnumValueCollection; +use Commercetools\History\Models\Common\AttributeLocalizedEnumValueCollection; /** * @internal @@ -36,13 +36,13 @@ final class ChangeLocalizedEnumValueOrderChangeModel extends JsonObjectModel imp /** * - * @var ?LocalizedEnumValueCollection + * @var ?AttributeLocalizedEnumValueCollection */ protected $previousValue; /** * - * @var ?LocalizedEnumValueCollection + * @var ?AttributeLocalizedEnumValueCollection */ protected $nextValue; @@ -64,8 +64,8 @@ final class ChangeLocalizedEnumValueOrderChangeModel extends JsonObjectModel imp */ public function __construct( ?string $change = null, - ?LocalizedEnumValueCollection $previousValue = null, - ?LocalizedEnumValueCollection $nextValue = null, + ?AttributeLocalizedEnumValueCollection $previousValue = null, + ?AttributeLocalizedEnumValueCollection $nextValue = null, ?string $fieldName = null, ?string $attributeName = null, ?string $type = null @@ -118,7 +118,7 @@ public function getChange() *Value before the change.
* * - * @return null|LocalizedEnumValueCollection + * @return null|AttributeLocalizedEnumValueCollection */ public function getPreviousValue() { @@ -128,7 +128,7 @@ public function getPreviousValue() if (is_null($data)) { return null; } - $this->previousValue = LocalizedEnumValueCollection::fromArray($data); + $this->previousValue = AttributeLocalizedEnumValueCollection::fromArray($data); } return $this->previousValue; @@ -138,7 +138,7 @@ public function getPreviousValue() *Value after the change.
* * - * @return null|LocalizedEnumValueCollection + * @return null|AttributeLocalizedEnumValueCollection */ public function getNextValue() { @@ -148,7 +148,7 @@ public function getNextValue() if (is_null($data)) { return null; } - $this->nextValue = LocalizedEnumValueCollection::fromArray($data); + $this->nextValue = AttributeLocalizedEnumValueCollection::fromArray($data); } return $this->nextValue; @@ -204,17 +204,17 @@ public function setChange(?string $change): void } /** - * @param ?LocalizedEnumValueCollection $previousValue + * @param ?AttributeLocalizedEnumValueCollection $previousValue */ - public function setPreviousValue(?LocalizedEnumValueCollection $previousValue): void + public function setPreviousValue(?AttributeLocalizedEnumValueCollection $previousValue): void { $this->previousValue = $previousValue; } /** - * @param ?LocalizedEnumValueCollection $nextValue + * @param ?AttributeLocalizedEnumValueCollection $nextValue */ - public function setNextValue(?LocalizedEnumValueCollection $nextValue): void + public function setNextValue(?AttributeLocalizedEnumValueCollection $nextValue): void { $this->nextValue = $nextValue; } diff --git a/lib/commercetools-history/src/Models/Change/ChangeMasterVariantChange.php b/lib/commercetools-history/src/Models/Change/ChangeMasterVariantChange.php index 34b5723ebb1..e1dfcf26ab3 100644 --- a/lib/commercetools-history/src/Models/Change/ChangeMasterVariantChange.php +++ b/lib/commercetools-history/src/Models/Change/ChangeMasterVariantChange.php @@ -48,6 +48,7 @@ public function getPreviousValue(); public function getNextValue(); /** + *Product data that was updated.
*staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Product data that was updated.
*staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Product data that was updated.
*staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Value before the change.
* - * @return null|EnumValueCollection + * @return null|AttributePlainEnumValueCollection */ public function getPreviousValue(); @@ -43,7 +43,7 @@ public function getPreviousValue(); *Value after the change.
* - * @return null|EnumValueCollection + * @return null|AttributePlainEnumValueCollection */ public function getNextValue(); @@ -61,14 +61,14 @@ public function getAttributeName(); public function setChange(?string $change): void; /** - * @param ?EnumValueCollection $previousValue + * @param ?AttributePlainEnumValueCollection $previousValue */ - public function setPreviousValue(?EnumValueCollection $previousValue): void; + public function setPreviousValue(?AttributePlainEnumValueCollection $previousValue): void; /** - * @param ?EnumValueCollection $nextValue + * @param ?AttributePlainEnumValueCollection $nextValue */ - public function setNextValue(?EnumValueCollection $nextValue): void; + public function setNextValue(?AttributePlainEnumValueCollection $nextValue): void; /** * @param ?string $attributeName diff --git a/lib/commercetools-history/src/Models/Change/ChangePlainEnumValueOrderChangeBuilder.php b/lib/commercetools-history/src/Models/Change/ChangePlainEnumValueOrderChangeBuilder.php index 927cd4bd555..4db0d7b3b85 100644 --- a/lib/commercetools-history/src/Models/Change/ChangePlainEnumValueOrderChangeBuilder.php +++ b/lib/commercetools-history/src/Models/Change/ChangePlainEnumValueOrderChangeBuilder.php @@ -14,7 +14,7 @@ use Commercetools\Base\JsonObjectModel; use Commercetools\Base\MapperFactory; use stdClass; -use Commercetools\History\Models\ChangeValue\EnumValueCollection; +use Commercetools\History\Models\Common\AttributePlainEnumValueCollection; /** * @implements BuilderValue before the change.
* - * @return null|EnumValueCollection + * @return null|AttributePlainEnumValueCollection */ public function getPreviousValue() { @@ -69,7 +69,7 @@ public function getPreviousValue() *Value after the change.
* - * @return null|EnumValueCollection + * @return null|AttributePlainEnumValueCollection */ public function getNextValue() { @@ -99,10 +99,10 @@ public function withChange(?string $change) } /** - * @param ?EnumValueCollection $previousValue + * @param ?AttributePlainEnumValueCollection $previousValue * @return $this */ - public function withPreviousValue(?EnumValueCollection $previousValue) + public function withPreviousValue(?AttributePlainEnumValueCollection $previousValue) { $this->previousValue = $previousValue; @@ -110,10 +110,10 @@ public function withPreviousValue(?EnumValueCollection $previousValue) } /** - * @param ?EnumValueCollection $nextValue + * @param ?AttributePlainEnumValueCollection $nextValue * @return $this */ - public function withNextValue(?EnumValueCollection $nextValue) + public function withNextValue(?AttributePlainEnumValueCollection $nextValue) { $this->nextValue = $nextValue; diff --git a/lib/commercetools-history/src/Models/Change/ChangePlainEnumValueOrderChangeModel.php b/lib/commercetools-history/src/Models/Change/ChangePlainEnumValueOrderChangeModel.php index 350de4ac9bd..b156dc7f628 100644 --- a/lib/commercetools-history/src/Models/Change/ChangePlainEnumValueOrderChangeModel.php +++ b/lib/commercetools-history/src/Models/Change/ChangePlainEnumValueOrderChangeModel.php @@ -13,7 +13,7 @@ use Commercetools\Base\JsonObjectModel; use Commercetools\Base\MapperFactory; use stdClass; -use Commercetools\History\Models\ChangeValue\EnumValueCollection; +use Commercetools\History\Models\Common\AttributePlainEnumValueCollection; /** * @internal @@ -36,13 +36,13 @@ final class ChangePlainEnumValueOrderChangeModel extends JsonObjectModel impleme /** * - * @var ?EnumValueCollection + * @var ?AttributePlainEnumValueCollection */ protected $previousValue; /** * - * @var ?EnumValueCollection + * @var ?AttributePlainEnumValueCollection */ protected $nextValue; @@ -58,8 +58,8 @@ final class ChangePlainEnumValueOrderChangeModel extends JsonObjectModel impleme */ public function __construct( ?string $change = null, - ?EnumValueCollection $previousValue = null, - ?EnumValueCollection $nextValue = null, + ?AttributePlainEnumValueCollection $previousValue = null, + ?AttributePlainEnumValueCollection $nextValue = null, ?string $attributeName = null, ?string $type = null ) { @@ -110,7 +110,7 @@ public function getChange() *Value before the change.
* * - * @return null|EnumValueCollection + * @return null|AttributePlainEnumValueCollection */ public function getPreviousValue() { @@ -120,7 +120,7 @@ public function getPreviousValue() if (is_null($data)) { return null; } - $this->previousValue = EnumValueCollection::fromArray($data); + $this->previousValue = AttributePlainEnumValueCollection::fromArray($data); } return $this->previousValue; @@ -130,7 +130,7 @@ public function getPreviousValue() *Value after the change.
* * - * @return null|EnumValueCollection + * @return null|AttributePlainEnumValueCollection */ public function getNextValue() { @@ -140,7 +140,7 @@ public function getNextValue() if (is_null($data)) { return null; } - $this->nextValue = EnumValueCollection::fromArray($data); + $this->nextValue = AttributePlainEnumValueCollection::fromArray($data); } return $this->nextValue; @@ -176,17 +176,17 @@ public function setChange(?string $change): void } /** - * @param ?EnumValueCollection $previousValue + * @param ?AttributePlainEnumValueCollection $previousValue */ - public function setPreviousValue(?EnumValueCollection $previousValue): void + public function setPreviousValue(?AttributePlainEnumValueCollection $previousValue): void { $this->previousValue = $previousValue; } /** - * @param ?EnumValueCollection $nextValue + * @param ?AttributePlainEnumValueCollection $nextValue */ - public function setNextValue(?EnumValueCollection $nextValue): void + public function setNextValue(?AttributePlainEnumValueCollection $nextValue): void { $this->nextValue = $nextValue; } diff --git a/lib/commercetools-history/src/Models/Change/ChangePriceChange.php b/lib/commercetools-history/src/Models/Change/ChangePriceChange.php index 30119f5272b..bb586aad801 100644 --- a/lib/commercetools-history/src/Models/Change/ChangePriceChange.php +++ b/lib/commercetools-history/src/Models/Change/ChangePriceChange.php @@ -19,6 +19,7 @@ interface ChangePriceChange extends Change public const FIELD_NEXT_VALUE = 'nextValue'; public const FIELD_CATALOG_DATA = 'catalogData'; public const FIELD_PRICE_ID = 'priceId'; + public const FIELD_VARIANT = 'variant'; /** @@ -49,6 +50,7 @@ public function getPreviousValue(); public function getNextValue(); /** + *Product data that was updated.
*staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + + * @return null|string + */ + public function getVariant(); + /** * @param ?string $change */ @@ -91,4 +102,9 @@ public function setCatalogData(?string $catalogData): void; * @param ?string $priceId */ public function setPriceId(?string $priceId): void; + + /** + * @param ?string $variant + */ + public function setVariant(?string $variant): void; } diff --git a/lib/commercetools-history/src/Models/Change/ChangePriceChangeBuilder.php b/lib/commercetools-history/src/Models/Change/ChangePriceChangeBuilder.php index 3c564997615..d387f290fe7 100644 --- a/lib/commercetools-history/src/Models/Change/ChangePriceChangeBuilder.php +++ b/lib/commercetools-history/src/Models/Change/ChangePriceChangeBuilder.php @@ -52,6 +52,12 @@ final class ChangePriceChangeBuilder implements Builder */ private $priceId; + /** + + * @var ?string + */ + private $variant; + /** * @return null|string @@ -84,6 +90,7 @@ public function getNextValue() } /** + *Product data that was updated.
*staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + + * @return null|string + */ + public function getVariant() + { + return $this->variant; + } + /** * @param ?string $change * @return $this @@ -163,6 +182,17 @@ public function withPriceId(?string $priceId) return $this; } + /** + * @param ?string $variant + * @return $this + */ + public function withVariant(?string $variant) + { + $this->variant = $variant; + + return $this; + } + /** * @deprecated use withPreviousValue() instead * @return $this @@ -192,7 +222,8 @@ public function build(): ChangePriceChange $this->previousValue instanceof PriceBuilder ? $this->previousValue->build() : $this->previousValue, $this->nextValue instanceof PriceBuilder ? $this->nextValue->build() : $this->nextValue, $this->catalogData, - $this->priceId + $this->priceId, + $this->variant ); } diff --git a/lib/commercetools-history/src/Models/Change/ChangePriceChangeModel.php b/lib/commercetools-history/src/Models/Change/ChangePriceChangeModel.php index 0d10bf681bf..fda164ccbe5 100644 --- a/lib/commercetools-history/src/Models/Change/ChangePriceChangeModel.php +++ b/lib/commercetools-history/src/Models/Change/ChangePriceChangeModel.php @@ -59,6 +59,12 @@ final class ChangePriceChangeModel extends JsonObjectModel implements ChangePric */ protected $priceId; + /** + * + * @var ?string + */ + protected $variant; + /** * @psalm-suppress MissingParamType @@ -69,6 +75,7 @@ public function __construct( ?Price $nextValue = null, ?string $catalogData = null, ?string $priceId = null, + ?string $variant = null, ?string $type = null ) { $this->change = $change; @@ -76,6 +83,7 @@ public function __construct( $this->nextValue = $nextValue; $this->catalogData = $catalogData; $this->priceId = $priceId; + $this->variant = $variant; $this->type = $type ?? self::DISCRIMINATOR_VALUE; } @@ -158,6 +166,7 @@ public function getNextValue() } /** + *Product data that was updated.
*staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + * + * @return null|string + */ + public function getVariant() + { + if (is_null($this->variant)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_VARIANT); + if (is_null($data)) { + return null; + } + $this->variant = (string) $data; + } + + return $this->variant; + } + /** * @param ?string $change @@ -241,6 +271,14 @@ public function setPriceId(?string $priceId): void $this->priceId = $priceId; } + /** + * @param ?string $variant + */ + public function setVariant(?string $variant): void + { + $this->variant = $variant; + } + } diff --git a/lib/commercetools-history/src/Models/Change/ChangePriceRoundingModeChange.php b/lib/commercetools-history/src/Models/Change/ChangePriceRoundingModeChange.php new file mode 100644 index 00000000000..542f5d69e04 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/ChangePriceRoundingModeChange.php @@ -0,0 +1,62 @@ +Value before the change. + * + + * @return null|string + */ + public function getPreviousValue(); + + /** + *Value after the change.
+ * + + * @return null|string + */ + public function getNextValue(); + + /** + * @param ?string $change + */ + public function setChange(?string $change): void; + + /** + * @param ?string $previousValue + */ + public function setPreviousValue(?string $previousValue): void; + + /** + * @param ?string $nextValue + */ + public function setNextValue(?string $nextValue): void; +} diff --git a/lib/commercetools-history/src/Models/Change/ChangePriceRoundingModeChangeBuilder.php b/lib/commercetools-history/src/Models/Change/ChangePriceRoundingModeChangeBuilder.php new file mode 100644 index 00000000000..d1d4f0827e5 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/ChangePriceRoundingModeChangeBuilder.php @@ -0,0 +1,119 @@ + + */ +final class ChangePriceRoundingModeChangeBuilder implements Builder +{ + /** + + * @var ?string + */ + private $change; + + /** + + * @var ?string + */ + private $previousValue; + + /** + + * @var ?string + */ + private $nextValue; + + /** + + * @return null|string + */ + public function getChange() + { + return $this->change; + } + + /** + *Value before the change.
+ * + + * @return null|string + */ + public function getPreviousValue() + { + return $this->previousValue; + } + + /** + *Value after the change.
+ * + + * @return null|string + */ + public function getNextValue() + { + return $this->nextValue; + } + + /** + * @param ?string $change + * @return $this + */ + public function withChange(?string $change) + { + $this->change = $change; + + return $this; + } + + /** + * @param ?string $previousValue + * @return $this + */ + public function withPreviousValue(?string $previousValue) + { + $this->previousValue = $previousValue; + + return $this; + } + + /** + * @param ?string $nextValue + * @return $this + */ + public function withNextValue(?string $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + + public function build(): ChangePriceRoundingModeChange + { + return new ChangePriceRoundingModeChangeModel( + $this->change, + $this->previousValue, + $this->nextValue + ); + } + + public static function of(): ChangePriceRoundingModeChangeBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-history/src/Models/Change/ChangePriceRoundingModeChangeCollection.php b/lib/commercetools-history/src/Models/Change/ChangePriceRoundingModeChangeCollection.php new file mode 100644 index 00000000000..9d498250474 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/ChangePriceRoundingModeChangeCollection.php @@ -0,0 +1,56 @@ + + * @method ChangePriceRoundingModeChange current() + * @method ChangePriceRoundingModeChange end() + * @method ChangePriceRoundingModeChange at($offset) + */ +class ChangePriceRoundingModeChangeCollection extends ChangeCollection +{ + /** + * @psalm-assert ChangePriceRoundingModeChange $value + * @psalm-param ChangePriceRoundingModeChange|stdClass $value + * @throws InvalidArgumentException + * + * @return ChangePriceRoundingModeChangeCollection + */ + public function add($value) + { + if (!$value instanceof ChangePriceRoundingModeChange) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?ChangePriceRoundingModeChange + */ + protected function mapper() + { + return function (?int $index): ?ChangePriceRoundingModeChange { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var ChangePriceRoundingModeChange $data */ + $data = ChangePriceRoundingModeChangeModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-history/src/Models/Change/ChangePriceRoundingModeChangeModel.php b/lib/commercetools-history/src/Models/Change/ChangePriceRoundingModeChangeModel.php new file mode 100644 index 00000000000..96bf2082461 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/ChangePriceRoundingModeChangeModel.php @@ -0,0 +1,167 @@ +change = $change; + $this->previousValue = $previousValue; + $this->nextValue = $nextValue; + $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; + } + + /** + * + * @return null|string + */ + public function getChange() + { + if (is_null($this->change)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CHANGE); + if (is_null($data)) { + return null; + } + $this->change = (string) $data; + } + + return $this->change; + } + + /** + *Value before the change.
+ * + * + * @return null|string + */ + public function getPreviousValue() + { + if (is_null($this->previousValue)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_PREVIOUS_VALUE); + if (is_null($data)) { + return null; + } + $this->previousValue = (string) $data; + } + + return $this->previousValue; + } + + /** + *Value after the change.
+ * + * + * @return null|string + */ + public function getNextValue() + { + if (is_null($this->nextValue)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_NEXT_VALUE); + if (is_null($data)) { + return null; + } + $this->nextValue = (string) $data; + } + + return $this->nextValue; + } + + + /** + * @param ?string $change + */ + public function setChange(?string $change): void + { + $this->change = $change; + } + + /** + * @param ?string $previousValue + */ + public function setPreviousValue(?string $previousValue): void + { + $this->previousValue = $previousValue; + } + + /** + * @param ?string $nextValue + */ + public function setNextValue(?string $nextValue): void + { + $this->nextValue = $nextValue; + } + + + +} diff --git a/lib/commercetools-history/src/Models/Change/ChangeProductSelectionActiveChangeModel.php b/lib/commercetools-history/src/Models/Change/ChangeProductSelectionActiveChangeModel.php index 413100efc03..d7dabdac16c 100644 --- a/lib/commercetools-history/src/Models/Change/ChangeProductSelectionActiveChangeModel.php +++ b/lib/commercetools-history/src/Models/Change/ChangeProductSelectionActiveChangeModel.php @@ -121,8 +121,8 @@ public function getProductSelection() if (is_null($data)) { return null; } - - $this->productSelection = ReferenceModel::of($data); + $className = ReferenceModel::resolveDiscriminatorClass($data); + $this->productSelection = $className::of($data); } return $this->productSelection; diff --git a/lib/commercetools-history/src/Models/Change/ChangeSlugChange.php b/lib/commercetools-history/src/Models/Change/ChangeSlugChange.php index 0e1a4f0e75b..ef750ce32b3 100644 --- a/lib/commercetools-history/src/Models/Change/ChangeSlugChange.php +++ b/lib/commercetools-history/src/Models/Change/ChangeSlugChange.php @@ -17,6 +17,7 @@ interface ChangeSlugChange extends Change public const FIELD_PREVIOUS_VALUE = 'previousValue'; public const FIELD_NEXT_VALUE = 'nextValue'; + public const FIELD_CATALOG_DATA = 'catalogData'; /** @@ -46,6 +47,18 @@ public function getPreviousValue(); */ public function getNextValue(); + /** + *Product data that was updated.
+ *staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Product data that was updated.
+ *staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Product data that was updated.
+ *staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Value after the change.
+ * + + * @return null|KeyReference + */ + public function getNextValue(); + + /** + * @param ?string $change + */ + public function setChange(?string $change): void; + + /** + * @param ?KeyReference $previousValue + */ + public function setPreviousValue(?KeyReference $previousValue): void; + + /** + * @param ?KeyReference $nextValue + */ + public function setNextValue(?KeyReference $nextValue): void; +} diff --git a/lib/commercetools-history/src/Models/Change/ChangeTopLevelUnitChangeBuilder.php b/lib/commercetools-history/src/Models/Change/ChangeTopLevelUnitChangeBuilder.php new file mode 100644 index 00000000000..c543b12cfe9 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/ChangeTopLevelUnitChangeBuilder.php @@ -0,0 +1,142 @@ + + */ +final class ChangeTopLevelUnitChangeBuilder implements Builder +{ + /** + + * @var ?string + */ + private $change; + + /** + + * @var null|KeyReference|KeyReferenceBuilder + */ + private $previousValue; + + /** + + * @var null|KeyReference|KeyReferenceBuilder + */ + private $nextValue; + + /** + + * @return null|string + */ + public function getChange() + { + return $this->change; + } + + /** + *Value before the change.
+ * + + * @return null|KeyReference + */ + public function getPreviousValue() + { + return $this->previousValue instanceof KeyReferenceBuilder ? $this->previousValue->build() : $this->previousValue; + } + + /** + *Value after the change.
+ * + + * @return null|KeyReference + */ + public function getNextValue() + { + return $this->nextValue instanceof KeyReferenceBuilder ? $this->nextValue->build() : $this->nextValue; + } + + /** + * @param ?string $change + * @return $this + */ + public function withChange(?string $change) + { + $this->change = $change; + + return $this; + } + + /** + * @param ?KeyReference $previousValue + * @return $this + */ + public function withPreviousValue(?KeyReference $previousValue) + { + $this->previousValue = $previousValue; + + return $this; + } + + /** + * @param ?KeyReference $nextValue + * @return $this + */ + public function withNextValue(?KeyReference $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + /** + * @deprecated use withPreviousValue() instead + * @return $this + */ + public function withPreviousValueBuilder(?KeyReferenceBuilder $previousValue) + { + $this->previousValue = $previousValue; + + return $this; + } + + /** + * @deprecated use withNextValue() instead + * @return $this + */ + public function withNextValueBuilder(?KeyReferenceBuilder $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + public function build(): ChangeTopLevelUnitChange + { + return new ChangeTopLevelUnitChangeModel( + $this->change, + $this->previousValue instanceof KeyReferenceBuilder ? $this->previousValue->build() : $this->previousValue, + $this->nextValue instanceof KeyReferenceBuilder ? $this->nextValue->build() : $this->nextValue + ); + } + + public static function of(): ChangeTopLevelUnitChangeBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-history/src/Models/Change/ChangeTopLevelUnitChangeCollection.php b/lib/commercetools-history/src/Models/Change/ChangeTopLevelUnitChangeCollection.php new file mode 100644 index 00000000000..49401824252 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/ChangeTopLevelUnitChangeCollection.php @@ -0,0 +1,56 @@ + + * @method ChangeTopLevelUnitChange current() + * @method ChangeTopLevelUnitChange end() + * @method ChangeTopLevelUnitChange at($offset) + */ +class ChangeTopLevelUnitChangeCollection extends ChangeCollection +{ + /** + * @psalm-assert ChangeTopLevelUnitChange $value + * @psalm-param ChangeTopLevelUnitChange|stdClass $value + * @throws InvalidArgumentException + * + * @return ChangeTopLevelUnitChangeCollection + */ + public function add($value) + { + if (!$value instanceof ChangeTopLevelUnitChange) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?ChangeTopLevelUnitChange + */ + protected function mapper() + { + return function (?int $index): ?ChangeTopLevelUnitChange { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var ChangeTopLevelUnitChange $data */ + $data = ChangeTopLevelUnitChangeModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-history/src/Models/Change/ChangeTopLevelUnitChangeModel.php b/lib/commercetools-history/src/Models/Change/ChangeTopLevelUnitChangeModel.php new file mode 100644 index 00000000000..18f15ab75f6 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/ChangeTopLevelUnitChangeModel.php @@ -0,0 +1,171 @@ +change = $change; + $this->previousValue = $previousValue; + $this->nextValue = $nextValue; + $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; + } + + /** + * + * @return null|string + */ + public function getChange() + { + if (is_null($this->change)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CHANGE); + if (is_null($data)) { + return null; + } + $this->change = (string) $data; + } + + return $this->change; + } + + /** + *Value before the change.
+ * + * + * @return null|KeyReference + */ + public function getPreviousValue() + { + if (is_null($this->previousValue)) { + /** @psalm-var stdClass|arrayValue after the change.
+ * + * + * @return null|KeyReference + */ + public function getNextValue() + { + if (is_null($this->nextValue)) { + /** @psalm-var stdClass|arrayIndividualExclusion ProductSelectionMode.
+ *
+
+ * @return null|ProductVariantExclusion
+ */
+ public function getVariantExclusion();
+
+ /**
+ * Value after the change.
+ * + + * @return null|Reference + */ + public function getNextValue(); + + /** + * @param ?string $change + */ + public function setChange(?string $change): void; + + /** + * @param ?ProductVariantExclusion $variantExclusion + */ + public function setVariantExclusion(?ProductVariantExclusion $variantExclusion): void; + + /** + * @param ?Reference $nextValue + */ + public function setNextValue(?Reference $nextValue): void; +} diff --git a/lib/commercetools-history/src/Models/Change/ExcludeProductChangeBuilder.php b/lib/commercetools-history/src/Models/Change/ExcludeProductChangeBuilder.php new file mode 100644 index 00000000000..30f11a22034 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/ExcludeProductChangeBuilder.php @@ -0,0 +1,144 @@ + + */ +final class ExcludeProductChangeBuilder implements Builder +{ + /** + + * @var ?string + */ + private $change; + + /** + + * @var null|ProductVariantExclusion|ProductVariantExclusionBuilder + */ + private $variantExclusion; + + /** + + * @var null|Reference|ReferenceBuilder + */ + private $nextValue; + + /** + + * @return null|string + */ + public function getChange() + { + return $this->change; + } + + /** + *Only Product Variants with the explicitly listed SKUs are part of a Product Selection with IndividualExclusion ProductSelectionMode.
Value after the change.
+ * + + * @return null|Reference + */ + public function getNextValue() + { + return $this->nextValue instanceof ReferenceBuilder ? $this->nextValue->build() : $this->nextValue; + } + + /** + * @param ?string $change + * @return $this + */ + public function withChange(?string $change) + { + $this->change = $change; + + return $this; + } + + /** + * @param ?ProductVariantExclusion $variantExclusion + * @return $this + */ + public function withVariantExclusion(?ProductVariantExclusion $variantExclusion) + { + $this->variantExclusion = $variantExclusion; + + return $this; + } + + /** + * @param ?Reference $nextValue + * @return $this + */ + public function withNextValue(?Reference $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + /** + * @deprecated use withVariantExclusion() instead + * @return $this + */ + public function withVariantExclusionBuilder(?ProductVariantExclusionBuilder $variantExclusion) + { + $this->variantExclusion = $variantExclusion; + + return $this; + } + + /** + * @deprecated use withNextValue() instead + * @return $this + */ + public function withNextValueBuilder(?ReferenceBuilder $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + public function build(): ExcludeProductChange + { + return new ExcludeProductChangeModel( + $this->change, + $this->variantExclusion instanceof ProductVariantExclusionBuilder ? $this->variantExclusion->build() : $this->variantExclusion, + $this->nextValue instanceof ReferenceBuilder ? $this->nextValue->build() : $this->nextValue + ); + } + + public static function of(): ExcludeProductChangeBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-history/src/Models/Change/ExcludeProductChangeCollection.php b/lib/commercetools-history/src/Models/Change/ExcludeProductChangeCollection.php new file mode 100644 index 00000000000..02867e105e9 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/ExcludeProductChangeCollection.php @@ -0,0 +1,56 @@ + + * @method ExcludeProductChange current() + * @method ExcludeProductChange end() + * @method ExcludeProductChange at($offset) + */ +class ExcludeProductChangeCollection extends ChangeCollection +{ + /** + * @psalm-assert ExcludeProductChange $value + * @psalm-param ExcludeProductChange|stdClass $value + * @throws InvalidArgumentException + * + * @return ExcludeProductChangeCollection + */ + public function add($value) + { + if (!$value instanceof ExcludeProductChange) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?ExcludeProductChange + */ + protected function mapper() + { + return function (?int $index): ?ExcludeProductChange { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var ExcludeProductChange $data */ + $data = ExcludeProductChangeModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-history/src/Models/Change/ExcludeProductChangeModel.php b/lib/commercetools-history/src/Models/Change/ExcludeProductChangeModel.php new file mode 100644 index 00000000000..7da0c82d36b --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/ExcludeProductChangeModel.php @@ -0,0 +1,173 @@ +change = $change; + $this->variantExclusion = $variantExclusion; + $this->nextValue = $nextValue; + $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; + } + + /** + * + * @return null|string + */ + public function getChange() + { + if (is_null($this->change)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CHANGE); + if (is_null($data)) { + return null; + } + $this->change = (string) $data; + } + + return $this->change; + } + + /** + *Only Product Variants with the explicitly listed SKUs are part of a Product Selection with IndividualExclusion ProductSelectionMode.
Value after the change.
+ * + * + * @return null|Reference + */ + public function getNextValue() + { + if (is_null($this->nextValue)) { + /** @psalm-var stdClass|arrayProduct data that was updated.
*staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + + * @return null|string + */ + public function getVariant(); + /** * @param ?string $change */ @@ -77,4 +88,9 @@ public function setNextValue(?ImageCollection $nextValue): void; * @param ?string $catalogData */ public function setCatalogData(?string $catalogData): void; + + /** + * @param ?string $variant + */ + public function setVariant(?string $variant): void; } diff --git a/lib/commercetools-history/src/Models/Change/MoveImageToPositionChangeBuilder.php b/lib/commercetools-history/src/Models/Change/MoveImageToPositionChangeBuilder.php index 5617211b0d6..d4a2f7098a5 100644 --- a/lib/commercetools-history/src/Models/Change/MoveImageToPositionChangeBuilder.php +++ b/lib/commercetools-history/src/Models/Change/MoveImageToPositionChangeBuilder.php @@ -45,6 +45,12 @@ final class MoveImageToPositionChangeBuilder implements Builder */ private $catalogData; + /** + + * @var ?string + */ + private $variant; + /** * @return null|string @@ -77,6 +83,7 @@ public function getNextValue() } /** + *Product data that was updated.
*staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + + * @return null|string + */ + public function getVariant() + { + return $this->variant; + } + /** * @param ?string $change * @return $this @@ -134,6 +153,17 @@ public function withCatalogData(?string $catalogData) return $this; } + /** + * @param ?string $variant + * @return $this + */ + public function withVariant(?string $variant) + { + $this->variant = $variant; + + return $this; + } + public function build(): MoveImageToPositionChange { @@ -141,7 +171,8 @@ public function build(): MoveImageToPositionChange $this->change, $this->previousValue, $this->nextValue, - $this->catalogData + $this->catalogData, + $this->variant ); } diff --git a/lib/commercetools-history/src/Models/Change/MoveImageToPositionChangeModel.php b/lib/commercetools-history/src/Models/Change/MoveImageToPositionChangeModel.php index 6aa980528cd..cd28e3482e4 100644 --- a/lib/commercetools-history/src/Models/Change/MoveImageToPositionChangeModel.php +++ b/lib/commercetools-history/src/Models/Change/MoveImageToPositionChangeModel.php @@ -52,6 +52,12 @@ final class MoveImageToPositionChangeModel extends JsonObjectModel implements Mo */ protected $catalogData; + /** + * + * @var ?string + */ + protected $variant; + /** * @psalm-suppress MissingParamType @@ -61,12 +67,14 @@ public function __construct( ?ImageCollection $previousValue = null, ?ImageCollection $nextValue = null, ?string $catalogData = null, + ?string $variant = null, ?string $type = null ) { $this->change = $change; $this->previousValue = $previousValue; $this->nextValue = $nextValue; $this->catalogData = $catalogData; + $this->variant = $variant; $this->type = $type ?? self::DISCRIMINATOR_VALUE; } @@ -147,6 +155,7 @@ public function getNextValue() } /** + *Product data that was updated.
*staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + * + * @return null|string + */ + public function getVariant() + { + if (is_null($this->variant)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_VARIANT); + if (is_null($data)) { + return null; + } + $this->variant = (string) $data; + } + + return $this->variant; + } + /** * @param ?string $change @@ -202,6 +232,14 @@ public function setCatalogData(?string $catalogData): void $this->catalogData = $catalogData; } + /** + * @param ?string $variant + */ + public function setVariant(?string $variant): void + { + $this->variant = $variant; + } + } diff --git a/lib/commercetools-history/src/Models/Change/RemoveAssetChange.php b/lib/commercetools-history/src/Models/Change/RemoveAssetChange.php index 504b5100dd7..72794236a8f 100644 --- a/lib/commercetools-history/src/Models/Change/RemoveAssetChange.php +++ b/lib/commercetools-history/src/Models/Change/RemoveAssetChange.php @@ -16,6 +16,8 @@ interface RemoveAssetChange extends Change { public const FIELD_PREVIOUS_VALUE = 'previousValue'; + public const FIELD_CATALOG_DATA = 'catalogData'; + public const FIELD_VARIANT = 'variant'; /** @@ -37,6 +39,27 @@ public function getType(); */ public function getPreviousValue(); + /** + *Product data that was updated.
+ *staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + + * @return null|string + */ + public function getVariant(); + /** * @param ?string $change */ @@ -46,4 +69,14 @@ public function setChange(?string $change): void; * @param ?Asset $previousValue */ public function setPreviousValue(?Asset $previousValue): void; + + /** + * @param ?string $catalogData + */ + public function setCatalogData(?string $catalogData): void; + + /** + * @param ?string $variant + */ + public function setVariant(?string $variant): void; } diff --git a/lib/commercetools-history/src/Models/Change/RemoveAssetChangeBuilder.php b/lib/commercetools-history/src/Models/Change/RemoveAssetChangeBuilder.php index 0342b714909..2af5fa27975 100644 --- a/lib/commercetools-history/src/Models/Change/RemoveAssetChangeBuilder.php +++ b/lib/commercetools-history/src/Models/Change/RemoveAssetChangeBuilder.php @@ -34,6 +34,18 @@ final class RemoveAssetChangeBuilder implements Builder */ private $previousValue; + /** + + * @var ?string + */ + private $catalogData; + + /** + + * @var ?string + */ + private $variant; + /** * @return null|string @@ -54,6 +66,33 @@ public function getPreviousValue() return $this->previousValue instanceof AssetBuilder ? $this->previousValue->build() : $this->previousValue; } + /** + *Product data that was updated.
+ *staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + + * @return null|string + */ + public function getVariant() + { + return $this->variant; + } + /** * @param ?string $change * @return $this @@ -76,6 +115,28 @@ public function withPreviousValue(?Asset $previousValue) return $this; } + /** + * @param ?string $catalogData + * @return $this + */ + public function withCatalogData(?string $catalogData) + { + $this->catalogData = $catalogData; + + return $this; + } + + /** + * @param ?string $variant + * @return $this + */ + public function withVariant(?string $variant) + { + $this->variant = $variant; + + return $this; + } + /** * @deprecated use withPreviousValue() instead * @return $this @@ -91,7 +152,9 @@ public function build(): RemoveAssetChange { return new RemoveAssetChangeModel( $this->change, - $this->previousValue instanceof AssetBuilder ? $this->previousValue->build() : $this->previousValue + $this->previousValue instanceof AssetBuilder ? $this->previousValue->build() : $this->previousValue, + $this->catalogData, + $this->variant ); } diff --git a/lib/commercetools-history/src/Models/Change/RemoveAssetChangeModel.php b/lib/commercetools-history/src/Models/Change/RemoveAssetChangeModel.php index fadc84b0a2f..f0e7d0389fd 100644 --- a/lib/commercetools-history/src/Models/Change/RemoveAssetChangeModel.php +++ b/lib/commercetools-history/src/Models/Change/RemoveAssetChangeModel.php @@ -41,6 +41,18 @@ final class RemoveAssetChangeModel extends JsonObjectModel implements RemoveAsse */ protected $previousValue; + /** + * + * @var ?string + */ + protected $catalogData; + + /** + * + * @var ?string + */ + protected $variant; + /** * @psalm-suppress MissingParamType @@ -48,10 +60,14 @@ final class RemoveAssetChangeModel extends JsonObjectModel implements RemoveAsse public function __construct( ?string $change = null, ?Asset $previousValue = null, + ?string $catalogData = null, + ?string $variant = null, ?string $type = null ) { $this->change = $change; $this->previousValue = $previousValue; + $this->catalogData = $catalogData; + $this->variant = $variant; $this->type = $type ?? self::DISCRIMINATOR_VALUE; } @@ -112,6 +128,51 @@ public function getPreviousValue() return $this->previousValue; } + /** + *Product data that was updated.
+ *staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + * + * @return null|string + */ + public function getVariant() + { + if (is_null($this->variant)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_VARIANT); + if (is_null($data)) { + return null; + } + $this->variant = (string) $data; + } + + return $this->variant; + } + /** * @param ?string $change @@ -129,6 +190,22 @@ public function setPreviousValue(?Asset $previousValue): void $this->previousValue = $previousValue; } + /** + * @param ?string $catalogData + */ + public function setCatalogData(?string $catalogData): void + { + $this->catalogData = $catalogData; + } + + /** + * @param ?string $variant + */ + public function setVariant(?string $variant): void + { + $this->variant = $variant; + } + } diff --git a/lib/commercetools-history/src/Models/Change/RemoveDeliveryItemsChange.php b/lib/commercetools-history/src/Models/Change/RemoveDeliveryItemsChange.php index 0f210444240..1f840f12965 100644 --- a/lib/commercetools-history/src/Models/Change/RemoveDeliveryItemsChange.php +++ b/lib/commercetools-history/src/Models/Change/RemoveDeliveryItemsChange.php @@ -10,7 +10,7 @@ use Commercetools\Base\JsonObject; use Commercetools\Base\DateTimeImmutableCollection; -use Commercetools\History\Models\Common\Delivery; +use Commercetools\History\Models\ChangeValue\DeliveryChangeValue; interface RemoveDeliveryItemsChange extends Change { @@ -33,7 +33,7 @@ public function getChange(); *Value before the change.
* - * @return null|Delivery + * @return null|DeliveryChangeValue */ public function getPreviousValue(); @@ -43,7 +43,7 @@ public function getPreviousValue(); public function setChange(?string $change): void; /** - * @param ?Delivery $previousValue + * @param ?DeliveryChangeValue $previousValue */ - public function setPreviousValue(?Delivery $previousValue): void; + public function setPreviousValue(?DeliveryChangeValue $previousValue): void; } diff --git a/lib/commercetools-history/src/Models/Change/RemoveDeliveryItemsChangeBuilder.php b/lib/commercetools-history/src/Models/Change/RemoveDeliveryItemsChangeBuilder.php index 64d64d8f8a3..efb6e67be27 100644 --- a/lib/commercetools-history/src/Models/Change/RemoveDeliveryItemsChangeBuilder.php +++ b/lib/commercetools-history/src/Models/Change/RemoveDeliveryItemsChangeBuilder.php @@ -14,8 +14,8 @@ use Commercetools\Base\JsonObjectModel; use Commercetools\Base\MapperFactory; use stdClass; -use Commercetools\History\Models\Common\Delivery; -use Commercetools\History\Models\Common\DeliveryBuilder; +use Commercetools\History\Models\ChangeValue\DeliveryChangeValue; +use Commercetools\History\Models\ChangeValue\DeliveryChangeValueBuilder; /** * @implements BuilderValue before the change.
* - * @return null|Delivery + * @return null|DeliveryChangeValue */ public function getPreviousValue() { - return $this->previousValue instanceof DeliveryBuilder ? $this->previousValue->build() : $this->previousValue; + return $this->previousValue instanceof DeliveryChangeValueBuilder ? $this->previousValue->build() : $this->previousValue; } /** @@ -66,10 +66,10 @@ public function withChange(?string $change) } /** - * @param ?Delivery $previousValue + * @param ?DeliveryChangeValue $previousValue * @return $this */ - public function withPreviousValue(?Delivery $previousValue) + public function withPreviousValue(?DeliveryChangeValue $previousValue) { $this->previousValue = $previousValue; @@ -80,7 +80,7 @@ public function withPreviousValue(?Delivery $previousValue) * @deprecated use withPreviousValue() instead * @return $this */ - public function withPreviousValueBuilder(?DeliveryBuilder $previousValue) + public function withPreviousValueBuilder(?DeliveryChangeValueBuilder $previousValue) { $this->previousValue = $previousValue; @@ -91,7 +91,7 @@ public function build(): RemoveDeliveryItemsChange { return new RemoveDeliveryItemsChangeModel( $this->change, - $this->previousValue instanceof DeliveryBuilder ? $this->previousValue->build() : $this->previousValue + $this->previousValue instanceof DeliveryChangeValueBuilder ? $this->previousValue->build() : $this->previousValue ); } diff --git a/lib/commercetools-history/src/Models/Change/RemoveDeliveryItemsChangeModel.php b/lib/commercetools-history/src/Models/Change/RemoveDeliveryItemsChangeModel.php index 697499bf96c..a684d8ffa2a 100644 --- a/lib/commercetools-history/src/Models/Change/RemoveDeliveryItemsChangeModel.php +++ b/lib/commercetools-history/src/Models/Change/RemoveDeliveryItemsChangeModel.php @@ -13,8 +13,8 @@ use Commercetools\Base\JsonObjectModel; use Commercetools\Base\MapperFactory; use stdClass; -use Commercetools\History\Models\Common\Delivery; -use Commercetools\History\Models\Common\DeliveryModel; +use Commercetools\History\Models\ChangeValue\DeliveryChangeValue; +use Commercetools\History\Models\ChangeValue\DeliveryChangeValueModel; /** * @internal @@ -37,7 +37,7 @@ final class RemoveDeliveryItemsChangeModel extends JsonObjectModel implements Re /** * - * @var ?Delivery + * @var ?DeliveryChangeValue */ protected $previousValue; @@ -47,7 +47,7 @@ final class RemoveDeliveryItemsChangeModel extends JsonObjectModel implements Re */ public function __construct( ?string $change = null, - ?Delivery $previousValue = null, + ?DeliveryChangeValue $previousValue = null, ?string $type = null ) { $this->change = $change; @@ -95,7 +95,7 @@ public function getChange() *Value before the change.
* * - * @return null|Delivery + * @return null|DeliveryChangeValue */ public function getPreviousValue() { @@ -106,7 +106,7 @@ public function getPreviousValue() return null; } - $this->previousValue = DeliveryModel::of($data); + $this->previousValue = DeliveryChangeValueModel::of($data); } return $this->previousValue; @@ -122,9 +122,9 @@ public function setChange(?string $change): void } /** - * @param ?Delivery $previousValue + * @param ?DeliveryChangeValue $previousValue */ - public function setPreviousValue(?Delivery $previousValue): void + public function setPreviousValue(?DeliveryChangeValue $previousValue): void { $this->previousValue = $previousValue; } diff --git a/lib/commercetools-history/src/Models/Change/RemoveEnumValuesChange.php b/lib/commercetools-history/src/Models/Change/RemoveEnumValuesChange.php index 88f1e5178b7..f6b1d774fa7 100644 --- a/lib/commercetools-history/src/Models/Change/RemoveEnumValuesChange.php +++ b/lib/commercetools-history/src/Models/Change/RemoveEnumValuesChange.php @@ -10,7 +10,7 @@ use Commercetools\Base\JsonObject; use Commercetools\Base\DateTimeImmutableCollection; -use Commercetools\History\Models\ChangeValue\EnumValue; +use Commercetools\History\Models\Common\AttributePlainEnumValue; interface RemoveEnumValuesChange extends Change { @@ -34,7 +34,7 @@ public function getChange(); *Value before the change.
* - * @return null|EnumValue + * @return null|AttributePlainEnumValue */ public function getPreviousValue(); @@ -52,9 +52,9 @@ public function getAttributeName(); public function setChange(?string $change): void; /** - * @param ?EnumValue $previousValue + * @param ?AttributePlainEnumValue $previousValue */ - public function setPreviousValue(?EnumValue $previousValue): void; + public function setPreviousValue(?AttributePlainEnumValue $previousValue): void; /** * @param ?string $attributeName diff --git a/lib/commercetools-history/src/Models/Change/RemoveEnumValuesChangeBuilder.php b/lib/commercetools-history/src/Models/Change/RemoveEnumValuesChangeBuilder.php index c8052f2231d..14abddab4d5 100644 --- a/lib/commercetools-history/src/Models/Change/RemoveEnumValuesChangeBuilder.php +++ b/lib/commercetools-history/src/Models/Change/RemoveEnumValuesChangeBuilder.php @@ -14,8 +14,8 @@ use Commercetools\Base\JsonObjectModel; use Commercetools\Base\MapperFactory; use stdClass; -use Commercetools\History\Models\ChangeValue\EnumValue; -use Commercetools\History\Models\ChangeValue\EnumValueBuilder; +use Commercetools\History\Models\Common\AttributePlainEnumValue; +use Commercetools\History\Models\Common\AttributePlainEnumValueBuilder; /** * @implements BuilderValue before the change.
* - * @return null|EnumValue + * @return null|AttributePlainEnumValue */ public function getPreviousValue() { - return $this->previousValue instanceof EnumValueBuilder ? $this->previousValue->build() : $this->previousValue; + return $this->previousValue instanceof AttributePlainEnumValueBuilder ? $this->previousValue->build() : $this->previousValue; } /** @@ -83,10 +83,10 @@ public function withChange(?string $change) } /** - * @param ?EnumValue $previousValue + * @param ?AttributePlainEnumValue $previousValue * @return $this */ - public function withPreviousValue(?EnumValue $previousValue) + public function withPreviousValue(?AttributePlainEnumValue $previousValue) { $this->previousValue = $previousValue; @@ -108,7 +108,7 @@ public function withAttributeName(?string $attributeName) * @deprecated use withPreviousValue() instead * @return $this */ - public function withPreviousValueBuilder(?EnumValueBuilder $previousValue) + public function withPreviousValueBuilder(?AttributePlainEnumValueBuilder $previousValue) { $this->previousValue = $previousValue; @@ -119,7 +119,7 @@ public function build(): RemoveEnumValuesChange { return new RemoveEnumValuesChangeModel( $this->change, - $this->previousValue instanceof EnumValueBuilder ? $this->previousValue->build() : $this->previousValue, + $this->previousValue instanceof AttributePlainEnumValueBuilder ? $this->previousValue->build() : $this->previousValue, $this->attributeName ); } diff --git a/lib/commercetools-history/src/Models/Change/RemoveEnumValuesChangeModel.php b/lib/commercetools-history/src/Models/Change/RemoveEnumValuesChangeModel.php index 513f96f1088..ef60c4eb080 100644 --- a/lib/commercetools-history/src/Models/Change/RemoveEnumValuesChangeModel.php +++ b/lib/commercetools-history/src/Models/Change/RemoveEnumValuesChangeModel.php @@ -13,8 +13,8 @@ use Commercetools\Base\JsonObjectModel; use Commercetools\Base\MapperFactory; use stdClass; -use Commercetools\History\Models\ChangeValue\EnumValue; -use Commercetools\History\Models\ChangeValue\EnumValueModel; +use Commercetools\History\Models\Common\AttributePlainEnumValue; +use Commercetools\History\Models\Common\AttributePlainEnumValueModel; /** * @internal @@ -37,7 +37,7 @@ final class RemoveEnumValuesChangeModel extends JsonObjectModel implements Remov /** * - * @var ?EnumValue + * @var ?AttributePlainEnumValue */ protected $previousValue; @@ -53,7 +53,7 @@ final class RemoveEnumValuesChangeModel extends JsonObjectModel implements Remov */ public function __construct( ?string $change = null, - ?EnumValue $previousValue = null, + ?AttributePlainEnumValue $previousValue = null, ?string $attributeName = null, ?string $type = null ) { @@ -103,7 +103,7 @@ public function getChange() *Value before the change.
* * - * @return null|EnumValue + * @return null|AttributePlainEnumValue */ public function getPreviousValue() { @@ -114,7 +114,7 @@ public function getPreviousValue() return null; } - $this->previousValue = EnumValueModel::of($data); + $this->previousValue = AttributePlainEnumValueModel::of($data); } return $this->previousValue; @@ -150,9 +150,9 @@ public function setChange(?string $change): void } /** - * @param ?EnumValue $previousValue + * @param ?AttributePlainEnumValue $previousValue */ - public function setPreviousValue(?EnumValue $previousValue): void + public function setPreviousValue(?AttributePlainEnumValue $previousValue): void { $this->previousValue = $previousValue; } diff --git a/lib/commercetools-history/src/Models/Change/RemoveFromCategoryChange.php b/lib/commercetools-history/src/Models/Change/RemoveFromCategoryChange.php index 23ce2964067..bbb3de9ea43 100644 --- a/lib/commercetools-history/src/Models/Change/RemoveFromCategoryChange.php +++ b/lib/commercetools-history/src/Models/Change/RemoveFromCategoryChange.php @@ -19,6 +19,7 @@ interface RemoveFromCategoryChange extends Change public const FIELD_PREVIOUS_VALUE = 'previousValue'; public const FIELD_NEXT_VALUE = 'nextValue'; public const FIELD_CATEGORY = 'category'; + public const FIELD_CATALOG_DATA = 'catalogData'; /** @@ -56,6 +57,18 @@ public function getNextValue(); */ public function getCategory(); + /** + *Product data that was updated.
+ *staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Product data that was updated.
+ *staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Product data that was updated.
+ *staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Product data that was updated.
*staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + + * @return null|string + */ + public function getVariant(); + /** * @param ?string $change */ @@ -77,4 +88,9 @@ public function setNextValue(?ImageCollection $nextValue): void; * @param ?string $catalogData */ public function setCatalogData(?string $catalogData): void; + + /** + * @param ?string $variant + */ + public function setVariant(?string $variant): void; } diff --git a/lib/commercetools-history/src/Models/Change/RemoveImageChangeBuilder.php b/lib/commercetools-history/src/Models/Change/RemoveImageChangeBuilder.php index c9d56d762fc..9920c123fc1 100644 --- a/lib/commercetools-history/src/Models/Change/RemoveImageChangeBuilder.php +++ b/lib/commercetools-history/src/Models/Change/RemoveImageChangeBuilder.php @@ -45,6 +45,12 @@ final class RemoveImageChangeBuilder implements Builder */ private $catalogData; + /** + + * @var ?string + */ + private $variant; + /** * @return null|string @@ -77,6 +83,7 @@ public function getNextValue() } /** + *Product data that was updated.
*staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + + * @return null|string + */ + public function getVariant() + { + return $this->variant; + } + /** * @param ?string $change * @return $this @@ -134,6 +153,17 @@ public function withCatalogData(?string $catalogData) return $this; } + /** + * @param ?string $variant + * @return $this + */ + public function withVariant(?string $variant) + { + $this->variant = $variant; + + return $this; + } + public function build(): RemoveImageChange { @@ -141,7 +171,8 @@ public function build(): RemoveImageChange $this->change, $this->previousValue, $this->nextValue, - $this->catalogData + $this->catalogData, + $this->variant ); } diff --git a/lib/commercetools-history/src/Models/Change/RemoveImageChangeModel.php b/lib/commercetools-history/src/Models/Change/RemoveImageChangeModel.php index b77a0ad16a7..ea3c8901558 100644 --- a/lib/commercetools-history/src/Models/Change/RemoveImageChangeModel.php +++ b/lib/commercetools-history/src/Models/Change/RemoveImageChangeModel.php @@ -52,6 +52,12 @@ final class RemoveImageChangeModel extends JsonObjectModel implements RemoveImag */ protected $catalogData; + /** + * + * @var ?string + */ + protected $variant; + /** * @psalm-suppress MissingParamType @@ -61,12 +67,14 @@ public function __construct( ?ImageCollection $previousValue = null, ?ImageCollection $nextValue = null, ?string $catalogData = null, + ?string $variant = null, ?string $type = null ) { $this->change = $change; $this->previousValue = $previousValue; $this->nextValue = $nextValue; $this->catalogData = $catalogData; + $this->variant = $variant; $this->type = $type ?? self::DISCRIMINATOR_VALUE; } @@ -147,6 +155,7 @@ public function getNextValue() } /** + *Product data that was updated.
*staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + * + * @return null|string + */ + public function getVariant() + { + if (is_null($this->variant)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_VARIANT); + if (is_null($data)) { + return null; + } + $this->variant = (string) $data; + } + + return $this->variant; + } + /** * @param ?string $change @@ -202,6 +232,14 @@ public function setCatalogData(?string $catalogData): void $this->catalogData = $catalogData; } + /** + * @param ?string $variant + */ + public function setVariant(?string $variant): void + { + $this->variant = $variant; + } + } diff --git a/lib/commercetools-history/src/Models/Change/RemoveLocalizedEnumValuesChange.php b/lib/commercetools-history/src/Models/Change/RemoveLocalizedEnumValuesChange.php index 653c3453842..2bc65bffe86 100644 --- a/lib/commercetools-history/src/Models/Change/RemoveLocalizedEnumValuesChange.php +++ b/lib/commercetools-history/src/Models/Change/RemoveLocalizedEnumValuesChange.php @@ -10,7 +10,7 @@ use Commercetools\Base\JsonObject; use Commercetools\Base\DateTimeImmutableCollection; -use Commercetools\History\Models\ChangeValue\LocalizedEnumValue; +use Commercetools\History\Models\Common\AttributeLocalizedEnumValue; interface RemoveLocalizedEnumValuesChange extends Change { @@ -34,7 +34,7 @@ public function getChange(); *Value before the change.
* - * @return null|LocalizedEnumValue + * @return null|AttributeLocalizedEnumValue */ public function getPreviousValue(); @@ -52,9 +52,9 @@ public function getAttributeName(); public function setChange(?string $change): void; /** - * @param ?LocalizedEnumValue $previousValue + * @param ?AttributeLocalizedEnumValue $previousValue */ - public function setPreviousValue(?LocalizedEnumValue $previousValue): void; + public function setPreviousValue(?AttributeLocalizedEnumValue $previousValue): void; /** * @param ?string $attributeName diff --git a/lib/commercetools-history/src/Models/Change/RemoveLocalizedEnumValuesChangeBuilder.php b/lib/commercetools-history/src/Models/Change/RemoveLocalizedEnumValuesChangeBuilder.php index 9c12e71e3b4..efa16fd1e7c 100644 --- a/lib/commercetools-history/src/Models/Change/RemoveLocalizedEnumValuesChangeBuilder.php +++ b/lib/commercetools-history/src/Models/Change/RemoveLocalizedEnumValuesChangeBuilder.php @@ -14,8 +14,8 @@ use Commercetools\Base\JsonObjectModel; use Commercetools\Base\MapperFactory; use stdClass; -use Commercetools\History\Models\ChangeValue\LocalizedEnumValue; -use Commercetools\History\Models\ChangeValue\LocalizedEnumValueBuilder; +use Commercetools\History\Models\Common\AttributeLocalizedEnumValue; +use Commercetools\History\Models\Common\AttributeLocalizedEnumValueBuilder; /** * @implements BuilderValue before the change.
* - * @return null|LocalizedEnumValue + * @return null|AttributeLocalizedEnumValue */ public function getPreviousValue() { - return $this->previousValue instanceof LocalizedEnumValueBuilder ? $this->previousValue->build() : $this->previousValue; + return $this->previousValue instanceof AttributeLocalizedEnumValueBuilder ? $this->previousValue->build() : $this->previousValue; } /** @@ -83,10 +83,10 @@ public function withChange(?string $change) } /** - * @param ?LocalizedEnumValue $previousValue + * @param ?AttributeLocalizedEnumValue $previousValue * @return $this */ - public function withPreviousValue(?LocalizedEnumValue $previousValue) + public function withPreviousValue(?AttributeLocalizedEnumValue $previousValue) { $this->previousValue = $previousValue; @@ -108,7 +108,7 @@ public function withAttributeName(?string $attributeName) * @deprecated use withPreviousValue() instead * @return $this */ - public function withPreviousValueBuilder(?LocalizedEnumValueBuilder $previousValue) + public function withPreviousValueBuilder(?AttributeLocalizedEnumValueBuilder $previousValue) { $this->previousValue = $previousValue; @@ -119,7 +119,7 @@ public function build(): RemoveLocalizedEnumValuesChange { return new RemoveLocalizedEnumValuesChangeModel( $this->change, - $this->previousValue instanceof LocalizedEnumValueBuilder ? $this->previousValue->build() : $this->previousValue, + $this->previousValue instanceof AttributeLocalizedEnumValueBuilder ? $this->previousValue->build() : $this->previousValue, $this->attributeName ); } diff --git a/lib/commercetools-history/src/Models/Change/RemoveLocalizedEnumValuesChangeModel.php b/lib/commercetools-history/src/Models/Change/RemoveLocalizedEnumValuesChangeModel.php index de05bdff91d..c6148238062 100644 --- a/lib/commercetools-history/src/Models/Change/RemoveLocalizedEnumValuesChangeModel.php +++ b/lib/commercetools-history/src/Models/Change/RemoveLocalizedEnumValuesChangeModel.php @@ -13,8 +13,8 @@ use Commercetools\Base\JsonObjectModel; use Commercetools\Base\MapperFactory; use stdClass; -use Commercetools\History\Models\ChangeValue\LocalizedEnumValue; -use Commercetools\History\Models\ChangeValue\LocalizedEnumValueModel; +use Commercetools\History\Models\Common\AttributeLocalizedEnumValue; +use Commercetools\History\Models\Common\AttributeLocalizedEnumValueModel; /** * @internal @@ -37,7 +37,7 @@ final class RemoveLocalizedEnumValuesChangeModel extends JsonObjectModel impleme /** * - * @var ?LocalizedEnumValue + * @var ?AttributeLocalizedEnumValue */ protected $previousValue; @@ -53,7 +53,7 @@ final class RemoveLocalizedEnumValuesChangeModel extends JsonObjectModel impleme */ public function __construct( ?string $change = null, - ?LocalizedEnumValue $previousValue = null, + ?AttributeLocalizedEnumValue $previousValue = null, ?string $attributeName = null, ?string $type = null ) { @@ -103,7 +103,7 @@ public function getChange() *Value before the change.
* * - * @return null|LocalizedEnumValue + * @return null|AttributeLocalizedEnumValue */ public function getPreviousValue() { @@ -114,7 +114,7 @@ public function getPreviousValue() return null; } - $this->previousValue = LocalizedEnumValueModel::of($data); + $this->previousValue = AttributeLocalizedEnumValueModel::of($data); } return $this->previousValue; @@ -150,9 +150,9 @@ public function setChange(?string $change): void } /** - * @param ?LocalizedEnumValue $previousValue + * @param ?AttributeLocalizedEnumValue $previousValue */ - public function setPreviousValue(?LocalizedEnumValue $previousValue): void + public function setPreviousValue(?AttributeLocalizedEnumValue $previousValue): void { $this->previousValue = $previousValue; } diff --git a/lib/commercetools-history/src/Models/Change/RemovePriceChange.php b/lib/commercetools-history/src/Models/Change/RemovePriceChange.php index 883cfa05a4b..025b6023d80 100644 --- a/lib/commercetools-history/src/Models/Change/RemovePriceChange.php +++ b/lib/commercetools-history/src/Models/Change/RemovePriceChange.php @@ -19,6 +19,7 @@ interface RemovePriceChange extends Change public const FIELD_NEXT_VALUE = 'nextValue'; public const FIELD_CATALOG_DATA = 'catalogData'; public const FIELD_PRICE_ID = 'priceId'; + public const FIELD_VARIANT = 'variant'; /** @@ -49,6 +50,7 @@ public function getPreviousValue(); public function getNextValue(); /** + *Product data that was updated.
*staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + + * @return null|string + */ + public function getVariant(); + /** * @param ?string $change */ @@ -91,4 +102,9 @@ public function setCatalogData(?string $catalogData): void; * @param ?string $priceId */ public function setPriceId(?string $priceId): void; + + /** + * @param ?string $variant + */ + public function setVariant(?string $variant): void; } diff --git a/lib/commercetools-history/src/Models/Change/RemovePriceChangeBuilder.php b/lib/commercetools-history/src/Models/Change/RemovePriceChangeBuilder.php index 6754778291a..0b36d607527 100644 --- a/lib/commercetools-history/src/Models/Change/RemovePriceChangeBuilder.php +++ b/lib/commercetools-history/src/Models/Change/RemovePriceChangeBuilder.php @@ -52,6 +52,12 @@ final class RemovePriceChangeBuilder implements Builder */ private $priceId; + /** + + * @var ?string + */ + private $variant; + /** * @return null|string @@ -84,6 +90,7 @@ public function getNextValue() } /** + *Product data that was updated.
*staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + + * @return null|string + */ + public function getVariant() + { + return $this->variant; + } + /** * @param ?string $change * @return $this @@ -163,6 +182,17 @@ public function withPriceId(?string $priceId) return $this; } + /** + * @param ?string $variant + * @return $this + */ + public function withVariant(?string $variant) + { + $this->variant = $variant; + + return $this; + } + /** * @deprecated use withPreviousValue() instead * @return $this @@ -192,7 +222,8 @@ public function build(): RemovePriceChange $this->previousValue instanceof PriceBuilder ? $this->previousValue->build() : $this->previousValue, $this->nextValue instanceof PriceBuilder ? $this->nextValue->build() : $this->nextValue, $this->catalogData, - $this->priceId + $this->priceId, + $this->variant ); } diff --git a/lib/commercetools-history/src/Models/Change/RemovePriceChangeModel.php b/lib/commercetools-history/src/Models/Change/RemovePriceChangeModel.php index 4248271793f..9335d93a8bb 100644 --- a/lib/commercetools-history/src/Models/Change/RemovePriceChangeModel.php +++ b/lib/commercetools-history/src/Models/Change/RemovePriceChangeModel.php @@ -59,6 +59,12 @@ final class RemovePriceChangeModel extends JsonObjectModel implements RemovePric */ protected $priceId; + /** + * + * @var ?string + */ + protected $variant; + /** * @psalm-suppress MissingParamType @@ -69,6 +75,7 @@ public function __construct( ?Price $nextValue = null, ?string $catalogData = null, ?string $priceId = null, + ?string $variant = null, ?string $type = null ) { $this->change = $change; @@ -76,6 +83,7 @@ public function __construct( $this->nextValue = $nextValue; $this->catalogData = $catalogData; $this->priceId = $priceId; + $this->variant = $variant; $this->type = $type ?? self::DISCRIMINATOR_VALUE; } @@ -158,6 +166,7 @@ public function getNextValue() } /** + *Product data that was updated.
*staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + * + * @return null|string + */ + public function getVariant() + { + if (is_null($this->variant)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_VARIANT); + if (is_null($data)) { + return null; + } + $this->variant = (string) $data; + } + + return $this->variant; + } + /** * @param ?string $change @@ -241,6 +271,14 @@ public function setPriceId(?string $priceId): void $this->priceId = $priceId; } + /** + * @param ?string $variant + */ + public function setVariant(?string $variant): void + { + $this->variant = $variant; + } + } diff --git a/lib/commercetools-history/src/Models/Change/RemoveProductChangeModel.php b/lib/commercetools-history/src/Models/Change/RemoveProductChangeModel.php index c2fa6455d53..6f450795fc0 100644 --- a/lib/commercetools-history/src/Models/Change/RemoveProductChangeModel.php +++ b/lib/commercetools-history/src/Models/Change/RemoveProductChangeModel.php @@ -105,8 +105,8 @@ public function getPreviousValue() if (is_null($data)) { return null; } - - $this->previousValue = ReferenceModel::of($data); + $className = ReferenceModel::resolveDiscriminatorClass($data); + $this->previousValue = $className::of($data); } return $this->previousValue; diff --git a/lib/commercetools-history/src/Models/Change/RemoveShippingChange.php b/lib/commercetools-history/src/Models/Change/RemoveShippingChange.php new file mode 100644 index 00000000000..5ac9bf061c4 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/RemoveShippingChange.php @@ -0,0 +1,49 @@ +Value before the change. + * + + * @return null|Shipping + */ + public function getPreviousValue(); + + /** + * @param ?string $change + */ + public function setChange(?string $change): void; + + /** + * @param ?Shipping $previousValue + */ + public function setPreviousValue(?Shipping $previousValue): void; +} diff --git a/lib/commercetools-history/src/Models/Change/RemoveShippingChangeBuilder.php b/lib/commercetools-history/src/Models/Change/RemoveShippingChangeBuilder.php new file mode 100644 index 00000000000..d91ab305961 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/RemoveShippingChangeBuilder.php @@ -0,0 +1,102 @@ + + */ +final class RemoveShippingChangeBuilder implements Builder +{ + /** + + * @var ?string + */ + private $change; + + /** + + * @var null|Shipping|ShippingBuilder + */ + private $previousValue; + + /** + + * @return null|string + */ + public function getChange() + { + return $this->change; + } + + /** + *Value before the change.
+ * + + * @return null|Shipping + */ + public function getPreviousValue() + { + return $this->previousValue instanceof ShippingBuilder ? $this->previousValue->build() : $this->previousValue; + } + + /** + * @param ?string $change + * @return $this + */ + public function withChange(?string $change) + { + $this->change = $change; + + return $this; + } + + /** + * @param ?Shipping $previousValue + * @return $this + */ + public function withPreviousValue(?Shipping $previousValue) + { + $this->previousValue = $previousValue; + + return $this; + } + + /** + * @deprecated use withPreviousValue() instead + * @return $this + */ + public function withPreviousValueBuilder(?ShippingBuilder $previousValue) + { + $this->previousValue = $previousValue; + + return $this; + } + + public function build(): RemoveShippingChange + { + return new RemoveShippingChangeModel( + $this->change, + $this->previousValue instanceof ShippingBuilder ? $this->previousValue->build() : $this->previousValue + ); + } + + public static function of(): RemoveShippingChangeBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-history/src/Models/Change/RemoveShippingChangeCollection.php b/lib/commercetools-history/src/Models/Change/RemoveShippingChangeCollection.php new file mode 100644 index 00000000000..062222333dc --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/RemoveShippingChangeCollection.php @@ -0,0 +1,56 @@ + + * @method RemoveShippingChange current() + * @method RemoveShippingChange end() + * @method RemoveShippingChange at($offset) + */ +class RemoveShippingChangeCollection extends ChangeCollection +{ + /** + * @psalm-assert RemoveShippingChange $value + * @psalm-param RemoveShippingChange|stdClass $value + * @throws InvalidArgumentException + * + * @return RemoveShippingChangeCollection + */ + public function add($value) + { + if (!$value instanceof RemoveShippingChange) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?RemoveShippingChange + */ + protected function mapper() + { + return function (?int $index): ?RemoveShippingChange { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var RemoveShippingChange $data */ + $data = RemoveShippingChangeModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-history/src/Models/Change/RemoveShippingChangeModel.php b/lib/commercetools-history/src/Models/Change/RemoveShippingChangeModel.php new file mode 100644 index 00000000000..32f21e58cd6 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/RemoveShippingChangeModel.php @@ -0,0 +1,134 @@ +change = $change; + $this->previousValue = $previousValue; + $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; + } + + /** + * + * @return null|string + */ + public function getChange() + { + if (is_null($this->change)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CHANGE); + if (is_null($data)) { + return null; + } + $this->change = (string) $data; + } + + return $this->change; + } + + /** + *Value before the change.
+ * + * + * @return null|Shipping + */ + public function getPreviousValue() + { + if (is_null($this->previousValue)) { + /** @psalm-var stdClass|arrayValue before the change.
* - * @return null|LineItem + * @return null|ShoppingListLineItem */ public function getPreviousValue(); @@ -42,7 +42,7 @@ public function getPreviousValue(); *Value after the change.
* - * @return null|LineItem + * @return null|ShoppingListLineItem */ public function getNextValue(); @@ -52,12 +52,12 @@ public function getNextValue(); public function setChange(?string $change): void; /** - * @param ?LineItem $previousValue + * @param ?ShoppingListLineItem $previousValue */ - public function setPreviousValue(?LineItem $previousValue): void; + public function setPreviousValue(?ShoppingListLineItem $previousValue): void; /** - * @param ?LineItem $nextValue + * @param ?ShoppingListLineItem $nextValue */ - public function setNextValue(?LineItem $nextValue): void; + public function setNextValue(?ShoppingListLineItem $nextValue): void; } diff --git a/lib/commercetools-history/src/Models/Change/RemoveShoppingListLineItemChangeBuilder.php b/lib/commercetools-history/src/Models/Change/RemoveShoppingListLineItemChangeBuilder.php index 17a5871614a..8fb01389888 100644 --- a/lib/commercetools-history/src/Models/Change/RemoveShoppingListLineItemChangeBuilder.php +++ b/lib/commercetools-history/src/Models/Change/RemoveShoppingListLineItemChangeBuilder.php @@ -14,8 +14,8 @@ use Commercetools\Base\JsonObjectModel; use Commercetools\Base\MapperFactory; use stdClass; -use Commercetools\History\Models\Common\LineItem; -use Commercetools\History\Models\Common\LineItemBuilder; +use Commercetools\History\Models\Common\ShoppingListLineItem; +use Commercetools\History\Models\Common\ShoppingListLineItemBuilder; /** * @implements BuilderValue before the change.
* - * @return null|LineItem + * @return null|ShoppingListLineItem */ public function getPreviousValue() { - return $this->previousValue instanceof LineItemBuilder ? $this->previousValue->build() : $this->previousValue; + return $this->previousValue instanceof ShoppingListLineItemBuilder ? $this->previousValue->build() : $this->previousValue; } /** *Value after the change.
* - * @return null|LineItem + * @return null|ShoppingListLineItem */ public function getNextValue() { - return $this->nextValue instanceof LineItemBuilder ? $this->nextValue->build() : $this->nextValue; + return $this->nextValue instanceof ShoppingListLineItemBuilder ? $this->nextValue->build() : $this->nextValue; } /** @@ -83,10 +83,10 @@ public function withChange(?string $change) } /** - * @param ?LineItem $previousValue + * @param ?ShoppingListLineItem $previousValue * @return $this */ - public function withPreviousValue(?LineItem $previousValue) + public function withPreviousValue(?ShoppingListLineItem $previousValue) { $this->previousValue = $previousValue; @@ -94,10 +94,10 @@ public function withPreviousValue(?LineItem $previousValue) } /** - * @param ?LineItem $nextValue + * @param ?ShoppingListLineItem $nextValue * @return $this */ - public function withNextValue(?LineItem $nextValue) + public function withNextValue(?ShoppingListLineItem $nextValue) { $this->nextValue = $nextValue; @@ -108,7 +108,7 @@ public function withNextValue(?LineItem $nextValue) * @deprecated use withPreviousValue() instead * @return $this */ - public function withPreviousValueBuilder(?LineItemBuilder $previousValue) + public function withPreviousValueBuilder(?ShoppingListLineItemBuilder $previousValue) { $this->previousValue = $previousValue; @@ -119,7 +119,7 @@ public function withPreviousValueBuilder(?LineItemBuilder $previousValue) * @deprecated use withNextValue() instead * @return $this */ - public function withNextValueBuilder(?LineItemBuilder $nextValue) + public function withNextValueBuilder(?ShoppingListLineItemBuilder $nextValue) { $this->nextValue = $nextValue; @@ -130,8 +130,8 @@ public function build(): RemoveShoppingListLineItemChange { return new RemoveShoppingListLineItemChangeModel( $this->change, - $this->previousValue instanceof LineItemBuilder ? $this->previousValue->build() : $this->previousValue, - $this->nextValue instanceof LineItemBuilder ? $this->nextValue->build() : $this->nextValue + $this->previousValue instanceof ShoppingListLineItemBuilder ? $this->previousValue->build() : $this->previousValue, + $this->nextValue instanceof ShoppingListLineItemBuilder ? $this->nextValue->build() : $this->nextValue ); } diff --git a/lib/commercetools-history/src/Models/Change/RemoveShoppingListLineItemChangeModel.php b/lib/commercetools-history/src/Models/Change/RemoveShoppingListLineItemChangeModel.php index edaef550083..c445d2e526e 100644 --- a/lib/commercetools-history/src/Models/Change/RemoveShoppingListLineItemChangeModel.php +++ b/lib/commercetools-history/src/Models/Change/RemoveShoppingListLineItemChangeModel.php @@ -13,8 +13,8 @@ use Commercetools\Base\JsonObjectModel; use Commercetools\Base\MapperFactory; use stdClass; -use Commercetools\History\Models\Common\LineItem; -use Commercetools\History\Models\Common\LineItemModel; +use Commercetools\History\Models\Common\ShoppingListLineItem; +use Commercetools\History\Models\Common\ShoppingListLineItemModel; /** * @internal @@ -37,13 +37,13 @@ final class RemoveShoppingListLineItemChangeModel extends JsonObjectModel implem /** * - * @var ?LineItem + * @var ?ShoppingListLineItem */ protected $previousValue; /** * - * @var ?LineItem + * @var ?ShoppingListLineItem */ protected $nextValue; @@ -53,8 +53,8 @@ final class RemoveShoppingListLineItemChangeModel extends JsonObjectModel implem */ public function __construct( ?string $change = null, - ?LineItem $previousValue = null, - ?LineItem $nextValue = null, + ?ShoppingListLineItem $previousValue = null, + ?ShoppingListLineItem $nextValue = null, ?string $type = null ) { $this->change = $change; @@ -103,7 +103,7 @@ public function getChange() *Value before the change.
* * - * @return null|LineItem + * @return null|ShoppingListLineItem */ public function getPreviousValue() { @@ -114,7 +114,7 @@ public function getPreviousValue() return null; } - $this->previousValue = LineItemModel::of($data); + $this->previousValue = ShoppingListLineItemModel::of($data); } return $this->previousValue; @@ -124,7 +124,7 @@ public function getPreviousValue() *Value after the change.
* * - * @return null|LineItem + * @return null|ShoppingListLineItem */ public function getNextValue() { @@ -135,7 +135,7 @@ public function getNextValue() return null; } - $this->nextValue = LineItemModel::of($data); + $this->nextValue = ShoppingListLineItemModel::of($data); } return $this->nextValue; @@ -151,17 +151,17 @@ public function setChange(?string $change): void } /** - * @param ?LineItem $previousValue + * @param ?ShoppingListLineItem $previousValue */ - public function setPreviousValue(?LineItem $previousValue): void + public function setPreviousValue(?ShoppingListLineItem $previousValue): void { $this->previousValue = $previousValue; } /** - * @param ?LineItem $nextValue + * @param ?ShoppingListLineItem $nextValue */ - public function setNextValue(?LineItem $nextValue): void + public function setNextValue(?ShoppingListLineItem $nextValue): void { $this->nextValue = $nextValue; } diff --git a/lib/commercetools-history/src/Models/Change/RemoveVariantChange.php b/lib/commercetools-history/src/Models/Change/RemoveVariantChange.php index f1d594ffbc2..513210af80f 100644 --- a/lib/commercetools-history/src/Models/Change/RemoveVariantChange.php +++ b/lib/commercetools-history/src/Models/Change/RemoveVariantChange.php @@ -48,6 +48,7 @@ public function getPreviousValue(); public function getNextValue(); /** + *Product data that was updated.
*staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Product data that was updated.
*staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Product data that was updated.
*staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Value after the change.
+ * + + * @return null|TaxRate + */ + public function getNextValue(); + + /** + * @param ?string $change + */ + public function setChange(?string $change): void; + + /** + * @param ?TaxRate $previousValue + */ + public function setPreviousValue(?TaxRate $previousValue): void; + + /** + * @param ?TaxRate $nextValue + */ + public function setNextValue(?TaxRate $nextValue): void; +} diff --git a/lib/commercetools-history/src/Models/Change/ReplaceTaxRateChangeBuilder.php b/lib/commercetools-history/src/Models/Change/ReplaceTaxRateChangeBuilder.php new file mode 100644 index 00000000000..da70ad3a7c8 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/ReplaceTaxRateChangeBuilder.php @@ -0,0 +1,142 @@ + + */ +final class ReplaceTaxRateChangeBuilder implements Builder +{ + /** + + * @var ?string + */ + private $change; + + /** + + * @var null|TaxRate|TaxRateBuilder + */ + private $previousValue; + + /** + + * @var null|TaxRate|TaxRateBuilder + */ + private $nextValue; + + /** + + * @return null|string + */ + public function getChange() + { + return $this->change; + } + + /** + *Value before the change.
+ * + + * @return null|TaxRate + */ + public function getPreviousValue() + { + return $this->previousValue instanceof TaxRateBuilder ? $this->previousValue->build() : $this->previousValue; + } + + /** + *Value after the change.
+ * + + * @return null|TaxRate + */ + public function getNextValue() + { + return $this->nextValue instanceof TaxRateBuilder ? $this->nextValue->build() : $this->nextValue; + } + + /** + * @param ?string $change + * @return $this + */ + public function withChange(?string $change) + { + $this->change = $change; + + return $this; + } + + /** + * @param ?TaxRate $previousValue + * @return $this + */ + public function withPreviousValue(?TaxRate $previousValue) + { + $this->previousValue = $previousValue; + + return $this; + } + + /** + * @param ?TaxRate $nextValue + * @return $this + */ + public function withNextValue(?TaxRate $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + /** + * @deprecated use withPreviousValue() instead + * @return $this + */ + public function withPreviousValueBuilder(?TaxRateBuilder $previousValue) + { + $this->previousValue = $previousValue; + + return $this; + } + + /** + * @deprecated use withNextValue() instead + * @return $this + */ + public function withNextValueBuilder(?TaxRateBuilder $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + public function build(): ReplaceTaxRateChange + { + return new ReplaceTaxRateChangeModel( + $this->change, + $this->previousValue instanceof TaxRateBuilder ? $this->previousValue->build() : $this->previousValue, + $this->nextValue instanceof TaxRateBuilder ? $this->nextValue->build() : $this->nextValue + ); + } + + public static function of(): ReplaceTaxRateChangeBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-history/src/Models/Change/ReplaceTaxRateChangeCollection.php b/lib/commercetools-history/src/Models/Change/ReplaceTaxRateChangeCollection.php new file mode 100644 index 00000000000..35299da4b40 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/ReplaceTaxRateChangeCollection.php @@ -0,0 +1,56 @@ + + * @method ReplaceTaxRateChange current() + * @method ReplaceTaxRateChange end() + * @method ReplaceTaxRateChange at($offset) + */ +class ReplaceTaxRateChangeCollection extends ChangeCollection +{ + /** + * @psalm-assert ReplaceTaxRateChange $value + * @psalm-param ReplaceTaxRateChange|stdClass $value + * @throws InvalidArgumentException + * + * @return ReplaceTaxRateChangeCollection + */ + public function add($value) + { + if (!$value instanceof ReplaceTaxRateChange) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?ReplaceTaxRateChange + */ + protected function mapper() + { + return function (?int $index): ?ReplaceTaxRateChange { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var ReplaceTaxRateChange $data */ + $data = ReplaceTaxRateChangeModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-history/src/Models/Change/ReplaceTaxRateChangeModel.php b/lib/commercetools-history/src/Models/Change/ReplaceTaxRateChangeModel.php new file mode 100644 index 00000000000..721ea7498ea --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/ReplaceTaxRateChangeModel.php @@ -0,0 +1,171 @@ +change = $change; + $this->previousValue = $previousValue; + $this->nextValue = $nextValue; + $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; + } + + /** + * + * @return null|string + */ + public function getChange() + { + if (is_null($this->change)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CHANGE); + if (is_null($data)) { + return null; + } + $this->change = (string) $data; + } + + return $this->change; + } + + /** + *Value before the change.
+ * + * + * @return null|TaxRate + */ + public function getPreviousValue() + { + if (is_null($this->previousValue)) { + /** @psalm-var stdClass|arrayValue after the change.
+ * + * + * @return null|TaxRate + */ + public function getNextValue() + { + if (is_null($this->nextValue)) { + /** @psalm-var stdClass|arrayElements removed from the array.
+ * + + * @return null|ReferenceCollection + */ + public function getRemovedItems(); + + /** + *Value before the change.
+ * + + * @return null|ReferenceCollection + */ + public function getPreviousValue(); + + /** + *Value after the change.
+ * + + * @return null|ReferenceCollection + */ + public function getNextValue(); + + /** + * @param ?string $change + */ + public function setChange(?string $change): void; + + /** + * @param ?ReferenceCollection $addedItems + */ + public function setAddedItems(?ReferenceCollection $addedItems): void; + + /** + * @param ?ReferenceCollection $removedItems + */ + public function setRemovedItems(?ReferenceCollection $removedItems): void; + + /** + * @param ?ReferenceCollection $previousValue + */ + public function setPreviousValue(?ReferenceCollection $previousValue): void; + + /** + * @param ?ReferenceCollection $nextValue + */ + public function setNextValue(?ReferenceCollection $nextValue): void; +} diff --git a/lib/commercetools-history/src/Models/Change/SetAncestorsChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetAncestorsChangeBuilder.php new file mode 100644 index 00000000000..539b89fecac --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetAncestorsChangeBuilder.php @@ -0,0 +1,178 @@ + + */ +final class SetAncestorsChangeBuilder implements Builder +{ + /** + + * @var ?string + */ + private $change; + + /** + + * @var ?ReferenceCollection + */ + private $addedItems; + + /** + + * @var ?ReferenceCollection + */ + private $removedItems; + + /** + + * @var ?ReferenceCollection + */ + private $previousValue; + + /** + + * @var ?ReferenceCollection + */ + private $nextValue; + + /** + + * @return null|string + */ + public function getChange() + { + return $this->change; + } + + /** + *Elements added to the array.
+ * + + * @return null|ReferenceCollection + */ + public function getAddedItems() + { + return $this->addedItems; + } + + /** + *Elements removed from the array.
+ * + + * @return null|ReferenceCollection + */ + public function getRemovedItems() + { + return $this->removedItems; + } + + /** + *Value before the change.
+ * + + * @return null|ReferenceCollection + */ + public function getPreviousValue() + { + return $this->previousValue; + } + + /** + *Value after the change.
+ * + + * @return null|ReferenceCollection + */ + public function getNextValue() + { + return $this->nextValue; + } + + /** + * @param ?string $change + * @return $this + */ + public function withChange(?string $change) + { + $this->change = $change; + + return $this; + } + + /** + * @param ?ReferenceCollection $addedItems + * @return $this + */ + public function withAddedItems(?ReferenceCollection $addedItems) + { + $this->addedItems = $addedItems; + + return $this; + } + + /** + * @param ?ReferenceCollection $removedItems + * @return $this + */ + public function withRemovedItems(?ReferenceCollection $removedItems) + { + $this->removedItems = $removedItems; + + return $this; + } + + /** + * @param ?ReferenceCollection $previousValue + * @return $this + */ + public function withPreviousValue(?ReferenceCollection $previousValue) + { + $this->previousValue = $previousValue; + + return $this; + } + + /** + * @param ?ReferenceCollection $nextValue + * @return $this + */ + public function withNextValue(?ReferenceCollection $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + + public function build(): SetAncestorsChange + { + return new SetAncestorsChangeModel( + $this->change, + $this->addedItems, + $this->removedItems, + $this->previousValue, + $this->nextValue + ); + } + + public static function of(): SetAncestorsChangeBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetAncestorsChangeCollection.php b/lib/commercetools-history/src/Models/Change/SetAncestorsChangeCollection.php new file mode 100644 index 00000000000..9006ec411df --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetAncestorsChangeCollection.php @@ -0,0 +1,56 @@ + + * @method SetAncestorsChange current() + * @method SetAncestorsChange end() + * @method SetAncestorsChange at($offset) + */ +class SetAncestorsChangeCollection extends ChangeCollection +{ + /** + * @psalm-assert SetAncestorsChange $value + * @psalm-param SetAncestorsChange|stdClass $value + * @throws InvalidArgumentException + * + * @return SetAncestorsChangeCollection + */ + public function add($value) + { + if (!$value instanceof SetAncestorsChange) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?SetAncestorsChange + */ + protected function mapper() + { + return function (?int $index): ?SetAncestorsChange { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var SetAncestorsChange $data */ + $data = SetAncestorsChangeModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetAncestorsChangeModel.php b/lib/commercetools-history/src/Models/Change/SetAncestorsChangeModel.php new file mode 100644 index 00000000000..3450b405dfc --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetAncestorsChangeModel.php @@ -0,0 +1,240 @@ +change = $change; + $this->addedItems = $addedItems; + $this->removedItems = $removedItems; + $this->previousValue = $previousValue; + $this->nextValue = $nextValue; + $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; + } + + /** + * + * @return null|string + */ + public function getChange() + { + if (is_null($this->change)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CHANGE); + if (is_null($data)) { + return null; + } + $this->change = (string) $data; + } + + return $this->change; + } + + /** + *Elements added to the array.
+ * + * + * @return null|ReferenceCollection + */ + public function getAddedItems() + { + if (is_null($this->addedItems)) { + /** @psalm-var ?listElements removed from the array.
+ * + * + * @return null|ReferenceCollection + */ + public function getRemovedItems() + { + if (is_null($this->removedItems)) { + /** @psalm-var ?listValue before the change.
+ * + * + * @return null|ReferenceCollection + */ + public function getPreviousValue() + { + if (is_null($this->previousValue)) { + /** @psalm-var ?listValue after the change.
+ * + * + * @return null|ReferenceCollection + */ + public function getNextValue() + { + if (is_null($this->nextValue)) { + /** @psalm-var ?listProduct data that was updated.
+ *staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + + * @return null|string + */ + public function getVariant(); + /** * @param ?string $change */ @@ -102,4 +125,14 @@ public function setCustomTypeId(?string $customTypeId): void; * @param ?AssetChangeValue $asset */ public function setAsset(?AssetChangeValue $asset): void; + + /** + * @param ?string $catalogData + */ + public function setCatalogData(?string $catalogData): void; + + /** + * @param ?string $variant + */ + public function setVariant(?string $variant): void; } diff --git a/lib/commercetools-history/src/Models/Change/SetAssetCustomFieldChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetAssetCustomFieldChangeBuilder.php index 852c12de62e..75f0c0aeee2 100644 --- a/lib/commercetools-history/src/Models/Change/SetAssetCustomFieldChangeBuilder.php +++ b/lib/commercetools-history/src/Models/Change/SetAssetCustomFieldChangeBuilder.php @@ -58,6 +58,18 @@ final class SetAssetCustomFieldChangeBuilder implements Builder */ private $asset; + /** + + * @var ?string + */ + private $catalogData; + + /** + + * @var ?string + */ + private $variant; + /** * @return null|string @@ -122,6 +134,33 @@ public function getAsset() return $this->asset instanceof AssetChangeValueBuilder ? $this->asset->build() : $this->asset; } + /** + *Product data that was updated.
+ *staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + + * @return null|string + */ + public function getVariant() + { + return $this->variant; + } + /** * @param ?string $change * @return $this @@ -188,6 +227,28 @@ public function withAsset(?AssetChangeValue $asset) return $this; } + /** + * @param ?string $catalogData + * @return $this + */ + public function withCatalogData(?string $catalogData) + { + $this->catalogData = $catalogData; + + return $this; + } + + /** + * @param ?string $variant + * @return $this + */ + public function withVariant(?string $variant) + { + $this->variant = $variant; + + return $this; + } + /** * @deprecated use withAsset() instead * @return $this @@ -207,7 +268,9 @@ public function build(): SetAssetCustomFieldChange $this->nextValue, $this->name, $this->customTypeId, - $this->asset instanceof AssetChangeValueBuilder ? $this->asset->build() : $this->asset + $this->asset instanceof AssetChangeValueBuilder ? $this->asset->build() : $this->asset, + $this->catalogData, + $this->variant ); } diff --git a/lib/commercetools-history/src/Models/Change/SetAssetCustomFieldChangeModel.php b/lib/commercetools-history/src/Models/Change/SetAssetCustomFieldChangeModel.php index 1200b175a2d..3666fc3515c 100644 --- a/lib/commercetools-history/src/Models/Change/SetAssetCustomFieldChangeModel.php +++ b/lib/commercetools-history/src/Models/Change/SetAssetCustomFieldChangeModel.php @@ -65,6 +65,18 @@ final class SetAssetCustomFieldChangeModel extends JsonObjectModel implements Se */ protected $asset; + /** + * + * @var ?string + */ + protected $catalogData; + + /** + * + * @var ?string + */ + protected $variant; + /** * @psalm-suppress MissingParamType @@ -76,6 +88,8 @@ public function __construct( ?string $name = null, ?string $customTypeId = null, ?AssetChangeValue $asset = null, + ?string $catalogData = null, + ?string $variant = null, ?string $type = null ) { $this->change = $change; @@ -84,6 +98,8 @@ public function __construct( $this->name = $name; $this->customTypeId = $customTypeId; $this->asset = $asset; + $this->catalogData = $catalogData; + $this->variant = $variant; $this->type = $type ?? self::DISCRIMINATOR_VALUE; } @@ -224,6 +240,51 @@ public function getAsset() return $this->asset; } + /** + *Product data that was updated.
+ *staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + * + * @return null|string + */ + public function getVariant() + { + if (is_null($this->variant)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_VARIANT); + if (is_null($data)) { + return null; + } + $this->variant = (string) $data; + } + + return $this->variant; + } + /** * @param ?string $change @@ -273,6 +334,22 @@ public function setAsset(?AssetChangeValue $asset): void $this->asset = $asset; } + /** + * @param ?string $catalogData + */ + public function setCatalogData(?string $catalogData): void + { + $this->catalogData = $catalogData; + } + + /** + * @param ?string $variant + */ + public function setVariant(?string $variant): void + { + $this->variant = $variant; + } + } diff --git a/lib/commercetools-history/src/Models/Change/SetAssetCustomTypeChange.php b/lib/commercetools-history/src/Models/Change/SetAssetCustomTypeChange.php index 84893ab16ab..345be6a10fb 100644 --- a/lib/commercetools-history/src/Models/Change/SetAssetCustomTypeChange.php +++ b/lib/commercetools-history/src/Models/Change/SetAssetCustomTypeChange.php @@ -19,6 +19,8 @@ interface SetAssetCustomTypeChange extends Change public const FIELD_PREVIOUS_VALUE = 'previousValue'; public const FIELD_NEXT_VALUE = 'nextValue'; public const FIELD_ASSET = 'asset'; + public const FIELD_CATALOG_DATA = 'catalogData'; + public const FIELD_VARIANT = 'variant'; /** @@ -56,6 +58,27 @@ public function getNextValue(); */ public function getAsset(); + /** + *Product data that was updated.
+ *staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + + * @return null|string + */ + public function getVariant(); + /** * @param ?string $change */ @@ -75,4 +98,14 @@ public function setNextValue(?CustomFields $nextValue): void; * @param ?AssetChangeValue $asset */ public function setAsset(?AssetChangeValue $asset): void; + + /** + * @param ?string $catalogData + */ + public function setCatalogData(?string $catalogData): void; + + /** + * @param ?string $variant + */ + public function setVariant(?string $variant): void; } diff --git a/lib/commercetools-history/src/Models/Change/SetAssetCustomTypeChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetAssetCustomTypeChangeBuilder.php index 0aaa8847b36..a50b0a90dd9 100644 --- a/lib/commercetools-history/src/Models/Change/SetAssetCustomTypeChangeBuilder.php +++ b/lib/commercetools-history/src/Models/Change/SetAssetCustomTypeChangeBuilder.php @@ -48,6 +48,18 @@ final class SetAssetCustomTypeChangeBuilder implements Builder */ private $asset; + /** + + * @var ?string + */ + private $catalogData; + + /** + + * @var ?string + */ + private $variant; + /** * @return null|string @@ -90,6 +102,33 @@ public function getAsset() return $this->asset instanceof AssetChangeValueBuilder ? $this->asset->build() : $this->asset; } + /** + *Product data that was updated.
+ *staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + + * @return null|string + */ + public function getVariant() + { + return $this->variant; + } + /** * @param ?string $change * @return $this @@ -134,6 +173,28 @@ public function withAsset(?AssetChangeValue $asset) return $this; } + /** + * @param ?string $catalogData + * @return $this + */ + public function withCatalogData(?string $catalogData) + { + $this->catalogData = $catalogData; + + return $this; + } + + /** + * @param ?string $variant + * @return $this + */ + public function withVariant(?string $variant) + { + $this->variant = $variant; + + return $this; + } + /** * @deprecated use withPreviousValue() instead * @return $this @@ -173,7 +234,9 @@ public function build(): SetAssetCustomTypeChange $this->change, $this->previousValue instanceof CustomFieldsBuilder ? $this->previousValue->build() : $this->previousValue, $this->nextValue instanceof CustomFieldsBuilder ? $this->nextValue->build() : $this->nextValue, - $this->asset instanceof AssetChangeValueBuilder ? $this->asset->build() : $this->asset + $this->asset instanceof AssetChangeValueBuilder ? $this->asset->build() : $this->asset, + $this->catalogData, + $this->variant ); } diff --git a/lib/commercetools-history/src/Models/Change/SetAssetCustomTypeChangeModel.php b/lib/commercetools-history/src/Models/Change/SetAssetCustomTypeChangeModel.php index b8da7fb5cd2..b31fce90305 100644 --- a/lib/commercetools-history/src/Models/Change/SetAssetCustomTypeChangeModel.php +++ b/lib/commercetools-history/src/Models/Change/SetAssetCustomTypeChangeModel.php @@ -55,6 +55,18 @@ final class SetAssetCustomTypeChangeModel extends JsonObjectModel implements Set */ protected $asset; + /** + * + * @var ?string + */ + protected $catalogData; + + /** + * + * @var ?string + */ + protected $variant; + /** * @psalm-suppress MissingParamType @@ -64,12 +76,16 @@ public function __construct( ?CustomFields $previousValue = null, ?CustomFields $nextValue = null, ?AssetChangeValue $asset = null, + ?string $catalogData = null, + ?string $variant = null, ?string $type = null ) { $this->change = $change; $this->previousValue = $previousValue; $this->nextValue = $nextValue; $this->asset = $asset; + $this->catalogData = $catalogData; + $this->variant = $variant; $this->type = $type ?? self::DISCRIMINATOR_VALUE; } @@ -172,6 +188,51 @@ public function getAsset() return $this->asset; } + /** + *Product data that was updated.
+ *staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + * + * @return null|string + */ + public function getVariant() + { + if (is_null($this->variant)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_VARIANT); + if (is_null($data)) { + return null; + } + $this->variant = (string) $data; + } + + return $this->variant; + } + /** * @param ?string $change @@ -205,6 +266,22 @@ public function setAsset(?AssetChangeValue $asset): void $this->asset = $asset; } + /** + * @param ?string $catalogData + */ + public function setCatalogData(?string $catalogData): void + { + $this->catalogData = $catalogData; + } + + /** + * @param ?string $variant + */ + public function setVariant(?string $variant): void + { + $this->variant = $variant; + } + } diff --git a/lib/commercetools-history/src/Models/Change/SetAssetDescriptionChange.php b/lib/commercetools-history/src/Models/Change/SetAssetDescriptionChange.php index d6eed6418a1..618edd7ce5a 100644 --- a/lib/commercetools-history/src/Models/Change/SetAssetDescriptionChange.php +++ b/lib/commercetools-history/src/Models/Change/SetAssetDescriptionChange.php @@ -19,6 +19,8 @@ interface SetAssetDescriptionChange extends Change public const FIELD_PREVIOUS_VALUE = 'previousValue'; public const FIELD_NEXT_VALUE = 'nextValue'; public const FIELD_ASSET = 'asset'; + public const FIELD_CATALOG_DATA = 'catalogData'; + public const FIELD_VARIANT = 'variant'; /** @@ -56,6 +58,27 @@ public function getNextValue(); */ public function getAsset(); + /** + *Product data that was updated.
+ *staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + + * @return null|string + */ + public function getVariant(); + /** * @param ?string $change */ @@ -75,4 +98,14 @@ public function setNextValue(?LocalizedString $nextValue): void; * @param ?AssetChangeValue $asset */ public function setAsset(?AssetChangeValue $asset): void; + + /** + * @param ?string $catalogData + */ + public function setCatalogData(?string $catalogData): void; + + /** + * @param ?string $variant + */ + public function setVariant(?string $variant): void; } diff --git a/lib/commercetools-history/src/Models/Change/SetAssetDescriptionChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetAssetDescriptionChangeBuilder.php index ba04f8cffcf..843e3c18186 100644 --- a/lib/commercetools-history/src/Models/Change/SetAssetDescriptionChangeBuilder.php +++ b/lib/commercetools-history/src/Models/Change/SetAssetDescriptionChangeBuilder.php @@ -48,6 +48,18 @@ final class SetAssetDescriptionChangeBuilder implements Builder */ private $asset; + /** + + * @var ?string + */ + private $catalogData; + + /** + + * @var ?string + */ + private $variant; + /** * @return null|string @@ -90,6 +102,33 @@ public function getAsset() return $this->asset instanceof AssetChangeValueBuilder ? $this->asset->build() : $this->asset; } + /** + *Product data that was updated.
+ *staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + + * @return null|string + */ + public function getVariant() + { + return $this->variant; + } + /** * @param ?string $change * @return $this @@ -134,6 +173,28 @@ public function withAsset(?AssetChangeValue $asset) return $this; } + /** + * @param ?string $catalogData + * @return $this + */ + public function withCatalogData(?string $catalogData) + { + $this->catalogData = $catalogData; + + return $this; + } + + /** + * @param ?string $variant + * @return $this + */ + public function withVariant(?string $variant) + { + $this->variant = $variant; + + return $this; + } + /** * @deprecated use withPreviousValue() instead * @return $this @@ -173,7 +234,9 @@ public function build(): SetAssetDescriptionChange $this->change, $this->previousValue instanceof LocalizedStringBuilder ? $this->previousValue->build() : $this->previousValue, $this->nextValue instanceof LocalizedStringBuilder ? $this->nextValue->build() : $this->nextValue, - $this->asset instanceof AssetChangeValueBuilder ? $this->asset->build() : $this->asset + $this->asset instanceof AssetChangeValueBuilder ? $this->asset->build() : $this->asset, + $this->catalogData, + $this->variant ); } diff --git a/lib/commercetools-history/src/Models/Change/SetAssetDescriptionChangeModel.php b/lib/commercetools-history/src/Models/Change/SetAssetDescriptionChangeModel.php index 7927d24cada..5386cfa688c 100644 --- a/lib/commercetools-history/src/Models/Change/SetAssetDescriptionChangeModel.php +++ b/lib/commercetools-history/src/Models/Change/SetAssetDescriptionChangeModel.php @@ -55,6 +55,18 @@ final class SetAssetDescriptionChangeModel extends JsonObjectModel implements Se */ protected $asset; + /** + * + * @var ?string + */ + protected $catalogData; + + /** + * + * @var ?string + */ + protected $variant; + /** * @psalm-suppress MissingParamType @@ -64,12 +76,16 @@ public function __construct( ?LocalizedString $previousValue = null, ?LocalizedString $nextValue = null, ?AssetChangeValue $asset = null, + ?string $catalogData = null, + ?string $variant = null, ?string $type = null ) { $this->change = $change; $this->previousValue = $previousValue; $this->nextValue = $nextValue; $this->asset = $asset; + $this->catalogData = $catalogData; + $this->variant = $variant; $this->type = $type ?? self::DISCRIMINATOR_VALUE; } @@ -172,6 +188,51 @@ public function getAsset() return $this->asset; } + /** + *Product data that was updated.
+ *staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + * + * @return null|string + */ + public function getVariant() + { + if (is_null($this->variant)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_VARIANT); + if (is_null($data)) { + return null; + } + $this->variant = (string) $data; + } + + return $this->variant; + } + /** * @param ?string $change @@ -205,6 +266,22 @@ public function setAsset(?AssetChangeValue $asset): void $this->asset = $asset; } + /** + * @param ?string $catalogData + */ + public function setCatalogData(?string $catalogData): void + { + $this->catalogData = $catalogData; + } + + /** + * @param ?string $variant + */ + public function setVariant(?string $variant): void + { + $this->variant = $variant; + } + } diff --git a/lib/commercetools-history/src/Models/Change/SetAssetKeyChange.php b/lib/commercetools-history/src/Models/Change/SetAssetKeyChange.php index 7492bfd6b9b..843201effee 100644 --- a/lib/commercetools-history/src/Models/Change/SetAssetKeyChange.php +++ b/lib/commercetools-history/src/Models/Change/SetAssetKeyChange.php @@ -18,6 +18,8 @@ interface SetAssetKeyChange extends Change public const FIELD_PREVIOUS_VALUE = 'previousValue'; public const FIELD_NEXT_VALUE = 'nextValue'; public const FIELD_ASSET = 'asset'; + public const FIELD_CATALOG_DATA = 'catalogData'; + public const FIELD_VARIANT = 'variant'; /** @@ -55,6 +57,27 @@ public function getNextValue(); */ public function getAsset(); + /** + *Product data that was updated.
+ *staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + + * @return null|string + */ + public function getVariant(); + /** * @param ?string $change */ @@ -74,4 +97,14 @@ public function setNextValue(?string $nextValue): void; * @param ?AssetChangeValue $asset */ public function setAsset(?AssetChangeValue $asset): void; + + /** + * @param ?string $catalogData + */ + public function setCatalogData(?string $catalogData): void; + + /** + * @param ?string $variant + */ + public function setVariant(?string $variant): void; } diff --git a/lib/commercetools-history/src/Models/Change/SetAssetKeyChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetAssetKeyChangeBuilder.php index 69f2e9f8b99..58d96f8ba68 100644 --- a/lib/commercetools-history/src/Models/Change/SetAssetKeyChangeBuilder.php +++ b/lib/commercetools-history/src/Models/Change/SetAssetKeyChangeBuilder.php @@ -46,6 +46,18 @@ final class SetAssetKeyChangeBuilder implements Builder */ private $asset; + /** + + * @var ?string + */ + private $catalogData; + + /** + + * @var ?string + */ + private $variant; + /** * @return null|string @@ -88,6 +100,33 @@ public function getAsset() return $this->asset instanceof AssetChangeValueBuilder ? $this->asset->build() : $this->asset; } + /** + *Product data that was updated.
+ *staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + + * @return null|string + */ + public function getVariant() + { + return $this->variant; + } + /** * @param ?string $change * @return $this @@ -132,6 +171,28 @@ public function withAsset(?AssetChangeValue $asset) return $this; } + /** + * @param ?string $catalogData + * @return $this + */ + public function withCatalogData(?string $catalogData) + { + $this->catalogData = $catalogData; + + return $this; + } + + /** + * @param ?string $variant + * @return $this + */ + public function withVariant(?string $variant) + { + $this->variant = $variant; + + return $this; + } + /** * @deprecated use withAsset() instead * @return $this @@ -149,7 +210,9 @@ public function build(): SetAssetKeyChange $this->change, $this->previousValue, $this->nextValue, - $this->asset instanceof AssetChangeValueBuilder ? $this->asset->build() : $this->asset + $this->asset instanceof AssetChangeValueBuilder ? $this->asset->build() : $this->asset, + $this->catalogData, + $this->variant ); } diff --git a/lib/commercetools-history/src/Models/Change/SetAssetKeyChangeModel.php b/lib/commercetools-history/src/Models/Change/SetAssetKeyChangeModel.php index 61640662562..aaba7baa153 100644 --- a/lib/commercetools-history/src/Models/Change/SetAssetKeyChangeModel.php +++ b/lib/commercetools-history/src/Models/Change/SetAssetKeyChangeModel.php @@ -53,6 +53,18 @@ final class SetAssetKeyChangeModel extends JsonObjectModel implements SetAssetKe */ protected $asset; + /** + * + * @var ?string + */ + protected $catalogData; + + /** + * + * @var ?string + */ + protected $variant; + /** * @psalm-suppress MissingParamType @@ -62,12 +74,16 @@ public function __construct( ?string $previousValue = null, ?string $nextValue = null, ?AssetChangeValue $asset = null, + ?string $catalogData = null, + ?string $variant = null, ?string $type = null ) { $this->change = $change; $this->previousValue = $previousValue; $this->nextValue = $nextValue; $this->asset = $asset; + $this->catalogData = $catalogData; + $this->variant = $variant; $this->type = $type ?? self::DISCRIMINATOR_VALUE; } @@ -168,6 +184,51 @@ public function getAsset() return $this->asset; } + /** + *Product data that was updated.
+ *staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + * + * @return null|string + */ + public function getVariant() + { + if (is_null($this->variant)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_VARIANT); + if (is_null($data)) { + return null; + } + $this->variant = (string) $data; + } + + return $this->variant; + } + /** * @param ?string $change @@ -201,6 +262,22 @@ public function setAsset(?AssetChangeValue $asset): void $this->asset = $asset; } + /** + * @param ?string $catalogData + */ + public function setCatalogData(?string $catalogData): void + { + $this->catalogData = $catalogData; + } + + /** + * @param ?string $variant + */ + public function setVariant(?string $variant): void + { + $this->variant = $variant; + } + } diff --git a/lib/commercetools-history/src/Models/Change/SetAssetSourcesChange.php b/lib/commercetools-history/src/Models/Change/SetAssetSourcesChange.php index d210f33b137..7b83beba516 100644 --- a/lib/commercetools-history/src/Models/Change/SetAssetSourcesChange.php +++ b/lib/commercetools-history/src/Models/Change/SetAssetSourcesChange.php @@ -19,6 +19,8 @@ interface SetAssetSourcesChange extends Change public const FIELD_PREVIOUS_VALUE = 'previousValue'; public const FIELD_NEXT_VALUE = 'nextValue'; public const FIELD_ASSET = 'asset'; + public const FIELD_CATALOG_DATA = 'catalogData'; + public const FIELD_VARIANT = 'variant'; /** @@ -56,6 +58,27 @@ public function getNextValue(); */ public function getAsset(); + /** + *Product data that was updated.
+ *staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + + * @return null|string + */ + public function getVariant(); + /** * @param ?string $change */ @@ -75,4 +98,14 @@ public function setNextValue(?AssetSourceCollection $nextValue): void; * @param ?AssetChangeValue $asset */ public function setAsset(?AssetChangeValue $asset): void; + + /** + * @param ?string $catalogData + */ + public function setCatalogData(?string $catalogData): void; + + /** + * @param ?string $variant + */ + public function setVariant(?string $variant): void; } diff --git a/lib/commercetools-history/src/Models/Change/SetAssetSourcesChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetAssetSourcesChangeBuilder.php index 691080f65f8..183df800147 100644 --- a/lib/commercetools-history/src/Models/Change/SetAssetSourcesChangeBuilder.php +++ b/lib/commercetools-history/src/Models/Change/SetAssetSourcesChangeBuilder.php @@ -47,6 +47,18 @@ final class SetAssetSourcesChangeBuilder implements Builder */ private $asset; + /** + + * @var ?string + */ + private $catalogData; + + /** + + * @var ?string + */ + private $variant; + /** * @return null|string @@ -89,6 +101,33 @@ public function getAsset() return $this->asset instanceof AssetChangeValueBuilder ? $this->asset->build() : $this->asset; } + /** + *Product data that was updated.
+ *staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + + * @return null|string + */ + public function getVariant() + { + return $this->variant; + } + /** * @param ?string $change * @return $this @@ -133,6 +172,28 @@ public function withAsset(?AssetChangeValue $asset) return $this; } + /** + * @param ?string $catalogData + * @return $this + */ + public function withCatalogData(?string $catalogData) + { + $this->catalogData = $catalogData; + + return $this; + } + + /** + * @param ?string $variant + * @return $this + */ + public function withVariant(?string $variant) + { + $this->variant = $variant; + + return $this; + } + /** * @deprecated use withAsset() instead * @return $this @@ -150,7 +211,9 @@ public function build(): SetAssetSourcesChange $this->change, $this->previousValue, $this->nextValue, - $this->asset instanceof AssetChangeValueBuilder ? $this->asset->build() : $this->asset + $this->asset instanceof AssetChangeValueBuilder ? $this->asset->build() : $this->asset, + $this->catalogData, + $this->variant ); } diff --git a/lib/commercetools-history/src/Models/Change/SetAssetSourcesChangeModel.php b/lib/commercetools-history/src/Models/Change/SetAssetSourcesChangeModel.php index f8e6c8f6d2b..c2f7f178b15 100644 --- a/lib/commercetools-history/src/Models/Change/SetAssetSourcesChangeModel.php +++ b/lib/commercetools-history/src/Models/Change/SetAssetSourcesChangeModel.php @@ -54,6 +54,18 @@ final class SetAssetSourcesChangeModel extends JsonObjectModel implements SetAss */ protected $asset; + /** + * + * @var ?string + */ + protected $catalogData; + + /** + * + * @var ?string + */ + protected $variant; + /** * @psalm-suppress MissingParamType @@ -63,12 +75,16 @@ public function __construct( ?AssetSourceCollection $previousValue = null, ?AssetSourceCollection $nextValue = null, ?AssetChangeValue $asset = null, + ?string $catalogData = null, + ?string $variant = null, ?string $type = null ) { $this->change = $change; $this->previousValue = $previousValue; $this->nextValue = $nextValue; $this->asset = $asset; + $this->catalogData = $catalogData; + $this->variant = $variant; $this->type = $type ?? self::DISCRIMINATOR_VALUE; } @@ -169,6 +185,51 @@ public function getAsset() return $this->asset; } + /** + *Product data that was updated.
+ *staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + * + * @return null|string + */ + public function getVariant() + { + if (is_null($this->variant)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_VARIANT); + if (is_null($data)) { + return null; + } + $this->variant = (string) $data; + } + + return $this->variant; + } + /** * @param ?string $change @@ -202,6 +263,22 @@ public function setAsset(?AssetChangeValue $asset): void $this->asset = $asset; } + /** + * @param ?string $catalogData + */ + public function setCatalogData(?string $catalogData): void + { + $this->catalogData = $catalogData; + } + + /** + * @param ?string $variant + */ + public function setVariant(?string $variant): void + { + $this->variant = $variant; + } + } diff --git a/lib/commercetools-history/src/Models/Change/SetAssetTagsChange.php b/lib/commercetools-history/src/Models/Change/SetAssetTagsChange.php index 52c76e148e0..975a971a1cd 100644 --- a/lib/commercetools-history/src/Models/Change/SetAssetTagsChange.php +++ b/lib/commercetools-history/src/Models/Change/SetAssetTagsChange.php @@ -18,6 +18,8 @@ interface SetAssetTagsChange extends Change public const FIELD_PREVIOUS_VALUE = 'previousValue'; public const FIELD_NEXT_VALUE = 'nextValue'; public const FIELD_ASSET = 'asset'; + public const FIELD_CATALOG_DATA = 'catalogData'; + public const FIELD_VARIANT = 'variant'; /** @@ -55,6 +57,27 @@ public function getNextValue(); */ public function getAsset(); + /** + *Product data that was updated.
+ *staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + + * @return null|string + */ + public function getVariant(); + /** * @param ?string $change */ @@ -74,4 +97,14 @@ public function setNextValue(?array $nextValue): void; * @param ?AssetChangeValue $asset */ public function setAsset(?AssetChangeValue $asset): void; + + /** + * @param ?string $catalogData + */ + public function setCatalogData(?string $catalogData): void; + + /** + * @param ?string $variant + */ + public function setVariant(?string $variant): void; } diff --git a/lib/commercetools-history/src/Models/Change/SetAssetTagsChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetAssetTagsChangeBuilder.php index f722230798b..a64f9cdada5 100644 --- a/lib/commercetools-history/src/Models/Change/SetAssetTagsChangeBuilder.php +++ b/lib/commercetools-history/src/Models/Change/SetAssetTagsChangeBuilder.php @@ -46,6 +46,18 @@ final class SetAssetTagsChangeBuilder implements Builder */ private $asset; + /** + + * @var ?string + */ + private $catalogData; + + /** + + * @var ?string + */ + private $variant; + /** * @return null|string @@ -88,6 +100,33 @@ public function getAsset() return $this->asset instanceof AssetChangeValueBuilder ? $this->asset->build() : $this->asset; } + /** + *Product data that was updated.
+ *staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + + * @return null|string + */ + public function getVariant() + { + return $this->variant; + } + /** * @param ?string $change * @return $this @@ -132,6 +171,28 @@ public function withAsset(?AssetChangeValue $asset) return $this; } + /** + * @param ?string $catalogData + * @return $this + */ + public function withCatalogData(?string $catalogData) + { + $this->catalogData = $catalogData; + + return $this; + } + + /** + * @param ?string $variant + * @return $this + */ + public function withVariant(?string $variant) + { + $this->variant = $variant; + + return $this; + } + /** * @deprecated use withAsset() instead * @return $this @@ -149,7 +210,9 @@ public function build(): SetAssetTagsChange $this->change, $this->previousValue, $this->nextValue, - $this->asset instanceof AssetChangeValueBuilder ? $this->asset->build() : $this->asset + $this->asset instanceof AssetChangeValueBuilder ? $this->asset->build() : $this->asset, + $this->catalogData, + $this->variant ); } diff --git a/lib/commercetools-history/src/Models/Change/SetAssetTagsChangeModel.php b/lib/commercetools-history/src/Models/Change/SetAssetTagsChangeModel.php index 5c24a2b1330..5a1b3adc359 100644 --- a/lib/commercetools-history/src/Models/Change/SetAssetTagsChangeModel.php +++ b/lib/commercetools-history/src/Models/Change/SetAssetTagsChangeModel.php @@ -53,6 +53,18 @@ final class SetAssetTagsChangeModel extends JsonObjectModel implements SetAssetT */ protected $asset; + /** + * + * @var ?string + */ + protected $catalogData; + + /** + * + * @var ?string + */ + protected $variant; + /** * @psalm-suppress MissingParamType @@ -62,12 +74,16 @@ public function __construct( ?array $previousValue = null, ?array $nextValue = null, ?AssetChangeValue $asset = null, + ?string $catalogData = null, + ?string $variant = null, ?string $type = null ) { $this->change = $change; $this->previousValue = $previousValue; $this->nextValue = $nextValue; $this->asset = $asset; + $this->catalogData = $catalogData; + $this->variant = $variant; $this->type = $type ?? self::DISCRIMINATOR_VALUE; } @@ -168,6 +184,51 @@ public function getAsset() return $this->asset; } + /** + *Product data that was updated.
+ *staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + * + * @return null|string + */ + public function getVariant() + { + if (is_null($this->variant)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_VARIANT); + if (is_null($data)) { + return null; + } + $this->variant = (string) $data; + } + + return $this->variant; + } + /** * @param ?string $change @@ -201,6 +262,22 @@ public function setAsset(?AssetChangeValue $asset): void $this->asset = $asset; } + /** + * @param ?string $catalogData + */ + public function setCatalogData(?string $catalogData): void + { + $this->catalogData = $catalogData; + } + + /** + * @param ?string $variant + */ + public function setVariant(?string $variant): void + { + $this->variant = $variant; + } + } diff --git a/lib/commercetools-history/src/Models/Change/SetAssociatesChange.php b/lib/commercetools-history/src/Models/Change/SetAssociatesChange.php new file mode 100644 index 00000000000..26c0e02c156 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetAssociatesChange.php @@ -0,0 +1,91 @@ +Elements added to the array. + * + + * @return null|AssociateCollection + */ + public function getAddedItems(); + + /** + *Elements removed from the array.
+ * + + * @return null|AssociateCollection + */ + public function getRemovedItems(); + + /** + *Value before the change.
+ * + + * @return null|AssociateCollection + */ + public function getPreviousValue(); + + /** + *Value after the change.
+ * + + * @return null|AssociateCollection + */ + public function getNextValue(); + + /** + * @param ?string $change + */ + public function setChange(?string $change): void; + + /** + * @param ?AssociateCollection $addedItems + */ + public function setAddedItems(?AssociateCollection $addedItems): void; + + /** + * @param ?AssociateCollection $removedItems + */ + public function setRemovedItems(?AssociateCollection $removedItems): void; + + /** + * @param ?AssociateCollection $previousValue + */ + public function setPreviousValue(?AssociateCollection $previousValue): void; + + /** + * @param ?AssociateCollection $nextValue + */ + public function setNextValue(?AssociateCollection $nextValue): void; +} diff --git a/lib/commercetools-history/src/Models/Change/SetAssociatesChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetAssociatesChangeBuilder.php new file mode 100644 index 00000000000..c6f0cc71f30 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetAssociatesChangeBuilder.php @@ -0,0 +1,178 @@ + + */ +final class SetAssociatesChangeBuilder implements Builder +{ + /** + + * @var ?string + */ + private $change; + + /** + + * @var ?AssociateCollection + */ + private $addedItems; + + /** + + * @var ?AssociateCollection + */ + private $removedItems; + + /** + + * @var ?AssociateCollection + */ + private $previousValue; + + /** + + * @var ?AssociateCollection + */ + private $nextValue; + + /** + + * @return null|string + */ + public function getChange() + { + return $this->change; + } + + /** + *Elements added to the array.
+ * + + * @return null|AssociateCollection + */ + public function getAddedItems() + { + return $this->addedItems; + } + + /** + *Elements removed from the array.
+ * + + * @return null|AssociateCollection + */ + public function getRemovedItems() + { + return $this->removedItems; + } + + /** + *Value before the change.
+ * + + * @return null|AssociateCollection + */ + public function getPreviousValue() + { + return $this->previousValue; + } + + /** + *Value after the change.
+ * + + * @return null|AssociateCollection + */ + public function getNextValue() + { + return $this->nextValue; + } + + /** + * @param ?string $change + * @return $this + */ + public function withChange(?string $change) + { + $this->change = $change; + + return $this; + } + + /** + * @param ?AssociateCollection $addedItems + * @return $this + */ + public function withAddedItems(?AssociateCollection $addedItems) + { + $this->addedItems = $addedItems; + + return $this; + } + + /** + * @param ?AssociateCollection $removedItems + * @return $this + */ + public function withRemovedItems(?AssociateCollection $removedItems) + { + $this->removedItems = $removedItems; + + return $this; + } + + /** + * @param ?AssociateCollection $previousValue + * @return $this + */ + public function withPreviousValue(?AssociateCollection $previousValue) + { + $this->previousValue = $previousValue; + + return $this; + } + + /** + * @param ?AssociateCollection $nextValue + * @return $this + */ + public function withNextValue(?AssociateCollection $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + + public function build(): SetAssociatesChange + { + return new SetAssociatesChangeModel( + $this->change, + $this->addedItems, + $this->removedItems, + $this->previousValue, + $this->nextValue + ); + } + + public static function of(): SetAssociatesChangeBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetAssociatesChangeCollection.php b/lib/commercetools-history/src/Models/Change/SetAssociatesChangeCollection.php new file mode 100644 index 00000000000..a8fb44c6dfb --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetAssociatesChangeCollection.php @@ -0,0 +1,56 @@ + + * @method SetAssociatesChange current() + * @method SetAssociatesChange end() + * @method SetAssociatesChange at($offset) + */ +class SetAssociatesChangeCollection extends ChangeCollection +{ + /** + * @psalm-assert SetAssociatesChange $value + * @psalm-param SetAssociatesChange|stdClass $value + * @throws InvalidArgumentException + * + * @return SetAssociatesChangeCollection + */ + public function add($value) + { + if (!$value instanceof SetAssociatesChange) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?SetAssociatesChange + */ + protected function mapper() + { + return function (?int $index): ?SetAssociatesChange { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var SetAssociatesChange $data */ + $data = SetAssociatesChangeModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetAssociatesChangeModel.php b/lib/commercetools-history/src/Models/Change/SetAssociatesChangeModel.php new file mode 100644 index 00000000000..42b2285db99 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetAssociatesChangeModel.php @@ -0,0 +1,240 @@ +change = $change; + $this->addedItems = $addedItems; + $this->removedItems = $removedItems; + $this->previousValue = $previousValue; + $this->nextValue = $nextValue; + $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; + } + + /** + * + * @return null|string + */ + public function getChange() + { + if (is_null($this->change)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CHANGE); + if (is_null($data)) { + return null; + } + $this->change = (string) $data; + } + + return $this->change; + } + + /** + *Elements added to the array.
+ * + * + * @return null|AssociateCollection + */ + public function getAddedItems() + { + if (is_null($this->addedItems)) { + /** @psalm-var ?listElements removed from the array.
+ * + * + * @return null|AssociateCollection + */ + public function getRemovedItems() + { + if (is_null($this->removedItems)) { + /** @psalm-var ?listValue before the change.
+ * + * + * @return null|AssociateCollection + */ + public function getPreviousValue() + { + if (is_null($this->previousValue)) { + /** @psalm-var ?listValue after the change.
+ * + * + * @return null|AssociateCollection + */ + public function getNextValue() + { + if (is_null($this->nextValue)) { + /** @psalm-var ?listValue before the change.
* - * @return null|AttributeValue + * @return null|Attribute */ public function getPreviousValue(); @@ -43,11 +44,12 @@ public function getPreviousValue(); *Value after the change.
* - * @return null|AttributeValue + * @return null|Attribute */ public function getNextValue(); /** + *Product data that was updated.
*staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + + * @return null|string + */ + public function getVariant(); + /** * @param ?string $change */ public function setChange(?string $change): void; /** - * @param ?AttributeValue $previousValue + * @param ?Attribute $previousValue */ - public function setPreviousValue(?AttributeValue $previousValue): void; + public function setPreviousValue(?Attribute $previousValue): void; /** - * @param ?AttributeValue $nextValue + * @param ?Attribute $nextValue */ - public function setNextValue(?AttributeValue $nextValue): void; + public function setNextValue(?Attribute $nextValue): void; /** * @param ?string $catalogData */ public function setCatalogData(?string $catalogData): void; + + /** + * @param ?string $variant + */ + public function setVariant(?string $variant): void; } diff --git a/lib/commercetools-history/src/Models/Change/SetAttributeChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetAttributeChangeBuilder.php index 22293f49f11..dffc7745989 100644 --- a/lib/commercetools-history/src/Models/Change/SetAttributeChangeBuilder.php +++ b/lib/commercetools-history/src/Models/Change/SetAttributeChangeBuilder.php @@ -14,8 +14,8 @@ use Commercetools\Base\JsonObjectModel; use Commercetools\Base\MapperFactory; use stdClass; -use Commercetools\History\Models\ChangeValue\AttributeValue; -use Commercetools\History\Models\ChangeValue\AttributeValueBuilder; +use Commercetools\History\Models\Common\Attribute; +use Commercetools\History\Models\Common\AttributeBuilder; /** * @implements BuilderValue before the change.
* - * @return null|AttributeValue + * @return null|Attribute */ public function getPreviousValue() { - return $this->previousValue instanceof AttributeValueBuilder ? $this->previousValue->build() : $this->previousValue; + return $this->previousValue instanceof AttributeBuilder ? $this->previousValue->build() : $this->previousValue; } /** *Value after the change.
* - * @return null|AttributeValue + * @return null|Attribute */ public function getNextValue() { - return $this->nextValue instanceof AttributeValueBuilder ? $this->nextValue->build() : $this->nextValue; + return $this->nextValue instanceof AttributeBuilder ? $this->nextValue->build() : $this->nextValue; } /** + *Product data that was updated.
*staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + + * @return null|string + */ + public function getVariant() + { + return $this->variant; + } + /** * @param ?string $change * @return $this @@ -103,10 +122,10 @@ public function withChange(?string $change) } /** - * @param ?AttributeValue $previousValue + * @param ?Attribute $previousValue * @return $this */ - public function withPreviousValue(?AttributeValue $previousValue) + public function withPreviousValue(?Attribute $previousValue) { $this->previousValue = $previousValue; @@ -114,10 +133,10 @@ public function withPreviousValue(?AttributeValue $previousValue) } /** - * @param ?AttributeValue $nextValue + * @param ?Attribute $nextValue * @return $this */ - public function withNextValue(?AttributeValue $nextValue) + public function withNextValue(?Attribute $nextValue) { $this->nextValue = $nextValue; @@ -135,11 +154,22 @@ public function withCatalogData(?string $catalogData) return $this; } + /** + * @param ?string $variant + * @return $this + */ + public function withVariant(?string $variant) + { + $this->variant = $variant; + + return $this; + } + /** * @deprecated use withPreviousValue() instead * @return $this */ - public function withPreviousValueBuilder(?AttributeValueBuilder $previousValue) + public function withPreviousValueBuilder(?AttributeBuilder $previousValue) { $this->previousValue = $previousValue; @@ -150,7 +180,7 @@ public function withPreviousValueBuilder(?AttributeValueBuilder $previousValue) * @deprecated use withNextValue() instead * @return $this */ - public function withNextValueBuilder(?AttributeValueBuilder $nextValue) + public function withNextValueBuilder(?AttributeBuilder $nextValue) { $this->nextValue = $nextValue; @@ -161,9 +191,10 @@ public function build(): SetAttributeChange { return new SetAttributeChangeModel( $this->change, - $this->previousValue instanceof AttributeValueBuilder ? $this->previousValue->build() : $this->previousValue, - $this->nextValue instanceof AttributeValueBuilder ? $this->nextValue->build() : $this->nextValue, - $this->catalogData + $this->previousValue instanceof AttributeBuilder ? $this->previousValue->build() : $this->previousValue, + $this->nextValue instanceof AttributeBuilder ? $this->nextValue->build() : $this->nextValue, + $this->catalogData, + $this->variant ); } diff --git a/lib/commercetools-history/src/Models/Change/SetAttributeChangeModel.php b/lib/commercetools-history/src/Models/Change/SetAttributeChangeModel.php index 4f501d6bc95..06e343620e1 100644 --- a/lib/commercetools-history/src/Models/Change/SetAttributeChangeModel.php +++ b/lib/commercetools-history/src/Models/Change/SetAttributeChangeModel.php @@ -13,8 +13,8 @@ use Commercetools\Base\JsonObjectModel; use Commercetools\Base\MapperFactory; use stdClass; -use Commercetools\History\Models\ChangeValue\AttributeValue; -use Commercetools\History\Models\ChangeValue\AttributeValueModel; +use Commercetools\History\Models\Common\Attribute; +use Commercetools\History\Models\Common\AttributeModel; /** * @internal @@ -37,13 +37,13 @@ final class SetAttributeChangeModel extends JsonObjectModel implements SetAttrib /** * - * @var ?AttributeValue + * @var ?Attribute */ protected $previousValue; /** * - * @var ?AttributeValue + * @var ?Attribute */ protected $nextValue; @@ -53,21 +53,29 @@ final class SetAttributeChangeModel extends JsonObjectModel implements SetAttrib */ protected $catalogData; + /** + * + * @var ?string + */ + protected $variant; + /** * @psalm-suppress MissingParamType */ public function __construct( ?string $change = null, - ?AttributeValue $previousValue = null, - ?AttributeValue $nextValue = null, + ?Attribute $previousValue = null, + ?Attribute $nextValue = null, ?string $catalogData = null, + ?string $variant = null, ?string $type = null ) { $this->change = $change; $this->previousValue = $previousValue; $this->nextValue = $nextValue; $this->catalogData = $catalogData; + $this->variant = $variant; $this->type = $type ?? self::DISCRIMINATOR_VALUE; } @@ -111,7 +119,7 @@ public function getChange() *Value before the change.
* * - * @return null|AttributeValue + * @return null|Attribute */ public function getPreviousValue() { @@ -122,7 +130,7 @@ public function getPreviousValue() return null; } - $this->previousValue = AttributeValueModel::of($data); + $this->previousValue = AttributeModel::of($data); } return $this->previousValue; @@ -132,7 +140,7 @@ public function getPreviousValue() *Value after the change.
* * - * @return null|AttributeValue + * @return null|Attribute */ public function getNextValue() { @@ -143,13 +151,14 @@ public function getNextValue() return null; } - $this->nextValue = AttributeValueModel::of($data); + $this->nextValue = AttributeModel::of($data); } return $this->nextValue; } /** + *Product data that was updated.
*staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + * + * @return null|string + */ + public function getVariant() + { + if (is_null($this->variant)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_VARIANT); + if (is_null($data)) { + return null; + } + $this->variant = (string) $data; + } + + return $this->variant; + } + /** * @param ?string $change @@ -182,17 +212,17 @@ public function setChange(?string $change): void } /** - * @param ?AttributeValue $previousValue + * @param ?Attribute $previousValue */ - public function setPreviousValue(?AttributeValue $previousValue): void + public function setPreviousValue(?Attribute $previousValue): void { $this->previousValue = $previousValue; } /** - * @param ?AttributeValue $nextValue + * @param ?Attribute $nextValue */ - public function setNextValue(?AttributeValue $nextValue): void + public function setNextValue(?Attribute $nextValue): void { $this->nextValue = $nextValue; } @@ -205,6 +235,14 @@ public function setCatalogData(?string $catalogData): void $this->catalogData = $catalogData; } + /** + * @param ?string $variant + */ + public function setVariant(?string $variant): void + { + $this->variant = $variant; + } + } diff --git a/lib/commercetools-history/src/Models/Change/SetBillingAddressCustomFieldChange.php b/lib/commercetools-history/src/Models/Change/SetBillingAddressCustomFieldChange.php new file mode 100644 index 00000000000..305b1badf68 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetBillingAddressCustomFieldChange.php @@ -0,0 +1,90 @@ +Name of the Custom Field. + * + + * @return null|string + */ + public function getName(); + + /** + *id of the referenced Type.
Value before the change.
+ * + + * @return null|mixed + */ + public function getPreviousValue(); + + /** + *Value after the change.
+ * + + * @return null|mixed + */ + public function getNextValue(); + + /** + * @param ?string $change + */ + public function setChange(?string $change): void; + + /** + * @param ?string $name + */ + public function setName(?string $name): void; + + /** + * @param ?string $customTypeId + */ + public function setCustomTypeId(?string $customTypeId): void; + + /** + * @param mixed $previousValue + */ + public function setPreviousValue( $previousValue): void; + + /** + * @param mixed $nextValue + */ + public function setNextValue( $nextValue): void; +} diff --git a/lib/commercetools-history/src/Models/Change/SetBillingAddressCustomFieldChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetBillingAddressCustomFieldChangeBuilder.php new file mode 100644 index 00000000000..33805ba8696 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetBillingAddressCustomFieldChangeBuilder.php @@ -0,0 +1,177 @@ + + */ +final class SetBillingAddressCustomFieldChangeBuilder implements Builder +{ + /** + + * @var ?string + */ + private $change; + + /** + + * @var ?string + */ + private $name; + + /** + + * @var ?string + */ + private $customTypeId; + + /** + + * @var null|mixed|mixed + */ + private $previousValue; + + /** + + * @var null|mixed|mixed + */ + private $nextValue; + + /** + + * @return null|string + */ + public function getChange() + { + return $this->change; + } + + /** + *Name of the Custom Field.
+ * + + * @return null|string + */ + public function getName() + { + return $this->name; + } + + /** + *id of the referenced Type.
Value before the change.
+ * + + * @return null|mixed + */ + public function getPreviousValue() + { + return $this->previousValue; + } + + /** + *Value after the change.
+ * + + * @return null|mixed + */ + public function getNextValue() + { + return $this->nextValue; + } + + /** + * @param ?string $change + * @return $this + */ + public function withChange(?string $change) + { + $this->change = $change; + + return $this; + } + + /** + * @param ?string $name + * @return $this + */ + public function withName(?string $name) + { + $this->name = $name; + + return $this; + } + + /** + * @param ?string $customTypeId + * @return $this + */ + public function withCustomTypeId(?string $customTypeId) + { + $this->customTypeId = $customTypeId; + + return $this; + } + + /** + * @param mixed $previousValue + * @return $this + */ + public function withPreviousValue( $previousValue) + { + $this->previousValue = $previousValue; + + return $this; + } + + /** + * @param mixed $nextValue + * @return $this + */ + public function withNextValue( $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + + public function build(): SetBillingAddressCustomFieldChange + { + return new SetBillingAddressCustomFieldChangeModel( + $this->change, + $this->name, + $this->customTypeId, + $this->previousValue, + $this->nextValue + ); + } + + public static function of(): SetBillingAddressCustomFieldChangeBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetBillingAddressCustomFieldChangeCollection.php b/lib/commercetools-history/src/Models/Change/SetBillingAddressCustomFieldChangeCollection.php new file mode 100644 index 00000000000..a5d039149ad --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetBillingAddressCustomFieldChangeCollection.php @@ -0,0 +1,56 @@ + + * @method SetBillingAddressCustomFieldChange current() + * @method SetBillingAddressCustomFieldChange end() + * @method SetBillingAddressCustomFieldChange at($offset) + */ +class SetBillingAddressCustomFieldChangeCollection extends ChangeCollection +{ + /** + * @psalm-assert SetBillingAddressCustomFieldChange $value + * @psalm-param SetBillingAddressCustomFieldChange|stdClass $value + * @throws InvalidArgumentException + * + * @return SetBillingAddressCustomFieldChangeCollection + */ + public function add($value) + { + if (!$value instanceof SetBillingAddressCustomFieldChange) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?SetBillingAddressCustomFieldChange + */ + protected function mapper() + { + return function (?int $index): ?SetBillingAddressCustomFieldChange { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var SetBillingAddressCustomFieldChange $data */ + $data = SetBillingAddressCustomFieldChangeModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetBillingAddressCustomFieldChangeModel.php b/lib/commercetools-history/src/Models/Change/SetBillingAddressCustomFieldChangeModel.php new file mode 100644 index 00000000000..2264018d536 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetBillingAddressCustomFieldChangeModel.php @@ -0,0 +1,239 @@ +change = $change; + $this->name = $name; + $this->customTypeId = $customTypeId; + $this->previousValue = $previousValue; + $this->nextValue = $nextValue; + $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; + } + + /** + * + * @return null|string + */ + public function getChange() + { + if (is_null($this->change)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CHANGE); + if (is_null($data)) { + return null; + } + $this->change = (string) $data; + } + + return $this->change; + } + + /** + *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; + } + + /** + *id of the referenced Type.
Value before the change.
+ * + * + * @return null|mixed + */ + public function getPreviousValue() + { + if (is_null($this->previousValue)) { + /** @psalm-var mixed $data */ + $data = $this->raw(self::FIELD_PREVIOUS_VALUE); + if (is_null($data)) { + return null; + } + $this->previousValue = $data; + } + + return $this->previousValue; + } + + /** + *Value after the change.
+ * + * + * @return null|mixed + */ + public function getNextValue() + { + if (is_null($this->nextValue)) { + /** @psalm-var mixed $data */ + $data = $this->raw(self::FIELD_NEXT_VALUE); + if (is_null($data)) { + return null; + } + $this->nextValue = $data; + } + + return $this->nextValue; + } + + + /** + * @param ?string $change + */ + public function setChange(?string $change): void + { + $this->change = $change; + } + + /** + * @param ?string $name + */ + public function setName(?string $name): void + { + $this->name = $name; + } + + /** + * @param ?string $customTypeId + */ + public function setCustomTypeId(?string $customTypeId): void + { + $this->customTypeId = $customTypeId; + } + + /** + * @param mixed $previousValue + */ + public function setPreviousValue( $previousValue): void + { + $this->previousValue = $previousValue; + } + + /** + * @param mixed $nextValue + */ + public function setNextValue( $nextValue): void + { + $this->nextValue = $nextValue; + } + + + +} diff --git a/lib/commercetools-history/src/Models/Change/SetBillingAddressCustomTypeChange.php b/lib/commercetools-history/src/Models/Change/SetBillingAddressCustomTypeChange.php new file mode 100644 index 00000000000..be160d0aa22 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetBillingAddressCustomTypeChange.php @@ -0,0 +1,63 @@ +Value before the change. + * + + * @return null|CustomFields + */ + public function getPreviousValue(); + + /** + *Value after the change.
+ * + + * @return null|CustomFields + */ + public function getNextValue(); + + /** + * @param ?string $change + */ + public function setChange(?string $change): void; + + /** + * @param ?CustomFields $previousValue + */ + public function setPreviousValue(?CustomFields $previousValue): void; + + /** + * @param ?CustomFields $nextValue + */ + public function setNextValue(?CustomFields $nextValue): void; +} diff --git a/lib/commercetools-history/src/Models/Change/SetBillingAddressCustomTypeChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetBillingAddressCustomTypeChangeBuilder.php new file mode 100644 index 00000000000..37f5cae50dd --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetBillingAddressCustomTypeChangeBuilder.php @@ -0,0 +1,142 @@ + + */ +final class SetBillingAddressCustomTypeChangeBuilder implements Builder +{ + /** + + * @var ?string + */ + private $change; + + /** + + * @var null|CustomFields|CustomFieldsBuilder + */ + private $previousValue; + + /** + + * @var null|CustomFields|CustomFieldsBuilder + */ + private $nextValue; + + /** + + * @return null|string + */ + public function getChange() + { + return $this->change; + } + + /** + *Value before the change.
+ * + + * @return null|CustomFields + */ + public function getPreviousValue() + { + return $this->previousValue instanceof CustomFieldsBuilder ? $this->previousValue->build() : $this->previousValue; + } + + /** + *Value after the change.
+ * + + * @return null|CustomFields + */ + public function getNextValue() + { + return $this->nextValue instanceof CustomFieldsBuilder ? $this->nextValue->build() : $this->nextValue; + } + + /** + * @param ?string $change + * @return $this + */ + public function withChange(?string $change) + { + $this->change = $change; + + return $this; + } + + /** + * @param ?CustomFields $previousValue + * @return $this + */ + public function withPreviousValue(?CustomFields $previousValue) + { + $this->previousValue = $previousValue; + + return $this; + } + + /** + * @param ?CustomFields $nextValue + * @return $this + */ + public function withNextValue(?CustomFields $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + /** + * @deprecated use withPreviousValue() instead + * @return $this + */ + public function withPreviousValueBuilder(?CustomFieldsBuilder $previousValue) + { + $this->previousValue = $previousValue; + + return $this; + } + + /** + * @deprecated use withNextValue() instead + * @return $this + */ + public function withNextValueBuilder(?CustomFieldsBuilder $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + public function build(): SetBillingAddressCustomTypeChange + { + return new SetBillingAddressCustomTypeChangeModel( + $this->change, + $this->previousValue instanceof CustomFieldsBuilder ? $this->previousValue->build() : $this->previousValue, + $this->nextValue instanceof CustomFieldsBuilder ? $this->nextValue->build() : $this->nextValue + ); + } + + public static function of(): SetBillingAddressCustomTypeChangeBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetBillingAddressCustomTypeChangeCollection.php b/lib/commercetools-history/src/Models/Change/SetBillingAddressCustomTypeChangeCollection.php new file mode 100644 index 00000000000..92c2ca6282b --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetBillingAddressCustomTypeChangeCollection.php @@ -0,0 +1,56 @@ + + * @method SetBillingAddressCustomTypeChange current() + * @method SetBillingAddressCustomTypeChange end() + * @method SetBillingAddressCustomTypeChange at($offset) + */ +class SetBillingAddressCustomTypeChangeCollection extends ChangeCollection +{ + /** + * @psalm-assert SetBillingAddressCustomTypeChange $value + * @psalm-param SetBillingAddressCustomTypeChange|stdClass $value + * @throws InvalidArgumentException + * + * @return SetBillingAddressCustomTypeChangeCollection + */ + public function add($value) + { + if (!$value instanceof SetBillingAddressCustomTypeChange) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?SetBillingAddressCustomTypeChange + */ + protected function mapper() + { + return function (?int $index): ?SetBillingAddressCustomTypeChange { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var SetBillingAddressCustomTypeChange $data */ + $data = SetBillingAddressCustomTypeChangeModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetBillingAddressCustomTypeChangeModel.php b/lib/commercetools-history/src/Models/Change/SetBillingAddressCustomTypeChangeModel.php new file mode 100644 index 00000000000..836d9c8d1fe --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetBillingAddressCustomTypeChangeModel.php @@ -0,0 +1,171 @@ +change = $change; + $this->previousValue = $previousValue; + $this->nextValue = $nextValue; + $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; + } + + /** + * + * @return null|string + */ + public function getChange() + { + if (is_null($this->change)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CHANGE); + if (is_null($data)) { + return null; + } + $this->change = (string) $data; + } + + return $this->change; + } + + /** + *Value before the change.
+ * + * + * @return null|CustomFields + */ + public function getPreviousValue() + { + if (is_null($this->previousValue)) { + /** @psalm-var stdClass|arrayValue after the change.
+ * + * + * @return null|CustomFields + */ + public function getNextValue() + { + if (is_null($this->nextValue)) { + /** @psalm-var stdClass|arrayValue after the change.
+ * + + * @return null|KeyReference + */ + public function getNextValue(); + + /** + * @param ?string $change + */ + public function setChange(?string $change): void; + + /** + * @param ?KeyReference $previousValue + */ + public function setPreviousValue(?KeyReference $previousValue): void; + + /** + * @param ?KeyReference $nextValue + */ + public function setNextValue(?KeyReference $nextValue): void; +} diff --git a/lib/commercetools-history/src/Models/Change/SetBusinessUnitChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetBusinessUnitChangeBuilder.php new file mode 100644 index 00000000000..9e39a0b16b4 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetBusinessUnitChangeBuilder.php @@ -0,0 +1,142 @@ + + */ +final class SetBusinessUnitChangeBuilder implements Builder +{ + /** + + * @var ?string + */ + private $change; + + /** + + * @var null|KeyReference|KeyReferenceBuilder + */ + private $previousValue; + + /** + + * @var null|KeyReference|KeyReferenceBuilder + */ + private $nextValue; + + /** + + * @return null|string + */ + public function getChange() + { + return $this->change; + } + + /** + *Value before the change.
+ * + + * @return null|KeyReference + */ + public function getPreviousValue() + { + return $this->previousValue instanceof KeyReferenceBuilder ? $this->previousValue->build() : $this->previousValue; + } + + /** + *Value after the change.
+ * + + * @return null|KeyReference + */ + public function getNextValue() + { + return $this->nextValue instanceof KeyReferenceBuilder ? $this->nextValue->build() : $this->nextValue; + } + + /** + * @param ?string $change + * @return $this + */ + public function withChange(?string $change) + { + $this->change = $change; + + return $this; + } + + /** + * @param ?KeyReference $previousValue + * @return $this + */ + public function withPreviousValue(?KeyReference $previousValue) + { + $this->previousValue = $previousValue; + + return $this; + } + + /** + * @param ?KeyReference $nextValue + * @return $this + */ + public function withNextValue(?KeyReference $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + /** + * @deprecated use withPreviousValue() instead + * @return $this + */ + public function withPreviousValueBuilder(?KeyReferenceBuilder $previousValue) + { + $this->previousValue = $previousValue; + + return $this; + } + + /** + * @deprecated use withNextValue() instead + * @return $this + */ + public function withNextValueBuilder(?KeyReferenceBuilder $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + public function build(): SetBusinessUnitChange + { + return new SetBusinessUnitChangeModel( + $this->change, + $this->previousValue instanceof KeyReferenceBuilder ? $this->previousValue->build() : $this->previousValue, + $this->nextValue instanceof KeyReferenceBuilder ? $this->nextValue->build() : $this->nextValue + ); + } + + public static function of(): SetBusinessUnitChangeBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetBusinessUnitChangeCollection.php b/lib/commercetools-history/src/Models/Change/SetBusinessUnitChangeCollection.php new file mode 100644 index 00000000000..254b0a2e160 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetBusinessUnitChangeCollection.php @@ -0,0 +1,56 @@ + + * @method SetBusinessUnitChange current() + * @method SetBusinessUnitChange end() + * @method SetBusinessUnitChange at($offset) + */ +class SetBusinessUnitChangeCollection extends ChangeCollection +{ + /** + * @psalm-assert SetBusinessUnitChange $value + * @psalm-param SetBusinessUnitChange|stdClass $value + * @throws InvalidArgumentException + * + * @return SetBusinessUnitChangeCollection + */ + public function add($value) + { + if (!$value instanceof SetBusinessUnitChange) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?SetBusinessUnitChange + */ + protected function mapper() + { + return function (?int $index): ?SetBusinessUnitChange { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var SetBusinessUnitChange $data */ + $data = SetBusinessUnitChangeModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetBusinessUnitChangeModel.php b/lib/commercetools-history/src/Models/Change/SetBusinessUnitChangeModel.php new file mode 100644 index 00000000000..6a365978b64 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetBusinessUnitChangeModel.php @@ -0,0 +1,171 @@ +change = $change; + $this->previousValue = $previousValue; + $this->nextValue = $nextValue; + $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; + } + + /** + * + * @return null|string + */ + public function getChange() + { + if (is_null($this->change)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CHANGE); + if (is_null($data)) { + return null; + } + $this->change = (string) $data; + } + + return $this->change; + } + + /** + *Value before the change.
+ * + * + * @return null|KeyReference + */ + public function getPreviousValue() + { + if (is_null($this->previousValue)) { + /** @psalm-var stdClass|arrayValue after the change.
+ * + * + * @return null|KeyReference + */ + public function getNextValue() + { + if (is_null($this->nextValue)) { + /** @psalm-var stdClass|arrayProduct data that was updated.
*staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Product data that was updated.
*staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Product data that was updated.
*staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Elements added to the array.
+ * + + * @return null|array + */ + public function getAddedItems(); + + /** + *Elements removed from the array.
+ * + + * @return null|array + */ + public function getRemovedItems(); + /** * @param ?string $change */ @@ -59,4 +77,14 @@ public function setPreviousValue(?array $previousValue): void; * @param ?array $nextValue */ public function setNextValue(?array $nextValue): void; + + /** + * @param ?array $addedItems + */ + public function setAddedItems(?array $addedItems): void; + + /** + * @param ?array $removedItems + */ + public function setRemovedItems(?array $removedItems): void; } diff --git a/lib/commercetools-history/src/Models/Change/SetChannelRolesChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetChannelRolesChangeBuilder.php index ea4a6fcc062..fa3cb026420 100644 --- a/lib/commercetools-history/src/Models/Change/SetChannelRolesChangeBuilder.php +++ b/lib/commercetools-history/src/Models/Change/SetChannelRolesChangeBuilder.php @@ -38,6 +38,18 @@ final class SetChannelRolesChangeBuilder implements Builder */ private $nextValue; + /** + + * @var ?array + */ + private $addedItems; + + /** + + * @var ?array + */ + private $removedItems; + /** * @return null|string @@ -69,6 +81,28 @@ public function getNextValue() return $this->nextValue; } + /** + *Elements added to the array.
+ * + + * @return null|array + */ + public function getAddedItems() + { + return $this->addedItems; + } + + /** + *Elements removed from the array.
+ * + + * @return null|array + */ + public function getRemovedItems() + { + return $this->removedItems; + } + /** * @param ?string $change * @return $this @@ -102,13 +136,37 @@ public function withNextValue(?array $nextValue) return $this; } + /** + * @param ?array $addedItems + * @return $this + */ + public function withAddedItems(?array $addedItems) + { + $this->addedItems = $addedItems; + + return $this; + } + + /** + * @param ?array $removedItems + * @return $this + */ + public function withRemovedItems(?array $removedItems) + { + $this->removedItems = $removedItems; + + return $this; + } + public function build(): SetChannelRolesChange { return new SetChannelRolesChangeModel( $this->change, $this->previousValue, - $this->nextValue + $this->nextValue, + $this->addedItems, + $this->removedItems ); } diff --git a/lib/commercetools-history/src/Models/Change/SetChannelRolesChangeModel.php b/lib/commercetools-history/src/Models/Change/SetChannelRolesChangeModel.php index a612232fdd1..c0747a537fc 100644 --- a/lib/commercetools-history/src/Models/Change/SetChannelRolesChangeModel.php +++ b/lib/commercetools-history/src/Models/Change/SetChannelRolesChangeModel.php @@ -45,6 +45,18 @@ final class SetChannelRolesChangeModel extends JsonObjectModel implements SetCha */ protected $nextValue; + /** + * + * @var ?array + */ + protected $addedItems; + + /** + * + * @var ?array + */ + protected $removedItems; + /** * @psalm-suppress MissingParamType @@ -53,11 +65,15 @@ public function __construct( ?string $change = null, ?array $previousValue = null, ?array $nextValue = null, + ?array $addedItems = null, + ?array $removedItems = null, ?string $type = null ) { $this->change = $change; $this->previousValue = $previousValue; $this->nextValue = $nextValue; + $this->addedItems = $addedItems; + $this->removedItems = $removedItems; $this->type = $type ?? self::DISCRIMINATOR_VALUE; } @@ -137,6 +153,46 @@ public function getNextValue() return $this->nextValue; } + /** + *Elements added to the array.
+ * + * + * @return null|array + */ + public function getAddedItems() + { + if (is_null($this->addedItems)) { + /** @psalm-var ?listElements removed from the array.
+ * + * + * @return null|array + */ + public function getRemovedItems() + { + if (is_null($this->removedItems)) { + /** @psalm-var ?listElements added to the array.
+ * + + * @return null|StoreCountryCollection + */ + public function getAddedItems(); + + /** + *Elements removed from the array.
+ * + + * @return null|StoreCountryCollection + */ + public function getRemovedItems(); + /** * @param ?string $change */ @@ -60,4 +78,14 @@ public function setPreviousValue(?StoreCountryCollection $previousValue): void; * @param ?StoreCountryCollection $nextValue */ public function setNextValue(?StoreCountryCollection $nextValue): void; + + /** + * @param ?StoreCountryCollection $addedItems + */ + public function setAddedItems(?StoreCountryCollection $addedItems): void; + + /** + * @param ?StoreCountryCollection $removedItems + */ + public function setRemovedItems(?StoreCountryCollection $removedItems): void; } diff --git a/lib/commercetools-history/src/Models/Change/SetCountriesChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetCountriesChangeBuilder.php index 91b639c649d..8cd19c37847 100644 --- a/lib/commercetools-history/src/Models/Change/SetCountriesChangeBuilder.php +++ b/lib/commercetools-history/src/Models/Change/SetCountriesChangeBuilder.php @@ -39,6 +39,18 @@ final class SetCountriesChangeBuilder implements Builder */ private $nextValue; + /** + + * @var ?StoreCountryCollection + */ + private $addedItems; + + /** + + * @var ?StoreCountryCollection + */ + private $removedItems; + /** * @return null|string @@ -70,6 +82,28 @@ public function getNextValue() return $this->nextValue; } + /** + *Elements added to the array.
+ * + + * @return null|StoreCountryCollection + */ + public function getAddedItems() + { + return $this->addedItems; + } + + /** + *Elements removed from the array.
+ * + + * @return null|StoreCountryCollection + */ + public function getRemovedItems() + { + return $this->removedItems; + } + /** * @param ?string $change * @return $this @@ -103,13 +137,37 @@ public function withNextValue(?StoreCountryCollection $nextValue) return $this; } + /** + * @param ?StoreCountryCollection $addedItems + * @return $this + */ + public function withAddedItems(?StoreCountryCollection $addedItems) + { + $this->addedItems = $addedItems; + + return $this; + } + + /** + * @param ?StoreCountryCollection $removedItems + * @return $this + */ + public function withRemovedItems(?StoreCountryCollection $removedItems) + { + $this->removedItems = $removedItems; + + return $this; + } + public function build(): SetCountriesChange { return new SetCountriesChangeModel( $this->change, $this->previousValue, - $this->nextValue + $this->nextValue, + $this->addedItems, + $this->removedItems ); } diff --git a/lib/commercetools-history/src/Models/Change/SetCountriesChangeModel.php b/lib/commercetools-history/src/Models/Change/SetCountriesChangeModel.php index 79b045e9e04..b9b5cc41d78 100644 --- a/lib/commercetools-history/src/Models/Change/SetCountriesChangeModel.php +++ b/lib/commercetools-history/src/Models/Change/SetCountriesChangeModel.php @@ -46,6 +46,18 @@ final class SetCountriesChangeModel extends JsonObjectModel implements SetCountr */ protected $nextValue; + /** + * + * @var ?StoreCountryCollection + */ + protected $addedItems; + + /** + * + * @var ?StoreCountryCollection + */ + protected $removedItems; + /** * @psalm-suppress MissingParamType @@ -54,11 +66,15 @@ public function __construct( ?string $change = null, ?StoreCountryCollection $previousValue = null, ?StoreCountryCollection $nextValue = null, + ?StoreCountryCollection $addedItems = null, + ?StoreCountryCollection $removedItems = null, ?string $type = null ) { $this->change = $change; $this->previousValue = $previousValue; $this->nextValue = $nextValue; + $this->addedItems = $addedItems; + $this->removedItems = $removedItems; $this->type = $type ?? self::DISCRIMINATOR_VALUE; } @@ -138,6 +154,46 @@ public function getNextValue() return $this->nextValue; } + /** + *Elements added to the array.
+ * + * + * @return null|StoreCountryCollection + */ + public function getAddedItems() + { + if (is_null($this->addedItems)) { + /** @psalm-var ?listElements removed from the array.
+ * + * + * @return null|StoreCountryCollection + */ + public function getRemovedItems() + { + if (is_null($this->removedItems)) { + /** @psalm-var ?listid of the referenced Type.
id of the referenced Type.
id of the referenced Type.
id of the updated CustomLineItem.
Value before the change.
+ * + + * @return null|DiscountedLineItemPrice + */ + public function getPreviousValue(); + + /** + *Value after the change.
+ * + + * @return null|DiscountedLineItemPrice + */ + public function getNextValue(); + + /** + * @param ?string $change + */ + public function setChange(?string $change): void; + + /** + * @param ?LocalizedString $customLineItem + */ + public function setCustomLineItem(?LocalizedString $customLineItem): void; + + /** + * @param ?string $customLineItemId + */ + public function setCustomLineItemId(?string $customLineItemId): void; + + /** + * @param ?DiscountedLineItemPrice $previousValue + */ + public function setPreviousValue(?DiscountedLineItemPrice $previousValue): void; + + /** + * @param ?DiscountedLineItemPrice $nextValue + */ + public function setNextValue(?DiscountedLineItemPrice $nextValue): void; +} diff --git a/lib/commercetools-history/src/Models/Change/SetCustomLineItemDiscountedPriceChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetCustomLineItemDiscountedPriceChangeBuilder.php new file mode 100644 index 00000000000..245e788dffe --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetCustomLineItemDiscountedPriceChangeBuilder.php @@ -0,0 +1,213 @@ + + */ +final class SetCustomLineItemDiscountedPriceChangeBuilder implements Builder +{ + /** + + * @var ?string + */ + private $change; + + /** + + * @var null|LocalizedString|LocalizedStringBuilder + */ + private $customLineItem; + + /** + + * @var ?string + */ + private $customLineItemId; + + /** + + * @var null|DiscountedLineItemPrice|DiscountedLineItemPriceBuilder + */ + private $previousValue; + + /** + + * @var null|DiscountedLineItemPrice|DiscountedLineItemPriceBuilder + */ + private $nextValue; + + /** + + * @return null|string + */ + public function getChange() + { + return $this->change; + } + + /** + *Name of the updated CustomLineItem.
+ * + + * @return null|LocalizedString + */ + public function getCustomLineItem() + { + return $this->customLineItem instanceof LocalizedStringBuilder ? $this->customLineItem->build() : $this->customLineItem; + } + + /** + *id of the updated CustomLineItem.
Value before the change.
+ * + + * @return null|DiscountedLineItemPrice + */ + public function getPreviousValue() + { + return $this->previousValue instanceof DiscountedLineItemPriceBuilder ? $this->previousValue->build() : $this->previousValue; + } + + /** + *Value after the change.
+ * + + * @return null|DiscountedLineItemPrice + */ + public function getNextValue() + { + return $this->nextValue instanceof DiscountedLineItemPriceBuilder ? $this->nextValue->build() : $this->nextValue; + } + + /** + * @param ?string $change + * @return $this + */ + public function withChange(?string $change) + { + $this->change = $change; + + return $this; + } + + /** + * @param ?LocalizedString $customLineItem + * @return $this + */ + public function withCustomLineItem(?LocalizedString $customLineItem) + { + $this->customLineItem = $customLineItem; + + return $this; + } + + /** + * @param ?string $customLineItemId + * @return $this + */ + public function withCustomLineItemId(?string $customLineItemId) + { + $this->customLineItemId = $customLineItemId; + + return $this; + } + + /** + * @param ?DiscountedLineItemPrice $previousValue + * @return $this + */ + public function withPreviousValue(?DiscountedLineItemPrice $previousValue) + { + $this->previousValue = $previousValue; + + return $this; + } + + /** + * @param ?DiscountedLineItemPrice $nextValue + * @return $this + */ + public function withNextValue(?DiscountedLineItemPrice $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + /** + * @deprecated use withCustomLineItem() instead + * @return $this + */ + public function withCustomLineItemBuilder(?LocalizedStringBuilder $customLineItem) + { + $this->customLineItem = $customLineItem; + + return $this; + } + + /** + * @deprecated use withPreviousValue() instead + * @return $this + */ + public function withPreviousValueBuilder(?DiscountedLineItemPriceBuilder $previousValue) + { + $this->previousValue = $previousValue; + + return $this; + } + + /** + * @deprecated use withNextValue() instead + * @return $this + */ + public function withNextValueBuilder(?DiscountedLineItemPriceBuilder $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + public function build(): SetCustomLineItemDiscountedPriceChange + { + return new SetCustomLineItemDiscountedPriceChangeModel( + $this->change, + $this->customLineItem instanceof LocalizedStringBuilder ? $this->customLineItem->build() : $this->customLineItem, + $this->customLineItemId, + $this->previousValue instanceof DiscountedLineItemPriceBuilder ? $this->previousValue->build() : $this->previousValue, + $this->nextValue instanceof DiscountedLineItemPriceBuilder ? $this->nextValue->build() : $this->nextValue + ); + } + + public static function of(): SetCustomLineItemDiscountedPriceChangeBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetCustomLineItemDiscountedPriceChangeCollection.php b/lib/commercetools-history/src/Models/Change/SetCustomLineItemDiscountedPriceChangeCollection.php new file mode 100644 index 00000000000..66ad7b73dbb --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetCustomLineItemDiscountedPriceChangeCollection.php @@ -0,0 +1,56 @@ + + * @method SetCustomLineItemDiscountedPriceChange current() + * @method SetCustomLineItemDiscountedPriceChange end() + * @method SetCustomLineItemDiscountedPriceChange at($offset) + */ +class SetCustomLineItemDiscountedPriceChangeCollection extends ChangeCollection +{ + /** + * @psalm-assert SetCustomLineItemDiscountedPriceChange $value + * @psalm-param SetCustomLineItemDiscountedPriceChange|stdClass $value + * @throws InvalidArgumentException + * + * @return SetCustomLineItemDiscountedPriceChangeCollection + */ + public function add($value) + { + if (!$value instanceof SetCustomLineItemDiscountedPriceChange) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?SetCustomLineItemDiscountedPriceChange + */ + protected function mapper() + { + return function (?int $index): ?SetCustomLineItemDiscountedPriceChange { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var SetCustomLineItemDiscountedPriceChange $data */ + $data = SetCustomLineItemDiscountedPriceChangeModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetCustomLineItemDiscountedPriceChangeModel.php b/lib/commercetools-history/src/Models/Change/SetCustomLineItemDiscountedPriceChangeModel.php new file mode 100644 index 00000000000..e37b3e7816a --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetCustomLineItemDiscountedPriceChangeModel.php @@ -0,0 +1,246 @@ +change = $change; + $this->customLineItem = $customLineItem; + $this->customLineItemId = $customLineItemId; + $this->previousValue = $previousValue; + $this->nextValue = $nextValue; + $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; + } + + /** + * + * @return null|string + */ + public function getChange() + { + if (is_null($this->change)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CHANGE); + if (is_null($data)) { + return null; + } + $this->change = (string) $data; + } + + return $this->change; + } + + /** + *Name of the updated CustomLineItem.
+ * + * + * @return null|LocalizedString + */ + public function getCustomLineItem() + { + if (is_null($this->customLineItem)) { + /** @psalm-var stdClass|arrayid of the updated CustomLineItem.
Value before the change.
+ * + * + * @return null|DiscountedLineItemPrice + */ + public function getPreviousValue() + { + if (is_null($this->previousValue)) { + /** @psalm-var stdClass|arrayValue after the change.
+ * + * + * @return null|DiscountedLineItemPrice + */ + public function getNextValue() + { + if (is_null($this->nextValue)) { + /** @psalm-var stdClass|arrayid of the updated CustomLineItem.
Value before the change.
+ * + + * @return null|DiscountedLineItemPriceForQuantity + */ + public function getPreviousValue(); + + /** + *Value after the change.
+ * + + * @return null|DiscountedLineItemPriceForQuantity + */ + public function getNextValue(); + + /** + * @param ?string $change + */ + public function setChange(?string $change): void; + + /** + * @param ?LocalizedString $customLineItem + */ + public function setCustomLineItem(?LocalizedString $customLineItem): void; + + /** + * @param ?string $customLineItemId + */ + public function setCustomLineItemId(?string $customLineItemId): void; + + /** + * @param ?DiscountedLineItemPriceForQuantity $previousValue + */ + public function setPreviousValue(?DiscountedLineItemPriceForQuantity $previousValue): void; + + /** + * @param ?DiscountedLineItemPriceForQuantity $nextValue + */ + public function setNextValue(?DiscountedLineItemPriceForQuantity $nextValue): void; +} diff --git a/lib/commercetools-history/src/Models/Change/SetCustomLineItemDiscountedPricePerQuantityChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetCustomLineItemDiscountedPricePerQuantityChangeBuilder.php new file mode 100644 index 00000000000..daa39a4b857 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetCustomLineItemDiscountedPricePerQuantityChangeBuilder.php @@ -0,0 +1,213 @@ + + */ +final class SetCustomLineItemDiscountedPricePerQuantityChangeBuilder implements Builder +{ + /** + + * @var ?string + */ + private $change; + + /** + + * @var null|LocalizedString|LocalizedStringBuilder + */ + private $customLineItem; + + /** + + * @var ?string + */ + private $customLineItemId; + + /** + + * @var null|DiscountedLineItemPriceForQuantity|DiscountedLineItemPriceForQuantityBuilder + */ + private $previousValue; + + /** + + * @var null|DiscountedLineItemPriceForQuantity|DiscountedLineItemPriceForQuantityBuilder + */ + private $nextValue; + + /** + + * @return null|string + */ + public function getChange() + { + return $this->change; + } + + /** + *Name of the updated CustomLineItem.
+ * + + * @return null|LocalizedString + */ + public function getCustomLineItem() + { + return $this->customLineItem instanceof LocalizedStringBuilder ? $this->customLineItem->build() : $this->customLineItem; + } + + /** + *id of the updated CustomLineItem.
Value before the change.
+ * + + * @return null|DiscountedLineItemPriceForQuantity + */ + public function getPreviousValue() + { + return $this->previousValue instanceof DiscountedLineItemPriceForQuantityBuilder ? $this->previousValue->build() : $this->previousValue; + } + + /** + *Value after the change.
+ * + + * @return null|DiscountedLineItemPriceForQuantity + */ + public function getNextValue() + { + return $this->nextValue instanceof DiscountedLineItemPriceForQuantityBuilder ? $this->nextValue->build() : $this->nextValue; + } + + /** + * @param ?string $change + * @return $this + */ + public function withChange(?string $change) + { + $this->change = $change; + + return $this; + } + + /** + * @param ?LocalizedString $customLineItem + * @return $this + */ + public function withCustomLineItem(?LocalizedString $customLineItem) + { + $this->customLineItem = $customLineItem; + + return $this; + } + + /** + * @param ?string $customLineItemId + * @return $this + */ + public function withCustomLineItemId(?string $customLineItemId) + { + $this->customLineItemId = $customLineItemId; + + return $this; + } + + /** + * @param ?DiscountedLineItemPriceForQuantity $previousValue + * @return $this + */ + public function withPreviousValue(?DiscountedLineItemPriceForQuantity $previousValue) + { + $this->previousValue = $previousValue; + + return $this; + } + + /** + * @param ?DiscountedLineItemPriceForQuantity $nextValue + * @return $this + */ + public function withNextValue(?DiscountedLineItemPriceForQuantity $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + /** + * @deprecated use withCustomLineItem() instead + * @return $this + */ + public function withCustomLineItemBuilder(?LocalizedStringBuilder $customLineItem) + { + $this->customLineItem = $customLineItem; + + return $this; + } + + /** + * @deprecated use withPreviousValue() instead + * @return $this + */ + public function withPreviousValueBuilder(?DiscountedLineItemPriceForQuantityBuilder $previousValue) + { + $this->previousValue = $previousValue; + + return $this; + } + + /** + * @deprecated use withNextValue() instead + * @return $this + */ + public function withNextValueBuilder(?DiscountedLineItemPriceForQuantityBuilder $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + public function build(): SetCustomLineItemDiscountedPricePerQuantityChange + { + return new SetCustomLineItemDiscountedPricePerQuantityChangeModel( + $this->change, + $this->customLineItem instanceof LocalizedStringBuilder ? $this->customLineItem->build() : $this->customLineItem, + $this->customLineItemId, + $this->previousValue instanceof DiscountedLineItemPriceForQuantityBuilder ? $this->previousValue->build() : $this->previousValue, + $this->nextValue instanceof DiscountedLineItemPriceForQuantityBuilder ? $this->nextValue->build() : $this->nextValue + ); + } + + public static function of(): SetCustomLineItemDiscountedPricePerQuantityChangeBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetCustomLineItemDiscountedPricePerQuantityChangeCollection.php b/lib/commercetools-history/src/Models/Change/SetCustomLineItemDiscountedPricePerQuantityChangeCollection.php new file mode 100644 index 00000000000..2ad7cdffd8b --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetCustomLineItemDiscountedPricePerQuantityChangeCollection.php @@ -0,0 +1,56 @@ + + * @method SetCustomLineItemDiscountedPricePerQuantityChange current() + * @method SetCustomLineItemDiscountedPricePerQuantityChange end() + * @method SetCustomLineItemDiscountedPricePerQuantityChange at($offset) + */ +class SetCustomLineItemDiscountedPricePerQuantityChangeCollection extends ChangeCollection +{ + /** + * @psalm-assert SetCustomLineItemDiscountedPricePerQuantityChange $value + * @psalm-param SetCustomLineItemDiscountedPricePerQuantityChange|stdClass $value + * @throws InvalidArgumentException + * + * @return SetCustomLineItemDiscountedPricePerQuantityChangeCollection + */ + public function add($value) + { + if (!$value instanceof SetCustomLineItemDiscountedPricePerQuantityChange) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?SetCustomLineItemDiscountedPricePerQuantityChange + */ + protected function mapper() + { + return function (?int $index): ?SetCustomLineItemDiscountedPricePerQuantityChange { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var SetCustomLineItemDiscountedPricePerQuantityChange $data */ + $data = SetCustomLineItemDiscountedPricePerQuantityChangeModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetCustomLineItemDiscountedPricePerQuantityChangeModel.php b/lib/commercetools-history/src/Models/Change/SetCustomLineItemDiscountedPricePerQuantityChangeModel.php new file mode 100644 index 00000000000..2ac814aed7e --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetCustomLineItemDiscountedPricePerQuantityChangeModel.php @@ -0,0 +1,246 @@ +change = $change; + $this->customLineItem = $customLineItem; + $this->customLineItemId = $customLineItemId; + $this->previousValue = $previousValue; + $this->nextValue = $nextValue; + $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; + } + + /** + * + * @return null|string + */ + public function getChange() + { + if (is_null($this->change)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CHANGE); + if (is_null($data)) { + return null; + } + $this->change = (string) $data; + } + + return $this->change; + } + + /** + *Name of the updated CustomLineItem.
+ * + * + * @return null|LocalizedString + */ + public function getCustomLineItem() + { + if (is_null($this->customLineItem)) { + /** @psalm-var stdClass|arrayid of the updated CustomLineItem.
Value before the change.
+ * + * + * @return null|DiscountedLineItemPriceForQuantity + */ + public function getPreviousValue() + { + if (is_null($this->previousValue)) { + /** @psalm-var stdClass|arrayValue after the change.
+ * + * + * @return null|DiscountedLineItemPriceForQuantity + */ + public function getNextValue() + { + if (is_null($this->nextValue)) { + /** @psalm-var stdClass|arrayName of the updated CustomLineItem.
+ * + + * @return null|LocalizedString + */ + public function getCustomLineItem(); + /** * @param ?string $change */ @@ -74,4 +84,9 @@ public function setNextValue(?ItemShippingDetails $nextValue): void; * @param ?string $customLineItemId */ public function setCustomLineItemId(?string $customLineItemId): void; + + /** + * @param ?LocalizedString $customLineItem + */ + public function setCustomLineItem(?LocalizedString $customLineItem): void; } diff --git a/lib/commercetools-history/src/Models/Change/SetCustomLineItemShippingDetailsChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetCustomLineItemShippingDetailsChangeBuilder.php index a0566f9662c..5d681c3dc45 100644 --- a/lib/commercetools-history/src/Models/Change/SetCustomLineItemShippingDetailsChangeBuilder.php +++ b/lib/commercetools-history/src/Models/Change/SetCustomLineItemShippingDetailsChangeBuilder.php @@ -16,6 +16,8 @@ use stdClass; use Commercetools\History\Models\Common\ItemShippingDetails; use Commercetools\History\Models\Common\ItemShippingDetailsBuilder; +use Commercetools\History\Models\Common\LocalizedString; +use Commercetools\History\Models\Common\LocalizedStringBuilder; /** * @implements BuilderName of the updated CustomLineItem.
+ * + + * @return null|LocalizedString + */ + public function getCustomLineItem() + { + return $this->customLineItem instanceof LocalizedStringBuilder ? $this->customLineItem->build() : $this->customLineItem; + } + /** * @param ?string $change * @return $this @@ -132,6 +151,17 @@ public function withCustomLineItemId(?string $customLineItemId) return $this; } + /** + * @param ?LocalizedString $customLineItem + * @return $this + */ + public function withCustomLineItem(?LocalizedString $customLineItem) + { + $this->customLineItem = $customLineItem; + + return $this; + } + /** * @deprecated use withPreviousValue() instead * @return $this @@ -154,13 +184,25 @@ public function withNextValueBuilder(?ItemShippingDetailsBuilder $nextValue) return $this; } + /** + * @deprecated use withCustomLineItem() instead + * @return $this + */ + public function withCustomLineItemBuilder(?LocalizedStringBuilder $customLineItem) + { + $this->customLineItem = $customLineItem; + + return $this; + } + public function build(): SetCustomLineItemShippingDetailsChange { return new SetCustomLineItemShippingDetailsChangeModel( $this->change, $this->previousValue instanceof ItemShippingDetailsBuilder ? $this->previousValue->build() : $this->previousValue, $this->nextValue instanceof ItemShippingDetailsBuilder ? $this->nextValue->build() : $this->nextValue, - $this->customLineItemId + $this->customLineItemId, + $this->customLineItem instanceof LocalizedStringBuilder ? $this->customLineItem->build() : $this->customLineItem ); } diff --git a/lib/commercetools-history/src/Models/Change/SetCustomLineItemShippingDetailsChangeModel.php b/lib/commercetools-history/src/Models/Change/SetCustomLineItemShippingDetailsChangeModel.php index afedd0e9068..9a31ee18b1d 100644 --- a/lib/commercetools-history/src/Models/Change/SetCustomLineItemShippingDetailsChangeModel.php +++ b/lib/commercetools-history/src/Models/Change/SetCustomLineItemShippingDetailsChangeModel.php @@ -15,6 +15,8 @@ use stdClass; use Commercetools\History\Models\Common\ItemShippingDetails; use Commercetools\History\Models\Common\ItemShippingDetailsModel; +use Commercetools\History\Models\Common\LocalizedString; +use Commercetools\History\Models\Common\LocalizedStringModel; /** * @internal @@ -53,6 +55,12 @@ final class SetCustomLineItemShippingDetailsChangeModel extends JsonObjectModel */ protected $customLineItemId; + /** + * + * @var ?LocalizedString + */ + protected $customLineItem; + /** * @psalm-suppress MissingParamType @@ -62,12 +70,14 @@ public function __construct( ?ItemShippingDetails $previousValue = null, ?ItemShippingDetails $nextValue = null, ?string $customLineItemId = null, + ?LocalizedString $customLineItem = null, ?string $type = null ) { $this->change = $change; $this->previousValue = $previousValue; $this->nextValue = $nextValue; $this->customLineItemId = $customLineItemId; + $this->customLineItem = $customLineItem; $this->type = $type ?? self::DISCRIMINATOR_VALUE; } @@ -169,6 +179,27 @@ public function getCustomLineItemId() return $this->customLineItemId; } + /** + *Name of the updated CustomLineItem.
+ * + * + * @return null|LocalizedString + */ + public function getCustomLineItem() + { + if (is_null($this->customLineItem)) { + /** @psalm-var stdClass|arrayValue before the change.
* - * @return null|Money + * @return null|TaxedItemPrice */ public function getPreviousValue(); @@ -45,7 +45,7 @@ public function getPreviousValue(); *Value after the change.
* - * @return null|Money + * @return null|TaxedItemPrice */ public function getNextValue(); @@ -71,14 +71,14 @@ public function getCustomLineItemId(); public function setChange(?string $change): void; /** - * @param ?Money $previousValue + * @param ?TaxedItemPrice $previousValue */ - public function setPreviousValue(?Money $previousValue): void; + public function setPreviousValue(?TaxedItemPrice $previousValue): void; /** - * @param ?Money $nextValue + * @param ?TaxedItemPrice $nextValue */ - public function setNextValue(?Money $nextValue): void; + public function setNextValue(?TaxedItemPrice $nextValue): void; /** * @param ?LocalizedString $customLineItem diff --git a/lib/commercetools-history/src/Models/Change/SetCustomLineItemTaxedPriceChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetCustomLineItemTaxedPriceChangeBuilder.php index 2d0d0f18911..1d4c60c953b 100644 --- a/lib/commercetools-history/src/Models/Change/SetCustomLineItemTaxedPriceChangeBuilder.php +++ b/lib/commercetools-history/src/Models/Change/SetCustomLineItemTaxedPriceChangeBuilder.php @@ -16,8 +16,8 @@ use stdClass; use Commercetools\History\Models\Common\LocalizedString; use Commercetools\History\Models\Common\LocalizedStringBuilder; -use Commercetools\History\Models\Common\Money; -use Commercetools\History\Models\Common\MoneyBuilder; +use Commercetools\History\Models\Common\TaxedItemPrice; +use Commercetools\History\Models\Common\TaxedItemPriceBuilder; /** * @implements BuilderValue before the change.
* - * @return null|Money + * @return null|TaxedItemPrice */ public function getPreviousValue() { - return $this->previousValue instanceof MoneyBuilder ? $this->previousValue->build() : $this->previousValue; + return $this->previousValue instanceof TaxedItemPriceBuilder ? $this->previousValue->build() : $this->previousValue; } /** *Value after the change.
* - * @return null|Money + * @return null|TaxedItemPrice */ public function getNextValue() { - return $this->nextValue instanceof MoneyBuilder ? $this->nextValue->build() : $this->nextValue; + return $this->nextValue instanceof TaxedItemPriceBuilder ? $this->nextValue->build() : $this->nextValue; } /** @@ -119,10 +119,10 @@ public function withChange(?string $change) } /** - * @param ?Money $previousValue + * @param ?TaxedItemPrice $previousValue * @return $this */ - public function withPreviousValue(?Money $previousValue) + public function withPreviousValue(?TaxedItemPrice $previousValue) { $this->previousValue = $previousValue; @@ -130,10 +130,10 @@ public function withPreviousValue(?Money $previousValue) } /** - * @param ?Money $nextValue + * @param ?TaxedItemPrice $nextValue * @return $this */ - public function withNextValue(?Money $nextValue) + public function withNextValue(?TaxedItemPrice $nextValue) { $this->nextValue = $nextValue; @@ -166,7 +166,7 @@ public function withCustomLineItemId(?string $customLineItemId) * @deprecated use withPreviousValue() instead * @return $this */ - public function withPreviousValueBuilder(?MoneyBuilder $previousValue) + public function withPreviousValueBuilder(?TaxedItemPriceBuilder $previousValue) { $this->previousValue = $previousValue; @@ -177,7 +177,7 @@ public function withPreviousValueBuilder(?MoneyBuilder $previousValue) * @deprecated use withNextValue() instead * @return $this */ - public function withNextValueBuilder(?MoneyBuilder $nextValue) + public function withNextValueBuilder(?TaxedItemPriceBuilder $nextValue) { $this->nextValue = $nextValue; @@ -199,8 +199,8 @@ public function build(): SetCustomLineItemTaxedPriceChange { return new SetCustomLineItemTaxedPriceChangeModel( $this->change, - $this->previousValue instanceof MoneyBuilder ? $this->previousValue->build() : $this->previousValue, - $this->nextValue instanceof MoneyBuilder ? $this->nextValue->build() : $this->nextValue, + $this->previousValue instanceof TaxedItemPriceBuilder ? $this->previousValue->build() : $this->previousValue, + $this->nextValue instanceof TaxedItemPriceBuilder ? $this->nextValue->build() : $this->nextValue, $this->customLineItem instanceof LocalizedStringBuilder ? $this->customLineItem->build() : $this->customLineItem, $this->customLineItemId ); diff --git a/lib/commercetools-history/src/Models/Change/SetCustomLineItemTaxedPriceChangeModel.php b/lib/commercetools-history/src/Models/Change/SetCustomLineItemTaxedPriceChangeModel.php index f9715a7fb1b..afd69e5e92e 100644 --- a/lib/commercetools-history/src/Models/Change/SetCustomLineItemTaxedPriceChangeModel.php +++ b/lib/commercetools-history/src/Models/Change/SetCustomLineItemTaxedPriceChangeModel.php @@ -15,8 +15,8 @@ use stdClass; use Commercetools\History\Models\Common\LocalizedString; use Commercetools\History\Models\Common\LocalizedStringModel; -use Commercetools\History\Models\Common\Money; -use Commercetools\History\Models\Common\MoneyModel; +use Commercetools\History\Models\Common\TaxedItemPrice; +use Commercetools\History\Models\Common\TaxedItemPriceModel; /** * @internal @@ -39,13 +39,13 @@ final class SetCustomLineItemTaxedPriceChangeModel extends JsonObjectModel imple /** * - * @var ?Money + * @var ?TaxedItemPrice */ protected $previousValue; /** * - * @var ?Money + * @var ?TaxedItemPrice */ protected $nextValue; @@ -67,8 +67,8 @@ final class SetCustomLineItemTaxedPriceChangeModel extends JsonObjectModel imple */ public function __construct( ?string $change = null, - ?Money $previousValue = null, - ?Money $nextValue = null, + ?TaxedItemPrice $previousValue = null, + ?TaxedItemPrice $nextValue = null, ?LocalizedString $customLineItem = null, ?string $customLineItemId = null, ?string $type = null @@ -121,7 +121,7 @@ public function getChange() *Value before the change.
* * - * @return null|Money + * @return null|TaxedItemPrice */ public function getPreviousValue() { @@ -132,7 +132,7 @@ public function getPreviousValue() return null; } - $this->previousValue = MoneyModel::of($data); + $this->previousValue = TaxedItemPriceModel::of($data); } return $this->previousValue; @@ -142,7 +142,7 @@ public function getPreviousValue() *Value after the change.
* * - * @return null|Money + * @return null|TaxedItemPrice */ public function getNextValue() { @@ -153,7 +153,7 @@ public function getNextValue() return null; } - $this->nextValue = MoneyModel::of($data); + $this->nextValue = TaxedItemPriceModel::of($data); } return $this->nextValue; @@ -210,17 +210,17 @@ public function setChange(?string $change): void } /** - * @param ?Money $previousValue + * @param ?TaxedItemPrice $previousValue */ - public function setPreviousValue(?Money $previousValue): void + public function setPreviousValue(?TaxedItemPrice $previousValue): void { $this->previousValue = $previousValue; } /** - * @param ?Money $nextValue + * @param ?TaxedItemPrice $nextValue */ - public function setNextValue(?Money $nextValue): void + public function setNextValue(?TaxedItemPrice $nextValue): void { $this->nextValue = $nextValue; } diff --git a/lib/commercetools-history/src/Models/Change/SetCustomerChangeModel.php b/lib/commercetools-history/src/Models/Change/SetCustomerChangeModel.php index 0a73e3a161f..587d575f90b 100644 --- a/lib/commercetools-history/src/Models/Change/SetCustomerChangeModel.php +++ b/lib/commercetools-history/src/Models/Change/SetCustomerChangeModel.php @@ -113,8 +113,8 @@ public function getPreviousValue() if (is_null($data)) { return null; } - - $this->previousValue = ReferenceModel::of($data); + $className = ReferenceModel::resolveDiscriminatorClass($data); + $this->previousValue = $className::of($data); } return $this->previousValue; @@ -134,8 +134,8 @@ public function getNextValue() if (is_null($data)) { return null; } - - $this->nextValue = ReferenceModel::of($data); + $className = ReferenceModel::resolveDiscriminatorClass($data); + $this->nextValue = $className::of($data); } return $this->nextValue; diff --git a/lib/commercetools-history/src/Models/Change/SetCustomerGroupAssignmentsChange.php b/lib/commercetools-history/src/Models/Change/SetCustomerGroupAssignmentsChange.php new file mode 100644 index 00000000000..6e0ae0c4ed5 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetCustomerGroupAssignmentsChange.php @@ -0,0 +1,91 @@ +Elements added to the array. + * + + * @return null|CustomerGroupAssignmentCollection + */ + public function getAddedItems(); + + /** + *Elements removed from the array.
+ * + + * @return null|CustomerGroupAssignmentCollection + */ + public function getRemovedItems(); + + /** + *Value before the change.
+ * + + * @return null|CustomerGroupAssignmentCollection + */ + public function getPreviousValue(); + + /** + *Value after the change.
+ * + + * @return null|CustomerGroupAssignmentCollection + */ + public function getNextValue(); + + /** + * @param ?string $change + */ + public function setChange(?string $change): void; + + /** + * @param ?CustomerGroupAssignmentCollection $addedItems + */ + public function setAddedItems(?CustomerGroupAssignmentCollection $addedItems): void; + + /** + * @param ?CustomerGroupAssignmentCollection $removedItems + */ + public function setRemovedItems(?CustomerGroupAssignmentCollection $removedItems): void; + + /** + * @param ?CustomerGroupAssignmentCollection $previousValue + */ + public function setPreviousValue(?CustomerGroupAssignmentCollection $previousValue): void; + + /** + * @param ?CustomerGroupAssignmentCollection $nextValue + */ + public function setNextValue(?CustomerGroupAssignmentCollection $nextValue): void; +} diff --git a/lib/commercetools-history/src/Models/Change/SetCustomerGroupAssignmentsChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetCustomerGroupAssignmentsChangeBuilder.php new file mode 100644 index 00000000000..a804ed953f1 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetCustomerGroupAssignmentsChangeBuilder.php @@ -0,0 +1,178 @@ + + */ +final class SetCustomerGroupAssignmentsChangeBuilder implements Builder +{ + /** + + * @var ?string + */ + private $change; + + /** + + * @var ?CustomerGroupAssignmentCollection + */ + private $addedItems; + + /** + + * @var ?CustomerGroupAssignmentCollection + */ + private $removedItems; + + /** + + * @var ?CustomerGroupAssignmentCollection + */ + private $previousValue; + + /** + + * @var ?CustomerGroupAssignmentCollection + */ + private $nextValue; + + /** + + * @return null|string + */ + public function getChange() + { + return $this->change; + } + + /** + *Elements added to the array.
+ * + + * @return null|CustomerGroupAssignmentCollection + */ + public function getAddedItems() + { + return $this->addedItems; + } + + /** + *Elements removed from the array.
+ * + + * @return null|CustomerGroupAssignmentCollection + */ + public function getRemovedItems() + { + return $this->removedItems; + } + + /** + *Value before the change.
+ * + + * @return null|CustomerGroupAssignmentCollection + */ + public function getPreviousValue() + { + return $this->previousValue; + } + + /** + *Value after the change.
+ * + + * @return null|CustomerGroupAssignmentCollection + */ + public function getNextValue() + { + return $this->nextValue; + } + + /** + * @param ?string $change + * @return $this + */ + public function withChange(?string $change) + { + $this->change = $change; + + return $this; + } + + /** + * @param ?CustomerGroupAssignmentCollection $addedItems + * @return $this + */ + public function withAddedItems(?CustomerGroupAssignmentCollection $addedItems) + { + $this->addedItems = $addedItems; + + return $this; + } + + /** + * @param ?CustomerGroupAssignmentCollection $removedItems + * @return $this + */ + public function withRemovedItems(?CustomerGroupAssignmentCollection $removedItems) + { + $this->removedItems = $removedItems; + + return $this; + } + + /** + * @param ?CustomerGroupAssignmentCollection $previousValue + * @return $this + */ + public function withPreviousValue(?CustomerGroupAssignmentCollection $previousValue) + { + $this->previousValue = $previousValue; + + return $this; + } + + /** + * @param ?CustomerGroupAssignmentCollection $nextValue + * @return $this + */ + public function withNextValue(?CustomerGroupAssignmentCollection $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + + public function build(): SetCustomerGroupAssignmentsChange + { + return new SetCustomerGroupAssignmentsChangeModel( + $this->change, + $this->addedItems, + $this->removedItems, + $this->previousValue, + $this->nextValue + ); + } + + public static function of(): SetCustomerGroupAssignmentsChangeBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetCustomerGroupAssignmentsChangeCollection.php b/lib/commercetools-history/src/Models/Change/SetCustomerGroupAssignmentsChangeCollection.php new file mode 100644 index 00000000000..a1cd1acfb86 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetCustomerGroupAssignmentsChangeCollection.php @@ -0,0 +1,56 @@ + + * @method SetCustomerGroupAssignmentsChange current() + * @method SetCustomerGroupAssignmentsChange end() + * @method SetCustomerGroupAssignmentsChange at($offset) + */ +class SetCustomerGroupAssignmentsChangeCollection extends ChangeCollection +{ + /** + * @psalm-assert SetCustomerGroupAssignmentsChange $value + * @psalm-param SetCustomerGroupAssignmentsChange|stdClass $value + * @throws InvalidArgumentException + * + * @return SetCustomerGroupAssignmentsChangeCollection + */ + public function add($value) + { + if (!$value instanceof SetCustomerGroupAssignmentsChange) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?SetCustomerGroupAssignmentsChange + */ + protected function mapper() + { + return function (?int $index): ?SetCustomerGroupAssignmentsChange { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var SetCustomerGroupAssignmentsChange $data */ + $data = SetCustomerGroupAssignmentsChangeModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetCustomerGroupAssignmentsChangeModel.php b/lib/commercetools-history/src/Models/Change/SetCustomerGroupAssignmentsChangeModel.php new file mode 100644 index 00000000000..5ccfcbf20ea --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetCustomerGroupAssignmentsChangeModel.php @@ -0,0 +1,240 @@ +change = $change; + $this->addedItems = $addedItems; + $this->removedItems = $removedItems; + $this->previousValue = $previousValue; + $this->nextValue = $nextValue; + $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; + } + + /** + * + * @return null|string + */ + public function getChange() + { + if (is_null($this->change)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CHANGE); + if (is_null($data)) { + return null; + } + $this->change = (string) $data; + } + + return $this->change; + } + + /** + *Elements added to the array.
+ * + * + * @return null|CustomerGroupAssignmentCollection + */ + public function getAddedItems() + { + if (is_null($this->addedItems)) { + /** @psalm-var ?listElements removed from the array.
+ * + * + * @return null|CustomerGroupAssignmentCollection + */ + public function getRemovedItems() + { + if (is_null($this->removedItems)) { + /** @psalm-var ?listValue before the change.
+ * + * + * @return null|CustomerGroupAssignmentCollection + */ + public function getPreviousValue() + { + if (is_null($this->previousValue)) { + /** @psalm-var ?listValue after the change.
+ * + * + * @return null|CustomerGroupAssignmentCollection + */ + public function getNextValue() + { + if (is_null($this->nextValue)) { + /** @psalm-var ?listid of the updated Delivery.
+ *
+
+ * @return null|string
+ */
+ public function getDeliveryId();
+
+ /**
+ * id of the updated Address.
Name of the Custom Field.
+ * + + * @return null|string + */ + public function getName(); + + /** + *id of the referenced Type.
Value before the change.
+ * + + * @return null|mixed + */ + public function getPreviousValue(); + + /** + *Value after the change.
+ * + + * @return null|mixed + */ + public function getNextValue(); + + /** + * @param ?string $change + */ + public function setChange(?string $change): void; + + /** + * @param ?string $deliveryId + */ + public function setDeliveryId(?string $deliveryId): void; + + /** + * @param ?string $addressId + */ + public function setAddressId(?string $addressId): void; + + /** + * @param ?string $name + */ + public function setName(?string $name): void; + + /** + * @param ?string $customTypeId + */ + public function setCustomTypeId(?string $customTypeId): void; + + /** + * @param mixed $previousValue + */ + public function setPreviousValue( $previousValue): void; + + /** + * @param mixed $nextValue + */ + public function setNextValue( $nextValue): void; +} diff --git a/lib/commercetools-history/src/Models/Change/SetDeliveryAddressCustomFieldChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetDeliveryAddressCustomFieldChangeBuilder.php new file mode 100644 index 00000000000..fa88aebd574 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetDeliveryAddressCustomFieldChangeBuilder.php @@ -0,0 +1,235 @@ + + */ +final class SetDeliveryAddressCustomFieldChangeBuilder implements Builder +{ + /** + + * @var ?string + */ + private $change; + + /** + + * @var ?string + */ + private $deliveryId; + + /** + + * @var ?string + */ + private $addressId; + + /** + + * @var ?string + */ + private $name; + + /** + + * @var ?string + */ + private $customTypeId; + + /** + + * @var null|mixed|mixed + */ + private $previousValue; + + /** + + * @var null|mixed|mixed + */ + private $nextValue; + + /** + + * @return null|string + */ + public function getChange() + { + return $this->change; + } + + /** + *id of the updated Delivery.
id of the updated Address.
Name of the Custom Field.
+ * + + * @return null|string + */ + public function getName() + { + return $this->name; + } + + /** + *id of the referenced Type.
Value before the change.
+ * + + * @return null|mixed + */ + public function getPreviousValue() + { + return $this->previousValue; + } + + /** + *Value after the change.
+ * + + * @return null|mixed + */ + public function getNextValue() + { + return $this->nextValue; + } + + /** + * @param ?string $change + * @return $this + */ + public function withChange(?string $change) + { + $this->change = $change; + + return $this; + } + + /** + * @param ?string $deliveryId + * @return $this + */ + public function withDeliveryId(?string $deliveryId) + { + $this->deliveryId = $deliveryId; + + return $this; + } + + /** + * @param ?string $addressId + * @return $this + */ + public function withAddressId(?string $addressId) + { + $this->addressId = $addressId; + + return $this; + } + + /** + * @param ?string $name + * @return $this + */ + public function withName(?string $name) + { + $this->name = $name; + + return $this; + } + + /** + * @param ?string $customTypeId + * @return $this + */ + public function withCustomTypeId(?string $customTypeId) + { + $this->customTypeId = $customTypeId; + + return $this; + } + + /** + * @param mixed $previousValue + * @return $this + */ + public function withPreviousValue( $previousValue) + { + $this->previousValue = $previousValue; + + return $this; + } + + /** + * @param mixed $nextValue + * @return $this + */ + public function withNextValue( $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + + public function build(): SetDeliveryAddressCustomFieldChange + { + return new SetDeliveryAddressCustomFieldChangeModel( + $this->change, + $this->deliveryId, + $this->addressId, + $this->name, + $this->customTypeId, + $this->previousValue, + $this->nextValue + ); + } + + public static function of(): SetDeliveryAddressCustomFieldChangeBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetDeliveryAddressCustomFieldChangeCollection.php b/lib/commercetools-history/src/Models/Change/SetDeliveryAddressCustomFieldChangeCollection.php new file mode 100644 index 00000000000..6485c402d3e --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetDeliveryAddressCustomFieldChangeCollection.php @@ -0,0 +1,56 @@ + + * @method SetDeliveryAddressCustomFieldChange current() + * @method SetDeliveryAddressCustomFieldChange end() + * @method SetDeliveryAddressCustomFieldChange at($offset) + */ +class SetDeliveryAddressCustomFieldChangeCollection extends ChangeCollection +{ + /** + * @psalm-assert SetDeliveryAddressCustomFieldChange $value + * @psalm-param SetDeliveryAddressCustomFieldChange|stdClass $value + * @throws InvalidArgumentException + * + * @return SetDeliveryAddressCustomFieldChangeCollection + */ + public function add($value) + { + if (!$value instanceof SetDeliveryAddressCustomFieldChange) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?SetDeliveryAddressCustomFieldChange + */ + protected function mapper() + { + return function (?int $index): ?SetDeliveryAddressCustomFieldChange { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var SetDeliveryAddressCustomFieldChange $data */ + $data = SetDeliveryAddressCustomFieldChangeModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetDeliveryAddressCustomFieldChangeModel.php b/lib/commercetools-history/src/Models/Change/SetDeliveryAddressCustomFieldChangeModel.php new file mode 100644 index 00000000000..129f175144c --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetDeliveryAddressCustomFieldChangeModel.php @@ -0,0 +1,311 @@ +change = $change; + $this->deliveryId = $deliveryId; + $this->addressId = $addressId; + $this->name = $name; + $this->customTypeId = $customTypeId; + $this->previousValue = $previousValue; + $this->nextValue = $nextValue; + $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; + } + + /** + * + * @return null|string + */ + public function getChange() + { + if (is_null($this->change)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CHANGE); + if (is_null($data)) { + return null; + } + $this->change = (string) $data; + } + + return $this->change; + } + + /** + *id of the updated Delivery.
id of the updated Address.
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; + } + + /** + *id of the referenced Type.
Value before the change.
+ * + * + * @return null|mixed + */ + public function getPreviousValue() + { + if (is_null($this->previousValue)) { + /** @psalm-var mixed $data */ + $data = $this->raw(self::FIELD_PREVIOUS_VALUE); + if (is_null($data)) { + return null; + } + $this->previousValue = $data; + } + + return $this->previousValue; + } + + /** + *Value after the change.
+ * + * + * @return null|mixed + */ + public function getNextValue() + { + if (is_null($this->nextValue)) { + /** @psalm-var mixed $data */ + $data = $this->raw(self::FIELD_NEXT_VALUE); + if (is_null($data)) { + return null; + } + $this->nextValue = $data; + } + + return $this->nextValue; + } + + + /** + * @param ?string $change + */ + public function setChange(?string $change): void + { + $this->change = $change; + } + + /** + * @param ?string $deliveryId + */ + public function setDeliveryId(?string $deliveryId): void + { + $this->deliveryId = $deliveryId; + } + + /** + * @param ?string $addressId + */ + public function setAddressId(?string $addressId): void + { + $this->addressId = $addressId; + } + + /** + * @param ?string $name + */ + public function setName(?string $name): void + { + $this->name = $name; + } + + /** + * @param ?string $customTypeId + */ + public function setCustomTypeId(?string $customTypeId): void + { + $this->customTypeId = $customTypeId; + } + + /** + * @param mixed $previousValue + */ + public function setPreviousValue( $previousValue): void + { + $this->previousValue = $previousValue; + } + + /** + * @param mixed $nextValue + */ + public function setNextValue( $nextValue): void + { + $this->nextValue = $nextValue; + } + + + +} diff --git a/lib/commercetools-history/src/Models/Change/SetDeliveryAddressCustomTypeChange.php b/lib/commercetools-history/src/Models/Change/SetDeliveryAddressCustomTypeChange.php new file mode 100644 index 00000000000..f791efc2e2b --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetDeliveryAddressCustomTypeChange.php @@ -0,0 +1,91 @@ +id of the updated Delivery.
+ *
+
+ * @return null|string
+ */
+ public function getDeliveryId();
+
+ /**
+ * id of the updated Address.
Value before the change.
+ * + + * @return null|CustomFields + */ + public function getPreviousValue(); + + /** + *Value after the change.
+ * + + * @return null|CustomFields + */ + public function getNextValue(); + + /** + * @param ?string $change + */ + public function setChange(?string $change): void; + + /** + * @param ?string $deliveryId + */ + public function setDeliveryId(?string $deliveryId): void; + + /** + * @param ?string $addressId + */ + public function setAddressId(?string $addressId): void; + + /** + * @param ?CustomFields $previousValue + */ + public function setPreviousValue(?CustomFields $previousValue): void; + + /** + * @param ?CustomFields $nextValue + */ + public function setNextValue(?CustomFields $nextValue): void; +} diff --git a/lib/commercetools-history/src/Models/Change/SetDeliveryAddressCustomTypeChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetDeliveryAddressCustomTypeChangeBuilder.php new file mode 100644 index 00000000000..417afa8d4e5 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetDeliveryAddressCustomTypeChangeBuilder.php @@ -0,0 +1,200 @@ + + */ +final class SetDeliveryAddressCustomTypeChangeBuilder implements Builder +{ + /** + + * @var ?string + */ + private $change; + + /** + + * @var ?string + */ + private $deliveryId; + + /** + + * @var ?string + */ + private $addressId; + + /** + + * @var null|CustomFields|CustomFieldsBuilder + */ + private $previousValue; + + /** + + * @var null|CustomFields|CustomFieldsBuilder + */ + private $nextValue; + + /** + + * @return null|string + */ + public function getChange() + { + return $this->change; + } + + /** + *id of the updated Delivery.
id of the updated Address.
Value before the change.
+ * + + * @return null|CustomFields + */ + public function getPreviousValue() + { + return $this->previousValue instanceof CustomFieldsBuilder ? $this->previousValue->build() : $this->previousValue; + } + + /** + *Value after the change.
+ * + + * @return null|CustomFields + */ + public function getNextValue() + { + return $this->nextValue instanceof CustomFieldsBuilder ? $this->nextValue->build() : $this->nextValue; + } + + /** + * @param ?string $change + * @return $this + */ + public function withChange(?string $change) + { + $this->change = $change; + + return $this; + } + + /** + * @param ?string $deliveryId + * @return $this + */ + public function withDeliveryId(?string $deliveryId) + { + $this->deliveryId = $deliveryId; + + return $this; + } + + /** + * @param ?string $addressId + * @return $this + */ + public function withAddressId(?string $addressId) + { + $this->addressId = $addressId; + + return $this; + } + + /** + * @param ?CustomFields $previousValue + * @return $this + */ + public function withPreviousValue(?CustomFields $previousValue) + { + $this->previousValue = $previousValue; + + return $this; + } + + /** + * @param ?CustomFields $nextValue + * @return $this + */ + public function withNextValue(?CustomFields $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + /** + * @deprecated use withPreviousValue() instead + * @return $this + */ + public function withPreviousValueBuilder(?CustomFieldsBuilder $previousValue) + { + $this->previousValue = $previousValue; + + return $this; + } + + /** + * @deprecated use withNextValue() instead + * @return $this + */ + public function withNextValueBuilder(?CustomFieldsBuilder $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + public function build(): SetDeliveryAddressCustomTypeChange + { + return new SetDeliveryAddressCustomTypeChangeModel( + $this->change, + $this->deliveryId, + $this->addressId, + $this->previousValue instanceof CustomFieldsBuilder ? $this->previousValue->build() : $this->previousValue, + $this->nextValue instanceof CustomFieldsBuilder ? $this->nextValue->build() : $this->nextValue + ); + } + + public static function of(): SetDeliveryAddressCustomTypeChangeBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetDeliveryAddressCustomTypeChangeCollection.php b/lib/commercetools-history/src/Models/Change/SetDeliveryAddressCustomTypeChangeCollection.php new file mode 100644 index 00000000000..f6b9d51cfb4 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetDeliveryAddressCustomTypeChangeCollection.php @@ -0,0 +1,56 @@ + + * @method SetDeliveryAddressCustomTypeChange current() + * @method SetDeliveryAddressCustomTypeChange end() + * @method SetDeliveryAddressCustomTypeChange at($offset) + */ +class SetDeliveryAddressCustomTypeChangeCollection extends ChangeCollection +{ + /** + * @psalm-assert SetDeliveryAddressCustomTypeChange $value + * @psalm-param SetDeliveryAddressCustomTypeChange|stdClass $value + * @throws InvalidArgumentException + * + * @return SetDeliveryAddressCustomTypeChangeCollection + */ + public function add($value) + { + if (!$value instanceof SetDeliveryAddressCustomTypeChange) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?SetDeliveryAddressCustomTypeChange + */ + protected function mapper() + { + return function (?int $index): ?SetDeliveryAddressCustomTypeChange { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var SetDeliveryAddressCustomTypeChange $data */ + $data = SetDeliveryAddressCustomTypeChangeModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetDeliveryAddressCustomTypeChangeModel.php b/lib/commercetools-history/src/Models/Change/SetDeliveryAddressCustomTypeChangeModel.php new file mode 100644 index 00000000000..9a8038779f9 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetDeliveryAddressCustomTypeChangeModel.php @@ -0,0 +1,243 @@ +change = $change; + $this->deliveryId = $deliveryId; + $this->addressId = $addressId; + $this->previousValue = $previousValue; + $this->nextValue = $nextValue; + $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; + } + + /** + * + * @return null|string + */ + public function getChange() + { + if (is_null($this->change)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CHANGE); + if (is_null($data)) { + return null; + } + $this->change = (string) $data; + } + + return $this->change; + } + + /** + *id of the updated Delivery.
id of the updated Address.
Value before the change.
+ * + * + * @return null|CustomFields + */ + public function getPreviousValue() + { + if (is_null($this->previousValue)) { + /** @psalm-var stdClass|arrayValue after the change.
+ * + * + * @return null|CustomFields + */ + public function getNextValue() + { + if (is_null($this->nextValue)) { + /** @psalm-var stdClass|arrayid of the updated Delivery.
+ *
+
+ * @return null|string
+ */
+ public function getDeliveryId();
+
+ /**
+ * Name of the Custom Field.
+ * + + * @return null|string + */ + public function getName(); + + /** + *id of the referenced Type.
Value before the change.
+ * + + * @return null|mixed + */ + public function getPreviousValue(); + + /** + *Value after the change.
+ * + + * @return null|mixed + */ + public function getNextValue(); + + /** + * @param ?string $change + */ + public function setChange(?string $change): void; + + /** + * @param ?string $deliveryId + */ + public function setDeliveryId(?string $deliveryId): void; + + /** + * @param ?string $name + */ + public function setName(?string $name): void; + + /** + * @param ?string $customTypeId + */ + public function setCustomTypeId(?string $customTypeId): void; + + /** + * @param mixed $previousValue + */ + public function setPreviousValue( $previousValue): void; + + /** + * @param mixed $nextValue + */ + public function setNextValue( $nextValue): void; +} diff --git a/lib/commercetools-history/src/Models/Change/SetDeliveryCustomFieldChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetDeliveryCustomFieldChangeBuilder.php new file mode 100644 index 00000000000..4ad9799370a --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetDeliveryCustomFieldChangeBuilder.php @@ -0,0 +1,206 @@ + + */ +final class SetDeliveryCustomFieldChangeBuilder implements Builder +{ + /** + + * @var ?string + */ + private $change; + + /** + + * @var ?string + */ + private $deliveryId; + + /** + + * @var ?string + */ + private $name; + + /** + + * @var ?string + */ + private $customTypeId; + + /** + + * @var null|mixed|mixed + */ + private $previousValue; + + /** + + * @var null|mixed|mixed + */ + private $nextValue; + + /** + + * @return null|string + */ + public function getChange() + { + return $this->change; + } + + /** + *id of the updated Delivery.
Name of the Custom Field.
+ * + + * @return null|string + */ + public function getName() + { + return $this->name; + } + + /** + *id of the referenced Type.
Value before the change.
+ * + + * @return null|mixed + */ + public function getPreviousValue() + { + return $this->previousValue; + } + + /** + *Value after the change.
+ * + + * @return null|mixed + */ + public function getNextValue() + { + return $this->nextValue; + } + + /** + * @param ?string $change + * @return $this + */ + public function withChange(?string $change) + { + $this->change = $change; + + return $this; + } + + /** + * @param ?string $deliveryId + * @return $this + */ + public function withDeliveryId(?string $deliveryId) + { + $this->deliveryId = $deliveryId; + + return $this; + } + + /** + * @param ?string $name + * @return $this + */ + public function withName(?string $name) + { + $this->name = $name; + + return $this; + } + + /** + * @param ?string $customTypeId + * @return $this + */ + public function withCustomTypeId(?string $customTypeId) + { + $this->customTypeId = $customTypeId; + + return $this; + } + + /** + * @param mixed $previousValue + * @return $this + */ + public function withPreviousValue( $previousValue) + { + $this->previousValue = $previousValue; + + return $this; + } + + /** + * @param mixed $nextValue + * @return $this + */ + public function withNextValue( $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + + public function build(): SetDeliveryCustomFieldChange + { + return new SetDeliveryCustomFieldChangeModel( + $this->change, + $this->deliveryId, + $this->name, + $this->customTypeId, + $this->previousValue, + $this->nextValue + ); + } + + public static function of(): SetDeliveryCustomFieldChangeBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetDeliveryCustomFieldChangeCollection.php b/lib/commercetools-history/src/Models/Change/SetDeliveryCustomFieldChangeCollection.php new file mode 100644 index 00000000000..017a6e27e06 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetDeliveryCustomFieldChangeCollection.php @@ -0,0 +1,56 @@ + + * @method SetDeliveryCustomFieldChange current() + * @method SetDeliveryCustomFieldChange end() + * @method SetDeliveryCustomFieldChange at($offset) + */ +class SetDeliveryCustomFieldChangeCollection extends ChangeCollection +{ + /** + * @psalm-assert SetDeliveryCustomFieldChange $value + * @psalm-param SetDeliveryCustomFieldChange|stdClass $value + * @throws InvalidArgumentException + * + * @return SetDeliveryCustomFieldChangeCollection + */ + public function add($value) + { + if (!$value instanceof SetDeliveryCustomFieldChange) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?SetDeliveryCustomFieldChange + */ + protected function mapper() + { + return function (?int $index): ?SetDeliveryCustomFieldChange { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var SetDeliveryCustomFieldChange $data */ + $data = SetDeliveryCustomFieldChangeModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetDeliveryCustomFieldChangeModel.php b/lib/commercetools-history/src/Models/Change/SetDeliveryCustomFieldChangeModel.php new file mode 100644 index 00000000000..e688ec70ed6 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetDeliveryCustomFieldChangeModel.php @@ -0,0 +1,275 @@ +change = $change; + $this->deliveryId = $deliveryId; + $this->name = $name; + $this->customTypeId = $customTypeId; + $this->previousValue = $previousValue; + $this->nextValue = $nextValue; + $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; + } + + /** + * + * @return null|string + */ + public function getChange() + { + if (is_null($this->change)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CHANGE); + if (is_null($data)) { + return null; + } + $this->change = (string) $data; + } + + return $this->change; + } + + /** + *id of the updated Delivery.
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; + } + + /** + *id of the referenced Type.
Value before the change.
+ * + * + * @return null|mixed + */ + public function getPreviousValue() + { + if (is_null($this->previousValue)) { + /** @psalm-var mixed $data */ + $data = $this->raw(self::FIELD_PREVIOUS_VALUE); + if (is_null($data)) { + return null; + } + $this->previousValue = $data; + } + + return $this->previousValue; + } + + /** + *Value after the change.
+ * + * + * @return null|mixed + */ + public function getNextValue() + { + if (is_null($this->nextValue)) { + /** @psalm-var mixed $data */ + $data = $this->raw(self::FIELD_NEXT_VALUE); + if (is_null($data)) { + return null; + } + $this->nextValue = $data; + } + + return $this->nextValue; + } + + + /** + * @param ?string $change + */ + public function setChange(?string $change): void + { + $this->change = $change; + } + + /** + * @param ?string $deliveryId + */ + public function setDeliveryId(?string $deliveryId): void + { + $this->deliveryId = $deliveryId; + } + + /** + * @param ?string $name + */ + public function setName(?string $name): void + { + $this->name = $name; + } + + /** + * @param ?string $customTypeId + */ + public function setCustomTypeId(?string $customTypeId): void + { + $this->customTypeId = $customTypeId; + } + + /** + * @param mixed $previousValue + */ + public function setPreviousValue( $previousValue): void + { + $this->previousValue = $previousValue; + } + + /** + * @param mixed $nextValue + */ + public function setNextValue( $nextValue): void + { + $this->nextValue = $nextValue; + } + + + +} diff --git a/lib/commercetools-history/src/Models/Change/SetDeliveryCustomTypeChange.php b/lib/commercetools-history/src/Models/Change/SetDeliveryCustomTypeChange.php new file mode 100644 index 00000000000..9aabb610150 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetDeliveryCustomTypeChange.php @@ -0,0 +1,77 @@ +id of the updated Delivery.
+ *
+
+ * @return null|string
+ */
+ public function getDeliveryId();
+
+ /**
+ * Value before the change.
+ * + + * @return null|CustomFields + */ + public function getPreviousValue(); + + /** + *Value after the change.
+ * + + * @return null|CustomFields + */ + public function getNextValue(); + + /** + * @param ?string $change + */ + public function setChange(?string $change): void; + + /** + * @param ?string $deliveryId + */ + public function setDeliveryId(?string $deliveryId): void; + + /** + * @param ?CustomFields $previousValue + */ + public function setPreviousValue(?CustomFields $previousValue): void; + + /** + * @param ?CustomFields $nextValue + */ + public function setNextValue(?CustomFields $nextValue): void; +} diff --git a/lib/commercetools-history/src/Models/Change/SetDeliveryCustomTypeChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetDeliveryCustomTypeChangeBuilder.php new file mode 100644 index 00000000000..e9db2fcb42d --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetDeliveryCustomTypeChangeBuilder.php @@ -0,0 +1,171 @@ + + */ +final class SetDeliveryCustomTypeChangeBuilder implements Builder +{ + /** + + * @var ?string + */ + private $change; + + /** + + * @var ?string + */ + private $deliveryId; + + /** + + * @var null|CustomFields|CustomFieldsBuilder + */ + private $previousValue; + + /** + + * @var null|CustomFields|CustomFieldsBuilder + */ + private $nextValue; + + /** + + * @return null|string + */ + public function getChange() + { + return $this->change; + } + + /** + *id of the updated Delivery.
Value before the change.
+ * + + * @return null|CustomFields + */ + public function getPreviousValue() + { + return $this->previousValue instanceof CustomFieldsBuilder ? $this->previousValue->build() : $this->previousValue; + } + + /** + *Value after the change.
+ * + + * @return null|CustomFields + */ + public function getNextValue() + { + return $this->nextValue instanceof CustomFieldsBuilder ? $this->nextValue->build() : $this->nextValue; + } + + /** + * @param ?string $change + * @return $this + */ + public function withChange(?string $change) + { + $this->change = $change; + + return $this; + } + + /** + * @param ?string $deliveryId + * @return $this + */ + public function withDeliveryId(?string $deliveryId) + { + $this->deliveryId = $deliveryId; + + return $this; + } + + /** + * @param ?CustomFields $previousValue + * @return $this + */ + public function withPreviousValue(?CustomFields $previousValue) + { + $this->previousValue = $previousValue; + + return $this; + } + + /** + * @param ?CustomFields $nextValue + * @return $this + */ + public function withNextValue(?CustomFields $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + /** + * @deprecated use withPreviousValue() instead + * @return $this + */ + public function withPreviousValueBuilder(?CustomFieldsBuilder $previousValue) + { + $this->previousValue = $previousValue; + + return $this; + } + + /** + * @deprecated use withNextValue() instead + * @return $this + */ + public function withNextValueBuilder(?CustomFieldsBuilder $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + public function build(): SetDeliveryCustomTypeChange + { + return new SetDeliveryCustomTypeChangeModel( + $this->change, + $this->deliveryId, + $this->previousValue instanceof CustomFieldsBuilder ? $this->previousValue->build() : $this->previousValue, + $this->nextValue instanceof CustomFieldsBuilder ? $this->nextValue->build() : $this->nextValue + ); + } + + public static function of(): SetDeliveryCustomTypeChangeBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetDeliveryCustomTypeChangeCollection.php b/lib/commercetools-history/src/Models/Change/SetDeliveryCustomTypeChangeCollection.php new file mode 100644 index 00000000000..097e4f4dcc0 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetDeliveryCustomTypeChangeCollection.php @@ -0,0 +1,56 @@ + + * @method SetDeliveryCustomTypeChange current() + * @method SetDeliveryCustomTypeChange end() + * @method SetDeliveryCustomTypeChange at($offset) + */ +class SetDeliveryCustomTypeChangeCollection extends ChangeCollection +{ + /** + * @psalm-assert SetDeliveryCustomTypeChange $value + * @psalm-param SetDeliveryCustomTypeChange|stdClass $value + * @throws InvalidArgumentException + * + * @return SetDeliveryCustomTypeChangeCollection + */ + public function add($value) + { + if (!$value instanceof SetDeliveryCustomTypeChange) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?SetDeliveryCustomTypeChange + */ + protected function mapper() + { + return function (?int $index): ?SetDeliveryCustomTypeChange { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var SetDeliveryCustomTypeChange $data */ + $data = SetDeliveryCustomTypeChangeModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetDeliveryCustomTypeChangeModel.php b/lib/commercetools-history/src/Models/Change/SetDeliveryCustomTypeChangeModel.php new file mode 100644 index 00000000000..b7247537104 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetDeliveryCustomTypeChangeModel.php @@ -0,0 +1,207 @@ +change = $change; + $this->deliveryId = $deliveryId; + $this->previousValue = $previousValue; + $this->nextValue = $nextValue; + $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; + } + + /** + * + * @return null|string + */ + public function getChange() + { + if (is_null($this->change)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CHANGE); + if (is_null($data)) { + return null; + } + $this->change = (string) $data; + } + + return $this->change; + } + + /** + *id of the updated Delivery.
Value before the change.
+ * + * + * @return null|CustomFields + */ + public function getPreviousValue() + { + if (is_null($this->previousValue)) { + /** @psalm-var stdClass|arrayValue after the change.
+ * + * + * @return null|CustomFields + */ + public function getNextValue() + { + if (is_null($this->nextValue)) { + /** @psalm-var stdClass|arrayValue after the change.
+ * + + * @return null|DiscountOnTotalPrice + */ + public function getNextValue(); + + /** + * @param ?string $change + */ + public function setChange(?string $change): void; + + /** + * @param ?DiscountOnTotalPrice $previousValue + */ + public function setPreviousValue(?DiscountOnTotalPrice $previousValue): void; + + /** + * @param ?DiscountOnTotalPrice $nextValue + */ + public function setNextValue(?DiscountOnTotalPrice $nextValue): void; +} diff --git a/lib/commercetools-history/src/Models/Change/SetDiscountOnTotalPriceChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetDiscountOnTotalPriceChangeBuilder.php new file mode 100644 index 00000000000..198590e412f --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetDiscountOnTotalPriceChangeBuilder.php @@ -0,0 +1,142 @@ + + */ +final class SetDiscountOnTotalPriceChangeBuilder implements Builder +{ + /** + + * @var ?string + */ + private $change; + + /** + + * @var null|DiscountOnTotalPrice|DiscountOnTotalPriceBuilder + */ + private $previousValue; + + /** + + * @var null|DiscountOnTotalPrice|DiscountOnTotalPriceBuilder + */ + private $nextValue; + + /** + + * @return null|string + */ + public function getChange() + { + return $this->change; + } + + /** + *Value before the change.
+ * + + * @return null|DiscountOnTotalPrice + */ + public function getPreviousValue() + { + return $this->previousValue instanceof DiscountOnTotalPriceBuilder ? $this->previousValue->build() : $this->previousValue; + } + + /** + *Value after the change.
+ * + + * @return null|DiscountOnTotalPrice + */ + public function getNextValue() + { + return $this->nextValue instanceof DiscountOnTotalPriceBuilder ? $this->nextValue->build() : $this->nextValue; + } + + /** + * @param ?string $change + * @return $this + */ + public function withChange(?string $change) + { + $this->change = $change; + + return $this; + } + + /** + * @param ?DiscountOnTotalPrice $previousValue + * @return $this + */ + public function withPreviousValue(?DiscountOnTotalPrice $previousValue) + { + $this->previousValue = $previousValue; + + return $this; + } + + /** + * @param ?DiscountOnTotalPrice $nextValue + * @return $this + */ + public function withNextValue(?DiscountOnTotalPrice $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + /** + * @deprecated use withPreviousValue() instead + * @return $this + */ + public function withPreviousValueBuilder(?DiscountOnTotalPriceBuilder $previousValue) + { + $this->previousValue = $previousValue; + + return $this; + } + + /** + * @deprecated use withNextValue() instead + * @return $this + */ + public function withNextValueBuilder(?DiscountOnTotalPriceBuilder $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + public function build(): SetDiscountOnTotalPriceChange + { + return new SetDiscountOnTotalPriceChangeModel( + $this->change, + $this->previousValue instanceof DiscountOnTotalPriceBuilder ? $this->previousValue->build() : $this->previousValue, + $this->nextValue instanceof DiscountOnTotalPriceBuilder ? $this->nextValue->build() : $this->nextValue + ); + } + + public static function of(): SetDiscountOnTotalPriceChangeBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetDiscountOnTotalPriceChangeCollection.php b/lib/commercetools-history/src/Models/Change/SetDiscountOnTotalPriceChangeCollection.php new file mode 100644 index 00000000000..f0d575fc047 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetDiscountOnTotalPriceChangeCollection.php @@ -0,0 +1,56 @@ + + * @method SetDiscountOnTotalPriceChange current() + * @method SetDiscountOnTotalPriceChange end() + * @method SetDiscountOnTotalPriceChange at($offset) + */ +class SetDiscountOnTotalPriceChangeCollection extends ChangeCollection +{ + /** + * @psalm-assert SetDiscountOnTotalPriceChange $value + * @psalm-param SetDiscountOnTotalPriceChange|stdClass $value + * @throws InvalidArgumentException + * + * @return SetDiscountOnTotalPriceChangeCollection + */ + public function add($value) + { + if (!$value instanceof SetDiscountOnTotalPriceChange) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?SetDiscountOnTotalPriceChange + */ + protected function mapper() + { + return function (?int $index): ?SetDiscountOnTotalPriceChange { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var SetDiscountOnTotalPriceChange $data */ + $data = SetDiscountOnTotalPriceChangeModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetDiscountOnTotalPriceChangeModel.php b/lib/commercetools-history/src/Models/Change/SetDiscountOnTotalPriceChangeModel.php new file mode 100644 index 00000000000..13b427495cc --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetDiscountOnTotalPriceChangeModel.php @@ -0,0 +1,171 @@ +change = $change; + $this->previousValue = $previousValue; + $this->nextValue = $nextValue; + $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; + } + + /** + * + * @return null|string + */ + public function getChange() + { + if (is_null($this->change)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CHANGE); + if (is_null($data)) { + return null; + } + $this->change = (string) $data; + } + + return $this->change; + } + + /** + *Value before the change.
+ * + * + * @return null|DiscountOnTotalPrice + */ + public function getPreviousValue() + { + if (is_null($this->previousValue)) { + /** @psalm-var stdClass|arrayValue after the change.
+ * + * + * @return null|DiscountOnTotalPrice + */ + public function getNextValue() + { + if (is_null($this->nextValue)) { + /** @psalm-var stdClass|arrayValue before the change.
* - * @return null|Price + * @return null|DiscountedPrice */ public function getPreviousValue(); @@ -45,11 +47,12 @@ public function getPreviousValue(); *Value after the change.
* - * @return null|Price + * @return null|DiscountedPrice */ public function getNextValue(); /** + *Product data that was updated.
*staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.sku or key of the updated ProductVariant.
Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
* * @return null|string @@ -76,20 +80,28 @@ public function getVariant(); */ public function getPriceId(); + /** + *Embedded Price of the ProductVariant.
+ * + + * @return null|Price + */ + public function getPrice(); + /** * @param ?string $change */ public function setChange(?string $change): void; /** - * @param ?Price $previousValue + * @param ?DiscountedPrice $previousValue */ - public function setPreviousValue(?Price $previousValue): void; + public function setPreviousValue(?DiscountedPrice $previousValue): void; /** - * @param ?Price $nextValue + * @param ?DiscountedPrice $nextValue */ - public function setNextValue(?Price $nextValue): void; + public function setNextValue(?DiscountedPrice $nextValue): void; /** * @param ?string $catalogData @@ -105,4 +117,9 @@ public function setVariant(?string $variant): void; * @param ?string $priceId */ public function setPriceId(?string $priceId): void; + + /** + * @param ?Price $price + */ + public function setPrice(?Price $price): void; } diff --git a/lib/commercetools-history/src/Models/Change/SetDiscountedPriceChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetDiscountedPriceChangeBuilder.php index aafab57dae1..0ed7b54f024 100644 --- a/lib/commercetools-history/src/Models/Change/SetDiscountedPriceChangeBuilder.php +++ b/lib/commercetools-history/src/Models/Change/SetDiscountedPriceChangeBuilder.php @@ -14,6 +14,8 @@ use Commercetools\Base\JsonObjectModel; use Commercetools\Base\MapperFactory; use stdClass; +use Commercetools\History\Models\Common\DiscountedPrice; +use Commercetools\History\Models\Common\DiscountedPriceBuilder; use Commercetools\History\Models\Common\Price; use Commercetools\History\Models\Common\PriceBuilder; @@ -30,13 +32,13 @@ final class SetDiscountedPriceChangeBuilder implements Builder /** - * @var null|Price|PriceBuilder + * @var null|DiscountedPrice|DiscountedPriceBuilder */ private $previousValue; /** - * @var null|Price|PriceBuilder + * @var null|DiscountedPrice|DiscountedPriceBuilder */ private $nextValue; @@ -58,6 +60,12 @@ final class SetDiscountedPriceChangeBuilder implements Builder */ private $priceId; + /** + + * @var null|Price|PriceBuilder + */ + private $price; + /** * @return null|string @@ -71,25 +79,26 @@ public function getChange() *Value before the change.
* - * @return null|Price + * @return null|DiscountedPrice */ public function getPreviousValue() { - return $this->previousValue instanceof PriceBuilder ? $this->previousValue->build() : $this->previousValue; + return $this->previousValue instanceof DiscountedPriceBuilder ? $this->previousValue->build() : $this->previousValue; } /** *Value after the change.
* - * @return null|Price + * @return null|DiscountedPrice */ public function getNextValue() { - return $this->nextValue instanceof PriceBuilder ? $this->nextValue->build() : $this->nextValue; + return $this->nextValue instanceof DiscountedPriceBuilder ? $this->nextValue->build() : $this->nextValue; } /** + *Product data that was updated.
*staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.sku or key of the updated ProductVariant.
Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
* * @return null|string @@ -125,6 +135,17 @@ public function getPriceId() return $this->priceId; } + /** + *Embedded Price of the ProductVariant.
+ * + + * @return null|Price + */ + public function getPrice() + { + return $this->price instanceof PriceBuilder ? $this->price->build() : $this->price; + } + /** * @param ?string $change * @return $this @@ -137,10 +158,10 @@ public function withChange(?string $change) } /** - * @param ?Price $previousValue + * @param ?DiscountedPrice $previousValue * @return $this */ - public function withPreviousValue(?Price $previousValue) + public function withPreviousValue(?DiscountedPrice $previousValue) { $this->previousValue = $previousValue; @@ -148,10 +169,10 @@ public function withPreviousValue(?Price $previousValue) } /** - * @param ?Price $nextValue + * @param ?DiscountedPrice $nextValue * @return $this */ - public function withNextValue(?Price $nextValue) + public function withNextValue(?DiscountedPrice $nextValue) { $this->nextValue = $nextValue; @@ -191,11 +212,22 @@ public function withPriceId(?string $priceId) return $this; } + /** + * @param ?Price $price + * @return $this + */ + public function withPrice(?Price $price) + { + $this->price = $price; + + return $this; + } + /** * @deprecated use withPreviousValue() instead * @return $this */ - public function withPreviousValueBuilder(?PriceBuilder $previousValue) + public function withPreviousValueBuilder(?DiscountedPriceBuilder $previousValue) { $this->previousValue = $previousValue; @@ -206,22 +238,34 @@ public function withPreviousValueBuilder(?PriceBuilder $previousValue) * @deprecated use withNextValue() instead * @return $this */ - public function withNextValueBuilder(?PriceBuilder $nextValue) + public function withNextValueBuilder(?DiscountedPriceBuilder $nextValue) { $this->nextValue = $nextValue; return $this; } + /** + * @deprecated use withPrice() instead + * @return $this + */ + public function withPriceBuilder(?PriceBuilder $price) + { + $this->price = $price; + + return $this; + } + public function build(): SetDiscountedPriceChange { return new SetDiscountedPriceChangeModel( $this->change, - $this->previousValue instanceof PriceBuilder ? $this->previousValue->build() : $this->previousValue, - $this->nextValue instanceof PriceBuilder ? $this->nextValue->build() : $this->nextValue, + $this->previousValue instanceof DiscountedPriceBuilder ? $this->previousValue->build() : $this->previousValue, + $this->nextValue instanceof DiscountedPriceBuilder ? $this->nextValue->build() : $this->nextValue, $this->catalogData, $this->variant, - $this->priceId + $this->priceId, + $this->price instanceof PriceBuilder ? $this->price->build() : $this->price ); } diff --git a/lib/commercetools-history/src/Models/Change/SetDiscountedPriceChangeModel.php b/lib/commercetools-history/src/Models/Change/SetDiscountedPriceChangeModel.php index 4222142df9e..1aa6d49aeb5 100644 --- a/lib/commercetools-history/src/Models/Change/SetDiscountedPriceChangeModel.php +++ b/lib/commercetools-history/src/Models/Change/SetDiscountedPriceChangeModel.php @@ -13,6 +13,8 @@ use Commercetools\Base\JsonObjectModel; use Commercetools\Base\MapperFactory; use stdClass; +use Commercetools\History\Models\Common\DiscountedPrice; +use Commercetools\History\Models\Common\DiscountedPriceModel; use Commercetools\History\Models\Common\Price; use Commercetools\History\Models\Common\PriceModel; @@ -37,13 +39,13 @@ final class SetDiscountedPriceChangeModel extends JsonObjectModel implements Set /** * - * @var ?Price + * @var ?DiscountedPrice */ protected $previousValue; /** * - * @var ?Price + * @var ?DiscountedPrice */ protected $nextValue; @@ -65,17 +67,24 @@ final class SetDiscountedPriceChangeModel extends JsonObjectModel implements Set */ protected $priceId; + /** + * + * @var ?Price + */ + protected $price; + /** * @psalm-suppress MissingParamType */ public function __construct( ?string $change = null, - ?Price $previousValue = null, - ?Price $nextValue = null, + ?DiscountedPrice $previousValue = null, + ?DiscountedPrice $nextValue = null, ?string $catalogData = null, ?string $variant = null, ?string $priceId = null, + ?Price $price = null, ?string $type = null ) { $this->change = $change; @@ -84,6 +93,7 @@ public function __construct( $this->catalogData = $catalogData; $this->variant = $variant; $this->priceId = $priceId; + $this->price = $price; $this->type = $type ?? self::DISCRIMINATOR_VALUE; } @@ -127,7 +137,7 @@ public function getChange() *Value before the change.
* * - * @return null|Price + * @return null|DiscountedPrice */ public function getPreviousValue() { @@ -138,7 +148,7 @@ public function getPreviousValue() return null; } - $this->previousValue = PriceModel::of($data); + $this->previousValue = DiscountedPriceModel::of($data); } return $this->previousValue; @@ -148,7 +158,7 @@ public function getPreviousValue() *Value after the change.
* * - * @return null|Price + * @return null|DiscountedPrice */ public function getNextValue() { @@ -159,13 +169,14 @@ public function getNextValue() return null; } - $this->nextValue = PriceModel::of($data); + $this->nextValue = DiscountedPriceModel::of($data); } return $this->nextValue; } /** + *Product data that was updated.
*staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.sku or key of the updated ProductVariant.
Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
* * * @return null|string @@ -228,6 +240,27 @@ public function getPriceId() return $this->priceId; } + /** + *Embedded Price of the ProductVariant.
+ * + * + * @return null|Price + */ + public function getPrice() + { + if (is_null($this->price)) { + /** @psalm-var stdClass|arrayElements added to the array.
+ * + + * @return null|ReferenceCollection + */ + public function getAddedItems(); + + /** + *Elements removed from the array.
+ * + + * @return null|ReferenceCollection + */ + public function getRemovedItems(); + /** * @param ?string $change */ @@ -60,4 +78,14 @@ public function setPreviousValue(?ReferenceCollection $previousValue): void; * @param ?ReferenceCollection $nextValue */ public function setNextValue(?ReferenceCollection $nextValue): void; + + /** + * @param ?ReferenceCollection $addedItems + */ + public function setAddedItems(?ReferenceCollection $addedItems): void; + + /** + * @param ?ReferenceCollection $removedItems + */ + public function setRemovedItems(?ReferenceCollection $removedItems): void; } diff --git a/lib/commercetools-history/src/Models/Change/SetDistributionChannelsChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetDistributionChannelsChangeBuilder.php index 6a26dda87ea..9bbf9e505b7 100644 --- a/lib/commercetools-history/src/Models/Change/SetDistributionChannelsChangeBuilder.php +++ b/lib/commercetools-history/src/Models/Change/SetDistributionChannelsChangeBuilder.php @@ -39,6 +39,18 @@ final class SetDistributionChannelsChangeBuilder implements Builder */ private $nextValue; + /** + + * @var ?ReferenceCollection + */ + private $addedItems; + + /** + + * @var ?ReferenceCollection + */ + private $removedItems; + /** * @return null|string @@ -70,6 +82,28 @@ public function getNextValue() return $this->nextValue; } + /** + *Elements added to the array.
+ * + + * @return null|ReferenceCollection + */ + public function getAddedItems() + { + return $this->addedItems; + } + + /** + *Elements removed from the array.
+ * + + * @return null|ReferenceCollection + */ + public function getRemovedItems() + { + return $this->removedItems; + } + /** * @param ?string $change * @return $this @@ -103,13 +137,37 @@ public function withNextValue(?ReferenceCollection $nextValue) return $this; } + /** + * @param ?ReferenceCollection $addedItems + * @return $this + */ + public function withAddedItems(?ReferenceCollection $addedItems) + { + $this->addedItems = $addedItems; + + return $this; + } + + /** + * @param ?ReferenceCollection $removedItems + * @return $this + */ + public function withRemovedItems(?ReferenceCollection $removedItems) + { + $this->removedItems = $removedItems; + + return $this; + } + public function build(): SetDistributionChannelsChange { return new SetDistributionChannelsChangeModel( $this->change, $this->previousValue, - $this->nextValue + $this->nextValue, + $this->addedItems, + $this->removedItems ); } diff --git a/lib/commercetools-history/src/Models/Change/SetDistributionChannelsChangeModel.php b/lib/commercetools-history/src/Models/Change/SetDistributionChannelsChangeModel.php index 3ef4044d1ce..d3752805544 100644 --- a/lib/commercetools-history/src/Models/Change/SetDistributionChannelsChangeModel.php +++ b/lib/commercetools-history/src/Models/Change/SetDistributionChannelsChangeModel.php @@ -46,6 +46,18 @@ final class SetDistributionChannelsChangeModel extends JsonObjectModel implement */ protected $nextValue; + /** + * + * @var ?ReferenceCollection + */ + protected $addedItems; + + /** + * + * @var ?ReferenceCollection + */ + protected $removedItems; + /** * @psalm-suppress MissingParamType @@ -54,11 +66,15 @@ public function __construct( ?string $change = null, ?ReferenceCollection $previousValue = null, ?ReferenceCollection $nextValue = null, + ?ReferenceCollection $addedItems = null, + ?ReferenceCollection $removedItems = null, ?string $type = null ) { $this->change = $change; $this->previousValue = $previousValue; $this->nextValue = $nextValue; + $this->addedItems = $addedItems; + $this->removedItems = $removedItems; $this->type = $type ?? self::DISCRIMINATOR_VALUE; } @@ -138,6 +154,46 @@ public function getNextValue() return $this->nextValue; } + /** + *Elements added to the array.
+ * + * + * @return null|ReferenceCollection + */ + public function getAddedItems() + { + if (is_null($this->addedItems)) { + /** @psalm-var ?listElements removed from the array.
+ * + * + * @return null|ReferenceCollection + */ + public function getRemovedItems() + { + if (is_null($this->removedItems)) { + /** @psalm-var ?listProduct data that was updated.
*staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + + * @return null|string + */ + public function getVariant(); + /** * @param ?string $change */ @@ -77,4 +88,9 @@ public function setNextValue(?Image $nextValue): void; * @param ?string $catalogData */ public function setCatalogData(?string $catalogData): void; + + /** + * @param ?string $variant + */ + public function setVariant(?string $variant): void; } diff --git a/lib/commercetools-history/src/Models/Change/SetImageLabelChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetImageLabelChangeBuilder.php index 68766ecb886..33870599487 100644 --- a/lib/commercetools-history/src/Models/Change/SetImageLabelChangeBuilder.php +++ b/lib/commercetools-history/src/Models/Change/SetImageLabelChangeBuilder.php @@ -46,6 +46,12 @@ final class SetImageLabelChangeBuilder implements Builder */ private $catalogData; + /** + + * @var ?string + */ + private $variant; + /** * @return null|string @@ -78,6 +84,7 @@ public function getNextValue() } /** + *Product data that was updated.
*staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + + * @return null|string + */ + public function getVariant() + { + return $this->variant; + } + /** * @param ?string $change * @return $this @@ -135,6 +154,17 @@ public function withCatalogData(?string $catalogData) return $this; } + /** + * @param ?string $variant + * @return $this + */ + public function withVariant(?string $variant) + { + $this->variant = $variant; + + return $this; + } + /** * @deprecated use withPreviousValue() instead * @return $this @@ -163,7 +193,8 @@ public function build(): SetImageLabelChange $this->change, $this->previousValue instanceof ImageBuilder ? $this->previousValue->build() : $this->previousValue, $this->nextValue instanceof ImageBuilder ? $this->nextValue->build() : $this->nextValue, - $this->catalogData + $this->catalogData, + $this->variant ); } diff --git a/lib/commercetools-history/src/Models/Change/SetImageLabelChangeModel.php b/lib/commercetools-history/src/Models/Change/SetImageLabelChangeModel.php index 0402433377c..624ae8da1b7 100644 --- a/lib/commercetools-history/src/Models/Change/SetImageLabelChangeModel.php +++ b/lib/commercetools-history/src/Models/Change/SetImageLabelChangeModel.php @@ -53,6 +53,12 @@ final class SetImageLabelChangeModel extends JsonObjectModel implements SetImage */ protected $catalogData; + /** + * + * @var ?string + */ + protected $variant; + /** * @psalm-suppress MissingParamType @@ -62,12 +68,14 @@ public function __construct( ?Image $previousValue = null, ?Image $nextValue = null, ?string $catalogData = null, + ?string $variant = null, ?string $type = null ) { $this->change = $change; $this->previousValue = $previousValue; $this->nextValue = $nextValue; $this->catalogData = $catalogData; + $this->variant = $variant; $this->type = $type ?? self::DISCRIMINATOR_VALUE; } @@ -150,6 +158,7 @@ public function getNextValue() } /** + *Product data that was updated.
*staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + * + * @return null|string + */ + public function getVariant() + { + if (is_null($this->variant)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_VARIANT); + if (is_null($data)) { + return null; + } + $this->variant = (string) $data; + } + + return $this->variant; + } + /** * @param ?string $change @@ -205,6 +235,14 @@ public function setCatalogData(?string $catalogData): void $this->catalogData = $catalogData; } + /** + * @param ?string $variant + */ + public function setVariant(?string $variant): void + { + $this->variant = $variant; + } + } diff --git a/lib/commercetools-history/src/Models/Change/SetInheritedAssociatesChange.php b/lib/commercetools-history/src/Models/Change/SetInheritedAssociatesChange.php new file mode 100644 index 00000000000..9a5e0406421 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetInheritedAssociatesChange.php @@ -0,0 +1,91 @@ +Elements added to the array. + * + + * @return null|InheritedAssociateCollection + */ + public function getAddedItems(); + + /** + *Elements removed from the array.
+ * + + * @return null|InheritedAssociateCollection + */ + public function getRemovedItems(); + + /** + *Value before the change.
+ * + + * @return null|InheritedAssociateCollection + */ + public function getPreviousValue(); + + /** + *Value after the change.
+ * + + * @return null|InheritedAssociateCollection + */ + public function getNextValue(); + + /** + * @param ?string $change + */ + public function setChange(?string $change): void; + + /** + * @param ?InheritedAssociateCollection $addedItems + */ + public function setAddedItems(?InheritedAssociateCollection $addedItems): void; + + /** + * @param ?InheritedAssociateCollection $removedItems + */ + public function setRemovedItems(?InheritedAssociateCollection $removedItems): void; + + /** + * @param ?InheritedAssociateCollection $previousValue + */ + public function setPreviousValue(?InheritedAssociateCollection $previousValue): void; + + /** + * @param ?InheritedAssociateCollection $nextValue + */ + public function setNextValue(?InheritedAssociateCollection $nextValue): void; +} diff --git a/lib/commercetools-history/src/Models/Change/SetInheritedAssociatesChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetInheritedAssociatesChangeBuilder.php new file mode 100644 index 00000000000..fc5172f8599 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetInheritedAssociatesChangeBuilder.php @@ -0,0 +1,178 @@ + + */ +final class SetInheritedAssociatesChangeBuilder implements Builder +{ + /** + + * @var ?string + */ + private $change; + + /** + + * @var ?InheritedAssociateCollection + */ + private $addedItems; + + /** + + * @var ?InheritedAssociateCollection + */ + private $removedItems; + + /** + + * @var ?InheritedAssociateCollection + */ + private $previousValue; + + /** + + * @var ?InheritedAssociateCollection + */ + private $nextValue; + + /** + + * @return null|string + */ + public function getChange() + { + return $this->change; + } + + /** + *Elements added to the array.
+ * + + * @return null|InheritedAssociateCollection + */ + public function getAddedItems() + { + return $this->addedItems; + } + + /** + *Elements removed from the array.
+ * + + * @return null|InheritedAssociateCollection + */ + public function getRemovedItems() + { + return $this->removedItems; + } + + /** + *Value before the change.
+ * + + * @return null|InheritedAssociateCollection + */ + public function getPreviousValue() + { + return $this->previousValue; + } + + /** + *Value after the change.
+ * + + * @return null|InheritedAssociateCollection + */ + public function getNextValue() + { + return $this->nextValue; + } + + /** + * @param ?string $change + * @return $this + */ + public function withChange(?string $change) + { + $this->change = $change; + + return $this; + } + + /** + * @param ?InheritedAssociateCollection $addedItems + * @return $this + */ + public function withAddedItems(?InheritedAssociateCollection $addedItems) + { + $this->addedItems = $addedItems; + + return $this; + } + + /** + * @param ?InheritedAssociateCollection $removedItems + * @return $this + */ + public function withRemovedItems(?InheritedAssociateCollection $removedItems) + { + $this->removedItems = $removedItems; + + return $this; + } + + /** + * @param ?InheritedAssociateCollection $previousValue + * @return $this + */ + public function withPreviousValue(?InheritedAssociateCollection $previousValue) + { + $this->previousValue = $previousValue; + + return $this; + } + + /** + * @param ?InheritedAssociateCollection $nextValue + * @return $this + */ + public function withNextValue(?InheritedAssociateCollection $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + + public function build(): SetInheritedAssociatesChange + { + return new SetInheritedAssociatesChangeModel( + $this->change, + $this->addedItems, + $this->removedItems, + $this->previousValue, + $this->nextValue + ); + } + + public static function of(): SetInheritedAssociatesChangeBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetInheritedAssociatesChangeCollection.php b/lib/commercetools-history/src/Models/Change/SetInheritedAssociatesChangeCollection.php new file mode 100644 index 00000000000..428ae5aeb85 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetInheritedAssociatesChangeCollection.php @@ -0,0 +1,56 @@ + + * @method SetInheritedAssociatesChange current() + * @method SetInheritedAssociatesChange end() + * @method SetInheritedAssociatesChange at($offset) + */ +class SetInheritedAssociatesChangeCollection extends ChangeCollection +{ + /** + * @psalm-assert SetInheritedAssociatesChange $value + * @psalm-param SetInheritedAssociatesChange|stdClass $value + * @throws InvalidArgumentException + * + * @return SetInheritedAssociatesChangeCollection + */ + public function add($value) + { + if (!$value instanceof SetInheritedAssociatesChange) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?SetInheritedAssociatesChange + */ + protected function mapper() + { + return function (?int $index): ?SetInheritedAssociatesChange { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var SetInheritedAssociatesChange $data */ + $data = SetInheritedAssociatesChangeModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetInheritedAssociatesChangeModel.php b/lib/commercetools-history/src/Models/Change/SetInheritedAssociatesChangeModel.php new file mode 100644 index 00000000000..bef51eb6aec --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetInheritedAssociatesChangeModel.php @@ -0,0 +1,240 @@ +change = $change; + $this->addedItems = $addedItems; + $this->removedItems = $removedItems; + $this->previousValue = $previousValue; + $this->nextValue = $nextValue; + $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; + } + + /** + * + * @return null|string + */ + public function getChange() + { + if (is_null($this->change)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CHANGE); + if (is_null($data)) { + return null; + } + $this->change = (string) $data; + } + + return $this->change; + } + + /** + *Elements added to the array.
+ * + * + * @return null|InheritedAssociateCollection + */ + public function getAddedItems() + { + if (is_null($this->addedItems)) { + /** @psalm-var ?listElements removed from the array.
+ * + * + * @return null|InheritedAssociateCollection + */ + public function getRemovedItems() + { + if (is_null($this->removedItems)) { + /** @psalm-var ?listValue before the change.
+ * + * + * @return null|InheritedAssociateCollection + */ + public function getPreviousValue() + { + if (is_null($this->previousValue)) { + /** @psalm-var ?listValue after the change.
+ * + * + * @return null|InheritedAssociateCollection + */ + public function getNextValue() + { + if (is_null($this->nextValue)) { + /** @psalm-var ?listElements removed from the array.
+ * + + * @return null|KeyReferenceCollection + */ + public function getRemovedItems(); + + /** + *Value before the change.
+ * + + * @return null|KeyReferenceCollection + */ + public function getPreviousValue(); + + /** + *Value after the change.
+ * + + * @return null|KeyReferenceCollection + */ + public function getNextValue(); + + /** + * @param ?string $change + */ + public function setChange(?string $change): void; + + /** + * @param ?KeyReferenceCollection $addedItems + */ + public function setAddedItems(?KeyReferenceCollection $addedItems): void; + + /** + * @param ?KeyReferenceCollection $removedItems + */ + public function setRemovedItems(?KeyReferenceCollection $removedItems): void; + + /** + * @param ?KeyReferenceCollection $previousValue + */ + public function setPreviousValue(?KeyReferenceCollection $previousValue): void; + + /** + * @param ?KeyReferenceCollection $nextValue + */ + public function setNextValue(?KeyReferenceCollection $nextValue): void; +} diff --git a/lib/commercetools-history/src/Models/Change/SetInheritedStoresChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetInheritedStoresChangeBuilder.php new file mode 100644 index 00000000000..ef62f7718d3 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetInheritedStoresChangeBuilder.php @@ -0,0 +1,178 @@ + + */ +final class SetInheritedStoresChangeBuilder implements Builder +{ + /** + + * @var ?string + */ + private $change; + + /** + + * @var ?KeyReferenceCollection + */ + private $addedItems; + + /** + + * @var ?KeyReferenceCollection + */ + private $removedItems; + + /** + + * @var ?KeyReferenceCollection + */ + private $previousValue; + + /** + + * @var ?KeyReferenceCollection + */ + private $nextValue; + + /** + + * @return null|string + */ + public function getChange() + { + return $this->change; + } + + /** + *Elements added to the array.
+ * + + * @return null|KeyReferenceCollection + */ + public function getAddedItems() + { + return $this->addedItems; + } + + /** + *Elements removed from the array.
+ * + + * @return null|KeyReferenceCollection + */ + public function getRemovedItems() + { + return $this->removedItems; + } + + /** + *Value before the change.
+ * + + * @return null|KeyReferenceCollection + */ + public function getPreviousValue() + { + return $this->previousValue; + } + + /** + *Value after the change.
+ * + + * @return null|KeyReferenceCollection + */ + public function getNextValue() + { + return $this->nextValue; + } + + /** + * @param ?string $change + * @return $this + */ + public function withChange(?string $change) + { + $this->change = $change; + + return $this; + } + + /** + * @param ?KeyReferenceCollection $addedItems + * @return $this + */ + public function withAddedItems(?KeyReferenceCollection $addedItems) + { + $this->addedItems = $addedItems; + + return $this; + } + + /** + * @param ?KeyReferenceCollection $removedItems + * @return $this + */ + public function withRemovedItems(?KeyReferenceCollection $removedItems) + { + $this->removedItems = $removedItems; + + return $this; + } + + /** + * @param ?KeyReferenceCollection $previousValue + * @return $this + */ + public function withPreviousValue(?KeyReferenceCollection $previousValue) + { + $this->previousValue = $previousValue; + + return $this; + } + + /** + * @param ?KeyReferenceCollection $nextValue + * @return $this + */ + public function withNextValue(?KeyReferenceCollection $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + + public function build(): SetInheritedStoresChange + { + return new SetInheritedStoresChangeModel( + $this->change, + $this->addedItems, + $this->removedItems, + $this->previousValue, + $this->nextValue + ); + } + + public static function of(): SetInheritedStoresChangeBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetInheritedStoresChangeCollection.php b/lib/commercetools-history/src/Models/Change/SetInheritedStoresChangeCollection.php new file mode 100644 index 00000000000..1baf49bac84 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetInheritedStoresChangeCollection.php @@ -0,0 +1,56 @@ + + * @method SetInheritedStoresChange current() + * @method SetInheritedStoresChange end() + * @method SetInheritedStoresChange at($offset) + */ +class SetInheritedStoresChangeCollection extends ChangeCollection +{ + /** + * @psalm-assert SetInheritedStoresChange $value + * @psalm-param SetInheritedStoresChange|stdClass $value + * @throws InvalidArgumentException + * + * @return SetInheritedStoresChangeCollection + */ + public function add($value) + { + if (!$value instanceof SetInheritedStoresChange) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?SetInheritedStoresChange + */ + protected function mapper() + { + return function (?int $index): ?SetInheritedStoresChange { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var SetInheritedStoresChange $data */ + $data = SetInheritedStoresChangeModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetInheritedStoresChangeModel.php b/lib/commercetools-history/src/Models/Change/SetInheritedStoresChangeModel.php new file mode 100644 index 00000000000..6cd98f3101f --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetInheritedStoresChangeModel.php @@ -0,0 +1,240 @@ +change = $change; + $this->addedItems = $addedItems; + $this->removedItems = $removedItems; + $this->previousValue = $previousValue; + $this->nextValue = $nextValue; + $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; + } + + /** + * + * @return null|string + */ + public function getChange() + { + if (is_null($this->change)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CHANGE); + if (is_null($data)) { + return null; + } + $this->change = (string) $data; + } + + return $this->change; + } + + /** + *Elements added to the array.
+ * + * + * @return null|KeyReferenceCollection + */ + public function getAddedItems() + { + if (is_null($this->addedItems)) { + /** @psalm-var ?listElements removed from the array.
+ * + * + * @return null|KeyReferenceCollection + */ + public function getRemovedItems() + { + if (is_null($this->removedItems)) { + /** @psalm-var ?listValue before the change.
+ * + * + * @return null|KeyReferenceCollection + */ + public function getPreviousValue() + { + if (is_null($this->previousValue)) { + /** @psalm-var ?listValue after the change.
+ * + * + * @return null|KeyReferenceCollection + */ + public function getNextValue() + { + if (is_null($this->nextValue)) { + /** @psalm-var ?listid of the updated Address.
+ *
+
+ * @return null|string
+ */
+ public function getAddressId();
+
+ /**
+ * Name of the Custom Field.
+ * + + * @return null|string + */ + public function getName(); + + /** + *id of the referenced Type.
Value before the change.
+ * + + * @return null|mixed + */ + public function getPreviousValue(); + + /** + *Value after the change.
+ * + + * @return null|mixed + */ + public function getNextValue(); + + /** + * @param ?string $change + */ + public function setChange(?string $change): void; + + /** + * @param ?string $addressId + */ + public function setAddressId(?string $addressId): void; + + /** + * @param ?string $name + */ + public function setName(?string $name): void; + + /** + * @param ?string $customTypeId + */ + public function setCustomTypeId(?string $customTypeId): void; + + /** + * @param mixed $previousValue + */ + public function setPreviousValue( $previousValue): void; + + /** + * @param mixed $nextValue + */ + public function setNextValue( $nextValue): void; +} diff --git a/lib/commercetools-history/src/Models/Change/SetItemShippingAddressCustomFieldChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetItemShippingAddressCustomFieldChangeBuilder.php new file mode 100644 index 00000000000..e515bda26f7 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetItemShippingAddressCustomFieldChangeBuilder.php @@ -0,0 +1,206 @@ + + */ +final class SetItemShippingAddressCustomFieldChangeBuilder implements Builder +{ + /** + + * @var ?string + */ + private $change; + + /** + + * @var ?string + */ + private $addressId; + + /** + + * @var ?string + */ + private $name; + + /** + + * @var ?string + */ + private $customTypeId; + + /** + + * @var null|mixed|mixed + */ + private $previousValue; + + /** + + * @var null|mixed|mixed + */ + private $nextValue; + + /** + + * @return null|string + */ + public function getChange() + { + return $this->change; + } + + /** + *id of the updated Address.
Name of the Custom Field.
+ * + + * @return null|string + */ + public function getName() + { + return $this->name; + } + + /** + *id of the referenced Type.
Value before the change.
+ * + + * @return null|mixed + */ + public function getPreviousValue() + { + return $this->previousValue; + } + + /** + *Value after the change.
+ * + + * @return null|mixed + */ + public function getNextValue() + { + return $this->nextValue; + } + + /** + * @param ?string $change + * @return $this + */ + public function withChange(?string $change) + { + $this->change = $change; + + return $this; + } + + /** + * @param ?string $addressId + * @return $this + */ + public function withAddressId(?string $addressId) + { + $this->addressId = $addressId; + + return $this; + } + + /** + * @param ?string $name + * @return $this + */ + public function withName(?string $name) + { + $this->name = $name; + + return $this; + } + + /** + * @param ?string $customTypeId + * @return $this + */ + public function withCustomTypeId(?string $customTypeId) + { + $this->customTypeId = $customTypeId; + + return $this; + } + + /** + * @param mixed $previousValue + * @return $this + */ + public function withPreviousValue( $previousValue) + { + $this->previousValue = $previousValue; + + return $this; + } + + /** + * @param mixed $nextValue + * @return $this + */ + public function withNextValue( $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + + public function build(): SetItemShippingAddressCustomFieldChange + { + return new SetItemShippingAddressCustomFieldChangeModel( + $this->change, + $this->addressId, + $this->name, + $this->customTypeId, + $this->previousValue, + $this->nextValue + ); + } + + public static function of(): SetItemShippingAddressCustomFieldChangeBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetItemShippingAddressCustomFieldChangeCollection.php b/lib/commercetools-history/src/Models/Change/SetItemShippingAddressCustomFieldChangeCollection.php new file mode 100644 index 00000000000..07fdadaa325 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetItemShippingAddressCustomFieldChangeCollection.php @@ -0,0 +1,56 @@ + + * @method SetItemShippingAddressCustomFieldChange current() + * @method SetItemShippingAddressCustomFieldChange end() + * @method SetItemShippingAddressCustomFieldChange at($offset) + */ +class SetItemShippingAddressCustomFieldChangeCollection extends ChangeCollection +{ + /** + * @psalm-assert SetItemShippingAddressCustomFieldChange $value + * @psalm-param SetItemShippingAddressCustomFieldChange|stdClass $value + * @throws InvalidArgumentException + * + * @return SetItemShippingAddressCustomFieldChangeCollection + */ + public function add($value) + { + if (!$value instanceof SetItemShippingAddressCustomFieldChange) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?SetItemShippingAddressCustomFieldChange + */ + protected function mapper() + { + return function (?int $index): ?SetItemShippingAddressCustomFieldChange { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var SetItemShippingAddressCustomFieldChange $data */ + $data = SetItemShippingAddressCustomFieldChangeModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetItemShippingAddressCustomFieldChangeModel.php b/lib/commercetools-history/src/Models/Change/SetItemShippingAddressCustomFieldChangeModel.php new file mode 100644 index 00000000000..978958db02d --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetItemShippingAddressCustomFieldChangeModel.php @@ -0,0 +1,275 @@ +change = $change; + $this->addressId = $addressId; + $this->name = $name; + $this->customTypeId = $customTypeId; + $this->previousValue = $previousValue; + $this->nextValue = $nextValue; + $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; + } + + /** + * + * @return null|string + */ + public function getChange() + { + if (is_null($this->change)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CHANGE); + if (is_null($data)) { + return null; + } + $this->change = (string) $data; + } + + return $this->change; + } + + /** + *id of the updated Address.
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; + } + + /** + *id of the referenced Type.
Value before the change.
+ * + * + * @return null|mixed + */ + public function getPreviousValue() + { + if (is_null($this->previousValue)) { + /** @psalm-var mixed $data */ + $data = $this->raw(self::FIELD_PREVIOUS_VALUE); + if (is_null($data)) { + return null; + } + $this->previousValue = $data; + } + + return $this->previousValue; + } + + /** + *Value after the change.
+ * + * + * @return null|mixed + */ + public function getNextValue() + { + if (is_null($this->nextValue)) { + /** @psalm-var mixed $data */ + $data = $this->raw(self::FIELD_NEXT_VALUE); + if (is_null($data)) { + return null; + } + $this->nextValue = $data; + } + + return $this->nextValue; + } + + + /** + * @param ?string $change + */ + public function setChange(?string $change): void + { + $this->change = $change; + } + + /** + * @param ?string $addressId + */ + public function setAddressId(?string $addressId): void + { + $this->addressId = $addressId; + } + + /** + * @param ?string $name + */ + public function setName(?string $name): void + { + $this->name = $name; + } + + /** + * @param ?string $customTypeId + */ + public function setCustomTypeId(?string $customTypeId): void + { + $this->customTypeId = $customTypeId; + } + + /** + * @param mixed $previousValue + */ + public function setPreviousValue( $previousValue): void + { + $this->previousValue = $previousValue; + } + + /** + * @param mixed $nextValue + */ + public function setNextValue( $nextValue): void + { + $this->nextValue = $nextValue; + } + + + +} diff --git a/lib/commercetools-history/src/Models/Change/SetItemShippingAddressCustomTypeChange.php b/lib/commercetools-history/src/Models/Change/SetItemShippingAddressCustomTypeChange.php new file mode 100644 index 00000000000..a899d00c778 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetItemShippingAddressCustomTypeChange.php @@ -0,0 +1,77 @@ +id of the updated Address.
+ *
+
+ * @return null|string
+ */
+ public function getAddressId();
+
+ /**
+ * Value before the change.
+ * + + * @return null|CustomFields + */ + public function getPreviousValue(); + + /** + *Value after the change.
+ * + + * @return null|CustomFields + */ + public function getNextValue(); + + /** + * @param ?string $change + */ + public function setChange(?string $change): void; + + /** + * @param ?string $addressId + */ + public function setAddressId(?string $addressId): void; + + /** + * @param ?CustomFields $previousValue + */ + public function setPreviousValue(?CustomFields $previousValue): void; + + /** + * @param ?CustomFields $nextValue + */ + public function setNextValue(?CustomFields $nextValue): void; +} diff --git a/lib/commercetools-history/src/Models/Change/SetItemShippingAddressCustomTypeChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetItemShippingAddressCustomTypeChangeBuilder.php new file mode 100644 index 00000000000..6e3af7ecc85 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetItemShippingAddressCustomTypeChangeBuilder.php @@ -0,0 +1,171 @@ + + */ +final class SetItemShippingAddressCustomTypeChangeBuilder implements Builder +{ + /** + + * @var ?string + */ + private $change; + + /** + + * @var ?string + */ + private $addressId; + + /** + + * @var null|CustomFields|CustomFieldsBuilder + */ + private $previousValue; + + /** + + * @var null|CustomFields|CustomFieldsBuilder + */ + private $nextValue; + + /** + + * @return null|string + */ + public function getChange() + { + return $this->change; + } + + /** + *id of the updated Address.
Value before the change.
+ * + + * @return null|CustomFields + */ + public function getPreviousValue() + { + return $this->previousValue instanceof CustomFieldsBuilder ? $this->previousValue->build() : $this->previousValue; + } + + /** + *Value after the change.
+ * + + * @return null|CustomFields + */ + public function getNextValue() + { + return $this->nextValue instanceof CustomFieldsBuilder ? $this->nextValue->build() : $this->nextValue; + } + + /** + * @param ?string $change + * @return $this + */ + public function withChange(?string $change) + { + $this->change = $change; + + return $this; + } + + /** + * @param ?string $addressId + * @return $this + */ + public function withAddressId(?string $addressId) + { + $this->addressId = $addressId; + + return $this; + } + + /** + * @param ?CustomFields $previousValue + * @return $this + */ + public function withPreviousValue(?CustomFields $previousValue) + { + $this->previousValue = $previousValue; + + return $this; + } + + /** + * @param ?CustomFields $nextValue + * @return $this + */ + public function withNextValue(?CustomFields $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + /** + * @deprecated use withPreviousValue() instead + * @return $this + */ + public function withPreviousValueBuilder(?CustomFieldsBuilder $previousValue) + { + $this->previousValue = $previousValue; + + return $this; + } + + /** + * @deprecated use withNextValue() instead + * @return $this + */ + public function withNextValueBuilder(?CustomFieldsBuilder $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + public function build(): SetItemShippingAddressCustomTypeChange + { + return new SetItemShippingAddressCustomTypeChangeModel( + $this->change, + $this->addressId, + $this->previousValue instanceof CustomFieldsBuilder ? $this->previousValue->build() : $this->previousValue, + $this->nextValue instanceof CustomFieldsBuilder ? $this->nextValue->build() : $this->nextValue + ); + } + + public static function of(): SetItemShippingAddressCustomTypeChangeBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetItemShippingAddressCustomTypeChangeCollection.php b/lib/commercetools-history/src/Models/Change/SetItemShippingAddressCustomTypeChangeCollection.php new file mode 100644 index 00000000000..9b448362ebf --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetItemShippingAddressCustomTypeChangeCollection.php @@ -0,0 +1,56 @@ + + * @method SetItemShippingAddressCustomTypeChange current() + * @method SetItemShippingAddressCustomTypeChange end() + * @method SetItemShippingAddressCustomTypeChange at($offset) + */ +class SetItemShippingAddressCustomTypeChangeCollection extends ChangeCollection +{ + /** + * @psalm-assert SetItemShippingAddressCustomTypeChange $value + * @psalm-param SetItemShippingAddressCustomTypeChange|stdClass $value + * @throws InvalidArgumentException + * + * @return SetItemShippingAddressCustomTypeChangeCollection + */ + public function add($value) + { + if (!$value instanceof SetItemShippingAddressCustomTypeChange) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?SetItemShippingAddressCustomTypeChange + */ + protected function mapper() + { + return function (?int $index): ?SetItemShippingAddressCustomTypeChange { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var SetItemShippingAddressCustomTypeChange $data */ + $data = SetItemShippingAddressCustomTypeChangeModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetItemShippingAddressCustomTypeChangeModel.php b/lib/commercetools-history/src/Models/Change/SetItemShippingAddressCustomTypeChangeModel.php new file mode 100644 index 00000000000..bf18d7d2efd --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetItemShippingAddressCustomTypeChangeModel.php @@ -0,0 +1,207 @@ +change = $change; + $this->addressId = $addressId; + $this->previousValue = $previousValue; + $this->nextValue = $nextValue; + $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; + } + + /** + * + * @return null|string + */ + public function getChange() + { + if (is_null($this->change)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CHANGE); + if (is_null($data)) { + return null; + } + $this->change = (string) $data; + } + + return $this->change; + } + + /** + *id of the updated Address.
Value before the change.
+ * + * + * @return null|CustomFields + */ + public function getPreviousValue() + { + if (is_null($this->previousValue)) { + /** @psalm-var stdClass|arrayValue after the change.
+ * + * + * @return null|CustomFields + */ + public function getNextValue() + { + if (is_null($this->nextValue)) { + /** @psalm-var stdClass|arrayElements added to the array.
+ * + + * @return null|array + */ + public function getAddedItems(); + + /** + *Elements removed from the array.
+ * + + * @return null|array + */ + public function getRemovedItems(); + /** * @param ?string $change */ @@ -59,4 +77,14 @@ public function setPreviousValue(?array $previousValue): void; * @param ?array $nextValue */ public function setNextValue(?array $nextValue): void; + + /** + * @param ?array $addedItems + */ + public function setAddedItems(?array $addedItems): void; + + /** + * @param ?array $removedItems + */ + public function setRemovedItems(?array $removedItems): void; } diff --git a/lib/commercetools-history/src/Models/Change/SetLanguagesChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetLanguagesChangeBuilder.php index 84392836147..ce570d34b14 100644 --- a/lib/commercetools-history/src/Models/Change/SetLanguagesChangeBuilder.php +++ b/lib/commercetools-history/src/Models/Change/SetLanguagesChangeBuilder.php @@ -38,6 +38,18 @@ final class SetLanguagesChangeBuilder implements Builder */ private $nextValue; + /** + + * @var ?array + */ + private $addedItems; + + /** + + * @var ?array + */ + private $removedItems; + /** * @return null|string @@ -69,6 +81,28 @@ public function getNextValue() return $this->nextValue; } + /** + *Elements added to the array.
+ * + + * @return null|array + */ + public function getAddedItems() + { + return $this->addedItems; + } + + /** + *Elements removed from the array.
+ * + + * @return null|array + */ + public function getRemovedItems() + { + return $this->removedItems; + } + /** * @param ?string $change * @return $this @@ -102,13 +136,37 @@ public function withNextValue(?array $nextValue) return $this; } + /** + * @param ?array $addedItems + * @return $this + */ + public function withAddedItems(?array $addedItems) + { + $this->addedItems = $addedItems; + + return $this; + } + + /** + * @param ?array $removedItems + * @return $this + */ + public function withRemovedItems(?array $removedItems) + { + $this->removedItems = $removedItems; + + return $this; + } + public function build(): SetLanguagesChange { return new SetLanguagesChangeModel( $this->change, $this->previousValue, - $this->nextValue + $this->nextValue, + $this->addedItems, + $this->removedItems ); } diff --git a/lib/commercetools-history/src/Models/Change/SetLanguagesChangeModel.php b/lib/commercetools-history/src/Models/Change/SetLanguagesChangeModel.php index c876cb317d8..61f993c5720 100644 --- a/lib/commercetools-history/src/Models/Change/SetLanguagesChangeModel.php +++ b/lib/commercetools-history/src/Models/Change/SetLanguagesChangeModel.php @@ -45,6 +45,18 @@ final class SetLanguagesChangeModel extends JsonObjectModel implements SetLangua */ protected $nextValue; + /** + * + * @var ?array + */ + protected $addedItems; + + /** + * + * @var ?array + */ + protected $removedItems; + /** * @psalm-suppress MissingParamType @@ -53,11 +65,15 @@ public function __construct( ?string $change = null, ?array $previousValue = null, ?array $nextValue = null, + ?array $addedItems = null, + ?array $removedItems = null, ?string $type = null ) { $this->change = $change; $this->previousValue = $previousValue; $this->nextValue = $nextValue; + $this->addedItems = $addedItems; + $this->removedItems = $removedItems; $this->type = $type ?? self::DISCRIMINATOR_VALUE; } @@ -137,6 +153,46 @@ public function getNextValue() return $this->nextValue; } + /** + *Elements added to the array.
+ * + * + * @return null|array + */ + public function getAddedItems() + { + if (is_null($this->addedItems)) { + /** @psalm-var ?listElements removed from the array.
+ * + * + * @return null|array + */ + public function getRemovedItems() + { + if (is_null($this->removedItems)) { + /** @psalm-var ?listsku or key of the updated ProductVariant.
Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
* * @return null|string */ public function getVariant(); + /** + *id of the updated LineItem.
sku or key of the updated ProductVariant.
Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
* * @return null|string @@ -107,6 +114,17 @@ public function getVariant() return $this->variant; } + /** + *id of the updated LineItem.
sku or key of the updated ProductVariant.
Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
* * * @return null|string @@ -200,6 +209,26 @@ public function getVariant() return $this->variant; } + /** + *id of the updated LineItem.
sku or key of the updated ProductVariant.
Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
* * @return null|string */ public function getVariant(); + /** + *id of the updated LineItem.
sku or key of the updated ProductVariant.
Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
* * @return null|string @@ -107,6 +114,17 @@ public function getVariant() return $this->variant; } + /** + *id of the updated LineItem.
sku or key of the updated ProductVariant.
Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
* * * @return null|string @@ -200,6 +209,26 @@ public function getVariant() return $this->variant; } + /** + *id of the updated LineItem.
sku or key of the updated ProductVariant.
Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
* * @return null|string diff --git a/lib/commercetools-history/src/Models/Change/SetLineItemDistributionChannelChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetLineItemDistributionChannelChangeBuilder.php index 980f454bd39..2d7233c1905 100644 --- a/lib/commercetools-history/src/Models/Change/SetLineItemDistributionChannelChangeBuilder.php +++ b/lib/commercetools-history/src/Models/Change/SetLineItemDistributionChannelChangeBuilder.php @@ -97,7 +97,8 @@ public function getLineItem() } /** - *sku or key of the updated ProductVariant.
Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
* * @return null|string diff --git a/lib/commercetools-history/src/Models/Change/SetLineItemDistributionChannelChangeModel.php b/lib/commercetools-history/src/Models/Change/SetLineItemDistributionChannelChangeModel.php index 812ecec2f80..020ee3b5410 100644 --- a/lib/commercetools-history/src/Models/Change/SetLineItemDistributionChannelChangeModel.php +++ b/lib/commercetools-history/src/Models/Change/SetLineItemDistributionChannelChangeModel.php @@ -131,8 +131,8 @@ public function getPreviousValue() if (is_null($data)) { return null; } - - $this->previousValue = ReferenceModel::of($data); + $className = ReferenceModel::resolveDiscriminatorClass($data); + $this->previousValue = $className::of($data); } return $this->previousValue; @@ -152,8 +152,8 @@ public function getNextValue() if (is_null($data)) { return null; } - - $this->nextValue = ReferenceModel::of($data); + $className = ReferenceModel::resolveDiscriminatorClass($data); + $this->nextValue = $className::of($data); } return $this->nextValue; @@ -181,7 +181,8 @@ public function getLineItem() } /** - *sku or key of the updated ProductVariant.
Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
* * * @return null|string diff --git a/lib/commercetools-history/src/Models/Change/SetLineItemPriceChange.php b/lib/commercetools-history/src/Models/Change/SetLineItemPriceChange.php index 691cdcc9fc8..c95e5ff249e 100644 --- a/lib/commercetools-history/src/Models/Change/SetLineItemPriceChange.php +++ b/lib/commercetools-history/src/Models/Change/SetLineItemPriceChange.php @@ -19,6 +19,7 @@ interface SetLineItemPriceChange extends Change public const FIELD_PREVIOUS_VALUE = 'previousValue'; public const FIELD_NEXT_VALUE = 'nextValue'; public const FIELD_LINE_ITEM = 'lineItem'; + public const FIELD_LINE_ITEM_ID = 'lineItemId'; /** @@ -56,6 +57,14 @@ public function getNextValue(); */ public function getLineItem(); + /** + *id of the updated LineItem.
id of the updated LineItem.
id of the updated LineItem.
sku or key of the updated ProductVariant.
Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
* * @return null|string diff --git a/lib/commercetools-history/src/Models/Change/SetLineItemProductKeyChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetLineItemProductKeyChangeBuilder.php index 56c13b8aafd..d64a5566bf3 100644 --- a/lib/commercetools-history/src/Models/Change/SetLineItemProductKeyChangeBuilder.php +++ b/lib/commercetools-history/src/Models/Change/SetLineItemProductKeyChangeBuilder.php @@ -112,7 +112,8 @@ public function getLineItemId() } /** - *sku or key of the updated ProductVariant.
Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
* * @return null|string diff --git a/lib/commercetools-history/src/Models/Change/SetLineItemProductKeyChangeModel.php b/lib/commercetools-history/src/Models/Change/SetLineItemProductKeyChangeModel.php index 39d42048fad..0e55f1ddd3d 100644 --- a/lib/commercetools-history/src/Models/Change/SetLineItemProductKeyChangeModel.php +++ b/lib/commercetools-history/src/Models/Change/SetLineItemProductKeyChangeModel.php @@ -205,7 +205,8 @@ public function getLineItemId() } /** - *sku or key of the updated ProductVariant.
Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
* * * @return null|string diff --git a/lib/commercetools-history/src/Models/Change/SetLineItemProductSlugChange.php b/lib/commercetools-history/src/Models/Change/SetLineItemProductSlugChange.php index 6b6a816403b..7144feed4b0 100644 --- a/lib/commercetools-history/src/Models/Change/SetLineItemProductSlugChange.php +++ b/lib/commercetools-history/src/Models/Change/SetLineItemProductSlugChange.php @@ -19,6 +19,7 @@ interface SetLineItemProductSlugChange extends Change public const FIELD_NEXT_VALUE = 'nextValue'; public const FIELD_LINE_ITEM = 'lineItem'; public const FIELD_VARIANT = 'variant'; + public const FIELD_LINE_ITEM_ID = 'lineItemId'; /** @@ -57,13 +58,22 @@ public function getNextValue(); public function getLineItem(); /** - *sku or key of the updated ProductVariant.
Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
* * @return null|string */ public function getVariant(); + /** + *id of the updated LineItem.
sku or key of the updated ProductVariant.
Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
* * @return null|string @@ -105,6 +112,17 @@ public function getVariant() return $this->variant; } + /** + *id of the updated LineItem.
sku or key of the updated ProductVariant.
Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
* * * @return null|string @@ -198,6 +207,26 @@ public function getVariant() return $this->variant; } + /** + *id of the updated LineItem.
Name of the Product the updated Line Item is based on.
+ * + + * @return null|LocalizedString + */ + public function getLineItem(); + + /** + *Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + + * @return null|string + */ + public function getVariant(); + /** * @param ?string $change */ @@ -74,4 +94,14 @@ public function setNextValue(?ItemShippingDetails $nextValue): void; * @param ?string $lineItemId */ public function setLineItemId(?string $lineItemId): void; + + /** + * @param ?LocalizedString $lineItem + */ + public function setLineItem(?LocalizedString $lineItem): void; + + /** + * @param ?string $variant + */ + public function setVariant(?string $variant): void; } diff --git a/lib/commercetools-history/src/Models/Change/SetLineItemShippingDetailsChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetLineItemShippingDetailsChangeBuilder.php index 7a413ee90b2..25645e62868 100644 --- a/lib/commercetools-history/src/Models/Change/SetLineItemShippingDetailsChangeBuilder.php +++ b/lib/commercetools-history/src/Models/Change/SetLineItemShippingDetailsChangeBuilder.php @@ -16,6 +16,8 @@ use stdClass; use Commercetools\History\Models\Common\ItemShippingDetails; use Commercetools\History\Models\Common\ItemShippingDetailsBuilder; +use Commercetools\History\Models\Common\LocalizedString; +use Commercetools\History\Models\Common\LocalizedStringBuilder; /** * @implements BuilderName of the Product the updated Line Item is based on.
+ * + + * @return null|LocalizedString + */ + public function getLineItem() + { + return $this->lineItem instanceof LocalizedStringBuilder ? $this->lineItem->build() : $this->lineItem; + } + + /** + *Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + + * @return null|string + */ + public function getVariant() + { + return $this->variant; + } + /** * @param ?string $change * @return $this @@ -132,6 +169,28 @@ public function withLineItemId(?string $lineItemId) return $this; } + /** + * @param ?LocalizedString $lineItem + * @return $this + */ + public function withLineItem(?LocalizedString $lineItem) + { + $this->lineItem = $lineItem; + + return $this; + } + + /** + * @param ?string $variant + * @return $this + */ + public function withVariant(?string $variant) + { + $this->variant = $variant; + + return $this; + } + /** * @deprecated use withPreviousValue() instead * @return $this @@ -154,13 +213,26 @@ public function withNextValueBuilder(?ItemShippingDetailsBuilder $nextValue) return $this; } + /** + * @deprecated use withLineItem() instead + * @return $this + */ + public function withLineItemBuilder(?LocalizedStringBuilder $lineItem) + { + $this->lineItem = $lineItem; + + return $this; + } + public function build(): SetLineItemShippingDetailsChange { return new SetLineItemShippingDetailsChangeModel( $this->change, $this->previousValue instanceof ItemShippingDetailsBuilder ? $this->previousValue->build() : $this->previousValue, $this->nextValue instanceof ItemShippingDetailsBuilder ? $this->nextValue->build() : $this->nextValue, - $this->lineItemId + $this->lineItemId, + $this->lineItem instanceof LocalizedStringBuilder ? $this->lineItem->build() : $this->lineItem, + $this->variant ); } diff --git a/lib/commercetools-history/src/Models/Change/SetLineItemShippingDetailsChangeModel.php b/lib/commercetools-history/src/Models/Change/SetLineItemShippingDetailsChangeModel.php index b0dbfc76399..5f616abc7bd 100644 --- a/lib/commercetools-history/src/Models/Change/SetLineItemShippingDetailsChangeModel.php +++ b/lib/commercetools-history/src/Models/Change/SetLineItemShippingDetailsChangeModel.php @@ -15,6 +15,8 @@ use stdClass; use Commercetools\History\Models\Common\ItemShippingDetails; use Commercetools\History\Models\Common\ItemShippingDetailsModel; +use Commercetools\History\Models\Common\LocalizedString; +use Commercetools\History\Models\Common\LocalizedStringModel; /** * @internal @@ -53,6 +55,18 @@ final class SetLineItemShippingDetailsChangeModel extends JsonObjectModel implem */ protected $lineItemId; + /** + * + * @var ?LocalizedString + */ + protected $lineItem; + + /** + * + * @var ?string + */ + protected $variant; + /** * @psalm-suppress MissingParamType @@ -62,12 +76,16 @@ public function __construct( ?ItemShippingDetails $previousValue = null, ?ItemShippingDetails $nextValue = null, ?string $lineItemId = null, + ?LocalizedString $lineItem = null, + ?string $variant = null, ?string $type = null ) { $this->change = $change; $this->previousValue = $previousValue; $this->nextValue = $nextValue; $this->lineItemId = $lineItemId; + $this->lineItem = $lineItem; + $this->variant = $variant; $this->type = $type ?? self::DISCRIMINATOR_VALUE; } @@ -169,6 +187,48 @@ public function getLineItemId() return $this->lineItemId; } + /** + *Name of the Product the updated Line Item is based on.
+ * + * + * @return null|LocalizedString + */ + public function getLineItem() + { + if (is_null($this->lineItem)) { + /** @psalm-var stdClass|arrayIdentifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + * + * @return null|string + */ + public function getVariant() + { + if (is_null($this->variant)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_VARIANT); + if (is_null($data)) { + return null; + } + $this->variant = (string) $data; + } + + return $this->variant; + } + /** * @param ?string $change @@ -202,6 +262,22 @@ public function setLineItemId(?string $lineItemId): void $this->lineItemId = $lineItemId; } + /** + * @param ?LocalizedString $lineItem + */ + public function setLineItem(?LocalizedString $lineItem): void + { + $this->lineItem = $lineItem; + } + + /** + * @param ?string $variant + */ + public function setVariant(?string $variant): void + { + $this->variant = $variant; + } + } diff --git a/lib/commercetools-history/src/Models/Change/SetLineItemTaxAmountChange.php b/lib/commercetools-history/src/Models/Change/SetLineItemTaxAmountChange.php index ba21048a68a..660251c8c17 100644 --- a/lib/commercetools-history/src/Models/Change/SetLineItemTaxAmountChange.php +++ b/lib/commercetools-history/src/Models/Change/SetLineItemTaxAmountChange.php @@ -21,6 +21,7 @@ interface SetLineItemTaxAmountChange extends Change public const FIELD_LINE_ITEM = 'lineItem'; public const FIELD_VARIANT = 'variant'; public const FIELD_TAX_MODE = 'taxMode'; + public const FIELD_LINE_ITEM_ID = 'lineItemId'; /** @@ -59,7 +60,8 @@ public function getNextValue(); public function getLineItem(); /** - *sku or key of the ProductVariant.
Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
* * @return null|string @@ -74,6 +76,14 @@ public function getVariant(); */ public function getTaxMode(); + /** + *id of the updated LineItem.
sku or key of the ProductVariant.
Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
* * @return null|string @@ -124,6 +131,17 @@ public function getTaxMode() return $this->taxMode; } + /** + *id of the updated LineItem.
sku or key of the ProductVariant.
Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
* * * @return null|string @@ -228,6 +237,26 @@ public function getTaxMode() return $this->taxMode; } + /** + *id of the updated LineItem.
sku or key of the ProductVariant.
Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
* * @return null|string @@ -74,6 +76,14 @@ public function getVariant(); */ public function getTaxMode(); + /** + *id of the updated LineItem.
sku or key of the ProductVariant.
Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
* * @return null|string @@ -124,6 +131,17 @@ public function getTaxMode() return $this->taxMode; } + /** + *id of the updated LineItem.
sku or key of the ProductVariant.
Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
* * * @return null|string @@ -228,6 +237,26 @@ public function getTaxMode() return $this->taxMode; } + /** + *id of the updated LineItem.
Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + + * @return null|string + */ + public function getVariant(); + /** * @param ?string $change */ @@ -89,4 +99,9 @@ public function setLineItem(?LocalizedString $lineItem): void; * @param ?string $lineItemId */ public function setLineItemId(?string $lineItemId): void; + + /** + * @param ?string $variant + */ + public function setVariant(?string $variant): void; } diff --git a/lib/commercetools-history/src/Models/Change/SetLineItemTaxedPriceChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetLineItemTaxedPriceChangeBuilder.php index f310d80cf2c..47b8581c15e 100644 --- a/lib/commercetools-history/src/Models/Change/SetLineItemTaxedPriceChangeBuilder.php +++ b/lib/commercetools-history/src/Models/Change/SetLineItemTaxedPriceChangeBuilder.php @@ -54,6 +54,12 @@ final class SetLineItemTaxedPriceChangeBuilder implements Builder */ private $lineItemId; + /** + + * @var ?string + */ + private $variant; + /** * @return null|string @@ -107,6 +113,18 @@ public function getLineItemId() return $this->lineItemId; } + /** + *Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + + * @return null|string + */ + public function getVariant() + { + return $this->variant; + } + /** * @param ?string $change * @return $this @@ -162,6 +180,17 @@ public function withLineItemId(?string $lineItemId) return $this; } + /** + * @param ?string $variant + * @return $this + */ + public function withVariant(?string $variant) + { + $this->variant = $variant; + + return $this; + } + /** * @deprecated use withPreviousValue() instead * @return $this @@ -202,7 +231,8 @@ public function build(): SetLineItemTaxedPriceChange $this->previousValue instanceof TaxedItemPriceBuilder ? $this->previousValue->build() : $this->previousValue, $this->nextValue instanceof TaxedItemPriceBuilder ? $this->nextValue->build() : $this->nextValue, $this->lineItem instanceof LocalizedStringBuilder ? $this->lineItem->build() : $this->lineItem, - $this->lineItemId + $this->lineItemId, + $this->variant ); } diff --git a/lib/commercetools-history/src/Models/Change/SetLineItemTaxedPriceChangeModel.php b/lib/commercetools-history/src/Models/Change/SetLineItemTaxedPriceChangeModel.php index 94b661cb512..541d09859f4 100644 --- a/lib/commercetools-history/src/Models/Change/SetLineItemTaxedPriceChangeModel.php +++ b/lib/commercetools-history/src/Models/Change/SetLineItemTaxedPriceChangeModel.php @@ -61,6 +61,12 @@ final class SetLineItemTaxedPriceChangeModel extends JsonObjectModel implements */ protected $lineItemId; + /** + * + * @var ?string + */ + protected $variant; + /** * @psalm-suppress MissingParamType @@ -71,6 +77,7 @@ public function __construct( ?TaxedItemPrice $nextValue = null, ?LocalizedString $lineItem = null, ?string $lineItemId = null, + ?string $variant = null, ?string $type = null ) { $this->change = $change; @@ -78,6 +85,7 @@ public function __construct( $this->nextValue = $nextValue; $this->lineItem = $lineItem; $this->lineItemId = $lineItemId; + $this->variant = $variant; $this->type = $type ?? self::DISCRIMINATOR_VALUE; } @@ -200,6 +208,27 @@ public function getLineItemId() return $this->lineItemId; } + /** + *Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + * + * @return null|string + */ + public function getVariant() + { + if (is_null($this->variant)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_VARIANT); + if (is_null($data)) { + return null; + } + $this->variant = (string) $data; + } + + return $this->variant; + } + /** * @param ?string $change @@ -241,6 +270,14 @@ public function setLineItemId(?string $lineItemId): void $this->lineItemId = $lineItemId; } + /** + * @param ?string $variant + */ + public function setVariant(?string $variant): void + { + $this->variant = $variant; + } + } diff --git a/lib/commercetools-history/src/Models/Change/SetLineItemTotalPriceChange.php b/lib/commercetools-history/src/Models/Change/SetLineItemTotalPriceChange.php index 12e55352969..8f8102f45c5 100644 --- a/lib/commercetools-history/src/Models/Change/SetLineItemTotalPriceChange.php +++ b/lib/commercetools-history/src/Models/Change/SetLineItemTotalPriceChange.php @@ -19,6 +19,8 @@ interface SetLineItemTotalPriceChange extends Change public const FIELD_PREVIOUS_VALUE = 'previousValue'; public const FIELD_NEXT_VALUE = 'nextValue'; public const FIELD_LINE_ITEM = 'lineItem'; + public const FIELD_LINE_ITEM_ID = 'lineItemId'; + public const FIELD_VARIANT = 'variant'; /** @@ -56,6 +58,23 @@ public function getNextValue(); */ public function getLineItem(); + /** + *id of the updated LineItem.
Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + + * @return null|string + */ + public function getVariant(); + /** * @param ?string $change */ @@ -75,4 +94,14 @@ public function setNextValue(?Money $nextValue): void; * @param ?LocalizedString $lineItem */ public function setLineItem(?LocalizedString $lineItem): void; + + /** + * @param ?string $lineItemId + */ + public function setLineItemId(?string $lineItemId): void; + + /** + * @param ?string $variant + */ + public function setVariant(?string $variant): void; } diff --git a/lib/commercetools-history/src/Models/Change/SetLineItemTotalPriceChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetLineItemTotalPriceChangeBuilder.php index 353d05d2eba..d57919c1a6a 100644 --- a/lib/commercetools-history/src/Models/Change/SetLineItemTotalPriceChangeBuilder.php +++ b/lib/commercetools-history/src/Models/Change/SetLineItemTotalPriceChangeBuilder.php @@ -48,6 +48,18 @@ final class SetLineItemTotalPriceChangeBuilder implements Builder */ private $lineItem; + /** + + * @var ?string + */ + private $lineItemId; + + /** + + * @var ?string + */ + private $variant; + /** * @return null|string @@ -90,6 +102,29 @@ public function getLineItem() return $this->lineItem instanceof LocalizedStringBuilder ? $this->lineItem->build() : $this->lineItem; } + /** + *id of the updated LineItem.
Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + + * @return null|string + */ + public function getVariant() + { + return $this->variant; + } + /** * @param ?string $change * @return $this @@ -134,6 +169,28 @@ public function withLineItem(?LocalizedString $lineItem) return $this; } + /** + * @param ?string $lineItemId + * @return $this + */ + public function withLineItemId(?string $lineItemId) + { + $this->lineItemId = $lineItemId; + + return $this; + } + + /** + * @param ?string $variant + * @return $this + */ + public function withVariant(?string $variant) + { + $this->variant = $variant; + + return $this; + } + /** * @deprecated use withPreviousValue() instead * @return $this @@ -173,7 +230,9 @@ public function build(): SetLineItemTotalPriceChange $this->change, $this->previousValue instanceof MoneyBuilder ? $this->previousValue->build() : $this->previousValue, $this->nextValue instanceof MoneyBuilder ? $this->nextValue->build() : $this->nextValue, - $this->lineItem instanceof LocalizedStringBuilder ? $this->lineItem->build() : $this->lineItem + $this->lineItem instanceof LocalizedStringBuilder ? $this->lineItem->build() : $this->lineItem, + $this->lineItemId, + $this->variant ); } diff --git a/lib/commercetools-history/src/Models/Change/SetLineItemTotalPriceChangeModel.php b/lib/commercetools-history/src/Models/Change/SetLineItemTotalPriceChangeModel.php index 9a71eda1e3a..c8fda6d1803 100644 --- a/lib/commercetools-history/src/Models/Change/SetLineItemTotalPriceChangeModel.php +++ b/lib/commercetools-history/src/Models/Change/SetLineItemTotalPriceChangeModel.php @@ -55,6 +55,18 @@ final class SetLineItemTotalPriceChangeModel extends JsonObjectModel implements */ protected $lineItem; + /** + * + * @var ?string + */ + protected $lineItemId; + + /** + * + * @var ?string + */ + protected $variant; + /** * @psalm-suppress MissingParamType @@ -64,12 +76,16 @@ public function __construct( ?Money $previousValue = null, ?Money $nextValue = null, ?LocalizedString $lineItem = null, + ?string $lineItemId = null, + ?string $variant = null, ?string $type = null ) { $this->change = $change; $this->previousValue = $previousValue; $this->nextValue = $nextValue; $this->lineItem = $lineItem; + $this->lineItemId = $lineItemId; + $this->variant = $variant; $this->type = $type ?? self::DISCRIMINATOR_VALUE; } @@ -172,6 +188,47 @@ public function getLineItem() return $this->lineItem; } + /** + *id of the updated LineItem.
Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + * + * @return null|string + */ + public function getVariant() + { + if (is_null($this->variant)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_VARIANT); + if (is_null($data)) { + return null; + } + $this->variant = (string) $data; + } + + return $this->variant; + } + /** * @param ?string $change @@ -205,6 +262,22 @@ public function setLineItem(?LocalizedString $lineItem): void $this->lineItem = $lineItem; } + /** + * @param ?string $lineItemId + */ + public function setLineItemId(?string $lineItemId): void + { + $this->lineItemId = $lineItemId; + } + + /** + * @param ?string $variant + */ + public function setVariant(?string $variant): void + { + $this->variant = $variant; + } + } diff --git a/lib/commercetools-history/src/Models/Change/SetMaxCartQuantityChange.php b/lib/commercetools-history/src/Models/Change/SetMaxCartQuantityChange.php new file mode 100644 index 00000000000..cd2ef23d36a --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetMaxCartQuantityChange.php @@ -0,0 +1,62 @@ +Value before the change. + * + + * @return null|int + */ + public function getPreviousValue(); + + /** + *Value after the change.
+ * + + * @return null|int + */ + public function getNextValue(); + + /** + * @param ?string $change + */ + public function setChange(?string $change): void; + + /** + * @param ?int $previousValue + */ + public function setPreviousValue(?int $previousValue): void; + + /** + * @param ?int $nextValue + */ + public function setNextValue(?int $nextValue): void; +} diff --git a/lib/commercetools-history/src/Models/Change/SetMaxCartQuantityChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetMaxCartQuantityChangeBuilder.php new file mode 100644 index 00000000000..880f96a82d9 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetMaxCartQuantityChangeBuilder.php @@ -0,0 +1,119 @@ + + */ +final class SetMaxCartQuantityChangeBuilder implements Builder +{ + /** + + * @var ?string + */ + private $change; + + /** + + * @var ?int + */ + private $previousValue; + + /** + + * @var ?int + */ + private $nextValue; + + /** + + * @return null|string + */ + public function getChange() + { + return $this->change; + } + + /** + *Value before the change.
+ * + + * @return null|int + */ + public function getPreviousValue() + { + return $this->previousValue; + } + + /** + *Value after the change.
+ * + + * @return null|int + */ + public function getNextValue() + { + return $this->nextValue; + } + + /** + * @param ?string $change + * @return $this + */ + public function withChange(?string $change) + { + $this->change = $change; + + return $this; + } + + /** + * @param ?int $previousValue + * @return $this + */ + public function withPreviousValue(?int $previousValue) + { + $this->previousValue = $previousValue; + + return $this; + } + + /** + * @param ?int $nextValue + * @return $this + */ + public function withNextValue(?int $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + + public function build(): SetMaxCartQuantityChange + { + return new SetMaxCartQuantityChangeModel( + $this->change, + $this->previousValue, + $this->nextValue + ); + } + + public static function of(): SetMaxCartQuantityChangeBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetMaxCartQuantityChangeCollection.php b/lib/commercetools-history/src/Models/Change/SetMaxCartQuantityChangeCollection.php new file mode 100644 index 00000000000..7f7bb43a31b --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetMaxCartQuantityChangeCollection.php @@ -0,0 +1,56 @@ + + * @method SetMaxCartQuantityChange current() + * @method SetMaxCartQuantityChange end() + * @method SetMaxCartQuantityChange at($offset) + */ +class SetMaxCartQuantityChangeCollection extends ChangeCollection +{ + /** + * @psalm-assert SetMaxCartQuantityChange $value + * @psalm-param SetMaxCartQuantityChange|stdClass $value + * @throws InvalidArgumentException + * + * @return SetMaxCartQuantityChangeCollection + */ + public function add($value) + { + if (!$value instanceof SetMaxCartQuantityChange) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?SetMaxCartQuantityChange + */ + protected function mapper() + { + return function (?int $index): ?SetMaxCartQuantityChange { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var SetMaxCartQuantityChange $data */ + $data = SetMaxCartQuantityChangeModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetMaxCartQuantityChangeModel.php b/lib/commercetools-history/src/Models/Change/SetMaxCartQuantityChangeModel.php new file mode 100644 index 00000000000..140881d908c --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetMaxCartQuantityChangeModel.php @@ -0,0 +1,167 @@ +change = $change; + $this->previousValue = $previousValue; + $this->nextValue = $nextValue; + $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; + } + + /** + * + * @return null|string + */ + public function getChange() + { + if (is_null($this->change)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CHANGE); + if (is_null($data)) { + return null; + } + $this->change = (string) $data; + } + + return $this->change; + } + + /** + *Value before the change.
+ * + * + * @return null|int + */ + public function getPreviousValue() + { + if (is_null($this->previousValue)) { + /** @psalm-var ?int $data */ + $data = $this->raw(self::FIELD_PREVIOUS_VALUE); + if (is_null($data)) { + return null; + } + $this->previousValue = (int) $data; + } + + return $this->previousValue; + } + + /** + *Value after the change.
+ * + * + * @return null|int + */ + public function getNextValue() + { + if (is_null($this->nextValue)) { + /** @psalm-var ?int $data */ + $data = $this->raw(self::FIELD_NEXT_VALUE); + if (is_null($data)) { + return null; + } + $this->nextValue = (int) $data; + } + + return $this->nextValue; + } + + + /** + * @param ?string $change + */ + public function setChange(?string $change): void + { + $this->change = $change; + } + + /** + * @param ?int $previousValue + */ + public function setPreviousValue(?int $previousValue): void + { + $this->previousValue = $previousValue; + } + + /** + * @param ?int $nextValue + */ + public function setNextValue(?int $nextValue): void + { + $this->nextValue = $nextValue; + } + + + +} diff --git a/lib/commercetools-history/src/Models/Change/SetMetaDescriptionChange.php b/lib/commercetools-history/src/Models/Change/SetMetaDescriptionChange.php index 5807eeef5f5..02d0fa8d04b 100644 --- a/lib/commercetools-history/src/Models/Change/SetMetaDescriptionChange.php +++ b/lib/commercetools-history/src/Models/Change/SetMetaDescriptionChange.php @@ -17,6 +17,7 @@ interface SetMetaDescriptionChange extends Change public const FIELD_PREVIOUS_VALUE = 'previousValue'; public const FIELD_NEXT_VALUE = 'nextValue'; + public const FIELD_CATALOG_DATA = 'catalogData'; /** @@ -46,6 +47,18 @@ public function getPreviousValue(); */ public function getNextValue(); + /** + *Product data that was updated.
+ *staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Product data that was updated.
+ *staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Product data that was updated.
+ *staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Product data that was updated.
+ *staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Product data that was updated.
+ *staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Product data that was updated.
+ *staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Product data that was updated.
+ *staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Product data that was updated.
+ *staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Product data that was updated.
+ *staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Value after the change.
+ * + + * @return null|int + */ + public function getNextValue(); + + /** + * @param ?string $change + */ + public function setChange(?string $change): void; + + /** + * @param ?int $previousValue + */ + public function setPreviousValue(?int $previousValue): void; + + /** + * @param ?int $nextValue + */ + public function setNextValue(?int $nextValue): void; +} diff --git a/lib/commercetools-history/src/Models/Change/SetMinCartQuantityChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetMinCartQuantityChangeBuilder.php new file mode 100644 index 00000000000..e2eb572161f --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetMinCartQuantityChangeBuilder.php @@ -0,0 +1,119 @@ + + */ +final class SetMinCartQuantityChangeBuilder implements Builder +{ + /** + + * @var ?string + */ + private $change; + + /** + + * @var ?int + */ + private $previousValue; + + /** + + * @var ?int + */ + private $nextValue; + + /** + + * @return null|string + */ + public function getChange() + { + return $this->change; + } + + /** + *Value before the change.
+ * + + * @return null|int + */ + public function getPreviousValue() + { + return $this->previousValue; + } + + /** + *Value after the change.
+ * + + * @return null|int + */ + public function getNextValue() + { + return $this->nextValue; + } + + /** + * @param ?string $change + * @return $this + */ + public function withChange(?string $change) + { + $this->change = $change; + + return $this; + } + + /** + * @param ?int $previousValue + * @return $this + */ + public function withPreviousValue(?int $previousValue) + { + $this->previousValue = $previousValue; + + return $this; + } + + /** + * @param ?int $nextValue + * @return $this + */ + public function withNextValue(?int $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + + public function build(): SetMinCartQuantityChange + { + return new SetMinCartQuantityChangeModel( + $this->change, + $this->previousValue, + $this->nextValue + ); + } + + public static function of(): SetMinCartQuantityChangeBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetMinCartQuantityChangeCollection.php b/lib/commercetools-history/src/Models/Change/SetMinCartQuantityChangeCollection.php new file mode 100644 index 00000000000..b283a44cc59 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetMinCartQuantityChangeCollection.php @@ -0,0 +1,56 @@ + + * @method SetMinCartQuantityChange current() + * @method SetMinCartQuantityChange end() + * @method SetMinCartQuantityChange at($offset) + */ +class SetMinCartQuantityChangeCollection extends ChangeCollection +{ + /** + * @psalm-assert SetMinCartQuantityChange $value + * @psalm-param SetMinCartQuantityChange|stdClass $value + * @throws InvalidArgumentException + * + * @return SetMinCartQuantityChangeCollection + */ + public function add($value) + { + if (!$value instanceof SetMinCartQuantityChange) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?SetMinCartQuantityChange + */ + protected function mapper() + { + return function (?int $index): ?SetMinCartQuantityChange { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var SetMinCartQuantityChange $data */ + $data = SetMinCartQuantityChangeModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetMinCartQuantityChangeModel.php b/lib/commercetools-history/src/Models/Change/SetMinCartQuantityChangeModel.php new file mode 100644 index 00000000000..adcbba89135 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetMinCartQuantityChangeModel.php @@ -0,0 +1,167 @@ +change = $change; + $this->previousValue = $previousValue; + $this->nextValue = $nextValue; + $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; + } + + /** + * + * @return null|string + */ + public function getChange() + { + if (is_null($this->change)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CHANGE); + if (is_null($data)) { + return null; + } + $this->change = (string) $data; + } + + return $this->change; + } + + /** + *Value before the change.
+ * + * + * @return null|int + */ + public function getPreviousValue() + { + if (is_null($this->previousValue)) { + /** @psalm-var ?int $data */ + $data = $this->raw(self::FIELD_PREVIOUS_VALUE); + if (is_null($data)) { + return null; + } + $this->previousValue = (int) $data; + } + + return $this->previousValue; + } + + /** + *Value after the change.
+ * + * + * @return null|int + */ + public function getNextValue() + { + if (is_null($this->nextValue)) { + /** @psalm-var ?int $data */ + $data = $this->raw(self::FIELD_NEXT_VALUE); + if (is_null($data)) { + return null; + } + $this->nextValue = (int) $data; + } + + return $this->nextValue; + } + + + /** + * @param ?string $change + */ + public function setChange(?string $change): void + { + $this->change = $change; + } + + /** + * @param ?int $previousValue + */ + public function setPreviousValue(?int $previousValue): void + { + $this->previousValue = $previousValue; + } + + /** + * @param ?int $nextValue + */ + public function setNextValue(?int $nextValue): void + { + $this->nextValue = $nextValue; + } + + + +} diff --git a/lib/commercetools-history/src/Models/Change/SetOrderLineItemCustomFieldChange.php b/lib/commercetools-history/src/Models/Change/SetOrderLineItemCustomFieldChange.php index 90c25938281..1b182ec4571 100644 --- a/lib/commercetools-history/src/Models/Change/SetOrderLineItemCustomFieldChange.php +++ b/lib/commercetools-history/src/Models/Change/SetOrderLineItemCustomFieldChange.php @@ -21,6 +21,7 @@ interface SetOrderLineItemCustomFieldChange extends Change public const FIELD_NAME = 'name'; public const FIELD_LINE_ITEM = 'lineItem'; public const FIELD_VARIANT = 'variant'; + public const FIELD_LINE_ITEM_ID = 'lineItemId'; /** @@ -75,13 +76,22 @@ public function getName(); public function getLineItem(); /** - *sku or key of the ProductVariant.
Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
* * @return null|string */ public function getVariant(); + /** + *id of the updated LineItem.
sku or key of the ProductVariant.
Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
* * @return null|string @@ -139,6 +146,17 @@ public function getVariant() return $this->variant; } + /** + *id of the updated LineItem.
sku or key of the ProductVariant.
Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
* * * @return null|string @@ -252,6 +261,26 @@ public function getVariant() return $this->variant; } + /** + *id of the updated LineItem.
sku or key of the ProductVariant.
Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
* * @return null|string */ public function getVariant(); + /** + *id of the updated LineItem.
sku or key of the ProductVariant.
Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
* * @return null|string @@ -107,6 +114,17 @@ public function getVariant() return $this->variant; } + /** + *id of the updated LineItem.
sku or key of the ProductVariant.
Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
* * * @return null|string @@ -200,6 +209,26 @@ public function getVariant() return $this->variant; } + /** + *id of the updated LineItem.
Value before the change.
* - * @return null|TaxedItemPrice + * @return null|TaxedPrice */ public function getPreviousValue(); @@ -43,11 +43,13 @@ public function getPreviousValue(); *Value after the change.
* - * @return null|TaxedItemPrice + * @return null|TaxedPrice */ public function getNextValue(); /** + *Indicates how taxes are set on the Cart.
+ * * @return null|string */ @@ -59,14 +61,14 @@ public function getTaxMode(); public function setChange(?string $change): void; /** - * @param ?TaxedItemPrice $previousValue + * @param ?TaxedPrice $previousValue */ - public function setPreviousValue(?TaxedItemPrice $previousValue): void; + public function setPreviousValue(?TaxedPrice $previousValue): void; /** - * @param ?TaxedItemPrice $nextValue + * @param ?TaxedPrice $nextValue */ - public function setNextValue(?TaxedItemPrice $nextValue): void; + public function setNextValue(?TaxedPrice $nextValue): void; /** * @param ?string $taxMode diff --git a/lib/commercetools-history/src/Models/Change/SetOrderTaxedPriceChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetOrderTaxedPriceChangeBuilder.php index f285df6289e..3f3c860ad13 100644 --- a/lib/commercetools-history/src/Models/Change/SetOrderTaxedPriceChangeBuilder.php +++ b/lib/commercetools-history/src/Models/Change/SetOrderTaxedPriceChangeBuilder.php @@ -14,8 +14,8 @@ use Commercetools\Base\JsonObjectModel; use Commercetools\Base\MapperFactory; use stdClass; -use Commercetools\History\Models\Common\TaxedItemPrice; -use Commercetools\History\Models\Common\TaxedItemPriceBuilder; +use Commercetools\History\Models\Common\TaxedPrice; +use Commercetools\History\Models\Common\TaxedPriceBuilder; /** * @implements BuilderValue before the change.
* - * @return null|TaxedItemPrice + * @return null|TaxedPrice */ public function getPreviousValue() { - return $this->previousValue instanceof TaxedItemPriceBuilder ? $this->previousValue->build() : $this->previousValue; + return $this->previousValue instanceof TaxedPriceBuilder ? $this->previousValue->build() : $this->previousValue; } /** *Value after the change.
* - * @return null|TaxedItemPrice + * @return null|TaxedPrice */ public function getNextValue() { - return $this->nextValue instanceof TaxedItemPriceBuilder ? $this->nextValue->build() : $this->nextValue; + return $this->nextValue instanceof TaxedPriceBuilder ? $this->nextValue->build() : $this->nextValue; } /** + *Indicates how taxes are set on the Cart.
+ * * @return null|string */ @@ -98,10 +100,10 @@ public function withChange(?string $change) } /** - * @param ?TaxedItemPrice $previousValue + * @param ?TaxedPrice $previousValue * @return $this */ - public function withPreviousValue(?TaxedItemPrice $previousValue) + public function withPreviousValue(?TaxedPrice $previousValue) { $this->previousValue = $previousValue; @@ -109,10 +111,10 @@ public function withPreviousValue(?TaxedItemPrice $previousValue) } /** - * @param ?TaxedItemPrice $nextValue + * @param ?TaxedPrice $nextValue * @return $this */ - public function withNextValue(?TaxedItemPrice $nextValue) + public function withNextValue(?TaxedPrice $nextValue) { $this->nextValue = $nextValue; @@ -134,7 +136,7 @@ public function withTaxMode(?string $taxMode) * @deprecated use withPreviousValue() instead * @return $this */ - public function withPreviousValueBuilder(?TaxedItemPriceBuilder $previousValue) + public function withPreviousValueBuilder(?TaxedPriceBuilder $previousValue) { $this->previousValue = $previousValue; @@ -145,7 +147,7 @@ public function withPreviousValueBuilder(?TaxedItemPriceBuilder $previousValue) * @deprecated use withNextValue() instead * @return $this */ - public function withNextValueBuilder(?TaxedItemPriceBuilder $nextValue) + public function withNextValueBuilder(?TaxedPriceBuilder $nextValue) { $this->nextValue = $nextValue; @@ -156,8 +158,8 @@ public function build(): SetOrderTaxedPriceChange { return new SetOrderTaxedPriceChangeModel( $this->change, - $this->previousValue instanceof TaxedItemPriceBuilder ? $this->previousValue->build() : $this->previousValue, - $this->nextValue instanceof TaxedItemPriceBuilder ? $this->nextValue->build() : $this->nextValue, + $this->previousValue instanceof TaxedPriceBuilder ? $this->previousValue->build() : $this->previousValue, + $this->nextValue instanceof TaxedPriceBuilder ? $this->nextValue->build() : $this->nextValue, $this->taxMode ); } diff --git a/lib/commercetools-history/src/Models/Change/SetOrderTaxedPriceChangeModel.php b/lib/commercetools-history/src/Models/Change/SetOrderTaxedPriceChangeModel.php index fa59cf46406..c08c83f0b05 100644 --- a/lib/commercetools-history/src/Models/Change/SetOrderTaxedPriceChangeModel.php +++ b/lib/commercetools-history/src/Models/Change/SetOrderTaxedPriceChangeModel.php @@ -13,8 +13,8 @@ use Commercetools\Base\JsonObjectModel; use Commercetools\Base\MapperFactory; use stdClass; -use Commercetools\History\Models\Common\TaxedItemPrice; -use Commercetools\History\Models\Common\TaxedItemPriceModel; +use Commercetools\History\Models\Common\TaxedPrice; +use Commercetools\History\Models\Common\TaxedPriceModel; /** * @internal @@ -37,13 +37,13 @@ final class SetOrderTaxedPriceChangeModel extends JsonObjectModel implements Set /** * - * @var ?TaxedItemPrice + * @var ?TaxedPrice */ protected $previousValue; /** * - * @var ?TaxedItemPrice + * @var ?TaxedPrice */ protected $nextValue; @@ -59,8 +59,8 @@ final class SetOrderTaxedPriceChangeModel extends JsonObjectModel implements Set */ public function __construct( ?string $change = null, - ?TaxedItemPrice $previousValue = null, - ?TaxedItemPrice $nextValue = null, + ?TaxedPrice $previousValue = null, + ?TaxedPrice $nextValue = null, ?string $taxMode = null, ?string $type = null ) { @@ -111,7 +111,7 @@ public function getChange() *Value before the change.
* * - * @return null|TaxedItemPrice + * @return null|TaxedPrice */ public function getPreviousValue() { @@ -122,7 +122,7 @@ public function getPreviousValue() return null; } - $this->previousValue = TaxedItemPriceModel::of($data); + $this->previousValue = TaxedPriceModel::of($data); } return $this->previousValue; @@ -132,7 +132,7 @@ public function getPreviousValue() *Value after the change.
* * - * @return null|TaxedItemPrice + * @return null|TaxedPrice */ public function getNextValue() { @@ -143,13 +143,15 @@ public function getNextValue() return null; } - $this->nextValue = TaxedItemPriceModel::of($data); + $this->nextValue = TaxedPriceModel::of($data); } return $this->nextValue; } /** + *Indicates how taxes are set on the Cart.
+ * * * @return null|string */ @@ -177,17 +179,17 @@ public function setChange(?string $change): void } /** - * @param ?TaxedItemPrice $previousValue + * @param ?TaxedPrice $previousValue */ - public function setPreviousValue(?TaxedItemPrice $previousValue): void + public function setPreviousValue(?TaxedPrice $previousValue): void { $this->previousValue = $previousValue; } /** - * @param ?TaxedItemPrice $nextValue + * @param ?TaxedPrice $nextValue */ - public function setNextValue(?TaxedItemPrice $nextValue): void + public function setNextValue(?TaxedPrice $nextValue): void { $this->nextValue = $nextValue; } diff --git a/lib/commercetools-history/src/Models/Change/SetParcelCustomFieldChange.php b/lib/commercetools-history/src/Models/Change/SetParcelCustomFieldChange.php new file mode 100644 index 00000000000..596766fb426 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetParcelCustomFieldChange.php @@ -0,0 +1,105 @@ +Information about the updated Parcel. + * + + * @return null|ParcelChangeValue + */ + public function getParcel(); + + /** + *id of the referenced Type.
Name of the Custom Field.
+ * + + * @return null|string + */ + public function getName(); + + /** + *Value before the change.
+ * + + * @return null|mixed + */ + public function getPreviousValue(); + + /** + *Value after the change.
+ * + + * @return null|mixed + */ + public function getNextValue(); + + /** + * @param ?string $change + */ + public function setChange(?string $change): void; + + /** + * @param ?ParcelChangeValue $parcel + */ + public function setParcel(?ParcelChangeValue $parcel): void; + + /** + * @param ?string $customTypeId + */ + public function setCustomTypeId(?string $customTypeId): void; + + /** + * @param ?string $name + */ + public function setName(?string $name): void; + + /** + * @param mixed $previousValue + */ + public function setPreviousValue( $previousValue): void; + + /** + * @param mixed $nextValue + */ + public function setNextValue( $nextValue): void; +} diff --git a/lib/commercetools-history/src/Models/Change/SetParcelCustomFieldChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetParcelCustomFieldChangeBuilder.php new file mode 100644 index 00000000000..5036f6c3dfa --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetParcelCustomFieldChangeBuilder.php @@ -0,0 +1,218 @@ + + */ +final class SetParcelCustomFieldChangeBuilder implements Builder +{ + /** + + * @var ?string + */ + private $change; + + /** + + * @var null|ParcelChangeValue|ParcelChangeValueBuilder + */ + private $parcel; + + /** + + * @var ?string + */ + private $customTypeId; + + /** + + * @var ?string + */ + private $name; + + /** + + * @var null|mixed|mixed + */ + private $previousValue; + + /** + + * @var null|mixed|mixed + */ + private $nextValue; + + /** + + * @return null|string + */ + public function getChange() + { + return $this->change; + } + + /** + *Information about the updated Parcel.
+ * + + * @return null|ParcelChangeValue + */ + public function getParcel() + { + return $this->parcel instanceof ParcelChangeValueBuilder ? $this->parcel->build() : $this->parcel; + } + + /** + *id of the referenced Type.
Name of the Custom Field.
+ * + + * @return null|string + */ + public function getName() + { + return $this->name; + } + + /** + *Value before the change.
+ * + + * @return null|mixed + */ + public function getPreviousValue() + { + return $this->previousValue; + } + + /** + *Value after the change.
+ * + + * @return null|mixed + */ + public function getNextValue() + { + return $this->nextValue; + } + + /** + * @param ?string $change + * @return $this + */ + public function withChange(?string $change) + { + $this->change = $change; + + return $this; + } + + /** + * @param ?ParcelChangeValue $parcel + * @return $this + */ + public function withParcel(?ParcelChangeValue $parcel) + { + $this->parcel = $parcel; + + return $this; + } + + /** + * @param ?string $customTypeId + * @return $this + */ + public function withCustomTypeId(?string $customTypeId) + { + $this->customTypeId = $customTypeId; + + return $this; + } + + /** + * @param ?string $name + * @return $this + */ + public function withName(?string $name) + { + $this->name = $name; + + return $this; + } + + /** + * @param mixed $previousValue + * @return $this + */ + public function withPreviousValue( $previousValue) + { + $this->previousValue = $previousValue; + + return $this; + } + + /** + * @param mixed $nextValue + * @return $this + */ + public function withNextValue( $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + /** + * @deprecated use withParcel() instead + * @return $this + */ + public function withParcelBuilder(?ParcelChangeValueBuilder $parcel) + { + $this->parcel = $parcel; + + return $this; + } + + public function build(): SetParcelCustomFieldChange + { + return new SetParcelCustomFieldChangeModel( + $this->change, + $this->parcel instanceof ParcelChangeValueBuilder ? $this->parcel->build() : $this->parcel, + $this->customTypeId, + $this->name, + $this->previousValue, + $this->nextValue + ); + } + + public static function of(): SetParcelCustomFieldChangeBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetParcelCustomFieldChangeCollection.php b/lib/commercetools-history/src/Models/Change/SetParcelCustomFieldChangeCollection.php new file mode 100644 index 00000000000..ef25d74371b --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetParcelCustomFieldChangeCollection.php @@ -0,0 +1,56 @@ + + * @method SetParcelCustomFieldChange current() + * @method SetParcelCustomFieldChange end() + * @method SetParcelCustomFieldChange at($offset) + */ +class SetParcelCustomFieldChangeCollection extends ChangeCollection +{ + /** + * @psalm-assert SetParcelCustomFieldChange $value + * @psalm-param SetParcelCustomFieldChange|stdClass $value + * @throws InvalidArgumentException + * + * @return SetParcelCustomFieldChangeCollection + */ + public function add($value) + { + if (!$value instanceof SetParcelCustomFieldChange) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?SetParcelCustomFieldChange + */ + protected function mapper() + { + return function (?int $index): ?SetParcelCustomFieldChange { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var SetParcelCustomFieldChange $data */ + $data = SetParcelCustomFieldChangeModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetParcelCustomFieldChangeModel.php b/lib/commercetools-history/src/Models/Change/SetParcelCustomFieldChangeModel.php new file mode 100644 index 00000000000..65684b4ce3a --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetParcelCustomFieldChangeModel.php @@ -0,0 +1,278 @@ +change = $change; + $this->parcel = $parcel; + $this->customTypeId = $customTypeId; + $this->name = $name; + $this->previousValue = $previousValue; + $this->nextValue = $nextValue; + $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; + } + + /** + * + * @return null|string + */ + public function getChange() + { + if (is_null($this->change)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CHANGE); + if (is_null($data)) { + return null; + } + $this->change = (string) $data; + } + + return $this->change; + } + + /** + *Information about the updated Parcel.
+ * + * + * @return null|ParcelChangeValue + */ + public function getParcel() + { + if (is_null($this->parcel)) { + /** @psalm-var stdClass|arrayid of the referenced Type.
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; + } + + /** + *Value before the change.
+ * + * + * @return null|mixed + */ + public function getPreviousValue() + { + if (is_null($this->previousValue)) { + /** @psalm-var mixed $data */ + $data = $this->raw(self::FIELD_PREVIOUS_VALUE); + if (is_null($data)) { + return null; + } + $this->previousValue = $data; + } + + return $this->previousValue; + } + + /** + *Value after the change.
+ * + * + * @return null|mixed + */ + public function getNextValue() + { + if (is_null($this->nextValue)) { + /** @psalm-var mixed $data */ + $data = $this->raw(self::FIELD_NEXT_VALUE); + if (is_null($data)) { + return null; + } + $this->nextValue = $data; + } + + return $this->nextValue; + } + + + /** + * @param ?string $change + */ + public function setChange(?string $change): void + { + $this->change = $change; + } + + /** + * @param ?ParcelChangeValue $parcel + */ + public function setParcel(?ParcelChangeValue $parcel): void + { + $this->parcel = $parcel; + } + + /** + * @param ?string $customTypeId + */ + public function setCustomTypeId(?string $customTypeId): void + { + $this->customTypeId = $customTypeId; + } + + /** + * @param ?string $name + */ + public function setName(?string $name): void + { + $this->name = $name; + } + + /** + * @param mixed $previousValue + */ + public function setPreviousValue( $previousValue): void + { + $this->previousValue = $previousValue; + } + + /** + * @param mixed $nextValue + */ + public function setNextValue( $nextValue): void + { + $this->nextValue = $nextValue; + } + + + +} diff --git a/lib/commercetools-history/src/Models/Change/SetParcelCustomTypeChange.php b/lib/commercetools-history/src/Models/Change/SetParcelCustomTypeChange.php new file mode 100644 index 00000000000..af1ae7ed8b9 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetParcelCustomTypeChange.php @@ -0,0 +1,78 @@ +Information about the updated Parcel. + * + + * @return null|ParcelChangeValue + */ + public function getParcel(); + + /** + *Value before the change.
+ * + + * @return null|CustomFields + */ + public function getPreviousValue(); + + /** + *Value after the change.
+ * + + * @return null|CustomFields + */ + public function getNextValue(); + + /** + * @param ?string $change + */ + public function setChange(?string $change): void; + + /** + * @param ?ParcelChangeValue $parcel + */ + public function setParcel(?ParcelChangeValue $parcel): void; + + /** + * @param ?CustomFields $previousValue + */ + public function setPreviousValue(?CustomFields $previousValue): void; + + /** + * @param ?CustomFields $nextValue + */ + public function setNextValue(?CustomFields $nextValue): void; +} diff --git a/lib/commercetools-history/src/Models/Change/SetParcelCustomTypeChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetParcelCustomTypeChangeBuilder.php new file mode 100644 index 00000000000..50651e582f4 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetParcelCustomTypeChangeBuilder.php @@ -0,0 +1,184 @@ + + */ +final class SetParcelCustomTypeChangeBuilder implements Builder +{ + /** + + * @var ?string + */ + private $change; + + /** + + * @var null|ParcelChangeValue|ParcelChangeValueBuilder + */ + private $parcel; + + /** + + * @var null|CustomFields|CustomFieldsBuilder + */ + private $previousValue; + + /** + + * @var null|CustomFields|CustomFieldsBuilder + */ + private $nextValue; + + /** + + * @return null|string + */ + public function getChange() + { + return $this->change; + } + + /** + *Information about the updated Parcel.
+ * + + * @return null|ParcelChangeValue + */ + public function getParcel() + { + return $this->parcel instanceof ParcelChangeValueBuilder ? $this->parcel->build() : $this->parcel; + } + + /** + *Value before the change.
+ * + + * @return null|CustomFields + */ + public function getPreviousValue() + { + return $this->previousValue instanceof CustomFieldsBuilder ? $this->previousValue->build() : $this->previousValue; + } + + /** + *Value after the change.
+ * + + * @return null|CustomFields + */ + public function getNextValue() + { + return $this->nextValue instanceof CustomFieldsBuilder ? $this->nextValue->build() : $this->nextValue; + } + + /** + * @param ?string $change + * @return $this + */ + public function withChange(?string $change) + { + $this->change = $change; + + return $this; + } + + /** + * @param ?ParcelChangeValue $parcel + * @return $this + */ + public function withParcel(?ParcelChangeValue $parcel) + { + $this->parcel = $parcel; + + return $this; + } + + /** + * @param ?CustomFields $previousValue + * @return $this + */ + public function withPreviousValue(?CustomFields $previousValue) + { + $this->previousValue = $previousValue; + + return $this; + } + + /** + * @param ?CustomFields $nextValue + * @return $this + */ + public function withNextValue(?CustomFields $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + /** + * @deprecated use withParcel() instead + * @return $this + */ + public function withParcelBuilder(?ParcelChangeValueBuilder $parcel) + { + $this->parcel = $parcel; + + return $this; + } + + /** + * @deprecated use withPreviousValue() instead + * @return $this + */ + public function withPreviousValueBuilder(?CustomFieldsBuilder $previousValue) + { + $this->previousValue = $previousValue; + + return $this; + } + + /** + * @deprecated use withNextValue() instead + * @return $this + */ + public function withNextValueBuilder(?CustomFieldsBuilder $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + public function build(): SetParcelCustomTypeChange + { + return new SetParcelCustomTypeChangeModel( + $this->change, + $this->parcel instanceof ParcelChangeValueBuilder ? $this->parcel->build() : $this->parcel, + $this->previousValue instanceof CustomFieldsBuilder ? $this->previousValue->build() : $this->previousValue, + $this->nextValue instanceof CustomFieldsBuilder ? $this->nextValue->build() : $this->nextValue + ); + } + + public static function of(): SetParcelCustomTypeChangeBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetParcelCustomTypeChangeCollection.php b/lib/commercetools-history/src/Models/Change/SetParcelCustomTypeChangeCollection.php new file mode 100644 index 00000000000..db61100eded --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetParcelCustomTypeChangeCollection.php @@ -0,0 +1,56 @@ + + * @method SetParcelCustomTypeChange current() + * @method SetParcelCustomTypeChange end() + * @method SetParcelCustomTypeChange at($offset) + */ +class SetParcelCustomTypeChangeCollection extends ChangeCollection +{ + /** + * @psalm-assert SetParcelCustomTypeChange $value + * @psalm-param SetParcelCustomTypeChange|stdClass $value + * @throws InvalidArgumentException + * + * @return SetParcelCustomTypeChangeCollection + */ + public function add($value) + { + if (!$value instanceof SetParcelCustomTypeChange) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?SetParcelCustomTypeChange + */ + protected function mapper() + { + return function (?int $index): ?SetParcelCustomTypeChange { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var SetParcelCustomTypeChange $data */ + $data = SetParcelCustomTypeChangeModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetParcelCustomTypeChangeModel.php b/lib/commercetools-history/src/Models/Change/SetParcelCustomTypeChangeModel.php new file mode 100644 index 00000000000..0b0074d6fe0 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetParcelCustomTypeChangeModel.php @@ -0,0 +1,210 @@ +change = $change; + $this->parcel = $parcel; + $this->previousValue = $previousValue; + $this->nextValue = $nextValue; + $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; + } + + /** + * + * @return null|string + */ + public function getChange() + { + if (is_null($this->change)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CHANGE); + if (is_null($data)) { + return null; + } + $this->change = (string) $data; + } + + return $this->change; + } + + /** + *Information about the updated Parcel.
+ * + * + * @return null|ParcelChangeValue + */ + public function getParcel() + { + if (is_null($this->parcel)) { + /** @psalm-var stdClass|arrayValue before the change.
+ * + * + * @return null|CustomFields + */ + public function getPreviousValue() + { + if (is_null($this->previousValue)) { + /** @psalm-var stdClass|arrayValue after the change.
+ * + * + * @return null|CustomFields + */ + public function getNextValue() + { + if (is_null($this->nextValue)) { + /** @psalm-var stdClass|arrayElements added to the array.
+ * + + * @return null|array + */ + public function getAddedItems(); + + /** + *Elements removed from the array.
+ * + + * @return null|array + */ + public function getRemovedItems(); + /** * @param ?string $change */ @@ -59,4 +77,14 @@ public function setPreviousValue(?array $previousValue): void; * @param ?array $nextValue */ public function setNextValue(?array $nextValue): void; + + /** + * @param ?array $addedItems + */ + public function setAddedItems(?array $addedItems): void; + + /** + * @param ?array $removedItems + */ + public function setRemovedItems(?array $removedItems): void; } diff --git a/lib/commercetools-history/src/Models/Change/SetPermissionsChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetPermissionsChangeBuilder.php index bbf98bcec9a..fe4c75f7bc1 100644 --- a/lib/commercetools-history/src/Models/Change/SetPermissionsChangeBuilder.php +++ b/lib/commercetools-history/src/Models/Change/SetPermissionsChangeBuilder.php @@ -38,6 +38,18 @@ final class SetPermissionsChangeBuilder implements Builder */ private $nextValue; + /** + + * @var ?array + */ + private $addedItems; + + /** + + * @var ?array + */ + private $removedItems; + /** * @return null|string @@ -69,6 +81,28 @@ public function getNextValue() return $this->nextValue; } + /** + *Elements added to the array.
+ * + + * @return null|array + */ + public function getAddedItems() + { + return $this->addedItems; + } + + /** + *Elements removed from the array.
+ * + + * @return null|array + */ + public function getRemovedItems() + { + return $this->removedItems; + } + /** * @param ?string $change * @return $this @@ -102,13 +136,37 @@ public function withNextValue(?array $nextValue) return $this; } + /** + * @param ?array $addedItems + * @return $this + */ + public function withAddedItems(?array $addedItems) + { + $this->addedItems = $addedItems; + + return $this; + } + + /** + * @param ?array $removedItems + * @return $this + */ + public function withRemovedItems(?array $removedItems) + { + $this->removedItems = $removedItems; + + return $this; + } + public function build(): SetPermissionsChange { return new SetPermissionsChangeModel( $this->change, $this->previousValue, - $this->nextValue + $this->nextValue, + $this->addedItems, + $this->removedItems ); } diff --git a/lib/commercetools-history/src/Models/Change/SetPermissionsChangeModel.php b/lib/commercetools-history/src/Models/Change/SetPermissionsChangeModel.php index 43d5a71f3c5..2c758b1dc49 100644 --- a/lib/commercetools-history/src/Models/Change/SetPermissionsChangeModel.php +++ b/lib/commercetools-history/src/Models/Change/SetPermissionsChangeModel.php @@ -45,6 +45,18 @@ final class SetPermissionsChangeModel extends JsonObjectModel implements SetPerm */ protected $nextValue; + /** + * + * @var ?array + */ + protected $addedItems; + + /** + * + * @var ?array + */ + protected $removedItems; + /** * @psalm-suppress MissingParamType @@ -53,11 +65,15 @@ public function __construct( ?string $change = null, ?array $previousValue = null, ?array $nextValue = null, + ?array $addedItems = null, + ?array $removedItems = null, ?string $type = null ) { $this->change = $change; $this->previousValue = $previousValue; $this->nextValue = $nextValue; + $this->addedItems = $addedItems; + $this->removedItems = $removedItems; $this->type = $type ?? self::DISCRIMINATOR_VALUE; } @@ -137,6 +153,46 @@ public function getNextValue() return $this->nextValue; } + /** + *Elements added to the array.
+ * + * + * @return null|array + */ + public function getAddedItems() + { + if (is_null($this->addedItems)) { + /** @psalm-var ?listElements removed from the array.
+ * + * + * @return null|array + */ + public function getRemovedItems() + { + if (is_null($this->removedItems)) { + /** @psalm-var ?liststaged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + + * @return null|string + */ + public function getVariant(); + + /** + *id of the Embedded Price.
Value before the change.
+ * + + * @return null|string + */ + public function getPreviousValue(); + + /** + *Value after the change.
+ * + + * @return null|string + */ + public function getNextValue(); + + /** + * @param ?string $change + */ + public function setChange(?string $change): void; + + /** + * @param ?string $catalogData + */ + public function setCatalogData(?string $catalogData): void; + + /** + * @param ?string $variant + */ + public function setVariant(?string $variant): void; + + /** + * @param ?string $priceId + */ + public function setPriceId(?string $priceId): void; + + /** + * @param ?string $previousValue + */ + public function setPreviousValue(?string $previousValue): void; + + /** + * @param ?string $nextValue + */ + public function setNextValue(?string $nextValue): void; +} diff --git a/lib/commercetools-history/src/Models/Change/SetPriceKeyChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetPriceKeyChangeBuilder.php new file mode 100644 index 00000000000..83a41d40001 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetPriceKeyChangeBuilder.php @@ -0,0 +1,211 @@ + + */ +final class SetPriceKeyChangeBuilder implements Builder +{ + /** + + * @var ?string + */ + private $change; + + /** + + * @var ?string + */ + private $catalogData; + + /** + + * @var ?string + */ + private $variant; + + /** + + * @var ?string + */ + private $priceId; + + /** + + * @var ?string + */ + private $previousValue; + + /** + + * @var ?string + */ + private $nextValue; + + /** + + * @return null|string + */ + public function getChange() + { + return $this->change; + } + + /** + *Product data that was updated.
+ *staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + + * @return null|string + */ + public function getVariant() + { + return $this->variant; + } + + /** + *id of the Embedded Price.
Value before the change.
+ * + + * @return null|string + */ + public function getPreviousValue() + { + return $this->previousValue; + } + + /** + *Value after the change.
+ * + + * @return null|string + */ + public function getNextValue() + { + return $this->nextValue; + } + + /** + * @param ?string $change + * @return $this + */ + public function withChange(?string $change) + { + $this->change = $change; + + return $this; + } + + /** + * @param ?string $catalogData + * @return $this + */ + public function withCatalogData(?string $catalogData) + { + $this->catalogData = $catalogData; + + return $this; + } + + /** + * @param ?string $variant + * @return $this + */ + public function withVariant(?string $variant) + { + $this->variant = $variant; + + return $this; + } + + /** + * @param ?string $priceId + * @return $this + */ + public function withPriceId(?string $priceId) + { + $this->priceId = $priceId; + + return $this; + } + + /** + * @param ?string $previousValue + * @return $this + */ + public function withPreviousValue(?string $previousValue) + { + $this->previousValue = $previousValue; + + return $this; + } + + /** + * @param ?string $nextValue + * @return $this + */ + public function withNextValue(?string $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + + public function build(): SetPriceKeyChange + { + return new SetPriceKeyChangeModel( + $this->change, + $this->catalogData, + $this->variant, + $this->priceId, + $this->previousValue, + $this->nextValue + ); + } + + public static function of(): SetPriceKeyChangeBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetPriceKeyChangeCollection.php b/lib/commercetools-history/src/Models/Change/SetPriceKeyChangeCollection.php new file mode 100644 index 00000000000..d28ff1e0d01 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetPriceKeyChangeCollection.php @@ -0,0 +1,56 @@ + + * @method SetPriceKeyChange current() + * @method SetPriceKeyChange end() + * @method SetPriceKeyChange at($offset) + */ +class SetPriceKeyChangeCollection extends ChangeCollection +{ + /** + * @psalm-assert SetPriceKeyChange $value + * @psalm-param SetPriceKeyChange|stdClass $value + * @throws InvalidArgumentException + * + * @return SetPriceKeyChangeCollection + */ + public function add($value) + { + if (!$value instanceof SetPriceKeyChange) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?SetPriceKeyChange + */ + protected function mapper() + { + return function (?int $index): ?SetPriceKeyChange { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var SetPriceKeyChange $data */ + $data = SetPriceKeyChangeModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetPriceKeyChangeModel.php b/lib/commercetools-history/src/Models/Change/SetPriceKeyChangeModel.php new file mode 100644 index 00000000000..4302603ac60 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetPriceKeyChangeModel.php @@ -0,0 +1,280 @@ +change = $change; + $this->catalogData = $catalogData; + $this->variant = $variant; + $this->priceId = $priceId; + $this->previousValue = $previousValue; + $this->nextValue = $nextValue; + $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; + } + + /** + * + * @return null|string + */ + public function getChange() + { + if (is_null($this->change)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CHANGE); + if (is_null($data)) { + return null; + } + $this->change = (string) $data; + } + + return $this->change; + } + + /** + *Product data that was updated.
+ *staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + * + * @return null|string + */ + public function getVariant() + { + if (is_null($this->variant)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_VARIANT); + if (is_null($data)) { + return null; + } + $this->variant = (string) $data; + } + + return $this->variant; + } + + /** + *id of the Embedded Price.
Value before the change.
+ * + * + * @return null|string + */ + public function getPreviousValue() + { + if (is_null($this->previousValue)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_PREVIOUS_VALUE); + if (is_null($data)) { + return null; + } + $this->previousValue = (string) $data; + } + + return $this->previousValue; + } + + /** + *Value after the change.
+ * + * + * @return null|string + */ + public function getNextValue() + { + if (is_null($this->nextValue)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_NEXT_VALUE); + if (is_null($data)) { + return null; + } + $this->nextValue = (string) $data; + } + + return $this->nextValue; + } + + + /** + * @param ?string $change + */ + public function setChange(?string $change): void + { + $this->change = $change; + } + + /** + * @param ?string $catalogData + */ + public function setCatalogData(?string $catalogData): void + { + $this->catalogData = $catalogData; + } + + /** + * @param ?string $variant + */ + public function setVariant(?string $variant): void + { + $this->variant = $variant; + } + + /** + * @param ?string $priceId + */ + public function setPriceId(?string $priceId): void + { + $this->priceId = $priceId; + } + + /** + * @param ?string $previousValue + */ + public function setPreviousValue(?string $previousValue): void + { + $this->previousValue = $previousValue; + } + + /** + * @param ?string $nextValue + */ + public function setNextValue(?string $nextValue): void + { + $this->nextValue = $nextValue; + } + + + +} diff --git a/lib/commercetools-history/src/Models/Change/SetPriceModeChange.php b/lib/commercetools-history/src/Models/Change/SetPriceModeChange.php new file mode 100644 index 00000000000..47e8b447d3f --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetPriceModeChange.php @@ -0,0 +1,62 @@ +Value before the change. + * + + * @return null|string + */ + public function getPreviousValue(); + + /** + *Value after the change.
+ * + + * @return null|string + */ + public function getNextValue(); + + /** + * @param ?string $change + */ + public function setChange(?string $change): void; + + /** + * @param ?string $previousValue + */ + public function setPreviousValue(?string $previousValue): void; + + /** + * @param ?string $nextValue + */ + public function setNextValue(?string $nextValue): void; +} diff --git a/lib/commercetools-history/src/Models/Change/SetPriceModeChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetPriceModeChangeBuilder.php new file mode 100644 index 00000000000..9891df42335 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetPriceModeChangeBuilder.php @@ -0,0 +1,119 @@ + + */ +final class SetPriceModeChangeBuilder implements Builder +{ + /** + + * @var ?string + */ + private $change; + + /** + + * @var ?string + */ + private $previousValue; + + /** + + * @var ?string + */ + private $nextValue; + + /** + + * @return null|string + */ + public function getChange() + { + return $this->change; + } + + /** + *Value before the change.
+ * + + * @return null|string + */ + public function getPreviousValue() + { + return $this->previousValue; + } + + /** + *Value after the change.
+ * + + * @return null|string + */ + public function getNextValue() + { + return $this->nextValue; + } + + /** + * @param ?string $change + * @return $this + */ + public function withChange(?string $change) + { + $this->change = $change; + + return $this; + } + + /** + * @param ?string $previousValue + * @return $this + */ + public function withPreviousValue(?string $previousValue) + { + $this->previousValue = $previousValue; + + return $this; + } + + /** + * @param ?string $nextValue + * @return $this + */ + public function withNextValue(?string $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + + public function build(): SetPriceModeChange + { + return new SetPriceModeChangeModel( + $this->change, + $this->previousValue, + $this->nextValue + ); + } + + public static function of(): SetPriceModeChangeBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetPriceModeChangeCollection.php b/lib/commercetools-history/src/Models/Change/SetPriceModeChangeCollection.php new file mode 100644 index 00000000000..6b83743d9ca --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetPriceModeChangeCollection.php @@ -0,0 +1,56 @@ + + * @method SetPriceModeChange current() + * @method SetPriceModeChange end() + * @method SetPriceModeChange at($offset) + */ +class SetPriceModeChangeCollection extends ChangeCollection +{ + /** + * @psalm-assert SetPriceModeChange $value + * @psalm-param SetPriceModeChange|stdClass $value + * @throws InvalidArgumentException + * + * @return SetPriceModeChangeCollection + */ + public function add($value) + { + if (!$value instanceof SetPriceModeChange) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?SetPriceModeChange + */ + protected function mapper() + { + return function (?int $index): ?SetPriceModeChange { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var SetPriceModeChange $data */ + $data = SetPriceModeChangeModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetPriceModeChangeModel.php b/lib/commercetools-history/src/Models/Change/SetPriceModeChangeModel.php new file mode 100644 index 00000000000..5df65d57ce7 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetPriceModeChangeModel.php @@ -0,0 +1,167 @@ +change = $change; + $this->previousValue = $previousValue; + $this->nextValue = $nextValue; + $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; + } + + /** + * + * @return null|string + */ + public function getChange() + { + if (is_null($this->change)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CHANGE); + if (is_null($data)) { + return null; + } + $this->change = (string) $data; + } + + return $this->change; + } + + /** + *Value before the change.
+ * + * + * @return null|string + */ + public function getPreviousValue() + { + if (is_null($this->previousValue)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_PREVIOUS_VALUE); + if (is_null($data)) { + return null; + } + $this->previousValue = (string) $data; + } + + return $this->previousValue; + } + + /** + *Value after the change.
+ * + * + * @return null|string + */ + public function getNextValue() + { + if (is_null($this->nextValue)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_NEXT_VALUE); + if (is_null($data)) { + return null; + } + $this->nextValue = (string) $data; + } + + return $this->nextValue; + } + + + /** + * @param ?string $change + */ + public function setChange(?string $change): void + { + $this->change = $change; + } + + /** + * @param ?string $previousValue + */ + public function setPreviousValue(?string $previousValue): void + { + $this->previousValue = $previousValue; + } + + /** + * @param ?string $nextValue + */ + public function setNextValue(?string $nextValue): void + { + $this->nextValue = $nextValue; + } + + + +} diff --git a/lib/commercetools-history/src/Models/Change/SetPricesChange.php b/lib/commercetools-history/src/Models/Change/SetPricesChange.php index 09baecbc842..609dc77a486 100644 --- a/lib/commercetools-history/src/Models/Change/SetPricesChange.php +++ b/lib/commercetools-history/src/Models/Change/SetPricesChange.php @@ -19,6 +19,8 @@ interface SetPricesChange extends Change public const FIELD_NEXT_VALUE = 'nextValue'; public const FIELD_CATALOG_DATA = 'catalogData'; public const FIELD_VARIANT = 'variant'; + public const FIELD_ADDED_ITEMS = 'addedItems'; + public const FIELD_REMOVED_ITEMS = 'removedItems'; /** @@ -49,6 +51,7 @@ public function getPreviousValue(); public function getNextValue(); /** + *Product data that was updated.
*staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.sku or key of the ProductVariant.
Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
* * @return null|string */ public function getVariant(); + /** + *Elements added to the array.
+ * + + * @return null|PriceCollection + */ + public function getAddedItems(); + + /** + *Elements removed from the array.
+ * + + * @return null|PriceCollection + */ + public function getRemovedItems(); + /** * @param ?string $change */ @@ -91,4 +111,14 @@ public function setCatalogData(?string $catalogData): void; * @param ?string $variant */ public function setVariant(?string $variant): void; + + /** + * @param ?PriceCollection $addedItems + */ + public function setAddedItems(?PriceCollection $addedItems): void; + + /** + * @param ?PriceCollection $removedItems + */ + public function setRemovedItems(?PriceCollection $removedItems): void; } diff --git a/lib/commercetools-history/src/Models/Change/SetPricesChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetPricesChangeBuilder.php index 702c6d5c9d0..f54d372e4b1 100644 --- a/lib/commercetools-history/src/Models/Change/SetPricesChangeBuilder.php +++ b/lib/commercetools-history/src/Models/Change/SetPricesChangeBuilder.php @@ -51,6 +51,18 @@ final class SetPricesChangeBuilder implements Builder */ private $variant; + /** + + * @var ?PriceCollection + */ + private $addedItems; + + /** + + * @var ?PriceCollection + */ + private $removedItems; + /** * @return null|string @@ -83,6 +95,7 @@ public function getNextValue() } /** + *Product data that was updated.
*staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.sku or key of the ProductVariant.
Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
* * @return null|string @@ -107,6 +121,28 @@ public function getVariant() return $this->variant; } + /** + *Elements added to the array.
+ * + + * @return null|PriceCollection + */ + public function getAddedItems() + { + return $this->addedItems; + } + + /** + *Elements removed from the array.
+ * + + * @return null|PriceCollection + */ + public function getRemovedItems() + { + return $this->removedItems; + } + /** * @param ?string $change * @return $this @@ -162,6 +198,28 @@ public function withVariant(?string $variant) return $this; } + /** + * @param ?PriceCollection $addedItems + * @return $this + */ + public function withAddedItems(?PriceCollection $addedItems) + { + $this->addedItems = $addedItems; + + return $this; + } + + /** + * @param ?PriceCollection $removedItems + * @return $this + */ + public function withRemovedItems(?PriceCollection $removedItems) + { + $this->removedItems = $removedItems; + + return $this; + } + public function build(): SetPricesChange { @@ -170,7 +228,9 @@ public function build(): SetPricesChange $this->previousValue, $this->nextValue, $this->catalogData, - $this->variant + $this->variant, + $this->addedItems, + $this->removedItems ); } diff --git a/lib/commercetools-history/src/Models/Change/SetPricesChangeModel.php b/lib/commercetools-history/src/Models/Change/SetPricesChangeModel.php index 7e04e08f4e2..175a3222452 100644 --- a/lib/commercetools-history/src/Models/Change/SetPricesChangeModel.php +++ b/lib/commercetools-history/src/Models/Change/SetPricesChangeModel.php @@ -58,6 +58,18 @@ final class SetPricesChangeModel extends JsonObjectModel implements SetPricesCha */ protected $variant; + /** + * + * @var ?PriceCollection + */ + protected $addedItems; + + /** + * + * @var ?PriceCollection + */ + protected $removedItems; + /** * @psalm-suppress MissingParamType @@ -68,6 +80,8 @@ public function __construct( ?PriceCollection $nextValue = null, ?string $catalogData = null, ?string $variant = null, + ?PriceCollection $addedItems = null, + ?PriceCollection $removedItems = null, ?string $type = null ) { $this->change = $change; @@ -75,6 +89,8 @@ public function __construct( $this->nextValue = $nextValue; $this->catalogData = $catalogData; $this->variant = $variant; + $this->addedItems = $addedItems; + $this->removedItems = $removedItems; $this->type = $type ?? self::DISCRIMINATOR_VALUE; } @@ -155,6 +171,7 @@ public function getNextValue() } /** + *Product data that was updated.
*staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.sku or key of the ProductVariant.
Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
* * * @return null|string @@ -197,6 +215,46 @@ public function getVariant() return $this->variant; } + /** + *Elements added to the array.
+ * + * + * @return null|PriceCollection + */ + public function getAddedItems() + { + if (is_null($this->addedItems)) { + /** @psalm-var ?listElements removed from the array.
+ * + * + * @return null|PriceCollection + */ + public function getRemovedItems() + { + if (is_null($this->removedItems)) { + /** @psalm-var ?liststaged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Value before the change.
+ * + + * @return null|Attribute + */ + public function getPreviousValue(); + + /** + *Value after the change.
+ * + + * @return null|Attribute + */ + public function getNextValue(); + + /** + * @param ?string $change + */ + public function setChange(?string $change): void; + + /** + * @param ?string $catalogData + */ + public function setCatalogData(?string $catalogData): void; + + /** + * @param ?Attribute $previousValue + */ + public function setPreviousValue(?Attribute $previousValue): void; + + /** + * @param ?Attribute $nextValue + */ + public function setNextValue(?Attribute $nextValue): void; +} diff --git a/lib/commercetools-history/src/Models/Change/SetProductAttributeChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetProductAttributeChangeBuilder.php new file mode 100644 index 00000000000..ea25f664a87 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetProductAttributeChangeBuilder.php @@ -0,0 +1,175 @@ + + */ +final class SetProductAttributeChangeBuilder implements Builder +{ + /** + + * @var ?string + */ + private $change; + + /** + + * @var ?string + */ + private $catalogData; + + /** + + * @var null|Attribute|AttributeBuilder + */ + private $previousValue; + + /** + + * @var null|Attribute|AttributeBuilder + */ + private $nextValue; + + /** + + * @return null|string + */ + public function getChange() + { + return $this->change; + } + + /** + *Product data that was updated.
+ *staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Value before the change.
+ * + + * @return null|Attribute + */ + public function getPreviousValue() + { + return $this->previousValue instanceof AttributeBuilder ? $this->previousValue->build() : $this->previousValue; + } + + /** + *Value after the change.
+ * + + * @return null|Attribute + */ + public function getNextValue() + { + return $this->nextValue instanceof AttributeBuilder ? $this->nextValue->build() : $this->nextValue; + } + + /** + * @param ?string $change + * @return $this + */ + public function withChange(?string $change) + { + $this->change = $change; + + return $this; + } + + /** + * @param ?string $catalogData + * @return $this + */ + public function withCatalogData(?string $catalogData) + { + $this->catalogData = $catalogData; + + return $this; + } + + /** + * @param ?Attribute $previousValue + * @return $this + */ + public function withPreviousValue(?Attribute $previousValue) + { + $this->previousValue = $previousValue; + + return $this; + } + + /** + * @param ?Attribute $nextValue + * @return $this + */ + public function withNextValue(?Attribute $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + /** + * @deprecated use withPreviousValue() instead + * @return $this + */ + public function withPreviousValueBuilder(?AttributeBuilder $previousValue) + { + $this->previousValue = $previousValue; + + return $this; + } + + /** + * @deprecated use withNextValue() instead + * @return $this + */ + public function withNextValueBuilder(?AttributeBuilder $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + public function build(): SetProductAttributeChange + { + return new SetProductAttributeChangeModel( + $this->change, + $this->catalogData, + $this->previousValue instanceof AttributeBuilder ? $this->previousValue->build() : $this->previousValue, + $this->nextValue instanceof AttributeBuilder ? $this->nextValue->build() : $this->nextValue + ); + } + + public static function of(): SetProductAttributeChangeBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetProductAttributeChangeCollection.php b/lib/commercetools-history/src/Models/Change/SetProductAttributeChangeCollection.php new file mode 100644 index 00000000000..7e74a0257fc --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetProductAttributeChangeCollection.php @@ -0,0 +1,56 @@ + + * @method SetProductAttributeChange current() + * @method SetProductAttributeChange end() + * @method SetProductAttributeChange at($offset) + */ +class SetProductAttributeChangeCollection extends ChangeCollection +{ + /** + * @psalm-assert SetProductAttributeChange $value + * @psalm-param SetProductAttributeChange|stdClass $value + * @throws InvalidArgumentException + * + * @return SetProductAttributeChangeCollection + */ + public function add($value) + { + if (!$value instanceof SetProductAttributeChange) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?SetProductAttributeChange + */ + protected function mapper() + { + return function (?int $index): ?SetProductAttributeChange { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var SetProductAttributeChange $data */ + $data = SetProductAttributeChangeModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetProductAttributeChangeModel.php b/lib/commercetools-history/src/Models/Change/SetProductAttributeChangeModel.php new file mode 100644 index 00000000000..06d41bc6095 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetProductAttributeChangeModel.php @@ -0,0 +1,211 @@ +change = $change; + $this->catalogData = $catalogData; + $this->previousValue = $previousValue; + $this->nextValue = $nextValue; + $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; + } + + /** + * + * @return null|string + */ + public function getChange() + { + if (is_null($this->change)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CHANGE); + if (is_null($data)) { + return null; + } + $this->change = (string) $data; + } + + return $this->change; + } + + /** + *Product data that was updated.
+ *staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Value before the change.
+ * + * + * @return null|Attribute + */ + public function getPreviousValue() + { + if (is_null($this->previousValue)) { + /** @psalm-var stdClass|arrayValue after the change.
+ * + * + * @return null|Attribute + */ + public function getNextValue() + { + if (is_null($this->nextValue)) { + /** @psalm-var stdClass|arrayProduct data that was updated.
*staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + + * @return null|string + */ + public function getVariant(); + + /** + *id of the Embedded Price.
id of the referenced Type.
Name of the Custom Field.
+ * + + * @return null|string + */ + public function getName(); + /** * @param ?string $change */ @@ -77,4 +115,24 @@ public function setNextValue(?CustomFields $nextValue): void; * @param ?string $catalogData */ public function setCatalogData(?string $catalogData): void; + + /** + * @param ?string $variant + */ + public function setVariant(?string $variant): void; + + /** + * @param ?string $priceId + */ + public function setPriceId(?string $priceId): void; + + /** + * @param ?string $customTypeId + */ + public function setCustomTypeId(?string $customTypeId): void; + + /** + * @param ?string $name + */ + public function setName(?string $name): void; } diff --git a/lib/commercetools-history/src/Models/Change/SetProductPriceCustomFieldChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetProductPriceCustomFieldChangeBuilder.php index 07691b8970a..5d02bbac7ff 100644 --- a/lib/commercetools-history/src/Models/Change/SetProductPriceCustomFieldChangeBuilder.php +++ b/lib/commercetools-history/src/Models/Change/SetProductPriceCustomFieldChangeBuilder.php @@ -46,6 +46,30 @@ final class SetProductPriceCustomFieldChangeBuilder implements Builder */ private $catalogData; + /** + + * @var ?string + */ + private $variant; + + /** + + * @var ?string + */ + private $priceId; + + /** + + * @var ?string + */ + private $customTypeId; + + /** + + * @var ?string + */ + private $name; + /** * @return null|string @@ -78,6 +102,7 @@ public function getNextValue() } /** + *Product data that was updated.
*staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + + * @return null|string + */ + public function getVariant() + { + return $this->variant; + } + + /** + *id of the Embedded Price.
id of the referenced Type.
Name of the Custom Field.
+ * + + * @return null|string + */ + public function getName() + { + return $this->name; + } + /** * @param ?string $change * @return $this @@ -135,6 +205,50 @@ public function withCatalogData(?string $catalogData) return $this; } + /** + * @param ?string $variant + * @return $this + */ + public function withVariant(?string $variant) + { + $this->variant = $variant; + + return $this; + } + + /** + * @param ?string $priceId + * @return $this + */ + public function withPriceId(?string $priceId) + { + $this->priceId = $priceId; + + return $this; + } + + /** + * @param ?string $customTypeId + * @return $this + */ + public function withCustomTypeId(?string $customTypeId) + { + $this->customTypeId = $customTypeId; + + return $this; + } + + /** + * @param ?string $name + * @return $this + */ + public function withName(?string $name) + { + $this->name = $name; + + return $this; + } + /** * @deprecated use withPreviousValue() instead * @return $this @@ -163,7 +277,11 @@ public function build(): SetProductPriceCustomFieldChange $this->change, $this->previousValue instanceof CustomFieldsBuilder ? $this->previousValue->build() : $this->previousValue, $this->nextValue instanceof CustomFieldsBuilder ? $this->nextValue->build() : $this->nextValue, - $this->catalogData + $this->catalogData, + $this->variant, + $this->priceId, + $this->customTypeId, + $this->name ); } diff --git a/lib/commercetools-history/src/Models/Change/SetProductPriceCustomFieldChangeModel.php b/lib/commercetools-history/src/Models/Change/SetProductPriceCustomFieldChangeModel.php index a3bdbe67431..1c36883dc99 100644 --- a/lib/commercetools-history/src/Models/Change/SetProductPriceCustomFieldChangeModel.php +++ b/lib/commercetools-history/src/Models/Change/SetProductPriceCustomFieldChangeModel.php @@ -53,6 +53,30 @@ final class SetProductPriceCustomFieldChangeModel extends JsonObjectModel implem */ protected $catalogData; + /** + * + * @var ?string + */ + protected $variant; + + /** + * + * @var ?string + */ + protected $priceId; + + /** + * + * @var ?string + */ + protected $customTypeId; + + /** + * + * @var ?string + */ + protected $name; + /** * @psalm-suppress MissingParamType @@ -62,12 +86,20 @@ public function __construct( ?CustomFields $previousValue = null, ?CustomFields $nextValue = null, ?string $catalogData = null, + ?string $variant = null, + ?string $priceId = null, + ?string $customTypeId = null, + ?string $name = null, ?string $type = null ) { $this->change = $change; $this->previousValue = $previousValue; $this->nextValue = $nextValue; $this->catalogData = $catalogData; + $this->variant = $variant; + $this->priceId = $priceId; + $this->customTypeId = $customTypeId; + $this->name = $name; $this->type = $type ?? self::DISCRIMINATOR_VALUE; } @@ -150,6 +182,7 @@ public function getNextValue() } /** + *Product data that was updated.
*staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + * + * @return null|string + */ + public function getVariant() + { + if (is_null($this->variant)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_VARIANT); + if (is_null($data)) { + return null; + } + $this->variant = (string) $data; + } + + return $this->variant; + } + + /** + *id of the Embedded Price.
id of the referenced Type.
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; + } + /** * @param ?string $change @@ -205,6 +319,38 @@ public function setCatalogData(?string $catalogData): void $this->catalogData = $catalogData; } + /** + * @param ?string $variant + */ + public function setVariant(?string $variant): void + { + $this->variant = $variant; + } + + /** + * @param ?string $priceId + */ + public function setPriceId(?string $priceId): void + { + $this->priceId = $priceId; + } + + /** + * @param ?string $customTypeId + */ + public function setCustomTypeId(?string $customTypeId): void + { + $this->customTypeId = $customTypeId; + } + + /** + * @param ?string $name + */ + public function setName(?string $name): void + { + $this->name = $name; + } + } diff --git a/lib/commercetools-history/src/Models/Change/SetProductPriceCustomTypeChange.php b/lib/commercetools-history/src/Models/Change/SetProductPriceCustomTypeChange.php index 79b30d17ee3..c6e514c254f 100644 --- a/lib/commercetools-history/src/Models/Change/SetProductPriceCustomTypeChange.php +++ b/lib/commercetools-history/src/Models/Change/SetProductPriceCustomTypeChange.php @@ -18,6 +18,8 @@ interface SetProductPriceCustomTypeChange extends Change public const FIELD_PREVIOUS_VALUE = 'previousValue'; public const FIELD_NEXT_VALUE = 'nextValue'; public const FIELD_CATALOG_DATA = 'catalogData'; + public const FIELD_VARIANT = 'variant'; + public const FIELD_PRICE_ID = 'priceId'; /** @@ -48,6 +50,7 @@ public function getPreviousValue(); public function getNextValue(); /** + *Product data that was updated.
*staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + + * @return null|string + */ + public function getVariant(); + + /** + *id of the Embedded Price.
Product data that was updated.
*staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + + * @return null|string + */ + public function getVariant() + { + return $this->variant; + } + + /** + *id of the Embedded Price.
Product data that was updated.
*staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + * + * @return null|string + */ + public function getVariant() + { + if (is_null($this->variant)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_VARIANT); + if (is_null($data)) { + return null; + } + $this->variant = (string) $data; + } + + return $this->variant; + } + + /** + *id of the Embedded Price.
Elements added to the array.
+ * + + * @return null|ProductSelectionSettingCollection + */ + public function getAddedItems(); + + /** + *Elements removed from the array.
+ * + + * @return null|ProductSelectionSettingCollection + */ + public function getRemovedItems(); + /** * @param ?string $change */ @@ -60,4 +78,14 @@ public function setPreviousValue(?ProductSelectionSettingCollection $previousVal * @param ?ProductSelectionSettingCollection $nextValue */ public function setNextValue(?ProductSelectionSettingCollection $nextValue): void; + + /** + * @param ?ProductSelectionSettingCollection $addedItems + */ + public function setAddedItems(?ProductSelectionSettingCollection $addedItems): void; + + /** + * @param ?ProductSelectionSettingCollection $removedItems + */ + public function setRemovedItems(?ProductSelectionSettingCollection $removedItems): void; } diff --git a/lib/commercetools-history/src/Models/Change/SetProductSelectionsChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetProductSelectionsChangeBuilder.php index f1a47b87229..71de497a54a 100644 --- a/lib/commercetools-history/src/Models/Change/SetProductSelectionsChangeBuilder.php +++ b/lib/commercetools-history/src/Models/Change/SetProductSelectionsChangeBuilder.php @@ -39,6 +39,18 @@ final class SetProductSelectionsChangeBuilder implements Builder */ private $nextValue; + /** + + * @var ?ProductSelectionSettingCollection + */ + private $addedItems; + + /** + + * @var ?ProductSelectionSettingCollection + */ + private $removedItems; + /** * @return null|string @@ -70,6 +82,28 @@ public function getNextValue() return $this->nextValue; } + /** + *Elements added to the array.
+ * + + * @return null|ProductSelectionSettingCollection + */ + public function getAddedItems() + { + return $this->addedItems; + } + + /** + *Elements removed from the array.
+ * + + * @return null|ProductSelectionSettingCollection + */ + public function getRemovedItems() + { + return $this->removedItems; + } + /** * @param ?string $change * @return $this @@ -103,13 +137,37 @@ public function withNextValue(?ProductSelectionSettingCollection $nextValue) return $this; } + /** + * @param ?ProductSelectionSettingCollection $addedItems + * @return $this + */ + public function withAddedItems(?ProductSelectionSettingCollection $addedItems) + { + $this->addedItems = $addedItems; + + return $this; + } + + /** + * @param ?ProductSelectionSettingCollection $removedItems + * @return $this + */ + public function withRemovedItems(?ProductSelectionSettingCollection $removedItems) + { + $this->removedItems = $removedItems; + + return $this; + } + public function build(): SetProductSelectionsChange { return new SetProductSelectionsChangeModel( $this->change, $this->previousValue, - $this->nextValue + $this->nextValue, + $this->addedItems, + $this->removedItems ); } diff --git a/lib/commercetools-history/src/Models/Change/SetProductSelectionsChangeModel.php b/lib/commercetools-history/src/Models/Change/SetProductSelectionsChangeModel.php index aabae360aef..1215df25c92 100644 --- a/lib/commercetools-history/src/Models/Change/SetProductSelectionsChangeModel.php +++ b/lib/commercetools-history/src/Models/Change/SetProductSelectionsChangeModel.php @@ -46,6 +46,18 @@ final class SetProductSelectionsChangeModel extends JsonObjectModel implements S */ protected $nextValue; + /** + * + * @var ?ProductSelectionSettingCollection + */ + protected $addedItems; + + /** + * + * @var ?ProductSelectionSettingCollection + */ + protected $removedItems; + /** * @psalm-suppress MissingParamType @@ -54,11 +66,15 @@ public function __construct( ?string $change = null, ?ProductSelectionSettingCollection $previousValue = null, ?ProductSelectionSettingCollection $nextValue = null, + ?ProductSelectionSettingCollection $addedItems = null, + ?ProductSelectionSettingCollection $removedItems = null, ?string $type = null ) { $this->change = $change; $this->previousValue = $previousValue; $this->nextValue = $nextValue; + $this->addedItems = $addedItems; + $this->removedItems = $removedItems; $this->type = $type ?? self::DISCRIMINATOR_VALUE; } @@ -138,6 +154,46 @@ public function getNextValue() return $this->nextValue; } + /** + *Elements added to the array.
+ * + * + * @return null|ProductSelectionSettingCollection + */ + public function getAddedItems() + { + if (is_null($this->addedItems)) { + /** @psalm-var ?listElements removed from the array.
+ * + * + * @return null|ProductSelectionSettingCollection + */ + public function getRemovedItems() + { + if (is_null($this->removedItems)) { + /** @psalm-var ?listProduct data that was updated.
*staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + + * @return null|string + */ + public function getVariant(); + /** * @param ?string $change */ @@ -76,4 +87,9 @@ public function setNextValue(?string $nextValue): void; * @param ?string $catalogData */ public function setCatalogData(?string $catalogData): void; + + /** + * @param ?string $variant + */ + public function setVariant(?string $variant): void; } diff --git a/lib/commercetools-history/src/Models/Change/SetProductVariantKeyChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetProductVariantKeyChangeBuilder.php index 798d32abd35..ef5ff33f9a6 100644 --- a/lib/commercetools-history/src/Models/Change/SetProductVariantKeyChangeBuilder.php +++ b/lib/commercetools-history/src/Models/Change/SetProductVariantKeyChangeBuilder.php @@ -44,6 +44,12 @@ final class SetProductVariantKeyChangeBuilder implements Builder */ private $catalogData; + /** + + * @var ?string + */ + private $variant; + /** * @return null|string @@ -76,6 +82,7 @@ public function getNextValue() } /** + *Product data that was updated.
*staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + + * @return null|string + */ + public function getVariant() + { + return $this->variant; + } + /** * @param ?string $change * @return $this @@ -133,6 +152,17 @@ public function withCatalogData(?string $catalogData) return $this; } + /** + * @param ?string $variant + * @return $this + */ + public function withVariant(?string $variant) + { + $this->variant = $variant; + + return $this; + } + public function build(): SetProductVariantKeyChange { @@ -140,7 +170,8 @@ public function build(): SetProductVariantKeyChange $this->change, $this->previousValue, $this->nextValue, - $this->catalogData + $this->catalogData, + $this->variant ); } diff --git a/lib/commercetools-history/src/Models/Change/SetProductVariantKeyChangeModel.php b/lib/commercetools-history/src/Models/Change/SetProductVariantKeyChangeModel.php index e8fab476fb4..517279630ae 100644 --- a/lib/commercetools-history/src/Models/Change/SetProductVariantKeyChangeModel.php +++ b/lib/commercetools-history/src/Models/Change/SetProductVariantKeyChangeModel.php @@ -51,6 +51,12 @@ final class SetProductVariantKeyChangeModel extends JsonObjectModel implements S */ protected $catalogData; + /** + * + * @var ?string + */ + protected $variant; + /** * @psalm-suppress MissingParamType @@ -60,12 +66,14 @@ public function __construct( ?string $previousValue = null, ?string $nextValue = null, ?string $catalogData = null, + ?string $variant = null, ?string $type = null ) { $this->change = $change; $this->previousValue = $previousValue; $this->nextValue = $nextValue; $this->catalogData = $catalogData; + $this->variant = $variant; $this->type = $type ?? self::DISCRIMINATOR_VALUE; } @@ -146,6 +154,7 @@ public function getNextValue() } /** + *Product data that was updated.
*staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + * + * @return null|string + */ + public function getVariant() + { + if (is_null($this->variant)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_VARIANT); + if (is_null($data)) { + return null; + } + $this->variant = (string) $data; + } + + return $this->variant; + } + /** * @param ?string $change @@ -201,6 +231,14 @@ public function setCatalogData(?string $catalogData): void $this->catalogData = $catalogData; } + /** + * @param ?string $variant + */ + public function setVariant(?string $variant): void + { + $this->variant = $variant; + } + } diff --git a/lib/commercetools-history/src/Models/Change/SetReservationsChange.php b/lib/commercetools-history/src/Models/Change/SetReservationsChange.php index 4701463792d..6c77e180ffc 100644 --- a/lib/commercetools-history/src/Models/Change/SetReservationsChange.php +++ b/lib/commercetools-history/src/Models/Change/SetReservationsChange.php @@ -17,6 +17,8 @@ interface SetReservationsChange extends Change public const FIELD_PREVIOUS_VALUE = 'previousValue'; public const FIELD_NEXT_VALUE = 'nextValue'; + public const FIELD_ADDED_ITEMS = 'addedItems'; + public const FIELD_REMOVED_ITEMS = 'removedItems'; /** @@ -46,6 +48,22 @@ public function getPreviousValue(); */ public function getNextValue(); + /** + *Elements added to the array.
+ * + + * @return null|ReservationCollection + */ + public function getAddedItems(); + + /** + *Elements removed from the array.
+ * + + * @return null|ReservationCollection + */ + public function getRemovedItems(); + /** * @param ?string $change */ @@ -60,4 +78,14 @@ public function setPreviousValue(?ReservationCollection $previousValue): void; * @param ?ReservationCollection $nextValue */ public function setNextValue(?ReservationCollection $nextValue): void; + + /** + * @param ?ReservationCollection $addedItems + */ + public function setAddedItems(?ReservationCollection $addedItems): void; + + /** + * @param ?ReservationCollection $removedItems + */ + public function setRemovedItems(?ReservationCollection $removedItems): void; } diff --git a/lib/commercetools-history/src/Models/Change/SetReservationsChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetReservationsChangeBuilder.php index 2f010544c3f..068f8bc3765 100644 --- a/lib/commercetools-history/src/Models/Change/SetReservationsChangeBuilder.php +++ b/lib/commercetools-history/src/Models/Change/SetReservationsChangeBuilder.php @@ -39,6 +39,18 @@ final class SetReservationsChangeBuilder implements Builder */ private $nextValue; + /** + + * @var ?ReservationCollection + */ + private $addedItems; + + /** + + * @var ?ReservationCollection + */ + private $removedItems; + /** * @return null|string @@ -70,6 +82,28 @@ public function getNextValue() return $this->nextValue; } + /** + *Elements added to the array.
+ * + + * @return null|ReservationCollection + */ + public function getAddedItems() + { + return $this->addedItems; + } + + /** + *Elements removed from the array.
+ * + + * @return null|ReservationCollection + */ + public function getRemovedItems() + { + return $this->removedItems; + } + /** * @param ?string $change * @return $this @@ -103,13 +137,37 @@ public function withNextValue(?ReservationCollection $nextValue) return $this; } + /** + * @param ?ReservationCollection $addedItems + * @return $this + */ + public function withAddedItems(?ReservationCollection $addedItems) + { + $this->addedItems = $addedItems; + + return $this; + } + + /** + * @param ?ReservationCollection $removedItems + * @return $this + */ + public function withRemovedItems(?ReservationCollection $removedItems) + { + $this->removedItems = $removedItems; + + return $this; + } + public function build(): SetReservationsChange { return new SetReservationsChangeModel( $this->change, $this->previousValue, - $this->nextValue + $this->nextValue, + $this->addedItems, + $this->removedItems ); } diff --git a/lib/commercetools-history/src/Models/Change/SetReservationsChangeModel.php b/lib/commercetools-history/src/Models/Change/SetReservationsChangeModel.php index 79093bb9660..fdf8de6f78d 100644 --- a/lib/commercetools-history/src/Models/Change/SetReservationsChangeModel.php +++ b/lib/commercetools-history/src/Models/Change/SetReservationsChangeModel.php @@ -46,6 +46,18 @@ final class SetReservationsChangeModel extends JsonObjectModel implements SetRes */ protected $nextValue; + /** + * + * @var ?ReservationCollection + */ + protected $addedItems; + + /** + * + * @var ?ReservationCollection + */ + protected $removedItems; + /** * @psalm-suppress MissingParamType @@ -54,11 +66,15 @@ public function __construct( ?string $change = null, ?ReservationCollection $previousValue = null, ?ReservationCollection $nextValue = null, + ?ReservationCollection $addedItems = null, + ?ReservationCollection $removedItems = null, ?string $type = null ) { $this->change = $change; $this->previousValue = $previousValue; $this->nextValue = $nextValue; + $this->addedItems = $addedItems; + $this->removedItems = $removedItems; $this->type = $type ?? self::DISCRIMINATOR_VALUE; } @@ -138,6 +154,46 @@ public function getNextValue() return $this->nextValue; } + /** + *Elements added to the array.
+ * + * + * @return null|ReservationCollection + */ + public function getAddedItems() + { + if (is_null($this->addedItems)) { + /** @psalm-var ?listElements removed from the array.
+ * + * + * @return null|ReservationCollection + */ + public function getRemovedItems() + { + if (is_null($this->removedItems)) { + /** @psalm-var ?listValue after the change.
+ * + + * @return null|ReturnInfo + */ + public function getNextValue(); + + /** + * @param ?string $change + */ + public function setChange(?string $change): void; + + /** + * @param ?ReturnInfo $previousValue + */ + public function setPreviousValue(?ReturnInfo $previousValue): void; + + /** + * @param ?ReturnInfo $nextValue + */ + public function setNextValue(?ReturnInfo $nextValue): void; +} diff --git a/lib/commercetools-history/src/Models/Change/SetReturnInfoChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetReturnInfoChangeBuilder.php new file mode 100644 index 00000000000..82911f1f15b --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetReturnInfoChangeBuilder.php @@ -0,0 +1,142 @@ + + */ +final class SetReturnInfoChangeBuilder implements Builder +{ + /** + + * @var ?string + */ + private $change; + + /** + + * @var null|ReturnInfo|ReturnInfoBuilder + */ + private $previousValue; + + /** + + * @var null|ReturnInfo|ReturnInfoBuilder + */ + private $nextValue; + + /** + + * @return null|string + */ + public function getChange() + { + return $this->change; + } + + /** + *Value before the change.
+ * + + * @return null|ReturnInfo + */ + public function getPreviousValue() + { + return $this->previousValue instanceof ReturnInfoBuilder ? $this->previousValue->build() : $this->previousValue; + } + + /** + *Value after the change.
+ * + + * @return null|ReturnInfo + */ + public function getNextValue() + { + return $this->nextValue instanceof ReturnInfoBuilder ? $this->nextValue->build() : $this->nextValue; + } + + /** + * @param ?string $change + * @return $this + */ + public function withChange(?string $change) + { + $this->change = $change; + + return $this; + } + + /** + * @param ?ReturnInfo $previousValue + * @return $this + */ + public function withPreviousValue(?ReturnInfo $previousValue) + { + $this->previousValue = $previousValue; + + return $this; + } + + /** + * @param ?ReturnInfo $nextValue + * @return $this + */ + public function withNextValue(?ReturnInfo $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + /** + * @deprecated use withPreviousValue() instead + * @return $this + */ + public function withPreviousValueBuilder(?ReturnInfoBuilder $previousValue) + { + $this->previousValue = $previousValue; + + return $this; + } + + /** + * @deprecated use withNextValue() instead + * @return $this + */ + public function withNextValueBuilder(?ReturnInfoBuilder $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + public function build(): SetReturnInfoChange + { + return new SetReturnInfoChangeModel( + $this->change, + $this->previousValue instanceof ReturnInfoBuilder ? $this->previousValue->build() : $this->previousValue, + $this->nextValue instanceof ReturnInfoBuilder ? $this->nextValue->build() : $this->nextValue + ); + } + + public static function of(): SetReturnInfoChangeBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetReturnInfoChangeCollection.php b/lib/commercetools-history/src/Models/Change/SetReturnInfoChangeCollection.php new file mode 100644 index 00000000000..19028b65e54 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetReturnInfoChangeCollection.php @@ -0,0 +1,56 @@ + + * @method SetReturnInfoChange current() + * @method SetReturnInfoChange end() + * @method SetReturnInfoChange at($offset) + */ +class SetReturnInfoChangeCollection extends ChangeCollection +{ + /** + * @psalm-assert SetReturnInfoChange $value + * @psalm-param SetReturnInfoChange|stdClass $value + * @throws InvalidArgumentException + * + * @return SetReturnInfoChangeCollection + */ + public function add($value) + { + if (!$value instanceof SetReturnInfoChange) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?SetReturnInfoChange + */ + protected function mapper() + { + return function (?int $index): ?SetReturnInfoChange { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var SetReturnInfoChange $data */ + $data = SetReturnInfoChangeModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetReturnInfoChangeModel.php b/lib/commercetools-history/src/Models/Change/SetReturnInfoChangeModel.php new file mode 100644 index 00000000000..c9c37743d7d --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetReturnInfoChangeModel.php @@ -0,0 +1,171 @@ +change = $change; + $this->previousValue = $previousValue; + $this->nextValue = $nextValue; + $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; + } + + /** + * + * @return null|string + */ + public function getChange() + { + if (is_null($this->change)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CHANGE); + if (is_null($data)) { + return null; + } + $this->change = (string) $data; + } + + return $this->change; + } + + /** + *Value before the change.
+ * + * + * @return null|ReturnInfo + */ + public function getPreviousValue() + { + if (is_null($this->previousValue)) { + /** @psalm-var stdClass|arrayValue after the change.
+ * + * + * @return null|ReturnInfo + */ + public function getNextValue() + { + if (is_null($this->nextValue)) { + /** @psalm-var stdClass|arrayid of the updated CustomLineItem.
Name of the Custom Field.
+ * + + * @return null|string + */ + public function getName(); + + /** + *id of the referenced Type.
Value before the change.
+ * + + * @return null|mixed + */ + public function getPreviousValue(); + + /** + *Value after the change.
+ * + + * @return null|mixed + */ + public function getNextValue(); + + /** + * @param ?string $change + */ + public function setChange(?string $change): void; + + /** + * @param ?LocalizedString $customLineItem + */ + public function setCustomLineItem(?LocalizedString $customLineItem): void; + + /** + * @param ?string $customLineItemId + */ + public function setCustomLineItemId(?string $customLineItemId): void; + + /** + * @param ?string $name + */ + public function setName(?string $name): void; + + /** + * @param ?string $customTypeId + */ + public function setCustomTypeId(?string $customTypeId): void; + + /** + * @param mixed $previousValue + */ + public function setPreviousValue( $previousValue): void; + + /** + * @param mixed $nextValue + */ + public function setNextValue( $nextValue): void; +} diff --git a/lib/commercetools-history/src/Models/Change/SetReturnItemCustomLineItemCustomFieldChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetReturnItemCustomLineItemCustomFieldChangeBuilder.php new file mode 100644 index 00000000000..62129d59d29 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetReturnItemCustomLineItemCustomFieldChangeBuilder.php @@ -0,0 +1,247 @@ + + */ +final class SetReturnItemCustomLineItemCustomFieldChangeBuilder implements Builder +{ + /** + + * @var ?string + */ + private $change; + + /** + + * @var null|LocalizedString|LocalizedStringBuilder + */ + private $customLineItem; + + /** + + * @var ?string + */ + private $customLineItemId; + + /** + + * @var ?string + */ + private $name; + + /** + + * @var ?string + */ + private $customTypeId; + + /** + + * @var null|mixed|mixed + */ + private $previousValue; + + /** + + * @var null|mixed|mixed + */ + private $nextValue; + + /** + + * @return null|string + */ + public function getChange() + { + return $this->change; + } + + /** + *Name of the updated CustomLineItem.
+ * + + * @return null|LocalizedString + */ + public function getCustomLineItem() + { + return $this->customLineItem instanceof LocalizedStringBuilder ? $this->customLineItem->build() : $this->customLineItem; + } + + /** + *id of the updated CustomLineItem.
Name of the Custom Field.
+ * + + * @return null|string + */ + public function getName() + { + return $this->name; + } + + /** + *id of the referenced Type.
Value before the change.
+ * + + * @return null|mixed + */ + public function getPreviousValue() + { + return $this->previousValue; + } + + /** + *Value after the change.
+ * + + * @return null|mixed + */ + public function getNextValue() + { + return $this->nextValue; + } + + /** + * @param ?string $change + * @return $this + */ + public function withChange(?string $change) + { + $this->change = $change; + + return $this; + } + + /** + * @param ?LocalizedString $customLineItem + * @return $this + */ + public function withCustomLineItem(?LocalizedString $customLineItem) + { + $this->customLineItem = $customLineItem; + + return $this; + } + + /** + * @param ?string $customLineItemId + * @return $this + */ + public function withCustomLineItemId(?string $customLineItemId) + { + $this->customLineItemId = $customLineItemId; + + return $this; + } + + /** + * @param ?string $name + * @return $this + */ + public function withName(?string $name) + { + $this->name = $name; + + return $this; + } + + /** + * @param ?string $customTypeId + * @return $this + */ + public function withCustomTypeId(?string $customTypeId) + { + $this->customTypeId = $customTypeId; + + return $this; + } + + /** + * @param mixed $previousValue + * @return $this + */ + public function withPreviousValue( $previousValue) + { + $this->previousValue = $previousValue; + + return $this; + } + + /** + * @param mixed $nextValue + * @return $this + */ + public function withNextValue( $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + /** + * @deprecated use withCustomLineItem() instead + * @return $this + */ + public function withCustomLineItemBuilder(?LocalizedStringBuilder $customLineItem) + { + $this->customLineItem = $customLineItem; + + return $this; + } + + public function build(): SetReturnItemCustomLineItemCustomFieldChange + { + return new SetReturnItemCustomLineItemCustomFieldChangeModel( + $this->change, + $this->customLineItem instanceof LocalizedStringBuilder ? $this->customLineItem->build() : $this->customLineItem, + $this->customLineItemId, + $this->name, + $this->customTypeId, + $this->previousValue, + $this->nextValue + ); + } + + public static function of(): SetReturnItemCustomLineItemCustomFieldChangeBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetReturnItemCustomLineItemCustomFieldChangeCollection.php b/lib/commercetools-history/src/Models/Change/SetReturnItemCustomLineItemCustomFieldChangeCollection.php new file mode 100644 index 00000000000..12af24bf7f4 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetReturnItemCustomLineItemCustomFieldChangeCollection.php @@ -0,0 +1,56 @@ + + * @method SetReturnItemCustomLineItemCustomFieldChange current() + * @method SetReturnItemCustomLineItemCustomFieldChange end() + * @method SetReturnItemCustomLineItemCustomFieldChange at($offset) + */ +class SetReturnItemCustomLineItemCustomFieldChangeCollection extends ChangeCollection +{ + /** + * @psalm-assert SetReturnItemCustomLineItemCustomFieldChange $value + * @psalm-param SetReturnItemCustomLineItemCustomFieldChange|stdClass $value + * @throws InvalidArgumentException + * + * @return SetReturnItemCustomLineItemCustomFieldChangeCollection + */ + public function add($value) + { + if (!$value instanceof SetReturnItemCustomLineItemCustomFieldChange) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?SetReturnItemCustomLineItemCustomFieldChange + */ + protected function mapper() + { + return function (?int $index): ?SetReturnItemCustomLineItemCustomFieldChange { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var SetReturnItemCustomLineItemCustomFieldChange $data */ + $data = SetReturnItemCustomLineItemCustomFieldChangeModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetReturnItemCustomLineItemCustomFieldChangeModel.php b/lib/commercetools-history/src/Models/Change/SetReturnItemCustomLineItemCustomFieldChangeModel.php new file mode 100644 index 00000000000..6673dafd5fb --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetReturnItemCustomLineItemCustomFieldChangeModel.php @@ -0,0 +1,314 @@ +change = $change; + $this->customLineItem = $customLineItem; + $this->customLineItemId = $customLineItemId; + $this->name = $name; + $this->customTypeId = $customTypeId; + $this->previousValue = $previousValue; + $this->nextValue = $nextValue; + $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; + } + + /** + * + * @return null|string + */ + public function getChange() + { + if (is_null($this->change)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CHANGE); + if (is_null($data)) { + return null; + } + $this->change = (string) $data; + } + + return $this->change; + } + + /** + *Name of the updated CustomLineItem.
+ * + * + * @return null|LocalizedString + */ + public function getCustomLineItem() + { + if (is_null($this->customLineItem)) { + /** @psalm-var stdClass|arrayid of the updated CustomLineItem.
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; + } + + /** + *id of the referenced Type.
Value before the change.
+ * + * + * @return null|mixed + */ + public function getPreviousValue() + { + if (is_null($this->previousValue)) { + /** @psalm-var mixed $data */ + $data = $this->raw(self::FIELD_PREVIOUS_VALUE); + if (is_null($data)) { + return null; + } + $this->previousValue = $data; + } + + return $this->previousValue; + } + + /** + *Value after the change.
+ * + * + * @return null|mixed + */ + public function getNextValue() + { + if (is_null($this->nextValue)) { + /** @psalm-var mixed $data */ + $data = $this->raw(self::FIELD_NEXT_VALUE); + if (is_null($data)) { + return null; + } + $this->nextValue = $data; + } + + return $this->nextValue; + } + + + /** + * @param ?string $change + */ + public function setChange(?string $change): void + { + $this->change = $change; + } + + /** + * @param ?LocalizedString $customLineItem + */ + public function setCustomLineItem(?LocalizedString $customLineItem): void + { + $this->customLineItem = $customLineItem; + } + + /** + * @param ?string $customLineItemId + */ + public function setCustomLineItemId(?string $customLineItemId): void + { + $this->customLineItemId = $customLineItemId; + } + + /** + * @param ?string $name + */ + public function setName(?string $name): void + { + $this->name = $name; + } + + /** + * @param ?string $customTypeId + */ + public function setCustomTypeId(?string $customTypeId): void + { + $this->customTypeId = $customTypeId; + } + + /** + * @param mixed $previousValue + */ + public function setPreviousValue( $previousValue): void + { + $this->previousValue = $previousValue; + } + + /** + * @param mixed $nextValue + */ + public function setNextValue( $nextValue): void + { + $this->nextValue = $nextValue; + } + + + +} diff --git a/lib/commercetools-history/src/Models/Change/SetReturnItemCustomLineItemCustomTypeChange.php b/lib/commercetools-history/src/Models/Change/SetReturnItemCustomLineItemCustomTypeChange.php new file mode 100644 index 00000000000..3abc1ccf54b --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetReturnItemCustomLineItemCustomTypeChange.php @@ -0,0 +1,92 @@ +Name of the updated CustomLineItem. + * + + * @return null|LocalizedString + */ + public function getCustomLineItem(); + + /** + *id of the updated CustomLineItem.
Value before the change.
+ * + + * @return null|CustomFields + */ + public function getPreviousValue(); + + /** + *Value after the change.
+ * + + * @return null|CustomFields + */ + public function getNextValue(); + + /** + * @param ?string $change + */ + public function setChange(?string $change): void; + + /** + * @param ?LocalizedString $customLineItem + */ + public function setCustomLineItem(?LocalizedString $customLineItem): void; + + /** + * @param ?string $customLineItemId + */ + public function setCustomLineItemId(?string $customLineItemId): void; + + /** + * @param ?CustomFields $previousValue + */ + public function setPreviousValue(?CustomFields $previousValue): void; + + /** + * @param ?CustomFields $nextValue + */ + public function setNextValue(?CustomFields $nextValue): void; +} diff --git a/lib/commercetools-history/src/Models/Change/SetReturnItemCustomLineItemCustomTypeChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetReturnItemCustomLineItemCustomTypeChangeBuilder.php new file mode 100644 index 00000000000..ecd1845d356 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetReturnItemCustomLineItemCustomTypeChangeBuilder.php @@ -0,0 +1,213 @@ + + */ +final class SetReturnItemCustomLineItemCustomTypeChangeBuilder implements Builder +{ + /** + + * @var ?string + */ + private $change; + + /** + + * @var null|LocalizedString|LocalizedStringBuilder + */ + private $customLineItem; + + /** + + * @var ?string + */ + private $customLineItemId; + + /** + + * @var null|CustomFields|CustomFieldsBuilder + */ + private $previousValue; + + /** + + * @var null|CustomFields|CustomFieldsBuilder + */ + private $nextValue; + + /** + + * @return null|string + */ + public function getChange() + { + return $this->change; + } + + /** + *Name of the updated CustomLineItem.
+ * + + * @return null|LocalizedString + */ + public function getCustomLineItem() + { + return $this->customLineItem instanceof LocalizedStringBuilder ? $this->customLineItem->build() : $this->customLineItem; + } + + /** + *id of the updated CustomLineItem.
Value before the change.
+ * + + * @return null|CustomFields + */ + public function getPreviousValue() + { + return $this->previousValue instanceof CustomFieldsBuilder ? $this->previousValue->build() : $this->previousValue; + } + + /** + *Value after the change.
+ * + + * @return null|CustomFields + */ + public function getNextValue() + { + return $this->nextValue instanceof CustomFieldsBuilder ? $this->nextValue->build() : $this->nextValue; + } + + /** + * @param ?string $change + * @return $this + */ + public function withChange(?string $change) + { + $this->change = $change; + + return $this; + } + + /** + * @param ?LocalizedString $customLineItem + * @return $this + */ + public function withCustomLineItem(?LocalizedString $customLineItem) + { + $this->customLineItem = $customLineItem; + + return $this; + } + + /** + * @param ?string $customLineItemId + * @return $this + */ + public function withCustomLineItemId(?string $customLineItemId) + { + $this->customLineItemId = $customLineItemId; + + return $this; + } + + /** + * @param ?CustomFields $previousValue + * @return $this + */ + public function withPreviousValue(?CustomFields $previousValue) + { + $this->previousValue = $previousValue; + + return $this; + } + + /** + * @param ?CustomFields $nextValue + * @return $this + */ + public function withNextValue(?CustomFields $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + /** + * @deprecated use withCustomLineItem() instead + * @return $this + */ + public function withCustomLineItemBuilder(?LocalizedStringBuilder $customLineItem) + { + $this->customLineItem = $customLineItem; + + return $this; + } + + /** + * @deprecated use withPreviousValue() instead + * @return $this + */ + public function withPreviousValueBuilder(?CustomFieldsBuilder $previousValue) + { + $this->previousValue = $previousValue; + + return $this; + } + + /** + * @deprecated use withNextValue() instead + * @return $this + */ + public function withNextValueBuilder(?CustomFieldsBuilder $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + public function build(): SetReturnItemCustomLineItemCustomTypeChange + { + return new SetReturnItemCustomLineItemCustomTypeChangeModel( + $this->change, + $this->customLineItem instanceof LocalizedStringBuilder ? $this->customLineItem->build() : $this->customLineItem, + $this->customLineItemId, + $this->previousValue instanceof CustomFieldsBuilder ? $this->previousValue->build() : $this->previousValue, + $this->nextValue instanceof CustomFieldsBuilder ? $this->nextValue->build() : $this->nextValue + ); + } + + public static function of(): SetReturnItemCustomLineItemCustomTypeChangeBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetReturnItemCustomLineItemCustomTypeChangeCollection.php b/lib/commercetools-history/src/Models/Change/SetReturnItemCustomLineItemCustomTypeChangeCollection.php new file mode 100644 index 00000000000..d615b96f045 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetReturnItemCustomLineItemCustomTypeChangeCollection.php @@ -0,0 +1,56 @@ + + * @method SetReturnItemCustomLineItemCustomTypeChange current() + * @method SetReturnItemCustomLineItemCustomTypeChange end() + * @method SetReturnItemCustomLineItemCustomTypeChange at($offset) + */ +class SetReturnItemCustomLineItemCustomTypeChangeCollection extends ChangeCollection +{ + /** + * @psalm-assert SetReturnItemCustomLineItemCustomTypeChange $value + * @psalm-param SetReturnItemCustomLineItemCustomTypeChange|stdClass $value + * @throws InvalidArgumentException + * + * @return SetReturnItemCustomLineItemCustomTypeChangeCollection + */ + public function add($value) + { + if (!$value instanceof SetReturnItemCustomLineItemCustomTypeChange) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?SetReturnItemCustomLineItemCustomTypeChange + */ + protected function mapper() + { + return function (?int $index): ?SetReturnItemCustomLineItemCustomTypeChange { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var SetReturnItemCustomLineItemCustomTypeChange $data */ + $data = SetReturnItemCustomLineItemCustomTypeChangeModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetReturnItemCustomLineItemCustomTypeChangeModel.php b/lib/commercetools-history/src/Models/Change/SetReturnItemCustomLineItemCustomTypeChangeModel.php new file mode 100644 index 00000000000..526179c1fa2 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetReturnItemCustomLineItemCustomTypeChangeModel.php @@ -0,0 +1,246 @@ +change = $change; + $this->customLineItem = $customLineItem; + $this->customLineItemId = $customLineItemId; + $this->previousValue = $previousValue; + $this->nextValue = $nextValue; + $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; + } + + /** + * + * @return null|string + */ + public function getChange() + { + if (is_null($this->change)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CHANGE); + if (is_null($data)) { + return null; + } + $this->change = (string) $data; + } + + return $this->change; + } + + /** + *Name of the updated CustomLineItem.
+ * + * + * @return null|LocalizedString + */ + public function getCustomLineItem() + { + if (is_null($this->customLineItem)) { + /** @psalm-var stdClass|arrayid of the updated CustomLineItem.
Value before the change.
+ * + * + * @return null|CustomFields + */ + public function getPreviousValue() + { + if (is_null($this->previousValue)) { + /** @psalm-var stdClass|arrayValue after the change.
+ * + * + * @return null|CustomFields + */ + public function getNextValue() + { + if (is_null($this->nextValue)) { + /** @psalm-var stdClass|arrayThis field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + + * @return null|string + */ + public function getVariant(); + + /** + *Name of the Product the updated Line Item is based on.
+ * + + * @return null|LocalizedString + */ + public function getLineItem(); + + /** + *id of the updated LineItem.
Name of the Custom Field.
+ * + + * @return null|string + */ + public function getName(); + + /** + *id of the referenced Type.
Value before the change.
+ * + + * @return null|mixed + */ + public function getPreviousValue(); + + /** + *Value after the change.
+ * + + * @return null|mixed + */ + public function getNextValue(); + + /** + * @param ?string $change + */ + public function setChange(?string $change): void; + + /** + * @param ?string $variant + */ + public function setVariant(?string $variant): void; + + /** + * @param ?LocalizedString $lineItem + */ + public function setLineItem(?LocalizedString $lineItem): void; + + /** + * @param ?string $lineItemId + */ + public function setLineItemId(?string $lineItemId): void; + + /** + * @param ?string $name + */ + public function setName(?string $name): void; + + /** + * @param ?string $customTypeId + */ + public function setCustomTypeId(?string $customTypeId): void; + + /** + * @param mixed $previousValue + */ + public function setPreviousValue( $previousValue): void; + + /** + * @param mixed $nextValue + */ + public function setNextValue( $nextValue): void; +} diff --git a/lib/commercetools-history/src/Models/Change/SetReturnItemLineItemCustomFieldChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetReturnItemLineItemCustomFieldChangeBuilder.php new file mode 100644 index 00000000000..ea60a625e51 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetReturnItemLineItemCustomFieldChangeBuilder.php @@ -0,0 +1,277 @@ + + */ +final class SetReturnItemLineItemCustomFieldChangeBuilder implements Builder +{ + /** + + * @var ?string + */ + private $change; + + /** + + * @var ?string + */ + private $variant; + + /** + + * @var null|LocalizedString|LocalizedStringBuilder + */ + private $lineItem; + + /** + + * @var ?string + */ + private $lineItemId; + + /** + + * @var ?string + */ + private $name; + + /** + + * @var ?string + */ + private $customTypeId; + + /** + + * @var null|mixed|mixed + */ + private $previousValue; + + /** + + * @var null|mixed|mixed + */ + private $nextValue; + + /** + + * @return null|string + */ + public function getChange() + { + return $this->change; + } + + /** + *Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + + * @return null|string + */ + public function getVariant() + { + return $this->variant; + } + + /** + *Name of the Product the updated Line Item is based on.
+ * + + * @return null|LocalizedString + */ + public function getLineItem() + { + return $this->lineItem instanceof LocalizedStringBuilder ? $this->lineItem->build() : $this->lineItem; + } + + /** + *id of the updated LineItem.
Name of the Custom Field.
+ * + + * @return null|string + */ + public function getName() + { + return $this->name; + } + + /** + *id of the referenced Type.
Value before the change.
+ * + + * @return null|mixed + */ + public function getPreviousValue() + { + return $this->previousValue; + } + + /** + *Value after the change.
+ * + + * @return null|mixed + */ + public function getNextValue() + { + return $this->nextValue; + } + + /** + * @param ?string $change + * @return $this + */ + public function withChange(?string $change) + { + $this->change = $change; + + return $this; + } + + /** + * @param ?string $variant + * @return $this + */ + public function withVariant(?string $variant) + { + $this->variant = $variant; + + return $this; + } + + /** + * @param ?LocalizedString $lineItem + * @return $this + */ + public function withLineItem(?LocalizedString $lineItem) + { + $this->lineItem = $lineItem; + + return $this; + } + + /** + * @param ?string $lineItemId + * @return $this + */ + public function withLineItemId(?string $lineItemId) + { + $this->lineItemId = $lineItemId; + + return $this; + } + + /** + * @param ?string $name + * @return $this + */ + public function withName(?string $name) + { + $this->name = $name; + + return $this; + } + + /** + * @param ?string $customTypeId + * @return $this + */ + public function withCustomTypeId(?string $customTypeId) + { + $this->customTypeId = $customTypeId; + + return $this; + } + + /** + * @param mixed $previousValue + * @return $this + */ + public function withPreviousValue( $previousValue) + { + $this->previousValue = $previousValue; + + return $this; + } + + /** + * @param mixed $nextValue + * @return $this + */ + public function withNextValue( $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + /** + * @deprecated use withLineItem() instead + * @return $this + */ + public function withLineItemBuilder(?LocalizedStringBuilder $lineItem) + { + $this->lineItem = $lineItem; + + return $this; + } + + public function build(): SetReturnItemLineItemCustomFieldChange + { + return new SetReturnItemLineItemCustomFieldChangeModel( + $this->change, + $this->variant, + $this->lineItem instanceof LocalizedStringBuilder ? $this->lineItem->build() : $this->lineItem, + $this->lineItemId, + $this->name, + $this->customTypeId, + $this->previousValue, + $this->nextValue + ); + } + + public static function of(): SetReturnItemLineItemCustomFieldChangeBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetReturnItemLineItemCustomFieldChangeCollection.php b/lib/commercetools-history/src/Models/Change/SetReturnItemLineItemCustomFieldChangeCollection.php new file mode 100644 index 00000000000..e02ccfb74a4 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetReturnItemLineItemCustomFieldChangeCollection.php @@ -0,0 +1,56 @@ + + * @method SetReturnItemLineItemCustomFieldChange current() + * @method SetReturnItemLineItemCustomFieldChange end() + * @method SetReturnItemLineItemCustomFieldChange at($offset) + */ +class SetReturnItemLineItemCustomFieldChangeCollection extends ChangeCollection +{ + /** + * @psalm-assert SetReturnItemLineItemCustomFieldChange $value + * @psalm-param SetReturnItemLineItemCustomFieldChange|stdClass $value + * @throws InvalidArgumentException + * + * @return SetReturnItemLineItemCustomFieldChangeCollection + */ + public function add($value) + { + if (!$value instanceof SetReturnItemLineItemCustomFieldChange) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?SetReturnItemLineItemCustomFieldChange + */ + protected function mapper() + { + return function (?int $index): ?SetReturnItemLineItemCustomFieldChange { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var SetReturnItemLineItemCustomFieldChange $data */ + $data = SetReturnItemLineItemCustomFieldChangeModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetReturnItemLineItemCustomFieldChangeModel.php b/lib/commercetools-history/src/Models/Change/SetReturnItemLineItemCustomFieldChangeModel.php new file mode 100644 index 00000000000..8e303bd943d --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetReturnItemLineItemCustomFieldChangeModel.php @@ -0,0 +1,351 @@ +change = $change; + $this->variant = $variant; + $this->lineItem = $lineItem; + $this->lineItemId = $lineItemId; + $this->name = $name; + $this->customTypeId = $customTypeId; + $this->previousValue = $previousValue; + $this->nextValue = $nextValue; + $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; + } + + /** + * + * @return null|string + */ + public function getChange() + { + if (is_null($this->change)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CHANGE); + if (is_null($data)) { + return null; + } + $this->change = (string) $data; + } + + return $this->change; + } + + /** + *Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + * + * @return null|string + */ + public function getVariant() + { + if (is_null($this->variant)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_VARIANT); + if (is_null($data)) { + return null; + } + $this->variant = (string) $data; + } + + return $this->variant; + } + + /** + *Name of the Product the updated Line Item is based on.
+ * + * + * @return null|LocalizedString + */ + public function getLineItem() + { + if (is_null($this->lineItem)) { + /** @psalm-var stdClass|arrayid of the updated LineItem.
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; + } + + /** + *id of the referenced Type.
Value before the change.
+ * + * + * @return null|mixed + */ + public function getPreviousValue() + { + if (is_null($this->previousValue)) { + /** @psalm-var mixed $data */ + $data = $this->raw(self::FIELD_PREVIOUS_VALUE); + if (is_null($data)) { + return null; + } + $this->previousValue = $data; + } + + return $this->previousValue; + } + + /** + *Value after the change.
+ * + * + * @return null|mixed + */ + public function getNextValue() + { + if (is_null($this->nextValue)) { + /** @psalm-var mixed $data */ + $data = $this->raw(self::FIELD_NEXT_VALUE); + if (is_null($data)) { + return null; + } + $this->nextValue = $data; + } + + return $this->nextValue; + } + + + /** + * @param ?string $change + */ + public function setChange(?string $change): void + { + $this->change = $change; + } + + /** + * @param ?string $variant + */ + public function setVariant(?string $variant): void + { + $this->variant = $variant; + } + + /** + * @param ?LocalizedString $lineItem + */ + public function setLineItem(?LocalizedString $lineItem): void + { + $this->lineItem = $lineItem; + } + + /** + * @param ?string $lineItemId + */ + public function setLineItemId(?string $lineItemId): void + { + $this->lineItemId = $lineItemId; + } + + /** + * @param ?string $name + */ + public function setName(?string $name): void + { + $this->name = $name; + } + + /** + * @param ?string $customTypeId + */ + public function setCustomTypeId(?string $customTypeId): void + { + $this->customTypeId = $customTypeId; + } + + /** + * @param mixed $previousValue + */ + public function setPreviousValue( $previousValue): void + { + $this->previousValue = $previousValue; + } + + /** + * @param mixed $nextValue + */ + public function setNextValue( $nextValue): void + { + $this->nextValue = $nextValue; + } + + + +} diff --git a/lib/commercetools-history/src/Models/Change/SetReturnItemLineItemCustomTypeChange.php b/lib/commercetools-history/src/Models/Change/SetReturnItemLineItemCustomTypeChange.php new file mode 100644 index 00000000000..008b3232ec3 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetReturnItemLineItemCustomTypeChange.php @@ -0,0 +1,107 @@ +Identifier of the updated Product Variant. + *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + + * @return null|string + */ + public function getVariant(); + + /** + *Name of the Product the updated Line Item is based on.
+ * + + * @return null|LocalizedString + */ + public function getLineItem(); + + /** + *id of the updated LineItem.
Value before the change.
+ * + + * @return null|CustomFields + */ + public function getPreviousValue(); + + /** + *Value after the change.
+ * + + * @return null|CustomFields + */ + public function getNextValue(); + + /** + * @param ?string $change + */ + public function setChange(?string $change): void; + + /** + * @param ?string $variant + */ + public function setVariant(?string $variant): void; + + /** + * @param ?LocalizedString $lineItem + */ + public function setLineItem(?LocalizedString $lineItem): void; + + /** + * @param ?string $lineItemId + */ + public function setLineItemId(?string $lineItemId): void; + + /** + * @param ?CustomFields $previousValue + */ + public function setPreviousValue(?CustomFields $previousValue): void; + + /** + * @param ?CustomFields $nextValue + */ + public function setNextValue(?CustomFields $nextValue): void; +} diff --git a/lib/commercetools-history/src/Models/Change/SetReturnItemLineItemCustomTypeChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetReturnItemLineItemCustomTypeChangeBuilder.php new file mode 100644 index 00000000000..1f264e17847 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetReturnItemLineItemCustomTypeChangeBuilder.php @@ -0,0 +1,243 @@ + + */ +final class SetReturnItemLineItemCustomTypeChangeBuilder implements Builder +{ + /** + + * @var ?string + */ + private $change; + + /** + + * @var ?string + */ + private $variant; + + /** + + * @var null|LocalizedString|LocalizedStringBuilder + */ + private $lineItem; + + /** + + * @var ?string + */ + private $lineItemId; + + /** + + * @var null|CustomFields|CustomFieldsBuilder + */ + private $previousValue; + + /** + + * @var null|CustomFields|CustomFieldsBuilder + */ + private $nextValue; + + /** + + * @return null|string + */ + public function getChange() + { + return $this->change; + } + + /** + *Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + + * @return null|string + */ + public function getVariant() + { + return $this->variant; + } + + /** + *Name of the Product the updated Line Item is based on.
+ * + + * @return null|LocalizedString + */ + public function getLineItem() + { + return $this->lineItem instanceof LocalizedStringBuilder ? $this->lineItem->build() : $this->lineItem; + } + + /** + *id of the updated LineItem.
Value before the change.
+ * + + * @return null|CustomFields + */ + public function getPreviousValue() + { + return $this->previousValue instanceof CustomFieldsBuilder ? $this->previousValue->build() : $this->previousValue; + } + + /** + *Value after the change.
+ * + + * @return null|CustomFields + */ + public function getNextValue() + { + return $this->nextValue instanceof CustomFieldsBuilder ? $this->nextValue->build() : $this->nextValue; + } + + /** + * @param ?string $change + * @return $this + */ + public function withChange(?string $change) + { + $this->change = $change; + + return $this; + } + + /** + * @param ?string $variant + * @return $this + */ + public function withVariant(?string $variant) + { + $this->variant = $variant; + + return $this; + } + + /** + * @param ?LocalizedString $lineItem + * @return $this + */ + public function withLineItem(?LocalizedString $lineItem) + { + $this->lineItem = $lineItem; + + return $this; + } + + /** + * @param ?string $lineItemId + * @return $this + */ + public function withLineItemId(?string $lineItemId) + { + $this->lineItemId = $lineItemId; + + return $this; + } + + /** + * @param ?CustomFields $previousValue + * @return $this + */ + public function withPreviousValue(?CustomFields $previousValue) + { + $this->previousValue = $previousValue; + + return $this; + } + + /** + * @param ?CustomFields $nextValue + * @return $this + */ + public function withNextValue(?CustomFields $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + /** + * @deprecated use withLineItem() instead + * @return $this + */ + public function withLineItemBuilder(?LocalizedStringBuilder $lineItem) + { + $this->lineItem = $lineItem; + + return $this; + } + + /** + * @deprecated use withPreviousValue() instead + * @return $this + */ + public function withPreviousValueBuilder(?CustomFieldsBuilder $previousValue) + { + $this->previousValue = $previousValue; + + return $this; + } + + /** + * @deprecated use withNextValue() instead + * @return $this + */ + public function withNextValueBuilder(?CustomFieldsBuilder $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + public function build(): SetReturnItemLineItemCustomTypeChange + { + return new SetReturnItemLineItemCustomTypeChangeModel( + $this->change, + $this->variant, + $this->lineItem instanceof LocalizedStringBuilder ? $this->lineItem->build() : $this->lineItem, + $this->lineItemId, + $this->previousValue instanceof CustomFieldsBuilder ? $this->previousValue->build() : $this->previousValue, + $this->nextValue instanceof CustomFieldsBuilder ? $this->nextValue->build() : $this->nextValue + ); + } + + public static function of(): SetReturnItemLineItemCustomTypeChangeBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetReturnItemLineItemCustomTypeChangeCollection.php b/lib/commercetools-history/src/Models/Change/SetReturnItemLineItemCustomTypeChangeCollection.php new file mode 100644 index 00000000000..e2fb62aacec --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetReturnItemLineItemCustomTypeChangeCollection.php @@ -0,0 +1,56 @@ + + * @method SetReturnItemLineItemCustomTypeChange current() + * @method SetReturnItemLineItemCustomTypeChange end() + * @method SetReturnItemLineItemCustomTypeChange at($offset) + */ +class SetReturnItemLineItemCustomTypeChangeCollection extends ChangeCollection +{ + /** + * @psalm-assert SetReturnItemLineItemCustomTypeChange $value + * @psalm-param SetReturnItemLineItemCustomTypeChange|stdClass $value + * @throws InvalidArgumentException + * + * @return SetReturnItemLineItemCustomTypeChangeCollection + */ + public function add($value) + { + if (!$value instanceof SetReturnItemLineItemCustomTypeChange) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?SetReturnItemLineItemCustomTypeChange + */ + protected function mapper() + { + return function (?int $index): ?SetReturnItemLineItemCustomTypeChange { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var SetReturnItemLineItemCustomTypeChange $data */ + $data = SetReturnItemLineItemCustomTypeChangeModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetReturnItemLineItemCustomTypeChangeModel.php b/lib/commercetools-history/src/Models/Change/SetReturnItemLineItemCustomTypeChangeModel.php new file mode 100644 index 00000000000..10fbeded887 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetReturnItemLineItemCustomTypeChangeModel.php @@ -0,0 +1,283 @@ +change = $change; + $this->variant = $variant; + $this->lineItem = $lineItem; + $this->lineItemId = $lineItemId; + $this->previousValue = $previousValue; + $this->nextValue = $nextValue; + $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; + } + + /** + * + * @return null|string + */ + public function getChange() + { + if (is_null($this->change)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CHANGE); + if (is_null($data)) { + return null; + } + $this->change = (string) $data; + } + + return $this->change; + } + + /** + *Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + * + * @return null|string + */ + public function getVariant() + { + if (is_null($this->variant)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_VARIANT); + if (is_null($data)) { + return null; + } + $this->variant = (string) $data; + } + + return $this->variant; + } + + /** + *Name of the Product the updated Line Item is based on.
+ * + * + * @return null|LocalizedString + */ + public function getLineItem() + { + if (is_null($this->lineItem)) { + /** @psalm-var stdClass|arrayid of the updated LineItem.
Value before the change.
+ * + * + * @return null|CustomFields + */ + public function getPreviousValue() + { + if (is_null($this->previousValue)) { + /** @psalm-var stdClass|arrayValue after the change.
+ * + * + * @return null|CustomFields + */ + public function getNextValue() + { + if (is_null($this->nextValue)) { + /** @psalm-var stdClass|arrayProduct data that was updated.
*staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Product data that was updated.
*staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Product data that was updated.
*staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.id of the referenced Type.
Value before the change.
+ * + + * @return null|mixed + */ + public function getPreviousValue(); + + /** + *Value after the change.
+ * + + * @return null|mixed + */ + public function getNextValue(); + + /** + * @param ?string $change + */ + public function setChange(?string $change): void; + + /** + * @param ?string $name + */ + public function setName(?string $name): void; + + /** + * @param ?string $customTypeId + */ + public function setCustomTypeId(?string $customTypeId): void; + + /** + * @param mixed $previousValue + */ + public function setPreviousValue( $previousValue): void; + + /** + * @param mixed $nextValue + */ + public function setNextValue( $nextValue): void; +} diff --git a/lib/commercetools-history/src/Models/Change/SetShippingAddressCustomFieldChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetShippingAddressCustomFieldChangeBuilder.php new file mode 100644 index 00000000000..d9d181845c7 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetShippingAddressCustomFieldChangeBuilder.php @@ -0,0 +1,177 @@ + + */ +final class SetShippingAddressCustomFieldChangeBuilder implements Builder +{ + /** + + * @var ?string + */ + private $change; + + /** + + * @var ?string + */ + private $name; + + /** + + * @var ?string + */ + private $customTypeId; + + /** + + * @var null|mixed|mixed + */ + private $previousValue; + + /** + + * @var null|mixed|mixed + */ + private $nextValue; + + /** + + * @return null|string + */ + public function getChange() + { + return $this->change; + } + + /** + *Name of the Custom Field.
+ * + + * @return null|string + */ + public function getName() + { + return $this->name; + } + + /** + *id of the referenced Type.
Value before the change.
+ * + + * @return null|mixed + */ + public function getPreviousValue() + { + return $this->previousValue; + } + + /** + *Value after the change.
+ * + + * @return null|mixed + */ + public function getNextValue() + { + return $this->nextValue; + } + + /** + * @param ?string $change + * @return $this + */ + public function withChange(?string $change) + { + $this->change = $change; + + return $this; + } + + /** + * @param ?string $name + * @return $this + */ + public function withName(?string $name) + { + $this->name = $name; + + return $this; + } + + /** + * @param ?string $customTypeId + * @return $this + */ + public function withCustomTypeId(?string $customTypeId) + { + $this->customTypeId = $customTypeId; + + return $this; + } + + /** + * @param mixed $previousValue + * @return $this + */ + public function withPreviousValue( $previousValue) + { + $this->previousValue = $previousValue; + + return $this; + } + + /** + * @param mixed $nextValue + * @return $this + */ + public function withNextValue( $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + + public function build(): SetShippingAddressCustomFieldChange + { + return new SetShippingAddressCustomFieldChangeModel( + $this->change, + $this->name, + $this->customTypeId, + $this->previousValue, + $this->nextValue + ); + } + + public static function of(): SetShippingAddressCustomFieldChangeBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetShippingAddressCustomFieldChangeCollection.php b/lib/commercetools-history/src/Models/Change/SetShippingAddressCustomFieldChangeCollection.php new file mode 100644 index 00000000000..8c770cbf40d --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetShippingAddressCustomFieldChangeCollection.php @@ -0,0 +1,56 @@ + + * @method SetShippingAddressCustomFieldChange current() + * @method SetShippingAddressCustomFieldChange end() + * @method SetShippingAddressCustomFieldChange at($offset) + */ +class SetShippingAddressCustomFieldChangeCollection extends ChangeCollection +{ + /** + * @psalm-assert SetShippingAddressCustomFieldChange $value + * @psalm-param SetShippingAddressCustomFieldChange|stdClass $value + * @throws InvalidArgumentException + * + * @return SetShippingAddressCustomFieldChangeCollection + */ + public function add($value) + { + if (!$value instanceof SetShippingAddressCustomFieldChange) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?SetShippingAddressCustomFieldChange + */ + protected function mapper() + { + return function (?int $index): ?SetShippingAddressCustomFieldChange { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var SetShippingAddressCustomFieldChange $data */ + $data = SetShippingAddressCustomFieldChangeModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetShippingAddressCustomFieldChangeModel.php b/lib/commercetools-history/src/Models/Change/SetShippingAddressCustomFieldChangeModel.php new file mode 100644 index 00000000000..e305d624dcf --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetShippingAddressCustomFieldChangeModel.php @@ -0,0 +1,239 @@ +change = $change; + $this->name = $name; + $this->customTypeId = $customTypeId; + $this->previousValue = $previousValue; + $this->nextValue = $nextValue; + $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; + } + + /** + * + * @return null|string + */ + public function getChange() + { + if (is_null($this->change)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CHANGE); + if (is_null($data)) { + return null; + } + $this->change = (string) $data; + } + + return $this->change; + } + + /** + *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; + } + + /** + *id of the referenced Type.
Value before the change.
+ * + * + * @return null|mixed + */ + public function getPreviousValue() + { + if (is_null($this->previousValue)) { + /** @psalm-var mixed $data */ + $data = $this->raw(self::FIELD_PREVIOUS_VALUE); + if (is_null($data)) { + return null; + } + $this->previousValue = $data; + } + + return $this->previousValue; + } + + /** + *Value after the change.
+ * + * + * @return null|mixed + */ + public function getNextValue() + { + if (is_null($this->nextValue)) { + /** @psalm-var mixed $data */ + $data = $this->raw(self::FIELD_NEXT_VALUE); + if (is_null($data)) { + return null; + } + $this->nextValue = $data; + } + + return $this->nextValue; + } + + + /** + * @param ?string $change + */ + public function setChange(?string $change): void + { + $this->change = $change; + } + + /** + * @param ?string $name + */ + public function setName(?string $name): void + { + $this->name = $name; + } + + /** + * @param ?string $customTypeId + */ + public function setCustomTypeId(?string $customTypeId): void + { + $this->customTypeId = $customTypeId; + } + + /** + * @param mixed $previousValue + */ + public function setPreviousValue( $previousValue): void + { + $this->previousValue = $previousValue; + } + + /** + * @param mixed $nextValue + */ + public function setNextValue( $nextValue): void + { + $this->nextValue = $nextValue; + } + + + +} diff --git a/lib/commercetools-history/src/Models/Change/SetShippingAddressCustomTypeChange.php b/lib/commercetools-history/src/Models/Change/SetShippingAddressCustomTypeChange.php new file mode 100644 index 00000000000..2098fb5bcfa --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetShippingAddressCustomTypeChange.php @@ -0,0 +1,63 @@ +Value before the change. + * + + * @return null|CustomFields + */ + public function getPreviousValue(); + + /** + *Value after the change.
+ * + + * @return null|CustomFields + */ + public function getNextValue(); + + /** + * @param ?string $change + */ + public function setChange(?string $change): void; + + /** + * @param ?CustomFields $previousValue + */ + public function setPreviousValue(?CustomFields $previousValue): void; + + /** + * @param ?CustomFields $nextValue + */ + public function setNextValue(?CustomFields $nextValue): void; +} diff --git a/lib/commercetools-history/src/Models/Change/SetShippingAddressCustomTypeChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetShippingAddressCustomTypeChangeBuilder.php new file mode 100644 index 00000000000..d058825961b --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetShippingAddressCustomTypeChangeBuilder.php @@ -0,0 +1,142 @@ + + */ +final class SetShippingAddressCustomTypeChangeBuilder implements Builder +{ + /** + + * @var ?string + */ + private $change; + + /** + + * @var null|CustomFields|CustomFieldsBuilder + */ + private $previousValue; + + /** + + * @var null|CustomFields|CustomFieldsBuilder + */ + private $nextValue; + + /** + + * @return null|string + */ + public function getChange() + { + return $this->change; + } + + /** + *Value before the change.
+ * + + * @return null|CustomFields + */ + public function getPreviousValue() + { + return $this->previousValue instanceof CustomFieldsBuilder ? $this->previousValue->build() : $this->previousValue; + } + + /** + *Value after the change.
+ * + + * @return null|CustomFields + */ + public function getNextValue() + { + return $this->nextValue instanceof CustomFieldsBuilder ? $this->nextValue->build() : $this->nextValue; + } + + /** + * @param ?string $change + * @return $this + */ + public function withChange(?string $change) + { + $this->change = $change; + + return $this; + } + + /** + * @param ?CustomFields $previousValue + * @return $this + */ + public function withPreviousValue(?CustomFields $previousValue) + { + $this->previousValue = $previousValue; + + return $this; + } + + /** + * @param ?CustomFields $nextValue + * @return $this + */ + public function withNextValue(?CustomFields $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + /** + * @deprecated use withPreviousValue() instead + * @return $this + */ + public function withPreviousValueBuilder(?CustomFieldsBuilder $previousValue) + { + $this->previousValue = $previousValue; + + return $this; + } + + /** + * @deprecated use withNextValue() instead + * @return $this + */ + public function withNextValueBuilder(?CustomFieldsBuilder $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + public function build(): SetShippingAddressCustomTypeChange + { + return new SetShippingAddressCustomTypeChangeModel( + $this->change, + $this->previousValue instanceof CustomFieldsBuilder ? $this->previousValue->build() : $this->previousValue, + $this->nextValue instanceof CustomFieldsBuilder ? $this->nextValue->build() : $this->nextValue + ); + } + + public static function of(): SetShippingAddressCustomTypeChangeBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetShippingAddressCustomTypeChangeCollection.php b/lib/commercetools-history/src/Models/Change/SetShippingAddressCustomTypeChangeCollection.php new file mode 100644 index 00000000000..adb10918457 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetShippingAddressCustomTypeChangeCollection.php @@ -0,0 +1,56 @@ + + * @method SetShippingAddressCustomTypeChange current() + * @method SetShippingAddressCustomTypeChange end() + * @method SetShippingAddressCustomTypeChange at($offset) + */ +class SetShippingAddressCustomTypeChangeCollection extends ChangeCollection +{ + /** + * @psalm-assert SetShippingAddressCustomTypeChange $value + * @psalm-param SetShippingAddressCustomTypeChange|stdClass $value + * @throws InvalidArgumentException + * + * @return SetShippingAddressCustomTypeChangeCollection + */ + public function add($value) + { + if (!$value instanceof SetShippingAddressCustomTypeChange) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?SetShippingAddressCustomTypeChange + */ + protected function mapper() + { + return function (?int $index): ?SetShippingAddressCustomTypeChange { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var SetShippingAddressCustomTypeChange $data */ + $data = SetShippingAddressCustomTypeChangeModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetShippingAddressCustomTypeChangeModel.php b/lib/commercetools-history/src/Models/Change/SetShippingAddressCustomTypeChangeModel.php new file mode 100644 index 00000000000..05796059370 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetShippingAddressCustomTypeChangeModel.php @@ -0,0 +1,171 @@ +change = $change; + $this->previousValue = $previousValue; + $this->nextValue = $nextValue; + $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; + } + + /** + * + * @return null|string + */ + public function getChange() + { + if (is_null($this->change)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CHANGE); + if (is_null($data)) { + return null; + } + $this->change = (string) $data; + } + + return $this->change; + } + + /** + *Value before the change.
+ * + * + * @return null|CustomFields + */ + public function getPreviousValue() + { + if (is_null($this->previousValue)) { + /** @psalm-var stdClass|arrayValue after the change.
+ * + * + * @return null|CustomFields + */ + public function getNextValue() + { + if (is_null($this->nextValue)) { + /** @psalm-var stdClass|arrayshippingKey of the updated Shipping.
+ *
+
+ * @return null|string
+ */
+ public function getShippingKey();
+
+ /**
+ * Name of the Custom Field.
+ * + + * @return null|string + */ + public function getName(); + + /** + *id of the referenced Type.
Value before the change.
+ * + + * @return null|mixed + */ + public function getPreviousValue(); + + /** + *Value after the change.
+ * + + * @return null|mixed + */ + public function getNextValue(); + + /** + * @param ?string $change + */ + public function setChange(?string $change): void; + + /** + * @param ?string $shippingKey + */ + public function setShippingKey(?string $shippingKey): void; + + /** + * @param ?string $name + */ + public function setName(?string $name): void; + + /** + * @param ?string $customTypeId + */ + public function setCustomTypeId(?string $customTypeId): void; + + /** + * @param mixed $previousValue + */ + public function setPreviousValue( $previousValue): void; + + /** + * @param mixed $nextValue + */ + public function setNextValue( $nextValue): void; +} diff --git a/lib/commercetools-history/src/Models/Change/SetShippingCustomFieldChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetShippingCustomFieldChangeBuilder.php new file mode 100644 index 00000000000..d9466ed7f24 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetShippingCustomFieldChangeBuilder.php @@ -0,0 +1,206 @@ + + */ +final class SetShippingCustomFieldChangeBuilder implements Builder +{ + /** + + * @var ?string + */ + private $change; + + /** + + * @var ?string + */ + private $shippingKey; + + /** + + * @var ?string + */ + private $name; + + /** + + * @var ?string + */ + private $customTypeId; + + /** + + * @var null|mixed|mixed + */ + private $previousValue; + + /** + + * @var null|mixed|mixed + */ + private $nextValue; + + /** + + * @return null|string + */ + public function getChange() + { + return $this->change; + } + + /** + *shippingKey of the updated Shipping.
Name of the Custom Field.
+ * + + * @return null|string + */ + public function getName() + { + return $this->name; + } + + /** + *id of the referenced Type.
Value before the change.
+ * + + * @return null|mixed + */ + public function getPreviousValue() + { + return $this->previousValue; + } + + /** + *Value after the change.
+ * + + * @return null|mixed + */ + public function getNextValue() + { + return $this->nextValue; + } + + /** + * @param ?string $change + * @return $this + */ + public function withChange(?string $change) + { + $this->change = $change; + + return $this; + } + + /** + * @param ?string $shippingKey + * @return $this + */ + public function withShippingKey(?string $shippingKey) + { + $this->shippingKey = $shippingKey; + + return $this; + } + + /** + * @param ?string $name + * @return $this + */ + public function withName(?string $name) + { + $this->name = $name; + + return $this; + } + + /** + * @param ?string $customTypeId + * @return $this + */ + public function withCustomTypeId(?string $customTypeId) + { + $this->customTypeId = $customTypeId; + + return $this; + } + + /** + * @param mixed $previousValue + * @return $this + */ + public function withPreviousValue( $previousValue) + { + $this->previousValue = $previousValue; + + return $this; + } + + /** + * @param mixed $nextValue + * @return $this + */ + public function withNextValue( $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + + public function build(): SetShippingCustomFieldChange + { + return new SetShippingCustomFieldChangeModel( + $this->change, + $this->shippingKey, + $this->name, + $this->customTypeId, + $this->previousValue, + $this->nextValue + ); + } + + public static function of(): SetShippingCustomFieldChangeBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetShippingCustomFieldChangeCollection.php b/lib/commercetools-history/src/Models/Change/SetShippingCustomFieldChangeCollection.php new file mode 100644 index 00000000000..d0e17365593 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetShippingCustomFieldChangeCollection.php @@ -0,0 +1,56 @@ + + * @method SetShippingCustomFieldChange current() + * @method SetShippingCustomFieldChange end() + * @method SetShippingCustomFieldChange at($offset) + */ +class SetShippingCustomFieldChangeCollection extends ChangeCollection +{ + /** + * @psalm-assert SetShippingCustomFieldChange $value + * @psalm-param SetShippingCustomFieldChange|stdClass $value + * @throws InvalidArgumentException + * + * @return SetShippingCustomFieldChangeCollection + */ + public function add($value) + { + if (!$value instanceof SetShippingCustomFieldChange) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?SetShippingCustomFieldChange + */ + protected function mapper() + { + return function (?int $index): ?SetShippingCustomFieldChange { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var SetShippingCustomFieldChange $data */ + $data = SetShippingCustomFieldChangeModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetShippingCustomFieldChangeModel.php b/lib/commercetools-history/src/Models/Change/SetShippingCustomFieldChangeModel.php new file mode 100644 index 00000000000..77d05632546 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetShippingCustomFieldChangeModel.php @@ -0,0 +1,275 @@ +change = $change; + $this->shippingKey = $shippingKey; + $this->name = $name; + $this->customTypeId = $customTypeId; + $this->previousValue = $previousValue; + $this->nextValue = $nextValue; + $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; + } + + /** + * + * @return null|string + */ + public function getChange() + { + if (is_null($this->change)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CHANGE); + if (is_null($data)) { + return null; + } + $this->change = (string) $data; + } + + return $this->change; + } + + /** + *shippingKey of the updated Shipping.
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; + } + + /** + *id of the referenced Type.
Value before the change.
+ * + * + * @return null|mixed + */ + public function getPreviousValue() + { + if (is_null($this->previousValue)) { + /** @psalm-var mixed $data */ + $data = $this->raw(self::FIELD_PREVIOUS_VALUE); + if (is_null($data)) { + return null; + } + $this->previousValue = $data; + } + + return $this->previousValue; + } + + /** + *Value after the change.
+ * + * + * @return null|mixed + */ + public function getNextValue() + { + if (is_null($this->nextValue)) { + /** @psalm-var mixed $data */ + $data = $this->raw(self::FIELD_NEXT_VALUE); + if (is_null($data)) { + return null; + } + $this->nextValue = $data; + } + + return $this->nextValue; + } + + + /** + * @param ?string $change + */ + public function setChange(?string $change): void + { + $this->change = $change; + } + + /** + * @param ?string $shippingKey + */ + public function setShippingKey(?string $shippingKey): void + { + $this->shippingKey = $shippingKey; + } + + /** + * @param ?string $name + */ + public function setName(?string $name): void + { + $this->name = $name; + } + + /** + * @param ?string $customTypeId + */ + public function setCustomTypeId(?string $customTypeId): void + { + $this->customTypeId = $customTypeId; + } + + /** + * @param mixed $previousValue + */ + public function setPreviousValue( $previousValue): void + { + $this->previousValue = $previousValue; + } + + /** + * @param mixed $nextValue + */ + public function setNextValue( $nextValue): void + { + $this->nextValue = $nextValue; + } + + + +} diff --git a/lib/commercetools-history/src/Models/Change/SetShippingCustomTypeChange.php b/lib/commercetools-history/src/Models/Change/SetShippingCustomTypeChange.php new file mode 100644 index 00000000000..d76305a2b0c --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetShippingCustomTypeChange.php @@ -0,0 +1,77 @@ +shippingKey of the updated Shipping.
+ *
+
+ * @return null|string
+ */
+ public function getShippingKey();
+
+ /**
+ * Value before the change.
+ * + + * @return null|CustomFields + */ + public function getPreviousValue(); + + /** + *Value after the change.
+ * + + * @return null|CustomFields + */ + public function getNextValue(); + + /** + * @param ?string $change + */ + public function setChange(?string $change): void; + + /** + * @param ?string $shippingKey + */ + public function setShippingKey(?string $shippingKey): void; + + /** + * @param ?CustomFields $previousValue + */ + public function setPreviousValue(?CustomFields $previousValue): void; + + /** + * @param ?CustomFields $nextValue + */ + public function setNextValue(?CustomFields $nextValue): void; +} diff --git a/lib/commercetools-history/src/Models/Change/SetShippingCustomTypeChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetShippingCustomTypeChangeBuilder.php new file mode 100644 index 00000000000..5c94f176603 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetShippingCustomTypeChangeBuilder.php @@ -0,0 +1,171 @@ + + */ +final class SetShippingCustomTypeChangeBuilder implements Builder +{ + /** + + * @var ?string + */ + private $change; + + /** + + * @var ?string + */ + private $shippingKey; + + /** + + * @var null|CustomFields|CustomFieldsBuilder + */ + private $previousValue; + + /** + + * @var null|CustomFields|CustomFieldsBuilder + */ + private $nextValue; + + /** + + * @return null|string + */ + public function getChange() + { + return $this->change; + } + + /** + *shippingKey of the updated Shipping.
Value before the change.
+ * + + * @return null|CustomFields + */ + public function getPreviousValue() + { + return $this->previousValue instanceof CustomFieldsBuilder ? $this->previousValue->build() : $this->previousValue; + } + + /** + *Value after the change.
+ * + + * @return null|CustomFields + */ + public function getNextValue() + { + return $this->nextValue instanceof CustomFieldsBuilder ? $this->nextValue->build() : $this->nextValue; + } + + /** + * @param ?string $change + * @return $this + */ + public function withChange(?string $change) + { + $this->change = $change; + + return $this; + } + + /** + * @param ?string $shippingKey + * @return $this + */ + public function withShippingKey(?string $shippingKey) + { + $this->shippingKey = $shippingKey; + + return $this; + } + + /** + * @param ?CustomFields $previousValue + * @return $this + */ + public function withPreviousValue(?CustomFields $previousValue) + { + $this->previousValue = $previousValue; + + return $this; + } + + /** + * @param ?CustomFields $nextValue + * @return $this + */ + public function withNextValue(?CustomFields $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + /** + * @deprecated use withPreviousValue() instead + * @return $this + */ + public function withPreviousValueBuilder(?CustomFieldsBuilder $previousValue) + { + $this->previousValue = $previousValue; + + return $this; + } + + /** + * @deprecated use withNextValue() instead + * @return $this + */ + public function withNextValueBuilder(?CustomFieldsBuilder $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + public function build(): SetShippingCustomTypeChange + { + return new SetShippingCustomTypeChangeModel( + $this->change, + $this->shippingKey, + $this->previousValue instanceof CustomFieldsBuilder ? $this->previousValue->build() : $this->previousValue, + $this->nextValue instanceof CustomFieldsBuilder ? $this->nextValue->build() : $this->nextValue + ); + } + + public static function of(): SetShippingCustomTypeChangeBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetShippingCustomTypeChangeCollection.php b/lib/commercetools-history/src/Models/Change/SetShippingCustomTypeChangeCollection.php new file mode 100644 index 00000000000..a65e262e1b8 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetShippingCustomTypeChangeCollection.php @@ -0,0 +1,56 @@ + + * @method SetShippingCustomTypeChange current() + * @method SetShippingCustomTypeChange end() + * @method SetShippingCustomTypeChange at($offset) + */ +class SetShippingCustomTypeChangeCollection extends ChangeCollection +{ + /** + * @psalm-assert SetShippingCustomTypeChange $value + * @psalm-param SetShippingCustomTypeChange|stdClass $value + * @throws InvalidArgumentException + * + * @return SetShippingCustomTypeChangeCollection + */ + public function add($value) + { + if (!$value instanceof SetShippingCustomTypeChange) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?SetShippingCustomTypeChange + */ + protected function mapper() + { + return function (?int $index): ?SetShippingCustomTypeChange { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var SetShippingCustomTypeChange $data */ + $data = SetShippingCustomTypeChangeModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetShippingCustomTypeChangeModel.php b/lib/commercetools-history/src/Models/Change/SetShippingCustomTypeChangeModel.php new file mode 100644 index 00000000000..29bc1e43e31 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetShippingCustomTypeChangeModel.php @@ -0,0 +1,207 @@ +change = $change; + $this->shippingKey = $shippingKey; + $this->previousValue = $previousValue; + $this->nextValue = $nextValue; + $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; + } + + /** + * + * @return null|string + */ + public function getChange() + { + if (is_null($this->change)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CHANGE); + if (is_null($data)) { + return null; + } + $this->change = (string) $data; + } + + return $this->change; + } + + /** + *shippingKey of the updated Shipping.
Value before the change.
+ * + * + * @return null|CustomFields + */ + public function getPreviousValue() + { + if (is_null($this->previousValue)) { + /** @psalm-var stdClass|arrayValue after the change.
+ * + * + * @return null|CustomFields + */ + public function getNextValue() + { + if (is_null($this->nextValue)) { + /** @psalm-var stdClass|arrayValue before the change.
* - * @return null|TaxedPrice + * @return null|TaxedItemPrice */ public function getPreviousValue(); @@ -42,7 +42,7 @@ public function getPreviousValue(); *Value after the change.
* - * @return null|TaxedPrice + * @return null|TaxedItemPrice */ public function getNextValue(); @@ -52,12 +52,12 @@ public function getNextValue(); public function setChange(?string $change): void; /** - * @param ?TaxedPrice $previousValue + * @param ?TaxedItemPrice $previousValue */ - public function setPreviousValue(?TaxedPrice $previousValue): void; + public function setPreviousValue(?TaxedItemPrice $previousValue): void; /** - * @param ?TaxedPrice $nextValue + * @param ?TaxedItemPrice $nextValue */ - public function setNextValue(?TaxedPrice $nextValue): void; + public function setNextValue(?TaxedItemPrice $nextValue): void; } diff --git a/lib/commercetools-history/src/Models/Change/SetShippingInfoTaxedPriceChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetShippingInfoTaxedPriceChangeBuilder.php index 9618c64efb8..a58c76df440 100644 --- a/lib/commercetools-history/src/Models/Change/SetShippingInfoTaxedPriceChangeBuilder.php +++ b/lib/commercetools-history/src/Models/Change/SetShippingInfoTaxedPriceChangeBuilder.php @@ -14,8 +14,8 @@ use Commercetools\Base\JsonObjectModel; use Commercetools\Base\MapperFactory; use stdClass; -use Commercetools\History\Models\Common\TaxedPrice; -use Commercetools\History\Models\Common\TaxedPriceBuilder; +use Commercetools\History\Models\Common\TaxedItemPrice; +use Commercetools\History\Models\Common\TaxedItemPriceBuilder; /** * @implements BuilderValue before the change.
* - * @return null|TaxedPrice + * @return null|TaxedItemPrice */ public function getPreviousValue() { - return $this->previousValue instanceof TaxedPriceBuilder ? $this->previousValue->build() : $this->previousValue; + return $this->previousValue instanceof TaxedItemPriceBuilder ? $this->previousValue->build() : $this->previousValue; } /** *Value after the change.
* - * @return null|TaxedPrice + * @return null|TaxedItemPrice */ public function getNextValue() { - return $this->nextValue instanceof TaxedPriceBuilder ? $this->nextValue->build() : $this->nextValue; + return $this->nextValue instanceof TaxedItemPriceBuilder ? $this->nextValue->build() : $this->nextValue; } /** @@ -83,10 +83,10 @@ public function withChange(?string $change) } /** - * @param ?TaxedPrice $previousValue + * @param ?TaxedItemPrice $previousValue * @return $this */ - public function withPreviousValue(?TaxedPrice $previousValue) + public function withPreviousValue(?TaxedItemPrice $previousValue) { $this->previousValue = $previousValue; @@ -94,10 +94,10 @@ public function withPreviousValue(?TaxedPrice $previousValue) } /** - * @param ?TaxedPrice $nextValue + * @param ?TaxedItemPrice $nextValue * @return $this */ - public function withNextValue(?TaxedPrice $nextValue) + public function withNextValue(?TaxedItemPrice $nextValue) { $this->nextValue = $nextValue; @@ -108,7 +108,7 @@ public function withNextValue(?TaxedPrice $nextValue) * @deprecated use withPreviousValue() instead * @return $this */ - public function withPreviousValueBuilder(?TaxedPriceBuilder $previousValue) + public function withPreviousValueBuilder(?TaxedItemPriceBuilder $previousValue) { $this->previousValue = $previousValue; @@ -119,7 +119,7 @@ public function withPreviousValueBuilder(?TaxedPriceBuilder $previousValue) * @deprecated use withNextValue() instead * @return $this */ - public function withNextValueBuilder(?TaxedPriceBuilder $nextValue) + public function withNextValueBuilder(?TaxedItemPriceBuilder $nextValue) { $this->nextValue = $nextValue; @@ -130,8 +130,8 @@ public function build(): SetShippingInfoTaxedPriceChange { return new SetShippingInfoTaxedPriceChangeModel( $this->change, - $this->previousValue instanceof TaxedPriceBuilder ? $this->previousValue->build() : $this->previousValue, - $this->nextValue instanceof TaxedPriceBuilder ? $this->nextValue->build() : $this->nextValue + $this->previousValue instanceof TaxedItemPriceBuilder ? $this->previousValue->build() : $this->previousValue, + $this->nextValue instanceof TaxedItemPriceBuilder ? $this->nextValue->build() : $this->nextValue ); } diff --git a/lib/commercetools-history/src/Models/Change/SetShippingInfoTaxedPriceChangeModel.php b/lib/commercetools-history/src/Models/Change/SetShippingInfoTaxedPriceChangeModel.php index 696a18985bd..efc720ff11f 100644 --- a/lib/commercetools-history/src/Models/Change/SetShippingInfoTaxedPriceChangeModel.php +++ b/lib/commercetools-history/src/Models/Change/SetShippingInfoTaxedPriceChangeModel.php @@ -13,8 +13,8 @@ use Commercetools\Base\JsonObjectModel; use Commercetools\Base\MapperFactory; use stdClass; -use Commercetools\History\Models\Common\TaxedPrice; -use Commercetools\History\Models\Common\TaxedPriceModel; +use Commercetools\History\Models\Common\TaxedItemPrice; +use Commercetools\History\Models\Common\TaxedItemPriceModel; /** * @internal @@ -37,13 +37,13 @@ final class SetShippingInfoTaxedPriceChangeModel extends JsonObjectModel impleme /** * - * @var ?TaxedPrice + * @var ?TaxedItemPrice */ protected $previousValue; /** * - * @var ?TaxedPrice + * @var ?TaxedItemPrice */ protected $nextValue; @@ -53,8 +53,8 @@ final class SetShippingInfoTaxedPriceChangeModel extends JsonObjectModel impleme */ public function __construct( ?string $change = null, - ?TaxedPrice $previousValue = null, - ?TaxedPrice $nextValue = null, + ?TaxedItemPrice $previousValue = null, + ?TaxedItemPrice $nextValue = null, ?string $type = null ) { $this->change = $change; @@ -103,7 +103,7 @@ public function getChange() *Value before the change.
* * - * @return null|TaxedPrice + * @return null|TaxedItemPrice */ public function getPreviousValue() { @@ -114,7 +114,7 @@ public function getPreviousValue() return null; } - $this->previousValue = TaxedPriceModel::of($data); + $this->previousValue = TaxedItemPriceModel::of($data); } return $this->previousValue; @@ -124,7 +124,7 @@ public function getPreviousValue() *Value after the change.
* * - * @return null|TaxedPrice + * @return null|TaxedItemPrice */ public function getNextValue() { @@ -135,7 +135,7 @@ public function getNextValue() return null; } - $this->nextValue = TaxedPriceModel::of($data); + $this->nextValue = TaxedItemPriceModel::of($data); } return $this->nextValue; @@ -151,17 +151,17 @@ public function setChange(?string $change): void } /** - * @param ?TaxedPrice $previousValue + * @param ?TaxedItemPrice $previousValue */ - public function setPreviousValue(?TaxedPrice $previousValue): void + public function setPreviousValue(?TaxedItemPrice $previousValue): void { $this->previousValue = $previousValue; } /** - * @param ?TaxedPrice $nextValue + * @param ?TaxedItemPrice $nextValue */ - public function setNextValue(?TaxedPrice $nextValue): void + public function setNextValue(?TaxedItemPrice $nextValue): void { $this->nextValue = $nextValue; } diff --git a/lib/commercetools-history/src/Models/Change/SetShippingRateChange.php b/lib/commercetools-history/src/Models/Change/SetShippingRateChange.php index 57323ce072a..226e8d99137 100644 --- a/lib/commercetools-history/src/Models/Change/SetShippingRateChange.php +++ b/lib/commercetools-history/src/Models/Change/SetShippingRateChange.php @@ -10,7 +10,7 @@ use Commercetools\Base\JsonObject; use Commercetools\Base\DateTimeImmutableCollection; -use Commercetools\History\Models\Common\Money; +use Commercetools\History\Models\Common\ShippingRate; interface SetShippingRateChange extends Change { @@ -34,7 +34,7 @@ public function getChange(); *Value before the change.
* - * @return null|Money + * @return null|ShippingRate */ public function getPreviousValue(); @@ -42,7 +42,7 @@ public function getPreviousValue(); *Value after the change.
* - * @return null|Money + * @return null|ShippingRate */ public function getNextValue(); @@ -52,12 +52,12 @@ public function getNextValue(); public function setChange(?string $change): void; /** - * @param ?Money $previousValue + * @param ?ShippingRate $previousValue */ - public function setPreviousValue(?Money $previousValue): void; + public function setPreviousValue(?ShippingRate $previousValue): void; /** - * @param ?Money $nextValue + * @param ?ShippingRate $nextValue */ - public function setNextValue(?Money $nextValue): void; + public function setNextValue(?ShippingRate $nextValue): void; } diff --git a/lib/commercetools-history/src/Models/Change/SetShippingRateChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetShippingRateChangeBuilder.php index 3f8dc4de71b..4ab5241d597 100644 --- a/lib/commercetools-history/src/Models/Change/SetShippingRateChangeBuilder.php +++ b/lib/commercetools-history/src/Models/Change/SetShippingRateChangeBuilder.php @@ -14,8 +14,8 @@ use Commercetools\Base\JsonObjectModel; use Commercetools\Base\MapperFactory; use stdClass; -use Commercetools\History\Models\Common\Money; -use Commercetools\History\Models\Common\MoneyBuilder; +use Commercetools\History\Models\Common\ShippingRate; +use Commercetools\History\Models\Common\ShippingRateBuilder; /** * @implements BuilderValue before the change.
* - * @return null|Money + * @return null|ShippingRate */ public function getPreviousValue() { - return $this->previousValue instanceof MoneyBuilder ? $this->previousValue->build() : $this->previousValue; + return $this->previousValue instanceof ShippingRateBuilder ? $this->previousValue->build() : $this->previousValue; } /** *Value after the change.
* - * @return null|Money + * @return null|ShippingRate */ public function getNextValue() { - return $this->nextValue instanceof MoneyBuilder ? $this->nextValue->build() : $this->nextValue; + return $this->nextValue instanceof ShippingRateBuilder ? $this->nextValue->build() : $this->nextValue; } /** @@ -83,10 +83,10 @@ public function withChange(?string $change) } /** - * @param ?Money $previousValue + * @param ?ShippingRate $previousValue * @return $this */ - public function withPreviousValue(?Money $previousValue) + public function withPreviousValue(?ShippingRate $previousValue) { $this->previousValue = $previousValue; @@ -94,10 +94,10 @@ public function withPreviousValue(?Money $previousValue) } /** - * @param ?Money $nextValue + * @param ?ShippingRate $nextValue * @return $this */ - public function withNextValue(?Money $nextValue) + public function withNextValue(?ShippingRate $nextValue) { $this->nextValue = $nextValue; @@ -108,7 +108,7 @@ public function withNextValue(?Money $nextValue) * @deprecated use withPreviousValue() instead * @return $this */ - public function withPreviousValueBuilder(?MoneyBuilder $previousValue) + public function withPreviousValueBuilder(?ShippingRateBuilder $previousValue) { $this->previousValue = $previousValue; @@ -119,7 +119,7 @@ public function withPreviousValueBuilder(?MoneyBuilder $previousValue) * @deprecated use withNextValue() instead * @return $this */ - public function withNextValueBuilder(?MoneyBuilder $nextValue) + public function withNextValueBuilder(?ShippingRateBuilder $nextValue) { $this->nextValue = $nextValue; @@ -130,8 +130,8 @@ public function build(): SetShippingRateChange { return new SetShippingRateChangeModel( $this->change, - $this->previousValue instanceof MoneyBuilder ? $this->previousValue->build() : $this->previousValue, - $this->nextValue instanceof MoneyBuilder ? $this->nextValue->build() : $this->nextValue + $this->previousValue instanceof ShippingRateBuilder ? $this->previousValue->build() : $this->previousValue, + $this->nextValue instanceof ShippingRateBuilder ? $this->nextValue->build() : $this->nextValue ); } diff --git a/lib/commercetools-history/src/Models/Change/SetShippingRateChangeModel.php b/lib/commercetools-history/src/Models/Change/SetShippingRateChangeModel.php index 7123ac925c4..9da15116a80 100644 --- a/lib/commercetools-history/src/Models/Change/SetShippingRateChangeModel.php +++ b/lib/commercetools-history/src/Models/Change/SetShippingRateChangeModel.php @@ -13,8 +13,8 @@ use Commercetools\Base\JsonObjectModel; use Commercetools\Base\MapperFactory; use stdClass; -use Commercetools\History\Models\Common\Money; -use Commercetools\History\Models\Common\MoneyModel; +use Commercetools\History\Models\Common\ShippingRate; +use Commercetools\History\Models\Common\ShippingRateModel; /** * @internal @@ -37,13 +37,13 @@ final class SetShippingRateChangeModel extends JsonObjectModel implements SetShi /** * - * @var ?Money + * @var ?ShippingRate */ protected $previousValue; /** * - * @var ?Money + * @var ?ShippingRate */ protected $nextValue; @@ -53,8 +53,8 @@ final class SetShippingRateChangeModel extends JsonObjectModel implements SetShi */ public function __construct( ?string $change = null, - ?Money $previousValue = null, - ?Money $nextValue = null, + ?ShippingRate $previousValue = null, + ?ShippingRate $nextValue = null, ?string $type = null ) { $this->change = $change; @@ -103,7 +103,7 @@ public function getChange() *Value before the change.
* * - * @return null|Money + * @return null|ShippingRate */ public function getPreviousValue() { @@ -114,7 +114,7 @@ public function getPreviousValue() return null; } - $this->previousValue = MoneyModel::of($data); + $this->previousValue = ShippingRateModel::of($data); } return $this->previousValue; @@ -124,7 +124,7 @@ public function getPreviousValue() *Value after the change.
* * - * @return null|Money + * @return null|ShippingRate */ public function getNextValue() { @@ -135,7 +135,7 @@ public function getNextValue() return null; } - $this->nextValue = MoneyModel::of($data); + $this->nextValue = ShippingRateModel::of($data); } return $this->nextValue; @@ -151,17 +151,17 @@ public function setChange(?string $change): void } /** - * @param ?Money $previousValue + * @param ?ShippingRate $previousValue */ - public function setPreviousValue(?Money $previousValue): void + public function setPreviousValue(?ShippingRate $previousValue): void { $this->previousValue = $previousValue; } /** - * @param ?Money $nextValue + * @param ?ShippingRate $nextValue */ - public function setNextValue(?Money $nextValue): void + public function setNextValue(?ShippingRate $nextValue): void { $this->nextValue = $nextValue; } diff --git a/lib/commercetools-history/src/Models/Change/SetSkuChange.php b/lib/commercetools-history/src/Models/Change/SetSkuChange.php index 297521c75b6..f9f8f86be7e 100644 --- a/lib/commercetools-history/src/Models/Change/SetSkuChange.php +++ b/lib/commercetools-history/src/Models/Change/SetSkuChange.php @@ -17,6 +17,7 @@ interface SetSkuChange extends Change public const FIELD_PREVIOUS_VALUE = 'previousValue'; public const FIELD_NEXT_VALUE = 'nextValue'; public const FIELD_CATALOG_DATA = 'catalogData'; + public const FIELD_VARIANT = 'variant'; /** @@ -47,6 +48,7 @@ public function getPreviousValue(); public function getNextValue(); /** + *Product data that was updated.
*staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + + * @return null|string + */ + public function getVariant(); + /** * @param ?string $change */ @@ -76,4 +87,9 @@ public function setNextValue(?string $nextValue): void; * @param ?string $catalogData */ public function setCatalogData(?string $catalogData): void; + + /** + * @param ?string $variant + */ + public function setVariant(?string $variant): void; } diff --git a/lib/commercetools-history/src/Models/Change/SetSkuChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetSkuChangeBuilder.php index 7d67b0c3b54..915e86f05d3 100644 --- a/lib/commercetools-history/src/Models/Change/SetSkuChangeBuilder.php +++ b/lib/commercetools-history/src/Models/Change/SetSkuChangeBuilder.php @@ -44,6 +44,12 @@ final class SetSkuChangeBuilder implements Builder */ private $catalogData; + /** + + * @var ?string + */ + private $variant; + /** * @return null|string @@ -76,6 +82,7 @@ public function getNextValue() } /** + *Product data that was updated.
*staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + + * @return null|string + */ + public function getVariant() + { + return $this->variant; + } + /** * @param ?string $change * @return $this @@ -133,6 +152,17 @@ public function withCatalogData(?string $catalogData) return $this; } + /** + * @param ?string $variant + * @return $this + */ + public function withVariant(?string $variant) + { + $this->variant = $variant; + + return $this; + } + public function build(): SetSkuChange { @@ -140,7 +170,8 @@ public function build(): SetSkuChange $this->change, $this->previousValue, $this->nextValue, - $this->catalogData + $this->catalogData, + $this->variant ); } diff --git a/lib/commercetools-history/src/Models/Change/SetSkuChangeModel.php b/lib/commercetools-history/src/Models/Change/SetSkuChangeModel.php index 4c8bf871bd5..998888cac31 100644 --- a/lib/commercetools-history/src/Models/Change/SetSkuChangeModel.php +++ b/lib/commercetools-history/src/Models/Change/SetSkuChangeModel.php @@ -51,6 +51,12 @@ final class SetSkuChangeModel extends JsonObjectModel implements SetSkuChange */ protected $catalogData; + /** + * + * @var ?string + */ + protected $variant; + /** * @psalm-suppress MissingParamType @@ -60,12 +66,14 @@ public function __construct( ?string $previousValue = null, ?string $nextValue = null, ?string $catalogData = null, + ?string $variant = null, ?string $type = null ) { $this->change = $change; $this->previousValue = $previousValue; $this->nextValue = $nextValue; $this->catalogData = $catalogData; + $this->variant = $variant; $this->type = $type ?? self::DISCRIMINATOR_VALUE; } @@ -146,6 +154,7 @@ public function getNextValue() } /** + *Product data that was updated.
*staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
+ * + * + * @return null|string + */ + public function getVariant() + { + if (is_null($this->variant)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_VARIANT); + if (is_null($data)) { + return null; + } + $this->variant = (string) $data; + } + + return $this->variant; + } + /** * @param ?string $change @@ -201,6 +231,14 @@ public function setCatalogData(?string $catalogData): void $this->catalogData = $catalogData; } + /** + * @param ?string $variant + */ + public function setVariant(?string $variant): void + { + $this->variant = $variant; + } + } diff --git a/lib/commercetools-history/src/Models/Change/SetStateRolesChange.php b/lib/commercetools-history/src/Models/Change/SetStateRolesChange.php index bbd087583af..844a75c82e9 100644 --- a/lib/commercetools-history/src/Models/Change/SetStateRolesChange.php +++ b/lib/commercetools-history/src/Models/Change/SetStateRolesChange.php @@ -16,6 +16,8 @@ interface SetStateRolesChange extends Change public const FIELD_PREVIOUS_VALUE = 'previousValue'; public const FIELD_NEXT_VALUE = 'nextValue'; + public const FIELD_ADDED_ITEMS = 'addedItems'; + public const FIELD_REMOVED_ITEMS = 'removedItems'; /** @@ -45,6 +47,22 @@ public function getPreviousValue(); */ public function getNextValue(); + /** + *Elements added to the array.
+ * + + * @return null|array + */ + public function getAddedItems(); + + /** + *Elements removed from the array.
+ * + + * @return null|array + */ + public function getRemovedItems(); + /** * @param ?string $change */ @@ -59,4 +77,14 @@ public function setPreviousValue(?array $previousValue): void; * @param ?array $nextValue */ public function setNextValue(?array $nextValue): void; + + /** + * @param ?array $addedItems + */ + public function setAddedItems(?array $addedItems): void; + + /** + * @param ?array $removedItems + */ + public function setRemovedItems(?array $removedItems): void; } diff --git a/lib/commercetools-history/src/Models/Change/SetStateRolesChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetStateRolesChangeBuilder.php index 793984b72e9..8e9c458bcae 100644 --- a/lib/commercetools-history/src/Models/Change/SetStateRolesChangeBuilder.php +++ b/lib/commercetools-history/src/Models/Change/SetStateRolesChangeBuilder.php @@ -38,6 +38,18 @@ final class SetStateRolesChangeBuilder implements Builder */ private $nextValue; + /** + + * @var ?array + */ + private $addedItems; + + /** + + * @var ?array + */ + private $removedItems; + /** * @return null|string @@ -69,6 +81,28 @@ public function getNextValue() return $this->nextValue; } + /** + *Elements added to the array.
+ * + + * @return null|array + */ + public function getAddedItems() + { + return $this->addedItems; + } + + /** + *Elements removed from the array.
+ * + + * @return null|array + */ + public function getRemovedItems() + { + return $this->removedItems; + } + /** * @param ?string $change * @return $this @@ -102,13 +136,37 @@ public function withNextValue(?array $nextValue) return $this; } + /** + * @param ?array $addedItems + * @return $this + */ + public function withAddedItems(?array $addedItems) + { + $this->addedItems = $addedItems; + + return $this; + } + + /** + * @param ?array $removedItems + * @return $this + */ + public function withRemovedItems(?array $removedItems) + { + $this->removedItems = $removedItems; + + return $this; + } + public function build(): SetStateRolesChange { return new SetStateRolesChangeModel( $this->change, $this->previousValue, - $this->nextValue + $this->nextValue, + $this->addedItems, + $this->removedItems ); } diff --git a/lib/commercetools-history/src/Models/Change/SetStateRolesChangeModel.php b/lib/commercetools-history/src/Models/Change/SetStateRolesChangeModel.php index 4dc41a79c3f..7898359951a 100644 --- a/lib/commercetools-history/src/Models/Change/SetStateRolesChangeModel.php +++ b/lib/commercetools-history/src/Models/Change/SetStateRolesChangeModel.php @@ -45,6 +45,18 @@ final class SetStateRolesChangeModel extends JsonObjectModel implements SetState */ protected $nextValue; + /** + * + * @var ?array + */ + protected $addedItems; + + /** + * + * @var ?array + */ + protected $removedItems; + /** * @psalm-suppress MissingParamType @@ -53,11 +65,15 @@ public function __construct( ?string $change = null, ?array $previousValue = null, ?array $nextValue = null, + ?array $addedItems = null, + ?array $removedItems = null, ?string $type = null ) { $this->change = $change; $this->previousValue = $previousValue; $this->nextValue = $nextValue; + $this->addedItems = $addedItems; + $this->removedItems = $removedItems; $this->type = $type ?? self::DISCRIMINATOR_VALUE; } @@ -137,6 +153,46 @@ public function getNextValue() return $this->nextValue; } + /** + *Elements added to the array.
+ * + * + * @return null|array + */ + public function getAddedItems() + { + if (is_null($this->addedItems)) { + /** @psalm-var ?listElements removed from the array.
+ * + * + * @return null|array + */ + public function getRemovedItems() + { + if (is_null($this->removedItems)) { + /** @psalm-var ?listValue before the change.
* - * @return null|Reference + * @return null|KeyReference */ public function getPreviousValue(); @@ -42,7 +42,7 @@ public function getPreviousValue(); *Value after the change.
* - * @return null|Reference + * @return null|KeyReference */ public function getNextValue(); @@ -52,12 +52,12 @@ public function getNextValue(); public function setChange(?string $change): void; /** - * @param ?Reference $previousValue + * @param ?KeyReference $previousValue */ - public function setPreviousValue(?Reference $previousValue): void; + public function setPreviousValue(?KeyReference $previousValue): void; /** - * @param ?Reference $nextValue + * @param ?KeyReference $nextValue */ - public function setNextValue(?Reference $nextValue): void; + public function setNextValue(?KeyReference $nextValue): void; } diff --git a/lib/commercetools-history/src/Models/Change/SetStoreChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetStoreChangeBuilder.php index 497aeb67117..255bcf99f9f 100644 --- a/lib/commercetools-history/src/Models/Change/SetStoreChangeBuilder.php +++ b/lib/commercetools-history/src/Models/Change/SetStoreChangeBuilder.php @@ -14,8 +14,8 @@ use Commercetools\Base\JsonObjectModel; use Commercetools\Base\MapperFactory; use stdClass; -use Commercetools\History\Models\Common\Reference; -use Commercetools\History\Models\Common\ReferenceBuilder; +use Commercetools\History\Models\Common\KeyReference; +use Commercetools\History\Models\Common\KeyReferenceBuilder; /** * @implements BuilderValue before the change.
* - * @return null|Reference + * @return null|KeyReference */ public function getPreviousValue() { - return $this->previousValue instanceof ReferenceBuilder ? $this->previousValue->build() : $this->previousValue; + return $this->previousValue instanceof KeyReferenceBuilder ? $this->previousValue->build() : $this->previousValue; } /** *Value after the change.
* - * @return null|Reference + * @return null|KeyReference */ public function getNextValue() { - return $this->nextValue instanceof ReferenceBuilder ? $this->nextValue->build() : $this->nextValue; + return $this->nextValue instanceof KeyReferenceBuilder ? $this->nextValue->build() : $this->nextValue; } /** @@ -83,10 +83,10 @@ public function withChange(?string $change) } /** - * @param ?Reference $previousValue + * @param ?KeyReference $previousValue * @return $this */ - public function withPreviousValue(?Reference $previousValue) + public function withPreviousValue(?KeyReference $previousValue) { $this->previousValue = $previousValue; @@ -94,10 +94,10 @@ public function withPreviousValue(?Reference $previousValue) } /** - * @param ?Reference $nextValue + * @param ?KeyReference $nextValue * @return $this */ - public function withNextValue(?Reference $nextValue) + public function withNextValue(?KeyReference $nextValue) { $this->nextValue = $nextValue; @@ -108,7 +108,7 @@ public function withNextValue(?Reference $nextValue) * @deprecated use withPreviousValue() instead * @return $this */ - public function withPreviousValueBuilder(?ReferenceBuilder $previousValue) + public function withPreviousValueBuilder(?KeyReferenceBuilder $previousValue) { $this->previousValue = $previousValue; @@ -119,7 +119,7 @@ public function withPreviousValueBuilder(?ReferenceBuilder $previousValue) * @deprecated use withNextValue() instead * @return $this */ - public function withNextValueBuilder(?ReferenceBuilder $nextValue) + public function withNextValueBuilder(?KeyReferenceBuilder $nextValue) { $this->nextValue = $nextValue; @@ -130,8 +130,8 @@ public function build(): SetStoreChange { return new SetStoreChangeModel( $this->change, - $this->previousValue instanceof ReferenceBuilder ? $this->previousValue->build() : $this->previousValue, - $this->nextValue instanceof ReferenceBuilder ? $this->nextValue->build() : $this->nextValue + $this->previousValue instanceof KeyReferenceBuilder ? $this->previousValue->build() : $this->previousValue, + $this->nextValue instanceof KeyReferenceBuilder ? $this->nextValue->build() : $this->nextValue ); } diff --git a/lib/commercetools-history/src/Models/Change/SetStoreChangeModel.php b/lib/commercetools-history/src/Models/Change/SetStoreChangeModel.php index 5e3343e5399..1bc3c5e3475 100644 --- a/lib/commercetools-history/src/Models/Change/SetStoreChangeModel.php +++ b/lib/commercetools-history/src/Models/Change/SetStoreChangeModel.php @@ -13,8 +13,8 @@ use Commercetools\Base\JsonObjectModel; use Commercetools\Base\MapperFactory; use stdClass; -use Commercetools\History\Models\Common\Reference; -use Commercetools\History\Models\Common\ReferenceModel; +use Commercetools\History\Models\Common\KeyReference; +use Commercetools\History\Models\Common\KeyReferenceModel; /** * @internal @@ -37,13 +37,13 @@ final class SetStoreChangeModel extends JsonObjectModel implements SetStoreChang /** * - * @var ?Reference + * @var ?KeyReference */ protected $previousValue; /** * - * @var ?Reference + * @var ?KeyReference */ protected $nextValue; @@ -53,8 +53,8 @@ final class SetStoreChangeModel extends JsonObjectModel implements SetStoreChang */ public function __construct( ?string $change = null, - ?Reference $previousValue = null, - ?Reference $nextValue = null, + ?KeyReference $previousValue = null, + ?KeyReference $nextValue = null, ?string $type = null ) { $this->change = $change; @@ -103,7 +103,7 @@ public function getChange() *Value before the change.
* * - * @return null|Reference + * @return null|KeyReference */ public function getPreviousValue() { @@ -113,8 +113,8 @@ public function getPreviousValue() if (is_null($data)) { return null; } - - $this->previousValue = ReferenceModel::of($data); + $className = KeyReferenceModel::resolveDiscriminatorClass($data); + $this->previousValue = $className::of($data); } return $this->previousValue; @@ -124,7 +124,7 @@ public function getPreviousValue() *Value after the change.
* * - * @return null|Reference + * @return null|KeyReference */ public function getNextValue() { @@ -134,8 +134,8 @@ public function getNextValue() if (is_null($data)) { return null; } - - $this->nextValue = ReferenceModel::of($data); + $className = KeyReferenceModel::resolveDiscriminatorClass($data); + $this->nextValue = $className::of($data); } return $this->nextValue; @@ -151,17 +151,17 @@ public function setChange(?string $change): void } /** - * @param ?Reference $previousValue + * @param ?KeyReference $previousValue */ - public function setPreviousValue(?Reference $previousValue): void + public function setPreviousValue(?KeyReference $previousValue): void { $this->previousValue = $previousValue; } /** - * @param ?Reference $nextValue + * @param ?KeyReference $nextValue */ - public function setNextValue(?Reference $nextValue): void + public function setNextValue(?KeyReference $nextValue): void { $this->nextValue = $nextValue; } diff --git a/lib/commercetools-history/src/Models/Change/SetStoresChange.php b/lib/commercetools-history/src/Models/Change/SetStoresChange.php index cca1d60f477..ee852682980 100644 --- a/lib/commercetools-history/src/Models/Change/SetStoresChange.php +++ b/lib/commercetools-history/src/Models/Change/SetStoresChange.php @@ -10,6 +10,7 @@ use Commercetools\Base\JsonObject; use Commercetools\Base\DateTimeImmutableCollection; +use Commercetools\History\Models\Common\KeyReferenceCollection; use Commercetools\History\Models\Common\ReferenceCollection; interface SetStoresChange extends Change @@ -17,6 +18,8 @@ interface SetStoresChange extends Change public const FIELD_PREVIOUS_VALUE = 'previousValue'; public const FIELD_NEXT_VALUE = 'nextValue'; + public const FIELD_ADDED_ITEMS = 'addedItems'; + public const FIELD_REMOVED_ITEMS = 'removedItems'; /** @@ -46,6 +49,22 @@ public function getPreviousValue(); */ public function getNextValue(); + /** + *Elements added to the array.
+ * + + * @return null|KeyReferenceCollection + */ + public function getAddedItems(); + + /** + *Elements removed from the array.
+ * + + * @return null|KeyReferenceCollection + */ + public function getRemovedItems(); + /** * @param ?string $change */ @@ -60,4 +79,14 @@ public function setPreviousValue(?ReferenceCollection $previousValue): void; * @param ?ReferenceCollection $nextValue */ public function setNextValue(?ReferenceCollection $nextValue): void; + + /** + * @param ?KeyReferenceCollection $addedItems + */ + public function setAddedItems(?KeyReferenceCollection $addedItems): void; + + /** + * @param ?KeyReferenceCollection $removedItems + */ + public function setRemovedItems(?KeyReferenceCollection $removedItems): void; } diff --git a/lib/commercetools-history/src/Models/Change/SetStoresChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetStoresChangeBuilder.php index 77f86275449..fcafcc0b4a3 100644 --- a/lib/commercetools-history/src/Models/Change/SetStoresChangeBuilder.php +++ b/lib/commercetools-history/src/Models/Change/SetStoresChangeBuilder.php @@ -14,6 +14,7 @@ use Commercetools\Base\JsonObjectModel; use Commercetools\Base\MapperFactory; use stdClass; +use Commercetools\History\Models\Common\KeyReferenceCollection; use Commercetools\History\Models\Common\ReferenceCollection; /** @@ -39,6 +40,18 @@ final class SetStoresChangeBuilder implements Builder */ private $nextValue; + /** + + * @var ?KeyReferenceCollection + */ + private $addedItems; + + /** + + * @var ?KeyReferenceCollection + */ + private $removedItems; + /** * @return null|string @@ -70,6 +83,28 @@ public function getNextValue() return $this->nextValue; } + /** + *Elements added to the array.
+ * + + * @return null|KeyReferenceCollection + */ + public function getAddedItems() + { + return $this->addedItems; + } + + /** + *Elements removed from the array.
+ * + + * @return null|KeyReferenceCollection + */ + public function getRemovedItems() + { + return $this->removedItems; + } + /** * @param ?string $change * @return $this @@ -103,13 +138,37 @@ public function withNextValue(?ReferenceCollection $nextValue) return $this; } + /** + * @param ?KeyReferenceCollection $addedItems + * @return $this + */ + public function withAddedItems(?KeyReferenceCollection $addedItems) + { + $this->addedItems = $addedItems; + + return $this; + } + + /** + * @param ?KeyReferenceCollection $removedItems + * @return $this + */ + public function withRemovedItems(?KeyReferenceCollection $removedItems) + { + $this->removedItems = $removedItems; + + return $this; + } + public function build(): SetStoresChange { return new SetStoresChangeModel( $this->change, $this->previousValue, - $this->nextValue + $this->nextValue, + $this->addedItems, + $this->removedItems ); } diff --git a/lib/commercetools-history/src/Models/Change/SetStoresChangeModel.php b/lib/commercetools-history/src/Models/Change/SetStoresChangeModel.php index d9d44c834f4..c52826a47ab 100644 --- a/lib/commercetools-history/src/Models/Change/SetStoresChangeModel.php +++ b/lib/commercetools-history/src/Models/Change/SetStoresChangeModel.php @@ -13,6 +13,7 @@ use Commercetools\Base\JsonObjectModel; use Commercetools\Base\MapperFactory; use stdClass; +use Commercetools\History\Models\Common\KeyReferenceCollection; use Commercetools\History\Models\Common\ReferenceCollection; /** @@ -46,6 +47,18 @@ final class SetStoresChangeModel extends JsonObjectModel implements SetStoresCha */ protected $nextValue; + /** + * + * @var ?KeyReferenceCollection + */ + protected $addedItems; + + /** + * + * @var ?KeyReferenceCollection + */ + protected $removedItems; + /** * @psalm-suppress MissingParamType @@ -54,11 +67,15 @@ public function __construct( ?string $change = null, ?ReferenceCollection $previousValue = null, ?ReferenceCollection $nextValue = null, + ?KeyReferenceCollection $addedItems = null, + ?KeyReferenceCollection $removedItems = null, ?string $type = null ) { $this->change = $change; $this->previousValue = $previousValue; $this->nextValue = $nextValue; + $this->addedItems = $addedItems; + $this->removedItems = $removedItems; $this->type = $type ?? self::DISCRIMINATOR_VALUE; } @@ -138,6 +155,46 @@ public function getNextValue() return $this->nextValue; } + /** + *Elements added to the array.
+ * + * + * @return null|KeyReferenceCollection + */ + public function getAddedItems() + { + if (is_null($this->addedItems)) { + /** @psalm-var ?listElements removed from the array.
+ * + * + * @return null|KeyReferenceCollection + */ + public function getRemovedItems() + { + if (is_null($this->removedItems)) { + /** @psalm-var ?listElements added to the array.
+ * + + * @return null|ReferenceCollection + */ + public function getAddedItems(); + + /** + *Elements removed from the array.
+ * + + * @return null|ReferenceCollection + */ + public function getRemovedItems(); + /** * @param ?string $change */ @@ -60,4 +78,14 @@ public function setPreviousValue(?ReferenceCollection $previousValue): void; * @param ?ReferenceCollection $nextValue */ public function setNextValue(?ReferenceCollection $nextValue): void; + + /** + * @param ?ReferenceCollection $addedItems + */ + public function setAddedItems(?ReferenceCollection $addedItems): void; + + /** + * @param ?ReferenceCollection $removedItems + */ + public function setRemovedItems(?ReferenceCollection $removedItems): void; } diff --git a/lib/commercetools-history/src/Models/Change/SetSupplyChannelsChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetSupplyChannelsChangeBuilder.php index 5ead69dc61c..7bca1595aca 100644 --- a/lib/commercetools-history/src/Models/Change/SetSupplyChannelsChangeBuilder.php +++ b/lib/commercetools-history/src/Models/Change/SetSupplyChannelsChangeBuilder.php @@ -39,6 +39,18 @@ final class SetSupplyChannelsChangeBuilder implements Builder */ private $nextValue; + /** + + * @var ?ReferenceCollection + */ + private $addedItems; + + /** + + * @var ?ReferenceCollection + */ + private $removedItems; + /** * @return null|string @@ -70,6 +82,28 @@ public function getNextValue() return $this->nextValue; } + /** + *Elements added to the array.
+ * + + * @return null|ReferenceCollection + */ + public function getAddedItems() + { + return $this->addedItems; + } + + /** + *Elements removed from the array.
+ * + + * @return null|ReferenceCollection + */ + public function getRemovedItems() + { + return $this->removedItems; + } + /** * @param ?string $change * @return $this @@ -103,13 +137,37 @@ public function withNextValue(?ReferenceCollection $nextValue) return $this; } + /** + * @param ?ReferenceCollection $addedItems + * @return $this + */ + public function withAddedItems(?ReferenceCollection $addedItems) + { + $this->addedItems = $addedItems; + + return $this; + } + + /** + * @param ?ReferenceCollection $removedItems + * @return $this + */ + public function withRemovedItems(?ReferenceCollection $removedItems) + { + $this->removedItems = $removedItems; + + return $this; + } + public function build(): SetSupplyChannelsChange { return new SetSupplyChannelsChangeModel( $this->change, $this->previousValue, - $this->nextValue + $this->nextValue, + $this->addedItems, + $this->removedItems ); } diff --git a/lib/commercetools-history/src/Models/Change/SetSupplyChannelsChangeModel.php b/lib/commercetools-history/src/Models/Change/SetSupplyChannelsChangeModel.php index 492a1139b2a..ec8bd4a2d44 100644 --- a/lib/commercetools-history/src/Models/Change/SetSupplyChannelsChangeModel.php +++ b/lib/commercetools-history/src/Models/Change/SetSupplyChannelsChangeModel.php @@ -46,6 +46,18 @@ final class SetSupplyChannelsChangeModel extends JsonObjectModel implements SetS */ protected $nextValue; + /** + * + * @var ?ReferenceCollection + */ + protected $addedItems; + + /** + * + * @var ?ReferenceCollection + */ + protected $removedItems; + /** * @psalm-suppress MissingParamType @@ -54,11 +66,15 @@ public function __construct( ?string $change = null, ?ReferenceCollection $previousValue = null, ?ReferenceCollection $nextValue = null, + ?ReferenceCollection $addedItems = null, + ?ReferenceCollection $removedItems = null, ?string $type = null ) { $this->change = $change; $this->previousValue = $previousValue; $this->nextValue = $nextValue; + $this->addedItems = $addedItems; + $this->removedItems = $removedItems; $this->type = $type ?? self::DISCRIMINATOR_VALUE; } @@ -138,6 +154,46 @@ public function getNextValue() return $this->nextValue; } + /** + *Elements added to the array.
+ * + * + * @return null|ReferenceCollection + */ + public function getAddedItems() + { + if (is_null($this->addedItems)) { + /** @psalm-var ?listElements removed from the array.
+ * + * + * @return null|ReferenceCollection + */ + public function getRemovedItems() + { + if (is_null($this->removedItems)) { + /** @psalm-var ?listName of the Custom Field.
+ * + + * @return null|string + */ + public function getName(); + + /** + *id of the referenced Type.
Value before the change.
+ * + + * @return null|mixed + */ + public function getPreviousValue(); + + /** + *Value after the change.
+ * + + * @return null|mixed + */ + public function getNextValue(); + + /** + * @param ?string $change + */ + public function setChange(?string $change): void; + + /** + * @param ?TransactionChangeValue $transaction + */ + public function setTransaction(?TransactionChangeValue $transaction): void; + + /** + * @param ?string $name + */ + public function setName(?string $name): void; + + /** + * @param ?string $customTypeId + */ + public function setCustomTypeId(?string $customTypeId): void; + + /** + * @param mixed $previousValue + */ + public function setPreviousValue( $previousValue): void; + + /** + * @param mixed $nextValue + */ + public function setNextValue( $nextValue): void; +} diff --git a/lib/commercetools-history/src/Models/Change/SetTransactionCustomFieldChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetTransactionCustomFieldChangeBuilder.php new file mode 100644 index 00000000000..78718d9c66d --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetTransactionCustomFieldChangeBuilder.php @@ -0,0 +1,218 @@ + + */ +final class SetTransactionCustomFieldChangeBuilder implements Builder +{ + /** + + * @var ?string + */ + private $change; + + /** + + * @var null|TransactionChangeValue|TransactionChangeValueBuilder + */ + private $transaction; + + /** + + * @var ?string + */ + private $name; + + /** + + * @var ?string + */ + private $customTypeId; + + /** + + * @var null|mixed|mixed + */ + private $previousValue; + + /** + + * @var null|mixed|mixed + */ + private $nextValue; + + /** + + * @return null|string + */ + public function getChange() + { + return $this->change; + } + + /** + *Holds information about the updated Transaction.
+ * + + * @return null|TransactionChangeValue + */ + public function getTransaction() + { + return $this->transaction instanceof TransactionChangeValueBuilder ? $this->transaction->build() : $this->transaction; + } + + /** + *Name of the Custom Field.
+ * + + * @return null|string + */ + public function getName() + { + return $this->name; + } + + /** + *id of the referenced Type.
Value before the change.
+ * + + * @return null|mixed + */ + public function getPreviousValue() + { + return $this->previousValue; + } + + /** + *Value after the change.
+ * + + * @return null|mixed + */ + public function getNextValue() + { + return $this->nextValue; + } + + /** + * @param ?string $change + * @return $this + */ + public function withChange(?string $change) + { + $this->change = $change; + + return $this; + } + + /** + * @param ?TransactionChangeValue $transaction + * @return $this + */ + public function withTransaction(?TransactionChangeValue $transaction) + { + $this->transaction = $transaction; + + return $this; + } + + /** + * @param ?string $name + * @return $this + */ + public function withName(?string $name) + { + $this->name = $name; + + return $this; + } + + /** + * @param ?string $customTypeId + * @return $this + */ + public function withCustomTypeId(?string $customTypeId) + { + $this->customTypeId = $customTypeId; + + return $this; + } + + /** + * @param mixed $previousValue + * @return $this + */ + public function withPreviousValue( $previousValue) + { + $this->previousValue = $previousValue; + + return $this; + } + + /** + * @param mixed $nextValue + * @return $this + */ + public function withNextValue( $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + /** + * @deprecated use withTransaction() instead + * @return $this + */ + public function withTransactionBuilder(?TransactionChangeValueBuilder $transaction) + { + $this->transaction = $transaction; + + return $this; + } + + public function build(): SetTransactionCustomFieldChange + { + return new SetTransactionCustomFieldChangeModel( + $this->change, + $this->transaction instanceof TransactionChangeValueBuilder ? $this->transaction->build() : $this->transaction, + $this->name, + $this->customTypeId, + $this->previousValue, + $this->nextValue + ); + } + + public static function of(): SetTransactionCustomFieldChangeBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetTransactionCustomFieldChangeCollection.php b/lib/commercetools-history/src/Models/Change/SetTransactionCustomFieldChangeCollection.php new file mode 100644 index 00000000000..47fa915e3c1 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetTransactionCustomFieldChangeCollection.php @@ -0,0 +1,56 @@ + + * @method SetTransactionCustomFieldChange current() + * @method SetTransactionCustomFieldChange end() + * @method SetTransactionCustomFieldChange at($offset) + */ +class SetTransactionCustomFieldChangeCollection extends ChangeCollection +{ + /** + * @psalm-assert SetTransactionCustomFieldChange $value + * @psalm-param SetTransactionCustomFieldChange|stdClass $value + * @throws InvalidArgumentException + * + * @return SetTransactionCustomFieldChangeCollection + */ + public function add($value) + { + if (!$value instanceof SetTransactionCustomFieldChange) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?SetTransactionCustomFieldChange + */ + protected function mapper() + { + return function (?int $index): ?SetTransactionCustomFieldChange { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var SetTransactionCustomFieldChange $data */ + $data = SetTransactionCustomFieldChangeModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetTransactionCustomFieldChangeModel.php b/lib/commercetools-history/src/Models/Change/SetTransactionCustomFieldChangeModel.php new file mode 100644 index 00000000000..f0d136a4706 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetTransactionCustomFieldChangeModel.php @@ -0,0 +1,278 @@ +change = $change; + $this->transaction = $transaction; + $this->name = $name; + $this->customTypeId = $customTypeId; + $this->previousValue = $previousValue; + $this->nextValue = $nextValue; + $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; + } + + /** + * + * @return null|string + */ + public function getChange() + { + if (is_null($this->change)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CHANGE); + if (is_null($data)) { + return null; + } + $this->change = (string) $data; + } + + return $this->change; + } + + /** + *Holds information about the updated Transaction.
+ * + * + * @return null|TransactionChangeValue + */ + public function getTransaction() + { + if (is_null($this->transaction)) { + /** @psalm-var stdClass|arrayName 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; + } + + /** + *id of the referenced Type.
Value before the change.
+ * + * + * @return null|mixed + */ + public function getPreviousValue() + { + if (is_null($this->previousValue)) { + /** @psalm-var mixed $data */ + $data = $this->raw(self::FIELD_PREVIOUS_VALUE); + if (is_null($data)) { + return null; + } + $this->previousValue = $data; + } + + return $this->previousValue; + } + + /** + *Value after the change.
+ * + * + * @return null|mixed + */ + public function getNextValue() + { + if (is_null($this->nextValue)) { + /** @psalm-var mixed $data */ + $data = $this->raw(self::FIELD_NEXT_VALUE); + if (is_null($data)) { + return null; + } + $this->nextValue = $data; + } + + return $this->nextValue; + } + + + /** + * @param ?string $change + */ + public function setChange(?string $change): void + { + $this->change = $change; + } + + /** + * @param ?TransactionChangeValue $transaction + */ + public function setTransaction(?TransactionChangeValue $transaction): void + { + $this->transaction = $transaction; + } + + /** + * @param ?string $name + */ + public function setName(?string $name): void + { + $this->name = $name; + } + + /** + * @param ?string $customTypeId + */ + public function setCustomTypeId(?string $customTypeId): void + { + $this->customTypeId = $customTypeId; + } + + /** + * @param mixed $previousValue + */ + public function setPreviousValue( $previousValue): void + { + $this->previousValue = $previousValue; + } + + /** + * @param mixed $nextValue + */ + public function setNextValue( $nextValue): void + { + $this->nextValue = $nextValue; + } + + + +} diff --git a/lib/commercetools-history/src/Models/Change/SetTransactionCustomTypeChange.php b/lib/commercetools-history/src/Models/Change/SetTransactionCustomTypeChange.php new file mode 100644 index 00000000000..88c5794e0a5 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetTransactionCustomTypeChange.php @@ -0,0 +1,78 @@ +Holds information about the updated Transaction. + * + + * @return null|TransactionChangeValue + */ + public function getTransaction(); + + /** + *Value before the change.
+ * + + * @return null|CustomFields + */ + public function getPreviousValue(); + + /** + *Value after the change.
+ * + + * @return null|CustomFields + */ + public function getNextValue(); + + /** + * @param ?string $change + */ + public function setChange(?string $change): void; + + /** + * @param ?TransactionChangeValue $transaction + */ + public function setTransaction(?TransactionChangeValue $transaction): void; + + /** + * @param ?CustomFields $previousValue + */ + public function setPreviousValue(?CustomFields $previousValue): void; + + /** + * @param ?CustomFields $nextValue + */ + public function setNextValue(?CustomFields $nextValue): void; +} diff --git a/lib/commercetools-history/src/Models/Change/SetTransactionCustomTypeChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetTransactionCustomTypeChangeBuilder.php new file mode 100644 index 00000000000..5176a8b911d --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetTransactionCustomTypeChangeBuilder.php @@ -0,0 +1,184 @@ + + */ +final class SetTransactionCustomTypeChangeBuilder implements Builder +{ + /** + + * @var ?string + */ + private $change; + + /** + + * @var null|TransactionChangeValue|TransactionChangeValueBuilder + */ + private $transaction; + + /** + + * @var null|CustomFields|CustomFieldsBuilder + */ + private $previousValue; + + /** + + * @var null|CustomFields|CustomFieldsBuilder + */ + private $nextValue; + + /** + + * @return null|string + */ + public function getChange() + { + return $this->change; + } + + /** + *Holds information about the updated Transaction.
+ * + + * @return null|TransactionChangeValue + */ + public function getTransaction() + { + return $this->transaction instanceof TransactionChangeValueBuilder ? $this->transaction->build() : $this->transaction; + } + + /** + *Value before the change.
+ * + + * @return null|CustomFields + */ + public function getPreviousValue() + { + return $this->previousValue instanceof CustomFieldsBuilder ? $this->previousValue->build() : $this->previousValue; + } + + /** + *Value after the change.
+ * + + * @return null|CustomFields + */ + public function getNextValue() + { + return $this->nextValue instanceof CustomFieldsBuilder ? $this->nextValue->build() : $this->nextValue; + } + + /** + * @param ?string $change + * @return $this + */ + public function withChange(?string $change) + { + $this->change = $change; + + return $this; + } + + /** + * @param ?TransactionChangeValue $transaction + * @return $this + */ + public function withTransaction(?TransactionChangeValue $transaction) + { + $this->transaction = $transaction; + + return $this; + } + + /** + * @param ?CustomFields $previousValue + * @return $this + */ + public function withPreviousValue(?CustomFields $previousValue) + { + $this->previousValue = $previousValue; + + return $this; + } + + /** + * @param ?CustomFields $nextValue + * @return $this + */ + public function withNextValue(?CustomFields $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + /** + * @deprecated use withTransaction() instead + * @return $this + */ + public function withTransactionBuilder(?TransactionChangeValueBuilder $transaction) + { + $this->transaction = $transaction; + + return $this; + } + + /** + * @deprecated use withPreviousValue() instead + * @return $this + */ + public function withPreviousValueBuilder(?CustomFieldsBuilder $previousValue) + { + $this->previousValue = $previousValue; + + return $this; + } + + /** + * @deprecated use withNextValue() instead + * @return $this + */ + public function withNextValueBuilder(?CustomFieldsBuilder $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + public function build(): SetTransactionCustomTypeChange + { + return new SetTransactionCustomTypeChangeModel( + $this->change, + $this->transaction instanceof TransactionChangeValueBuilder ? $this->transaction->build() : $this->transaction, + $this->previousValue instanceof CustomFieldsBuilder ? $this->previousValue->build() : $this->previousValue, + $this->nextValue instanceof CustomFieldsBuilder ? $this->nextValue->build() : $this->nextValue + ); + } + + public static function of(): SetTransactionCustomTypeChangeBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetTransactionCustomTypeChangeCollection.php b/lib/commercetools-history/src/Models/Change/SetTransactionCustomTypeChangeCollection.php new file mode 100644 index 00000000000..b08a614b15f --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetTransactionCustomTypeChangeCollection.php @@ -0,0 +1,56 @@ + + * @method SetTransactionCustomTypeChange current() + * @method SetTransactionCustomTypeChange end() + * @method SetTransactionCustomTypeChange at($offset) + */ +class SetTransactionCustomTypeChangeCollection extends ChangeCollection +{ + /** + * @psalm-assert SetTransactionCustomTypeChange $value + * @psalm-param SetTransactionCustomTypeChange|stdClass $value + * @throws InvalidArgumentException + * + * @return SetTransactionCustomTypeChangeCollection + */ + public function add($value) + { + if (!$value instanceof SetTransactionCustomTypeChange) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?SetTransactionCustomTypeChange + */ + protected function mapper() + { + return function (?int $index): ?SetTransactionCustomTypeChange { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var SetTransactionCustomTypeChange $data */ + $data = SetTransactionCustomTypeChangeModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetTransactionCustomTypeChangeModel.php b/lib/commercetools-history/src/Models/Change/SetTransactionCustomTypeChangeModel.php new file mode 100644 index 00000000000..6c00b26d7e5 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetTransactionCustomTypeChangeModel.php @@ -0,0 +1,210 @@ +change = $change; + $this->transaction = $transaction; + $this->previousValue = $previousValue; + $this->nextValue = $nextValue; + $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; + } + + /** + * + * @return null|string + */ + public function getChange() + { + if (is_null($this->change)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CHANGE); + if (is_null($data)) { + return null; + } + $this->change = (string) $data; + } + + return $this->change; + } + + /** + *Holds information about the updated Transaction.
+ * + * + * @return null|TransactionChangeValue + */ + public function getTransaction() + { + if (is_null($this->transaction)) { + /** @psalm-var stdClass|arrayValue before the change.
+ * + * + * @return null|CustomFields + */ + public function getPreviousValue() + { + if (is_null($this->previousValue)) { + /** @psalm-var stdClass|arrayValue after the change.
+ * + * + * @return null|CustomFields + */ + public function getNextValue() + { + if (is_null($this->nextValue)) { + /** @psalm-var stdClass|arrayElements added to the array.
+ * + + * @return null|ReferenceCollection + */ + public function getAddedItems(); + + /** + *Elements removed from the array.
+ * + + * @return null|ReferenceCollection + */ + public function getRemovedItems(); + /** * @param ?string $change */ @@ -60,4 +78,14 @@ public function setPreviousValue(?ReferenceCollection $previousValue): void; * @param ?ReferenceCollection $nextValue */ public function setNextValue(?ReferenceCollection $nextValue): void; + + /** + * @param ?ReferenceCollection $addedItems + */ + public function setAddedItems(?ReferenceCollection $addedItems): void; + + /** + * @param ?ReferenceCollection $removedItems + */ + public function setRemovedItems(?ReferenceCollection $removedItems): void; } diff --git a/lib/commercetools-history/src/Models/Change/SetTransitionsChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetTransitionsChangeBuilder.php index ac10ec92327..cb285abea1a 100644 --- a/lib/commercetools-history/src/Models/Change/SetTransitionsChangeBuilder.php +++ b/lib/commercetools-history/src/Models/Change/SetTransitionsChangeBuilder.php @@ -39,6 +39,18 @@ final class SetTransitionsChangeBuilder implements Builder */ private $nextValue; + /** + + * @var ?ReferenceCollection + */ + private $addedItems; + + /** + + * @var ?ReferenceCollection + */ + private $removedItems; + /** * @return null|string @@ -70,6 +82,28 @@ public function getNextValue() return $this->nextValue; } + /** + *Elements added to the array.
+ * + + * @return null|ReferenceCollection + */ + public function getAddedItems() + { + return $this->addedItems; + } + + /** + *Elements removed from the array.
+ * + + * @return null|ReferenceCollection + */ + public function getRemovedItems() + { + return $this->removedItems; + } + /** * @param ?string $change * @return $this @@ -103,13 +137,37 @@ public function withNextValue(?ReferenceCollection $nextValue) return $this; } + /** + * @param ?ReferenceCollection $addedItems + * @return $this + */ + public function withAddedItems(?ReferenceCollection $addedItems) + { + $this->addedItems = $addedItems; + + return $this; + } + + /** + * @param ?ReferenceCollection $removedItems + * @return $this + */ + public function withRemovedItems(?ReferenceCollection $removedItems) + { + $this->removedItems = $removedItems; + + return $this; + } + public function build(): SetTransitionsChange { return new SetTransitionsChangeModel( $this->change, $this->previousValue, - $this->nextValue + $this->nextValue, + $this->addedItems, + $this->removedItems ); } diff --git a/lib/commercetools-history/src/Models/Change/SetTransitionsChangeModel.php b/lib/commercetools-history/src/Models/Change/SetTransitionsChangeModel.php index c1776946ca9..29d66c4f79c 100644 --- a/lib/commercetools-history/src/Models/Change/SetTransitionsChangeModel.php +++ b/lib/commercetools-history/src/Models/Change/SetTransitionsChangeModel.php @@ -46,6 +46,18 @@ final class SetTransitionsChangeModel extends JsonObjectModel implements SetTran */ protected $nextValue; + /** + * + * @var ?ReferenceCollection + */ + protected $addedItems; + + /** + * + * @var ?ReferenceCollection + */ + protected $removedItems; + /** * @psalm-suppress MissingParamType @@ -54,11 +66,15 @@ public function __construct( ?string $change = null, ?ReferenceCollection $previousValue = null, ?ReferenceCollection $nextValue = null, + ?ReferenceCollection $addedItems = null, + ?ReferenceCollection $removedItems = null, ?string $type = null ) { $this->change = $change; $this->previousValue = $previousValue; $this->nextValue = $nextValue; + $this->addedItems = $addedItems; + $this->removedItems = $removedItems; $this->type = $type ?? self::DISCRIMINATOR_VALUE; } @@ -138,6 +154,46 @@ public function getNextValue() return $this->nextValue; } + /** + *Elements added to the array.
+ * + * + * @return null|ReferenceCollection + */ + public function getAddedItems() + { + if (is_null($this->addedItems)) { + /** @psalm-var ?listElements removed from the array.
+ * + * + * @return null|ReferenceCollection + */ + public function getRemovedItems() + { + if (is_null($this->removedItems)) { + /** @psalm-var ?listunitType="Division", reference to the new parent unit for the Business Unit.
+ *
+
+ * @return null|BusinessUnitResourceIdentifier
+ */
+ public function getParentUnit();
+
+ /**
+ * Value before the change.
+ * + + * @return null|string + */ + public function getPreviousValue(); + + /** + *Value after the change.
+ * + + * @return null|string + */ + public function getNextValue(); + + /** + * @param ?string $change + */ + public function setChange(?string $change): void; + + /** + * @param ?BusinessUnitResourceIdentifier $parentUnit + */ + public function setParentUnit(?BusinessUnitResourceIdentifier $parentUnit): void; + + /** + * @param ?string $previousValue + */ + public function setPreviousValue(?string $previousValue): void; + + /** + * @param ?string $nextValue + */ + public function setNextValue(?string $nextValue): void; +} diff --git a/lib/commercetools-history/src/Models/Change/SetUnitTypeChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetUnitTypeChangeBuilder.php new file mode 100644 index 00000000000..e48c9082f78 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetUnitTypeChangeBuilder.php @@ -0,0 +1,160 @@ + + */ +final class SetUnitTypeChangeBuilder implements Builder +{ + /** + + * @var ?string + */ + private $change; + + /** + + * @var null|BusinessUnitResourceIdentifier|BusinessUnitResourceIdentifierBuilder + */ + private $parentUnit; + + /** + + * @var ?string + */ + private $previousValue; + + /** + + * @var ?string + */ + private $nextValue; + + /** + + * @return null|string + */ + public function getChange() + { + return $this->change; + } + + /** + *If unitType="Division", reference to the new parent unit for the Business Unit.
Value before the change.
+ * + + * @return null|string + */ + public function getPreviousValue() + { + return $this->previousValue; + } + + /** + *Value after the change.
+ * + + * @return null|string + */ + public function getNextValue() + { + return $this->nextValue; + } + + /** + * @param ?string $change + * @return $this + */ + public function withChange(?string $change) + { + $this->change = $change; + + return $this; + } + + /** + * @param ?BusinessUnitResourceIdentifier $parentUnit + * @return $this + */ + public function withParentUnit(?BusinessUnitResourceIdentifier $parentUnit) + { + $this->parentUnit = $parentUnit; + + return $this; + } + + /** + * @param ?string $previousValue + * @return $this + */ + public function withPreviousValue(?string $previousValue) + { + $this->previousValue = $previousValue; + + return $this; + } + + /** + * @param ?string $nextValue + * @return $this + */ + public function withNextValue(?string $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + /** + * @deprecated use withParentUnit() instead + * @return $this + */ + public function withParentUnitBuilder(?BusinessUnitResourceIdentifierBuilder $parentUnit) + { + $this->parentUnit = $parentUnit; + + return $this; + } + + public function build(): SetUnitTypeChange + { + return new SetUnitTypeChangeModel( + $this->change, + $this->parentUnit instanceof BusinessUnitResourceIdentifierBuilder ? $this->parentUnit->build() : $this->parentUnit, + $this->previousValue, + $this->nextValue + ); + } + + public static function of(): SetUnitTypeChangeBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetUnitTypeChangeCollection.php b/lib/commercetools-history/src/Models/Change/SetUnitTypeChangeCollection.php new file mode 100644 index 00000000000..bbf32bb0058 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetUnitTypeChangeCollection.php @@ -0,0 +1,56 @@ + + * @method SetUnitTypeChange current() + * @method SetUnitTypeChange end() + * @method SetUnitTypeChange at($offset) + */ +class SetUnitTypeChangeCollection extends ChangeCollection +{ + /** + * @psalm-assert SetUnitTypeChange $value + * @psalm-param SetUnitTypeChange|stdClass $value + * @throws InvalidArgumentException + * + * @return SetUnitTypeChangeCollection + */ + public function add($value) + { + if (!$value instanceof SetUnitTypeChange) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?SetUnitTypeChange + */ + protected function mapper() + { + return function (?int $index): ?SetUnitTypeChange { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var SetUnitTypeChange $data */ + $data = SetUnitTypeChangeModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetUnitTypeChangeModel.php b/lib/commercetools-history/src/Models/Change/SetUnitTypeChangeModel.php new file mode 100644 index 00000000000..954e7f8f8bd --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetUnitTypeChangeModel.php @@ -0,0 +1,206 @@ +change = $change; + $this->parentUnit = $parentUnit; + $this->previousValue = $previousValue; + $this->nextValue = $nextValue; + $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; + } + + /** + * + * @return null|string + */ + public function getChange() + { + if (is_null($this->change)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CHANGE); + if (is_null($data)) { + return null; + } + $this->change = (string) $data; + } + + return $this->change; + } + + /** + *If unitType="Division", reference to the new parent unit for the Business Unit.
Value before the change.
+ * + * + * @return null|string + */ + public function getPreviousValue() + { + if (is_null($this->previousValue)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_PREVIOUS_VALUE); + if (is_null($data)) { + return null; + } + $this->previousValue = (string) $data; + } + + return $this->previousValue; + } + + /** + *Value after the change.
+ * + * + * @return null|string + */ + public function getNextValue() + { + if (is_null($this->nextValue)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_NEXT_VALUE); + if (is_null($data)) { + return null; + } + $this->nextValue = (string) $data; + } + + return $this->nextValue; + } + + + /** + * @param ?string $change + */ + public function setChange(?string $change): void + { + $this->change = $change; + } + + /** + * @param ?BusinessUnitResourceIdentifier $parentUnit + */ + public function setParentUnit(?BusinessUnitResourceIdentifier $parentUnit): void + { + $this->parentUnit = $parentUnit; + } + + /** + * @param ?string $previousValue + */ + public function setPreviousValue(?string $previousValue): void + { + $this->previousValue = $previousValue; + } + + /** + * @param ?string $nextValue + */ + public function setNextValue(?string $nextValue): void + { + $this->nextValue = $nextValue; + } + + + +} diff --git a/lib/commercetools-history/src/Models/Change/SetVariantAvailabilityChange.php b/lib/commercetools-history/src/Models/Change/SetVariantAvailabilityChange.php index 684ed7f9e62..75209f59650 100644 --- a/lib/commercetools-history/src/Models/Change/SetVariantAvailabilityChange.php +++ b/lib/commercetools-history/src/Models/Change/SetVariantAvailabilityChange.php @@ -49,6 +49,7 @@ public function getPreviousValue(); public function getNextValue(); /** + *Product data that was updated.
*staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.sku or key of the ProductVariant.
Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
* * @return null|string diff --git a/lib/commercetools-history/src/Models/Change/SetVariantAvailabilityChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetVariantAvailabilityChangeBuilder.php index eb44a1941be..644b69b84c8 100644 --- a/lib/commercetools-history/src/Models/Change/SetVariantAvailabilityChangeBuilder.php +++ b/lib/commercetools-history/src/Models/Change/SetVariantAvailabilityChangeBuilder.php @@ -84,6 +84,7 @@ public function getNextValue() } /** + *Product data that was updated.
*staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.sku or key of the ProductVariant.
Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
* * @return null|string diff --git a/lib/commercetools-history/src/Models/Change/SetVariantAvailabilityChangeModel.php b/lib/commercetools-history/src/Models/Change/SetVariantAvailabilityChangeModel.php index 61e72864ddc..53c2ce0a134 100644 --- a/lib/commercetools-history/src/Models/Change/SetVariantAvailabilityChangeModel.php +++ b/lib/commercetools-history/src/Models/Change/SetVariantAvailabilityChangeModel.php @@ -158,6 +158,7 @@ public function getNextValue() } /** + *Product data that was updated.
*staged, if the staged ProductCatalogData was updated.current, if the current ProductCatalogData was updated.sku or key of the ProductVariant.
Identifier of the updated Product Variant.
+ *This field holds the SKU, if defined; otherwise the key; otherwise the ID.
* * * @return null|string diff --git a/lib/commercetools-history/src/Models/Change/SetVariantExclusionChange.php b/lib/commercetools-history/src/Models/Change/SetVariantExclusionChange.php new file mode 100644 index 00000000000..60ef7a394d3 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetVariantExclusionChange.php @@ -0,0 +1,78 @@ +Reference to the updated Product. + * + + * @return null|Reference + */ + public function getProduct(); + + /** + *Value before the change.
+ * + + * @return null|ProductVariantExclusion + */ + public function getPreviousValue(); + + /** + *Value after the change.
+ * + + * @return null|ProductVariantExclusion + */ + public function getNextValue(); + + /** + * @param ?string $change + */ + public function setChange(?string $change): void; + + /** + * @param ?Reference $product + */ + public function setProduct(?Reference $product): void; + + /** + * @param ?ProductVariantExclusion $previousValue + */ + public function setPreviousValue(?ProductVariantExclusion $previousValue): void; + + /** + * @param ?ProductVariantExclusion $nextValue + */ + public function setNextValue(?ProductVariantExclusion $nextValue): void; +} diff --git a/lib/commercetools-history/src/Models/Change/SetVariantExclusionChangeBuilder.php b/lib/commercetools-history/src/Models/Change/SetVariantExclusionChangeBuilder.php new file mode 100644 index 00000000000..67872f0640b --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetVariantExclusionChangeBuilder.php @@ -0,0 +1,184 @@ + + */ +final class SetVariantExclusionChangeBuilder implements Builder +{ + /** + + * @var ?string + */ + private $change; + + /** + + * @var null|Reference|ReferenceBuilder + */ + private $product; + + /** + + * @var null|ProductVariantExclusion|ProductVariantExclusionBuilder + */ + private $previousValue; + + /** + + * @var null|ProductVariantExclusion|ProductVariantExclusionBuilder + */ + private $nextValue; + + /** + + * @return null|string + */ + public function getChange() + { + return $this->change; + } + + /** + *Reference to the updated Product.
+ * + + * @return null|Reference + */ + public function getProduct() + { + return $this->product instanceof ReferenceBuilder ? $this->product->build() : $this->product; + } + + /** + *Value before the change.
+ * + + * @return null|ProductVariantExclusion + */ + public function getPreviousValue() + { + return $this->previousValue instanceof ProductVariantExclusionBuilder ? $this->previousValue->build() : $this->previousValue; + } + + /** + *Value after the change.
+ * + + * @return null|ProductVariantExclusion + */ + public function getNextValue() + { + return $this->nextValue instanceof ProductVariantExclusionBuilder ? $this->nextValue->build() : $this->nextValue; + } + + /** + * @param ?string $change + * @return $this + */ + public function withChange(?string $change) + { + $this->change = $change; + + return $this; + } + + /** + * @param ?Reference $product + * @return $this + */ + public function withProduct(?Reference $product) + { + $this->product = $product; + + return $this; + } + + /** + * @param ?ProductVariantExclusion $previousValue + * @return $this + */ + public function withPreviousValue(?ProductVariantExclusion $previousValue) + { + $this->previousValue = $previousValue; + + return $this; + } + + /** + * @param ?ProductVariantExclusion $nextValue + * @return $this + */ + public function withNextValue(?ProductVariantExclusion $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + /** + * @deprecated use withProduct() instead + * @return $this + */ + public function withProductBuilder(?ReferenceBuilder $product) + { + $this->product = $product; + + return $this; + } + + /** + * @deprecated use withPreviousValue() instead + * @return $this + */ + public function withPreviousValueBuilder(?ProductVariantExclusionBuilder $previousValue) + { + $this->previousValue = $previousValue; + + return $this; + } + + /** + * @deprecated use withNextValue() instead + * @return $this + */ + public function withNextValueBuilder(?ProductVariantExclusionBuilder $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + public function build(): SetVariantExclusionChange + { + return new SetVariantExclusionChangeModel( + $this->change, + $this->product instanceof ReferenceBuilder ? $this->product->build() : $this->product, + $this->previousValue instanceof ProductVariantExclusionBuilder ? $this->previousValue->build() : $this->previousValue, + $this->nextValue instanceof ProductVariantExclusionBuilder ? $this->nextValue->build() : $this->nextValue + ); + } + + public static function of(): SetVariantExclusionChangeBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetVariantExclusionChangeCollection.php b/lib/commercetools-history/src/Models/Change/SetVariantExclusionChangeCollection.php new file mode 100644 index 00000000000..1cc818e8453 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetVariantExclusionChangeCollection.php @@ -0,0 +1,56 @@ + + * @method SetVariantExclusionChange current() + * @method SetVariantExclusionChange end() + * @method SetVariantExclusionChange at($offset) + */ +class SetVariantExclusionChangeCollection extends ChangeCollection +{ + /** + * @psalm-assert SetVariantExclusionChange $value + * @psalm-param SetVariantExclusionChange|stdClass $value + * @throws InvalidArgumentException + * + * @return SetVariantExclusionChangeCollection + */ + public function add($value) + { + if (!$value instanceof SetVariantExclusionChange) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?SetVariantExclusionChange + */ + protected function mapper() + { + return function (?int $index): ?SetVariantExclusionChange { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var SetVariantExclusionChange $data */ + $data = SetVariantExclusionChangeModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-history/src/Models/Change/SetVariantExclusionChangeModel.php b/lib/commercetools-history/src/Models/Change/SetVariantExclusionChangeModel.php new file mode 100644 index 00000000000..892a4639353 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/SetVariantExclusionChangeModel.php @@ -0,0 +1,210 @@ +change = $change; + $this->product = $product; + $this->previousValue = $previousValue; + $this->nextValue = $nextValue; + $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; + } + + /** + * + * @return null|string + */ + public function getChange() + { + if (is_null($this->change)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CHANGE); + if (is_null($data)) { + return null; + } + $this->change = (string) $data; + } + + return $this->change; + } + + /** + *Reference to the updated Product.
+ * + * + * @return null|Reference + */ + public function getProduct() + { + if (is_null($this->product)) { + /** @psalm-var stdClass|arrayValue before the change.
+ * + * + * @return null|ProductVariantExclusion + */ + public function getPreviousValue() + { + if (is_null($this->previousValue)) { + /** @psalm-var stdClass|arrayValue after the change.
+ * + * + * @return null|ProductVariantExclusion + */ + public function getNextValue() + { + if (is_null($this->nextValue)) { + /** @psalm-var stdClass|arrayid of the updated CustomLineItem.
id of the updated LineItem.
id of the updated CustomLineItem.
id of the State involved in the transition.
id of the updated CustomLineItem.
id of the updated LineItem.
id of the updated CustomLineItem.
id of the State involved in the transition.
id of the updated CustomLineItem.
id of the updated LineItem.
id of the updated CustomLineItem.
id of the State involved in the transition.
Value after the change.
+ * + + * @return null|Address + */ + public function getNextValue(); + + /** + * @param ?string $change + */ + public function setChange(?string $change): void; + + /** + * @param ?Address $previousValue + */ + public function setPreviousValue(?Address $previousValue): void; + + /** + * @param ?Address $nextValue + */ + public function setNextValue(?Address $nextValue): void; +} diff --git a/lib/commercetools-history/src/Models/Change/UpdateItemShippingAddressChangeBuilder.php b/lib/commercetools-history/src/Models/Change/UpdateItemShippingAddressChangeBuilder.php new file mode 100644 index 00000000000..9530a44986d --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/UpdateItemShippingAddressChangeBuilder.php @@ -0,0 +1,142 @@ + + */ +final class UpdateItemShippingAddressChangeBuilder implements Builder +{ + /** + + * @var ?string + */ + private $change; + + /** + + * @var null|Address|AddressBuilder + */ + private $previousValue; + + /** + + * @var null|Address|AddressBuilder + */ + private $nextValue; + + /** + + * @return null|string + */ + public function getChange() + { + return $this->change; + } + + /** + *Value before the change.
+ * + + * @return null|Address + */ + public function getPreviousValue() + { + return $this->previousValue instanceof AddressBuilder ? $this->previousValue->build() : $this->previousValue; + } + + /** + *Value after the change.
+ * + + * @return null|Address + */ + public function getNextValue() + { + return $this->nextValue instanceof AddressBuilder ? $this->nextValue->build() : $this->nextValue; + } + + /** + * @param ?string $change + * @return $this + */ + public function withChange(?string $change) + { + $this->change = $change; + + return $this; + } + + /** + * @param ?Address $previousValue + * @return $this + */ + public function withPreviousValue(?Address $previousValue) + { + $this->previousValue = $previousValue; + + return $this; + } + + /** + * @param ?Address $nextValue + * @return $this + */ + public function withNextValue(?Address $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + /** + * @deprecated use withPreviousValue() instead + * @return $this + */ + public function withPreviousValueBuilder(?AddressBuilder $previousValue) + { + $this->previousValue = $previousValue; + + return $this; + } + + /** + * @deprecated use withNextValue() instead + * @return $this + */ + public function withNextValueBuilder(?AddressBuilder $nextValue) + { + $this->nextValue = $nextValue; + + return $this; + } + + public function build(): UpdateItemShippingAddressChange + { + return new UpdateItemShippingAddressChangeModel( + $this->change, + $this->previousValue instanceof AddressBuilder ? $this->previousValue->build() : $this->previousValue, + $this->nextValue instanceof AddressBuilder ? $this->nextValue->build() : $this->nextValue + ); + } + + public static function of(): UpdateItemShippingAddressChangeBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-history/src/Models/Change/UpdateItemShippingAddressChangeCollection.php b/lib/commercetools-history/src/Models/Change/UpdateItemShippingAddressChangeCollection.php new file mode 100644 index 00000000000..fe1d8833793 --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/UpdateItemShippingAddressChangeCollection.php @@ -0,0 +1,56 @@ + + * @method UpdateItemShippingAddressChange current() + * @method UpdateItemShippingAddressChange end() + * @method UpdateItemShippingAddressChange at($offset) + */ +class UpdateItemShippingAddressChangeCollection extends ChangeCollection +{ + /** + * @psalm-assert UpdateItemShippingAddressChange $value + * @psalm-param UpdateItemShippingAddressChange|stdClass $value + * @throws InvalidArgumentException + * + * @return UpdateItemShippingAddressChangeCollection + */ + public function add($value) + { + if (!$value instanceof UpdateItemShippingAddressChange) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?UpdateItemShippingAddressChange + */ + protected function mapper() + { + return function (?int $index): ?UpdateItemShippingAddressChange { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var UpdateItemShippingAddressChange $data */ + $data = UpdateItemShippingAddressChangeModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-history/src/Models/Change/UpdateItemShippingAddressChangeModel.php b/lib/commercetools-history/src/Models/Change/UpdateItemShippingAddressChangeModel.php new file mode 100644 index 00000000000..52af10189ca --- /dev/null +++ b/lib/commercetools-history/src/Models/Change/UpdateItemShippingAddressChangeModel.php @@ -0,0 +1,171 @@ +change = $change; + $this->previousValue = $previousValue; + $this->nextValue = $nextValue; + $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; + } + + /** + * + * @return null|string + */ + public function getChange() + { + if (is_null($this->change)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CHANGE); + if (is_null($data)) { + return null; + } + $this->change = (string) $data; + } + + return $this->change; + } + + /** + *Value before the change.
+ * + * + * @return null|Address + */ + public function getPreviousValue() + { + if (is_null($this->previousValue)) { + /** @psalm-var stdClass|arrayValue after the change.
+ * + * + * @return null|Address + */ + public function getNextValue() + { + if (is_null($this->nextValue)) { + /** @psalm-var stdClass|arrayUnique ID of the Address.
+ *Custom Fields defined for the Address.
* - * @return null|string + * @return null|CustomFields */ - public function getId(); + public function getCustom(); /** - - * @return null|string - */ - public function getKey(); - - /** - - * @return null|string - */ - public function getTitle(); - - /** - - * @return null|string - */ - public function getSalutation(); - - /** - - * @return null|string - */ - public function getFirstName(); - - /** - - * @return null|string - */ - public function getLastName(); - - /** - - * @return null|string - */ - public function getStreetName(); - - /** - - * @return null|string - */ - public function getStreetNumber(); - - /** - - * @return null|string - */ - public function getAdditionalStreetInfo(); - - /** - - * @return null|string - */ - public function getPostalCode(); - - /** - - * @return null|string - */ - public function getCity(); - - /** - - * @return null|string - */ - public function getRegion(); - - /** - - * @return null|string - */ - public function getState(); - - /** - *Two-digit country code as per ISO 3166-1 alpha-2.
- * - - * @return null|string - */ - public function getCountry(); - - /** - - * @return null|string - */ - public function getCompany(); - - /** - - * @return null|string - */ - public function getDepartment(); - - /** - - * @return null|string - */ - public function getBuilding(); - - /** - - * @return null|string - */ - public function getApartment(); - - /** - - * @return null|string - */ - public function getPOBox(); - - /** - - * @return null|string - */ - public function getPhone(); - - /** - - * @return null|string - */ - public function getMobile(); - - /** - - * @return null|string - */ - public function getEmail(); - - /** - - * @return null|string - */ - public function getFax(); - - /** - - * @return null|string - */ - public function getAdditionalAddressInfo(); - - /** - - * @return null|string - */ - public function getExternalId(); - - /** - * @param ?string $id - */ - public function setId(?string $id): void; - - /** - * @param ?string $key - */ - public function setKey(?string $key): void; - - /** - * @param ?string $title - */ - public function setTitle(?string $title): void; - - /** - * @param ?string $salutation - */ - public function setSalutation(?string $salutation): void; - - /** - * @param ?string $firstName - */ - public function setFirstName(?string $firstName): void; - - /** - * @param ?string $lastName - */ - public function setLastName(?string $lastName): void; - - /** - * @param ?string $streetName - */ - public function setStreetName(?string $streetName): void; - - /** - * @param ?string $streetNumber - */ - public function setStreetNumber(?string $streetNumber): void; - - /** - * @param ?string $additionalStreetInfo - */ - public function setAdditionalStreetInfo(?string $additionalStreetInfo): void; - - /** - * @param ?string $postalCode - */ - public function setPostalCode(?string $postalCode): void; - - /** - * @param ?string $city - */ - public function setCity(?string $city): void; - - /** - * @param ?string $region - */ - public function setRegion(?string $region): void; - - /** - * @param ?string $state - */ - public function setState(?string $state): void; - - /** - * @param ?string $country - */ - public function setCountry(?string $country): void; - - /** - * @param ?string $company - */ - public function setCompany(?string $company): void; - - /** - * @param ?string $department - */ - public function setDepartment(?string $department): void; - - /** - * @param ?string $building - */ - public function setBuilding(?string $building): void; - - /** - * @param ?string $apartment - */ - public function setApartment(?string $apartment): void; - - /** - * @param ?string $pOBox - */ - public function setPOBox(?string $pOBox): void; - - /** - * @param ?string $phone - */ - public function setPhone(?string $phone): void; - - /** - * @param ?string $mobile - */ - public function setMobile(?string $mobile): void; - - /** - * @param ?string $email - */ - public function setEmail(?string $email): void; - - /** - * @param ?string $fax - */ - public function setFax(?string $fax): void; - - /** - * @param ?string $additionalAddressInfo - */ - public function setAdditionalAddressInfo(?string $additionalAddressInfo): void; - - /** - * @param ?string $externalId + * @param ?CustomFields $custom */ - public function setExternalId(?string $externalId): void; + public function setCustom(?CustomFields $custom): void; } diff --git a/lib/commercetools-history/src/Models/Common/AddressBuilder.php b/lib/commercetools-history/src/Models/Common/AddressBuilder.php index b78b30ee88d..4a5bb626271 100644 --- a/lib/commercetools-history/src/Models/Common/AddressBuilder.php +++ b/lib/commercetools-history/src/Models/Common/AddressBuilder.php @@ -32,6 +32,12 @@ final class AddressBuilder implements Builder */ private $key; + /** + + * @var ?string + */ + private $country; + /** * @var ?string @@ -98,12 +104,6 @@ final class AddressBuilder implements Builder */ private $state; - /** - - * @var ?string - */ - private $country; - /** * @var ?string @@ -171,7 +171,15 @@ final class AddressBuilder implements Builder private $externalId; /** - *Unique ID of the Address.
+ + * @var null|CustomFields|CustomFieldsBuilder + */ + private $custom; + + /** + *Unique identifier of the Address.
+ *It is not recommended to set it manually since the API overwrites this ID when creating an Address for a Customer.
+ * Use key instead and omit this field from the request to let the API generate the ID for the Address.
User-defined identifier of the Address that must be unique when multiple addresses are referenced in BusinessUnits, Customers, and itemShippingAddresses (LineItem-specific addresses) of a Cart, Order, QuoteRequest, or Quote.
Name of the country.
+ * + + * @return null|string + */ + public function getCountry() + { + return $this->country; + } + + /** + *Title of the contact, for example 'Dr.'
+ * * @return null|string */ @@ -200,6 +223,8 @@ public function getTitle() } /** + *Salutation of the contact, for example 'Mr.' or 'Ms.'
+ * * @return null|string */ @@ -209,6 +234,8 @@ public function getSalutation() } /** + *Given name (first name) of the contact.
+ * * @return null|string */ @@ -218,6 +245,8 @@ public function getFirstName() } /** + *Family name (last name) of the contact.
+ * * @return null|string */ @@ -227,6 +256,8 @@ public function getLastName() } /** + *Name of the street.
+ * * @return null|string */ @@ -236,6 +267,8 @@ public function getStreetName() } /** + *Street number.
+ * * @return null|string */ @@ -245,6 +278,8 @@ public function getStreetNumber() } /** + *Further information on the street address.
+ * * @return null|string */ @@ -254,6 +289,8 @@ public function getAdditionalStreetInfo() } /** + *Postal code.
+ * * @return null|string */ @@ -263,6 +300,8 @@ public function getPostalCode() } /** + *Name of the city.
+ * * @return null|string */ @@ -272,6 +311,8 @@ public function getCity() } /** + *Name of the region.
+ * * @return null|string */ @@ -281,6 +322,8 @@ public function getRegion() } /** + *Name of the state, for example, Colorado.
+ * * @return null|string */ @@ -290,18 +333,9 @@ public function getState() } /** - *Two-digit country code as per ISO 3166-1 alpha-2.
+ *Name of the company.
* - * @return null|string - */ - public function getCountry() - { - return $this->country; - } - - /** - * @return null|string */ public function getCompany() @@ -310,6 +344,8 @@ public function getCompany() } /** + *Name of the department.
+ * * @return null|string */ @@ -319,6 +355,8 @@ public function getDepartment() } /** + *Number or name of the building.
+ * * @return null|string */ @@ -328,6 +366,8 @@ public function getBuilding() } /** + *Number or name of the apartment.
+ * * @return null|string */ @@ -337,6 +377,8 @@ public function getApartment() } /** + *Post office box number.
+ * * @return null|string */ @@ -346,6 +388,8 @@ public function getPOBox() } /** + *Phone number of the contact.
+ * * @return null|string */ @@ -355,6 +399,8 @@ public function getPhone() } /** + *Mobile phone number of the contact.
+ * * @return null|string */ @@ -364,6 +410,8 @@ public function getMobile() } /** + *Email address of the contact.
+ * * @return null|string */ @@ -373,6 +421,8 @@ public function getEmail() } /** + *Fax number of the contact.
+ * * @return null|string */ @@ -382,6 +432,8 @@ public function getFax() } /** + *Further information on the Address.
+ * * @return null|string */ @@ -391,6 +443,8 @@ public function getAdditionalAddressInfo() } /** + *ID for the contact used in an external system.
+ * * @return null|string */ @@ -399,6 +453,17 @@ public function getExternalId() return $this->externalId; } + /** + *Custom Fields defined for the Address.
+ * + + * @return null|CustomFields + */ + public function getCustom() + { + return $this->custom instanceof CustomFieldsBuilder ? $this->custom->build() : $this->custom; + } + /** * @param ?string $id * @return $this @@ -421,6 +486,17 @@ public function withKey(?string $key) return $this; } + /** + * @param ?string $country + * @return $this + */ + public function withCountry(?string $country) + { + $this->country = $country; + + return $this; + } + /** * @param ?string $title * @return $this @@ -542,17 +618,6 @@ public function withState(?string $state) return $this; } - /** - * @param ?string $country - * @return $this - */ - public function withCountry(?string $country) - { - $this->country = $country; - - return $this; - } - /** * @param ?string $company * @return $this @@ -674,12 +739,34 @@ public function withExternalId(?string $externalId) return $this; } + /** + * @param ?CustomFields $custom + * @return $this + */ + public function withCustom(?CustomFields $custom) + { + $this->custom = $custom; + + return $this; + } + + /** + * @deprecated use withCustom() instead + * @return $this + */ + public function withCustomBuilder(?CustomFieldsBuilder $custom) + { + $this->custom = $custom; + + return $this; + } public function build(): Address { return new AddressModel( $this->id, $this->key, + $this->country, $this->title, $this->salutation, $this->firstName, @@ -691,7 +778,6 @@ public function build(): Address $this->city, $this->region, $this->state, - $this->country, $this->company, $this->department, $this->building, @@ -702,7 +788,8 @@ public function build(): Address $this->email, $this->fax, $this->additionalAddressInfo, - $this->externalId + $this->externalId, + $this->custom instanceof CustomFieldsBuilder ? $this->custom->build() : $this->custom ); } diff --git a/lib/commercetools-history/src/Models/Common/AddressCollection.php b/lib/commercetools-history/src/Models/Common/AddressCollection.php index 2455e3fdce8..08afabc9877 100644 --- a/lib/commercetools-history/src/Models/Common/AddressCollection.php +++ b/lib/commercetools-history/src/Models/Common/AddressCollection.php @@ -8,17 +8,17 @@ namespace Commercetools\History\Models\Common; -use Commercetools\Base\MapperSequence; +use Commercetools\History\Models\Common\BaseAddressCollection; use Commercetools\Exception\InvalidArgumentException; use stdClass; /** - * @extends MapperSequence + * @extends BaseAddressCollection * @method Address current() * @method Address end() * @method Address at($offset) */ -class AddressCollection extends MapperSequence +class AddressCollection extends BaseAddressCollection { /** * @psalm-assert Address $value diff --git a/lib/commercetools-history/src/Models/Common/AddressModel.php b/lib/commercetools-history/src/Models/Common/AddressModel.php index 33fe4d8f18b..a8c14188430 100644 --- a/lib/commercetools-history/src/Models/Common/AddressModel.php +++ b/lib/commercetools-history/src/Models/Common/AddressModel.php @@ -33,6 +33,12 @@ final class AddressModel extends JsonObjectModel implements Address */ protected $key; + /** + * + * @var ?string + */ + protected $country; + /** * * @var ?string @@ -99,12 +105,6 @@ final class AddressModel extends JsonObjectModel implements Address */ protected $state; - /** - * - * @var ?string - */ - protected $country; - /** * * @var ?string @@ -171,6 +171,12 @@ final class AddressModel extends JsonObjectModel implements Address */ protected $externalId; + /** + * + * @var ?CustomFields + */ + protected $custom; + /** * @psalm-suppress MissingParamType @@ -178,6 +184,7 @@ final class AddressModel extends JsonObjectModel implements Address public function __construct( ?string $id = null, ?string $key = null, + ?string $country = null, ?string $title = null, ?string $salutation = null, ?string $firstName = null, @@ -189,7 +196,6 @@ public function __construct( ?string $city = null, ?string $region = null, ?string $state = null, - ?string $country = null, ?string $company = null, ?string $department = null, ?string $building = null, @@ -200,10 +206,12 @@ public function __construct( ?string $email = null, ?string $fax = null, ?string $additionalAddressInfo = null, - ?string $externalId = null + ?string $externalId = null, + ?CustomFields $custom = null ) { $this->id = $id; $this->key = $key; + $this->country = $country; $this->title = $title; $this->salutation = $salutation; $this->firstName = $firstName; @@ -215,7 +223,6 @@ public function __construct( $this->city = $city; $this->region = $region; $this->state = $state; - $this->country = $country; $this->company = $company; $this->department = $department; $this->building = $building; @@ -227,11 +234,14 @@ public function __construct( $this->fax = $fax; $this->additionalAddressInfo = $additionalAddressInfo; $this->externalId = $externalId; + $this->custom = $custom; } /** - *Unique ID of the Address.
+ *Unique identifier of the Address.
+ *It is not recommended to set it manually since the API overwrites this ID when creating an Address for a Customer.
+ * Use key instead and omit this field from the request to let the API generate the ID for the Address.
User-defined identifier of the Address that must be unique when multiple addresses are referenced in BusinessUnits, Customers, and itemShippingAddresses (LineItem-specific addresses) of a Cart, Order, QuoteRequest, or Quote.
Name of the country.
+ * + * + * @return null|string + */ + public function getCountry() + { + if (is_null($this->country)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_COUNTRY); + if (is_null($data)) { + return null; + } + $this->country = (string) $data; + } + + return $this->country; + } + + /** + *Title of the contact, for example 'Dr.'
+ * * * @return null|string */ @@ -287,6 +321,8 @@ public function getTitle() } /** + *Salutation of the contact, for example 'Mr.' or 'Ms.'
+ * * * @return null|string */ @@ -305,6 +341,8 @@ public function getSalutation() } /** + *Given name (first name) of the contact.
+ * * * @return null|string */ @@ -323,6 +361,8 @@ public function getFirstName() } /** + *Family name (last name) of the contact.
+ * * * @return null|string */ @@ -341,6 +381,8 @@ public function getLastName() } /** + *Name of the street.
+ * * * @return null|string */ @@ -359,6 +401,8 @@ public function getStreetName() } /** + *Street number.
+ * * * @return null|string */ @@ -377,6 +421,8 @@ public function getStreetNumber() } /** + *Further information on the street address.
+ * * * @return null|string */ @@ -395,6 +441,8 @@ public function getAdditionalStreetInfo() } /** + *Postal code.
+ * * * @return null|string */ @@ -413,6 +461,8 @@ public function getPostalCode() } /** + *Name of the city.
+ * * * @return null|string */ @@ -431,6 +481,8 @@ public function getCity() } /** + *Name of the region.
+ * * * @return null|string */ @@ -449,6 +501,8 @@ public function getRegion() } /** + *Name of the state, for example, Colorado.
+ * * * @return null|string */ @@ -467,29 +521,11 @@ public function getState() } /** - *Two-digit country code as per ISO 3166-1 alpha-2.
+ *Name of the company.
* * * @return null|string */ - public function getCountry() - { - if (is_null($this->country)) { - /** @psalm-var ?string $data */ - $data = $this->raw(self::FIELD_COUNTRY); - if (is_null($data)) { - return null; - } - $this->country = (string) $data; - } - - return $this->country; - } - - /** - * - * @return null|string - */ public function getCompany() { if (is_null($this->company)) { @@ -505,6 +541,8 @@ public function getCompany() } /** + *Name of the department.
+ * * * @return null|string */ @@ -523,6 +561,8 @@ public function getDepartment() } /** + *Number or name of the building.
+ * * * @return null|string */ @@ -541,6 +581,8 @@ public function getBuilding() } /** + *Number or name of the apartment.
+ * * * @return null|string */ @@ -559,6 +601,8 @@ public function getApartment() } /** + *Post office box number.
+ * * * @return null|string */ @@ -577,6 +621,8 @@ public function getPOBox() } /** + *Phone number of the contact.
+ * * * @return null|string */ @@ -595,6 +641,8 @@ public function getPhone() } /** + *Mobile phone number of the contact.
+ * * * @return null|string */ @@ -613,6 +661,8 @@ public function getMobile() } /** + *Email address of the contact.
+ * * * @return null|string */ @@ -631,6 +681,8 @@ public function getEmail() } /** + *Fax number of the contact.
+ * * * @return null|string */ @@ -649,6 +701,8 @@ public function getFax() } /** + *Further information on the Address.
+ * * * @return null|string */ @@ -667,6 +721,8 @@ public function getAdditionalAddressInfo() } /** + *ID for the contact used in an external system.
+ * * * @return null|string */ @@ -684,6 +740,27 @@ public function getExternalId() return $this->externalId; } + /** + *Custom Fields defined for the Address.
+ * + * + * @return null|CustomFields + */ + public function getCustom() + { + if (is_null($this->custom)) { + /** @psalm-var stdClass|arrayUnique identifier of the Asset. Not required when importing Assets using the Import API.
+ * * @return null|string */ @@ -28,23 +32,45 @@ public function getId(); /** + * @return null|AssetSourceCollection + */ + public function getSources(); + + /** + *Name of the Asset.
+ * + * @return null|LocalizedString */ public function getName(); /** + *Description of the Asset.
+ * * @return null|LocalizedString */ public function getDescription(); /** + *Keywords for categorizing and organizing Assets.
+ * + + * @return null|array + */ + public function getTags(); + + /** + *Custom Fields defined for the Asset.
+ * * @return null|CustomFields */ public function getCustom(); /** + *User-defined identifier of the Asset. It is unique per Category or ProductVariant.
+ * * @return null|string */ @@ -55,6 +81,11 @@ public function getKey(); */ public function setId(?string $id): void; + /** + * @param ?AssetSourceCollection $sources + */ + public function setSources(?AssetSourceCollection $sources): void; + /** * @param ?LocalizedString $name */ @@ -65,6 +96,11 @@ public function setName(?LocalizedString $name): void; */ public function setDescription(?LocalizedString $description): void; + /** + * @param ?array $tags + */ + public function setTags(?array $tags): void; + /** * @param ?CustomFields $custom */ diff --git a/lib/commercetools-history/src/Models/Common/AssetBuilder.php b/lib/commercetools-history/src/Models/Common/AssetBuilder.php index 040d9b756f4..d61426c6755 100644 --- a/lib/commercetools-history/src/Models/Common/AssetBuilder.php +++ b/lib/commercetools-history/src/Models/Common/AssetBuilder.php @@ -26,6 +26,12 @@ final class AssetBuilder implements Builder */ private $id; + /** + + * @var ?AssetSourceCollection + */ + private $sources; + /** * @var null|LocalizedString|LocalizedStringBuilder @@ -38,6 +44,12 @@ final class AssetBuilder implements Builder */ private $description; + /** + + * @var ?array + */ + private $tags; + /** * @var null|CustomFields|CustomFieldsBuilder @@ -51,6 +63,8 @@ final class AssetBuilder implements Builder private $key; /** + *Unique identifier of the Asset. Not required when importing Assets using the Import API.
+ * * @return null|string */ @@ -61,6 +75,17 @@ public function getId() /** + * @return null|AssetSourceCollection + */ + public function getSources() + { + return $this->sources; + } + + /** + *Name of the Asset.
+ * + * @return null|LocalizedString */ public function getName() @@ -69,6 +94,8 @@ public function getName() } /** + *Description of the Asset.
+ * * @return null|LocalizedString */ @@ -78,6 +105,19 @@ public function getDescription() } /** + *Keywords for categorizing and organizing Assets.
+ * + + * @return null|array + */ + public function getTags() + { + return $this->tags; + } + + /** + *Custom Fields defined for the Asset.
+ * * @return null|CustomFields */ @@ -87,6 +127,8 @@ public function getCustom() } /** + *User-defined identifier of the Asset. It is unique per Category or ProductVariant.
+ * * @return null|string */ @@ -106,6 +148,17 @@ public function withId(?string $id) return $this; } + /** + * @param ?AssetSourceCollection $sources + * @return $this + */ + public function withSources(?AssetSourceCollection $sources) + { + $this->sources = $sources; + + return $this; + } + /** * @param ?LocalizedString $name * @return $this @@ -128,6 +181,17 @@ public function withDescription(?LocalizedString $description) return $this; } + /** + * @param ?array $tags + * @return $this + */ + public function withTags(?array $tags) + { + $this->tags = $tags; + + return $this; + } + /** * @param ?CustomFields $custom * @return $this @@ -187,8 +251,10 @@ public function build(): Asset { return new AssetModel( $this->id, + $this->sources, $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name, $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description, + $this->tags, $this->custom instanceof CustomFieldsBuilder ? $this->custom->build() : $this->custom, $this->key ); diff --git a/lib/commercetools-history/src/Models/Common/AssetDimensions.php b/lib/commercetools-history/src/Models/Common/AssetDimensions.php index 2b41f63d69b..13991198c5b 100644 --- a/lib/commercetools-history/src/Models/Common/AssetDimensions.php +++ b/lib/commercetools-history/src/Models/Common/AssetDimensions.php @@ -18,12 +18,16 @@ interface AssetDimensions extends JsonObject public const FIELD_H = 'h'; /** + *Width of the Asset source.
+ * * @return null|int */ public function getW(); /** + *Height of the Asset source.
+ * * @return null|int */ diff --git a/lib/commercetools-history/src/Models/Common/AssetDimensionsBuilder.php b/lib/commercetools-history/src/Models/Common/AssetDimensionsBuilder.php index 77aeb522385..5e533033a82 100644 --- a/lib/commercetools-history/src/Models/Common/AssetDimensionsBuilder.php +++ b/lib/commercetools-history/src/Models/Common/AssetDimensionsBuilder.php @@ -33,6 +33,8 @@ final class AssetDimensionsBuilder implements Builder private $h; /** + *Width of the Asset source.
+ * * @return null|int */ @@ -42,6 +44,8 @@ public function getW() } /** + *Height of the Asset source.
+ * * @return null|int */ diff --git a/lib/commercetools-history/src/Models/Common/AssetDimensionsModel.php b/lib/commercetools-history/src/Models/Common/AssetDimensionsModel.php index 0e115fae26d..a6ea51aa798 100644 --- a/lib/commercetools-history/src/Models/Common/AssetDimensionsModel.php +++ b/lib/commercetools-history/src/Models/Common/AssetDimensionsModel.php @@ -47,6 +47,8 @@ public function __construct( } /** + *Width of the Asset source.
+ * * * @return null|int */ @@ -65,6 +67,8 @@ public function getW() } /** + *Height of the Asset source.
+ * * * @return null|int */ diff --git a/lib/commercetools-history/src/Models/Common/AssetModel.php b/lib/commercetools-history/src/Models/Common/AssetModel.php index 914af522960..26fdd4a2b8d 100644 --- a/lib/commercetools-history/src/Models/Common/AssetModel.php +++ b/lib/commercetools-history/src/Models/Common/AssetModel.php @@ -27,6 +27,12 @@ final class AssetModel extends JsonObjectModel implements Asset */ protected $id; + /** + * + * @var ?AssetSourceCollection + */ + protected $sources; + /** * * @var ?LocalizedString @@ -39,6 +45,12 @@ final class AssetModel extends JsonObjectModel implements Asset */ protected $description; + /** + * + * @var ?array + */ + protected $tags; + /** * * @var ?CustomFields @@ -57,20 +69,26 @@ final class AssetModel extends JsonObjectModel implements Asset */ public function __construct( ?string $id = null, + ?AssetSourceCollection $sources = null, ?LocalizedString $name = null, ?LocalizedString $description = null, + ?array $tags = null, ?CustomFields $custom = null, ?string $key = null ) { $this->id = $id; + $this->sources = $sources; $this->name = $name; $this->description = $description; + $this->tags = $tags; $this->custom = $custom; $this->key = $key; } /** + *Unique identifier of the Asset. Not required when importing Assets using the Import API.
+ * * * @return null|string */ @@ -89,6 +107,26 @@ public function getId() } /** + * + * @return null|AssetSourceCollection + */ + public function getSources() + { + if (is_null($this->sources)) { + /** @psalm-var ?listName of the Asset.
+ * * * @return null|LocalizedString */ @@ -108,6 +146,8 @@ public function getName() } /** + *Description of the Asset.
+ * * * @return null|LocalizedString */ @@ -127,6 +167,28 @@ public function getDescription() } /** + *Keywords for categorizing and organizing Assets.
+ * + * + * @return null|array + */ + public function getTags() + { + if (is_null($this->tags)) { + /** @psalm-var ?listCustom Fields defined for the Asset.
+ * * * @return null|CustomFields */ @@ -146,6 +208,8 @@ public function getCustom() } /** + *User-defined identifier of the Asset. It is unique per Category or ProductVariant.
+ * * * @return null|string */ @@ -172,6 +236,14 @@ public function setId(?string $id): void $this->id = $id; } + /** + * @param ?AssetSourceCollection $sources + */ + public function setSources(?AssetSourceCollection $sources): void + { + $this->sources = $sources; + } + /** * @param ?LocalizedString $name */ @@ -188,6 +260,14 @@ public function setDescription(?LocalizedString $description): void $this->description = $description; } + /** + * @param ?array $tags + */ + public function setTags(?array $tags): void + { + $this->tags = $tags; + } + /** * @param ?CustomFields $custom */ diff --git a/lib/commercetools-history/src/Models/Common/AssetSource.php b/lib/commercetools-history/src/Models/Common/AssetSource.php index 2dfb0ffb485..f31baf05a99 100644 --- a/lib/commercetools-history/src/Models/Common/AssetSource.php +++ b/lib/commercetools-history/src/Models/Common/AssetSource.php @@ -20,24 +20,32 @@ interface AssetSource extends JsonObject public const FIELD_CONTENT_TYPE = 'contentType'; /** + *URI of the AssetSource.
+ * * @return null|string */ public function getUri(); /** + *User-defined identifier of the AssetSource. Must be unique per Asset.
+ * * @return null|string */ public function getKey(); /** + *Width and height of the AssetSource.
+ * * @return null|AssetDimensions */ public function getDimensions(); /** + *Indicates the type of content, for example application/pdf.
URI of the AssetSource.
+ * * @return null|string */ @@ -54,6 +56,8 @@ public function getUri() } /** + *User-defined identifier of the AssetSource. Must be unique per Asset.
+ * * @return null|string */ @@ -63,6 +67,8 @@ public function getKey() } /** + *Width and height of the AssetSource.
+ * * @return null|AssetDimensions */ @@ -72,6 +78,8 @@ public function getDimensions() } /** + *Indicates the type of content, for example application/pdf.
URI of the AssetSource.
+ * * * @return null|string */ @@ -81,6 +83,8 @@ public function getUri() } /** + *User-defined identifier of the AssetSource. Must be unique per Asset.
+ * * * @return null|string */ @@ -99,6 +103,8 @@ public function getKey() } /** + *Width and height of the AssetSource.
+ * * * @return null|AssetDimensions */ @@ -118,6 +124,8 @@ public function getDimensions() } /** + *Indicates the type of content, for example application/pdf.
Roles assigned to the Associate within a Business Unit.
+ * * @return null|AssociateRoleAssignmentCollection */ public function getAssociateRoleAssignments(); /** + *Deprecated type. Use associateRoleAssignments instead.
The Customer that acts as an Associate in the Business Unit.
+ * + + * @return null|CustomerReference */ public function getCustomer(); @@ -35,7 +48,12 @@ public function getCustomer(); public function setAssociateRoleAssignments(?AssociateRoleAssignmentCollection $associateRoleAssignments): void; /** - * @param ?Reference $customer + * @param ?array $roles + */ + public function setRoles(?array $roles): void; + + /** + * @param ?CustomerReference $customer */ - public function setCustomer(?Reference $customer): void; + public function setCustomer(?CustomerReference $customer): void; } diff --git a/lib/commercetools-history/src/Models/Common/AssociateBuilder.php b/lib/commercetools-history/src/Models/Common/AssociateBuilder.php index 7c24d319019..c9c5b29bf1a 100644 --- a/lib/commercetools-history/src/Models/Common/AssociateBuilder.php +++ b/lib/commercetools-history/src/Models/Common/AssociateBuilder.php @@ -28,11 +28,19 @@ final class AssociateBuilder implements Builder /** - * @var null|Reference|ReferenceBuilder + * @var ?array + */ + private $roles; + + /** + + * @var null|CustomerReference|CustomerReferenceBuilder */ private $customer; /** + *Roles assigned to the Associate within a Business Unit.
+ * * @return null|AssociateRoleAssignmentCollection */ @@ -42,12 +50,25 @@ public function getAssociateRoleAssignments() } /** + *Deprecated type. Use associateRoleAssignments instead.
The Customer that acts as an Associate in the Business Unit.
+ * - * @return null|Reference + * @return null|CustomerReference */ public function getCustomer() { - return $this->customer instanceof ReferenceBuilder ? $this->customer->build() : $this->customer; + return $this->customer instanceof CustomerReferenceBuilder ? $this->customer->build() : $this->customer; } /** @@ -62,10 +83,21 @@ public function withAssociateRoleAssignments(?AssociateRoleAssignmentCollection } /** - * @param ?Reference $customer + * @param ?array $roles + * @return $this + */ + public function withRoles(?array $roles) + { + $this->roles = $roles; + + return $this; + } + + /** + * @param ?CustomerReference $customer * @return $this */ - public function withCustomer(?Reference $customer) + public function withCustomer(?CustomerReference $customer) { $this->customer = $customer; @@ -76,7 +108,7 @@ public function withCustomer(?Reference $customer) * @deprecated use withCustomer() instead * @return $this */ - public function withCustomerBuilder(?ReferenceBuilder $customer) + public function withCustomerBuilder(?CustomerReferenceBuilder $customer) { $this->customer = $customer; @@ -87,7 +119,8 @@ public function build(): Associate { return new AssociateModel( $this->associateRoleAssignments, - $this->customer instanceof ReferenceBuilder ? $this->customer->build() : $this->customer + $this->roles, + $this->customer instanceof CustomerReferenceBuilder ? $this->customer->build() : $this->customer ); } diff --git a/lib/commercetools-history/src/Models/Common/AssociateModel.php b/lib/commercetools-history/src/Models/Common/AssociateModel.php index 1f9d1ef1b5c..7096e7f97a3 100644 --- a/lib/commercetools-history/src/Models/Common/AssociateModel.php +++ b/lib/commercetools-history/src/Models/Common/AssociateModel.php @@ -29,7 +29,13 @@ final class AssociateModel extends JsonObjectModel implements Associate /** * - * @var ?Reference + * @var ?array + */ + protected $roles; + + /** + * + * @var ?CustomerReference */ protected $customer; @@ -39,14 +45,18 @@ final class AssociateModel extends JsonObjectModel implements Associate */ public function __construct( ?AssociateRoleAssignmentCollection $associateRoleAssignments = null, - ?Reference $customer = null + ?array $roles = null, + ?CustomerReference $customer = null ) { $this->associateRoleAssignments = $associateRoleAssignments; + $this->roles = $roles; $this->customer = $customer; } /** + *Roles assigned to the Associate within a Business Unit.
+ * * * @return null|AssociateRoleAssignmentCollection */ @@ -65,8 +75,30 @@ public function getAssociateRoleAssignments() } /** + *Deprecated type. Use associateRoleAssignments instead.
The Customer that acts as an Associate in the Business Unit.
+ * + * + * @return null|CustomerReference */ public function getCustomer() { @@ -77,7 +109,7 @@ public function getCustomer() return null; } - $this->customer = ReferenceModel::of($data); + $this->customer = CustomerReferenceModel::of($data); } return $this->customer; @@ -93,9 +125,17 @@ public function setAssociateRoleAssignments(?AssociateRoleAssignmentCollection $ } /** - * @param ?Reference $customer + * @param ?array $roles + */ + public function setRoles(?array $roles): void + { + $this->roles = $roles; + } + + /** + * @param ?CustomerReference $customer */ - public function setCustomer(?Reference $customer): void + public function setCustomer(?CustomerReference $customer): void { $this->customer = $customer; } diff --git a/lib/commercetools-history/src/Models/Common/AssociateRoleAssignment.php b/lib/commercetools-history/src/Models/Common/AssociateRoleAssignment.php index 383dfc475aa..120521812d8 100644 --- a/lib/commercetools-history/src/Models/Common/AssociateRoleAssignment.php +++ b/lib/commercetools-history/src/Models/Common/AssociateRoleAssignment.php @@ -18,13 +18,15 @@ interface AssociateRoleAssignment extends JsonObject public const FIELD_INHERITANCE = 'inheritance'; /** + *Role the Associate holds within a Business Unit.
+ * - * @return null|KeyReference + * @return null|AssociateRoleKeyReference */ public function getAssociateRole(); /** - *Determines whether an AssociateRoleAssignment can be inherited by child Business Units.
+ *Determines whether the AssociateRoleAssignment can be inherited by child Business Units.
* * @return null|string @@ -32,9 +34,9 @@ public function getAssociateRole(); public function getInheritance(); /** - * @param ?KeyReference $associateRole + * @param ?AssociateRoleKeyReference $associateRole */ - public function setAssociateRole(?KeyReference $associateRole): void; + public function setAssociateRole(?AssociateRoleKeyReference $associateRole): void; /** * @param ?string $inheritance diff --git a/lib/commercetools-history/src/Models/Common/AssociateRoleAssignmentBuilder.php b/lib/commercetools-history/src/Models/Common/AssociateRoleAssignmentBuilder.php index 97ff0848b58..ff8f32ee760 100644 --- a/lib/commercetools-history/src/Models/Common/AssociateRoleAssignmentBuilder.php +++ b/lib/commercetools-history/src/Models/Common/AssociateRoleAssignmentBuilder.php @@ -22,7 +22,7 @@ final class AssociateRoleAssignmentBuilder implements Builder { /** - * @var null|KeyReference|KeyReferenceBuilder + * @var null|AssociateRoleKeyReference|AssociateRoleKeyReferenceBuilder */ private $associateRole; @@ -33,16 +33,18 @@ final class AssociateRoleAssignmentBuilder implements Builder private $inheritance; /** + *Role the Associate holds within a Business Unit.
+ * - * @return null|KeyReference + * @return null|AssociateRoleKeyReference */ public function getAssociateRole() { - return $this->associateRole instanceof KeyReferenceBuilder ? $this->associateRole->build() : $this->associateRole; + return $this->associateRole instanceof AssociateRoleKeyReferenceBuilder ? $this->associateRole->build() : $this->associateRole; } /** - *Determines whether an AssociateRoleAssignment can be inherited by child Business Units.
+ *Determines whether the AssociateRoleAssignment can be inherited by child Business Units.
* * @return null|string @@ -53,10 +55,10 @@ public function getInheritance() } /** - * @param ?KeyReference $associateRole + * @param ?AssociateRoleKeyReference $associateRole * @return $this */ - public function withAssociateRole(?KeyReference $associateRole) + public function withAssociateRole(?AssociateRoleKeyReference $associateRole) { $this->associateRole = $associateRole; @@ -78,7 +80,7 @@ public function withInheritance(?string $inheritance) * @deprecated use withAssociateRole() instead * @return $this */ - public function withAssociateRoleBuilder(?KeyReferenceBuilder $associateRole) + public function withAssociateRoleBuilder(?AssociateRoleKeyReferenceBuilder $associateRole) { $this->associateRole = $associateRole; @@ -88,7 +90,7 @@ public function withAssociateRoleBuilder(?KeyReferenceBuilder $associateRole) public function build(): AssociateRoleAssignment { return new AssociateRoleAssignmentModel( - $this->associateRole instanceof KeyReferenceBuilder ? $this->associateRole->build() : $this->associateRole, + $this->associateRole instanceof AssociateRoleKeyReferenceBuilder ? $this->associateRole->build() : $this->associateRole, $this->inheritance ); } diff --git a/lib/commercetools-history/src/Models/Common/AssociateRoleAssignmentModel.php b/lib/commercetools-history/src/Models/Common/AssociateRoleAssignmentModel.php index 4ac0b46bfa8..d8bd87a35c8 100644 --- a/lib/commercetools-history/src/Models/Common/AssociateRoleAssignmentModel.php +++ b/lib/commercetools-history/src/Models/Common/AssociateRoleAssignmentModel.php @@ -23,7 +23,7 @@ final class AssociateRoleAssignmentModel extends JsonObjectModel implements Asso /** * - * @var ?KeyReference + * @var ?AssociateRoleKeyReference */ protected $associateRole; @@ -38,7 +38,7 @@ final class AssociateRoleAssignmentModel extends JsonObjectModel implements Asso * @psalm-suppress MissingParamType */ public function __construct( - ?KeyReference $associateRole = null, + ?AssociateRoleKeyReference $associateRole = null, ?string $inheritance = null ) { $this->associateRole = $associateRole; @@ -47,8 +47,10 @@ public function __construct( } /** + *Role the Associate holds within a Business Unit.
* - * @return null|KeyReference + * + * @return null|AssociateRoleKeyReference */ public function getAssociateRole() { @@ -59,14 +61,14 @@ public function getAssociateRole() return null; } - $this->associateRole = KeyReferenceModel::of($data); + $this->associateRole = AssociateRoleKeyReferenceModel::of($data); } return $this->associateRole; } /** - *Determines whether an AssociateRoleAssignment can be inherited by child Business Units.
+ *Determines whether the AssociateRoleAssignment can be inherited by child Business Units.
* * * @return null|string @@ -87,9 +89,9 @@ public function getInheritance() /** - * @param ?KeyReference $associateRole + * @param ?AssociateRoleKeyReference $associateRole */ - public function setAssociateRole(?KeyReference $associateRole): void + public function setAssociateRole(?AssociateRoleKeyReference $associateRole): void { $this->associateRole = $associateRole; } diff --git a/lib/commercetools-history/src/Models/Common/AssociateRoleKeyReference.php b/lib/commercetools-history/src/Models/Common/AssociateRoleKeyReference.php new file mode 100644 index 00000000000..35b34169c29 --- /dev/null +++ b/lib/commercetools-history/src/Models/Common/AssociateRoleKeyReference.php @@ -0,0 +1,30 @@ +Unique and immutable key of the referenced AssociateRole. + * + + * @return null|string + */ + public function getKey(); + + /** + * @param ?string $key + */ + public function setKey(?string $key): void; +} diff --git a/lib/commercetools-history/src/Models/Common/AssociateRoleKeyReferenceBuilder.php b/lib/commercetools-history/src/Models/Common/AssociateRoleKeyReferenceBuilder.php new file mode 100644 index 00000000000..cf1cd33ad6b --- /dev/null +++ b/lib/commercetools-history/src/Models/Common/AssociateRoleKeyReferenceBuilder.php @@ -0,0 +1,63 @@ + + */ +final class AssociateRoleKeyReferenceBuilder implements Builder +{ + /** + + * @var ?string + */ + private $key; + + /** + *Unique and immutable key of the referenced AssociateRole.
+ * + + * @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(): AssociateRoleKeyReference + { + return new AssociateRoleKeyReferenceModel( + $this->key + ); + } + + public static function of(): AssociateRoleKeyReferenceBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-history/src/Models/Common/AssociateRoleKeyReferenceCollection.php b/lib/commercetools-history/src/Models/Common/AssociateRoleKeyReferenceCollection.php new file mode 100644 index 00000000000..b969b6c1512 --- /dev/null +++ b/lib/commercetools-history/src/Models/Common/AssociateRoleKeyReferenceCollection.php @@ -0,0 +1,56 @@ + + * @method AssociateRoleKeyReference current() + * @method AssociateRoleKeyReference end() + * @method AssociateRoleKeyReference at($offset) + */ +class AssociateRoleKeyReferenceCollection extends KeyReferenceCollection +{ + /** + * @psalm-assert AssociateRoleKeyReference $value + * @psalm-param AssociateRoleKeyReference|stdClass $value + * @throws InvalidArgumentException + * + * @return AssociateRoleKeyReferenceCollection + */ + public function add($value) + { + if (!$value instanceof AssociateRoleKeyReference) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?AssociateRoleKeyReference + */ + protected function mapper() + { + return function (?int $index): ?AssociateRoleKeyReference { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var AssociateRoleKeyReference $data */ + $data = AssociateRoleKeyReferenceModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-history/src/Models/Common/AssociateRoleKeyReferenceModel.php b/lib/commercetools-history/src/Models/Common/AssociateRoleKeyReferenceModel.php new file mode 100644 index 00000000000..5eb18812387 --- /dev/null +++ b/lib/commercetools-history/src/Models/Common/AssociateRoleKeyReferenceModel.php @@ -0,0 +1,99 @@ +key = $key; + $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 and immutable key of the referenced AssociateRole.
+ * + * + * @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-history/src/Models/Common/Attribute.php b/lib/commercetools-history/src/Models/Common/Attribute.php new file mode 100644 index 00000000000..e0a189833dd --- /dev/null +++ b/lib/commercetools-history/src/Models/Common/Attribute.php @@ -0,0 +1,55 @@ +Name of the Attribute. + * + + * @return null|string + */ + public function getName(); + + /** + *The AttributeType determines the format of the Attribute value to be provided:
key of the Plain Enum Value or Localized Enum Value objects,
+ * or the complete objects as value.value.value.set object as value.value.value.Name of the Attribute.
+ * + + * @return null|string + */ + public function getName() + { + return $this->name; + } + + /** + *The AttributeType determines the format of the Attribute value to be provided:
key of the Plain Enum Value or Localized Enum Value objects,
+ * or the complete objects as value.value.value.set object as value.value.value.Describes the Type of the Attribute.
+ * * @return null|AttributeType */ public function getType(); /** - *The unique name of the attribute used in the API. The name must be between two and 256 characters long and can contain the ASCII letters A to Z in lowercase or uppercase, digits, underscores (_) and the hyphen-minus (-). When using the same name for an attribute in two or more product types all fields of the AttributeDefinition of this attribute need to be the same across the product types, otherwise an AttributeDefinitionAlreadyExists error code will be returned. An exception to this are the values of an enum or lenum type and sets thereof.
User-defined name of the Attribute that is unique within the Project.
* * @return null|string @@ -38,13 +41,15 @@ public function getType(); public function getName(); /** + *Human-readable label for the Attribute.
+ * * @return null|LocalizedString */ public function getLabel(); /** - *Whether the attribute is required to have a value.
+ *If true, the Attribute must have a value on a ProductVariant.
Specifies whether the Attribute is defined at the Product or Variant level.
+ * + + * @return null|string + */ + public function getLevel(); + + /** + *Specifies how Attributes are validated across all variants of a Product.
+ * * @return null|string */ public function getAttributeConstraint(); /** + *Provides additional Attribute information to aid content managers configure Product details.
+ * * @return null|LocalizedString */ public function getInputTip(); /** + *Provides a visual representation directive for values of this Attribute (only relevant for AttributeTextType and AttributeLocalizableTextType).
+ * * @return null|string */ public function getInputHint(); /** - *Whether the attribute's values should generally be enabled in product search. This determines whether the value is stored in products for matching terms in the context of full-text search queries and can be used in facets & filters as part of product search queries. The exact features that are enabled/disabled with this flag depend on the concrete attribute type and are described there. The max size of a searchable field is restricted to 10922 characters. This constraint is enforced at both product creation and product update. If the length of the input exceeds the maximum size an InvalidField error is returned.
+ *If true, the Attribute's values are available in the Product Search or the Product Projection Search API for use in full-text search queries, filters, and facets.
+ * However, if an Attribute's level is set as Product, then Product Projection Search does not support the Attribute.
The exact features that are available with this flag depend on the specific AttributeType. + * The maximum size of a searchable field is restricted by the Field content size limit. + * This constraint is enforced at both Product creation and Product update. + * If the length of the input exceeds the maximum size, an InvalidField error is returned.
* * @return null|bool @@ -97,6 +121,11 @@ public function setLabel(?LocalizedString $label): void; */ public function setIsRequired(?bool $isRequired): void; + /** + * @param ?string $level + */ + public function setLevel(?string $level): void; + /** * @param ?string $attributeConstraint */ diff --git a/lib/commercetools-history/src/Models/Common/AttributeDefinitionBuilder.php b/lib/commercetools-history/src/Models/Common/AttributeDefinitionBuilder.php index a1f99900cab..08643fa68b3 100644 --- a/lib/commercetools-history/src/Models/Common/AttributeDefinitionBuilder.php +++ b/lib/commercetools-history/src/Models/Common/AttributeDefinitionBuilder.php @@ -44,6 +44,12 @@ final class AttributeDefinitionBuilder implements Builder */ private $isRequired; + /** + + * @var ?string + */ + private $level; + /** * @var ?string @@ -69,6 +75,8 @@ final class AttributeDefinitionBuilder implements Builder private $isSearchable; /** + *Describes the Type of the Attribute.
+ * * @return null|AttributeType */ @@ -78,7 +86,7 @@ public function getType() } /** - *The unique name of the attribute used in the API. The name must be between two and 256 characters long and can contain the ASCII letters A to Z in lowercase or uppercase, digits, underscores (_) and the hyphen-minus (-). When using the same name for an attribute in two or more product types all fields of the AttributeDefinition of this attribute need to be the same across the product types, otherwise an AttributeDefinitionAlreadyExists error code will be returned. An exception to this are the values of an enum or lenum type and sets thereof.
User-defined name of the Attribute that is unique within the Project.
* * @return null|string @@ -89,6 +97,8 @@ public function getName() } /** + *Human-readable label for the Attribute.
+ * * @return null|LocalizedString */ @@ -98,7 +108,7 @@ public function getLabel() } /** - *Whether the attribute is required to have a value.
+ *If true, the Attribute must have a value on a ProductVariant.
Specifies whether the Attribute is defined at the Product or Variant level.
+ * + + * @return null|string + */ + public function getLevel() + { + return $this->level; + } + + /** + *Specifies how Attributes are validated across all variants of a Product.
+ * * @return null|string */ @@ -118,6 +141,8 @@ public function getAttributeConstraint() } /** + *Provides additional Attribute information to aid content managers configure Product details.
+ * * @return null|LocalizedString */ @@ -127,6 +152,8 @@ public function getInputTip() } /** + *Provides a visual representation directive for values of this Attribute (only relevant for AttributeTextType and AttributeLocalizableTextType).
+ * * @return null|string */ @@ -136,7 +163,12 @@ public function getInputHint() } /** - *Whether the attribute's values should generally be enabled in product search. This determines whether the value is stored in products for matching terms in the context of full-text search queries and can be used in facets & filters as part of product search queries. The exact features that are enabled/disabled with this flag depend on the concrete attribute type and are described there. The max size of a searchable field is restricted to 10922 characters. This constraint is enforced at both product creation and product update. If the length of the input exceeds the maximum size an InvalidField error is returned.
+ *If true, the Attribute's values are available in the Product Search or the Product Projection Search API for use in full-text search queries, filters, and facets.
+ * However, if an Attribute's level is set as Product, then Product Projection Search does not support the Attribute.
The exact features that are available with this flag depend on the specific AttributeType. + * The maximum size of a searchable field is restricted by the Field content size limit. + * This constraint is enforced at both Product creation and Product update. + * If the length of the input exceeds the maximum size, an InvalidField error is returned.
* * @return null|bool @@ -190,6 +222,17 @@ public function withIsRequired(?bool $isRequired) return $this; } + /** + * @param ?string $level + * @return $this + */ + public function withLevel(?string $level) + { + $this->level = $level; + + return $this; + } + /** * @param ?string $attributeConstraint * @return $this @@ -274,6 +317,7 @@ public function build(): AttributeDefinition $this->name, $this->label instanceof LocalizedStringBuilder ? $this->label->build() : $this->label, $this->isRequired, + $this->level, $this->attributeConstraint, $this->inputTip instanceof LocalizedStringBuilder ? $this->inputTip->build() : $this->inputTip, $this->inputHint, diff --git a/lib/commercetools-history/src/Models/Common/AttributeDefinitionModel.php b/lib/commercetools-history/src/Models/Common/AttributeDefinitionModel.php index 449d45fb27a..ccbde041745 100644 --- a/lib/commercetools-history/src/Models/Common/AttributeDefinitionModel.php +++ b/lib/commercetools-history/src/Models/Common/AttributeDefinitionModel.php @@ -45,6 +45,12 @@ final class AttributeDefinitionModel extends JsonObjectModel implements Attribut */ protected $isRequired; + /** + * + * @var ?string + */ + protected $level; + /** * * @var ?string @@ -78,6 +84,7 @@ public function __construct( ?string $name = null, ?LocalizedString $label = null, ?bool $isRequired = null, + ?string $level = null, ?string $attributeConstraint = null, ?LocalizedString $inputTip = null, ?string $inputHint = null, @@ -87,6 +94,7 @@ public function __construct( $this->name = $name; $this->label = $label; $this->isRequired = $isRequired; + $this->level = $level; $this->attributeConstraint = $attributeConstraint; $this->inputTip = $inputTip; $this->inputHint = $inputHint; @@ -95,6 +103,8 @@ public function __construct( } /** + *Describes the Type of the Attribute.
+ * * * @return null|AttributeType */ @@ -114,7 +124,7 @@ public function getType() } /** - *The unique name of the attribute used in the API. The name must be between two and 256 characters long and can contain the ASCII letters A to Z in lowercase or uppercase, digits, underscores (_) and the hyphen-minus (-). When using the same name for an attribute in two or more product types all fields of the AttributeDefinition of this attribute need to be the same across the product types, otherwise an AttributeDefinitionAlreadyExists error code will be returned. An exception to this are the values of an enum or lenum type and sets thereof.
User-defined name of the Attribute that is unique within the Project.
* * * @return null|string @@ -134,6 +144,8 @@ public function getName() } /** + *Human-readable label for the Attribute.
+ * * * @return null|LocalizedString */ @@ -153,7 +165,7 @@ public function getLabel() } /** - *Whether the attribute is required to have a value.
+ *If true, the Attribute must have a value on a ProductVariant.
Specifies whether the Attribute is defined at the Product or Variant level.
+ * + * + * @return null|string + */ + public function getLevel() + { + if (is_null($this->level)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_LEVEL); + if (is_null($data)) { + return null; + } + $this->level = (string) $data; + } + + return $this->level; + } + + /** + *Specifies how Attributes are validated across all variants of a Product.
+ * * * @return null|string */ @@ -191,6 +225,8 @@ public function getAttributeConstraint() } /** + *Provides additional Attribute information to aid content managers configure Product details.
+ * * * @return null|LocalizedString */ @@ -210,6 +246,8 @@ public function getInputTip() } /** + *Provides a visual representation directive for values of this Attribute (only relevant for AttributeTextType and AttributeLocalizableTextType).
+ * * * @return null|string */ @@ -228,7 +266,12 @@ public function getInputHint() } /** - *Whether the attribute's values should generally be enabled in product search. This determines whether the value is stored in products for matching terms in the context of full-text search queries and can be used in facets & filters as part of product search queries. The exact features that are enabled/disabled with this flag depend on the concrete attribute type and are described there. The max size of a searchable field is restricted to 10922 characters. This constraint is enforced at both product creation and product update. If the length of the input exceeds the maximum size an InvalidField error is returned.
+ *If true, the Attribute's values are available in the Product Search or the Product Projection Search API for use in full-text search queries, filters, and facets.
+ * However, if an Attribute's level is set as Product, then Product Projection Search does not support the Attribute.
The exact features that are available with this flag depend on the specific AttributeType. + * The maximum size of a searchable field is restricted by the Field content size limit. + * This constraint is enforced at both Product creation and Product update. + * If the length of the input exceeds the maximum size, an InvalidField error is returned.
* * * @return null|bool @@ -280,6 +323,14 @@ public function setIsRequired(?bool $isRequired): void $this->isRequired = $isRequired; } + /** + * @param ?string $level + */ + public function setLevel(?string $level): void + { + $this->level = $level; + } + /** * @param ?string $attributeConstraint */ diff --git a/lib/commercetools-history/src/Models/Common/AttributeModel.php b/lib/commercetools-history/src/Models/Common/AttributeModel.php new file mode 100644 index 00000000000..e085a64878f --- /dev/null +++ b/lib/commercetools-history/src/Models/Common/AttributeModel.php @@ -0,0 +1,118 @@ +name = $name; + $this->value = $value; + + } + + /** + *Name of the Attribute.
+ * + * + * @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 AttributeType determines the format of the Attribute value to be provided:
key of the Plain Enum Value or Localized Enum Value objects,
+ * or the complete objects as value.value.value.set object as value.value.value.It is not recommended to set it manually since the API overwrites this ID when creating an Address for a Customer.
+ * Use key instead and omit this field from the request to let the API generate the ID for the Address.
User-defined identifier of the Address that must be unique when multiple addresses are referenced in BusinessUnits, Customers, and itemShippingAddresses (LineItem-specific addresses) of a Cart, Order, QuoteRequest, or Quote.
Name of the country.
+ * + + * @return null|string + */ + public function getCountry(); + + /** + *Title of the contact, for example 'Dr.'
+ * + + * @return null|string + */ + public function getTitle(); + + /** + *Salutation of the contact, for example 'Mr.' or 'Ms.'
+ * + + * @return null|string + */ + public function getSalutation(); + + /** + *Given name (first name) of the contact.
+ * + + * @return null|string + */ + public function getFirstName(); + + /** + *Family name (last name) of the contact.
+ * + + * @return null|string + */ + public function getLastName(); + + /** + *Name of the street.
+ * + + * @return null|string + */ + public function getStreetName(); + + /** + *Street number.
+ * + + * @return null|string + */ + public function getStreetNumber(); + + /** + *Further information on the street address.
+ * + + * @return null|string + */ + public function getAdditionalStreetInfo(); + + /** + *Postal code.
+ * + + * @return null|string + */ + public function getPostalCode(); + + /** + *Name of the city.
+ * + + * @return null|string + */ + public function getCity(); + + /** + *Name of the region.
+ * + + * @return null|string + */ + public function getRegion(); + + /** + *Name of the state, for example, Colorado.
+ * + + * @return null|string + */ + public function getState(); + + /** + *Name of the company.
+ * + + * @return null|string + */ + public function getCompany(); + + /** + *Name of the department.
+ * + + * @return null|string + */ + public function getDepartment(); + + /** + *Number or name of the building.
+ * + + * @return null|string + */ + public function getBuilding(); + + /** + *Number or name of the apartment.
+ * + + * @return null|string + */ + public function getApartment(); + + /** + *Post office box number.
+ * + + * @return null|string + */ + public function getPOBox(); + + /** + *Phone number of the contact.
+ * + + * @return null|string + */ + public function getPhone(); + + /** + *Mobile phone number of the contact.
+ * + + * @return null|string + */ + public function getMobile(); + + /** + *Email address of the contact.
+ * + + * @return null|string + */ + public function getEmail(); + + /** + *Fax number of the contact.
+ * + + * @return null|string + */ + public function getFax(); + + /** + *Further information on the Address.
+ * + + * @return null|string + */ + public function getAdditionalAddressInfo(); + + /** + *ID for the contact used in an external system.
+ * + + * @return null|string + */ + public function getExternalId(); + + /** + * @param ?string $id + */ + public function setId(?string $id): void; + + /** + * @param ?string $key + */ + public function setKey(?string $key): void; + + /** + * @param ?string $country + */ + public function setCountry(?string $country): void; + + /** + * @param ?string $title + */ + public function setTitle(?string $title): void; + + /** + * @param ?string $salutation + */ + public function setSalutation(?string $salutation): void; + + /** + * @param ?string $firstName + */ + public function setFirstName(?string $firstName): void; + + /** + * @param ?string $lastName + */ + public function setLastName(?string $lastName): void; + + /** + * @param ?string $streetName + */ + public function setStreetName(?string $streetName): void; + + /** + * @param ?string $streetNumber + */ + public function setStreetNumber(?string $streetNumber): void; + + /** + * @param ?string $additionalStreetInfo + */ + public function setAdditionalStreetInfo(?string $additionalStreetInfo): void; + + /** + * @param ?string $postalCode + */ + public function setPostalCode(?string $postalCode): void; + + /** + * @param ?string $city + */ + public function setCity(?string $city): void; + + /** + * @param ?string $region + */ + public function setRegion(?string $region): void; + + /** + * @param ?string $state + */ + public function setState(?string $state): void; + + /** + * @param ?string $company + */ + public function setCompany(?string $company): void; + + /** + * @param ?string $department + */ + public function setDepartment(?string $department): void; + + /** + * @param ?string $building + */ + public function setBuilding(?string $building): void; + + /** + * @param ?string $apartment + */ + public function setApartment(?string $apartment): void; + + /** + * @param ?string $pOBox + */ + public function setPOBox(?string $pOBox): void; + + /** + * @param ?string $phone + */ + public function setPhone(?string $phone): void; + + /** + * @param ?string $mobile + */ + public function setMobile(?string $mobile): void; + + /** + * @param ?string $email + */ + public function setEmail(?string $email): void; + + /** + * @param ?string $fax + */ + public function setFax(?string $fax): void; + + /** + * @param ?string $additionalAddressInfo + */ + public function setAdditionalAddressInfo(?string $additionalAddressInfo): void; + + /** + * @param ?string $externalId + */ + public function setExternalId(?string $externalId): void; +} diff --git a/lib/commercetools-history/src/Models/Common/BaseAddressBuilder.php b/lib/commercetools-history/src/Models/Common/BaseAddressBuilder.php new file mode 100644 index 00000000000..f907911ca02 --- /dev/null +++ b/lib/commercetools-history/src/Models/Common/BaseAddressBuilder.php @@ -0,0 +1,761 @@ + + */ +final class BaseAddressBuilder implements Builder +{ + /** + + * @var ?string + */ + private $id; + + /** + + * @var ?string + */ + private $key; + + /** + + * @var ?string + */ + private $country; + + /** + + * @var ?string + */ + private $title; + + /** + + * @var ?string + */ + private $salutation; + + /** + + * @var ?string + */ + private $firstName; + + /** + + * @var ?string + */ + private $lastName; + + /** + + * @var ?string + */ + private $streetName; + + /** + + * @var ?string + */ + private $streetNumber; + + /** + + * @var ?string + */ + private $additionalStreetInfo; + + /** + + * @var ?string + */ + private $postalCode; + + /** + + * @var ?string + */ + private $city; + + /** + + * @var ?string + */ + private $region; + + /** + + * @var ?string + */ + private $state; + + /** + + * @var ?string + */ + private $company; + + /** + + * @var ?string + */ + private $department; + + /** + + * @var ?string + */ + private $building; + + /** + + * @var ?string + */ + private $apartment; + + /** + + * @var ?string + */ + private $pOBox; + + /** + + * @var ?string + */ + private $phone; + + /** + + * @var ?string + */ + private $mobile; + + /** + + * @var ?string + */ + private $email; + + /** + + * @var ?string + */ + private $fax; + + /** + + * @var ?string + */ + private $additionalAddressInfo; + + /** + + * @var ?string + */ + private $externalId; + + /** + *Unique identifier of the Address.
+ *It is not recommended to set it manually since the API overwrites this ID when creating an Address for a Customer.
+ * Use key instead and omit this field from the request to let the API generate the ID for the Address.
User-defined identifier of the Address that must be unique when multiple addresses are referenced in BusinessUnits, Customers, and itemShippingAddresses (LineItem-specific addresses) of a Cart, Order, QuoteRequest, or Quote.
Name of the country.
+ * + + * @return null|string + */ + public function getCountry() + { + return $this->country; + } + + /** + *Title of the contact, for example 'Dr.'
+ * + + * @return null|string + */ + public function getTitle() + { + return $this->title; + } + + /** + *Salutation of the contact, for example 'Mr.' or 'Ms.'
+ * + + * @return null|string + */ + public function getSalutation() + { + return $this->salutation; + } + + /** + *Given name (first name) of the contact.
+ * + + * @return null|string + */ + public function getFirstName() + { + return $this->firstName; + } + + /** + *Family name (last name) of the contact.
+ * + + * @return null|string + */ + public function getLastName() + { + return $this->lastName; + } + + /** + *Name of the street.
+ * + + * @return null|string + */ + public function getStreetName() + { + return $this->streetName; + } + + /** + *Street number.
+ * + + * @return null|string + */ + public function getStreetNumber() + { + return $this->streetNumber; + } + + /** + *Further information on the street address.
+ * + + * @return null|string + */ + public function getAdditionalStreetInfo() + { + return $this->additionalStreetInfo; + } + + /** + *Postal code.
+ * + + * @return null|string + */ + public function getPostalCode() + { + return $this->postalCode; + } + + /** + *Name of the city.
+ * + + * @return null|string + */ + public function getCity() + { + return $this->city; + } + + /** + *Name of the region.
+ * + + * @return null|string + */ + public function getRegion() + { + return $this->region; + } + + /** + *Name of the state, for example, Colorado.
+ * + + * @return null|string + */ + public function getState() + { + return $this->state; + } + + /** + *Name of the company.
+ * + + * @return null|string + */ + public function getCompany() + { + return $this->company; + } + + /** + *Name of the department.
+ * + + * @return null|string + */ + public function getDepartment() + { + return $this->department; + } + + /** + *Number or name of the building.
+ * + + * @return null|string + */ + public function getBuilding() + { + return $this->building; + } + + /** + *Number or name of the apartment.
+ * + + * @return null|string + */ + public function getApartment() + { + return $this->apartment; + } + + /** + *Post office box number.
+ * + + * @return null|string + */ + public function getPOBox() + { + return $this->pOBox; + } + + /** + *Phone number of the contact.
+ * + + * @return null|string + */ + public function getPhone() + { + return $this->phone; + } + + /** + *Mobile phone number of the contact.
+ * + + * @return null|string + */ + public function getMobile() + { + return $this->mobile; + } + + /** + *Email address of the contact.
+ * + + * @return null|string + */ + public function getEmail() + { + return $this->email; + } + + /** + *Fax number of the contact.
+ * + + * @return null|string + */ + public function getFax() + { + return $this->fax; + } + + /** + *Further information on the Address.
+ * + + * @return null|string + */ + public function getAdditionalAddressInfo() + { + return $this->additionalAddressInfo; + } + + /** + *ID for the contact used in an external system.
+ * + + * @return null|string + */ + public function getExternalId() + { + return $this->externalId; + } + + /** + * @param ?string $id + * @return $this + */ + public function withId(?string $id) + { + $this->id = $id; + + return $this; + } + + /** + * @param ?string $key + * @return $this + */ + public function withKey(?string $key) + { + $this->key = $key; + + return $this; + } + + /** + * @param ?string $country + * @return $this + */ + public function withCountry(?string $country) + { + $this->country = $country; + + return $this; + } + + /** + * @param ?string $title + * @return $this + */ + public function withTitle(?string $title) + { + $this->title = $title; + + return $this; + } + + /** + * @param ?string $salutation + * @return $this + */ + public function withSalutation(?string $salutation) + { + $this->salutation = $salutation; + + return $this; + } + + /** + * @param ?string $firstName + * @return $this + */ + public function withFirstName(?string $firstName) + { + $this->firstName = $firstName; + + return $this; + } + + /** + * @param ?string $lastName + * @return $this + */ + public function withLastName(?string $lastName) + { + $this->lastName = $lastName; + + return $this; + } + + /** + * @param ?string $streetName + * @return $this + */ + public function withStreetName(?string $streetName) + { + $this->streetName = $streetName; + + return $this; + } + + /** + * @param ?string $streetNumber + * @return $this + */ + public function withStreetNumber(?string $streetNumber) + { + $this->streetNumber = $streetNumber; + + return $this; + } + + /** + * @param ?string $additionalStreetInfo + * @return $this + */ + public function withAdditionalStreetInfo(?string $additionalStreetInfo) + { + $this->additionalStreetInfo = $additionalStreetInfo; + + return $this; + } + + /** + * @param ?string $postalCode + * @return $this + */ + public function withPostalCode(?string $postalCode) + { + $this->postalCode = $postalCode; + + return $this; + } + + /** + * @param ?string $city + * @return $this + */ + public function withCity(?string $city) + { + $this->city = $city; + + return $this; + } + + /** + * @param ?string $region + * @return $this + */ + public function withRegion(?string $region) + { + $this->region = $region; + + return $this; + } + + /** + * @param ?string $state + * @return $this + */ + public function withState(?string $state) + { + $this->state = $state; + + return $this; + } + + /** + * @param ?string $company + * @return $this + */ + public function withCompany(?string $company) + { + $this->company = $company; + + return $this; + } + + /** + * @param ?string $department + * @return $this + */ + public function withDepartment(?string $department) + { + $this->department = $department; + + return $this; + } + + /** + * @param ?string $building + * @return $this + */ + public function withBuilding(?string $building) + { + $this->building = $building; + + return $this; + } + + /** + * @param ?string $apartment + * @return $this + */ + public function withApartment(?string $apartment) + { + $this->apartment = $apartment; + + return $this; + } + + /** + * @param ?string $pOBox + * @return $this + */ + public function withPOBox(?string $pOBox) + { + $this->pOBox = $pOBox; + + return $this; + } + + /** + * @param ?string $phone + * @return $this + */ + public function withPhone(?string $phone) + { + $this->phone = $phone; + + return $this; + } + + /** + * @param ?string $mobile + * @return $this + */ + public function withMobile(?string $mobile) + { + $this->mobile = $mobile; + + return $this; + } + + /** + * @param ?string $email + * @return $this + */ + public function withEmail(?string $email) + { + $this->email = $email; + + return $this; + } + + /** + * @param ?string $fax + * @return $this + */ + public function withFax(?string $fax) + { + $this->fax = $fax; + + return $this; + } + + /** + * @param ?string $additionalAddressInfo + * @return $this + */ + public function withAdditionalAddressInfo(?string $additionalAddressInfo) + { + $this->additionalAddressInfo = $additionalAddressInfo; + + return $this; + } + + /** + * @param ?string $externalId + * @return $this + */ + public function withExternalId(?string $externalId) + { + $this->externalId = $externalId; + + return $this; + } + + + public function build(): BaseAddress + { + return new BaseAddressModel( + $this->id, + $this->key, + $this->country, + $this->title, + $this->salutation, + $this->firstName, + $this->lastName, + $this->streetName, + $this->streetNumber, + $this->additionalStreetInfo, + $this->postalCode, + $this->city, + $this->region, + $this->state, + $this->company, + $this->department, + $this->building, + $this->apartment, + $this->pOBox, + $this->phone, + $this->mobile, + $this->email, + $this->fax, + $this->additionalAddressInfo, + $this->externalId + ); + } + + public static function of(): BaseAddressBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-history/src/Models/Common/BaseAddressCollection.php b/lib/commercetools-history/src/Models/Common/BaseAddressCollection.php new file mode 100644 index 00000000000..f93901a7779 --- /dev/null +++ b/lib/commercetools-history/src/Models/Common/BaseAddressCollection.php @@ -0,0 +1,60 @@ + + * @psalm-method T current() + * @psalm-method T end() + * @psalm-method T at($offset) + * @method BaseAddress current() + * @method BaseAddress end() + * @method BaseAddress at($offset) + */ +class BaseAddressCollection extends MapperSequence +{ + /** + * @psalm-assert T $value + * @psalm-param T|stdClass $value + * @throws InvalidArgumentException + * + * @return BaseAddressCollection + */ + public function add($value) + { + if (!$value instanceof BaseAddress) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?T + */ + protected function mapper() + { + return function (?int $index): ?BaseAddress { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var T $data */ + $data = BaseAddressModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-history/src/Models/Common/BaseAddressModel.php b/lib/commercetools-history/src/Models/Common/BaseAddressModel.php new file mode 100644 index 00000000000..c03885d7a9a --- /dev/null +++ b/lib/commercetools-history/src/Models/Common/BaseAddressModel.php @@ -0,0 +1,938 @@ +id = $id; + $this->key = $key; + $this->country = $country; + $this->title = $title; + $this->salutation = $salutation; + $this->firstName = $firstName; + $this->lastName = $lastName; + $this->streetName = $streetName; + $this->streetNumber = $streetNumber; + $this->additionalStreetInfo = $additionalStreetInfo; + $this->postalCode = $postalCode; + $this->city = $city; + $this->region = $region; + $this->state = $state; + $this->company = $company; + $this->department = $department; + $this->building = $building; + $this->apartment = $apartment; + $this->pOBox = $pOBox; + $this->phone = $phone; + $this->mobile = $mobile; + $this->email = $email; + $this->fax = $fax; + $this->additionalAddressInfo = $additionalAddressInfo; + $this->externalId = $externalId; + + } + + /** + *Unique identifier of the Address.
+ *It is not recommended to set it manually since the API overwrites this ID when creating an Address for a Customer.
+ * Use key instead and omit this field from the request to let the API generate the ID for the Address.
User-defined identifier of the Address that must be unique when multiple addresses are referenced in BusinessUnits, Customers, and itemShippingAddresses (LineItem-specific addresses) of a Cart, Order, QuoteRequest, or Quote.
Name of the country.
+ * + * + * @return null|string + */ + public function getCountry() + { + if (is_null($this->country)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_COUNTRY); + if (is_null($data)) { + return null; + } + $this->country = (string) $data; + } + + return $this->country; + } + + /** + *Title of the contact, for example 'Dr.'
+ * + * + * @return null|string + */ + public function getTitle() + { + if (is_null($this->title)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_TITLE); + if (is_null($data)) { + return null; + } + $this->title = (string) $data; + } + + return $this->title; + } + + /** + *Salutation of the contact, for example 'Mr.' or 'Ms.'
+ * + * + * @return null|string + */ + public function getSalutation() + { + if (is_null($this->salutation)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_SALUTATION); + if (is_null($data)) { + return null; + } + $this->salutation = (string) $data; + } + + return $this->salutation; + } + + /** + *Given name (first name) of the contact.
+ * + * + * @return null|string + */ + public function getFirstName() + { + if (is_null($this->firstName)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_FIRST_NAME); + if (is_null($data)) { + return null; + } + $this->firstName = (string) $data; + } + + return $this->firstName; + } + + /** + *Family name (last name) of the contact.
+ * + * + * @return null|string + */ + public function getLastName() + { + if (is_null($this->lastName)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_LAST_NAME); + if (is_null($data)) { + return null; + } + $this->lastName = (string) $data; + } + + return $this->lastName; + } + + /** + *Name of the street.
+ * + * + * @return null|string + */ + public function getStreetName() + { + if (is_null($this->streetName)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_STREET_NAME); + if (is_null($data)) { + return null; + } + $this->streetName = (string) $data; + } + + return $this->streetName; + } + + /** + *Street number.
+ * + * + * @return null|string + */ + public function getStreetNumber() + { + if (is_null($this->streetNumber)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_STREET_NUMBER); + if (is_null($data)) { + return null; + } + $this->streetNumber = (string) $data; + } + + return $this->streetNumber; + } + + /** + *Further information on the street address.
+ * + * + * @return null|string + */ + public function getAdditionalStreetInfo() + { + if (is_null($this->additionalStreetInfo)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_ADDITIONAL_STREET_INFO); + if (is_null($data)) { + return null; + } + $this->additionalStreetInfo = (string) $data; + } + + return $this->additionalStreetInfo; + } + + /** + *Postal code.
+ * + * + * @return null|string + */ + public function getPostalCode() + { + if (is_null($this->postalCode)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_POSTAL_CODE); + if (is_null($data)) { + return null; + } + $this->postalCode = (string) $data; + } + + return $this->postalCode; + } + + /** + *Name of the city.
+ * + * + * @return null|string + */ + public function getCity() + { + if (is_null($this->city)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CITY); + if (is_null($data)) { + return null; + } + $this->city = (string) $data; + } + + return $this->city; + } + + /** + *Name of the region.
+ * + * + * @return null|string + */ + public function getRegion() + { + if (is_null($this->region)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_REGION); + if (is_null($data)) { + return null; + } + $this->region = (string) $data; + } + + return $this->region; + } + + /** + *Name of the state, for example, Colorado.
+ * + * + * @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; + } + + /** + *Name of the company.
+ * + * + * @return null|string + */ + public function getCompany() + { + if (is_null($this->company)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_COMPANY); + if (is_null($data)) { + return null; + } + $this->company = (string) $data; + } + + return $this->company; + } + + /** + *Name of the department.
+ * + * + * @return null|string + */ + public function getDepartment() + { + if (is_null($this->department)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_DEPARTMENT); + if (is_null($data)) { + return null; + } + $this->department = (string) $data; + } + + return $this->department; + } + + /** + *Number or name of the building.
+ * + * + * @return null|string + */ + public function getBuilding() + { + if (is_null($this->building)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_BUILDING); + if (is_null($data)) { + return null; + } + $this->building = (string) $data; + } + + return $this->building; + } + + /** + *Number or name of the apartment.
+ * + * + * @return null|string + */ + public function getApartment() + { + if (is_null($this->apartment)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_APARTMENT); + if (is_null($data)) { + return null; + } + $this->apartment = (string) $data; + } + + return $this->apartment; + } + + /** + *Post office box number.
+ * + * + * @return null|string + */ + public function getPOBox() + { + if (is_null($this->pOBox)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_P_O_BOX); + if (is_null($data)) { + return null; + } + $this->pOBox = (string) $data; + } + + return $this->pOBox; + } + + /** + *Phone number of the contact.
+ * + * + * @return null|string + */ + public function getPhone() + { + if (is_null($this->phone)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_PHONE); + if (is_null($data)) { + return null; + } + $this->phone = (string) $data; + } + + return $this->phone; + } + + /** + *Mobile phone number of the contact.
+ * + * + * @return null|string + */ + public function getMobile() + { + if (is_null($this->mobile)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_MOBILE); + if (is_null($data)) { + return null; + } + $this->mobile = (string) $data; + } + + return $this->mobile; + } + + /** + *Email address of the contact.
+ * + * + * @return null|string + */ + public function getEmail() + { + if (is_null($this->email)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_EMAIL); + if (is_null($data)) { + return null; + } + $this->email = (string) $data; + } + + return $this->email; + } + + /** + *Fax number of the contact.
+ * + * + * @return null|string + */ + public function getFax() + { + if (is_null($this->fax)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_FAX); + if (is_null($data)) { + return null; + } + $this->fax = (string) $data; + } + + return $this->fax; + } + + /** + *Further information on the Address.
+ * + * + * @return null|string + */ + public function getAdditionalAddressInfo() + { + if (is_null($this->additionalAddressInfo)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_ADDITIONAL_ADDRESS_INFO); + if (is_null($data)) { + return null; + } + $this->additionalAddressInfo = (string) $data; + } + + return $this->additionalAddressInfo; + } + + /** + *ID for the contact used in an external system.
+ * + * + * @return null|string + */ + public function getExternalId() + { + if (is_null($this->externalId)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_EXTERNAL_ID); + if (is_null($data)) { + return null; + } + $this->externalId = (string) $data; + } + + return $this->externalId; + } + + + /** + * @param ?string $id + */ + public function setId(?string $id): void + { + $this->id = $id; + } + + /** + * @param ?string $key + */ + public function setKey(?string $key): void + { + $this->key = $key; + } + + /** + * @param ?string $country + */ + public function setCountry(?string $country): void + { + $this->country = $country; + } + + /** + * @param ?string $title + */ + public function setTitle(?string $title): void + { + $this->title = $title; + } + + /** + * @param ?string $salutation + */ + public function setSalutation(?string $salutation): void + { + $this->salutation = $salutation; + } + + /** + * @param ?string $firstName + */ + public function setFirstName(?string $firstName): void + { + $this->firstName = $firstName; + } + + /** + * @param ?string $lastName + */ + public function setLastName(?string $lastName): void + { + $this->lastName = $lastName; + } + + /** + * @param ?string $streetName + */ + public function setStreetName(?string $streetName): void + { + $this->streetName = $streetName; + } + + /** + * @param ?string $streetNumber + */ + public function setStreetNumber(?string $streetNumber): void + { + $this->streetNumber = $streetNumber; + } + + /** + * @param ?string $additionalStreetInfo + */ + public function setAdditionalStreetInfo(?string $additionalStreetInfo): void + { + $this->additionalStreetInfo = $additionalStreetInfo; + } + + /** + * @param ?string $postalCode + */ + public function setPostalCode(?string $postalCode): void + { + $this->postalCode = $postalCode; + } + + /** + * @param ?string $city + */ + public function setCity(?string $city): void + { + $this->city = $city; + } + + /** + * @param ?string $region + */ + public function setRegion(?string $region): void + { + $this->region = $region; + } + + /** + * @param ?string $state + */ + public function setState(?string $state): void + { + $this->state = $state; + } + + /** + * @param ?string $company + */ + public function setCompany(?string $company): void + { + $this->company = $company; + } + + /** + * @param ?string $department + */ + public function setDepartment(?string $department): void + { + $this->department = $department; + } + + /** + * @param ?string $building + */ + public function setBuilding(?string $building): void + { + $this->building = $building; + } + + /** + * @param ?string $apartment + */ + public function setApartment(?string $apartment): void + { + $this->apartment = $apartment; + } + + /** + * @param ?string $pOBox + */ + public function setPOBox(?string $pOBox): void + { + $this->pOBox = $pOBox; + } + + /** + * @param ?string $phone + */ + public function setPhone(?string $phone): void + { + $this->phone = $phone; + } + + /** + * @param ?string $mobile + */ + public function setMobile(?string $mobile): void + { + $this->mobile = $mobile; + } + + /** + * @param ?string $email + */ + public function setEmail(?string $email): void + { + $this->email = $email; + } + + /** + * @param ?string $fax + */ + public function setFax(?string $fax): void + { + $this->fax = $fax; + } + + /** + * @param ?string $additionalAddressInfo + */ + public function setAdditionalAddressInfo(?string $additionalAddressInfo): void + { + $this->additionalAddressInfo = $additionalAddressInfo; + } + + /** + * @param ?string $externalId + */ + public function setExternalId(?string $externalId): void + { + $this->externalId = $externalId; + } + + + +} diff --git a/lib/commercetools-history/src/Models/Common/BusinessUnitKeyReference.php b/lib/commercetools-history/src/Models/Common/BusinessUnitKeyReference.php new file mode 100644 index 00000000000..004a215df4f --- /dev/null +++ b/lib/commercetools-history/src/Models/Common/BusinessUnitKeyReference.php @@ -0,0 +1,30 @@ +Unique and immutable key of the referenced BusinessUnit. + * + + * @return null|string + */ + public function getKey(); + + /** + * @param ?string $key + */ + public function setKey(?string $key): void; +} diff --git a/lib/commercetools-history/src/Models/Common/BusinessUnitKeyReferenceBuilder.php b/lib/commercetools-history/src/Models/Common/BusinessUnitKeyReferenceBuilder.php new file mode 100644 index 00000000000..17cd614907a --- /dev/null +++ b/lib/commercetools-history/src/Models/Common/BusinessUnitKeyReferenceBuilder.php @@ -0,0 +1,63 @@ + + */ +final class BusinessUnitKeyReferenceBuilder implements Builder +{ + /** + + * @var ?string + */ + private $key; + + /** + *Unique and immutable key of the referenced BusinessUnit.
+ * + + * @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(): BusinessUnitKeyReference + { + return new BusinessUnitKeyReferenceModel( + $this->key + ); + } + + public static function of(): BusinessUnitKeyReferenceBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-history/src/Models/Common/BusinessUnitKeyReferenceCollection.php b/lib/commercetools-history/src/Models/Common/BusinessUnitKeyReferenceCollection.php new file mode 100644 index 00000000000..6dabbc1c142 --- /dev/null +++ b/lib/commercetools-history/src/Models/Common/BusinessUnitKeyReferenceCollection.php @@ -0,0 +1,56 @@ + + * @method BusinessUnitKeyReference current() + * @method BusinessUnitKeyReference end() + * @method BusinessUnitKeyReference at($offset) + */ +class BusinessUnitKeyReferenceCollection extends KeyReferenceCollection +{ + /** + * @psalm-assert BusinessUnitKeyReference $value + * @psalm-param BusinessUnitKeyReference|stdClass $value + * @throws InvalidArgumentException + * + * @return BusinessUnitKeyReferenceCollection + */ + public function add($value) + { + if (!$value instanceof BusinessUnitKeyReference) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?BusinessUnitKeyReference + */ + protected function mapper() + { + return function (?int $index): ?BusinessUnitKeyReference { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var BusinessUnitKeyReference $data */ + $data = BusinessUnitKeyReferenceModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-history/src/Models/Common/BusinessUnitKeyReferenceModel.php b/lib/commercetools-history/src/Models/Common/BusinessUnitKeyReferenceModel.php new file mode 100644 index 00000000000..5a347f94944 --- /dev/null +++ b/lib/commercetools-history/src/Models/Common/BusinessUnitKeyReferenceModel.php @@ -0,0 +1,99 @@ +key = $key; + $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 and immutable key of the referenced BusinessUnit.
+ * + * + * @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-history/src/Models/Common/BusinessUnitResourceIdentifier.php b/lib/commercetools-history/src/Models/Common/BusinessUnitResourceIdentifier.php new file mode 100644 index 00000000000..0d3f4847183 --- /dev/null +++ b/lib/commercetools-history/src/Models/Common/BusinessUnitResourceIdentifier.php @@ -0,0 +1,43 @@ +Unique identifier of the referenced BusinessUnit. Required ifkey is absent.
+ *
+
+ * @return null|string
+ */
+ public function getId();
+
+ /**
+ * Unique key of the referenced BusinessUnit. Required if id is absent.
Unique identifier of the referenced BusinessUnit. Required if key is absent.
Unique key of the referenced BusinessUnit. Required if id is absent.
Type of resource the value should reference. Supported resource type identifiers are:
+ * + + * @return null|string + */ + public function getTypeId() + { + return $this->typeId; + } + + /** + * @param ?string $id + * @return $this + */ + public function withId(?string $id) + { + $this->id = $id; + + return $this; + } + + /** + * @param ?string $key + * @return $this + */ + public function withKey(?string $key) + { + $this->key = $key; + + return $this; + } + + /** + * @param ?string $typeId + * @return $this + */ + public function withTypeId(?string $typeId) + { + $this->typeId = $typeId; + + return $this; + } + + + public function build(): BusinessUnitResourceIdentifier + { + return new BusinessUnitResourceIdentifierModel( + $this->id, + $this->key, + $this->typeId + ); + } + + public static function of(): BusinessUnitResourceIdentifierBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-history/src/Models/Common/BusinessUnitResourceIdentifierCollection.php b/lib/commercetools-history/src/Models/Common/BusinessUnitResourceIdentifierCollection.php new file mode 100644 index 00000000000..660605aa287 --- /dev/null +++ b/lib/commercetools-history/src/Models/Common/BusinessUnitResourceIdentifierCollection.php @@ -0,0 +1,56 @@ + + * @method BusinessUnitResourceIdentifier current() + * @method BusinessUnitResourceIdentifier end() + * @method BusinessUnitResourceIdentifier at($offset) + */ +class BusinessUnitResourceIdentifierCollection extends ResourceIdentifierCollection +{ + /** + * @psalm-assert BusinessUnitResourceIdentifier $value + * @psalm-param BusinessUnitResourceIdentifier|stdClass $value + * @throws InvalidArgumentException + * + * @return BusinessUnitResourceIdentifierCollection + */ + public function add($value) + { + if (!$value instanceof BusinessUnitResourceIdentifier) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?BusinessUnitResourceIdentifier + */ + protected function mapper() + { + return function (?int $index): ?BusinessUnitResourceIdentifier { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var BusinessUnitResourceIdentifier $data */ + $data = BusinessUnitResourceIdentifierModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-history/src/Models/Common/BusinessUnitResourceIdentifierModel.php b/lib/commercetools-history/src/Models/Common/BusinessUnitResourceIdentifierModel.php new file mode 100644 index 00000000000..48582b020e4 --- /dev/null +++ b/lib/commercetools-history/src/Models/Common/BusinessUnitResourceIdentifierModel.php @@ -0,0 +1,144 @@ +id = $id; + $this->key = $key; + $this->typeId = $typeId; + + } + + /** + *Unique identifier of the referenced BusinessUnit. Required if key is absent.
Unique key of the referenced BusinessUnit. Required if id is absent.
Type of resource the value should reference. Supported resource type identifiers are:
+ * + * + * @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; + } + + + /** + * @param ?string $id + */ + public function setId(?string $id): void + { + $this->id = $id; + } + + /** + * @param ?string $key + */ + public function setKey(?string $key): void + { + $this->key = $key; + } + + /** + * @param ?string $typeId + */ + public function setTypeId(?string $typeId): void + { + $this->typeId = $typeId; + } + + + +} diff --git a/lib/commercetools-history/src/Models/Common/CartDiscountReference.php b/lib/commercetools-history/src/Models/Common/CartDiscountReference.php new file mode 100644 index 00000000000..1d0ba8dd171 --- /dev/null +++ b/lib/commercetools-history/src/Models/Common/CartDiscountReference.php @@ -0,0 +1,30 @@ +Unique identifier of the referenced CartDiscount. + * + + * @return null|string + */ + public function getId(); + + /** + * @param ?string $id + */ + public function setId(?string $id): void; +} diff --git a/lib/commercetools-history/src/Models/Common/CartDiscountReferenceBuilder.php b/lib/commercetools-history/src/Models/Common/CartDiscountReferenceBuilder.php new file mode 100644 index 00000000000..0098fb9a871 --- /dev/null +++ b/lib/commercetools-history/src/Models/Common/CartDiscountReferenceBuilder.php @@ -0,0 +1,63 @@ + + */ +final class CartDiscountReferenceBuilder implements Builder +{ + /** + + * @var ?string + */ + private $id; + + /** + *Unique identifier of the referenced CartDiscount.
+ * + + * @return null|string + */ + public function getId() + { + return $this->id; + } + + /** + * @param ?string $id + * @return $this + */ + public function withId(?string $id) + { + $this->id = $id; + + return $this; + } + + + public function build(): CartDiscountReference + { + return new CartDiscountReferenceModel( + $this->id + ); + } + + public static function of(): CartDiscountReferenceBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-history/src/Models/Common/CartDiscountReferenceCollection.php b/lib/commercetools-history/src/Models/Common/CartDiscountReferenceCollection.php new file mode 100644 index 00000000000..010179d9189 --- /dev/null +++ b/lib/commercetools-history/src/Models/Common/CartDiscountReferenceCollection.php @@ -0,0 +1,56 @@ + + * @method CartDiscountReference current() + * @method CartDiscountReference end() + * @method CartDiscountReference at($offset) + */ +class CartDiscountReferenceCollection extends ReferenceCollection +{ + /** + * @psalm-assert CartDiscountReference $value + * @psalm-param CartDiscountReference|stdClass $value + * @throws InvalidArgumentException + * + * @return CartDiscountReferenceCollection + */ + public function add($value) + { + if (!$value instanceof CartDiscountReference) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?CartDiscountReference + */ + protected function mapper() + { + return function (?int $index): ?CartDiscountReference { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var CartDiscountReference $data */ + $data = CartDiscountReferenceModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-history/src/Models/Common/CartDiscountReferenceModel.php b/lib/commercetools-history/src/Models/Common/CartDiscountReferenceModel.php new file mode 100644 index 00000000000..0ca194128d5 --- /dev/null +++ b/lib/commercetools-history/src/Models/Common/CartDiscountReferenceModel.php @@ -0,0 +1,99 @@ +id = $id; + $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 CartDiscount.
+ * + * + * @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; + } + + + /** + * @param ?string $id + */ + public function setId(?string $id): void + { + $this->id = $id; + } + + + +} diff --git a/lib/commercetools-history/src/Models/Common/CartDiscountTarget.php b/lib/commercetools-history/src/Models/Common/CartDiscountTarget.php new file mode 100644 index 00000000000..c0ebf1397ec --- /dev/null +++ b/lib/commercetools-history/src/Models/Common/CartDiscountTarget.php @@ -0,0 +1,29 @@ + + */ +final class CartDiscountTargetBuilder implements Builder +{ + /** + + * @var ?string + */ + private $type; + + /** + + * @return null|string + */ + public function getType() + { + return $this->type; + } + + /** + * @param ?string $type + * @return $this + */ + public function withType(?string $type) + { + $this->type = $type; + + return $this; + } + + + public function build(): CartDiscountTarget + { + return new CartDiscountTargetModel( + $this->type + ); + } + + public static function of(): CartDiscountTargetBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-history/src/Models/Common/CartDiscountTargetCollection.php b/lib/commercetools-history/src/Models/Common/CartDiscountTargetCollection.php new file mode 100644 index 00000000000..3e28c8018ba --- /dev/null +++ b/lib/commercetools-history/src/Models/Common/CartDiscountTargetCollection.php @@ -0,0 +1,56 @@ + + * @method CartDiscountTarget current() + * @method CartDiscountTarget end() + * @method CartDiscountTarget at($offset) + */ +class CartDiscountTargetCollection extends MapperSequence +{ + /** + * @psalm-assert CartDiscountTarget $value + * @psalm-param CartDiscountTarget|stdClass $value + * @throws InvalidArgumentException + * + * @return CartDiscountTargetCollection + */ + public function add($value) + { + if (!$value instanceof CartDiscountTarget) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?CartDiscountTarget + */ + protected function mapper() + { + return function (?int $index): ?CartDiscountTarget { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var CartDiscountTarget $data */ + $data = CartDiscountTargetModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-history/src/Models/Common/CartDiscountTargetModel.php b/lib/commercetools-history/src/Models/Common/CartDiscountTargetModel.php new file mode 100644 index 00000000000..cc1347e5ab5 --- /dev/null +++ b/lib/commercetools-history/src/Models/Common/CartDiscountTargetModel.php @@ -0,0 +1,70 @@ +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; + } + + + /** + * @param ?string $type + */ + public function setType(?string $type): void + { + $this->type = $type; + } + + + +} diff --git a/lib/commercetools-history/src/Models/Common/CartDiscountValue.php b/lib/commercetools-history/src/Models/Common/CartDiscountValue.php new file mode 100644 index 00000000000..4ec4f021bea --- /dev/null +++ b/lib/commercetools-history/src/Models/Common/CartDiscountValue.php @@ -0,0 +1,29 @@ + + */ +final class CartDiscountValueBuilder implements Builder +{ + /** + + * @var ?string + */ + private $type; + + /** + + * @return null|string + */ + public function getType() + { + return $this->type; + } + + /** + * @param ?string $type + * @return $this + */ + public function withType(?string $type) + { + $this->type = $type; + + return $this; + } + + + public function build(): CartDiscountValue + { + return new CartDiscountValueModel( + $this->type + ); + } + + public static function of(): CartDiscountValueBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-history/src/Models/Common/CartDiscountValueCollection.php b/lib/commercetools-history/src/Models/Common/CartDiscountValueCollection.php new file mode 100644 index 00000000000..6510c2ba742 --- /dev/null +++ b/lib/commercetools-history/src/Models/Common/CartDiscountValueCollection.php @@ -0,0 +1,56 @@ + + * @method CartDiscountValue current() + * @method CartDiscountValue end() + * @method CartDiscountValue at($offset) + */ +class CartDiscountValueCollection extends MapperSequence +{ + /** + * @psalm-assert CartDiscountValue $value + * @psalm-param CartDiscountValue|stdClass $value + * @throws InvalidArgumentException + * + * @return CartDiscountValueCollection + */ + public function add($value) + { + if (!$value instanceof CartDiscountValue) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?CartDiscountValue + */ + protected function mapper() + { + return function (?int $index): ?CartDiscountValue { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var CartDiscountValue $data */ + $data = CartDiscountValueModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-history/src/Models/Common/CartDiscountValueModel.php b/lib/commercetools-history/src/Models/Common/CartDiscountValueModel.php new file mode 100644 index 00000000000..230532114e8 --- /dev/null +++ b/lib/commercetools-history/src/Models/Common/CartDiscountValueModel.php @@ -0,0 +1,70 @@ +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; + } + + + /** + * @param ?string $type + */ + public function setType(?string $type): void + { + $this->type = $type; + } + + + +} diff --git a/lib/commercetools-history/src/Models/Common/CategoryOrderHints.php b/lib/commercetools-history/src/Models/Common/CategoryOrderHints.php index e66c7a12569..f80717b0a59 100644 --- a/lib/commercetools-history/src/Models/Common/CategoryOrderHints.php +++ b/lib/commercetools-history/src/Models/Common/CategoryOrderHints.php @@ -8,13 +8,8 @@ namespace Commercetools\History\Models\Common; -use Commercetools\Base\JsonObject; -use Commercetools\Base\DateTimeImmutableCollection; +use Commercetools\Base\CMap; -interface CategoryOrderHints extends JsonObject +interface CategoryOrderHints extends CMap { - - public const FIELD_PATTERN0 = '/^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/'; - - } diff --git a/lib/commercetools-history/src/Models/Common/CategoryOrderHintsBuilder.php b/lib/commercetools-history/src/Models/Common/CategoryOrderHintsBuilder.php index 64904eeff57..3c4f41dbd15 100644 --- a/lib/commercetools-history/src/Models/Common/CategoryOrderHintsBuilder.php +++ b/lib/commercetools-history/src/Models/Common/CategoryOrderHintsBuilder.php @@ -8,30 +8,39 @@ namespace Commercetools\History\Models\Common; -use Commercetools\Base\Builder; -use Commercetools\Base\DateTimeImmutableCollection; -use Commercetools\Base\JsonObject; -use Commercetools\Base\JsonObjectModel; -use Commercetools\Base\MapperFactory; use stdClass; +use Commercetools\Base\MapperMap; +use Commercetools\Base\Builder; /** * @implements BuilderUnique identifier of the referenced Category.
+ * + + * @return null|string + */ + public function getId() + { + return $this->id; + } + + /** + * @param ?string $id + * @return $this + */ + public function withId(?string $id) + { + $this->id = $id; + + return $this; + } + + + public function build(): CategoryReference + { + return new CategoryReferenceModel( + $this->id + ); + } + + public static function of(): CategoryReferenceBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-history/src/Models/Common/CategoryReferenceCollection.php b/lib/commercetools-history/src/Models/Common/CategoryReferenceCollection.php new file mode 100644 index 00000000000..5758c1b67fa --- /dev/null +++ b/lib/commercetools-history/src/Models/Common/CategoryReferenceCollection.php @@ -0,0 +1,56 @@ + + * @method CategoryReference current() + * @method CategoryReference end() + * @method CategoryReference at($offset) + */ +class CategoryReferenceCollection extends ReferenceCollection +{ + /** + * @psalm-assert CategoryReference $value + * @psalm-param CategoryReference|stdClass $value + * @throws InvalidArgumentException + * + * @return CategoryReferenceCollection + */ + public function add($value) + { + if (!$value instanceof CategoryReference) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?CategoryReference + */ + protected function mapper() + { + return function (?int $index): ?CategoryReference { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var CategoryReference $data */ + $data = CategoryReferenceModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-history/src/Models/Common/CategoryReferenceModel.php b/lib/commercetools-history/src/Models/Common/CategoryReferenceModel.php new file mode 100644 index 00000000000..a8aff7ffce2 --- /dev/null +++ b/lib/commercetools-history/src/Models/Common/CategoryReferenceModel.php @@ -0,0 +1,99 @@ +id = $id; + $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 Category.
+ * + * + * @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; + } + + + /** + * @param ?string $id + */ + public function setId(?string $id): void + { + $this->id = $id; + } + + + +} diff --git a/lib/commercetools-history/src/Models/Common/CentPrecisionMoney.php b/lib/commercetools-history/src/Models/Common/CentPrecisionMoney.php new file mode 100644 index 00000000000..0cdbc1f50cc --- /dev/null +++ b/lib/commercetools-history/src/Models/Common/CentPrecisionMoney.php @@ -0,0 +1,30 @@ +The number of default fraction digits for the given currency, like2 for EUR or 0 for JPY.
+ *
+
+ * @return null|int
+ */
+ public function getFractionDigits();
+
+ /**
+ * @param ?int $fractionDigits
+ */
+ public function setFractionDigits(?int $fractionDigits): void;
+}
diff --git a/lib/commercetools-history/src/Models/Common/CentPrecisionMoneyBuilder.php b/lib/commercetools-history/src/Models/Common/CentPrecisionMoneyBuilder.php
new file mode 100644
index 00000000000..7fd693c8c0a
--- /dev/null
+++ b/lib/commercetools-history/src/Models/Common/CentPrecisionMoneyBuilder.php
@@ -0,0 +1,125 @@
+
+ */
+final class CentPrecisionMoneyBuilder implements Builder
+{
+ /**
+
+ * @var ?int
+ */
+ private $centAmount;
+
+ /**
+
+ * @var ?string
+ */
+ private $currencyCode;
+
+ /**
+
+ * @var ?int
+ */
+ private $fractionDigits;
+
+ /**
+ * Amount in the smallest indivisible unit of a currency, such as:
+ *500).5).Currency code compliant to ISO 4217.
+ * + + * @return null|string + */ + public function getCurrencyCode() + { + return $this->currencyCode; + } + + /** + *The number of default fraction digits for the given currency, like 2 for EUR or 0 for JPY.
Amount in the smallest indivisible unit of a currency, such as:
+ *500).5).Currency code compliant to ISO 4217.
+ * + * + * @return null|string + */ + public function getCurrencyCode() + { + if (is_null($this->currencyCode)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CURRENCY_CODE); + if (is_null($data)) { + return null; + } + $this->currencyCode = (string) $data; + } + + return $this->currencyCode; + } + + /** + *Type of money used.
+ * + * + * @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 number of default fraction digits for the given currency, like 2 for EUR or 0 for JPY.
Unique identifier of the referenced Channel.
+ * + + * @return null|string + */ + public function getId() + { + return $this->id; + } + + /** + * @param ?string $id + * @return $this + */ + public function withId(?string $id) + { + $this->id = $id; + + return $this; + } + + + public function build(): ChannelReference + { + return new ChannelReferenceModel( + $this->id + ); + } + + public static function of(): ChannelReferenceBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-history/src/Models/Common/ChannelReferenceCollection.php b/lib/commercetools-history/src/Models/Common/ChannelReferenceCollection.php new file mode 100644 index 00000000000..f82e205ff3a --- /dev/null +++ b/lib/commercetools-history/src/Models/Common/ChannelReferenceCollection.php @@ -0,0 +1,56 @@ + + * @method ChannelReference current() + * @method ChannelReference end() + * @method ChannelReference at($offset) + */ +class ChannelReferenceCollection extends ReferenceCollection +{ + /** + * @psalm-assert ChannelReference $value + * @psalm-param ChannelReference|stdClass $value + * @throws InvalidArgumentException + * + * @return ChannelReferenceCollection + */ + public function add($value) + { + if (!$value instanceof ChannelReference) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?ChannelReference + */ + protected function mapper() + { + return function (?int $index): ?ChannelReference { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var ChannelReference $data */ + $data = ChannelReferenceModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-history/src/Models/Common/ChannelReferenceModel.php b/lib/commercetools-history/src/Models/Common/ChannelReferenceModel.php new file mode 100644 index 00000000000..9b421e62cf3 --- /dev/null +++ b/lib/commercetools-history/src/Models/Common/ChannelReferenceModel.php @@ -0,0 +1,99 @@ +id = $id; + $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 Channel.
+ * + * + * @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; + } + + + /** + * @param ?string $id + */ + public function setId(?string $id): void + { + $this->id = $id; + } + + + +} diff --git a/lib/commercetools-history/src/Models/Common/ClientLogging.php b/lib/commercetools-history/src/Models/Common/ClientLogging.php new file mode 100644 index 00000000000..e327158d5f3 --- /dev/null +++ b/lib/commercetools-history/src/Models/Common/ClientLogging.php @@ -0,0 +1,87 @@ +id of the API Client which created the resource.
+ *
+
+ * @return null|string
+ */
+ public function getClientId();
+
+ /**
+ * External user ID provided by X-External-User-ID HTTP Header.
Indicates the Customer who modified the resource using a token from the password flow.
+ * + + * @return null|CustomerReference + */ + public function getCustomer(); + + /** + *Indicates that the resource was modified during an anonymous session with the logged ID.
+ * + + * @return null|string + */ + public function getAnonymousId(); + + /** + *Indicates the Customer who created or modified the resource in the context of a Business Unit. Only available for B2B-enabled Projects when an Associate acts on behalf of a company using the associate endpoints.
+ * + + * @return null|CustomerReference + */ + public function getAssociate(); + + /** + * @param ?string $clientId + */ + public function setClientId(?string $clientId): void; + + /** + * @param ?string $externalUserId + */ + public function setExternalUserId(?string $externalUserId): void; + + /** + * @param ?CustomerReference $customer + */ + public function setCustomer(?CustomerReference $customer): void; + + /** + * @param ?string $anonymousId + */ + public function setAnonymousId(?string $anonymousId): void; + + /** + * @param ?CustomerReference $associate + */ + public function setAssociate(?CustomerReference $associate): void; +} diff --git a/lib/commercetools-history/src/Models/Common/ClientLoggingBuilder.php b/lib/commercetools-history/src/Models/Common/ClientLoggingBuilder.php new file mode 100644 index 00000000000..93be101aeac --- /dev/null +++ b/lib/commercetools-history/src/Models/Common/ClientLoggingBuilder.php @@ -0,0 +1,200 @@ + + */ +final class ClientLoggingBuilder implements Builder +{ + /** + + * @var ?string + */ + private $clientId; + + /** + + * @var ?string + */ + private $externalUserId; + + /** + + * @var null|CustomerReference|CustomerReferenceBuilder + */ + private $customer; + + /** + + * @var ?string + */ + private $anonymousId; + + /** + + * @var null|CustomerReference|CustomerReferenceBuilder + */ + private $associate; + + /** + *id of the API Client which created the resource.
External user ID provided by X-External-User-ID HTTP Header.
Indicates the Customer who modified the resource using a token from the password flow.
+ * + + * @return null|CustomerReference + */ + public function getCustomer() + { + return $this->customer instanceof CustomerReferenceBuilder ? $this->customer->build() : $this->customer; + } + + /** + *Indicates that the resource was modified during an anonymous session with the logged ID.
+ * + + * @return null|string + */ + public function getAnonymousId() + { + return $this->anonymousId; + } + + /** + *Indicates the Customer who created or modified the resource in the context of a Business Unit. Only available for B2B-enabled Projects when an Associate acts on behalf of a company using the associate endpoints.
+ * + + * @return null|CustomerReference + */ + public function getAssociate() + { + return $this->associate instanceof CustomerReferenceBuilder ? $this->associate->build() : $this->associate; + } + + /** + * @param ?string $clientId + * @return $this + */ + public function withClientId(?string $clientId) + { + $this->clientId = $clientId; + + return $this; + } + + /** + * @param ?string $externalUserId + * @return $this + */ + public function withExternalUserId(?string $externalUserId) + { + $this->externalUserId = $externalUserId; + + return $this; + } + + /** + * @param ?CustomerReference $customer + * @return $this + */ + public function withCustomer(?CustomerReference $customer) + { + $this->customer = $customer; + + return $this; + } + + /** + * @param ?string $anonymousId + * @return $this + */ + public function withAnonymousId(?string $anonymousId) + { + $this->anonymousId = $anonymousId; + + return $this; + } + + /** + * @param ?CustomerReference $associate + * @return $this + */ + public function withAssociate(?CustomerReference $associate) + { + $this->associate = $associate; + + return $this; + } + + /** + * @deprecated use withCustomer() instead + * @return $this + */ + public function withCustomerBuilder(?CustomerReferenceBuilder $customer) + { + $this->customer = $customer; + + return $this; + } + + /** + * @deprecated use withAssociate() instead + * @return $this + */ + public function withAssociateBuilder(?CustomerReferenceBuilder $associate) + { + $this->associate = $associate; + + return $this; + } + + public function build(): ClientLogging + { + return new ClientLoggingModel( + $this->clientId, + $this->externalUserId, + $this->customer instanceof CustomerReferenceBuilder ? $this->customer->build() : $this->customer, + $this->anonymousId, + $this->associate instanceof CustomerReferenceBuilder ? $this->associate->build() : $this->associate + ); + } + + public static function of(): ClientLoggingBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-history/src/Models/Common/ClientLoggingCollection.php b/lib/commercetools-history/src/Models/Common/ClientLoggingCollection.php new file mode 100644 index 00000000000..6fc2c965da0 --- /dev/null +++ b/lib/commercetools-history/src/Models/Common/ClientLoggingCollection.php @@ -0,0 +1,56 @@ + + * @method ClientLogging current() + * @method ClientLogging end() + * @method ClientLogging at($offset) + */ +class ClientLoggingCollection extends MapperSequence +{ + /** + * @psalm-assert ClientLogging $value + * @psalm-param ClientLogging|stdClass $value + * @throws InvalidArgumentException + * + * @return ClientLoggingCollection + */ + public function add($value) + { + if (!$value instanceof ClientLogging) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?ClientLogging + */ + protected function mapper() + { + return function (?int $index): ?ClientLogging { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var ClientLogging $data */ + $data = ClientLoggingModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-history/src/Models/Common/ClientLoggingModel.php b/lib/commercetools-history/src/Models/Common/ClientLoggingModel.php new file mode 100644 index 00000000000..01b44db0a3e --- /dev/null +++ b/lib/commercetools-history/src/Models/Common/ClientLoggingModel.php @@ -0,0 +1,218 @@ +clientId = $clientId; + $this->externalUserId = $externalUserId; + $this->customer = $customer; + $this->anonymousId = $anonymousId; + $this->associate = $associate; + + } + + /** + *id of the API Client which created the resource.
External user ID provided by X-External-User-ID HTTP Header.
Indicates the Customer who modified the resource using a token from the password flow.
+ * + * + * @return null|CustomerReference + */ + public function getCustomer() + { + if (is_null($this->customer)) { + /** @psalm-var stdClass|arrayIndicates that the resource was modified during an anonymous session with the logged ID.
+ * + * + * @return null|string + */ + public function getAnonymousId() + { + if (is_null($this->anonymousId)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_ANONYMOUS_ID); + if (is_null($data)) { + return null; + } + $this->anonymousId = (string) $data; + } + + return $this->anonymousId; + } + + /** + *Indicates the Customer who created or modified the resource in the context of a Business Unit. Only available for B2B-enabled Projects when an Associate acts on behalf of a company using the associate endpoints.
+ * + * + * @return null|CustomerReference + */ + public function getAssociate() + { + if (is_null($this->associate)) { + /** @psalm-var stdClass|arrayDescriptive label of the value.
+ * + + * @return null|string + */ + public function getLabel(); + + /** + * @param ?string $key + */ + public function setKey(?string $key): void; + + /** + * @param ?string $label + */ + public function setLabel(?string $label): void; +} diff --git a/lib/commercetools-history/src/Models/Common/CustomFieldEnumValueBuilder.php b/lib/commercetools-history/src/Models/Common/CustomFieldEnumValueBuilder.php new file mode 100644 index 00000000000..5cee2dd1c81 --- /dev/null +++ b/lib/commercetools-history/src/Models/Common/CustomFieldEnumValueBuilder.php @@ -0,0 +1,92 @@ + + */ +final class CustomFieldEnumValueBuilder implements Builder +{ + /** + + * @var ?string + */ + private $key; + + /** + + * @var ?string + */ + private $label; + + /** + *Key of the value used as a programmatic identifier.
+ * + + * @return null|string + */ + public function getKey() + { + return $this->key; + } + + /** + *Descriptive label of the value.
+ * + + * @return null|string + */ + public function getLabel() + { + return $this->label; + } + + /** + * @param ?string $key + * @return $this + */ + public function withKey(?string $key) + { + $this->key = $key; + + return $this; + } + + /** + * @param ?string $label + * @return $this + */ + public function withLabel(?string $label) + { + $this->label = $label; + + return $this; + } + + + public function build(): CustomFieldEnumValue + { + return new CustomFieldEnumValueModel( + $this->key, + $this->label + ); + } + + public static function of(): CustomFieldEnumValueBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-history/src/Models/Common/CustomFieldEnumValueCollection.php b/lib/commercetools-history/src/Models/Common/CustomFieldEnumValueCollection.php new file mode 100644 index 00000000000..51666b3f24c --- /dev/null +++ b/lib/commercetools-history/src/Models/Common/CustomFieldEnumValueCollection.php @@ -0,0 +1,56 @@ + + * @method CustomFieldEnumValue current() + * @method CustomFieldEnumValue end() + * @method CustomFieldEnumValue at($offset) + */ +class CustomFieldEnumValueCollection extends MapperSequence +{ + /** + * @psalm-assert CustomFieldEnumValue $value + * @psalm-param CustomFieldEnumValue|stdClass $value + * @throws InvalidArgumentException + * + * @return CustomFieldEnumValueCollection + */ + public function add($value) + { + if (!$value instanceof CustomFieldEnumValue) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?CustomFieldEnumValue + */ + protected function mapper() + { + return function (?int $index): ?CustomFieldEnumValue { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var CustomFieldEnumValue $data */ + $data = CustomFieldEnumValueModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-history/src/Models/Common/CustomFieldEnumValueModel.php b/lib/commercetools-history/src/Models/Common/CustomFieldEnumValueModel.php new file mode 100644 index 00000000000..3b9094988a6 --- /dev/null +++ b/lib/commercetools-history/src/Models/Common/CustomFieldEnumValueModel.php @@ -0,0 +1,108 @@ +key = $key; + $this->label = $label; + + } + + /** + *Key of the value used as a programmatic identifier.
+ * + * + * @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; + } + + /** + *Descriptive label of the value.
+ * + * + * @return null|string + */ + public function getLabel() + { + if (is_null($this->label)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_LABEL); + if (is_null($data)) { + return null; + } + $this->label = (string) $data; + } + + return $this->label; + } + + + /** + * @param ?string $key + */ + public function setKey(?string $key): void + { + $this->key = $key; + } + + /** + * @param ?string $label + */ + public function setLabel(?string $label): void + { + $this->label = $label; + } + + + +} diff --git a/lib/commercetools-history/src/Models/Common/CustomFieldLocalizedEnumValue.php b/lib/commercetools-history/src/Models/Common/CustomFieldLocalizedEnumValue.php new file mode 100644 index 00000000000..914b67125aa --- /dev/null +++ b/lib/commercetools-history/src/Models/Common/CustomFieldLocalizedEnumValue.php @@ -0,0 +1,45 @@ +Key of the value used as a programmatic identifier. + * + + * @return null|string + */ + public function getKey(); + + /** + *Descriptive localized label of the value.
+ * + + * @return null|LocalizedString + */ + public function getLabel(); + + /** + * @param ?string $key + */ + public function setKey(?string $key): void; + + /** + * @param ?LocalizedString $label + */ + public function setLabel(?LocalizedString $label): void; +} diff --git a/lib/commercetools-history/src/Models/Common/CustomFieldLocalizedEnumValueBuilder.php b/lib/commercetools-history/src/Models/Common/CustomFieldLocalizedEnumValueBuilder.php new file mode 100644 index 00000000000..30ab0732938 --- /dev/null +++ b/lib/commercetools-history/src/Models/Common/CustomFieldLocalizedEnumValueBuilder.php @@ -0,0 +1,102 @@ + + */ +final class CustomFieldLocalizedEnumValueBuilder implements Builder +{ + /** + + * @var ?string + */ + private $key; + + /** + + * @var null|LocalizedString|LocalizedStringBuilder + */ + private $label; + + /** + *Key of the value used as a programmatic identifier.
+ * + + * @return null|string + */ + public function getKey() + { + return $this->key; + } + + /** + *Descriptive localized label of the value.
+ * + + * @return null|LocalizedString + */ + public function getLabel() + { + return $this->label instanceof LocalizedStringBuilder ? $this->label->build() : $this->label; + } + + /** + * @param ?string $key + * @return $this + */ + public function withKey(?string $key) + { + $this->key = $key; + + return $this; + } + + /** + * @param ?LocalizedString $label + * @return $this + */ + public function withLabel(?LocalizedString $label) + { + $this->label = $label; + + return $this; + } + + /** + * @deprecated use withLabel() instead + * @return $this + */ + public function withLabelBuilder(?LocalizedStringBuilder $label) + { + $this->label = $label; + + return $this; + } + + public function build(): CustomFieldLocalizedEnumValue + { + return new CustomFieldLocalizedEnumValueModel( + $this->key, + $this->label instanceof LocalizedStringBuilder ? $this->label->build() : $this->label + ); + } + + public static function of(): CustomFieldLocalizedEnumValueBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-history/src/Models/Common/CustomFieldLocalizedEnumValueCollection.php b/lib/commercetools-history/src/Models/Common/CustomFieldLocalizedEnumValueCollection.php new file mode 100644 index 00000000000..afc2a069ff7 --- /dev/null +++ b/lib/commercetools-history/src/Models/Common/CustomFieldLocalizedEnumValueCollection.php @@ -0,0 +1,56 @@ + + * @method CustomFieldLocalizedEnumValue current() + * @method CustomFieldLocalizedEnumValue end() + * @method CustomFieldLocalizedEnumValue at($offset) + */ +class CustomFieldLocalizedEnumValueCollection extends MapperSequence +{ + /** + * @psalm-assert CustomFieldLocalizedEnumValue $value + * @psalm-param CustomFieldLocalizedEnumValue|stdClass $value + * @throws InvalidArgumentException + * + * @return CustomFieldLocalizedEnumValueCollection + */ + public function add($value) + { + if (!$value instanceof CustomFieldLocalizedEnumValue) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?CustomFieldLocalizedEnumValue + */ + protected function mapper() + { + return function (?int $index): ?CustomFieldLocalizedEnumValue { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var CustomFieldLocalizedEnumValue $data */ + $data = CustomFieldLocalizedEnumValueModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-history/src/Models/Common/CustomFieldLocalizedEnumValueModel.php b/lib/commercetools-history/src/Models/Common/CustomFieldLocalizedEnumValueModel.php new file mode 100644 index 00000000000..5719aa82c50 --- /dev/null +++ b/lib/commercetools-history/src/Models/Common/CustomFieldLocalizedEnumValueModel.php @@ -0,0 +1,109 @@ +key = $key; + $this->label = $label; + + } + + /** + *Key of the value used as a programmatic identifier.
+ * + * + * @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; + } + + /** + *Descriptive localized label of the value.
+ * + * + * @return null|LocalizedString + */ + public function getLabel() + { + if (is_null($this->label)) { + /** @psalm-var stdClass|arrayReference to the Type that holds the FieldDefinitions for the Custom Fields.
+ * - * @return null|Reference + * @return null|TypeReference */ public function getType(); /** - *A valid JSON object, based on FieldDefinition.
+ *Object containing the Custom Fields for the customized resource or data type.
* - * @return null|mixed + * @return null|FieldContainer */ public function getFields(); /** - * @param ?Reference $type + * @param ?TypeReference $type */ - public function setType(?Reference $type): void; + public function setType(?TypeReference $type): void; /** - * @param ?JsonObject $fields + * @param ?FieldContainer $fields */ - public function setFields(?JsonObject $fields): void; + public function setFields(?FieldContainer $fields): void; } diff --git a/lib/commercetools-history/src/Models/Common/CustomFieldsBuilder.php b/lib/commercetools-history/src/Models/Common/CustomFieldsBuilder.php index 5bc347e0dfb..bcc515538b8 100644 --- a/lib/commercetools-history/src/Models/Common/CustomFieldsBuilder.php +++ b/lib/commercetools-history/src/Models/Common/CustomFieldsBuilder.php @@ -22,41 +22,43 @@ final class CustomFieldsBuilder implements Builder { /** - * @var null|Reference|ReferenceBuilder + * @var null|TypeReference|TypeReferenceBuilder */ private $type; /** - * @var ?JsonObject + * @var null|FieldContainer|FieldContainerBuilder */ private $fields; /** + *Reference to the Type that holds the FieldDefinitions for the Custom Fields.
+ * - * @return null|Reference + * @return null|TypeReference */ public function getType() { - return $this->type instanceof ReferenceBuilder ? $this->type->build() : $this->type; + return $this->type instanceof TypeReferenceBuilder ? $this->type->build() : $this->type; } /** - *A valid JSON object, based on FieldDefinition.
+ *Object containing the Custom Fields for the customized resource or data type.
* - * @return null|JsonObject + * @return null|FieldContainer */ public function getFields() { - return $this->fields; + return $this->fields instanceof FieldContainerBuilder ? $this->fields->build() : $this->fields; } /** - * @param ?Reference $type + * @param ?TypeReference $type * @return $this */ - public function withType(?Reference $type) + public function withType(?TypeReference $type) { $this->type = $type; @@ -64,10 +66,10 @@ public function withType(?Reference $type) } /** - * @param ?JsonObject $fields + * @param ?FieldContainer $fields * @return $this */ - public function withFields(?JsonObject $fields) + public function withFields(?FieldContainer $fields) { $this->fields = $fields; @@ -78,18 +80,29 @@ public function withFields(?JsonObject $fields) * @deprecated use withType() instead * @return $this */ - public function withTypeBuilder(?ReferenceBuilder $type) + public function withTypeBuilder(?TypeReferenceBuilder $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(): CustomFields { return new CustomFieldsModel( - $this->type instanceof ReferenceBuilder ? $this->type->build() : $this->type, - $this->fields + $this->type instanceof TypeReferenceBuilder ? $this->type->build() : $this->type, + $this->fields instanceof FieldContainerBuilder ? $this->fields->build() : $this->fields ); } diff --git a/lib/commercetools-history/src/Models/Common/CustomFieldsModel.php b/lib/commercetools-history/src/Models/Common/CustomFieldsModel.php index 48820f8a7cd..9be806cc5cf 100644 --- a/lib/commercetools-history/src/Models/Common/CustomFieldsModel.php +++ b/lib/commercetools-history/src/Models/Common/CustomFieldsModel.php @@ -23,13 +23,13 @@ final class CustomFieldsModel extends JsonObjectModel implements CustomFields /** * - * @var ?Reference + * @var ?TypeReference */ protected $type; /** * - * @var ?mixed + * @var ?FieldContainer */ protected $fields; @@ -38,8 +38,8 @@ final class CustomFieldsModel extends JsonObjectModel implements CustomFields * @psalm-suppress MissingParamType */ public function __construct( - ?Reference $type = null, - ?JsonObject $fields = null + ?TypeReference $type = null, + ?FieldContainer $fields = null ) { $this->type = $type; $this->fields = $fields; @@ -47,8 +47,10 @@ public function __construct( } /** + *Reference to the Type that holds the FieldDefinitions for the Custom Fields.
* - * @return null|Reference + * + * @return null|TypeReference */ public function getType() { @@ -59,17 +61,17 @@ public function getType() return null; } - $this->type = ReferenceModel::of($data); + $this->type = TypeReferenceModel::of($data); } return $this->type; } /** - *A valid JSON object, based on FieldDefinition.
+ *Object containing the Custom Fields for the customized resource or data type.
* * - * @return null|mixed + * @return null|FieldContainer */ public function getFields() { @@ -79,7 +81,8 @@ public function getFields() if (is_null($data)) { return null; } - $this->fields = JsonObjectModel::of($data); + + $this->fields = FieldContainerModel::of($data); } return $this->fields; @@ -87,17 +90,17 @@ public function getFields() /** - * @param ?Reference $type + * @param ?TypeReference $type */ - public function setType(?Reference $type): void + public function setType(?TypeReference $type): void { $this->type = $type; } /** - * @param ?JsonObject $fields + * @param ?FieldContainer $fields */ - public function setFields(?JsonObject $fields): void + public function setFields(?FieldContainer $fields): void { $this->fields = $fields; } diff --git a/lib/commercetools-history/src/Models/Common/CustomLineItem.php b/lib/commercetools-history/src/Models/Common/CustomLineItem.php index 55436eba987..6e26ce3ede0 100644 --- a/lib/commercetools-history/src/Models/Common/CustomLineItem.php +++ b/lib/commercetools-history/src/Models/Common/CustomLineItem.php @@ -15,15 +15,26 @@ interface CustomLineItem extends JsonObject { public const FIELD_ID = 'id'; + public const FIELD_KEY = 'key'; public const FIELD_NAME = 'name'; public const FIELD_MONEY = 'money'; public const FIELD_TAXED_PRICE = 'taxedPrice'; + public const FIELD_TAXED_PRICE_PORTIONS = 'taxedPricePortions'; public const FIELD_TOTAL_PRICE = 'totalPrice'; public const FIELD_SLUG = 'slug'; public const FIELD_QUANTITY = 'quantity'; + public const FIELD_STATE = 'state'; + public const FIELD_TAX_CATEGORY = 'taxCategory'; + public const FIELD_TAX_RATE = 'taxRate'; + public const FIELD_PER_METHOD_TAX_RATE = 'perMethodTaxRate'; + public const FIELD_DISCOUNTED_PRICE_PER_QUANTITY = 'discountedPricePerQuantity'; + public const FIELD_CUSTOM = 'custom'; + public const FIELD_SHIPPING_DETAILS = 'shippingDetails'; + public const FIELD_PRICE_MODE = 'priceMode'; + public const FIELD_RECURRENCE_INFO = 'recurrenceInfo'; /** - *The unique ID of this CustomLineItem.
+ *Unique identifier of the Custom Line Item.
* * @return null|string @@ -31,31 +42,59 @@ interface CustomLineItem extends JsonObject public function getId(); /** + *User-defined unique identifier of the Custom Line Item.
+ * + + * @return null|string + */ + public function getKey(); + + /** + *Name of the Custom Line Item.
+ * * @return null|LocalizedString */ public function getName(); /** + *Money value of the Custom Line Item.
+ * - * @return null|Money + * @return null|TypedMoney */ public function getMoney(); /** + *Automatically set after the taxRate is set.
Total taxed prices based on the quantity of the Custom Line Item assigned to each Shipping Method. Only applicable for Carts with Multiple ShippingMode.
+ * Automatically set after perMethodTaxRate is set.
Total price of the Custom Line Item (money multiplied by quantity).
+ * If the Custom Line Item is discounted, the total price is discountedPricePerQuantity multiplied by quantity.
Includes taxes if the TaxRate includedInPrice is true.
A unique String in the cart to identify this CustomLineItem.
+ *User-defined identifier used in a deep-link URL for the Custom Line Item.
+ * It matches the pattern [a-zA-Z0-9_-]{2,256}.
The amount of a CustomLineItem in the cart. Must be a positive integer.
+ *Number of Custom Line Items in the Cart or Order.
* * @return null|int */ public function getQuantity(); + /** + *Tracks specific quantities of the Custom Line Item within a given State. When a Custom Line Item is added to a Cart, its full quantity is set to the built-in "Initial" state. State transitions for Custom Line Items are managed on the Order.
+ * + + * @return null|ItemStateCollection + */ + public function getState(); + + /** + *Used to select a Tax Rate when a Cart has the Platform TaxMode.
Platform TaxMode, the taxRate of Custom Line Items is set automatically once a shipping address is set. The rate is based on the TaxCategory that applies for the shipping address.External TaxMode, the taxRate of Custom Line Items can be set using ExternalTaxRateDraft.Tax Rate per Shipping Method for a Cart with Multiple ShippingMode. For a Cart with Platform TaxMode it is automatically set after the Shipping Method is added.
+ * For a Cart with External TaxMode, the Tax Rate must be set with ExternalTaxRateDraft.
Discounted price of a single quantity of the Custom Line Item.
+ * + + * @return null|DiscountedLineItemPriceForQuantityCollection + */ + public function getDiscountedPricePerQuantity(); + + /** + *Custom Fields of the Custom Line Item.
+ * + + * @return null|CustomFields + */ + public function getCustom(); + + /** + *Container for Custom Line Item-specific addresses.
+ * + + * @return null|ItemShippingDetails + */ + public function getShippingDetails(); + + /** + *Indicates whether Cart Discounts with a matching CartDiscountCustomLineItemsTarget, MultiBuyCustomLineItemsTarget, or CartDiscountPatternTarget are applied to the Custom Line Item.
+ * + + * @return null|string + */ + public function getPriceMode(); + + /** + *Recurring Order and frequency data.
+ * + + * @return null|CustomLineItemRecurrenceInfo + */ + public function getRecurrenceInfo(); + /** * @param ?string $id */ public function setId(?string $id): void; + /** + * @param ?string $key + */ + public function setKey(?string $key): void; + /** * @param ?LocalizedString $name */ public function setName(?LocalizedString $name): void; /** - * @param ?Money $money + * @param ?TypedMoney $money */ - public function setMoney(?Money $money): void; + public function setMoney(?TypedMoney $money): void; /** * @param ?TaxedItemPrice $taxedPrice @@ -91,9 +211,14 @@ public function setMoney(?Money $money): void; public function setTaxedPrice(?TaxedItemPrice $taxedPrice): void; /** - * @param ?Money $totalPrice + * @param ?MethodTaxedPriceCollection $taxedPricePortions + */ + public function setTaxedPricePortions(?MethodTaxedPriceCollection $taxedPricePortions): void; + + /** + * @param ?CentPrecisionMoney $totalPrice */ - public function setTotalPrice(?Money $totalPrice): void; + public function setTotalPrice(?CentPrecisionMoney $totalPrice): void; /** * @param ?string $slug @@ -104,4 +229,49 @@ public function setSlug(?string $slug): void; * @param ?int $quantity */ public function setQuantity(?int $quantity): void; + + /** + * @param ?ItemStateCollection $state + */ + public function setState(?ItemStateCollection $state): void; + + /** + * @param ?TaxCategoryReference $taxCategory + */ + public function setTaxCategory(?TaxCategoryReference $taxCategory): void; + + /** + * @param ?TaxRate $taxRate + */ + public function setTaxRate(?TaxRate $taxRate): void; + + /** + * @param ?MethodTaxRateCollection $perMethodTaxRate + */ + public function setPerMethodTaxRate(?MethodTaxRateCollection $perMethodTaxRate): void; + + /** + * @param ?DiscountedLineItemPriceForQuantityCollection $discountedPricePerQuantity + */ + public function setDiscountedPricePerQuantity(?DiscountedLineItemPriceForQuantityCollection $discountedPricePerQuantity): void; + + /** + * @param ?CustomFields $custom + */ + public function setCustom(?CustomFields $custom): void; + + /** + * @param ?ItemShippingDetails $shippingDetails + */ + 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-history/src/Models/Common/CustomLineItemBuilder.php b/lib/commercetools-history/src/Models/Common/CustomLineItemBuilder.php index 19fb2814c99..1146789030c 100644 --- a/lib/commercetools-history/src/Models/Common/CustomLineItemBuilder.php +++ b/lib/commercetools-history/src/Models/Common/CustomLineItemBuilder.php @@ -26,6 +26,12 @@ final class CustomLineItemBuilder implements Builder */ private $id; + /** + + * @var ?string + */ + private $key; + /** * @var null|LocalizedString|LocalizedStringBuilder @@ -34,7 +40,7 @@ final class CustomLineItemBuilder implements Builder /** - * @var null|Money|MoneyBuilder + * @var null|TypedMoney|TypedMoneyBuilder */ private $money; @@ -46,7 +52,13 @@ final class CustomLineItemBuilder implements Builder /** - * @var null|Money|MoneyBuilder + * @var ?MethodTaxedPriceCollection + */ + private $taxedPricePortions; + + /** + + * @var null|CentPrecisionMoney|CentPrecisionMoneyBuilder */ private $totalPrice; @@ -63,7 +75,61 @@ final class CustomLineItemBuilder implements Builder private $quantity; /** - *The unique ID of this CustomLineItem.
+ + * @var ?ItemStateCollection + */ + private $state; + + /** + + * @var null|TaxCategoryReference|TaxCategoryReferenceBuilder + */ + private $taxCategory; + + /** + + * @var null|TaxRate|TaxRateBuilder + */ + private $taxRate; + + /** + + * @var ?MethodTaxRateCollection + */ + private $perMethodTaxRate; + + /** + + * @var ?DiscountedLineItemPriceForQuantityCollection + */ + private $discountedPricePerQuantity; + + /** + + * @var null|CustomFields|CustomFieldsBuilder + */ + private $custom; + + /** + + * @var null|ItemShippingDetails|ItemShippingDetailsBuilder + */ + private $shippingDetails; + + /** + + * @var ?string + */ + private $priceMode; + + /** + + * @var null|CustomLineItemRecurrenceInfo|CustomLineItemRecurrenceInfoBuilder + */ + private $recurrenceInfo; + + /** + *Unique identifier of the Custom Line Item.
* * @return null|string @@ -74,6 +140,19 @@ public function getId() } /** + *User-defined unique identifier of the Custom Line Item.
+ * + + * @return null|string + */ + public function getKey() + { + return $this->key; + } + + /** + *Name of the Custom Line Item.
+ * * @return null|LocalizedString */ @@ -83,15 +162,19 @@ public function getName() } /** + *Money value of the Custom Line Item.
+ * - * @return null|Money + * @return null|TypedMoney */ public function getMoney() { - return $this->money instanceof MoneyBuilder ? $this->money->build() : $this->money; + return $this->money instanceof TypedMoneyBuilder ? $this->money->build() : $this->money; } /** + *Automatically set after the taxRate is set.
Total taxed prices based on the quantity of the Custom Line Item assigned to each Shipping Method. Only applicable for Carts with Multiple ShippingMode.
+ * Automatically set after perMethodTaxRate is set.
Total price of the Custom Line Item (money multiplied by quantity).
+ * If the Custom Line Item is discounted, the total price is discountedPricePerQuantity multiplied by quantity.
Includes taxes if the TaxRate includedInPrice is true.
A unique String in the cart to identify this CustomLineItem.
+ *User-defined identifier used in a deep-link URL for the Custom Line Item.
+ * It matches the pattern [a-zA-Z0-9_-]{2,256}.
The amount of a CustomLineItem in the cart. Must be a positive integer.
+ *Number of Custom Line Items in the Cart or Order.
* * @return null|int @@ -131,6 +231,109 @@ public function getQuantity() return $this->quantity; } + /** + *Tracks specific quantities of the Custom Line Item within a given State. When a Custom Line Item is added to a Cart, its full quantity is set to the built-in "Initial" state. State transitions for Custom Line Items are managed on the Order.
+ * + + * @return null|ItemStateCollection + */ + public function getState() + { + return $this->state; + } + + /** + *Used to select a Tax Rate when a Cart has the Platform TaxMode.
Platform TaxMode, the taxRate of Custom Line Items is set automatically once a shipping address is set. The rate is based on the TaxCategory that applies for the shipping address.External TaxMode, the taxRate of Custom Line Items can be set using ExternalTaxRateDraft.Tax Rate per Shipping Method for a Cart with Multiple ShippingMode. For a Cart with Platform TaxMode it is automatically set after the Shipping Method is added.
+ * For a Cart with External TaxMode, the Tax Rate must be set with ExternalTaxRateDraft.
Discounted price of a single quantity of the Custom Line Item.
+ * + + * @return null|DiscountedLineItemPriceForQuantityCollection + */ + public function getDiscountedPricePerQuantity() + { + return $this->discountedPricePerQuantity; + } + + /** + *Custom Fields of the Custom Line Item.
+ * + + * @return null|CustomFields + */ + public function getCustom() + { + return $this->custom instanceof CustomFieldsBuilder ? $this->custom->build() : $this->custom; + } + + /** + *Container for Custom Line Item-specific addresses.
+ * + + * @return null|ItemShippingDetails + */ + public function getShippingDetails() + { + return $this->shippingDetails instanceof ItemShippingDetailsBuilder ? $this->shippingDetails->build() : $this->shippingDetails; + } + + /** + *Indicates whether Cart Discounts with a matching CartDiscountCustomLineItemsTarget, MultiBuyCustomLineItemsTarget, or CartDiscountPatternTarget are applied to the Custom Line Item.
+ * + + * @return null|string + */ + 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 @@ -142,6 +345,17 @@ public function withId(?string $id) return $this; } + /** + * @param ?string $key + * @return $this + */ + public function withKey(?string $key) + { + $this->key = $key; + + return $this; + } + /** * @param ?LocalizedString $name * @return $this @@ -154,10 +368,10 @@ public function withName(?LocalizedString $name) } /** - * @param ?Money $money + * @param ?TypedMoney $money * @return $this */ - public function withMoney(?Money $money) + public function withMoney(?TypedMoney $money) { $this->money = $money; @@ -176,10 +390,21 @@ public function withTaxedPrice(?TaxedItemPrice $taxedPrice) } /** - * @param ?Money $totalPrice + * @param ?MethodTaxedPriceCollection $taxedPricePortions + * @return $this + */ + public function withTaxedPricePortions(?MethodTaxedPriceCollection $taxedPricePortions) + { + $this->taxedPricePortions = $taxedPricePortions; + + return $this; + } + + /** + * @param ?CentPrecisionMoney $totalPrice * @return $this */ - public function withTotalPrice(?Money $totalPrice) + public function withTotalPrice(?CentPrecisionMoney $totalPrice) { $this->totalPrice = $totalPrice; @@ -208,6 +433,105 @@ public function withQuantity(?int $quantity) return $this; } + /** + * @param ?ItemStateCollection $state + * @return $this + */ + public function withState(?ItemStateCollection $state) + { + $this->state = $state; + + return $this; + } + + /** + * @param ?TaxCategoryReference $taxCategory + * @return $this + */ + public function withTaxCategory(?TaxCategoryReference $taxCategory) + { + $this->taxCategory = $taxCategory; + + return $this; + } + + /** + * @param ?TaxRate $taxRate + * @return $this + */ + public function withTaxRate(?TaxRate $taxRate) + { + $this->taxRate = $taxRate; + + return $this; + } + + /** + * @param ?MethodTaxRateCollection $perMethodTaxRate + * @return $this + */ + public function withPerMethodTaxRate(?MethodTaxRateCollection $perMethodTaxRate) + { + $this->perMethodTaxRate = $perMethodTaxRate; + + return $this; + } + + /** + * @param ?DiscountedLineItemPriceForQuantityCollection $discountedPricePerQuantity + * @return $this + */ + public function withDiscountedPricePerQuantity(?DiscountedLineItemPriceForQuantityCollection $discountedPricePerQuantity) + { + $this->discountedPricePerQuantity = $discountedPricePerQuantity; + + return $this; + } + + /** + * @param ?CustomFields $custom + * @return $this + */ + public function withCustom(?CustomFields $custom) + { + $this->custom = $custom; + + return $this; + } + + /** + * @param ?ItemShippingDetails $shippingDetails + * @return $this + */ + public function withShippingDetails(?ItemShippingDetails $shippingDetails) + { + $this->shippingDetails = $shippingDetails; + + return $this; + } + + /** + * @param ?string $priceMode + * @return $this + */ + public function withPriceMode(?string $priceMode) + { + $this->priceMode = $priceMode; + + return $this; + } + + /** + * @param ?CustomLineItemRecurrenceInfo $recurrenceInfo + * @return $this + */ + public function withRecurrenceInfo(?CustomLineItemRecurrenceInfo $recurrenceInfo) + { + $this->recurrenceInfo = $recurrenceInfo; + + return $this; + } + /** * @deprecated use withName() instead * @return $this @@ -223,7 +547,7 @@ public function withNameBuilder(?LocalizedStringBuilder $name) * @deprecated use withMoney() instead * @return $this */ - public function withMoneyBuilder(?MoneyBuilder $money) + public function withMoneyBuilder(?TypedMoneyBuilder $money) { $this->money = $money; @@ -245,23 +569,89 @@ public function withTaxedPriceBuilder(?TaxedItemPriceBuilder $taxedPrice) * @deprecated use withTotalPrice() instead * @return $this */ - public function withTotalPriceBuilder(?MoneyBuilder $totalPrice) + public function withTotalPriceBuilder(?CentPrecisionMoneyBuilder $totalPrice) { $this->totalPrice = $totalPrice; return $this; } + /** + * @deprecated use withTaxCategory() instead + * @return $this + */ + public function withTaxCategoryBuilder(?TaxCategoryReferenceBuilder $taxCategory) + { + $this->taxCategory = $taxCategory; + + return $this; + } + + /** + * @deprecated use withTaxRate() instead + * @return $this + */ + public function withTaxRateBuilder(?TaxRateBuilder $taxRate) + { + $this->taxRate = $taxRate; + + return $this; + } + + /** + * @deprecated use withCustom() instead + * @return $this + */ + public function withCustomBuilder(?CustomFieldsBuilder $custom) + { + $this->custom = $custom; + + return $this; + } + + /** + * @deprecated use withShippingDetails() instead + * @return $this + */ + public function withShippingDetailsBuilder(?ItemShippingDetailsBuilder $shippingDetails) + { + $this->shippingDetails = $shippingDetails; + + 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( $this->id, + $this->key, $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name, - $this->money instanceof MoneyBuilder ? $this->money->build() : $this->money, + $this->money instanceof TypedMoneyBuilder ? $this->money->build() : $this->money, $this->taxedPrice instanceof TaxedItemPriceBuilder ? $this->taxedPrice->build() : $this->taxedPrice, - $this->totalPrice instanceof MoneyBuilder ? $this->totalPrice->build() : $this->totalPrice, + $this->taxedPricePortions, + $this->totalPrice instanceof CentPrecisionMoneyBuilder ? $this->totalPrice->build() : $this->totalPrice, $this->slug, - $this->quantity + $this->quantity, + $this->state, + $this->taxCategory instanceof TaxCategoryReferenceBuilder ? $this->taxCategory->build() : $this->taxCategory, + $this->taxRate instanceof TaxRateBuilder ? $this->taxRate->build() : $this->taxRate, + $this->perMethodTaxRate, + $this->discountedPricePerQuantity, + $this->custom instanceof CustomFieldsBuilder ? $this->custom->build() : $this->custom, + $this->shippingDetails instanceof ItemShippingDetailsBuilder ? $this->shippingDetails->build() : $this->shippingDetails, + $this->priceMode, + $this->recurrenceInfo instanceof CustomLineItemRecurrenceInfoBuilder ? $this->recurrenceInfo->build() : $this->recurrenceInfo ); } diff --git a/lib/commercetools-history/src/Models/Common/CustomLineItemModel.php b/lib/commercetools-history/src/Models/Common/CustomLineItemModel.php index ff8544d3523..2bd570129b0 100644 --- a/lib/commercetools-history/src/Models/Common/CustomLineItemModel.php +++ b/lib/commercetools-history/src/Models/Common/CustomLineItemModel.php @@ -27,6 +27,12 @@ final class CustomLineItemModel extends JsonObjectModel implements CustomLineIte */ protected $id; + /** + * + * @var ?string + */ + protected $key; + /** * * @var ?LocalizedString @@ -35,7 +41,7 @@ final class CustomLineItemModel extends JsonObjectModel implements CustomLineIte /** * - * @var ?Money + * @var ?TypedMoney */ protected $money; @@ -47,7 +53,13 @@ final class CustomLineItemModel extends JsonObjectModel implements CustomLineIte /** * - * @var ?Money + * @var ?MethodTaxedPriceCollection + */ + protected $taxedPricePortions; + + /** + * + * @var ?CentPrecisionMoney */ protected $totalPrice; @@ -63,31 +75,107 @@ final class CustomLineItemModel extends JsonObjectModel implements CustomLineIte */ protected $quantity; + /** + * + * @var ?ItemStateCollection + */ + protected $state; + + /** + * + * @var ?TaxCategoryReference + */ + protected $taxCategory; + + /** + * + * @var ?TaxRate + */ + protected $taxRate; + + /** + * + * @var ?MethodTaxRateCollection + */ + protected $perMethodTaxRate; + + /** + * + * @var ?DiscountedLineItemPriceForQuantityCollection + */ + protected $discountedPricePerQuantity; + + /** + * + * @var ?CustomFields + */ + protected $custom; + + /** + * + * @var ?ItemShippingDetails + */ + protected $shippingDetails; + + /** + * + * @var ?string + */ + protected $priceMode; + + /** + * + * @var ?CustomLineItemRecurrenceInfo + */ + protected $recurrenceInfo; + /** * @psalm-suppress MissingParamType */ public function __construct( ?string $id = null, + ?string $key = null, ?LocalizedString $name = null, - ?Money $money = null, + ?TypedMoney $money = null, ?TaxedItemPrice $taxedPrice = null, - ?Money $totalPrice = null, + ?MethodTaxedPriceCollection $taxedPricePortions = null, + ?CentPrecisionMoney $totalPrice = null, ?string $slug = null, - ?int $quantity = null + ?int $quantity = null, + ?ItemStateCollection $state = null, + ?TaxCategoryReference $taxCategory = null, + ?TaxRate $taxRate = null, + ?MethodTaxRateCollection $perMethodTaxRate = null, + ?DiscountedLineItemPriceForQuantityCollection $discountedPricePerQuantity = null, + ?CustomFields $custom = null, + ?ItemShippingDetails $shippingDetails = null, + ?string $priceMode = null, + ?CustomLineItemRecurrenceInfo $recurrenceInfo = null ) { $this->id = $id; + $this->key = $key; $this->name = $name; $this->money = $money; $this->taxedPrice = $taxedPrice; + $this->taxedPricePortions = $taxedPricePortions; $this->totalPrice = $totalPrice; $this->slug = $slug; $this->quantity = $quantity; + $this->state = $state; + $this->taxCategory = $taxCategory; + $this->taxRate = $taxRate; + $this->perMethodTaxRate = $perMethodTaxRate; + $this->discountedPricePerQuantity = $discountedPricePerQuantity; + $this->custom = $custom; + $this->shippingDetails = $shippingDetails; + $this->priceMode = $priceMode; + $this->recurrenceInfo = $recurrenceInfo; } /** - *The unique ID of this CustomLineItem.
+ *Unique identifier of the Custom Line Item.
* * * @return null|string @@ -107,6 +195,28 @@ public function getId() } /** + *User-defined unique identifier of the Custom Line Item.
+ * + * + * @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 Custom Line Item.
+ * * * @return null|LocalizedString */ @@ -126,8 +236,10 @@ public function getName() } /** + *Money value of the Custom Line Item.
+ * * - * @return null|Money + * @return null|TypedMoney */ public function getMoney() { @@ -137,14 +249,16 @@ public function getMoney() if (is_null($data)) { return null; } - - $this->money = MoneyModel::of($data); + $className = TypedMoneyModel::resolveDiscriminatorClass($data); + $this->money = $className::of($data); } return $this->money; } /** + *Automatically set after the taxRate is set.
Total taxed prices based on the quantity of the Custom Line Item assigned to each Shipping Method. Only applicable for Carts with Multiple ShippingMode.
+ * Automatically set after perMethodTaxRate is set.
Total price of the Custom Line Item (money multiplied by quantity).
+ * If the Custom Line Item is discounted, the total price is discountedPricePerQuantity multiplied by quantity.
Includes taxes if the TaxRate includedInPrice is true.
A unique String in the cart to identify this CustomLineItem.
+ *User-defined identifier used in a deep-link URL for the Custom Line Item.
+ * It matches the pattern [a-zA-Z0-9_-]{2,256}.
The amount of a CustomLineItem in the cart. Must be a positive integer.
+ *Number of Custom Line Items in the Cart or Order.
* * * @return null|int @@ -222,6 +362,195 @@ public function getQuantity() return $this->quantity; } + /** + *Tracks specific quantities of the Custom Line Item within a given State. When a Custom Line Item is added to a Cart, its full quantity is set to the built-in "Initial" state. State transitions for Custom Line Items are managed on the Order.
+ * + * + * @return null|ItemStateCollection + */ + public function getState() + { + if (is_null($this->state)) { + /** @psalm-var ?listUsed to select a Tax Rate when a Cart has the Platform TaxMode.
Platform TaxMode, the taxRate of Custom Line Items is set automatically once a shipping address is set. The rate is based on the TaxCategory that applies for the shipping address.External TaxMode, the taxRate of Custom Line Items can be set using ExternalTaxRateDraft.Tax Rate per Shipping Method for a Cart with Multiple ShippingMode. For a Cart with Platform TaxMode it is automatically set after the Shipping Method is added.
+ * For a Cart with External TaxMode, the Tax Rate must be set with ExternalTaxRateDraft.
Discounted price of a single quantity of the Custom Line Item.
+ * + * + * @return null|DiscountedLineItemPriceForQuantityCollection + */ + public function getDiscountedPricePerQuantity() + { + if (is_null($this->discountedPricePerQuantity)) { + /** @psalm-var ?listCustom Fields of the Custom Line Item.
+ * + * + * @return null|CustomFields + */ + public function getCustom() + { + if (is_null($this->custom)) { + /** @psalm-var stdClass|arrayContainer for Custom Line Item-specific addresses.
+ * + * + * @return null|ItemShippingDetails + */ + public function getShippingDetails() + { + if (is_null($this->shippingDetails)) { + /** @psalm-var stdClass|arrayIndicates whether Cart Discounts with a matching CartDiscountCustomLineItemsTarget, MultiBuyCustomLineItemsTarget, or CartDiscountPatternTarget are applied to the Custom Line Item.
+ * + * + * @return null|string + */ + public function getPriceMode() + { + if (is_null($this->priceMode)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_PRICE_MODE); + if (is_null($data)) { + return null; + } + $this->priceMode = (string) $data; + } + + return $this->priceMode; + } + + /** + *Recurring Order and frequency data.
+ * + * + * @return null|CustomLineItemRecurrenceInfo + */ + public function getRecurrenceInfo() + { + if (is_null($this->recurrenceInfo)) { + /** @psalm-var stdClass|arrayReference 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-history/src/Models/Common/CustomLineItemRecurrenceInfoCollection.php b/lib/commercetools-history/src/Models/Common/CustomLineItemRecurrenceInfoCollection.php new file mode 100644 index 00000000000..63c6ba06c23 --- /dev/null +++ b/lib/commercetools-history/src/Models/Common/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-history/src/Models/Common/CustomLineItemRecurrenceInfoModel.php b/lib/commercetools-history/src/Models/Common/CustomLineItemRecurrenceInfoModel.php new file mode 100644 index 00000000000..1bdd578fd04 --- /dev/null +++ b/lib/commercetools-history/src/Models/Common/CustomLineItemRecurrenceInfoModel.php @@ -0,0 +1,73 @@ +recurrencePolicy = $recurrencePolicy; + + } + + /** + *Reference to a RecurrencePolicy.
+ * + * + * @return null|RecurrencePolicyReference + */ + public function getRecurrencePolicy() + { + if (is_null($this->recurrencePolicy)) { + /** @psalm-var stdClass|arrayReference to a Customer Group.
+ * + + * @return null|CustomerGroupReference + */ + public function getCustomerGroup() + { + return $this->customerGroup instanceof CustomerGroupReferenceBuilder ? $this->customerGroup->build() : $this->customerGroup; + } + + /** + * @param ?CustomerGroupReference $customerGroup + * @return $this + */ + public function withCustomerGroup(?CustomerGroupReference $customerGroup) + { + $this->customerGroup = $customerGroup; + + return $this; + } + + /** + * @deprecated use withCustomerGroup() instead + * @return $this + */ + public function withCustomerGroupBuilder(?CustomerGroupReferenceBuilder $customerGroup) + { + $this->customerGroup = $customerGroup; + + return $this; + } + + public function build(): CustomerGroupAssignment + { + return new CustomerGroupAssignmentModel( + $this->customerGroup instanceof CustomerGroupReferenceBuilder ? $this->customerGroup->build() : $this->customerGroup + ); + } + + public static function of(): CustomerGroupAssignmentBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-history/src/Models/Common/CustomerGroupAssignmentCollection.php b/lib/commercetools-history/src/Models/Common/CustomerGroupAssignmentCollection.php new file mode 100644 index 00000000000..0988e6858ee --- /dev/null +++ b/lib/commercetools-history/src/Models/Common/CustomerGroupAssignmentCollection.php @@ -0,0 +1,56 @@ + + * @method CustomerGroupAssignment current() + * @method CustomerGroupAssignment end() + * @method CustomerGroupAssignment at($offset) + */ +class CustomerGroupAssignmentCollection extends MapperSequence +{ + /** + * @psalm-assert CustomerGroupAssignment $value + * @psalm-param CustomerGroupAssignment|stdClass $value + * @throws InvalidArgumentException + * + * @return CustomerGroupAssignmentCollection + */ + public function add($value) + { + if (!$value instanceof CustomerGroupAssignment) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?CustomerGroupAssignment + */ + protected function mapper() + { + return function (?int $index): ?CustomerGroupAssignment { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var CustomerGroupAssignment $data */ + $data = CustomerGroupAssignmentModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-history/src/Models/Common/CustomerGroupAssignmentModel.php b/lib/commercetools-history/src/Models/Common/CustomerGroupAssignmentModel.php new file mode 100644 index 00000000000..0fd27314090 --- /dev/null +++ b/lib/commercetools-history/src/Models/Common/CustomerGroupAssignmentModel.php @@ -0,0 +1,73 @@ +customerGroup = $customerGroup; + + } + + /** + *Reference to a Customer Group.
+ * + * + * @return null|CustomerGroupReference + */ + public function getCustomerGroup() + { + if (is_null($this->customerGroup)) { + /** @psalm-var stdClass|arrayUnique identifier of the referenced CustomerGroup.
+ * + + * @return null|string + */ + public function getId() + { + return $this->id; + } + + /** + * @param ?string $id + * @return $this + */ + public function withId(?string $id) + { + $this->id = $id; + + return $this; + } + + + public function build(): CustomerGroupReference + { + return new CustomerGroupReferenceModel( + $this->id + ); + } + + public static function of(): CustomerGroupReferenceBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-history/src/Models/Common/CustomerGroupReferenceCollection.php b/lib/commercetools-history/src/Models/Common/CustomerGroupReferenceCollection.php new file mode 100644 index 00000000000..61b16177100 --- /dev/null +++ b/lib/commercetools-history/src/Models/Common/CustomerGroupReferenceCollection.php @@ -0,0 +1,56 @@ + + * @method CustomerGroupReference current() + * @method CustomerGroupReference end() + * @method CustomerGroupReference at($offset) + */ +class CustomerGroupReferenceCollection extends ReferenceCollection +{ + /** + * @psalm-assert CustomerGroupReference $value + * @psalm-param CustomerGroupReference|stdClass $value + * @throws InvalidArgumentException + * + * @return CustomerGroupReferenceCollection + */ + public function add($value) + { + if (!$value instanceof CustomerGroupReference) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?CustomerGroupReference + */ + protected function mapper() + { + return function (?int $index): ?CustomerGroupReference { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var CustomerGroupReference $data */ + $data = CustomerGroupReferenceModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-history/src/Models/Common/CustomerGroupReferenceModel.php b/lib/commercetools-history/src/Models/Common/CustomerGroupReferenceModel.php new file mode 100644 index 00000000000..36f8a9eb385 --- /dev/null +++ b/lib/commercetools-history/src/Models/Common/CustomerGroupReferenceModel.php @@ -0,0 +1,99 @@ +id = $id; + $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 CustomerGroup.
+ * + * + * @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; + } + + + /** + * @param ?string $id + */ + public function setId(?string $id): void + { + $this->id = $id; + } + + + +} diff --git a/lib/commercetools-history/src/Models/Common/CustomerReference.php b/lib/commercetools-history/src/Models/Common/CustomerReference.php new file mode 100644 index 00000000000..1eba21e6d92 --- /dev/null +++ b/lib/commercetools-history/src/Models/Common/CustomerReference.php @@ -0,0 +1,30 @@ +Unique identifier of the referenced Customer. + * + + * @return null|string + */ + public function getId(); + + /** + * @param ?string $id + */ + public function setId(?string $id): void; +} diff --git a/lib/commercetools-history/src/Models/Common/CustomerReferenceBuilder.php b/lib/commercetools-history/src/Models/Common/CustomerReferenceBuilder.php new file mode 100644 index 00000000000..21aae581588 --- /dev/null +++ b/lib/commercetools-history/src/Models/Common/CustomerReferenceBuilder.php @@ -0,0 +1,63 @@ + + */ +final class CustomerReferenceBuilder implements Builder +{ + /** + + * @var ?string + */ + private $id; + + /** + *Unique identifier of the referenced Customer.
+ * + + * @return null|string + */ + public function getId() + { + return $this->id; + } + + /** + * @param ?string $id + * @return $this + */ + public function withId(?string $id) + { + $this->id = $id; + + return $this; + } + + + public function build(): CustomerReference + { + return new CustomerReferenceModel( + $this->id + ); + } + + public static function of(): CustomerReferenceBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-history/src/Models/Common/CustomerReferenceCollection.php b/lib/commercetools-history/src/Models/Common/CustomerReferenceCollection.php new file mode 100644 index 00000000000..c6b0dbff278 --- /dev/null +++ b/lib/commercetools-history/src/Models/Common/CustomerReferenceCollection.php @@ -0,0 +1,56 @@ + + * @method CustomerReference current() + * @method CustomerReference end() + * @method CustomerReference at($offset) + */ +class CustomerReferenceCollection extends ReferenceCollection +{ + /** + * @psalm-assert CustomerReference $value + * @psalm-param CustomerReference|stdClass $value + * @throws InvalidArgumentException + * + * @return CustomerReferenceCollection + */ + public function add($value) + { + if (!$value instanceof CustomerReference) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?CustomerReference + */ + protected function mapper() + { + return function (?int $index): ?CustomerReference { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var CustomerReference $data */ + $data = CustomerReferenceModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-history/src/Models/Common/CustomerReferenceModel.php b/lib/commercetools-history/src/Models/Common/CustomerReferenceModel.php new file mode 100644 index 00000000000..5c44463e2ee --- /dev/null +++ b/lib/commercetools-history/src/Models/Common/CustomerReferenceModel.php @@ -0,0 +1,99 @@ +id = $id; + $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 Customer.
+ * + * + * @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; + } + + + /** + * @param ?string $id + */ + public function setId(?string $id): void + { + $this->id = $id; + } + + + +} diff --git a/lib/commercetools-history/src/Models/Common/Delivery.php b/lib/commercetools-history/src/Models/Common/Delivery.php index 7ad32aa985f..91316f84c36 100644 --- a/lib/commercetools-history/src/Models/Common/Delivery.php +++ b/lib/commercetools-history/src/Models/Common/Delivery.php @@ -10,11 +10,13 @@ use Commercetools\Base\JsonObject; use Commercetools\Base\DateTimeImmutableCollection; +use DateTimeImmutable; interface Delivery extends JsonObject { public const FIELD_ID = 'id'; + public const FIELD_KEY = 'key'; public const FIELD_CREATED_AT = 'createdAt'; public const FIELD_ITEMS = 'items'; public const FIELD_PARCELS = 'parcels'; @@ -22,37 +24,55 @@ interface Delivery extends JsonObject public const FIELD_CUSTOM = 'custom'; /** + *Unique identifier of the Delivery.
+ * * @return null|string */ public function getId(); /** + *User-defined unique identifier of the Delivery.
+ * * @return null|string */ + public function getKey(); + + /** + *Date and time (UTC) the Delivery was created.
+ * + + * @return null|DateTimeImmutable + */ public function getCreatedAt(); /** + *Line Items or Custom Line Items that are delivered.
+ * * @return null|DeliveryItemCollection */ public function getItems(); /** + *Information regarding the appearance, content, and shipment of a Parcel.
+ * * @return null|ParcelCollection */ public function getParcels(); /** + *Address to which Parcels are delivered.
+ * * @return null|Address */ public function getAddress(); /** - *Custom Fields for the Transaction.
+ *Custom Fields of the Delivery.
* * @return null|CustomFields @@ -65,9 +85,14 @@ public function getCustom(); public function setId(?string $id): void; /** - * @param ?string $createdAt + * @param ?string $key + */ + public function setKey(?string $key): void; + + /** + * @param ?DateTimeImmutable $createdAt */ - public function setCreatedAt(?string $createdAt): void; + public function setCreatedAt(?DateTimeImmutable $createdAt): void; /** * @param ?DeliveryItemCollection $items diff --git a/lib/commercetools-history/src/Models/Common/DeliveryBuilder.php b/lib/commercetools-history/src/Models/Common/DeliveryBuilder.php index da697682f31..45af51bc742 100644 --- a/lib/commercetools-history/src/Models/Common/DeliveryBuilder.php +++ b/lib/commercetools-history/src/Models/Common/DeliveryBuilder.php @@ -14,6 +14,7 @@ use Commercetools\Base\JsonObjectModel; use Commercetools\Base\MapperFactory; use stdClass; +use DateTimeImmutable; /** * @implements BuilderUnique identifier of the Delivery.
+ * * @return null|string */ @@ -66,15 +75,30 @@ public function getId() } /** + *User-defined unique identifier of the Delivery.
+ * * @return null|string */ + public function getKey() + { + return $this->key; + } + + /** + *Date and time (UTC) the Delivery was created.
+ * + + * @return null|DateTimeImmutable + */ public function getCreatedAt() { return $this->createdAt; } /** + *Line Items or Custom Line Items that are delivered.
+ * * @return null|DeliveryItemCollection */ @@ -84,6 +108,8 @@ public function getItems() } /** + *Information regarding the appearance, content, and shipment of a Parcel.
+ * * @return null|ParcelCollection */ @@ -93,6 +119,8 @@ public function getParcels() } /** + *Address to which Parcels are delivered.
+ * * @return null|Address */ @@ -102,7 +130,7 @@ public function getAddress() } /** - *Custom Fields for the Transaction.
+ *Custom Fields of the Delivery.
* * @return null|CustomFields @@ -124,10 +152,21 @@ public function withId(?string $id) } /** - * @param ?string $createdAt + * @param ?string $key + * @return $this + */ + public function withKey(?string $key) + { + $this->key = $key; + + return $this; + } + + /** + * @param ?DateTimeImmutable $createdAt * @return $this */ - public function withCreatedAt(?string $createdAt) + public function withCreatedAt(?DateTimeImmutable $createdAt) { $this->createdAt = $createdAt; @@ -204,6 +243,7 @@ public function build(): Delivery { return new DeliveryModel( $this->id, + $this->key, $this->createdAt, $this->items, $this->parcels, diff --git a/lib/commercetools-history/src/Models/Common/DeliveryItem.php b/lib/commercetools-history/src/Models/Common/DeliveryItem.php index 4896bd7e4a1..0ffd24d7315 100644 --- a/lib/commercetools-history/src/Models/Common/DeliveryItem.php +++ b/lib/commercetools-history/src/Models/Common/DeliveryItem.php @@ -18,12 +18,16 @@ interface DeliveryItem extends JsonObject public const FIELD_QUANTITY = 'quantity'; /** + *id of the LineItem or CustomLineItem delivered.
Number of Line Items or Custom Line Items delivered.
+ * * @return null|int */ diff --git a/lib/commercetools-history/src/Models/Common/DeliveryItemBuilder.php b/lib/commercetools-history/src/Models/Common/DeliveryItemBuilder.php index 7d54ddf58e6..44e57750d8a 100644 --- a/lib/commercetools-history/src/Models/Common/DeliveryItemBuilder.php +++ b/lib/commercetools-history/src/Models/Common/DeliveryItemBuilder.php @@ -33,6 +33,8 @@ final class DeliveryItemBuilder implements Builder private $quantity; /** + *id of the LineItem or CustomLineItem delivered.
Number of Line Items or Custom Line Items delivered.
+ * * @return null|int */ diff --git a/lib/commercetools-history/src/Models/Common/DeliveryItemModel.php b/lib/commercetools-history/src/Models/Common/DeliveryItemModel.php index 24ca9af5302..ecb28128259 100644 --- a/lib/commercetools-history/src/Models/Common/DeliveryItemModel.php +++ b/lib/commercetools-history/src/Models/Common/DeliveryItemModel.php @@ -47,6 +47,8 @@ public function __construct( } /** + *id of the LineItem or CustomLineItem delivered.
Number of Line Items or Custom Line Items delivered.
+ * * * @return null|int */ diff --git a/lib/commercetools-history/src/Models/Common/DeliveryModel.php b/lib/commercetools-history/src/Models/Common/DeliveryModel.php index 81973bcc685..bec97304d61 100644 --- a/lib/commercetools-history/src/Models/Common/DeliveryModel.php +++ b/lib/commercetools-history/src/Models/Common/DeliveryModel.php @@ -13,6 +13,7 @@ use Commercetools\Base\JsonObjectModel; use Commercetools\Base\MapperFactory; use stdClass; +use DateTimeImmutable; /** * @internal @@ -31,6 +32,12 @@ final class DeliveryModel extends JsonObjectModel implements Delivery * * @var ?string */ + protected $key; + + /** + * + * @var ?DateTimeImmutable + */ protected $createdAt; /** @@ -63,13 +70,15 @@ final class DeliveryModel extends JsonObjectModel implements Delivery */ public function __construct( ?string $id = null, - ?string $createdAt = null, + ?string $key = null, + ?DateTimeImmutable $createdAt = null, ?DeliveryItemCollection $items = null, ?ParcelCollection $parcels = null, ?Address $address = null, ?CustomFields $custom = null ) { $this->id = $id; + $this->key = $key; $this->createdAt = $createdAt; $this->items = $items; $this->parcels = $parcels; @@ -79,6 +88,8 @@ public function __construct( } /** + *Unique identifier of the Delivery.
+ * * * @return null|string */ @@ -97,9 +108,31 @@ public function getId() } /** + *User-defined unique identifier of the Delivery.
+ * * * @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; + } + + /** + *Date and time (UTC) the Delivery was created.
+ * + * + * @return null|DateTimeImmutable + */ public function getCreatedAt() { if (is_null($this->createdAt)) { @@ -108,13 +141,19 @@ public function getCreatedAt() if (is_null($data)) { return null; } - $this->createdAt = (string) $data; + $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data); + if (false === $data) { + return null; + } + $this->createdAt = $data; } return $this->createdAt; } /** + *Line Items or Custom Line Items that are delivered.
+ * * * @return null|DeliveryItemCollection */ @@ -133,6 +172,8 @@ public function getItems() } /** + *Information regarding the appearance, content, and shipment of a Parcel.
+ * * * @return null|ParcelCollection */ @@ -151,6 +192,8 @@ public function getParcels() } /** + *Address to which Parcels are delivered.
+ * * * @return null|Address */ @@ -170,7 +213,7 @@ public function getAddress() } /** - *Custom Fields for the Transaction.
+ *Custom Fields of the Delivery.
* * * @return null|CustomFields @@ -200,9 +243,17 @@ public function setId(?string $id): void } /** - * @param ?string $createdAt + * @param ?string $key */ - public function setCreatedAt(?string $createdAt): void + public function setKey(?string $key): void + { + $this->key = $key; + } + + /** + * @param ?DateTimeImmutable $createdAt + */ + public function setCreatedAt(?DateTimeImmutable $createdAt): void { $this->createdAt = $createdAt; } @@ -240,5 +291,14 @@ public function setCustom(?CustomFields $custom): void } + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + $data = $this->toArray(); + if (isset($data[Delivery::FIELD_CREATED_AT]) && $data[Delivery::FIELD_CREATED_AT] instanceof \DateTimeImmutable) { + $data[Delivery::FIELD_CREATED_AT] = $data[Delivery::FIELD_CREATED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c'); + } + return (object) $data; + } } diff --git a/lib/commercetools-history/src/Models/Common/DiscountCodeInfo.php b/lib/commercetools-history/src/Models/Common/DiscountCodeInfo.php index f393085ad4e..1ad017e33ae 100644 --- a/lib/commercetools-history/src/Models/Common/DiscountCodeInfo.php +++ b/lib/commercetools-history/src/Models/Common/DiscountCodeInfo.php @@ -18,21 +18,25 @@ interface DiscountCodeInfo extends JsonObject public const FIELD_STATE = 'state'; /** + *Discount Code associated with the Cart or Order.
+ * - * @return null|Reference + * @return null|DiscountCodeReference */ public function getDiscountCode(); /** + *Indicates the state of the Discount Code applied to the Cart or Order.
+ * * @return null|string */ public function getState(); /** - * @param ?Reference $discountCode + * @param ?DiscountCodeReference $discountCode */ - public function setDiscountCode(?Reference $discountCode): void; + public function setDiscountCode(?DiscountCodeReference $discountCode): void; /** * @param ?string $state diff --git a/lib/commercetools-history/src/Models/Common/DiscountCodeInfoBuilder.php b/lib/commercetools-history/src/Models/Common/DiscountCodeInfoBuilder.php index 2ca2f55fe1b..14bd4b53f39 100644 --- a/lib/commercetools-history/src/Models/Common/DiscountCodeInfoBuilder.php +++ b/lib/commercetools-history/src/Models/Common/DiscountCodeInfoBuilder.php @@ -22,7 +22,7 @@ final class DiscountCodeInfoBuilder implements Builder { /** - * @var null|Reference|ReferenceBuilder + * @var null|DiscountCodeReference|DiscountCodeReferenceBuilder */ private $discountCode; @@ -33,15 +33,19 @@ final class DiscountCodeInfoBuilder implements Builder private $state; /** + *Discount Code associated with the Cart or Order.
+ * - * @return null|Reference + * @return null|DiscountCodeReference */ public function getDiscountCode() { - return $this->discountCode instanceof ReferenceBuilder ? $this->discountCode->build() : $this->discountCode; + return $this->discountCode instanceof DiscountCodeReferenceBuilder ? $this->discountCode->build() : $this->discountCode; } /** + *Indicates the state of the Discount Code applied to the Cart or Order.
+ * * @return null|string */ @@ -51,10 +55,10 @@ public function getState() } /** - * @param ?Reference $discountCode + * @param ?DiscountCodeReference $discountCode * @return $this */ - public function withDiscountCode(?Reference $discountCode) + public function withDiscountCode(?DiscountCodeReference $discountCode) { $this->discountCode = $discountCode; @@ -76,7 +80,7 @@ public function withState(?string $state) * @deprecated use withDiscountCode() instead * @return $this */ - public function withDiscountCodeBuilder(?ReferenceBuilder $discountCode) + public function withDiscountCodeBuilder(?DiscountCodeReferenceBuilder $discountCode) { $this->discountCode = $discountCode; @@ -86,7 +90,7 @@ public function withDiscountCodeBuilder(?ReferenceBuilder $discountCode) public function build(): DiscountCodeInfo { return new DiscountCodeInfoModel( - $this->discountCode instanceof ReferenceBuilder ? $this->discountCode->build() : $this->discountCode, + $this->discountCode instanceof DiscountCodeReferenceBuilder ? $this->discountCode->build() : $this->discountCode, $this->state ); } diff --git a/lib/commercetools-history/src/Models/Common/DiscountCodeInfoModel.php b/lib/commercetools-history/src/Models/Common/DiscountCodeInfoModel.php index 78b7142f6e1..5d9121c88bc 100644 --- a/lib/commercetools-history/src/Models/Common/DiscountCodeInfoModel.php +++ b/lib/commercetools-history/src/Models/Common/DiscountCodeInfoModel.php @@ -23,7 +23,7 @@ final class DiscountCodeInfoModel extends JsonObjectModel implements DiscountCod /** * - * @var ?Reference + * @var ?DiscountCodeReference */ protected $discountCode; @@ -38,7 +38,7 @@ final class DiscountCodeInfoModel extends JsonObjectModel implements DiscountCod * @psalm-suppress MissingParamType */ public function __construct( - ?Reference $discountCode = null, + ?DiscountCodeReference $discountCode = null, ?string $state = null ) { $this->discountCode = $discountCode; @@ -47,8 +47,10 @@ public function __construct( } /** + *Discount Code associated with the Cart or Order.
* - * @return null|Reference + * + * @return null|DiscountCodeReference */ public function getDiscountCode() { @@ -59,13 +61,15 @@ public function getDiscountCode() return null; } - $this->discountCode = ReferenceModel::of($data); + $this->discountCode = DiscountCodeReferenceModel::of($data); } return $this->discountCode; } /** + *Indicates the state of the Discount Code applied to the Cart or Order.
+ * * * @return null|string */ @@ -85,9 +89,9 @@ public function getState() /** - * @param ?Reference $discountCode + * @param ?DiscountCodeReference $discountCode */ - public function setDiscountCode(?Reference $discountCode): void + public function setDiscountCode(?DiscountCodeReference $discountCode): void { $this->discountCode = $discountCode; } diff --git a/lib/commercetools-history/src/Models/Common/DiscountCodeReference.php b/lib/commercetools-history/src/Models/Common/DiscountCodeReference.php new file mode 100644 index 00000000000..88f06537a56 --- /dev/null +++ b/lib/commercetools-history/src/Models/Common/DiscountCodeReference.php @@ -0,0 +1,30 @@ +Unique identifier of the referenced DiscountCode. + * + + * @return null|string + */ + public function getId(); + + /** + * @param ?string $id + */ + public function setId(?string $id): void; +} diff --git a/lib/commercetools-history/src/Models/Common/DiscountCodeReferenceBuilder.php b/lib/commercetools-history/src/Models/Common/DiscountCodeReferenceBuilder.php new file mode 100644 index 00000000000..18e27943fa4 --- /dev/null +++ b/lib/commercetools-history/src/Models/Common/DiscountCodeReferenceBuilder.php @@ -0,0 +1,63 @@ + + */ +final class DiscountCodeReferenceBuilder implements Builder +{ + /** + + * @var ?string + */ + private $id; + + /** + *Unique identifier of the referenced DiscountCode.
+ * + + * @return null|string + */ + public function getId() + { + return $this->id; + } + + /** + * @param ?string $id + * @return $this + */ + public function withId(?string $id) + { + $this->id = $id; + + return $this; + } + + + public function build(): DiscountCodeReference + { + return new DiscountCodeReferenceModel( + $this->id + ); + } + + public static function of(): DiscountCodeReferenceBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-history/src/Models/Common/DiscountCodeReferenceCollection.php b/lib/commercetools-history/src/Models/Common/DiscountCodeReferenceCollection.php new file mode 100644 index 00000000000..6629b17150f --- /dev/null +++ b/lib/commercetools-history/src/Models/Common/DiscountCodeReferenceCollection.php @@ -0,0 +1,56 @@ + + * @method DiscountCodeReference current() + * @method DiscountCodeReference end() + * @method DiscountCodeReference at($offset) + */ +class DiscountCodeReferenceCollection extends ReferenceCollection +{ + /** + * @psalm-assert DiscountCodeReference $value + * @psalm-param DiscountCodeReference|stdClass $value + * @throws InvalidArgumentException + * + * @return DiscountCodeReferenceCollection + */ + public function add($value) + { + if (!$value instanceof DiscountCodeReference) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?DiscountCodeReference + */ + protected function mapper() + { + return function (?int $index): ?DiscountCodeReference { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var DiscountCodeReference $data */ + $data = DiscountCodeReferenceModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-history/src/Models/Common/DiscountCodeReferenceModel.php b/lib/commercetools-history/src/Models/Common/DiscountCodeReferenceModel.php new file mode 100644 index 00000000000..9f42335ef7b --- /dev/null +++ b/lib/commercetools-history/src/Models/Common/DiscountCodeReferenceModel.php @@ -0,0 +1,99 @@ +id = $id; + $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 DiscountCode.
+ * + * + * @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; + } + + + /** + * @param ?string $id + */ + public function setId(?string $id): void + { + $this->id = $id; + } + + + +} diff --git a/lib/commercetools-history/src/Models/Common/DiscountOnTotalPrice.php b/lib/commercetools-history/src/Models/Common/DiscountOnTotalPrice.php new file mode 100644 index 00000000000..6d89a85a4b5 --- /dev/null +++ b/lib/commercetools-history/src/Models/Common/DiscountOnTotalPrice.php @@ -0,0 +1,77 @@ +Money value of the discount on the total price of the Cart or Order. + * + + * @return null|TypedMoney + */ + public function getDiscountedAmount(); + + /** + *Discounts that impact the total price of the Cart or Order.
+ * + + * @return null|DiscountedTotalPricePortionCollection + */ + public function getIncludedDiscounts(); + + /** + *Money value of the discount on the total net price of the Cart or Order.
+ *The same percentage of discount applies as on the discountedAmount.
+ * Present only when taxedPrice of the Cart or Order exists.
Money value of the discount on the total gross price of the Cart or Order.
+ *The same percentage of discount applies as on the discountedAmount.
+ * Present only when taxedPrice of the Cart or Order exists.
Money value of the discount on the total price of the Cart or Order.
+ * + + * @return null|TypedMoney + */ + public function getDiscountedAmount() + { + return $this->discountedAmount instanceof TypedMoneyBuilder ? $this->discountedAmount->build() : $this->discountedAmount; + } + + /** + *Discounts that impact the total price of the Cart or Order.
+ * + + * @return null|DiscountedTotalPricePortionCollection + */ + public function getIncludedDiscounts() + { + return $this->includedDiscounts; + } + + /** + *Money value of the discount on the total net price of the Cart or Order.
+ *The same percentage of discount applies as on the discountedAmount.
+ * Present only when taxedPrice of the Cart or Order exists.
Money value of the discount on the total gross price of the Cart or Order.
+ *The same percentage of discount applies as on the discountedAmount.
+ * Present only when taxedPrice of the Cart or Order exists.
Money value of the discount on the total price of the Cart or Order.
+ * + * + * @return null|TypedMoney + */ + public function getDiscountedAmount() + { + if (is_null($this->discountedAmount)) { + /** @psalm-var stdClass|arrayDiscounts that impact the total price of the Cart or Order.
+ * + * + * @return null|DiscountedTotalPricePortionCollection + */ + public function getIncludedDiscounts() + { + if (is_null($this->includedDiscounts)) { + /** @psalm-var ?listMoney value of the discount on the total net price of the Cart or Order.
+ *The same percentage of discount applies as on the discountedAmount.
+ * Present only when taxedPrice of the Cart or Order exists.
Money value of the discount on the total gross price of the Cart or Order.
+ *The same percentage of discount applies as on the discountedAmount.
+ * Present only when taxedPrice of the Cart or Order exists.
A CartDiscountReference or DirectDiscountReference of the applicable discount on the Line Item.
+ * * @return null|Reference */ public function getDiscount(); /** + *Money value of the applicable discount.
+ * - * @return null|Money + * @return null|TypedMoney */ public function getDiscountedAmount(); @@ -35,7 +39,7 @@ public function getDiscountedAmount(); public function setDiscount(?Reference $discount): void; /** - * @param ?Money $discountedAmount + * @param ?TypedMoney $discountedAmount */ - public function setDiscountedAmount(?Money $discountedAmount): void; + public function setDiscountedAmount(?TypedMoney $discountedAmount): void; } diff --git a/lib/commercetools-history/src/Models/Common/DiscountedLineItemPortionBuilder.php b/lib/commercetools-history/src/Models/Common/DiscountedLineItemPortionBuilder.php index 4b71bc061d2..22b25820296 100644 --- a/lib/commercetools-history/src/Models/Common/DiscountedLineItemPortionBuilder.php +++ b/lib/commercetools-history/src/Models/Common/DiscountedLineItemPortionBuilder.php @@ -28,11 +28,13 @@ final class DiscountedLineItemPortionBuilder implements Builder /** - * @var null|Money|MoneyBuilder + * @var null|TypedMoney|TypedMoneyBuilder */ private $discountedAmount; /** + *A CartDiscountReference or DirectDiscountReference of the applicable discount on the Line Item.
+ * * @return null|Reference */ @@ -42,12 +44,14 @@ public function getDiscount() } /** + *Money value of the applicable discount.
+ * - * @return null|Money + * @return null|TypedMoney */ public function getDiscountedAmount() { - return $this->discountedAmount instanceof MoneyBuilder ? $this->discountedAmount->build() : $this->discountedAmount; + return $this->discountedAmount instanceof TypedMoneyBuilder ? $this->discountedAmount->build() : $this->discountedAmount; } /** @@ -62,10 +66,10 @@ public function withDiscount(?Reference $discount) } /** - * @param ?Money $discountedAmount + * @param ?TypedMoney $discountedAmount * @return $this */ - public function withDiscountedAmount(?Money $discountedAmount) + public function withDiscountedAmount(?TypedMoney $discountedAmount) { $this->discountedAmount = $discountedAmount; @@ -87,7 +91,7 @@ public function withDiscountBuilder(?ReferenceBuilder $discount) * @deprecated use withDiscountedAmount() instead * @return $this */ - public function withDiscountedAmountBuilder(?MoneyBuilder $discountedAmount) + public function withDiscountedAmountBuilder(?TypedMoneyBuilder $discountedAmount) { $this->discountedAmount = $discountedAmount; @@ -98,7 +102,7 @@ public function build(): DiscountedLineItemPortion { return new DiscountedLineItemPortionModel( $this->discount instanceof ReferenceBuilder ? $this->discount->build() : $this->discount, - $this->discountedAmount instanceof MoneyBuilder ? $this->discountedAmount->build() : $this->discountedAmount + $this->discountedAmount instanceof TypedMoneyBuilder ? $this->discountedAmount->build() : $this->discountedAmount ); } diff --git a/lib/commercetools-history/src/Models/Common/DiscountedLineItemPortionModel.php b/lib/commercetools-history/src/Models/Common/DiscountedLineItemPortionModel.php index cb582256099..cd46bb2aac0 100644 --- a/lib/commercetools-history/src/Models/Common/DiscountedLineItemPortionModel.php +++ b/lib/commercetools-history/src/Models/Common/DiscountedLineItemPortionModel.php @@ -29,7 +29,7 @@ final class DiscountedLineItemPortionModel extends JsonObjectModel implements Di /** * - * @var ?Money + * @var ?TypedMoney */ protected $discountedAmount; @@ -39,7 +39,7 @@ final class DiscountedLineItemPortionModel extends JsonObjectModel implements Di */ public function __construct( ?Reference $discount = null, - ?Money $discountedAmount = null + ?TypedMoney $discountedAmount = null ) { $this->discount = $discount; $this->discountedAmount = $discountedAmount; @@ -47,6 +47,8 @@ public function __construct( } /** + *A CartDiscountReference or DirectDiscountReference of the applicable discount on the Line Item.
+ * * * @return null|Reference */ @@ -58,16 +60,18 @@ public function getDiscount() if (is_null($data)) { return null; } - - $this->discount = ReferenceModel::of($data); + $className = ReferenceModel::resolveDiscriminatorClass($data); + $this->discount = $className::of($data); } return $this->discount; } /** + *Money value of the applicable discount.
* - * @return null|Money + * + * @return null|TypedMoney */ public function getDiscountedAmount() { @@ -77,8 +81,8 @@ public function getDiscountedAmount() if (is_null($data)) { return null; } - - $this->discountedAmount = MoneyModel::of($data); + $className = TypedMoneyModel::resolveDiscriminatorClass($data); + $this->discountedAmount = $className::of($data); } return $this->discountedAmount; @@ -94,9 +98,9 @@ public function setDiscount(?Reference $discount): void } /** - * @param ?Money $discountedAmount + * @param ?TypedMoney $discountedAmount */ - public function setDiscountedAmount(?Money $discountedAmount): void + public function setDiscountedAmount(?TypedMoney $discountedAmount): void { $this->discountedAmount = $discountedAmount; } diff --git a/lib/commercetools-history/src/Models/Common/DiscountedLineItemPrice.php b/lib/commercetools-history/src/Models/Common/DiscountedLineItemPrice.php index 6096b6a69e4..670448e6cec 100644 --- a/lib/commercetools-history/src/Models/Common/DiscountedLineItemPrice.php +++ b/lib/commercetools-history/src/Models/Common/DiscountedLineItemPrice.php @@ -18,21 +18,25 @@ interface DiscountedLineItemPrice extends JsonObject public const FIELD_INCLUDED_DISCOUNTS = 'includedDiscounts'; /** + *Money value of the discounted Line Item or Custom Line Item.
+ * - * @return null|Money + * @return null|TypedMoney */ public function getValue(); /** + *Discount applicable on the Line Item or Custom Line Item.
+ * * @return null|DiscountedLineItemPortionCollection */ public function getIncludedDiscounts(); /** - * @param ?Money $value + * @param ?TypedMoney $value */ - public function setValue(?Money $value): void; + public function setValue(?TypedMoney $value): void; /** * @param ?DiscountedLineItemPortionCollection $includedDiscounts diff --git a/lib/commercetools-history/src/Models/Common/DiscountedLineItemPriceBuilder.php b/lib/commercetools-history/src/Models/Common/DiscountedLineItemPriceBuilder.php index 43fc83302cc..6580ab7cd83 100644 --- a/lib/commercetools-history/src/Models/Common/DiscountedLineItemPriceBuilder.php +++ b/lib/commercetools-history/src/Models/Common/DiscountedLineItemPriceBuilder.php @@ -22,7 +22,7 @@ final class DiscountedLineItemPriceBuilder implements Builder { /** - * @var null|Money|MoneyBuilder + * @var null|TypedMoney|TypedMoneyBuilder */ private $value; @@ -33,15 +33,19 @@ final class DiscountedLineItemPriceBuilder implements Builder private $includedDiscounts; /** + *Money value of the discounted Line Item or Custom Line Item.
+ * - * @return null|Money + * @return null|TypedMoney */ public function getValue() { - return $this->value instanceof MoneyBuilder ? $this->value->build() : $this->value; + return $this->value instanceof TypedMoneyBuilder ? $this->value->build() : $this->value; } /** + *Discount applicable on the Line Item or Custom Line Item.
+ * * @return null|DiscountedLineItemPortionCollection */ @@ -51,10 +55,10 @@ public function getIncludedDiscounts() } /** - * @param ?Money $value + * @param ?TypedMoney $value * @return $this */ - public function withValue(?Money $value) + public function withValue(?TypedMoney $value) { $this->value = $value; @@ -76,7 +80,7 @@ public function withIncludedDiscounts(?DiscountedLineItemPortionCollection $incl * @deprecated use withValue() instead * @return $this */ - public function withValueBuilder(?MoneyBuilder $value) + public function withValueBuilder(?TypedMoneyBuilder $value) { $this->value = $value; @@ -86,7 +90,7 @@ public function withValueBuilder(?MoneyBuilder $value) public function build(): DiscountedLineItemPrice { return new DiscountedLineItemPriceModel( - $this->value instanceof MoneyBuilder ? $this->value->build() : $this->value, + $this->value instanceof TypedMoneyBuilder ? $this->value->build() : $this->value, $this->includedDiscounts ); } diff --git a/lib/commercetools-history/src/Models/Common/DiscountedLineItemPriceForQuantity.php b/lib/commercetools-history/src/Models/Common/DiscountedLineItemPriceForQuantity.php index 72c99f24056..ea5cf0ad4a8 100644 --- a/lib/commercetools-history/src/Models/Common/DiscountedLineItemPriceForQuantity.php +++ b/lib/commercetools-history/src/Models/Common/DiscountedLineItemPriceForQuantity.php @@ -18,12 +18,16 @@ interface DiscountedLineItemPriceForQuantity extends JsonObject public const FIELD_DISCOUNTED_PRICE = 'discountedPrice'; /** + *Number of Line Items or Custom Line Items in the Cart.
+ * * @return null|int */ public function getQuantity(); /** + *Discounted price of the Line Item or Custom Line Item.
+ * * @return null|DiscountedLineItemPrice */ diff --git a/lib/commercetools-history/src/Models/Common/DiscountedLineItemPriceForQuantityBuilder.php b/lib/commercetools-history/src/Models/Common/DiscountedLineItemPriceForQuantityBuilder.php index 66ac488a12b..be2ae9f75ce 100644 --- a/lib/commercetools-history/src/Models/Common/DiscountedLineItemPriceForQuantityBuilder.php +++ b/lib/commercetools-history/src/Models/Common/DiscountedLineItemPriceForQuantityBuilder.php @@ -33,6 +33,8 @@ final class DiscountedLineItemPriceForQuantityBuilder implements Builder private $discountedPrice; /** + *Number of Line Items or Custom Line Items in the Cart.
+ * * @return null|int */ @@ -42,6 +44,8 @@ public function getQuantity() } /** + *Discounted price of the Line Item or Custom Line Item.
+ * * @return null|DiscountedLineItemPrice */ diff --git a/lib/commercetools-history/src/Models/Common/DiscountedLineItemPriceForQuantityModel.php b/lib/commercetools-history/src/Models/Common/DiscountedLineItemPriceForQuantityModel.php index 3d8c7bda4df..8bc11595563 100644 --- a/lib/commercetools-history/src/Models/Common/DiscountedLineItemPriceForQuantityModel.php +++ b/lib/commercetools-history/src/Models/Common/DiscountedLineItemPriceForQuantityModel.php @@ -47,6 +47,8 @@ public function __construct( } /** + *Number of Line Items or Custom Line Items in the Cart.
+ * * * @return null|int */ @@ -65,6 +67,8 @@ public function getQuantity() } /** + *Discounted price of the Line Item or Custom Line Item.
+ * * * @return null|DiscountedLineItemPrice */ diff --git a/lib/commercetools-history/src/Models/Common/DiscountedLineItemPriceModel.php b/lib/commercetools-history/src/Models/Common/DiscountedLineItemPriceModel.php index 81e8de435ee..99e33ddb5ce 100644 --- a/lib/commercetools-history/src/Models/Common/DiscountedLineItemPriceModel.php +++ b/lib/commercetools-history/src/Models/Common/DiscountedLineItemPriceModel.php @@ -23,7 +23,7 @@ final class DiscountedLineItemPriceModel extends JsonObjectModel implements Disc /** * - * @var ?Money + * @var ?TypedMoney */ protected $value; @@ -38,7 +38,7 @@ final class DiscountedLineItemPriceModel extends JsonObjectModel implements Disc * @psalm-suppress MissingParamType */ public function __construct( - ?Money $value = null, + ?TypedMoney $value = null, ?DiscountedLineItemPortionCollection $includedDiscounts = null ) { $this->value = $value; @@ -47,8 +47,10 @@ public function __construct( } /** + *Money value of the discounted Line Item or Custom Line Item.
* - * @return null|Money + * + * @return null|TypedMoney */ public function getValue() { @@ -58,14 +60,16 @@ public function getValue() if (is_null($data)) { return null; } - - $this->value = MoneyModel::of($data); + $className = TypedMoneyModel::resolveDiscriminatorClass($data); + $this->value = $className::of($data); } return $this->value; } /** + *Discount applicable on the Line Item or Custom Line Item.
+ * * * @return null|DiscountedLineItemPortionCollection */ @@ -85,9 +89,9 @@ public function getIncludedDiscounts() /** - * @param ?Money $value + * @param ?TypedMoney $value */ - public function setValue(?Money $value): void + public function setValue(?TypedMoney $value): void { $this->value = $value; } diff --git a/lib/commercetools-history/src/Models/Common/DiscountedPrice.php b/lib/commercetools-history/src/Models/Common/DiscountedPrice.php new file mode 100644 index 00000000000..40e433cc7bc --- /dev/null +++ b/lib/commercetools-history/src/Models/Common/DiscountedPrice.php @@ -0,0 +1,45 @@ +Money value of the discounted price. + * + + * @return null|TypedMoney + */ + public function getValue(); + + /** + *ProductDiscount related to the discounted price.
+ * + + * @return null|ProductDiscountReference + */ + public function getDiscount(); + + /** + * @param ?TypedMoney $value + */ + public function setValue(?TypedMoney $value): void; + + /** + * @param ?ProductDiscountReference $discount + */ + public function setDiscount(?ProductDiscountReference $discount): void; +} diff --git a/lib/commercetools-history/src/Models/Common/DiscountedPriceBuilder.php b/lib/commercetools-history/src/Models/Common/DiscountedPriceBuilder.php new file mode 100644 index 00000000000..592d4bb505e --- /dev/null +++ b/lib/commercetools-history/src/Models/Common/DiscountedPriceBuilder.php @@ -0,0 +1,113 @@ + + */ +final class DiscountedPriceBuilder implements Builder +{ + /** + + * @var null|TypedMoney|TypedMoneyBuilder + */ + private $value; + + /** + + * @var null|ProductDiscountReference|ProductDiscountReferenceBuilder + */ + private $discount; + + /** + *Money value of the discounted price.
+ * + + * @return null|TypedMoney + */ + public function getValue() + { + return $this->value instanceof TypedMoneyBuilder ? $this->value->build() : $this->value; + } + + /** + *ProductDiscount related to the discounted price.
+ * + + * @return null|ProductDiscountReference + */ + public function getDiscount() + { + return $this->discount instanceof ProductDiscountReferenceBuilder ? $this->discount->build() : $this->discount; + } + + /** + * @param ?TypedMoney $value + * @return $this + */ + public function withValue(?TypedMoney $value) + { + $this->value = $value; + + return $this; + } + + /** + * @param ?ProductDiscountReference $discount + * @return $this + */ + public function withDiscount(?ProductDiscountReference $discount) + { + $this->discount = $discount; + + return $this; + } + + /** + * @deprecated use withValue() instead + * @return $this + */ + public function withValueBuilder(?TypedMoneyBuilder $value) + { + $this->value = $value; + + return $this; + } + + /** + * @deprecated use withDiscount() instead + * @return $this + */ + public function withDiscountBuilder(?ProductDiscountReferenceBuilder $discount) + { + $this->discount = $discount; + + return $this; + } + + public function build(): DiscountedPrice + { + return new DiscountedPriceModel( + $this->value instanceof TypedMoneyBuilder ? $this->value->build() : $this->value, + $this->discount instanceof ProductDiscountReferenceBuilder ? $this->discount->build() : $this->discount + ); + } + + public static function of(): DiscountedPriceBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-history/src/Models/Common/DiscountedPriceCollection.php b/lib/commercetools-history/src/Models/Common/DiscountedPriceCollection.php new file mode 100644 index 00000000000..edcee3cb70b --- /dev/null +++ b/lib/commercetools-history/src/Models/Common/DiscountedPriceCollection.php @@ -0,0 +1,56 @@ + + * @method DiscountedPrice current() + * @method DiscountedPrice end() + * @method DiscountedPrice at($offset) + */ +class DiscountedPriceCollection extends MapperSequence +{ + /** + * @psalm-assert DiscountedPrice $value + * @psalm-param DiscountedPrice|stdClass $value + * @throws InvalidArgumentException + * + * @return DiscountedPriceCollection + */ + public function add($value) + { + if (!$value instanceof DiscountedPrice) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?DiscountedPrice + */ + protected function mapper() + { + return function (?int $index): ?DiscountedPrice { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var DiscountedPrice $data */ + $data = DiscountedPriceModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-history/src/Models/Common/DiscountedPriceModel.php b/lib/commercetools-history/src/Models/Common/DiscountedPriceModel.php new file mode 100644 index 00000000000..9388ae501f3 --- /dev/null +++ b/lib/commercetools-history/src/Models/Common/DiscountedPriceModel.php @@ -0,0 +1,110 @@ +value = $value; + $this->discount = $discount; + + } + + /** + *Money value of the discounted price.
+ * + * + * @return null|TypedMoney + */ + public function getValue() + { + if (is_null($this->value)) { + /** @psalm-var stdClass|arrayProductDiscount related to the discounted price.
+ * + * + * @return null|ProductDiscountReference + */ + public function getDiscount() + { + if (is_null($this->discount)) { + /** @psalm-var stdClass|arraytotalPrice.
+ *
+
+ * @return null|Reference
+ */
+ public function getDiscount();
+
+ /**
+ * Money value of the discount.
+ * + + * @return null|TypedMoney + */ + public function getDiscountedAmount(); + + /** + * @param ?Reference $discount + */ + public function setDiscount(?Reference $discount): void; + + /** + * @param ?TypedMoney $discountedAmount + */ + public function setDiscountedAmount(?TypedMoney $discountedAmount): void; +} diff --git a/lib/commercetools-history/src/Models/Common/DiscountedTotalPricePortionBuilder.php b/lib/commercetools-history/src/Models/Common/DiscountedTotalPricePortionBuilder.php new file mode 100644 index 00000000000..b403cca5b96 --- /dev/null +++ b/lib/commercetools-history/src/Models/Common/DiscountedTotalPricePortionBuilder.php @@ -0,0 +1,113 @@ + + */ +final class DiscountedTotalPricePortionBuilder implements Builder +{ + /** + + * @var null|Reference|ReferenceBuilder + */ + private $discount; + + /** + + * @var null|TypedMoney|TypedMoneyBuilder + */ + private $discountedAmount; + + /** + *A CartDiscountReference or DirectDiscountReference to the discount applied on the Cart totalPrice.
Money value of the discount.
+ * + + * @return null|TypedMoney + */ + public function getDiscountedAmount() + { + return $this->discountedAmount instanceof TypedMoneyBuilder ? $this->discountedAmount->build() : $this->discountedAmount; + } + + /** + * @param ?Reference $discount + * @return $this + */ + public function withDiscount(?Reference $discount) + { + $this->discount = $discount; + + return $this; + } + + /** + * @param ?TypedMoney $discountedAmount + * @return $this + */ + public function withDiscountedAmount(?TypedMoney $discountedAmount) + { + $this->discountedAmount = $discountedAmount; + + return $this; + } + + /** + * @deprecated use withDiscount() instead + * @return $this + */ + public function withDiscountBuilder(?ReferenceBuilder $discount) + { + $this->discount = $discount; + + return $this; + } + + /** + * @deprecated use withDiscountedAmount() instead + * @return $this + */ + public function withDiscountedAmountBuilder(?TypedMoneyBuilder $discountedAmount) + { + $this->discountedAmount = $discountedAmount; + + return $this; + } + + public function build(): DiscountedTotalPricePortion + { + return new DiscountedTotalPricePortionModel( + $this->discount instanceof ReferenceBuilder ? $this->discount->build() : $this->discount, + $this->discountedAmount instanceof TypedMoneyBuilder ? $this->discountedAmount->build() : $this->discountedAmount + ); + } + + public static function of(): DiscountedTotalPricePortionBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-history/src/Models/Common/DiscountedTotalPricePortionCollection.php b/lib/commercetools-history/src/Models/Common/DiscountedTotalPricePortionCollection.php new file mode 100644 index 00000000000..ec7ab20546c --- /dev/null +++ b/lib/commercetools-history/src/Models/Common/DiscountedTotalPricePortionCollection.php @@ -0,0 +1,56 @@ + + * @method DiscountedTotalPricePortion current() + * @method DiscountedTotalPricePortion end() + * @method DiscountedTotalPricePortion at($offset) + */ +class DiscountedTotalPricePortionCollection extends MapperSequence +{ + /** + * @psalm-assert DiscountedTotalPricePortion $value + * @psalm-param DiscountedTotalPricePortion|stdClass $value + * @throws InvalidArgumentException + * + * @return DiscountedTotalPricePortionCollection + */ + public function add($value) + { + if (!$value instanceof DiscountedTotalPricePortion) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?DiscountedTotalPricePortion + */ + protected function mapper() + { + return function (?int $index): ?DiscountedTotalPricePortion { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var DiscountedTotalPricePortion $data */ + $data = DiscountedTotalPricePortionModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-history/src/Models/Common/DiscountedTotalPricePortionModel.php b/lib/commercetools-history/src/Models/Common/DiscountedTotalPricePortionModel.php new file mode 100644 index 00000000000..4ee36cc7d68 --- /dev/null +++ b/lib/commercetools-history/src/Models/Common/DiscountedTotalPricePortionModel.php @@ -0,0 +1,110 @@ +discount = $discount; + $this->discountedAmount = $discountedAmount; + + } + + /** + *A CartDiscountReference or DirectDiscountReference to the discount applied on the Cart totalPrice.
Money value of the discount.
+ * + * + * @return null|TypedMoney + */ + public function getDiscountedAmount() + { + if (is_null($this->discountedAmount)) { + /** @psalm-var stdClass|arrayData type of the Custom Field to define.
+ * * @return null|FieldType */ public function getType(); /** - *The name of the field. The name must be between two and 36 characters long and can contain the ASCII letters A to Z in lowercase or uppercase, digits, underscores (_) and the hyphen-minus (-). The name must be unique for a given resource type ID. In case there is a field with the same name in another type it has to have the same FieldType also.
Name of the Custom Field to define.
+ * Must be unique for a given ResourceTypeId.
+ * In case there is a FieldDefinition with the same name in another Type, both FieldDefinitions must have the same type.
A human-readable label for the field.
+ * * @return null|LocalizedString */ public function getLabel(); /** + *Defines whether the field is required to have a value.
+ * + + * @return null|bool + */ + public function getRequired(); + + /** + *Defines the visual representation of the field in user interfaces like the Merchant Center. + * It is only relevant for string-based FieldTypes like CustomFieldStringType and CustomFieldLocalizedStringType.
+ * * @return null|string */ @@ -60,6 +78,11 @@ public function setName(?string $name): void; */ public function setLabel(?LocalizedString $label): void; + /** + * @param ?bool $required + */ + public function setRequired(?bool $required): void; + /** * @param ?string $inputHint */ diff --git a/lib/commercetools-history/src/Models/Common/FieldDefinitionBuilder.php b/lib/commercetools-history/src/Models/Common/FieldDefinitionBuilder.php index d742a3deaf3..001bad68493 100644 --- a/lib/commercetools-history/src/Models/Common/FieldDefinitionBuilder.php +++ b/lib/commercetools-history/src/Models/Common/FieldDefinitionBuilder.php @@ -38,6 +38,12 @@ final class FieldDefinitionBuilder implements Builder */ private $label; + /** + + * @var ?bool + */ + private $required; + /** * @var ?string @@ -45,6 +51,8 @@ final class FieldDefinitionBuilder implements Builder private $inputHint; /** + *Data type of the Custom Field to define.
+ * * @return null|FieldType */ @@ -54,7 +62,9 @@ public function getType() } /** - *The name of the field. The name must be between two and 36 characters long and can contain the ASCII letters A to Z in lowercase or uppercase, digits, underscores (_) and the hyphen-minus (-). The name must be unique for a given resource type ID. In case there is a field with the same name in another type it has to have the same FieldType also.
Name of the Custom Field to define.
+ * Must be unique for a given ResourceTypeId.
+ * In case there is a FieldDefinition with the same name in another Type, both FieldDefinitions must have the same type.
A human-readable label for the field.
+ * * @return null|LocalizedString */ @@ -74,6 +86,20 @@ public function getLabel() } /** + *Defines whether the field is required to have a value.
+ * + + * @return null|bool + */ + public function getRequired() + { + return $this->required; + } + + /** + *Defines the visual representation of the field in user interfaces like the Merchant Center. + * It is only relevant for string-based FieldTypes like CustomFieldStringType and CustomFieldLocalizedStringType.
+ * * @return null|string */ @@ -115,6 +141,17 @@ public function withLabel(?LocalizedString $label) return $this; } + /** + * @param ?bool $required + * @return $this + */ + public function withRequired(?bool $required) + { + $this->required = $required; + + return $this; + } + /** * @param ?string $inputHint * @return $this @@ -154,6 +191,7 @@ public function build(): FieldDefinition $this->type instanceof FieldTypeBuilder ? $this->type->build() : $this->type, $this->name, $this->label instanceof LocalizedStringBuilder ? $this->label->build() : $this->label, + $this->required, $this->inputHint ); } diff --git a/lib/commercetools-history/src/Models/Common/FieldDefinitionModel.php b/lib/commercetools-history/src/Models/Common/FieldDefinitionModel.php index 1634e0e0fea..3d494fd2f16 100644 --- a/lib/commercetools-history/src/Models/Common/FieldDefinitionModel.php +++ b/lib/commercetools-history/src/Models/Common/FieldDefinitionModel.php @@ -39,6 +39,12 @@ final class FieldDefinitionModel extends JsonObjectModel implements FieldDefinit */ protected $label; + /** + * + * @var ?bool + */ + protected $required; + /** * * @var ?string @@ -53,16 +59,20 @@ public function __construct( ?FieldType $type = null, ?string $name = null, ?LocalizedString $label = null, + ?bool $required = null, ?string $inputHint = null ) { $this->type = $type; $this->name = $name; $this->label = $label; + $this->required = $required; $this->inputHint = $inputHint; } /** + *Data type of the Custom Field to define.
+ * * * @return null|FieldType */ @@ -82,7 +92,9 @@ public function getType() } /** - *The name of the field. The name must be between two and 36 characters long and can contain the ASCII letters A to Z in lowercase or uppercase, digits, underscores (_) and the hyphen-minus (-). The name must be unique for a given resource type ID. In case there is a field with the same name in another type it has to have the same FieldType also.
Name of the Custom Field to define.
+ * Must be unique for a given ResourceTypeId.
+ * In case there is a FieldDefinition with the same name in another Type, both FieldDefinitions must have the same type.
A human-readable label for the field.
+ * * * @return null|LocalizedString */ @@ -121,6 +135,29 @@ public function getLabel() } /** + *Defines whether the field is required to have a value.
+ * + * + * @return null|bool + */ + public function getRequired() + { + if (is_null($this->required)) { + /** @psalm-var ?bool $data */ + $data = $this->raw(self::FIELD_REQUIRED); + if (is_null($data)) { + return null; + } + $this->required = (bool) $data; + } + + return $this->required; + } + + /** + *Defines the visual representation of the field in user interfaces like the Merchant Center. + * It is only relevant for string-based FieldTypes like CustomFieldStringType and CustomFieldLocalizedStringType.
+ * * * @return null|string */ @@ -163,6 +200,14 @@ public function setLabel(?LocalizedString $label): void $this->label = $label; } + /** + * @param ?bool $required + */ + public function setRequired(?bool $required): void + { + $this->required = $required; + } + /** * @param ?string $inputHint */ diff --git a/lib/commercetools-history/src/Models/Common/GeoJson.php b/lib/commercetools-history/src/Models/Common/GeoJson.php new file mode 100644 index 00000000000..40cd1ca97a4 --- /dev/null +++ b/lib/commercetools-history/src/Models/Common/GeoJson.php @@ -0,0 +1,25 @@ + + */ +final class GeoJsonBuilder implements Builder +{ + + + + + public function build(): GeoJson + { + return new GeoJsonModel( + ); + } + + public static function of(): GeoJsonBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-history/src/Models/Common/GeoJsonCollection.php b/lib/commercetools-history/src/Models/Common/GeoJsonCollection.php new file mode 100644 index 00000000000..ebf5c0bafaf --- /dev/null +++ b/lib/commercetools-history/src/Models/Common/GeoJsonCollection.php @@ -0,0 +1,60 @@ + + * @psalm-method T current() + * @psalm-method T end() + * @psalm-method T at($offset) + * @method GeoJson current() + * @method GeoJson end() + * @method GeoJson at($offset) + */ +class GeoJsonCollection extends MapperSequence +{ + /** + * @psalm-assert T $value + * @psalm-param T|stdClass $value + * @throws InvalidArgumentException + * + * @return GeoJsonCollection + */ + public function add($value) + { + if (!$value instanceof GeoJson) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?T + */ + protected function mapper() + { + return function (?int $index): ?GeoJson { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var T $data */ + $data = GeoJsonModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-history/src/Models/Common/GeoJsonModel.php b/lib/commercetools-history/src/Models/Common/GeoJsonModel.php new file mode 100644 index 00000000000..be385133480 --- /dev/null +++ b/lib/commercetools-history/src/Models/Common/GeoJsonModel.php @@ -0,0 +1,96 @@ + > + * + */ + private static $discriminatorClasses = [ + 'Point' => GeoLocationModel::class, + ]; + + /** + * @psalm-suppress MissingParamType + */ + public function __construct( + ?string $type = null + ) { + $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; + } + + + + + + /** + * @psalm-param stdClass|arrayURL of the image in its original size that must be unique within a single ProductVariant.
+ * * @return null|string */ public function getUrl(); /** + *Dimensions of the original image.
+ * * @return null|ImageDimensions */ public function getDimensions(); /** + *Custom label for the image.
+ * * @return null|string */ diff --git a/lib/commercetools-history/src/Models/Common/ImageBuilder.php b/lib/commercetools-history/src/Models/Common/ImageBuilder.php index 2007ad2e221..4261cbd29e8 100644 --- a/lib/commercetools-history/src/Models/Common/ImageBuilder.php +++ b/lib/commercetools-history/src/Models/Common/ImageBuilder.php @@ -39,6 +39,8 @@ final class ImageBuilder implements Builder private $label; /** + *URL of the image in its original size that must be unique within a single ProductVariant.
+ * * @return null|string */ @@ -48,6 +50,8 @@ public function getUrl() } /** + *Dimensions of the original image.
+ * * @return null|ImageDimensions */ @@ -57,6 +61,8 @@ public function getDimensions() } /** + *Custom label for the image.
+ * * @return null|string */ diff --git a/lib/commercetools-history/src/Models/Common/ImageDimensions.php b/lib/commercetools-history/src/Models/Common/ImageDimensions.php index 9059408e259..eb006da4eba 100644 --- a/lib/commercetools-history/src/Models/Common/ImageDimensions.php +++ b/lib/commercetools-history/src/Models/Common/ImageDimensions.php @@ -18,12 +18,16 @@ interface ImageDimensions extends JsonObject public const FIELD_H = 'h'; /** + *Width of the image.
+ * * @return null|int */ public function getW(); /** + *Height of the image.
+ * * @return null|int */ diff --git a/lib/commercetools-history/src/Models/Common/ImageDimensionsBuilder.php b/lib/commercetools-history/src/Models/Common/ImageDimensionsBuilder.php index b2fe6b5a830..78bdf42b21d 100644 --- a/lib/commercetools-history/src/Models/Common/ImageDimensionsBuilder.php +++ b/lib/commercetools-history/src/Models/Common/ImageDimensionsBuilder.php @@ -33,6 +33,8 @@ final class ImageDimensionsBuilder implements Builder private $h; /** + *Width of the image.
+ * * @return null|int */ @@ -42,6 +44,8 @@ public function getW() } /** + *Height of the image.
+ * * @return null|int */ diff --git a/lib/commercetools-history/src/Models/Common/ImageDimensionsModel.php b/lib/commercetools-history/src/Models/Common/ImageDimensionsModel.php index 996969e089d..74b09f3e0c7 100644 --- a/lib/commercetools-history/src/Models/Common/ImageDimensionsModel.php +++ b/lib/commercetools-history/src/Models/Common/ImageDimensionsModel.php @@ -47,6 +47,8 @@ public function __construct( } /** + *Width of the image.
+ * * * @return null|int */ @@ -65,6 +67,8 @@ public function getW() } /** + *Height of the image.
+ * * * @return null|int */ diff --git a/lib/commercetools-history/src/Models/Common/ImageModel.php b/lib/commercetools-history/src/Models/Common/ImageModel.php index d77d8d0b0be..ba778597ed3 100644 --- a/lib/commercetools-history/src/Models/Common/ImageModel.php +++ b/lib/commercetools-history/src/Models/Common/ImageModel.php @@ -55,6 +55,8 @@ public function __construct( } /** + *URL of the image in its original size that must be unique within a single ProductVariant.
+ * * * @return null|string */ @@ -73,6 +75,8 @@ public function getUrl() } /** + *Dimensions of the original image.
+ * * * @return null|ImageDimensions */ @@ -92,6 +96,8 @@ public function getDimensions() } /** + *Custom label for the image.
+ * * * @return null|string */ diff --git a/lib/commercetools-history/src/Models/Common/InheritedAssociate.php b/lib/commercetools-history/src/Models/Common/InheritedAssociate.php index 7a10ebba356..31ea7d1ed21 100644 --- a/lib/commercetools-history/src/Models/Common/InheritedAssociate.php +++ b/lib/commercetools-history/src/Models/Common/InheritedAssociate.php @@ -18,14 +18,18 @@ interface InheritedAssociate extends JsonObject public const FIELD_CUSTOMER = 'customer'; /** + *Inherited roles of the Associate within a Business Unit.
+ * * @return null|InheritedAssociateRoleAssignmentCollection */ public function getAssociateRoleAssignments(); /** + *The Customer that acts as an Associate in the Business Unit.
+ * - * @return null|Reference + * @return null|CustomerReference */ public function getCustomer(); @@ -35,7 +39,7 @@ public function getCustomer(); public function setAssociateRoleAssignments(?InheritedAssociateRoleAssignmentCollection $associateRoleAssignments): void; /** - * @param ?Reference $customer + * @param ?CustomerReference $customer */ - public function setCustomer(?Reference $customer): void; + public function setCustomer(?CustomerReference $customer): void; } diff --git a/lib/commercetools-history/src/Models/Common/InheritedAssociateBuilder.php b/lib/commercetools-history/src/Models/Common/InheritedAssociateBuilder.php index 2fd89070972..cc728f6285e 100644 --- a/lib/commercetools-history/src/Models/Common/InheritedAssociateBuilder.php +++ b/lib/commercetools-history/src/Models/Common/InheritedAssociateBuilder.php @@ -28,11 +28,13 @@ final class InheritedAssociateBuilder implements Builder /** - * @var null|Reference|ReferenceBuilder + * @var null|CustomerReference|CustomerReferenceBuilder */ private $customer; /** + *Inherited roles of the Associate within a Business Unit.
+ * * @return null|InheritedAssociateRoleAssignmentCollection */ @@ -42,12 +44,14 @@ public function getAssociateRoleAssignments() } /** + *The Customer that acts as an Associate in the Business Unit.
+ * - * @return null|Reference + * @return null|CustomerReference */ public function getCustomer() { - return $this->customer instanceof ReferenceBuilder ? $this->customer->build() : $this->customer; + return $this->customer instanceof CustomerReferenceBuilder ? $this->customer->build() : $this->customer; } /** @@ -62,10 +66,10 @@ public function withAssociateRoleAssignments(?InheritedAssociateRoleAssignmentCo } /** - * @param ?Reference $customer + * @param ?CustomerReference $customer * @return $this */ - public function withCustomer(?Reference $customer) + public function withCustomer(?CustomerReference $customer) { $this->customer = $customer; @@ -76,7 +80,7 @@ public function withCustomer(?Reference $customer) * @deprecated use withCustomer() instead * @return $this */ - public function withCustomerBuilder(?ReferenceBuilder $customer) + public function withCustomerBuilder(?CustomerReferenceBuilder $customer) { $this->customer = $customer; @@ -87,7 +91,7 @@ public function build(): InheritedAssociate { return new InheritedAssociateModel( $this->associateRoleAssignments, - $this->customer instanceof ReferenceBuilder ? $this->customer->build() : $this->customer + $this->customer instanceof CustomerReferenceBuilder ? $this->customer->build() : $this->customer ); } diff --git a/lib/commercetools-history/src/Models/Common/InheritedAssociateModel.php b/lib/commercetools-history/src/Models/Common/InheritedAssociateModel.php index 4737059a675..1a2dc7fdf67 100644 --- a/lib/commercetools-history/src/Models/Common/InheritedAssociateModel.php +++ b/lib/commercetools-history/src/Models/Common/InheritedAssociateModel.php @@ -29,7 +29,7 @@ final class InheritedAssociateModel extends JsonObjectModel implements Inherited /** * - * @var ?Reference + * @var ?CustomerReference */ protected $customer; @@ -39,7 +39,7 @@ final class InheritedAssociateModel extends JsonObjectModel implements Inherited */ public function __construct( ?InheritedAssociateRoleAssignmentCollection $associateRoleAssignments = null, - ?Reference $customer = null + ?CustomerReference $customer = null ) { $this->associateRoleAssignments = $associateRoleAssignments; $this->customer = $customer; @@ -47,6 +47,8 @@ public function __construct( } /** + *Inherited roles of the Associate within a Business Unit.
+ * * * @return null|InheritedAssociateRoleAssignmentCollection */ @@ -65,8 +67,10 @@ public function getAssociateRoleAssignments() } /** + *The Customer that acts as an Associate in the Business Unit.
+ * * - * @return null|Reference + * @return null|CustomerReference */ public function getCustomer() { @@ -77,7 +81,7 @@ public function getCustomer() return null; } - $this->customer = ReferenceModel::of($data); + $this->customer = CustomerReferenceModel::of($data); } return $this->customer; @@ -93,9 +97,9 @@ public function setAssociateRoleAssignments(?InheritedAssociateRoleAssignmentCol } /** - * @param ?Reference $customer + * @param ?CustomerReference $customer */ - public function setCustomer(?Reference $customer): void + public function setCustomer(?CustomerReference $customer): void { $this->customer = $customer; } diff --git a/lib/commercetools-history/src/Models/Common/InheritedAssociateRoleAssignment.php b/lib/commercetools-history/src/Models/Common/InheritedAssociateRoleAssignment.php index 76d85d30bf8..d56324ca8fa 100644 --- a/lib/commercetools-history/src/Models/Common/InheritedAssociateRoleAssignment.php +++ b/lib/commercetools-history/src/Models/Common/InheritedAssociateRoleAssignment.php @@ -18,24 +18,28 @@ interface InheritedAssociateRoleAssignment extends JsonObject public const FIELD_SOURCE = 'source'; /** + *Inherited role the Associate holds within a Business Unit.
+ * - * @return null|KeyReference + * @return null|AssociateRoleKeyReference */ public function getAssociateRole(); /** + *Reference to the parent Business Unit where the assignment is defined explicitly.
+ * - * @return null|KeyReference + * @return null|BusinessUnitKeyReference */ public function getSource(); /** - * @param ?KeyReference $associateRole + * @param ?AssociateRoleKeyReference $associateRole */ - public function setAssociateRole(?KeyReference $associateRole): void; + public function setAssociateRole(?AssociateRoleKeyReference $associateRole): void; /** - * @param ?KeyReference $source + * @param ?BusinessUnitKeyReference $source */ - public function setSource(?KeyReference $source): void; + public function setSource(?BusinessUnitKeyReference $source): void; } diff --git a/lib/commercetools-history/src/Models/Common/InheritedAssociateRoleAssignmentBuilder.php b/lib/commercetools-history/src/Models/Common/InheritedAssociateRoleAssignmentBuilder.php index 0767d4c4341..0dba7bae6d4 100644 --- a/lib/commercetools-history/src/Models/Common/InheritedAssociateRoleAssignmentBuilder.php +++ b/lib/commercetools-history/src/Models/Common/InheritedAssociateRoleAssignmentBuilder.php @@ -22,39 +22,43 @@ final class InheritedAssociateRoleAssignmentBuilder implements Builder { /** - * @var null|KeyReference|KeyReferenceBuilder + * @var null|AssociateRoleKeyReference|AssociateRoleKeyReferenceBuilder */ private $associateRole; /** - * @var null|KeyReference|KeyReferenceBuilder + * @var null|BusinessUnitKeyReference|BusinessUnitKeyReferenceBuilder */ private $source; /** + *Inherited role the Associate holds within a Business Unit.
+ * - * @return null|KeyReference + * @return null|AssociateRoleKeyReference */ public function getAssociateRole() { - return $this->associateRole instanceof KeyReferenceBuilder ? $this->associateRole->build() : $this->associateRole; + return $this->associateRole instanceof AssociateRoleKeyReferenceBuilder ? $this->associateRole->build() : $this->associateRole; } /** + *Reference to the parent Business Unit where the assignment is defined explicitly.
+ * - * @return null|KeyReference + * @return null|BusinessUnitKeyReference */ public function getSource() { - return $this->source instanceof KeyReferenceBuilder ? $this->source->build() : $this->source; + return $this->source instanceof BusinessUnitKeyReferenceBuilder ? $this->source->build() : $this->source; } /** - * @param ?KeyReference $associateRole + * @param ?AssociateRoleKeyReference $associateRole * @return $this */ - public function withAssociateRole(?KeyReference $associateRole) + public function withAssociateRole(?AssociateRoleKeyReference $associateRole) { $this->associateRole = $associateRole; @@ -62,10 +66,10 @@ public function withAssociateRole(?KeyReference $associateRole) } /** - * @param ?KeyReference $source + * @param ?BusinessUnitKeyReference $source * @return $this */ - public function withSource(?KeyReference $source) + public function withSource(?BusinessUnitKeyReference $source) { $this->source = $source; @@ -76,7 +80,7 @@ public function withSource(?KeyReference $source) * @deprecated use withAssociateRole() instead * @return $this */ - public function withAssociateRoleBuilder(?KeyReferenceBuilder $associateRole) + public function withAssociateRoleBuilder(?AssociateRoleKeyReferenceBuilder $associateRole) { $this->associateRole = $associateRole; @@ -87,7 +91,7 @@ public function withAssociateRoleBuilder(?KeyReferenceBuilder $associateRole) * @deprecated use withSource() instead * @return $this */ - public function withSourceBuilder(?KeyReferenceBuilder $source) + public function withSourceBuilder(?BusinessUnitKeyReferenceBuilder $source) { $this->source = $source; @@ -97,8 +101,8 @@ public function withSourceBuilder(?KeyReferenceBuilder $source) public function build(): InheritedAssociateRoleAssignment { return new InheritedAssociateRoleAssignmentModel( - $this->associateRole instanceof KeyReferenceBuilder ? $this->associateRole->build() : $this->associateRole, - $this->source instanceof KeyReferenceBuilder ? $this->source->build() : $this->source + $this->associateRole instanceof AssociateRoleKeyReferenceBuilder ? $this->associateRole->build() : $this->associateRole, + $this->source instanceof BusinessUnitKeyReferenceBuilder ? $this->source->build() : $this->source ); } diff --git a/lib/commercetools-history/src/Models/Common/InheritedAssociateRoleAssignmentModel.php b/lib/commercetools-history/src/Models/Common/InheritedAssociateRoleAssignmentModel.php index 2939ce39e01..c8ccf3521b8 100644 --- a/lib/commercetools-history/src/Models/Common/InheritedAssociateRoleAssignmentModel.php +++ b/lib/commercetools-history/src/Models/Common/InheritedAssociateRoleAssignmentModel.php @@ -23,13 +23,13 @@ final class InheritedAssociateRoleAssignmentModel extends JsonObjectModel implem /** * - * @var ?KeyReference + * @var ?AssociateRoleKeyReference */ protected $associateRole; /** * - * @var ?KeyReference + * @var ?BusinessUnitKeyReference */ protected $source; @@ -38,8 +38,8 @@ final class InheritedAssociateRoleAssignmentModel extends JsonObjectModel implem * @psalm-suppress MissingParamType */ public function __construct( - ?KeyReference $associateRole = null, - ?KeyReference $source = null + ?AssociateRoleKeyReference $associateRole = null, + ?BusinessUnitKeyReference $source = null ) { $this->associateRole = $associateRole; $this->source = $source; @@ -47,8 +47,10 @@ public function __construct( } /** + *Inherited role the Associate holds within a Business Unit.
* - * @return null|KeyReference + * + * @return null|AssociateRoleKeyReference */ public function getAssociateRole() { @@ -59,15 +61,17 @@ public function getAssociateRole() return null; } - $this->associateRole = KeyReferenceModel::of($data); + $this->associateRole = AssociateRoleKeyReferenceModel::of($data); } return $this->associateRole; } /** + *Reference to the parent Business Unit where the assignment is defined explicitly.
+ * * - * @return null|KeyReference + * @return null|BusinessUnitKeyReference */ public function getSource() { @@ -78,7 +82,7 @@ public function getSource() return null; } - $this->source = KeyReferenceModel::of($data); + $this->source = BusinessUnitKeyReferenceModel::of($data); } return $this->source; @@ -86,17 +90,17 @@ public function getSource() /** - * @param ?KeyReference $associateRole + * @param ?AssociateRoleKeyReference $associateRole */ - public function setAssociateRole(?KeyReference $associateRole): void + public function setAssociateRole(?AssociateRoleKeyReference $associateRole): void { $this->associateRole = $associateRole; } /** - * @param ?KeyReference $source + * @param ?BusinessUnitKeyReference $source */ - public function setSource(?KeyReference $source): void + public function setSource(?BusinessUnitKeyReference $source): void { $this->source = $source; } diff --git a/lib/commercetools-history/src/Models/Common/ItemShippingDetails.php b/lib/commercetools-history/src/Models/Common/ItemShippingDetails.php index 0dcee422051..959508d6e67 100644 --- a/lib/commercetools-history/src/Models/Common/ItemShippingDetails.php +++ b/lib/commercetools-history/src/Models/Common/ItemShippingDetails.php @@ -18,13 +18,19 @@ interface ItemShippingDetails extends JsonObject public const FIELD_VALID = 'valid'; /** + *Holds information on the quantity of Line Items or Custom Line Items and the address it is shipped.
+ * * @return null|ItemShippingTargetCollection */ public function getTargets(); /** - *true if the quantity of the (custom) line item is equal to the sum of the sub-quantities in targets, false otherwise. A cart cannot be ordered when the value is false. The error InvalidItemShippingDetails will be triggered.
true if the quantity of Line Items or Custom Line Items is equal to the sum of sub-quantities defined in targets.false if the quantity of Line Items or Custom Line Items is not equal to the sum of sub-quantities defined in targets.
+ * Ordering a Cart when the value is false returns an InvalidItemShippingDetails error.Holds information on the quantity of Line Items or Custom Line Items and the address it is shipped.
+ * * @return null|ItemShippingTargetCollection */ @@ -42,7 +44,11 @@ public function getTargets() } /** - *true if the quantity of the (custom) line item is equal to the sum of the sub-quantities in targets, false otherwise. A cart cannot be ordered when the value is false. The error InvalidItemShippingDetails will be triggered.
true if the quantity of Line Items or Custom Line Items is equal to the sum of sub-quantities defined in targets.false if the quantity of Line Items or Custom Line Items is not equal to the sum of sub-quantities defined in targets.
+ * Ordering a Cart when the value is false returns an InvalidItemShippingDetails error.Holds information on the quantity of Line Items or Custom Line Items and the address it is shipped.
+ * * * @return null|ItemShippingTargetCollection */ @@ -65,7 +67,11 @@ public function getTargets() } /** - *true if the quantity of the (custom) line item is equal to the sum of the sub-quantities in targets, false otherwise. A cart cannot be ordered when the value is false. The error InvalidItemShippingDetails will be triggered.
true if the quantity of Line Items or Custom Line Items is equal to the sum of sub-quantities defined in targets.false if the quantity of Line Items or Custom Line Items is not equal to the sum of sub-quantities defined in targets.
+ * Ordering a Cart when the value is false returns an InvalidItemShippingDetails error.The key of the address in the cart's itemShippingAddresses
Key of the address in the Cart itemShippingAddresses.
+ * Duplicate address keys are not allowed.
The quantity of items that should go to the address with the specified addressKey. Only positive values are allowed. Using 0 as quantity is also possible in a draft object, but the element will not be present in the resulting ItemShippingDetails.
Quantity of Line Items or Custom Line Items shipped to the address with the specified addressKey.
If a quantity is updated to 0 when defining ItemShippingDetailsDraft, the targets are removed from a Line Item or Custom Line Item in the resulting ItemShippingDetails.
User-defined unique identifier of the Shipping Method in a Cart with Multiple ShippingMode.
It connects Line Item or Custom Line Item quantities with individual Shipping Methods.
+ * + + * @return null|string + */ + public function getShippingMethodKey(); + /** * @param ?string $addressKey */ @@ -42,4 +54,9 @@ public function setAddressKey(?string $addressKey): void; * @param ?int $quantity */ public function setQuantity(?int $quantity): void; + + /** + * @param ?string $shippingMethodKey + */ + public function setShippingMethodKey(?string $shippingMethodKey): void; } diff --git a/lib/commercetools-history/src/Models/Common/ItemShippingTargetBuilder.php b/lib/commercetools-history/src/Models/Common/ItemShippingTargetBuilder.php index d07329a6c3b..771c9248996 100644 --- a/lib/commercetools-history/src/Models/Common/ItemShippingTargetBuilder.php +++ b/lib/commercetools-history/src/Models/Common/ItemShippingTargetBuilder.php @@ -33,7 +33,14 @@ final class ItemShippingTargetBuilder implements Builder private $quantity; /** - *The key of the address in the cart's itemShippingAddresses
Key of the address in the Cart itemShippingAddresses.
+ * Duplicate address keys are not allowed.
The quantity of items that should go to the address with the specified addressKey. Only positive values are allowed. Using 0 as quantity is also possible in a draft object, but the element will not be present in the resulting ItemShippingDetails.
Quantity of Line Items or Custom Line Items shipped to the address with the specified addressKey.
If a quantity is updated to 0 when defining ItemShippingDetailsDraft, the targets are removed from a Line Item or Custom Line Item in the resulting ItemShippingDetails.
User-defined unique identifier of the Shipping Method in a Cart with Multiple ShippingMode.
It connects Line Item or Custom Line Item quantities with individual Shipping Methods.
+ * + + * @return null|string + */ + public function getShippingMethodKey() + { + return $this->shippingMethodKey; + } + /** * @param ?string $addressKey * @return $this @@ -76,12 +96,24 @@ public function withQuantity(?int $quantity) return $this; } + /** + * @param ?string $shippingMethodKey + * @return $this + */ + public function withShippingMethodKey(?string $shippingMethodKey) + { + $this->shippingMethodKey = $shippingMethodKey; + + return $this; + } + public function build(): ItemShippingTarget { return new ItemShippingTargetModel( $this->addressKey, - $this->quantity + $this->quantity, + $this->shippingMethodKey ); } diff --git a/lib/commercetools-history/src/Models/Common/ItemShippingTargetModel.php b/lib/commercetools-history/src/Models/Common/ItemShippingTargetModel.php index 85b3cb7ce87..acf4aef3922 100644 --- a/lib/commercetools-history/src/Models/Common/ItemShippingTargetModel.php +++ b/lib/commercetools-history/src/Models/Common/ItemShippingTargetModel.php @@ -33,21 +33,30 @@ final class ItemShippingTargetModel extends JsonObjectModel implements ItemShipp */ protected $quantity; + /** + * + * @var ?string + */ + protected $shippingMethodKey; + /** * @psalm-suppress MissingParamType */ public function __construct( ?string $addressKey = null, - ?int $quantity = null + ?int $quantity = null, + ?string $shippingMethodKey = null ) { $this->addressKey = $addressKey; $this->quantity = $quantity; + $this->shippingMethodKey = $shippingMethodKey; } /** - *The key of the address in the cart's itemShippingAddresses
Key of the address in the Cart itemShippingAddresses.
+ * Duplicate address keys are not allowed.
The quantity of items that should go to the address with the specified addressKey. Only positive values are allowed. Using 0 as quantity is also possible in a draft object, but the element will not be present in the resulting ItemShippingDetails.
Quantity of Line Items or Custom Line Items shipped to the address with the specified addressKey.
If a quantity is updated to 0 when defining ItemShippingDetailsDraft, the targets are removed from a Line Item or Custom Line Item in the resulting ItemShippingDetails.
User-defined unique identifier of the Shipping Method in a Cart with Multiple ShippingMode.
It connects Line Item or Custom Line Item quantities with individual Shipping Methods.
+ * + * + * @return null|string + */ + public function getShippingMethodKey() + { + if (is_null($this->shippingMethodKey)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_SHIPPING_METHOD_KEY); + if (is_null($data)) { + return null; + } + $this->shippingMethodKey = (string) $data; + } + + return $this->shippingMethodKey; + } + /** * @param ?string $addressKey @@ -103,6 +134,14 @@ public function setQuantity(?int $quantity): void $this->quantity = $quantity; } + /** + * @param ?string $shippingMethodKey + */ + public function setShippingMethodKey(?string $shippingMethodKey): void + { + $this->shippingMethodKey = $shippingMethodKey; + } + } diff --git a/lib/commercetools-history/src/Models/Common/ItemState.php b/lib/commercetools-history/src/Models/Common/ItemState.php index 434cdc061d5..8dc937dd158 100644 --- a/lib/commercetools-history/src/Models/Common/ItemState.php +++ b/lib/commercetools-history/src/Models/Common/ItemState.php @@ -18,14 +18,18 @@ interface ItemState extends JsonObject public const FIELD_STATE = 'state'; /** + *Number of Line Items or Custom Line Items in this State.
+ * * @return null|int */ public function getQuantity(); /** + *State of the Line Items or Custom Line Items in a custom workflow.
+ * - * @return null|Reference + * @return null|StateReference */ public function getState(); @@ -35,7 +39,7 @@ public function getState(); public function setQuantity(?int $quantity): void; /** - * @param ?Reference $state + * @param ?StateReference $state */ - public function setState(?Reference $state): void; + public function setState(?StateReference $state): void; } diff --git a/lib/commercetools-history/src/Models/Common/ItemStateBuilder.php b/lib/commercetools-history/src/Models/Common/ItemStateBuilder.php index 5e3076b210b..bd69d7e7124 100644 --- a/lib/commercetools-history/src/Models/Common/ItemStateBuilder.php +++ b/lib/commercetools-history/src/Models/Common/ItemStateBuilder.php @@ -28,11 +28,13 @@ final class ItemStateBuilder implements Builder /** - * @var null|Reference|ReferenceBuilder + * @var null|StateReference|StateReferenceBuilder */ private $state; /** + *Number of Line Items or Custom Line Items in this State.
+ * * @return null|int */ @@ -42,12 +44,14 @@ public function getQuantity() } /** + *State of the Line Items or Custom Line Items in a custom workflow.
+ * - * @return null|Reference + * @return null|StateReference */ public function getState() { - return $this->state instanceof ReferenceBuilder ? $this->state->build() : $this->state; + return $this->state instanceof StateReferenceBuilder ? $this->state->build() : $this->state; } /** @@ -62,10 +66,10 @@ public function withQuantity(?int $quantity) } /** - * @param ?Reference $state + * @param ?StateReference $state * @return $this */ - public function withState(?Reference $state) + public function withState(?StateReference $state) { $this->state = $state; @@ -76,7 +80,7 @@ public function withState(?Reference $state) * @deprecated use withState() instead * @return $this */ - public function withStateBuilder(?ReferenceBuilder $state) + public function withStateBuilder(?StateReferenceBuilder $state) { $this->state = $state; @@ -87,7 +91,7 @@ public function build(): ItemState { return new ItemStateModel( $this->quantity, - $this->state instanceof ReferenceBuilder ? $this->state->build() : $this->state + $this->state instanceof StateReferenceBuilder ? $this->state->build() : $this->state ); } diff --git a/lib/commercetools-history/src/Models/Common/ItemStateModel.php b/lib/commercetools-history/src/Models/Common/ItemStateModel.php index f958127a752..f0cb3054bfe 100644 --- a/lib/commercetools-history/src/Models/Common/ItemStateModel.php +++ b/lib/commercetools-history/src/Models/Common/ItemStateModel.php @@ -29,7 +29,7 @@ final class ItemStateModel extends JsonObjectModel implements ItemState /** * - * @var ?Reference + * @var ?StateReference */ protected $state; @@ -39,7 +39,7 @@ final class ItemStateModel extends JsonObjectModel implements ItemState */ public function __construct( ?int $quantity = null, - ?Reference $state = null + ?StateReference $state = null ) { $this->quantity = $quantity; $this->state = $state; @@ -47,6 +47,8 @@ public function __construct( } /** + *Number of Line Items or Custom Line Items in this State.
+ * * * @return null|int */ @@ -65,8 +67,10 @@ public function getQuantity() } /** + *State of the Line Items or Custom Line Items in a custom workflow.
+ * * - * @return null|Reference + * @return null|StateReference */ public function getState() { @@ -77,7 +81,7 @@ public function getState() return null; } - $this->state = ReferenceModel::of($data); + $this->state = StateReferenceModel::of($data); } return $this->state; @@ -93,9 +97,9 @@ public function setQuantity(?int $quantity): void } /** - * @param ?Reference $state + * @param ?StateReference $state */ - public function setState(?Reference $state): void + public function setState(?StateReference $state): void { $this->state = $state; } diff --git a/lib/commercetools-history/src/Models/Common/KeyReference.php b/lib/commercetools-history/src/Models/Common/KeyReference.php index 1b1cd7da533..bc100b79cc7 100644 --- a/lib/commercetools-history/src/Models/Common/KeyReference.php +++ b/lib/commercetools-history/src/Models/Common/KeyReference.php @@ -13,29 +13,28 @@ interface KeyReference extends JsonObject { - - public const FIELD_KEY = 'key'; + public const DISCRIMINATOR_FIELD = 'typeId'; public const FIELD_TYPE_ID = 'typeId'; + public const FIELD_KEY = 'key'; /** + *Type of referenced resource.
+ * * @return null|string */ - public function getKey(); + public function getTypeId(); /** + *User-defined unique and immutable key of the referenced resource.
+ * * @return null|string */ - public function getTypeId(); + public function getKey(); /** * @param ?string $key */ public function setKey(?string $key): void; - - /** - * @param ?string $typeId - */ - public function setTypeId(?string $typeId): void; } diff --git a/lib/commercetools-history/src/Models/Common/KeyReferenceBuilder.php b/lib/commercetools-history/src/Models/Common/KeyReferenceBuilder.php index 5edad50266c..d149c3d2299 100644 --- a/lib/commercetools-history/src/Models/Common/KeyReferenceBuilder.php +++ b/lib/commercetools-history/src/Models/Common/KeyReferenceBuilder.php @@ -27,12 +27,8 @@ final class KeyReferenceBuilder implements Builder private $key; /** - - * @var ?string - */ - private $typeId; - - /** + *User-defined unique and immutable key of the referenced resource.
+ * * @return null|string */ @@ -41,15 +37,6 @@ public function getKey() return $this->key; } - /** - - * @return null|string - */ - public function getTypeId() - { - return $this->typeId; - } - /** * @param ?string $key * @return $this @@ -61,23 +48,11 @@ public function withKey(?string $key) return $this; } - /** - * @param ?string $typeId - * @return $this - */ - public function withTypeId(?string $typeId) - { - $this->typeId = $typeId; - - return $this; - } - public function build(): KeyReference { return new KeyReferenceModel( - $this->key, - $this->typeId + $this->key ); } diff --git a/lib/commercetools-history/src/Models/Common/KeyReferenceCollection.php b/lib/commercetools-history/src/Models/Common/KeyReferenceCollection.php index a826083ccd1..e28e03e29e1 100644 --- a/lib/commercetools-history/src/Models/Common/KeyReferenceCollection.php +++ b/lib/commercetools-history/src/Models/Common/KeyReferenceCollection.php @@ -13,7 +13,11 @@ use stdClass; /** - * @extends MapperSequence