Interface CartSetDirectDiscountsAction
- All Superinterfaces:
CartUpdateAction
,ResourceUpdateAction<CartUpdateAction>
Adds a DirectDiscount, but only if no DiscountCode has been added to the Cart. Either a Discount Code or a Direct Discount can exist on a Cart at the same time.
Example to create an instance using the builder pattern
CartSetDirectDiscountsAction cartSetDirectDiscountsAction = CartSetDirectDiscountsAction.builder()
.plusDiscounts(discountsBuilder -> discountsBuilder)
.build()
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
discriminator value for CartSetDirectDiscountsAction -
Method Summary
Modifier and TypeMethodDescriptionbuilder()
builder factory method for CartSetDirectDiscountsActionbuilder
(CartSetDirectDiscountsAction template) create builder for CartSetDirectDiscountsAction instancestatic CartSetDirectDiscountsAction
deepCopy
(CartSetDirectDiscountsAction template) factory method to create a deep copy of CartSetDirectDiscountsAction@NotNull @Valid List<DirectDiscountDraft>
If set, all existing Direct Discounts are replaced.static CartSetDirectDiscountsAction
of()
factory methodstatic CartSetDirectDiscountsAction
of
(CartSetDirectDiscountsAction template) factory method to create a shallow copy CartSetDirectDiscountsActionvoid
setDiscounts
(DirectDiscountDraft... discounts) If set, all existing Direct Discounts are replaced.void
setDiscounts
(List<DirectDiscountDraft> discounts) If set, all existing Direct Discounts are replaced.static com.fasterxml.jackson.core.type.TypeReference<CartSetDirectDiscountsAction>
gives a TypeReference for usage with Jackson DataBinddefault <T> T
accessor map functionMethods inherited from interface com.commercetools.api.models.cart.CartUpdateAction
getAction, withCartUpdateAction
Methods inherited from interface com.commercetools.api.models.ResourceUpdateAction
get
-
Field Details
-
SET_DIRECT_DISCOUNTS
discriminator value for CartSetDirectDiscountsAction- See Also:
-
-
Method Details
-
getDiscounts
- If set, all existing Direct Discounts are replaced. The discounts apply in the order they are added to the list.
- If empty, all existing Direct Discounts are removed and all affected prices on the Cart or Order are recalculated.
- Returns:
- discounts
-
setDiscounts
- If set, all existing Direct Discounts are replaced. The discounts apply in the order they are added to the list.
- If empty, all existing Direct Discounts are removed and all affected prices on the Cart or Order are recalculated.
- Parameters:
discounts
- values to be set
-
setDiscounts
- If set, all existing Direct Discounts are replaced. The discounts apply in the order they are added to the list.
- If empty, all existing Direct Discounts are removed and all affected prices on the Cart or Order are recalculated.
- Parameters:
discounts
- values to be set
-
of
factory method- Returns:
- instance of CartSetDirectDiscountsAction
-
of
factory method to create a shallow copy CartSetDirectDiscountsAction- Parameters:
template
- instance to be copied- Returns:
- copy instance
-
deepCopy
@Nullable static CartSetDirectDiscountsAction deepCopy(@Nullable CartSetDirectDiscountsAction template) factory method to create a deep copy of CartSetDirectDiscountsAction- Parameters:
template
- instance to be copied- Returns:
- copy instance
-
builder
builder factory method for CartSetDirectDiscountsAction- Returns:
- builder
-
builder
create builder for CartSetDirectDiscountsAction instance- Parameters:
template
- instance with prefilled values for the builder- Returns:
- builder
-
withCartSetDirectDiscountsAction
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
-