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
22use DateTimeImmutable;
23use stdClass;
24
28final class LineItemDraftBuilder implements Builder
29{
34 private $key;
35
40 private $productId;
41
46 private $variantId;
47
52 private $sku;
53
58 private $quantity;
59
64 private $addedAt;
65
70 private $distributionChannel;
71
76 private $supplyChannel;
77
82 private $externalPrice;
83
88 private $externalTotalPrice;
89
94 private $externalTaxRate;
95
100 private $perMethodExternalTaxRate;
101
106 private $inventoryMode;
107
112 private $shippingDetails;
113
118 private $custom;
119
126 public function getKey()
127 {
128 return $this->key;
129 }
130
137 public function getProductId()
138 {
139 return $this->productId;
140 }
141
149 public function getVariantId()
150 {
151 return $this->variantId;
152 }
153
160 public function getSku()
161 {
162 return $this->sku;
163 }
164
171 public function getQuantity()
172 {
173 return $this->quantity;
174 }
175
184 public function getAddedAt()
185 {
186 return $this->addedAt;
187 }
188
198 public function getDistributionChannel()
199 {
200 return $this->distributionChannel instanceof ChannelResourceIdentifierBuilder ? $this->distributionChannel->build() : $this->distributionChannel;
201 }
202
210 public function getSupplyChannel()
211 {
212 return $this->supplyChannel instanceof ChannelResourceIdentifierBuilder ? $this->supplyChannel->build() : $this->supplyChannel;
213 }
214
221 public function getExternalPrice()
222 {
223 return $this->externalPrice instanceof MoneyBuilder ? $this->externalPrice->build() : $this->externalPrice;
224 }
225
232 public function getExternalTotalPrice()
233 {
234 return $this->externalTotalPrice instanceof ExternalLineItemTotalPriceBuilder ? $this->externalTotalPrice->build() : $this->externalTotalPrice;
235 }
236
243 public function getExternalTaxRate()
244 {
245 return $this->externalTaxRate instanceof ExternalTaxRateDraftBuilder ? $this->externalTaxRate->build() : $this->externalTaxRate;
246 }
247
255 {
256 return $this->perMethodExternalTaxRate;
257 }
258
266 public function getInventoryMode()
267 {
268 return $this->inventoryMode;
269 }
270
277 public function getShippingDetails()
278 {
279 return $this->shippingDetails instanceof ItemShippingDetailsDraftBuilder ? $this->shippingDetails->build() : $this->shippingDetails;
280 }
281
288 public function getCustom()
289 {
290 return $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom;
291 }
292
297 public function withKey(?string $key)
298 {
299 $this->key = $key;
300
301 return $this;
302 }
303
308 public function withProductId(?string $productId)
309 {
310 $this->productId = $productId;
311
312 return $this;
313 }
314
319 public function withVariantId(?int $variantId)
320 {
321 $this->variantId = $variantId;
322
323 return $this;
324 }
325
330 public function withSku(?string $sku)
331 {
332 $this->sku = $sku;
333
334 return $this;
335 }
336
341 public function withQuantity(?int $quantity)
342 {
343 $this->quantity = $quantity;
344
345 return $this;
346 }
347
352 public function withAddedAt(?DateTimeImmutable $addedAt)
353 {
354 $this->addedAt = $addedAt;
355
356 return $this;
357 }
358
363 public function withDistributionChannel(?ChannelResourceIdentifier $distributionChannel)
364 {
365 $this->distributionChannel = $distributionChannel;
366
367 return $this;
368 }
369
374 public function withSupplyChannel(?ChannelResourceIdentifier $supplyChannel)
375 {
376 $this->supplyChannel = $supplyChannel;
377
378 return $this;
379 }
380
385 public function withExternalPrice(?Money $externalPrice)
386 {
387 $this->externalPrice = $externalPrice;
388
389 return $this;
390 }
391
396 public function withExternalTotalPrice(?ExternalLineItemTotalPrice $externalTotalPrice)
397 {
398 $this->externalTotalPrice = $externalTotalPrice;
399
400 return $this;
401 }
402
407 public function withExternalTaxRate(?ExternalTaxRateDraft $externalTaxRate)
408 {
409 $this->externalTaxRate = $externalTaxRate;
410
411 return $this;
412 }
413
418 public function withPerMethodExternalTaxRate(?MethodExternalTaxRateDraftCollection $perMethodExternalTaxRate)
419 {
420 $this->perMethodExternalTaxRate = $perMethodExternalTaxRate;
421
422 return $this;
423 }
424
429 public function withInventoryMode(?string $inventoryMode)
430 {
431 $this->inventoryMode = $inventoryMode;
432
433 return $this;
434 }
435
440 public function withShippingDetails(?ItemShippingDetailsDraft $shippingDetails)
441 {
442 $this->shippingDetails = $shippingDetails;
443
444 return $this;
445 }
446
451 public function withCustom(?CustomFieldsDraft $custom)
452 {
453 $this->custom = $custom;
454
455 return $this;
456 }
457
463 {
464 $this->distributionChannel = $distributionChannel;
465
466 return $this;
467 }
468
474 {
475 $this->supplyChannel = $supplyChannel;
476
477 return $this;
478 }
479
484 public function withExternalPriceBuilder(?MoneyBuilder $externalPrice)
485 {
486 $this->externalPrice = $externalPrice;
487
488 return $this;
489 }
490
496 {
497 $this->externalTotalPrice = $externalTotalPrice;
498
499 return $this;
500 }
501
507 {
508 $this->externalTaxRate = $externalTaxRate;
509
510 return $this;
511 }
512
518 {
519 $this->shippingDetails = $shippingDetails;
520
521 return $this;
522 }
523
529 {
530 $this->custom = $custom;
531
532 return $this;
533 }
534
535 public function build(): LineItemDraft
536 {
537 return new LineItemDraftModel(
538 $this->key,
539 $this->productId,
540 $this->variantId,
541 $this->sku,
542 $this->quantity,
543 $this->addedAt,
544 $this->distributionChannel instanceof ChannelResourceIdentifierBuilder ? $this->distributionChannel->build() : $this->distributionChannel,
545 $this->supplyChannel instanceof ChannelResourceIdentifierBuilder ? $this->supplyChannel->build() : $this->supplyChannel,
546 $this->externalPrice instanceof MoneyBuilder ? $this->externalPrice->build() : $this->externalPrice,
547 $this->externalTotalPrice instanceof ExternalLineItemTotalPriceBuilder ? $this->externalTotalPrice->build() : $this->externalTotalPrice,
548 $this->externalTaxRate instanceof ExternalTaxRateDraftBuilder ? $this->externalTaxRate->build() : $this->externalTaxRate,
549 $this->perMethodExternalTaxRate,
550 $this->inventoryMode,
551 $this->shippingDetails instanceof ItemShippingDetailsDraftBuilder ? $this->shippingDetails->build() : $this->shippingDetails,
552 $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom
553 );
554 }
555
556 public static function of(): LineItemDraftBuilder
557 {
558 return new self();
559 }
560}
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)
withExternalTotalPrice(?ExternalLineItemTotalPrice $externalTotalPrice)