atg.commerce.pricing
Class AddressVerificationTaxProcessorTaxCalculator

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.commerce.pricing.TaxProcessorTaxCalculator
              extended by atg.commerce.pricing.AddressVerificationTaxProcessorTaxCalculator
All Implemented Interfaces:
TaxPricingCalculator, NameContextBindingListener, NameContextElement, NameResolver, AdminableService, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, java.util.EventListener

public class AddressVerificationTaxProcessorTaxCalculator
extends TaxProcessorTaxCalculator

An extension of the TaxProcessorTaxCalculator which optionally verifies the shipping address about to be taxed, the billing address about to be taxed, or both. In determining whether shipping and billing addresses are valid, The AddressVerificationTaxProcessorTaxCalculator tests to see whether there is any billing/shipping address at all, and then whether any of the required properties (as defined in requiredBillingAddressProperties and requiredShippingAddressProperties) is null.

An AddressVerificationTaxProcessorTaxCalculator defines the following properties:


Field Summary
static java.lang.String CLASS_VERSION
          Class version string
 
Fields inherited from class atg.commerce.pricing.TaxProcessorTaxCalculator
DETAILED_ITEM_PRICE_TAX_PROPERTY
 
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
AddressVerificationTaxProcessorTaxCalculator()
           
 
Method Summary
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.
 java.lang.String[] getRequiredBillingAddressProperties()
          the properties of a billing address which are required to not be null
 java.lang.String[] getRequiredShippingAddressProperties()
          the properties of a shipping address which are required to not be null
 boolean getThrowVerificationException()
          flag that determines whether this calculator should throw a descriptive exception upon address verification failure.
 boolean isThrowVerificationException()
          Test property ThrowVerificationException
 boolean isVerifyBillingAddress()
          Test property VerifyBillingAddress
 boolean isVerifyShippingAddress()
          Test property VerifyShippingAddress
 void setRequiredBillingAddressProperties(java.lang.String[] pRequiredBillingAddressProperties)
          the properties of a billing address which are required to not be null
 void setRequiredShippingAddressProperties(java.lang.String[] pRequiredShippingAddressProperties)
          the properties of a shipping address which are required to not be null
 void setThrowVerificationException(boolean pThrowVerificationException)
          flag that determines whether this calculator should throw a descriptive exception upon address verification failure.
 void setVerifyBillingAddress(boolean pVerifyBillingAddress)
          flag that determines whether this calculator should verify the billing address before asking the taxprocessor to tax it.
 void setVerifyShippingAddress(boolean pVerifyShippingAddress)
          flag that determines whether this calculator should verify the shipping address before asking the taxprocessor to tax it.
protected  boolean verifyBillingAddress(TaxRequestInfo pTRI)
          verifies that the billing address is not null, and that no crucial properties of the billing address are null.
protected  boolean verifyShippingAddress(TaxRequestInfo pTRI)
          verifies that each shipping address is not null, and that no crucial properties of any shipping address are null.
 
Methods inherited from class atg.commerce.pricing.TaxProcessorTaxCalculator
assignItemTaxAmounts, assignItemTaxAmounts, createTaxableItemForRelationship, createTaxableItemForRelationship, createTaxableItemForRelationshipByAverage, createTaxableItemForRelationshipByAverage, determineShippingAddress, doStartService, getBillingAddressPropertyName, getCalculateTaxByShipping, getOrderManager, getPricingTools, getRelationshipsToAssignTaxTo, getTaxProcessor, getTaxStatusProperty, isVerifyAddresses, priceTax, setBillingAddressPropertyName, setCalculateTaxByShipping, setOrderManager, setPricingTools, setTaxProcessor, setTaxStatusProperty, setVerifyAddresses
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, doStopService, 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

AddressVerificationTaxProcessorTaxCalculator

public AddressVerificationTaxProcessorTaxCalculator()
Method Detail

setVerifyBillingAddress

public void setVerifyBillingAddress(boolean pVerifyBillingAddress)
flag that determines whether this calculator should verify the billing address before asking the taxprocessor to tax it.

Parameters:
pVerifyBillingAddress - new value to set

isVerifyBillingAddress

public boolean isVerifyBillingAddress()
Test property VerifyBillingAddress

Returns:
VerifyBillingAddress

setVerifyShippingAddress

public void setVerifyShippingAddress(boolean pVerifyShippingAddress)
flag that determines whether this calculator should verify the shipping address before asking the taxprocessor to tax it.

Parameters:
pVerifyShippingAddress - new value to set

isVerifyShippingAddress

public boolean isVerifyShippingAddress()
Test property VerifyShippingAddress

Returns:
VerifyShippingAddress

setThrowVerificationException

public void setThrowVerificationException(boolean pThrowVerificationException)
flag that determines whether this calculator should throw a descriptive exception upon address verification failure. If false, a failed address verification means that the tax calculated will always be zero.

Parameters:
pThrowVerificationException - new value to set

getThrowVerificationException

public boolean getThrowVerificationException()
flag that determines whether this calculator should throw a descriptive exception upon address verification failure. If false, a failed address verification means that the tax calculated will always be zero.

Returns:
property ThrowVerificationException

isThrowVerificationException

public boolean isThrowVerificationException()
Test property ThrowVerificationException

Returns:
ThrowVerificationException

setRequiredBillingAddressProperties

public void setRequiredBillingAddressProperties(java.lang.String[] pRequiredBillingAddressProperties)
the properties of a billing address which are required to not be null

Parameters:
pRequiredBillingAddressProperties - new value to set

getRequiredBillingAddressProperties

public java.lang.String[] getRequiredBillingAddressProperties()
the properties of a billing address which are required to not be null

Returns:
property RequiredBillingAddressProperties

setRequiredShippingAddressProperties

public void setRequiredShippingAddressProperties(java.lang.String[] pRequiredShippingAddressProperties)
the properties of a shipping address which are required to not be null

Parameters:
pRequiredShippingAddressProperties - new value to set

getRequiredShippingAddressProperties

public java.lang.String[] getRequiredShippingAddressProperties()
the properties of a shipping address which are required to not be null

Returns:
property RequiredShippingAddressProperties

calculateTax

protected void calculateTax(TaxRequestInfo pTRI,
                            TaxPriceInfo pPriceQuote,
                            Order pOrder,
                            RepositoryItem pPricingModel,
                            java.util.Locale pLocale,
                            RepositoryItem pProfile,
                            java.util.Map pExtraParameters)
                     throws PricingException
Given the input TaxRequestInfo object, modify the input pPriceQuote object to reflect the current tax. Takes the following steps to achieve this:

Overrides:
calculateTax in class TaxProcessorTaxCalculator
Parameters:
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.
Throws:
PricingException - if there was a problem determining the tax

calculateTaxByShipping

protected void calculateTaxByShipping(TaxRequestInfo pTRI,
                                      TaxPriceInfo pPriceQuote,
                                      Order pOrder,
                                      RepositoryItem pPricingModel,
                                      java.util.Locale pLocale,
                                      RepositoryItem pProfile,
                                      java.util.Map pExtraParameters)
                               throws PricingException
Given the input TaxRequestInfo object, modify the input pPriceQuote object to reflect the current tax. This method differs from calculateTax in that it calls through to the 'calculateTaxByShipping' tax API call. Takes the following steps to achieve this:

Overrides:
calculateTaxByShipping in class TaxProcessorTaxCalculator
Parameters:
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.
Throws:
PricingException

verifyBillingAddress

protected boolean verifyBillingAddress(TaxRequestInfo pTRI)
                                throws PricingException
verifies that the billing address is not null, and that no crucial properties of the billing address are null. The crucial properties are defined in the RequiredBillingAddressProperties property

Parameters:
pTRI - the TaxRequestInfo containing the billing address to verify
Returns:
true if the address is OK, false if the address has problems
Throws:
PricingException - if there was a problem verifying the billing address

verifyShippingAddress

protected boolean verifyShippingAddress(TaxRequestInfo pTRI)
                                 throws PricingException
verifies that each shipping address is not null, and that no crucial properties of any shipping address are null. The crucial properties are defined in the RequiredShippingAddressProperties property

Parameters:
pTRI - the TaxRequestInfo containing the shipping address to verify
Returns:
true if the address is OK, false if the address has problems
Throws:
PricingException - if there was a problem verifying the shipping address