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 $custom;
259
264 private $quoteState;
265
270 private $state;
271
276 private $purchaseOrderNumber;
277
282 private $businessUnit;
283
290 public function getId()
291 {
292 return $this->id;
293 }
294
301 public function getVersion()
302 {
303 return $this->version;
304 }
305
312 public function getCreatedAt()
313 {
314 return $this->createdAt;
315 }
316
323 public function getLastModifiedAt()
324 {
325 return $this->lastModifiedAt;
326 }
327
334 public function getKey()
335 {
336 return $this->key;
337 }
338
345 public function getLastModifiedBy()
346 {
347 return $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy;
348 }
349
356 public function getCreatedBy()
357 {
358 return $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy;
359 }
360
367 public function getQuoteRequest()
368 {
369 return $this->quoteRequest instanceof QuoteRequestReferenceBuilder ? $this->quoteRequest->build() : $this->quoteRequest;
370 }
371
378 public function getStagedQuote()
379 {
380 return $this->stagedQuote instanceof StagedQuoteReferenceBuilder ? $this->stagedQuote->build() : $this->stagedQuote;
381 }
382
389 public function getCustomer()
390 {
391 return $this->customer instanceof CustomerReferenceBuilder ? $this->customer->build() : $this->customer;
392 }
393
402 public function getCustomerGroup()
403 {
404 return $this->customerGroup instanceof CustomerGroupReferenceBuilder ? $this->customerGroup->build() : $this->customerGroup;
405 }
406
413 public function getValidTo()
414 {
415 return $this->validTo;
416 }
417
424 public function getSellerComment()
425 {
426 return $this->sellerComment;
427 }
428
435 public function getBuyerComment()
436 {
437 return $this->buyerComment;
438 }
439
446 public function getStore()
447 {
448 return $this->store instanceof StoreKeyReferenceBuilder ? $this->store->build() : $this->store;
449 }
450
457 public function getLineItems()
458 {
459 return $this->lineItems;
460 }
461
468 public function getCustomLineItems()
469 {
470 return $this->customLineItems;
471 }
472
480 public function getTotalPrice()
481 {
482 return $this->totalPrice instanceof TypedMoneyBuilder ? $this->totalPrice->build() : $this->totalPrice;
483 }
484
493 public function getTaxedPrice()
494 {
495 return $this->taxedPrice instanceof TaxedPriceBuilder ? $this->taxedPrice->build() : $this->taxedPrice;
496 }
497
505 public function getShippingAddress()
506 {
507 return $this->shippingAddress instanceof AddressBuilder ? $this->shippingAddress->build() : $this->shippingAddress;
508 }
509
516 public function getBillingAddress()
517 {
518 return $this->billingAddress instanceof AddressBuilder ? $this->billingAddress->build() : $this->billingAddress;
519 }
520
527 public function getInventoryMode()
528 {
529 return $this->inventoryMode;
530 }
531
538 public function getTaxMode()
539 {
540 return $this->taxMode;
541 }
542
549 public function getPriceRoundingMode()
550 {
551 return $this->priceRoundingMode;
552 }
553
560 public function getTaxRoundingMode()
561 {
562 return $this->taxRoundingMode;
563 }
564
571 public function getTaxCalculationMode()
572 {
573 return $this->taxCalculationMode;
574 }
575
582 public function getCountry()
583 {
584 return $this->country;
585 }
586
593 public function getShippingInfo()
594 {
595 return $this->shippingInfo instanceof ShippingInfoBuilder ? $this->shippingInfo->build() : $this->shippingInfo;
596 }
597
604 public function getPaymentInfo()
605 {
606 return $this->paymentInfo instanceof PaymentInfoBuilder ? $this->paymentInfo->build() : $this->paymentInfo;
607 }
608
615 public function getShippingRateInput()
616 {
617 return $this->shippingRateInput instanceof ShippingRateInputBuilder ? $this->shippingRateInput->build() : $this->shippingRateInput;
618 }
619
629 public function getItemShippingAddresses()
630 {
631 return $this->itemShippingAddresses;
632 }
633
640 public function getDirectDiscounts()
641 {
642 return $this->directDiscounts;
643 }
644
651 public function getCustom()
652 {
653 return $this->custom instanceof CustomFieldsBuilder ? $this->custom->build() : $this->custom;
654 }
655
662 public function getQuoteState()
663 {
664 return $this->quoteState;
665 }
666
674 public function getState()
675 {
676 return $this->state instanceof StateReferenceBuilder ? $this->state->build() : $this->state;
677 }
678
686 public function getPurchaseOrderNumber()
687 {
688 return $this->purchaseOrderNumber;
689 }
690
697 public function getBusinessUnit()
698 {
699 return $this->businessUnit instanceof BusinessUnitKeyReferenceBuilder ? $this->businessUnit->build() : $this->businessUnit;
700 }
701
706 public function withId(?string $id)
707 {
708 $this->id = $id;
709
710 return $this;
711 }
712
717 public function withVersion(?int $version)
718 {
719 $this->version = $version;
720
721 return $this;
722 }
723
728 public function withCreatedAt(?DateTimeImmutable $createdAt)
729 {
730 $this->createdAt = $createdAt;
731
732 return $this;
733 }
734
739 public function withLastModifiedAt(?DateTimeImmutable $lastModifiedAt)
740 {
741 $this->lastModifiedAt = $lastModifiedAt;
742
743 return $this;
744 }
745
750 public function withKey(?string $key)
751 {
752 $this->key = $key;
753
754 return $this;
755 }
756
761 public function withLastModifiedBy(?LastModifiedBy $lastModifiedBy)
762 {
763 $this->lastModifiedBy = $lastModifiedBy;
764
765 return $this;
766 }
767
772 public function withCreatedBy(?CreatedBy $createdBy)
773 {
774 $this->createdBy = $createdBy;
775
776 return $this;
777 }
778
783 public function withQuoteRequest(?QuoteRequestReference $quoteRequest)
784 {
785 $this->quoteRequest = $quoteRequest;
786
787 return $this;
788 }
789
794 public function withStagedQuote(?StagedQuoteReference $stagedQuote)
795 {
796 $this->stagedQuote = $stagedQuote;
797
798 return $this;
799 }
800
805 public function withCustomer(?CustomerReference $customer)
806 {
807 $this->customer = $customer;
808
809 return $this;
810 }
811
816 public function withCustomerGroup(?CustomerGroupReference $customerGroup)
817 {
818 $this->customerGroup = $customerGroup;
819
820 return $this;
821 }
822
827 public function withValidTo(?DateTimeImmutable $validTo)
828 {
829 $this->validTo = $validTo;
830
831 return $this;
832 }
833
838 public function withSellerComment(?string $sellerComment)
839 {
840 $this->sellerComment = $sellerComment;
841
842 return $this;
843 }
844
849 public function withBuyerComment(?string $buyerComment)
850 {
851 $this->buyerComment = $buyerComment;
852
853 return $this;
854 }
855
860 public function withStore(?StoreKeyReference $store)
861 {
862 $this->store = $store;
863
864 return $this;
865 }
866
871 public function withLineItems(?LineItemCollection $lineItems)
872 {
873 $this->lineItems = $lineItems;
874
875 return $this;
876 }
877
882 public function withCustomLineItems(?CustomLineItemCollection $customLineItems)
883 {
884 $this->customLineItems = $customLineItems;
885
886 return $this;
887 }
888
893 public function withTotalPrice(?TypedMoney $totalPrice)
894 {
895 $this->totalPrice = $totalPrice;
896
897 return $this;
898 }
899
904 public function withTaxedPrice(?TaxedPrice $taxedPrice)
905 {
906 $this->taxedPrice = $taxedPrice;
907
908 return $this;
909 }
910
915 public function withShippingAddress(?Address $shippingAddress)
916 {
917 $this->shippingAddress = $shippingAddress;
918
919 return $this;
920 }
921
926 public function withBillingAddress(?Address $billingAddress)
927 {
928 $this->billingAddress = $billingAddress;
929
930 return $this;
931 }
932
937 public function withInventoryMode(?string $inventoryMode)
938 {
939 $this->inventoryMode = $inventoryMode;
940
941 return $this;
942 }
943
948 public function withTaxMode(?string $taxMode)
949 {
950 $this->taxMode = $taxMode;
951
952 return $this;
953 }
954
959 public function withPriceRoundingMode(?string $priceRoundingMode)
960 {
961 $this->priceRoundingMode = $priceRoundingMode;
962
963 return $this;
964 }
965
970 public function withTaxRoundingMode(?string $taxRoundingMode)
971 {
972 $this->taxRoundingMode = $taxRoundingMode;
973
974 return $this;
975 }
976
981 public function withTaxCalculationMode(?string $taxCalculationMode)
982 {
983 $this->taxCalculationMode = $taxCalculationMode;
984
985 return $this;
986 }
987
992 public function withCountry(?string $country)
993 {
994 $this->country = $country;
995
996 return $this;
997 }
998
1003 public function withShippingInfo(?ShippingInfo $shippingInfo)
1004 {
1005 $this->shippingInfo = $shippingInfo;
1006
1007 return $this;
1008 }
1009
1014 public function withPaymentInfo(?PaymentInfo $paymentInfo)
1015 {
1016 $this->paymentInfo = $paymentInfo;
1017
1018 return $this;
1019 }
1020
1025 public function withShippingRateInput(?ShippingRateInput $shippingRateInput)
1026 {
1027 $this->shippingRateInput = $shippingRateInput;
1028
1029 return $this;
1030 }
1031
1036 public function withItemShippingAddresses(?AddressCollection $itemShippingAddresses)
1037 {
1038 $this->itemShippingAddresses = $itemShippingAddresses;
1039
1040 return $this;
1041 }
1042
1047 public function withDirectDiscounts(?DirectDiscountCollection $directDiscounts)
1048 {
1049 $this->directDiscounts = $directDiscounts;
1050
1051 return $this;
1052 }
1053
1058 public function withCustom(?CustomFields $custom)
1059 {
1060 $this->custom = $custom;
1061
1062 return $this;
1063 }
1064
1069 public function withQuoteState(?string $quoteState)
1070 {
1071 $this->quoteState = $quoteState;
1072
1073 return $this;
1074 }
1075
1080 public function withState(?StateReference $state)
1081 {
1082 $this->state = $state;
1083
1084 return $this;
1085 }
1086
1091 public function withPurchaseOrderNumber(?string $purchaseOrderNumber)
1092 {
1093 $this->purchaseOrderNumber = $purchaseOrderNumber;
1094
1095 return $this;
1096 }
1097
1102 public function withBusinessUnit(?BusinessUnitKeyReference $businessUnit)
1103 {
1104 $this->businessUnit = $businessUnit;
1105
1106 return $this;
1107 }
1108
1113 public function withLastModifiedByBuilder(?LastModifiedByBuilder $lastModifiedBy)
1114 {
1115 $this->lastModifiedBy = $lastModifiedBy;
1116
1117 return $this;
1118 }
1119
1124 public function withCreatedByBuilder(?CreatedByBuilder $createdBy)
1125 {
1126 $this->createdBy = $createdBy;
1127
1128 return $this;
1129 }
1130
1136 {
1137 $this->quoteRequest = $quoteRequest;
1138
1139 return $this;
1140 }
1141
1147 {
1148 $this->stagedQuote = $stagedQuote;
1149
1150 return $this;
1151 }
1152
1158 {
1159 $this->customer = $customer;
1160
1161 return $this;
1162 }
1163
1169 {
1170 $this->customerGroup = $customerGroup;
1171
1172 return $this;
1173 }
1174
1180 {
1181 $this->store = $store;
1182
1183 return $this;
1184 }
1185
1190 public function withTotalPriceBuilder(?TypedMoneyBuilder $totalPrice)
1191 {
1192 $this->totalPrice = $totalPrice;
1193
1194 return $this;
1195 }
1196
1201 public function withTaxedPriceBuilder(?TaxedPriceBuilder $taxedPrice)
1202 {
1203 $this->taxedPrice = $taxedPrice;
1204
1205 return $this;
1206 }
1207
1212 public function withShippingAddressBuilder(?AddressBuilder $shippingAddress)
1213 {
1214 $this->shippingAddress = $shippingAddress;
1215
1216 return $this;
1217 }
1218
1223 public function withBillingAddressBuilder(?AddressBuilder $billingAddress)
1224 {
1225 $this->billingAddress = $billingAddress;
1226
1227 return $this;
1228 }
1229
1234 public function withShippingInfoBuilder(?ShippingInfoBuilder $shippingInfo)
1235 {
1236 $this->shippingInfo = $shippingInfo;
1237
1238 return $this;
1239 }
1240
1245 public function withPaymentInfoBuilder(?PaymentInfoBuilder $paymentInfo)
1246 {
1247 $this->paymentInfo = $paymentInfo;
1248
1249 return $this;
1250 }
1251
1256 public function withShippingRateInputBuilder(?ShippingRateInputBuilder $shippingRateInput)
1257 {
1258 $this->shippingRateInput = $shippingRateInput;
1259
1260 return $this;
1261 }
1262
1267 public function withCustomBuilder(?CustomFieldsBuilder $custom)
1268 {
1269 $this->custom = $custom;
1270
1271 return $this;
1272 }
1273
1279 {
1280 $this->state = $state;
1281
1282 return $this;
1283 }
1284
1290 {
1291 $this->businessUnit = $businessUnit;
1292
1293 return $this;
1294 }
1295
1296 public function build(): Quote
1297 {
1298 return new QuoteModel(
1299 $this->id,
1300 $this->version,
1301 $this->createdAt,
1302 $this->lastModifiedAt,
1303 $this->key,
1304 $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy,
1305 $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy,
1306 $this->quoteRequest instanceof QuoteRequestReferenceBuilder ? $this->quoteRequest->build() : $this->quoteRequest,
1307 $this->stagedQuote instanceof StagedQuoteReferenceBuilder ? $this->stagedQuote->build() : $this->stagedQuote,
1308 $this->customer instanceof CustomerReferenceBuilder ? $this->customer->build() : $this->customer,
1309 $this->customerGroup instanceof CustomerGroupReferenceBuilder ? $this->customerGroup->build() : $this->customerGroup,
1310 $this->validTo,
1311 $this->sellerComment,
1312 $this->buyerComment,
1313 $this->store instanceof StoreKeyReferenceBuilder ? $this->store->build() : $this->store,
1314 $this->lineItems,
1315 $this->customLineItems,
1316 $this->totalPrice instanceof TypedMoneyBuilder ? $this->totalPrice->build() : $this->totalPrice,
1317 $this->taxedPrice instanceof TaxedPriceBuilder ? $this->taxedPrice->build() : $this->taxedPrice,
1318 $this->shippingAddress instanceof AddressBuilder ? $this->shippingAddress->build() : $this->shippingAddress,
1319 $this->billingAddress instanceof AddressBuilder ? $this->billingAddress->build() : $this->billingAddress,
1320 $this->inventoryMode,
1321 $this->taxMode,
1322 $this->priceRoundingMode,
1323 $this->taxRoundingMode,
1324 $this->taxCalculationMode,
1325 $this->country,
1326 $this->shippingInfo instanceof ShippingInfoBuilder ? $this->shippingInfo->build() : $this->shippingInfo,
1327 $this->paymentInfo instanceof PaymentInfoBuilder ? $this->paymentInfo->build() : $this->paymentInfo,
1328 $this->shippingRateInput instanceof ShippingRateInputBuilder ? $this->shippingRateInput->build() : $this->shippingRateInput,
1329 $this->itemShippingAddresses,
1330 $this->directDiscounts,
1331 $this->custom instanceof CustomFieldsBuilder ? $this->custom->build() : $this->custom,
1332 $this->quoteState,
1333 $this->state instanceof StateReferenceBuilder ? $this->state->build() : $this->state,
1334 $this->purchaseOrderNumber,
1335 $this->businessUnit instanceof BusinessUnitKeyReferenceBuilder ? $this->businessUnit->build() : $this->businessUnit
1336 );
1337 }
1338
1339 public static function of(): QuoteBuilder
1340 {
1341 return new self();
1342 }
1343}
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)
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)