Class PriceTypeDetail

java.lang.Object
com.broadleafcommerce.pricing.client.domain.PriceTypeDetail
All Implemented Interfaces:
Serializable

public class PriceTypeDetail extends Object implements Serializable
Aggregation of PriceDetails for a specific type of price along with the price and currency of the "best" of all the candidate PriceLists.
Author:
Nathan Moore (nathandmoore)
See Also:
  • Field Details

    • VARIANT_BASE_FIELD

      public static String VARIANT_BASE_FIELD
    • BASE_FIELD

      public static String BASE_FIELD
    • PRICE_DATA_FIELD

      public static String PRICE_DATA_FIELD
  • Constructor Details

    • PriceTypeDetail

      public PriceTypeDetail()
  • Method Details

    • getCurrency

      @Nullable public javax.money.CurrencyUnit getCurrency()
      Extracts the CurrencyUnit from the price fields on PriceTypeDetail.

      It looks for getBestRecurringPriceDetail(), getBestUsagePriceDetail() and getBestPrice() to determine the CurrencyUnit.

      Returns null if the CurrencyUnit is not found.

      Returns:
      the CurrencyUnit in which the prices are present for this PriceTypeDetail
      Since:
      2.0.4
    • isDirectlyFromVariant

      public boolean isDirectlyFromVariant()
    • getType

      public String getType()
      The corresponding type of the price: salePrice, standardPrice, contractPrice, etc.
      Returns:
      The corresponding type of the price: salePrice, standardPrice, contractPrice, etc.
    • getDerivedFromFieldType

      public String getDerivedFromFieldType()
      A PriceInfo can be the result of a formula based pricing algorithm. For example, a sale price might be 10% off of the retail price. For proper sorting by the caller, it can be important to know the way that the price was derived. By default, for price infos and details returned from a formula, the derivedFromField will be either PRICE_DATA_FIELD, VARIANT_BASE_FIELD, or BASE_FIELD.
      Returns:
      Returns one of {"PRICE_DATA_FIELD", "VARIANT_BASE_FIELD", "BASE_FIELD", or null (representing none or unknown)}
    • getBestPrice

      public javax.money.MonetaryAmount getBestPrice()
      The determined best price value for this type of price from amongst all the candidates.
      Returns:
      The determined best price value for this type of price from amongst all the candidates.
    • getBestRecurringPriceDetail

      public RecurringPriceDetail getBestRecurringPriceDetail()
      Represents the details related to a recurring (or subscription) price include the terms.
      Since:
      Pricing Client 2.0.3
    • getBestUsagePriceDetail

      public UsagePriceDetail getBestUsagePriceDetail()
      Represents the details related to a usage price including the units.
      Since:
      Pricing Client 2.0.3
    • getPriceListId

      public String getPriceListId()
      String representation of the PriceList that provided bestPrice.
      Returns:
      String representation of the PriceList that provided bestPrice.
      See Also:
    • isHasCurrencyConversion

      public boolean isHasCurrencyConversion()
      Whether the current priceTypeDetail record has a converted PriceTypeDetail record which has been converted from the getCurrency() to the PriceInfoContext.getRequestedCurrency().

      This flag is set on the original PriceTypeDetail to indicate the presence of a corresponding PriceInfo.getConvertedPriceTypeDetails() entry.

      Since:
      2.0.4
    • getExchangeRateDetail

      public ExchangeRateDetail getExchangeRateDetail()
      The ExchangeRateDetail used to convert the price from the original currency to the PriceInfoContext.getRequestedCurrency().
      Since:
      2.0.4
    • getPriceDetails

      public Map<String,PriceDetail> getPriceDetails()
      A map for every candidate PriceList for the type, with the key being a PriceListRef.getId().
      Returns:
      A map for every candidate PriceList for the type, with the key being a PriceListRef.getId().
      See Also:
    • getPriceDataTierList

      public List<PriceDataTierRef> getPriceDataTierList()
      Used to store the priceDataTiers for this detail.
      Since:
      2.0.4
    • setType

      public void setType(String type)
      The corresponding type of the price: salePrice, standardPrice, contractPrice, etc.
      Parameters:
      type - The corresponding type of the price: salePrice, standardPrice, contractPrice, etc.
    • setDerivedFromFieldType

      public void setDerivedFromFieldType(String derivedFromFieldType)
      A PriceInfo can be the result of a formula based pricing algorithm. For example, a sale price might be 10% off of the retail price. For proper sorting by the caller, it can be important to know the way that the price was derived. By default, for price infos and details returned from a formula, the derivedFromField will be either PRICE_DATA_FIELD, VARIANT_BASE_FIELD, or BASE_FIELD.
      Parameters:
      derivedFromField - The type of field used in formula based pricing
    • setBestPrice

      public void setBestPrice(javax.money.MonetaryAmount bestPrice)
      The determined best price value for this type of price from amongst all the candidates.
      Parameters:
      bestPrice - The determined best price value for this type of price from amongst all the candidates.
    • setBestRecurringPriceDetail

      public void setBestRecurringPriceDetail(RecurringPriceDetail bestRecurringPriceDetail)
      Represents the details related to a recurring (or subscription) price include the terms.
      Since:
      Pricing Client 2.0.3
    • setBestUsagePriceDetail

      public void setBestUsagePriceDetail(UsagePriceDetail bestUsagePriceDetail)
      Represents the details related to a usage price including the units.
      Since:
      Pricing Client 2.0.3
    • setPriceListId

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

      public void setHasCurrencyConversion(boolean hasCurrencyConversion)
      Whether the current priceTypeDetail record has a converted PriceTypeDetail record which has been converted from the getCurrency() to the PriceInfoContext.getRequestedCurrency().

      This flag is set on the original PriceTypeDetail to indicate the presence of a corresponding PriceInfo.getConvertedPriceTypeDetails() entry.

      Since:
      2.0.4
    • setExchangeRateDetail

      public void setExchangeRateDetail(ExchangeRateDetail exchangeRateDetail)
      The ExchangeRateDetail used to convert the price from the original currency to the PriceInfoContext.getRequestedCurrency().
      Since:
      2.0.4
    • setPriceDetails

      public void setPriceDetails(Map<String,PriceDetail> priceDetails)
      A map for every candidate PriceList for the type, with the key being a PriceListRef.getId().
      Parameters:
      priceDetails - A map for every candidate PriceList for the type, with the key being a PriceListRef.getId().
      See Also:
    • setPriceDataTierList

      public void setPriceDataTierList(List<PriceDataTierRef> priceDataTierList)
      Used to store the priceDataTiers for this detail.
      Since:
      2.0.4
    • 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