commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
CartDraftModel.php
1<?php
2
3declare(strict_types=1);
10
28use stdClass;
29
33final class CartDraftModel extends JsonObjectModel implements CartDraft
34{
39 protected $currency;
40
45 protected $key;
46
51 protected $customerId;
52
57 protected $customerEmail;
58
63 protected $customerGroup;
64
69 protected $anonymousId;
70
75 protected $businessUnit;
76
81 protected $store;
82
87 protected $lineItems;
88
94
99 protected $taxMode;
100
106
112
118
124
129 protected $inventoryMode;
130
136
142
148
154
159 protected $shippingMode;
160
166
171 protected $shipping;
172
178
183 protected $discountCodes;
184
190
195 protected $country;
196
201 protected $locale;
202
207 protected $origin;
208
214
219 protected $custom;
220
226
227
231 public function __construct(
232 ?string $currency = null,
233 ?string $key = null,
234 ?string $customerId = null,
235 ?string $customerEmail = null,
237 ?string $anonymousId = null,
242 ?string $taxMode = null,
244 ?string $priceRoundingMode = null,
245 ?string $taxRoundingMode = null,
246 ?string $taxCalculationMode = null,
247 ?string $inventoryMode = null,
252 ?string $shippingMode = null,
256 ?array $discountCodes = null,
258 ?string $country = null,
259 ?string $locale = null,
260 ?string $origin = null,
263 ?string $purchaseOrderNumber = null
264 ) {
265 $this->currency = $currency;
266 $this->key = $key;
267 $this->customerId = $customerId;
268 $this->customerEmail = $customerEmail;
269 $this->customerGroup = $customerGroup;
270 $this->anonymousId = $anonymousId;
271 $this->businessUnit = $businessUnit;
272 $this->store = $store;
273 $this->lineItems = $lineItems;
274 $this->customLineItems = $customLineItems;
275 $this->taxMode = $taxMode;
276 $this->externalTaxRateForShippingMethod = $externalTaxRateForShippingMethod;
277 $this->priceRoundingMode = $priceRoundingMode;
278 $this->taxRoundingMode = $taxRoundingMode;
279 $this->taxCalculationMode = $taxCalculationMode;
280 $this->inventoryMode = $inventoryMode;
281 $this->billingAddress = $billingAddress;
282 $this->shippingAddress = $shippingAddress;
283 $this->shippingMethod = $shippingMethod;
284 $this->shippingRateInput = $shippingRateInput;
285 $this->shippingMode = $shippingMode;
286 $this->customShipping = $customShipping;
287 $this->shipping = $shipping;
288 $this->itemShippingAddresses = $itemShippingAddresses;
289 $this->discountCodes = $discountCodes;
290 $this->directDiscountsIgnoreCartDiscounts = $directDiscountsIgnoreCartDiscounts;
291 $this->country = $country;
292 $this->locale = $locale;
293 $this->origin = $origin;
294 $this->deleteDaysAfterLastModification = $deleteDaysAfterLastModification;
295 $this->custom = $custom;
296 $this->purchaseOrderNumber = $purchaseOrderNumber;
297 }
298
305 public function getCurrency()
306 {
307 if (is_null($this->currency)) {
309 $data = $this->raw(self::FIELD_CURRENCY);
310 if (is_null($data)) {
311 return null;
312 }
313 $this->currency = (string) $data;
314 }
315
316 return $this->currency;
317 }
318
325 public function getKey()
326 {
327 if (is_null($this->key)) {
329 $data = $this->raw(self::FIELD_KEY);
330 if (is_null($data)) {
331 return null;
332 }
333 $this->key = (string) $data;
334 }
335
336 return $this->key;
337 }
338
345 public function getCustomerId()
346 {
347 if (is_null($this->customerId)) {
349 $data = $this->raw(self::FIELD_CUSTOMER_ID);
350 if (is_null($data)) {
351 return null;
352 }
353 $this->customerId = (string) $data;
354 }
355
356 return $this->customerId;
357 }
358
365 public function getCustomerEmail()
366 {
367 if (is_null($this->customerEmail)) {
369 $data = $this->raw(self::FIELD_CUSTOMER_EMAIL);
370 if (is_null($data)) {
371 return null;
372 }
373 $this->customerEmail = (string) $data;
374 }
375
377 }
378
387 public function getCustomerGroup()
388 {
389 if (is_null($this->customerGroup)) {
391 $data = $this->raw(self::FIELD_CUSTOMER_GROUP);
392 if (is_null($data)) {
393 return null;
394 }
395
396 $this->customerGroup = CustomerGroupResourceIdentifierModel::of($data);
397 }
398
400 }
401
408 public function getAnonymousId()
409 {
410 if (is_null($this->anonymousId)) {
412 $data = $this->raw(self::FIELD_ANONYMOUS_ID);
413 if (is_null($data)) {
414 return null;
415 }
416 $this->anonymousId = (string) $data;
417 }
418
419 return $this->anonymousId;
420 }
421
428 public function getBusinessUnit()
429 {
430 if (is_null($this->businessUnit)) {
432 $data = $this->raw(self::FIELD_BUSINESS_UNIT);
433 if (is_null($data)) {
434 return null;
435 }
436
437 $this->businessUnit = BusinessUnitResourceIdentifierModel::of($data);
438 }
439
440 return $this->businessUnit;
441 }
442
449 public function getStore()
450 {
451 if (is_null($this->store)) {
453 $data = $this->raw(self::FIELD_STORE);
454 if (is_null($data)) {
455 return null;
456 }
457
458 $this->store = StoreResourceIdentifierModel::of($data);
459 }
460
461 return $this->store;
462 }
463
470 public function getLineItems()
471 {
472 if (is_null($this->lineItems)) {
474 $data = $this->raw(self::FIELD_LINE_ITEMS);
475 if (is_null($data)) {
476 return null;
477 }
478 $this->lineItems = LineItemDraftCollection::fromArray($data);
479 }
480
481 return $this->lineItems;
482 }
483
490 public function getCustomLineItems()
491 {
492 if (is_null($this->customLineItems)) {
494 $data = $this->raw(self::FIELD_CUSTOM_LINE_ITEMS);
495 if (is_null($data)) {
496 return null;
497 }
498 $this->customLineItems = CustomLineItemDraftCollection::fromArray($data);
499 }
500
502 }
503
510 public function getTaxMode()
511 {
512 if (is_null($this->taxMode)) {
514 $data = $this->raw(self::FIELD_TAX_MODE);
515 if (is_null($data)) {
516 return null;
517 }
518 $this->taxMode = (string) $data;
519 }
520
521 return $this->taxMode;
522 }
523
531 {
532 if (is_null($this->externalTaxRateForShippingMethod)) {
534 $data = $this->raw(self::FIELD_EXTERNAL_TAX_RATE_FOR_SHIPPING_METHOD);
535 if (is_null($data)) {
536 return null;
537 }
538
539 $this->externalTaxRateForShippingMethod = ExternalTaxRateDraftModel::of($data);
540 }
541
543 }
544
551 public function getPriceRoundingMode()
552 {
553 if (is_null($this->priceRoundingMode)) {
555 $data = $this->raw(self::FIELD_PRICE_ROUNDING_MODE);
556 if (is_null($data)) {
557 return null;
558 }
559 $this->priceRoundingMode = (string) $data;
560 }
561
563 }
564
571 public function getTaxRoundingMode()
572 {
573 if (is_null($this->taxRoundingMode)) {
575 $data = $this->raw(self::FIELD_TAX_ROUNDING_MODE);
576 if (is_null($data)) {
577 return null;
578 }
579 $this->taxRoundingMode = (string) $data;
580 }
581
583 }
584
591 public function getTaxCalculationMode()
592 {
593 if (is_null($this->taxCalculationMode)) {
595 $data = $this->raw(self::FIELD_TAX_CALCULATION_MODE);
596 if (is_null($data)) {
597 return null;
598 }
599 $this->taxCalculationMode = (string) $data;
600 }
601
603 }
604
611 public function getInventoryMode()
612 {
613 if (is_null($this->inventoryMode)) {
615 $data = $this->raw(self::FIELD_INVENTORY_MODE);
616 if (is_null($data)) {
617 return null;
618 }
619 $this->inventoryMode = (string) $data;
620 }
621
623 }
624
631 public function getBillingAddress()
632 {
633 if (is_null($this->billingAddress)) {
635 $data = $this->raw(self::FIELD_BILLING_ADDRESS);
636 if (is_null($data)) {
637 return null;
638 }
639
640 $this->billingAddress = BaseAddressModel::of($data);
641 }
642
644 }
645
653 public function getShippingAddress()
654 {
655 if (is_null($this->shippingAddress)) {
657 $data = $this->raw(self::FIELD_SHIPPING_ADDRESS);
658 if (is_null($data)) {
659 return null;
660 }
661
662 $this->shippingAddress = BaseAddressModel::of($data);
663 }
664
666 }
667
674 public function getShippingMethod()
675 {
676 if (is_null($this->shippingMethod)) {
678 $data = $this->raw(self::FIELD_SHIPPING_METHOD);
679 if (is_null($data)) {
680 return null;
681 }
682
683 $this->shippingMethod = ShippingMethodResourceIdentifierModel::of($data);
684 }
685
687 }
688
701 public function getShippingRateInput()
702 {
703 if (is_null($this->shippingRateInput)) {
705 $data = $this->raw(self::FIELD_SHIPPING_RATE_INPUT);
706 if (is_null($data)) {
707 return null;
708 }
710 $this->shippingRateInput = $className::of($data);
711 }
712
714 }
715
725 public function getShippingMode()
726 {
727 if (is_null($this->shippingMode)) {
729 $data = $this->raw(self::FIELD_SHIPPING_MODE);
730 if (is_null($data)) {
731 return null;
732 }
733 $this->shippingMode = (string) $data;
734 }
735
736 return $this->shippingMode;
737 }
738
745 public function getCustomShipping()
746 {
747 if (is_null($this->customShipping)) {
749 $data = $this->raw(self::FIELD_CUSTOM_SHIPPING);
750 if (is_null($data)) {
751 return null;
752 }
753 $this->customShipping = CustomShippingDraftCollection::fromArray($data);
754 }
755
757 }
758
765 public function getShipping()
766 {
767 if (is_null($this->shipping)) {
769 $data = $this->raw(self::FIELD_SHIPPING);
770 if (is_null($data)) {
771 return null;
772 }
773 $this->shipping = ShippingDraftCollection::fromArray($data);
774 }
775
776 return $this->shipping;
777 }
778
787 public function getItemShippingAddresses()
788 {
789 if (is_null($this->itemShippingAddresses)) {
791 $data = $this->raw(self::FIELD_ITEM_SHIPPING_ADDRESSES);
792 if (is_null($data)) {
793 return null;
794 }
795 $this->itemShippingAddresses = BaseAddressCollection::fromArray($data);
796 }
797
799 }
800
807 public function getDiscountCodes()
808 {
809 if (is_null($this->discountCodes)) {
811 $data = $this->raw(self::FIELD_DISCOUNT_CODES);
812 if (is_null($data)) {
813 return null;
814 }
815 $this->discountCodes = $data;
816 }
817
819 }
820
831 {
832 if (is_null($this->directDiscountsIgnoreCartDiscounts)) {
834 $data = $this->raw(self::FIELD_DIRECT_DISCOUNTS_IGNORE_CART_DISCOUNTS);
835 if (is_null($data)) {
836 return null;
837 }
838 $this->directDiscountsIgnoreCartDiscounts = (bool) $data;
839 }
840
842 }
843
851 public function getCountry()
852 {
853 if (is_null($this->country)) {
855 $data = $this->raw(self::FIELD_COUNTRY);
856 if (is_null($data)) {
857 return null;
858 }
859 $this->country = (string) $data;
860 }
861
862 return $this->country;
863 }
864
871 public function getLocale()
872 {
873 if (is_null($this->locale)) {
875 $data = $this->raw(self::FIELD_LOCALE);
876 if (is_null($data)) {
877 return null;
878 }
879 $this->locale = (string) $data;
880 }
881
882 return $this->locale;
883 }
884
891 public function getOrigin()
892 {
893 if (is_null($this->origin)) {
895 $data = $this->raw(self::FIELD_ORIGIN);
896 if (is_null($data)) {
897 return null;
898 }
899 $this->origin = (string) $data;
900 }
901
902 return $this->origin;
903 }
904
914 {
915 if (is_null($this->deleteDaysAfterLastModification)) {
917 $data = $this->raw(self::FIELD_DELETE_DAYS_AFTER_LAST_MODIFICATION);
918 if (is_null($data)) {
919 return null;
920 }
921 $this->deleteDaysAfterLastModification = (int) $data;
922 }
923
925 }
926
933 public function getCustom()
934 {
935 if (is_null($this->custom)) {
937 $data = $this->raw(self::FIELD_CUSTOM);
938 if (is_null($data)) {
939 return null;
940 }
941
942 $this->custom = CustomFieldsDraftModel::of($data);
943 }
944
945 return $this->custom;
946 }
947
955 public function getPurchaseOrderNumber()
956 {
957 if (is_null($this->purchaseOrderNumber)) {
959 $data = $this->raw(self::FIELD_PURCHASE_ORDER_NUMBER);
960 if (is_null($data)) {
961 return null;
962 }
963 $this->purchaseOrderNumber = (string) $data;
964 }
965
967 }
968
969
973 public function setCurrency(?string $currency): void
974 {
975 $this->currency = $currency;
976 }
977
981 public function setKey(?string $key): void
982 {
983 $this->key = $key;
984 }
985
989 public function setCustomerId(?string $customerId): void
990 {
991 $this->customerId = $customerId;
992 }
993
997 public function setCustomerEmail(?string $customerEmail): void
998 {
999 $this->customerEmail = $customerEmail;
1000 }
1001
1006 {
1007 $this->customerGroup = $customerGroup;
1008 }
1009
1013 public function setAnonymousId(?string $anonymousId): void
1014 {
1015 $this->anonymousId = $anonymousId;
1016 }
1017
1022 {
1023 $this->businessUnit = $businessUnit;
1024 }
1025
1030 {
1031 $this->store = $store;
1032 }
1033
1038 {
1039 $this->lineItems = $lineItems;
1040 }
1041
1046 {
1047 $this->customLineItems = $customLineItems;
1048 }
1049
1053 public function setTaxMode(?string $taxMode): void
1054 {
1055 $this->taxMode = $taxMode;
1056 }
1057
1062 {
1063 $this->externalTaxRateForShippingMethod = $externalTaxRateForShippingMethod;
1064 }
1065
1069 public function setPriceRoundingMode(?string $priceRoundingMode): void
1070 {
1071 $this->priceRoundingMode = $priceRoundingMode;
1072 }
1073
1077 public function setTaxRoundingMode(?string $taxRoundingMode): void
1078 {
1079 $this->taxRoundingMode = $taxRoundingMode;
1080 }
1081
1085 public function setTaxCalculationMode(?string $taxCalculationMode): void
1086 {
1087 $this->taxCalculationMode = $taxCalculationMode;
1088 }
1089
1093 public function setInventoryMode(?string $inventoryMode): void
1094 {
1095 $this->inventoryMode = $inventoryMode;
1096 }
1097
1102 {
1103 $this->billingAddress = $billingAddress;
1104 }
1105
1110 {
1111 $this->shippingAddress = $shippingAddress;
1112 }
1113
1118 {
1119 $this->shippingMethod = $shippingMethod;
1120 }
1121
1126 {
1127 $this->shippingRateInput = $shippingRateInput;
1128 }
1129
1133 public function setShippingMode(?string $shippingMode): void
1134 {
1135 $this->shippingMode = $shippingMode;
1136 }
1137
1142 {
1143 $this->customShipping = $customShipping;
1144 }
1145
1150 {
1151 $this->shipping = $shipping;
1152 }
1153
1158 {
1159 $this->itemShippingAddresses = $itemShippingAddresses;
1160 }
1161
1165 public function setDiscountCodes(?array $discountCodes): void
1166 {
1167 $this->discountCodes = $discountCodes;
1168 }
1169
1174 {
1175 $this->directDiscountsIgnoreCartDiscounts = $directDiscountsIgnoreCartDiscounts;
1176 }
1177
1181 public function setCountry(?string $country): void
1182 {
1183 $this->country = $country;
1184 }
1185
1189 public function setLocale(?string $locale): void
1190 {
1191 $this->locale = $locale;
1192 }
1193
1197 public function setOrigin(?string $origin): void
1198 {
1199 $this->origin = $origin;
1200 }
1201
1206 {
1207 $this->deleteDaysAfterLastModification = $deleteDaysAfterLastModification;
1208 }
1209
1213 public function setCustom(?CustomFieldsDraft $custom): void
1214 {
1215 $this->custom = $custom;
1216 }
1217
1221 public function setPurchaseOrderNumber(?string $purchaseOrderNumber): void
1222 {
1223 $this->purchaseOrderNumber = $purchaseOrderNumber;
1224 }
1225}
setStore(?StoreResourceIdentifier $store)
setShippingMethod(?ShippingMethodResourceIdentifier $shippingMethod)
setBusinessUnit(?BusinessUnitResourceIdentifier $businessUnit)
setPriceRoundingMode(?string $priceRoundingMode)
setShipping(?ShippingDraftCollection $shipping)
setShippingAddress(?BaseAddress $shippingAddress)
setCustomLineItems(?CustomLineItemDraftCollection $customLineItems)
setShippingRateInput(?ShippingRateInputDraft $shippingRateInput)
setExternalTaxRateForShippingMethod(?ExternalTaxRateDraft $externalTaxRateForShippingMethod)
setDirectDiscountsIgnoreCartDiscounts(?bool $directDiscountsIgnoreCartDiscounts)
setItemShippingAddresses(?BaseAddressCollection $itemShippingAddresses)
setPurchaseOrderNumber(?string $purchaseOrderNumber)
setBillingAddress(?BaseAddress $billingAddress)
setCustomShipping(?CustomShippingDraftCollection $customShipping)
setTaxCalculationMode(?string $taxCalculationMode)
setLineItems(?LineItemDraftCollection $lineItems)
setDeleteDaysAfterLastModification(?int $deleteDaysAfterLastModification)
setCustomerGroup(?CustomerGroupResourceIdentifier $customerGroup)
__construct(?string $currency=null, ?string $key=null, ?string $customerId=null, ?string $customerEmail=null, ?CustomerGroupResourceIdentifier $customerGroup=null, ?string $anonymousId=null, ?BusinessUnitResourceIdentifier $businessUnit=null, ?StoreResourceIdentifier $store=null, ?LineItemDraftCollection $lineItems=null, ?CustomLineItemDraftCollection $customLineItems=null, ?string $taxMode=null, ?ExternalTaxRateDraft $externalTaxRateForShippingMethod=null, ?string $priceRoundingMode=null, ?string $taxRoundingMode=null, ?string $taxCalculationMode=null, ?string $inventoryMode=null, ?BaseAddress $billingAddress=null, ?BaseAddress $shippingAddress=null, ?ShippingMethodResourceIdentifier $shippingMethod=null, ?ShippingRateInputDraft $shippingRateInput=null, ?string $shippingMode=null, ?CustomShippingDraftCollection $customShipping=null, ?ShippingDraftCollection $shipping=null, ?BaseAddressCollection $itemShippingAddresses=null, ?array $discountCodes=null, ?bool $directDiscountsIgnoreCartDiscounts=null, ?string $country=null, ?string $locale=null, ?string $origin=null, ?int $deleteDaysAfterLastModification=null, ?CustomFieldsDraft $custom=null, ?string $purchaseOrderNumber=null)
static fromArray(array $data)