Class DiscountTier

  • All Implemented Interfaces:
    com.broadleafcommerce.data.tracking.core.EmbeddedContextStateAware, Serializable, Comparable<DiscountTier>

    public class DiscountTier
    extends Object
    implements Serializable, Comparable<DiscountTier>, com.broadleafcommerce.data.tracking.core.EmbeddedContextStateAware
    Represents a tier and amount combination for an offer's discount. For example, an offer might allow a 10% off if a user purchases 1 through 5 of the same item but then allow 15% off if they purchase more than 5 of that item.
    Note that tiers only apply to item offers—not orders or fulfillment groups.
    Author:
    Chad Harchar (charchar)
    See Also:
    Serialized Form
    • Constructor Detail

      • DiscountTier

        public DiscountTier()
    • Method Detail

      • compareTo

        public int compareTo​(@NonNull
                             DiscountTier that)
        Compares priorities. Null is less than non-null.
        Specified by:
        compareTo in interface Comparable<DiscountTier>
        Parameters:
        that - DiscountTier to which we are comparing
        Returns:
        a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
      • getMinQuantity

        public Long getMinQuantity()
        The minimum quantity of items needed to reach this tier.
      • getMinAmount

        public BigDecimal getMinAmount()
        The minimum currency amount to qualify for this tier.
      • getAmount

        public BigDecimal getAmount()
        The discount amount that this tier represents. If the amount is 10, then whether it is calculated as a percentage (10%) or a currency amount ($10) is determined by methodType. Overrides Discount.amount of the parent Offer.
      • getContextState

        public com.broadleafcommerce.data.tracking.core.EmbeddedContextState getContextState()
        A subset of Tracking information to expose the context state for this object. This value is not persisted, and instead it is dynamically calculated and populated when the ChangeDetails for the parent object's entire attributes map are compared.
        Specified by:
        getContextState in interface com.broadleafcommerce.data.tracking.core.EmbeddedContextStateAware
        Returns:
        a subset of Tracking information to expose the context state for this object
      • setMinQuantity

        public void setMinQuantity​(Long minQuantity)
        The minimum quantity of items needed to reach this tier.
      • setMinAmount

        public void setMinAmount​(BigDecimal minAmount)
        The minimum currency amount to qualify for this tier.
      • setAmount

        public void setAmount​(BigDecimal amount)
        The discount amount that this tier represents. If the amount is 10, then whether it is calculated as a percentage (10%) or a currency amount ($10) is determined by methodType. Overrides Discount.amount of the parent Offer.
      • setContextState

        public void setContextState​(com.broadleafcommerce.data.tracking.core.EmbeddedContextState contextState)
        A subset of Tracking information to expose the context state for this object. This value is not persisted, and instead it is dynamically calculated and populated when the ChangeDetails for the parent object's entire attributes map are compared.
        Specified by:
        setContextState in interface com.broadleafcommerce.data.tracking.core.EmbeddedContextStateAware
        Parameters:
        contextState - a subset of Tracking information to expose the context state for this object
      • canEqual

        protected boolean canEqual​(Object other)
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object