commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
OrderImportDraftModel.php
1<?php
2
3declare(strict_types=1);
10
32use DateTimeImmutable;
33use stdClass;
34
39{
44 protected $orderNumber;
45
51
56 protected $customerId;
57
62 protected $customerEmail;
63
68 protected $customerGroup;
69
74 protected $businessUnit;
75
80 protected $store;
81
86 protected $lineItems;
87
93
98 protected $totalPrice;
99
104 protected $taxedPrice;
105
111
117
123
128 protected $inventoryMode;
129
135
141
147
152 protected $shippingInfo;
153
158 protected $paymentInfo;
159
164 protected $paymentState;
165
170 protected $shipmentState;
171
176 protected $orderState;
177
182 protected $state;
183
188 protected $country;
189
194 protected $origin;
195
200 protected $completedAt;
201
206 protected $custom;
207
208
212 public function __construct(
213 ?string $orderNumber = null,
214 ?string $purchaseOrderNumber = null,
215 ?string $customerId = null,
216 ?string $customerEmail = null,
222 ?Money $totalPrice = null,
224 ?string $priceRoundingMode = null,
225 ?string $taxRoundingMode = null,
226 ?string $taxCalculationMode = null,
227 ?string $inventoryMode = null,
233 ?string $paymentState = null,
234 ?string $shipmentState = null,
235 ?string $orderState = null,
236 ?StateReference $state = null,
237 ?string $country = null,
238 ?string $origin = null,
239 ?DateTimeImmutable $completedAt = null,
241 ) {
242 $this->orderNumber = $orderNumber;
243 $this->purchaseOrderNumber = $purchaseOrderNumber;
244 $this->customerId = $customerId;
245 $this->customerEmail = $customerEmail;
246 $this->customerGroup = $customerGroup;
247 $this->businessUnit = $businessUnit;
248 $this->store = $store;
249 $this->lineItems = $lineItems;
250 $this->customLineItems = $customLineItems;
251 $this->totalPrice = $totalPrice;
252 $this->taxedPrice = $taxedPrice;
253 $this->priceRoundingMode = $priceRoundingMode;
254 $this->taxRoundingMode = $taxRoundingMode;
255 $this->taxCalculationMode = $taxCalculationMode;
256 $this->inventoryMode = $inventoryMode;
257 $this->billingAddress = $billingAddress;
258 $this->shippingAddress = $shippingAddress;
259 $this->itemShippingAddresses = $itemShippingAddresses;
260 $this->shippingInfo = $shippingInfo;
261 $this->paymentInfo = $paymentInfo;
262 $this->paymentState = $paymentState;
263 $this->shipmentState = $shipmentState;
264 $this->orderState = $orderState;
265 $this->state = $state;
266 $this->country = $country;
267 $this->origin = $origin;
268 $this->completedAt = $completedAt;
269 $this->custom = $custom;
270 }
271
279 public function getOrderNumber()
280 {
281 if (is_null($this->orderNumber)) {
283 $data = $this->raw(self::FIELD_ORDER_NUMBER);
284 if (is_null($data)) {
285 return null;
286 }
287 $this->orderNumber = (string) $data;
288 }
289
290 return $this->orderNumber;
291 }
292
299 public function getPurchaseOrderNumber()
300 {
301 if (is_null($this->purchaseOrderNumber)) {
303 $data = $this->raw(self::FIELD_PURCHASE_ORDER_NUMBER);
304 if (is_null($data)) {
305 return null;
306 }
307 $this->purchaseOrderNumber = (string) $data;
308 }
309
311 }
312
319 public function getCustomerId()
320 {
321 if (is_null($this->customerId)) {
323 $data = $this->raw(self::FIELD_CUSTOMER_ID);
324 if (is_null($data)) {
325 return null;
326 }
327 $this->customerId = (string) $data;
328 }
329
330 return $this->customerId;
331 }
332
339 public function getCustomerEmail()
340 {
341 if (is_null($this->customerEmail)) {
343 $data = $this->raw(self::FIELD_CUSTOMER_EMAIL);
344 if (is_null($data)) {
345 return null;
346 }
347 $this->customerEmail = (string) $data;
348 }
349
351 }
352
359 public function getCustomerGroup()
360 {
361 if (is_null($this->customerGroup)) {
363 $data = $this->raw(self::FIELD_CUSTOMER_GROUP);
364 if (is_null($data)) {
365 return null;
366 }
367
368 $this->customerGroup = CustomerGroupResourceIdentifierModel::of($data);
369 }
370
372 }
373
381 public function getBusinessUnit()
382 {
383 if (is_null($this->businessUnit)) {
385 $data = $this->raw(self::FIELD_BUSINESS_UNIT);
386 if (is_null($data)) {
387 return null;
388 }
389
390 $this->businessUnit = BusinessUnitResourceIdentifierModel::of($data);
391 }
392
393 return $this->businessUnit;
394 }
395
405 public function getStore()
406 {
407 if (is_null($this->store)) {
409 $data = $this->raw(self::FIELD_STORE);
410 if (is_null($data)) {
411 return null;
412 }
413
414 $this->store = StoreResourceIdentifierModel::of($data);
415 }
416
417 return $this->store;
418 }
419
427 public function getLineItems()
428 {
429 if (is_null($this->lineItems)) {
431 $data = $this->raw(self::FIELD_LINE_ITEMS);
432 if (is_null($data)) {
433 return null;
434 }
435 $this->lineItems = LineItemImportDraftCollection::fromArray($data);
436 }
437
438 return $this->lineItems;
439 }
440
448 public function getCustomLineItems()
449 {
450 if (is_null($this->customLineItems)) {
452 $data = $this->raw(self::FIELD_CUSTOM_LINE_ITEMS);
453 if (is_null($data)) {
454 return null;
455 }
456 $this->customLineItems = CustomLineItemImportDraftCollection::fromArray($data);
457 }
458
460 }
461
468 public function getTotalPrice()
469 {
470 if (is_null($this->totalPrice)) {
472 $data = $this->raw(self::FIELD_TOTAL_PRICE);
473 if (is_null($data)) {
474 return null;
475 }
476
477 $this->totalPrice = MoneyModel::of($data);
478 }
479
480 return $this->totalPrice;
481 }
482
489 public function getTaxedPrice()
490 {
491 if (is_null($this->taxedPrice)) {
493 $data = $this->raw(self::FIELD_TAXED_PRICE);
494 if (is_null($data)) {
495 return null;
496 }
497
498 $this->taxedPrice = TaxedPriceDraftModel::of($data);
499 }
500
501 return $this->taxedPrice;
502 }
503
510 public function getPriceRoundingMode()
511 {
512 if (is_null($this->priceRoundingMode)) {
514 $data = $this->raw(self::FIELD_PRICE_ROUNDING_MODE);
515 if (is_null($data)) {
516 return null;
517 }
518 $this->priceRoundingMode = (string) $data;
519 }
520
522 }
523
530 public function getTaxRoundingMode()
531 {
532 if (is_null($this->taxRoundingMode)) {
534 $data = $this->raw(self::FIELD_TAX_ROUNDING_MODE);
535 if (is_null($data)) {
536 return null;
537 }
538 $this->taxRoundingMode = (string) $data;
539 }
540
542 }
543
550 public function getTaxCalculationMode()
551 {
552 if (is_null($this->taxCalculationMode)) {
554 $data = $this->raw(self::FIELD_TAX_CALCULATION_MODE);
555 if (is_null($data)) {
556 return null;
557 }
558 $this->taxCalculationMode = (string) $data;
559 }
560
562 }
563
570 public function getInventoryMode()
571 {
572 if (is_null($this->inventoryMode)) {
574 $data = $this->raw(self::FIELD_INVENTORY_MODE);
575 if (is_null($data)) {
576 return null;
577 }
578 $this->inventoryMode = (string) $data;
579 }
580
582 }
583
590 public function getBillingAddress()
591 {
592 if (is_null($this->billingAddress)) {
594 $data = $this->raw(self::FIELD_BILLING_ADDRESS);
595 if (is_null($data)) {
596 return null;
597 }
598
599 $this->billingAddress = BaseAddressModel::of($data);
600 }
601
603 }
604
611 public function getShippingAddress()
612 {
613 if (is_null($this->shippingAddress)) {
615 $data = $this->raw(self::FIELD_SHIPPING_ADDRESS);
616 if (is_null($data)) {
617 return null;
618 }
619
620 $this->shippingAddress = BaseAddressModel::of($data);
621 }
622
624 }
625
632 public function getItemShippingAddresses()
633 {
634 if (is_null($this->itemShippingAddresses)) {
636 $data = $this->raw(self::FIELD_ITEM_SHIPPING_ADDRESSES);
637 if (is_null($data)) {
638 return null;
639 }
640 $this->itemShippingAddresses = BaseAddressCollection::fromArray($data);
641 }
642
644 }
645
652 public function getShippingInfo()
653 {
654 if (is_null($this->shippingInfo)) {
656 $data = $this->raw(self::FIELD_SHIPPING_INFO);
657 if (is_null($data)) {
658 return null;
659 }
660
661 $this->shippingInfo = ShippingInfoImportDraftModel::of($data);
662 }
663
664 return $this->shippingInfo;
665 }
666
673 public function getPaymentInfo()
674 {
675 if (is_null($this->paymentInfo)) {
677 $data = $this->raw(self::FIELD_PAYMENT_INFO);
678 if (is_null($data)) {
679 return null;
680 }
681
682 $this->paymentInfo = PaymentInfoModel::of($data);
683 }
684
685 return $this->paymentInfo;
686 }
687
694 public function getPaymentState()
695 {
696 if (is_null($this->paymentState)) {
698 $data = $this->raw(self::FIELD_PAYMENT_STATE);
699 if (is_null($data)) {
700 return null;
701 }
702 $this->paymentState = (string) $data;
703 }
704
705 return $this->paymentState;
706 }
707
714 public function getShipmentState()
715 {
716 if (is_null($this->shipmentState)) {
718 $data = $this->raw(self::FIELD_SHIPMENT_STATE);
719 if (is_null($data)) {
720 return null;
721 }
722 $this->shipmentState = (string) $data;
723 }
724
726 }
727
734 public function getOrderState()
735 {
736 if (is_null($this->orderState)) {
738 $data = $this->raw(self::FIELD_ORDER_STATE);
739 if (is_null($data)) {
740 return null;
741 }
742 $this->orderState = (string) $data;
743 }
744
745 return $this->orderState;
746 }
747
754 public function getState()
755 {
756 if (is_null($this->state)) {
758 $data = $this->raw(self::FIELD_STATE);
759 if (is_null($data)) {
760 return null;
761 }
762
763 $this->state = StateReferenceModel::of($data);
764 }
765
766 return $this->state;
767 }
768
775 public function getCountry()
776 {
777 if (is_null($this->country)) {
779 $data = $this->raw(self::FIELD_COUNTRY);
780 if (is_null($data)) {
781 return null;
782 }
783 $this->country = (string) $data;
784 }
785
786 return $this->country;
787 }
788
795 public function getOrigin()
796 {
797 if (is_null($this->origin)) {
799 $data = $this->raw(self::FIELD_ORIGIN);
800 if (is_null($data)) {
801 return null;
802 }
803 $this->origin = (string) $data;
804 }
805
806 return $this->origin;
807 }
808
815 public function getCompletedAt()
816 {
817 if (is_null($this->completedAt)) {
819 $data = $this->raw(self::FIELD_COMPLETED_AT);
820 if (is_null($data)) {
821 return null;
822 }
823 $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data);
824 if (false === $data) {
825 return null;
826 }
827 $this->completedAt = $data;
828 }
829
830 return $this->completedAt;
831 }
832
839 public function getCustom()
840 {
841 if (is_null($this->custom)) {
843 $data = $this->raw(self::FIELD_CUSTOM);
844 if (is_null($data)) {
845 return null;
846 }
847
848 $this->custom = CustomFieldsDraftModel::of($data);
849 }
850
851 return $this->custom;
852 }
853
854
858 public function setOrderNumber(?string $orderNumber): void
859 {
860 $this->orderNumber = $orderNumber;
861 }
862
866 public function setPurchaseOrderNumber(?string $purchaseOrderNumber): void
867 {
868 $this->purchaseOrderNumber = $purchaseOrderNumber;
869 }
870
874 public function setCustomerId(?string $customerId): void
875 {
876 $this->customerId = $customerId;
877 }
878
882 public function setCustomerEmail(?string $customerEmail): void
883 {
884 $this->customerEmail = $customerEmail;
885 }
886
891 {
892 $this->customerGroup = $customerGroup;
893 }
894
899 {
900 $this->businessUnit = $businessUnit;
901 }
902
907 {
908 $this->store = $store;
909 }
910
915 {
916 $this->lineItems = $lineItems;
917 }
918
923 {
924 $this->customLineItems = $customLineItems;
925 }
926
930 public function setTotalPrice(?Money $totalPrice): void
931 {
932 $this->totalPrice = $totalPrice;
933 }
934
939 {
940 $this->taxedPrice = $taxedPrice;
941 }
942
946 public function setPriceRoundingMode(?string $priceRoundingMode): void
947 {
948 $this->priceRoundingMode = $priceRoundingMode;
949 }
950
954 public function setTaxRoundingMode(?string $taxRoundingMode): void
955 {
956 $this->taxRoundingMode = $taxRoundingMode;
957 }
958
962 public function setTaxCalculationMode(?string $taxCalculationMode): void
963 {
964 $this->taxCalculationMode = $taxCalculationMode;
965 }
966
970 public function setInventoryMode(?string $inventoryMode): void
971 {
972 $this->inventoryMode = $inventoryMode;
973 }
974
979 {
980 $this->billingAddress = $billingAddress;
981 }
982
987 {
988 $this->shippingAddress = $shippingAddress;
989 }
990
995 {
996 $this->itemShippingAddresses = $itemShippingAddresses;
997 }
998
1003 {
1004 $this->shippingInfo = $shippingInfo;
1005 }
1006
1011 {
1012 $this->paymentInfo = $paymentInfo;
1013 }
1014
1018 public function setPaymentState(?string $paymentState): void
1019 {
1020 $this->paymentState = $paymentState;
1021 }
1022
1026 public function setShipmentState(?string $shipmentState): void
1027 {
1028 $this->shipmentState = $shipmentState;
1029 }
1030
1034 public function setOrderState(?string $orderState): void
1035 {
1036 $this->orderState = $orderState;
1037 }
1038
1042 public function setState(?StateReference $state): void
1043 {
1044 $this->state = $state;
1045 }
1046
1050 public function setCountry(?string $country): void
1051 {
1052 $this->country = $country;
1053 }
1054
1058 public function setOrigin(?string $origin): void
1059 {
1060 $this->origin = $origin;
1061 }
1062
1066 public function setCompletedAt(?DateTimeImmutable $completedAt): void
1067 {
1068 $this->completedAt = $completedAt;
1069 }
1070
1074 public function setCustom(?CustomFieldsDraft $custom): void
1075 {
1076 $this->custom = $custom;
1077 }
1078
1079
1080 #[\ReturnTypeWillChange]
1081 public function jsonSerialize()
1082 {
1083 $data = $this->toArray();
1084 if (isset($data[OrderImportDraft::FIELD_COMPLETED_AT]) && $data[OrderImportDraft::FIELD_COMPLETED_AT] instanceof \DateTimeImmutable) {
1085 $data[OrderImportDraft::FIELD_COMPLETED_AT] = $data[OrderImportDraft::FIELD_COMPLETED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c');
1086 }
1087 return (object) $data;
1088 }
1089}
setCustomLineItems(?CustomLineItemImportDraftCollection $customLineItems)
__construct(?string $orderNumber=null, ?string $purchaseOrderNumber=null, ?string $customerId=null, ?string $customerEmail=null, ?CustomerGroupResourceIdentifier $customerGroup=null, ?BusinessUnitResourceIdentifier $businessUnit=null, ?StoreResourceIdentifier $store=null, ?LineItemImportDraftCollection $lineItems=null, ?CustomLineItemImportDraftCollection $customLineItems=null, ?Money $totalPrice=null, ?TaxedPriceDraft $taxedPrice=null, ?string $priceRoundingMode=null, ?string $taxRoundingMode=null, ?string $taxCalculationMode=null, ?string $inventoryMode=null, ?BaseAddress $billingAddress=null, ?BaseAddress $shippingAddress=null, ?BaseAddressCollection $itemShippingAddresses=null, ?ShippingInfoImportDraft $shippingInfo=null, ?PaymentInfo $paymentInfo=null, ?string $paymentState=null, ?string $shipmentState=null, ?string $orderState=null, ?StateReference $state=null, ?string $country=null, ?string $origin=null, ?DateTimeImmutable $completedAt=null, ?CustomFieldsDraft $custom=null)
setLineItems(?LineItemImportDraftCollection $lineItems)
setShippingInfo(?ShippingInfoImportDraft $shippingInfo)
setItemShippingAddresses(?BaseAddressCollection $itemShippingAddresses)
setCustomerGroup(?CustomerGroupResourceIdentifier $customerGroup)
setBusinessUnit(?BusinessUnitResourceIdentifier $businessUnit)
static fromArray(array $data)