atg.commerce.pricing
Class TaxPricingEngineImpl

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.commerce.pricing.PricingEngineService
              extended by atg.commerce.pricing.TaxPricingEngineImpl
All Implemented Interfaces:
PricingEngine, TaxPricingEngine, NameContextBindingListener, NameContextElement, NameResolver, AdminableService, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, Schedulable, java.util.EventListener

public class TaxPricingEngineImpl
extends PricingEngineService
implements TaxPricingEngine

A TaxPricingEngine implementation which computes the tax for an order. It accomplishes this task by invoking a series of TaxPricingCalculators which incrementally compute the tax price:

Note: if a particular order of calculator invocation is desired, sorting must be done prior to passing discounts/precalculators/postcalculators in to the Engine.

Properties:

See Also:
TaxPricingCalculator, TaxPriceInfo

Field Summary
static java.lang.String CLASS_VERSION
          Class version string
 
Fields inherited from class atg.commerce.pricing.PricingEngineService
mGlobalPromotions
 
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
TaxPricingEngineImpl()
           
 
Method Summary
 void checkPromotionsForCloseness(TaxPriceInfo pPriceInfo, Order pOrder, java.util.Collection pPricingModels, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters)
          Check to see if the order qualifies under any of the pricingModels' "closenessQualifiers".
protected  java.lang.String getCurrencyCode(Order pOrder, java.util.Collection pPricingModels, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters)
          Return the currency code that should be used in the context of this pricing request
 TaxPricingCalculator[] getPostCalculators()
          Gets the PricingCalculators which are run after any discounts are applied
 TaxPricingCalculator[] getPreCalculators()
          Gets the PricingCalculators which are run before any discounts are applied
 java.util.Collection getPricingModels(RepositoryItem pProfile)
          Returns a List of pricing models (e.g.
 TaxPriceInfo priceTax(Order pOrder, java.util.Collection pPricingModels, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters)
          Tax an order within a context.
 void setPostCalculators(TaxPricingCalculator[] pPostCalculators)
          Sets the PricingCalculators which are run after any discounts are applied
 void setPreCalculators(TaxPricingCalculator[] pPreCalculators)
          Sets the PricingCalculators which are run before any discounts are applied
 
Methods inherited from class atg.commerce.pricing.PricingEngineService
addPromotion, addPromotionToList, checkAndAddPromotions, checkPromotionExpiration, createPriceInfo, doStartService, doStopService, expirePromotion, findGlobalPromotions, getAdjustmentPricingModels, getCalculator, getClosenessQualifierEvaluator, getCurrencyCode, getDefaultLocale, getGlobalPromotions, getGlobalPromotionsQuery, getGlobalPromotionsSchedulableDate, getInitialPromotions, getPriceInfoClass, getPricingCurrencyCode, getPricingModelComparator, getPricingModelProperties, getPricingTools, getProfileProperties, getPromotionItemDescriptors, getPromotionItemTypes, getPromotions, getPromotionsRepository, getPromotionTools, getScheduler, getUpdateSchedule, getUserOnlyPromotions, loadGlobalPromotions, performScheduledTask, setClosenessQualifierEvaluator, setDefaultLocale, setGlobalPromotionsQuery, setGlobalPromotionsSchedulableDate, setPriceInfoClass, setPricingModelComparator, setPricingModelProperties, setPricingTools, setProfileProperties, setPromotionItemTypes, setPromotionsRepository, setPromotionTools, setScheduler, setUpdateSchedule
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, getAbsoluteName, getAdminServlet, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
 
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

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Class version string

Constructor Detail

TaxPricingEngineImpl

public TaxPricingEngineImpl()
Method Detail

setPreCalculators

public void setPreCalculators(TaxPricingCalculator[] pPreCalculators)
Sets the PricingCalculators which are run before any discounts are applied


getPreCalculators

public TaxPricingCalculator[] getPreCalculators()
Gets the PricingCalculators which are run before any discounts are applied


setPostCalculators

public void setPostCalculators(TaxPricingCalculator[] pPostCalculators)
Sets the PricingCalculators which are run after any discounts are applied


getPostCalculators

public TaxPricingCalculator[] getPostCalculators()
Gets the PricingCalculators which are run after any discounts are applied


getPricingModels

public java.util.Collection getPricingModels(RepositoryItem pProfile)
Returns a List of pricing models (e.g. promotions) for a given Profile.

Specified by:
getPricingModels in interface PricingEngine
Parameters:
pProfile - The user's profile from which the engine will extract promotions
Returns:
List of RepositoryItems which represent pricing models for use in pricing.

getCurrencyCode

protected java.lang.String getCurrencyCode(Order pOrder,
                                           java.util.Collection pPricingModels,
                                           java.util.Locale pLocale,
                                           RepositoryItem pProfile,
                                           java.util.Map pExtraParameters)
                                    throws PricingException
Return the currency code that should be used in the context of this pricing request

Throws:
PricingException - if an error occurs while attempting to determine the currency code

priceTax

public TaxPriceInfo priceTax(Order pOrder,
                             java.util.Collection pPricingModels,
                             java.util.Locale pLocale,
                             RepositoryItem pProfile,
                             java.util.Map pExtraParameters)
                      throws PricingException
Tax an order within a context. The context is represented by the input parameters.

Specified by:
priceTax in interface TaxPricingEngine
Parameters:
pOrder - The order to tax
pPricingModels - A Collection of RepositoryItems representing PricingModels
pLocale - The Locale to use for pricing
pProfile - The user's profile
pExtraParameters - A Map of extra parameters to be used in the pricing, may be null
Returns:
TaxPriceInfo representing the tax quote for the order. Return null if no pricing info can be determined. This may occur if the order supplied is null.
Throws:
PricingException - if an error occurs while attempting to price

checkPromotionsForCloseness

public void checkPromotionsForCloseness(TaxPriceInfo pPriceInfo,
                                        Order pOrder,
                                        java.util.Collection pPricingModels,
                                        java.util.Locale pLocale,
                                        RepositoryItem pProfile,
                                        java.util.Map pExtraParameters)
                                 throws PricingException
Check to see if the order qualifies under any of the pricingModels' "closenessQualifiers". If so, add the closenessQualifiers to the priceInfo.

Parameters:
pPriceInfo - The TaxPriceInfo object associated with the order.
pOrder - The order to check
pPricingModels - A Collection of RepositoryItems representing PricingModels
pLocale - The Locale to use for pricing
pProfile - The user's profile
pExtraParameters - A Map of extra parameters to be used in the pricing, may be null
Throws:
PricingException