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 PriceDraftBuilderbuilder()builder factory method for PriceDraftstatic PriceDraftBuilderbuilder(PriceDraft template) create builder for PriceDraft instancecopyDeep()static PriceDraftdeepCopy(PriceDraft template) factory method to create a deep copy of PriceDraft@Valid ChannelResourceIdentifierSet this field if this Price is only valid for the referencedProductDistributionChannel.Set this field if this Price is only valid for the specified country.@Valid CustomFieldsDraftCustom Fields for the Price.Set this field if this Price is only valid for the referenced CustomerGroup.@Valid DiscountedPriceDraftSet this field to add a DiscountedPrice from an external service.getKey()User-defined identifier for the Price.RecurrencePolicy for which this Price is valid.@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 MoneygetValue()Money value of this Price.static PriceDraftof()factory methodstatic PriceDraftof(PriceDraft template) factory method to create a shallow copy PriceDraftvoidsetChannel(ChannelResourceIdentifier channel) Set this field if this Price is only valid for the referencedProductDistributionChannel.voidsetCountry(String country) Set this field if this Price is only valid for the specified country.voidsetCustom(CustomFieldsDraft custom) Custom Fields for the Price.voidsetCustomerGroup(CustomerGroupResourceIdentifier customerGroup) Set this field if this Price is only valid for the referenced CustomerGroup.voidsetDiscounted(DiscountedPriceDraft discounted) Set this field to add a DiscountedPrice from an external service.voidUser-defined identifier for the Price.voidsetRecurrencePolicy(RecurrencePolicyResourceIdentifier recurrencePolicy) RecurrencePolicy for which this Price is valid.voidsetTiers(PriceTierDraft... tiers) Set this field to specify different Prices for certain LineItem quantities.voidsetTiers(List<PriceTierDraft> tiers) Set this field to specify different Prices for certain LineItem quantities.voidsetValidFrom(ZonedDateTime validFrom) Set this field if this Price is only valid from the specified date and time.voidsetValidUntil(ZonedDateTime validUntil) Set this field if this Price is only valid until the specified date and time.voidMoney value of this Price.static com.fasterxml.jackson.core.type.TypeReference<PriceDraft>gives a TypeReference for usage with Jackson DataBinddefault <T> TwithPriceDraft(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
ProductDistributionChannel.- 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
isActiveflag set totrue. - A ProductDiscountValue of type
external. - A
predicatethat matches the ProductVariant the Price is referenced from.
- Returns:
- discounted
- The
-
getTiers
Set this field to specify different Prices for certain LineItem quantities.
If
discountedis set, the tiered Price is ignored for a Product Variant.- Returns:
- tiers
-
getCustom
Custom Fields for the Price.
- Specified by:
getCustomin interfaceCustomizableDraft<PriceDraft>- Returns:
- custom
-
getRecurrencePolicy
RecurrencePolicy for which this Price is valid.
- Returns:
- recurrencePolicy
-
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
ProductDistributionChannel.- 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
isActiveflag set totrue. - A ProductDiscountValue of type
external. - A
predicatethat 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
discountedis 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
discountedis set, the tiered Price is ignored for a Product Variant.- Parameters:
tiers- values to be set
-
setCustom
Custom Fields for the Price.
- Specified by:
setCustomin interfaceCustomizableDraft<PriceDraft>- Parameters:
custom- value to be set
-
setRecurrencePolicy
RecurrencePolicy for which this Price is valid.
- Parameters:
recurrencePolicy- 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
-
copyDeep
PriceDraft copyDeep() -
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
-