1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Starweb\Api\Generated\Normalizer; |
4
|
|
|
|
5
|
|
|
use Jane\JsonSchemaRuntime\Reference; |
6
|
|
|
use Symfony\Component\Serializer\Exception\InvalidArgumentException; |
7
|
|
|
use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; |
8
|
|
|
use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; |
9
|
|
|
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; |
10
|
|
|
use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; |
11
|
|
|
use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; |
12
|
|
|
use Symfony\Component\Serializer\Normalizer\NormalizerInterface; |
13
|
|
|
class OrderModelNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface |
14
|
|
|
{ |
15
|
|
|
use DenormalizerAwareTrait; |
16
|
|
|
use NormalizerAwareTrait; |
17
|
|
|
public function supportsDenormalization($data, $type, $format = null) |
18
|
|
|
{ |
19
|
|
|
return $type === 'Starweb\\Api\\Generated\\Model\\OrderModel'; |
20
|
|
|
} |
21
|
|
|
public function supportsNormalization($data, $format = null) |
22
|
|
|
{ |
23
|
|
|
return get_class($data) === 'Starweb\\Api\\Generated\\Model\\OrderModel'; |
24
|
|
|
} |
25
|
|
|
public function denormalize($data, $class, $format = null, array $context = array()) |
26
|
|
|
{ |
27
|
|
|
if (!is_object($data)) { |
28
|
|
|
throw new InvalidArgumentException(); |
29
|
|
|
} |
30
|
|
|
$object = new \Starweb\Api\Generated\Model\OrderModel(); |
31
|
|
|
if (property_exists($data, 'orderId')) { |
32
|
|
|
$object->setOrderId($data->{'orderId'}); |
33
|
|
|
} |
34
|
|
|
if (property_exists($data, 'modifiedAt')) { |
35
|
|
|
$object->setModifiedAt($data->{'modifiedAt'}); |
36
|
|
|
} |
37
|
|
|
if (property_exists($data, 'baseCurrencyCode')) { |
38
|
|
|
$object->setBaseCurrencyCode($data->{'baseCurrencyCode'}); |
39
|
|
|
} |
40
|
|
|
if (property_exists($data, 'shopCountryCode')) { |
41
|
|
|
$object->setShopCountryCode($data->{'shopCountryCode'}); |
42
|
|
|
} |
43
|
|
|
if (property_exists($data, 'totalAmount')) { |
44
|
|
|
$object->setTotalAmount($data->{'totalAmount'}); |
45
|
|
|
} |
46
|
|
|
if (property_exists($data, 'totalVat')) { |
47
|
|
|
$object->setTotalVat($data->{'totalVat'}); |
48
|
|
|
} |
49
|
|
|
if (property_exists($data, 'amountToPay')) { |
50
|
|
|
$object->setAmountToPay($data->{'amountToPay'}); |
51
|
|
|
} |
52
|
|
|
if (property_exists($data, 'totalAmountInBaseCurrency')) { |
53
|
|
|
$object->setTotalAmountInBaseCurrency($data->{'totalAmountInBaseCurrency'}); |
54
|
|
|
} |
55
|
|
|
if (property_exists($data, 'totalVatInBaseCurrency')) { |
56
|
|
|
$object->setTotalVatInBaseCurrency($data->{'totalVatInBaseCurrency'}); |
57
|
|
|
} |
58
|
|
|
if (property_exists($data, 'amountToPayInBaseCurrency')) { |
59
|
|
|
$object->setAmountToPayInBaseCurrency($data->{'amountToPayInBaseCurrency'}); |
60
|
|
|
} |
61
|
|
|
if (property_exists($data, 'createdAt')) { |
62
|
|
|
$object->setCreatedAt($data->{'createdAt'}); |
63
|
|
|
} |
64
|
|
|
if (property_exists($data, 'customerId')) { |
65
|
|
|
$object->setCustomerId($data->{'customerId'}); |
66
|
|
|
} |
67
|
|
|
if (property_exists($data, 'statusId')) { |
68
|
|
|
$object->setStatusId($data->{'statusId'}); |
69
|
|
|
} |
70
|
|
|
if (property_exists($data, 'onOrderStatusChangeSendEmail')) { |
71
|
|
|
$object->setOnOrderStatusChangeSendEmail($data->{'onOrderStatusChangeSendEmail'}); |
72
|
|
|
} |
73
|
|
|
if (property_exists($data, 'onOrderStatusChangeProcessPayment')) { |
74
|
|
|
$object->setOnOrderStatusChangeProcessPayment($data->{'onOrderStatusChangeProcessPayment'}); |
75
|
|
|
} |
76
|
|
|
if (property_exists($data, 'sendEmailsOnStatusChange')) { |
77
|
|
|
$object->setSendEmailsOnStatusChange($data->{'sendEmailsOnStatusChange'}); |
78
|
|
|
} |
79
|
|
|
if (property_exists($data, 'shippingMethodId')) { |
80
|
|
|
$object->setShippingMethodId($data->{'shippingMethodId'}); |
81
|
|
|
} |
82
|
|
|
if (property_exists($data, 'paymentMethodId')) { |
83
|
|
|
$object->setPaymentMethodId($data->{'paymentMethodId'}); |
84
|
|
|
} |
85
|
|
|
if (property_exists($data, 'paymentMethodIdCode')) { |
86
|
|
|
$object->setPaymentMethodIdCode($data->{'paymentMethodIdCode'}); |
87
|
|
|
} |
88
|
|
|
if (property_exists($data, 'paymentMethodName')) { |
89
|
|
|
$object->setPaymentMethodName($data->{'paymentMethodName'}); |
90
|
|
|
} |
91
|
|
|
if (property_exists($data, 'paymentFee')) { |
92
|
|
|
$object->setPaymentFee($data->{'paymentFee'}); |
93
|
|
|
} |
94
|
|
|
if (property_exists($data, 'paymentVatRate')) { |
95
|
|
|
$object->setPaymentVatRate($data->{'paymentVatRate'}); |
96
|
|
|
} |
97
|
|
|
if (property_exists($data, 'shippingMethodName')) { |
98
|
|
|
$object->setShippingMethodName($data->{'shippingMethodName'}); |
99
|
|
|
} |
100
|
|
|
if (property_exists($data, 'shippingCost')) { |
101
|
|
|
$object->setShippingCost($data->{'shippingCost'}); |
102
|
|
|
} |
103
|
|
|
if (property_exists($data, 'shippingVatRate')) { |
104
|
|
|
$object->setShippingVatRate($data->{'shippingVatRate'}); |
105
|
|
|
} |
106
|
|
|
if (property_exists($data, 'totalWeight')) { |
107
|
|
|
$object->setTotalWeight($data->{'totalWeight'}); |
108
|
|
|
} |
109
|
|
|
if (property_exists($data, 'customInfo1')) { |
110
|
|
|
$object->setCustomInfo1($data->{'customInfo1'}); |
111
|
|
|
} |
112
|
|
|
if (property_exists($data, 'customInfo2')) { |
113
|
|
|
$object->setCustomInfo2($data->{'customInfo2'}); |
114
|
|
|
} |
115
|
|
|
if (property_exists($data, 'customInfo3')) { |
116
|
|
|
$object->setCustomInfo3($data->{'customInfo3'}); |
117
|
|
|
} |
118
|
|
|
if (property_exists($data, 'customInfo4')) { |
119
|
|
|
$object->setCustomInfo4($data->{'customInfo4'}); |
120
|
|
|
} |
121
|
|
|
if (property_exists($data, 'discountCode')) { |
122
|
|
|
$object->setDiscountCode($data->{'discountCode'}); |
123
|
|
|
} |
124
|
|
|
if (property_exists($data, 'amountPaid')) { |
125
|
|
|
$object->setAmountPaid($data->{'amountPaid'}); |
126
|
|
|
} |
127
|
|
|
if (property_exists($data, 'amountPaidInBaseCurrency')) { |
128
|
|
|
$object->setAmountPaidInBaseCurrency($data->{'amountPaidInBaseCurrency'}); |
129
|
|
|
} |
130
|
|
|
if (property_exists($data, 'isComplete')) { |
131
|
|
|
$object->setIsComplete($data->{'isComplete'}); |
132
|
|
|
} |
133
|
|
|
if (property_exists($data, 'currencyCode')) { |
134
|
|
|
$object->setCurrencyCode($data->{'currencyCode'}); |
135
|
|
|
} |
136
|
|
|
if (property_exists($data, 'currencyExchangeRate')) { |
137
|
|
|
$object->setCurrencyExchangeRate($data->{'currencyExchangeRate'}); |
138
|
|
|
} |
139
|
|
|
if (property_exists($data, 'currencyPrecision')) { |
140
|
|
|
$object->setCurrencyPrecision($data->{'currencyPrecision'}); |
141
|
|
|
} |
142
|
|
|
if (property_exists($data, 'langCode')) { |
143
|
|
|
$object->setLangCode($data->{'langCode'}); |
144
|
|
|
} |
145
|
|
|
if (property_exists($data, 'paymentReference')) { |
146
|
|
|
$object->setPaymentReference($data->{'paymentReference'}); |
147
|
|
|
} |
148
|
|
|
if (property_exists($data, 'paymentStatus')) { |
149
|
|
|
$object->setPaymentStatus($data->{'paymentStatus'}); |
150
|
|
|
} |
151
|
|
|
if (property_exists($data, 'isRead')) { |
152
|
|
|
$object->setIsRead($data->{'isRead'}); |
153
|
|
|
} |
154
|
|
|
if (property_exists($data, 'hasComments')) { |
155
|
|
|
$object->setHasComments($data->{'hasComments'}); |
156
|
|
|
} |
157
|
|
|
if (property_exists($data, 'internalComment')) { |
158
|
|
|
$object->setInternalComment($data->{'internalComment'}); |
159
|
|
|
} |
160
|
|
|
if (property_exists($data, 'shippingTrackerType')) { |
161
|
|
|
$object->setShippingTrackerType($data->{'shippingTrackerType'}); |
162
|
|
|
} |
163
|
|
|
if (property_exists($data, 'shippingTrackingNo')) { |
164
|
|
|
$object->setShippingTrackingNo($data->{'shippingTrackingNo'}); |
165
|
|
|
} |
166
|
|
|
if (property_exists($data, 'originalCustomerEmail')) { |
167
|
|
|
$object->setOriginalCustomerEmail($data->{'originalCustomerEmail'}); |
168
|
|
|
} |
169
|
|
|
if (property_exists($data, 'originalCustomerNationalIdNo')) { |
170
|
|
|
$object->setOriginalCustomerNationalIdNo($data->{'originalCustomerNationalIdNo'}); |
171
|
|
|
} |
172
|
|
|
if (property_exists($data, 'originalCustomerVatNo')) { |
173
|
|
|
$object->setOriginalCustomerVatNo($data->{'originalCustomerVatNo'}); |
174
|
|
|
} |
175
|
|
|
if (property_exists($data, 'originalCustomerCustomInfo1')) { |
176
|
|
|
$object->setOriginalCustomerCustomInfo1($data->{'originalCustomerCustomInfo1'}); |
177
|
|
|
} |
178
|
|
|
if (property_exists($data, 'originalCustomerCustomInfo2')) { |
179
|
|
|
$object->setOriginalCustomerCustomInfo2($data->{'originalCustomerCustomInfo2'}); |
180
|
|
|
} |
181
|
|
|
if (property_exists($data, 'items')) { |
182
|
|
|
$object->setItems($this->denormalizer->denormalize($data->{'items'}, 'Starweb\\Api\\Generated\\Model\\OrderItemModelCollection', 'json', $context)); |
|
|
|
|
183
|
|
|
} |
184
|
|
|
if (property_exists($data, 'addresses')) { |
185
|
|
|
$object->setAddresses($this->denormalizer->denormalize($data->{'addresses'}, 'Starweb\\Api\\Generated\\Model\\OrderAddressCollection', 'json', $context)); |
|
|
|
|
186
|
|
|
} |
187
|
|
|
if (property_exists($data, 'externalServices')) { |
188
|
|
|
$object->setExternalServices($this->denormalizer->denormalize($data->{'externalServices'}, 'Starweb\\Api\\Generated\\Model\\OrderExternalServiceModelCollection', 'json', $context)); |
|
|
|
|
189
|
|
|
} |
190
|
|
|
if (property_exists($data, 'customer')) { |
191
|
|
|
$object->setCustomer($this->denormalizer->denormalize($data->{'customer'}, 'Starweb\\Api\\Generated\\Model\\CustomerModelItem', 'json', $context)); |
|
|
|
|
192
|
|
|
} |
193
|
|
|
if (property_exists($data, 'status')) { |
194
|
|
|
$object->setStatus($this->denormalizer->denormalize($data->{'status'}, 'Starweb\\Api\\Generated\\Model\\OrderStatusModelItem', 'json', $context)); |
|
|
|
|
195
|
|
|
} |
196
|
|
|
return $object; |
197
|
|
|
} |
198
|
|
|
public function normalize($object, $format = null, array $context = array()) |
199
|
|
|
{ |
200
|
|
|
$data = new \stdClass(); |
201
|
|
|
if (null !== $object->getOrderId()) { |
202
|
|
|
$data->{'orderId'} = $object->getOrderId(); |
203
|
|
|
} |
204
|
|
|
if (null !== $object->getModifiedAt()) { |
205
|
|
|
$data->{'modifiedAt'} = $object->getModifiedAt(); |
206
|
|
|
} |
207
|
|
|
if (null !== $object->getBaseCurrencyCode()) { |
208
|
|
|
$data->{'baseCurrencyCode'} = $object->getBaseCurrencyCode(); |
209
|
|
|
} |
210
|
|
|
if (null !== $object->getShopCountryCode()) { |
211
|
|
|
$data->{'shopCountryCode'} = $object->getShopCountryCode(); |
212
|
|
|
} |
213
|
|
|
if (null !== $object->getTotalAmount()) { |
214
|
|
|
$data->{'totalAmount'} = $object->getTotalAmount(); |
215
|
|
|
} |
216
|
|
|
if (null !== $object->getTotalVat()) { |
217
|
|
|
$data->{'totalVat'} = $object->getTotalVat(); |
218
|
|
|
} |
219
|
|
|
if (null !== $object->getAmountToPay()) { |
220
|
|
|
$data->{'amountToPay'} = $object->getAmountToPay(); |
221
|
|
|
} |
222
|
|
|
if (null !== $object->getTotalAmountInBaseCurrency()) { |
223
|
|
|
$data->{'totalAmountInBaseCurrency'} = $object->getTotalAmountInBaseCurrency(); |
224
|
|
|
} |
225
|
|
|
if (null !== $object->getTotalVatInBaseCurrency()) { |
226
|
|
|
$data->{'totalVatInBaseCurrency'} = $object->getTotalVatInBaseCurrency(); |
227
|
|
|
} |
228
|
|
|
if (null !== $object->getAmountToPayInBaseCurrency()) { |
229
|
|
|
$data->{'amountToPayInBaseCurrency'} = $object->getAmountToPayInBaseCurrency(); |
230
|
|
|
} |
231
|
|
|
if (null !== $object->getCreatedAt()) { |
232
|
|
|
$data->{'createdAt'} = $object->getCreatedAt(); |
233
|
|
|
} |
234
|
|
|
if (null !== $object->getCustomerId()) { |
235
|
|
|
$data->{'customerId'} = $object->getCustomerId(); |
236
|
|
|
} |
237
|
|
|
if (null !== $object->getStatusId()) { |
238
|
|
|
$data->{'statusId'} = $object->getStatusId(); |
239
|
|
|
} |
240
|
|
|
if (null !== $object->getOnOrderStatusChangeSendEmail()) { |
241
|
|
|
$data->{'onOrderStatusChangeSendEmail'} = $object->getOnOrderStatusChangeSendEmail(); |
242
|
|
|
} |
243
|
|
|
if (null !== $object->getOnOrderStatusChangeProcessPayment()) { |
244
|
|
|
$data->{'onOrderStatusChangeProcessPayment'} = $object->getOnOrderStatusChangeProcessPayment(); |
245
|
|
|
} |
246
|
|
|
if (null !== $object->getSendEmailsOnStatusChange()) { |
247
|
|
|
$data->{'sendEmailsOnStatusChange'} = $object->getSendEmailsOnStatusChange(); |
248
|
|
|
} |
249
|
|
|
if (null !== $object->getShippingMethodId()) { |
250
|
|
|
$data->{'shippingMethodId'} = $object->getShippingMethodId(); |
251
|
|
|
} |
252
|
|
|
if (null !== $object->getPaymentMethodId()) { |
253
|
|
|
$data->{'paymentMethodId'} = $object->getPaymentMethodId(); |
254
|
|
|
} |
255
|
|
|
if (null !== $object->getPaymentMethodIdCode()) { |
256
|
|
|
$data->{'paymentMethodIdCode'} = $object->getPaymentMethodIdCode(); |
257
|
|
|
} |
258
|
|
|
if (null !== $object->getPaymentMethodName()) { |
259
|
|
|
$data->{'paymentMethodName'} = $object->getPaymentMethodName(); |
260
|
|
|
} |
261
|
|
|
if (null !== $object->getPaymentFee()) { |
262
|
|
|
$data->{'paymentFee'} = $object->getPaymentFee(); |
263
|
|
|
} |
264
|
|
|
if (null !== $object->getPaymentVatRate()) { |
265
|
|
|
$data->{'paymentVatRate'} = $object->getPaymentVatRate(); |
266
|
|
|
} |
267
|
|
|
if (null !== $object->getShippingMethodName()) { |
268
|
|
|
$data->{'shippingMethodName'} = $object->getShippingMethodName(); |
269
|
|
|
} |
270
|
|
|
if (null !== $object->getShippingCost()) { |
271
|
|
|
$data->{'shippingCost'} = $object->getShippingCost(); |
272
|
|
|
} |
273
|
|
|
if (null !== $object->getShippingVatRate()) { |
274
|
|
|
$data->{'shippingVatRate'} = $object->getShippingVatRate(); |
275
|
|
|
} |
276
|
|
|
if (null !== $object->getTotalWeight()) { |
277
|
|
|
$data->{'totalWeight'} = $object->getTotalWeight(); |
278
|
|
|
} |
279
|
|
|
if (null !== $object->getCustomInfo1()) { |
280
|
|
|
$data->{'customInfo1'} = $object->getCustomInfo1(); |
281
|
|
|
} |
282
|
|
|
if (null !== $object->getCustomInfo2()) { |
283
|
|
|
$data->{'customInfo2'} = $object->getCustomInfo2(); |
284
|
|
|
} |
285
|
|
|
if (null !== $object->getCustomInfo3()) { |
286
|
|
|
$data->{'customInfo3'} = $object->getCustomInfo3(); |
287
|
|
|
} |
288
|
|
|
if (null !== $object->getCustomInfo4()) { |
289
|
|
|
$data->{'customInfo4'} = $object->getCustomInfo4(); |
290
|
|
|
} |
291
|
|
|
if (null !== $object->getDiscountCode()) { |
292
|
|
|
$data->{'discountCode'} = $object->getDiscountCode(); |
293
|
|
|
} |
294
|
|
|
if (null !== $object->getAmountPaid()) { |
295
|
|
|
$data->{'amountPaid'} = $object->getAmountPaid(); |
296
|
|
|
} |
297
|
|
|
if (null !== $object->getAmountPaidInBaseCurrency()) { |
298
|
|
|
$data->{'amountPaidInBaseCurrency'} = $object->getAmountPaidInBaseCurrency(); |
299
|
|
|
} |
300
|
|
|
if (null !== $object->getIsComplete()) { |
301
|
|
|
$data->{'isComplete'} = $object->getIsComplete(); |
302
|
|
|
} |
303
|
|
|
if (null !== $object->getCurrencyCode()) { |
304
|
|
|
$data->{'currencyCode'} = $object->getCurrencyCode(); |
305
|
|
|
} |
306
|
|
|
if (null !== $object->getCurrencyExchangeRate()) { |
307
|
|
|
$data->{'currencyExchangeRate'} = $object->getCurrencyExchangeRate(); |
308
|
|
|
} |
309
|
|
|
if (null !== $object->getCurrencyPrecision()) { |
310
|
|
|
$data->{'currencyPrecision'} = $object->getCurrencyPrecision(); |
311
|
|
|
} |
312
|
|
|
if (null !== $object->getLangCode()) { |
313
|
|
|
$data->{'langCode'} = $object->getLangCode(); |
314
|
|
|
} |
315
|
|
|
if (null !== $object->getPaymentReference()) { |
316
|
|
|
$data->{'paymentReference'} = $object->getPaymentReference(); |
317
|
|
|
} |
318
|
|
|
if (null !== $object->getPaymentStatus()) { |
319
|
|
|
$data->{'paymentStatus'} = $object->getPaymentStatus(); |
320
|
|
|
} |
321
|
|
|
if (null !== $object->getIsRead()) { |
322
|
|
|
$data->{'isRead'} = $object->getIsRead(); |
323
|
|
|
} |
324
|
|
|
if (null !== $object->getHasComments()) { |
325
|
|
|
$data->{'hasComments'} = $object->getHasComments(); |
326
|
|
|
} |
327
|
|
|
if (null !== $object->getInternalComment()) { |
328
|
|
|
$data->{'internalComment'} = $object->getInternalComment(); |
329
|
|
|
} |
330
|
|
|
if (null !== $object->getShippingTrackerType()) { |
331
|
|
|
$data->{'shippingTrackerType'} = $object->getShippingTrackerType(); |
332
|
|
|
} |
333
|
|
|
if (null !== $object->getShippingTrackingNo()) { |
334
|
|
|
$data->{'shippingTrackingNo'} = $object->getShippingTrackingNo(); |
335
|
|
|
} |
336
|
|
|
if (null !== $object->getOriginalCustomerEmail()) { |
337
|
|
|
$data->{'originalCustomerEmail'} = $object->getOriginalCustomerEmail(); |
338
|
|
|
} |
339
|
|
|
if (null !== $object->getOriginalCustomerNationalIdNo()) { |
340
|
|
|
$data->{'originalCustomerNationalIdNo'} = $object->getOriginalCustomerNationalIdNo(); |
341
|
|
|
} |
342
|
|
|
if (null !== $object->getOriginalCustomerVatNo()) { |
343
|
|
|
$data->{'originalCustomerVatNo'} = $object->getOriginalCustomerVatNo(); |
344
|
|
|
} |
345
|
|
|
if (null !== $object->getOriginalCustomerCustomInfo1()) { |
346
|
|
|
$data->{'originalCustomerCustomInfo1'} = $object->getOriginalCustomerCustomInfo1(); |
347
|
|
|
} |
348
|
|
|
if (null !== $object->getOriginalCustomerCustomInfo2()) { |
349
|
|
|
$data->{'originalCustomerCustomInfo2'} = $object->getOriginalCustomerCustomInfo2(); |
350
|
|
|
} |
351
|
|
|
if (null !== $object->getItems()) { |
352
|
|
|
$data->{'items'} = $this->normalizer->normalize($object->getItems(), 'json', $context); |
353
|
|
|
} |
354
|
|
|
if (null !== $object->getAddresses()) { |
355
|
|
|
$data->{'addresses'} = $this->normalizer->normalize($object->getAddresses(), 'json', $context); |
356
|
|
|
} |
357
|
|
|
if (null !== $object->getExternalServices()) { |
358
|
|
|
$data->{'externalServices'} = $this->normalizer->normalize($object->getExternalServices(), 'json', $context); |
359
|
|
|
} |
360
|
|
|
if (null !== $object->getCustomer()) { |
361
|
|
|
$data->{'customer'} = $this->normalizer->normalize($object->getCustomer(), 'json', $context); |
362
|
|
|
} |
363
|
|
|
if (null !== $object->getStatus()) { |
364
|
|
|
$data->{'status'} = $this->normalizer->normalize($object->getStatus(), 'json', $context); |
365
|
|
|
} |
366
|
|
|
return $data; |
367
|
|
|
} |
368
|
|
|
} |