commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
LineItemDraftBuilder.php
1<?php
2
3declare(strict_types=1);
10
24use DateTimeImmutable;
25use stdClass;
26
30final class LineItemDraftBuilder implements Builder
31{
36 private $key;
37
42 private $productId;
43
48 private $variantId;
49
54 private $sku;
55
60 private $quantity;
61
66 private $addedAt;
67
72 private $distributionChannel;
73
78 private $supplyChannel;
79
84 private $externalPrice;
85
90 private $externalTotalPrice;
91
96 private $externalTaxRate;
97
102 private $perMethodExternalTaxRate;
103
108 private $inventoryMode;
109
114 private $shippingDetails;
115
120 private $custom;
121
126 private $recurrenceInfo;
127
134 public function getKey()
135 {
136 return $this->key;
137 }
138
145 public function getProductId()
146 {
147 return $this->productId;
148 }
149
157 public function getVariantId()
158 {
159 return $this->variantId;
160 }
161
168 public function getSku()
169 {
170 return $this->sku;
171 }
172
179 public function getQuantity()
180 {
181 return $this->quantity;
182 }
183
192 public function getAddedAt()
193 {
194 return $this->addedAt;
195 }
196
206 public function getDistributionChannel()
207 {
208 return $this->distributionChannel instanceof ChannelResourceIdentifierBuilder ? $this->distributionChannel->build() : $this->distributionChannel;
209 }
210
218 public function getSupplyChannel()
219 {
220 return $this->supplyChannel instanceof ChannelResourceIdentifierBuilder ? $this->supplyChannel->build() : $this->supplyChannel;
221 }
222
230 public function getExternalPrice()
231 {
232 return $this->externalPrice instanceof MoneyBuilder ? $this->externalPrice->build() : $this->externalPrice;
233 }
234
241 public function getExternalTotalPrice()
242 {
243 return $this->externalTotalPrice instanceof ExternalLineItemTotalPriceBuilder ? $this->externalTotalPrice->build() : $this->externalTotalPrice;
244 }
245
252 public function getExternalTaxRate()
253 {
254 return $this->externalTaxRate instanceof ExternalTaxRateDraftBuilder ? $this->externalTaxRate->build() : $this->externalTaxRate;
255 }
256
264 {
265 return $this->perMethodExternalTaxRate;
266 }
267
275 public function getInventoryMode()
276 {
277 return $this->inventoryMode;
278 }
279
286 public function getShippingDetails()
287 {
288 return $this->shippingDetails instanceof ItemShippingDetailsDraftBuilder ? $this->shippingDetails->build() : $this->shippingDetails;
289 }
290
297 public function getCustom()
298 {
299 return $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom;
300 }
301
308 public function getRecurrenceInfo()
309 {
310 return $this->recurrenceInfo instanceof LineItemRecurrenceInfoDraftBuilder ? $this->recurrenceInfo->build() : $this->recurrenceInfo;
311 }
312
317 public function withKey(?string $key)
318 {
319 $this->key = $key;
320
321 return $this;
322 }
323
328 public function withProductId(?string $productId)
329 {
330 $this->productId = $productId;
331
332 return $this;
333 }
334
339 public function withVariantId(?int $variantId)
340 {
341 $this->variantId = $variantId;
342
343 return $this;
344 }
345
350 public function withSku(?string $sku)
351 {
352 $this->sku = $sku;
353
354 return $this;
355 }
356
361 public function withQuantity(?int $quantity)
362 {
363 $this->quantity = $quantity;
364
365 return $this;
366 }
367
372 public function withAddedAt(?DateTimeImmutable $addedAt)
373 {
374 $this->addedAt = $addedAt;
375
376 return $this;
377 }
378
383 public function withDistributionChannel(?ChannelResourceIdentifier $distributionChannel)
384 {
385 $this->distributionChannel = $distributionChannel;
386
387 return $this;
388 }
389
394 public function withSupplyChannel(?ChannelResourceIdentifier $supplyChannel)
395 {
396 $this->supplyChannel = $supplyChannel;
397
398 return $this;
399 }
400
405 public function withExternalPrice(?Money $externalPrice)
406 {
407 $this->externalPrice = $externalPrice;
408
409 return $this;
410 }
411
416 public function withExternalTotalPrice(?ExternalLineItemTotalPrice $externalTotalPrice)
417 {
418 $this->externalTotalPrice = $externalTotalPrice;
419
420 return $this;
421 }
422
427 public function withExternalTaxRate(?ExternalTaxRateDraft $externalTaxRate)
428 {
429 $this->externalTaxRate = $externalTaxRate;
430
431 return $this;
432 }
433
438 public function withPerMethodExternalTaxRate(?MethodExternalTaxRateDraftCollection $perMethodExternalTaxRate)
439 {
440 $this->perMethodExternalTaxRate = $perMethodExternalTaxRate;
441
442 return $this;
443 }
444
449 public function withInventoryMode(?string $inventoryMode)
450 {
451 $this->inventoryMode = $inventoryMode;
452
453 return $this;
454 }
455
460 public function withShippingDetails(?ItemShippingDetailsDraft $shippingDetails)
461 {
462 $this->shippingDetails = $shippingDetails;
463
464 return $this;
465 }
466
471 public function withCustom(?CustomFieldsDraft $custom)
472 {
473 $this->custom = $custom;
474
475 return $this;
476 }
477
482 public function withRecurrenceInfo(?LineItemRecurrenceInfoDraft $recurrenceInfo)
483 {
484 $this->recurrenceInfo = $recurrenceInfo;
485
486 return $this;
487 }
488
494 {
495 $this->distributionChannel = $distributionChannel;
496
497 return $this;
498 }
499
505 {
506 $this->supplyChannel = $supplyChannel;
507
508 return $this;
509 }
510
515 public function withExternalPriceBuilder(?MoneyBuilder $externalPrice)
516 {
517 $this->externalPrice = $externalPrice;
518
519 return $this;
520 }
521
527 {
528 $this->externalTotalPrice = $externalTotalPrice;
529
530 return $this;
531 }
532
538 {
539 $this->externalTaxRate = $externalTaxRate;
540
541 return $this;
542 }
543
549 {
550 $this->shippingDetails = $shippingDetails;
551
552 return $this;
553 }
554
560 {
561 $this->custom = $custom;
562
563 return $this;
564 }
565
571 {
572 $this->recurrenceInfo = $recurrenceInfo;
573
574 return $this;
575 }
576
577 public function build(): LineItemDraft
578 {
579 return new LineItemDraftModel(
580 $this->key,
581 $this->productId,
582 $this->variantId,
583 $this->sku,
584 $this->quantity,
585 $this->addedAt,
586 $this->distributionChannel instanceof ChannelResourceIdentifierBuilder ? $this->distributionChannel->build() : $this->distributionChannel,
587 $this->supplyChannel instanceof ChannelResourceIdentifierBuilder ? $this->supplyChannel->build() : $this->supplyChannel,
588 $this->externalPrice instanceof MoneyBuilder ? $this->externalPrice->build() : $this->externalPrice,
589 $this->externalTotalPrice instanceof ExternalLineItemTotalPriceBuilder ? $this->externalTotalPrice->build() : $this->externalTotalPrice,
590 $this->externalTaxRate instanceof ExternalTaxRateDraftBuilder ? $this->externalTaxRate->build() : $this->externalTaxRate,
591 $this->perMethodExternalTaxRate,
592 $this->inventoryMode,
593 $this->shippingDetails instanceof ItemShippingDetailsDraftBuilder ? $this->shippingDetails->build() : $this->shippingDetails,
594 $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom,
595 $this->recurrenceInfo instanceof LineItemRecurrenceInfoDraftBuilder ? $this->recurrenceInfo->build() : $this->recurrenceInfo
596 );
597 }
598
599 public static function of(): LineItemDraftBuilder
600 {
601 return new self();
602 }
603}
withShippingDetails(?ItemShippingDetailsDraft $shippingDetails)
withExternalTotalPriceBuilder(?ExternalLineItemTotalPriceBuilder $externalTotalPrice)
withDistributionChannelBuilder(?ChannelResourceIdentifierBuilder $distributionChannel)
withExternalTaxRate(?ExternalTaxRateDraft $externalTaxRate)
withSupplyChannelBuilder(?ChannelResourceIdentifierBuilder $supplyChannel)
withShippingDetailsBuilder(?ItemShippingDetailsDraftBuilder $shippingDetails)
withExternalTaxRateBuilder(?ExternalTaxRateDraftBuilder $externalTaxRate)
withSupplyChannel(?ChannelResourceIdentifier $supplyChannel)
withDistributionChannel(?ChannelResourceIdentifier $distributionChannel)
withPerMethodExternalTaxRate(?MethodExternalTaxRateDraftCollection $perMethodExternalTaxRate)
withRecurrenceInfoBuilder(?LineItemRecurrenceInfoDraftBuilder $recurrenceInfo)
withRecurrenceInfo(?LineItemRecurrenceInfoDraft $recurrenceInfo)
withExternalTotalPrice(?ExternalLineItemTotalPrice $externalTotalPrice)