atg.commerce.csr.pricing.calculators
Class ExchangeOrderDiscountCalculator

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.commerce.pricing.DiscountCalculatorService
              extended by atg.commerce.pricing.OrderDiscountCalculator
                  extended by atg.commerce.csr.pricing.calculators.ExchangeOrderDiscountCalculator
All Implemented Interfaces:
OrderPricingCalculator, atg.naming.AbsoluteNameable, NameContextBindingListener, NameContextElement, atg.naming.NameContextParentable, NameResolver, AdminableService, atg.nucleus.Configured, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, java.util.EventListener

public class ExchangeOrderDiscountCalculator
extends OrderDiscountCalculator

This calculator is used to apply order promotions to an exchange order.

The order promotions that are applied are those that have been applied to the promotion evaluation order. The value of each order promotion is a pre-calcuated and stored in the ReturnRequest.

This calculator overrides getAdjuster to return the pre-calcuated value of the promotion. It also overrides getDicountType to always return the Constants.AMOUNT_OFF type.

See Also:
getAdjuster(RepositoryItem, Map), getDiscountType(RepositoryItem, Map)

Field Summary
static java.lang.String CLASS_VERSION
           
protected  ReturnManager mReturnManager
           
 
Fields inherited from class atg.commerce.pricing.DiscountCalculatorService
AMOUNT_INCREASE_TYPE, AMOUNT_OFF_TYPE, FIXED_PRICE_TYPE, ILLEGAL_TYPE, mPromotionTools, 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
ExchangeOrderDiscountCalculator()
           
 
Method Summary
protected  MatchingObject findMatchingObject(OrderPriceInfo pPriceQuote, java.util.List pPriceQuotes, java.util.List pItems, RepositoryItem pPricingModel, RepositoryItem pProfile, java.util.Locale pLocale, Order pOrder, java.util.Map pExtraParameters)
          Overrides the base behavior to unconditionally return a MatchingObject.
protected  double getAdjuster(RepositoryItem pPricingModel, java.util.Map pExtraParameters)
          Overrides the base behavior to return the pre-calculated value for the promotion that's stored in the ReturnRequest
protected  java.lang.String getDiscountType(RepositoryItem pPricingModel, java.util.Map pExtraParameters)
          Overrides the base behavior to always return the amount off type
 ReturnManager getReturnManager()
           
 void priceOrder(OrderPriceInfo pPriceQuote, Order pOrder, RepositoryItem pPricingModel, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters)
          Overrides the based behavior to look for a return request passed through the extra parameters map.
 void setReturnManager(ReturnManager pReturnManager)
          Sets the ReturnManager
 
Methods inherited from class atg.commerce.pricing.OrderDiscountCalculator
adjustOrderSubTotal, adjustShippingGroupSubtotalPriceInfos, applyAdjustmentToNonTaxablePriceInfo, applyAdjustmentToSubtotalPriceInfo, applyAdjustmentToTaxablePriceInfo, computeGroupSubtotal, computeGroupSubtotal, computeGroupSubtotal, createCurrentShareMap, doStartService, getAmountToDiscount, getAmountToDiscount, getDetailsToReceiveDiscountShare, getItemsToReceiveDiscountShare, getNonDiscountableTotal, getNonTaxableShippingGroupTotal, getPricingTools, getTaxableShippingGroupTotal, getTotalForShippingGroups, getTotalShareValueForShippingGroup, isSaveDetailsOrderDiscountShare, isSaveItemsOrderDiscountShare, setPricingTools, setSaveDetailsOrderDiscountShare, setSaveItemsOrderDiscountShare, updateItemsDiscountShare, updateItemsDiscountShare, updateShippingItemsSubtotalMaps
 
Methods inherited from class atg.commerce.pricing.DiscountCalculatorService
adjust, adjustAmount, getDiscountType, getPricingModelProperties, getPromotionTools, getQualifierService, getQualifierService, isNegativeAmountException, setNegativeAmountException, setPricingModelProperties, setPromotionTools, setQualifierService
 
Methods inherited from class atg.nucleus.GenericService
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
 
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, 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

CLASS_VERSION

public static final java.lang.String CLASS_VERSION
See Also:
Constant Field Values

mReturnManager

protected ReturnManager mReturnManager
Constructor Detail

ExchangeOrderDiscountCalculator

public ExchangeOrderDiscountCalculator()
Method Detail

setReturnManager

public void setReturnManager(ReturnManager pReturnManager)
Sets the ReturnManager

Parameters:
pReturnTools - the ReturnManagers

getReturnManager

public ReturnManager getReturnManager()
Returns:
the ReturnManager

priceOrder

public void priceOrder(OrderPriceInfo pPriceQuote,
                       Order pOrder,
                       RepositoryItem pPricingModel,
                       java.util.Locale pLocale,
                       RepositoryItem pProfile,
                       java.util.Map pExtraParameters)
                throws PricingException
Overrides the based behavior to look for a return request passed through the extra parameters map. If one is found and the given order is the return's replacement order, it calls super for each order promotion applied to the promotion evaluation order.

Specified by:
priceOrder in interface OrderPricingCalculator
Overrides:
priceOrder in class OrderDiscountCalculator
Parameters:
pPriceQuote - OrderPriceInfo representing the current price quote for the order
pOrder - The order to price
pPricingModel - A RepositoryItems representing a PricingModel
pProfile - The user's profile
pExtraParameters - A Map of extra parameters to be used in the pricing, may be null
Throws:
PricingException
See Also:
OrderDiscountCalculator.updateItemsDiscountShare(Order, double, double, double, String, long), OrderDiscountCalculator.adjustShippingGroupSubtotalPriceInfos(String, OrderPriceInfo, Order, Locale, RepositoryItem, Map, Map, Map)

getAdjuster

protected double getAdjuster(RepositoryItem pPricingModel,
                             java.util.Map pExtraParameters)
                      throws PricingException
Overrides the base behavior to return the pre-calculated value for the promotion that's stored in the ReturnRequest

Overrides:
getAdjuster in class DiscountCalculatorService
Parameters:
pPricingModel - RepositoryItem pricing model
pExtraParameters - Map of optional extra parameters, may be null
Returns:
double adjuster to use
Throws:
PricingException - if the method fails to get a valid double adjuster
See Also:
ReturnRequest.getExchangeOrderPromotionValue()

getDiscountType

protected java.lang.String getDiscountType(RepositoryItem pPricingModel,
                                           java.util.Map pExtraParameters)
                                    throws PricingException
Overrides the base behavior to always return the amount off type

Overrides:
getDiscountType in class DiscountCalculatorService
Parameters:
pPricingModel - RepositoryItem pricing model
pExtraParameters - Map of optional extra parameters
Returns:
String discount type to use
Throws:
PricingException - if the method fails to determine a valid discount type.
See Also:
Constants.AMOUNT_OFF

findMatchingObject

protected MatchingObject findMatchingObject(OrderPriceInfo pPriceQuote,
                                            java.util.List pPriceQuotes,
                                            java.util.List pItems,
                                            RepositoryItem pPricingModel,
                                            RepositoryItem pProfile,
                                            java.util.Locale pLocale,
                                            Order pOrder,
                                            java.util.Map pExtraParameters)
                                     throws PricingException
Overrides the base behavior to unconditionally return a MatchingObject. This is necessary since the order promotions applied by this calculator don't have to qualify against the current order through the Qualifier service.

Overrides:
findMatchingObject in class OrderDiscountCalculator
Returns:
Throws:
PricingException
See Also:
Qualifier.findQualifyingOrder(List, List, RepositoryItem, RepositoryItem, Locale, Order, OrderPriceInfo, ShippingGroup, ShippingPriceInfo, Map)