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
222 public function getCurrency()
223 {
224 return $this->currency;
225 }
226
233 public function getKey()
234 {
235 return $this->key;
236 }
237
244 public function getCustomerId()
245 {
246 return $this->customerId;
247 }
248
255 public function getCustomerEmail()
256 {
257 return $this->customerEmail;
258 }
259
268 public function getCustomerGroup()
269 {
270 return $this->customerGroup instanceof CustomerGroupResourceIdentifierBuilder ? $this->customerGroup->build() : $this->customerGroup;
271 }
272
279 public function getAnonymousId()
280 {
281 return $this->anonymousId;
282 }
283
290 public function getBusinessUnit()
291 {
292 return $this->businessUnit instanceof BusinessUnitResourceIdentifierBuilder ? $this->businessUnit->build() : $this->businessUnit;
293 }
294
301 public function getStore()
302 {
303 return $this->store instanceof StoreResourceIdentifierBuilder ? $this->store->build() : $this->store;
304 }
305
312 public function getLineItems()
313 {
314 return $this->lineItems;
315 }
316
323 public function getCustomLineItems()
324 {
325 return $this->customLineItems;
326 }
327
334 public function getTaxMode()
335 {
336 return $this->taxMode;
337 }
338
346 {
347 return $this->externalTaxRateForShippingMethod instanceof ExternalTaxRateDraftBuilder ? $this->externalTaxRateForShippingMethod->build() : $this->externalTaxRateForShippingMethod;
348 }
349
356 public function getPriceRoundingMode()
357 {
358 return $this->priceRoundingMode;
359 }
360
367 public function getTaxRoundingMode()
368 {
369 return $this->taxRoundingMode;
370 }
371
378 public function getTaxCalculationMode()
379 {
380 return $this->taxCalculationMode;
381 }
382
389 public function getInventoryMode()
390 {
391 return $this->inventoryMode;
392 }
393
400 public function getBillingAddress()
401 {
402 return $this->billingAddress instanceof BaseAddressBuilder ? $this->billingAddress->build() : $this->billingAddress;
403 }
404
412 public function getShippingAddress()
413 {
414 return $this->shippingAddress instanceof BaseAddressBuilder ? $this->shippingAddress->build() : $this->shippingAddress;
415 }
416
423 public function getShippingMethod()
424 {
425 return $this->shippingMethod instanceof ShippingMethodResourceIdentifierBuilder ? $this->shippingMethod->build() : $this->shippingMethod;
426 }
427
440 public function getShippingRateInput()
441 {
442 return $this->shippingRateInput instanceof ShippingRateInputDraftBuilder ? $this->shippingRateInput->build() : $this->shippingRateInput;
443 }
444
454 public function getShippingMode()
455 {
456 return $this->shippingMode;
457 }
458
465 public function getCustomShipping()
466 {
467 return $this->customShipping;
468 }
469
476 public function getShipping()
477 {
478 return $this->shipping;
479 }
480
489 public function getItemShippingAddresses()
490 {
491 return $this->itemShippingAddresses;
492 }
493
500 public function getDiscountCodes()
501 {
502 return $this->discountCodes;
503 }
504
512 public function getCountry()
513 {
514 return $this->country;
515 }
516
523 public function getLocale()
524 {
525 return $this->locale;
526 }
527
534 public function getOrigin()
535 {
536 return $this->origin;
537 }
538
548 {
549 return $this->deleteDaysAfterLastModification;
550 }
551
558 public function getCustom()
559 {
560 return $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom;
561 }
562
567 public function withCurrency(?string $currency)
568 {
569 $this->currency = $currency;
570
571 return $this;
572 }
573
578 public function withKey(?string $key)
579 {
580 $this->key = $key;
581
582 return $this;
583 }
584
589 public function withCustomerId(?string $customerId)
590 {
591 $this->customerId = $customerId;
592
593 return $this;
594 }
595
600 public function withCustomerEmail(?string $customerEmail)
601 {
602 $this->customerEmail = $customerEmail;
603
604 return $this;
605 }
606
611 public function withCustomerGroup(?CustomerGroupResourceIdentifier $customerGroup)
612 {
613 $this->customerGroup = $customerGroup;
614
615 return $this;
616 }
617
622 public function withAnonymousId(?string $anonymousId)
623 {
624 $this->anonymousId = $anonymousId;
625
626 return $this;
627 }
628
633 public function withBusinessUnit(?BusinessUnitResourceIdentifier $businessUnit)
634 {
635 $this->businessUnit = $businessUnit;
636
637 return $this;
638 }
639
644 public function withStore(?StoreResourceIdentifier $store)
645 {
646 $this->store = $store;
647
648 return $this;
649 }
650
655 public function withLineItems(?LineItemDraftCollection $lineItems)
656 {
657 $this->lineItems = $lineItems;
658
659 return $this;
660 }
661
666 public function withCustomLineItems(?CustomLineItemDraftCollection $customLineItems)
667 {
668 $this->customLineItems = $customLineItems;
669
670 return $this;
671 }
672
677 public function withTaxMode(?string $taxMode)
678 {
679 $this->taxMode = $taxMode;
680
681 return $this;
682 }
683
688 public function withExternalTaxRateForShippingMethod(?ExternalTaxRateDraft $externalTaxRateForShippingMethod)
689 {
690 $this->externalTaxRateForShippingMethod = $externalTaxRateForShippingMethod;
691
692 return $this;
693 }
694
699 public function withPriceRoundingMode(?string $priceRoundingMode)
700 {
701 $this->priceRoundingMode = $priceRoundingMode;
702
703 return $this;
704 }
705
710 public function withTaxRoundingMode(?string $taxRoundingMode)
711 {
712 $this->taxRoundingMode = $taxRoundingMode;
713
714 return $this;
715 }
716
721 public function withTaxCalculationMode(?string $taxCalculationMode)
722 {
723 $this->taxCalculationMode = $taxCalculationMode;
724
725 return $this;
726 }
727
732 public function withInventoryMode(?string $inventoryMode)
733 {
734 $this->inventoryMode = $inventoryMode;
735
736 return $this;
737 }
738
743 public function withBillingAddress(?BaseAddress $billingAddress)
744 {
745 $this->billingAddress = $billingAddress;
746
747 return $this;
748 }
749
754 public function withShippingAddress(?BaseAddress $shippingAddress)
755 {
756 $this->shippingAddress = $shippingAddress;
757
758 return $this;
759 }
760
765 public function withShippingMethod(?ShippingMethodResourceIdentifier $shippingMethod)
766 {
767 $this->shippingMethod = $shippingMethod;
768
769 return $this;
770 }
771
776 public function withShippingRateInput(?ShippingRateInputDraft $shippingRateInput)
777 {
778 $this->shippingRateInput = $shippingRateInput;
779
780 return $this;
781 }
782
787 public function withShippingMode(?string $shippingMode)
788 {
789 $this->shippingMode = $shippingMode;
790
791 return $this;
792 }
793
798 public function withCustomShipping(?CustomShippingDraftCollection $customShipping)
799 {
800 $this->customShipping = $customShipping;
801
802 return $this;
803 }
804
809 public function withShipping(?ShippingDraftCollection $shipping)
810 {
811 $this->shipping = $shipping;
812
813 return $this;
814 }
815
820 public function withItemShippingAddresses(?BaseAddressCollection $itemShippingAddresses)
821 {
822 $this->itemShippingAddresses = $itemShippingAddresses;
823
824 return $this;
825 }
826
831 public function withDiscountCodes(?array $discountCodes)
832 {
833 $this->discountCodes = $discountCodes;
834
835 return $this;
836 }
837
842 public function withCountry(?string $country)
843 {
844 $this->country = $country;
845
846 return $this;
847 }
848
853 public function withLocale(?string $locale)
854 {
855 $this->locale = $locale;
856
857 return $this;
858 }
859
864 public function withOrigin(?string $origin)
865 {
866 $this->origin = $origin;
867
868 return $this;
869 }
870
875 public function withDeleteDaysAfterLastModification(?int $deleteDaysAfterLastModification)
876 {
877 $this->deleteDaysAfterLastModification = $deleteDaysAfterLastModification;
878
879 return $this;
880 }
881
886 public function withCustom(?CustomFieldsDraft $custom)
887 {
888 $this->custom = $custom;
889
890 return $this;
891 }
892
898 {
899 $this->customerGroup = $customerGroup;
900
901 return $this;
902 }
903
909 {
910 $this->businessUnit = $businessUnit;
911
912 return $this;
913 }
914
920 {
921 $this->store = $store;
922
923 return $this;
924 }
925
930 public function withExternalTaxRateForShippingMethodBuilder(?ExternalTaxRateDraftBuilder $externalTaxRateForShippingMethod)
931 {
932 $this->externalTaxRateForShippingMethod = $externalTaxRateForShippingMethod;
933
934 return $this;
935 }
936
941 public function withBillingAddressBuilder(?BaseAddressBuilder $billingAddress)
942 {
943 $this->billingAddress = $billingAddress;
944
945 return $this;
946 }
947
952 public function withShippingAddressBuilder(?BaseAddressBuilder $shippingAddress)
953 {
954 $this->shippingAddress = $shippingAddress;
955
956 return $this;
957 }
958
964 {
965 $this->shippingMethod = $shippingMethod;
966
967 return $this;
968 }
969
975 {
976 $this->shippingRateInput = $shippingRateInput;
977
978 return $this;
979 }
980
986 {
987 $this->custom = $custom;
988
989 return $this;
990 }
991
992 public function build(): CartDraft
993 {
994 return new CartDraftModel(
995 $this->currency,
996 $this->key,
997 $this->customerId,
998 $this->customerEmail,
999 $this->customerGroup instanceof CustomerGroupResourceIdentifierBuilder ? $this->customerGroup->build() : $this->customerGroup,
1000 $this->anonymousId,
1001 $this->businessUnit instanceof BusinessUnitResourceIdentifierBuilder ? $this->businessUnit->build() : $this->businessUnit,
1002 $this->store instanceof StoreResourceIdentifierBuilder ? $this->store->build() : $this->store,
1003 $this->lineItems,
1004 $this->customLineItems,
1005 $this->taxMode,
1006 $this->externalTaxRateForShippingMethod instanceof ExternalTaxRateDraftBuilder ? $this->externalTaxRateForShippingMethod->build() : $this->externalTaxRateForShippingMethod,
1007 $this->priceRoundingMode,
1008 $this->taxRoundingMode,
1009 $this->taxCalculationMode,
1010 $this->inventoryMode,
1011 $this->billingAddress instanceof BaseAddressBuilder ? $this->billingAddress->build() : $this->billingAddress,
1012 $this->shippingAddress instanceof BaseAddressBuilder ? $this->shippingAddress->build() : $this->shippingAddress,
1013 $this->shippingMethod instanceof ShippingMethodResourceIdentifierBuilder ? $this->shippingMethod->build() : $this->shippingMethod,
1014 $this->shippingRateInput instanceof ShippingRateInputDraftBuilder ? $this->shippingRateInput->build() : $this->shippingRateInput,
1015 $this->shippingMode,
1016 $this->customShipping,
1017 $this->shipping,
1018 $this->itemShippingAddresses,
1019 $this->discountCodes,
1020 $this->country,
1021 $this->locale,
1022 $this->origin,
1023 $this->deleteDaysAfterLastModification,
1024 $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom
1025 );
1026 }
1027
1028 public static function of(): CartDraftBuilder
1029 {
1030 return new self();
1031 }
1032}
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)