commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
QuoteBuilder.php
1<?php
2
3declare(strict_types=1);
10
54use DateTimeImmutable;
55use stdClass;
56
60final class QuoteBuilder implements Builder
61{
66 private $id;
67
72 private $version;
73
78 private $createdAt;
79
84 private $lastModifiedAt;
85
90 private $key;
91
96 private $lastModifiedBy;
97
102 private $createdBy;
103
108 private $quoteRequest;
109
114 private $stagedQuote;
115
120 private $customer;
121
126 private $customerGroup;
127
132 private $validTo;
133
138 private $sellerComment;
139
144 private $buyerComment;
145
150 private $store;
151
156 private $lineItems;
157
162 private $customLineItems;
163
168 private $totalPrice;
169
174 private $taxedPrice;
175
180 private $shippingAddress;
181
186 private $billingAddress;
187
192 private $inventoryMode;
193
198 private $taxMode;
199
204 private $priceRoundingMode;
205
210 private $taxRoundingMode;
211
216 private $taxCalculationMode;
217
222 private $country;
223
228 private $shippingInfo;
229
234 private $paymentInfo;
235
240 private $shippingRateInput;
241
246 private $itemShippingAddresses;
247
252 private $directDiscounts;
253
258 private $directDiscountsIgnoreCartDiscounts;
259
264 private $custom;
265
270 private $quoteState;
271
276 private $state;
277
282 private $purchaseOrderNumber;
283
288 private $businessUnit;
289
296 public function getId()
297 {
298 return $this->id;
299 }
300
307 public function getVersion()
308 {
309 return $this->version;
310 }
311
318 public function getCreatedAt()
319 {
320 return $this->createdAt;
321 }
322
329 public function getLastModifiedAt()
330 {
331 return $this->lastModifiedAt;
332 }
333
340 public function getKey()
341 {
342 return $this->key;
343 }
344
351 public function getLastModifiedBy()
352 {
353 return $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy;
354 }
355
362 public function getCreatedBy()
363 {
364 return $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy;
365 }
366
373 public function getQuoteRequest()
374 {
375 return $this->quoteRequest instanceof QuoteRequestReferenceBuilder ? $this->quoteRequest->build() : $this->quoteRequest;
376 }
377
384 public function getStagedQuote()
385 {
386 return $this->stagedQuote instanceof StagedQuoteReferenceBuilder ? $this->stagedQuote->build() : $this->stagedQuote;
387 }
388
395 public function getCustomer()
396 {
397 return $this->customer instanceof CustomerReferenceBuilder ? $this->customer->build() : $this->customer;
398 }
399
408 public function getCustomerGroup()
409 {
410 return $this->customerGroup instanceof CustomerGroupReferenceBuilder ? $this->customerGroup->build() : $this->customerGroup;
411 }
412
419 public function getValidTo()
420 {
421 return $this->validTo;
422 }
423
430 public function getSellerComment()
431 {
432 return $this->sellerComment;
433 }
434
441 public function getBuyerComment()
442 {
443 return $this->buyerComment;
444 }
445
452 public function getStore()
453 {
454 return $this->store instanceof StoreKeyReferenceBuilder ? $this->store->build() : $this->store;
455 }
456
463 public function getLineItems()
464 {
465 return $this->lineItems;
466 }
467
474 public function getCustomLineItems()
475 {
476 return $this->customLineItems;
477 }
478
486 public function getTotalPrice()
487 {
488 return $this->totalPrice instanceof TypedMoneyBuilder ? $this->totalPrice->build() : $this->totalPrice;
489 }
490
499 public function getTaxedPrice()
500 {
501 return $this->taxedPrice instanceof TaxedPriceBuilder ? $this->taxedPrice->build() : $this->taxedPrice;
502 }
503
511 public function getShippingAddress()
512 {
513 return $this->shippingAddress instanceof AddressBuilder ? $this->shippingAddress->build() : $this->shippingAddress;
514 }
515
522 public function getBillingAddress()
523 {
524 return $this->billingAddress instanceof AddressBuilder ? $this->billingAddress->build() : $this->billingAddress;
525 }
526
533 public function getInventoryMode()
534 {
535 return $this->inventoryMode;
536 }
537
544 public function getTaxMode()
545 {
546 return $this->taxMode;
547 }
548
555 public function getPriceRoundingMode()
556 {
557 return $this->priceRoundingMode;
558 }
559
566 public function getTaxRoundingMode()
567 {
568 return $this->taxRoundingMode;
569 }
570
577 public function getTaxCalculationMode()
578 {
579 return $this->taxCalculationMode;
580 }
581
588 public function getCountry()
589 {
590 return $this->country;
591 }
592
599 public function getShippingInfo()
600 {
601 return $this->shippingInfo instanceof ShippingInfoBuilder ? $this->shippingInfo->build() : $this->shippingInfo;
602 }
603
610 public function getPaymentInfo()
611 {
612 return $this->paymentInfo instanceof PaymentInfoBuilder ? $this->paymentInfo->build() : $this->paymentInfo;
613 }
614
621 public function getShippingRateInput()
622 {
623 return $this->shippingRateInput instanceof ShippingRateInputBuilder ? $this->shippingRateInput->build() : $this->shippingRateInput;
624 }
625
635 public function getItemShippingAddresses()
636 {
637 return $this->itemShippingAddresses;
638 }
639
646 public function getDirectDiscounts()
647 {
648 return $this->directDiscounts;
649 }
650
661 {
662 return $this->directDiscountsIgnoreCartDiscounts;
663 }
664
671 public function getCustom()
672 {
673 return $this->custom instanceof CustomFieldsBuilder ? $this->custom->build() : $this->custom;
674 }
675
682 public function getQuoteState()
683 {
684 return $this->quoteState;
685 }
686
694 public function getState()
695 {
696 return $this->state instanceof StateReferenceBuilder ? $this->state->build() : $this->state;
697 }
698
706 public function getPurchaseOrderNumber()
707 {
708 return $this->purchaseOrderNumber;
709 }
710
717 public function getBusinessUnit()
718 {
719 return $this->businessUnit instanceof BusinessUnitKeyReferenceBuilder ? $this->businessUnit->build() : $this->businessUnit;
720 }
721
726 public function withId(?string $id)
727 {
728 $this->id = $id;
729
730 return $this;
731 }
732
737 public function withVersion(?int $version)
738 {
739 $this->version = $version;
740
741 return $this;
742 }
743
748 public function withCreatedAt(?DateTimeImmutable $createdAt)
749 {
750 $this->createdAt = $createdAt;
751
752 return $this;
753 }
754
759 public function withLastModifiedAt(?DateTimeImmutable $lastModifiedAt)
760 {
761 $this->lastModifiedAt = $lastModifiedAt;
762
763 return $this;
764 }
765
770 public function withKey(?string $key)
771 {
772 $this->key = $key;
773
774 return $this;
775 }
776
781 public function withLastModifiedBy(?LastModifiedBy $lastModifiedBy)
782 {
783 $this->lastModifiedBy = $lastModifiedBy;
784
785 return $this;
786 }
787
792 public function withCreatedBy(?CreatedBy $createdBy)
793 {
794 $this->createdBy = $createdBy;
795
796 return $this;
797 }
798
803 public function withQuoteRequest(?QuoteRequestReference $quoteRequest)
804 {
805 $this->quoteRequest = $quoteRequest;
806
807 return $this;
808 }
809
814 public function withStagedQuote(?StagedQuoteReference $stagedQuote)
815 {
816 $this->stagedQuote = $stagedQuote;
817
818 return $this;
819 }
820
825 public function withCustomer(?CustomerReference $customer)
826 {
827 $this->customer = $customer;
828
829 return $this;
830 }
831
836 public function withCustomerGroup(?CustomerGroupReference $customerGroup)
837 {
838 $this->customerGroup = $customerGroup;
839
840 return $this;
841 }
842
847 public function withValidTo(?DateTimeImmutable $validTo)
848 {
849 $this->validTo = $validTo;
850
851 return $this;
852 }
853
858 public function withSellerComment(?string $sellerComment)
859 {
860 $this->sellerComment = $sellerComment;
861
862 return $this;
863 }
864
869 public function withBuyerComment(?string $buyerComment)
870 {
871 $this->buyerComment = $buyerComment;
872
873 return $this;
874 }
875
880 public function withStore(?StoreKeyReference $store)
881 {
882 $this->store = $store;
883
884 return $this;
885 }
886
891 public function withLineItems(?LineItemCollection $lineItems)
892 {
893 $this->lineItems = $lineItems;
894
895 return $this;
896 }
897
902 public function withCustomLineItems(?CustomLineItemCollection $customLineItems)
903 {
904 $this->customLineItems = $customLineItems;
905
906 return $this;
907 }
908
913 public function withTotalPrice(?TypedMoney $totalPrice)
914 {
915 $this->totalPrice = $totalPrice;
916
917 return $this;
918 }
919
924 public function withTaxedPrice(?TaxedPrice $taxedPrice)
925 {
926 $this->taxedPrice = $taxedPrice;
927
928 return $this;
929 }
930
935 public function withShippingAddress(?Address $shippingAddress)
936 {
937 $this->shippingAddress = $shippingAddress;
938
939 return $this;
940 }
941
946 public function withBillingAddress(?Address $billingAddress)
947 {
948 $this->billingAddress = $billingAddress;
949
950 return $this;
951 }
952
957 public function withInventoryMode(?string $inventoryMode)
958 {
959 $this->inventoryMode = $inventoryMode;
960
961 return $this;
962 }
963
968 public function withTaxMode(?string $taxMode)
969 {
970 $this->taxMode = $taxMode;
971
972 return $this;
973 }
974
979 public function withPriceRoundingMode(?string $priceRoundingMode)
980 {
981 $this->priceRoundingMode = $priceRoundingMode;
982
983 return $this;
984 }
985
990 public function withTaxRoundingMode(?string $taxRoundingMode)
991 {
992 $this->taxRoundingMode = $taxRoundingMode;
993
994 return $this;
995 }
996
1001 public function withTaxCalculationMode(?string $taxCalculationMode)
1002 {
1003 $this->taxCalculationMode = $taxCalculationMode;
1004
1005 return $this;
1006 }
1007
1012 public function withCountry(?string $country)
1013 {
1014 $this->country = $country;
1015
1016 return $this;
1017 }
1018
1023 public function withShippingInfo(?ShippingInfo $shippingInfo)
1024 {
1025 $this->shippingInfo = $shippingInfo;
1026
1027 return $this;
1028 }
1029
1034 public function withPaymentInfo(?PaymentInfo $paymentInfo)
1035 {
1036 $this->paymentInfo = $paymentInfo;
1037
1038 return $this;
1039 }
1040
1045 public function withShippingRateInput(?ShippingRateInput $shippingRateInput)
1046 {
1047 $this->shippingRateInput = $shippingRateInput;
1048
1049 return $this;
1050 }
1051
1056 public function withItemShippingAddresses(?AddressCollection $itemShippingAddresses)
1057 {
1058 $this->itemShippingAddresses = $itemShippingAddresses;
1059
1060 return $this;
1061 }
1062
1067 public function withDirectDiscounts(?DirectDiscountCollection $directDiscounts)
1068 {
1069 $this->directDiscounts = $directDiscounts;
1070
1071 return $this;
1072 }
1073
1078 public function withDirectDiscountsIgnoreCartDiscounts(?bool $directDiscountsIgnoreCartDiscounts)
1079 {
1080 $this->directDiscountsIgnoreCartDiscounts = $directDiscountsIgnoreCartDiscounts;
1081
1082 return $this;
1083 }
1084
1089 public function withCustom(?CustomFields $custom)
1090 {
1091 $this->custom = $custom;
1092
1093 return $this;
1094 }
1095
1100 public function withQuoteState(?string $quoteState)
1101 {
1102 $this->quoteState = $quoteState;
1103
1104 return $this;
1105 }
1106
1111 public function withState(?StateReference $state)
1112 {
1113 $this->state = $state;
1114
1115 return $this;
1116 }
1117
1122 public function withPurchaseOrderNumber(?string $purchaseOrderNumber)
1123 {
1124 $this->purchaseOrderNumber = $purchaseOrderNumber;
1125
1126 return $this;
1127 }
1128
1133 public function withBusinessUnit(?BusinessUnitKeyReference $businessUnit)
1134 {
1135 $this->businessUnit = $businessUnit;
1136
1137 return $this;
1138 }
1139
1144 public function withLastModifiedByBuilder(?LastModifiedByBuilder $lastModifiedBy)
1145 {
1146 $this->lastModifiedBy = $lastModifiedBy;
1147
1148 return $this;
1149 }
1150
1155 public function withCreatedByBuilder(?CreatedByBuilder $createdBy)
1156 {
1157 $this->createdBy = $createdBy;
1158
1159 return $this;
1160 }
1161
1167 {
1168 $this->quoteRequest = $quoteRequest;
1169
1170 return $this;
1171 }
1172
1178 {
1179 $this->stagedQuote = $stagedQuote;
1180
1181 return $this;
1182 }
1183
1189 {
1190 $this->customer = $customer;
1191
1192 return $this;
1193 }
1194
1200 {
1201 $this->customerGroup = $customerGroup;
1202
1203 return $this;
1204 }
1205
1211 {
1212 $this->store = $store;
1213
1214 return $this;
1215 }
1216
1221 public function withTotalPriceBuilder(?TypedMoneyBuilder $totalPrice)
1222 {
1223 $this->totalPrice = $totalPrice;
1224
1225 return $this;
1226 }
1227
1232 public function withTaxedPriceBuilder(?TaxedPriceBuilder $taxedPrice)
1233 {
1234 $this->taxedPrice = $taxedPrice;
1235
1236 return $this;
1237 }
1238
1243 public function withShippingAddressBuilder(?AddressBuilder $shippingAddress)
1244 {
1245 $this->shippingAddress = $shippingAddress;
1246
1247 return $this;
1248 }
1249
1254 public function withBillingAddressBuilder(?AddressBuilder $billingAddress)
1255 {
1256 $this->billingAddress = $billingAddress;
1257
1258 return $this;
1259 }
1260
1265 public function withShippingInfoBuilder(?ShippingInfoBuilder $shippingInfo)
1266 {
1267 $this->shippingInfo = $shippingInfo;
1268
1269 return $this;
1270 }
1271
1276 public function withPaymentInfoBuilder(?PaymentInfoBuilder $paymentInfo)
1277 {
1278 $this->paymentInfo = $paymentInfo;
1279
1280 return $this;
1281 }
1282
1287 public function withShippingRateInputBuilder(?ShippingRateInputBuilder $shippingRateInput)
1288 {
1289 $this->shippingRateInput = $shippingRateInput;
1290
1291 return $this;
1292 }
1293
1298 public function withCustomBuilder(?CustomFieldsBuilder $custom)
1299 {
1300 $this->custom = $custom;
1301
1302 return $this;
1303 }
1304
1310 {
1311 $this->state = $state;
1312
1313 return $this;
1314 }
1315
1321 {
1322 $this->businessUnit = $businessUnit;
1323
1324 return $this;
1325 }
1326
1327 public function build(): Quote
1328 {
1329 return new QuoteModel(
1330 $this->id,
1331 $this->version,
1332 $this->createdAt,
1333 $this->lastModifiedAt,
1334 $this->key,
1335 $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy,
1336 $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy,
1337 $this->quoteRequest instanceof QuoteRequestReferenceBuilder ? $this->quoteRequest->build() : $this->quoteRequest,
1338 $this->stagedQuote instanceof StagedQuoteReferenceBuilder ? $this->stagedQuote->build() : $this->stagedQuote,
1339 $this->customer instanceof CustomerReferenceBuilder ? $this->customer->build() : $this->customer,
1340 $this->customerGroup instanceof CustomerGroupReferenceBuilder ? $this->customerGroup->build() : $this->customerGroup,
1341 $this->validTo,
1342 $this->sellerComment,
1343 $this->buyerComment,
1344 $this->store instanceof StoreKeyReferenceBuilder ? $this->store->build() : $this->store,
1345 $this->lineItems,
1346 $this->customLineItems,
1347 $this->totalPrice instanceof TypedMoneyBuilder ? $this->totalPrice->build() : $this->totalPrice,
1348 $this->taxedPrice instanceof TaxedPriceBuilder ? $this->taxedPrice->build() : $this->taxedPrice,
1349 $this->shippingAddress instanceof AddressBuilder ? $this->shippingAddress->build() : $this->shippingAddress,
1350 $this->billingAddress instanceof AddressBuilder ? $this->billingAddress->build() : $this->billingAddress,
1351 $this->inventoryMode,
1352 $this->taxMode,
1353 $this->priceRoundingMode,
1354 $this->taxRoundingMode,
1355 $this->taxCalculationMode,
1356 $this->country,
1357 $this->shippingInfo instanceof ShippingInfoBuilder ? $this->shippingInfo->build() : $this->shippingInfo,
1358 $this->paymentInfo instanceof PaymentInfoBuilder ? $this->paymentInfo->build() : $this->paymentInfo,
1359 $this->shippingRateInput instanceof ShippingRateInputBuilder ? $this->shippingRateInput->build() : $this->shippingRateInput,
1360 $this->itemShippingAddresses,
1361 $this->directDiscounts,
1362 $this->directDiscountsIgnoreCartDiscounts,
1363 $this->custom instanceof CustomFieldsBuilder ? $this->custom->build() : $this->custom,
1364 $this->quoteState,
1365 $this->state instanceof StateReferenceBuilder ? $this->state->build() : $this->state,
1366 $this->purchaseOrderNumber,
1367 $this->businessUnit instanceof BusinessUnitKeyReferenceBuilder ? $this->businessUnit->build() : $this->businessUnit
1368 );
1369 }
1370
1371 public static function of(): QuoteBuilder
1372 {
1373 return new self();
1374 }
1375}
withShippingRateInput(?ShippingRateInput $shippingRateInput)
withItemShippingAddresses(?AddressCollection $itemShippingAddresses)
withCustomerBuilder(?CustomerReferenceBuilder $customer)
withBusinessUnitBuilder(?BusinessUnitKeyReferenceBuilder $businessUnit)
withCustomBuilder(?CustomFieldsBuilder $custom)
withValidTo(?DateTimeImmutable $validTo)
withTaxRoundingMode(?string $taxRoundingMode)
withCreatedByBuilder(?CreatedByBuilder $createdBy)
withCustomerGroup(?CustomerGroupReference $customerGroup)
withPaymentInfoBuilder(?PaymentInfoBuilder $paymentInfo)
withPurchaseOrderNumber(?string $purchaseOrderNumber)
withLineItems(?LineItemCollection $lineItems)
withBillingAddressBuilder(?AddressBuilder $billingAddress)
withBillingAddress(?Address $billingAddress)
withStagedQuoteBuilder(?StagedQuoteReferenceBuilder $stagedQuote)
withDirectDiscounts(?DirectDiscountCollection $directDiscounts)
withLastModifiedBy(?LastModifiedBy $lastModifiedBy)
withCustomer(?CustomerReference $customer)
withCustomLineItems(?CustomLineItemCollection $customLineItems)
withCreatedAt(?DateTimeImmutable $createdAt)
withShippingAddressBuilder(?AddressBuilder $shippingAddress)
withDirectDiscountsIgnoreCartDiscounts(?bool $directDiscountsIgnoreCartDiscounts)
withStoreBuilder(?StoreKeyReferenceBuilder $store)
withTaxedPriceBuilder(?TaxedPriceBuilder $taxedPrice)
withQuoteRequest(?QuoteRequestReference $quoteRequest)
withTotalPriceBuilder(?TypedMoneyBuilder $totalPrice)
withStagedQuote(?StagedQuoteReference $stagedQuote)
withBusinessUnit(?BusinessUnitKeyReference $businessUnit)
withTaxCalculationMode(?string $taxCalculationMode)
withQuoteRequestBuilder(?QuoteRequestReferenceBuilder $quoteRequest)
withLastModifiedByBuilder(?LastModifiedByBuilder $lastModifiedBy)
withShippingInfoBuilder(?ShippingInfoBuilder $shippingInfo)
withLastModifiedAt(?DateTimeImmutable $lastModifiedAt)
withPriceRoundingMode(?string $priceRoundingMode)
withShippingAddress(?Address $shippingAddress)
withShippingInfo(?ShippingInfo $shippingInfo)
withStateBuilder(?StateReferenceBuilder $state)
withShippingRateInputBuilder(?ShippingRateInputBuilder $shippingRateInput)
withCustomerGroupBuilder(?CustomerGroupReferenceBuilder $customerGroup)