Interface PriceDraft
- All Superinterfaces:
CustomizableDraft<PriceDraft>
,Draft<PriceDraft>
,WithKey
The draft representation for prices to be embedded into ProductVariantDrafts when the ProductPriceMode is Embedded
. For the Standalone
ProductPriceMode use StandalonePriceDraft.
Example to create an instance using the builder pattern
PriceDraft priceDraft = PriceDraft.builder()
.value(valueBuilder -> valueBuilder)
.build()
-
Method Summary
Modifier and TypeMethodDescriptionstatic PriceDraftBuilder
builder()
builder factory method for PriceDraftstatic PriceDraftBuilder
builder
(PriceDraft template) create builder for PriceDraft instancestatic PriceDraft
deepCopy
(PriceDraft template) factory method to create a deep copy of PriceDraft@Valid ChannelResourceIdentifier
Set this field if this Price is only valid for the referencedProductDistribution
Channel.Set this field if this Price is only valid for the specified country.@Valid CustomFieldsDraft
Custom Fields for the Price.Set this field if this Price is only valid for the referenced CustomerGroup.@Valid DiscountedPriceDraft
Set this field to add a DiscountedPrice from an external service.getKey()
User-defined identifier for the Price.@Valid List<PriceTierDraft>
getTiers()
Set this field to specify different Prices for certain LineItem quantities.Set this field if this Price is only valid from the specified date and time.Set this field if this Price is only valid until the specified date and time.@NotNull @Valid Money
getValue()
Money value of this Price.static PriceDraft
of()
factory methodstatic PriceDraft
of
(PriceDraft template) factory method to create a shallow copy PriceDraftvoid
setChannel
(ChannelResourceIdentifier channel) Set this field if this Price is only valid for the referencedProductDistribution
Channel.void
setCountry
(String country) Set this field if this Price is only valid for the specified country.void
setCustom
(CustomFieldsDraft custom) Custom Fields for the Price.void
setCustomerGroup
(CustomerGroupResourceIdentifier customerGroup) Set this field if this Price is only valid for the referenced CustomerGroup.void
setDiscounted
(DiscountedPriceDraft discounted) Set this field to add a DiscountedPrice from an external service.void
User-defined identifier for the Price.void
setTiers
(PriceTierDraft... tiers) Set this field to specify different Prices for certain LineItem quantities.void
setTiers
(List<PriceTierDraft> tiers) Set this field to specify different Prices for certain LineItem quantities.void
setValidFrom
(ZonedDateTime validFrom) Set this field if this Price is only valid from the specified date and time.void
setValidUntil
(ZonedDateTime validUntil) Set this field if this Price is only valid until the specified date and time.void
Money value of this Price.static com.fasterxml.jackson.core.type.TypeReference<PriceDraft>
gives a TypeReference for usage with Jackson DataBinddefault <T> T
withPriceDraft
(Function<PriceDraft, T> helper) accessor map functionMethods inherited from interface com.commercetools.api.models.CustomizableDraft
unwrapCustomizableDraft
-
Method Details
-
getKey
String getKey()User-defined identifier for the Price. It must be unique per ProductVariant.
-
getValue
Money value of this Price.
To set the money value in high precision, use HighPrecisionMoneyDraft.
- Returns:
- value
-
getCountry
String getCountry()Set this field if this Price is only valid for the specified country.
- Returns:
- country
-
getCustomerGroup
Set this field if this Price is only valid for the referenced CustomerGroup.
- Returns:
- customerGroup
-
getChannel
Set this field if this Price is only valid for the referenced
ProductDistribution
Channel.- Returns:
- channel
-
getValidFrom
ZonedDateTime getValidFrom()Set this field if this Price is only valid from the specified date and time. Must be at least 1 ms earlier than
validUntil
.- Returns:
- validFrom
-
getValidUntil
ZonedDateTime getValidUntil()Set this field if this Price is only valid until the specified date and time. Must be at least 1 ms later than
validFrom
. Prices that are no longer valid are not automatically removed, but they can be removed if necessary.- Returns:
- validUntil
-
getDiscounted
Set this field to add a DiscountedPrice from an external service.
Otherwise, Composable Commerce sets this field automatically if at least one ProductDiscount applies. The DiscountedPrice must reference a ProductDiscount with:
- The
isActive
flag set totrue
. - A ProductDiscountValue of type
external
. - A
predicate
that matches the ProductVariant the Price is referenced from.
- Returns:
- discounted
- The
-
getTiers
Set this field to specify different Prices for certain LineItem quantities.
If
discounted
is set, the tiered Price is ignored for a Product Variant.- Returns:
- tiers
-
getCustom
Custom Fields for the Price.
- Specified by:
getCustom
in interfaceCustomizableDraft<PriceDraft>
- Returns:
- custom
-
setKey
User-defined identifier for the Price. It must be unique per ProductVariant.
- Parameters:
key
- value to be set
-
setValue
Money value of this Price.
To set the money value in high precision, use HighPrecisionMoneyDraft.
- Parameters:
value
- value to be set
-
setCountry
Set this field if this Price is only valid for the specified country.
- Parameters:
country
- value to be set
-
setCustomerGroup
Set this field if this Price is only valid for the referenced CustomerGroup.
- Parameters:
customerGroup
- value to be set
-
setChannel
Set this field if this Price is only valid for the referenced
ProductDistribution
Channel.- Parameters:
channel
- value to be set
-
setValidFrom
Set this field if this Price is only valid from the specified date and time. Must be at least 1 ms earlier than
validUntil
.- Parameters:
validFrom
- value to be set
-
setValidUntil
Set this field if this Price is only valid until the specified date and time. Must be at least 1 ms later than
validFrom
. Prices that are no longer valid are not automatically removed, but they can be removed if necessary.- Parameters:
validUntil
- value to be set
-
setDiscounted
Set this field to add a DiscountedPrice from an external service.
Otherwise, Composable Commerce sets this field automatically if at least one ProductDiscount applies. The DiscountedPrice must reference a ProductDiscount with:
- The
isActive
flag set totrue
. - A ProductDiscountValue of type
external
. - A
predicate
that matches the ProductVariant the Price is referenced from.
- Parameters:
discounted
- value to be set
- The
-
setTiers
Set this field to specify different Prices for certain LineItem quantities.
If
discounted
is set, the tiered Price is ignored for a Product Variant.- Parameters:
tiers
- values to be set
-
setTiers
Set this field to specify different Prices for certain LineItem quantities.
If
discounted
is set, the tiered Price is ignored for a Product Variant.- Parameters:
tiers
- values to be set
-
setCustom
Custom Fields for the Price.
- Specified by:
setCustom
in interfaceCustomizableDraft<PriceDraft>
- Parameters:
custom
- value to be set
-
of
factory method- Returns:
- instance of PriceDraft
-
of
factory method to create a shallow copy PriceDraft- Parameters:
template
- instance to be copied- Returns:
- copy instance
-
deepCopy
factory method to create a deep copy of PriceDraft- Parameters:
template
- instance to be copied- Returns:
- copy instance
-
builder
builder factory method for PriceDraft- Returns:
- builder
-
builder
create builder for PriceDraft instance- Parameters:
template
- instance with prefilled values for the builder- Returns:
- builder
-
withPriceDraft
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
-