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
215
219 public function __construct(
220 ?string $currency = null,
221 ?string $key = null,
222 ?string $customerId = null,
223 ?string $customerEmail = null,
225 ?string $anonymousId = null,
230 ?string $taxMode = null,
232 ?string $priceRoundingMode = null,
233 ?string $taxRoundingMode = null,
234 ?string $taxCalculationMode = null,
235 ?string $inventoryMode = null,
240 ?string $shippingMode = null,
244 ?array $discountCodes = null,
245 ?string $country = null,
246 ?string $locale = null,
247 ?string $origin = null,
250 ) {
251 $this->currency = $currency;
252 $this->key = $key;
253 $this->customerId = $customerId;
254 $this->customerEmail = $customerEmail;
255 $this->customerGroup = $customerGroup;
256 $this->anonymousId = $anonymousId;
257 $this->businessUnit = $businessUnit;
258 $this->store = $store;
259 $this->lineItems = $lineItems;
260 $this->customLineItems = $customLineItems;
261 $this->taxMode = $taxMode;
262 $this->externalTaxRateForShippingMethod = $externalTaxRateForShippingMethod;
263 $this->priceRoundingMode = $priceRoundingMode;
264 $this->taxRoundingMode = $taxRoundingMode;
265 $this->taxCalculationMode = $taxCalculationMode;
266 $this->inventoryMode = $inventoryMode;
267 $this->billingAddress = $billingAddress;
268 $this->shippingAddress = $shippingAddress;
269 $this->shippingMethod = $shippingMethod;
270 $this->shippingRateInput = $shippingRateInput;
271 $this->shippingMode = $shippingMode;
272 $this->customShipping = $customShipping;
273 $this->shipping = $shipping;
274 $this->itemShippingAddresses = $itemShippingAddresses;
275 $this->discountCodes = $discountCodes;
276 $this->country = $country;
277 $this->locale = $locale;
278 $this->origin = $origin;
279 $this->deleteDaysAfterLastModification = $deleteDaysAfterLastModification;
280 $this->custom = $custom;
281 }
282
289 public function getCurrency()
290 {
291 if (is_null($this->currency)) {
293 $data = $this->raw(self::FIELD_CURRENCY);
294 if (is_null($data)) {
295 return null;
296 }
297 $this->currency = (string) $data;
298 }
299
300 return $this->currency;
301 }
302
309 public function getKey()
310 {
311 if (is_null($this->key)) {
313 $data = $this->raw(self::FIELD_KEY);
314 if (is_null($data)) {
315 return null;
316 }
317 $this->key = (string) $data;
318 }
319
320 return $this->key;
321 }
322
329 public function getCustomerId()
330 {
331 if (is_null($this->customerId)) {
333 $data = $this->raw(self::FIELD_CUSTOMER_ID);
334 if (is_null($data)) {
335 return null;
336 }
337 $this->customerId = (string) $data;
338 }
339
340 return $this->customerId;
341 }
342
349 public function getCustomerEmail()
350 {
351 if (is_null($this->customerEmail)) {
353 $data = $this->raw(self::FIELD_CUSTOMER_EMAIL);
354 if (is_null($data)) {
355 return null;
356 }
357 $this->customerEmail = (string) $data;
358 }
359
361 }
362
371 public function getCustomerGroup()
372 {
373 if (is_null($this->customerGroup)) {
375 $data = $this->raw(self::FIELD_CUSTOMER_GROUP);
376 if (is_null($data)) {
377 return null;
378 }
379
380 $this->customerGroup = CustomerGroupResourceIdentifierModel::of($data);
381 }
382
384 }
385
392 public function getAnonymousId()
393 {
394 if (is_null($this->anonymousId)) {
396 $data = $this->raw(self::FIELD_ANONYMOUS_ID);
397 if (is_null($data)) {
398 return null;
399 }
400 $this->anonymousId = (string) $data;
401 }
402
403 return $this->anonymousId;
404 }
405
412 public function getBusinessUnit()
413 {
414 if (is_null($this->businessUnit)) {
416 $data = $this->raw(self::FIELD_BUSINESS_UNIT);
417 if (is_null($data)) {
418 return null;
419 }
420
421 $this->businessUnit = BusinessUnitResourceIdentifierModel::of($data);
422 }
423
424 return $this->businessUnit;
425 }
426
433 public function getStore()
434 {
435 if (is_null($this->store)) {
437 $data = $this->raw(self::FIELD_STORE);
438 if (is_null($data)) {
439 return null;
440 }
441
442 $this->store = StoreResourceIdentifierModel::of($data);
443 }
444
445 return $this->store;
446 }
447
454 public function getLineItems()
455 {
456 if (is_null($this->lineItems)) {
458 $data = $this->raw(self::FIELD_LINE_ITEMS);
459 if (is_null($data)) {
460 return null;
461 }
462 $this->lineItems = LineItemDraftCollection::fromArray($data);
463 }
464
465 return $this->lineItems;
466 }
467
474 public function getCustomLineItems()
475 {
476 if (is_null($this->customLineItems)) {
478 $data = $this->raw(self::FIELD_CUSTOM_LINE_ITEMS);
479 if (is_null($data)) {
480 return null;
481 }
482 $this->customLineItems = CustomLineItemDraftCollection::fromArray($data);
483 }
484
486 }
487
494 public function getTaxMode()
495 {
496 if (is_null($this->taxMode)) {
498 $data = $this->raw(self::FIELD_TAX_MODE);
499 if (is_null($data)) {
500 return null;
501 }
502 $this->taxMode = (string) $data;
503 }
504
505 return $this->taxMode;
506 }
507
515 {
516 if (is_null($this->externalTaxRateForShippingMethod)) {
518 $data = $this->raw(self::FIELD_EXTERNAL_TAX_RATE_FOR_SHIPPING_METHOD);
519 if (is_null($data)) {
520 return null;
521 }
522
523 $this->externalTaxRateForShippingMethod = ExternalTaxRateDraftModel::of($data);
524 }
525
527 }
528
535 public function getPriceRoundingMode()
536 {
537 if (is_null($this->priceRoundingMode)) {
539 $data = $this->raw(self::FIELD_PRICE_ROUNDING_MODE);
540 if (is_null($data)) {
541 return null;
542 }
543 $this->priceRoundingMode = (string) $data;
544 }
545
547 }
548
555 public function getTaxRoundingMode()
556 {
557 if (is_null($this->taxRoundingMode)) {
559 $data = $this->raw(self::FIELD_TAX_ROUNDING_MODE);
560 if (is_null($data)) {
561 return null;
562 }
563 $this->taxRoundingMode = (string) $data;
564 }
565
567 }
568
575 public function getTaxCalculationMode()
576 {
577 if (is_null($this->taxCalculationMode)) {
579 $data = $this->raw(self::FIELD_TAX_CALCULATION_MODE);
580 if (is_null($data)) {
581 return null;
582 }
583 $this->taxCalculationMode = (string) $data;
584 }
585
587 }
588
595 public function getInventoryMode()
596 {
597 if (is_null($this->inventoryMode)) {
599 $data = $this->raw(self::FIELD_INVENTORY_MODE);
600 if (is_null($data)) {
601 return null;
602 }
603 $this->inventoryMode = (string) $data;
604 }
605
607 }
608
615 public function getBillingAddress()
616 {
617 if (is_null($this->billingAddress)) {
619 $data = $this->raw(self::FIELD_BILLING_ADDRESS);
620 if (is_null($data)) {
621 return null;
622 }
623
624 $this->billingAddress = BaseAddressModel::of($data);
625 }
626
628 }
629
637 public function getShippingAddress()
638 {
639 if (is_null($this->shippingAddress)) {
641 $data = $this->raw(self::FIELD_SHIPPING_ADDRESS);
642 if (is_null($data)) {
643 return null;
644 }
645
646 $this->shippingAddress = BaseAddressModel::of($data);
647 }
648
650 }
651
658 public function getShippingMethod()
659 {
660 if (is_null($this->shippingMethod)) {
662 $data = $this->raw(self::FIELD_SHIPPING_METHOD);
663 if (is_null($data)) {
664 return null;
665 }
666
667 $this->shippingMethod = ShippingMethodResourceIdentifierModel::of($data);
668 }
669
671 }
672
685 public function getShippingRateInput()
686 {
687 if (is_null($this->shippingRateInput)) {
689 $data = $this->raw(self::FIELD_SHIPPING_RATE_INPUT);
690 if (is_null($data)) {
691 return null;
692 }
694 $this->shippingRateInput = $className::of($data);
695 }
696
698 }
699
709 public function getShippingMode()
710 {
711 if (is_null($this->shippingMode)) {
713 $data = $this->raw(self::FIELD_SHIPPING_MODE);
714 if (is_null($data)) {
715 return null;
716 }
717 $this->shippingMode = (string) $data;
718 }
719
720 return $this->shippingMode;
721 }
722
729 public function getCustomShipping()
730 {
731 if (is_null($this->customShipping)) {
733 $data = $this->raw(self::FIELD_CUSTOM_SHIPPING);
734 if (is_null($data)) {
735 return null;
736 }
737 $this->customShipping = CustomShippingDraftCollection::fromArray($data);
738 }
739
741 }
742
749 public function getShipping()
750 {
751 if (is_null($this->shipping)) {
753 $data = $this->raw(self::FIELD_SHIPPING);
754 if (is_null($data)) {
755 return null;
756 }
757 $this->shipping = ShippingDraftCollection::fromArray($data);
758 }
759
760 return $this->shipping;
761 }
762
771 public function getItemShippingAddresses()
772 {
773 if (is_null($this->itemShippingAddresses)) {
775 $data = $this->raw(self::FIELD_ITEM_SHIPPING_ADDRESSES);
776 if (is_null($data)) {
777 return null;
778 }
779 $this->itemShippingAddresses = BaseAddressCollection::fromArray($data);
780 }
781
783 }
784
791 public function getDiscountCodes()
792 {
793 if (is_null($this->discountCodes)) {
795 $data = $this->raw(self::FIELD_DISCOUNT_CODES);
796 if (is_null($data)) {
797 return null;
798 }
799 $this->discountCodes = $data;
800 }
801
803 }
804
812 public function getCountry()
813 {
814 if (is_null($this->country)) {
816 $data = $this->raw(self::FIELD_COUNTRY);
817 if (is_null($data)) {
818 return null;
819 }
820 $this->country = (string) $data;
821 }
822
823 return $this->country;
824 }
825
832 public function getLocale()
833 {
834 if (is_null($this->locale)) {
836 $data = $this->raw(self::FIELD_LOCALE);
837 if (is_null($data)) {
838 return null;
839 }
840 $this->locale = (string) $data;
841 }
842
843 return $this->locale;
844 }
845
852 public function getOrigin()
853 {
854 if (is_null($this->origin)) {
856 $data = $this->raw(self::FIELD_ORIGIN);
857 if (is_null($data)) {
858 return null;
859 }
860 $this->origin = (string) $data;
861 }
862
863 return $this->origin;
864 }
865
875 {
876 if (is_null($this->deleteDaysAfterLastModification)) {
878 $data = $this->raw(self::FIELD_DELETE_DAYS_AFTER_LAST_MODIFICATION);
879 if (is_null($data)) {
880 return null;
881 }
882 $this->deleteDaysAfterLastModification = (int) $data;
883 }
884
886 }
887
894 public function getCustom()
895 {
896 if (is_null($this->custom)) {
898 $data = $this->raw(self::FIELD_CUSTOM);
899 if (is_null($data)) {
900 return null;
901 }
902
903 $this->custom = CustomFieldsDraftModel::of($data);
904 }
905
906 return $this->custom;
907 }
908
909
913 public function setCurrency(?string $currency): void
914 {
915 $this->currency = $currency;
916 }
917
921 public function setKey(?string $key): void
922 {
923 $this->key = $key;
924 }
925
929 public function setCustomerId(?string $customerId): void
930 {
931 $this->customerId = $customerId;
932 }
933
937 public function setCustomerEmail(?string $customerEmail): void
938 {
939 $this->customerEmail = $customerEmail;
940 }
941
946 {
947 $this->customerGroup = $customerGroup;
948 }
949
953 public function setAnonymousId(?string $anonymousId): void
954 {
955 $this->anonymousId = $anonymousId;
956 }
957
962 {
963 $this->businessUnit = $businessUnit;
964 }
965
970 {
971 $this->store = $store;
972 }
973
978 {
979 $this->lineItems = $lineItems;
980 }
981
986 {
987 $this->customLineItems = $customLineItems;
988 }
989
993 public function setTaxMode(?string $taxMode): void
994 {
995 $this->taxMode = $taxMode;
996 }
997
1002 {
1003 $this->externalTaxRateForShippingMethod = $externalTaxRateForShippingMethod;
1004 }
1005
1009 public function setPriceRoundingMode(?string $priceRoundingMode): void
1010 {
1011 $this->priceRoundingMode = $priceRoundingMode;
1012 }
1013
1017 public function setTaxRoundingMode(?string $taxRoundingMode): void
1018 {
1019 $this->taxRoundingMode = $taxRoundingMode;
1020 }
1021
1025 public function setTaxCalculationMode(?string $taxCalculationMode): void
1026 {
1027 $this->taxCalculationMode = $taxCalculationMode;
1028 }
1029
1033 public function setInventoryMode(?string $inventoryMode): void
1034 {
1035 $this->inventoryMode = $inventoryMode;
1036 }
1037
1042 {
1043 $this->billingAddress = $billingAddress;
1044 }
1045
1050 {
1051 $this->shippingAddress = $shippingAddress;
1052 }
1053
1058 {
1059 $this->shippingMethod = $shippingMethod;
1060 }
1061
1066 {
1067 $this->shippingRateInput = $shippingRateInput;
1068 }
1069
1073 public function setShippingMode(?string $shippingMode): void
1074 {
1075 $this->shippingMode = $shippingMode;
1076 }
1077
1082 {
1083 $this->customShipping = $customShipping;
1084 }
1085
1090 {
1091 $this->shipping = $shipping;
1092 }
1093
1098 {
1099 $this->itemShippingAddresses = $itemShippingAddresses;
1100 }
1101
1105 public function setDiscountCodes(?array $discountCodes): void
1106 {
1107 $this->discountCodes = $discountCodes;
1108 }
1109
1113 public function setCountry(?string $country): void
1114 {
1115 $this->country = $country;
1116 }
1117
1121 public function setLocale(?string $locale): void
1122 {
1123 $this->locale = $locale;
1124 }
1125
1129 public function setOrigin(?string $origin): void
1130 {
1131 $this->origin = $origin;
1132 }
1133
1138 {
1139 $this->deleteDaysAfterLastModification = $deleteDaysAfterLastModification;
1140 }
1141
1145 public function setCustom(?CustomFieldsDraft $custom): void
1146 {
1147 $this->custom = $custom;
1148 }
1149}
setStore(?StoreResourceIdentifier $store)
setShippingMethod(?ShippingMethodResourceIdentifier $shippingMethod)
setBusinessUnit(?BusinessUnitResourceIdentifier $businessUnit)
setPriceRoundingMode(?string $priceRoundingMode)
setShipping(?ShippingDraftCollection $shipping)
setShippingAddress(?BaseAddress $shippingAddress)
setCustomLineItems(?CustomLineItemDraftCollection $customLineItems)
__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)
setShippingRateInput(?ShippingRateInputDraft $shippingRateInput)
setExternalTaxRateForShippingMethod(?ExternalTaxRateDraft $externalTaxRateForShippingMethod)
setItemShippingAddresses(?BaseAddressCollection $itemShippingAddresses)
setBillingAddress(?BaseAddress $billingAddress)
setCustomShipping(?CustomShippingDraftCollection $customShipping)
setTaxCalculationMode(?string $taxCalculationMode)
setLineItems(?LineItemDraftCollection $lineItems)
setDeleteDaysAfterLastModification(?int $deleteDaysAfterLastModification)
setCustomerGroup(?CustomerGroupResourceIdentifier $customerGroup)
static fromArray(array $data)