Interface CartSetDirectDiscountsAction

All Superinterfaces:
CartUpdateAction, ResourceUpdateAction<CartUpdateAction>

public interface CartSetDirectDiscountsAction extends 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 Details

    • SET_DIRECT_DISCOUNTS

      static final String SET_DIRECT_DISCOUNTS
      discriminator value for CartSetDirectDiscountsAction
      See Also:
  • Method Details

    • getDiscounts

      @NotNull @Valid @NotNull @Valid List<DirectDiscountDraft> 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

      void setDiscounts(DirectDiscountDraft... discounts)
      • 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

      void setDiscounts(List<DirectDiscountDraft> discounts)
      • 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

      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

      default <T> T withCartSetDirectDiscountsAction(Function<CartSetDirectDiscountsAction,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<CartSetDirectDiscountsAction> typeReference()
      gives a TypeReference for usage with Jackson DataBind
      Returns:
      TypeReference