atg.integrations.cybersource
Class CyberSourceTax

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.integrations.cybersource.CyberSourceTax
All Implemented Interfaces:
NameContextBindingListener, NameContextElement, NameResolver, AdminableService, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, TaxProcessor, java.util.EventListener

public class CyberSourceTax
extends GenericService
implements TaxProcessor

This class manages the communications to a CyberSource tax system


Field Summary
static java.lang.String AcceptanceCity
           
static java.lang.String AcceptanceCountry
           
static java.lang.String AcceptanceState
           
static java.lang.String AcceptanceZip
           
static java.lang.String CLASS_VERSION
           
 CyberSourceConnection mCsCon
          CyberSourceConnection module that contains the merchant related data
 java.lang.String mNoNexus
          No Nexus field specifies states/provinces excluded from tax responsibilities (the list is delimited by comma: NY,NJ,MA)
protected  java.lang.String mOriginCity
           
protected  java.lang.String mOriginCountry
           
protected  java.lang.String mOriginState
           
protected  java.lang.String mOriginZip
           
protected  java.lang.String mSellerRegistrationNumber
           
protected  java.lang.String mShipFromCity
           
protected  java.lang.String mShipFromCountry
           
protected  java.lang.String mShipFromState
           
protected  java.lang.String mShipFromZip
           
 boolean mUseProductCode
          This property defines a pre-taxableItem request rather than a pre-shipping group request
static java.lang.String NoNexus
           
static java.lang.String SellerRegistration
           
static java.lang.String ShipFromCity
           
static java.lang.String ShipFromCountry
           
static java.lang.String ShipFromState
           
static java.lang.String ShipFromZip
           
 
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
CyberSourceTax()
          Default constructor
 
Method Summary
 void assignTaxProductCode(TaxableItem pItem, com.cybersource.ics.client.message.ICSClientOffer pOffer)
          This method may be overidden by a subclass to set the product code for each offer.
 TaxStatus calculate(TaxRequestInfo ccinfo, int i)
           
 TaxStatus calculateAllTax(TaxStatus[] taxstatus)
           
 TaxStatus calculateTax(TaxRequestInfo ccinfo)
          Calculate tax on the information specified in TaxRequestInfo
 TaxStatus[] calculateTaxByShipping(TaxRequestInfo ccinfo)
          Calculate tax on the information specified in TaxRequestInfo.
 void doStartService()
          Initialize the service
 CyberSourceConnection getCsCon()
           
 java.lang.String getNoNexus()
           
 java.lang.String getOriginCity()
          Get OriginCity used for tax calculations.
 java.lang.String getOriginCountry()
          Get OriginCountry used for tax calculations.
 java.lang.String getOriginState()
          Get OriginState used for tax calculations.
 java.lang.String getOriginZip()
          Get OriginZip used for tax calculations.
 java.lang.String getSellerRegistrationNumber()
           
 java.lang.String getShipFromCity()
          Get ShipFromCity used for tax calculations.
 java.lang.String getShipFromCountry()
          Get ShipFromCountry used for tax calculations.
 java.lang.String getShipFromState()
          Get ShipFromState used for tax calculations.
 java.lang.String getShipFromZip()
          Get ShipFromZip/PostalCode used for tax calculations.
 boolean getUseProductCode()
           
static void main(java.lang.String[] args)
          Run some simple tests
 TaxStatus[] performTax(TaxRequestInfo ccinfo)
          Makes a call to cybersource for each shipping destination
 void setCsCon(CyberSourceConnection pCsCon)
           
 void setNoNexus(java.lang.String pNoNexus)
           
 void setOriginCity(java.lang.String pOriginCity)
          Set OriginCity used for tax calculations.
 void setOriginCountry(java.lang.String pOriginCountry)
          Set 2 character OriginCountry used for tax calculations.
 void setOriginState(java.lang.String pOriginState)
          Set OriginState/Province used for tax calculations.
 void setOriginZip(java.lang.String pOriginZip)
          Set OriginZip/PostalCode used for tax calculations.
 void setSellerRegistrationNumber(java.lang.String pSellerRegistrationNumber)
           
 void setShipFromCity(java.lang.String pShipFromCity)
          Set ShipFromCity used for tax calculations.
 void setShipFromCountry(java.lang.String pShipFromCountry)
          Set ShipFromCountry used for tax calculations.
 void setShipFromState(java.lang.String pShipFromState)
          Set ShipFromState/Province used for tax calculations.
 void setShipFromZip(java.lang.String pShipFromZip)
          Set ShipFromZip/PostalCode used for tax calculations.
 void setUseProductCode(boolean pUseProductCode)
           
 boolean TaxProductCodeSetting(TaxableItem pItem)
          This function simply checks the taxStatus property in the taxableItem
 java.lang.String toString()
           
 
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, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION

NoNexus

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

SellerRegistration

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

ShipFromCity

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

ShipFromState

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

ShipFromZip

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

ShipFromCountry

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

AcceptanceCity

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

AcceptanceState

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

AcceptanceZip

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

AcceptanceCountry

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

mShipFromCountry

protected java.lang.String mShipFromCountry

mShipFromCity

protected java.lang.String mShipFromCity

mShipFromState

protected java.lang.String mShipFromState

mShipFromZip

protected java.lang.String mShipFromZip

mOriginCountry

protected java.lang.String mOriginCountry

mOriginCity

protected java.lang.String mOriginCity

mOriginState

protected java.lang.String mOriginState

mOriginZip

protected java.lang.String mOriginZip

mSellerRegistrationNumber

protected java.lang.String mSellerRegistrationNumber

mCsCon

public CyberSourceConnection mCsCon
CyberSourceConnection module that contains the merchant related data


mNoNexus

public java.lang.String mNoNexus
No Nexus field specifies states/provinces excluded from tax responsibilities (the list is delimited by comma: NY,NJ,MA)


mUseProductCode

public boolean mUseProductCode
This property defines a pre-taxableItem request rather than a pre-shipping group request

Constructor Detail

CyberSourceTax

public CyberSourceTax()
Default constructor

Method Detail

setShipFromCountry

public void setShipFromCountry(java.lang.String pShipFromCountry)
Set ShipFromCountry used for tax calculations.


getShipFromCountry

public java.lang.String getShipFromCountry()
Get ShipFromCountry used for tax calculations.


setShipFromCity

public void setShipFromCity(java.lang.String pShipFromCity)
Set ShipFromCity used for tax calculations.


getShipFromCity

public java.lang.String getShipFromCity()
Get ShipFromCity used for tax calculations.


setShipFromState

public void setShipFromState(java.lang.String pShipFromState)
Set ShipFromState/Province used for tax calculations.


getShipFromState

public java.lang.String getShipFromState()
Get ShipFromState used for tax calculations.


setShipFromZip

public void setShipFromZip(java.lang.String pShipFromZip)
Set ShipFromZip/PostalCode used for tax calculations.


getShipFromZip

public java.lang.String getShipFromZip()
Get ShipFromZip/PostalCode used for tax calculations.


setOriginCountry

public void setOriginCountry(java.lang.String pOriginCountry)
Set 2 character OriginCountry used for tax calculations.


getOriginCountry

public java.lang.String getOriginCountry()
Get OriginCountry used for tax calculations.


setOriginCity

public void setOriginCity(java.lang.String pOriginCity)
Set OriginCity used for tax calculations.


getOriginCity

public java.lang.String getOriginCity()
Get OriginCity used for tax calculations.


setOriginState

public void setOriginState(java.lang.String pOriginState)
Set OriginState/Province used for tax calculations.


getOriginState

public java.lang.String getOriginState()
Get OriginState used for tax calculations.


setOriginZip

public void setOriginZip(java.lang.String pOriginZip)
Set OriginZip/PostalCode used for tax calculations.


getOriginZip

public java.lang.String getOriginZip()
Get OriginZip used for tax calculations.


setSellerRegistrationNumber

public void setSellerRegistrationNumber(java.lang.String pSellerRegistrationNumber)

getSellerRegistrationNumber

public java.lang.String getSellerRegistrationNumber()

setCsCon

public void setCsCon(CyberSourceConnection pCsCon)

getCsCon

public CyberSourceConnection getCsCon()

setNoNexus

public void setNoNexus(java.lang.String pNoNexus)

getNoNexus

public java.lang.String getNoNexus()

setUseProductCode

public void setUseProductCode(boolean pUseProductCode)

getUseProductCode

public boolean getUseProductCode()

calculateTax

public TaxStatus calculateTax(TaxRequestInfo ccinfo)
Description copied from interface: TaxProcessor
Calculate tax on the information specified in TaxRequestInfo

Specified by:
calculateTax in interface TaxProcessor
Parameters:
ccinfo - the TaxInfo reference which contains all the tax calculation data
Returns:
a TaxStatus object detailing the results of the tax calculation

calculateTaxByShipping

public TaxStatus[] calculateTaxByShipping(TaxRequestInfo ccinfo)
Description copied from interface: TaxProcessor
Calculate tax on the information specified in TaxRequestInfo. Unlike calculateTax, however, this method returns tax information on a per-shipping group basis. That is to say, it returns tax information for items grouped around their shipping address.

Specified by:
calculateTaxByShipping in interface TaxProcessor
Parameters:
ccinfo - the TaxInfo reference which contains all the tax calculation data
Returns:
an array of TaxStatus objects detailing the results of the tax calculation

performTax

public TaxStatus[] performTax(TaxRequestInfo ccinfo)
                       throws com.cybersource.ics.base.exception.ICSException
Makes a call to cybersource for each shipping destination

Throws:
com.cybersource.ics.base.exception.ICSException

calculateAllTax

public TaxStatus calculateAllTax(TaxStatus[] taxstatus)

calculate

public TaxStatus calculate(TaxRequestInfo ccinfo,
                           int i)
                    throws com.cybersource.ics.base.exception.ICSException
Throws:
com.cybersource.ics.base.exception.ICSException

doStartService

public void doStartService()
                    throws ServiceException
Initialize the service

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

TaxProductCodeSetting

public boolean TaxProductCodeSetting(TaxableItem pItem)
This function simply checks the taxStatus property in the taxableItem

Parameters:
pItem - An object that represents an item or a bunch of items of the same category
Returns:
true or false whether or not the taxStatus property is set
See Also:
TaxableItem

assignTaxProductCode

public void assignTaxProductCode(TaxableItem pItem,
                                 com.cybersource.ics.client.message.ICSClientOffer pOffer)
                          throws CyberSourceException
This method may be overidden by a subclass to set the product code for each offer. Now the product code is provided by DCS in the taxStatus property of the TaxableItem object. A user may choose another way to propagate that data. In this case, this method will be overidden by a subclass.

Parameters:
pItem - An object in the destination group that represents an item or a bunch of items of the same catergory
pOffer - Offer object to set data for the taxable item
Throws:
CyberSourceException
See Also:
TaxableItem

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
a String representation of this object

main

public static void main(java.lang.String[] args)
Run some simple tests