Interface Price
- All Superinterfaces:
Customizable<Price>
,WithKey
- All Known Implementing Classes:
PriceImpl
The representation for prices embedded in LineItems and in ProductVariants when the ProductPriceMode is Embedded
. For the Standalone
ProductPriceMode refer to StandalonePrice.
Example to create an instance using the builder pattern
Price price = Price.builder()
.id("{id}")
.value(valueBuilder -> valueBuilder)
.build()
-
Method Summary
Modifier and TypeMethodDescriptionstatic PriceBuilder
builder()
builder factory method for Pricestatic PriceBuilder
create builder for Price instancestatic Price
factory method to create a deep copy of Price@Valid ChannelReference
ProductDistribution
Channel for which this Price is valid.Country for which this Price is valid.@Valid CustomFields
Custom Fields defined for the Price.@Valid CustomerGroupReference
CustomerGroup for which this Price is valid.@Valid DiscountedPrice
Is set if a ProductDiscount has been applied.@NotNull String
getId()
Unique identifier of this Price.getKey()
User-defined identifier of the Price.getTiers()
Present if different Prices for certain LineItem quantities have been specified.Date and time from which this Price is valid.Date and time until this Price is valid.@NotNull @Valid TypedMoney
getValue()
Money value of this Price.static Price
of()
factory methodstatic Price
factory method to create a shallow copy Pricevoid
setChannel
(ChannelReference channel) ProductDistribution
Channel for which this Price is valid.void
setCountry
(String country) Country for which this Price is valid.void
setCustom
(CustomFields custom) Custom Fields defined for the Price.void
setCustomerGroup
(CustomerGroupReference customerGroup) CustomerGroup for which this Price is valid.void
setDiscounted
(DiscountedPrice discounted) Is set if a ProductDiscount has been applied.void
Unique identifier of this Price.void
User-defined identifier of the Price.void
Present if different Prices for certain LineItem quantities have been specified.void
Present if different Prices for certain LineItem quantities have been specified.void
setValidFrom
(ZonedDateTime validFrom) Date and time from which this Price is valid.void
setValidUntil
(ZonedDateTime validUntil) Date and time until this Price is valid.void
setValue
(TypedMoney value) Money value of this Price.static com.fasterxml.jackson.core.type.TypeReference<Price>
gives a TypeReference for usage with Jackson DataBinddefault <T> T
accessor map functionMethods inherited from interface com.commercetools.api.models.Customizable
unwrapCustomizable
-
Method Details
-
getId
Unique identifier of this Price.
- Returns:
- id
-
getKey
String getKey()User-defined identifier of the Price. It is unique per ProductVariant.
-
getValue
Money value of this Price.
- Returns:
- value
-
getCountry
String getCountry()Country for which this Price is valid.
- Returns:
- country
-
getCustomerGroup
CustomerGroup for which this Price is valid.
- Returns:
- customerGroup
-
getChannel
ProductDistribution
Channel for which this Price is valid.- Returns:
- channel
-
getValidFrom
ZonedDateTime getValidFrom()Date and time from which this Price is valid.
- Returns:
- validFrom
-
getValidUntil
ZonedDateTime getValidUntil()Date and time until this Price is valid. Prices that are no longer valid are not automatically removed, but they can be removed if necessary.
- Returns:
- validUntil
-
getDiscounted
Is set if a ProductDiscount has been applied. If set, the API uses the DiscountedPrice value for the Line Item Price selection. When a relative discount has been applied and the fraction part of the DiscountedPrice
value
is 0.5, thevalue
is rounded in favor of the customer with half-down rounding.- Returns:
- discounted
-
getTiers
Present if different Prices for certain LineItem quantities have been specified.
- Returns:
- tiers
-
getCustom
Custom Fields defined for the Price.
- Specified by:
getCustom
in interfaceCustomizable<Price>
- Returns:
- custom
-
setId
Unique identifier of this Price.
- Parameters:
id
- value to be set
-
setKey
User-defined identifier of the Price. It is unique per ProductVariant.
- Parameters:
key
- value to be set
-
setValue
Money value of this Price.
- Parameters:
value
- value to be set
-
setCountry
Country for which this Price is valid.
- Parameters:
country
- value to be set
-
setCustomerGroup
CustomerGroup for which this Price is valid.
- Parameters:
customerGroup
- value to be set
-
setChannel
ProductDistribution
Channel for which this Price is valid.- Parameters:
channel
- value to be set
-
setValidFrom
Date and time from which this Price is valid.
- Parameters:
validFrom
- value to be set
-
setValidUntil
Date and time until this Price is valid. Prices that are no longer valid are not automatically removed, but they can be removed if necessary.
- Parameters:
validUntil
- value to be set
-
setDiscounted
Is set if a ProductDiscount has been applied. If set, the API uses the DiscountedPrice value for the Line Item Price selection. When a relative discount has been applied and the fraction part of the DiscountedPrice
value
is 0.5, thevalue
is rounded in favor of the customer with half-down rounding.- Parameters:
discounted
- value to be set
-
setTiers
Present if different Prices for certain LineItem quantities have been specified.
- Parameters:
tiers
- values to be set
-
setTiers
Present if different Prices for certain LineItem quantities have been specified.
- Parameters:
tiers
- values to be set
-
setCustom
Custom Fields defined for the Price.
- Specified by:
setCustom
in interfaceCustomizable<Price>
- Parameters:
custom
- value to be set
-
of
factory method- Returns:
- instance of Price
-
of
factory method to create a shallow copy Price- Parameters:
template
- instance to be copied- Returns:
- copy instance
-
deepCopy
factory method to create a deep copy of Price- Parameters:
template
- instance to be copied- Returns:
- copy instance
-
builder
builder factory method for Price- Returns:
- builder
-
builder
create builder for Price instance- Parameters:
template
- instance with prefilled values for the builder- Returns:
- builder
-
withPrice
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
-