commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
OrderUpdateActionModel.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 'addDelivery' => OrderAddDeliveryActionModel::class,
35 'addItemShippingAddress' => OrderAddItemShippingAddressActionModel::class,
36 'addParcelToDelivery' => OrderAddParcelToDeliveryActionModel::class,
37 'addPayment' => OrderAddPaymentActionModel::class,
38 'addReturnInfo' => OrderAddReturnInfoActionModel::class,
39 'changeOrderState' => OrderChangeOrderStateActionModel::class,
40 'changePaymentState' => OrderChangePaymentStateActionModel::class,
41 'changeShipmentState' => OrderChangeShipmentStateActionModel::class,
42 'importCustomLineItemState' => OrderImportCustomLineItemStateActionModel::class,
43 'importLineItemState' => OrderImportLineItemStateActionModel::class,
44 'removeDelivery' => OrderRemoveDeliveryActionModel::class,
45 'removeItemShippingAddress' => OrderRemoveItemShippingAddressActionModel::class,
46 'removeParcelFromDelivery' => OrderRemoveParcelFromDeliveryActionModel::class,
47 'removePayment' => OrderRemovePaymentActionModel::class,
48 'setBillingAddress' => OrderSetBillingAddressActionModel::class,
49 'setBillingAddressCustomField' => OrderSetBillingAddressCustomFieldActionModel::class,
50 'setBillingAddressCustomType' => OrderSetBillingAddressCustomTypeActionModel::class,
51 'setCustomField' => OrderSetCustomFieldActionModel::class,
52 'setCustomLineItemCustomField' => OrderSetCustomLineItemCustomFieldActionModel::class,
53 'setCustomLineItemCustomType' => OrderSetCustomLineItemCustomTypeActionModel::class,
54 'setCustomLineItemShippingDetails' => OrderSetCustomLineItemShippingDetailsActionModel::class,
55 'setCustomType' => OrderSetCustomTypeActionModel::class,
56 'setCustomerEmail' => OrderSetCustomerEmailActionModel::class,
57 'setCustomerId' => OrderSetCustomerIdActionModel::class,
58 'setDeliveryAddress' => OrderSetDeliveryAddressActionModel::class,
59 'setDeliveryAddressCustomField' => OrderSetDeliveryAddressCustomFieldActionModel::class,
60 'setDeliveryAddressCustomType' => OrderSetDeliveryAddressCustomTypeActionModel::class,
61 'setDeliveryCustomField' => OrderSetDeliveryCustomFieldActionModel::class,
62 'setDeliveryCustomType' => OrderSetDeliveryCustomTypeActionModel::class,
63 'setDeliveryItems' => OrderSetDeliveryItemsActionModel::class,
64 'setItemShippingAddressCustomField' => OrderSetItemShippingAddressCustomFieldActionModel::class,
65 'setItemShippingAddressCustomType' => OrderSetItemShippingAddressCustomTypeActionModel::class,
66 'setLineItemCustomField' => OrderSetLineItemCustomFieldActionModel::class,
67 'setLineItemCustomType' => OrderSetLineItemCustomTypeActionModel::class,
68 'setLineItemShippingDetails' => OrderSetLineItemShippingDetailsActionModel::class,
69 'setLocale' => OrderSetLocaleActionModel::class,
70 'setOrderNumber' => OrderSetOrderNumberActionModel::class,
71 'setParcelCustomField' => OrderSetParcelCustomFieldActionModel::class,
72 'setParcelCustomType' => OrderSetParcelCustomTypeActionModel::class,
73 'setParcelItems' => OrderSetParcelItemsActionModel::class,
74 'setParcelMeasurements' => OrderSetParcelMeasurementsActionModel::class,
75 'setParcelTrackingData' => OrderSetParcelTrackingDataActionModel::class,
76 'setPurchaseOrderNumber' => OrderSetPurchaseOrderNumberActionModel::class,
77 'setReturnInfo' => OrderSetReturnInfoActionModel::class,
78 'setReturnItemCustomField' => OrderSetReturnItemCustomFieldActionModel::class,
79 'setReturnItemCustomType' => OrderSetReturnItemCustomTypeActionModel::class,
80 'setReturnPaymentState' => OrderSetReturnPaymentStateActionModel::class,
81 'setReturnShipmentState' => OrderSetReturnShipmentStateActionModel::class,
82 'setShippingAddress' => OrderSetShippingAddressActionModel::class,
83 'setShippingAddressCustomField' => OrderSetShippingAddressCustomFieldActionModel::class,
84 'setShippingAddressCustomType' => OrderSetShippingAddressCustomTypeActionModel::class,
85 'setShippingCustomField' => OrderSetShippingCustomFieldActionModel::class,
86 'setShippingCustomType' => OrderSetShippingCustomTypeActionModel::class,
87 'setStore' => OrderSetStoreActionModel::class,
88 'transitionCustomLineItemState' => OrderTransitionCustomLineItemStateActionModel::class,
89 'transitionLineItemState' => OrderTransitionLineItemStateActionModel::class,
90 'transitionState' => OrderTransitionStateActionModel::class,
91 'updateItemShippingAddress' => OrderUpdateItemShippingAddressActionModel::class,
92 'updateSyncInfo' => OrderUpdateSyncInfoActionModel::class,
93 ];
94
98 public function __construct(
99 ?string $action = null
100 ) {
101 $this->action = $action;
102 }
103
108 public function getAction()
109 {
110 if (is_null($this->action)) {
112 $data = $this->raw(self::FIELD_ACTION);
113 if (is_null($data)) {
114 return null;
115 }
116 $this->action = (string) $data;
117 }
118
119 return $this->action;
120 }
121
122
123
124
125
130 public static function resolveDiscriminatorClass($value): string
131 {
133 if (is_object($value) && isset($value->$fieldName)) {
135 $discriminatorValue = $value->$fieldName;
136 if (isset(self::$discriminatorClasses[$discriminatorValue])) {
137 return self::$discriminatorClasses[$discriminatorValue];
138 }
139 }
140 if (is_array($value) && isset($value[$fieldName])) {
142 $discriminatorValue = $value[$fieldName];
143 if (isset(self::$discriminatorClasses[$discriminatorValue])) {
144 return self::$discriminatorClasses[$discriminatorValue];
145 }
146 }
147
149 $type = OrderUpdateActionModel::class;
150 return $type;
151 }
152}