commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
CartDraftModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
28 use stdClass;
29 
33 final 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 
93  protected $customLineItems;
94 
99  protected $taxMode;
100 
106 
111  protected $taxRoundingMode;
112 
118 
123  protected $inventoryMode;
124 
129  protected $billingAddress;
130 
135  protected $shippingAddress;
136 
141  protected $shippingMethod;
142 
148 
153  protected $shippingMode;
154 
159  protected $customShipping;
160 
165  protected $shipping;
166 
172 
177  protected $discountCodes;
178 
183  protected $country;
184 
189  protected $locale;
190 
195  protected $origin;
196 
202 
207  protected $custom;
208 
209 
213  public function __construct(
214  ?string $currency = null,
215  ?string $key = null,
216  ?string $customerId = null,
217  ?string $customerEmail = null,
219  ?string $anonymousId = null,
224  ?string $taxMode = null,
226  ?string $taxRoundingMode = null,
227  ?string $taxCalculationMode = null,
228  ?string $inventoryMode = null,
233  ?string $shippingMode = null,
237  ?array $discountCodes = null,
238  ?string $country = null,
239  ?string $locale = null,
240  ?string $origin = null,
242  ?CustomFieldsDraft $custom = null
243  ) {
244  $this->currency = $currency;
245  $this->key = $key;
246  $this->customerId = $customerId;
247  $this->customerEmail = $customerEmail;
248  $this->customerGroup = $customerGroup;
249  $this->anonymousId = $anonymousId;
250  $this->businessUnit = $businessUnit;
251  $this->store = $store;
252  $this->lineItems = $lineItems;
253  $this->customLineItems = $customLineItems;
254  $this->taxMode = $taxMode;
255  $this->externalTaxRateForShippingMethod = $externalTaxRateForShippingMethod;
256  $this->taxRoundingMode = $taxRoundingMode;
257  $this->taxCalculationMode = $taxCalculationMode;
258  $this->inventoryMode = $inventoryMode;
259  $this->billingAddress = $billingAddress;
260  $this->shippingAddress = $shippingAddress;
261  $this->shippingMethod = $shippingMethod;
262  $this->shippingRateInput = $shippingRateInput;
263  $this->shippingMode = $shippingMode;
264  $this->customShipping = $customShipping;
265  $this->shipping = $shipping;
266  $this->itemShippingAddresses = $itemShippingAddresses;
267  $this->discountCodes = $discountCodes;
268  $this->country = $country;
269  $this->locale = $locale;
270  $this->origin = $origin;
271  $this->deleteDaysAfterLastModification = $deleteDaysAfterLastModification;
272  $this->custom = $custom;
273  }
274 
281  public function getCurrency()
282  {
283  if (is_null($this->currency)) {
285  $data = $this->raw(self::FIELD_CURRENCY);
286  if (is_null($data)) {
287  return null;
288  }
289  $this->currency = (string) $data;
290  }
291 
292  return $this->currency;
293  }
294 
301  public function getKey()
302  {
303  if (is_null($this->key)) {
305  $data = $this->raw(self::FIELD_KEY);
306  if (is_null($data)) {
307  return null;
308  }
309  $this->key = (string) $data;
310  }
311 
312  return $this->key;
313  }
314 
321  public function getCustomerId()
322  {
323  if (is_null($this->customerId)) {
325  $data = $this->raw(self::FIELD_CUSTOMER_ID);
326  if (is_null($data)) {
327  return null;
328  }
329  $this->customerId = (string) $data;
330  }
331 
332  return $this->customerId;
333  }
334 
341  public function getCustomerEmail()
342  {
343  if (is_null($this->customerEmail)) {
345  $data = $this->raw(self::FIELD_CUSTOMER_EMAIL);
346  if (is_null($data)) {
347  return null;
348  }
349  $this->customerEmail = (string) $data;
350  }
351 
352  return $this->customerEmail;
353  }
354 
363  public function getCustomerGroup()
364  {
365  if (is_null($this->customerGroup)) {
367  $data = $this->raw(self::FIELD_CUSTOMER_GROUP);
368  if (is_null($data)) {
369  return null;
370  }
371 
372  $this->customerGroup = CustomerGroupResourceIdentifierModel::of($data);
373  }
374 
375  return $this->customerGroup;
376  }
377 
384  public function getAnonymousId()
385  {
386  if (is_null($this->anonymousId)) {
388  $data = $this->raw(self::FIELD_ANONYMOUS_ID);
389  if (is_null($data)) {
390  return null;
391  }
392  $this->anonymousId = (string) $data;
393  }
394 
395  return $this->anonymousId;
396  }
397 
404  public function getBusinessUnit()
405  {
406  if (is_null($this->businessUnit)) {
408  $data = $this->raw(self::FIELD_BUSINESS_UNIT);
409  if (is_null($data)) {
410  return null;
411  }
412 
413  $this->businessUnit = BusinessUnitResourceIdentifierModel::of($data);
414  }
415 
416  return $this->businessUnit;
417  }
418 
425  public function getStore()
426  {
427  if (is_null($this->store)) {
429  $data = $this->raw(self::FIELD_STORE);
430  if (is_null($data)) {
431  return null;
432  }
433 
434  $this->store = StoreResourceIdentifierModel::of($data);
435  }
436 
437  return $this->store;
438  }
439 
446  public function getLineItems()
447  {
448  if (is_null($this->lineItems)) {
450  $data = $this->raw(self::FIELD_LINE_ITEMS);
451  if (is_null($data)) {
452  return null;
453  }
454  $this->lineItems = LineItemDraftCollection::fromArray($data);
455  }
456 
457  return $this->lineItems;
458  }
459 
466  public function getCustomLineItems()
467  {
468  if (is_null($this->customLineItems)) {
470  $data = $this->raw(self::FIELD_CUSTOM_LINE_ITEMS);
471  if (is_null($data)) {
472  return null;
473  }
474  $this->customLineItems = CustomLineItemDraftCollection::fromArray($data);
475  }
476 
477  return $this->customLineItems;
478  }
479 
486  public function getTaxMode()
487  {
488  if (is_null($this->taxMode)) {
490  $data = $this->raw(self::FIELD_TAX_MODE);
491  if (is_null($data)) {
492  return null;
493  }
494  $this->taxMode = (string) $data;
495  }
496 
497  return $this->taxMode;
498  }
499 
507  {
508  if (is_null($this->externalTaxRateForShippingMethod)) {
510  $data = $this->raw(self::FIELD_EXTERNAL_TAX_RATE_FOR_SHIPPING_METHOD);
511  if (is_null($data)) {
512  return null;
513  }
514 
515  $this->externalTaxRateForShippingMethod = ExternalTaxRateDraftModel::of($data);
516  }
517 
519  }
520 
527  public function getTaxRoundingMode()
528  {
529  if (is_null($this->taxRoundingMode)) {
531  $data = $this->raw(self::FIELD_TAX_ROUNDING_MODE);
532  if (is_null($data)) {
533  return null;
534  }
535  $this->taxRoundingMode = (string) $data;
536  }
537 
538  return $this->taxRoundingMode;
539  }
540 
547  public function getTaxCalculationMode()
548  {
549  if (is_null($this->taxCalculationMode)) {
551  $data = $this->raw(self::FIELD_TAX_CALCULATION_MODE);
552  if (is_null($data)) {
553  return null;
554  }
555  $this->taxCalculationMode = (string) $data;
556  }
557 
559  }
560 
567  public function getInventoryMode()
568  {
569  if (is_null($this->inventoryMode)) {
571  $data = $this->raw(self::FIELD_INVENTORY_MODE);
572  if (is_null($data)) {
573  return null;
574  }
575  $this->inventoryMode = (string) $data;
576  }
577 
578  return $this->inventoryMode;
579  }
580 
587  public function getBillingAddress()
588  {
589  if (is_null($this->billingAddress)) {
591  $data = $this->raw(self::FIELD_BILLING_ADDRESS);
592  if (is_null($data)) {
593  return null;
594  }
595 
596  $this->billingAddress = BaseAddressModel::of($data);
597  }
598 
599  return $this->billingAddress;
600  }
601 
609  public function getShippingAddress()
610  {
611  if (is_null($this->shippingAddress)) {
613  $data = $this->raw(self::FIELD_SHIPPING_ADDRESS);
614  if (is_null($data)) {
615  return null;
616  }
617 
618  $this->shippingAddress = BaseAddressModel::of($data);
619  }
620 
621  return $this->shippingAddress;
622  }
623 
630  public function getShippingMethod()
631  {
632  if (is_null($this->shippingMethod)) {
634  $data = $this->raw(self::FIELD_SHIPPING_METHOD);
635  if (is_null($data)) {
636  return null;
637  }
638 
639  $this->shippingMethod = ShippingMethodResourceIdentifierModel::of($data);
640  }
641 
642  return $this->shippingMethod;
643  }
644 
657  public function getShippingRateInput()
658  {
659  if (is_null($this->shippingRateInput)) {
661  $data = $this->raw(self::FIELD_SHIPPING_RATE_INPUT);
662  if (is_null($data)) {
663  return null;
664  }
666  $this->shippingRateInput = $className::of($data);
667  }
668 
670  }
671 
681  public function getShippingMode()
682  {
683  if (is_null($this->shippingMode)) {
685  $data = $this->raw(self::FIELD_SHIPPING_MODE);
686  if (is_null($data)) {
687  return null;
688  }
689  $this->shippingMode = (string) $data;
690  }
691 
692  return $this->shippingMode;
693  }
694 
701  public function getCustomShipping()
702  {
703  if (is_null($this->customShipping)) {
705  $data = $this->raw(self::FIELD_CUSTOM_SHIPPING);
706  if (is_null($data)) {
707  return null;
708  }
709  $this->customShipping = CustomShippingDraftCollection::fromArray($data);
710  }
711 
712  return $this->customShipping;
713  }
714 
721  public function getShipping()
722  {
723  if (is_null($this->shipping)) {
725  $data = $this->raw(self::FIELD_SHIPPING);
726  if (is_null($data)) {
727  return null;
728  }
729  $this->shipping = ShippingDraftCollection::fromArray($data);
730  }
731 
732  return $this->shipping;
733  }
734 
743  public function getItemShippingAddresses()
744  {
745  if (is_null($this->itemShippingAddresses)) {
747  $data = $this->raw(self::FIELD_ITEM_SHIPPING_ADDRESSES);
748  if (is_null($data)) {
749  return null;
750  }
751  $this->itemShippingAddresses = BaseAddressCollection::fromArray($data);
752  }
753 
755  }
756 
763  public function getDiscountCodes()
764  {
765  if (is_null($this->discountCodes)) {
767  $data = $this->raw(self::FIELD_DISCOUNT_CODES);
768  if (is_null($data)) {
769  return null;
770  }
771  $this->discountCodes = $data;
772  }
773 
774  return $this->discountCodes;
775  }
776 
784  public function getCountry()
785  {
786  if (is_null($this->country)) {
788  $data = $this->raw(self::FIELD_COUNTRY);
789  if (is_null($data)) {
790  return null;
791  }
792  $this->country = (string) $data;
793  }
794 
795  return $this->country;
796  }
797 
804  public function getLocale()
805  {
806  if (is_null($this->locale)) {
808  $data = $this->raw(self::FIELD_LOCALE);
809  if (is_null($data)) {
810  return null;
811  }
812  $this->locale = (string) $data;
813  }
814 
815  return $this->locale;
816  }
817 
824  public function getOrigin()
825  {
826  if (is_null($this->origin)) {
828  $data = $this->raw(self::FIELD_ORIGIN);
829  if (is_null($data)) {
830  return null;
831  }
832  $this->origin = (string) $data;
833  }
834 
835  return $this->origin;
836  }
837 
847  {
848  if (is_null($this->deleteDaysAfterLastModification)) {
850  $data = $this->raw(self::FIELD_DELETE_DAYS_AFTER_LAST_MODIFICATION);
851  if (is_null($data)) {
852  return null;
853  }
854  $this->deleteDaysAfterLastModification = (int) $data;
855  }
856 
858  }
859 
866  public function getCustom()
867  {
868  if (is_null($this->custom)) {
870  $data = $this->raw(self::FIELD_CUSTOM);
871  if (is_null($data)) {
872  return null;
873  }
874 
875  $this->custom = CustomFieldsDraftModel::of($data);
876  }
877 
878  return $this->custom;
879  }
880 
881 
885  public function setCurrency(?string $currency): void
886  {
887  $this->currency = $currency;
888  }
889 
893  public function setKey(?string $key): void
894  {
895  $this->key = $key;
896  }
897 
901  public function setCustomerId(?string $customerId): void
902  {
903  $this->customerId = $customerId;
904  }
905 
909  public function setCustomerEmail(?string $customerEmail): void
910  {
911  $this->customerEmail = $customerEmail;
912  }
913 
918  {
919  $this->customerGroup = $customerGroup;
920  }
921 
925  public function setAnonymousId(?string $anonymousId): void
926  {
927  $this->anonymousId = $anonymousId;
928  }
929 
934  {
935  $this->businessUnit = $businessUnit;
936  }
937 
941  public function setStore(?StoreResourceIdentifier $store): void
942  {
943  $this->store = $store;
944  }
945 
950  {
951  $this->lineItems = $lineItems;
952  }
953 
958  {
959  $this->customLineItems = $customLineItems;
960  }
961 
965  public function setTaxMode(?string $taxMode): void
966  {
967  $this->taxMode = $taxMode;
968  }
969 
974  {
975  $this->externalTaxRateForShippingMethod = $externalTaxRateForShippingMethod;
976  }
977 
981  public function setTaxRoundingMode(?string $taxRoundingMode): void
982  {
983  $this->taxRoundingMode = $taxRoundingMode;
984  }
985 
989  public function setTaxCalculationMode(?string $taxCalculationMode): void
990  {
991  $this->taxCalculationMode = $taxCalculationMode;
992  }
993 
997  public function setInventoryMode(?string $inventoryMode): void
998  {
999  $this->inventoryMode = $inventoryMode;
1000  }
1001 
1006  {
1007  $this->billingAddress = $billingAddress;
1008  }
1009 
1014  {
1015  $this->shippingAddress = $shippingAddress;
1016  }
1017 
1022  {
1023  $this->shippingMethod = $shippingMethod;
1024  }
1025 
1030  {
1031  $this->shippingRateInput = $shippingRateInput;
1032  }
1033 
1037  public function setShippingMode(?string $shippingMode): void
1038  {
1039  $this->shippingMode = $shippingMode;
1040  }
1041 
1046  {
1047  $this->customShipping = $customShipping;
1048  }
1049 
1054  {
1055  $this->shipping = $shipping;
1056  }
1057 
1062  {
1063  $this->itemShippingAddresses = $itemShippingAddresses;
1064  }
1065 
1069  public function setDiscountCodes(?array $discountCodes): void
1070  {
1071  $this->discountCodes = $discountCodes;
1072  }
1073 
1077  public function setCountry(?string $country): void
1078  {
1079  $this->country = $country;
1080  }
1081 
1085  public function setLocale(?string $locale): void
1086  {
1087  $this->locale = $locale;
1088  }
1089 
1093  public function setOrigin(?string $origin): void
1094  {
1095  $this->origin = $origin;
1096  }
1097 
1102  {
1103  $this->deleteDaysAfterLastModification = $deleteDaysAfterLastModification;
1104  }
1105 
1109  public function setCustom(?CustomFieldsDraft $custom): void
1110  {
1111  $this->custom = $custom;
1112  }
1113 }
setStore(?StoreResourceIdentifier $store)
setShippingMethod(?ShippingMethodResourceIdentifier $shippingMethod)
setBusinessUnit(?BusinessUnitResourceIdentifier $businessUnit)
setShipping(?ShippingDraftCollection $shipping)
setShippingAddress(?BaseAddress $shippingAddress)
setCustomLineItems(?CustomLineItemDraftCollection $customLineItems)
setShippingRateInput(?ShippingRateInputDraft $shippingRateInput)
setExternalTaxRateForShippingMethod(?ExternalTaxRateDraft $externalTaxRateForShippingMethod)
setItemShippingAddresses(?BaseAddressCollection $itemShippingAddresses)
setBillingAddress(?BaseAddress $billingAddress)
setCustomShipping(?CustomShippingDraftCollection $customShipping)
setTaxCalculationMode(?string $taxCalculationMode)
setLineItems(?LineItemDraftCollection $lineItems)
setDeleteDaysAfterLastModification(?int $deleteDaysAfterLastModification)
__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 $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)
setCustomerGroup(?CustomerGroupResourceIdentifier $customerGroup)