commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
MyCartDraftModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
26 use stdClass;
27 
31 final class MyCartDraftModel extends JsonObjectModel implements MyCartDraft
32 {
37  protected $currency;
38 
43  protected $customerEmail;
44 
49  protected $businessUnit;
50 
55  protected $store;
56 
61  protected $lineItems;
62 
67  protected $taxMode;
68 
73  protected $inventoryMode;
74 
79  protected $billingAddress;
80 
85  protected $shippingAddress;
86 
91  protected $shippingMethod;
92 
98 
103  protected $shippingMode;
104 
109  protected $discountCodes;
110 
115  protected $country;
116 
121  protected $locale;
122 
128 
133  protected $custom;
134 
135 
139  public function __construct(
140  ?string $currency = null,
141  ?string $customerEmail = null,
145  ?string $taxMode = null,
146  ?string $inventoryMode = null,
151  ?string $shippingMode = null,
152  ?array $discountCodes = null,
153  ?string $country = null,
154  ?string $locale = null,
156  ?CustomFieldsDraft $custom = null
157  ) {
158  $this->currency = $currency;
159  $this->customerEmail = $customerEmail;
160  $this->businessUnit = $businessUnit;
161  $this->store = $store;
162  $this->lineItems = $lineItems;
163  $this->taxMode = $taxMode;
164  $this->inventoryMode = $inventoryMode;
165  $this->billingAddress = $billingAddress;
166  $this->shippingAddress = $shippingAddress;
167  $this->shippingMethod = $shippingMethod;
168  $this->itemShippingAddresses = $itemShippingAddresses;
169  $this->shippingMode = $shippingMode;
170  $this->discountCodes = $discountCodes;
171  $this->country = $country;
172  $this->locale = $locale;
173  $this->deleteDaysAfterLastModification = $deleteDaysAfterLastModification;
174  $this->custom = $custom;
175  }
176 
183  public function getCurrency()
184  {
185  if (is_null($this->currency)) {
187  $data = $this->raw(self::FIELD_CURRENCY);
188  if (is_null($data)) {
189  return null;
190  }
191  $this->currency = (string) $data;
192  }
193 
194  return $this->currency;
195  }
196 
203  public function getCustomerEmail()
204  {
205  if (is_null($this->customerEmail)) {
207  $data = $this->raw(self::FIELD_CUSTOMER_EMAIL);
208  if (is_null($data)) {
209  return null;
210  }
211  $this->customerEmail = (string) $data;
212  }
213 
214  return $this->customerEmail;
215  }
216 
223  public function getBusinessUnit()
224  {
225  if (is_null($this->businessUnit)) {
227  $data = $this->raw(self::FIELD_BUSINESS_UNIT);
228  if (is_null($data)) {
229  return null;
230  }
231 
232  $this->businessUnit = BusinessUnitResourceIdentifierModel::of($data);
233  }
234 
235  return $this->businessUnit;
236  }
237 
244  public function getStore()
245  {
246  if (is_null($this->store)) {
248  $data = $this->raw(self::FIELD_STORE);
249  if (is_null($data)) {
250  return null;
251  }
252 
253  $this->store = StoreResourceIdentifierModel::of($data);
254  }
255 
256  return $this->store;
257  }
258 
265  public function getLineItems()
266  {
267  if (is_null($this->lineItems)) {
269  $data = $this->raw(self::FIELD_LINE_ITEMS);
270  if (is_null($data)) {
271  return null;
272  }
273  $this->lineItems = MyLineItemDraftCollection::fromArray($data);
274  }
275 
276  return $this->lineItems;
277  }
278 
285  public function getTaxMode()
286  {
287  if (is_null($this->taxMode)) {
289  $data = $this->raw(self::FIELD_TAX_MODE);
290  if (is_null($data)) {
291  return null;
292  }
293  $this->taxMode = (string) $data;
294  }
295 
296  return $this->taxMode;
297  }
298 
305  public function getInventoryMode()
306  {
307  if (is_null($this->inventoryMode)) {
309  $data = $this->raw(self::FIELD_INVENTORY_MODE);
310  if (is_null($data)) {
311  return null;
312  }
313  $this->inventoryMode = (string) $data;
314  }
315 
316  return $this->inventoryMode;
317  }
318 
325  public function getBillingAddress()
326  {
327  if (is_null($this->billingAddress)) {
329  $data = $this->raw(self::FIELD_BILLING_ADDRESS);
330  if (is_null($data)) {
331  return null;
332  }
333 
334  $this->billingAddress = BaseAddressModel::of($data);
335  }
336 
337  return $this->billingAddress;
338  }
339 
346  public function getShippingAddress()
347  {
348  if (is_null($this->shippingAddress)) {
350  $data = $this->raw(self::FIELD_SHIPPING_ADDRESS);
351  if (is_null($data)) {
352  return null;
353  }
354 
355  $this->shippingAddress = BaseAddressModel::of($data);
356  }
357 
358  return $this->shippingAddress;
359  }
360 
367  public function getShippingMethod()
368  {
369  if (is_null($this->shippingMethod)) {
371  $data = $this->raw(self::FIELD_SHIPPING_METHOD);
372  if (is_null($data)) {
373  return null;
374  }
375 
376  $this->shippingMethod = ShippingMethodResourceIdentifierModel::of($data);
377  }
378 
379  return $this->shippingMethod;
380  }
381 
390  public function getItemShippingAddresses()
391  {
392  if (is_null($this->itemShippingAddresses)) {
394  $data = $this->raw(self::FIELD_ITEM_SHIPPING_ADDRESSES);
395  if (is_null($data)) {
396  return null;
397  }
398  $this->itemShippingAddresses = BaseAddressCollection::fromArray($data);
399  }
400 
402  }
403 
413  public function getShippingMode()
414  {
415  if (is_null($this->shippingMode)) {
417  $data = $this->raw(self::FIELD_SHIPPING_MODE);
418  if (is_null($data)) {
419  return null;
420  }
421  $this->shippingMode = (string) $data;
422  }
423 
424  return $this->shippingMode;
425  }
426 
433  public function getDiscountCodes()
434  {
435  if (is_null($this->discountCodes)) {
437  $data = $this->raw(self::FIELD_DISCOUNT_CODES);
438  if (is_null($data)) {
439  return null;
440  }
441  $this->discountCodes = $data;
442  }
443 
444  return $this->discountCodes;
445  }
446 
454  public function getCountry()
455  {
456  if (is_null($this->country)) {
458  $data = $this->raw(self::FIELD_COUNTRY);
459  if (is_null($data)) {
460  return null;
461  }
462  $this->country = (string) $data;
463  }
464 
465  return $this->country;
466  }
467 
475  public function getLocale()
476  {
477  if (is_null($this->locale)) {
479  $data = $this->raw(self::FIELD_LOCALE);
480  if (is_null($data)) {
481  return null;
482  }
483  $this->locale = (string) $data;
484  }
485 
486  return $this->locale;
487  }
488 
498  {
499  if (is_null($this->deleteDaysAfterLastModification)) {
501  $data = $this->raw(self::FIELD_DELETE_DAYS_AFTER_LAST_MODIFICATION);
502  if (is_null($data)) {
503  return null;
504  }
505  $this->deleteDaysAfterLastModification = (int) $data;
506  }
507 
509  }
510 
517  public function getCustom()
518  {
519  if (is_null($this->custom)) {
521  $data = $this->raw(self::FIELD_CUSTOM);
522  if (is_null($data)) {
523  return null;
524  }
525 
526  $this->custom = CustomFieldsDraftModel::of($data);
527  }
528 
529  return $this->custom;
530  }
531 
532 
536  public function setCurrency(?string $currency): void
537  {
538  $this->currency = $currency;
539  }
540 
544  public function setCustomerEmail(?string $customerEmail): void
545  {
546  $this->customerEmail = $customerEmail;
547  }
548 
553  {
554  $this->businessUnit = $businessUnit;
555  }
556 
560  public function setStore(?StoreResourceIdentifier $store): void
561  {
562  $this->store = $store;
563  }
564 
569  {
570  $this->lineItems = $lineItems;
571  }
572 
576  public function setTaxMode(?string $taxMode): void
577  {
578  $this->taxMode = $taxMode;
579  }
580 
584  public function setInventoryMode(?string $inventoryMode): void
585  {
586  $this->inventoryMode = $inventoryMode;
587  }
588 
593  {
594  $this->billingAddress = $billingAddress;
595  }
596 
601  {
602  $this->shippingAddress = $shippingAddress;
603  }
604 
609  {
610  $this->shippingMethod = $shippingMethod;
611  }
612 
617  {
618  $this->itemShippingAddresses = $itemShippingAddresses;
619  }
620 
624  public function setShippingMode(?string $shippingMode): void
625  {
626  $this->shippingMode = $shippingMode;
627  }
628 
632  public function setDiscountCodes(?array $discountCodes): void
633  {
634  $this->discountCodes = $discountCodes;
635  }
636 
640  public function setCountry(?string $country): void
641  {
642  $this->country = $country;
643  }
644 
648  public function setLocale(?string $locale): void
649  {
650  $this->locale = $locale;
651  }
652 
657  {
658  $this->deleteDaysAfterLastModification = $deleteDaysAfterLastModification;
659  }
660 
664  public function setCustom(?CustomFieldsDraft $custom): void
665  {
666  $this->custom = $custom;
667  }
668 }
setBusinessUnit(?BusinessUnitResourceIdentifier $businessUnit)
setBillingAddress(?BaseAddress $billingAddress)
setItemShippingAddresses(?BaseAddressCollection $itemShippingAddresses)
setStore(?StoreResourceIdentifier $store)
__construct(?string $currency=null, ?string $customerEmail=null, ?BusinessUnitResourceIdentifier $businessUnit=null, ?StoreResourceIdentifier $store=null, ?MyLineItemDraftCollection $lineItems=null, ?string $taxMode=null, ?string $inventoryMode=null, ?BaseAddress $billingAddress=null, ?BaseAddress $shippingAddress=null, ?ShippingMethodResourceIdentifier $shippingMethod=null, ?BaseAddressCollection $itemShippingAddresses=null, ?string $shippingMode=null, ?array $discountCodes=null, ?string $country=null, ?string $locale=null, ?int $deleteDaysAfterLastModification=null, ?CustomFieldsDraft $custom=null)
setDeleteDaysAfterLastModification(?int $deleteDaysAfterLastModification)
setShippingMethod(?ShippingMethodResourceIdentifier $shippingMethod)
setLineItems(?MyLineItemDraftCollection $lineItems)
setShippingAddress(?BaseAddress $shippingAddress)