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
238
243 protected $custom;
244
249 protected $state;
250
256
261 protected $cart;
262
267 protected $businessUnit;
268
269
273 public function __construct(
274 ?string $id = null,
275 ?int $version = null,
276 ?DateTimeImmutable $createdAt = null,
277 ?DateTimeImmutable $lastModifiedAt = null,
278 ?string $key = null,
280 ?CreatedBy $createdBy = null,
281 ?string $quoteRequestState = null,
282 ?string $comment = null,
288 ?TypedMoney $totalPrice = null,
289 ?TaxedPrice $taxedPrice = null,
291 ?Address $billingAddress = null,
292 ?string $inventoryMode = null,
293 ?string $taxMode = null,
294 ?string $priceRoundingMode = null,
295 ?string $taxRoundingMode = null,
296 ?string $taxCalculationMode = null,
297 ?string $country = null,
304 ?CustomFields $custom = null,
305 ?StateReference $state = null,
306 ?string $purchaseOrderNumber = null,
307 ?CartReference $cart = null,
309 ) {
310 $this->id = $id;
311 $this->version = $version;
312 $this->createdAt = $createdAt;
313 $this->lastModifiedAt = $lastModifiedAt;
314 $this->key = $key;
315 $this->lastModifiedBy = $lastModifiedBy;
316 $this->createdBy = $createdBy;
317 $this->quoteRequestState = $quoteRequestState;
318 $this->comment = $comment;
319 $this->customer = $customer;
320 $this->customerGroup = $customerGroup;
321 $this->store = $store;
322 $this->lineItems = $lineItems;
323 $this->customLineItems = $customLineItems;
324 $this->totalPrice = $totalPrice;
325 $this->taxedPrice = $taxedPrice;
326 $this->shippingAddress = $shippingAddress;
327 $this->billingAddress = $billingAddress;
328 $this->inventoryMode = $inventoryMode;
329 $this->taxMode = $taxMode;
330 $this->priceRoundingMode = $priceRoundingMode;
331 $this->taxRoundingMode = $taxRoundingMode;
332 $this->taxCalculationMode = $taxCalculationMode;
333 $this->country = $country;
334 $this->shippingInfo = $shippingInfo;
335 $this->paymentInfo = $paymentInfo;
336 $this->shippingRateInput = $shippingRateInput;
337 $this->itemShippingAddresses = $itemShippingAddresses;
338 $this->directDiscounts = $directDiscounts;
339 $this->directDiscountsIgnoreCartDiscounts = $directDiscountsIgnoreCartDiscounts;
340 $this->custom = $custom;
341 $this->state = $state;
342 $this->purchaseOrderNumber = $purchaseOrderNumber;
343 $this->cart = $cart;
344 $this->businessUnit = $businessUnit;
345 }
346
353 public function getId()
354 {
355 if (is_null($this->id)) {
357 $data = $this->raw(self::FIELD_ID);
358 if (is_null($data)) {
359 return null;
360 }
361 $this->id = (string) $data;
362 }
363
364 return $this->id;
365 }
366
373 public function getVersion()
374 {
375 if (is_null($this->version)) {
377 $data = $this->raw(self::FIELD_VERSION);
378 if (is_null($data)) {
379 return null;
380 }
381 $this->version = (int) $data;
382 }
383
384 return $this->version;
385 }
386
393 public function getCreatedAt()
394 {
395 if (is_null($this->createdAt)) {
397 $data = $this->raw(self::FIELD_CREATED_AT);
398 if (is_null($data)) {
399 return null;
400 }
401 $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data);
402 if (false === $data) {
403 return null;
404 }
405 $this->createdAt = $data;
406 }
407
408 return $this->createdAt;
409 }
410
417 public function getLastModifiedAt()
418 {
419 if (is_null($this->lastModifiedAt)) {
421 $data = $this->raw(self::FIELD_LAST_MODIFIED_AT);
422 if (is_null($data)) {
423 return null;
424 }
425 $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data);
426 if (false === $data) {
427 return null;
428 }
429 $this->lastModifiedAt = $data;
430 }
431
433 }
434
441 public function getKey()
442 {
443 if (is_null($this->key)) {
445 $data = $this->raw(self::FIELD_KEY);
446 if (is_null($data)) {
447 return null;
448 }
449 $this->key = (string) $data;
450 }
451
452 return $this->key;
453 }
454
461 public function getLastModifiedBy()
462 {
463 if (is_null($this->lastModifiedBy)) {
465 $data = $this->raw(self::FIELD_LAST_MODIFIED_BY);
466 if (is_null($data)) {
467 return null;
468 }
469
470 $this->lastModifiedBy = LastModifiedByModel::of($data);
471 }
472
474 }
475
482 public function getCreatedBy()
483 {
484 if (is_null($this->createdBy)) {
486 $data = $this->raw(self::FIELD_CREATED_BY);
487 if (is_null($data)) {
488 return null;
489 }
490
491 $this->createdBy = CreatedByModel::of($data);
492 }
493
494 return $this->createdBy;
495 }
496
503 public function getQuoteRequestState()
504 {
505 if (is_null($this->quoteRequestState)) {
507 $data = $this->raw(self::FIELD_QUOTE_REQUEST_STATE);
508 if (is_null($data)) {
509 return null;
510 }
511 $this->quoteRequestState = (string) $data;
512 }
513
515 }
516
523 public function getComment()
524 {
525 if (is_null($this->comment)) {
527 $data = $this->raw(self::FIELD_COMMENT);
528 if (is_null($data)) {
529 return null;
530 }
531 $this->comment = (string) $data;
532 }
533
534 return $this->comment;
535 }
536
543 public function getCustomer()
544 {
545 if (is_null($this->customer)) {
547 $data = $this->raw(self::FIELD_CUSTOMER);
548 if (is_null($data)) {
549 return null;
550 }
551
552 $this->customer = CustomerReferenceModel::of($data);
553 }
554
555 return $this->customer;
556 }
557
566 public function getCustomerGroup()
567 {
568 if (is_null($this->customerGroup)) {
570 $data = $this->raw(self::FIELD_CUSTOMER_GROUP);
571 if (is_null($data)) {
572 return null;
573 }
574
575 $this->customerGroup = CustomerGroupReferenceModel::of($data);
576 }
577
579 }
580
587 public function getStore()
588 {
589 if (is_null($this->store)) {
591 $data = $this->raw(self::FIELD_STORE);
592 if (is_null($data)) {
593 return null;
594 }
595
596 $this->store = StoreKeyReferenceModel::of($data);
597 }
598
599 return $this->store;
600 }
601
608 public function getLineItems()
609 {
610 if (is_null($this->lineItems)) {
612 $data = $this->raw(self::FIELD_LINE_ITEMS);
613 if (is_null($data)) {
614 return null;
615 }
616 $this->lineItems = LineItemCollection::fromArray($data);
617 }
618
619 return $this->lineItems;
620 }
621
628 public function getCustomLineItems()
629 {
630 if (is_null($this->customLineItems)) {
632 $data = $this->raw(self::FIELD_CUSTOM_LINE_ITEMS);
633 if (is_null($data)) {
634 return null;
635 }
636 $this->customLineItems = CustomLineItemCollection::fromArray($data);
637 }
638
640 }
641
649 public function getTotalPrice()
650 {
651 if (is_null($this->totalPrice)) {
653 $data = $this->raw(self::FIELD_TOTAL_PRICE);
654 if (is_null($data)) {
655 return null;
656 }
657 $className = TypedMoneyModel::resolveDiscriminatorClass($data);
658 $this->totalPrice = $className::of($data);
659 }
660
661 return $this->totalPrice;
662 }
663
672 public function getTaxedPrice()
673 {
674 if (is_null($this->taxedPrice)) {
676 $data = $this->raw(self::FIELD_TAXED_PRICE);
677 if (is_null($data)) {
678 return null;
679 }
680
681 $this->taxedPrice = TaxedPriceModel::of($data);
682 }
683
684 return $this->taxedPrice;
685 }
686
694 public function getShippingAddress()
695 {
696 if (is_null($this->shippingAddress)) {
698 $data = $this->raw(self::FIELD_SHIPPING_ADDRESS);
699 if (is_null($data)) {
700 return null;
701 }
702
703 $this->shippingAddress = AddressModel::of($data);
704 }
705
707 }
708
715 public function getBillingAddress()
716 {
717 if (is_null($this->billingAddress)) {
719 $data = $this->raw(self::FIELD_BILLING_ADDRESS);
720 if (is_null($data)) {
721 return null;
722 }
723
724 $this->billingAddress = AddressModel::of($data);
725 }
726
728 }
729
736 public function getInventoryMode()
737 {
738 if (is_null($this->inventoryMode)) {
740 $data = $this->raw(self::FIELD_INVENTORY_MODE);
741 if (is_null($data)) {
742 return null;
743 }
744 $this->inventoryMode = (string) $data;
745 }
746
748 }
749
756 public function getTaxMode()
757 {
758 if (is_null($this->taxMode)) {
760 $data = $this->raw(self::FIELD_TAX_MODE);
761 if (is_null($data)) {
762 return null;
763 }
764 $this->taxMode = (string) $data;
765 }
766
767 return $this->taxMode;
768 }
769
776 public function getPriceRoundingMode()
777 {
778 if (is_null($this->priceRoundingMode)) {
780 $data = $this->raw(self::FIELD_PRICE_ROUNDING_MODE);
781 if (is_null($data)) {
782 return null;
783 }
784 $this->priceRoundingMode = (string) $data;
785 }
786
788 }
789
796 public function getTaxRoundingMode()
797 {
798 if (is_null($this->taxRoundingMode)) {
800 $data = $this->raw(self::FIELD_TAX_ROUNDING_MODE);
801 if (is_null($data)) {
802 return null;
803 }
804 $this->taxRoundingMode = (string) $data;
805 }
806
808 }
809
816 public function getTaxCalculationMode()
817 {
818 if (is_null($this->taxCalculationMode)) {
820 $data = $this->raw(self::FIELD_TAX_CALCULATION_MODE);
821 if (is_null($data)) {
822 return null;
823 }
824 $this->taxCalculationMode = (string) $data;
825 }
826
828 }
829
836 public function getCountry()
837 {
838 if (is_null($this->country)) {
840 $data = $this->raw(self::FIELD_COUNTRY);
841 if (is_null($data)) {
842 return null;
843 }
844 $this->country = (string) $data;
845 }
846
847 return $this->country;
848 }
849
856 public function getShippingInfo()
857 {
858 if (is_null($this->shippingInfo)) {
860 $data = $this->raw(self::FIELD_SHIPPING_INFO);
861 if (is_null($data)) {
862 return null;
863 }
864
865 $this->shippingInfo = ShippingInfoModel::of($data);
866 }
867
868 return $this->shippingInfo;
869 }
870
877 public function getPaymentInfo()
878 {
879 if (is_null($this->paymentInfo)) {
881 $data = $this->raw(self::FIELD_PAYMENT_INFO);
882 if (is_null($data)) {
883 return null;
884 }
885
886 $this->paymentInfo = PaymentInfoModel::of($data);
887 }
888
889 return $this->paymentInfo;
890 }
891
898 public function getShippingRateInput()
899 {
900 if (is_null($this->shippingRateInput)) {
902 $data = $this->raw(self::FIELD_SHIPPING_RATE_INPUT);
903 if (is_null($data)) {
904 return null;
905 }
906 $className = ShippingRateInputModel::resolveDiscriminatorClass($data);
907 $this->shippingRateInput = $className::of($data);
908 }
909
911 }
912
922 public function getItemShippingAddresses()
923 {
924 if (is_null($this->itemShippingAddresses)) {
926 $data = $this->raw(self::FIELD_ITEM_SHIPPING_ADDRESSES);
927 if (is_null($data)) {
928 return null;
929 }
930 $this->itemShippingAddresses = AddressCollection::fromArray($data);
931 }
932
934 }
935
942 public function getDirectDiscounts()
943 {
944 if (is_null($this->directDiscounts)) {
946 $data = $this->raw(self::FIELD_DIRECT_DISCOUNTS);
947 if (is_null($data)) {
948 return null;
949 }
950 $this->directDiscounts = DirectDiscountCollection::fromArray($data);
951 }
952
954 }
955
966 {
967 if (is_null($this->directDiscountsIgnoreCartDiscounts)) {
969 $data = $this->raw(self::FIELD_DIRECT_DISCOUNTS_IGNORE_CART_DISCOUNTS);
970 if (is_null($data)) {
971 return null;
972 }
973 $this->directDiscountsIgnoreCartDiscounts = (bool) $data;
974 }
975
977 }
978
985 public function getCustom()
986 {
987 if (is_null($this->custom)) {
989 $data = $this->raw(self::FIELD_CUSTOM);
990 if (is_null($data)) {
991 return null;
992 }
993
994 $this->custom = CustomFieldsModel::of($data);
995 }
996
997 return $this->custom;
998 }
999
1007 public function getState()
1008 {
1009 if (is_null($this->state)) {
1011 $data = $this->raw(self::FIELD_STATE);
1012 if (is_null($data)) {
1013 return null;
1014 }
1015
1016 $this->state = StateReferenceModel::of($data);
1017 }
1018
1019 return $this->state;
1020 }
1021
1029 public function getPurchaseOrderNumber()
1030 {
1031 if (is_null($this->purchaseOrderNumber)) {
1033 $data = $this->raw(self::FIELD_PURCHASE_ORDER_NUMBER);
1034 if (is_null($data)) {
1035 return null;
1036 }
1037 $this->purchaseOrderNumber = (string) $data;
1038 }
1039
1041 }
1042
1049 public function getCart()
1050 {
1051 if (is_null($this->cart)) {
1053 $data = $this->raw(self::FIELD_CART);
1054 if (is_null($data)) {
1055 return null;
1056 }
1057
1058 $this->cart = CartReferenceModel::of($data);
1059 }
1060
1061 return $this->cart;
1062 }
1063
1070 public function getBusinessUnit()
1071 {
1072 if (is_null($this->businessUnit)) {
1074 $data = $this->raw(self::FIELD_BUSINESS_UNIT);
1075 if (is_null($data)) {
1076 return null;
1077 }
1078
1079 $this->businessUnit = BusinessUnitKeyReferenceModel::of($data);
1080 }
1081
1082 return $this->businessUnit;
1083 }
1084
1085
1089 public function setId(?string $id): void
1090 {
1091 $this->id = $id;
1092 }
1093
1097 public function setVersion(?int $version): void
1098 {
1099 $this->version = $version;
1100 }
1101
1105 public function setCreatedAt(?DateTimeImmutable $createdAt): void
1106 {
1107 $this->createdAt = $createdAt;
1108 }
1109
1113 public function setLastModifiedAt(?DateTimeImmutable $lastModifiedAt): void
1114 {
1115 $this->lastModifiedAt = $lastModifiedAt;
1116 }
1117
1121 public function setKey(?string $key): void
1122 {
1123 $this->key = $key;
1124 }
1125
1130 {
1131 $this->lastModifiedBy = $lastModifiedBy;
1132 }
1133
1137 public function setCreatedBy(?CreatedBy $createdBy): void
1138 {
1139 $this->createdBy = $createdBy;
1140 }
1141
1145 public function setQuoteRequestState(?string $quoteRequestState): void
1146 {
1147 $this->quoteRequestState = $quoteRequestState;
1148 }
1149
1153 public function setComment(?string $comment): void
1154 {
1155 $this->comment = $comment;
1156 }
1157
1162 {
1163 $this->customer = $customer;
1164 }
1165
1170 {
1171 $this->customerGroup = $customerGroup;
1172 }
1173
1177 public function setStore(?StoreKeyReference $store): void
1178 {
1179 $this->store = $store;
1180 }
1181
1186 {
1187 $this->lineItems = $lineItems;
1188 }
1189
1194 {
1195 $this->customLineItems = $customLineItems;
1196 }
1197
1201 public function setTotalPrice(?TypedMoney $totalPrice): void
1202 {
1203 $this->totalPrice = $totalPrice;
1204 }
1205
1209 public function setTaxedPrice(?TaxedPrice $taxedPrice): void
1210 {
1211 $this->taxedPrice = $taxedPrice;
1212 }
1213
1218 {
1219 $this->shippingAddress = $shippingAddress;
1220 }
1221
1226 {
1227 $this->billingAddress = $billingAddress;
1228 }
1229
1233 public function setInventoryMode(?string $inventoryMode): void
1234 {
1235 $this->inventoryMode = $inventoryMode;
1236 }
1237
1241 public function setTaxMode(?string $taxMode): void
1242 {
1243 $this->taxMode = $taxMode;
1244 }
1245
1249 public function setPriceRoundingMode(?string $priceRoundingMode): void
1250 {
1251 $this->priceRoundingMode = $priceRoundingMode;
1252 }
1253
1257 public function setTaxRoundingMode(?string $taxRoundingMode): void
1258 {
1259 $this->taxRoundingMode = $taxRoundingMode;
1260 }
1261
1265 public function setTaxCalculationMode(?string $taxCalculationMode): void
1266 {
1267 $this->taxCalculationMode = $taxCalculationMode;
1268 }
1269
1273 public function setCountry(?string $country): void
1274 {
1275 $this->country = $country;
1276 }
1277
1282 {
1283 $this->shippingInfo = $shippingInfo;
1284 }
1285
1290 {
1291 $this->paymentInfo = $paymentInfo;
1292 }
1293
1298 {
1299 $this->shippingRateInput = $shippingRateInput;
1300 }
1301
1306 {
1307 $this->itemShippingAddresses = $itemShippingAddresses;
1308 }
1309
1314 {
1315 $this->directDiscounts = $directDiscounts;
1316 }
1317
1322 {
1323 $this->directDiscountsIgnoreCartDiscounts = $directDiscountsIgnoreCartDiscounts;
1324 }
1325
1329 public function setCustom(?CustomFields $custom): void
1330 {
1331 $this->custom = $custom;
1332 }
1333
1337 public function setState(?StateReference $state): void
1338 {
1339 $this->state = $state;
1340 }
1341
1345 public function setPurchaseOrderNumber(?string $purchaseOrderNumber): void
1346 {
1347 $this->purchaseOrderNumber = $purchaseOrderNumber;
1348 }
1349
1353 public function setCart(?CartReference $cart): void
1354 {
1355 $this->cart = $cart;
1356 }
1357
1362 {
1363 $this->businessUnit = $businessUnit;
1364 }
1365
1366
1367 #[\ReturnTypeWillChange]
1368 public function jsonSerialize()
1369 {
1370 $data = $this->toArray();
1371 if (isset($data[QuoteRequest::FIELD_CREATED_AT]) && $data[QuoteRequest::FIELD_CREATED_AT] instanceof \DateTimeImmutable) {
1372 $data[QuoteRequest::FIELD_CREATED_AT] = $data[QuoteRequest::FIELD_CREATED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c');
1373 }
1374
1375 if (isset($data[QuoteRequest::FIELD_LAST_MODIFIED_AT]) && $data[QuoteRequest::FIELD_LAST_MODIFIED_AT] instanceof \DateTimeImmutable) {
1376 $data[QuoteRequest::FIELD_LAST_MODIFIED_AT] = $data[QuoteRequest::FIELD_LAST_MODIFIED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c');
1377 }
1378 return (object) $data;
1379 }
1380}
setDirectDiscountsIgnoreCartDiscounts(?bool $directDiscountsIgnoreCartDiscounts)
setItemShippingAddresses(?AddressCollection $itemShippingAddresses)
setDirectDiscounts(?DirectDiscountCollection $directDiscounts)
setBusinessUnit(?BusinessUnitKeyReference $businessUnit)
setCustomLineItems(?CustomLineItemCollection $customLineItems)
setShippingRateInput(?ShippingRateInput $shippingRateInput)
setCustomerGroup(?CustomerGroupReference $customerGroup)
__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, ?bool $directDiscountsIgnoreCartDiscounts=null, ?CustomFields $custom=null, ?StateReference $state=null, ?string $purchaseOrderNumber=null, ?CartReference $cart=null, ?BusinessUnitKeyReference $businessUnit=null)