Interface DirectDiscount


public interface DirectDiscount

Represents a CartDiscount that is only associated with a single Cart or Order.


Example to create an instance using the builder pattern

     DirectDiscount directDiscount = DirectDiscount.builder()
             .id("{id}")
             .value(valueBuilder -> valueBuilder)
             .build()
 
  • Method Details

    • getId

      @NotNull @NotNull String getId()

      Unique identifier of the Direct Discount.

      Returns:
      id
    • getValue

      @NotNull @Valid @NotNull @Valid CartDiscountValue getValue()

      Effect of the Discount on the Cart.

      Returns:
      value
    • getTarget

      @Valid @Valid CartDiscountTarget getTarget()

      Segment of the Cart that is discounted.

      Empty when the value is set to giftLineItem.

      Returns:
      target
    • setId

      void setId(String id)

      Unique identifier of the Direct Discount.

      Parameters:
      id - value to be set
    • setValue

      void setValue(CartDiscountValue value)

      Effect of the Discount on the Cart.

      Parameters:
      value - value to be set
    • setTarget

      void setTarget(CartDiscountTarget target)

      Segment of the Cart that is discounted.

      Empty when the value is set to giftLineItem.

      Parameters:
      target - value to be set
    • of

      static DirectDiscount of()
      factory method
      Returns:
      instance of DirectDiscount
    • of

      static DirectDiscount of(DirectDiscount template)
      factory method to create a shallow copy DirectDiscount
      Parameters:
      template - instance to be copied
      Returns:
      copy instance
    • deepCopy

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

      static DirectDiscountBuilder builder()
      builder factory method for DirectDiscount
      Returns:
      builder
    • builder

      static DirectDiscountBuilder builder(DirectDiscount template)
      create builder for DirectDiscount instance
      Parameters:
      template - instance with prefilled values for the builder
      Returns:
      builder
    • withDirectDiscount

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