commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
CartModel.php
1<?php
2
3declare(strict_types=1);
10
37use DateTimeImmutable;
38use stdClass;
39
43final class CartModel extends JsonObjectModel implements Cart
44{
49 protected $id;
50
55 protected $version;
56
61 protected $createdAt;
62
67 protected $lastModifiedAt;
68
73 protected $key;
74
79 protected $customerId;
80
85 protected $customerEmail;
86
91 protected $customerGroup;
92
97 protected $anonymousId;
98
103 protected $businessUnit;
104
109 protected $store;
110
115 protected $lineItems;
116
122
128
133 protected $totalPrice;
134
139 protected $taxedPrice;
140
146
152
157 protected $taxMode;
158
164
170
176
181 protected $inventoryMode;
182
187 protected $cartState;
188
194
200
206
211 protected $shippingMode;
212
217 protected $shippingKey;
218
223 protected $shippingInfo;
224
230
236
241 protected $shipping;
242
248
253 protected $discountCodes;
254
260
265 protected $refusedGifts;
266
271 protected $paymentInfo;
272
277 protected $country;
278
283 protected $locale;
284
289 protected $origin;
290
295 protected $custom;
296
302
307 protected $lock;
308
314
320
326
331 protected $createdBy;
332
333
337 public function __construct(
338 ?string $id = null,
339 ?int $version = null,
340 ?DateTimeImmutable $createdAt = null,
341 ?DateTimeImmutable $lastModifiedAt = null,
342 ?string $key = null,
343 ?string $customerId = null,
344 ?string $customerEmail = null,
346 ?string $anonymousId = null,
351 ?int $totalLineItemQuantity = null,
353 ?TaxedPrice $taxedPrice = null,
356 ?string $taxMode = null,
357 ?string $priceRoundingMode = null,
358 ?string $taxRoundingMode = null,
359 ?string $taxCalculationMode = null,
360 ?string $inventoryMode = null,
361 ?string $cartState = null,
362 ?string $freezeStrategy = null,
363 ?Address $billingAddress = null,
365 ?string $shippingMode = null,
366 ?string $shippingKey = null,
376 ?string $country = null,
377 ?string $locale = null,
378 ?string $origin = null,
379 ?CustomFields $custom = null,
381 ?CartLock $lock = null,
383 ?string $purchaseOrderNumber = null,
385 ?CreatedBy $createdBy = null
386 ) {
387 $this->id = $id;
388 $this->version = $version;
389 $this->createdAt = $createdAt;
390 $this->lastModifiedAt = $lastModifiedAt;
391 $this->key = $key;
392 $this->customerId = $customerId;
393 $this->customerEmail = $customerEmail;
394 $this->customerGroup = $customerGroup;
395 $this->anonymousId = $anonymousId;
396 $this->businessUnit = $businessUnit;
397 $this->store = $store;
398 $this->lineItems = $lineItems;
399 $this->customLineItems = $customLineItems;
400 $this->totalLineItemQuantity = $totalLineItemQuantity;
401 $this->totalPrice = $totalPrice;
402 $this->taxedPrice = $taxedPrice;
403 $this->taxedShippingPrice = $taxedShippingPrice;
404 $this->discountOnTotalPrice = $discountOnTotalPrice;
405 $this->taxMode = $taxMode;
406 $this->priceRoundingMode = $priceRoundingMode;
407 $this->taxRoundingMode = $taxRoundingMode;
408 $this->taxCalculationMode = $taxCalculationMode;
409 $this->inventoryMode = $inventoryMode;
410 $this->cartState = $cartState;
411 $this->freezeStrategy = $freezeStrategy;
412 $this->billingAddress = $billingAddress;
413 $this->shippingAddress = $shippingAddress;
414 $this->shippingMode = $shippingMode;
415 $this->shippingKey = $shippingKey;
416 $this->shippingInfo = $shippingInfo;
417 $this->shippingRateInput = $shippingRateInput;
418 $this->shippingCustomFields = $shippingCustomFields;
419 $this->shipping = $shipping;
420 $this->itemShippingAddresses = $itemShippingAddresses;
421 $this->discountCodes = $discountCodes;
422 $this->directDiscounts = $directDiscounts;
423 $this->refusedGifts = $refusedGifts;
424 $this->paymentInfo = $paymentInfo;
425 $this->country = $country;
426 $this->locale = $locale;
427 $this->origin = $origin;
428 $this->custom = $custom;
429 $this->discountTypeCombination = $discountTypeCombination;
430 $this->lock = $lock;
431 $this->deleteDaysAfterLastModification = $deleteDaysAfterLastModification;
432 $this->purchaseOrderNumber = $purchaseOrderNumber;
433 $this->lastModifiedBy = $lastModifiedBy;
434 $this->createdBy = $createdBy;
435 }
436
443 public function getId()
444 {
445 if (is_null($this->id)) {
447 $data = $this->raw(self::FIELD_ID);
448 if (is_null($data)) {
449 return null;
450 }
451 $this->id = (string) $data;
452 }
453
454 return $this->id;
455 }
456
463 public function getVersion()
464 {
465 if (is_null($this->version)) {
467 $data = $this->raw(self::FIELD_VERSION);
468 if (is_null($data)) {
469 return null;
470 }
471 $this->version = (int) $data;
472 }
473
474 return $this->version;
475 }
476
483 public function getCreatedAt()
484 {
485 if (is_null($this->createdAt)) {
487 $data = $this->raw(self::FIELD_CREATED_AT);
488 if (is_null($data)) {
489 return null;
490 }
491 $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data);
492 if (false === $data) {
493 return null;
494 }
495 $this->createdAt = $data;
496 }
497
498 return $this->createdAt;
499 }
500
507 public function getLastModifiedAt()
508 {
509 if (is_null($this->lastModifiedAt)) {
511 $data = $this->raw(self::FIELD_LAST_MODIFIED_AT);
512 if (is_null($data)) {
513 return null;
514 }
515 $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data);
516 if (false === $data) {
517 return null;
518 }
519 $this->lastModifiedAt = $data;
520 }
521
523 }
524
531 public function getKey()
532 {
533 if (is_null($this->key)) {
535 $data = $this->raw(self::FIELD_KEY);
536 if (is_null($data)) {
537 return null;
538 }
539 $this->key = (string) $data;
540 }
541
542 return $this->key;
543 }
544
551 public function getCustomerId()
552 {
553 if (is_null($this->customerId)) {
555 $data = $this->raw(self::FIELD_CUSTOMER_ID);
556 if (is_null($data)) {
557 return null;
558 }
559 $this->customerId = (string) $data;
560 }
561
562 return $this->customerId;
563 }
564
571 public function getCustomerEmail()
572 {
573 if (is_null($this->customerEmail)) {
575 $data = $this->raw(self::FIELD_CUSTOMER_EMAIL);
576 if (is_null($data)) {
577 return null;
578 }
579 $this->customerEmail = (string) $data;
580 }
581
583 }
584
591 public function getCustomerGroup()
592 {
593 if (is_null($this->customerGroup)) {
595 $data = $this->raw(self::FIELD_CUSTOMER_GROUP);
596 if (is_null($data)) {
597 return null;
598 }
599
600 $this->customerGroup = CustomerGroupReferenceModel::of($data);
601 }
602
604 }
605
612 public function getAnonymousId()
613 {
614 if (is_null($this->anonymousId)) {
616 $data = $this->raw(self::FIELD_ANONYMOUS_ID);
617 if (is_null($data)) {
618 return null;
619 }
620 $this->anonymousId = (string) $data;
621 }
622
623 return $this->anonymousId;
624 }
625
632 public function getBusinessUnit()
633 {
634 if (is_null($this->businessUnit)) {
636 $data = $this->raw(self::FIELD_BUSINESS_UNIT);
637 if (is_null($data)) {
638 return null;
639 }
640
641 $this->businessUnit = BusinessUnitKeyReferenceModel::of($data);
642 }
643
644 return $this->businessUnit;
645 }
646
653 public function getStore()
654 {
655 if (is_null($this->store)) {
657 $data = $this->raw(self::FIELD_STORE);
658 if (is_null($data)) {
659 return null;
660 }
661
662 $this->store = StoreKeyReferenceModel::of($data);
663 }
664
665 return $this->store;
666 }
667
674 public function getLineItems()
675 {
676 if (is_null($this->lineItems)) {
678 $data = $this->raw(self::FIELD_LINE_ITEMS);
679 if (is_null($data)) {
680 return null;
681 }
682 $this->lineItems = LineItemCollection::fromArray($data);
683 }
684
685 return $this->lineItems;
686 }
687
694 public function getCustomLineItems()
695 {
696 if (is_null($this->customLineItems)) {
698 $data = $this->raw(self::FIELD_CUSTOM_LINE_ITEMS);
699 if (is_null($data)) {
700 return null;
701 }
702 $this->customLineItems = CustomLineItemCollection::fromArray($data);
703 }
704
706 }
707
714 public function getTotalLineItemQuantity()
715 {
716 if (is_null($this->totalLineItemQuantity)) {
718 $data = $this->raw(self::FIELD_TOTAL_LINE_ITEM_QUANTITY);
719 if (is_null($data)) {
720 return null;
721 }
722 $this->totalLineItemQuantity = (int) $data;
723 }
724
726 }
727
736 public function getTotalPrice()
737 {
738 if (is_null($this->totalPrice)) {
740 $data = $this->raw(self::FIELD_TOTAL_PRICE);
741 if (is_null($data)) {
742 return null;
743 }
744
745 $this->totalPrice = CentPrecisionMoneyModel::of($data);
746 }
747
748 return $this->totalPrice;
749 }
750
761 public function getTaxedPrice()
762 {
763 if (is_null($this->taxedPrice)) {
765 $data = $this->raw(self::FIELD_TAXED_PRICE);
766 if (is_null($data)) {
767 return null;
768 }
769
770 $this->taxedPrice = TaxedPriceModel::of($data);
771 }
772
773 return $this->taxedPrice;
774 }
775
783 public function getTaxedShippingPrice()
784 {
785 if (is_null($this->taxedShippingPrice)) {
787 $data = $this->raw(self::FIELD_TAXED_SHIPPING_PRICE);
788 if (is_null($data)) {
789 return null;
790 }
791
792 $this->taxedShippingPrice = TaxedPriceModel::of($data);
793 }
794
796 }
797
804 public function getDiscountOnTotalPrice()
805 {
806 if (is_null($this->discountOnTotalPrice)) {
808 $data = $this->raw(self::FIELD_DISCOUNT_ON_TOTAL_PRICE);
809 if (is_null($data)) {
810 return null;
811 }
812
813 $this->discountOnTotalPrice = DiscountOnTotalPriceModel::of($data);
814 }
815
817 }
818
825 public function getTaxMode()
826 {
827 if (is_null($this->taxMode)) {
829 $data = $this->raw(self::FIELD_TAX_MODE);
830 if (is_null($data)) {
831 return null;
832 }
833 $this->taxMode = (string) $data;
834 }
835
836 return $this->taxMode;
837 }
838
845 public function getPriceRoundingMode()
846 {
847 if (is_null($this->priceRoundingMode)) {
849 $data = $this->raw(self::FIELD_PRICE_ROUNDING_MODE);
850 if (is_null($data)) {
851 return null;
852 }
853 $this->priceRoundingMode = (string) $data;
854 }
855
857 }
858
865 public function getTaxRoundingMode()
866 {
867 if (is_null($this->taxRoundingMode)) {
869 $data = $this->raw(self::FIELD_TAX_ROUNDING_MODE);
870 if (is_null($data)) {
871 return null;
872 }
873 $this->taxRoundingMode = (string) $data;
874 }
875
877 }
878
885 public function getTaxCalculationMode()
886 {
887 if (is_null($this->taxCalculationMode)) {
889 $data = $this->raw(self::FIELD_TAX_CALCULATION_MODE);
890 if (is_null($data)) {
891 return null;
892 }
893 $this->taxCalculationMode = (string) $data;
894 }
895
897 }
898
905 public function getInventoryMode()
906 {
907 if (is_null($this->inventoryMode)) {
909 $data = $this->raw(self::FIELD_INVENTORY_MODE);
910 if (is_null($data)) {
911 return null;
912 }
913 $this->inventoryMode = (string) $data;
914 }
915
917 }
918
925 public function getCartState()
926 {
927 if (is_null($this->cartState)) {
929 $data = $this->raw(self::FIELD_CART_STATE);
930 if (is_null($data)) {
931 return null;
932 }
933 $this->cartState = (string) $data;
934 }
935
936 return $this->cartState;
937 }
938
945 public function getFreezeStrategy()
946 {
947 if (is_null($this->freezeStrategy)) {
949 $data = $this->raw(self::FIELD_FREEZE_STRATEGY);
950 if (is_null($data)) {
951 return null;
952 }
953 $this->freezeStrategy = (string) $data;
954 }
955
957 }
958
965 public function getBillingAddress()
966 {
967 if (is_null($this->billingAddress)) {
969 $data = $this->raw(self::FIELD_BILLING_ADDRESS);
970 if (is_null($data)) {
971 return null;
972 }
973
974 $this->billingAddress = AddressModel::of($data);
975 }
976
978 }
979
986 public function getShippingAddress()
987 {
988 if (is_null($this->shippingAddress)) {
990 $data = $this->raw(self::FIELD_SHIPPING_ADDRESS);
991 if (is_null($data)) {
992 return null;
993 }
994
995 $this->shippingAddress = AddressModel::of($data);
996 }
997
999 }
1000
1007 public function getShippingMode()
1008 {
1009 if (is_null($this->shippingMode)) {
1011 $data = $this->raw(self::FIELD_SHIPPING_MODE);
1012 if (is_null($data)) {
1013 return null;
1014 }
1015 $this->shippingMode = (string) $data;
1016 }
1017
1018 return $this->shippingMode;
1019 }
1020
1027 public function getShippingKey()
1028 {
1029 if (is_null($this->shippingKey)) {
1031 $data = $this->raw(self::FIELD_SHIPPING_KEY);
1032 if (is_null($data)) {
1033 return null;
1034 }
1035 $this->shippingKey = (string) $data;
1036 }
1037
1038 return $this->shippingKey;
1039 }
1040
1047 public function getShippingInfo()
1048 {
1049 if (is_null($this->shippingInfo)) {
1051 $data = $this->raw(self::FIELD_SHIPPING_INFO);
1052 if (is_null($data)) {
1053 return null;
1054 }
1055
1056 $this->shippingInfo = ShippingInfoModel::of($data);
1057 }
1058
1059 return $this->shippingInfo;
1060 }
1061
1074 public function getShippingRateInput()
1075 {
1076 if (is_null($this->shippingRateInput)) {
1078 $data = $this->raw(self::FIELD_SHIPPING_RATE_INPUT);
1079 if (is_null($data)) {
1080 return null;
1081 }
1083 $this->shippingRateInput = $className::of($data);
1084 }
1085
1087 }
1088
1095 public function getShippingCustomFields()
1096 {
1097 if (is_null($this->shippingCustomFields)) {
1099 $data = $this->raw(self::FIELD_SHIPPING_CUSTOM_FIELDS);
1100 if (is_null($data)) {
1101 return null;
1102 }
1103
1104 $this->shippingCustomFields = CustomFieldsModel::of($data);
1105 }
1106
1108 }
1109
1116 public function getShipping()
1117 {
1118 if (is_null($this->shipping)) {
1120 $data = $this->raw(self::FIELD_SHIPPING);
1121 if (is_null($data)) {
1122 return null;
1123 }
1124 $this->shipping = ShippingCollection::fromArray($data);
1125 }
1126
1127 return $this->shipping;
1128 }
1129
1138 {
1139 if (is_null($this->itemShippingAddresses)) {
1141 $data = $this->raw(self::FIELD_ITEM_SHIPPING_ADDRESSES);
1142 if (is_null($data)) {
1143 return null;
1144 }
1145 $this->itemShippingAddresses = AddressCollection::fromArray($data);
1146 }
1147
1149 }
1150
1157 public function getDiscountCodes()
1158 {
1159 if (is_null($this->discountCodes)) {
1161 $data = $this->raw(self::FIELD_DISCOUNT_CODES);
1162 if (is_null($data)) {
1163 return null;
1164 }
1165 $this->discountCodes = DiscountCodeInfoCollection::fromArray($data);
1166 }
1167
1168 return $this->discountCodes;
1169 }
1170
1177 public function getDirectDiscounts()
1178 {
1179 if (is_null($this->directDiscounts)) {
1181 $data = $this->raw(self::FIELD_DIRECT_DISCOUNTS);
1182 if (is_null($data)) {
1183 return null;
1184 }
1185 $this->directDiscounts = DirectDiscountCollection::fromArray($data);
1186 }
1187
1189 }
1190
1197 public function getRefusedGifts()
1198 {
1199 if (is_null($this->refusedGifts)) {
1201 $data = $this->raw(self::FIELD_REFUSED_GIFTS);
1202 if (is_null($data)) {
1203 return null;
1204 }
1205 $this->refusedGifts = CartDiscountReferenceCollection::fromArray($data);
1206 }
1207
1208 return $this->refusedGifts;
1209 }
1210
1217 public function getPaymentInfo()
1218 {
1219 if (is_null($this->paymentInfo)) {
1221 $data = $this->raw(self::FIELD_PAYMENT_INFO);
1222 if (is_null($data)) {
1223 return null;
1224 }
1225
1226 $this->paymentInfo = PaymentInfoModel::of($data);
1227 }
1228
1229 return $this->paymentInfo;
1230 }
1231
1238 public function getCountry()
1239 {
1240 if (is_null($this->country)) {
1242 $data = $this->raw(self::FIELD_COUNTRY);
1243 if (is_null($data)) {
1244 return null;
1245 }
1246 $this->country = (string) $data;
1247 }
1248
1249 return $this->country;
1250 }
1251
1258 public function getLocale()
1259 {
1260 if (is_null($this->locale)) {
1262 $data = $this->raw(self::FIELD_LOCALE);
1263 if (is_null($data)) {
1264 return null;
1265 }
1266 $this->locale = (string) $data;
1267 }
1268
1269 return $this->locale;
1270 }
1271
1278 public function getOrigin()
1279 {
1280 if (is_null($this->origin)) {
1282 $data = $this->raw(self::FIELD_ORIGIN);
1283 if (is_null($data)) {
1284 return null;
1285 }
1286 $this->origin = (string) $data;
1287 }
1288
1289 return $this->origin;
1290 }
1291
1298 public function getCustom()
1299 {
1300 if (is_null($this->custom)) {
1302 $data = $this->raw(self::FIELD_CUSTOM);
1303 if (is_null($data)) {
1304 return null;
1305 }
1306
1307 $this->custom = CustomFieldsModel::of($data);
1308 }
1309
1310 return $this->custom;
1311 }
1312
1320 {
1321 if (is_null($this->discountTypeCombination)) {
1323 $data = $this->raw(self::FIELD_DISCOUNT_TYPE_COMBINATION);
1324 if (is_null($data)) {
1325 return null;
1326 }
1328 $this->discountTypeCombination = $className::of($data);
1329 }
1330
1332 }
1333
1340 public function getLock()
1341 {
1342 if (is_null($this->lock)) {
1344 $data = $this->raw(self::FIELD_LOCK);
1345 if (is_null($data)) {
1346 return null;
1347 }
1348
1349 $this->lock = CartLockModel::of($data);
1350 }
1351
1352 return $this->lock;
1353 }
1354
1362 {
1363 if (is_null($this->deleteDaysAfterLastModification)) {
1365 $data = $this->raw(self::FIELD_DELETE_DAYS_AFTER_LAST_MODIFICATION);
1366 if (is_null($data)) {
1367 return null;
1368 }
1369 $this->deleteDaysAfterLastModification = (int) $data;
1370 }
1371
1373 }
1374
1382 public function getPurchaseOrderNumber()
1383 {
1384 if (is_null($this->purchaseOrderNumber)) {
1386 $data = $this->raw(self::FIELD_PURCHASE_ORDER_NUMBER);
1387 if (is_null($data)) {
1388 return null;
1389 }
1390 $this->purchaseOrderNumber = (string) $data;
1391 }
1392
1394 }
1395
1402 public function getLastModifiedBy()
1403 {
1404 if (is_null($this->lastModifiedBy)) {
1406 $data = $this->raw(self::FIELD_LAST_MODIFIED_BY);
1407 if (is_null($data)) {
1408 return null;
1409 }
1410
1411 $this->lastModifiedBy = LastModifiedByModel::of($data);
1412 }
1413
1414 return $this->lastModifiedBy;
1415 }
1416
1423 public function getCreatedBy()
1424 {
1425 if (is_null($this->createdBy)) {
1427 $data = $this->raw(self::FIELD_CREATED_BY);
1428 if (is_null($data)) {
1429 return null;
1430 }
1431
1432 $this->createdBy = CreatedByModel::of($data);
1433 }
1434
1435 return $this->createdBy;
1436 }
1437
1438
1442 public function setId(?string $id): void
1443 {
1444 $this->id = $id;
1445 }
1446
1450 public function setVersion(?int $version): void
1451 {
1452 $this->version = $version;
1453 }
1454
1458 public function setCreatedAt(?DateTimeImmutable $createdAt): void
1459 {
1460 $this->createdAt = $createdAt;
1461 }
1462
1466 public function setLastModifiedAt(?DateTimeImmutable $lastModifiedAt): void
1467 {
1468 $this->lastModifiedAt = $lastModifiedAt;
1469 }
1470
1474 public function setKey(?string $key): void
1475 {
1476 $this->key = $key;
1477 }
1478
1482 public function setCustomerId(?string $customerId): void
1483 {
1484 $this->customerId = $customerId;
1485 }
1486
1490 public function setCustomerEmail(?string $customerEmail): void
1491 {
1492 $this->customerEmail = $customerEmail;
1493 }
1494
1499 {
1500 $this->customerGroup = $customerGroup;
1501 }
1502
1506 public function setAnonymousId(?string $anonymousId): void
1507 {
1508 $this->anonymousId = $anonymousId;
1509 }
1510
1515 {
1516 $this->businessUnit = $businessUnit;
1517 }
1518
1522 public function setStore(?StoreKeyReference $store): void
1523 {
1524 $this->store = $store;
1525 }
1526
1531 {
1532 $this->lineItems = $lineItems;
1533 }
1534
1539 {
1540 $this->customLineItems = $customLineItems;
1541 }
1542
1547 {
1548 $this->totalLineItemQuantity = $totalLineItemQuantity;
1549 }
1550
1555 {
1556 $this->totalPrice = $totalPrice;
1557 }
1558
1562 public function setTaxedPrice(?TaxedPrice $taxedPrice): void
1563 {
1564 $this->taxedPrice = $taxedPrice;
1565 }
1566
1571 {
1572 $this->taxedShippingPrice = $taxedShippingPrice;
1573 }
1574
1579 {
1580 $this->discountOnTotalPrice = $discountOnTotalPrice;
1581 }
1582
1586 public function setTaxMode(?string $taxMode): void
1587 {
1588 $this->taxMode = $taxMode;
1589 }
1590
1594 public function setPriceRoundingMode(?string $priceRoundingMode): void
1595 {
1596 $this->priceRoundingMode = $priceRoundingMode;
1597 }
1598
1602 public function setTaxRoundingMode(?string $taxRoundingMode): void
1603 {
1604 $this->taxRoundingMode = $taxRoundingMode;
1605 }
1606
1610 public function setTaxCalculationMode(?string $taxCalculationMode): void
1611 {
1612 $this->taxCalculationMode = $taxCalculationMode;
1613 }
1614
1618 public function setInventoryMode(?string $inventoryMode): void
1619 {
1620 $this->inventoryMode = $inventoryMode;
1621 }
1622
1626 public function setCartState(?string $cartState): void
1627 {
1628 $this->cartState = $cartState;
1629 }
1630
1634 public function setFreezeStrategy(?string $freezeStrategy): void
1635 {
1636 $this->freezeStrategy = $freezeStrategy;
1637 }
1638
1643 {
1644 $this->billingAddress = $billingAddress;
1645 }
1646
1651 {
1652 $this->shippingAddress = $shippingAddress;
1653 }
1654
1658 public function setShippingMode(?string $shippingMode): void
1659 {
1660 $this->shippingMode = $shippingMode;
1661 }
1662
1666 public function setShippingKey(?string $shippingKey): void
1667 {
1668 $this->shippingKey = $shippingKey;
1669 }
1670
1675 {
1676 $this->shippingInfo = $shippingInfo;
1677 }
1678
1683 {
1684 $this->shippingRateInput = $shippingRateInput;
1685 }
1686
1691 {
1692 $this->shippingCustomFields = $shippingCustomFields;
1693 }
1694
1699 {
1700 $this->shipping = $shipping;
1701 }
1702
1707 {
1708 $this->itemShippingAddresses = $itemShippingAddresses;
1709 }
1710
1715 {
1716 $this->discountCodes = $discountCodes;
1717 }
1718
1723 {
1724 $this->directDiscounts = $directDiscounts;
1725 }
1726
1731 {
1732 $this->refusedGifts = $refusedGifts;
1733 }
1734
1739 {
1740 $this->paymentInfo = $paymentInfo;
1741 }
1742
1746 public function setCountry(?string $country): void
1747 {
1748 $this->country = $country;
1749 }
1750
1754 public function setLocale(?string $locale): void
1755 {
1756 $this->locale = $locale;
1757 }
1758
1762 public function setOrigin(?string $origin): void
1763 {
1764 $this->origin = $origin;
1765 }
1766
1770 public function setCustom(?CustomFields $custom): void
1771 {
1772 $this->custom = $custom;
1773 }
1774
1779 {
1780 $this->discountTypeCombination = $discountTypeCombination;
1781 }
1782
1786 public function setLock(?CartLock $lock): void
1787 {
1788 $this->lock = $lock;
1789 }
1790
1795 {
1796 $this->deleteDaysAfterLastModification = $deleteDaysAfterLastModification;
1797 }
1798
1802 public function setPurchaseOrderNumber(?string $purchaseOrderNumber): void
1803 {
1804 $this->purchaseOrderNumber = $purchaseOrderNumber;
1805 }
1806
1811 {
1812 $this->lastModifiedBy = $lastModifiedBy;
1813 }
1814
1818 public function setCreatedBy(?CreatedBy $createdBy): void
1819 {
1820 $this->createdBy = $createdBy;
1821 }
1822
1823
1824 #[\ReturnTypeWillChange]
1825 public function jsonSerialize()
1826 {
1827 $data = $this->toArray();
1828 if (isset($data[Cart::FIELD_CREATED_AT]) && $data[Cart::FIELD_CREATED_AT] instanceof \DateTimeImmutable) {
1829 $data[Cart::FIELD_CREATED_AT] = $data[Cart::FIELD_CREATED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c');
1830 }
1831
1832 if (isset($data[Cart::FIELD_LAST_MODIFIED_AT]) && $data[Cart::FIELD_LAST_MODIFIED_AT] instanceof \DateTimeImmutable) {
1833 $data[Cart::FIELD_LAST_MODIFIED_AT] = $data[Cart::FIELD_LAST_MODIFIED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c');
1834 }
1835 return (object) $data;
1836 }
1837}
setFreezeStrategy(?string $freezeStrategy)
setStore(?StoreKeyReference $store)
setLastModifiedAt(?DateTimeImmutable $lastModifiedAt)
setDiscountCodes(?DiscountCodeInfoCollection $discountCodes)
setDeleteDaysAfterLastModification(?int $deleteDaysAfterLastModification)
setRefusedGifts(?CartDiscountReferenceCollection $refusedGifts)
setBillingAddress(?Address $billingAddress)
setCustomerEmail(?string $customerEmail)
setTaxedShippingPrice(?TaxedPrice $taxedShippingPrice)
setTaxCalculationMode(?string $taxCalculationMode)
setTotalPrice(?CentPrecisionMoney $totalPrice)
setBusinessUnit(?BusinessUnitKeyReference $businessUnit)
setCustomLineItems(?CustomLineItemCollection $customLineItems)
setDiscountTypeCombination(?DiscountTypeCombination $discountTypeCombination)
setCustomerGroup(?CustomerGroupReference $customerGroup)
setShipping(?ShippingCollection $shipping)
setLastModifiedBy(?LastModifiedBy $lastModifiedBy)
setShippingMode(?string $shippingMode)
setTaxedPrice(?TaxedPrice $taxedPrice)
setShippingInfo(?ShippingInfo $shippingInfo)
setPaymentInfo(?PaymentInfo $paymentInfo)
setCreatedAt(?DateTimeImmutable $createdAt)
__construct(?string $id=null, ?int $version=null, ?DateTimeImmutable $createdAt=null, ?DateTimeImmutable $lastModifiedAt=null, ?string $key=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, ?int $totalLineItemQuantity=null, ?CentPrecisionMoney $totalPrice=null, ?TaxedPrice $taxedPrice=null, ?TaxedPrice $taxedShippingPrice=null, ?DiscountOnTotalPrice $discountOnTotalPrice=null, ?string $taxMode=null, ?string $priceRoundingMode=null, ?string $taxRoundingMode=null, ?string $taxCalculationMode=null, ?string $inventoryMode=null, ?string $cartState=null, ?string $freezeStrategy=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, ?CustomFields $custom=null, ?DiscountTypeCombination $discountTypeCombination=null, ?CartLock $lock=null, ?int $deleteDaysAfterLastModification=null, ?string $purchaseOrderNumber=null, ?LastModifiedBy $lastModifiedBy=null, ?CreatedBy $createdBy=null)
setShippingRateInput(?ShippingRateInput $shippingRateInput)
setInventoryMode(?string $inventoryMode)
setDiscountOnTotalPrice(?DiscountOnTotalPrice $discountOnTotalPrice)
setTaxRoundingMode(?string $taxRoundingMode)
setShippingAddress(?Address $shippingAddress)
setDirectDiscounts(?DirectDiscountCollection $directDiscounts)
setPurchaseOrderNumber(?string $purchaseOrderNumber)
setTotalLineItemQuantity(?int $totalLineItemQuantity)
setPriceRoundingMode(?string $priceRoundingMode)
setLineItems(?LineItemCollection $lineItems)
setShippingCustomFields(?CustomFields $shippingCustomFields)
setItemShippingAddresses(?AddressCollection $itemShippingAddresses)
static fromArray(array $data)