Interface Price
- All Superinterfaces:
Customizable<Price>,WithKey
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 PriceBuilderbuilder()builder factory method for Pricestatic PriceBuildercreate builder for Price instancecopyDeep()static Pricefactory method to create a deep copy of Price@Valid ChannelReferenceProductDistributionChannel for which this Price is valid.Country for which this Price is valid.@Valid CustomFieldsCustom Fields defined for the Price.@Valid CustomerGroupReferenceCustomerGroup for which this Price is valid.@Valid DiscountedPriceIs set if a ProductDiscount has been applied.@NotNull StringgetId()Unique identifier of this Price.getKey()User-defined identifier of the Price.@Valid RecurrencePolicyReferenceRecurrence Policy for which this Price is valid.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 TypedMoneygetValue()Money value of this Price.static Priceof()factory methodstatic Pricefactory method to create a shallow copy PricevoidsetChannel(ChannelReference channel) ProductDistributionChannel for which this Price is valid.voidsetCountry(String country) Country for which this Price is valid.voidsetCustom(CustomFields custom) Custom Fields defined for the Price.voidsetCustomerGroup(CustomerGroupReference customerGroup) CustomerGroup for which this Price is valid.voidsetDiscounted(DiscountedPrice discounted) Is set if a ProductDiscount has been applied.voidUnique identifier of this Price.voidUser-defined identifier of the Price.voidsetRecurrencePolicy(RecurrencePolicyReference recurrencePolicy) Recurrence Policy for which this Price is valid.voidPresent if different Prices for certain LineItem quantities have been specified.voidPresent if different Prices for certain LineItem quantities have been specified.voidsetValidFrom(ZonedDateTime validFrom) Date and time from which this Price is valid.voidsetValidUntil(ZonedDateTime validUntil) Date and time until this Price is valid.voidsetValue(TypedMoney value) Money value of this Price.static com.fasterxml.jackson.core.type.TypeReference<Price>gives a TypeReference for usage with Jackson DataBinddefault <T> Taccessor 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
ProductDistributionChannel 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
valueis 0.5, thevalueis rounded in favor of the customer with half-down rounding.If an absolute discount value exceeds the price of the Product Variant, the discounted price is a negative value.
- Returns:
- discounted
-
getTiers
Present if different Prices for certain LineItem quantities have been specified.
If
discountedis present, the tiered Price is ignored for a Product Variant.- Returns:
- tiers
-
getCustom
Custom Fields defined for the Price.
- Specified by:
getCustomin interfaceCustomizable<Price>- Returns:
- custom
-
getRecurrencePolicy
Recurrence Policy for which this Price is valid.
- Returns:
- recurrencePolicy
-
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
ProductDistributionChannel 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
valueis 0.5, thevalueis rounded in favor of the customer with half-down rounding.If an absolute discount value exceeds the price of the Product Variant, the discounted price is a negative value.
- Parameters:
discounted- value to be set
-
setTiers
Present if different Prices for certain LineItem quantities have been specified.
If
discountedis present, the tiered Price is ignored for a Product Variant.- Parameters:
tiers- values to be set
-
setTiers
Present if different Prices for certain LineItem quantities have been specified.
If
discountedis present, the tiered Price is ignored for a Product Variant.- Parameters:
tiers- values to be set
-
setCustom
Custom Fields defined for the Price.
- Specified by:
setCustomin interfaceCustomizable<Price>- Parameters:
custom- value to be set
-
setRecurrencePolicy
Recurrence Policy for which this Price is valid.
- Parameters:
recurrencePolicy- 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
-
copyDeep
Price copyDeep() -
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
-