atg.commerce.pricing
Class TaxDiscountCalculator

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.TaxDiscountCalculator
All Implemented Interfaces:
TaxPricingCalculator, 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
Direct Known Subclasses:
BulkTaxDiscountCalculator

public class TaxDiscountCalculator
extends DiscountCalculatorService
implements TaxPricingCalculator

Calculates TaxPriceInfos for Orders which the calculator is given. This calculator can either be passed in a MatchingObject via the extra parameters map with key Constants.MATCHING_OBJECT containing the order that qualified for the promotion or it can consult the Qualifier service, looking for the Order to be taxed. It calls Qualifier.findQualifyingOrder for this purpose. If it gets back an order, a TaxPriceInfo is computed based on the input PricingModel (RepositoryItem).

The discount to apply can be passed in as a DiscountStructure object via the extra parameters map with key Constants.DISCOUNT_STRUCTURE or it can be determined from the discountType and adjuster properties of the pricing model.

See Also:
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, 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
TaxDiscountCalculator()
           
 
Method Summary
 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(TaxPriceInfo 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.
 PricingTools getPricingTools()
          pricing tools to help with generating prices
 void priceTax(TaxPriceInfo pPriceQuote, Order pOrder, RepositoryItem pPricingModel, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters)
          Tax an order within a context.
 void setPricingTools(PricingTools pPricingTools)
          pricing tools to help with generating prices
 
Methods inherited from class atg.commerce.pricing.DiscountCalculatorService
adjust, adjustAmount, getAdjuster, getDiscountType, 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 java.lang.String CLASS_VERSION
Class version string

Constructor Detail

TaxDiscountCalculator

public TaxDiscountCalculator()
Method Detail

setPricingTools

public void setPricingTools(PricingTools pPricingTools)
pricing tools to help with generating prices

Parameters:
pPricingTools - new value to set

getPricingTools

public PricingTools getPricingTools()
pricing tools to help with generating prices

Returns:
property PricingTools

priceTax

public void priceTax(TaxPriceInfo pPriceQuote,
                     Order pOrder,
                     RepositoryItem pPricingModel,
                     java.util.Locale pLocale,
                     RepositoryItem pProfile,
                     java.util.Map pExtraParameters)
              throws PricingException
Tax an order within a context. Discounts the total tax, not individual break down (e.g. local, country)

Specified by:
priceTax in interface TaxPricingCalculator
Parameters:
pPriceQuote - TaxPriceInfo representing the tax quote for the order
pOrder - The order to tax
pPricingModels - A Collection of RepositoryItems representing PricingModels
pProfile - The user's profile
pExtraParameters - A Map of extra parameters to be used in the pricing, may be null
Throws:
PricingException

getAmountToDiscount

protected double getAmountToDiscount(TaxPriceInfo pPriceQuote,
                                     Order pOrder,
                                     RepositoryItem pPricingModel,
                                     java.util.Locale pLocale,
                                     RepositoryItem pProfile,
                                     java.util.Map pExtraParameters)
                              throws PricingException
This will return the amount that will eventually be discounted. This will be priceQuote.amount by default (and there will usually be no need to change this.)

Parameters:
pPriceQuote - TaxPriceInfo representing the current price quote for the tax
pOrder - 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)
Returns:
The amount to discount... defaults to pPriceQuote.getAmount()
Throws:
PricingException

doStartService

public void doStartService()
                    throws ServiceException
Description copied from class: GenericService
This is called after a Service has been created, placed into the naming hierarchy, and initialized with its configured property values. The Service should override this method to start any processes it requires.

Overrides:
doStartService in class GenericService
Throws:
ServiceException - if the Service had a problem starting up