Interface CartAddDiscountCodeAction

All Superinterfaces:
CartUpdateAction, ResourceUpdateAction<CartUpdateAction>

public interface CartAddDiscountCodeAction extends CartUpdateAction

Adds a DiscountCode to the Cart to activate the related Cart Discounts. Adding a Discount Code is only possible if no DirectDiscount has been applied to the Cart. Discount Codes can be added to frozen Carts, but their DiscountCodeState is then DoesNotMatchCart.

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 Details

    • ADD_DISCOUNT_CODE

      static final String ADD_DISCOUNT_CODE
      discriminator value for CartAddDiscountCodeAction
      See Also:
  • Method Details

    • getCode

      @NotNull @NotNull String getCode()

      code of a DiscountCode.

      Returns:
      code
    • setCode

      void setCode(String code)

      code of 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
    • 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

      default <T> T withCartAddDiscountCodeAction(Function<CartAddDiscountCodeAction,T> helper)
      accessor map function
      Type Parameters:
      T - mapped type
      Parameters:
      helper - function to map the object
      Returns:
      mapped value
    • typeReference

      static com.fasterxml.jackson.core.type.TypeReference<CartAddDiscountCodeAction> typeReference()
      gives a TypeReference for usage with Jackson DataBind
      Returns:
      TypeReference