commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
lib
commercetools-api
src
Models
Cart
LineItemDraftBuilder.php
1
<?php
2
3
declare(strict_types=1);
9
namespace
Commercetools\Api\Models\Cart
;
10
11
use
Commercetools\Api\Models\Channel\ChannelResourceIdentifier
;
12
use
Commercetools\Api\Models\Channel\ChannelResourceIdentifierBuilder
;
13
use
Commercetools\Api\Models\Common\Money
;
14
use
Commercetools\Api\Models\Common\MoneyBuilder
;
15
use
Commercetools\Api\Models\Type\CustomFieldsDraft
;
16
use
Commercetools\Api\Models\Type\CustomFieldsDraftBuilder
;
17
use
Commercetools\Base\Builder
;
18
use
Commercetools\Base\DateTimeImmutableCollection
;
19
use
Commercetools\Base\JsonObject
;
20
use
Commercetools\Base\JsonObjectModel
;
21
use
Commercetools\Base\MapperFactory
;
22
use DateTimeImmutable;
23
use stdClass;
24
28
final
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
254
public
function
getPerMethodExternalTaxRate
()
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
462
public
function
withDistributionChannelBuilder
(?
ChannelResourceIdentifierBuilder
$distributionChannel)
463
{
464
$this->distributionChannel = $distributionChannel;
465
466
return
$this;
467
}
468
473
public
function
withSupplyChannelBuilder
(?
ChannelResourceIdentifierBuilder
$supplyChannel)
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
495
public
function
withExternalTotalPriceBuilder
(?
ExternalLineItemTotalPriceBuilder
$externalTotalPrice)
496
{
497
$this->externalTotalPrice = $externalTotalPrice;
498
499
return
$this;
500
}
501
506
public
function
withExternalTaxRateBuilder
(?
ExternalTaxRateDraftBuilder
$externalTaxRate)
507
{
508
$this->externalTaxRate = $externalTaxRate;
509
510
return
$this;
511
}
512
517
public
function
withShippingDetailsBuilder
(?
ItemShippingDetailsDraftBuilder
$shippingDetails)
518
{
519
$this->shippingDetails = $shippingDetails;
520
521
return
$this;
522
}
523
528
public
function
withCustomBuilder
(?
CustomFieldsDraftBuilder
$custom)
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
}
Commercetools\Api\Models\Cart\ExternalLineItemTotalPriceBuilder
Definition
ExternalLineItemTotalPriceBuilder.php:24
Commercetools\Api\Models\Cart\ExternalLineItemTotalPriceBuilder\build
build()
Definition
ExternalLineItemTotalPriceBuilder.php:103
Commercetools\Api\Models\Cart\ExternalTaxRateDraftBuilder
Definition
ExternalTaxRateDraftBuilder.php:23
Commercetools\Api\Models\Cart\ExternalTaxRateDraftBuilder\build
build()
Definition
ExternalTaxRateDraftBuilder.php:201
Commercetools\Api\Models\Cart\ItemShippingDetailsDraftBuilder
Definition
ItemShippingDetailsDraftBuilder.php:22
Commercetools\Api\Models\Cart\ItemShippingDetailsDraftBuilder\build
build()
Definition
ItemShippingDetailsDraftBuilder.php:53
Commercetools\Api\Models\Cart\LineItemDraftBuilder
Definition
LineItemDraftBuilder.php:29
Commercetools\Api\Models\Cart\LineItemDraftBuilder\withSku
withSku(?string $sku)
Definition
LineItemDraftBuilder.php:330
Commercetools\Api\Models\Cart\LineItemDraftBuilder\getInventoryMode
getInventoryMode()
Definition
LineItemDraftBuilder.php:266
Commercetools\Api\Models\Cart\LineItemDraftBuilder\getDistributionChannel
getDistributionChannel()
Definition
LineItemDraftBuilder.php:198
Commercetools\Api\Models\Cart\LineItemDraftBuilder\getPerMethodExternalTaxRate
getPerMethodExternalTaxRate()
Definition
LineItemDraftBuilder.php:254
Commercetools\Api\Models\Cart\LineItemDraftBuilder\withShippingDetails
withShippingDetails(?ItemShippingDetailsDraft $shippingDetails)
Definition
LineItemDraftBuilder.php:440
Commercetools\Api\Models\Cart\LineItemDraftBuilder\getExternalPrice
getExternalPrice()
Definition
LineItemDraftBuilder.php:221
Commercetools\Api\Models\Cart\LineItemDraftBuilder\withAddedAt
withAddedAt(?DateTimeImmutable $addedAt)
Definition
LineItemDraftBuilder.php:352
Commercetools\Api\Models\Cart\LineItemDraftBuilder\getSupplyChannel
getSupplyChannel()
Definition
LineItemDraftBuilder.php:210
Commercetools\Api\Models\Cart\LineItemDraftBuilder\getShippingDetails
getShippingDetails()
Definition
LineItemDraftBuilder.php:277
Commercetools\Api\Models\Cart\LineItemDraftBuilder\getProductId
getProductId()
Definition
LineItemDraftBuilder.php:137
Commercetools\Api\Models\Cart\LineItemDraftBuilder\getAddedAt
getAddedAt()
Definition
LineItemDraftBuilder.php:184
Commercetools\Api\Models\Cart\LineItemDraftBuilder\withCustomBuilder
withCustomBuilder(?CustomFieldsDraftBuilder $custom)
Definition
LineItemDraftBuilder.php:528
Commercetools\Api\Models\Cart\LineItemDraftBuilder\withExternalTotalPriceBuilder
withExternalTotalPriceBuilder(?ExternalLineItemTotalPriceBuilder $externalTotalPrice)
Definition
LineItemDraftBuilder.php:495
Commercetools\Api\Models\Cart\LineItemDraftBuilder\withKey
withKey(?string $key)
Definition
LineItemDraftBuilder.php:297
Commercetools\Api\Models\Cart\LineItemDraftBuilder\getKey
getKey()
Definition
LineItemDraftBuilder.php:126
Commercetools\Api\Models\Cart\LineItemDraftBuilder\getSku
getSku()
Definition
LineItemDraftBuilder.php:160
Commercetools\Api\Models\Cart\LineItemDraftBuilder\withDistributionChannelBuilder
withDistributionChannelBuilder(?ChannelResourceIdentifierBuilder $distributionChannel)
Definition
LineItemDraftBuilder.php:462
Commercetools\Api\Models\Cart\LineItemDraftBuilder\withExternalTaxRate
withExternalTaxRate(?ExternalTaxRateDraft $externalTaxRate)
Definition
LineItemDraftBuilder.php:407
Commercetools\Api\Models\Cart\LineItemDraftBuilder\withSupplyChannelBuilder
withSupplyChannelBuilder(?ChannelResourceIdentifierBuilder $supplyChannel)
Definition
LineItemDraftBuilder.php:473
Commercetools\Api\Models\Cart\LineItemDraftBuilder\withShippingDetailsBuilder
withShippingDetailsBuilder(?ItemShippingDetailsDraftBuilder $shippingDetails)
Definition
LineItemDraftBuilder.php:517
Commercetools\Api\Models\Cart\LineItemDraftBuilder\withCustom
withCustom(?CustomFieldsDraft $custom)
Definition
LineItemDraftBuilder.php:451
Commercetools\Api\Models\Cart\LineItemDraftBuilder\withExternalTaxRateBuilder
withExternalTaxRateBuilder(?ExternalTaxRateDraftBuilder $externalTaxRate)
Definition
LineItemDraftBuilder.php:506
Commercetools\Api\Models\Cart\LineItemDraftBuilder\withSupplyChannel
withSupplyChannel(?ChannelResourceIdentifier $supplyChannel)
Definition
LineItemDraftBuilder.php:374
Commercetools\Api\Models\Cart\LineItemDraftBuilder\of
static of()
Definition
LineItemDraftBuilder.php:556
Commercetools\Api\Models\Cart\LineItemDraftBuilder\getQuantity
getQuantity()
Definition
LineItemDraftBuilder.php:171
Commercetools\Api\Models\Cart\LineItemDraftBuilder\withDistributionChannel
withDistributionChannel(?ChannelResourceIdentifier $distributionChannel)
Definition
LineItemDraftBuilder.php:363
Commercetools\Api\Models\Cart\LineItemDraftBuilder\withInventoryMode
withInventoryMode(?string $inventoryMode)
Definition
LineItemDraftBuilder.php:429
Commercetools\Api\Models\Cart\LineItemDraftBuilder\getCustom
getCustom()
Definition
LineItemDraftBuilder.php:288
Commercetools\Api\Models\Cart\LineItemDraftBuilder\getExternalTaxRate
getExternalTaxRate()
Definition
LineItemDraftBuilder.php:243
Commercetools\Api\Models\Cart\LineItemDraftBuilder\withProductId
withProductId(?string $productId)
Definition
LineItemDraftBuilder.php:308
Commercetools\Api\Models\Cart\LineItemDraftBuilder\withVariantId
withVariantId(?int $variantId)
Definition
LineItemDraftBuilder.php:319
Commercetools\Api\Models\Cart\LineItemDraftBuilder\withQuantity
withQuantity(?int $quantity)
Definition
LineItemDraftBuilder.php:341
Commercetools\Api\Models\Cart\LineItemDraftBuilder\withPerMethodExternalTaxRate
withPerMethodExternalTaxRate(?MethodExternalTaxRateDraftCollection $perMethodExternalTaxRate)
Definition
LineItemDraftBuilder.php:418
Commercetools\Api\Models\Cart\LineItemDraftBuilder\getExternalTotalPrice
getExternalTotalPrice()
Definition
LineItemDraftBuilder.php:232
Commercetools\Api\Models\Cart\LineItemDraftBuilder\build
build()
Definition
LineItemDraftBuilder.php:535
Commercetools\Api\Models\Cart\LineItemDraftBuilder\withExternalPriceBuilder
withExternalPriceBuilder(?MoneyBuilder $externalPrice)
Definition
LineItemDraftBuilder.php:484
Commercetools\Api\Models\Cart\LineItemDraftBuilder\withExternalTotalPrice
withExternalTotalPrice(?ExternalLineItemTotalPrice $externalTotalPrice)
Definition
LineItemDraftBuilder.php:396
Commercetools\Api\Models\Cart\LineItemDraftBuilder\getVariantId
getVariantId()
Definition
LineItemDraftBuilder.php:149
Commercetools\Api\Models\Cart\LineItemDraftBuilder\withExternalPrice
withExternalPrice(?Money $externalPrice)
Definition
LineItemDraftBuilder.php:385
Commercetools\Api\Models\Cart\LineItemDraftModel
Definition
LineItemDraftModel.php:28
Commercetools\Api\Models\Cart\MethodExternalTaxRateDraftCollection
Definition
MethodExternalTaxRateDraftCollection.php:22
Commercetools\Api\Models\Channel\ChannelResourceIdentifierBuilder
Definition
ChannelResourceIdentifierBuilder.php:24
Commercetools\Api\Models\Channel\ChannelResourceIdentifierBuilder\build
build()
Definition
ChannelResourceIdentifierBuilder.php:82
Commercetools\Api\Models\Common\MoneyBuilder
Definition
MoneyBuilder.php:22
Commercetools\Api\Models\Common\MoneyBuilder\build
build()
Definition
MoneyBuilder.php:84
Commercetools\Api\Models\Type\CustomFieldsDraftBuilder
Definition
CustomFieldsDraftBuilder.php:22
Commercetools\Api\Models\Type\CustomFieldsDraftBuilder\build
build()
Definition
CustomFieldsDraftBuilder.php:101
Commercetools\Base\DateTimeImmutableCollection
Definition
DateTimeImmutableCollection.php:21
Commercetools\Base\JsonObjectModel
Definition
JsonObjectModel.php:15
Commercetools\Base\MapperFactory
Definition
MapperFactory.php:16
Commercetools\Api\Models\Cart\ExternalLineItemTotalPrice
Definition
ExternalLineItemTotalPrice.php:16
Commercetools\Api\Models\Cart\ExternalTaxRateDraft
Definition
ExternalTaxRateDraft.php:16
Commercetools\Api\Models\Cart\ItemShippingDetailsDraft
Definition
ItemShippingDetailsDraft.php:15
Commercetools\Api\Models\Cart\LineItemDraft
Definition
LineItemDraft.php:19
Commercetools\Api\Models\Channel\ChannelResourceIdentifier
Definition
ChannelResourceIdentifier.php:16
Commercetools\Api\Models\Common\Money
Definition
Money.php:15
Commercetools\Api\Models\Type\CustomFieldsDraft
Definition
CustomFieldsDraft.php:15
Commercetools\Base\Builder
Definition
Builder.php:16
Commercetools\Base\JsonObject
Definition
JsonObject.php:15
Commercetools\Api\Models\Cart
Definition
Cart.php:9
Generated by
1.9.8