commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
CartDraftBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
29 use stdClass;
30 
34 final 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 $taxRoundingMode;
113 
118  private $taxCalculationMode;
119 
124  private $inventoryMode;
125 
130  private $billingAddress;
131 
136  private $shippingAddress;
137 
142  private $shippingMethod;
143 
148  private $shippingRateInput;
149 
154  private $shippingMode;
155 
160  private $customShipping;
161 
166  private $shipping;
167 
172  private $itemShippingAddresses;
173 
178  private $discountCodes;
179 
184  private $country;
185 
190  private $locale;
191 
196  private $origin;
197 
202  private $deleteDaysAfterLastModification;
203 
208  private $custom;
209 
216  public function getCurrency()
217  {
218  return $this->currency;
219  }
220 
227  public function getKey()
228  {
229  return $this->key;
230  }
231 
238  public function getCustomerId()
239  {
240  return $this->customerId;
241  }
242 
249  public function getCustomerEmail()
250  {
251  return $this->customerEmail;
252  }
253 
262  public function getCustomerGroup()
263  {
264  return $this->customerGroup instanceof CustomerGroupResourceIdentifierBuilder ? $this->customerGroup->build() : $this->customerGroup;
265  }
266 
273  public function getAnonymousId()
274  {
275  return $this->anonymousId;
276  }
277 
284  public function getBusinessUnit()
285  {
286  return $this->businessUnit instanceof BusinessUnitResourceIdentifierBuilder ? $this->businessUnit->build() : $this->businessUnit;
287  }
288 
295  public function getStore()
296  {
297  return $this->store instanceof StoreResourceIdentifierBuilder ? $this->store->build() : $this->store;
298  }
299 
306  public function getLineItems()
307  {
308  return $this->lineItems;
309  }
310 
317  public function getCustomLineItems()
318  {
319  return $this->customLineItems;
320  }
321 
328  public function getTaxMode()
329  {
330  return $this->taxMode;
331  }
332 
340  {
341  return $this->externalTaxRateForShippingMethod instanceof ExternalTaxRateDraftBuilder ? $this->externalTaxRateForShippingMethod->build() : $this->externalTaxRateForShippingMethod;
342  }
343 
350  public function getTaxRoundingMode()
351  {
352  return $this->taxRoundingMode;
353  }
354 
361  public function getTaxCalculationMode()
362  {
363  return $this->taxCalculationMode;
364  }
365 
372  public function getInventoryMode()
373  {
374  return $this->inventoryMode;
375  }
376 
383  public function getBillingAddress()
384  {
385  return $this->billingAddress instanceof BaseAddressBuilder ? $this->billingAddress->build() : $this->billingAddress;
386  }
387 
395  public function getShippingAddress()
396  {
397  return $this->shippingAddress instanceof BaseAddressBuilder ? $this->shippingAddress->build() : $this->shippingAddress;
398  }
399 
406  public function getShippingMethod()
407  {
408  return $this->shippingMethod instanceof ShippingMethodResourceIdentifierBuilder ? $this->shippingMethod->build() : $this->shippingMethod;
409  }
410 
423  public function getShippingRateInput()
424  {
425  return $this->shippingRateInput instanceof ShippingRateInputDraftBuilder ? $this->shippingRateInput->build() : $this->shippingRateInput;
426  }
427 
437  public function getShippingMode()
438  {
439  return $this->shippingMode;
440  }
441 
448  public function getCustomShipping()
449  {
450  return $this->customShipping;
451  }
452 
459  public function getShipping()
460  {
461  return $this->shipping;
462  }
463 
472  public function getItemShippingAddresses()
473  {
474  return $this->itemShippingAddresses;
475  }
476 
483  public function getDiscountCodes()
484  {
485  return $this->discountCodes;
486  }
487 
495  public function getCountry()
496  {
497  return $this->country;
498  }
499 
506  public function getLocale()
507  {
508  return $this->locale;
509  }
510 
517  public function getOrigin()
518  {
519  return $this->origin;
520  }
521 
531  {
532  return $this->deleteDaysAfterLastModification;
533  }
534 
541  public function getCustom()
542  {
543  return $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom;
544  }
545 
550  public function withCurrency(?string $currency)
551  {
552  $this->currency = $currency;
553 
554  return $this;
555  }
556 
561  public function withKey(?string $key)
562  {
563  $this->key = $key;
564 
565  return $this;
566  }
567 
572  public function withCustomerId(?string $customerId)
573  {
574  $this->customerId = $customerId;
575 
576  return $this;
577  }
578 
583  public function withCustomerEmail(?string $customerEmail)
584  {
585  $this->customerEmail = $customerEmail;
586 
587  return $this;
588  }
589 
594  public function withCustomerGroup(?CustomerGroupResourceIdentifier $customerGroup)
595  {
596  $this->customerGroup = $customerGroup;
597 
598  return $this;
599  }
600 
605  public function withAnonymousId(?string $anonymousId)
606  {
607  $this->anonymousId = $anonymousId;
608 
609  return $this;
610  }
611 
616  public function withBusinessUnit(?BusinessUnitResourceIdentifier $businessUnit)
617  {
618  $this->businessUnit = $businessUnit;
619 
620  return $this;
621  }
622 
627  public function withStore(?StoreResourceIdentifier $store)
628  {
629  $this->store = $store;
630 
631  return $this;
632  }
633 
638  public function withLineItems(?LineItemDraftCollection $lineItems)
639  {
640  $this->lineItems = $lineItems;
641 
642  return $this;
643  }
644 
649  public function withCustomLineItems(?CustomLineItemDraftCollection $customLineItems)
650  {
651  $this->customLineItems = $customLineItems;
652 
653  return $this;
654  }
655 
660  public function withTaxMode(?string $taxMode)
661  {
662  $this->taxMode = $taxMode;
663 
664  return $this;
665  }
666 
671  public function withExternalTaxRateForShippingMethod(?ExternalTaxRateDraft $externalTaxRateForShippingMethod)
672  {
673  $this->externalTaxRateForShippingMethod = $externalTaxRateForShippingMethod;
674 
675  return $this;
676  }
677 
682  public function withTaxRoundingMode(?string $taxRoundingMode)
683  {
684  $this->taxRoundingMode = $taxRoundingMode;
685 
686  return $this;
687  }
688 
693  public function withTaxCalculationMode(?string $taxCalculationMode)
694  {
695  $this->taxCalculationMode = $taxCalculationMode;
696 
697  return $this;
698  }
699 
704  public function withInventoryMode(?string $inventoryMode)
705  {
706  $this->inventoryMode = $inventoryMode;
707 
708  return $this;
709  }
710 
715  public function withBillingAddress(?BaseAddress $billingAddress)
716  {
717  $this->billingAddress = $billingAddress;
718 
719  return $this;
720  }
721 
726  public function withShippingAddress(?BaseAddress $shippingAddress)
727  {
728  $this->shippingAddress = $shippingAddress;
729 
730  return $this;
731  }
732 
737  public function withShippingMethod(?ShippingMethodResourceIdentifier $shippingMethod)
738  {
739  $this->shippingMethod = $shippingMethod;
740 
741  return $this;
742  }
743 
748  public function withShippingRateInput(?ShippingRateInputDraft $shippingRateInput)
749  {
750  $this->shippingRateInput = $shippingRateInput;
751 
752  return $this;
753  }
754 
759  public function withShippingMode(?string $shippingMode)
760  {
761  $this->shippingMode = $shippingMode;
762 
763  return $this;
764  }
765 
770  public function withCustomShipping(?CustomShippingDraftCollection $customShipping)
771  {
772  $this->customShipping = $customShipping;
773 
774  return $this;
775  }
776 
781  public function withShipping(?ShippingDraftCollection $shipping)
782  {
783  $this->shipping = $shipping;
784 
785  return $this;
786  }
787 
792  public function withItemShippingAddresses(?BaseAddressCollection $itemShippingAddresses)
793  {
794  $this->itemShippingAddresses = $itemShippingAddresses;
795 
796  return $this;
797  }
798 
803  public function withDiscountCodes(?array $discountCodes)
804  {
805  $this->discountCodes = $discountCodes;
806 
807  return $this;
808  }
809 
814  public function withCountry(?string $country)
815  {
816  $this->country = $country;
817 
818  return $this;
819  }
820 
825  public function withLocale(?string $locale)
826  {
827  $this->locale = $locale;
828 
829  return $this;
830  }
831 
836  public function withOrigin(?string $origin)
837  {
838  $this->origin = $origin;
839 
840  return $this;
841  }
842 
847  public function withDeleteDaysAfterLastModification(?int $deleteDaysAfterLastModification)
848  {
849  $this->deleteDaysAfterLastModification = $deleteDaysAfterLastModification;
850 
851  return $this;
852  }
853 
858  public function withCustom(?CustomFieldsDraft $custom)
859  {
860  $this->custom = $custom;
861 
862  return $this;
863  }
864 
870  {
871  $this->customerGroup = $customerGroup;
872 
873  return $this;
874  }
875 
881  {
882  $this->businessUnit = $businessUnit;
883 
884  return $this;
885  }
886 
892  {
893  $this->store = $store;
894 
895  return $this;
896  }
897 
902  public function withExternalTaxRateForShippingMethodBuilder(?ExternalTaxRateDraftBuilder $externalTaxRateForShippingMethod)
903  {
904  $this->externalTaxRateForShippingMethod = $externalTaxRateForShippingMethod;
905 
906  return $this;
907  }
908 
913  public function withBillingAddressBuilder(?BaseAddressBuilder $billingAddress)
914  {
915  $this->billingAddress = $billingAddress;
916 
917  return $this;
918  }
919 
924  public function withShippingAddressBuilder(?BaseAddressBuilder $shippingAddress)
925  {
926  $this->shippingAddress = $shippingAddress;
927 
928  return $this;
929  }
930 
936  {
937  $this->shippingMethod = $shippingMethod;
938 
939  return $this;
940  }
941 
946  public function withShippingRateInputBuilder(?ShippingRateInputDraftBuilder $shippingRateInput)
947  {
948  $this->shippingRateInput = $shippingRateInput;
949 
950  return $this;
951  }
952 
957  public function withCustomBuilder(?CustomFieldsDraftBuilder $custom)
958  {
959  $this->custom = $custom;
960 
961  return $this;
962  }
963 
964  public function build(): CartDraft
965  {
966  return new CartDraftModel(
967  $this->currency,
968  $this->key,
969  $this->customerId,
970  $this->customerEmail,
971  $this->customerGroup instanceof CustomerGroupResourceIdentifierBuilder ? $this->customerGroup->build() : $this->customerGroup,
972  $this->anonymousId,
973  $this->businessUnit instanceof BusinessUnitResourceIdentifierBuilder ? $this->businessUnit->build() : $this->businessUnit,
974  $this->store instanceof StoreResourceIdentifierBuilder ? $this->store->build() : $this->store,
975  $this->lineItems,
976  $this->customLineItems,
977  $this->taxMode,
978  $this->externalTaxRateForShippingMethod instanceof ExternalTaxRateDraftBuilder ? $this->externalTaxRateForShippingMethod->build() : $this->externalTaxRateForShippingMethod,
979  $this->taxRoundingMode,
980  $this->taxCalculationMode,
981  $this->inventoryMode,
982  $this->billingAddress instanceof BaseAddressBuilder ? $this->billingAddress->build() : $this->billingAddress,
983  $this->shippingAddress instanceof BaseAddressBuilder ? $this->shippingAddress->build() : $this->shippingAddress,
984  $this->shippingMethod instanceof ShippingMethodResourceIdentifierBuilder ? $this->shippingMethod->build() : $this->shippingMethod,
985  $this->shippingRateInput instanceof ShippingRateInputDraftBuilder ? $this->shippingRateInput->build() : $this->shippingRateInput,
986  $this->shippingMode,
987  $this->customShipping,
988  $this->shipping,
989  $this->itemShippingAddresses,
990  $this->discountCodes,
991  $this->country,
992  $this->locale,
993  $this->origin,
994  $this->deleteDaysAfterLastModification,
995  $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom
996  );
997  }
998 
999  public static function of(): CartDraftBuilder
1000  {
1001  return new self();
1002  }
1003 }
withStore(?StoreResourceIdentifier $store)
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)
withBillingAddress(?BaseAddress $billingAddress)
withStoreBuilder(?StoreResourceIdentifierBuilder $store)
withItemShippingAddresses(?BaseAddressCollection $itemShippingAddresses)
withBillingAddressBuilder(?BaseAddressBuilder $billingAddress)
withDeleteDaysAfterLastModification(?int $deleteDaysAfterLastModification)