java.lang.Object
com.broadleafcommerce.pricing.client.domain.PriceInfo
All Implemented Interfaces:
Serializable, Comparable<PriceInfo>

public class PriceInfo extends Object implements Comparable<PriceInfo>, Serializable
Pricing information for a PriceableTarget, providing the target, best price, and, optionally, the details of all the candidate prices and their originating PriceListRefs.
Author:
Chad Harchar (charchar), Nathan Moore (nathandmoore)
See Also:
  • Constructor Details

    • PriceInfo

      public PriceInfo()
  • Method Details

    • getCurrency

      public javax.money.CurrencyUnit getCurrency()
    • compareTo

      public int compareTo(@Nullable PriceInfo o)
      Compares price. Null is more than non-null.
      Specified by:
      compareTo in interface Comparable<PriceInfo>
    • hasLimitedQuantity

      public boolean hasLimitedQuantity()
      Whether this PriceInfo has a limited quantity.
      Since:
      Pricing Client 2.0.3
    • isActive

      public boolean isActive()
      Whether this PriceInfo is active based on the activeStartDate and activeEndDate.
      Since:
      Pricing Client 2.0.3
    • getTarget

      public PriceableTarget getTarget()
      The PriceableTarget to which this info corresponds.
      Returns:
      The PriceableTarget to which this info corresponds.
      See Also:
    • getPrice

      public javax.money.MonetaryAmount getPrice()
      Determined best price for target.
      Returns:
      Determined best price for target.
    • getRecurringPrice

      public RecurringPriceDetail getRecurringPrice()
      This is the recurring price if any from the same source as the price. The recurring price is used for subscriptions and is not expected to be charged at checkout typically.
      Returns:
      This is the recurring price if any from the same source as the price.
      Since:
      Pricing Client 2.0.3
    • getUsagePrice

      public UsagePriceDetail getUsagePrice()
      This is the usage price if any from the same source as the price. The usage price represents a charge when a priceable target is used, e.g., when using minutes above the base allowance.
      Returns:
      This is the usage price if any from the same source as the price.
      Since:
      Pricing Client 2.0.3
    • getPriceType

      public String getPriceType()
      The type of price whether salePrice, standardPrice, contractPrice, etc.
      Returns:
      The type of price whether salePrice, standardPrice, contractPrice, etc.
    • getPriceDataId

      public String getPriceDataId()
      Id of the specific PriceData that this price came from.

      Only applicable if the priceListPriceSource is DefaultPriceListPriceSources.BLC_PRICE_LIST_PRICE_DATA.

      Returns:
      Id of the specific PriceData that this price came from
      Since:
      Pricing Client 2.0.3
    • getPriceDataType

      public String getPriceDataType()
    • getPriceListId

      public String getPriceListId()
      String representation of the PriceList that provided the best price.
      Returns:
      String representation of the PriceList that provided the best price.
      See Also:
    • getPriceListPriceSource

      public String getPriceListPriceSource()
      If this price is from a price list, this field indicates the source of the price within the price list. E.g. price list formula, price list price data, etc.
      Since:
      1.4.1, 2.0.1
      See Also:
    • getActiveStartDate

      public Instant getActiveStartDate()
      Defines the beginning time for which this price is active.
      Since:
      Pricing Client 2.0.3
    • getActiveEndDate

      public Instant getActiveEndDate()
      Defines the ending time for which this price is active
      Since:
      Pricing Client 2.0.3
    • getStartingQuantity

      public Integer getStartingQuantity()
      Defines the initial quantity available for this price data before a pricing event such as a flash sale. It only serves an informational purpose.
      Since:
      Pricing Client 2.0.3
    • getAvailableQuantity

      public Integer getAvailableQuantity()
      The available quantity that can use this price data. This is used for events such as a flash sale where the sale price is limited to a certain amount of quantity.
      Since:
      Pricing Client 2.0.3
    • getBackupPriceInfo

      public PriceInfo getBackupPriceInfo()
      If this PriceInfo is limited for events such as a flash sale, the backup is used for any remaining items that cannot get the sale price. The backup is the second best price that does not have a quantity restriction, if no other price lists exist, the item's base price is used.

      For example, if the sale price is only available for 2 more items, and the customer has 5 items in the cart, only 2 of them should get the sale price and the remaining items should get the backup price.

      Since:
      Pricing Client 2.0.3
    • getPriceTypeDetails

      public Map<String,PriceTypeDetail> getPriceTypeDetails()
      Map of each type of price to each corresponding PriceTypeDetail, which contains the best overall price for that type along with all the PriceDetails for the candidate PriceLists.
      Returns:
      Map of each type of price to each corresponding PriceTypeDetail
    • setTarget

      public void setTarget(PriceableTarget target)
      The PriceableTarget to which this info corresponds.
      Parameters:
      target - The PriceableTarget to which this info corresponds.
      See Also:
    • setPrice

      public void setPrice(javax.money.MonetaryAmount price)
      Determined best price for target.
      Parameters:
      price - Determined best price for target.
    • setRecurringPrice

      public void setRecurringPrice(RecurringPriceDetail recurringPrice)
      This is the recurring price if any from the same source as the price. The recurring price is used for subscriptions and is not expected to be charged at checkout typically.
      Parameters:
      recurringPrice - This is the recurring price if any from the same source as the price
      Since:
      Pricing Client 2.0.3
    • setUsagePrice

      public void setUsagePrice(UsagePriceDetail usagePrice)
      This is the usage price if any from the same source as the price. The usage price represents a charge when a priceable target is used, e.g., when using minutes above the base allowance.
      Parameters:
      usagePrice - This is the usage price if any from the same source as the price
      Since:
      Pricing Client 2.0.3
    • setPriceType

      public void setPriceType(String priceType)
      The type of price whether salePrice, standardPrice, contractPrice, etc.
      Parameters:
      priceType - The type of price whether salePrice, standardPrice, contractPrice, etc.
    • setPriceDataId

      public void setPriceDataId(String priceDataId)
      Id of the specific PriceData that this price came from.

      Only applicable if the priceListPriceSource is DefaultPriceListPriceSources.BLC_PRICE_LIST_PRICE_DATA.

      Parameters:
      priceDataId - Id of the specific PriceData that this price came from
      Since:
      Pricing Client 2.0.3
    • setPriceDataType

      public void setPriceDataType(String priceDataType)
    • setPriceListId

      public void setPriceListId(String priceListId)
      String representation of the PriceList that provided the best price.
      Parameters:
      priceListId - String representation of the PriceList that provided the best price.
      See Also:
    • setPriceListPriceSource

      public void setPriceListPriceSource(String priceListPriceSource)
      If this price is from a price list, this field indicates the source of the price within the price list. E.g. price list formula, price list price data, etc.
      Since:
      1.4.1, 2.0.1
      See Also:
    • setActiveStartDate

      public void setActiveStartDate(Instant activeStartDate)
      Defines the beginning time for which this price is active.
      Since:
      Pricing Client 2.0.3
    • setActiveEndDate

      public void setActiveEndDate(Instant activeEndDate)
      Defines the ending time for which this price is active
      Since:
      Pricing Client 2.0.3
    • setStartingQuantity

      public void setStartingQuantity(Integer startingQuantity)
      Defines the initial quantity available for this price data before a pricing event such as a flash sale. It only serves an informational purpose.
      Since:
      Pricing Client 2.0.3
    • setAvailableQuantity

      public void setAvailableQuantity(Integer availableQuantity)
      The available quantity that can use this price data. This is used for events such as a flash sale where the sale price is limited to a certain amount of quantity.
      Since:
      Pricing Client 2.0.3
    • setBackupPriceInfo

      public void setBackupPriceInfo(PriceInfo backupPriceInfo)
      If this PriceInfo is limited for events such as a flash sale, the backup is used for any remaining items that cannot get the sale price. The backup is the second best price that does not have a quantity restriction, if no other price lists exist, the item's base price is used.

      For example, if the sale price is only available for 2 more items, and the customer has 5 items in the cart, only 2 of them should get the sale price and the remaining items should get the backup price.

      Since:
      Pricing Client 2.0.3
    • setPriceTypeDetails

      public void setPriceTypeDetails(Map<String,PriceTypeDetail> priceTypeDetails)
      Map of each type of price to each corresponding PriceTypeDetail, which contains the best overall price for that type along with all the PriceDetails for the candidate PriceLists.
      Parameters:
      Map - of each type of price to each corresponding PriceTypeDetail
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object