Class PriceDraftBuilder
- All Implemented Interfaces:
Builder<PriceDraft>
Example to create an instance using the builder pattern
PriceDraft priceDraft = PriceDraft.builder()
.value(valueBuilder -> valueBuilder)
.build()
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddTiers
(Function<PriceTierDraftBuilder, PriceTierDraft> builder) Set this field to specify different Prices for certain LineItem quantities.build()
builds PriceDraft with checking for non-null required valuesbuilds PriceDraft without checking for non-null required valueschannel
(ChannelResourceIdentifier channel) Set this field if this Price is only valid for the referencedProductDistribution
Channel.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.custom
(CustomFieldsDraft custom) Custom Fields for the Price.Custom Fields for the Price.customerGroup
(CustomerGroupResourceIdentifier customerGroup) Set this field if this Price is only valid for the referenced CustomerGroup.customerGroup
(Function<CustomerGroupResourceIdentifierBuilder, CustomerGroupResourceIdentifierBuilder> builder) Set this field if this Price is only valid for the referenced CustomerGroup.discounted
(DiscountedPriceDraft discounted) Set this field to add a DiscountedPrice from an external service.Set this field to add a DiscountedPrice from an external service.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.Custom Fields for the Price.Set this field if this Price is only valid for the referenced CustomerGroup.Set this field to add a DiscountedPrice from an external service.getKey()
User-defined identifier for the Price.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.getValue()
Money value of this Price.User-defined identifier for the Price.static PriceDraftBuilder
of()
factory method for an instance of PriceDraftBuilderstatic PriceDraftBuilder
of
(PriceDraft template) create builder for PriceDraft instanceplusTiers
(PriceTierDraft... tiers) Set this field to specify different Prices for certain LineItem quantities.Set this field to specify different Prices for certain LineItem quantities.setTiers
(Function<PriceTierDraftBuilder, PriceTierDraft> builder) Set this field to specify different Prices for certain LineItem quantities.tiers
(PriceTierDraft... tiers) Set this field to specify different Prices for certain LineItem quantities.tiers
(List<PriceTierDraft> tiers) Set this field to specify different Prices for certain LineItem quantities.validFrom
(ZonedDateTime validFrom) Set this field if this Price is only valid from the specified date and time.validUntil
(ZonedDateTime validUntil) Set this field if this Price is only valid until the specified date and time.Money value of this Price.value
(Function<MoneyBuilder, MoneyBuilder> builder) Money value of this Price.Set this field if this Price is only valid for the referencedProductDistribution
Channel.Custom Fields for the Price.withCustomerGroup
(Function<CustomerGroupResourceIdentifierBuilder, CustomerGroupResourceIdentifier> builder) Set this field if this Price is only valid for the referenced CustomerGroup.Set this field to add a DiscountedPrice from an external service.Set this field to specify different Prices for certain LineItem quantities.withValue
(Function<MoneyBuilder, Money> builder) Money value of this Price.
-
Constructor Details
-
PriceDraftBuilder
public PriceDraftBuilder()
-
-
Method Details
-
key
User-defined identifier for the Price. It must be unique per ProductVariant.
- Parameters:
key
- value to be set- Returns:
- Builder
-
value
Money value of this Price.
- Parameters:
builder
- function to build the value value- Returns:
- Builder
-
withValue
Money value of this Price.
- Parameters:
builder
- function to build the value value- Returns:
- Builder
-
value
Money value of this Price.
- Parameters:
value
- value to be set- Returns:
- Builder
-
country
Set this field if this Price is only valid for the specified country.
- Parameters:
country
- value to be set- Returns:
- Builder
-
customerGroup
public PriceDraftBuilder customerGroup(Function<CustomerGroupResourceIdentifierBuilder, CustomerGroupResourceIdentifierBuilder> builder) Set this field if this Price is only valid for the referenced CustomerGroup.
- Parameters:
builder
- function to build the customerGroup value- Returns:
- Builder
-
withCustomerGroup
public PriceDraftBuilder withCustomerGroup(Function<CustomerGroupResourceIdentifierBuilder, CustomerGroupResourceIdentifier> builder) Set this field if this Price is only valid for the referenced CustomerGroup.
- Parameters:
builder
- function to build the customerGroup value- Returns:
- Builder
-
customerGroup
Set this field if this Price is only valid for the referenced CustomerGroup.
- Parameters:
customerGroup
- value to be set- Returns:
- Builder
-
channel
public PriceDraftBuilder channel(Function<ChannelResourceIdentifierBuilder, ChannelResourceIdentifierBuilder> builder) Set this field if this Price is only valid for the referenced
ProductDistribution
Channel.- Parameters:
builder
- function to build the channel value- Returns:
- Builder
-
withChannel
public PriceDraftBuilder withChannel(Function<ChannelResourceIdentifierBuilder, ChannelResourceIdentifier> builder) Set this field if this Price is only valid for the referenced
ProductDistribution
Channel.- Parameters:
builder
- function to build the channel value- Returns:
- Builder
-
channel
Set this field if this Price is only valid for the referenced
ProductDistribution
Channel.- Parameters:
channel
- value to be set- Returns:
- Builder
-
validFrom
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- Returns:
- Builder
-
validUntil
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- Returns:
- Builder
-
discounted
public PriceDraftBuilder discounted(Function<DiscountedPriceDraftBuilder, DiscountedPriceDraftBuilder> builder) 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:
builder
- function to build the discounted value- Returns:
- Builder
- The
-
withDiscounted
public PriceDraftBuilder withDiscounted(Function<DiscountedPriceDraftBuilder, DiscountedPriceDraft> builder) 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:
builder
- function to build the discounted value- Returns:
- Builder
- The
-
discounted
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- Returns:
- Builder
- The
-
tiers
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
- value to be set- Returns:
- Builder
-
tiers
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
- value to be set- Returns:
- Builder
-
plusTiers
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
- value to be set- Returns:
- Builder
-
plusTiers
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:
builder
- function to build the tiers value- Returns:
- Builder
-
withTiers
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:
builder
- function to build the tiers value- Returns:
- Builder
-
addTiers
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:
builder
- function to build the tiers value- Returns:
- Builder
-
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:
builder
- function to build the tiers value- Returns:
- Builder
-
custom
public PriceDraftBuilder custom(Function<CustomFieldsDraftBuilder, CustomFieldsDraftBuilder> builder) Custom Fields for the Price.
- Parameters:
builder
- function to build the custom value- Returns:
- Builder
-
withCustom
Custom Fields for the Price.
- Parameters:
builder
- function to build the custom value- Returns:
- Builder
-
custom
Custom Fields for the Price.
- Parameters:
custom
- value to be set- Returns:
- Builder
-
getKey
User-defined identifier for the Price. It must be unique per ProductVariant.
- Returns:
- key
-
getValue
Money value of this Price.
- Returns:
- value
-
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
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
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.
- Returns:
- custom
-
build
builds PriceDraft with checking for non-null required values- Specified by:
build
in interfaceBuilder<PriceDraft>
- Returns:
- PriceDraft
-
buildUnchecked
builds PriceDraft without checking for non-null required values- Returns:
- PriceDraft
-
of
factory method for an instance of PriceDraftBuilder- Returns:
- builder
-
of
create builder for PriceDraft instance- Parameters:
template
- instance with prefilled values for the builder- Returns:
- builder
-