Interface CartDiscountDraft
- All Superinterfaces:
CustomizableDraft<CartDiscountDraft>
,io.vrap.rmf.base.client.Draft<CartDiscountDraft>
,WithKey
- All Known Implementing Classes:
CartDiscountDraftImpl
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 CartDiscountTarget
Must not be set when thevalue
has typegiftLineItem
, otherwise a CartDiscountTarget must be set.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.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
setTarget
(CartDiscountTarget target) Must not be set when thevalue
has typegiftLineItem
, otherwise a CartDiscountTarget must be set.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.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
User-defined unique identifier for the CartDiscount.
-
getDescription
Description of the CartDiscount.
- Returns:
- description
-
getValue
Effect of the CartDiscount. For a target, relative or absolute Discount values or a fixed item Price value can be specified. If no target is specified, a Gift Line Item can be added to the Cart.
- Returns:
- value
-
getCartPredicate
Valid Cart Predicate.
- Returns:
- cartPredicate
-
getTarget
Must not be set when the
value
has typegiftLineItem
, otherwise a CartDiscountTarget must be set.- 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
-
getIsActive
Only active Discounts can be applied to the Cart.
- 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.
- 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. For a target, relative or absolute Discount values or a fixed item Price value can be specified. If no target is specified, a Gift Line Item can be added to the Cart.
- Parameters:
value
- value to be set
-
setCartPredicate
Valid Cart Predicate.
- Parameters:
cartPredicate
- value to be set
-
setTarget
Must not be set when the
value
has typegiftLineItem
, otherwise a CartDiscountTarget must be set.- 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
-
setIsActive
Only active Discounts can be applied to the Cart.
- 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
-