Interface PriceTierDraft

All Superinterfaces:
Draft<PriceTierDraft>

public interface PriceTierDraft extends Draft<PriceTierDraft>

Specifies a Price tier that applies when the minimum quantity for the LineItem of a ProductVariant with the related Price is reached in a Cart.


Example to create an instance using the builder pattern

     PriceTierDraft priceTierDraft = PriceTierDraft.builder()
             .minimumQuantity(0.3)
             .value(valueBuilder -> valueBuilder)
             .build()
 
  • Method Details

    • getMinimumQuantity

      @NotNull @NotNull Long getMinimumQuantity()

      Minimum quantity this Price tier is valid for.

      The minimum quantity is always greater than or equal to 2. The base Price is interpreted as valid for a minimum quantity equal to 1. A Price or StandalonePrice cannot contain more than one tier with the same minimumQuantity. In the case one of the constraint is not met an InvalidField is returned.

      Returns:
      minimumQuantity
    • getValue

      @NotNull @Valid @NotNull @Valid Money getValue()

      Money value that applies when the minimumQuantity is greater than or equal to the LineItem quantity. To set the money value in high precision, use HighPrecisionMoneyDraft.

      The currencyCode of a Price tier must be the same as the currencyCode in the value of the related Price.

      Returns:
      value
    • setMinimumQuantity

      void setMinimumQuantity(Long minimumQuantity)

      Minimum quantity this Price tier is valid for.

      The minimum quantity is always greater than or equal to 2. The base Price is interpreted as valid for a minimum quantity equal to 1. A Price or StandalonePrice cannot contain more than one tier with the same minimumQuantity. In the case one of the constraint is not met an InvalidField is returned.

      Parameters:
      minimumQuantity - value to be set
    • setValue

      void setValue(Money value)

      Money value that applies when the minimumQuantity is greater than or equal to the LineItem quantity. To set the money value in high precision, use HighPrecisionMoneyDraft.

      The currencyCode of a Price tier must be the same as the currencyCode in the value of the related Price.

      Parameters:
      value - value to be set
    • of

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

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

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

      static PriceTierDraftBuilder builder()
      builder factory method for PriceTierDraft
      Returns:
      builder
    • builder

      static PriceTierDraftBuilder builder(PriceTierDraft template)
      create builder for PriceTierDraft instance
      Parameters:
      template - instance with prefilled values for the builder
      Returns:
      builder
    • withPriceTierDraft

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