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 CustomLineItemBuilderbuilder()builder factory method for CustomLineItemstatic CustomLineItemBuilderbuilder(CustomLineItem template) create builder for CustomLineItem instancecopyDeep()static CustomLineItemdeepCopy(CustomLineItem template) factory method to create a deep copy of CustomLineItem@Valid CustomFieldsCustom Fields of the Custom Line Item.@NotNull @Valid List<DiscountedLineItemPriceForQuantity>Discounted price of a single quantity of the Custom Line Item.@NotNull StringgetId()Unique identifier of the Custom Line Item.getKey()User-defined unique identifier of the Custom Line Item.@NotNull @Valid TypedMoneygetMoney()Money value of the Custom Line Item.@NotNull @Valid LocalizedStringgetName()Name of the Custom Line Item.@NotNull @Valid List<MethodTaxRate>Tax Rate per Shipping Method for a Cart withMultipleShippingMode.@NotNull CustomLineItemPriceModeIndicates whether Cart Discounts with a matching CartDiscountCustomLineItemsTarget, MultiBuyCustomLineItemsTarget, or CartDiscountPatternTarget are applied to the Custom Line Item.@NotNull Long@Valid CustomLineItemRecurrenceInfoRecurring Order and frequency data.@Valid ItemShippingDetailsContainer for Custom Line Item-specific addresses.@NotNull StringgetSlug()User-defined identifier used in a deep-link URL for the Custom Line Item.getState()Tracks specific quantities of the Custom Line Item within a given State.@Valid TaxCategoryReferenceUsed to select a Tax Rate when a Cart has thePlatformTaxMode.@Valid TaxedItemPriceAutomatically set after thetaxRateis set.@NotNull @Valid List<MethodTaxedPrice>Total taxed prices based on the quantity of the Custom Line Item assigned to each Shipping Method.@Valid TaxRateFor a Cart withPlatformTaxMode, thetaxRateof Custom Line Items is set automatically once a shipping address is set.@NotNull @Valid CentPrecisionMoneyTotal price of the Custom Line Item (moneymultiplied byquantity).static CustomLineItemof()factory methodstatic CustomLineItemof(CustomLineItem template) factory method to create a shallow copy CustomLineItemvoidsetCustom(CustomFields custom) Custom Fields of the Custom Line Item.voidsetDiscountedPricePerQuantity(DiscountedLineItemPriceForQuantity... discountedPricePerQuantity) Discounted price of a single quantity of the Custom Line Item.voidsetDiscountedPricePerQuantity(List<DiscountedLineItemPriceForQuantity> discountedPricePerQuantity) Discounted price of a single quantity of the Custom Line Item.voidUnique identifier of the Custom Line Item.voidUser-defined unique identifier of the Custom Line Item.voidsetMoney(TypedMoney money) Money value of the Custom Line Item.voidsetName(LocalizedString name) Name of the Custom Line Item.voidsetPerMethodTaxRate(MethodTaxRate... perMethodTaxRate) Tax Rate per Shipping Method for a Cart withMultipleShippingMode.voidsetPerMethodTaxRate(List<MethodTaxRate> perMethodTaxRate) Tax Rate per Shipping Method for a Cart withMultipleShippingMode.voidsetPriceMode(CustomLineItemPriceMode priceMode) Indicates whether Cart Discounts with a matching CartDiscountCustomLineItemsTarget, MultiBuyCustomLineItemsTarget, or CartDiscountPatternTarget are applied to the Custom Line Item.voidsetQuantity(Long quantity) voidsetRecurrenceInfo(CustomLineItemRecurrenceInfo recurrenceInfo) Recurring Order and frequency data.voidsetShippingDetails(ItemShippingDetails shippingDetails) Container for Custom Line Item-specific addresses.voidUser-defined identifier used in a deep-link URL for the Custom Line Item.voidTracks specific quantities of the Custom Line Item within a given State.voidTracks specific quantities of the Custom Line Item within a given State.voidsetTaxCategory(TaxCategoryReference taxCategory) Used to select a Tax Rate when a Cart has thePlatformTaxMode.voidsetTaxedPrice(TaxedItemPrice taxedPrice) Automatically set after thetaxRateis set.voidsetTaxedPricePortions(MethodTaxedPrice... taxedPricePortions) Total taxed prices based on the quantity of the Custom Line Item assigned to each Shipping Method.voidsetTaxedPricePortions(List<MethodTaxedPrice> taxedPricePortions) Total taxed prices based on the quantity of the Custom Line Item assigned to each Shipping Method.voidsetTaxRate(TaxRate taxRate) For a Cart withPlatformTaxMode, thetaxRateof Custom Line Items is set automatically once a shipping address is set.voidsetTotalPrice(CentPrecisionMoney totalPrice) Total price of the Custom Line Item (moneymultiplied byquantity).static com.fasterxml.jackson.core.type.TypeReference<CustomLineItem>gives a TypeReference for usage with Jackson DataBinddefault <T> TwithCustomLineItem(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
taxRateis 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
MultipleShippingMode. Automatically set afterperMethodTaxRateis set.- Returns:
- taxedPricePortions
-
getTotalPrice
Total price of the Custom Line Item (
moneymultiplied byquantity). If the Custom Line Item is discounted, the total price isdiscountedPricePerQuantitymultiplied byquantity.Includes taxes if the TaxRate
includedInPriceistrue.- 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
- Returns:
- quantity
-
getState
Tracks specific quantities of the Custom Line Item within a given State. When a Custom Line Item is added to a Cart, its full quantity is set to the built-in "Initial" state. State transitions for Custom Line Items are managed on the Order.
- Returns:
- state
-
getTaxCategory
Used to select a Tax Rate when a Cart has the
PlatformTaxMode.- Returns:
- taxCategory
-
getTaxRate
- For a Cart with
PlatformTaxMode, thetaxRateof 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
ExternalTaxMode, thetaxRateof Custom Line Items can be set using ExternalTaxRateDraft.
- Returns:
- taxRate
- For a Cart with
-
getPerMethodTaxRate
Tax Rate per Shipping Method for a Cart with
MultipleShippingMode. For a Cart withPlatformTaxMode it is automatically set after the Shipping Method is added. For a Cart withExternalTaxMode, 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:
getCustomin interfaceCustomizable<CustomLineItem>- Returns:
- custom
-
getShippingDetails
Container for Custom Line Item-specific addresses.
- Returns:
- shippingDetails
-
getPriceMode
Indicates whether Cart Discounts with a matching CartDiscountCustomLineItemsTarget, MultiBuyCustomLineItemsTarget, or CartDiscountPatternTarget are applied to the Custom Line Item.
- Returns:
- priceMode
-
getRecurrenceInfo
Recurring Order and frequency data.
- Returns:
- recurrenceInfo
-
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
taxRateis 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
MultipleShippingMode. Automatically set afterperMethodTaxRateis 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
MultipleShippingMode. Automatically set afterperMethodTaxRateis set.- Parameters:
taxedPricePortions- values to be set
-
setTotalPrice
Total price of the Custom Line Item (
moneymultiplied byquantity). If the Custom Line Item is discounted, the total price isdiscountedPricePerQuantitymultiplied byquantity.Includes taxes if the TaxRate
includedInPriceistrue.- 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
- Parameters:
quantity- value to be set
-
setState
Tracks specific quantities of the Custom Line Item within a given State. When a Custom Line Item is added to a Cart, its full quantity is set to the built-in "Initial" state. State transitions for Custom Line Items are managed on the Order.
- Parameters:
state- values to be set
-
setState
Tracks specific quantities of the Custom Line Item within a given State. When a Custom Line Item is added to a Cart, its full quantity is set to the built-in "Initial" state. State transitions for Custom Line Items are managed on the Order.
- Parameters:
state- values to be set
-
setTaxCategory
Used to select a Tax Rate when a Cart has the
PlatformTaxMode.- Parameters:
taxCategory- value to be set
-
setTaxRate
- For a Cart with
PlatformTaxMode, thetaxRateof 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
ExternalTaxMode, thetaxRateof 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
MultipleShippingMode. For a Cart withPlatformTaxMode it is automatically set after the Shipping Method is added. For a Cart withExternalTaxMode, the Tax Rate must be set with ExternalTaxRateDraft.- Parameters:
perMethodTaxRate- values to be set
-
setPerMethodTaxRate
Tax Rate per Shipping Method for a Cart with
MultipleShippingMode. For a Cart withPlatformTaxMode it is automatically set after the Shipping Method is added. For a Cart withExternalTaxMode, 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:
setCustomin 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, MultiBuyCustomLineItemsTarget, or CartDiscountPatternTarget are applied to the Custom Line Item.
- Parameters:
priceMode- value to be set
-
setRecurrenceInfo
Recurring Order and frequency data.
- Parameters:
recurrenceInfo- 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
-
copyDeep
CustomLineItem copyDeep() -
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
-