atg.integrations.taxware
Class VeraZipOrderImpl

java.lang.Object
  extended by atg.payment.avs.GenericAddressVerificationInfo
      extended by atg.integrations.taxware.BillingShipping
          extended by atg.integrations.taxware.VeraZipOrderImpl
All Implemented Interfaces:
VeraZipable, AddressVerificationInfo, java.io.Serializable

public class VeraZipOrderImpl
extends atg.integrations.taxware.BillingShipping
implements VeraZipable

This class exists to enable easily adding verazip support to OrderImpl. This class works with the TaxWareCalculateSalesTax order processing item.

Most of the code here attempts to implements the VeraZipable interface, mostly through an array of ZipResult objects.

Much of the other code deals with providing access functions so that it can be hooked up to a web page.

A final chunk of code attempts to set whatever can be set from the current ZipResult object.

See Also:
OrderImpl, VeraZipable, ZipResult, ZipResultItem, ZipRequest, Serialized Form

Field Summary
static java.lang.String CLASS_VERSION
           
protected  int[] mZipIndexArray
          The index into the array associated with the zip result.
protected  ZipResult[] mZipResultArray
          The zip result returned from verazip.
 
Fields inherited from class atg.integrations.taxware.BillingShipping
mUseBillAddress
 
Fields inherited from interface atg.integrations.taxware.VeraZipable
BILLING_ADDRESS_NAME, SHIP_TO_ADDRESS_NAME
 
Constructor Summary
VeraZipOrderImpl(ApplicationLogging log)
           
 
Method Summary
 java.lang.String getAddressNameForIndex(int index)
           
 int getBillZipOptionChoice()
          gets the index for the currently chosen billing zip option.
 int getBillZipOptionCount()
          Returns the count of possible string options.
 java.lang.String[] getBillZipOptions()
          Returns the string array describing the current billing zip options.
 int getIndexForAddressName(java.lang.String pName)
          Returns the array index for the address with the given name.
 int getMaxCountOfZipAddresses()
          Returns the maxinumber of addressed to check.
 int getShipToZipOptionChoice()
          gets the index for the currently chosen ship-to zip option.
 int getShipToZipOptionCount()
           
 java.lang.String[] getShipToZipOptions()
          Returns the string array describing the current billing zip options.
 java.lang.String getZipErrorString()
          Sets the current zip error string.
 ZipRequest getZipRequestForAddress(int idxAddress)
          Get the request for the specified address object.
 ZipResult getZipResultAt(int idx)
          Get the ZipResult object.
 boolean isZipError()
          Returns true if there is currently a zip order.
protected static boolean nullOrEmptyString(java.lang.String pString)
          A helper function which checks to see if a string is null or empty.
protected  void setBillInfoFromZipResult(ZipResult pZipResult)
          Attempts to set whatever information is possible from the specified zip result.
 void setBillZipOptionChoice(int pIndex)
          Sets the index for the currently chosen zip option.
protected  void setShipToInfoFromZipResult(ZipResult pZipResult)
          Attempts to set whatever information is possible from the specified zip result.
 void setShipToZipOptionChoice(int pIndex)
          Sets the index for the currently chosen ship-to zip option.
 void setZipError(boolean pIsError)
          Sets a zip error -- probably not a good idea to use.
 void setZipErrorString(java.lang.String pError)
          Sets the current zip error string.
 void setZipResultAt(int idx, ZipResult pZipResult)
          Set the ZipResult object at the specified index.
 
Methods inherited from class atg.integrations.taxware.BillingShipping
getBillCity, getBillCountry, getBillState, getBillZip, getShipToCity, getShipToCountry, getShipToState, getShipToZip, getUseBillAddress, setBillCity, setBillCountry, setBillState, setBillZip, setShipToCity, setShipToCountry, setShipToState, setShipToZip, setUseBillAddress
 
Methods inherited from class atg.payment.avs.GenericAddressVerificationInfo
getAddress1, getAddress2, getAddressVerificationItem, getAddressVerificationItems, getPaymentId, setAddress1, setAddress2, setAddressVerificationItems, setPaymentId
 
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

mZipResultArray

protected ZipResult[] mZipResultArray
The zip result returned from verazip.


mZipIndexArray

protected int[] mZipIndexArray
The index into the array associated with the zip result.

Constructor Detail

VeraZipOrderImpl

public VeraZipOrderImpl(ApplicationLogging log)
Method Detail

getMaxCountOfZipAddresses

public int getMaxCountOfZipAddresses()
Returns the maxinumber of addressed to check.

Specified by:
getMaxCountOfZipAddresses in interface VeraZipable

getIndexForAddressName

public int getIndexForAddressName(java.lang.String pName)
Returns the array index for the address with the given name.

Specified by:
getIndexForAddressName in interface VeraZipable

getAddressNameForIndex

public java.lang.String getAddressNameForIndex(int index)
Specified by:
getAddressNameForIndex in interface VeraZipable

setShipToInfoFromZipResult

protected void setShipToInfoFromZipResult(ZipResult pZipResult)
Attempts to set whatever information is possible from the specified zip result. If a choice has yet to be chosen, tries to set missing information from the information which is the same for all of the options (like state name or city name, for example).

If a choice has been set, copies any non-matching info from the choice.


setBillInfoFromZipResult

protected void setBillInfoFromZipResult(ZipResult pZipResult)
Attempts to set whatever information is possible from the specified zip result. If a choice has yet to be chosen, tries to set missing information from the information which is the same for all of the options (like state name or city name, for example).

If a choice has been set, copies any non-matching info from the choice.


nullOrEmptyString

protected static boolean nullOrEmptyString(java.lang.String pString)
A helper function which checks to see if a string is null or empty.


setZipResultAt

public void setZipResultAt(int idx,
                           ZipResult pZipResult)
Set the ZipResult object at the specified index.

Note that we go ahead and call the setXXXXInfoFromZipResult method as well, so that defaults will be there the next time the page is rendered.

Set ZipResut always does real set, regardless of whether mUseBillAddress is set.

Specified by:
setZipResultAt in interface VeraZipable

getZipResultAt

public ZipResult getZipResultAt(int idx)
Get the ZipResult object.

Specified by:
getZipResultAt in interface VeraZipable

getShipToZipOptionCount

public int getShipToZipOptionCount()

getShipToZipOptions

public java.lang.String[] getShipToZipOptions()
Returns the string array describing the current billing zip options.


setShipToZipOptionChoice

public void setShipToZipOptionChoice(int pIndex)
Sets the index for the currently chosen ship-to zip option. -1 means nothing chosen yet.


getShipToZipOptionChoice

public int getShipToZipOptionChoice()
gets the index for the currently chosen ship-to zip option. -1 means nothing chosen yet.


getBillZipOptionCount

public int getBillZipOptionCount()
Returns the count of possible string options.


getBillZipOptions

public java.lang.String[] getBillZipOptions()
Returns the string array describing the current billing zip options.


setBillZipOptionChoice

public void setBillZipOptionChoice(int pIndex)
Sets the index for the currently chosen zip option. -1 means nothing chosen yet. Called by UI.


getBillZipOptionChoice

public int getBillZipOptionChoice()
gets the index for the currently chosen billing zip option. -1 means nothing chosen yet.


getZipRequestForAddress

public ZipRequest getZipRequestForAddress(int idxAddress)
Get the request for the specified address object. If this function returns null, then that means don't check the specified address.

Specified by:
getZipRequestForAddress in interface VeraZipable

setZipErrorString

public void setZipErrorString(java.lang.String pError)
Sets the current zip error string.

Specified by:
setZipErrorString in interface VeraZipable

getZipErrorString

public java.lang.String getZipErrorString()
Sets the current zip error string.

Specified by:
getZipErrorString in interface VeraZipable

setZipError

public void setZipError(boolean pIsError)
Sets a zip error -- probably not a good idea to use.

Specified by:
setZipError in interface VeraZipable

isZipError

public boolean isZipError()
Returns true if there is currently a zip order.

Specified by:
isZipError in interface VeraZipable