Interface CartAddDiscountCodeAction
- All Superinterfaces:
CartUpdateAction,ResourceUpdateAction<CartUpdateAction>
Adds a DiscountCode to the Cart to activate the related Cart Discounts. If the related Cart Discounts are inactive or invalid, or belong to a different Store than the Cart, a DiscountCodeNonApplicableError is returned.
A Discount Code can be added only if no DirectDiscount has been applied to the Cart. For frozen Carts, the DiscountCodeState must be DoesNotMatchCart when adding a Discount Code.
The maximum number of Discount Codes in a Cart is restricted by a limit.
Specific Error Code: MatchingPriceNotFound
Example to create an instance using the builder pattern
CartAddDiscountCodeAction cartAddDiscountCodeAction = CartAddDiscountCodeAction.builder()
.code("{code}")
.build()
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringdiscriminator value for CartAddDiscountCodeAction -
Method Summary
Modifier and TypeMethodDescriptionbuilder()builder factory method for CartAddDiscountCodeActionbuilder(CartAddDiscountCodeAction template) create builder for CartAddDiscountCodeAction instancecopyDeep()static CartAddDiscountCodeActiondeepCopy(CartAddDiscountCodeAction template) factory method to create a deep copy of CartAddDiscountCodeAction@NotNull StringgetCode()codeof a DiscountCode.static CartAddDiscountCodeActionof()factory methodstatic CartAddDiscountCodeActionof(CartAddDiscountCodeAction template) factory method to create a shallow copy CartAddDiscountCodeActionvoidcodeof a DiscountCode.static com.fasterxml.jackson.core.type.TypeReference<CartAddDiscountCodeAction>gives a TypeReference for usage with Jackson DataBinddefault <T> Taccessor map functionMethods inherited from interface com.commercetools.api.models.cart.CartUpdateAction
getAction, withCartUpdateActionMethods inherited from interface com.commercetools.api.models.ResourceUpdateAction
get
-
Field Details
-
ADD_DISCOUNT_CODE
discriminator value for CartAddDiscountCodeAction- See Also:
-
-
Method Details
-
getCode
codeof a DiscountCode.- Returns:
- code
-
setCode
codeof a DiscountCode.- Parameters:
code- value to be set
-
of
factory method- Returns:
- instance of CartAddDiscountCodeAction
-
of
factory method to create a shallow copy CartAddDiscountCodeAction- Parameters:
template- instance to be copied- Returns:
- copy instance
-
copyDeep
CartAddDiscountCodeAction copyDeep()- Specified by:
copyDeepin interfaceCartUpdateAction
-
deepCopy
factory method to create a deep copy of CartAddDiscountCodeAction- Parameters:
template- instance to be copied- Returns:
- copy instance
-
builder
builder factory method for CartAddDiscountCodeAction- Returns:
- builder
-
builder
create builder for CartAddDiscountCodeAction instance- Parameters:
template- instance with prefilled values for the builder- Returns:
- builder
-
withCartAddDiscountCodeAction
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
-