commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
OrderModel.php
1<?php
2
3declare(strict_types=1);
10
60use DateTimeImmutable;
61use stdClass;
62
66final class OrderModel extends JsonObjectModel implements Order
67{
72 protected $id;
73
78 protected $version;
79
84 protected $createdAt;
85
90 protected $lastModifiedAt;
91
96 protected $orderNumber;
97
103
108 protected $customerId;
109
114 protected $customerEmail;
115
120 protected $customerGroup;
121
126 protected $anonymousId;
127
132 protected $businessUnit;
133
138 protected $store;
139
144 protected $lineItems;
145
151
156 protected $totalPrice;
157
162 protected $taxedPrice;
163
169
175
181
186 protected $taxMode;
187
193
199
204 protected $inventoryMode;
205
211
217
222 protected $shippingMode;
223
228 protected $shippingKey;
229
234 protected $shippingInfo;
235
241
247
252 protected $shipping;
253
259
264 protected $discountCodes;
265
271
277
282 protected $refusedGifts;
283
288 protected $paymentInfo;
289
294 protected $country;
295
300 protected $locale;
301
306 protected $origin;
307
312 protected $cart;
313
318 protected $quote;
319
325
330 protected $orderState;
331
336 protected $shipmentState;
337
342 protected $paymentState;
343
348 protected $state;
349
354 protected $syncInfo;
355
360 protected $returnInfo;
361
367
373
378 protected $custom;
379
384 protected $completedAt;
385
391
396 protected $createdBy;
397
398
402 public function __construct(
403 ?string $id = null,
404 ?int $version = null,
405 ?DateTimeImmutable $createdAt = null,
406 ?DateTimeImmutable $lastModifiedAt = null,
407 ?string $orderNumber = null,
408 ?string $purchaseOrderNumber = null,
409 ?string $customerId = null,
410 ?string $customerEmail = null,
412 ?string $anonymousId = null,
418 ?TaxedPrice $taxedPrice = null,
421 ?string $priceRoundingMode = null,
422 ?string $taxMode = null,
423 ?string $taxRoundingMode = null,
424 ?string $taxCalculationMode = null,
425 ?string $inventoryMode = null,
426 ?Address $billingAddress = null,
428 ?string $shippingMode = null,
429 ?string $shippingKey = null,
440 ?string $country = null,
441 ?string $locale = null,
442 ?string $origin = null,
443 ?CartReference $cart = null,
444 ?QuoteReference $quote = null,
446 ?string $orderState = null,
447 ?string $shipmentState = null,
448 ?string $paymentState = null,
449 ?StateReference $state = null,
453 ?int $lastMessageSequenceNumber = null,
454 ?CustomFields $custom = null,
455 ?DateTimeImmutable $completedAt = null,
457 ?CreatedBy $createdBy = null
458 ) {
459 $this->id = $id;
460 $this->version = $version;
461 $this->createdAt = $createdAt;
462 $this->lastModifiedAt = $lastModifiedAt;
463 $this->orderNumber = $orderNumber;
464 $this->purchaseOrderNumber = $purchaseOrderNumber;
465 $this->customerId = $customerId;
466 $this->customerEmail = $customerEmail;
467 $this->customerGroup = $customerGroup;
468 $this->anonymousId = $anonymousId;
469 $this->businessUnit = $businessUnit;
470 $this->store = $store;
471 $this->lineItems = $lineItems;
472 $this->customLineItems = $customLineItems;
473 $this->totalPrice = $totalPrice;
474 $this->taxedPrice = $taxedPrice;
475 $this->taxedShippingPrice = $taxedShippingPrice;
476 $this->discountOnTotalPrice = $discountOnTotalPrice;
477 $this->priceRoundingMode = $priceRoundingMode;
478 $this->taxMode = $taxMode;
479 $this->taxRoundingMode = $taxRoundingMode;
480 $this->taxCalculationMode = $taxCalculationMode;
481 $this->inventoryMode = $inventoryMode;
482 $this->billingAddress = $billingAddress;
483 $this->shippingAddress = $shippingAddress;
484 $this->shippingMode = $shippingMode;
485 $this->shippingKey = $shippingKey;
486 $this->shippingInfo = $shippingInfo;
487 $this->shippingRateInput = $shippingRateInput;
488 $this->shippingCustomFields = $shippingCustomFields;
489 $this->shipping = $shipping;
490 $this->itemShippingAddresses = $itemShippingAddresses;
491 $this->discountCodes = $discountCodes;
492 $this->directDiscounts = $directDiscounts;
493 $this->directDiscountsIgnoreCartDiscounts = $directDiscountsIgnoreCartDiscounts;
494 $this->refusedGifts = $refusedGifts;
495 $this->paymentInfo = $paymentInfo;
496 $this->country = $country;
497 $this->locale = $locale;
498 $this->origin = $origin;
499 $this->cart = $cart;
500 $this->quote = $quote;
501 $this->recurringOrder = $recurringOrder;
502 $this->orderState = $orderState;
503 $this->shipmentState = $shipmentState;
504 $this->paymentState = $paymentState;
505 $this->state = $state;
506 $this->syncInfo = $syncInfo;
507 $this->returnInfo = $returnInfo;
508 $this->discountTypeCombination = $discountTypeCombination;
509 $this->lastMessageSequenceNumber = $lastMessageSequenceNumber;
510 $this->custom = $custom;
511 $this->completedAt = $completedAt;
512 $this->lastModifiedBy = $lastModifiedBy;
513 $this->createdBy = $createdBy;
514 }
515
522 public function getId()
523 {
524 if (is_null($this->id)) {
526 $data = $this->raw(self::FIELD_ID);
527 if (is_null($data)) {
528 return null;
529 }
530 $this->id = (string) $data;
531 }
532
533 return $this->id;
534 }
535
542 public function getVersion()
543 {
544 if (is_null($this->version)) {
546 $data = $this->raw(self::FIELD_VERSION);
547 if (is_null($data)) {
548 return null;
549 }
550 $this->version = (int) $data;
551 }
552
553 return $this->version;
554 }
555
562 public function getCreatedAt()
563 {
564 if (is_null($this->createdAt)) {
566 $data = $this->raw(self::FIELD_CREATED_AT);
567 if (is_null($data)) {
568 return null;
569 }
570 $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data);
571 if (false === $data) {
572 return null;
573 }
574 $this->createdAt = $data;
575 }
576
577 return $this->createdAt;
578 }
579
586 public function getLastModifiedAt()
587 {
588 if (is_null($this->lastModifiedAt)) {
590 $data = $this->raw(self::FIELD_LAST_MODIFIED_AT);
591 if (is_null($data)) {
592 return null;
593 }
594 $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data);
595 if (false === $data) {
596 return null;
597 }
598 $this->lastModifiedAt = $data;
599 }
600
602 }
603
610 public function getOrderNumber()
611 {
612 if (is_null($this->orderNumber)) {
614 $data = $this->raw(self::FIELD_ORDER_NUMBER);
615 if (is_null($data)) {
616 return null;
617 }
618 $this->orderNumber = (string) $data;
619 }
620
621 return $this->orderNumber;
622 }
623
631 public function getPurchaseOrderNumber()
632 {
633 if (is_null($this->purchaseOrderNumber)) {
635 $data = $this->raw(self::FIELD_PURCHASE_ORDER_NUMBER);
636 if (is_null($data)) {
637 return null;
638 }
639 $this->purchaseOrderNumber = (string) $data;
640 }
641
643 }
644
651 public function getCustomerId()
652 {
653 if (is_null($this->customerId)) {
655 $data = $this->raw(self::FIELD_CUSTOMER_ID);
656 if (is_null($data)) {
657 return null;
658 }
659 $this->customerId = (string) $data;
660 }
661
662 return $this->customerId;
663 }
664
671 public function getCustomerEmail()
672 {
673 if (is_null($this->customerEmail)) {
675 $data = $this->raw(self::FIELD_CUSTOMER_EMAIL);
676 if (is_null($data)) {
677 return null;
678 }
679 $this->customerEmail = (string) $data;
680 }
681
683 }
684
692 public function getCustomerGroup()
693 {
694 if (is_null($this->customerGroup)) {
696 $data = $this->raw(self::FIELD_CUSTOMER_GROUP);
697 if (is_null($data)) {
698 return null;
699 }
700
701 $this->customerGroup = CustomerGroupReferenceModel::of($data);
702 }
703
705 }
706
713 public function getAnonymousId()
714 {
715 if (is_null($this->anonymousId)) {
717 $data = $this->raw(self::FIELD_ANONYMOUS_ID);
718 if (is_null($data)) {
719 return null;
720 }
721 $this->anonymousId = (string) $data;
722 }
723
724 return $this->anonymousId;
725 }
726
733 public function getBusinessUnit()
734 {
735 if (is_null($this->businessUnit)) {
737 $data = $this->raw(self::FIELD_BUSINESS_UNIT);
738 if (is_null($data)) {
739 return null;
740 }
741
742 $this->businessUnit = BusinessUnitKeyReferenceModel::of($data);
743 }
744
745 return $this->businessUnit;
746 }
747
754 public function getStore()
755 {
756 if (is_null($this->store)) {
758 $data = $this->raw(self::FIELD_STORE);
759 if (is_null($data)) {
760 return null;
761 }
762
763 $this->store = StoreKeyReferenceModel::of($data);
764 }
765
766 return $this->store;
767 }
768
775 public function getLineItems()
776 {
777 if (is_null($this->lineItems)) {
779 $data = $this->raw(self::FIELD_LINE_ITEMS);
780 if (is_null($data)) {
781 return null;
782 }
783 $this->lineItems = LineItemCollection::fromArray($data);
784 }
785
786 return $this->lineItems;
787 }
788
795 public function getCustomLineItems()
796 {
797 if (is_null($this->customLineItems)) {
799 $data = $this->raw(self::FIELD_CUSTOM_LINE_ITEMS);
800 if (is_null($data)) {
801 return null;
802 }
803 $this->customLineItems = CustomLineItemCollection::fromArray($data);
804 }
805
807 }
808
817 public function getTotalPrice()
818 {
819 if (is_null($this->totalPrice)) {
821 $data = $this->raw(self::FIELD_TOTAL_PRICE);
822 if (is_null($data)) {
823 return null;
824 }
825
826 $this->totalPrice = CentPrecisionMoneyModel::of($data);
827 }
828
829 return $this->totalPrice;
830 }
831
842 public function getTaxedPrice()
843 {
844 if (is_null($this->taxedPrice)) {
846 $data = $this->raw(self::FIELD_TAXED_PRICE);
847 if (is_null($data)) {
848 return null;
849 }
850
851 $this->taxedPrice = TaxedPriceModel::of($data);
852 }
853
854 return $this->taxedPrice;
855 }
856
864 public function getTaxedShippingPrice()
865 {
866 if (is_null($this->taxedShippingPrice)) {
868 $data = $this->raw(self::FIELD_TAXED_SHIPPING_PRICE);
869 if (is_null($data)) {
870 return null;
871 }
872
873 $this->taxedShippingPrice = TaxedPriceModel::of($data);
874 }
875
877 }
878
885 public function getDiscountOnTotalPrice()
886 {
887 if (is_null($this->discountOnTotalPrice)) {
889 $data = $this->raw(self::FIELD_DISCOUNT_ON_TOTAL_PRICE);
890 if (is_null($data)) {
891 return null;
892 }
893
894 $this->discountOnTotalPrice = DiscountOnTotalPriceModel::of($data);
895 }
896
898 }
899
906 public function getPriceRoundingMode()
907 {
908 if (is_null($this->priceRoundingMode)) {
910 $data = $this->raw(self::FIELD_PRICE_ROUNDING_MODE);
911 if (is_null($data)) {
912 return null;
913 }
914 $this->priceRoundingMode = (string) $data;
915 }
916
918 }
919
926 public function getTaxMode()
927 {
928 if (is_null($this->taxMode)) {
930 $data = $this->raw(self::FIELD_TAX_MODE);
931 if (is_null($data)) {
932 return null;
933 }
934 $this->taxMode = (string) $data;
935 }
936
937 return $this->taxMode;
938 }
939
946 public function getTaxRoundingMode()
947 {
948 if (is_null($this->taxRoundingMode)) {
950 $data = $this->raw(self::FIELD_TAX_ROUNDING_MODE);
951 if (is_null($data)) {
952 return null;
953 }
954 $this->taxRoundingMode = (string) $data;
955 }
956
958 }
959
966 public function getTaxCalculationMode()
967 {
968 if (is_null($this->taxCalculationMode)) {
970 $data = $this->raw(self::FIELD_TAX_CALCULATION_MODE);
971 if (is_null($data)) {
972 return null;
973 }
974 $this->taxCalculationMode = (string) $data;
975 }
976
978 }
979
986 public function getInventoryMode()
987 {
988 if (is_null($this->inventoryMode)) {
990 $data = $this->raw(self::FIELD_INVENTORY_MODE);
991 if (is_null($data)) {
992 return null;
993 }
994 $this->inventoryMode = (string) $data;
995 }
996
998 }
999
1006 public function getBillingAddress()
1007 {
1008 if (is_null($this->billingAddress)) {
1010 $data = $this->raw(self::FIELD_BILLING_ADDRESS);
1011 if (is_null($data)) {
1012 return null;
1013 }
1014
1015 $this->billingAddress = AddressModel::of($data);
1016 }
1017
1018 return $this->billingAddress;
1019 }
1020
1028 public function getShippingAddress()
1029 {
1030 if (is_null($this->shippingAddress)) {
1032 $data = $this->raw(self::FIELD_SHIPPING_ADDRESS);
1033 if (is_null($data)) {
1034 return null;
1035 }
1036
1037 $this->shippingAddress = AddressModel::of($data);
1038 }
1039
1041 }
1042
1049 public function getShippingMode()
1050 {
1051 if (is_null($this->shippingMode)) {
1053 $data = $this->raw(self::FIELD_SHIPPING_MODE);
1054 if (is_null($data)) {
1055 return null;
1056 }
1057 $this->shippingMode = (string) $data;
1058 }
1059
1060 return $this->shippingMode;
1061 }
1062
1069 public function getShippingKey()
1070 {
1071 if (is_null($this->shippingKey)) {
1073 $data = $this->raw(self::FIELD_SHIPPING_KEY);
1074 if (is_null($data)) {
1075 return null;
1076 }
1077 $this->shippingKey = (string) $data;
1078 }
1079
1080 return $this->shippingKey;
1081 }
1082
1090 public function getShippingInfo()
1091 {
1092 if (is_null($this->shippingInfo)) {
1094 $data = $this->raw(self::FIELD_SHIPPING_INFO);
1095 if (is_null($data)) {
1096 return null;
1097 }
1098
1099 $this->shippingInfo = ShippingInfoModel::of($data);
1100 }
1101
1102 return $this->shippingInfo;
1103 }
1104
1117 public function getShippingRateInput()
1118 {
1119 if (is_null($this->shippingRateInput)) {
1121 $data = $this->raw(self::FIELD_SHIPPING_RATE_INPUT);
1122 if (is_null($data)) {
1123 return null;
1124 }
1125 $className = ShippingRateInputModel::resolveDiscriminatorClass($data);
1126 $this->shippingRateInput = $className::of($data);
1127 }
1128
1130 }
1131
1138 public function getShippingCustomFields()
1139 {
1140 if (is_null($this->shippingCustomFields)) {
1142 $data = $this->raw(self::FIELD_SHIPPING_CUSTOM_FIELDS);
1143 if (is_null($data)) {
1144 return null;
1145 }
1146
1147 $this->shippingCustomFields = CustomFieldsModel::of($data);
1148 }
1149
1151 }
1152
1160 public function getShipping()
1161 {
1162 if (is_null($this->shipping)) {
1164 $data = $this->raw(self::FIELD_SHIPPING);
1165 if (is_null($data)) {
1166 return null;
1167 }
1168 $this->shipping = ShippingCollection::fromArray($data);
1169 }
1170
1171 return $this->shipping;
1172 }
1173
1182 {
1183 if (is_null($this->itemShippingAddresses)) {
1185 $data = $this->raw(self::FIELD_ITEM_SHIPPING_ADDRESSES);
1186 if (is_null($data)) {
1187 return null;
1188 }
1189 $this->itemShippingAddresses = AddressCollection::fromArray($data);
1190 }
1191
1193 }
1194
1202 public function getDiscountCodes()
1203 {
1204 if (is_null($this->discountCodes)) {
1206 $data = $this->raw(self::FIELD_DISCOUNT_CODES);
1207 if (is_null($data)) {
1208 return null;
1209 }
1210 $this->discountCodes = DiscountCodeInfoCollection::fromArray($data);
1211 }
1212
1213 return $this->discountCodes;
1214 }
1215
1223 public function getDirectDiscounts()
1224 {
1225 if (is_null($this->directDiscounts)) {
1227 $data = $this->raw(self::FIELD_DIRECT_DISCOUNTS);
1228 if (is_null($data)) {
1229 return null;
1230 }
1231 $this->directDiscounts = DirectDiscountCollection::fromArray($data);
1232 }
1233
1235 }
1236
1247 {
1248 if (is_null($this->directDiscountsIgnoreCartDiscounts)) {
1250 $data = $this->raw(self::FIELD_DIRECT_DISCOUNTS_IGNORE_CART_DISCOUNTS);
1251 if (is_null($data)) {
1252 return null;
1253 }
1254 $this->directDiscountsIgnoreCartDiscounts = (bool) $data;
1255 }
1256
1258 }
1259
1266 public function getRefusedGifts()
1267 {
1268 if (is_null($this->refusedGifts)) {
1270 $data = $this->raw(self::FIELD_REFUSED_GIFTS);
1271 if (is_null($data)) {
1272 return null;
1273 }
1274 $this->refusedGifts = CartDiscountReferenceCollection::fromArray($data);
1275 }
1276
1277 return $this->refusedGifts;
1278 }
1279
1286 public function getPaymentInfo()
1287 {
1288 if (is_null($this->paymentInfo)) {
1290 $data = $this->raw(self::FIELD_PAYMENT_INFO);
1291 if (is_null($data)) {
1292 return null;
1293 }
1294
1295 $this->paymentInfo = PaymentInfoModel::of($data);
1296 }
1297
1298 return $this->paymentInfo;
1299 }
1300
1307 public function getCountry()
1308 {
1309 if (is_null($this->country)) {
1311 $data = $this->raw(self::FIELD_COUNTRY);
1312 if (is_null($data)) {
1313 return null;
1314 }
1315 $this->country = (string) $data;
1316 }
1317
1318 return $this->country;
1319 }
1320
1328 public function getLocale()
1329 {
1330 if (is_null($this->locale)) {
1332 $data = $this->raw(self::FIELD_LOCALE);
1333 if (is_null($data)) {
1334 return null;
1335 }
1336 $this->locale = (string) $data;
1337 }
1338
1339 return $this->locale;
1340 }
1341
1348 public function getOrigin()
1349 {
1350 if (is_null($this->origin)) {
1352 $data = $this->raw(self::FIELD_ORIGIN);
1353 if (is_null($data)) {
1354 return null;
1355 }
1356 $this->origin = (string) $data;
1357 }
1358
1359 return $this->origin;
1360 }
1361
1369 public function getCart()
1370 {
1371 if (is_null($this->cart)) {
1373 $data = $this->raw(self::FIELD_CART);
1374 if (is_null($data)) {
1375 return null;
1376 }
1377
1378 $this->cart = CartReferenceModel::of($data);
1379 }
1380
1381 return $this->cart;
1382 }
1383
1390 public function getQuote()
1391 {
1392 if (is_null($this->quote)) {
1394 $data = $this->raw(self::FIELD_QUOTE);
1395 if (is_null($data)) {
1396 return null;
1397 }
1398
1399 $this->quote = QuoteReferenceModel::of($data);
1400 }
1401
1402 return $this->quote;
1403 }
1404
1411 public function getRecurringOrder()
1412 {
1413 if (is_null($this->recurringOrder)) {
1415 $data = $this->raw(self::FIELD_RECURRING_ORDER);
1416 if (is_null($data)) {
1417 return null;
1418 }
1419
1420 $this->recurringOrder = RecurringOrderReferenceModel::of($data);
1421 }
1422
1423 return $this->recurringOrder;
1424 }
1425
1432 public function getOrderState()
1433 {
1434 if (is_null($this->orderState)) {
1436 $data = $this->raw(self::FIELD_ORDER_STATE);
1437 if (is_null($data)) {
1438 return null;
1439 }
1440 $this->orderState = (string) $data;
1441 }
1442
1443 return $this->orderState;
1444 }
1445
1452 public function getShipmentState()
1453 {
1454 if (is_null($this->shipmentState)) {
1456 $data = $this->raw(self::FIELD_SHIPMENT_STATE);
1457 if (is_null($data)) {
1458 return null;
1459 }
1460 $this->shipmentState = (string) $data;
1461 }
1462
1463 return $this->shipmentState;
1464 }
1465
1472 public function getPaymentState()
1473 {
1474 if (is_null($this->paymentState)) {
1476 $data = $this->raw(self::FIELD_PAYMENT_STATE);
1477 if (is_null($data)) {
1478 return null;
1479 }
1480 $this->paymentState = (string) $data;
1481 }
1482
1483 return $this->paymentState;
1484 }
1485
1493 public function getState()
1494 {
1495 if (is_null($this->state)) {
1497 $data = $this->raw(self::FIELD_STATE);
1498 if (is_null($data)) {
1499 return null;
1500 }
1501
1502 $this->state = StateReferenceModel::of($data);
1503 }
1504
1505 return $this->state;
1506 }
1507
1515 public function getSyncInfo()
1516 {
1517 if (is_null($this->syncInfo)) {
1519 $data = $this->raw(self::FIELD_SYNC_INFO);
1520 if (is_null($data)) {
1521 return null;
1522 }
1523 $this->syncInfo = SyncInfoCollection::fromArray($data);
1524 }
1525
1526 return $this->syncInfo;
1527 }
1528
1535 public function getReturnInfo()
1536 {
1537 if (is_null($this->returnInfo)) {
1539 $data = $this->raw(self::FIELD_RETURN_INFO);
1540 if (is_null($data)) {
1541 return null;
1542 }
1543 $this->returnInfo = ReturnInfoCollection::fromArray($data);
1544 }
1545
1546 return $this->returnInfo;
1547 }
1548
1556 {
1557 if (is_null($this->discountTypeCombination)) {
1559 $data = $this->raw(self::FIELD_DISCOUNT_TYPE_COMBINATION);
1560 if (is_null($data)) {
1561 return null;
1562 }
1564 $this->discountTypeCombination = $className::of($data);
1565 }
1566
1568 }
1569
1577 {
1578 if (is_null($this->lastMessageSequenceNumber)) {
1580 $data = $this->raw(self::FIELD_LAST_MESSAGE_SEQUENCE_NUMBER);
1581 if (is_null($data)) {
1582 return null;
1583 }
1584 $this->lastMessageSequenceNumber = (int) $data;
1585 }
1586
1588 }
1589
1596 public function getCustom()
1597 {
1598 if (is_null($this->custom)) {
1600 $data = $this->raw(self::FIELD_CUSTOM);
1601 if (is_null($data)) {
1602 return null;
1603 }
1604
1605 $this->custom = CustomFieldsModel::of($data);
1606 }
1607
1608 return $this->custom;
1609 }
1610
1618 public function getCompletedAt()
1619 {
1620 if (is_null($this->completedAt)) {
1622 $data = $this->raw(self::FIELD_COMPLETED_AT);
1623 if (is_null($data)) {
1624 return null;
1625 }
1626 $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data);
1627 if (false === $data) {
1628 return null;
1629 }
1630 $this->completedAt = $data;
1631 }
1632
1633 return $this->completedAt;
1634 }
1635
1642 public function getLastModifiedBy()
1643 {
1644 if (is_null($this->lastModifiedBy)) {
1646 $data = $this->raw(self::FIELD_LAST_MODIFIED_BY);
1647 if (is_null($data)) {
1648 return null;
1649 }
1650
1651 $this->lastModifiedBy = LastModifiedByModel::of($data);
1652 }
1653
1654 return $this->lastModifiedBy;
1655 }
1656
1663 public function getCreatedBy()
1664 {
1665 if (is_null($this->createdBy)) {
1667 $data = $this->raw(self::FIELD_CREATED_BY);
1668 if (is_null($data)) {
1669 return null;
1670 }
1671
1672 $this->createdBy = CreatedByModel::of($data);
1673 }
1674
1675 return $this->createdBy;
1676 }
1677
1678
1682 public function setId(?string $id): void
1683 {
1684 $this->id = $id;
1685 }
1686
1690 public function setVersion(?int $version): void
1691 {
1692 $this->version = $version;
1693 }
1694
1698 public function setCreatedAt(?DateTimeImmutable $createdAt): void
1699 {
1700 $this->createdAt = $createdAt;
1701 }
1702
1706 public function setLastModifiedAt(?DateTimeImmutable $lastModifiedAt): void
1707 {
1708 $this->lastModifiedAt = $lastModifiedAt;
1709 }
1710
1714 public function setOrderNumber(?string $orderNumber): void
1715 {
1716 $this->orderNumber = $orderNumber;
1717 }
1718
1722 public function setPurchaseOrderNumber(?string $purchaseOrderNumber): void
1723 {
1724 $this->purchaseOrderNumber = $purchaseOrderNumber;
1725 }
1726
1730 public function setCustomerId(?string $customerId): void
1731 {
1732 $this->customerId = $customerId;
1733 }
1734
1738 public function setCustomerEmail(?string $customerEmail): void
1739 {
1740 $this->customerEmail = $customerEmail;
1741 }
1742
1747 {
1748 $this->customerGroup = $customerGroup;
1749 }
1750
1754 public function setAnonymousId(?string $anonymousId): void
1755 {
1756 $this->anonymousId = $anonymousId;
1757 }
1758
1763 {
1764 $this->businessUnit = $businessUnit;
1765 }
1766
1770 public function setStore(?StoreKeyReference $store): void
1771 {
1772 $this->store = $store;
1773 }
1774
1779 {
1780 $this->lineItems = $lineItems;
1781 }
1782
1787 {
1788 $this->customLineItems = $customLineItems;
1789 }
1790
1795 {
1796 $this->totalPrice = $totalPrice;
1797 }
1798
1802 public function setTaxedPrice(?TaxedPrice $taxedPrice): void
1803 {
1804 $this->taxedPrice = $taxedPrice;
1805 }
1806
1811 {
1812 $this->taxedShippingPrice = $taxedShippingPrice;
1813 }
1814
1819 {
1820 $this->discountOnTotalPrice = $discountOnTotalPrice;
1821 }
1822
1826 public function setPriceRoundingMode(?string $priceRoundingMode): void
1827 {
1828 $this->priceRoundingMode = $priceRoundingMode;
1829 }
1830
1834 public function setTaxMode(?string $taxMode): void
1835 {
1836 $this->taxMode = $taxMode;
1837 }
1838
1842 public function setTaxRoundingMode(?string $taxRoundingMode): void
1843 {
1844 $this->taxRoundingMode = $taxRoundingMode;
1845 }
1846
1850 public function setTaxCalculationMode(?string $taxCalculationMode): void
1851 {
1852 $this->taxCalculationMode = $taxCalculationMode;
1853 }
1854
1858 public function setInventoryMode(?string $inventoryMode): void
1859 {
1860 $this->inventoryMode = $inventoryMode;
1861 }
1862
1867 {
1868 $this->billingAddress = $billingAddress;
1869 }
1870
1875 {
1876 $this->shippingAddress = $shippingAddress;
1877 }
1878
1882 public function setShippingMode(?string $shippingMode): void
1883 {
1884 $this->shippingMode = $shippingMode;
1885 }
1886
1890 public function setShippingKey(?string $shippingKey): void
1891 {
1892 $this->shippingKey = $shippingKey;
1893 }
1894
1899 {
1900 $this->shippingInfo = $shippingInfo;
1901 }
1902
1907 {
1908 $this->shippingRateInput = $shippingRateInput;
1909 }
1910
1915 {
1916 $this->shippingCustomFields = $shippingCustomFields;
1917 }
1918
1923 {
1924 $this->shipping = $shipping;
1925 }
1926
1931 {
1932 $this->itemShippingAddresses = $itemShippingAddresses;
1933 }
1934
1939 {
1940 $this->discountCodes = $discountCodes;
1941 }
1942
1947 {
1948 $this->directDiscounts = $directDiscounts;
1949 }
1950
1955 {
1956 $this->directDiscountsIgnoreCartDiscounts = $directDiscountsIgnoreCartDiscounts;
1957 }
1958
1963 {
1964 $this->refusedGifts = $refusedGifts;
1965 }
1966
1971 {
1972 $this->paymentInfo = $paymentInfo;
1973 }
1974
1978 public function setCountry(?string $country): void
1979 {
1980 $this->country = $country;
1981 }
1982
1986 public function setLocale(?string $locale): void
1987 {
1988 $this->locale = $locale;
1989 }
1990
1994 public function setOrigin(?string $origin): void
1995 {
1996 $this->origin = $origin;
1997 }
1998
2002 public function setCart(?CartReference $cart): void
2003 {
2004 $this->cart = $cart;
2005 }
2006
2010 public function setQuote(?QuoteReference $quote): void
2011 {
2012 $this->quote = $quote;
2013 }
2014
2019 {
2020 $this->recurringOrder = $recurringOrder;
2021 }
2022
2026 public function setOrderState(?string $orderState): void
2027 {
2028 $this->orderState = $orderState;
2029 }
2030
2034 public function setShipmentState(?string $shipmentState): void
2035 {
2036 $this->shipmentState = $shipmentState;
2037 }
2038
2042 public function setPaymentState(?string $paymentState): void
2043 {
2044 $this->paymentState = $paymentState;
2045 }
2046
2050 public function setState(?StateReference $state): void
2051 {
2052 $this->state = $state;
2053 }
2054
2059 {
2060 $this->syncInfo = $syncInfo;
2061 }
2062
2067 {
2068 $this->returnInfo = $returnInfo;
2069 }
2070
2075 {
2076 $this->discountTypeCombination = $discountTypeCombination;
2077 }
2078
2083 {
2084 $this->lastMessageSequenceNumber = $lastMessageSequenceNumber;
2085 }
2086
2090 public function setCustom(?CustomFields $custom): void
2091 {
2092 $this->custom = $custom;
2093 }
2094
2098 public function setCompletedAt(?DateTimeImmutable $completedAt): void
2099 {
2100 $this->completedAt = $completedAt;
2101 }
2102
2107 {
2108 $this->lastModifiedBy = $lastModifiedBy;
2109 }
2110
2114 public function setCreatedBy(?CreatedBy $createdBy): void
2115 {
2116 $this->createdBy = $createdBy;
2117 }
2118
2119
2120 #[\ReturnTypeWillChange]
2121 public function jsonSerialize()
2122 {
2123 $data = $this->toArray();
2124 if (isset($data[Order::FIELD_CREATED_AT]) && $data[Order::FIELD_CREATED_AT] instanceof \DateTimeImmutable) {
2125 $data[Order::FIELD_CREATED_AT] = $data[Order::FIELD_CREATED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c');
2126 }
2127
2128 if (isset($data[Order::FIELD_LAST_MODIFIED_AT]) && $data[Order::FIELD_LAST_MODIFIED_AT] instanceof \DateTimeImmutable) {
2129 $data[Order::FIELD_LAST_MODIFIED_AT] = $data[Order::FIELD_LAST_MODIFIED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c');
2130 }
2131
2132 if (isset($data[Order::FIELD_COMPLETED_AT]) && $data[Order::FIELD_COMPLETED_AT] instanceof \DateTimeImmutable) {
2133 $data[Order::FIELD_COMPLETED_AT] = $data[Order::FIELD_COMPLETED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c');
2134 }
2135 return (object) $data;
2136 }
2137}
setDirectDiscounts(?DirectDiscountCollection $directDiscounts)
setItemShippingAddresses(?AddressCollection $itemShippingAddresses)
setShippingRateInput(?ShippingRateInput $shippingRateInput)
setSyncInfo(?SyncInfoCollection $syncInfo)
setCustomerGroup(?CustomerGroupReference $customerGroup)
__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, ?CentPrecisionMoney $totalPrice=null, ?TaxedPrice $taxedPrice=null, ?TaxedPrice $taxedShippingPrice=null, ?DiscountOnTotalPrice $discountOnTotalPrice=null, ?string $priceRoundingMode=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, ?bool $directDiscountsIgnoreCartDiscounts=null, ?CartDiscountReferenceCollection $refusedGifts=null, ?PaymentInfo $paymentInfo=null, ?string $country=null, ?string $locale=null, ?string $origin=null, ?CartReference $cart=null, ?QuoteReference $quote=null, ?RecurringOrderReference $recurringOrder=null, ?string $orderState=null, ?string $shipmentState=null, ?string $paymentState=null, ?StateReference $state=null, ?SyncInfoCollection $syncInfo=null, ?ReturnInfoCollection $returnInfo=null, ?DiscountTypeCombination $discountTypeCombination=null, ?int $lastMessageSequenceNumber=null, ?CustomFields $custom=null, ?DateTimeImmutable $completedAt=null, ?LastModifiedBy $lastModifiedBy=null, ?CreatedBy $createdBy=null)
setShippingInfo(?ShippingInfo $shippingInfo)
setDiscountTypeCombination(?DiscountTypeCombination $discountTypeCombination)
setShippingAddress(?Address $shippingAddress)
setRecurringOrder(?RecurringOrderReference $recurringOrder)
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)
setTotalPrice(?CentPrecisionMoney $totalPrice)
setBusinessUnit(?BusinessUnitKeyReference $businessUnit)
setShippingCustomFields(?CustomFields $shippingCustomFields)
setReturnInfo(?ReturnInfoCollection $returnInfo)
setPriceRoundingMode(?string $priceRoundingMode)
setDirectDiscountsIgnoreCartDiscounts(?bool $directDiscountsIgnoreCartDiscounts)
setBillingAddress(?Address $billingAddress)
setLineItems(?LineItemCollection $lineItems)
setLastModifiedAt(?DateTimeImmutable $lastModifiedAt)
setStore(?StoreKeyReference $store)
setShipping(?ShippingCollection $shipping)
setLastMessageSequenceNumber(?int $lastMessageSequenceNumber)
static fromArray(array $data)