commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
CartUpdateActionModel.php
1<?php
2
3declare(strict_types=1);
10
15use stdClass;
16
21{
22 public const DISCRIMINATOR_VALUE = '';
27 protected $action;
28
33 private static $discriminatorClasses = [
34 'addCustomLineItem' => CartAddCustomLineItemActionModel::class,
35 'addCustomShippingMethod' => CartAddCustomShippingMethodActionModel::class,
36 'addDiscountCode' => CartAddDiscountCodeActionModel::class,
37 'addItemShippingAddress' => CartAddItemShippingAddressActionModel::class,
38 'addLineItem' => CartAddLineItemActionModel::class,
39 'addPayment' => CartAddPaymentActionModel::class,
40 'addShippingMethod' => CartAddShippingMethodActionModel::class,
41 'addShoppingList' => CartAddShoppingListActionModel::class,
42 'applyDeltaToCustomLineItemShippingDetailsTargets' => CartApplyDeltaToCustomLineItemShippingDetailsTargetsActionModel::class,
43 'applyDeltaToLineItemShippingDetailsTargets' => CartApplyDeltaToLineItemShippingDetailsTargetsActionModel::class,
44 'changeCustomLineItemMoney' => CartChangeCustomLineItemMoneyActionModel::class,
45 'changeCustomLineItemPriceMode' => CartChangeCustomLineItemPriceModeActionModel::class,
46 'changeCustomLineItemQuantity' => CartChangeCustomLineItemQuantityActionModel::class,
47 'changeLineItemQuantity' => CartChangeLineItemQuantityActionModel::class,
48 'changeLineItemsOrder' => CartChangeLineItemsOrderActionModel::class,
49 'changePriceRoundingMode' => CartChangePriceRoundingModeActionModel::class,
50 'changeTaxCalculationMode' => CartChangeTaxCalculationModeActionModel::class,
51 'changeTaxMode' => CartChangeTaxModeActionModel::class,
52 'changeTaxRoundingMode' => CartChangeTaxRoundingModeActionModel::class,
53 'freezeCart' => CartFreezeCartActionModel::class,
54 'lockCart' => CartLockCartActionModel::class,
55 'recalculate' => CartRecalculateActionModel::class,
56 'removeCustomLineItem' => CartRemoveCustomLineItemActionModel::class,
57 'removeDiscountCode' => CartRemoveDiscountCodeActionModel::class,
58 'removeItemShippingAddress' => CartRemoveItemShippingAddressActionModel::class,
59 'removeLineItem' => CartRemoveLineItemActionModel::class,
60 'removePayment' => CartRemovePaymentActionModel::class,
61 'removeShippingMethod' => CartRemoveShippingMethodActionModel::class,
62 'setAnonymousId' => CartSetAnonymousIdActionModel::class,
63 'setBillingAddress' => CartSetBillingAddressActionModel::class,
64 'setBillingAddressCustomField' => CartSetBillingAddressCustomFieldActionModel::class,
65 'setBillingAddressCustomType' => CartSetBillingAddressCustomTypeActionModel::class,
66 'setBusinessUnit' => CartSetBusinessUnitActionModel::class,
67 'setCartTotalTax' => CartSetCartTotalTaxActionModel::class,
68 'setCountry' => CartSetCountryActionModel::class,
69 'setCustomField' => CartSetCustomFieldActionModel::class,
70 'setCustomLineItemCustomField' => CartSetCustomLineItemCustomFieldActionModel::class,
71 'setCustomLineItemCustomType' => CartSetCustomLineItemCustomTypeActionModel::class,
72 'setCustomLineItemRecurrenceInfo' => CartSetCustomLineItemRecurrenceInfoActionModel::class,
73 'setCustomLineItemShippingDetails' => CartSetCustomLineItemShippingDetailsActionModel::class,
74 'setCustomLineItemTaxAmount' => CartSetCustomLineItemTaxAmountActionModel::class,
75 'setCustomLineItemTaxRate' => CartSetCustomLineItemTaxRateActionModel::class,
76 'setCustomShippingMethod' => CartSetCustomShippingMethodActionModel::class,
77 'setCustomType' => CartSetCustomTypeActionModel::class,
78 'setCustomerEmail' => CartSetCustomerEmailActionModel::class,
79 'setCustomerGroup' => CartSetCustomerGroupActionModel::class,
80 'setCustomerId' => CartSetCustomerIdActionModel::class,
81 'setDeleteDaysAfterLastModification' => CartSetDeleteDaysAfterLastModificationActionModel::class,
82 'setDirectDiscounts' => CartSetDirectDiscountsActionModel::class,
83 'setItemShippingAddressCustomField' => CartSetItemShippingAddressCustomFieldActionModel::class,
84 'setItemShippingAddressCustomType' => CartSetItemShippingAddressCustomTypeActionModel::class,
85 'setKey' => CartSetKeyActionModel::class,
86 'setLineItemCustomField' => CartSetLineItemCustomFieldActionModel::class,
87 'setLineItemCustomType' => CartSetLineItemCustomTypeActionModel::class,
88 'setLineItemDistributionChannel' => CartSetLineItemDistributionChannelActionModel::class,
89 'setLineItemInventoryMode' => CartSetLineItemInventoryModeActionModel::class,
90 'setLineItemPrice' => CartSetLineItemPriceActionModel::class,
91 'setLineItemRecurrenceInfo' => CartSetLineItemRecurrenceInfoActionModel::class,
92 'setLineItemShippingDetails' => CartSetLineItemShippingDetailsActionModel::class,
93 'setLineItemSupplyChannel' => CartSetLineItemSupplyChannelActionModel::class,
94 'setLineItemTaxAmount' => CartSetLineItemTaxAmountActionModel::class,
95 'setLineItemTaxRate' => CartSetLineItemTaxRateActionModel::class,
96 'setLineItemTotalPrice' => CartSetLineItemTotalPriceActionModel::class,
97 'setLocale' => CartSetLocaleActionModel::class,
98 'setPurchaseOrderNumber' => CartSetPurchaseOrderNumberActionModel::class,
99 'setShippingAddress' => CartSetShippingAddressActionModel::class,
100 'setShippingAddressCustomField' => CartSetShippingAddressCustomFieldActionModel::class,
101 'setShippingAddressCustomType' => CartSetShippingAddressCustomTypeActionModel::class,
102 'setShippingCustomField' => CartSetShippingCustomFieldActionModel::class,
103 'setShippingCustomType' => CartSetShippingCustomTypeActionModel::class,
104 'setShippingMethod' => CartSetShippingMethodActionModel::class,
105 'setShippingMethodTaxAmount' => CartSetShippingMethodTaxAmountActionModel::class,
106 'setShippingMethodTaxRate' => CartSetShippingMethodTaxRateActionModel::class,
107 'setShippingRateInput' => CartSetShippingRateInputActionModel::class,
108 'unfreezeCart' => CartUnfreezeCartActionModel::class,
109 'unlockCart' => CartUnlockCartActionModel::class,
110 'updateItemShippingAddress' => CartUpdateItemShippingAddressActionModel::class,
111 ];
112
116 public function __construct(
117 ?string $action = null
118 ) {
119 $this->action = $action;
120 }
121
126 public function getAction()
127 {
128 if (is_null($this->action)) {
130 $data = $this->raw(self::FIELD_ACTION);
131 if (is_null($data)) {
132 return null;
133 }
134 $this->action = (string) $data;
135 }
136
137 return $this->action;
138 }
139
140
141
142
143
148 public static function resolveDiscriminatorClass($value): string
149 {
151 if (is_object($value) && isset($value->$fieldName)) {
153 $discriminatorValue = $value->$fieldName;
154 if (isset(self::$discriminatorClasses[$discriminatorValue])) {
155 return self::$discriminatorClasses[$discriminatorValue];
156 }
157 }
158 if (is_array($value) && isset($value[$fieldName])) {
160 $discriminatorValue = $value[$fieldName];
161 if (isset(self::$discriminatorClasses[$discriminatorValue])) {
162 return self::$discriminatorClasses[$discriminatorValue];
163 }
164 }
165
167 $type = CartUpdateActionModel::class;
168 return $type;
169 }
170}