public class GroupDiscountCalculator extends ItemDiscountCalculator implements CalculatorInfoProvider
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CLASS_VERSION
Class version string
|
static java.lang.String |
GROUP_CALCULATOR_TYPE
PMDL calculator type
|
EXTRA_PARAM_QUALIFIERSERVICE
AMOUNT_INCREASE_TYPE, AMOUNT_OFF_TYPE, FIXED_PRICE_TYPE, ILLEGAL_TYPE, mPromotionTools, PERCENT_OFF_TYPE
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 |
---|
GroupDiscountCalculator() |
Modifier and Type | Method and Description |
---|---|
protected java.util.Map<java.lang.Integer,atg.commerce.pricing.DiscountGroup> |
buildGroups(java.util.Collection qualifyingItems)
Build a structure which places quantities of qualified detailed item price infos
into groups for purposes of discounting.
|
double |
findAdjustedPriceWithinGroup(DetailedItemPriceInfo pDetailedItemPriceInfo,
RepositoryItem pPricingModel,
java.util.Locale pLocale,
double pGroupTotal,
java.util.Map pExtraParameters) |
CalculatorInfo |
getCalculatorInfo()
Retrieve information about this calculator.
|
PricingTools |
getPricingTools()
pricing tools to help with calculating prices
|
protected void |
handleLeftOvers(java.util.List<DetailedItemPriceInfo> pDetails,
double pLeftOvers)
This method deals with the case where precision may be lost when applying discount to multiple items due
to rounding.
|
protected void |
handleLeftOvers(java.util.List<DetailedItemPriceInfo> pDetails,
double pLeftOvers,
java.lang.String pCurrencyCode)
This method deals with the case where precision may be lost when applying
discount to multiple items due to rounding.
|
protected void |
priceGroup(atg.commerce.pricing.DiscountGroup pDiscountGroup,
RepositoryItem pPricingModel,
java.util.Locale pLocale,
double pGroupTotal,
java.util.Map pExtraParameters)
Re-prices dipis within a group according to the pricing model passed in.
|
void |
priceItems(java.util.List pPriceQuotes,
java.util.List pItems,
RepositoryItem pPricingModel,
java.util.Locale pLocale,
RepositoryItem pProfile,
Order pOrder,
java.util.Map pExtraParameters)
Price a List of items together in a context
when it comes right down to it, we're only discounting single items :
the only reason we need to price items in a context is to allow complex
qualification statements.
|
void |
setPricingTools(PricingTools pPricingTools)
pricing tools to help with calculating prices
|
protected void |
updateQualifiedItems(java.util.Collection pQualifiedItems,
java.util.Map pExtraParameters)
Update a qualified item to reflect any re-pricing operations carried out on its associated dipis.
|
determineDiscountNumber, determineDiscountNumberWithFraction, doStartService, findAdjustedPrice, findQualifyingItems, getAmountToDiscount, getRangeComparator, priceDetailedItemPriceInfo, priceEachItem, priceItem, priceQualifyingItem, priceQualifyingItems, setRangeComparator, updateDetailedPriceInfos, updateQualifyingDetails, updateQuantityAsQualifier, validateQualifierService
adjust, adjustAmount, adjustAmount, getAdjuster, getDiscountType, getDiscountType, getPricingModelProperties, getPromotionTools, getQualifierService, getQualifierService, isNegativeAmountException, setNegativeAmountException, setPricingModelProperties, setPromotionTools, setQualifierService
addLogListener, createAdminServlet, 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 GROUP_CALCULATOR_TYPE
public void setPricingTools(PricingTools pPricingTools)
setPricingTools
in class ItemDiscountCalculator
pPricingTools
- new value to setpublic PricingTools getPricingTools()
getPricingTools
in class ItemDiscountCalculator
public void priceItems(java.util.List pPriceQuotes, java.util.List pItems, RepositoryItem pPricingModel, java.util.Locale pLocale, RepositoryItem pProfile, Order pOrder, java.util.Map pExtraParameters) throws PricingException
ItemDiscountCalculator
priceItems
in interface ItemPricingCalculator
priceItems
in class ItemDiscountCalculator
pPriceQuotes
- List of ItemPriceInfo objects representing the current price quotes for the itemspItems
- The items to pricepPricingModel
- A RepositoryItem representing a PricingModelpLocale
- the locale for this pricingpProfile
- The user's profilepOrder
- The Order object of which the List of items are a part, may be nullpExtraParameters
- A Map of extra parameters to be used in the pricing, may be nullPricingException
- if there was a problem in determining an item's pricepublic double findAdjustedPriceWithinGroup(DetailedItemPriceInfo pDetailedItemPriceInfo, RepositoryItem pPricingModel, java.util.Locale pLocale, double pGroupTotal, java.util.Map pExtraParameters) throws PricingException
pDetailedItemPriceInfo
- - Detailed Item Price Info whose price we will adjustpPricingModel
- - Pricing Model including the discount type and amountpLocale
- the locale in which the items are to be discountedpGroupTotal
- - total value of the current grouppExtraParameters
- any extra information that this method might need to set the
prices of a number of the qualifying itemPricingException
public CalculatorInfo getCalculatorInfo()
getCalculatorInfo
in interface CalculatorInfoProvider
protected java.util.Map<java.lang.Integer,atg.commerce.pricing.DiscountGroup> buildGroups(java.util.Collection qualifyingItems) throws PricingException
qualifyingItems
- - the items whose detailed item price infos we wish to place
into groups.PricingException
protected void updateQualifiedItems(java.util.Collection pQualifiedItems, java.util.Map pExtraParameters) throws PricingException
pQualifiedItems
- - the items we wish to updatepExtraParameters
- any extra information that this method might need to set the
prices of a number of the qualifying itemPricingException
protected void priceGroup(atg.commerce.pricing.DiscountGroup pDiscountGroup, RepositoryItem pPricingModel, java.util.Locale pLocale, double pGroupTotal, java.util.Map pExtraParameters) throws PricingException
pPricingModel
- - the pricing model which will tell us the size and kind of discount to apply.pLocale
- - the locale in which the items are to be discountedpGroupTotal
- - The current total cost of all items in the group.pExtraParameters
- - any extra information that this method might need to set the
prices of a number of the qualifying itemPricingException
protected void handleLeftOvers(java.util.List<DetailedItemPriceInfo> pDetails, double pLeftOvers)
pDetails
- List of DetailedItemPriceInfo for items in the grouppLeftOvers
- The money lost through the rounding process that need to be re-distributed into the DIPIsprotected void handleLeftOvers(java.util.List<DetailedItemPriceInfo> pDetails, double pLeftOvers, java.lang.String pCurrencyCode)
pDetails
- List of DetailedItemPriceInfo for items in the grouppLeftOvers
- The money lost through the rounding process that need to be
re-distributed into the DIPIs *pCurrencyCode
- the currency code whose number of decimal places will be used in any rounding operations