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
205 protected $shippingMode;
206
211 protected $shippingKey;
212
217 protected $shippingInfo;
218
224
230
235 protected $shipping;
236
242
247 protected $discountCodes;
248
254
259 protected $refusedGifts;
260
265 protected $paymentInfo;
266
271 protected $country;
272
277 protected $locale;
278
283 protected $origin;
284
289 protected $custom;
290
296
302
308
313 protected $createdBy;
314
315
319 public function __construct(
320 ?string $id = null,
321 ?int $version = null,
322 ?DateTimeImmutable $createdAt = null,
323 ?DateTimeImmutable $lastModifiedAt = null,
324 ?string $key = null,
325 ?string $customerId = null,
326 ?string $customerEmail = null,
328 ?string $anonymousId = null,
333 ?int $totalLineItemQuantity = null,
335 ?TaxedPrice $taxedPrice = null,
338 ?string $taxMode = null,
339 ?string $priceRoundingMode = null,
340 ?string $taxRoundingMode = null,
341 ?string $taxCalculationMode = null,
342 ?string $inventoryMode = null,
343 ?string $cartState = null,
344 ?Address $billingAddress = null,
346 ?string $shippingMode = null,
347 ?string $shippingKey = null,
357 ?string $country = null,
358 ?string $locale = null,
359 ?string $origin = null,
360 ?CustomFields $custom = null,
364 ?CreatedBy $createdBy = null
365 ) {
366 $this->id = $id;
367 $this->version = $version;
368 $this->createdAt = $createdAt;
369 $this->lastModifiedAt = $lastModifiedAt;
370 $this->key = $key;
371 $this->customerId = $customerId;
372 $this->customerEmail = $customerEmail;
373 $this->customerGroup = $customerGroup;
374 $this->anonymousId = $anonymousId;
375 $this->businessUnit = $businessUnit;
376 $this->store = $store;
377 $this->lineItems = $lineItems;
378 $this->customLineItems = $customLineItems;
379 $this->totalLineItemQuantity = $totalLineItemQuantity;
380 $this->totalPrice = $totalPrice;
381 $this->taxedPrice = $taxedPrice;
382 $this->taxedShippingPrice = $taxedShippingPrice;
383 $this->discountOnTotalPrice = $discountOnTotalPrice;
384 $this->taxMode = $taxMode;
385 $this->priceRoundingMode = $priceRoundingMode;
386 $this->taxRoundingMode = $taxRoundingMode;
387 $this->taxCalculationMode = $taxCalculationMode;
388 $this->inventoryMode = $inventoryMode;
389 $this->cartState = $cartState;
390 $this->billingAddress = $billingAddress;
391 $this->shippingAddress = $shippingAddress;
392 $this->shippingMode = $shippingMode;
393 $this->shippingKey = $shippingKey;
394 $this->shippingInfo = $shippingInfo;
395 $this->shippingRateInput = $shippingRateInput;
396 $this->shippingCustomFields = $shippingCustomFields;
397 $this->shipping = $shipping;
398 $this->itemShippingAddresses = $itemShippingAddresses;
399 $this->discountCodes = $discountCodes;
400 $this->directDiscounts = $directDiscounts;
401 $this->refusedGifts = $refusedGifts;
402 $this->paymentInfo = $paymentInfo;
403 $this->country = $country;
404 $this->locale = $locale;
405 $this->origin = $origin;
406 $this->custom = $custom;
407 $this->discountTypeCombination = $discountTypeCombination;
408 $this->deleteDaysAfterLastModification = $deleteDaysAfterLastModification;
409 $this->lastModifiedBy = $lastModifiedBy;
410 $this->createdBy = $createdBy;
411 }
412
419 public function getId()
420 {
421 if (is_null($this->id)) {
423 $data = $this->raw(self::FIELD_ID);
424 if (is_null($data)) {
425 return null;
426 }
427 $this->id = (string) $data;
428 }
429
430 return $this->id;
431 }
432
439 public function getVersion()
440 {
441 if (is_null($this->version)) {
443 $data = $this->raw(self::FIELD_VERSION);
444 if (is_null($data)) {
445 return null;
446 }
447 $this->version = (int) $data;
448 }
449
450 return $this->version;
451 }
452
459 public function getCreatedAt()
460 {
461 if (is_null($this->createdAt)) {
463 $data = $this->raw(self::FIELD_CREATED_AT);
464 if (is_null($data)) {
465 return null;
466 }
467 $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data);
468 if (false === $data) {
469 return null;
470 }
471 $this->createdAt = $data;
472 }
473
474 return $this->createdAt;
475 }
476
483 public function getLastModifiedAt()
484 {
485 if (is_null($this->lastModifiedAt)) {
487 $data = $this->raw(self::FIELD_LAST_MODIFIED_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->lastModifiedAt = $data;
496 }
497
499 }
500
507 public function getKey()
508 {
509 if (is_null($this->key)) {
511 $data = $this->raw(self::FIELD_KEY);
512 if (is_null($data)) {
513 return null;
514 }
515 $this->key = (string) $data;
516 }
517
518 return $this->key;
519 }
520
527 public function getCustomerId()
528 {
529 if (is_null($this->customerId)) {
531 $data = $this->raw(self::FIELD_CUSTOMER_ID);
532 if (is_null($data)) {
533 return null;
534 }
535 $this->customerId = (string) $data;
536 }
537
538 return $this->customerId;
539 }
540
547 public function getCustomerEmail()
548 {
549 if (is_null($this->customerEmail)) {
551 $data = $this->raw(self::FIELD_CUSTOMER_EMAIL);
552 if (is_null($data)) {
553 return null;
554 }
555 $this->customerEmail = (string) $data;
556 }
557
559 }
560
567 public function getCustomerGroup()
568 {
569 if (is_null($this->customerGroup)) {
571 $data = $this->raw(self::FIELD_CUSTOMER_GROUP);
572 if (is_null($data)) {
573 return null;
574 }
575
576 $this->customerGroup = CustomerGroupReferenceModel::of($data);
577 }
578
580 }
581
588 public function getAnonymousId()
589 {
590 if (is_null($this->anonymousId)) {
592 $data = $this->raw(self::FIELD_ANONYMOUS_ID);
593 if (is_null($data)) {
594 return null;
595 }
596 $this->anonymousId = (string) $data;
597 }
598
599 return $this->anonymousId;
600 }
601
608 public function getBusinessUnit()
609 {
610 if (is_null($this->businessUnit)) {
612 $data = $this->raw(self::FIELD_BUSINESS_UNIT);
613 if (is_null($data)) {
614 return null;
615 }
616
617 $this->businessUnit = BusinessUnitKeyReferenceModel::of($data);
618 }
619
620 return $this->businessUnit;
621 }
622
629 public function getStore()
630 {
631 if (is_null($this->store)) {
633 $data = $this->raw(self::FIELD_STORE);
634 if (is_null($data)) {
635 return null;
636 }
637
638 $this->store = StoreKeyReferenceModel::of($data);
639 }
640
641 return $this->store;
642 }
643
650 public function getLineItems()
651 {
652 if (is_null($this->lineItems)) {
654 $data = $this->raw(self::FIELD_LINE_ITEMS);
655 if (is_null($data)) {
656 return null;
657 }
658 $this->lineItems = LineItemCollection::fromArray($data);
659 }
660
661 return $this->lineItems;
662 }
663
670 public function getCustomLineItems()
671 {
672 if (is_null($this->customLineItems)) {
674 $data = $this->raw(self::FIELD_CUSTOM_LINE_ITEMS);
675 if (is_null($data)) {
676 return null;
677 }
678 $this->customLineItems = CustomLineItemCollection::fromArray($data);
679 }
680
682 }
683
690 public function getTotalLineItemQuantity()
691 {
692 if (is_null($this->totalLineItemQuantity)) {
694 $data = $this->raw(self::FIELD_TOTAL_LINE_ITEM_QUANTITY);
695 if (is_null($data)) {
696 return null;
697 }
698 $this->totalLineItemQuantity = (int) $data;
699 }
700
702 }
703
712 public function getTotalPrice()
713 {
714 if (is_null($this->totalPrice)) {
716 $data = $this->raw(self::FIELD_TOTAL_PRICE);
717 if (is_null($data)) {
718 return null;
719 }
720
721 $this->totalPrice = CentPrecisionMoneyModel::of($data);
722 }
723
724 return $this->totalPrice;
725 }
726
737 public function getTaxedPrice()
738 {
739 if (is_null($this->taxedPrice)) {
741 $data = $this->raw(self::FIELD_TAXED_PRICE);
742 if (is_null($data)) {
743 return null;
744 }
745
746 $this->taxedPrice = TaxedPriceModel::of($data);
747 }
748
749 return $this->taxedPrice;
750 }
751
759 public function getTaxedShippingPrice()
760 {
761 if (is_null($this->taxedShippingPrice)) {
763 $data = $this->raw(self::FIELD_TAXED_SHIPPING_PRICE);
764 if (is_null($data)) {
765 return null;
766 }
767
768 $this->taxedShippingPrice = TaxedPriceModel::of($data);
769 }
770
772 }
773
780 public function getDiscountOnTotalPrice()
781 {
782 if (is_null($this->discountOnTotalPrice)) {
784 $data = $this->raw(self::FIELD_DISCOUNT_ON_TOTAL_PRICE);
785 if (is_null($data)) {
786 return null;
787 }
788
789 $this->discountOnTotalPrice = DiscountOnTotalPriceModel::of($data);
790 }
791
793 }
794
801 public function getTaxMode()
802 {
803 if (is_null($this->taxMode)) {
805 $data = $this->raw(self::FIELD_TAX_MODE);
806 if (is_null($data)) {
807 return null;
808 }
809 $this->taxMode = (string) $data;
810 }
811
812 return $this->taxMode;
813 }
814
821 public function getPriceRoundingMode()
822 {
823 if (is_null($this->priceRoundingMode)) {
825 $data = $this->raw(self::FIELD_PRICE_ROUNDING_MODE);
826 if (is_null($data)) {
827 return null;
828 }
829 $this->priceRoundingMode = (string) $data;
830 }
831
833 }
834
841 public function getTaxRoundingMode()
842 {
843 if (is_null($this->taxRoundingMode)) {
845 $data = $this->raw(self::FIELD_TAX_ROUNDING_MODE);
846 if (is_null($data)) {
847 return null;
848 }
849 $this->taxRoundingMode = (string) $data;
850 }
851
853 }
854
861 public function getTaxCalculationMode()
862 {
863 if (is_null($this->taxCalculationMode)) {
865 $data = $this->raw(self::FIELD_TAX_CALCULATION_MODE);
866 if (is_null($data)) {
867 return null;
868 }
869 $this->taxCalculationMode = (string) $data;
870 }
871
873 }
874
881 public function getInventoryMode()
882 {
883 if (is_null($this->inventoryMode)) {
885 $data = $this->raw(self::FIELD_INVENTORY_MODE);
886 if (is_null($data)) {
887 return null;
888 }
889 $this->inventoryMode = (string) $data;
890 }
891
893 }
894
901 public function getCartState()
902 {
903 if (is_null($this->cartState)) {
905 $data = $this->raw(self::FIELD_CART_STATE);
906 if (is_null($data)) {
907 return null;
908 }
909 $this->cartState = (string) $data;
910 }
911
912 return $this->cartState;
913 }
914
921 public function getBillingAddress()
922 {
923 if (is_null($this->billingAddress)) {
925 $data = $this->raw(self::FIELD_BILLING_ADDRESS);
926 if (is_null($data)) {
927 return null;
928 }
929
930 $this->billingAddress = AddressModel::of($data);
931 }
932
934 }
935
942 public function getShippingAddress()
943 {
944 if (is_null($this->shippingAddress)) {
946 $data = $this->raw(self::FIELD_SHIPPING_ADDRESS);
947 if (is_null($data)) {
948 return null;
949 }
950
951 $this->shippingAddress = AddressModel::of($data);
952 }
953
955 }
956
963 public function getShippingMode()
964 {
965 if (is_null($this->shippingMode)) {
967 $data = $this->raw(self::FIELD_SHIPPING_MODE);
968 if (is_null($data)) {
969 return null;
970 }
971 $this->shippingMode = (string) $data;
972 }
973
974 return $this->shippingMode;
975 }
976
983 public function getShippingKey()
984 {
985 if (is_null($this->shippingKey)) {
987 $data = $this->raw(self::FIELD_SHIPPING_KEY);
988 if (is_null($data)) {
989 return null;
990 }
991 $this->shippingKey = (string) $data;
992 }
993
994 return $this->shippingKey;
995 }
996
1003 public function getShippingInfo()
1004 {
1005 if (is_null($this->shippingInfo)) {
1007 $data = $this->raw(self::FIELD_SHIPPING_INFO);
1008 if (is_null($data)) {
1009 return null;
1010 }
1011
1012 $this->shippingInfo = ShippingInfoModel::of($data);
1013 }
1014
1015 return $this->shippingInfo;
1016 }
1017
1030 public function getShippingRateInput()
1031 {
1032 if (is_null($this->shippingRateInput)) {
1034 $data = $this->raw(self::FIELD_SHIPPING_RATE_INPUT);
1035 if (is_null($data)) {
1036 return null;
1037 }
1039 $this->shippingRateInput = $className::of($data);
1040 }
1041
1043 }
1044
1051 public function getShippingCustomFields()
1052 {
1053 if (is_null($this->shippingCustomFields)) {
1055 $data = $this->raw(self::FIELD_SHIPPING_CUSTOM_FIELDS);
1056 if (is_null($data)) {
1057 return null;
1058 }
1059
1060 $this->shippingCustomFields = CustomFieldsModel::of($data);
1061 }
1062
1064 }
1065
1072 public function getShipping()
1073 {
1074 if (is_null($this->shipping)) {
1076 $data = $this->raw(self::FIELD_SHIPPING);
1077 if (is_null($data)) {
1078 return null;
1079 }
1080 $this->shipping = ShippingCollection::fromArray($data);
1081 }
1082
1083 return $this->shipping;
1084 }
1085
1094 {
1095 if (is_null($this->itemShippingAddresses)) {
1097 $data = $this->raw(self::FIELD_ITEM_SHIPPING_ADDRESSES);
1098 if (is_null($data)) {
1099 return null;
1100 }
1101 $this->itemShippingAddresses = AddressCollection::fromArray($data);
1102 }
1103
1105 }
1106
1113 public function getDiscountCodes()
1114 {
1115 if (is_null($this->discountCodes)) {
1117 $data = $this->raw(self::FIELD_DISCOUNT_CODES);
1118 if (is_null($data)) {
1119 return null;
1120 }
1121 $this->discountCodes = DiscountCodeInfoCollection::fromArray($data);
1122 }
1123
1124 return $this->discountCodes;
1125 }
1126
1133 public function getDirectDiscounts()
1134 {
1135 if (is_null($this->directDiscounts)) {
1137 $data = $this->raw(self::FIELD_DIRECT_DISCOUNTS);
1138 if (is_null($data)) {
1139 return null;
1140 }
1141 $this->directDiscounts = DirectDiscountCollection::fromArray($data);
1142 }
1143
1145 }
1146
1153 public function getRefusedGifts()
1154 {
1155 if (is_null($this->refusedGifts)) {
1157 $data = $this->raw(self::FIELD_REFUSED_GIFTS);
1158 if (is_null($data)) {
1159 return null;
1160 }
1161 $this->refusedGifts = CartDiscountReferenceCollection::fromArray($data);
1162 }
1163
1164 return $this->refusedGifts;
1165 }
1166
1173 public function getPaymentInfo()
1174 {
1175 if (is_null($this->paymentInfo)) {
1177 $data = $this->raw(self::FIELD_PAYMENT_INFO);
1178 if (is_null($data)) {
1179 return null;
1180 }
1181
1182 $this->paymentInfo = PaymentInfoModel::of($data);
1183 }
1184
1185 return $this->paymentInfo;
1186 }
1187
1194 public function getCountry()
1195 {
1196 if (is_null($this->country)) {
1198 $data = $this->raw(self::FIELD_COUNTRY);
1199 if (is_null($data)) {
1200 return null;
1201 }
1202 $this->country = (string) $data;
1203 }
1204
1205 return $this->country;
1206 }
1207
1214 public function getLocale()
1215 {
1216 if (is_null($this->locale)) {
1218 $data = $this->raw(self::FIELD_LOCALE);
1219 if (is_null($data)) {
1220 return null;
1221 }
1222 $this->locale = (string) $data;
1223 }
1224
1225 return $this->locale;
1226 }
1227
1234 public function getOrigin()
1235 {
1236 if (is_null($this->origin)) {
1238 $data = $this->raw(self::FIELD_ORIGIN);
1239 if (is_null($data)) {
1240 return null;
1241 }
1242 $this->origin = (string) $data;
1243 }
1244
1245 return $this->origin;
1246 }
1247
1254 public function getCustom()
1255 {
1256 if (is_null($this->custom)) {
1258 $data = $this->raw(self::FIELD_CUSTOM);
1259 if (is_null($data)) {
1260 return null;
1261 }
1262
1263 $this->custom = CustomFieldsModel::of($data);
1264 }
1265
1266 return $this->custom;
1267 }
1268
1276 {
1277 if (is_null($this->discountTypeCombination)) {
1279 $data = $this->raw(self::FIELD_DISCOUNT_TYPE_COMBINATION);
1280 if (is_null($data)) {
1281 return null;
1282 }
1284 $this->discountTypeCombination = $className::of($data);
1285 }
1286
1288 }
1289
1297 {
1298 if (is_null($this->deleteDaysAfterLastModification)) {
1300 $data = $this->raw(self::FIELD_DELETE_DAYS_AFTER_LAST_MODIFICATION);
1301 if (is_null($data)) {
1302 return null;
1303 }
1304 $this->deleteDaysAfterLastModification = (int) $data;
1305 }
1306
1308 }
1309
1316 public function getLastModifiedBy()
1317 {
1318 if (is_null($this->lastModifiedBy)) {
1320 $data = $this->raw(self::FIELD_LAST_MODIFIED_BY);
1321 if (is_null($data)) {
1322 return null;
1323 }
1324
1325 $this->lastModifiedBy = LastModifiedByModel::of($data);
1326 }
1327
1328 return $this->lastModifiedBy;
1329 }
1330
1337 public function getCreatedBy()
1338 {
1339 if (is_null($this->createdBy)) {
1341 $data = $this->raw(self::FIELD_CREATED_BY);
1342 if (is_null($data)) {
1343 return null;
1344 }
1345
1346 $this->createdBy = CreatedByModel::of($data);
1347 }
1348
1349 return $this->createdBy;
1350 }
1351
1352
1356 public function setId(?string $id): void
1357 {
1358 $this->id = $id;
1359 }
1360
1364 public function setVersion(?int $version): void
1365 {
1366 $this->version = $version;
1367 }
1368
1372 public function setCreatedAt(?DateTimeImmutable $createdAt): void
1373 {
1374 $this->createdAt = $createdAt;
1375 }
1376
1380 public function setLastModifiedAt(?DateTimeImmutable $lastModifiedAt): void
1381 {
1382 $this->lastModifiedAt = $lastModifiedAt;
1383 }
1384
1388 public function setKey(?string $key): void
1389 {
1390 $this->key = $key;
1391 }
1392
1396 public function setCustomerId(?string $customerId): void
1397 {
1398 $this->customerId = $customerId;
1399 }
1400
1404 public function setCustomerEmail(?string $customerEmail): void
1405 {
1406 $this->customerEmail = $customerEmail;
1407 }
1408
1413 {
1414 $this->customerGroup = $customerGroup;
1415 }
1416
1420 public function setAnonymousId(?string $anonymousId): void
1421 {
1422 $this->anonymousId = $anonymousId;
1423 }
1424
1429 {
1430 $this->businessUnit = $businessUnit;
1431 }
1432
1436 public function setStore(?StoreKeyReference $store): void
1437 {
1438 $this->store = $store;
1439 }
1440
1445 {
1446 $this->lineItems = $lineItems;
1447 }
1448
1453 {
1454 $this->customLineItems = $customLineItems;
1455 }
1456
1461 {
1462 $this->totalLineItemQuantity = $totalLineItemQuantity;
1463 }
1464
1469 {
1470 $this->totalPrice = $totalPrice;
1471 }
1472
1476 public function setTaxedPrice(?TaxedPrice $taxedPrice): void
1477 {
1478 $this->taxedPrice = $taxedPrice;
1479 }
1480
1485 {
1486 $this->taxedShippingPrice = $taxedShippingPrice;
1487 }
1488
1493 {
1494 $this->discountOnTotalPrice = $discountOnTotalPrice;
1495 }
1496
1500 public function setTaxMode(?string $taxMode): void
1501 {
1502 $this->taxMode = $taxMode;
1503 }
1504
1508 public function setPriceRoundingMode(?string $priceRoundingMode): void
1509 {
1510 $this->priceRoundingMode = $priceRoundingMode;
1511 }
1512
1516 public function setTaxRoundingMode(?string $taxRoundingMode): void
1517 {
1518 $this->taxRoundingMode = $taxRoundingMode;
1519 }
1520
1524 public function setTaxCalculationMode(?string $taxCalculationMode): void
1525 {
1526 $this->taxCalculationMode = $taxCalculationMode;
1527 }
1528
1532 public function setInventoryMode(?string $inventoryMode): void
1533 {
1534 $this->inventoryMode = $inventoryMode;
1535 }
1536
1540 public function setCartState(?string $cartState): void
1541 {
1542 $this->cartState = $cartState;
1543 }
1544
1549 {
1550 $this->billingAddress = $billingAddress;
1551 }
1552
1557 {
1558 $this->shippingAddress = $shippingAddress;
1559 }
1560
1564 public function setShippingMode(?string $shippingMode): void
1565 {
1566 $this->shippingMode = $shippingMode;
1567 }
1568
1572 public function setShippingKey(?string $shippingKey): void
1573 {
1574 $this->shippingKey = $shippingKey;
1575 }
1576
1581 {
1582 $this->shippingInfo = $shippingInfo;
1583 }
1584
1589 {
1590 $this->shippingRateInput = $shippingRateInput;
1591 }
1592
1597 {
1598 $this->shippingCustomFields = $shippingCustomFields;
1599 }
1600
1605 {
1606 $this->shipping = $shipping;
1607 }
1608
1613 {
1614 $this->itemShippingAddresses = $itemShippingAddresses;
1615 }
1616
1621 {
1622 $this->discountCodes = $discountCodes;
1623 }
1624
1629 {
1630 $this->directDiscounts = $directDiscounts;
1631 }
1632
1637 {
1638 $this->refusedGifts = $refusedGifts;
1639 }
1640
1645 {
1646 $this->paymentInfo = $paymentInfo;
1647 }
1648
1652 public function setCountry(?string $country): void
1653 {
1654 $this->country = $country;
1655 }
1656
1660 public function setLocale(?string $locale): void
1661 {
1662 $this->locale = $locale;
1663 }
1664
1668 public function setOrigin(?string $origin): void
1669 {
1670 $this->origin = $origin;
1671 }
1672
1676 public function setCustom(?CustomFields $custom): void
1677 {
1678 $this->custom = $custom;
1679 }
1680
1685 {
1686 $this->discountTypeCombination = $discountTypeCombination;
1687 }
1688
1693 {
1694 $this->deleteDaysAfterLastModification = $deleteDaysAfterLastModification;
1695 }
1696
1701 {
1702 $this->lastModifiedBy = $lastModifiedBy;
1703 }
1704
1708 public function setCreatedBy(?CreatedBy $createdBy): void
1709 {
1710 $this->createdBy = $createdBy;
1711 }
1712
1713
1714 #[\ReturnTypeWillChange]
1715 public function jsonSerialize()
1716 {
1717 $data = $this->toArray();
1718 if (isset($data[Cart::FIELD_CREATED_AT]) && $data[Cart::FIELD_CREATED_AT] instanceof \DateTimeImmutable) {
1719 $data[Cart::FIELD_CREATED_AT] = $data[Cart::FIELD_CREATED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c');
1720 }
1721
1722 if (isset($data[Cart::FIELD_LAST_MODIFIED_AT]) && $data[Cart::FIELD_LAST_MODIFIED_AT] instanceof \DateTimeImmutable) {
1723 $data[Cart::FIELD_LAST_MODIFIED_AT] = $data[Cart::FIELD_LAST_MODIFIED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c');
1724 }
1725 return (object) $data;
1726 }
1727}
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)
setShippingRateInput(?ShippingRateInput $shippingRateInput)
__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, ?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, ?int $deleteDaysAfterLastModification=null, ?LastModifiedBy $lastModifiedBy=null, ?CreatedBy $createdBy=null)
setInventoryMode(?string $inventoryMode)
setDiscountOnTotalPrice(?DiscountOnTotalPrice $discountOnTotalPrice)
setTaxRoundingMode(?string $taxRoundingMode)
setShippingAddress(?Address $shippingAddress)
setDirectDiscounts(?DirectDiscountCollection $directDiscounts)
setTotalLineItemQuantity(?int $totalLineItemQuantity)
setPriceRoundingMode(?string $priceRoundingMode)
setLineItems(?LineItemCollection $lineItems)
setShippingCustomFields(?CustomFields $shippingCustomFields)
setItemShippingAddresses(?AddressCollection $itemShippingAddresses)
static fromArray(array $data)