Interface CartDiscountValueRelative

All Superinterfaces:
CartDiscountValue, CartDiscountValueMixin, CartDiscountValueRelativeMixin, GenericCartDiscountValueMixin<CartDiscountValueRelativeDraft>

public interface CartDiscountValueRelative extends CartDiscountValue, CartDiscountValueRelativeMixin

Discounts the CartDiscountTarget relative to its price.


Example to create an instance using the builder pattern

     CartDiscountValueRelative cartDiscountValueRelative = CartDiscountValueRelative.builder()
             .permyriad(0.3)
             .build()
 
  • Field Details

  • Method Details

    • getPermyriad

      @NotNull @NotNull Long getPermyriad()

      Fraction (per ten thousand) the price is reduced by. For example, 1000 will result in a 10% price reduction.

      Specified by:
      getPermyriad in interface CartDiscountValueRelativeMixin
      Returns:
      permyriad
    • getApplicationMode

      DiscountApplicationMode getApplicationMode()

      Indicates how the discount applies when using CartDiscountPatternTarget.

      • If the mode is IndividualApplication, the discounted percentage is applied on each unit's price. The units matching the triggerPattern are not considered.
      • If the mode is ProportionateDistribution and EvenDistribution the discounted value is calculated from the total value of the units matching the targetPattern and distributed among the units matching the targetPattern or triggerPattern. These modes are allowed only if CartDiscountPatternTarget triggerPattern is non-empty.
      Returns:
      applicationMode
    • setPermyriad

      void setPermyriad(Long permyriad)

      Fraction (per ten thousand) the price is reduced by. For example, 1000 will result in a 10% price reduction.

      Parameters:
      permyriad - value to be set
    • setApplicationMode

      void setApplicationMode(DiscountApplicationMode applicationMode)

      Indicates how the discount applies when using CartDiscountPatternTarget.

      • If the mode is IndividualApplication, the discounted percentage is applied on each unit's price. The units matching the triggerPattern are not considered.
      • If the mode is ProportionateDistribution and EvenDistribution the discounted value is calculated from the total value of the units matching the targetPattern and distributed among the units matching the targetPattern or triggerPattern. These modes are allowed only if CartDiscountPatternTarget triggerPattern is non-empty.
      Parameters:
      applicationMode - value to be set
    • of

      factory method
      Returns:
      instance of CartDiscountValueRelative
    • of

      factory method to create a shallow copy CartDiscountValueRelative
      Parameters:
      template - instance to be copied
      Returns:
      copy instance
    • copyDeep

      Specified by:
      copyDeep in interface CartDiscountValue
    • deepCopy

      @Nullable static CartDiscountValueRelative deepCopy(@Nullable CartDiscountValueRelative template)
      factory method to create a deep copy of CartDiscountValueRelative
      Parameters:
      template - instance to be copied
      Returns:
      copy instance
    • builder

      builder factory method for CartDiscountValueRelative
      Returns:
      builder
    • builder

      create builder for CartDiscountValueRelative instance
      Parameters:
      template - instance with prefilled values for the builder
      Returns:
      builder
    • withCartDiscountValueRelative

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