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
22use DateTimeImmutable;
23use stdClass;
24
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
138 public function getProductId()
139 {
140 return $this->productId;
141 }
142
151 public function getVariantId()
152 {
153 return $this->variantId;
154 }
155
163 public function getSku()
164 {
165 return $this->sku;
166 }
167
174 public function getQuantity()
175 {
176 return $this->quantity;
177 }
178
187 public function getAddedAt()
188 {
189 return $this->addedAt;
190 }
191
200 public function getDistributionChannel()
201 {
202 return $this->distributionChannel instanceof ChannelResourceIdentifierBuilder ? $this->distributionChannel->build() : $this->distributionChannel;
203 }
204
212 public function getSupplyChannel()
213 {
214 return $this->supplyChannel instanceof ChannelResourceIdentifierBuilder ? $this->supplyChannel->build() : $this->supplyChannel;
215 }
216
223 public function getExternalPrice()
224 {
225 return $this->externalPrice instanceof MoneyBuilder ? $this->externalPrice->build() : $this->externalPrice;
226 }
227
234 public function getExternalTotalPrice()
235 {
236 return $this->externalTotalPrice instanceof ExternalLineItemTotalPriceBuilder ? $this->externalTotalPrice->build() : $this->externalTotalPrice;
237 }
238
245 public function getExternalTaxRate()
246 {
247 return $this->externalTaxRate instanceof ExternalTaxRateDraftBuilder ? $this->externalTaxRate->build() : $this->externalTaxRate;
248 }
249
257 {
258 return $this->perMethodExternalTaxRate;
259 }
260
268 public function getInventoryMode()
269 {
270 return $this->inventoryMode;
271 }
272
279 public function getShippingDetails()
280 {
281 return $this->shippingDetails instanceof ItemShippingDetailsDraftBuilder ? $this->shippingDetails->build() : $this->shippingDetails;
282 }
283
290 public function getCustom()
291 {
292 return $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom;
293 }
294
299 public function withKey(?string $key)
300 {
301 $this->key = $key;
302
303 return $this;
304 }
305
310 public function withProductId(?string $productId)
311 {
312 $this->productId = $productId;
313
314 return $this;
315 }
316
321 public function withVariantId(?int $variantId)
322 {
323 $this->variantId = $variantId;
324
325 return $this;
326 }
327
332 public function withSku(?string $sku)
333 {
334 $this->sku = $sku;
335
336 return $this;
337 }
338
343 public function withQuantity(?int $quantity)
344 {
345 $this->quantity = $quantity;
346
347 return $this;
348 }
349
354 public function withAddedAt(?DateTimeImmutable $addedAt)
355 {
356 $this->addedAt = $addedAt;
357
358 return $this;
359 }
360
365 public function withDistributionChannel(?ChannelResourceIdentifier $distributionChannel)
366 {
367 $this->distributionChannel = $distributionChannel;
368
369 return $this;
370 }
371
376 public function withSupplyChannel(?ChannelResourceIdentifier $supplyChannel)
377 {
378 $this->supplyChannel = $supplyChannel;
379
380 return $this;
381 }
382
387 public function withExternalPrice(?Money $externalPrice)
388 {
389 $this->externalPrice = $externalPrice;
390
391 return $this;
392 }
393
398 public function withExternalTotalPrice(?ExternalLineItemTotalPrice $externalTotalPrice)
399 {
400 $this->externalTotalPrice = $externalTotalPrice;
401
402 return $this;
403 }
404
409 public function withExternalTaxRate(?ExternalTaxRateDraft $externalTaxRate)
410 {
411 $this->externalTaxRate = $externalTaxRate;
412
413 return $this;
414 }
415
420 public function withPerMethodExternalTaxRate(?MethodExternalTaxRateDraftCollection $perMethodExternalTaxRate)
421 {
422 $this->perMethodExternalTaxRate = $perMethodExternalTaxRate;
423
424 return $this;
425 }
426
431 public function withInventoryMode(?string $inventoryMode)
432 {
433 $this->inventoryMode = $inventoryMode;
434
435 return $this;
436 }
437
442 public function withShippingDetails(?ItemShippingDetailsDraft $shippingDetails)
443 {
444 $this->shippingDetails = $shippingDetails;
445
446 return $this;
447 }
448
453 public function withCustom(?CustomFieldsDraft $custom)
454 {
455 $this->custom = $custom;
456
457 return $this;
458 }
459
465 {
466 $this->distributionChannel = $distributionChannel;
467
468 return $this;
469 }
470
476 {
477 $this->supplyChannel = $supplyChannel;
478
479 return $this;
480 }
481
486 public function withExternalPriceBuilder(?MoneyBuilder $externalPrice)
487 {
488 $this->externalPrice = $externalPrice;
489
490 return $this;
491 }
492
498 {
499 $this->externalTotalPrice = $externalTotalPrice;
500
501 return $this;
502 }
503
509 {
510 $this->externalTaxRate = $externalTaxRate;
511
512 return $this;
513 }
514
520 {
521 $this->shippingDetails = $shippingDetails;
522
523 return $this;
524 }
525
531 {
532 $this->custom = $custom;
533
534 return $this;
535 }
536
537 public function build(): CartAddLineItemAction
538 {
540 $this->key,
541 $this->productId,
542 $this->variantId,
543 $this->sku,
544 $this->quantity,
545 $this->addedAt,
546 $this->distributionChannel instanceof ChannelResourceIdentifierBuilder ? $this->distributionChannel->build() : $this->distributionChannel,
547 $this->supplyChannel instanceof ChannelResourceIdentifierBuilder ? $this->supplyChannel->build() : $this->supplyChannel,
548 $this->externalPrice instanceof MoneyBuilder ? $this->externalPrice->build() : $this->externalPrice,
549 $this->externalTotalPrice instanceof ExternalLineItemTotalPriceBuilder ? $this->externalTotalPrice->build() : $this->externalTotalPrice,
550 $this->externalTaxRate instanceof ExternalTaxRateDraftBuilder ? $this->externalTaxRate->build() : $this->externalTaxRate,
551 $this->perMethodExternalTaxRate,
552 $this->inventoryMode,
553 $this->shippingDetails instanceof ItemShippingDetailsDraftBuilder ? $this->shippingDetails->build() : $this->shippingDetails,
554 $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom
555 );
556 }
557
558 public static function of(): CartAddLineItemActionBuilder
559 {
560 return new self();
561 }
562}
withPerMethodExternalTaxRate(?MethodExternalTaxRateDraftCollection $perMethodExternalTaxRate)
withDistributionChannelBuilder(?ChannelResourceIdentifierBuilder $distributionChannel)
withExternalTotalPriceBuilder(?ExternalLineItemTotalPriceBuilder $externalTotalPrice)
withExternalTotalPrice(?ExternalLineItemTotalPrice $externalTotalPrice)
withDistributionChannel(?ChannelResourceIdentifier $distributionChannel)
withExternalTaxRateBuilder(?ExternalTaxRateDraftBuilder $externalTaxRate)
withSupplyChannelBuilder(?ChannelResourceIdentifierBuilder $supplyChannel)
withShippingDetailsBuilder(?ItemShippingDetailsDraftBuilder $shippingDetails)