Interface CartDiscountDraft
- All Superinterfaces:
CustomizableDraft<CartDiscountDraft>
,Draft<CartDiscountDraft>
,WithKey
Example to create an instance using the builder pattern
CartDiscountDraft cartDiscountDraft = CartDiscountDraft.builder()
.name(nameBuilder -> nameBuilder)
.value(valueBuilder -> valueBuilder)
.cartPredicate("{cartPredicate}")
.sortOrder("{sortOrder}")
.build()
-
Method Summary
Modifier and TypeMethodDescriptionstatic CartDiscountDraftBuilder
builder()
builder factory method for CartDiscountDraftstatic CartDiscountDraftBuilder
builder
(CartDiscountDraft template) create builder for CartDiscountDraft instancestatic CartDiscountDraft
deepCopy
(CartDiscountDraft template) factory method to create a deep copy of CartDiscountDraft@NotNull String
Valid Cart Predicate.@Valid CustomFieldsDraft
Custom Fields of the CartDiscount.@Valid LocalizedString
Description of the CartDiscount.Only active Discounts can be applied to the Cart.getKey()
User-defined unique identifier for the CartDiscount.@NotNull @Valid LocalizedString
getName()
Name of the CartDiscount.States whether the Discount can only be used in a connection with a DiscountCode.@NotNull String
Value between0
and1
.Specifies whether the application of this discount causes the following discounts to be ignored.@Valid List<StoreResourceIdentifier>
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.@Valid CartDiscountTarget
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.@NotNull @Valid CartDiscountValueDraft
getValue()
Effect of the CartDiscount on thetarget
.static CartDiscountDraft
of()
factory methodstatic CartDiscountDraft
of
(CartDiscountDraft template) factory method to create a shallow copy CartDiscountDraftvoid
setCartPredicate
(String cartPredicate) Valid Cart Predicate.void
setCustom
(CustomFieldsDraft custom) Custom Fields of the CartDiscount.void
setDescription
(LocalizedString description) Description of the CartDiscount.void
setIsActive
(Boolean isActive) Only active Discounts can be applied to the Cart.void
User-defined unique identifier for the CartDiscount.void
setName
(LocalizedString name) Name of the CartDiscount.void
setRequiresDiscountCode
(Boolean requiresDiscountCode) States whether the Discount can only be used in a connection with a DiscountCode.void
setSortOrder
(String sortOrder) Value between0
and1
.void
setStackingMode
(StackingMode stackingMode) Specifies whether the application of this discount causes the following discounts to be ignored.void
setStores
(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.void
setStores
(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.void
setTarget
(CartDiscountTarget target) Segment of the Cart that will be discounted.void
setValidFrom
(ZonedDateTime validFrom) Date and time (UTC) from which the Discount is effective.void
setValidUntil
(ZonedDateTime validUntil) Date and time (UTC) until which the Discount is effective.void
setValue
(CartDiscountValueDraft value) Effect of the CartDiscount on thetarget
.static com.fasterxml.jackson.core.type.TypeReference<CartDiscountDraft>
gives a TypeReference for usage with Jackson DataBinddefault <T> T
withCartDiscountDraft
(Function<CartDiscountDraft, T> helper) accessor map functionMethods inherited from interface com.commercetools.api.models.CustomizableDraft
unwrapCustomizableDraft
-
Method Details
-
getName
Name of the CartDiscount.
- Returns:
- name
-
getKey
String getKey()User-defined unique identifier for the CartDiscount.
-
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
Boolean 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
ZonedDateTime getValidFrom()Date and time (UTC) from which the Discount is effective.
- Returns:
- validFrom
-
getValidUntil
ZonedDateTime getValidUntil()Date and time (UTC) until which the Discount is effective.
- Returns:
- validUntil
-
getRequiresDiscountCode
Boolean getRequiresDiscountCode()States whether the Discount can only be used in a connection with a DiscountCode.
- Returns:
- requiresDiscountCode
-
getStackingMode
StackingMode getStackingMode()Specifies whether the application of this discount causes the following discounts to be ignored.
- Returns:
- stackingMode
-
getCustom
Custom Fields of the CartDiscount.
- Specified by:
getCustom
in interfaceCustomizableDraft<CartDiscountDraft>
- Returns:
- custom
-
setName
Name of the CartDiscount.
- Parameters:
name
- value to be set
-
setKey
User-defined unique identifier for the CartDiscount.
- Parameters:
key
- value to be set
-
setDescription
Description of the CartDiscount.
- Parameters:
description
- value to be set
-
setValue
Effect of the CartDiscount on the
target
.- Parameters:
value
- value to be set
-
setCartPredicate
Valid Cart Predicate.
- Parameters:
cartPredicate
- value to be set
-
setTarget
Segment of the Cart that will be discounted.
Must not be set if the
value
isgiftLineItem
.- Parameters:
target
- value to be set
-
setSortOrder
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
-
setStores
- 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
- values to be set
-
setStores
- 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
- values to be set
-
setIsActive
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
-
setValidFrom
Date and time (UTC) from which the Discount is effective.
- Parameters:
validFrom
- value to be set
-
setValidUntil
Date and time (UTC) until which the Discount is effective.
- Parameters:
validUntil
- value to be set
-
setRequiresDiscountCode
States whether the Discount can only be used in a connection with a DiscountCode.
- Parameters:
requiresDiscountCode
- value to be set
-
setStackingMode
Specifies whether the application of this discount causes the following discounts to be ignored.
- Parameters:
stackingMode
- value to be set
-
setCustom
Custom Fields of the CartDiscount.
- Specified by:
setCustom
in interfaceCustomizableDraft<CartDiscountDraft>
- Parameters:
custom
- value to be set
-
of
factory method- Returns:
- instance of CartDiscountDraft
-
of
factory method to create a shallow copy CartDiscountDraft- Parameters:
template
- instance to be copied- Returns:
- copy instance
-
deepCopy
factory method to create a deep copy of CartDiscountDraft- Parameters:
template
- instance to be copied- Returns:
- copy instance
-
builder
builder factory method for CartDiscountDraft- Returns:
- builder
-
builder
create builder for CartDiscountDraft instance- Parameters:
template
- instance with prefilled values for the builder- Returns:
- builder
-
withCartDiscountDraft
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
-