Class PriceInfo
- All Implemented Interfaces:
Serializable,Comparable<PriceInfo>
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:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanintCompares price.booleanDefines the ending time for which this price is activeDefines the beginning time for which this price is active.The available quantity that can use this price data.If thisPriceInfois limited for events such as a flash sale, the backup is used for any remaining items that cannot get the sale price.A reference (typically the Id) of the CancellationPolicy for this priceData that governs how this priceData's subscription would be cancelled.Map containing the entries ofpriceTypeDetailsbut converted to the requested currency.javax.money.CurrencyUnitA PriceInfo can be the result of a formula based pricing algorithm.Only relevant for price that came from a specific PriceData.javax.money.MonetaryAmountgetPrice()Determined best price fortarget.Map containing the info related to adjustments made to the price.Id of the specific PriceData that this price came from.Used to store the priceDataTiers for the price type returned for this price infoString representation of the PriceList that provided thebest price.If this price is from a price list, this field indicates the source of the price within the price list.The type ofpricewhether salePrice, standardPrice, contractPrice, etc.Map of each type of price to each correspondingPriceTypeDetail, which contains the best overall price for that type along with all thePriceDetailsfor the candidatePriceLists.This is the recurring price if any from the same source as theprice.Defines the initial quantity available for this price data before a pricing event such as a flash sale.ThePriceableTargetto which this info corresponds.Optional<javax.money.MonetaryAmount>This is the usage price if any from the same source as theprice.inthashCode()booleanWhether this PriceInfo has a limited quantity.booleanisActive()Whether this PriceInfo is active based on theactiveStartDateandactiveEndDate.booleanbooleanvoidsetActiveEndDate(Instant activeEndDate) Defines the ending time for which this price is activevoidsetActiveStartDate(Instant activeStartDate) Defines the beginning time for which this price is active.voidsetAvailableQuantity(Integer availableQuantity) The available quantity that can use this price data.voidsetBackupPriceInfo(PriceInfo backupPriceInfo) If thisPriceInfois limited for events such as a flash sale, the backup is used for any remaining items that cannot get the sale price.voidsetCancellationPolicyRef(String cancellationPolicyRef) A reference (typically the Id) of the CancellationPolicy for this priceData that governs how this priceData's subscription would be cancelled.voidsetConvertedPriceTypeDetails(Map<String, PriceTypeDetail> convertedPriceTypeDetails) Map containing the entries ofpriceTypeDetailsbut converted to the requested currency.voidsetDerivedFromFieldType(String derivedFromFieldType) A PriceInfo can be the result of a formula based pricing algorithm.voidsetPaymentStrategy(String paymentStrategy) Only relevant for price that came from a specific PriceData.voidsetPrice(javax.money.MonetaryAmount price) Determined best price fortarget.voidsetPriceAdjustmentInfo(PriceAdjustmentInfo priceAdjustmentInfo) Map containing the info related to adjustments made to the price.voidsetPriceDataId(String priceDataId) Id of the specific PriceData that this price came from.voidsetPriceDataTierList(List<PriceDataTierRef> priceDataTierList) Used to store the priceDataTiers for the price type returned for this price infovoidsetPriceDataType(String priceDataType) voidsetPriceListId(String priceListId) String representation of the PriceList that provided thebest price.voidsetPriceListPriceSource(String priceListPriceSource) If this price is from a price list, this field indicates the source of the price within the price list.voidsetPriceType(String priceType) The type ofpricewhether salePrice, standardPrice, contractPrice, etc.voidsetPriceTypeDetails(Map<String, PriceTypeDetail> priceTypeDetails) Map of each type of price to each correspondingPriceTypeDetail, which contains the best overall price for that type along with all thePriceDetailsfor the candidatePriceLists.voidsetRecurringPrice(RecurringPriceDetail recurringPrice) This is the recurring price if any from the same source as theprice.voidsetStartingQuantity(Integer startingQuantity) Defines the initial quantity available for this price data before a pricing event such as a flash sale.voidsetTarget(PriceableTarget target) ThePriceableTargetto which this info corresponds.voidsetUsagePrice(UsagePriceDetail usagePrice) This is the usage price if any from the same source as theprice.toString()
-
Field Details
-
PRICE_INFO_COMPARATOR
-
-
Constructor Details
-
PriceInfo
public PriceInfo()
-
-
Method Details
-
isDirectlyFromVariant
public boolean isDirectlyFromVariant() -
isFromPriceData
public boolean isFromPriceData() -
getCurrency
public javax.money.CurrencyUnit getCurrency() -
compareTo
Compares price. Null is more than non-null.- Specified by:
compareToin interfaceComparable<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 theactiveStartDateandactiveEndDate.- Since:
- Pricing Client 2.0.3
-
getTotalAdjustmentAmount
-
getTarget
ThePriceableTargetto which this info corresponds.- Returns:
- The
PriceableTargetto which this info corresponds. - See Also:
-
getPrice
public javax.money.MonetaryAmount getPrice()Determined best price fortarget.- Returns:
- Determined best price for
target.
-
getRecurringPrice
This is the recurring price if any from the same source as theprice. 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
This is the usage price if any from the same source as theprice. 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
The type ofpricewhether salePrice, standardPrice, contractPrice, etc.- Returns:
- The type of
pricewhether salePrice, standardPrice, contractPrice, etc.
-
getPaymentStrategy
Only relevant for price that came from a specific PriceData.Represents the payment strategy, specifically when payment is billed for a recurring price.
- Since:
- 2.0.4
- See Also:
-
getPriceDataId
Id of the specific PriceData that this price came from.Only applicable if the
priceListPriceSourceisDefaultPriceListPriceSources.BLC_PRICE_LIST_PRICE_DATA.- Returns:
- Id of the specific PriceData that this price came from
- Since:
- Pricing Client 2.0.3
-
getPriceDataType
-
getPriceListId
String representation of the PriceList that provided thebest price.- Returns:
- String representation of the PriceList that provided the
best price. - See Also:
-
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
Defines the beginning time for which this price is active.- Since:
- Pricing Client 2.0.3
-
getActiveEndDate
Defines the ending time for which this price is active- Since:
- Pricing Client 2.0.3
-
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
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
If thisPriceInfois 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
-
getCancellationPolicyRef
A reference (typically the Id) of the CancellationPolicy for this priceData that governs how this priceData's subscription would be cancelled.This is only relevant for prices that are associated with a subscription.
- Since:
- 2.0.4
-
getPriceTypeDetails
Map of each type of price to each correspondingPriceTypeDetail, which contains the best overall price for that type along with all thePriceDetailsfor the candidatePriceLists.- Returns:
- Map of each type of price to each corresponding
PriceTypeDetail
-
getConvertedPriceTypeDetails
Map containing the entries ofpriceTypeDetailsbut converted to the requested currency.The requested currency is obtained from the
PriceContext.- Since:
- 2.0.4
-
getPriceAdjustmentInfo
Map containing the info related to adjustments made to the price.- Since:
- 2.0.4
-
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}
-
getPriceDataTierList
Used to store the priceDataTiers for the price type returned for this price info- Since:
- 2.0.4
-
setTarget
ThePriceableTargetto which this info corresponds.- Parameters:
target- ThePriceableTargetto which this info corresponds.- See Also:
-
setPrice
public void setPrice(javax.money.MonetaryAmount price) Determined best price fortarget.- Parameters:
price- Determined best price fortarget.
-
setRecurringPrice
This is the recurring price if any from the same source as theprice. 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 theprice- Since:
- Pricing Client 2.0.3
-
setUsagePrice
This is the usage price if any from the same source as theprice. 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 theprice- Since:
- Pricing Client 2.0.3
-
setPriceType
The type ofpricewhether salePrice, standardPrice, contractPrice, etc.- Parameters:
priceType- The type ofpricewhether salePrice, standardPrice, contractPrice, etc.
-
setPaymentStrategy
Only relevant for price that came from a specific PriceData.Represents the payment strategy, specifically when payment is billed for a recurring price.
- Since:
- 2.0.4
- See Also:
-
setPriceDataId
Id of the specific PriceData that this price came from.Only applicable if the
priceListPriceSourceisDefaultPriceListPriceSources.BLC_PRICE_LIST_PRICE_DATA.- Parameters:
priceDataId- Id of the specific PriceData that this price came from- Since:
- Pricing Client 2.0.3
-
setPriceDataType
-
setPriceListId
String representation of the PriceList that provided thebest price.- Parameters:
priceListId- String representation of the PriceList that provided thebest price.- See Also:
-
setPriceListPriceSource
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
Defines the beginning time for which this price is active.- Since:
- Pricing Client 2.0.3
-
setActiveEndDate
Defines the ending time for which this price is active- Since:
- Pricing Client 2.0.3
-
setStartingQuantity
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
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
If thisPriceInfois 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
-
setCancellationPolicyRef
A reference (typically the Id) of the CancellationPolicy for this priceData that governs how this priceData's subscription would be cancelled.This is only relevant for prices that are associated with a subscription.
- Since:
- 2.0.4
-
setPriceTypeDetails
Map of each type of price to each correspondingPriceTypeDetail, which contains the best overall price for that type along with all thePriceDetailsfor the candidatePriceLists.- Parameters:
Map- of each type of price to each correspondingPriceTypeDetail
-
setConvertedPriceTypeDetails
Map containing the entries ofpriceTypeDetailsbut converted to the requested currency.The requested currency is obtained from the
PriceContext.- Since:
- 2.0.4
-
setPriceAdjustmentInfo
Map containing the info related to adjustments made to the price.- Since:
- 2.0.4
-
setDerivedFromFieldType
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
-
setPriceDataTierList
Used to store the priceDataTiers for the price type returned for this price info- Since:
- 2.0.4
-
equals
-
canEqual
-
hashCode
public int hashCode() -
toString
-