commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
MyCartDraftModel.php
1<?php
2
3declare(strict_types=1);
10
26use stdClass;
27
31final 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
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,
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
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
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
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
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
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
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
474 public function getLocale()
475 {
476 if (is_null($this->locale)) {
478 $data = $this->raw(self::FIELD_LOCALE);
479 if (is_null($data)) {
480 return null;
481 }
482 $this->locale = (string) $data;
483 }
484
485 return $this->locale;
486 }
487
497 {
498 if (is_null($this->deleteDaysAfterLastModification)) {
500 $data = $this->raw(self::FIELD_DELETE_DAYS_AFTER_LAST_MODIFICATION);
501 if (is_null($data)) {
502 return null;
503 }
504 $this->deleteDaysAfterLastModification = (int) $data;
505 }
506
508 }
509
516 public function getCustom()
517 {
518 if (is_null($this->custom)) {
520 $data = $this->raw(self::FIELD_CUSTOM);
521 if (is_null($data)) {
522 return null;
523 }
524
525 $this->custom = CustomFieldsDraftModel::of($data);
526 }
527
528 return $this->custom;
529 }
530
531
535 public function setCurrency(?string $currency): void
536 {
537 $this->currency = $currency;
538 }
539
543 public function setCustomerEmail(?string $customerEmail): void
544 {
545 $this->customerEmail = $customerEmail;
546 }
547
552 {
553 $this->businessUnit = $businessUnit;
554 }
555
560 {
561 $this->store = $store;
562 }
563
568 {
569 $this->lineItems = $lineItems;
570 }
571
575 public function setTaxMode(?string $taxMode): void
576 {
577 $this->taxMode = $taxMode;
578 }
579
583 public function setInventoryMode(?string $inventoryMode): void
584 {
585 $this->inventoryMode = $inventoryMode;
586 }
587
592 {
593 $this->billingAddress = $billingAddress;
594 }
595
600 {
601 $this->shippingAddress = $shippingAddress;
602 }
603
608 {
609 $this->shippingMethod = $shippingMethod;
610 }
611
616 {
617 $this->itemShippingAddresses = $itemShippingAddresses;
618 }
619
623 public function setShippingMode(?string $shippingMode): void
624 {
625 $this->shippingMode = $shippingMode;
626 }
627
631 public function setDiscountCodes(?array $discountCodes): void
632 {
633 $this->discountCodes = $discountCodes;
634 }
635
639 public function setCountry(?string $country): void
640 {
641 $this->country = $country;
642 }
643
647 public function setLocale(?string $locale): void
648 {
649 $this->locale = $locale;
650 }
651
656 {
657 $this->deleteDaysAfterLastModification = $deleteDaysAfterLastModification;
658 }
659
663 public function setCustom(?CustomFieldsDraft $custom): void
664 {
665 $this->custom = $custom;
666 }
667}
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)
static fromArray(array $data)