commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
CartDraftBuilder.php
1<?php
2
3declare(strict_types=1);
10
29use stdClass;
30
34final class CartDraftBuilder implements Builder
35{
40 private $currency;
41
46 private $key;
47
52 private $customerId;
53
58 private $customerEmail;
59
64 private $customerGroup;
65
70 private $anonymousId;
71
76 private $businessUnit;
77
82 private $store;
83
88 private $lineItems;
89
94 private $customLineItems;
95
100 private $taxMode;
101
106 private $externalTaxRateForShippingMethod;
107
112 private $priceRoundingMode;
113
118 private $taxRoundingMode;
119
124 private $taxCalculationMode;
125
130 private $inventoryMode;
131
136 private $billingAddress;
137
142 private $shippingAddress;
143
148 private $shippingMethod;
149
154 private $shippingRateInput;
155
160 private $shippingMode;
161
166 private $customShipping;
167
172 private $shipping;
173
178 private $itemShippingAddresses;
179
184 private $discountCodes;
185
190 private $directDiscountsIgnoreCartDiscounts;
191
196 private $country;
197
202 private $locale;
203
208 private $origin;
209
214 private $deleteDaysAfterLastModification;
215
220 private $custom;
221
226 private $purchaseOrderNumber;
227
234 public function getCurrency()
235 {
236 return $this->currency;
237 }
238
245 public function getKey()
246 {
247 return $this->key;
248 }
249
256 public function getCustomerId()
257 {
258 return $this->customerId;
259 }
260
267 public function getCustomerEmail()
268 {
269 return $this->customerEmail;
270 }
271
280 public function getCustomerGroup()
281 {
282 return $this->customerGroup instanceof CustomerGroupResourceIdentifierBuilder ? $this->customerGroup->build() : $this->customerGroup;
283 }
284
291 public function getAnonymousId()
292 {
293 return $this->anonymousId;
294 }
295
302 public function getBusinessUnit()
303 {
304 return $this->businessUnit instanceof BusinessUnitResourceIdentifierBuilder ? $this->businessUnit->build() : $this->businessUnit;
305 }
306
313 public function getStore()
314 {
315 return $this->store instanceof StoreResourceIdentifierBuilder ? $this->store->build() : $this->store;
316 }
317
324 public function getLineItems()
325 {
326 return $this->lineItems;
327 }
328
335 public function getCustomLineItems()
336 {
337 return $this->customLineItems;
338 }
339
346 public function getTaxMode()
347 {
348 return $this->taxMode;
349 }
350
358 {
359 return $this->externalTaxRateForShippingMethod instanceof ExternalTaxRateDraftBuilder ? $this->externalTaxRateForShippingMethod->build() : $this->externalTaxRateForShippingMethod;
360 }
361
368 public function getPriceRoundingMode()
369 {
370 return $this->priceRoundingMode;
371 }
372
379 public function getTaxRoundingMode()
380 {
381 return $this->taxRoundingMode;
382 }
383
390 public function getTaxCalculationMode()
391 {
392 return $this->taxCalculationMode;
393 }
394
401 public function getInventoryMode()
402 {
403 return $this->inventoryMode;
404 }
405
412 public function getBillingAddress()
413 {
414 return $this->billingAddress instanceof BaseAddressBuilder ? $this->billingAddress->build() : $this->billingAddress;
415 }
416
424 public function getShippingAddress()
425 {
426 return $this->shippingAddress instanceof BaseAddressBuilder ? $this->shippingAddress->build() : $this->shippingAddress;
427 }
428
435 public function getShippingMethod()
436 {
437 return $this->shippingMethod instanceof ShippingMethodResourceIdentifierBuilder ? $this->shippingMethod->build() : $this->shippingMethod;
438 }
439
452 public function getShippingRateInput()
453 {
454 return $this->shippingRateInput instanceof ShippingRateInputDraftBuilder ? $this->shippingRateInput->build() : $this->shippingRateInput;
455 }
456
466 public function getShippingMode()
467 {
468 return $this->shippingMode;
469 }
470
477 public function getCustomShipping()
478 {
479 return $this->customShipping;
480 }
481
488 public function getShipping()
489 {
490 return $this->shipping;
491 }
492
501 public function getItemShippingAddresses()
502 {
503 return $this->itemShippingAddresses;
504 }
505
512 public function getDiscountCodes()
513 {
514 return $this->discountCodes;
515 }
516
527 {
528 return $this->directDiscountsIgnoreCartDiscounts;
529 }
530
538 public function getCountry()
539 {
540 return $this->country;
541 }
542
549 public function getLocale()
550 {
551 return $this->locale;
552 }
553
560 public function getOrigin()
561 {
562 return $this->origin;
563 }
564
574 {
575 return $this->deleteDaysAfterLastModification;
576 }
577
584 public function getCustom()
585 {
586 return $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom;
587 }
588
596 public function getPurchaseOrderNumber()
597 {
598 return $this->purchaseOrderNumber;
599 }
600
605 public function withCurrency(?string $currency)
606 {
607 $this->currency = $currency;
608
609 return $this;
610 }
611
616 public function withKey(?string $key)
617 {
618 $this->key = $key;
619
620 return $this;
621 }
622
627 public function withCustomerId(?string $customerId)
628 {
629 $this->customerId = $customerId;
630
631 return $this;
632 }
633
638 public function withCustomerEmail(?string $customerEmail)
639 {
640 $this->customerEmail = $customerEmail;
641
642 return $this;
643 }
644
649 public function withCustomerGroup(?CustomerGroupResourceIdentifier $customerGroup)
650 {
651 $this->customerGroup = $customerGroup;
652
653 return $this;
654 }
655
660 public function withAnonymousId(?string $anonymousId)
661 {
662 $this->anonymousId = $anonymousId;
663
664 return $this;
665 }
666
671 public function withBusinessUnit(?BusinessUnitResourceIdentifier $businessUnit)
672 {
673 $this->businessUnit = $businessUnit;
674
675 return $this;
676 }
677
682 public function withStore(?StoreResourceIdentifier $store)
683 {
684 $this->store = $store;
685
686 return $this;
687 }
688
693 public function withLineItems(?LineItemDraftCollection $lineItems)
694 {
695 $this->lineItems = $lineItems;
696
697 return $this;
698 }
699
704 public function withCustomLineItems(?CustomLineItemDraftCollection $customLineItems)
705 {
706 $this->customLineItems = $customLineItems;
707
708 return $this;
709 }
710
715 public function withTaxMode(?string $taxMode)
716 {
717 $this->taxMode = $taxMode;
718
719 return $this;
720 }
721
726 public function withExternalTaxRateForShippingMethod(?ExternalTaxRateDraft $externalTaxRateForShippingMethod)
727 {
728 $this->externalTaxRateForShippingMethod = $externalTaxRateForShippingMethod;
729
730 return $this;
731 }
732
737 public function withPriceRoundingMode(?string $priceRoundingMode)
738 {
739 $this->priceRoundingMode = $priceRoundingMode;
740
741 return $this;
742 }
743
748 public function withTaxRoundingMode(?string $taxRoundingMode)
749 {
750 $this->taxRoundingMode = $taxRoundingMode;
751
752 return $this;
753 }
754
759 public function withTaxCalculationMode(?string $taxCalculationMode)
760 {
761 $this->taxCalculationMode = $taxCalculationMode;
762
763 return $this;
764 }
765
770 public function withInventoryMode(?string $inventoryMode)
771 {
772 $this->inventoryMode = $inventoryMode;
773
774 return $this;
775 }
776
781 public function withBillingAddress(?BaseAddress $billingAddress)
782 {
783 $this->billingAddress = $billingAddress;
784
785 return $this;
786 }
787
792 public function withShippingAddress(?BaseAddress $shippingAddress)
793 {
794 $this->shippingAddress = $shippingAddress;
795
796 return $this;
797 }
798
803 public function withShippingMethod(?ShippingMethodResourceIdentifier $shippingMethod)
804 {
805 $this->shippingMethod = $shippingMethod;
806
807 return $this;
808 }
809
814 public function withShippingRateInput(?ShippingRateInputDraft $shippingRateInput)
815 {
816 $this->shippingRateInput = $shippingRateInput;
817
818 return $this;
819 }
820
825 public function withShippingMode(?string $shippingMode)
826 {
827 $this->shippingMode = $shippingMode;
828
829 return $this;
830 }
831
836 public function withCustomShipping(?CustomShippingDraftCollection $customShipping)
837 {
838 $this->customShipping = $customShipping;
839
840 return $this;
841 }
842
847 public function withShipping(?ShippingDraftCollection $shipping)
848 {
849 $this->shipping = $shipping;
850
851 return $this;
852 }
853
858 public function withItemShippingAddresses(?BaseAddressCollection $itemShippingAddresses)
859 {
860 $this->itemShippingAddresses = $itemShippingAddresses;
861
862 return $this;
863 }
864
869 public function withDiscountCodes(?array $discountCodes)
870 {
871 $this->discountCodes = $discountCodes;
872
873 return $this;
874 }
875
880 public function withDirectDiscountsIgnoreCartDiscounts(?bool $directDiscountsIgnoreCartDiscounts)
881 {
882 $this->directDiscountsIgnoreCartDiscounts = $directDiscountsIgnoreCartDiscounts;
883
884 return $this;
885 }
886
891 public function withCountry(?string $country)
892 {
893 $this->country = $country;
894
895 return $this;
896 }
897
902 public function withLocale(?string $locale)
903 {
904 $this->locale = $locale;
905
906 return $this;
907 }
908
913 public function withOrigin(?string $origin)
914 {
915 $this->origin = $origin;
916
917 return $this;
918 }
919
924 public function withDeleteDaysAfterLastModification(?int $deleteDaysAfterLastModification)
925 {
926 $this->deleteDaysAfterLastModification = $deleteDaysAfterLastModification;
927
928 return $this;
929 }
930
935 public function withCustom(?CustomFieldsDraft $custom)
936 {
937 $this->custom = $custom;
938
939 return $this;
940 }
941
946 public function withPurchaseOrderNumber(?string $purchaseOrderNumber)
947 {
948 $this->purchaseOrderNumber = $purchaseOrderNumber;
949
950 return $this;
951 }
952
958 {
959 $this->customerGroup = $customerGroup;
960
961 return $this;
962 }
963
969 {
970 $this->businessUnit = $businessUnit;
971
972 return $this;
973 }
974
980 {
981 $this->store = $store;
982
983 return $this;
984 }
985
990 public function withExternalTaxRateForShippingMethodBuilder(?ExternalTaxRateDraftBuilder $externalTaxRateForShippingMethod)
991 {
992 $this->externalTaxRateForShippingMethod = $externalTaxRateForShippingMethod;
993
994 return $this;
995 }
996
1001 public function withBillingAddressBuilder(?BaseAddressBuilder $billingAddress)
1002 {
1003 $this->billingAddress = $billingAddress;
1004
1005 return $this;
1006 }
1007
1012 public function withShippingAddressBuilder(?BaseAddressBuilder $shippingAddress)
1013 {
1014 $this->shippingAddress = $shippingAddress;
1015
1016 return $this;
1017 }
1018
1024 {
1025 $this->shippingMethod = $shippingMethod;
1026
1027 return $this;
1028 }
1029
1035 {
1036 $this->shippingRateInput = $shippingRateInput;
1037
1038 return $this;
1039 }
1040
1046 {
1047 $this->custom = $custom;
1048
1049 return $this;
1050 }
1051
1052 public function build(): CartDraft
1053 {
1054 return new CartDraftModel(
1055 $this->currency,
1056 $this->key,
1057 $this->customerId,
1058 $this->customerEmail,
1059 $this->customerGroup instanceof CustomerGroupResourceIdentifierBuilder ? $this->customerGroup->build() : $this->customerGroup,
1060 $this->anonymousId,
1061 $this->businessUnit instanceof BusinessUnitResourceIdentifierBuilder ? $this->businessUnit->build() : $this->businessUnit,
1062 $this->store instanceof StoreResourceIdentifierBuilder ? $this->store->build() : $this->store,
1063 $this->lineItems,
1064 $this->customLineItems,
1065 $this->taxMode,
1066 $this->externalTaxRateForShippingMethod instanceof ExternalTaxRateDraftBuilder ? $this->externalTaxRateForShippingMethod->build() : $this->externalTaxRateForShippingMethod,
1067 $this->priceRoundingMode,
1068 $this->taxRoundingMode,
1069 $this->taxCalculationMode,
1070 $this->inventoryMode,
1071 $this->billingAddress instanceof BaseAddressBuilder ? $this->billingAddress->build() : $this->billingAddress,
1072 $this->shippingAddress instanceof BaseAddressBuilder ? $this->shippingAddress->build() : $this->shippingAddress,
1073 $this->shippingMethod instanceof ShippingMethodResourceIdentifierBuilder ? $this->shippingMethod->build() : $this->shippingMethod,
1074 $this->shippingRateInput instanceof ShippingRateInputDraftBuilder ? $this->shippingRateInput->build() : $this->shippingRateInput,
1075 $this->shippingMode,
1076 $this->customShipping,
1077 $this->shipping,
1078 $this->itemShippingAddresses,
1079 $this->discountCodes,
1080 $this->directDiscountsIgnoreCartDiscounts,
1081 $this->country,
1082 $this->locale,
1083 $this->origin,
1084 $this->deleteDaysAfterLastModification,
1085 $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom,
1086 $this->purchaseOrderNumber
1087 );
1088 }
1089
1090 public static function of(): CartDraftBuilder
1091 {
1092 return new self();
1093 }
1094}
withDirectDiscountsIgnoreCartDiscounts(?bool $directDiscountsIgnoreCartDiscounts)
withCustomShipping(?CustomShippingDraftCollection $customShipping)
withBusinessUnit(?BusinessUnitResourceIdentifier $businessUnit)
withShipping(?ShippingDraftCollection $shipping)
withShippingAddressBuilder(?BaseAddressBuilder $shippingAddress)
withExternalTaxRateForShippingMethodBuilder(?ExternalTaxRateDraftBuilder $externalTaxRateForShippingMethod)
withShippingAddress(?BaseAddress $shippingAddress)
withShippingRateInputBuilder(?ShippingRateInputDraftBuilder $shippingRateInput)
withShippingRateInput(?ShippingRateInputDraft $shippingRateInput)
withShippingMethodBuilder(?ShippingMethodResourceIdentifierBuilder $shippingMethod)
withTaxCalculationMode(?string $taxCalculationMode)
withCustomerGroup(?CustomerGroupResourceIdentifier $customerGroup)
withBusinessUnitBuilder(?BusinessUnitResourceIdentifierBuilder $businessUnit)
withExternalTaxRateForShippingMethod(?ExternalTaxRateDraft $externalTaxRateForShippingMethod)
withLineItems(?LineItemDraftCollection $lineItems)
withCustomBuilder(?CustomFieldsDraftBuilder $custom)
withCustomerGroupBuilder(?CustomerGroupResourceIdentifierBuilder $customerGroup)
withCustomLineItems(?CustomLineItemDraftCollection $customLineItems)
withShippingMethod(?ShippingMethodResourceIdentifier $shippingMethod)
withStoreBuilder(?StoreResourceIdentifierBuilder $store)
withItemShippingAddresses(?BaseAddressCollection $itemShippingAddresses)
withBillingAddressBuilder(?BaseAddressBuilder $billingAddress)
withDeleteDaysAfterLastModification(?int $deleteDaysAfterLastModification)
withPurchaseOrderNumber(?string $purchaseOrderNumber)