commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
CartAddLineItemActionBuilder.php
1<?php
2
3declare(strict_types=1);
10
24use DateTimeImmutable;
25use stdClass;
26
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 $recurrenceInfo;
121
126 private $custom;
127
134 public function getKey()
135 {
136 return $this->key;
137 }
138
146 public function getProductId()
147 {
148 return $this->productId;
149 }
150
159 public function getVariantId()
160 {
161 return $this->variantId;
162 }
163
171 public function getSku()
172 {
173 return $this->sku;
174 }
175
182 public function getQuantity()
183 {
184 return $this->quantity;
185 }
186
195 public function getAddedAt()
196 {
197 return $this->addedAt;
198 }
199
208 public function getDistributionChannel()
209 {
210 return $this->distributionChannel instanceof ChannelResourceIdentifierBuilder ? $this->distributionChannel->build() : $this->distributionChannel;
211 }
212
220 public function getSupplyChannel()
221 {
222 return $this->supplyChannel instanceof ChannelResourceIdentifierBuilder ? $this->supplyChannel->build() : $this->supplyChannel;
223 }
224
232 public function getExternalPrice()
233 {
234 return $this->externalPrice instanceof MoneyBuilder ? $this->externalPrice->build() : $this->externalPrice;
235 }
236
243 public function getExternalTotalPrice()
244 {
245 return $this->externalTotalPrice instanceof ExternalLineItemTotalPriceBuilder ? $this->externalTotalPrice->build() : $this->externalTotalPrice;
246 }
247
254 public function getExternalTaxRate()
255 {
256 return $this->externalTaxRate instanceof ExternalTaxRateDraftBuilder ? $this->externalTaxRate->build() : $this->externalTaxRate;
257 }
258
266 {
267 return $this->perMethodExternalTaxRate;
268 }
269
277 public function getInventoryMode()
278 {
279 return $this->inventoryMode;
280 }
281
288 public function getShippingDetails()
289 {
290 return $this->shippingDetails instanceof ItemShippingDetailsDraftBuilder ? $this->shippingDetails->build() : $this->shippingDetails;
291 }
292
299 public function getRecurrenceInfo()
300 {
301 return $this->recurrenceInfo instanceof LineItemRecurrenceInfoDraftBuilder ? $this->recurrenceInfo->build() : $this->recurrenceInfo;
302 }
303
310 public function getCustom()
311 {
312 return $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom;
313 }
314
319 public function withKey(?string $key)
320 {
321 $this->key = $key;
322
323 return $this;
324 }
325
330 public function withProductId(?string $productId)
331 {
332 $this->productId = $productId;
333
334 return $this;
335 }
336
341 public function withVariantId(?int $variantId)
342 {
343 $this->variantId = $variantId;
344
345 return $this;
346 }
347
352 public function withSku(?string $sku)
353 {
354 $this->sku = $sku;
355
356 return $this;
357 }
358
363 public function withQuantity(?int $quantity)
364 {
365 $this->quantity = $quantity;
366
367 return $this;
368 }
369
374 public function withAddedAt(?DateTimeImmutable $addedAt)
375 {
376 $this->addedAt = $addedAt;
377
378 return $this;
379 }
380
385 public function withDistributionChannel(?ChannelResourceIdentifier $distributionChannel)
386 {
387 $this->distributionChannel = $distributionChannel;
388
389 return $this;
390 }
391
396 public function withSupplyChannel(?ChannelResourceIdentifier $supplyChannel)
397 {
398 $this->supplyChannel = $supplyChannel;
399
400 return $this;
401 }
402
407 public function withExternalPrice(?Money $externalPrice)
408 {
409 $this->externalPrice = $externalPrice;
410
411 return $this;
412 }
413
418 public function withExternalTotalPrice(?ExternalLineItemTotalPrice $externalTotalPrice)
419 {
420 $this->externalTotalPrice = $externalTotalPrice;
421
422 return $this;
423 }
424
429 public function withExternalTaxRate(?ExternalTaxRateDraft $externalTaxRate)
430 {
431 $this->externalTaxRate = $externalTaxRate;
432
433 return $this;
434 }
435
440 public function withPerMethodExternalTaxRate(?MethodExternalTaxRateDraftCollection $perMethodExternalTaxRate)
441 {
442 $this->perMethodExternalTaxRate = $perMethodExternalTaxRate;
443
444 return $this;
445 }
446
451 public function withInventoryMode(?string $inventoryMode)
452 {
453 $this->inventoryMode = $inventoryMode;
454
455 return $this;
456 }
457
462 public function withShippingDetails(?ItemShippingDetailsDraft $shippingDetails)
463 {
464 $this->shippingDetails = $shippingDetails;
465
466 return $this;
467 }
468
473 public function withRecurrenceInfo(?LineItemRecurrenceInfoDraft $recurrenceInfo)
474 {
475 $this->recurrenceInfo = $recurrenceInfo;
476
477 return $this;
478 }
479
484 public function withCustom(?CustomFieldsDraft $custom)
485 {
486 $this->custom = $custom;
487
488 return $this;
489 }
490
496 {
497 $this->distributionChannel = $distributionChannel;
498
499 return $this;
500 }
501
507 {
508 $this->supplyChannel = $supplyChannel;
509
510 return $this;
511 }
512
517 public function withExternalPriceBuilder(?MoneyBuilder $externalPrice)
518 {
519 $this->externalPrice = $externalPrice;
520
521 return $this;
522 }
523
529 {
530 $this->externalTotalPrice = $externalTotalPrice;
531
532 return $this;
533 }
534
540 {
541 $this->externalTaxRate = $externalTaxRate;
542
543 return $this;
544 }
545
551 {
552 $this->shippingDetails = $shippingDetails;
553
554 return $this;
555 }
556
562 {
563 $this->recurrenceInfo = $recurrenceInfo;
564
565 return $this;
566 }
567
573 {
574 $this->custom = $custom;
575
576 return $this;
577 }
578
579 public function build(): CartAddLineItemAction
580 {
582 $this->key,
583 $this->productId,
584 $this->variantId,
585 $this->sku,
586 $this->quantity,
587 $this->addedAt,
588 $this->distributionChannel instanceof ChannelResourceIdentifierBuilder ? $this->distributionChannel->build() : $this->distributionChannel,
589 $this->supplyChannel instanceof ChannelResourceIdentifierBuilder ? $this->supplyChannel->build() : $this->supplyChannel,
590 $this->externalPrice instanceof MoneyBuilder ? $this->externalPrice->build() : $this->externalPrice,
591 $this->externalTotalPrice instanceof ExternalLineItemTotalPriceBuilder ? $this->externalTotalPrice->build() : $this->externalTotalPrice,
592 $this->externalTaxRate instanceof ExternalTaxRateDraftBuilder ? $this->externalTaxRate->build() : $this->externalTaxRate,
593 $this->perMethodExternalTaxRate,
594 $this->inventoryMode,
595 $this->shippingDetails instanceof ItemShippingDetailsDraftBuilder ? $this->shippingDetails->build() : $this->shippingDetails,
596 $this->recurrenceInfo instanceof LineItemRecurrenceInfoDraftBuilder ? $this->recurrenceInfo->build() : $this->recurrenceInfo,
597 $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom
598 );
599 }
600
601 public static function of(): CartAddLineItemActionBuilder
602 {
603 return new self();
604 }
605}
withPerMethodExternalTaxRate(?MethodExternalTaxRateDraftCollection $perMethodExternalTaxRate)
withDistributionChannelBuilder(?ChannelResourceIdentifierBuilder $distributionChannel)
withExternalTotalPriceBuilder(?ExternalLineItemTotalPriceBuilder $externalTotalPrice)
withExternalTotalPrice(?ExternalLineItemTotalPrice $externalTotalPrice)
withDistributionChannel(?ChannelResourceIdentifier $distributionChannel)
withExternalTaxRateBuilder(?ExternalTaxRateDraftBuilder $externalTaxRate)
withSupplyChannelBuilder(?ChannelResourceIdentifierBuilder $supplyChannel)
withShippingDetailsBuilder(?ItemShippingDetailsDraftBuilder $shippingDetails)
withRecurrenceInfoBuilder(?LineItemRecurrenceInfoDraftBuilder $recurrenceInfo)