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
38use DateTimeImmutable;
39use stdClass;
40
44final class CartModel extends JsonObjectModel implements Cart
45{
50 protected $id;
51
56 protected $version;
57
62 protected $createdAt;
63
68 protected $lastModifiedAt;
69
74 protected $key;
75
80 protected $customerId;
81
86 protected $customerEmail;
87
92 protected $customerGroup;
93
98 protected $anonymousId;
99
104 protected $businessUnit;
105
110 protected $store;
111
116 protected $lineItems;
117
123
129
134 protected $totalPrice;
135
140 protected $taxedPrice;
141
147
153
158 protected $taxMode;
159
165
171
177
182 protected $inventoryMode;
183
188 protected $cartState;
189
195
201
207
212 protected $shippingMode;
213
218 protected $shippingKey;
219
224 protected $shippingInfo;
225
231
237
242 protected $shipping;
243
249
254 protected $discountCodes;
255
261
267
272 protected $refusedGifts;
273
278 protected $paymentInfo;
279
284 protected $country;
285
290 protected $locale;
291
296 protected $origin;
297
302 protected $custom;
303
309
315
320 protected $lock;
321
327
333
339
344 protected $createdBy;
345
350 protected $warnings;
351
352
356 public function __construct(
357 ?string $id = null,
358 ?int $version = null,
359 ?DateTimeImmutable $createdAt = null,
360 ?DateTimeImmutable $lastModifiedAt = null,
361 ?string $key = null,
362 ?string $customerId = null,
363 ?string $customerEmail = null,
365 ?string $anonymousId = null,
370 ?int $totalLineItemQuantity = null,
372 ?TaxedPrice $taxedPrice = null,
375 ?string $taxMode = null,
376 ?string $priceRoundingMode = null,
377 ?string $taxRoundingMode = null,
378 ?string $taxCalculationMode = null,
379 ?string $inventoryMode = null,
380 ?string $cartState = null,
381 ?string $freezeStrategy = null,
382 ?Address $billingAddress = null,
384 ?string $shippingMode = null,
385 ?string $shippingKey = null,
396 ?string $country = null,
397 ?string $locale = null,
398 ?string $origin = null,
399 ?CustomFields $custom = null,
402 ?CartLock $lock = null,
404 ?string $purchaseOrderNumber = null,
406 ?CreatedBy $createdBy = null,
408 ) {
409 $this->id = $id;
410 $this->version = $version;
411 $this->createdAt = $createdAt;
412 $this->lastModifiedAt = $lastModifiedAt;
413 $this->key = $key;
414 $this->customerId = $customerId;
415 $this->customerEmail = $customerEmail;
416 $this->customerGroup = $customerGroup;
417 $this->anonymousId = $anonymousId;
418 $this->businessUnit = $businessUnit;
419 $this->store = $store;
420 $this->lineItems = $lineItems;
421 $this->customLineItems = $customLineItems;
422 $this->totalLineItemQuantity = $totalLineItemQuantity;
423 $this->totalPrice = $totalPrice;
424 $this->taxedPrice = $taxedPrice;
425 $this->taxedShippingPrice = $taxedShippingPrice;
426 $this->discountOnTotalPrice = $discountOnTotalPrice;
427 $this->taxMode = $taxMode;
428 $this->priceRoundingMode = $priceRoundingMode;
429 $this->taxRoundingMode = $taxRoundingMode;
430 $this->taxCalculationMode = $taxCalculationMode;
431 $this->inventoryMode = $inventoryMode;
432 $this->cartState = $cartState;
433 $this->freezeStrategy = $freezeStrategy;
434 $this->billingAddress = $billingAddress;
435 $this->shippingAddress = $shippingAddress;
436 $this->shippingMode = $shippingMode;
437 $this->shippingKey = $shippingKey;
438 $this->shippingInfo = $shippingInfo;
439 $this->shippingRateInput = $shippingRateInput;
440 $this->shippingCustomFields = $shippingCustomFields;
441 $this->shipping = $shipping;
442 $this->itemShippingAddresses = $itemShippingAddresses;
443 $this->discountCodes = $discountCodes;
444 $this->directDiscounts = $directDiscounts;
445 $this->directDiscountsIgnoreCartDiscounts = $directDiscountsIgnoreCartDiscounts;
446 $this->refusedGifts = $refusedGifts;
447 $this->paymentInfo = $paymentInfo;
448 $this->country = $country;
449 $this->locale = $locale;
450 $this->origin = $origin;
451 $this->custom = $custom;
452 $this->recurringPaymentConfiguration = $recurringPaymentConfiguration;
453 $this->discountTypeCombination = $discountTypeCombination;
454 $this->lock = $lock;
455 $this->deleteDaysAfterLastModification = $deleteDaysAfterLastModification;
456 $this->purchaseOrderNumber = $purchaseOrderNumber;
457 $this->lastModifiedBy = $lastModifiedBy;
458 $this->createdBy = $createdBy;
459 $this->warnings = $warnings;
460 }
461
468 public function getId()
469 {
470 if (is_null($this->id)) {
472 $data = $this->raw(self::FIELD_ID);
473 if (is_null($data)) {
474 return null;
475 }
476 $this->id = (string) $data;
477 }
478
479 return $this->id;
480 }
481
488 public function getVersion()
489 {
490 if (is_null($this->version)) {
492 $data = $this->raw(self::FIELD_VERSION);
493 if (is_null($data)) {
494 return null;
495 }
496 $this->version = (int) $data;
497 }
498
499 return $this->version;
500 }
501
508 public function getCreatedAt()
509 {
510 if (is_null($this->createdAt)) {
512 $data = $this->raw(self::FIELD_CREATED_AT);
513 if (is_null($data)) {
514 return null;
515 }
516 $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data);
517 if (false === $data) {
518 return null;
519 }
520 $this->createdAt = $data;
521 }
522
523 return $this->createdAt;
524 }
525
532 public function getLastModifiedAt()
533 {
534 if (is_null($this->lastModifiedAt)) {
536 $data = $this->raw(self::FIELD_LAST_MODIFIED_AT);
537 if (is_null($data)) {
538 return null;
539 }
540 $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data);
541 if (false === $data) {
542 return null;
543 }
544 $this->lastModifiedAt = $data;
545 }
546
548 }
549
556 public function getKey()
557 {
558 if (is_null($this->key)) {
560 $data = $this->raw(self::FIELD_KEY);
561 if (is_null($data)) {
562 return null;
563 }
564 $this->key = (string) $data;
565 }
566
567 return $this->key;
568 }
569
576 public function getCustomerId()
577 {
578 if (is_null($this->customerId)) {
580 $data = $this->raw(self::FIELD_CUSTOMER_ID);
581 if (is_null($data)) {
582 return null;
583 }
584 $this->customerId = (string) $data;
585 }
586
587 return $this->customerId;
588 }
589
596 public function getCustomerEmail()
597 {
598 if (is_null($this->customerEmail)) {
600 $data = $this->raw(self::FIELD_CUSTOMER_EMAIL);
601 if (is_null($data)) {
602 return null;
603 }
604 $this->customerEmail = (string) $data;
605 }
606
608 }
609
616 public function getCustomerGroup()
617 {
618 if (is_null($this->customerGroup)) {
620 $data = $this->raw(self::FIELD_CUSTOMER_GROUP);
621 if (is_null($data)) {
622 return null;
623 }
624
625 $this->customerGroup = CustomerGroupReferenceModel::of($data);
626 }
627
629 }
630
637 public function getAnonymousId()
638 {
639 if (is_null($this->anonymousId)) {
641 $data = $this->raw(self::FIELD_ANONYMOUS_ID);
642 if (is_null($data)) {
643 return null;
644 }
645 $this->anonymousId = (string) $data;
646 }
647
648 return $this->anonymousId;
649 }
650
657 public function getBusinessUnit()
658 {
659 if (is_null($this->businessUnit)) {
661 $data = $this->raw(self::FIELD_BUSINESS_UNIT);
662 if (is_null($data)) {
663 return null;
664 }
665
666 $this->businessUnit = BusinessUnitKeyReferenceModel::of($data);
667 }
668
669 return $this->businessUnit;
670 }
671
678 public function getStore()
679 {
680 if (is_null($this->store)) {
682 $data = $this->raw(self::FIELD_STORE);
683 if (is_null($data)) {
684 return null;
685 }
686
687 $this->store = StoreKeyReferenceModel::of($data);
688 }
689
690 return $this->store;
691 }
692
699 public function getLineItems()
700 {
701 if (is_null($this->lineItems)) {
703 $data = $this->raw(self::FIELD_LINE_ITEMS);
704 if (is_null($data)) {
705 return null;
706 }
707 $this->lineItems = LineItemCollection::fromArray($data);
708 }
709
710 return $this->lineItems;
711 }
712
719 public function getCustomLineItems()
720 {
721 if (is_null($this->customLineItems)) {
723 $data = $this->raw(self::FIELD_CUSTOM_LINE_ITEMS);
724 if (is_null($data)) {
725 return null;
726 }
727 $this->customLineItems = CustomLineItemCollection::fromArray($data);
728 }
729
731 }
732
739 public function getTotalLineItemQuantity()
740 {
741 if (is_null($this->totalLineItemQuantity)) {
743 $data = $this->raw(self::FIELD_TOTAL_LINE_ITEM_QUANTITY);
744 if (is_null($data)) {
745 return null;
746 }
747 $this->totalLineItemQuantity = (int) $data;
748 }
749
751 }
752
761 public function getTotalPrice()
762 {
763 if (is_null($this->totalPrice)) {
765 $data = $this->raw(self::FIELD_TOTAL_PRICE);
766 if (is_null($data)) {
767 return null;
768 }
769
770 $this->totalPrice = CentPrecisionMoneyModel::of($data);
771 }
772
773 return $this->totalPrice;
774 }
775
786 public function getTaxedPrice()
787 {
788 if (is_null($this->taxedPrice)) {
790 $data = $this->raw(self::FIELD_TAXED_PRICE);
791 if (is_null($data)) {
792 return null;
793 }
794
795 $this->taxedPrice = TaxedPriceModel::of($data);
796 }
797
798 return $this->taxedPrice;
799 }
800
808 public function getTaxedShippingPrice()
809 {
810 if (is_null($this->taxedShippingPrice)) {
812 $data = $this->raw(self::FIELD_TAXED_SHIPPING_PRICE);
813 if (is_null($data)) {
814 return null;
815 }
816
817 $this->taxedShippingPrice = TaxedPriceModel::of($data);
818 }
819
821 }
822
829 public function getDiscountOnTotalPrice()
830 {
831 if (is_null($this->discountOnTotalPrice)) {
833 $data = $this->raw(self::FIELD_DISCOUNT_ON_TOTAL_PRICE);
834 if (is_null($data)) {
835 return null;
836 }
837
838 $this->discountOnTotalPrice = DiscountOnTotalPriceModel::of($data);
839 }
840
842 }
843
850 public function getTaxMode()
851 {
852 if (is_null($this->taxMode)) {
854 $data = $this->raw(self::FIELD_TAX_MODE);
855 if (is_null($data)) {
856 return null;
857 }
858 $this->taxMode = (string) $data;
859 }
860
861 return $this->taxMode;
862 }
863
870 public function getPriceRoundingMode()
871 {
872 if (is_null($this->priceRoundingMode)) {
874 $data = $this->raw(self::FIELD_PRICE_ROUNDING_MODE);
875 if (is_null($data)) {
876 return null;
877 }
878 $this->priceRoundingMode = (string) $data;
879 }
880
882 }
883
890 public function getTaxRoundingMode()
891 {
892 if (is_null($this->taxRoundingMode)) {
894 $data = $this->raw(self::FIELD_TAX_ROUNDING_MODE);
895 if (is_null($data)) {
896 return null;
897 }
898 $this->taxRoundingMode = (string) $data;
899 }
900
902 }
903
910 public function getTaxCalculationMode()
911 {
912 if (is_null($this->taxCalculationMode)) {
914 $data = $this->raw(self::FIELD_TAX_CALCULATION_MODE);
915 if (is_null($data)) {
916 return null;
917 }
918 $this->taxCalculationMode = (string) $data;
919 }
920
922 }
923
930 public function getInventoryMode()
931 {
932 if (is_null($this->inventoryMode)) {
934 $data = $this->raw(self::FIELD_INVENTORY_MODE);
935 if (is_null($data)) {
936 return null;
937 }
938 $this->inventoryMode = (string) $data;
939 }
940
942 }
943
950 public function getCartState()
951 {
952 if (is_null($this->cartState)) {
954 $data = $this->raw(self::FIELD_CART_STATE);
955 if (is_null($data)) {
956 return null;
957 }
958 $this->cartState = (string) $data;
959 }
960
961 return $this->cartState;
962 }
963
970 public function getFreezeStrategy()
971 {
972 if (is_null($this->freezeStrategy)) {
974 $data = $this->raw(self::FIELD_FREEZE_STRATEGY);
975 if (is_null($data)) {
976 return null;
977 }
978 $this->freezeStrategy = (string) $data;
979 }
980
982 }
983
990 public function getBillingAddress()
991 {
992 if (is_null($this->billingAddress)) {
994 $data = $this->raw(self::FIELD_BILLING_ADDRESS);
995 if (is_null($data)) {
996 return null;
997 }
998
999 $this->billingAddress = AddressModel::of($data);
1000 }
1001
1002 return $this->billingAddress;
1003 }
1004
1011 public function getShippingAddress()
1012 {
1013 if (is_null($this->shippingAddress)) {
1015 $data = $this->raw(self::FIELD_SHIPPING_ADDRESS);
1016 if (is_null($data)) {
1017 return null;
1018 }
1019
1020 $this->shippingAddress = AddressModel::of($data);
1021 }
1022
1024 }
1025
1032 public function getShippingMode()
1033 {
1034 if (is_null($this->shippingMode)) {
1036 $data = $this->raw(self::FIELD_SHIPPING_MODE);
1037 if (is_null($data)) {
1038 return null;
1039 }
1040 $this->shippingMode = (string) $data;
1041 }
1042
1043 return $this->shippingMode;
1044 }
1045
1052 public function getShippingKey()
1053 {
1054 if (is_null($this->shippingKey)) {
1056 $data = $this->raw(self::FIELD_SHIPPING_KEY);
1057 if (is_null($data)) {
1058 return null;
1059 }
1060 $this->shippingKey = (string) $data;
1061 }
1062
1063 return $this->shippingKey;
1064 }
1065
1072 public function getShippingInfo()
1073 {
1074 if (is_null($this->shippingInfo)) {
1076 $data = $this->raw(self::FIELD_SHIPPING_INFO);
1077 if (is_null($data)) {
1078 return null;
1079 }
1080
1081 $this->shippingInfo = ShippingInfoModel::of($data);
1082 }
1083
1084 return $this->shippingInfo;
1085 }
1086
1099 public function getShippingRateInput()
1100 {
1101 if (is_null($this->shippingRateInput)) {
1103 $data = $this->raw(self::FIELD_SHIPPING_RATE_INPUT);
1104 if (is_null($data)) {
1105 return null;
1106 }
1108 $this->shippingRateInput = $className::of($data);
1109 }
1110
1112 }
1113
1120 public function getShippingCustomFields()
1121 {
1122 if (is_null($this->shippingCustomFields)) {
1124 $data = $this->raw(self::FIELD_SHIPPING_CUSTOM_FIELDS);
1125 if (is_null($data)) {
1126 return null;
1127 }
1128
1129 $this->shippingCustomFields = CustomFieldsModel::of($data);
1130 }
1131
1133 }
1134
1141 public function getShipping()
1142 {
1143 if (is_null($this->shipping)) {
1145 $data = $this->raw(self::FIELD_SHIPPING);
1146 if (is_null($data)) {
1147 return null;
1148 }
1149 $this->shipping = ShippingCollection::fromArray($data);
1150 }
1151
1152 return $this->shipping;
1153 }
1154
1163 {
1164 if (is_null($this->itemShippingAddresses)) {
1166 $data = $this->raw(self::FIELD_ITEM_SHIPPING_ADDRESSES);
1167 if (is_null($data)) {
1168 return null;
1169 }
1170 $this->itemShippingAddresses = AddressCollection::fromArray($data);
1171 }
1172
1174 }
1175
1183 public function getDiscountCodes()
1184 {
1185 if (is_null($this->discountCodes)) {
1187 $data = $this->raw(self::FIELD_DISCOUNT_CODES);
1188 if (is_null($data)) {
1189 return null;
1190 }
1191 $this->discountCodes = DiscountCodeInfoCollection::fromArray($data);
1192 }
1193
1194 return $this->discountCodes;
1195 }
1196
1204 public function getDirectDiscounts()
1205 {
1206 if (is_null($this->directDiscounts)) {
1208 $data = $this->raw(self::FIELD_DIRECT_DISCOUNTS);
1209 if (is_null($data)) {
1210 return null;
1211 }
1212 $this->directDiscounts = DirectDiscountCollection::fromArray($data);
1213 }
1214
1216 }
1217
1228 {
1229 if (is_null($this->directDiscountsIgnoreCartDiscounts)) {
1231 $data = $this->raw(self::FIELD_DIRECT_DISCOUNTS_IGNORE_CART_DISCOUNTS);
1232 if (is_null($data)) {
1233 return null;
1234 }
1235 $this->directDiscountsIgnoreCartDiscounts = (bool) $data;
1236 }
1237
1239 }
1240
1247 public function getRefusedGifts()
1248 {
1249 if (is_null($this->refusedGifts)) {
1251 $data = $this->raw(self::FIELD_REFUSED_GIFTS);
1252 if (is_null($data)) {
1253 return null;
1254 }
1255 $this->refusedGifts = CartDiscountReferenceCollection::fromArray($data);
1256 }
1257
1258 return $this->refusedGifts;
1259 }
1260
1267 public function getPaymentInfo()
1268 {
1269 if (is_null($this->paymentInfo)) {
1271 $data = $this->raw(self::FIELD_PAYMENT_INFO);
1272 if (is_null($data)) {
1273 return null;
1274 }
1275
1276 $this->paymentInfo = PaymentInfoModel::of($data);
1277 }
1278
1279 return $this->paymentInfo;
1280 }
1281
1288 public function getCountry()
1289 {
1290 if (is_null($this->country)) {
1292 $data = $this->raw(self::FIELD_COUNTRY);
1293 if (is_null($data)) {
1294 return null;
1295 }
1296 $this->country = (string) $data;
1297 }
1298
1299 return $this->country;
1300 }
1301
1308 public function getLocale()
1309 {
1310 if (is_null($this->locale)) {
1312 $data = $this->raw(self::FIELD_LOCALE);
1313 if (is_null($data)) {
1314 return null;
1315 }
1316 $this->locale = (string) $data;
1317 }
1318
1319 return $this->locale;
1320 }
1321
1328 public function getOrigin()
1329 {
1330 if (is_null($this->origin)) {
1332 $data = $this->raw(self::FIELD_ORIGIN);
1333 if (is_null($data)) {
1334 return null;
1335 }
1336 $this->origin = (string) $data;
1337 }
1338
1339 return $this->origin;
1340 }
1341
1348 public function getCustom()
1349 {
1350 if (is_null($this->custom)) {
1352 $data = $this->raw(self::FIELD_CUSTOM);
1353 if (is_null($data)) {
1354 return null;
1355 }
1356
1357 $this->custom = CustomFieldsModel::of($data);
1358 }
1359
1360 return $this->custom;
1361 }
1362
1370 {
1371 if (is_null($this->recurringPaymentConfiguration)) {
1373 $data = $this->raw(self::FIELD_RECURRING_PAYMENT_CONFIGURATION);
1374 if (is_null($data)) {
1375 return null;
1376 }
1377
1378 $this->recurringPaymentConfiguration = RecurringPaymentConfigurationModel::of($data);
1379 }
1380
1382 }
1383
1391 {
1392 if (is_null($this->discountTypeCombination)) {
1394 $data = $this->raw(self::FIELD_DISCOUNT_TYPE_COMBINATION);
1395 if (is_null($data)) {
1396 return null;
1397 }
1399 $this->discountTypeCombination = $className::of($data);
1400 }
1401
1403 }
1404
1411 public function getLock()
1412 {
1413 if (is_null($this->lock)) {
1415 $data = $this->raw(self::FIELD_LOCK);
1416 if (is_null($data)) {
1417 return null;
1418 }
1419
1420 $this->lock = CartLockModel::of($data);
1421 }
1422
1423 return $this->lock;
1424 }
1425
1433 {
1434 if (is_null($this->deleteDaysAfterLastModification)) {
1436 $data = $this->raw(self::FIELD_DELETE_DAYS_AFTER_LAST_MODIFICATION);
1437 if (is_null($data)) {
1438 return null;
1439 }
1440 $this->deleteDaysAfterLastModification = (int) $data;
1441 }
1442
1444 }
1445
1453 public function getPurchaseOrderNumber()
1454 {
1455 if (is_null($this->purchaseOrderNumber)) {
1457 $data = $this->raw(self::FIELD_PURCHASE_ORDER_NUMBER);
1458 if (is_null($data)) {
1459 return null;
1460 }
1461 $this->purchaseOrderNumber = (string) $data;
1462 }
1463
1465 }
1466
1473 public function getLastModifiedBy()
1474 {
1475 if (is_null($this->lastModifiedBy)) {
1477 $data = $this->raw(self::FIELD_LAST_MODIFIED_BY);
1478 if (is_null($data)) {
1479 return null;
1480 }
1481
1482 $this->lastModifiedBy = LastModifiedByModel::of($data);
1483 }
1484
1485 return $this->lastModifiedBy;
1486 }
1487
1494 public function getCreatedBy()
1495 {
1496 if (is_null($this->createdBy)) {
1498 $data = $this->raw(self::FIELD_CREATED_BY);
1499 if (is_null($data)) {
1500 return null;
1501 }
1502
1503 $this->createdBy = CreatedByModel::of($data);
1504 }
1505
1506 return $this->createdBy;
1507 }
1508
1515 public function getWarnings()
1516 {
1517 if (is_null($this->warnings)) {
1519 $data = $this->raw(self::FIELD_WARNINGS);
1520 if (is_null($data)) {
1521 return null;
1522 }
1523 $this->warnings = WarningObjectCollection::fromArray($data);
1524 }
1525
1526 return $this->warnings;
1527 }
1528
1529
1533 public function setId(?string $id): void
1534 {
1535 $this->id = $id;
1536 }
1537
1541 public function setVersion(?int $version): void
1542 {
1543 $this->version = $version;
1544 }
1545
1549 public function setCreatedAt(?DateTimeImmutable $createdAt): void
1550 {
1551 $this->createdAt = $createdAt;
1552 }
1553
1557 public function setLastModifiedAt(?DateTimeImmutable $lastModifiedAt): void
1558 {
1559 $this->lastModifiedAt = $lastModifiedAt;
1560 }
1561
1565 public function setKey(?string $key): void
1566 {
1567 $this->key = $key;
1568 }
1569
1573 public function setCustomerId(?string $customerId): void
1574 {
1575 $this->customerId = $customerId;
1576 }
1577
1581 public function setCustomerEmail(?string $customerEmail): void
1582 {
1583 $this->customerEmail = $customerEmail;
1584 }
1585
1590 {
1591 $this->customerGroup = $customerGroup;
1592 }
1593
1597 public function setAnonymousId(?string $anonymousId): void
1598 {
1599 $this->anonymousId = $anonymousId;
1600 }
1601
1606 {
1607 $this->businessUnit = $businessUnit;
1608 }
1609
1613 public function setStore(?StoreKeyReference $store): void
1614 {
1615 $this->store = $store;
1616 }
1617
1622 {
1623 $this->lineItems = $lineItems;
1624 }
1625
1630 {
1631 $this->customLineItems = $customLineItems;
1632 }
1633
1638 {
1639 $this->totalLineItemQuantity = $totalLineItemQuantity;
1640 }
1641
1646 {
1647 $this->totalPrice = $totalPrice;
1648 }
1649
1653 public function setTaxedPrice(?TaxedPrice $taxedPrice): void
1654 {
1655 $this->taxedPrice = $taxedPrice;
1656 }
1657
1662 {
1663 $this->taxedShippingPrice = $taxedShippingPrice;
1664 }
1665
1670 {
1671 $this->discountOnTotalPrice = $discountOnTotalPrice;
1672 }
1673
1677 public function setTaxMode(?string $taxMode): void
1678 {
1679 $this->taxMode = $taxMode;
1680 }
1681
1685 public function setPriceRoundingMode(?string $priceRoundingMode): void
1686 {
1687 $this->priceRoundingMode = $priceRoundingMode;
1688 }
1689
1693 public function setTaxRoundingMode(?string $taxRoundingMode): void
1694 {
1695 $this->taxRoundingMode = $taxRoundingMode;
1696 }
1697
1701 public function setTaxCalculationMode(?string $taxCalculationMode): void
1702 {
1703 $this->taxCalculationMode = $taxCalculationMode;
1704 }
1705
1709 public function setInventoryMode(?string $inventoryMode): void
1710 {
1711 $this->inventoryMode = $inventoryMode;
1712 }
1713
1717 public function setCartState(?string $cartState): void
1718 {
1719 $this->cartState = $cartState;
1720 }
1721
1725 public function setFreezeStrategy(?string $freezeStrategy): void
1726 {
1727 $this->freezeStrategy = $freezeStrategy;
1728 }
1729
1734 {
1735 $this->billingAddress = $billingAddress;
1736 }
1737
1742 {
1743 $this->shippingAddress = $shippingAddress;
1744 }
1745
1749 public function setShippingMode(?string $shippingMode): void
1750 {
1751 $this->shippingMode = $shippingMode;
1752 }
1753
1757 public function setShippingKey(?string $shippingKey): void
1758 {
1759 $this->shippingKey = $shippingKey;
1760 }
1761
1766 {
1767 $this->shippingInfo = $shippingInfo;
1768 }
1769
1774 {
1775 $this->shippingRateInput = $shippingRateInput;
1776 }
1777
1782 {
1783 $this->shippingCustomFields = $shippingCustomFields;
1784 }
1785
1790 {
1791 $this->shipping = $shipping;
1792 }
1793
1798 {
1799 $this->itemShippingAddresses = $itemShippingAddresses;
1800 }
1801
1806 {
1807 $this->discountCodes = $discountCodes;
1808 }
1809
1814 {
1815 $this->directDiscounts = $directDiscounts;
1816 }
1817
1822 {
1823 $this->directDiscountsIgnoreCartDiscounts = $directDiscountsIgnoreCartDiscounts;
1824 }
1825
1830 {
1831 $this->refusedGifts = $refusedGifts;
1832 }
1833
1838 {
1839 $this->paymentInfo = $paymentInfo;
1840 }
1841
1845 public function setCountry(?string $country): void
1846 {
1847 $this->country = $country;
1848 }
1849
1853 public function setLocale(?string $locale): void
1854 {
1855 $this->locale = $locale;
1856 }
1857
1861 public function setOrigin(?string $origin): void
1862 {
1863 $this->origin = $origin;
1864 }
1865
1869 public function setCustom(?CustomFields $custom): void
1870 {
1871 $this->custom = $custom;
1872 }
1873
1878 {
1879 $this->recurringPaymentConfiguration = $recurringPaymentConfiguration;
1880 }
1881
1886 {
1887 $this->discountTypeCombination = $discountTypeCombination;
1888 }
1889
1893 public function setLock(?CartLock $lock): void
1894 {
1895 $this->lock = $lock;
1896 }
1897
1902 {
1903 $this->deleteDaysAfterLastModification = $deleteDaysAfterLastModification;
1904 }
1905
1909 public function setPurchaseOrderNumber(?string $purchaseOrderNumber): void
1910 {
1911 $this->purchaseOrderNumber = $purchaseOrderNumber;
1912 }
1913
1918 {
1919 $this->lastModifiedBy = $lastModifiedBy;
1920 }
1921
1925 public function setCreatedBy(?CreatedBy $createdBy): void
1926 {
1927 $this->createdBy = $createdBy;
1928 }
1929
1934 {
1935 $this->warnings = $warnings;
1936 }
1937
1938
1939 #[\ReturnTypeWillChange]
1940 public function jsonSerialize()
1941 {
1942 $data = $this->toArray();
1943 if (isset($data[Cart::FIELD_CREATED_AT]) && $data[Cart::FIELD_CREATED_AT] instanceof \DateTimeImmutable) {
1944 $data[Cart::FIELD_CREATED_AT] = $data[Cart::FIELD_CREATED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c');
1945 }
1946
1947 if (isset($data[Cart::FIELD_LAST_MODIFIED_AT]) && $data[Cart::FIELD_LAST_MODIFIED_AT] instanceof \DateTimeImmutable) {
1948 $data[Cart::FIELD_LAST_MODIFIED_AT] = $data[Cart::FIELD_LAST_MODIFIED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c');
1949 }
1950 return (object) $data;
1951 }
1952}
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)
setRecurringPaymentConfiguration(?RecurringPaymentConfiguration $recurringPaymentConfiguration)
setLastModifiedBy(?LastModifiedBy $lastModifiedBy)
setShippingMode(?string $shippingMode)
setTaxedPrice(?TaxedPrice $taxedPrice)
setShippingInfo(?ShippingInfo $shippingInfo)
setPaymentInfo(?PaymentInfo $paymentInfo)
setCreatedAt(?DateTimeImmutable $createdAt)
setDirectDiscountsIgnoreCartDiscounts(?bool $directDiscountsIgnoreCartDiscounts)
setShippingRateInput(?ShippingRateInput $shippingRateInput)
setWarnings(?WarningObjectCollection $warnings)
setInventoryMode(?string $inventoryMode)
setDiscountOnTotalPrice(?DiscountOnTotalPrice $discountOnTotalPrice)
__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, ?bool $directDiscountsIgnoreCartDiscounts=null, ?CartDiscountReferenceCollection $refusedGifts=null, ?PaymentInfo $paymentInfo=null, ?string $country=null, ?string $locale=null, ?string $origin=null, ?CustomFields $custom=null, ?RecurringPaymentConfiguration $recurringPaymentConfiguration=null, ?DiscountTypeCombination $discountTypeCombination=null, ?CartLock $lock=null, ?int $deleteDaysAfterLastModification=null, ?string $purchaseOrderNumber=null, ?LastModifiedBy $lastModifiedBy=null, ?CreatedBy $createdBy=null, ?WarningObjectCollection $warnings=null)
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)