commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
OrderImportDraftModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
32 use DateTimeImmutable;
33 use 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 
92  protected $customLineItems;
93 
98  protected $totalPrice;
99 
104  protected $taxedPrice;
105 
110  protected $taxRoundingMode;
111 
117 
122  protected $inventoryMode;
123 
128  protected $billingAddress;
129 
134  protected $shippingAddress;
135 
141 
146  protected $shippingInfo;
147 
152  protected $paymentInfo;
153 
158  protected $paymentState;
159 
164  protected $shipmentState;
165 
170  protected $orderState;
171 
176  protected $state;
177 
182  protected $country;
183 
188  protected $origin;
189 
194  protected $completedAt;
195 
200  protected $custom;
201 
202 
206  public function __construct(
207  ?string $orderNumber = null,
208  ?string $purchaseOrderNumber = null,
209  ?string $customerId = null,
210  ?string $customerEmail = null,
216  ?Money $totalPrice = null,
218  ?string $taxRoundingMode = null,
219  ?string $taxCalculationMode = null,
220  ?string $inventoryMode = null,
225  ?PaymentInfo $paymentInfo = null,
226  ?string $paymentState = null,
227  ?string $shipmentState = null,
228  ?string $orderState = null,
229  ?StateReference $state = null,
230  ?string $country = null,
231  ?string $origin = null,
232  ?DateTimeImmutable $completedAt = null,
233  ?CustomFieldsDraft $custom = null
234  ) {
235  $this->orderNumber = $orderNumber;
236  $this->purchaseOrderNumber = $purchaseOrderNumber;
237  $this->customerId = $customerId;
238  $this->customerEmail = $customerEmail;
239  $this->customerGroup = $customerGroup;
240  $this->businessUnit = $businessUnit;
241  $this->store = $store;
242  $this->lineItems = $lineItems;
243  $this->customLineItems = $customLineItems;
244  $this->totalPrice = $totalPrice;
245  $this->taxedPrice = $taxedPrice;
246  $this->taxRoundingMode = $taxRoundingMode;
247  $this->taxCalculationMode = $taxCalculationMode;
248  $this->inventoryMode = $inventoryMode;
249  $this->billingAddress = $billingAddress;
250  $this->shippingAddress = $shippingAddress;
251  $this->itemShippingAddresses = $itemShippingAddresses;
252  $this->shippingInfo = $shippingInfo;
253  $this->paymentInfo = $paymentInfo;
254  $this->paymentState = $paymentState;
255  $this->shipmentState = $shipmentState;
256  $this->orderState = $orderState;
257  $this->state = $state;
258  $this->country = $country;
259  $this->origin = $origin;
260  $this->completedAt = $completedAt;
261  $this->custom = $custom;
262  }
263 
271  public function getOrderNumber()
272  {
273  if (is_null($this->orderNumber)) {
275  $data = $this->raw(self::FIELD_ORDER_NUMBER);
276  if (is_null($data)) {
277  return null;
278  }
279  $this->orderNumber = (string) $data;
280  }
281 
282  return $this->orderNumber;
283  }
284 
291  public function getPurchaseOrderNumber()
292  {
293  if (is_null($this->purchaseOrderNumber)) {
295  $data = $this->raw(self::FIELD_PURCHASE_ORDER_NUMBER);
296  if (is_null($data)) {
297  return null;
298  }
299  $this->purchaseOrderNumber = (string) $data;
300  }
301 
303  }
304 
311  public function getCustomerId()
312  {
313  if (is_null($this->customerId)) {
315  $data = $this->raw(self::FIELD_CUSTOMER_ID);
316  if (is_null($data)) {
317  return null;
318  }
319  $this->customerId = (string) $data;
320  }
321 
322  return $this->customerId;
323  }
324 
331  public function getCustomerEmail()
332  {
333  if (is_null($this->customerEmail)) {
335  $data = $this->raw(self::FIELD_CUSTOMER_EMAIL);
336  if (is_null($data)) {
337  return null;
338  }
339  $this->customerEmail = (string) $data;
340  }
341 
342  return $this->customerEmail;
343  }
344 
351  public function getCustomerGroup()
352  {
353  if (is_null($this->customerGroup)) {
355  $data = $this->raw(self::FIELD_CUSTOMER_GROUP);
356  if (is_null($data)) {
357  return null;
358  }
359 
360  $this->customerGroup = CustomerGroupResourceIdentifierModel::of($data);
361  }
362 
363  return $this->customerGroup;
364  }
365 
373  public function getBusinessUnit()
374  {
375  if (is_null($this->businessUnit)) {
377  $data = $this->raw(self::FIELD_BUSINESS_UNIT);
378  if (is_null($data)) {
379  return null;
380  }
381 
382  $this->businessUnit = BusinessUnitResourceIdentifierModel::of($data);
383  }
384 
385  return $this->businessUnit;
386  }
387 
397  public function getStore()
398  {
399  if (is_null($this->store)) {
401  $data = $this->raw(self::FIELD_STORE);
402  if (is_null($data)) {
403  return null;
404  }
405 
406  $this->store = StoreResourceIdentifierModel::of($data);
407  }
408 
409  return $this->store;
410  }
411 
419  public function getLineItems()
420  {
421  if (is_null($this->lineItems)) {
423  $data = $this->raw(self::FIELD_LINE_ITEMS);
424  if (is_null($data)) {
425  return null;
426  }
427  $this->lineItems = LineItemImportDraftCollection::fromArray($data);
428  }
429 
430  return $this->lineItems;
431  }
432 
440  public function getCustomLineItems()
441  {
442  if (is_null($this->customLineItems)) {
444  $data = $this->raw(self::FIELD_CUSTOM_LINE_ITEMS);
445  if (is_null($data)) {
446  return null;
447  }
448  $this->customLineItems = CustomLineItemImportDraftCollection::fromArray($data);
449  }
450 
451  return $this->customLineItems;
452  }
453 
460  public function getTotalPrice()
461  {
462  if (is_null($this->totalPrice)) {
464  $data = $this->raw(self::FIELD_TOTAL_PRICE);
465  if (is_null($data)) {
466  return null;
467  }
468 
469  $this->totalPrice = MoneyModel::of($data);
470  }
471 
472  return $this->totalPrice;
473  }
474 
481  public function getTaxedPrice()
482  {
483  if (is_null($this->taxedPrice)) {
485  $data = $this->raw(self::FIELD_TAXED_PRICE);
486  if (is_null($data)) {
487  return null;
488  }
489 
490  $this->taxedPrice = TaxedPriceDraftModel::of($data);
491  }
492 
493  return $this->taxedPrice;
494  }
495 
502  public function getTaxRoundingMode()
503  {
504  if (is_null($this->taxRoundingMode)) {
506  $data = $this->raw(self::FIELD_TAX_ROUNDING_MODE);
507  if (is_null($data)) {
508  return null;
509  }
510  $this->taxRoundingMode = (string) $data;
511  }
512 
513  return $this->taxRoundingMode;
514  }
515 
522  public function getTaxCalculationMode()
523  {
524  if (is_null($this->taxCalculationMode)) {
526  $data = $this->raw(self::FIELD_TAX_CALCULATION_MODE);
527  if (is_null($data)) {
528  return null;
529  }
530  $this->taxCalculationMode = (string) $data;
531  }
532 
534  }
535 
542  public function getInventoryMode()
543  {
544  if (is_null($this->inventoryMode)) {
546  $data = $this->raw(self::FIELD_INVENTORY_MODE);
547  if (is_null($data)) {
548  return null;
549  }
550  $this->inventoryMode = (string) $data;
551  }
552 
553  return $this->inventoryMode;
554  }
555 
562  public function getBillingAddress()
563  {
564  if (is_null($this->billingAddress)) {
566  $data = $this->raw(self::FIELD_BILLING_ADDRESS);
567  if (is_null($data)) {
568  return null;
569  }
570 
571  $this->billingAddress = BaseAddressModel::of($data);
572  }
573 
574  return $this->billingAddress;
575  }
576 
583  public function getShippingAddress()
584  {
585  if (is_null($this->shippingAddress)) {
587  $data = $this->raw(self::FIELD_SHIPPING_ADDRESS);
588  if (is_null($data)) {
589  return null;
590  }
591 
592  $this->shippingAddress = BaseAddressModel::of($data);
593  }
594 
595  return $this->shippingAddress;
596  }
597 
604  public function getItemShippingAddresses()
605  {
606  if (is_null($this->itemShippingAddresses)) {
608  $data = $this->raw(self::FIELD_ITEM_SHIPPING_ADDRESSES);
609  if (is_null($data)) {
610  return null;
611  }
612  $this->itemShippingAddresses = BaseAddressCollection::fromArray($data);
613  }
614 
616  }
617 
624  public function getShippingInfo()
625  {
626  if (is_null($this->shippingInfo)) {
628  $data = $this->raw(self::FIELD_SHIPPING_INFO);
629  if (is_null($data)) {
630  return null;
631  }
632 
633  $this->shippingInfo = ShippingInfoImportDraftModel::of($data);
634  }
635 
636  return $this->shippingInfo;
637  }
638 
645  public function getPaymentInfo()
646  {
647  if (is_null($this->paymentInfo)) {
649  $data = $this->raw(self::FIELD_PAYMENT_INFO);
650  if (is_null($data)) {
651  return null;
652  }
653 
654  $this->paymentInfo = PaymentInfoModel::of($data);
655  }
656 
657  return $this->paymentInfo;
658  }
659 
666  public function getPaymentState()
667  {
668  if (is_null($this->paymentState)) {
670  $data = $this->raw(self::FIELD_PAYMENT_STATE);
671  if (is_null($data)) {
672  return null;
673  }
674  $this->paymentState = (string) $data;
675  }
676 
677  return $this->paymentState;
678  }
679 
686  public function getShipmentState()
687  {
688  if (is_null($this->shipmentState)) {
690  $data = $this->raw(self::FIELD_SHIPMENT_STATE);
691  if (is_null($data)) {
692  return null;
693  }
694  $this->shipmentState = (string) $data;
695  }
696 
697  return $this->shipmentState;
698  }
699 
706  public function getOrderState()
707  {
708  if (is_null($this->orderState)) {
710  $data = $this->raw(self::FIELD_ORDER_STATE);
711  if (is_null($data)) {
712  return null;
713  }
714  $this->orderState = (string) $data;
715  }
716 
717  return $this->orderState;
718  }
719 
726  public function getState()
727  {
728  if (is_null($this->state)) {
730  $data = $this->raw(self::FIELD_STATE);
731  if (is_null($data)) {
732  return null;
733  }
734 
735  $this->state = StateReferenceModel::of($data);
736  }
737 
738  return $this->state;
739  }
740 
747  public function getCountry()
748  {
749  if (is_null($this->country)) {
751  $data = $this->raw(self::FIELD_COUNTRY);
752  if (is_null($data)) {
753  return null;
754  }
755  $this->country = (string) $data;
756  }
757 
758  return $this->country;
759  }
760 
767  public function getOrigin()
768  {
769  if (is_null($this->origin)) {
771  $data = $this->raw(self::FIELD_ORIGIN);
772  if (is_null($data)) {
773  return null;
774  }
775  $this->origin = (string) $data;
776  }
777 
778  return $this->origin;
779  }
780 
787  public function getCompletedAt()
788  {
789  if (is_null($this->completedAt)) {
791  $data = $this->raw(self::FIELD_COMPLETED_AT);
792  if (is_null($data)) {
793  return null;
794  }
795  $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data);
796  if (false === $data) {
797  return null;
798  }
799  $this->completedAt = $data;
800  }
801 
802  return $this->completedAt;
803  }
804 
811  public function getCustom()
812  {
813  if (is_null($this->custom)) {
815  $data = $this->raw(self::FIELD_CUSTOM);
816  if (is_null($data)) {
817  return null;
818  }
819 
820  $this->custom = CustomFieldsDraftModel::of($data);
821  }
822 
823  return $this->custom;
824  }
825 
826 
830  public function setOrderNumber(?string $orderNumber): void
831  {
832  $this->orderNumber = $orderNumber;
833  }
834 
838  public function setPurchaseOrderNumber(?string $purchaseOrderNumber): void
839  {
840  $this->purchaseOrderNumber = $purchaseOrderNumber;
841  }
842 
846  public function setCustomerId(?string $customerId): void
847  {
848  $this->customerId = $customerId;
849  }
850 
854  public function setCustomerEmail(?string $customerEmail): void
855  {
856  $this->customerEmail = $customerEmail;
857  }
858 
863  {
864  $this->customerGroup = $customerGroup;
865  }
866 
871  {
872  $this->businessUnit = $businessUnit;
873  }
874 
878  public function setStore(?StoreResourceIdentifier $store): void
879  {
880  $this->store = $store;
881  }
882 
887  {
888  $this->lineItems = $lineItems;
889  }
890 
895  {
896  $this->customLineItems = $customLineItems;
897  }
898 
902  public function setTotalPrice(?Money $totalPrice): void
903  {
904  $this->totalPrice = $totalPrice;
905  }
906 
910  public function setTaxedPrice(?TaxedPriceDraft $taxedPrice): void
911  {
912  $this->taxedPrice = $taxedPrice;
913  }
914 
918  public function setTaxRoundingMode(?string $taxRoundingMode): void
919  {
920  $this->taxRoundingMode = $taxRoundingMode;
921  }
922 
926  public function setTaxCalculationMode(?string $taxCalculationMode): void
927  {
928  $this->taxCalculationMode = $taxCalculationMode;
929  }
930 
934  public function setInventoryMode(?string $inventoryMode): void
935  {
936  $this->inventoryMode = $inventoryMode;
937  }
938 
943  {
944  $this->billingAddress = $billingAddress;
945  }
946 
951  {
952  $this->shippingAddress = $shippingAddress;
953  }
954 
959  {
960  $this->itemShippingAddresses = $itemShippingAddresses;
961  }
962 
967  {
968  $this->shippingInfo = $shippingInfo;
969  }
970 
974  public function setPaymentInfo(?PaymentInfo $paymentInfo): void
975  {
976  $this->paymentInfo = $paymentInfo;
977  }
978 
982  public function setPaymentState(?string $paymentState): void
983  {
984  $this->paymentState = $paymentState;
985  }
986 
990  public function setShipmentState(?string $shipmentState): void
991  {
992  $this->shipmentState = $shipmentState;
993  }
994 
998  public function setOrderState(?string $orderState): void
999  {
1000  $this->orderState = $orderState;
1001  }
1002 
1006  public function setState(?StateReference $state): void
1007  {
1008  $this->state = $state;
1009  }
1010 
1014  public function setCountry(?string $country): void
1015  {
1016  $this->country = $country;
1017  }
1018 
1022  public function setOrigin(?string $origin): void
1023  {
1024  $this->origin = $origin;
1025  }
1026 
1030  public function setCompletedAt(?DateTimeImmutable $completedAt): void
1031  {
1032  $this->completedAt = $completedAt;
1033  }
1034 
1038  public function setCustom(?CustomFieldsDraft $custom): void
1039  {
1040  $this->custom = $custom;
1041  }
1042 
1043 
1044  #[\ReturnTypeWillChange]
1045  public function jsonSerialize()
1046  {
1047  $data = $this->toArray();
1048  if (isset($data[OrderImportDraft::FIELD_COMPLETED_AT]) && $data[OrderImportDraft::FIELD_COMPLETED_AT] instanceof \DateTimeImmutable) {
1049  $data[OrderImportDraft::FIELD_COMPLETED_AT] = $data[OrderImportDraft::FIELD_COMPLETED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c');
1050  }
1051  return (object) $data;
1052  }
1053 }
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 $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)