Interface CustomLineItem
- All Superinterfaces:
Customizable<CustomLineItem>
A generic item that can be added to the Cart but is not bound to a Product that can be used for discounts (negative money), vouchers, complex cart rules, additional services, or fees. You control the lifecycle of this item.
Example to create an instance using the builder pattern
CustomLineItem customLineItem = CustomLineItem.builder()
.id("{id}")
.name(nameBuilder -> nameBuilder)
.money(moneyBuilder -> moneyBuilder)
.plusTaxedPricePortions(taxedPricePortionsBuilder -> taxedPricePortionsBuilder)
.totalPrice(totalPriceBuilder -> totalPriceBuilder)
.slug("{slug}")
.quantity(0.3)
.plusState(stateBuilder -> stateBuilder)
.plusPerMethodTaxRate(perMethodTaxRateBuilder -> perMethodTaxRateBuilder)
.plusDiscountedPricePerQuantity(discountedPricePerQuantityBuilder -> discountedPricePerQuantityBuilder)
.priceMode(CustomLineItemPriceMode.STANDARD)
.build()
-
Method Summary
Modifier and TypeMethodDescriptionstatic CustomLineItemBuilder
builder()
builder factory method for CustomLineItemstatic CustomLineItemBuilder
builder
(CustomLineItem template) create builder for CustomLineItem instancestatic CustomLineItem
deepCopy
(CustomLineItem template) factory method to create a deep copy of CustomLineItem@Valid CustomFields
Custom Fields of the Custom Line Item.@NotNull @Valid List<DiscountedLineItemPriceForQuantity>
Discounted price of a single quantity of the Custom Line Item.@NotNull String
getId()
Unique identifier of the Custom Line Item.getKey()
User-defined unique identifier of the Custom Line Item.@NotNull @Valid TypedMoney
getMoney()
Money value of the Custom Line Item.@NotNull @Valid LocalizedString
getName()
Name of the Custom Line Item.@NotNull @Valid List<MethodTaxRate>
Tax Rate per Shipping Method for a Cart withMultiple
ShippingMode.@NotNull CustomLineItemPriceMode
Indicates whether Cart Discounts with a matching CartDiscountCustomLineItemsTarget are applied to the Custom Line Item.@NotNull Long
Number of Custom Line Items in the Cart or Order.@Valid ItemShippingDetails
Container for Custom Line Item-specific addresses.@NotNull String
getSlug()
User-defined identifier used in a deep-link URL for the Custom Line Item.getState()
State of the Custom Line Item in the Cart or Order.@Valid TaxCategoryReference
Used to select a Tax Rate when a Cart has thePlatform
TaxMode.@Valid TaxedItemPrice
Automatically set after thetaxRate
is set.@NotNull @Valid List<MethodTaxedPrice>
Total taxed prices based on the quantity of the Custom Line Item assigned to each Shipping Method.@Valid TaxRate
For a Cart withPlatform
TaxMode, thetaxRate
of Custom Line Items is set automatically once a shipping address is set.@NotNull @Valid CentPrecisionMoney
Total price of the Custom Line Item (money
multiplied byquantity
).static CustomLineItem
of()
factory methodstatic CustomLineItem
of
(CustomLineItem template) factory method to create a shallow copy CustomLineItemvoid
setCustom
(CustomFields custom) Custom Fields of the Custom Line Item.void
setDiscountedPricePerQuantity
(DiscountedLineItemPriceForQuantity... discountedPricePerQuantity) Discounted price of a single quantity of the Custom Line Item.void
setDiscountedPricePerQuantity
(List<DiscountedLineItemPriceForQuantity> discountedPricePerQuantity) Discounted price of a single quantity of the Custom Line Item.void
Unique identifier of the Custom Line Item.void
User-defined unique identifier of the Custom Line Item.void
setMoney
(TypedMoney money) Money value of the Custom Line Item.void
setName
(LocalizedString name) Name of the Custom Line Item.void
setPerMethodTaxRate
(MethodTaxRate... perMethodTaxRate) Tax Rate per Shipping Method for a Cart withMultiple
ShippingMode.void
setPerMethodTaxRate
(List<MethodTaxRate> perMethodTaxRate) Tax Rate per Shipping Method for a Cart withMultiple
ShippingMode.void
setPriceMode
(CustomLineItemPriceMode priceMode) Indicates whether Cart Discounts with a matching CartDiscountCustomLineItemsTarget are applied to the Custom Line Item.void
setQuantity
(Long quantity) Number of Custom Line Items in the Cart or Order.void
setShippingDetails
(ItemShippingDetails shippingDetails) Container for Custom Line Item-specific addresses.void
User-defined identifier used in a deep-link URL for the Custom Line Item.void
State of the Custom Line Item in the Cart or Order.void
State of the Custom Line Item in the Cart or Order.void
setTaxCategory
(TaxCategoryReference taxCategory) Used to select a Tax Rate when a Cart has thePlatform
TaxMode.void
setTaxedPrice
(TaxedItemPrice taxedPrice) Automatically set after thetaxRate
is set.void
setTaxedPricePortions
(MethodTaxedPrice... taxedPricePortions) Total taxed prices based on the quantity of the Custom Line Item assigned to each Shipping Method.void
setTaxedPricePortions
(List<MethodTaxedPrice> taxedPricePortions) Total taxed prices based on the quantity of the Custom Line Item assigned to each Shipping Method.void
setTaxRate
(TaxRate taxRate) For a Cart withPlatform
TaxMode, thetaxRate
of Custom Line Items is set automatically once a shipping address is set.void
setTotalPrice
(CentPrecisionMoney totalPrice) Total price of the Custom Line Item (money
multiplied byquantity
).static com.fasterxml.jackson.core.type.TypeReference<CustomLineItem>
gives a TypeReference for usage with Jackson DataBinddefault <T> T
withCustomLineItem
(Function<CustomLineItem, T> helper) accessor map functionMethods inherited from interface com.commercetools.api.models.Customizable
unwrapCustomizable
-
Method Details
-
getId
Unique identifier of the Custom Line Item.
- Returns:
- id
-
getKey
String getKey()User-defined unique identifier of the Custom Line Item.
- Returns:
- key
-
getName
Name of the Custom Line Item.
- Returns:
- name
-
getMoney
Money value of the Custom Line Item.
- Returns:
- money
-
getTaxedPrice
Automatically set after the
taxRate
is set.- Returns:
- taxedPrice
-
getTaxedPricePortions
Total taxed prices based on the quantity of the Custom Line Item assigned to each Shipping Method. Only applicable for Carts with
Multiple
ShippingMode. Automatically set afterperMethodTaxRate
is set.- Returns:
- taxedPricePortions
-
getTotalPrice
Total price of the Custom Line Item (
money
multiplied byquantity
). If the Custom Line Item is discounted, the total price isdiscountedPricePerQuantity
multiplied byquantity
.Includes taxes if the TaxRate
includedInPrice
istrue
.- Returns:
- totalPrice
-
getSlug
User-defined identifier used in a deep-link URL for the Custom Line Item. It matches the pattern
[a-zA-Z0-9_-]{2,256}
.- Returns:
- slug
-
getQuantity
Number of Custom Line Items in the Cart or Order.
- Returns:
- quantity
-
getState
State of the Custom Line Item in the Cart or Order.
- Returns:
- state
-
getTaxCategory
Used to select a Tax Rate when a Cart has the
Platform
TaxMode.- Returns:
- taxCategory
-
getTaxRate
- For a Cart with
Platform
TaxMode, thetaxRate
of Custom Line Items is set automatically once a shipping address is set. The rate is based on the TaxCategory that applies for the shipping address. - For a Cart with
External
TaxMode, thetaxRate
of Custom Line Items can be set using ExternalTaxRateDraft.
- Returns:
- taxRate
- For a Cart with
-
getPerMethodTaxRate
Tax Rate per Shipping Method for a Cart with
Multiple
ShippingMode. For a Cart withPlatform
TaxMode it is automatically set after the Shipping Method is added. For a Cart withExternal
TaxMode, the Tax Rate must be set with ExternalTaxRateDraft.- Returns:
- perMethodTaxRate
-
getDiscountedPricePerQuantity
@NotNull @Valid @NotNull @Valid List<DiscountedLineItemPriceForQuantity> getDiscountedPricePerQuantity()Discounted price of a single quantity of the Custom Line Item.
- Returns:
- discountedPricePerQuantity
-
getCustom
Custom Fields of the Custom Line Item.
- Specified by:
getCustom
in interfaceCustomizable<CustomLineItem>
- Returns:
- custom
-
getShippingDetails
Container for Custom Line Item-specific addresses.
- Returns:
- shippingDetails
-
getPriceMode
Indicates whether Cart Discounts with a matching CartDiscountCustomLineItemsTarget are applied to the Custom Line Item.
- Returns:
- priceMode
-
setId
Unique identifier of the Custom Line Item.
- Parameters:
id
- value to be set
-
setKey
User-defined unique identifier of the Custom Line Item.
- Parameters:
key
- value to be set
-
setName
Name of the Custom Line Item.
- Parameters:
name
- value to be set
-
setMoney
Money value of the Custom Line Item.
- Parameters:
money
- value to be set
-
setTaxedPrice
Automatically set after the
taxRate
is set.- Parameters:
taxedPrice
- value to be set
-
setTaxedPricePortions
Total taxed prices based on the quantity of the Custom Line Item assigned to each Shipping Method. Only applicable for Carts with
Multiple
ShippingMode. Automatically set afterperMethodTaxRate
is set.- Parameters:
taxedPricePortions
- values to be set
-
setTaxedPricePortions
Total taxed prices based on the quantity of the Custom Line Item assigned to each Shipping Method. Only applicable for Carts with
Multiple
ShippingMode. Automatically set afterperMethodTaxRate
is set.- Parameters:
taxedPricePortions
- values to be set
-
setTotalPrice
Total price of the Custom Line Item (
money
multiplied byquantity
). If the Custom Line Item is discounted, the total price isdiscountedPricePerQuantity
multiplied byquantity
.Includes taxes if the TaxRate
includedInPrice
istrue
.- Parameters:
totalPrice
- value to be set
-
setSlug
User-defined identifier used in a deep-link URL for the Custom Line Item. It matches the pattern
[a-zA-Z0-9_-]{2,256}
.- Parameters:
slug
- value to be set
-
setQuantity
Number of Custom Line Items in the Cart or Order.
- Parameters:
quantity
- value to be set
-
setState
State of the Custom Line Item in the Cart or Order.
- Parameters:
state
- values to be set
-
setState
State of the Custom Line Item in the Cart or Order.
- Parameters:
state
- values to be set
-
setTaxCategory
Used to select a Tax Rate when a Cart has the
Platform
TaxMode.- Parameters:
taxCategory
- value to be set
-
setTaxRate
- For a Cart with
Platform
TaxMode, thetaxRate
of Custom Line Items is set automatically once a shipping address is set. The rate is based on the TaxCategory that applies for the shipping address. - For a Cart with
External
TaxMode, thetaxRate
of Custom Line Items can be set using ExternalTaxRateDraft.
- Parameters:
taxRate
- value to be set
- For a Cart with
-
setPerMethodTaxRate
Tax Rate per Shipping Method for a Cart with
Multiple
ShippingMode. For a Cart withPlatform
TaxMode it is automatically set after the Shipping Method is added. For a Cart withExternal
TaxMode, the Tax Rate must be set with ExternalTaxRateDraft.- Parameters:
perMethodTaxRate
- values to be set
-
setPerMethodTaxRate
Tax Rate per Shipping Method for a Cart with
Multiple
ShippingMode. For a Cart withPlatform
TaxMode it is automatically set after the Shipping Method is added. For a Cart withExternal
TaxMode, the Tax Rate must be set with ExternalTaxRateDraft.- Parameters:
perMethodTaxRate
- values to be set
-
setDiscountedPricePerQuantity
void setDiscountedPricePerQuantity(DiscountedLineItemPriceForQuantity... discountedPricePerQuantity) Discounted price of a single quantity of the Custom Line Item.
- Parameters:
discountedPricePerQuantity
- values to be set
-
setDiscountedPricePerQuantity
void setDiscountedPricePerQuantity(List<DiscountedLineItemPriceForQuantity> discountedPricePerQuantity) Discounted price of a single quantity of the Custom Line Item.
- Parameters:
discountedPricePerQuantity
- values to be set
-
setCustom
Custom Fields of the Custom Line Item.
- Specified by:
setCustom
in interfaceCustomizable<CustomLineItem>
- Parameters:
custom
- value to be set
-
setShippingDetails
Container for Custom Line Item-specific addresses.
- Parameters:
shippingDetails
- value to be set
-
setPriceMode
Indicates whether Cart Discounts with a matching CartDiscountCustomLineItemsTarget are applied to the Custom Line Item.
- Parameters:
priceMode
- value to be set
-
of
factory method- Returns:
- instance of CustomLineItem
-
of
factory method to create a shallow copy CustomLineItem- Parameters:
template
- instance to be copied- Returns:
- copy instance
-
deepCopy
factory method to create a deep copy of CustomLineItem- Parameters:
template
- instance to be copied- Returns:
- copy instance
-
builder
builder factory method for CustomLineItem- Returns:
- builder
-
builder
create builder for CustomLineItem instance- Parameters:
template
- instance with prefilled values for the builder- Returns:
- builder
-
withCustomLineItem
accessor map function- Type Parameters:
T
- mapped type- Parameters:
helper
- function to map the object- Returns:
- mapped value
-
typeReference
gives a TypeReference for usage with Jackson DataBind- Returns:
- TypeReference
-