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 $country;
191
196 private $locale;
197
202 private $origin;
203
208 private $deleteDaysAfterLastModification;
209
214 private $custom;
215
220 private $purchaseOrderNumber;
221
228 public function getCurrency()
229 {
230 return $this->currency;
231 }
232
239 public function getKey()
240 {
241 return $this->key;
242 }
243
250 public function getCustomerId()
251 {
252 return $this->customerId;
253 }
254
261 public function getCustomerEmail()
262 {
263 return $this->customerEmail;
264 }
265
274 public function getCustomerGroup()
275 {
276 return $this->customerGroup instanceof CustomerGroupResourceIdentifierBuilder ? $this->customerGroup->build() : $this->customerGroup;
277 }
278
285 public function getAnonymousId()
286 {
287 return $this->anonymousId;
288 }
289
296 public function getBusinessUnit()
297 {
298 return $this->businessUnit instanceof BusinessUnitResourceIdentifierBuilder ? $this->businessUnit->build() : $this->businessUnit;
299 }
300
307 public function getStore()
308 {
309 return $this->store instanceof StoreResourceIdentifierBuilder ? $this->store->build() : $this->store;
310 }
311
318 public function getLineItems()
319 {
320 return $this->lineItems;
321 }
322
329 public function getCustomLineItems()
330 {
331 return $this->customLineItems;
332 }
333
340 public function getTaxMode()
341 {
342 return $this->taxMode;
343 }
344
352 {
353 return $this->externalTaxRateForShippingMethod instanceof ExternalTaxRateDraftBuilder ? $this->externalTaxRateForShippingMethod->build() : $this->externalTaxRateForShippingMethod;
354 }
355
362 public function getPriceRoundingMode()
363 {
364 return $this->priceRoundingMode;
365 }
366
373 public function getTaxRoundingMode()
374 {
375 return $this->taxRoundingMode;
376 }
377
384 public function getTaxCalculationMode()
385 {
386 return $this->taxCalculationMode;
387 }
388
395 public function getInventoryMode()
396 {
397 return $this->inventoryMode;
398 }
399
406 public function getBillingAddress()
407 {
408 return $this->billingAddress instanceof BaseAddressBuilder ? $this->billingAddress->build() : $this->billingAddress;
409 }
410
418 public function getShippingAddress()
419 {
420 return $this->shippingAddress instanceof BaseAddressBuilder ? $this->shippingAddress->build() : $this->shippingAddress;
421 }
422
429 public function getShippingMethod()
430 {
431 return $this->shippingMethod instanceof ShippingMethodResourceIdentifierBuilder ? $this->shippingMethod->build() : $this->shippingMethod;
432 }
433
446 public function getShippingRateInput()
447 {
448 return $this->shippingRateInput instanceof ShippingRateInputDraftBuilder ? $this->shippingRateInput->build() : $this->shippingRateInput;
449 }
450
460 public function getShippingMode()
461 {
462 return $this->shippingMode;
463 }
464
471 public function getCustomShipping()
472 {
473 return $this->customShipping;
474 }
475
482 public function getShipping()
483 {
484 return $this->shipping;
485 }
486
495 public function getItemShippingAddresses()
496 {
497 return $this->itemShippingAddresses;
498 }
499
506 public function getDiscountCodes()
507 {
508 return $this->discountCodes;
509 }
510
518 public function getCountry()
519 {
520 return $this->country;
521 }
522
529 public function getLocale()
530 {
531 return $this->locale;
532 }
533
540 public function getOrigin()
541 {
542 return $this->origin;
543 }
544
554 {
555 return $this->deleteDaysAfterLastModification;
556 }
557
564 public function getCustom()
565 {
566 return $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom;
567 }
568
576 public function getPurchaseOrderNumber()
577 {
578 return $this->purchaseOrderNumber;
579 }
580
585 public function withCurrency(?string $currency)
586 {
587 $this->currency = $currency;
588
589 return $this;
590 }
591
596 public function withKey(?string $key)
597 {
598 $this->key = $key;
599
600 return $this;
601 }
602
607 public function withCustomerId(?string $customerId)
608 {
609 $this->customerId = $customerId;
610
611 return $this;
612 }
613
618 public function withCustomerEmail(?string $customerEmail)
619 {
620 $this->customerEmail = $customerEmail;
621
622 return $this;
623 }
624
629 public function withCustomerGroup(?CustomerGroupResourceIdentifier $customerGroup)
630 {
631 $this->customerGroup = $customerGroup;
632
633 return $this;
634 }
635
640 public function withAnonymousId(?string $anonymousId)
641 {
642 $this->anonymousId = $anonymousId;
643
644 return $this;
645 }
646
651 public function withBusinessUnit(?BusinessUnitResourceIdentifier $businessUnit)
652 {
653 $this->businessUnit = $businessUnit;
654
655 return $this;
656 }
657
662 public function withStore(?StoreResourceIdentifier $store)
663 {
664 $this->store = $store;
665
666 return $this;
667 }
668
673 public function withLineItems(?LineItemDraftCollection $lineItems)
674 {
675 $this->lineItems = $lineItems;
676
677 return $this;
678 }
679
684 public function withCustomLineItems(?CustomLineItemDraftCollection $customLineItems)
685 {
686 $this->customLineItems = $customLineItems;
687
688 return $this;
689 }
690
695 public function withTaxMode(?string $taxMode)
696 {
697 $this->taxMode = $taxMode;
698
699 return $this;
700 }
701
706 public function withExternalTaxRateForShippingMethod(?ExternalTaxRateDraft $externalTaxRateForShippingMethod)
707 {
708 $this->externalTaxRateForShippingMethod = $externalTaxRateForShippingMethod;
709
710 return $this;
711 }
712
717 public function withPriceRoundingMode(?string $priceRoundingMode)
718 {
719 $this->priceRoundingMode = $priceRoundingMode;
720
721 return $this;
722 }
723
728 public function withTaxRoundingMode(?string $taxRoundingMode)
729 {
730 $this->taxRoundingMode = $taxRoundingMode;
731
732 return $this;
733 }
734
739 public function withTaxCalculationMode(?string $taxCalculationMode)
740 {
741 $this->taxCalculationMode = $taxCalculationMode;
742
743 return $this;
744 }
745
750 public function withInventoryMode(?string $inventoryMode)
751 {
752 $this->inventoryMode = $inventoryMode;
753
754 return $this;
755 }
756
761 public function withBillingAddress(?BaseAddress $billingAddress)
762 {
763 $this->billingAddress = $billingAddress;
764
765 return $this;
766 }
767
772 public function withShippingAddress(?BaseAddress $shippingAddress)
773 {
774 $this->shippingAddress = $shippingAddress;
775
776 return $this;
777 }
778
783 public function withShippingMethod(?ShippingMethodResourceIdentifier $shippingMethod)
784 {
785 $this->shippingMethod = $shippingMethod;
786
787 return $this;
788 }
789
794 public function withShippingRateInput(?ShippingRateInputDraft $shippingRateInput)
795 {
796 $this->shippingRateInput = $shippingRateInput;
797
798 return $this;
799 }
800
805 public function withShippingMode(?string $shippingMode)
806 {
807 $this->shippingMode = $shippingMode;
808
809 return $this;
810 }
811
816 public function withCustomShipping(?CustomShippingDraftCollection $customShipping)
817 {
818 $this->customShipping = $customShipping;
819
820 return $this;
821 }
822
827 public function withShipping(?ShippingDraftCollection $shipping)
828 {
829 $this->shipping = $shipping;
830
831 return $this;
832 }
833
838 public function withItemShippingAddresses(?BaseAddressCollection $itemShippingAddresses)
839 {
840 $this->itemShippingAddresses = $itemShippingAddresses;
841
842 return $this;
843 }
844
849 public function withDiscountCodes(?array $discountCodes)
850 {
851 $this->discountCodes = $discountCodes;
852
853 return $this;
854 }
855
860 public function withCountry(?string $country)
861 {
862 $this->country = $country;
863
864 return $this;
865 }
866
871 public function withLocale(?string $locale)
872 {
873 $this->locale = $locale;
874
875 return $this;
876 }
877
882 public function withOrigin(?string $origin)
883 {
884 $this->origin = $origin;
885
886 return $this;
887 }
888
893 public function withDeleteDaysAfterLastModification(?int $deleteDaysAfterLastModification)
894 {
895 $this->deleteDaysAfterLastModification = $deleteDaysAfterLastModification;
896
897 return $this;
898 }
899
904 public function withCustom(?CustomFieldsDraft $custom)
905 {
906 $this->custom = $custom;
907
908 return $this;
909 }
910
915 public function withPurchaseOrderNumber(?string $purchaseOrderNumber)
916 {
917 $this->purchaseOrderNumber = $purchaseOrderNumber;
918
919 return $this;
920 }
921
927 {
928 $this->customerGroup = $customerGroup;
929
930 return $this;
931 }
932
938 {
939 $this->businessUnit = $businessUnit;
940
941 return $this;
942 }
943
949 {
950 $this->store = $store;
951
952 return $this;
953 }
954
959 public function withExternalTaxRateForShippingMethodBuilder(?ExternalTaxRateDraftBuilder $externalTaxRateForShippingMethod)
960 {
961 $this->externalTaxRateForShippingMethod = $externalTaxRateForShippingMethod;
962
963 return $this;
964 }
965
970 public function withBillingAddressBuilder(?BaseAddressBuilder $billingAddress)
971 {
972 $this->billingAddress = $billingAddress;
973
974 return $this;
975 }
976
981 public function withShippingAddressBuilder(?BaseAddressBuilder $shippingAddress)
982 {
983 $this->shippingAddress = $shippingAddress;
984
985 return $this;
986 }
987
993 {
994 $this->shippingMethod = $shippingMethod;
995
996 return $this;
997 }
998
1004 {
1005 $this->shippingRateInput = $shippingRateInput;
1006
1007 return $this;
1008 }
1009
1015 {
1016 $this->custom = $custom;
1017
1018 return $this;
1019 }
1020
1021 public function build(): CartDraft
1022 {
1023 return new CartDraftModel(
1024 $this->currency,
1025 $this->key,
1026 $this->customerId,
1027 $this->customerEmail,
1028 $this->customerGroup instanceof CustomerGroupResourceIdentifierBuilder ? $this->customerGroup->build() : $this->customerGroup,
1029 $this->anonymousId,
1030 $this->businessUnit instanceof BusinessUnitResourceIdentifierBuilder ? $this->businessUnit->build() : $this->businessUnit,
1031 $this->store instanceof StoreResourceIdentifierBuilder ? $this->store->build() : $this->store,
1032 $this->lineItems,
1033 $this->customLineItems,
1034 $this->taxMode,
1035 $this->externalTaxRateForShippingMethod instanceof ExternalTaxRateDraftBuilder ? $this->externalTaxRateForShippingMethod->build() : $this->externalTaxRateForShippingMethod,
1036 $this->priceRoundingMode,
1037 $this->taxRoundingMode,
1038 $this->taxCalculationMode,
1039 $this->inventoryMode,
1040 $this->billingAddress instanceof BaseAddressBuilder ? $this->billingAddress->build() : $this->billingAddress,
1041 $this->shippingAddress instanceof BaseAddressBuilder ? $this->shippingAddress->build() : $this->shippingAddress,
1042 $this->shippingMethod instanceof ShippingMethodResourceIdentifierBuilder ? $this->shippingMethod->build() : $this->shippingMethod,
1043 $this->shippingRateInput instanceof ShippingRateInputDraftBuilder ? $this->shippingRateInput->build() : $this->shippingRateInput,
1044 $this->shippingMode,
1045 $this->customShipping,
1046 $this->shipping,
1047 $this->itemShippingAddresses,
1048 $this->discountCodes,
1049 $this->country,
1050 $this->locale,
1051 $this->origin,
1052 $this->deleteDaysAfterLastModification,
1053 $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom,
1054 $this->purchaseOrderNumber
1055 );
1056 }
1057
1058 public static function of(): CartDraftBuilder
1059 {
1060 return new self();
1061 }
1062}
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)