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
196
201 protected $country;
202
207 protected $shippingInfo;
208
213 protected $paymentInfo;
214
220
226
232
237 protected $custom;
238
243 protected $state;
244
250
255 protected $cart;
256
261 protected $businessUnit;
262
263
267 public function __construct(
268 ?string $id = null,
269 ?int $version = null,
270 ?DateTimeImmutable $createdAt = null,
271 ?DateTimeImmutable $lastModifiedAt = null,
272 ?string $key = null,
274 ?CreatedBy $createdBy = null,
275 ?string $quoteRequestState = null,
276 ?string $comment = null,
282 ?TypedMoney $totalPrice = null,
283 ?TaxedPrice $taxedPrice = null,
285 ?Address $billingAddress = null,
286 ?string $inventoryMode = null,
287 ?string $taxMode = null,
288 ?string $priceRoundingMode = null,
289 ?string $taxRoundingMode = null,
290 ?string $taxCalculationMode = null,
291 ?string $country = null,
297 ?CustomFields $custom = null,
298 ?StateReference $state = null,
299 ?string $purchaseOrderNumber = null,
300 ?CartReference $cart = null,
302 ) {
303 $this->id = $id;
304 $this->version = $version;
305 $this->createdAt = $createdAt;
306 $this->lastModifiedAt = $lastModifiedAt;
307 $this->key = $key;
308 $this->lastModifiedBy = $lastModifiedBy;
309 $this->createdBy = $createdBy;
310 $this->quoteRequestState = $quoteRequestState;
311 $this->comment = $comment;
312 $this->customer = $customer;
313 $this->customerGroup = $customerGroup;
314 $this->store = $store;
315 $this->lineItems = $lineItems;
316 $this->customLineItems = $customLineItems;
317 $this->totalPrice = $totalPrice;
318 $this->taxedPrice = $taxedPrice;
319 $this->shippingAddress = $shippingAddress;
320 $this->billingAddress = $billingAddress;
321 $this->inventoryMode = $inventoryMode;
322 $this->taxMode = $taxMode;
323 $this->priceRoundingMode = $priceRoundingMode;
324 $this->taxRoundingMode = $taxRoundingMode;
325 $this->taxCalculationMode = $taxCalculationMode;
326 $this->country = $country;
327 $this->shippingInfo = $shippingInfo;
328 $this->paymentInfo = $paymentInfo;
329 $this->shippingRateInput = $shippingRateInput;
330 $this->itemShippingAddresses = $itemShippingAddresses;
331 $this->directDiscounts = $directDiscounts;
332 $this->custom = $custom;
333 $this->state = $state;
334 $this->purchaseOrderNumber = $purchaseOrderNumber;
335 $this->cart = $cart;
336 $this->businessUnit = $businessUnit;
337 }
338
345 public function getId()
346 {
347 if (is_null($this->id)) {
349 $data = $this->raw(self::FIELD_ID);
350 if (is_null($data)) {
351 return null;
352 }
353 $this->id = (string) $data;
354 }
355
356 return $this->id;
357 }
358
365 public function getVersion()
366 {
367 if (is_null($this->version)) {
369 $data = $this->raw(self::FIELD_VERSION);
370 if (is_null($data)) {
371 return null;
372 }
373 $this->version = (int) $data;
374 }
375
376 return $this->version;
377 }
378
385 public function getCreatedAt()
386 {
387 if (is_null($this->createdAt)) {
389 $data = $this->raw(self::FIELD_CREATED_AT);
390 if (is_null($data)) {
391 return null;
392 }
393 $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data);
394 if (false === $data) {
395 return null;
396 }
397 $this->createdAt = $data;
398 }
399
400 return $this->createdAt;
401 }
402
409 public function getLastModifiedAt()
410 {
411 if (is_null($this->lastModifiedAt)) {
413 $data = $this->raw(self::FIELD_LAST_MODIFIED_AT);
414 if (is_null($data)) {
415 return null;
416 }
417 $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data);
418 if (false === $data) {
419 return null;
420 }
421 $this->lastModifiedAt = $data;
422 }
423
425 }
426
433 public function getKey()
434 {
435 if (is_null($this->key)) {
437 $data = $this->raw(self::FIELD_KEY);
438 if (is_null($data)) {
439 return null;
440 }
441 $this->key = (string) $data;
442 }
443
444 return $this->key;
445 }
446
453 public function getLastModifiedBy()
454 {
455 if (is_null($this->lastModifiedBy)) {
457 $data = $this->raw(self::FIELD_LAST_MODIFIED_BY);
458 if (is_null($data)) {
459 return null;
460 }
461
462 $this->lastModifiedBy = LastModifiedByModel::of($data);
463 }
464
466 }
467
474 public function getCreatedBy()
475 {
476 if (is_null($this->createdBy)) {
478 $data = $this->raw(self::FIELD_CREATED_BY);
479 if (is_null($data)) {
480 return null;
481 }
482
483 $this->createdBy = CreatedByModel::of($data);
484 }
485
486 return $this->createdBy;
487 }
488
495 public function getQuoteRequestState()
496 {
497 if (is_null($this->quoteRequestState)) {
499 $data = $this->raw(self::FIELD_QUOTE_REQUEST_STATE);
500 if (is_null($data)) {
501 return null;
502 }
503 $this->quoteRequestState = (string) $data;
504 }
505
507 }
508
515 public function getComment()
516 {
517 if (is_null($this->comment)) {
519 $data = $this->raw(self::FIELD_COMMENT);
520 if (is_null($data)) {
521 return null;
522 }
523 $this->comment = (string) $data;
524 }
525
526 return $this->comment;
527 }
528
535 public function getCustomer()
536 {
537 if (is_null($this->customer)) {
539 $data = $this->raw(self::FIELD_CUSTOMER);
540 if (is_null($data)) {
541 return null;
542 }
543
544 $this->customer = CustomerReferenceModel::of($data);
545 }
546
547 return $this->customer;
548 }
549
558 public function getCustomerGroup()
559 {
560 if (is_null($this->customerGroup)) {
562 $data = $this->raw(self::FIELD_CUSTOMER_GROUP);
563 if (is_null($data)) {
564 return null;
565 }
566
567 $this->customerGroup = CustomerGroupReferenceModel::of($data);
568 }
569
571 }
572
579 public function getStore()
580 {
581 if (is_null($this->store)) {
583 $data = $this->raw(self::FIELD_STORE);
584 if (is_null($data)) {
585 return null;
586 }
587
588 $this->store = StoreKeyReferenceModel::of($data);
589 }
590
591 return $this->store;
592 }
593
600 public function getLineItems()
601 {
602 if (is_null($this->lineItems)) {
604 $data = $this->raw(self::FIELD_LINE_ITEMS);
605 if (is_null($data)) {
606 return null;
607 }
608 $this->lineItems = LineItemCollection::fromArray($data);
609 }
610
611 return $this->lineItems;
612 }
613
620 public function getCustomLineItems()
621 {
622 if (is_null($this->customLineItems)) {
624 $data = $this->raw(self::FIELD_CUSTOM_LINE_ITEMS);
625 if (is_null($data)) {
626 return null;
627 }
628 $this->customLineItems = CustomLineItemCollection::fromArray($data);
629 }
630
632 }
633
641 public function getTotalPrice()
642 {
643 if (is_null($this->totalPrice)) {
645 $data = $this->raw(self::FIELD_TOTAL_PRICE);
646 if (is_null($data)) {
647 return null;
648 }
649 $className = TypedMoneyModel::resolveDiscriminatorClass($data);
650 $this->totalPrice = $className::of($data);
651 }
652
653 return $this->totalPrice;
654 }
655
664 public function getTaxedPrice()
665 {
666 if (is_null($this->taxedPrice)) {
668 $data = $this->raw(self::FIELD_TAXED_PRICE);
669 if (is_null($data)) {
670 return null;
671 }
672
673 $this->taxedPrice = TaxedPriceModel::of($data);
674 }
675
676 return $this->taxedPrice;
677 }
678
686 public function getShippingAddress()
687 {
688 if (is_null($this->shippingAddress)) {
690 $data = $this->raw(self::FIELD_SHIPPING_ADDRESS);
691 if (is_null($data)) {
692 return null;
693 }
694
695 $this->shippingAddress = AddressModel::of($data);
696 }
697
699 }
700
707 public function getBillingAddress()
708 {
709 if (is_null($this->billingAddress)) {
711 $data = $this->raw(self::FIELD_BILLING_ADDRESS);
712 if (is_null($data)) {
713 return null;
714 }
715
716 $this->billingAddress = AddressModel::of($data);
717 }
718
720 }
721
728 public function getInventoryMode()
729 {
730 if (is_null($this->inventoryMode)) {
732 $data = $this->raw(self::FIELD_INVENTORY_MODE);
733 if (is_null($data)) {
734 return null;
735 }
736 $this->inventoryMode = (string) $data;
737 }
738
740 }
741
748 public function getTaxMode()
749 {
750 if (is_null($this->taxMode)) {
752 $data = $this->raw(self::FIELD_TAX_MODE);
753 if (is_null($data)) {
754 return null;
755 }
756 $this->taxMode = (string) $data;
757 }
758
759 return $this->taxMode;
760 }
761
768 public function getPriceRoundingMode()
769 {
770 if (is_null($this->priceRoundingMode)) {
772 $data = $this->raw(self::FIELD_PRICE_ROUNDING_MODE);
773 if (is_null($data)) {
774 return null;
775 }
776 $this->priceRoundingMode = (string) $data;
777 }
778
780 }
781
788 public function getTaxRoundingMode()
789 {
790 if (is_null($this->taxRoundingMode)) {
792 $data = $this->raw(self::FIELD_TAX_ROUNDING_MODE);
793 if (is_null($data)) {
794 return null;
795 }
796 $this->taxRoundingMode = (string) $data;
797 }
798
800 }
801
808 public function getTaxCalculationMode()
809 {
810 if (is_null($this->taxCalculationMode)) {
812 $data = $this->raw(self::FIELD_TAX_CALCULATION_MODE);
813 if (is_null($data)) {
814 return null;
815 }
816 $this->taxCalculationMode = (string) $data;
817 }
818
820 }
821
828 public function getCountry()
829 {
830 if (is_null($this->country)) {
832 $data = $this->raw(self::FIELD_COUNTRY);
833 if (is_null($data)) {
834 return null;
835 }
836 $this->country = (string) $data;
837 }
838
839 return $this->country;
840 }
841
848 public function getShippingInfo()
849 {
850 if (is_null($this->shippingInfo)) {
852 $data = $this->raw(self::FIELD_SHIPPING_INFO);
853 if (is_null($data)) {
854 return null;
855 }
856
857 $this->shippingInfo = ShippingInfoModel::of($data);
858 }
859
860 return $this->shippingInfo;
861 }
862
869 public function getPaymentInfo()
870 {
871 if (is_null($this->paymentInfo)) {
873 $data = $this->raw(self::FIELD_PAYMENT_INFO);
874 if (is_null($data)) {
875 return null;
876 }
877
878 $this->paymentInfo = PaymentInfoModel::of($data);
879 }
880
881 return $this->paymentInfo;
882 }
883
890 public function getShippingRateInput()
891 {
892 if (is_null($this->shippingRateInput)) {
894 $data = $this->raw(self::FIELD_SHIPPING_RATE_INPUT);
895 if (is_null($data)) {
896 return null;
897 }
898 $className = ShippingRateInputModel::resolveDiscriminatorClass($data);
899 $this->shippingRateInput = $className::of($data);
900 }
901
903 }
904
914 public function getItemShippingAddresses()
915 {
916 if (is_null($this->itemShippingAddresses)) {
918 $data = $this->raw(self::FIELD_ITEM_SHIPPING_ADDRESSES);
919 if (is_null($data)) {
920 return null;
921 }
922 $this->itemShippingAddresses = AddressCollection::fromArray($data);
923 }
924
926 }
927
934 public function getDirectDiscounts()
935 {
936 if (is_null($this->directDiscounts)) {
938 $data = $this->raw(self::FIELD_DIRECT_DISCOUNTS);
939 if (is_null($data)) {
940 return null;
941 }
942 $this->directDiscounts = DirectDiscountCollection::fromArray($data);
943 }
944
946 }
947
954 public function getCustom()
955 {
956 if (is_null($this->custom)) {
958 $data = $this->raw(self::FIELD_CUSTOM);
959 if (is_null($data)) {
960 return null;
961 }
962
963 $this->custom = CustomFieldsModel::of($data);
964 }
965
966 return $this->custom;
967 }
968
976 public function getState()
977 {
978 if (is_null($this->state)) {
980 $data = $this->raw(self::FIELD_STATE);
981 if (is_null($data)) {
982 return null;
983 }
984
985 $this->state = StateReferenceModel::of($data);
986 }
987
988 return $this->state;
989 }
990
998 public function getPurchaseOrderNumber()
999 {
1000 if (is_null($this->purchaseOrderNumber)) {
1002 $data = $this->raw(self::FIELD_PURCHASE_ORDER_NUMBER);
1003 if (is_null($data)) {
1004 return null;
1005 }
1006 $this->purchaseOrderNumber = (string) $data;
1007 }
1008
1010 }
1011
1018 public function getCart()
1019 {
1020 if (is_null($this->cart)) {
1022 $data = $this->raw(self::FIELD_CART);
1023 if (is_null($data)) {
1024 return null;
1025 }
1026
1027 $this->cart = CartReferenceModel::of($data);
1028 }
1029
1030 return $this->cart;
1031 }
1032
1039 public function getBusinessUnit()
1040 {
1041 if (is_null($this->businessUnit)) {
1043 $data = $this->raw(self::FIELD_BUSINESS_UNIT);
1044 if (is_null($data)) {
1045 return null;
1046 }
1047
1048 $this->businessUnit = BusinessUnitKeyReferenceModel::of($data);
1049 }
1050
1051 return $this->businessUnit;
1052 }
1053
1054
1058 public function setId(?string $id): void
1059 {
1060 $this->id = $id;
1061 }
1062
1066 public function setVersion(?int $version): void
1067 {
1068 $this->version = $version;
1069 }
1070
1074 public function setCreatedAt(?DateTimeImmutable $createdAt): void
1075 {
1076 $this->createdAt = $createdAt;
1077 }
1078
1082 public function setLastModifiedAt(?DateTimeImmutable $lastModifiedAt): void
1083 {
1084 $this->lastModifiedAt = $lastModifiedAt;
1085 }
1086
1090 public function setKey(?string $key): void
1091 {
1092 $this->key = $key;
1093 }
1094
1099 {
1100 $this->lastModifiedBy = $lastModifiedBy;
1101 }
1102
1106 public function setCreatedBy(?CreatedBy $createdBy): void
1107 {
1108 $this->createdBy = $createdBy;
1109 }
1110
1114 public function setQuoteRequestState(?string $quoteRequestState): void
1115 {
1116 $this->quoteRequestState = $quoteRequestState;
1117 }
1118
1122 public function setComment(?string $comment): void
1123 {
1124 $this->comment = $comment;
1125 }
1126
1131 {
1132 $this->customer = $customer;
1133 }
1134
1139 {
1140 $this->customerGroup = $customerGroup;
1141 }
1142
1146 public function setStore(?StoreKeyReference $store): void
1147 {
1148 $this->store = $store;
1149 }
1150
1155 {
1156 $this->lineItems = $lineItems;
1157 }
1158
1163 {
1164 $this->customLineItems = $customLineItems;
1165 }
1166
1170 public function setTotalPrice(?TypedMoney $totalPrice): void
1171 {
1172 $this->totalPrice = $totalPrice;
1173 }
1174
1178 public function setTaxedPrice(?TaxedPrice $taxedPrice): void
1179 {
1180 $this->taxedPrice = $taxedPrice;
1181 }
1182
1187 {
1188 $this->shippingAddress = $shippingAddress;
1189 }
1190
1195 {
1196 $this->billingAddress = $billingAddress;
1197 }
1198
1202 public function setInventoryMode(?string $inventoryMode): void
1203 {
1204 $this->inventoryMode = $inventoryMode;
1205 }
1206
1210 public function setTaxMode(?string $taxMode): void
1211 {
1212 $this->taxMode = $taxMode;
1213 }
1214
1218 public function setPriceRoundingMode(?string $priceRoundingMode): void
1219 {
1220 $this->priceRoundingMode = $priceRoundingMode;
1221 }
1222
1226 public function setTaxRoundingMode(?string $taxRoundingMode): void
1227 {
1228 $this->taxRoundingMode = $taxRoundingMode;
1229 }
1230
1234 public function setTaxCalculationMode(?string $taxCalculationMode): void
1235 {
1236 $this->taxCalculationMode = $taxCalculationMode;
1237 }
1238
1242 public function setCountry(?string $country): void
1243 {
1244 $this->country = $country;
1245 }
1246
1251 {
1252 $this->shippingInfo = $shippingInfo;
1253 }
1254
1259 {
1260 $this->paymentInfo = $paymentInfo;
1261 }
1262
1267 {
1268 $this->shippingRateInput = $shippingRateInput;
1269 }
1270
1275 {
1276 $this->itemShippingAddresses = $itemShippingAddresses;
1277 }
1278
1283 {
1284 $this->directDiscounts = $directDiscounts;
1285 }
1286
1290 public function setCustom(?CustomFields $custom): void
1291 {
1292 $this->custom = $custom;
1293 }
1294
1298 public function setState(?StateReference $state): void
1299 {
1300 $this->state = $state;
1301 }
1302
1306 public function setPurchaseOrderNumber(?string $purchaseOrderNumber): void
1307 {
1308 $this->purchaseOrderNumber = $purchaseOrderNumber;
1309 }
1310
1314 public function setCart(?CartReference $cart): void
1315 {
1316 $this->cart = $cart;
1317 }
1318
1323 {
1324 $this->businessUnit = $businessUnit;
1325 }
1326
1327
1328 #[\ReturnTypeWillChange]
1329 public function jsonSerialize()
1330 {
1331 $data = $this->toArray();
1332 if (isset($data[QuoteRequest::FIELD_CREATED_AT]) && $data[QuoteRequest::FIELD_CREATED_AT] instanceof \DateTimeImmutable) {
1333 $data[QuoteRequest::FIELD_CREATED_AT] = $data[QuoteRequest::FIELD_CREATED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c');
1334 }
1335
1336 if (isset($data[QuoteRequest::FIELD_LAST_MODIFIED_AT]) && $data[QuoteRequest::FIELD_LAST_MODIFIED_AT] instanceof \DateTimeImmutable) {
1337 $data[QuoteRequest::FIELD_LAST_MODIFIED_AT] = $data[QuoteRequest::FIELD_LAST_MODIFIED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c');
1338 }
1339 return (object) $data;
1340 }
1341}
__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 $priceRoundingMode=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)