Class PriceInfo
java.lang.Object
com.broadleafcommerce.pricing.client.domain.PriceInfo
- All Implemented Interfaces:
Serializable
,Comparable<PriceInfo>
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
int
Compares price.boolean
Defines 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 thisPriceInfo
is limited for events such as a flash sale, the backup is used for any remaining items that cannot get the sale price.javax.money.CurrencyUnit
javax.money.MonetaryAmount
getPrice()
Determined best price fortarget
.Id of the specific PriceData that this price came from.String 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 ofprice
whether 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 thePriceDetails
for 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.ThePriceableTarget
to which this info corresponds.This is the usage price if any from the same source as theprice
.int
hashCode()
boolean
Whether this PriceInfo has a limited quantity.boolean
isActive()
Whether this PriceInfo is active based on theactiveStartDate
andactiveEndDate
.void
setActiveEndDate
(Instant activeEndDate) Defines the ending time for which this price is activevoid
setActiveStartDate
(Instant activeStartDate) Defines the beginning time for which this price is active.void
setAvailableQuantity
(Integer availableQuantity) The available quantity that can use this price data.void
setBackupPriceInfo
(PriceInfo backupPriceInfo) If thisPriceInfo
is limited for events such as a flash sale, the backup is used for any remaining items that cannot get the sale price.void
setPrice
(javax.money.MonetaryAmount price) Determined best price fortarget
.void
setPriceDataId
(String priceDataId) Id of the specific PriceData that this price came from.void
setPriceDataType
(String priceDataType) void
setPriceListId
(String priceListId) String representation of the PriceList that provided thebest price
.void
setPriceListPriceSource
(String priceListPriceSource) If this price is from a price list, this field indicates the source of the price within the price list.void
setPriceType
(String priceType) The type ofprice
whether salePrice, standardPrice, contractPrice, etc.void
setPriceTypeDetails
(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 thePriceDetails
for the candidatePriceLists
.void
setRecurringPrice
(RecurringPriceDetail recurringPrice) This is the recurring price if any from the same source as theprice
.void
setStartingQuantity
(Integer startingQuantity) Defines the initial quantity available for this price data before a pricing event such as a flash sale.void
setTarget
(PriceableTarget target) ThePriceableTarget
to which this info corresponds.void
setUsagePrice
(UsagePriceDetail usagePrice) This is the usage price if any from the same source as theprice
.toString()
-
Constructor Details
-
PriceInfo
public PriceInfo()
-
-
Method Details
-
getCurrency
public javax.money.CurrencyUnit getCurrency() -
compareTo
Compares price. Null is more than non-null.- Specified by:
compareTo
in 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 theactiveStartDate
andactiveEndDate
.- Since:
- Pricing Client 2.0.3
-
getTarget
ThePriceableTarget
to which this info corresponds.- Returns:
- The
PriceableTarget
to 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 ofprice
whether salePrice, standardPrice, contractPrice, etc.- Returns:
- The type of
price
whether salePrice, standardPrice, contractPrice, etc.
-
getPriceDataId
Id of the specific PriceData that this price came from.Only applicable if the
priceListPriceSource
isDefaultPriceListPriceSources.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 thisPriceInfo
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
Map of each type of price to each correspondingPriceTypeDetail
, which contains the best overall price for that type along with all thePriceDetails
for the candidatePriceLists
.- Returns:
- Map of each type of price to each corresponding
PriceTypeDetail
-
setTarget
ThePriceableTarget
to which this info corresponds.- Parameters:
target
- ThePriceableTarget
to 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 ofprice
whether salePrice, standardPrice, contractPrice, etc.- Parameters:
priceType
- The type ofprice
whether salePrice, standardPrice, contractPrice, etc.
-
setPriceDataId
Id of the specific PriceData that this price came from.Only applicable if the
priceListPriceSource
isDefaultPriceListPriceSources.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 thisPriceInfo
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
Map of each type of price to each correspondingPriceTypeDetail
, which contains the best overall price for that type along with all thePriceDetails
for the candidatePriceLists
.- Parameters:
Map
- of each type of price to each correspondingPriceTypeDetail
-
equals
-
canEqual
-
hashCode
public int hashCode() -
toString
-