commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
CartModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
37 use DateTimeImmutable;
38 use stdClass;
39 
43 final 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 
121  protected $customLineItems;
122 
128 
133  protected $totalPrice;
134 
139  protected $taxedPrice;
140 
146 
152 
157  protected $taxMode;
158 
163  protected $taxRoundingMode;
164 
170 
175  protected $inventoryMode;
176 
181  protected $cartState;
182 
187  protected $billingAddress;
188 
193  protected $shippingAddress;
194 
199  protected $shippingMode;
200 
205  protected $shippingKey;
206 
211  protected $shippingInfo;
212 
218 
224 
229  protected $shipping;
230 
236 
241  protected $discountCodes;
242 
247  protected $directDiscounts;
248 
253  protected $refusedGifts;
254 
259  protected $paymentInfo;
260 
265  protected $country;
266 
271  protected $locale;
272 
277  protected $origin;
278 
283  protected $custom;
284 
290 
295  protected $lastModifiedBy;
296 
301  protected $createdBy;
302 
303 
307  public function __construct(
308  ?string $id = null,
309  ?int $version = null,
310  ?DateTimeImmutable $createdAt = null,
311  ?DateTimeImmutable $lastModifiedAt = null,
312  ?string $key = null,
313  ?string $customerId = null,
314  ?string $customerEmail = null,
316  ?string $anonymousId = null,
318  ?StoreKeyReference $store = null,
321  ?int $totalLineItemQuantity = null,
323  ?TaxedPrice $taxedPrice = null,
326  ?string $taxMode = null,
327  ?string $taxRoundingMode = null,
328  ?string $taxCalculationMode = null,
329  ?string $inventoryMode = null,
330  ?string $cartState = null,
331  ?Address $billingAddress = null,
332  ?Address $shippingAddress = null,
333  ?string $shippingMode = null,
334  ?string $shippingKey = null,
335  ?ShippingInfo $shippingInfo = null,
343  ?PaymentInfo $paymentInfo = null,
344  ?string $country = null,
345  ?string $locale = null,
346  ?string $origin = null,
347  ?CustomFields $custom = null,
350  ?CreatedBy $createdBy = null
351  ) {
352  $this->id = $id;
353  $this->version = $version;
354  $this->createdAt = $createdAt;
355  $this->lastModifiedAt = $lastModifiedAt;
356  $this->key = $key;
357  $this->customerId = $customerId;
358  $this->customerEmail = $customerEmail;
359  $this->customerGroup = $customerGroup;
360  $this->anonymousId = $anonymousId;
361  $this->businessUnit = $businessUnit;
362  $this->store = $store;
363  $this->lineItems = $lineItems;
364  $this->customLineItems = $customLineItems;
365  $this->totalLineItemQuantity = $totalLineItemQuantity;
366  $this->totalPrice = $totalPrice;
367  $this->taxedPrice = $taxedPrice;
368  $this->taxedShippingPrice = $taxedShippingPrice;
369  $this->discountOnTotalPrice = $discountOnTotalPrice;
370  $this->taxMode = $taxMode;
371  $this->taxRoundingMode = $taxRoundingMode;
372  $this->taxCalculationMode = $taxCalculationMode;
373  $this->inventoryMode = $inventoryMode;
374  $this->cartState = $cartState;
375  $this->billingAddress = $billingAddress;
376  $this->shippingAddress = $shippingAddress;
377  $this->shippingMode = $shippingMode;
378  $this->shippingKey = $shippingKey;
379  $this->shippingInfo = $shippingInfo;
380  $this->shippingRateInput = $shippingRateInput;
381  $this->shippingCustomFields = $shippingCustomFields;
382  $this->shipping = $shipping;
383  $this->itemShippingAddresses = $itemShippingAddresses;
384  $this->discountCodes = $discountCodes;
385  $this->directDiscounts = $directDiscounts;
386  $this->refusedGifts = $refusedGifts;
387  $this->paymentInfo = $paymentInfo;
388  $this->country = $country;
389  $this->locale = $locale;
390  $this->origin = $origin;
391  $this->custom = $custom;
392  $this->deleteDaysAfterLastModification = $deleteDaysAfterLastModification;
393  $this->lastModifiedBy = $lastModifiedBy;
394  $this->createdBy = $createdBy;
395  }
396 
403  public function getId()
404  {
405  if (is_null($this->id)) {
407  $data = $this->raw(self::FIELD_ID);
408  if (is_null($data)) {
409  return null;
410  }
411  $this->id = (string) $data;
412  }
413 
414  return $this->id;
415  }
416 
423  public function getVersion()
424  {
425  if (is_null($this->version)) {
427  $data = $this->raw(self::FIELD_VERSION);
428  if (is_null($data)) {
429  return null;
430  }
431  $this->version = (int) $data;
432  }
433 
434  return $this->version;
435  }
436 
443  public function getCreatedAt()
444  {
445  if (is_null($this->createdAt)) {
447  $data = $this->raw(self::FIELD_CREATED_AT);
448  if (is_null($data)) {
449  return null;
450  }
451  $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data);
452  if (false === $data) {
453  return null;
454  }
455  $this->createdAt = $data;
456  }
457 
458  return $this->createdAt;
459  }
460 
467  public function getLastModifiedAt()
468  {
469  if (is_null($this->lastModifiedAt)) {
471  $data = $this->raw(self::FIELD_LAST_MODIFIED_AT);
472  if (is_null($data)) {
473  return null;
474  }
475  $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data);
476  if (false === $data) {
477  return null;
478  }
479  $this->lastModifiedAt = $data;
480  }
481 
482  return $this->lastModifiedAt;
483  }
484 
491  public function getKey()
492  {
493  if (is_null($this->key)) {
495  $data = $this->raw(self::FIELD_KEY);
496  if (is_null($data)) {
497  return null;
498  }
499  $this->key = (string) $data;
500  }
501 
502  return $this->key;
503  }
504 
511  public function getCustomerId()
512  {
513  if (is_null($this->customerId)) {
515  $data = $this->raw(self::FIELD_CUSTOMER_ID);
516  if (is_null($data)) {
517  return null;
518  }
519  $this->customerId = (string) $data;
520  }
521 
522  return $this->customerId;
523  }
524 
531  public function getCustomerEmail()
532  {
533  if (is_null($this->customerEmail)) {
535  $data = $this->raw(self::FIELD_CUSTOMER_EMAIL);
536  if (is_null($data)) {
537  return null;
538  }
539  $this->customerEmail = (string) $data;
540  }
541 
542  return $this->customerEmail;
543  }
544 
551  public function getCustomerGroup()
552  {
553  if (is_null($this->customerGroup)) {
555  $data = $this->raw(self::FIELD_CUSTOMER_GROUP);
556  if (is_null($data)) {
557  return null;
558  }
559 
560  $this->customerGroup = CustomerGroupReferenceModel::of($data);
561  }
562 
563  return $this->customerGroup;
564  }
565 
572  public function getAnonymousId()
573  {
574  if (is_null($this->anonymousId)) {
576  $data = $this->raw(self::FIELD_ANONYMOUS_ID);
577  if (is_null($data)) {
578  return null;
579  }
580  $this->anonymousId = (string) $data;
581  }
582 
583  return $this->anonymousId;
584  }
585 
592  public function getBusinessUnit()
593  {
594  if (is_null($this->businessUnit)) {
596  $data = $this->raw(self::FIELD_BUSINESS_UNIT);
597  if (is_null($data)) {
598  return null;
599  }
600 
601  $this->businessUnit = BusinessUnitKeyReferenceModel::of($data);
602  }
603 
604  return $this->businessUnit;
605  }
606 
613  public function getStore()
614  {
615  if (is_null($this->store)) {
617  $data = $this->raw(self::FIELD_STORE);
618  if (is_null($data)) {
619  return null;
620  }
621 
622  $this->store = StoreKeyReferenceModel::of($data);
623  }
624 
625  return $this->store;
626  }
627 
634  public function getLineItems()
635  {
636  if (is_null($this->lineItems)) {
638  $data = $this->raw(self::FIELD_LINE_ITEMS);
639  if (is_null($data)) {
640  return null;
641  }
642  $this->lineItems = LineItemCollection::fromArray($data);
643  }
644 
645  return $this->lineItems;
646  }
647 
654  public function getCustomLineItems()
655  {
656  if (is_null($this->customLineItems)) {
658  $data = $this->raw(self::FIELD_CUSTOM_LINE_ITEMS);
659  if (is_null($data)) {
660  return null;
661  }
662  $this->customLineItems = CustomLineItemCollection::fromArray($data);
663  }
664 
665  return $this->customLineItems;
666  }
667 
674  public function getTotalLineItemQuantity()
675  {
676  if (is_null($this->totalLineItemQuantity)) {
678  $data = $this->raw(self::FIELD_TOTAL_LINE_ITEM_QUANTITY);
679  if (is_null($data)) {
680  return null;
681  }
682  $this->totalLineItemQuantity = (int) $data;
683  }
684 
686  }
687 
696  public function getTotalPrice()
697  {
698  if (is_null($this->totalPrice)) {
700  $data = $this->raw(self::FIELD_TOTAL_PRICE);
701  if (is_null($data)) {
702  return null;
703  }
704 
705  $this->totalPrice = CentPrecisionMoneyModel::of($data);
706  }
707 
708  return $this->totalPrice;
709  }
710 
721  public function getTaxedPrice()
722  {
723  if (is_null($this->taxedPrice)) {
725  $data = $this->raw(self::FIELD_TAXED_PRICE);
726  if (is_null($data)) {
727  return null;
728  }
729 
730  $this->taxedPrice = TaxedPriceModel::of($data);
731  }
732 
733  return $this->taxedPrice;
734  }
735 
742  public function getTaxedShippingPrice()
743  {
744  if (is_null($this->taxedShippingPrice)) {
746  $data = $this->raw(self::FIELD_TAXED_SHIPPING_PRICE);
747  if (is_null($data)) {
748  return null;
749  }
750 
751  $this->taxedShippingPrice = TaxedPriceModel::of($data);
752  }
753 
755  }
756 
763  public function getDiscountOnTotalPrice()
764  {
765  if (is_null($this->discountOnTotalPrice)) {
767  $data = $this->raw(self::FIELD_DISCOUNT_ON_TOTAL_PRICE);
768  if (is_null($data)) {
769  return null;
770  }
771 
772  $this->discountOnTotalPrice = DiscountOnTotalPriceModel::of($data);
773  }
774 
776  }
777 
784  public function getTaxMode()
785  {
786  if (is_null($this->taxMode)) {
788  $data = $this->raw(self::FIELD_TAX_MODE);
789  if (is_null($data)) {
790  return null;
791  }
792  $this->taxMode = (string) $data;
793  }
794 
795  return $this->taxMode;
796  }
797 
804  public function getTaxRoundingMode()
805  {
806  if (is_null($this->taxRoundingMode)) {
808  $data = $this->raw(self::FIELD_TAX_ROUNDING_MODE);
809  if (is_null($data)) {
810  return null;
811  }
812  $this->taxRoundingMode = (string) $data;
813  }
814 
815  return $this->taxRoundingMode;
816  }
817 
824  public function getTaxCalculationMode()
825  {
826  if (is_null($this->taxCalculationMode)) {
828  $data = $this->raw(self::FIELD_TAX_CALCULATION_MODE);
829  if (is_null($data)) {
830  return null;
831  }
832  $this->taxCalculationMode = (string) $data;
833  }
834 
836  }
837 
844  public function getInventoryMode()
845  {
846  if (is_null($this->inventoryMode)) {
848  $data = $this->raw(self::FIELD_INVENTORY_MODE);
849  if (is_null($data)) {
850  return null;
851  }
852  $this->inventoryMode = (string) $data;
853  }
854 
855  return $this->inventoryMode;
856  }
857 
864  public function getCartState()
865  {
866  if (is_null($this->cartState)) {
868  $data = $this->raw(self::FIELD_CART_STATE);
869  if (is_null($data)) {
870  return null;
871  }
872  $this->cartState = (string) $data;
873  }
874 
875  return $this->cartState;
876  }
877 
884  public function getBillingAddress()
885  {
886  if (is_null($this->billingAddress)) {
888  $data = $this->raw(self::FIELD_BILLING_ADDRESS);
889  if (is_null($data)) {
890  return null;
891  }
892 
893  $this->billingAddress = AddressModel::of($data);
894  }
895 
896  return $this->billingAddress;
897  }
898 
905  public function getShippingAddress()
906  {
907  if (is_null($this->shippingAddress)) {
909  $data = $this->raw(self::FIELD_SHIPPING_ADDRESS);
910  if (is_null($data)) {
911  return null;
912  }
913 
914  $this->shippingAddress = AddressModel::of($data);
915  }
916 
917  return $this->shippingAddress;
918  }
919 
926  public function getShippingMode()
927  {
928  if (is_null($this->shippingMode)) {
930  $data = $this->raw(self::FIELD_SHIPPING_MODE);
931  if (is_null($data)) {
932  return null;
933  }
934  $this->shippingMode = (string) $data;
935  }
936 
937  return $this->shippingMode;
938  }
939 
946  public function getShippingKey()
947  {
948  if (is_null($this->shippingKey)) {
950  $data = $this->raw(self::FIELD_SHIPPING_KEY);
951  if (is_null($data)) {
952  return null;
953  }
954  $this->shippingKey = (string) $data;
955  }
956 
957  return $this->shippingKey;
958  }
959 
966  public function getShippingInfo()
967  {
968  if (is_null($this->shippingInfo)) {
970  $data = $this->raw(self::FIELD_SHIPPING_INFO);
971  if (is_null($data)) {
972  return null;
973  }
974 
975  $this->shippingInfo = ShippingInfoModel::of($data);
976  }
977 
978  return $this->shippingInfo;
979  }
980 
993  public function getShippingRateInput()
994  {
995  if (is_null($this->shippingRateInput)) {
997  $data = $this->raw(self::FIELD_SHIPPING_RATE_INPUT);
998  if (is_null($data)) {
999  return null;
1000  }
1002  $this->shippingRateInput = $className::of($data);
1003  }
1004 
1005  return $this->shippingRateInput;
1006  }
1007 
1014  public function getShippingCustomFields()
1015  {
1016  if (is_null($this->shippingCustomFields)) {
1018  $data = $this->raw(self::FIELD_SHIPPING_CUSTOM_FIELDS);
1019  if (is_null($data)) {
1020  return null;
1021  }
1022 
1023  $this->shippingCustomFields = CustomFieldsModel::of($data);
1024  }
1025 
1027  }
1028 
1035  public function getShipping()
1036  {
1037  if (is_null($this->shipping)) {
1039  $data = $this->raw(self::FIELD_SHIPPING);
1040  if (is_null($data)) {
1041  return null;
1042  }
1043  $this->shipping = ShippingCollection::fromArray($data);
1044  }
1045 
1046  return $this->shipping;
1047  }
1048 
1056  public function getItemShippingAddresses()
1057  {
1058  if (is_null($this->itemShippingAddresses)) {
1060  $data = $this->raw(self::FIELD_ITEM_SHIPPING_ADDRESSES);
1061  if (is_null($data)) {
1062  return null;
1063  }
1064  $this->itemShippingAddresses = AddressCollection::fromArray($data);
1065  }
1066 
1068  }
1069 
1076  public function getDiscountCodes()
1077  {
1078  if (is_null($this->discountCodes)) {
1080  $data = $this->raw(self::FIELD_DISCOUNT_CODES);
1081  if (is_null($data)) {
1082  return null;
1083  }
1084  $this->discountCodes = DiscountCodeInfoCollection::fromArray($data);
1085  }
1086 
1087  return $this->discountCodes;
1088  }
1089 
1096  public function getDirectDiscounts()
1097  {
1098  if (is_null($this->directDiscounts)) {
1100  $data = $this->raw(self::FIELD_DIRECT_DISCOUNTS);
1101  if (is_null($data)) {
1102  return null;
1103  }
1104  $this->directDiscounts = DirectDiscountCollection::fromArray($data);
1105  }
1106 
1107  return $this->directDiscounts;
1108  }
1109 
1116  public function getRefusedGifts()
1117  {
1118  if (is_null($this->refusedGifts)) {
1120  $data = $this->raw(self::FIELD_REFUSED_GIFTS);
1121  if (is_null($data)) {
1122  return null;
1123  }
1124  $this->refusedGifts = CartDiscountReferenceCollection::fromArray($data);
1125  }
1126 
1127  return $this->refusedGifts;
1128  }
1129 
1136  public function getPaymentInfo()
1137  {
1138  if (is_null($this->paymentInfo)) {
1140  $data = $this->raw(self::FIELD_PAYMENT_INFO);
1141  if (is_null($data)) {
1142  return null;
1143  }
1144 
1145  $this->paymentInfo = PaymentInfoModel::of($data);
1146  }
1147 
1148  return $this->paymentInfo;
1149  }
1150 
1157  public function getCountry()
1158  {
1159  if (is_null($this->country)) {
1161  $data = $this->raw(self::FIELD_COUNTRY);
1162  if (is_null($data)) {
1163  return null;
1164  }
1165  $this->country = (string) $data;
1166  }
1167 
1168  return $this->country;
1169  }
1170 
1177  public function getLocale()
1178  {
1179  if (is_null($this->locale)) {
1181  $data = $this->raw(self::FIELD_LOCALE);
1182  if (is_null($data)) {
1183  return null;
1184  }
1185  $this->locale = (string) $data;
1186  }
1187 
1188  return $this->locale;
1189  }
1190 
1197  public function getOrigin()
1198  {
1199  if (is_null($this->origin)) {
1201  $data = $this->raw(self::FIELD_ORIGIN);
1202  if (is_null($data)) {
1203  return null;
1204  }
1205  $this->origin = (string) $data;
1206  }
1207 
1208  return $this->origin;
1209  }
1210 
1217  public function getCustom()
1218  {
1219  if (is_null($this->custom)) {
1221  $data = $this->raw(self::FIELD_CUSTOM);
1222  if (is_null($data)) {
1223  return null;
1224  }
1225 
1226  $this->custom = CustomFieldsModel::of($data);
1227  }
1228 
1229  return $this->custom;
1230  }
1231 
1239  {
1240  if (is_null($this->deleteDaysAfterLastModification)) {
1242  $data = $this->raw(self::FIELD_DELETE_DAYS_AFTER_LAST_MODIFICATION);
1243  if (is_null($data)) {
1244  return null;
1245  }
1246  $this->deleteDaysAfterLastModification = (int) $data;
1247  }
1248 
1250  }
1251 
1258  public function getLastModifiedBy()
1259  {
1260  if (is_null($this->lastModifiedBy)) {
1262  $data = $this->raw(self::FIELD_LAST_MODIFIED_BY);
1263  if (is_null($data)) {
1264  return null;
1265  }
1266 
1267  $this->lastModifiedBy = LastModifiedByModel::of($data);
1268  }
1269 
1270  return $this->lastModifiedBy;
1271  }
1272 
1279  public function getCreatedBy()
1280  {
1281  if (is_null($this->createdBy)) {
1283  $data = $this->raw(self::FIELD_CREATED_BY);
1284  if (is_null($data)) {
1285  return null;
1286  }
1287 
1288  $this->createdBy = CreatedByModel::of($data);
1289  }
1290 
1291  return $this->createdBy;
1292  }
1293 
1294 
1298  public function setId(?string $id): void
1299  {
1300  $this->id = $id;
1301  }
1302 
1306  public function setVersion(?int $version): void
1307  {
1308  $this->version = $version;
1309  }
1310 
1314  public function setCreatedAt(?DateTimeImmutable $createdAt): void
1315  {
1316  $this->createdAt = $createdAt;
1317  }
1318 
1322  public function setLastModifiedAt(?DateTimeImmutable $lastModifiedAt): void
1323  {
1324  $this->lastModifiedAt = $lastModifiedAt;
1325  }
1326 
1330  public function setKey(?string $key): void
1331  {
1332  $this->key = $key;
1333  }
1334 
1338  public function setCustomerId(?string $customerId): void
1339  {
1340  $this->customerId = $customerId;
1341  }
1342 
1346  public function setCustomerEmail(?string $customerEmail): void
1347  {
1348  $this->customerEmail = $customerEmail;
1349  }
1350 
1355  {
1356  $this->customerGroup = $customerGroup;
1357  }
1358 
1362  public function setAnonymousId(?string $anonymousId): void
1363  {
1364  $this->anonymousId = $anonymousId;
1365  }
1366 
1371  {
1372  $this->businessUnit = $businessUnit;
1373  }
1374 
1378  public function setStore(?StoreKeyReference $store): void
1379  {
1380  $this->store = $store;
1381  }
1382 
1387  {
1388  $this->lineItems = $lineItems;
1389  }
1390 
1395  {
1396  $this->customLineItems = $customLineItems;
1397  }
1398 
1403  {
1404  $this->totalLineItemQuantity = $totalLineItemQuantity;
1405  }
1406 
1411  {
1412  $this->totalPrice = $totalPrice;
1413  }
1414 
1418  public function setTaxedPrice(?TaxedPrice $taxedPrice): void
1419  {
1420  $this->taxedPrice = $taxedPrice;
1421  }
1422 
1427  {
1428  $this->taxedShippingPrice = $taxedShippingPrice;
1429  }
1430 
1435  {
1436  $this->discountOnTotalPrice = $discountOnTotalPrice;
1437  }
1438 
1442  public function setTaxMode(?string $taxMode): void
1443  {
1444  $this->taxMode = $taxMode;
1445  }
1446 
1450  public function setTaxRoundingMode(?string $taxRoundingMode): void
1451  {
1452  $this->taxRoundingMode = $taxRoundingMode;
1453  }
1454 
1458  public function setTaxCalculationMode(?string $taxCalculationMode): void
1459  {
1460  $this->taxCalculationMode = $taxCalculationMode;
1461  }
1462 
1466  public function setInventoryMode(?string $inventoryMode): void
1467  {
1468  $this->inventoryMode = $inventoryMode;
1469  }
1470 
1474  public function setCartState(?string $cartState): void
1475  {
1476  $this->cartState = $cartState;
1477  }
1478 
1483  {
1484  $this->billingAddress = $billingAddress;
1485  }
1486 
1491  {
1492  $this->shippingAddress = $shippingAddress;
1493  }
1494 
1498  public function setShippingMode(?string $shippingMode): void
1499  {
1500  $this->shippingMode = $shippingMode;
1501  }
1502 
1506  public function setShippingKey(?string $shippingKey): void
1507  {
1508  $this->shippingKey = $shippingKey;
1509  }
1510 
1515  {
1516  $this->shippingInfo = $shippingInfo;
1517  }
1518 
1523  {
1524  $this->shippingRateInput = $shippingRateInput;
1525  }
1526 
1531  {
1532  $this->shippingCustomFields = $shippingCustomFields;
1533  }
1534 
1538  public function setShipping(?ShippingCollection $shipping): void
1539  {
1540  $this->shipping = $shipping;
1541  }
1542 
1547  {
1548  $this->itemShippingAddresses = $itemShippingAddresses;
1549  }
1550 
1555  {
1556  $this->discountCodes = $discountCodes;
1557  }
1558 
1563  {
1564  $this->directDiscounts = $directDiscounts;
1565  }
1566 
1571  {
1572  $this->refusedGifts = $refusedGifts;
1573  }
1574 
1578  public function setPaymentInfo(?PaymentInfo $paymentInfo): void
1579  {
1580  $this->paymentInfo = $paymentInfo;
1581  }
1582 
1586  public function setCountry(?string $country): void
1587  {
1588  $this->country = $country;
1589  }
1590 
1594  public function setLocale(?string $locale): void
1595  {
1596  $this->locale = $locale;
1597  }
1598 
1602  public function setOrigin(?string $origin): void
1603  {
1604  $this->origin = $origin;
1605  }
1606 
1610  public function setCustom(?CustomFields $custom): void
1611  {
1612  $this->custom = $custom;
1613  }
1614 
1619  {
1620  $this->deleteDaysAfterLastModification = $deleteDaysAfterLastModification;
1621  }
1622 
1627  {
1628  $this->lastModifiedBy = $lastModifiedBy;
1629  }
1630 
1634  public function setCreatedBy(?CreatedBy $createdBy): void
1635  {
1636  $this->createdBy = $createdBy;
1637  }
1638 
1639 
1640  #[\ReturnTypeWillChange]
1641  public function jsonSerialize()
1642  {
1643  $data = $this->toArray();
1644  if (isset($data[Cart::FIELD_CREATED_AT]) && $data[Cart::FIELD_CREATED_AT] instanceof \DateTimeImmutable) {
1645  $data[Cart::FIELD_CREATED_AT] = $data[Cart::FIELD_CREATED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c');
1646  }
1647 
1648  if (isset($data[Cart::FIELD_LAST_MODIFIED_AT]) && $data[Cart::FIELD_LAST_MODIFIED_AT] instanceof \DateTimeImmutable) {
1649  $data[Cart::FIELD_LAST_MODIFIED_AT] = $data[Cart::FIELD_LAST_MODIFIED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c');
1650  }
1651  return (object) $data;
1652  }
1653 }
__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 $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, ?int $deleteDaysAfterLastModification=null, ?LastModifiedBy $lastModifiedBy=null, ?CreatedBy $createdBy=null)
Definition: CartModel.php:307
setStore(?StoreKeyReference $store)
Definition: CartModel.php:1378
setLastModifiedAt(?DateTimeImmutable $lastModifiedAt)
Definition: CartModel.php:1322
setDiscountCodes(?DiscountCodeInfoCollection $discountCodes)
Definition: CartModel.php:1554
setDeleteDaysAfterLastModification(?int $deleteDaysAfterLastModification)
Definition: CartModel.php:1618
setRefusedGifts(?CartDiscountReferenceCollection $refusedGifts)
Definition: CartModel.php:1570
setBillingAddress(?Address $billingAddress)
Definition: CartModel.php:1482
setCustomerEmail(?string $customerEmail)
Definition: CartModel.php:1346
setAnonymousId(?string $anonymousId)
Definition: CartModel.php:1362
setTaxedShippingPrice(?TaxedPrice $taxedShippingPrice)
Definition: CartModel.php:1426
setTaxCalculationMode(?string $taxCalculationMode)
Definition: CartModel.php:1458
setTotalPrice(?CentPrecisionMoney $totalPrice)
Definition: CartModel.php:1410
setBusinessUnit(?BusinessUnitKeyReference $businessUnit)
Definition: CartModel.php:1370
setCustomLineItems(?CustomLineItemCollection $customLineItems)
Definition: CartModel.php:1394
setCustomerGroup(?CustomerGroupReference $customerGroup)
Definition: CartModel.php:1354
setShipping(?ShippingCollection $shipping)
Definition: CartModel.php:1538
setLastModifiedBy(?LastModifiedBy $lastModifiedBy)
Definition: CartModel.php:1626
setShippingMode(?string $shippingMode)
Definition: CartModel.php:1498
setTaxedPrice(?TaxedPrice $taxedPrice)
Definition: CartModel.php:1418
setShippingInfo(?ShippingInfo $shippingInfo)
Definition: CartModel.php:1514
setPaymentInfo(?PaymentInfo $paymentInfo)
Definition: CartModel.php:1578
setCreatedAt(?DateTimeImmutable $createdAt)
Definition: CartModel.php:1314
setCreatedBy(?CreatedBy $createdBy)
Definition: CartModel.php:1634
setShippingRateInput(?ShippingRateInput $shippingRateInput)
Definition: CartModel.php:1522
setInventoryMode(?string $inventoryMode)
Definition: CartModel.php:1466
setDiscountOnTotalPrice(?DiscountOnTotalPrice $discountOnTotalPrice)
Definition: CartModel.php:1434
setShippingKey(?string $shippingKey)
Definition: CartModel.php:1506
setTaxRoundingMode(?string $taxRoundingMode)
Definition: CartModel.php:1450
setShippingAddress(?Address $shippingAddress)
Definition: CartModel.php:1490
setDirectDiscounts(?DirectDiscountCollection $directDiscounts)
Definition: CartModel.php:1562
setTotalLineItemQuantity(?int $totalLineItemQuantity)
Definition: CartModel.php:1402
setLineItems(?LineItemCollection $lineItems)
Definition: CartModel.php:1386
setShippingCustomFields(?CustomFields $shippingCustomFields)
Definition: CartModel.php:1530
setItemShippingAddresses(?AddressCollection $itemShippingAddresses)
Definition: CartModel.php:1546