|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object atg.nucleus.logging.VariableArgumentApplicationLoggingImpl atg.nucleus.GenericService atg.commerce.pricing.DiscountCalculatorService atg.commerce.pricing.OrderDiscountCalculator
public class OrderDiscountCalculator
Calculates OrderPriceInfos for Orders which the calculator is given.
This calculator consults the Qualifer service, looking for the Order to be priced.
It calls Qualifier.findQualifyingOrder
for this purpose. If it gets back an Order,
an OrderPriceInfo is computed based on the input PricingModel (RepositoryItem).
Qualifier
Field Summary | |
---|---|
static java.lang.String |
CLASS_VERSION
Class version string |
Fields inherited from class atg.commerce.pricing.DiscountCalculatorService |
---|
AMOUNT_INCREASE_TYPE, AMOUNT_OFF_TYPE, FIXED_PRICE_TYPE, ILLEGAL_TYPE, PERCENT_OFF_TYPE |
Fields inherited from class atg.nucleus.GenericService |
---|
SERVICE_INFO_KEY |
Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging |
---|
DEFAULT_LOG_TRACE_STATUS |
Fields inherited from interface atg.nucleus.logging.ApplicationLogging |
---|
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS |
Constructor Summary | |
---|---|
OrderDiscountCalculator()
|
Method Summary | |
---|---|
protected double |
computeGroupSubtotal(long pTimesToDiscount,
int pNumberOfGroups,
double pGroupSubTotal,
double pAdjuster,
java.lang.String pDiscountType,
java.lang.String pId)
Computes a shippinggroup subtotal based on the type of discount given. |
protected double |
computeGroupSubtotal(long pTimesToDiscount,
int pNumberOfGroups,
double pGroupSubTotal,
double pAdjuster,
java.lang.String pDiscountType,
java.lang.String pOrderId,
double pOldOrderAmount)
Computes a shippinggroup subtotal based on the type of discount given. |
void |
doStartService()
This is called after a Service has been created, placed into the naming hierarchy, and initialized with its configured property values. |
protected double |
getAmountToDiscount(OrderPriceInfo pPriceQuote,
Order pOrder,
RepositoryItem pPricingModel,
java.util.Locale pLocale,
RepositoryItem pProfile,
java.util.Map pExtraParameters)
This will return the amount that will eventually be discounted. |
protected java.util.List |
getDetailsToReceiveDiscountShare(ItemPriceInfo pItemPriceInfo)
This will return the price details in an item price info that will be marked as receiving a share of the order discount. |
protected java.util.List |
getItemsToReceiveDiscountShare(Order pOrder)
This will return the items in an order that will be marked as receiving a share of the order discount. |
PricingTools |
getPricingTools()
pricing tools to help with calculating prices |
boolean |
isSaveDetailsOrderDiscountShare()
If this is true, update itemPriceInfo.orderDiscountShare |
boolean |
isSaveItemsOrderDiscountShare()
If this is true, update itemPriceInfo.orderDiscountShare |
void |
priceOrder(OrderPriceInfo pPriceQuote,
Order pOrder,
RepositoryItem pPricingModel,
java.util.Locale pLocale,
RepositoryItem pProfile,
java.util.Map pExtraParameters)
Price a single order within a context defined by the input parameters. |
void |
setPricingTools(PricingTools pPricingTools)
pricing tools to help with calculating prices |
void |
setSaveDetailsOrderDiscountShare(boolean pSaveDetailsOrderDiscountShare)
|
void |
setSaveItemsOrderDiscountShare(boolean pSaveItemsOrderDiscountShare)
|
protected void |
updateItemsDiscountShare(Order pOrder,
double pUnadjustedPrice,
double pTotalAdjustment,
double pAdjuster,
java.lang.String pDiscountType,
long pTimesToDiscount)
This method will set the orderDiscountShare property of each CommerceItem's priceInfo. |
protected double |
updateShippingItemsSubtotalMaps(double pOrderSubTotal,
double pOldOrderAmount,
MatchingObject pQualifier,
double pAdjuster,
java.lang.String pDiscountType,
OrderPriceInfo pPriceQuote,
Order pOrder,
RepositoryItem pPricingModel,
java.util.Map pExtraParameters)
These method will iterate through each of the maps in the OrderPriceInfo that contain shipping group subtotal information. |
Methods inherited from class atg.commerce.pricing.DiscountCalculatorService |
---|
adjust, adjustAmount, getDiscountType, getPricingModelProperties, getQualifierService, isNegativeAmountException, setNegativeAmountException, setPricingModelProperties, setQualifierService |
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl |
---|
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static java.lang.String CLASS_VERSION
Constructor Detail |
---|
public OrderDiscountCalculator()
Method Detail |
---|
public void setPricingTools(PricingTools pPricingTools)
pPricingTools
- new value to setpublic PricingTools getPricingTools()
public void setSaveItemsOrderDiscountShare(boolean pSaveItemsOrderDiscountShare)
public boolean isSaveItemsOrderDiscountShare()
public void setSaveDetailsOrderDiscountShare(boolean pSaveDetailsOrderDiscountShare)
public boolean isSaveDetailsOrderDiscountShare()
public void priceOrder(OrderPriceInfo pPriceQuote, Order pOrder, RepositoryItem pPricingModel, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters) throws PricingException
priceOrder
in interface OrderPricingCalculator
pPriceQuote
- OrderPriceInfo representing the current price quote for the orderpOrder
- The order to pricepPricingModel
- A RepositoryItems representing a PricingModelpProfile
- The user's profilepExtraParameters
- A Map of extra parameters to be used in the pricing, may be null
PricingException
updateShippingItemsSubtotalMaps(double, double, atg.commerce.pricing.definition.MatchingObject, double, java.lang.String, atg.commerce.pricing.OrderPriceInfo, atg.commerce.order.Order, atg.repository.RepositoryItem, java.util.Map)
protected double updateShippingItemsSubtotalMaps(double pOrderSubTotal, double pOldOrderAmount, MatchingObject pQualifier, double pAdjuster, java.lang.String pDiscountType, OrderPriceInfo pPriceQuote, Order pOrder, RepositoryItem pPricingModel, java.util.Map pExtraParameters) throws PricingException
taxableShippingItemsSubtotalPriceInfos
nonTaxableShippingItemsSubtotalPriceInfos
shippingItemsSubtotalPriceInfos
computeGroupSubtotal
is called. The amount
of the price info in the entry is set to this value, the info is marked discounted, and
a new adjustement is added to the info
pOrderSubTotal
- The new subtotal of the orderpOldOrderAmount
- The previous subtotal of the orderpQualifier
- The MatchingObject as returned by Qualifier.evaluateQualifierpAdjuster
- The adjuster of the promotionpDiscountType
- The type of discount being givenpPriceQuote
- The order's price infopOrder
- The order that was discountedpPricingModel
- The promotion that changed the price of the orderpExtraParameters
- Any extra parameters
PricingException
protected double computeGroupSubtotal(long pTimesToDiscount, int pNumberOfGroups, double pGroupSubTotal, double pAdjuster, java.lang.String pDiscountType, java.lang.String pId) throws PricingException
pTimesToDiscount
- the number of times we should apply the configured discountpNumberOfGroups
- the number of groups in the order, including the one for which
this method is computing a subtotalpGroupSubTotal
- is the subtotal that needs adjustingpAdjuster
- is the amount by which to adjust pGroupSubTotalpDiscountType
- the way in which pAdjuster is applied to pGroupSubTotal. May be one of:
"Fixed Price", "Amount Off", or "Percent Off".pId
- an ID to associate with this adjustment for error reporting
PricingException
- if there was a problem computing the group subtotalprotected double computeGroupSubtotal(long pTimesToDiscount, int pNumberOfGroups, double pGroupSubTotal, double pAdjuster, java.lang.String pDiscountType, java.lang.String pOrderId, double pOldOrderAmount) throws PricingException
pTimesToDiscount
- the number of times we should apply the configured discountpNumberOfGroups
- the number of groups in the order, including the one for which
this method is computing a subtotalpGroupSubTotal
- is the subtotal that needs adjustingpAdjuster
- is the amount by which to adjust pGroupSubTotalpDiscountType
- the way in which pAdjuster is applied to pGroupSubTotal. May be one of:
"Fixed Price", "Amount Off", or "Percent Off".pId
- an ID to associate with this adjustment for error reporting
PricingException
- if there was a problem computing the group subtotalprotected void updateItemsDiscountShare(Order pOrder, double pUnadjustedPrice, double pTotalAdjustment, double pAdjuster, java.lang.String pDiscountType, long pTimesToDiscount) throws PricingException
saveItemsOrderDiscountShare
is true. If saveDetailsOrderDiscountShare
is true, then the
orderDiscountShare property of each DetailedItemPriceInfo is also updated.
pOrder
- the order that was discountedpUnadjustedPrice
- The original pre-discount price of the orderpTotalAdjustment
- This is the total change to the order total, for the current promotionpAdjuster
- The size of the discountpDiscountType
- the way in which pAdjuster is applied to pGroupSubTotal. May be one of:
"Fixed Price", "Amount Off", or "Percent Off".pTimesToDiscount
- The number of times to apply the given discount
PricingException
protected double getAmountToDiscount(OrderPriceInfo pPriceQuote, Order pOrder, RepositoryItem pPricingModel, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters) throws PricingException
pPriceQuote
- OrderPriceInfo representing the current price quote for the orderpOrder
- The order that will be discounted (ignored by default)pPricingModel
- A RepositoryItems representing a PricingModel (ignored by default)pProfile
- The user's profile (ignored by default)pExtraParameters
- A Map of extra parameters to be used in the pricing, may be null (ignored by default)
PricingException
protected java.util.List getDetailsToReceiveDiscountShare(ItemPriceInfo pItemPriceInfo)
pOrder
- The order that will be discounted
protected java.util.List getItemsToReceiveDiscountShare(Order pOrder)
pOrder
- The order that will be discounted
public void doStartService() throws ServiceException
GenericService
doStartService
in class GenericService
ServiceException
- if the Service had a problem starting up
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |