public class TaxProcessorTaxCalculator extends GenericService implements TaxPricingCalculator
averagePriceRoundingDecimalPlaces property
 of PricingTools.  As of this writing, DCS does not keep track of which units of a CommerceItem
 are being shipped to what addresses.  Also, the ItemPricingEngine is capable of pricing
 different units of a CommerceItem differently because of various promotions.  These
 two facts mean that we can't be perfectly sure about the exact amount that is to be
 taxed.  Instead, this calculator takes an average CommerceItem unit price and multiplies
 it by the number of units in a particular shipping group.  All this dividing may
 potentially leave us with a price that has an infinitely repeating number of decimals.
 The averagePriceRoundingDecimalPlaces property dictates how to truncate
 these prices before sending them to the TaxProcessor implementation.  This calculator
 keeps track of any missing money and adds it to one of the totals.| Modifier and Type | Field and Description | 
|---|---|
| static java.lang.String | CLASS_VERSIONClass version string | 
| static java.lang.String | DETAILED_ITEM_PRICE_TAX_PROPERTY | 
SERVICE_INFO_KEYDEFAULT_LOG_TRACE_STATUSDEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS| Constructor and Description | 
|---|
| TaxProcessorTaxCalculator() | 
| Modifier and Type | Method and Description | 
|---|---|
| protected void | assignItemTaxAmounts(Order pOrder,
                    TaxPriceInfo pOrderTax,
                    TaxStatus pStatus)Assign each detail's  taxfor the given order. | 
| protected void | assignItemTaxAmounts(ShippingGroup pShippingGroup,
                    TaxPriceInfo pTaxPriceInfo,
                    OrderPriceInfo pOrderPrice,
                    OrderPriceInfo pShippingSubtotal,
                    TaxStatus pStatus)Assign each detail's  taxfor the given order. | 
| protected void | calculateTax(TaxRequestInfo pTRI,
            TaxPriceInfo pPriceQuote,
            Order pOrder,
            RepositoryItem pPricingModel,
            java.util.Locale pLocale,
            RepositoryItem pProfile,
            java.util.Map pExtraParameters)Given the input TaxRequestInfo object, modify the input pPriceQuote object
 to reflect the current tax. | 
| protected void | calculateTaxByShipping(TaxRequestInfo pTRI,
                      TaxPriceInfo pPriceQuote,
                      Order pOrder,
                      RepositoryItem pPricingModel,
                      java.util.Locale pLocale,
                      RepositoryItem pProfile,
                      java.util.Map pExtraParameters)Given the input TaxRequestInfo object, modify the input pPriceQuote object
 to reflect the current tax. | 
| protected TaxableItem | createTaxableItemForRelationship(CommerceItemRelationship pRelationship,
                                TaxRequestInfo pTaxRequestInfo)create a TaxableItem for the input relationship and TaxRequestInfo. | 
| protected TaxableItem | createTaxableItemForRelationship(CommerceItemRelationship pRelationship,
                                TaxRequestInfo pTaxRequestInfo,
                                Order pOrder,
                                java.util.Locale pLocale,
                                RepositoryItem pProfile,
                                java.util.Map pExtraParameters)create a TaxableItem for the input relationship and
 TaxRequestInfo. | 
| protected TaxableItem | createTaxableItemForRelationshipByAverage(CommerceItemRelationship pRelationship,
                                         TaxRequestInfo pTaxRequestInfo)create a TaxableItem for the input relationship and TaxRequestInfo. | 
| protected TaxableItem | createTaxableItemForRelationshipByAverage(CommerceItemRelationship pRelationship,
                                         TaxRequestInfo pTaxRequestInfo,
                                         Order pOrder,
                                         java.util.Locale pLocale,
                                         RepositoryItem pProfile,
                                         java.util.Map pExtraParameters)create a TaxableItem for the input relationship and TaxRequestInfo. | 
| protected Address | determineShippingAddress(ShippingGroup pGroup)Determines a shipping address based on a ShippingGroup | 
| void | doStartService()This is called after a Service has been created, placed into the
 naming hierarchy, and initialized with its configured property
 values. | 
| java.lang.String | getBillingAddressPropertyName()Returns the billingAddressPropertyName | 
| boolean | getCalculateTaxByShipping()flag that determines whether this calculator should calculate tax on a per-shippingGroup basis. | 
| OrderManager | getOrderManager()Get property OrderManager | 
| PricingTools | getPricingTools()the PricingTools object which helps this calculator calculate tax' | 
| java.util.List | getRelationshipsToAssignTaxTo(ShippingGroup pShippingGroup)Returns the list of ShippingGroupCommerceItemRelationships that should be assigned tax. | 
| TaxProcessor | getTaxProcessor()Get property TaxProcessor | 
| java.lang.String | getTaxStatusProperty()Returns property TaxStatusProperty | 
| boolean | isVerifyAddresses()Test property VerifyAddresses | 
| 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 | setBillingAddressPropertyName(java.lang.String pBillingAddressPropertyName)Sets the billingAddressPropertyName | 
| void | setCalculateTaxByShipping(boolean pCalculateTaxByShipping)flag that determines whether this calculator should calculate tax on a per-shippingGroup basis. | 
| void | setOrderManager(OrderManager pOrderManager)Set property OrderManager | 
| void | setPricingTools(PricingTools pPricingTools)the PricingTools object which helps this calculator calculate tax | 
| void | setTaxProcessor(TaxProcessor pTaxProcessor)Set property TaxProcessor | 
| void | setTaxStatusProperty(java.lang.String pTaxStatusProperty)Sets property TaxStatusProperty | 
| void | setVerifyAddresses(boolean pVerifyAddresses)flag that determines whether this calculator will attempt to verify addresses | 
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, stopServicevlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarningpublic static final java.lang.String CLASS_VERSION
public static final java.lang.String DETAILED_ITEM_PRICE_TAX_PROPERTY
public void setTaxStatusProperty(java.lang.String pTaxStatusProperty)
public java.lang.String getTaxStatusProperty()
public void setTaxProcessor(TaxProcessor pTaxProcessor)
pTaxProcessor - new value to setpublic TaxProcessor getTaxProcessor()
public void setOrderManager(OrderManager pOrderManager)
pOrderManager - new value to setpublic OrderManager getOrderManager()
public void setPricingTools(PricingTools pPricingTools)
pPricingTools - new value to setpublic PricingTools getPricingTools()
public void setVerifyAddresses(boolean pVerifyAddresses)
pVerifyAddresses - new value to setpublic boolean isVerifyAddresses()
public void setCalculateTaxByShipping(boolean pCalculateTaxByShipping)
pCalculateTaxByShipping - new value to setpublic boolean getCalculateTaxByShipping()
public java.lang.String getBillingAddressPropertyName()
public void setBillingAddressPropertyName(java.lang.String pBillingAddressPropertyName)
public void priceTax(TaxPriceInfo pPriceQuote, Order pOrder, RepositoryItem pPricingModel, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters) throws PricingException
Ideally, we should change a shipping relationship to include an exact specification of which units of a CommerceItem belong to that relationship.
priceTax in interface TaxPricingCalculatorpPriceQuote - TaxPriceInfo representing the tax quote for the orderpOrder - The order to taxpPricingModels - A Collection of RepositoryItems representing PricingModelspProfile - The user's profilepExtraParameters - A Map of extra parameters to be used in the pricing, may be nullPricingExceptionprotected void calculateTaxByShipping(TaxRequestInfo pTRI, TaxPriceInfo pPriceQuote, Order pOrder, RepositoryItem pPricingModel, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters) throws PricingException
pTRI - the TaxRequestInfo object which represents a request from a TaxProcessor
        for a tax calculation.  Required.pPriceQuote - the TaxPriceInfo to modify to reflect the calculated tax.  Required.pOrder - the order for which tax is being calculated.  Optional.pPricingModel - the pricing model which is modifying the tax total.  Optional.
        Not used in DCS at this time.pLocale - the local in which the tax should be calculated. Optional.pProfile - the person for whom the tax is being calculated. Optional.pExtraParameters - any extra information needed to calculate tax. Optional.PricingExceptionprotected void calculateTax(TaxRequestInfo pTRI, TaxPriceInfo pPriceQuote, Order pOrder, RepositoryItem pPricingModel, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters) throws PricingException
pTRI - the TaxRequestInfo object which represents a request from a TaxProcessor
        for a tax calculation. Required.pPriceQuote - the TaxPriceInfo to modify to reflect the calculated tax.  Required.pOrder - the order for which tax is being calculated.  Optional.pPricingModel - the pricing model which is modifying the tax total.  Optional.
        Not used in DCS at this time.pLocale - the local in which the tax should be calculated. Optional.pProfile - the person for whom the tax is being calculated. Optional.pExtraParameters - any extra information needed to calculate tax. Optional.PricingExceptionprotected Address determineShippingAddress(ShippingGroup pGroup)
protected TaxableItem createTaxableItemForRelationshipByAverage(CommerceItemRelationship pRelationship, TaxRequestInfo pTaxRequestInfo, Order pOrder, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters) throws PricingException
pRelationship - the relationship for which a TaxableItem is needed.pTaxRequestInfo - the TaxRequestInfo object into which the returned TaxableItem will be
        inserted.PricingExceptionprotected TaxableItem createTaxableItemForRelationshipByAverage(CommerceItemRelationship pRelationship, TaxRequestInfo pTaxRequestInfo) throws PricingException
pRelationship - the relationship for which a TaxableItem is needed.pTaxRequestInfo - the TaxRequestInfo object into which the returned TaxableItem will be
        inserted.PricingExceptionprotected TaxableItem createTaxableItemForRelationship(CommerceItemRelationship pRelationship, TaxRequestInfo pTaxRequestInfo) throws PricingException
pRelationship - the relationship for which a TaxableItem is needed.pTaxRequestInfo - the TaxRequestInfo object into which the returned TaxableItem will be
        inserted.PricingExceptionprotected TaxableItem createTaxableItemForRelationship(CommerceItemRelationship pRelationship, TaxRequestInfo pTaxRequestInfo, Order pOrder, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters) throws PricingException
pRelationship - the relationship for which a TaxableItem is needed.pTaxRequestInfo - the TaxRequestInfo object into which the returned TaxableItem will be
        inserted.PricingExceptionprotected void assignItemTaxAmounts(Order pOrder, TaxPriceInfo pOrderTax, TaxStatus pStatus) throws PricingException
tax for the given order.  This
 method will assign a tax value for the detail proportional to the
 details cost compared to the order cost.
 The calculation also takes into consideration the discount share that
 the item has received, as well as any manual adjustments (always
 a negative number as it's an adjustment as opposed to a discount).
 For example, in its simplest form, if the order is $100, the detail
 is $20, and the tax is $10: the detail's tax will be $2.
 This method is used if
 calculateTaxByShipping is false.pOrder - The order that was just taxed.pOrderTax - The orders tax.pStatus - This is the tax status that was returned from the TaxProcessor.  This is currently
                ignored.  If the status were to include the item level tax breakdown, this method
                could be extended to use that information.PricingExceptionprotected void assignItemTaxAmounts(ShippingGroup pShippingGroup, TaxPriceInfo pTaxPriceInfo, OrderPriceInfo pOrderPrice, OrderPriceInfo pShippingSubtotal, TaxStatus pStatus) throws PricingException
tax for the given order.  This
 method will assign a tax value for the detail proportional to the
 details cost compared to the shipping group subtotal.  For
 example, if the shipping subtotal is $100, the detail is $20, and
 the tax is $10: the detail's tax will be $2. This method is used
 if calculateTaxByShipping is true.pShippingGroup - The shipping group whose details will be updatepTaxPriceInfo - The TaxPriceInfo for the shipping grouppOrderPrice - The TaxPriceInfo for the entire orderpShippingSubtotal - The price info containing the subtotal information for the shipping grouppStatus - This is the tax status that was returned from the TaxProcessor.  This is currently
                ignored.  If the status were to include the item level tax breakdown, this method
                could be extended to use that information.PricingExceptionpublic java.util.List getRelationshipsToAssignTaxTo(ShippingGroup pShippingGroup)
pShippingGroup - the shipping group being taxedpublic void doStartService()
                    throws ServiceException
GenericServicedoStartService in class GenericServiceServiceException - if the Service had a problem starting up