Interface DirectDiscountDraft

All Superinterfaces:
Draft<DirectDiscountDraft>

public interface DirectDiscountDraft extends Draft<DirectDiscountDraft>

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

For an introduction to Direct Discounts and to understand how they work in Composable Commerce, see the Direct Discounts overview.


Example to create an instance using the builder pattern

     DirectDiscountDraft directDiscountDraft = DirectDiscountDraft.builder()
             .value(valueBuilder -> valueBuilder)
             .build()
 
  • Method Details

    • getValue

      @NotNull @Valid @NotNull @Valid CartDiscountValueDraft getValue()

      Defines the effect the Discount will have.

      Returns:
      value
    • getTarget

      @Valid @Valid CartDiscountTarget getTarget()

      Defines what segment of the Cart will be discounted.

      If value is set to giftLineItem, this must not be set.

      Returns:
      target
    • setValue

      void setValue(CartDiscountValueDraft value)

      Defines the effect the Discount will have.

      Parameters:
      value - value to be set
    • setTarget

      void setTarget(CartDiscountTarget target)

      Defines what segment of the Cart will be discounted.

      If value is set to giftLineItem, this must not be set.

      Parameters:
      target - value to be set
    • of

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

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

      factory method to create a deep copy of DirectDiscountDraft
      Parameters:
      template - instance to be copied
      Returns:
      copy instance
    • builder

      static DirectDiscountDraftBuilder builder()
      builder factory method for DirectDiscountDraft
      Returns:
      builder
    • builder

      create builder for DirectDiscountDraft instance
      Parameters:
      template - instance with prefilled values for the builder
      Returns:
      builder
    • withDirectDiscountDraft

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