commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
OrderModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
56 use DateTimeImmutable;
57 use stdClass;
58 
62 final class OrderModel extends JsonObjectModel implements Order
63 {
68  protected $id;
69 
74  protected $version;
75 
80  protected $createdAt;
81 
86  protected $lastModifiedAt;
87 
92  protected $orderNumber;
93 
99 
104  protected $customerId;
105 
110  protected $customerEmail;
111 
116  protected $customerGroup;
117 
122  protected $anonymousId;
123 
128  protected $businessUnit;
129 
134  protected $store;
135 
140  protected $lineItems;
141 
146  protected $customLineItems;
147 
152  protected $totalPrice;
153 
158  protected $taxedPrice;
159 
165 
171 
176  protected $taxMode;
177 
182  protected $taxRoundingMode;
183 
189 
194  protected $inventoryMode;
195 
200  protected $billingAddress;
201 
206  protected $shippingAddress;
207 
212  protected $shippingMode;
213 
218  protected $shippingKey;
219 
224  protected $shippingInfo;
225 
231 
237 
242  protected $shipping;
243 
249 
254  protected $discountCodes;
255 
260  protected $directDiscounts;
261 
266  protected $refusedGifts;
267 
272  protected $paymentInfo;
273 
278  protected $country;
279 
284  protected $locale;
285 
290  protected $origin;
291 
296  protected $cart;
297 
302  protected $quote;
303 
308  protected $orderState;
309 
314  protected $shipmentState;
315 
320  protected $paymentState;
321 
326  protected $state;
327 
332  protected $syncInfo;
333 
338  protected $returnInfo;
339 
345 
350  protected $custom;
351 
356  protected $completedAt;
357 
362  protected $lastModifiedBy;
363 
368  protected $createdBy;
369 
370 
374  public function __construct(
375  ?string $id = null,
376  ?int $version = null,
377  ?DateTimeImmutable $createdAt = null,
378  ?DateTimeImmutable $lastModifiedAt = null,
379  ?string $orderNumber = null,
380  ?string $purchaseOrderNumber = null,
381  ?string $customerId = null,
382  ?string $customerEmail = null,
384  ?string $anonymousId = null,
386  ?StoreKeyReference $store = null,
389  ?TypedMoney $totalPrice = null,
390  ?TaxedPrice $taxedPrice = null,
393  ?string $taxMode = null,
394  ?string $taxRoundingMode = null,
395  ?string $taxCalculationMode = null,
396  ?string $inventoryMode = null,
397  ?Address $billingAddress = null,
398  ?Address $shippingAddress = null,
399  ?string $shippingMode = null,
400  ?string $shippingKey = null,
401  ?ShippingInfo $shippingInfo = null,
409  ?PaymentInfo $paymentInfo = null,
410  ?string $country = null,
411  ?string $locale = null,
412  ?string $origin = null,
413  ?CartReference $cart = null,
414  ?QuoteReference $quote = null,
415  ?string $orderState = null,
416  ?string $shipmentState = null,
417  ?string $paymentState = null,
418  ?StateReference $state = null,
421  ?int $lastMessageSequenceNumber = null,
422  ?CustomFields $custom = null,
423  ?DateTimeImmutable $completedAt = null,
425  ?CreatedBy $createdBy = null
426  ) {
427  $this->id = $id;
428  $this->version = $version;
429  $this->createdAt = $createdAt;
430  $this->lastModifiedAt = $lastModifiedAt;
431  $this->orderNumber = $orderNumber;
432  $this->purchaseOrderNumber = $purchaseOrderNumber;
433  $this->customerId = $customerId;
434  $this->customerEmail = $customerEmail;
435  $this->customerGroup = $customerGroup;
436  $this->anonymousId = $anonymousId;
437  $this->businessUnit = $businessUnit;
438  $this->store = $store;
439  $this->lineItems = $lineItems;
440  $this->customLineItems = $customLineItems;
441  $this->totalPrice = $totalPrice;
442  $this->taxedPrice = $taxedPrice;
443  $this->taxedShippingPrice = $taxedShippingPrice;
444  $this->discountOnTotalPrice = $discountOnTotalPrice;
445  $this->taxMode = $taxMode;
446  $this->taxRoundingMode = $taxRoundingMode;
447  $this->taxCalculationMode = $taxCalculationMode;
448  $this->inventoryMode = $inventoryMode;
449  $this->billingAddress = $billingAddress;
450  $this->shippingAddress = $shippingAddress;
451  $this->shippingMode = $shippingMode;
452  $this->shippingKey = $shippingKey;
453  $this->shippingInfo = $shippingInfo;
454  $this->shippingRateInput = $shippingRateInput;
455  $this->shippingCustomFields = $shippingCustomFields;
456  $this->shipping = $shipping;
457  $this->itemShippingAddresses = $itemShippingAddresses;
458  $this->discountCodes = $discountCodes;
459  $this->directDiscounts = $directDiscounts;
460  $this->refusedGifts = $refusedGifts;
461  $this->paymentInfo = $paymentInfo;
462  $this->country = $country;
463  $this->locale = $locale;
464  $this->origin = $origin;
465  $this->cart = $cart;
466  $this->quote = $quote;
467  $this->orderState = $orderState;
468  $this->shipmentState = $shipmentState;
469  $this->paymentState = $paymentState;
470  $this->state = $state;
471  $this->syncInfo = $syncInfo;
472  $this->returnInfo = $returnInfo;
473  $this->lastMessageSequenceNumber = $lastMessageSequenceNumber;
474  $this->custom = $custom;
475  $this->completedAt = $completedAt;
476  $this->lastModifiedBy = $lastModifiedBy;
477  $this->createdBy = $createdBy;
478  }
479 
486  public function getId()
487  {
488  if (is_null($this->id)) {
490  $data = $this->raw(self::FIELD_ID);
491  if (is_null($data)) {
492  return null;
493  }
494  $this->id = (string) $data;
495  }
496 
497  return $this->id;
498  }
499 
506  public function getVersion()
507  {
508  if (is_null($this->version)) {
510  $data = $this->raw(self::FIELD_VERSION);
511  if (is_null($data)) {
512  return null;
513  }
514  $this->version = (int) $data;
515  }
516 
517  return $this->version;
518  }
519 
526  public function getCreatedAt()
527  {
528  if (is_null($this->createdAt)) {
530  $data = $this->raw(self::FIELD_CREATED_AT);
531  if (is_null($data)) {
532  return null;
533  }
534  $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data);
535  if (false === $data) {
536  return null;
537  }
538  $this->createdAt = $data;
539  }
540 
541  return $this->createdAt;
542  }
543 
550  public function getLastModifiedAt()
551  {
552  if (is_null($this->lastModifiedAt)) {
554  $data = $this->raw(self::FIELD_LAST_MODIFIED_AT);
555  if (is_null($data)) {
556  return null;
557  }
558  $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data);
559  if (false === $data) {
560  return null;
561  }
562  $this->lastModifiedAt = $data;
563  }
564 
565  return $this->lastModifiedAt;
566  }
567 
574  public function getOrderNumber()
575  {
576  if (is_null($this->orderNumber)) {
578  $data = $this->raw(self::FIELD_ORDER_NUMBER);
579  if (is_null($data)) {
580  return null;
581  }
582  $this->orderNumber = (string) $data;
583  }
584 
585  return $this->orderNumber;
586  }
587 
595  public function getPurchaseOrderNumber()
596  {
597  if (is_null($this->purchaseOrderNumber)) {
599  $data = $this->raw(self::FIELD_PURCHASE_ORDER_NUMBER);
600  if (is_null($data)) {
601  return null;
602  }
603  $this->purchaseOrderNumber = (string) $data;
604  }
605 
607  }
608 
615  public function getCustomerId()
616  {
617  if (is_null($this->customerId)) {
619  $data = $this->raw(self::FIELD_CUSTOMER_ID);
620  if (is_null($data)) {
621  return null;
622  }
623  $this->customerId = (string) $data;
624  }
625 
626  return $this->customerId;
627  }
628 
635  public function getCustomerEmail()
636  {
637  if (is_null($this->customerEmail)) {
639  $data = $this->raw(self::FIELD_CUSTOMER_EMAIL);
640  if (is_null($data)) {
641  return null;
642  }
643  $this->customerEmail = (string) $data;
644  }
645 
646  return $this->customerEmail;
647  }
648 
656  public function getCustomerGroup()
657  {
658  if (is_null($this->customerGroup)) {
660  $data = $this->raw(self::FIELD_CUSTOMER_GROUP);
661  if (is_null($data)) {
662  return null;
663  }
664 
665  $this->customerGroup = CustomerGroupReferenceModel::of($data);
666  }
667 
668  return $this->customerGroup;
669  }
670 
677  public function getAnonymousId()
678  {
679  if (is_null($this->anonymousId)) {
681  $data = $this->raw(self::FIELD_ANONYMOUS_ID);
682  if (is_null($data)) {
683  return null;
684  }
685  $this->anonymousId = (string) $data;
686  }
687 
688  return $this->anonymousId;
689  }
690 
697  public function getBusinessUnit()
698  {
699  if (is_null($this->businessUnit)) {
701  $data = $this->raw(self::FIELD_BUSINESS_UNIT);
702  if (is_null($data)) {
703  return null;
704  }
705 
706  $this->businessUnit = BusinessUnitKeyReferenceModel::of($data);
707  }
708 
709  return $this->businessUnit;
710  }
711 
718  public function getStore()
719  {
720  if (is_null($this->store)) {
722  $data = $this->raw(self::FIELD_STORE);
723  if (is_null($data)) {
724  return null;
725  }
726 
727  $this->store = StoreKeyReferenceModel::of($data);
728  }
729 
730  return $this->store;
731  }
732 
739  public function getLineItems()
740  {
741  if (is_null($this->lineItems)) {
743  $data = $this->raw(self::FIELD_LINE_ITEMS);
744  if (is_null($data)) {
745  return null;
746  }
747  $this->lineItems = LineItemCollection::fromArray($data);
748  }
749 
750  return $this->lineItems;
751  }
752 
759  public function getCustomLineItems()
760  {
761  if (is_null($this->customLineItems)) {
763  $data = $this->raw(self::FIELD_CUSTOM_LINE_ITEMS);
764  if (is_null($data)) {
765  return null;
766  }
767  $this->customLineItems = CustomLineItemCollection::fromArray($data);
768  }
769 
770  return $this->customLineItems;
771  }
772 
781  public function getTotalPrice()
782  {
783  if (is_null($this->totalPrice)) {
785  $data = $this->raw(self::FIELD_TOTAL_PRICE);
786  if (is_null($data)) {
787  return null;
788  }
789  $className = TypedMoneyModel::resolveDiscriminatorClass($data);
790  $this->totalPrice = $className::of($data);
791  }
792 
793  return $this->totalPrice;
794  }
795 
806  public function getTaxedPrice()
807  {
808  if (is_null($this->taxedPrice)) {
810  $data = $this->raw(self::FIELD_TAXED_PRICE);
811  if (is_null($data)) {
812  return null;
813  }
814 
815  $this->taxedPrice = TaxedPriceModel::of($data);
816  }
817 
818  return $this->taxedPrice;
819  }
820 
827  public function getTaxedShippingPrice()
828  {
829  if (is_null($this->taxedShippingPrice)) {
831  $data = $this->raw(self::FIELD_TAXED_SHIPPING_PRICE);
832  if (is_null($data)) {
833  return null;
834  }
835 
836  $this->taxedShippingPrice = TaxedPriceModel::of($data);
837  }
838 
840  }
841 
848  public function getDiscountOnTotalPrice()
849  {
850  if (is_null($this->discountOnTotalPrice)) {
852  $data = $this->raw(self::FIELD_DISCOUNT_ON_TOTAL_PRICE);
853  if (is_null($data)) {
854  return null;
855  }
856 
857  $this->discountOnTotalPrice = DiscountOnTotalPriceModel::of($data);
858  }
859 
861  }
862 
869  public function getTaxMode()
870  {
871  if (is_null($this->taxMode)) {
873  $data = $this->raw(self::FIELD_TAX_MODE);
874  if (is_null($data)) {
875  return null;
876  }
877  $this->taxMode = (string) $data;
878  }
879 
880  return $this->taxMode;
881  }
882 
889  public function getTaxRoundingMode()
890  {
891  if (is_null($this->taxRoundingMode)) {
893  $data = $this->raw(self::FIELD_TAX_ROUNDING_MODE);
894  if (is_null($data)) {
895  return null;
896  }
897  $this->taxRoundingMode = (string) $data;
898  }
899 
900  return $this->taxRoundingMode;
901  }
902 
909  public function getTaxCalculationMode()
910  {
911  if (is_null($this->taxCalculationMode)) {
913  $data = $this->raw(self::FIELD_TAX_CALCULATION_MODE);
914  if (is_null($data)) {
915  return null;
916  }
917  $this->taxCalculationMode = (string) $data;
918  }
919 
921  }
922 
929  public function getInventoryMode()
930  {
931  if (is_null($this->inventoryMode)) {
933  $data = $this->raw(self::FIELD_INVENTORY_MODE);
934  if (is_null($data)) {
935  return null;
936  }
937  $this->inventoryMode = (string) $data;
938  }
939 
940  return $this->inventoryMode;
941  }
942 
949  public function getBillingAddress()
950  {
951  if (is_null($this->billingAddress)) {
953  $data = $this->raw(self::FIELD_BILLING_ADDRESS);
954  if (is_null($data)) {
955  return null;
956  }
957 
958  $this->billingAddress = AddressModel::of($data);
959  }
960 
961  return $this->billingAddress;
962  }
963 
971  public function getShippingAddress()
972  {
973  if (is_null($this->shippingAddress)) {
975  $data = $this->raw(self::FIELD_SHIPPING_ADDRESS);
976  if (is_null($data)) {
977  return null;
978  }
979 
980  $this->shippingAddress = AddressModel::of($data);
981  }
982 
983  return $this->shippingAddress;
984  }
985 
992  public function getShippingMode()
993  {
994  if (is_null($this->shippingMode)) {
996  $data = $this->raw(self::FIELD_SHIPPING_MODE);
997  if (is_null($data)) {
998  return null;
999  }
1000  $this->shippingMode = (string) $data;
1001  }
1002 
1003  return $this->shippingMode;
1004  }
1005 
1012  public function getShippingKey()
1013  {
1014  if (is_null($this->shippingKey)) {
1016  $data = $this->raw(self::FIELD_SHIPPING_KEY);
1017  if (is_null($data)) {
1018  return null;
1019  }
1020  $this->shippingKey = (string) $data;
1021  }
1022 
1023  return $this->shippingKey;
1024  }
1025 
1033  public function getShippingInfo()
1034  {
1035  if (is_null($this->shippingInfo)) {
1037  $data = $this->raw(self::FIELD_SHIPPING_INFO);
1038  if (is_null($data)) {
1039  return null;
1040  }
1041 
1042  $this->shippingInfo = ShippingInfoModel::of($data);
1043  }
1044 
1045  return $this->shippingInfo;
1046  }
1047 
1060  public function getShippingRateInput()
1061  {
1062  if (is_null($this->shippingRateInput)) {
1064  $data = $this->raw(self::FIELD_SHIPPING_RATE_INPUT);
1065  if (is_null($data)) {
1066  return null;
1067  }
1069  $this->shippingRateInput = $className::of($data);
1070  }
1071 
1072  return $this->shippingRateInput;
1073  }
1074 
1081  public function getShippingCustomFields()
1082  {
1083  if (is_null($this->shippingCustomFields)) {
1085  $data = $this->raw(self::FIELD_SHIPPING_CUSTOM_FIELDS);
1086  if (is_null($data)) {
1087  return null;
1088  }
1089 
1090  $this->shippingCustomFields = CustomFieldsModel::of($data);
1091  }
1092 
1094  }
1095 
1103  public function getShipping()
1104  {
1105  if (is_null($this->shipping)) {
1107  $data = $this->raw(self::FIELD_SHIPPING);
1108  if (is_null($data)) {
1109  return null;
1110  }
1111  $this->shipping = ShippingCollection::fromArray($data);
1112  }
1113 
1114  return $this->shipping;
1115  }
1116 
1124  public function getItemShippingAddresses()
1125  {
1126  if (is_null($this->itemShippingAddresses)) {
1128  $data = $this->raw(self::FIELD_ITEM_SHIPPING_ADDRESSES);
1129  if (is_null($data)) {
1130  return null;
1131  }
1132  $this->itemShippingAddresses = AddressCollection::fromArray($data);
1133  }
1134 
1136  }
1137 
1145  public function getDiscountCodes()
1146  {
1147  if (is_null($this->discountCodes)) {
1149  $data = $this->raw(self::FIELD_DISCOUNT_CODES);
1150  if (is_null($data)) {
1151  return null;
1152  }
1153  $this->discountCodes = DiscountCodeInfoCollection::fromArray($data);
1154  }
1155 
1156  return $this->discountCodes;
1157  }
1158 
1166  public function getDirectDiscounts()
1167  {
1168  if (is_null($this->directDiscounts)) {
1170  $data = $this->raw(self::FIELD_DIRECT_DISCOUNTS);
1171  if (is_null($data)) {
1172  return null;
1173  }
1174  $this->directDiscounts = DirectDiscountCollection::fromArray($data);
1175  }
1176 
1177  return $this->directDiscounts;
1178  }
1179 
1186  public function getRefusedGifts()
1187  {
1188  if (is_null($this->refusedGifts)) {
1190  $data = $this->raw(self::FIELD_REFUSED_GIFTS);
1191  if (is_null($data)) {
1192  return null;
1193  }
1194  $this->refusedGifts = CartDiscountReferenceCollection::fromArray($data);
1195  }
1196 
1197  return $this->refusedGifts;
1198  }
1199 
1206  public function getPaymentInfo()
1207  {
1208  if (is_null($this->paymentInfo)) {
1210  $data = $this->raw(self::FIELD_PAYMENT_INFO);
1211  if (is_null($data)) {
1212  return null;
1213  }
1214 
1215  $this->paymentInfo = PaymentInfoModel::of($data);
1216  }
1217 
1218  return $this->paymentInfo;
1219  }
1220 
1227  public function getCountry()
1228  {
1229  if (is_null($this->country)) {
1231  $data = $this->raw(self::FIELD_COUNTRY);
1232  if (is_null($data)) {
1233  return null;
1234  }
1235  $this->country = (string) $data;
1236  }
1237 
1238  return $this->country;
1239  }
1240 
1248  public function getLocale()
1249  {
1250  if (is_null($this->locale)) {
1252  $data = $this->raw(self::FIELD_LOCALE);
1253  if (is_null($data)) {
1254  return null;
1255  }
1256  $this->locale = (string) $data;
1257  }
1258 
1259  return $this->locale;
1260  }
1261 
1268  public function getOrigin()
1269  {
1270  if (is_null($this->origin)) {
1272  $data = $this->raw(self::FIELD_ORIGIN);
1273  if (is_null($data)) {
1274  return null;
1275  }
1276  $this->origin = (string) $data;
1277  }
1278 
1279  return $this->origin;
1280  }
1281 
1289  public function getCart()
1290  {
1291  if (is_null($this->cart)) {
1293  $data = $this->raw(self::FIELD_CART);
1294  if (is_null($data)) {
1295  return null;
1296  }
1297 
1298  $this->cart = CartReferenceModel::of($data);
1299  }
1300 
1301  return $this->cart;
1302  }
1303 
1310  public function getQuote()
1311  {
1312  if (is_null($this->quote)) {
1314  $data = $this->raw(self::FIELD_QUOTE);
1315  if (is_null($data)) {
1316  return null;
1317  }
1318 
1319  $this->quote = QuoteReferenceModel::of($data);
1320  }
1321 
1322  return $this->quote;
1323  }
1324 
1331  public function getOrderState()
1332  {
1333  if (is_null($this->orderState)) {
1335  $data = $this->raw(self::FIELD_ORDER_STATE);
1336  if (is_null($data)) {
1337  return null;
1338  }
1339  $this->orderState = (string) $data;
1340  }
1341 
1342  return $this->orderState;
1343  }
1344 
1351  public function getShipmentState()
1352  {
1353  if (is_null($this->shipmentState)) {
1355  $data = $this->raw(self::FIELD_SHIPMENT_STATE);
1356  if (is_null($data)) {
1357  return null;
1358  }
1359  $this->shipmentState = (string) $data;
1360  }
1361 
1362  return $this->shipmentState;
1363  }
1364 
1371  public function getPaymentState()
1372  {
1373  if (is_null($this->paymentState)) {
1375  $data = $this->raw(self::FIELD_PAYMENT_STATE);
1376  if (is_null($data)) {
1377  return null;
1378  }
1379  $this->paymentState = (string) $data;
1380  }
1381 
1382  return $this->paymentState;
1383  }
1384 
1392  public function getState()
1393  {
1394  if (is_null($this->state)) {
1396  $data = $this->raw(self::FIELD_STATE);
1397  if (is_null($data)) {
1398  return null;
1399  }
1400 
1401  $this->state = StateReferenceModel::of($data);
1402  }
1403 
1404  return $this->state;
1405  }
1406 
1414  public function getSyncInfo()
1415  {
1416  if (is_null($this->syncInfo)) {
1418  $data = $this->raw(self::FIELD_SYNC_INFO);
1419  if (is_null($data)) {
1420  return null;
1421  }
1422  $this->syncInfo = SyncInfoCollection::fromArray($data);
1423  }
1424 
1425  return $this->syncInfo;
1426  }
1427 
1434  public function getReturnInfo()
1435  {
1436  if (is_null($this->returnInfo)) {
1438  $data = $this->raw(self::FIELD_RETURN_INFO);
1439  if (is_null($data)) {
1440  return null;
1441  }
1442  $this->returnInfo = ReturnInfoCollection::fromArray($data);
1443  }
1444 
1445  return $this->returnInfo;
1446  }
1447 
1455  {
1456  if (is_null($this->lastMessageSequenceNumber)) {
1458  $data = $this->raw(self::FIELD_LAST_MESSAGE_SEQUENCE_NUMBER);
1459  if (is_null($data)) {
1460  return null;
1461  }
1462  $this->lastMessageSequenceNumber = (int) $data;
1463  }
1464 
1466  }
1467 
1474  public function getCustom()
1475  {
1476  if (is_null($this->custom)) {
1478  $data = $this->raw(self::FIELD_CUSTOM);
1479  if (is_null($data)) {
1480  return null;
1481  }
1482 
1483  $this->custom = CustomFieldsModel::of($data);
1484  }
1485 
1486  return $this->custom;
1487  }
1488 
1496  public function getCompletedAt()
1497  {
1498  if (is_null($this->completedAt)) {
1500  $data = $this->raw(self::FIELD_COMPLETED_AT);
1501  if (is_null($data)) {
1502  return null;
1503  }
1504  $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data);
1505  if (false === $data) {
1506  return null;
1507  }
1508  $this->completedAt = $data;
1509  }
1510 
1511  return $this->completedAt;
1512  }
1513 
1520  public function getLastModifiedBy()
1521  {
1522  if (is_null($this->lastModifiedBy)) {
1524  $data = $this->raw(self::FIELD_LAST_MODIFIED_BY);
1525  if (is_null($data)) {
1526  return null;
1527  }
1528 
1529  $this->lastModifiedBy = LastModifiedByModel::of($data);
1530  }
1531 
1532  return $this->lastModifiedBy;
1533  }
1534 
1541  public function getCreatedBy()
1542  {
1543  if (is_null($this->createdBy)) {
1545  $data = $this->raw(self::FIELD_CREATED_BY);
1546  if (is_null($data)) {
1547  return null;
1548  }
1549 
1550  $this->createdBy = CreatedByModel::of($data);
1551  }
1552 
1553  return $this->createdBy;
1554  }
1555 
1556 
1560  public function setId(?string $id): void
1561  {
1562  $this->id = $id;
1563  }
1564 
1568  public function setVersion(?int $version): void
1569  {
1570  $this->version = $version;
1571  }
1572 
1576  public function setCreatedAt(?DateTimeImmutable $createdAt): void
1577  {
1578  $this->createdAt = $createdAt;
1579  }
1580 
1584  public function setLastModifiedAt(?DateTimeImmutable $lastModifiedAt): void
1585  {
1586  $this->lastModifiedAt = $lastModifiedAt;
1587  }
1588 
1592  public function setOrderNumber(?string $orderNumber): void
1593  {
1594  $this->orderNumber = $orderNumber;
1595  }
1596 
1600  public function setPurchaseOrderNumber(?string $purchaseOrderNumber): void
1601  {
1602  $this->purchaseOrderNumber = $purchaseOrderNumber;
1603  }
1604 
1608  public function setCustomerId(?string $customerId): void
1609  {
1610  $this->customerId = $customerId;
1611  }
1612 
1616  public function setCustomerEmail(?string $customerEmail): void
1617  {
1618  $this->customerEmail = $customerEmail;
1619  }
1620 
1625  {
1626  $this->customerGroup = $customerGroup;
1627  }
1628 
1632  public function setAnonymousId(?string $anonymousId): void
1633  {
1634  $this->anonymousId = $anonymousId;
1635  }
1636 
1641  {
1642  $this->businessUnit = $businessUnit;
1643  }
1644 
1648  public function setStore(?StoreKeyReference $store): void
1649  {
1650  $this->store = $store;
1651  }
1652 
1657  {
1658  $this->lineItems = $lineItems;
1659  }
1660 
1665  {
1666  $this->customLineItems = $customLineItems;
1667  }
1668 
1672  public function setTotalPrice(?TypedMoney $totalPrice): void
1673  {
1674  $this->totalPrice = $totalPrice;
1675  }
1676 
1680  public function setTaxedPrice(?TaxedPrice $taxedPrice): void
1681  {
1682  $this->taxedPrice = $taxedPrice;
1683  }
1684 
1689  {
1690  $this->taxedShippingPrice = $taxedShippingPrice;
1691  }
1692 
1697  {
1698  $this->discountOnTotalPrice = $discountOnTotalPrice;
1699  }
1700 
1704  public function setTaxMode(?string $taxMode): void
1705  {
1706  $this->taxMode = $taxMode;
1707  }
1708 
1712  public function setTaxRoundingMode(?string $taxRoundingMode): void
1713  {
1714  $this->taxRoundingMode = $taxRoundingMode;
1715  }
1716 
1720  public function setTaxCalculationMode(?string $taxCalculationMode): void
1721  {
1722  $this->taxCalculationMode = $taxCalculationMode;
1723  }
1724 
1728  public function setInventoryMode(?string $inventoryMode): void
1729  {
1730  $this->inventoryMode = $inventoryMode;
1731  }
1732 
1737  {
1738  $this->billingAddress = $billingAddress;
1739  }
1740 
1745  {
1746  $this->shippingAddress = $shippingAddress;
1747  }
1748 
1752  public function setShippingMode(?string $shippingMode): void
1753  {
1754  $this->shippingMode = $shippingMode;
1755  }
1756 
1760  public function setShippingKey(?string $shippingKey): void
1761  {
1762  $this->shippingKey = $shippingKey;
1763  }
1764 
1769  {
1770  $this->shippingInfo = $shippingInfo;
1771  }
1772 
1777  {
1778  $this->shippingRateInput = $shippingRateInput;
1779  }
1780 
1785  {
1786  $this->shippingCustomFields = $shippingCustomFields;
1787  }
1788 
1792  public function setShipping(?ShippingCollection $shipping): void
1793  {
1794  $this->shipping = $shipping;
1795  }
1796 
1801  {
1802  $this->itemShippingAddresses = $itemShippingAddresses;
1803  }
1804 
1809  {
1810  $this->discountCodes = $discountCodes;
1811  }
1812 
1817  {
1818  $this->directDiscounts = $directDiscounts;
1819  }
1820 
1825  {
1826  $this->refusedGifts = $refusedGifts;
1827  }
1828 
1832  public function setPaymentInfo(?PaymentInfo $paymentInfo): void
1833  {
1834  $this->paymentInfo = $paymentInfo;
1835  }
1836 
1840  public function setCountry(?string $country): void
1841  {
1842  $this->country = $country;
1843  }
1844 
1848  public function setLocale(?string $locale): void
1849  {
1850  $this->locale = $locale;
1851  }
1852 
1856  public function setOrigin(?string $origin): void
1857  {
1858  $this->origin = $origin;
1859  }
1860 
1864  public function setCart(?CartReference $cart): void
1865  {
1866  $this->cart = $cart;
1867  }
1868 
1872  public function setQuote(?QuoteReference $quote): void
1873  {
1874  $this->quote = $quote;
1875  }
1876 
1880  public function setOrderState(?string $orderState): void
1881  {
1882  $this->orderState = $orderState;
1883  }
1884 
1888  public function setShipmentState(?string $shipmentState): void
1889  {
1890  $this->shipmentState = $shipmentState;
1891  }
1892 
1896  public function setPaymentState(?string $paymentState): void
1897  {
1898  $this->paymentState = $paymentState;
1899  }
1900 
1904  public function setState(?StateReference $state): void
1905  {
1906  $this->state = $state;
1907  }
1908 
1912  public function setSyncInfo(?SyncInfoCollection $syncInfo): void
1913  {
1914  $this->syncInfo = $syncInfo;
1915  }
1916 
1921  {
1922  $this->returnInfo = $returnInfo;
1923  }
1924 
1929  {
1930  $this->lastMessageSequenceNumber = $lastMessageSequenceNumber;
1931  }
1932 
1936  public function setCustom(?CustomFields $custom): void
1937  {
1938  $this->custom = $custom;
1939  }
1940 
1944  public function setCompletedAt(?DateTimeImmutable $completedAt): void
1945  {
1946  $this->completedAt = $completedAt;
1947  }
1948 
1953  {
1954  $this->lastModifiedBy = $lastModifiedBy;
1955  }
1956 
1960  public function setCreatedBy(?CreatedBy $createdBy): void
1961  {
1962  $this->createdBy = $createdBy;
1963  }
1964 
1965 
1966  #[\ReturnTypeWillChange]
1967  public function jsonSerialize()
1968  {
1969  $data = $this->toArray();
1970  if (isset($data[Order::FIELD_CREATED_AT]) && $data[Order::FIELD_CREATED_AT] instanceof \DateTimeImmutable) {
1971  $data[Order::FIELD_CREATED_AT] = $data[Order::FIELD_CREATED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c');
1972  }
1973 
1974  if (isset($data[Order::FIELD_LAST_MODIFIED_AT]) && $data[Order::FIELD_LAST_MODIFIED_AT] instanceof \DateTimeImmutable) {
1975  $data[Order::FIELD_LAST_MODIFIED_AT] = $data[Order::FIELD_LAST_MODIFIED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c');
1976  }
1977 
1978  if (isset($data[Order::FIELD_COMPLETED_AT]) && $data[Order::FIELD_COMPLETED_AT] instanceof \DateTimeImmutable) {
1979  $data[Order::FIELD_COMPLETED_AT] = $data[Order::FIELD_COMPLETED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c');
1980  }
1981  return (object) $data;
1982  }
1983 }
setInventoryMode(?string $inventoryMode)
setDirectDiscounts(?DirectDiscountCollection $directDiscounts)
setItemShippingAddresses(?AddressCollection $itemShippingAddresses)
setShippingRateInput(?ShippingRateInput $shippingRateInput)
setSyncInfo(?SyncInfoCollection $syncInfo)
setCustomerGroup(?CustomerGroupReference $customerGroup)
setShippingInfo(?ShippingInfo $shippingInfo)
__construct(?string $id=null, ?int $version=null, ?DateTimeImmutable $createdAt=null, ?DateTimeImmutable $lastModifiedAt=null, ?string $orderNumber=null, ?string $purchaseOrderNumber=null, ?string $customerId=null, ?string $customerEmail=null, ?CustomerGroupReference $customerGroup=null, ?string $anonymousId=null, ?BusinessUnitKeyReference $businessUnit=null, ?StoreKeyReference $store=null, ?LineItemCollection $lineItems=null, ?CustomLineItemCollection $customLineItems=null, ?TypedMoney $totalPrice=null, ?TaxedPrice $taxedPrice=null, ?TaxedPrice $taxedShippingPrice=null, ?DiscountOnTotalPrice $discountOnTotalPrice=null, ?string $taxMode=null, ?string $taxRoundingMode=null, ?string $taxCalculationMode=null, ?string $inventoryMode=null, ?Address $billingAddress=null, ?Address $shippingAddress=null, ?string $shippingMode=null, ?string $shippingKey=null, ?ShippingInfo $shippingInfo=null, ?ShippingRateInput $shippingRateInput=null, ?CustomFields $shippingCustomFields=null, ?ShippingCollection $shipping=null, ?AddressCollection $itemShippingAddresses=null, ?DiscountCodeInfoCollection $discountCodes=null, ?DirectDiscountCollection $directDiscounts=null, ?CartDiscountReferenceCollection $refusedGifts=null, ?PaymentInfo $paymentInfo=null, ?string $country=null, ?string $locale=null, ?string $origin=null, ?CartReference $cart=null, ?QuoteReference $quote=null, ?string $orderState=null, ?string $shipmentState=null, ?string $paymentState=null, ?StateReference $state=null, ?SyncInfoCollection $syncInfo=null, ?ReturnInfoCollection $returnInfo=null, ?int $lastMessageSequenceNumber=null, ?CustomFields $custom=null, ?DateTimeImmutable $completedAt=null, ?LastModifiedBy $lastModifiedBy=null, ?CreatedBy $createdBy=null)
Definition: OrderModel.php:374
setCustomerEmail(?string $customerEmail)
setShipmentState(?string $shipmentState)
setShippingAddress(?Address $shippingAddress)
setTaxRoundingMode(?string $taxRoundingMode)
setTaxCalculationMode(?string $taxCalculationMode)
setDiscountOnTotalPrice(?DiscountOnTotalPrice $discountOnTotalPrice)
setPaymentInfo(?PaymentInfo $paymentInfo)
setCustomLineItems(?CustomLineItemCollection $customLineItems)
setLastModifiedBy(?LastModifiedBy $lastModifiedBy)
setCompletedAt(?DateTimeImmutable $completedAt)
setCreatedAt(?DateTimeImmutable $createdAt)
setRefusedGifts(?CartDiscountReferenceCollection $refusedGifts)
setTaxedShippingPrice(?TaxedPrice $taxedShippingPrice)
setDiscountCodes(?DiscountCodeInfoCollection $discountCodes)
setPurchaseOrderNumber(?string $purchaseOrderNumber)
setBusinessUnit(?BusinessUnitKeyReference $businessUnit)
setShippingCustomFields(?CustomFields $shippingCustomFields)
setTotalPrice(?TypedMoney $totalPrice)
setReturnInfo(?ReturnInfoCollection $returnInfo)
setBillingAddress(?Address $billingAddress)
setLineItems(?LineItemCollection $lineItems)
setLastModifiedAt(?DateTimeImmutable $lastModifiedAt)
setStore(?StoreKeyReference $store)
setTaxedPrice(?TaxedPrice $taxedPrice)
setShipping(?ShippingCollection $shipping)
setLastMessageSequenceNumber(?int $lastMessageSequenceNumber)