commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
QuoteRequestModel.php
1<?php
2
3declare(strict_types=1);
10
51use DateTimeImmutable;
52use stdClass;
53
57final class QuoteRequestModel extends JsonObjectModel implements QuoteRequest
58{
63 protected $id;
64
69 protected $version;
70
75 protected $createdAt;
76
81 protected $lastModifiedAt;
82
87 protected $key;
88
93 protected $lastModifiedBy;
94
99 protected $createdBy;
100
106
111 protected $comment;
112
117 protected $customer;
118
123 protected $customerGroup;
124
129 protected $store;
130
135 protected $lineItems;
136
142
147 protected $totalPrice;
148
153 protected $taxedPrice;
154
160
166
171 protected $inventoryMode;
172
177 protected $taxMode;
178
184
190
195 protected $country;
196
201 protected $shippingInfo;
202
207 protected $paymentInfo;
208
214
220
226
231 protected $custom;
232
237 protected $state;
238
244
249 protected $cart;
250
255 protected $businessUnit;
256
257
261 public function __construct(
262 ?string $id = null,
263 ?int $version = null,
264 ?DateTimeImmutable $createdAt = null,
265 ?DateTimeImmutable $lastModifiedAt = null,
266 ?string $key = null,
268 ?CreatedBy $createdBy = null,
269 ?string $quoteRequestState = null,
270 ?string $comment = null,
276 ?TypedMoney $totalPrice = null,
277 ?TaxedPrice $taxedPrice = null,
279 ?Address $billingAddress = null,
280 ?string $inventoryMode = null,
281 ?string $taxMode = null,
282 ?string $taxRoundingMode = null,
283 ?string $taxCalculationMode = null,
284 ?string $country = null,
290 ?CustomFields $custom = null,
291 ?StateReference $state = null,
292 ?string $purchaseOrderNumber = null,
293 ?CartReference $cart = null,
295 ) {
296 $this->id = $id;
297 $this->version = $version;
298 $this->createdAt = $createdAt;
299 $this->lastModifiedAt = $lastModifiedAt;
300 $this->key = $key;
301 $this->lastModifiedBy = $lastModifiedBy;
302 $this->createdBy = $createdBy;
303 $this->quoteRequestState = $quoteRequestState;
304 $this->comment = $comment;
305 $this->customer = $customer;
306 $this->customerGroup = $customerGroup;
307 $this->store = $store;
308 $this->lineItems = $lineItems;
309 $this->customLineItems = $customLineItems;
310 $this->totalPrice = $totalPrice;
311 $this->taxedPrice = $taxedPrice;
312 $this->shippingAddress = $shippingAddress;
313 $this->billingAddress = $billingAddress;
314 $this->inventoryMode = $inventoryMode;
315 $this->taxMode = $taxMode;
316 $this->taxRoundingMode = $taxRoundingMode;
317 $this->taxCalculationMode = $taxCalculationMode;
318 $this->country = $country;
319 $this->shippingInfo = $shippingInfo;
320 $this->paymentInfo = $paymentInfo;
321 $this->shippingRateInput = $shippingRateInput;
322 $this->itemShippingAddresses = $itemShippingAddresses;
323 $this->directDiscounts = $directDiscounts;
324 $this->custom = $custom;
325 $this->state = $state;
326 $this->purchaseOrderNumber = $purchaseOrderNumber;
327 $this->cart = $cart;
328 $this->businessUnit = $businessUnit;
329 }
330
337 public function getId()
338 {
339 if (is_null($this->id)) {
341 $data = $this->raw(self::FIELD_ID);
342 if (is_null($data)) {
343 return null;
344 }
345 $this->id = (string) $data;
346 }
347
348 return $this->id;
349 }
350
357 public function getVersion()
358 {
359 if (is_null($this->version)) {
361 $data = $this->raw(self::FIELD_VERSION);
362 if (is_null($data)) {
363 return null;
364 }
365 $this->version = (int) $data;
366 }
367
368 return $this->version;
369 }
370
377 public function getCreatedAt()
378 {
379 if (is_null($this->createdAt)) {
381 $data = $this->raw(self::FIELD_CREATED_AT);
382 if (is_null($data)) {
383 return null;
384 }
385 $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data);
386 if (false === $data) {
387 return null;
388 }
389 $this->createdAt = $data;
390 }
391
392 return $this->createdAt;
393 }
394
401 public function getLastModifiedAt()
402 {
403 if (is_null($this->lastModifiedAt)) {
405 $data = $this->raw(self::FIELD_LAST_MODIFIED_AT);
406 if (is_null($data)) {
407 return null;
408 }
409 $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data);
410 if (false === $data) {
411 return null;
412 }
413 $this->lastModifiedAt = $data;
414 }
415
417 }
418
425 public function getKey()
426 {
427 if (is_null($this->key)) {
429 $data = $this->raw(self::FIELD_KEY);
430 if (is_null($data)) {
431 return null;
432 }
433 $this->key = (string) $data;
434 }
435
436 return $this->key;
437 }
438
445 public function getLastModifiedBy()
446 {
447 if (is_null($this->lastModifiedBy)) {
449 $data = $this->raw(self::FIELD_LAST_MODIFIED_BY);
450 if (is_null($data)) {
451 return null;
452 }
453
454 $this->lastModifiedBy = LastModifiedByModel::of($data);
455 }
456
458 }
459
466 public function getCreatedBy()
467 {
468 if (is_null($this->createdBy)) {
470 $data = $this->raw(self::FIELD_CREATED_BY);
471 if (is_null($data)) {
472 return null;
473 }
474
475 $this->createdBy = CreatedByModel::of($data);
476 }
477
478 return $this->createdBy;
479 }
480
487 public function getQuoteRequestState()
488 {
489 if (is_null($this->quoteRequestState)) {
491 $data = $this->raw(self::FIELD_QUOTE_REQUEST_STATE);
492 if (is_null($data)) {
493 return null;
494 }
495 $this->quoteRequestState = (string) $data;
496 }
497
499 }
500
507 public function getComment()
508 {
509 if (is_null($this->comment)) {
511 $data = $this->raw(self::FIELD_COMMENT);
512 if (is_null($data)) {
513 return null;
514 }
515 $this->comment = (string) $data;
516 }
517
518 return $this->comment;
519 }
520
527 public function getCustomer()
528 {
529 if (is_null($this->customer)) {
531 $data = $this->raw(self::FIELD_CUSTOMER);
532 if (is_null($data)) {
533 return null;
534 }
535
536 $this->customer = CustomerReferenceModel::of($data);
537 }
538
539 return $this->customer;
540 }
541
550 public function getCustomerGroup()
551 {
552 if (is_null($this->customerGroup)) {
554 $data = $this->raw(self::FIELD_CUSTOMER_GROUP);
555 if (is_null($data)) {
556 return null;
557 }
558
559 $this->customerGroup = CustomerGroupReferenceModel::of($data);
560 }
561
563 }
564
571 public function getStore()
572 {
573 if (is_null($this->store)) {
575 $data = $this->raw(self::FIELD_STORE);
576 if (is_null($data)) {
577 return null;
578 }
579
580 $this->store = StoreKeyReferenceModel::of($data);
581 }
582
583 return $this->store;
584 }
585
592 public function getLineItems()
593 {
594 if (is_null($this->lineItems)) {
596 $data = $this->raw(self::FIELD_LINE_ITEMS);
597 if (is_null($data)) {
598 return null;
599 }
600 $this->lineItems = LineItemCollection::fromArray($data);
601 }
602
603 return $this->lineItems;
604 }
605
612 public function getCustomLineItems()
613 {
614 if (is_null($this->customLineItems)) {
616 $data = $this->raw(self::FIELD_CUSTOM_LINE_ITEMS);
617 if (is_null($data)) {
618 return null;
619 }
620 $this->customLineItems = CustomLineItemCollection::fromArray($data);
621 }
622
624 }
625
633 public function getTotalPrice()
634 {
635 if (is_null($this->totalPrice)) {
637 $data = $this->raw(self::FIELD_TOTAL_PRICE);
638 if (is_null($data)) {
639 return null;
640 }
641 $className = TypedMoneyModel::resolveDiscriminatorClass($data);
642 $this->totalPrice = $className::of($data);
643 }
644
645 return $this->totalPrice;
646 }
647
656 public function getTaxedPrice()
657 {
658 if (is_null($this->taxedPrice)) {
660 $data = $this->raw(self::FIELD_TAXED_PRICE);
661 if (is_null($data)) {
662 return null;
663 }
664
665 $this->taxedPrice = TaxedPriceModel::of($data);
666 }
667
668 return $this->taxedPrice;
669 }
670
678 public function getShippingAddress()
679 {
680 if (is_null($this->shippingAddress)) {
682 $data = $this->raw(self::FIELD_SHIPPING_ADDRESS);
683 if (is_null($data)) {
684 return null;
685 }
686
687 $this->shippingAddress = AddressModel::of($data);
688 }
689
691 }
692
699 public function getBillingAddress()
700 {
701 if (is_null($this->billingAddress)) {
703 $data = $this->raw(self::FIELD_BILLING_ADDRESS);
704 if (is_null($data)) {
705 return null;
706 }
707
708 $this->billingAddress = AddressModel::of($data);
709 }
710
712 }
713
720 public function getInventoryMode()
721 {
722 if (is_null($this->inventoryMode)) {
724 $data = $this->raw(self::FIELD_INVENTORY_MODE);
725 if (is_null($data)) {
726 return null;
727 }
728 $this->inventoryMode = (string) $data;
729 }
730
732 }
733
740 public function getTaxMode()
741 {
742 if (is_null($this->taxMode)) {
744 $data = $this->raw(self::FIELD_TAX_MODE);
745 if (is_null($data)) {
746 return null;
747 }
748 $this->taxMode = (string) $data;
749 }
750
751 return $this->taxMode;
752 }
753
760 public function getTaxRoundingMode()
761 {
762 if (is_null($this->taxRoundingMode)) {
764 $data = $this->raw(self::FIELD_TAX_ROUNDING_MODE);
765 if (is_null($data)) {
766 return null;
767 }
768 $this->taxRoundingMode = (string) $data;
769 }
770
772 }
773
780 public function getTaxCalculationMode()
781 {
782 if (is_null($this->taxCalculationMode)) {
784 $data = $this->raw(self::FIELD_TAX_CALCULATION_MODE);
785 if (is_null($data)) {
786 return null;
787 }
788 $this->taxCalculationMode = (string) $data;
789 }
790
792 }
793
800 public function getCountry()
801 {
802 if (is_null($this->country)) {
804 $data = $this->raw(self::FIELD_COUNTRY);
805 if (is_null($data)) {
806 return null;
807 }
808 $this->country = (string) $data;
809 }
810
811 return $this->country;
812 }
813
820 public function getShippingInfo()
821 {
822 if (is_null($this->shippingInfo)) {
824 $data = $this->raw(self::FIELD_SHIPPING_INFO);
825 if (is_null($data)) {
826 return null;
827 }
828
829 $this->shippingInfo = ShippingInfoModel::of($data);
830 }
831
832 return $this->shippingInfo;
833 }
834
841 public function getPaymentInfo()
842 {
843 if (is_null($this->paymentInfo)) {
845 $data = $this->raw(self::FIELD_PAYMENT_INFO);
846 if (is_null($data)) {
847 return null;
848 }
849
850 $this->paymentInfo = PaymentInfoModel::of($data);
851 }
852
853 return $this->paymentInfo;
854 }
855
862 public function getShippingRateInput()
863 {
864 if (is_null($this->shippingRateInput)) {
866 $data = $this->raw(self::FIELD_SHIPPING_RATE_INPUT);
867 if (is_null($data)) {
868 return null;
869 }
870 $className = ShippingRateInputModel::resolveDiscriminatorClass($data);
871 $this->shippingRateInput = $className::of($data);
872 }
873
875 }
876
886 public function getItemShippingAddresses()
887 {
888 if (is_null($this->itemShippingAddresses)) {
890 $data = $this->raw(self::FIELD_ITEM_SHIPPING_ADDRESSES);
891 if (is_null($data)) {
892 return null;
893 }
894 $this->itemShippingAddresses = AddressCollection::fromArray($data);
895 }
896
898 }
899
906 public function getDirectDiscounts()
907 {
908 if (is_null($this->directDiscounts)) {
910 $data = $this->raw(self::FIELD_DIRECT_DISCOUNTS);
911 if (is_null($data)) {
912 return null;
913 }
914 $this->directDiscounts = DirectDiscountCollection::fromArray($data);
915 }
916
918 }
919
926 public function getCustom()
927 {
928 if (is_null($this->custom)) {
930 $data = $this->raw(self::FIELD_CUSTOM);
931 if (is_null($data)) {
932 return null;
933 }
934
935 $this->custom = CustomFieldsModel::of($data);
936 }
937
938 return $this->custom;
939 }
940
948 public function getState()
949 {
950 if (is_null($this->state)) {
952 $data = $this->raw(self::FIELD_STATE);
953 if (is_null($data)) {
954 return null;
955 }
956
957 $this->state = StateReferenceModel::of($data);
958 }
959
960 return $this->state;
961 }
962
970 public function getPurchaseOrderNumber()
971 {
972 if (is_null($this->purchaseOrderNumber)) {
974 $data = $this->raw(self::FIELD_PURCHASE_ORDER_NUMBER);
975 if (is_null($data)) {
976 return null;
977 }
978 $this->purchaseOrderNumber = (string) $data;
979 }
980
982 }
983
990 public function getCart()
991 {
992 if (is_null($this->cart)) {
994 $data = $this->raw(self::FIELD_CART);
995 if (is_null($data)) {
996 return null;
997 }
998
999 $this->cart = CartReferenceModel::of($data);
1000 }
1001
1002 return $this->cart;
1003 }
1004
1011 public function getBusinessUnit()
1012 {
1013 if (is_null($this->businessUnit)) {
1015 $data = $this->raw(self::FIELD_BUSINESS_UNIT);
1016 if (is_null($data)) {
1017 return null;
1018 }
1019
1020 $this->businessUnit = BusinessUnitKeyReferenceModel::of($data);
1021 }
1022
1023 return $this->businessUnit;
1024 }
1025
1026
1030 public function setId(?string $id): void
1031 {
1032 $this->id = $id;
1033 }
1034
1038 public function setVersion(?int $version): void
1039 {
1040 $this->version = $version;
1041 }
1042
1046 public function setCreatedAt(?DateTimeImmutable $createdAt): void
1047 {
1048 $this->createdAt = $createdAt;
1049 }
1050
1054 public function setLastModifiedAt(?DateTimeImmutable $lastModifiedAt): void
1055 {
1056 $this->lastModifiedAt = $lastModifiedAt;
1057 }
1058
1062 public function setKey(?string $key): void
1063 {
1064 $this->key = $key;
1065 }
1066
1071 {
1072 $this->lastModifiedBy = $lastModifiedBy;
1073 }
1074
1078 public function setCreatedBy(?CreatedBy $createdBy): void
1079 {
1080 $this->createdBy = $createdBy;
1081 }
1082
1086 public function setQuoteRequestState(?string $quoteRequestState): void
1087 {
1088 $this->quoteRequestState = $quoteRequestState;
1089 }
1090
1094 public function setComment(?string $comment): void
1095 {
1096 $this->comment = $comment;
1097 }
1098
1103 {
1104 $this->customer = $customer;
1105 }
1106
1111 {
1112 $this->customerGroup = $customerGroup;
1113 }
1114
1118 public function setStore(?StoreKeyReference $store): void
1119 {
1120 $this->store = $store;
1121 }
1122
1127 {
1128 $this->lineItems = $lineItems;
1129 }
1130
1135 {
1136 $this->customLineItems = $customLineItems;
1137 }
1138
1142 public function setTotalPrice(?TypedMoney $totalPrice): void
1143 {
1144 $this->totalPrice = $totalPrice;
1145 }
1146
1150 public function setTaxedPrice(?TaxedPrice $taxedPrice): void
1151 {
1152 $this->taxedPrice = $taxedPrice;
1153 }
1154
1159 {
1160 $this->shippingAddress = $shippingAddress;
1161 }
1162
1167 {
1168 $this->billingAddress = $billingAddress;
1169 }
1170
1174 public function setInventoryMode(?string $inventoryMode): void
1175 {
1176 $this->inventoryMode = $inventoryMode;
1177 }
1178
1182 public function setTaxMode(?string $taxMode): void
1183 {
1184 $this->taxMode = $taxMode;
1185 }
1186
1190 public function setTaxRoundingMode(?string $taxRoundingMode): void
1191 {
1192 $this->taxRoundingMode = $taxRoundingMode;
1193 }
1194
1198 public function setTaxCalculationMode(?string $taxCalculationMode): void
1199 {
1200 $this->taxCalculationMode = $taxCalculationMode;
1201 }
1202
1206 public function setCountry(?string $country): void
1207 {
1208 $this->country = $country;
1209 }
1210
1215 {
1216 $this->shippingInfo = $shippingInfo;
1217 }
1218
1223 {
1224 $this->paymentInfo = $paymentInfo;
1225 }
1226
1231 {
1232 $this->shippingRateInput = $shippingRateInput;
1233 }
1234
1239 {
1240 $this->itemShippingAddresses = $itemShippingAddresses;
1241 }
1242
1247 {
1248 $this->directDiscounts = $directDiscounts;
1249 }
1250
1254 public function setCustom(?CustomFields $custom): void
1255 {
1256 $this->custom = $custom;
1257 }
1258
1262 public function setState(?StateReference $state): void
1263 {
1264 $this->state = $state;
1265 }
1266
1270 public function setPurchaseOrderNumber(?string $purchaseOrderNumber): void
1271 {
1272 $this->purchaseOrderNumber = $purchaseOrderNumber;
1273 }
1274
1278 public function setCart(?CartReference $cart): void
1279 {
1280 $this->cart = $cart;
1281 }
1282
1287 {
1288 $this->businessUnit = $businessUnit;
1289 }
1290
1291
1292 #[\ReturnTypeWillChange]
1293 public function jsonSerialize()
1294 {
1295 $data = $this->toArray();
1296 if (isset($data[QuoteRequest::FIELD_CREATED_AT]) && $data[QuoteRequest::FIELD_CREATED_AT] instanceof \DateTimeImmutable) {
1297 $data[QuoteRequest::FIELD_CREATED_AT] = $data[QuoteRequest::FIELD_CREATED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c');
1298 }
1299
1300 if (isset($data[QuoteRequest::FIELD_LAST_MODIFIED_AT]) && $data[QuoteRequest::FIELD_LAST_MODIFIED_AT] instanceof \DateTimeImmutable) {
1301 $data[QuoteRequest::FIELD_LAST_MODIFIED_AT] = $data[QuoteRequest::FIELD_LAST_MODIFIED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c');
1302 }
1303 return (object) $data;
1304 }
1305}
__construct(?string $id=null, ?int $version=null, ?DateTimeImmutable $createdAt=null, ?DateTimeImmutable $lastModifiedAt=null, ?string $key=null, ?LastModifiedBy $lastModifiedBy=null, ?CreatedBy $createdBy=null, ?string $quoteRequestState=null, ?string $comment=null, ?CustomerReference $customer=null, ?CustomerGroupReference $customerGroup=null, ?StoreKeyReference $store=null, ?LineItemCollection $lineItems=null, ?CustomLineItemCollection $customLineItems=null, ?TypedMoney $totalPrice=null, ?TaxedPrice $taxedPrice=null, ?Address $shippingAddress=null, ?Address $billingAddress=null, ?string $inventoryMode=null, ?string $taxMode=null, ?string $taxRoundingMode=null, ?string $taxCalculationMode=null, ?string $country=null, ?ShippingInfo $shippingInfo=null, ?PaymentInfo $paymentInfo=null, ?ShippingRateInput $shippingRateInput=null, ?AddressCollection $itemShippingAddresses=null, ?DirectDiscountCollection $directDiscounts=null, ?CustomFields $custom=null, ?StateReference $state=null, ?string $purchaseOrderNumber=null, ?CartReference $cart=null, ?BusinessUnitKeyReference $businessUnit=null)
setItemShippingAddresses(?AddressCollection $itemShippingAddresses)
setDirectDiscounts(?DirectDiscountCollection $directDiscounts)
setBusinessUnit(?BusinessUnitKeyReference $businessUnit)
setCustomLineItems(?CustomLineItemCollection $customLineItems)
setShippingRateInput(?ShippingRateInput $shippingRateInput)
setCustomerGroup(?CustomerGroupReference $customerGroup)