Class CartAddLineItemActionImpl
- All Implemented Interfaces:
CartAddLineItemAction
,CartUpdateAction
,CustomizableDraft<CartAddLineItemAction>
,ResourceUpdateAction<CartUpdateAction>
,io.vrap.rmf.base.client.ModelBase
If the Cart contains a LineItem for a Product Variant with the same LineItemMode, Custom Fields, supply and distribution channel, then only the quantity of the existing Line Item is increased. If LineItem shippingDetails
is set, it is merged. All addresses will be present afterwards and, for address keys present in both shipping details, the quantity will be summed up. A new Line Item is added when the externalPrice
or externalTotalPrice
is set in this update action. The LineItem price is set as described in LineItem Price selection.
If the Tax Rate is not set, a MissingTaxRateForCountry error is returned.
If the Line Items do not have a Price according to the Product priceMode
value for a selected currency and/or country, Customer Group, or Channel, a MatchingPriceNotFound error is returned.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.vrap.rmf.base.client.ModelBase
io.vrap.rmf.base.client.ModelBase.FilteredRecursiveToStringStyle
-
Field Summary
Fields inherited from interface com.commercetools.api.models.cart.CartAddLineItemAction
ADD_LINE_ITEM
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Date and time (UTC) the Product Variant is added to the Cart.Custom Fields for the Line Item.Used to select a Product Price.Sets the LineItemprice
value, and thepriceMode
toExternalPrice
LineItemPriceMode.External Tax Rate for the Line Item, if the Cart has theExternal
TaxMode.Sets the LineItemprice
andtotalPrice
values, and thepriceMode
toExternalTotal
LineItemPriceMode.Inventory mode specific to the Line Item only, and valid for the entirequantity
of the Line Item.getKey()
User-defined unique identifier of the LineItem.id
of the published Product.Quantity of the Product Variant to add to the Cart.Container for Line Item-specific addresses.getSku()
SKU of the ProductVariant.Used to identify Inventory entries that must be reserved.id
of the ProductVariant in the Product.int
hashCode()
void
setAddedAt
(ZonedDateTime addedAt) Date and time (UTC) the Product Variant is added to the Cart.void
setCustom
(CustomFieldsDraft custom) Custom Fields for the Line Item.void
setDistributionChannel
(ChannelResourceIdentifier distributionChannel) Used to select a Product Price.void
setExternalPrice
(Money externalPrice) Sets the LineItemprice
value, and thepriceMode
toExternalPrice
LineItemPriceMode.void
setExternalTaxRate
(ExternalTaxRateDraft externalTaxRate) External Tax Rate for the Line Item, if the Cart has theExternal
TaxMode.void
setExternalTotalPrice
(ExternalLineItemTotalPrice externalTotalPrice) Sets the LineItemprice
andtotalPrice
values, and thepriceMode
toExternalTotal
LineItemPriceMode.void
setInventoryMode
(InventoryMode inventoryMode) Inventory mode specific to the Line Item only, and valid for the entirequantity
of the Line Item.void
User-defined unique identifier of the LineItem.void
setProductId
(String productId) id
of the published Product.void
setQuantity
(Long quantity) Quantity of the Product Variant to add to the Cart.void
setShippingDetails
(ItemShippingDetailsDraft shippingDetails) Container for Line Item-specific addresses.void
SKU of the ProductVariant.void
setSupplyChannel
(ChannelResourceIdentifier supplyChannel) Used to identify Inventory entries that must be reserved.void
setVariantId
(Long variantId) id
of the ProductVariant in the Product.Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.commercetools.api.models.cart.CartAddLineItemAction
withCartAddLineItemAction
Methods inherited from interface com.commercetools.api.models.cart.CartUpdateAction
withCartUpdateAction
Methods inherited from interface com.commercetools.api.models.CustomizableDraft
unwrapCustomizableDraft
Methods inherited from interface io.vrap.rmf.base.client.ModelBase
reflectionString, reflectionString
Methods inherited from interface com.commercetools.api.models.ResourceUpdateAction
get
-
Constructor Details
-
CartAddLineItemActionImpl
public CartAddLineItemActionImpl()create empty instance
-
-
Method Details
-
getAction
- Specified by:
getAction
in interfaceCartUpdateAction
- Specified by:
getAction
in interfaceResourceUpdateAction<CartUpdateAction>
- Returns:
- action
-
getKey
User-defined unique identifier of the LineItem.
- Specified by:
getKey
in interfaceCartAddLineItemAction
- Returns:
- key
-
getProductId
id
of the published Product.Either the
productId
andvariantId
, orsku
must be provided.- Specified by:
getProductId
in interfaceCartAddLineItemAction
- Returns:
- productId
-
getVariantId
id
of the ProductVariant in the Product. If not provided, the Master Variant is used.Either the
productId
andvariantId
, orsku
must be provided.- Specified by:
getVariantId
in interfaceCartAddLineItemAction
- Returns:
- variantId
-
getSku
SKU of the ProductVariant.
Either the
productId
andvariantId
, orsku
must be provided.- Specified by:
getSku
in interfaceCartAddLineItemAction
- Returns:
- sku
-
getQuantity
Quantity of the Product Variant to add to the Cart.
- Specified by:
getQuantity
in interfaceCartAddLineItemAction
- Returns:
- quantity
-
getAddedAt
Date and time (UTC) the Product Variant is added to the Cart. If not set, it defaults to the current date and time.
Optional for backwards compatibility reasons.
- Specified by:
getAddedAt
in interfaceCartAddLineItemAction
- Returns:
- addedAt
-
getDistributionChannel
Used to select a Product Price. The Channel must have the
ProductDistribution
ChannelRoleEnum. If the Cart is bound to a Store withdistributionChannels
set, the Channel must match one of the Store's distribution channels.- Specified by:
getDistributionChannel
in interfaceCartAddLineItemAction
- Returns:
- distributionChannel
-
getSupplyChannel
Used to identify Inventory entries that must be reserved. The Channel must have the
InventorySupply
ChannelRoleEnum.- Specified by:
getSupplyChannel
in interfaceCartAddLineItemAction
- Returns:
- supplyChannel
-
getExternalPrice
Sets the LineItem
price
value, and thepriceMode
toExternalPrice
LineItemPriceMode.- Specified by:
getExternalPrice
in interfaceCartAddLineItemAction
- Returns:
- externalPrice
-
getExternalTotalPrice
Sets the LineItem
price
andtotalPrice
values, and thepriceMode
toExternalTotal
LineItemPriceMode.- Specified by:
getExternalTotalPrice
in interfaceCartAddLineItemAction
- Returns:
- externalTotalPrice
-
getExternalTaxRate
External Tax Rate for the Line Item, if the Cart has the
External
TaxMode.- Specified by:
getExternalTaxRate
in interfaceCartAddLineItemAction
- Returns:
- externalTaxRate
-
getInventoryMode
Inventory mode specific to the Line Item only, and valid for the entire
quantity
of the Line Item. Set only if the inventory mode should be different from theinventoryMode
specified on the Cart.- Specified by:
getInventoryMode
in interfaceCartAddLineItemAction
- Returns:
- inventoryMode
-
getShippingDetails
Container for Line Item-specific addresses.
- Specified by:
getShippingDetails
in interfaceCartAddLineItemAction
- Returns:
- shippingDetails
-
getCustom
Custom Fields for the Line Item.
- Specified by:
getCustom
in interfaceCartAddLineItemAction
- Specified by:
getCustom
in interfaceCustomizableDraft<CartAddLineItemAction>
- Returns:
- custom
-
setKey
Description copied from interface:CartAddLineItemAction
User-defined unique identifier of the LineItem.
- Specified by:
setKey
in interfaceCartAddLineItemAction
- Parameters:
key
- value to be set
-
setProductId
Description copied from interface:CartAddLineItemAction
id
of the published Product.Either the
productId
andvariantId
, orsku
must be provided.- Specified by:
setProductId
in interfaceCartAddLineItemAction
- Parameters:
productId
- value to be set
-
setVariantId
Description copied from interface:CartAddLineItemAction
id
of the ProductVariant in the Product. If not provided, the Master Variant is used.Either the
productId
andvariantId
, orsku
must be provided.- Specified by:
setVariantId
in interfaceCartAddLineItemAction
- Parameters:
variantId
- value to be set
-
setSku
Description copied from interface:CartAddLineItemAction
SKU of the ProductVariant.
Either the
productId
andvariantId
, orsku
must be provided.- Specified by:
setSku
in interfaceCartAddLineItemAction
- Parameters:
sku
- value to be set
-
setQuantity
Description copied from interface:CartAddLineItemAction
Quantity of the Product Variant to add to the Cart.
- Specified by:
setQuantity
in interfaceCartAddLineItemAction
- Parameters:
quantity
- value to be set
-
setAddedAt
Description copied from interface:CartAddLineItemAction
Date and time (UTC) the Product Variant is added to the Cart. If not set, it defaults to the current date and time.
Optional for backwards compatibility reasons.
- Specified by:
setAddedAt
in interfaceCartAddLineItemAction
- Parameters:
addedAt
- value to be set
-
setDistributionChannel
Description copied from interface:CartAddLineItemAction
Used to select a Product Price. The Channel must have the
ProductDistribution
ChannelRoleEnum. If the Cart is bound to a Store withdistributionChannels
set, the Channel must match one of the Store's distribution channels.- Specified by:
setDistributionChannel
in interfaceCartAddLineItemAction
- Parameters:
distributionChannel
- value to be set
-
setSupplyChannel
Description copied from interface:CartAddLineItemAction
Used to identify Inventory entries that must be reserved. The Channel must have the
InventorySupply
ChannelRoleEnum.- Specified by:
setSupplyChannel
in interfaceCartAddLineItemAction
- Parameters:
supplyChannel
- value to be set
-
setExternalPrice
Description copied from interface:CartAddLineItemAction
Sets the LineItem
price
value, and thepriceMode
toExternalPrice
LineItemPriceMode.- Specified by:
setExternalPrice
in interfaceCartAddLineItemAction
- Parameters:
externalPrice
- value to be set
-
setExternalTotalPrice
Description copied from interface:CartAddLineItemAction
Sets the LineItem
price
andtotalPrice
values, and thepriceMode
toExternalTotal
LineItemPriceMode.- Specified by:
setExternalTotalPrice
in interfaceCartAddLineItemAction
- Parameters:
externalTotalPrice
- value to be set
-
setExternalTaxRate
Description copied from interface:CartAddLineItemAction
External Tax Rate for the Line Item, if the Cart has the
External
TaxMode.- Specified by:
setExternalTaxRate
in interfaceCartAddLineItemAction
- Parameters:
externalTaxRate
- value to be set
-
setInventoryMode
Description copied from interface:CartAddLineItemAction
Inventory mode specific to the Line Item only, and valid for the entire
quantity
of the Line Item. Set only if the inventory mode should be different from theinventoryMode
specified on the Cart.- Specified by:
setInventoryMode
in interfaceCartAddLineItemAction
- Parameters:
inventoryMode
- value to be set
-
setShippingDetails
Description copied from interface:CartAddLineItemAction
Container for Line Item-specific addresses.
- Specified by:
setShippingDetails
in interfaceCartAddLineItemAction
- Parameters:
shippingDetails
- value to be set
-
setCustom
Description copied from interface:CartAddLineItemAction
Custom Fields for the Line Item.
- Specified by:
setCustom
in interfaceCartAddLineItemAction
- Specified by:
setCustom
in interfaceCustomizableDraft<CartAddLineItemAction>
- Parameters:
custom
- value to be set
-
equals
-
hashCode
-