atg.integrations.cybersource
Class CyberSourceConnection

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

public class CyberSourceConnection
extends GenericService

This class manages the communication to the CyberSource server. All CyberSource integration services use this class to connect to the server.

All information on the CyberSource API was aquired from 19991112_ICS2_DG.pdf version 2.


Field Summary
static java.lang.String CLASS_VERSION
           
 com.cybersource.ics.client.ICSClient mClient
           
 java.lang.String mCsConfigFile
           
 java.lang.String mIgnoreAVS
           
static java.lang.String mResourceBundle
           
static atg.payment.Message msg
          A message object used to format localized error messages.
 
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
CyberSourceConnection()
          Default constructor for the CyberSource connection object.
 
Method Summary
 void doStartService()
          Initialize data structures when service is started.
static double DoubleFormat(double a)
          Formats a double number, for example 5.08908 will be formatted to 5.08
 java.lang.String getCsConfigFile()
          Get the path to the ICSClient.props file used to configure communication with the CyberSource payment system.
 com.cybersource.ics.client.ICSClient getICSClient()
          Return the ICSClient object for this connection, creating it if necessary.
 com.cybersource.ics.client.message.ICSClientOffer getICSClientOffer()
          Create and return a new ICSClientOffer
 com.cybersource.ics.client.message.ICSClientRequest getICSClientRequest()
          Create and return a new ICSClientRequest object for the ICSClient used by this connection.
 java.lang.String getIgnoreAVS()
          Query whether or not to add the ignore_avs field in the ICSClientRequest
 boolean getInitialized()
          Return true if this connection has been initialized and is ready for use.
 java.lang.String getMerchantId()
          Get the CyberSource merchant ID to use with this connection.
 java.lang.String getMerchantIdPropertyName()
          Get the name of the property from the ICSClient.props file that specifies the MerchantId to use.
 CyberSourceStatus processError(java.lang.String pKey, java.lang.String pMessage)
           
 CyberSourceStatus processError(java.lang.String pKey, java.lang.String pMessage, double totald)
           
 void setCsConfigFile(java.lang.String pCsConfigFile)
          Specify the path to the ICSClient.props file that contains name=value client & server pair info to communicate with CyberSource payment system.
 void setIgnoreAVS(java.lang.String pIgnoreAVS)
          Specify whether or not to add the ignore_avs field in the ICSClientRequest.
 void setMerchantIdPropertyName(java.lang.String pMerchantIdPropertyName)
          Specify the name of the property from the ICSClient.props file that specifies the MerchantId to use.
 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

mResourceBundle

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

msg

public static atg.payment.Message msg
A message object used to format localized error messages.


mCsConfigFile

public java.lang.String mCsConfigFile

mClient

public transient com.cybersource.ics.client.ICSClient mClient

mIgnoreAVS

public java.lang.String mIgnoreAVS
Constructor Detail

CyberSourceConnection

public CyberSourceConnection()
Default constructor for the CyberSource connection object.

Method Detail

getInitialized

public boolean getInitialized()
Return true if this connection has been initialized and is ready for use.


setCsConfigFile

public void setCsConfigFile(java.lang.String pCsConfigFile)
Specify the path to the ICSClient.props file that contains name=value client & server pair info to communicate with CyberSource payment system. Initially it contains test keys and certificates for testing. After running the ECert application, these values should be replaced with keys and certificates generated by ECert program.


getCsConfigFile

public java.lang.String getCsConfigFile()
Get the path to the ICSClient.props file used to configure communication with the CyberSource payment system.


getMerchantId

public java.lang.String getMerchantId()
Get the CyberSource merchant ID to use with this connection.


setMerchantIdPropertyName

public void setMerchantIdPropertyName(java.lang.String pMerchantIdPropertyName)
Specify the name of the property from the ICSClient.props file that specifies the MerchantId to use. This property is used only for 3210 version, all the later versions obtain the merchant id from the ICSClient object.


getMerchantIdPropertyName

public java.lang.String getMerchantIdPropertyName()
Get the name of the property from the ICSClient.props file that specifies the MerchantId to use.


getICSClient

public com.cybersource.ics.client.ICSClient getICSClient()
Return the ICSClient object for this connection, creating it if necessary.


getICSClientRequest

public com.cybersource.ics.client.message.ICSClientRequest getICSClientRequest()
                                                                        throws com.cybersource.ics.base.exception.ICSException
Create and return a new ICSClientRequest object for the ICSClient used by this connection.

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

getICSClientOffer

public com.cybersource.ics.client.message.ICSClientOffer getICSClientOffer()
                                                                    throws com.cybersource.ics.base.exception.ICSException
Create and return a new ICSClientOffer

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

setIgnoreAVS

public void setIgnoreAVS(java.lang.String pIgnoreAVS)
Specify whether or not to add the ignore_avs field in the ICSClientRequest.


getIgnoreAVS

public java.lang.String getIgnoreAVS()
Query whether or not to add the ignore_avs field in the ICSClientRequest


toString

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

doStartService

public void doStartService()
                    throws ServiceException
Initialize data structures when service is started.

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

DoubleFormat

public static double DoubleFormat(double a)
Formats a double number, for example 5.08908 will be formatted to 5.08


processError

public CyberSourceStatus processError(java.lang.String pKey,
                                      java.lang.String pMessage)
Returns:
a CyberSourceStatus object with the error message

processError

public CyberSourceStatus processError(java.lang.String pKey,
                                      java.lang.String pMessage,
                                      double totald)
Returns:
a CyberSourceStatus object with the error message