commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
QuoteBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
54 use DateTimeImmutable;
55 use stdClass;
56 
60 final 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 $taxRoundingMode;
205 
210  private $taxCalculationMode;
211 
216  private $country;
217 
222  private $shippingInfo;
223 
228  private $paymentInfo;
229 
234  private $shippingRateInput;
235 
240  private $itemShippingAddresses;
241 
246  private $directDiscounts;
247 
252  private $custom;
253 
258  private $quoteState;
259 
264  private $state;
265 
270  private $purchaseOrderNumber;
271 
276  private $businessUnit;
277 
284  public function getId()
285  {
286  return $this->id;
287  }
288 
295  public function getVersion()
296  {
297  return $this->version;
298  }
299 
306  public function getCreatedAt()
307  {
308  return $this->createdAt;
309  }
310 
317  public function getLastModifiedAt()
318  {
319  return $this->lastModifiedAt;
320  }
321 
328  public function getKey()
329  {
330  return $this->key;
331  }
332 
339  public function getLastModifiedBy()
340  {
341  return $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy;
342  }
343 
350  public function getCreatedBy()
351  {
352  return $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy;
353  }
354 
361  public function getQuoteRequest()
362  {
363  return $this->quoteRequest instanceof QuoteRequestReferenceBuilder ? $this->quoteRequest->build() : $this->quoteRequest;
364  }
365 
372  public function getStagedQuote()
373  {
374  return $this->stagedQuote instanceof StagedQuoteReferenceBuilder ? $this->stagedQuote->build() : $this->stagedQuote;
375  }
376 
383  public function getCustomer()
384  {
385  return $this->customer instanceof CustomerReferenceBuilder ? $this->customer->build() : $this->customer;
386  }
387 
396  public function getCustomerGroup()
397  {
398  return $this->customerGroup instanceof CustomerGroupReferenceBuilder ? $this->customerGroup->build() : $this->customerGroup;
399  }
400 
407  public function getValidTo()
408  {
409  return $this->validTo;
410  }
411 
418  public function getSellerComment()
419  {
420  return $this->sellerComment;
421  }
422 
429  public function getBuyerComment()
430  {
431  return $this->buyerComment;
432  }
433 
440  public function getStore()
441  {
442  return $this->store instanceof StoreKeyReferenceBuilder ? $this->store->build() : $this->store;
443  }
444 
451  public function getLineItems()
452  {
453  return $this->lineItems;
454  }
455 
462  public function getCustomLineItems()
463  {
464  return $this->customLineItems;
465  }
466 
474  public function getTotalPrice()
475  {
476  return $this->totalPrice instanceof TypedMoneyBuilder ? $this->totalPrice->build() : $this->totalPrice;
477  }
478 
487  public function getTaxedPrice()
488  {
489  return $this->taxedPrice instanceof TaxedPriceBuilder ? $this->taxedPrice->build() : $this->taxedPrice;
490  }
491 
499  public function getShippingAddress()
500  {
501  return $this->shippingAddress instanceof AddressBuilder ? $this->shippingAddress->build() : $this->shippingAddress;
502  }
503 
510  public function getBillingAddress()
511  {
512  return $this->billingAddress instanceof AddressBuilder ? $this->billingAddress->build() : $this->billingAddress;
513  }
514 
521  public function getInventoryMode()
522  {
523  return $this->inventoryMode;
524  }
525 
532  public function getTaxMode()
533  {
534  return $this->taxMode;
535  }
536 
543  public function getTaxRoundingMode()
544  {
545  return $this->taxRoundingMode;
546  }
547 
554  public function getTaxCalculationMode()
555  {
556  return $this->taxCalculationMode;
557  }
558 
565  public function getCountry()
566  {
567  return $this->country;
568  }
569 
576  public function getShippingInfo()
577  {
578  return $this->shippingInfo instanceof ShippingInfoBuilder ? $this->shippingInfo->build() : $this->shippingInfo;
579  }
580 
587  public function getPaymentInfo()
588  {
589  return $this->paymentInfo instanceof PaymentInfoBuilder ? $this->paymentInfo->build() : $this->paymentInfo;
590  }
591 
598  public function getShippingRateInput()
599  {
600  return $this->shippingRateInput instanceof ShippingRateInputBuilder ? $this->shippingRateInput->build() : $this->shippingRateInput;
601  }
602 
612  public function getItemShippingAddresses()
613  {
614  return $this->itemShippingAddresses;
615  }
616 
623  public function getDirectDiscounts()
624  {
625  return $this->directDiscounts;
626  }
627 
634  public function getCustom()
635  {
636  return $this->custom instanceof CustomFieldsBuilder ? $this->custom->build() : $this->custom;
637  }
638 
645  public function getQuoteState()
646  {
647  return $this->quoteState;
648  }
649 
657  public function getState()
658  {
659  return $this->state instanceof StateReferenceBuilder ? $this->state->build() : $this->state;
660  }
661 
669  public function getPurchaseOrderNumber()
670  {
671  return $this->purchaseOrderNumber;
672  }
673 
680  public function getBusinessUnit()
681  {
682  return $this->businessUnit instanceof BusinessUnitKeyReferenceBuilder ? $this->businessUnit->build() : $this->businessUnit;
683  }
684 
689  public function withId(?string $id)
690  {
691  $this->id = $id;
692 
693  return $this;
694  }
695 
700  public function withVersion(?int $version)
701  {
702  $this->version = $version;
703 
704  return $this;
705  }
706 
711  public function withCreatedAt(?DateTimeImmutable $createdAt)
712  {
713  $this->createdAt = $createdAt;
714 
715  return $this;
716  }
717 
722  public function withLastModifiedAt(?DateTimeImmutable $lastModifiedAt)
723  {
724  $this->lastModifiedAt = $lastModifiedAt;
725 
726  return $this;
727  }
728 
733  public function withKey(?string $key)
734  {
735  $this->key = $key;
736 
737  return $this;
738  }
739 
744  public function withLastModifiedBy(?LastModifiedBy $lastModifiedBy)
745  {
746  $this->lastModifiedBy = $lastModifiedBy;
747 
748  return $this;
749  }
750 
755  public function withCreatedBy(?CreatedBy $createdBy)
756  {
757  $this->createdBy = $createdBy;
758 
759  return $this;
760  }
761 
766  public function withQuoteRequest(?QuoteRequestReference $quoteRequest)
767  {
768  $this->quoteRequest = $quoteRequest;
769 
770  return $this;
771  }
772 
777  public function withStagedQuote(?StagedQuoteReference $stagedQuote)
778  {
779  $this->stagedQuote = $stagedQuote;
780 
781  return $this;
782  }
783 
788  public function withCustomer(?CustomerReference $customer)
789  {
790  $this->customer = $customer;
791 
792  return $this;
793  }
794 
799  public function withCustomerGroup(?CustomerGroupReference $customerGroup)
800  {
801  $this->customerGroup = $customerGroup;
802 
803  return $this;
804  }
805 
810  public function withValidTo(?DateTimeImmutable $validTo)
811  {
812  $this->validTo = $validTo;
813 
814  return $this;
815  }
816 
821  public function withSellerComment(?string $sellerComment)
822  {
823  $this->sellerComment = $sellerComment;
824 
825  return $this;
826  }
827 
832  public function withBuyerComment(?string $buyerComment)
833  {
834  $this->buyerComment = $buyerComment;
835 
836  return $this;
837  }
838 
843  public function withStore(?StoreKeyReference $store)
844  {
845  $this->store = $store;
846 
847  return $this;
848  }
849 
854  public function withLineItems(?LineItemCollection $lineItems)
855  {
856  $this->lineItems = $lineItems;
857 
858  return $this;
859  }
860 
865  public function withCustomLineItems(?CustomLineItemCollection $customLineItems)
866  {
867  $this->customLineItems = $customLineItems;
868 
869  return $this;
870  }
871 
876  public function withTotalPrice(?TypedMoney $totalPrice)
877  {
878  $this->totalPrice = $totalPrice;
879 
880  return $this;
881  }
882 
887  public function withTaxedPrice(?TaxedPrice $taxedPrice)
888  {
889  $this->taxedPrice = $taxedPrice;
890 
891  return $this;
892  }
893 
898  public function withShippingAddress(?Address $shippingAddress)
899  {
900  $this->shippingAddress = $shippingAddress;
901 
902  return $this;
903  }
904 
909  public function withBillingAddress(?Address $billingAddress)
910  {
911  $this->billingAddress = $billingAddress;
912 
913  return $this;
914  }
915 
920  public function withInventoryMode(?string $inventoryMode)
921  {
922  $this->inventoryMode = $inventoryMode;
923 
924  return $this;
925  }
926 
931  public function withTaxMode(?string $taxMode)
932  {
933  $this->taxMode = $taxMode;
934 
935  return $this;
936  }
937 
942  public function withTaxRoundingMode(?string $taxRoundingMode)
943  {
944  $this->taxRoundingMode = $taxRoundingMode;
945 
946  return $this;
947  }
948 
953  public function withTaxCalculationMode(?string $taxCalculationMode)
954  {
955  $this->taxCalculationMode = $taxCalculationMode;
956 
957  return $this;
958  }
959 
964  public function withCountry(?string $country)
965  {
966  $this->country = $country;
967 
968  return $this;
969  }
970 
975  public function withShippingInfo(?ShippingInfo $shippingInfo)
976  {
977  $this->shippingInfo = $shippingInfo;
978 
979  return $this;
980  }
981 
986  public function withPaymentInfo(?PaymentInfo $paymentInfo)
987  {
988  $this->paymentInfo = $paymentInfo;
989 
990  return $this;
991  }
992 
997  public function withShippingRateInput(?ShippingRateInput $shippingRateInput)
998  {
999  $this->shippingRateInput = $shippingRateInput;
1000 
1001  return $this;
1002  }
1003 
1008  public function withItemShippingAddresses(?AddressCollection $itemShippingAddresses)
1009  {
1010  $this->itemShippingAddresses = $itemShippingAddresses;
1011 
1012  return $this;
1013  }
1014 
1019  public function withDirectDiscounts(?DirectDiscountCollection $directDiscounts)
1020  {
1021  $this->directDiscounts = $directDiscounts;
1022 
1023  return $this;
1024  }
1025 
1030  public function withCustom(?CustomFields $custom)
1031  {
1032  $this->custom = $custom;
1033 
1034  return $this;
1035  }
1036 
1041  public function withQuoteState(?string $quoteState)
1042  {
1043  $this->quoteState = $quoteState;
1044 
1045  return $this;
1046  }
1047 
1052  public function withState(?StateReference $state)
1053  {
1054  $this->state = $state;
1055 
1056  return $this;
1057  }
1058 
1063  public function withPurchaseOrderNumber(?string $purchaseOrderNumber)
1064  {
1065  $this->purchaseOrderNumber = $purchaseOrderNumber;
1066 
1067  return $this;
1068  }
1069 
1074  public function withBusinessUnit(?BusinessUnitKeyReference $businessUnit)
1075  {
1076  $this->businessUnit = $businessUnit;
1077 
1078  return $this;
1079  }
1080 
1085  public function withLastModifiedByBuilder(?LastModifiedByBuilder $lastModifiedBy)
1086  {
1087  $this->lastModifiedBy = $lastModifiedBy;
1088 
1089  return $this;
1090  }
1091 
1096  public function withCreatedByBuilder(?CreatedByBuilder $createdBy)
1097  {
1098  $this->createdBy = $createdBy;
1099 
1100  return $this;
1101  }
1102 
1108  {
1109  $this->quoteRequest = $quoteRequest;
1110 
1111  return $this;
1112  }
1113 
1119  {
1120  $this->stagedQuote = $stagedQuote;
1121 
1122  return $this;
1123  }
1124 
1129  public function withCustomerBuilder(?CustomerReferenceBuilder $customer)
1130  {
1131  $this->customer = $customer;
1132 
1133  return $this;
1134  }
1135 
1141  {
1142  $this->customerGroup = $customerGroup;
1143 
1144  return $this;
1145  }
1146 
1152  {
1153  $this->store = $store;
1154 
1155  return $this;
1156  }
1157 
1162  public function withTotalPriceBuilder(?TypedMoneyBuilder $totalPrice)
1163  {
1164  $this->totalPrice = $totalPrice;
1165 
1166  return $this;
1167  }
1168 
1173  public function withTaxedPriceBuilder(?TaxedPriceBuilder $taxedPrice)
1174  {
1175  $this->taxedPrice = $taxedPrice;
1176 
1177  return $this;
1178  }
1179 
1184  public function withShippingAddressBuilder(?AddressBuilder $shippingAddress)
1185  {
1186  $this->shippingAddress = $shippingAddress;
1187 
1188  return $this;
1189  }
1190 
1195  public function withBillingAddressBuilder(?AddressBuilder $billingAddress)
1196  {
1197  $this->billingAddress = $billingAddress;
1198 
1199  return $this;
1200  }
1201 
1206  public function withShippingInfoBuilder(?ShippingInfoBuilder $shippingInfo)
1207  {
1208  $this->shippingInfo = $shippingInfo;
1209 
1210  return $this;
1211  }
1212 
1217  public function withPaymentInfoBuilder(?PaymentInfoBuilder $paymentInfo)
1218  {
1219  $this->paymentInfo = $paymentInfo;
1220 
1221  return $this;
1222  }
1223 
1228  public function withShippingRateInputBuilder(?ShippingRateInputBuilder $shippingRateInput)
1229  {
1230  $this->shippingRateInput = $shippingRateInput;
1231 
1232  return $this;
1233  }
1234 
1239  public function withCustomBuilder(?CustomFieldsBuilder $custom)
1240  {
1241  $this->custom = $custom;
1242 
1243  return $this;
1244  }
1245 
1250  public function withStateBuilder(?StateReferenceBuilder $state)
1251  {
1252  $this->state = $state;
1253 
1254  return $this;
1255  }
1256 
1262  {
1263  $this->businessUnit = $businessUnit;
1264 
1265  return $this;
1266  }
1267 
1268  public function build(): Quote
1269  {
1270  return new QuoteModel(
1271  $this->id,
1272  $this->version,
1273  $this->createdAt,
1274  $this->lastModifiedAt,
1275  $this->key,
1276  $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy,
1277  $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy,
1278  $this->quoteRequest instanceof QuoteRequestReferenceBuilder ? $this->quoteRequest->build() : $this->quoteRequest,
1279  $this->stagedQuote instanceof StagedQuoteReferenceBuilder ? $this->stagedQuote->build() : $this->stagedQuote,
1280  $this->customer instanceof CustomerReferenceBuilder ? $this->customer->build() : $this->customer,
1281  $this->customerGroup instanceof CustomerGroupReferenceBuilder ? $this->customerGroup->build() : $this->customerGroup,
1282  $this->validTo,
1283  $this->sellerComment,
1284  $this->buyerComment,
1285  $this->store instanceof StoreKeyReferenceBuilder ? $this->store->build() : $this->store,
1286  $this->lineItems,
1287  $this->customLineItems,
1288  $this->totalPrice instanceof TypedMoneyBuilder ? $this->totalPrice->build() : $this->totalPrice,
1289  $this->taxedPrice instanceof TaxedPriceBuilder ? $this->taxedPrice->build() : $this->taxedPrice,
1290  $this->shippingAddress instanceof AddressBuilder ? $this->shippingAddress->build() : $this->shippingAddress,
1291  $this->billingAddress instanceof AddressBuilder ? $this->billingAddress->build() : $this->billingAddress,
1292  $this->inventoryMode,
1293  $this->taxMode,
1294  $this->taxRoundingMode,
1295  $this->taxCalculationMode,
1296  $this->country,
1297  $this->shippingInfo instanceof ShippingInfoBuilder ? $this->shippingInfo->build() : $this->shippingInfo,
1298  $this->paymentInfo instanceof PaymentInfoBuilder ? $this->paymentInfo->build() : $this->paymentInfo,
1299  $this->shippingRateInput instanceof ShippingRateInputBuilder ? $this->shippingRateInput->build() : $this->shippingRateInput,
1300  $this->itemShippingAddresses,
1301  $this->directDiscounts,
1302  $this->custom instanceof CustomFieldsBuilder ? $this->custom->build() : $this->custom,
1303  $this->quoteState,
1304  $this->state instanceof StateReferenceBuilder ? $this->state->build() : $this->state,
1305  $this->purchaseOrderNumber,
1306  $this->businessUnit instanceof BusinessUnitKeyReferenceBuilder ? $this->businessUnit->build() : $this->businessUnit
1307  );
1308  }
1309 
1310  public static function of(): QuoteBuilder
1311  {
1312  return new self();
1313  }
1314 }
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)
withPaymentInfo(?PaymentInfo $paymentInfo)
withBusinessUnit(?BusinessUnitKeyReference $businessUnit)
withTaxCalculationMode(?string $taxCalculationMode)
withQuoteRequestBuilder(?QuoteRequestReferenceBuilder $quoteRequest)
withLastModifiedByBuilder(?LastModifiedByBuilder $lastModifiedBy)
withShippingInfoBuilder(?ShippingInfoBuilder $shippingInfo)
withLastModifiedAt(?DateTimeImmutable $lastModifiedAt)
withShippingAddress(?Address $shippingAddress)
withShippingInfo(?ShippingInfo $shippingInfo)
withStateBuilder(?StateReferenceBuilder $state)
withShippingRateInputBuilder(?ShippingRateInputBuilder $shippingRateInput)
withCustomerGroupBuilder(?CustomerGroupReferenceBuilder $customerGroup)