Interface PriceTier
A Price tier is selected instead of the default Price when a certain quantity of the ProductVariant is added to a Cart and ordered. For example: the Price can be lower if more than 10 items are ordered. If no Price tier is found for the Order quantity, the base Price is used. A Price tier is applied for the entire quantity of a Product Variant put as LineItem in a Cart as soon as the minimum quantity for the Price tier is reached. The Price tier is applied per Line Item of the Product Variant. If, for example, the same Product Variant appears in the same Cart as several Line Items, (what can be achieved by different values of a Custom Field on the Line Items) for each Line Item the minimum quantity must be reached to get the Price tier.
Example to create an instance using the builder pattern
PriceTier priceTier = PriceTier.builder()
.minimumQuantity(0.3)
.value(valueBuilder -> valueBuilder)
.build()
-
Method Summary
Modifier and TypeMethodDescriptionstatic PriceTierBuilder
builder()
builder factory method for PriceTierstatic PriceTierBuilder
create builder for PriceTier instancestatic PriceTier
factory method to create a deep copy of PriceTier@NotNull Long
Minimum quantity this Price tier is valid for.@NotNull @Valid TypedMoney
getValue()
Money value that applies when theminimumQuantity
is greater than or equal to the LineItemquantity
.static PriceTier
of()
factory methodstatic PriceTier
factory method to create a shallow copy PriceTiervoid
setMinimumQuantity
(Long minimumQuantity) Minimum quantity this Price tier is valid for.void
setValue
(TypedMoney value) Money value that applies when theminimumQuantity
is greater than or equal to the LineItemquantity
.static com.fasterxml.jackson.core.type.TypeReference<PriceTier>
gives a TypeReference for usage with Jackson DataBinddefault <T> T
withPriceTier
(Function<PriceTier, T> helper) accessor map function
-
Method Details
-
getMinimumQuantity
Minimum quantity this Price tier is valid for.
The minimum quantity is always greater than or equal to 2. The base Price is interpreted as valid for a minimum quantity equal to 1. A Price or StandalonePrice cannot contain more than one tier with the same
minimumQuantity
.- Returns:
- minimumQuantity
-
getValue
Money value that applies when the
minimumQuantity
is greater than or equal to the LineItemquantity
.The
currencyCode
of a Price tier is always the same as thecurrencyCode
in thevalue
of the related Price.- Returns:
- value
-
setMinimumQuantity
Minimum quantity this Price tier is valid for.
The minimum quantity is always greater than or equal to 2. The base Price is interpreted as valid for a minimum quantity equal to 1. A Price or StandalonePrice cannot contain more than one tier with the same
minimumQuantity
.- Parameters:
minimumQuantity
- value to be set
-
setValue
Money value that applies when the
minimumQuantity
is greater than or equal to the LineItemquantity
.The
currencyCode
of a Price tier is always the same as thecurrencyCode
in thevalue
of the related Price.- Parameters:
value
- value to be set
-
of
factory method- Returns:
- instance of PriceTier
-
of
factory method to create a shallow copy PriceTier- Parameters:
template
- instance to be copied- Returns:
- copy instance
-
deepCopy
factory method to create a deep copy of PriceTier- Parameters:
template
- instance to be copied- Returns:
- copy instance
-
builder
builder factory method for PriceTier- Returns:
- builder
-
builder
create builder for PriceTier instance- Parameters:
template
- instance with prefilled values for the builder- Returns:
- builder
-
withPriceTier
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
-