Interface CartSetDirectDiscountsAction

All Superinterfaces:
CartUpdateAction, ResourceUpdateAction<CartUpdateAction>

public interface CartSetDirectDiscountsAction extends CartUpdateAction

Adds a DirectDiscount to the Cart.

If Cart directDiscountsIgnoreCartDiscounts is true, Direct Discounts can only be added when no DiscountCode has been added to the Cart.


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 set to an empty array, 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 set to an empty array, 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 set to an empty array, 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
    • copyDeep

      Specified by:
      copyDeep in interface CartUpdateAction
    • 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

      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 tools.jackson.core.type.TypeReference<CartSetDirectDiscountsAction> typeReference()
      gives a TypeReference for usage with Jackson DataBind
      Returns:
      TypeReference