Class CartDiscountDraftBuilder
- All Implemented Interfaces:
Builder<CartDiscountDraft>
Example to create an instance using the builder pattern
CartDiscountDraft cartDiscountDraft = CartDiscountDraft.builder()
.name(nameBuilder -> nameBuilder)
.value(valueBuilder -> valueBuilder)
.cartPredicate("{cartPredicate}")
.sortOrder("{sortOrder}")
.build()
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionIf defined, the Cart Discount applies on Carts having a Store matching any Store defined for this field. If not defined, the Cart Discount applies on all Carts, irrespective of a Store.build()
builds CartDiscountDraft with checking for non-null required valuesbuilds CartDiscountDraft without checking for non-null required valuescartPredicate
(String cartPredicate) Valid Cart Predicate.custom
(CustomFieldsDraft custom) Custom Fields of the CartDiscount.Custom Fields of the CartDiscount.description
(LocalizedString description) Description of the CartDiscount.Description of the CartDiscount.Valid Cart Predicate.Custom Fields of the CartDiscount.Description of the CartDiscount.Only active Discounts can be applied to the Cart.getKey()
User-defined unique identifier for the CartDiscount.getName()
Name of the CartDiscount.States whether the Discount can only be used in a connection with a DiscountCode.Value between0
and1
.Specifies whether the application of this discount causes the following discounts to be ignored.If defined, the Cart Discount applies on Carts having a Store matching any Store defined for this field. If not defined, the Cart Discount applies on all Carts, irrespective of a Store.Segment of the Cart that will be discounted.Date and time (UTC) from which the Discount is effective.Date and time (UTC) until which the Discount is effective.getValue()
Effect of the CartDiscount on thetarget
.Only active Discounts can be applied to the Cart.User-defined unique identifier for the CartDiscount.name
(LocalizedString name) Name of the CartDiscount.Name of the CartDiscount.static CartDiscountDraftBuilder
of()
factory method for an instance of CartDiscountDraftBuilderstatic CartDiscountDraftBuilder
of
(CartDiscountDraft template) create builder for CartDiscountDraft instanceplusStores
(StoreResourceIdentifier... stores) If defined, the Cart Discount applies on Carts having a Store matching any Store defined for this field. If not defined, the Cart Discount applies on all Carts, irrespective of a Store.If defined, the Cart Discount applies on Carts having a Store matching any Store defined for this field. If not defined, the Cart Discount applies on all Carts, irrespective of a Store.requiresDiscountCode
(Boolean requiresDiscountCode) States whether the Discount can only be used in a connection with a DiscountCode.If defined, the Cart Discount applies on Carts having a Store matching any Store defined for this field. If not defined, the Cart Discount applies on all Carts, irrespective of a Store.Value between0
and1
.stackingMode
(StackingMode stackingMode) Specifies whether the application of this discount causes the following discounts to be ignored.stores
(StoreResourceIdentifier... stores) If defined, the Cart Discount applies on Carts having a Store matching any Store defined for this field. If not defined, the Cart Discount applies on all Carts, irrespective of a Store.stores
(List<StoreResourceIdentifier> stores) If defined, the Cart Discount applies on Carts having a Store matching any Store defined for this field. If not defined, the Cart Discount applies on all Carts, irrespective of a Store.target
(CartDiscountTarget target) Segment of the Cart that will be discounted.target
(Function<CartDiscountTargetBuilder, Builder<? extends CartDiscountTarget>> builder) Segment of the Cart that will be discounted.validFrom
(ZonedDateTime validFrom) Date and time (UTC) from which the Discount is effective.validUntil
(ZonedDateTime validUntil) Date and time (UTC) until which the Discount is effective.value
(CartDiscountValueDraft value) Effect of the CartDiscount on thetarget
.value
(Function<CartDiscountValueDraftBuilder, Builder<? extends CartDiscountValueDraft>> builder) Effect of the CartDiscount on thetarget
.Custom Fields of the CartDiscount.Description of the CartDiscount.Name of the CartDiscount.If defined, the Cart Discount applies on Carts having a Store matching any Store defined for this field. If not defined, the Cart Discount applies on all Carts, irrespective of a Store.
-
Constructor Details
-
CartDiscountDraftBuilder
public CartDiscountDraftBuilder()
-
-
Method Details
-
name
public CartDiscountDraftBuilder name(Function<LocalizedStringBuilder, LocalizedStringBuilder> builder) Name of the CartDiscount.
- Parameters:
builder
- function to build the name value- Returns:
- Builder
-
withName
Name of the CartDiscount.
- Parameters:
builder
- function to build the name value- Returns:
- Builder
-
name
Name of the CartDiscount.
- Parameters:
name
- value to be set- Returns:
- Builder
-
key
User-defined unique identifier for the CartDiscount.
- Parameters:
key
- value to be set- Returns:
- Builder
-
description
public CartDiscountDraftBuilder description(Function<LocalizedStringBuilder, LocalizedStringBuilder> builder) Description of the CartDiscount.
- Parameters:
builder
- function to build the description value- Returns:
- Builder
-
withDescription
public CartDiscountDraftBuilder withDescription(Function<LocalizedStringBuilder, LocalizedString> builder) Description of the CartDiscount.
- Parameters:
builder
- function to build the description value- Returns:
- Builder
-
description
Description of the CartDiscount.
- Parameters:
description
- value to be set- Returns:
- Builder
-
value
Effect of the CartDiscount on the
target
.- Parameters:
value
- value to be set- Returns:
- Builder
-
value
public CartDiscountDraftBuilder value(Function<CartDiscountValueDraftBuilder, Builder<? extends CartDiscountValueDraft>> builder) Effect of the CartDiscount on the
target
.- Parameters:
builder
- function to build the value value- Returns:
- Builder
-
cartPredicate
Valid Cart Predicate.
- Parameters:
cartPredicate
- value to be set- Returns:
- Builder
-
target
Segment of the Cart that will be discounted.
Must not be set if the
value
isgiftLineItem
.- Parameters:
target
- value to be set- Returns:
- Builder
-
target
public CartDiscountDraftBuilder target(Function<CartDiscountTargetBuilder, Builder<? extends CartDiscountTarget>> builder) Segment of the Cart that will be discounted.
Must not be set if the
value
isgiftLineItem
.- Parameters:
builder
- function to build the target value- Returns:
- Builder
-
sortOrder
Value between
0
and1
. A Discount with a higher sortOrder is prioritized. The sort order must be unambiguous among all CartDiscounts.- Parameters:
sortOrder
- value to be set- Returns:
- Builder
-
stores
- If defined, the Cart Discount applies on Carts having a Store matching any Store defined for this field.
- If not defined, the Cart Discount applies on all Carts, irrespective of a Store.
If the referenced Stores exceed the limit, a MaxStoreReferencesReached error is returned.
If the referenced Stores exceed the limit for Cart Discounts that do not require a Discount Code, a StoreCartDiscountsLimitReached error is returned.
- Parameters:
stores
- value to be set- Returns:
- Builder
-
stores
- If defined, the Cart Discount applies on Carts having a Store matching any Store defined for this field.
- If not defined, the Cart Discount applies on all Carts, irrespective of a Store.
If the referenced Stores exceed the limit, a MaxStoreReferencesReached error is returned.
If the referenced Stores exceed the limit for Cart Discounts that do not require a Discount Code, a StoreCartDiscountsLimitReached error is returned.
- Parameters:
stores
- value to be set- Returns:
- Builder
-
plusStores
- If defined, the Cart Discount applies on Carts having a Store matching any Store defined for this field.
- If not defined, the Cart Discount applies on all Carts, irrespective of a Store.
If the referenced Stores exceed the limit, a MaxStoreReferencesReached error is returned.
If the referenced Stores exceed the limit for Cart Discounts that do not require a Discount Code, a StoreCartDiscountsLimitReached error is returned.
- Parameters:
stores
- value to be set- Returns:
- Builder
-
plusStores
public CartDiscountDraftBuilder plusStores(Function<StoreResourceIdentifierBuilder, StoreResourceIdentifierBuilder> builder) - If defined, the Cart Discount applies on Carts having a Store matching any Store defined for this field.
- If not defined, the Cart Discount applies on all Carts, irrespective of a Store.
If the referenced Stores exceed the limit, a MaxStoreReferencesReached error is returned.
If the referenced Stores exceed the limit for Cart Discounts that do not require a Discount Code, a StoreCartDiscountsLimitReached error is returned.
- Parameters:
builder
- function to build the stores value- Returns:
- Builder
-
withStores
public CartDiscountDraftBuilder withStores(Function<StoreResourceIdentifierBuilder, StoreResourceIdentifierBuilder> builder) - If defined, the Cart Discount applies on Carts having a Store matching any Store defined for this field.
- If not defined, the Cart Discount applies on all Carts, irrespective of a Store.
If the referenced Stores exceed the limit, a MaxStoreReferencesReached error is returned.
If the referenced Stores exceed the limit for Cart Discounts that do not require a Discount Code, a StoreCartDiscountsLimitReached error is returned.
- Parameters:
builder
- function to build the stores value- Returns:
- Builder
-
addStores
public CartDiscountDraftBuilder addStores(Function<StoreResourceIdentifierBuilder, StoreResourceIdentifier> builder) - If defined, the Cart Discount applies on Carts having a Store matching any Store defined for this field.
- If not defined, the Cart Discount applies on all Carts, irrespective of a Store.
If the referenced Stores exceed the limit, a MaxStoreReferencesReached error is returned.
If the referenced Stores exceed the limit for Cart Discounts that do not require a Discount Code, a StoreCartDiscountsLimitReached error is returned.
- Parameters:
builder
- function to build the stores value- Returns:
- Builder
-
setStores
public CartDiscountDraftBuilder setStores(Function<StoreResourceIdentifierBuilder, StoreResourceIdentifier> builder) - If defined, the Cart Discount applies on Carts having a Store matching any Store defined for this field.
- If not defined, the Cart Discount applies on all Carts, irrespective of a Store.
If the referenced Stores exceed the limit, a MaxStoreReferencesReached error is returned.
If the referenced Stores exceed the limit for Cart Discounts that do not require a Discount Code, a StoreCartDiscountsLimitReached error is returned.
- Parameters:
builder
- function to build the stores value- Returns:
- Builder
-
isActive
Only active Discounts can be applied to the Cart. If the limit for active Cart Discounts is reached, a MaxCartDiscountsReached error is returned.
- Parameters:
isActive
- value to be set- Returns:
- Builder
-
validFrom
Date and time (UTC) from which the Discount is effective.
- Parameters:
validFrom
- value to be set- Returns:
- Builder
-
validUntil
Date and time (UTC) until which the Discount is effective.
- Parameters:
validUntil
- value to be set- Returns:
- Builder
-
requiresDiscountCode
States whether the Discount can only be used in a connection with a DiscountCode.
- Parameters:
requiresDiscountCode
- value to be set- Returns:
- Builder
-
stackingMode
Specifies whether the application of this discount causes the following discounts to be ignored.
- Parameters:
stackingMode
- value to be set- Returns:
- Builder
-
custom
public CartDiscountDraftBuilder custom(Function<CustomFieldsDraftBuilder, CustomFieldsDraftBuilder> builder) Custom Fields of the CartDiscount.
- Parameters:
builder
- function to build the custom value- Returns:
- Builder
-
withCustom
public CartDiscountDraftBuilder withCustom(Function<CustomFieldsDraftBuilder, CustomFieldsDraft> builder) Custom Fields of the CartDiscount.
- Parameters:
builder
- function to build the custom value- Returns:
- Builder
-
custom
Custom Fields of the CartDiscount.
- Parameters:
custom
- value to be set- Returns:
- Builder
-
getName
Name of the CartDiscount.
- Returns:
- name
-
getKey
User-defined unique identifier for the CartDiscount.
- Returns:
- key
-
getDescription
Description of the CartDiscount.
- Returns:
- description
-
getValue
Effect of the CartDiscount on the
target
.- Returns:
- value
-
getCartPredicate
Valid Cart Predicate.
- Returns:
- cartPredicate
-
getTarget
Segment of the Cart that will be discounted.
Must not be set if the
value
isgiftLineItem
.- Returns:
- target
-
getSortOrder
Value between
0
and1
. A Discount with a higher sortOrder is prioritized. The sort order must be unambiguous among all CartDiscounts.- Returns:
- sortOrder
-
getStores
- If defined, the Cart Discount applies on Carts having a Store matching any Store defined for this field.
- If not defined, the Cart Discount applies on all Carts, irrespective of a Store.
If the referenced Stores exceed the limit, a MaxStoreReferencesReached error is returned.
If the referenced Stores exceed the limit for Cart Discounts that do not require a Discount Code, a StoreCartDiscountsLimitReached error is returned.
- Returns:
- stores
-
getIsActive
Only active Discounts can be applied to the Cart. If the limit for active Cart Discounts is reached, a MaxCartDiscountsReached error is returned.
- Returns:
- isActive
-
getValidFrom
Date and time (UTC) from which the Discount is effective.
- Returns:
- validFrom
-
getValidUntil
Date and time (UTC) until which the Discount is effective.
- Returns:
- validUntil
-
getRequiresDiscountCode
States whether the Discount can only be used in a connection with a DiscountCode.
- Returns:
- requiresDiscountCode
-
getStackingMode
Specifies whether the application of this discount causes the following discounts to be ignored.
- Returns:
- stackingMode
-
getCustom
Custom Fields of the CartDiscount.
- Returns:
- custom
-
build
builds CartDiscountDraft with checking for non-null required values- Specified by:
build
in interfaceBuilder<CartDiscountDraft>
- Returns:
- CartDiscountDraft
-
buildUnchecked
builds CartDiscountDraft without checking for non-null required values- Returns:
- CartDiscountDraft
-
of
factory method for an instance of CartDiscountDraftBuilder- Returns:
- builder
-
of
create builder for CartDiscountDraft instance- Parameters:
template
- instance with prefilled values for the builder- Returns:
- builder
-