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.

      Absent if the value is giftLineItem.

      Returns:
      target
    • getParticipateInBestDealSelection

      Boolean getParticipateInBestDealSelection()
      • If true, Direct Discounts compete against Product Discounts to apply the best deal.
      • If false, Direct Discounts are ignored when calculating the best deal comparison, and are applied on top of the discount type that offers the best deal.

      This applies only when the DiscountCombinationMode for the Project is BestDeal.

      Returns:
      participateInBestDealSelection
    • 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.

      Absent if the value is giftLineItem.

      Parameters:
      target - value to be set
    • setParticipateInBestDealSelection

      void setParticipateInBestDealSelection(Boolean participateInBestDealSelection)
      • If true, Direct Discounts compete against Product Discounts to apply the best deal.
      • If false, Direct Discounts are ignored when calculating the best deal comparison, and are applied on top of the discount type that offers the best deal.

      This applies only when the DiscountCombinationMode for the Project is BestDeal.

      Parameters:
      participateInBestDealSelection - 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
    • copyDeep

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