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
189 protected $country;
190
195 protected $locale;
196
201 protected $origin;
202
208
213 protected $custom;
214
220
221
225 public function __construct(
226 ?string $currency = null,
227 ?string $key = null,
228 ?string $customerId = null,
229 ?string $customerEmail = null,
231 ?string $anonymousId = null,
236 ?string $taxMode = null,
238 ?string $priceRoundingMode = null,
239 ?string $taxRoundingMode = null,
240 ?string $taxCalculationMode = null,
241 ?string $inventoryMode = null,
246 ?string $shippingMode = null,
250 ?array $discountCodes = null,
251 ?string $country = null,
252 ?string $locale = null,
253 ?string $origin = null,
256 ?string $purchaseOrderNumber = null
257 ) {
258 $this->currency = $currency;
259 $this->key = $key;
260 $this->customerId = $customerId;
261 $this->customerEmail = $customerEmail;
262 $this->customerGroup = $customerGroup;
263 $this->anonymousId = $anonymousId;
264 $this->businessUnit = $businessUnit;
265 $this->store = $store;
266 $this->lineItems = $lineItems;
267 $this->customLineItems = $customLineItems;
268 $this->taxMode = $taxMode;
269 $this->externalTaxRateForShippingMethod = $externalTaxRateForShippingMethod;
270 $this->priceRoundingMode = $priceRoundingMode;
271 $this->taxRoundingMode = $taxRoundingMode;
272 $this->taxCalculationMode = $taxCalculationMode;
273 $this->inventoryMode = $inventoryMode;
274 $this->billingAddress = $billingAddress;
275 $this->shippingAddress = $shippingAddress;
276 $this->shippingMethod = $shippingMethod;
277 $this->shippingRateInput = $shippingRateInput;
278 $this->shippingMode = $shippingMode;
279 $this->customShipping = $customShipping;
280 $this->shipping = $shipping;
281 $this->itemShippingAddresses = $itemShippingAddresses;
282 $this->discountCodes = $discountCodes;
283 $this->country = $country;
284 $this->locale = $locale;
285 $this->origin = $origin;
286 $this->deleteDaysAfterLastModification = $deleteDaysAfterLastModification;
287 $this->custom = $custom;
288 $this->purchaseOrderNumber = $purchaseOrderNumber;
289 }
290
297 public function getCurrency()
298 {
299 if (is_null($this->currency)) {
301 $data = $this->raw(self::FIELD_CURRENCY);
302 if (is_null($data)) {
303 return null;
304 }
305 $this->currency = (string) $data;
306 }
307
308 return $this->currency;
309 }
310
317 public function getKey()
318 {
319 if (is_null($this->key)) {
321 $data = $this->raw(self::FIELD_KEY);
322 if (is_null($data)) {
323 return null;
324 }
325 $this->key = (string) $data;
326 }
327
328 return $this->key;
329 }
330
337 public function getCustomerId()
338 {
339 if (is_null($this->customerId)) {
341 $data = $this->raw(self::FIELD_CUSTOMER_ID);
342 if (is_null($data)) {
343 return null;
344 }
345 $this->customerId = (string) $data;
346 }
347
348 return $this->customerId;
349 }
350
357 public function getCustomerEmail()
358 {
359 if (is_null($this->customerEmail)) {
361 $data = $this->raw(self::FIELD_CUSTOMER_EMAIL);
362 if (is_null($data)) {
363 return null;
364 }
365 $this->customerEmail = (string) $data;
366 }
367
369 }
370
379 public function getCustomerGroup()
380 {
381 if (is_null($this->customerGroup)) {
383 $data = $this->raw(self::FIELD_CUSTOMER_GROUP);
384 if (is_null($data)) {
385 return null;
386 }
387
388 $this->customerGroup = CustomerGroupResourceIdentifierModel::of($data);
389 }
390
392 }
393
400 public function getAnonymousId()
401 {
402 if (is_null($this->anonymousId)) {
404 $data = $this->raw(self::FIELD_ANONYMOUS_ID);
405 if (is_null($data)) {
406 return null;
407 }
408 $this->anonymousId = (string) $data;
409 }
410
411 return $this->anonymousId;
412 }
413
420 public function getBusinessUnit()
421 {
422 if (is_null($this->businessUnit)) {
424 $data = $this->raw(self::FIELD_BUSINESS_UNIT);
425 if (is_null($data)) {
426 return null;
427 }
428
429 $this->businessUnit = BusinessUnitResourceIdentifierModel::of($data);
430 }
431
432 return $this->businessUnit;
433 }
434
441 public function getStore()
442 {
443 if (is_null($this->store)) {
445 $data = $this->raw(self::FIELD_STORE);
446 if (is_null($data)) {
447 return null;
448 }
449
450 $this->store = StoreResourceIdentifierModel::of($data);
451 }
452
453 return $this->store;
454 }
455
462 public function getLineItems()
463 {
464 if (is_null($this->lineItems)) {
466 $data = $this->raw(self::FIELD_LINE_ITEMS);
467 if (is_null($data)) {
468 return null;
469 }
470 $this->lineItems = LineItemDraftCollection::fromArray($data);
471 }
472
473 return $this->lineItems;
474 }
475
482 public function getCustomLineItems()
483 {
484 if (is_null($this->customLineItems)) {
486 $data = $this->raw(self::FIELD_CUSTOM_LINE_ITEMS);
487 if (is_null($data)) {
488 return null;
489 }
490 $this->customLineItems = CustomLineItemDraftCollection::fromArray($data);
491 }
492
494 }
495
502 public function getTaxMode()
503 {
504 if (is_null($this->taxMode)) {
506 $data = $this->raw(self::FIELD_TAX_MODE);
507 if (is_null($data)) {
508 return null;
509 }
510 $this->taxMode = (string) $data;
511 }
512
513 return $this->taxMode;
514 }
515
523 {
524 if (is_null($this->externalTaxRateForShippingMethod)) {
526 $data = $this->raw(self::FIELD_EXTERNAL_TAX_RATE_FOR_SHIPPING_METHOD);
527 if (is_null($data)) {
528 return null;
529 }
530
531 $this->externalTaxRateForShippingMethod = ExternalTaxRateDraftModel::of($data);
532 }
533
535 }
536
543 public function getPriceRoundingMode()
544 {
545 if (is_null($this->priceRoundingMode)) {
547 $data = $this->raw(self::FIELD_PRICE_ROUNDING_MODE);
548 if (is_null($data)) {
549 return null;
550 }
551 $this->priceRoundingMode = (string) $data;
552 }
553
555 }
556
563 public function getTaxRoundingMode()
564 {
565 if (is_null($this->taxRoundingMode)) {
567 $data = $this->raw(self::FIELD_TAX_ROUNDING_MODE);
568 if (is_null($data)) {
569 return null;
570 }
571 $this->taxRoundingMode = (string) $data;
572 }
573
575 }
576
583 public function getTaxCalculationMode()
584 {
585 if (is_null($this->taxCalculationMode)) {
587 $data = $this->raw(self::FIELD_TAX_CALCULATION_MODE);
588 if (is_null($data)) {
589 return null;
590 }
591 $this->taxCalculationMode = (string) $data;
592 }
593
595 }
596
603 public function getInventoryMode()
604 {
605 if (is_null($this->inventoryMode)) {
607 $data = $this->raw(self::FIELD_INVENTORY_MODE);
608 if (is_null($data)) {
609 return null;
610 }
611 $this->inventoryMode = (string) $data;
612 }
613
615 }
616
623 public function getBillingAddress()
624 {
625 if (is_null($this->billingAddress)) {
627 $data = $this->raw(self::FIELD_BILLING_ADDRESS);
628 if (is_null($data)) {
629 return null;
630 }
631
632 $this->billingAddress = BaseAddressModel::of($data);
633 }
634
636 }
637
645 public function getShippingAddress()
646 {
647 if (is_null($this->shippingAddress)) {
649 $data = $this->raw(self::FIELD_SHIPPING_ADDRESS);
650 if (is_null($data)) {
651 return null;
652 }
653
654 $this->shippingAddress = BaseAddressModel::of($data);
655 }
656
658 }
659
666 public function getShippingMethod()
667 {
668 if (is_null($this->shippingMethod)) {
670 $data = $this->raw(self::FIELD_SHIPPING_METHOD);
671 if (is_null($data)) {
672 return null;
673 }
674
675 $this->shippingMethod = ShippingMethodResourceIdentifierModel::of($data);
676 }
677
679 }
680
693 public function getShippingRateInput()
694 {
695 if (is_null($this->shippingRateInput)) {
697 $data = $this->raw(self::FIELD_SHIPPING_RATE_INPUT);
698 if (is_null($data)) {
699 return null;
700 }
702 $this->shippingRateInput = $className::of($data);
703 }
704
706 }
707
717 public function getShippingMode()
718 {
719 if (is_null($this->shippingMode)) {
721 $data = $this->raw(self::FIELD_SHIPPING_MODE);
722 if (is_null($data)) {
723 return null;
724 }
725 $this->shippingMode = (string) $data;
726 }
727
728 return $this->shippingMode;
729 }
730
737 public function getCustomShipping()
738 {
739 if (is_null($this->customShipping)) {
741 $data = $this->raw(self::FIELD_CUSTOM_SHIPPING);
742 if (is_null($data)) {
743 return null;
744 }
745 $this->customShipping = CustomShippingDraftCollection::fromArray($data);
746 }
747
749 }
750
757 public function getShipping()
758 {
759 if (is_null($this->shipping)) {
761 $data = $this->raw(self::FIELD_SHIPPING);
762 if (is_null($data)) {
763 return null;
764 }
765 $this->shipping = ShippingDraftCollection::fromArray($data);
766 }
767
768 return $this->shipping;
769 }
770
779 public function getItemShippingAddresses()
780 {
781 if (is_null($this->itemShippingAddresses)) {
783 $data = $this->raw(self::FIELD_ITEM_SHIPPING_ADDRESSES);
784 if (is_null($data)) {
785 return null;
786 }
787 $this->itemShippingAddresses = BaseAddressCollection::fromArray($data);
788 }
789
791 }
792
799 public function getDiscountCodes()
800 {
801 if (is_null($this->discountCodes)) {
803 $data = $this->raw(self::FIELD_DISCOUNT_CODES);
804 if (is_null($data)) {
805 return null;
806 }
807 $this->discountCodes = $data;
808 }
809
811 }
812
820 public function getCountry()
821 {
822 if (is_null($this->country)) {
824 $data = $this->raw(self::FIELD_COUNTRY);
825 if (is_null($data)) {
826 return null;
827 }
828 $this->country = (string) $data;
829 }
830
831 return $this->country;
832 }
833
840 public function getLocale()
841 {
842 if (is_null($this->locale)) {
844 $data = $this->raw(self::FIELD_LOCALE);
845 if (is_null($data)) {
846 return null;
847 }
848 $this->locale = (string) $data;
849 }
850
851 return $this->locale;
852 }
853
860 public function getOrigin()
861 {
862 if (is_null($this->origin)) {
864 $data = $this->raw(self::FIELD_ORIGIN);
865 if (is_null($data)) {
866 return null;
867 }
868 $this->origin = (string) $data;
869 }
870
871 return $this->origin;
872 }
873
883 {
884 if (is_null($this->deleteDaysAfterLastModification)) {
886 $data = $this->raw(self::FIELD_DELETE_DAYS_AFTER_LAST_MODIFICATION);
887 if (is_null($data)) {
888 return null;
889 }
890 $this->deleteDaysAfterLastModification = (int) $data;
891 }
892
894 }
895
902 public function getCustom()
903 {
904 if (is_null($this->custom)) {
906 $data = $this->raw(self::FIELD_CUSTOM);
907 if (is_null($data)) {
908 return null;
909 }
910
911 $this->custom = CustomFieldsDraftModel::of($data);
912 }
913
914 return $this->custom;
915 }
916
924 public function getPurchaseOrderNumber()
925 {
926 if (is_null($this->purchaseOrderNumber)) {
928 $data = $this->raw(self::FIELD_PURCHASE_ORDER_NUMBER);
929 if (is_null($data)) {
930 return null;
931 }
932 $this->purchaseOrderNumber = (string) $data;
933 }
934
936 }
937
938
942 public function setCurrency(?string $currency): void
943 {
944 $this->currency = $currency;
945 }
946
950 public function setKey(?string $key): void
951 {
952 $this->key = $key;
953 }
954
958 public function setCustomerId(?string $customerId): void
959 {
960 $this->customerId = $customerId;
961 }
962
966 public function setCustomerEmail(?string $customerEmail): void
967 {
968 $this->customerEmail = $customerEmail;
969 }
970
975 {
976 $this->customerGroup = $customerGroup;
977 }
978
982 public function setAnonymousId(?string $anonymousId): void
983 {
984 $this->anonymousId = $anonymousId;
985 }
986
991 {
992 $this->businessUnit = $businessUnit;
993 }
994
999 {
1000 $this->store = $store;
1001 }
1002
1007 {
1008 $this->lineItems = $lineItems;
1009 }
1010
1015 {
1016 $this->customLineItems = $customLineItems;
1017 }
1018
1022 public function setTaxMode(?string $taxMode): void
1023 {
1024 $this->taxMode = $taxMode;
1025 }
1026
1031 {
1032 $this->externalTaxRateForShippingMethod = $externalTaxRateForShippingMethod;
1033 }
1034
1038 public function setPriceRoundingMode(?string $priceRoundingMode): void
1039 {
1040 $this->priceRoundingMode = $priceRoundingMode;
1041 }
1042
1046 public function setTaxRoundingMode(?string $taxRoundingMode): void
1047 {
1048 $this->taxRoundingMode = $taxRoundingMode;
1049 }
1050
1054 public function setTaxCalculationMode(?string $taxCalculationMode): void
1055 {
1056 $this->taxCalculationMode = $taxCalculationMode;
1057 }
1058
1062 public function setInventoryMode(?string $inventoryMode): void
1063 {
1064 $this->inventoryMode = $inventoryMode;
1065 }
1066
1071 {
1072 $this->billingAddress = $billingAddress;
1073 }
1074
1079 {
1080 $this->shippingAddress = $shippingAddress;
1081 }
1082
1087 {
1088 $this->shippingMethod = $shippingMethod;
1089 }
1090
1095 {
1096 $this->shippingRateInput = $shippingRateInput;
1097 }
1098
1102 public function setShippingMode(?string $shippingMode): void
1103 {
1104 $this->shippingMode = $shippingMode;
1105 }
1106
1111 {
1112 $this->customShipping = $customShipping;
1113 }
1114
1119 {
1120 $this->shipping = $shipping;
1121 }
1122
1127 {
1128 $this->itemShippingAddresses = $itemShippingAddresses;
1129 }
1130
1134 public function setDiscountCodes(?array $discountCodes): void
1135 {
1136 $this->discountCodes = $discountCodes;
1137 }
1138
1142 public function setCountry(?string $country): void
1143 {
1144 $this->country = $country;
1145 }
1146
1150 public function setLocale(?string $locale): void
1151 {
1152 $this->locale = $locale;
1153 }
1154
1158 public function setOrigin(?string $origin): void
1159 {
1160 $this->origin = $origin;
1161 }
1162
1167 {
1168 $this->deleteDaysAfterLastModification = $deleteDaysAfterLastModification;
1169 }
1170
1174 public function setCustom(?CustomFieldsDraft $custom): void
1175 {
1176 $this->custom = $custom;
1177 }
1178
1182 public function setPurchaseOrderNumber(?string $purchaseOrderNumber): void
1183 {
1184 $this->purchaseOrderNumber = $purchaseOrderNumber;
1185 }
1186}
setStore(?StoreResourceIdentifier $store)
setShippingMethod(?ShippingMethodResourceIdentifier $shippingMethod)
setBusinessUnit(?BusinessUnitResourceIdentifier $businessUnit)
setPriceRoundingMode(?string $priceRoundingMode)
setShipping(?ShippingDraftCollection $shipping)
setShippingAddress(?BaseAddress $shippingAddress)
__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, ?string $country=null, ?string $locale=null, ?string $origin=null, ?int $deleteDaysAfterLastModification=null, ?CustomFieldsDraft $custom=null, ?string $purchaseOrderNumber=null)
setCustomLineItems(?CustomLineItemDraftCollection $customLineItems)
setShippingRateInput(?ShippingRateInputDraft $shippingRateInput)
setExternalTaxRateForShippingMethod(?ExternalTaxRateDraft $externalTaxRateForShippingMethod)
setItemShippingAddresses(?BaseAddressCollection $itemShippingAddresses)
setPurchaseOrderNumber(?string $purchaseOrderNumber)
setBillingAddress(?BaseAddress $billingAddress)
setCustomShipping(?CustomShippingDraftCollection $customShipping)
setTaxCalculationMode(?string $taxCalculationMode)
setLineItems(?LineItemDraftCollection $lineItems)
setDeleteDaysAfterLastModification(?int $deleteDaysAfterLastModification)
setCustomerGroup(?CustomerGroupResourceIdentifier $customerGroup)
static fromArray(array $data)