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 'recalculate' => CartRecalculateActionModel::class,
55 'removeCustomLineItem' => CartRemoveCustomLineItemActionModel::class,
56 'removeDiscountCode' => CartRemoveDiscountCodeActionModel::class,
57 'removeItemShippingAddress' => CartRemoveItemShippingAddressActionModel::class,
58 'removeLineItem' => CartRemoveLineItemActionModel::class,
59 'removePayment' => CartRemovePaymentActionModel::class,
60 'removeShippingMethod' => CartRemoveShippingMethodActionModel::class,
61 'setAnonymousId' => CartSetAnonymousIdActionModel::class,
62 'setBillingAddress' => CartSetBillingAddressActionModel::class,
63 'setBillingAddressCustomField' => CartSetBillingAddressCustomFieldActionModel::class,
64 'setBillingAddressCustomType' => CartSetBillingAddressCustomTypeActionModel::class,
65 'setBusinessUnit' => CartSetBusinessUnitActionModel::class,
66 'setCartTotalTax' => CartSetCartTotalTaxActionModel::class,
67 'setCountry' => CartSetCountryActionModel::class,
68 'setCustomField' => CartSetCustomFieldActionModel::class,
69 'setCustomLineItemCustomField' => CartSetCustomLineItemCustomFieldActionModel::class,
70 'setCustomLineItemCustomType' => CartSetCustomLineItemCustomTypeActionModel::class,
71 'setCustomLineItemRecurrenceInfo' => CartSetCustomLineItemRecurrenceInfoActionModel::class,
72 'setCustomLineItemShippingDetails' => CartSetCustomLineItemShippingDetailsActionModel::class,
73 'setCustomLineItemTaxAmount' => CartSetCustomLineItemTaxAmountActionModel::class,
74 'setCustomLineItemTaxRate' => CartSetCustomLineItemTaxRateActionModel::class,
75 'setCustomShippingMethod' => CartSetCustomShippingMethodActionModel::class,
76 'setCustomType' => CartSetCustomTypeActionModel::class,
77 'setCustomerEmail' => CartSetCustomerEmailActionModel::class,
78 'setCustomerGroup' => CartSetCustomerGroupActionModel::class,
79 'setCustomerId' => CartSetCustomerIdActionModel::class,
80 'setDeleteDaysAfterLastModification' => CartSetDeleteDaysAfterLastModificationActionModel::class,
81 'setDirectDiscounts' => CartSetDirectDiscountsActionModel::class,
82 'setItemShippingAddressCustomField' => CartSetItemShippingAddressCustomFieldActionModel::class,
83 'setItemShippingAddressCustomType' => CartSetItemShippingAddressCustomTypeActionModel::class,
84 'setKey' => CartSetKeyActionModel::class,
85 'setLineItemCustomField' => CartSetLineItemCustomFieldActionModel::class,
86 'setLineItemCustomType' => CartSetLineItemCustomTypeActionModel::class,
87 'setLineItemDistributionChannel' => CartSetLineItemDistributionChannelActionModel::class,
88 'setLineItemInventoryMode' => CartSetLineItemInventoryModeActionModel::class,
89 'setLineItemPrice' => CartSetLineItemPriceActionModel::class,
90 'setLineItemRecurrenceInfo' => CartSetLineItemRecurrenceInfoActionModel::class,
91 'setLineItemShippingDetails' => CartSetLineItemShippingDetailsActionModel::class,
92 'setLineItemSupplyChannel' => CartSetLineItemSupplyChannelActionModel::class,
93 'setLineItemTaxAmount' => CartSetLineItemTaxAmountActionModel::class,
94 'setLineItemTaxRate' => CartSetLineItemTaxRateActionModel::class,
95 'setLineItemTotalPrice' => CartSetLineItemTotalPriceActionModel::class,
96 'setLocale' => CartSetLocaleActionModel::class,
97 'setShippingAddress' => CartSetShippingAddressActionModel::class,
98 'setShippingAddressCustomField' => CartSetShippingAddressCustomFieldActionModel::class,
99 'setShippingAddressCustomType' => CartSetShippingAddressCustomTypeActionModel::class,
100 'setShippingCustomField' => CartSetShippingCustomFieldActionModel::class,
101 'setShippingCustomType' => CartSetShippingCustomTypeActionModel::class,
102 'setShippingMethod' => CartSetShippingMethodActionModel::class,
103 'setShippingMethodTaxAmount' => CartSetShippingMethodTaxAmountActionModel::class,
104 'setShippingMethodTaxRate' => CartSetShippingMethodTaxRateActionModel::class,
105 'setShippingRateInput' => CartSetShippingRateInputActionModel::class,
106 'unfreezeCart' => CartUnfreezeCartActionModel::class,
107 'updateItemShippingAddress' => CartUpdateItemShippingAddressActionModel::class,
108 ];
109
113 public function __construct(
114 ?string $action = null
115 ) {
116 $this->action = $action;
117 }
118
123 public function getAction()
124 {
125 if (is_null($this->action)) {
127 $data = $this->raw(self::FIELD_ACTION);
128 if (is_null($data)) {
129 return null;
130 }
131 $this->action = (string) $data;
132 }
133
134 return $this->action;
135 }
136
137
138
139
140
145 public static function resolveDiscriminatorClass($value): string
146 {
148 if (is_object($value) && isset($value->$fieldName)) {
150 $discriminatorValue = $value->$fieldName;
151 if (isset(self::$discriminatorClasses[$discriminatorValue])) {
152 return self::$discriminatorClasses[$discriminatorValue];
153 }
154 }
155 if (is_array($value) && isset($value[$fieldName])) {
157 $discriminatorValue = $value[$fieldName];
158 if (isset(self::$discriminatorClasses[$discriminatorValue])) {
159 return self::$discriminatorClasses[$discriminatorValue];
160 }
161 }
162
164 $type = CartUpdateActionModel::class;
165 return $type;
166 }
167}