public class ItemTieredPriceCalculator extends GenericService implements ItemSchemePriceCalculator, ItemPriceSourceHandler
Tier pricing means the item's unit price will be variable, based on how many quantities ordered and how the tier is defined. For instance, if buy quantity from 0 to 10, the tier price is 10$, buy quantity from 11 to 20, the unit price is 9$, buy quantity from 21 to 30, the unit price is 8$ then if the user buys 25 items, the total price will be 10*10 + 10*9 + 5*8 = 230$
ItemSchemePriceCalculator
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CLASS_VERSION
Class version string
|
static java.lang.String |
RANGE_PROPERTY |
SERVICE_INFO_KEY
DEFAULT_LOG_TRACE_STATUS
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
Constructor and Description |
---|
ItemTieredPriceCalculator() |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getComplexPricePropertyName()
the name of the property for the ComplexPrice
|
ItemPriceSource |
getItemPriceSource(ItemPriceInfo pPriceQuote,
CommerceItem pItem,
RepositoryItem pPricingModel,
java.util.Locale pLocale,
RepositoryItem pProfile,
java.util.Map pExtraParameters)
This method is called by the calculator to return the
ItemPriceSource that
should be used to price the given CommerceItem |
OrderManager |
getOrderManager()
The order manager is used to find the relationships for a given
range.
|
java.lang.String |
getPriceLevelPropertyName()
the name of the property for the PriceLevel
|
java.util.List |
getPriceLevels(ItemPriceSource pItemPriceSource,
RepositoryItem pPrice,
ItemPriceInfo pPriceQuote,
CommerceItem pItem,
RepositoryItem pPricingModel,
java.util.Locale pLocale,
RepositoryItem pProfile,
java.util.Map pExtraParameters)
This method is called by the calculator to provide the List of priceLevel repository
items used to price the given commerce item.
|
java.lang.String |
getPricePropertyName()
the name of the property for the price of each price level
|
PricingTools |
getPricingTools()
pricing tools to help with price calculation
|
java.lang.String |
getQuantityPropertyName()
the name of the property for the quantity of each price level
|
boolean |
populateItemPriceSource(ItemPriceSource pItemPriceSource,
Order pOrder,
CommerceItem pCommerceItem,
CommerceItem pParentCommerceItem,
java.util.Map pExtraParameters)
Generates the
ItemPriceSource listVolumeLevels based on the PricingAdjustments
added by this calculator to the given CommerceItem. |
void |
priceItem(RepositoryItem pPrice,
ItemPriceInfo pPriceQuote,
CommerceItem pItem,
RepositoryItem pPricingModel,
java.util.Locale pLocale,
RepositoryItem pProfile,
java.util.Map pExtraParameters)
Sets the tiered price with the given determined price
|
void |
setComplexPricePropertyName(java.lang.String pComplexPricePropertyName)
the name of the property for the ComplexPrice
|
void |
setOrderManager(OrderManager pOrderManager) |
void |
setPriceLevelPropertyName(java.lang.String pPriceLevelPropertyName)
the name of the property for the PriceLevel
|
void |
setPricePropertyName(java.lang.String pPricePropertyName)
the name of the property for the price of each price level
|
void |
setPricingTools(PricingTools pPricingTools)
pricing tools to help with price calculation
|
void |
setQuantityPropertyName(java.lang.String pQuantityPropertyName)
the name of the property for the quantity of each price level
|
boolean |
shouldConsumeSource(ItemPriceSource pItemPriceSource)
This implementation is only here to satisfy the interface.
|
addLogListener, createAdminServlet, doStartService, doStopService, getAbsoluteName, getAdminServlet, getAdminServletOutputStreamEncoding, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isAdminServletUseServletOutputStream, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, reResolveThis, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setAdminServletOutputStreamEncoding, setAdminServletUseServletOutputStream, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
public static java.lang.String CLASS_VERSION
public static final java.lang.String RANGE_PROPERTY
public void setPricingTools(PricingTools pPricingTools)
pPricingTools
- new value to setpublic PricingTools getPricingTools()
public void setOrderManager(OrderManager pOrderManager)
public OrderManager getOrderManager()
public void setComplexPricePropertyName(java.lang.String pComplexPricePropertyName)
pComplexPricePropertyName
- new value to setpublic java.lang.String getComplexPricePropertyName()
public void setPriceLevelPropertyName(java.lang.String pPriceLevelPropertyName)
pPriceLevelPropertyName
- new value to setpublic java.lang.String getPriceLevelPropertyName()
public void setQuantityPropertyName(java.lang.String pQuantityPropertyName)
pQuantityPropertyName
- new value to setpublic java.lang.String getQuantityPropertyName()
public void setPricePropertyName(java.lang.String pPricePropertyName)
pPricePropertyName
- new value to setpublic java.lang.String getPricePropertyName()
public void priceItem(RepositoryItem pPrice, ItemPriceInfo pPriceQuote, CommerceItem pItem, RepositoryItem pPricingModel, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters) throws PricingException
This method calls getPriceLevels
to determine the list of
price levels that should be used to price the item.
priceItem
in interface ItemSchemePriceCalculator
pPrice
- the price as extracted from the PriceListpPriceQuote
- ItemPriceInfo representing the current price quote for the itempItem
- The item to pricepPricingModel
- A RepositoryItem representing a PricingModelpLocale
- the locale in which this item should be pricedpProfile
- The user's profilepExtraParameters
- A Map of extra parameters to be used in the pricing, may be nullPricingException
- if there was a problem pricing the input pItemgetPriceLevels(ItemPriceSource, RepositoryItem, ItemPriceInfo, CommerceItem, RepositoryItem, Locale, RepositoryItem, Map)
public java.util.List getPriceLevels(ItemPriceSource pItemPriceSource, RepositoryItem pPrice, ItemPriceInfo pPriceQuote, CommerceItem pItem, RepositoryItem pPricingModel, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters) throws PricingException
This method first checks for a ItemPriceSource and returns its list volume levels. Otherwise, it returns the levels from the given price repository item.
pItemPriceSource
- the ItemPriceSource
that is being use to price the item. The value can be null when
no source is being used.pPrice
- the price object found for the item. This value can be null when a price source is being used.pPriceQuote
- the current price infopItem
- the item being pricedpPricingModel
- pLocale
- pProfile
- pExtraParameters
- the extra parameter mapPricingException
public ItemPriceSource getItemPriceSource(ItemPriceInfo pPriceQuote, CommerceItem pItem, RepositoryItem pPricingModel, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters)
ItemPriceSource
that
should be used to price the given CommerceItem
getItemPriceSource
in interface ItemPriceSourceHandler
pPriceQuote
- the new ItemPriceInfo for that's being generated in the pricing operationpItem
- the commerce item that's being pricedpPricingModel
- the current pricing modelpLocale
- the localepProfile
- the customer profile referencepExtraParameters
- the extra parameter map passed to the pricing operation.PricingTools.getItemPriceSource(ItemPriceInfo, CommerceItem, RepositoryItem, Locale, RepositoryItem, Map)
public boolean populateItemPriceSource(ItemPriceSource pItemPriceSource, Order pOrder, CommerceItem pCommerceItem, CommerceItem pParentCommerceItem, java.util.Map pExtraParameters)
ItemPriceSource listVolumeLevels
based on the PricingAdjustments
added by this calculator to the given CommerceItem. The PricingAdjustments are used to reverse engineer the levels used to price the
item. Note that the levels can only be determined up to the last one used to originally price the item.populateItemPriceSource
in interface ItemPriceSourceHandler
pItemPriceSource
- the source being generated and populated with pricing data.pOrder
- the OrderpCommerceItem
- the item for which the source is being createdpParentCommerceItem
- the item that contained pCommerceItempExtraParameters
- a Map of extra parameters objects that was passed to the initial call to generate the source objects.ItemPriceSource
properties were updatedpublic boolean shouldConsumeSource(ItemPriceSource pItemPriceSource)
priceListScheme
in the ItemPriceSource
shouldConsumeSource
in interface ItemPriceSourceHandler