|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--com.jcommercesql.gateway.authorizenet.AuthorizeNet
This class was designed using the Authorize.net Advanced Integration Method Implementation Guide v1.0. It is recommended that you download a copy of this guide to fully understand what gateway methods should be used for your particular situation.
| Field Summary | |
protected java.lang.String |
host
|
protected java.lang.String |
merchantMD5HashValue
|
protected java.lang.String |
path
|
protected int |
port
|
protected java.lang.String |
postData
|
protected byte[] |
rawResponse
|
protected java.lang.String |
x_Amount
|
protected char |
x_Delim_Char
|
protected java.lang.String |
x_Delim_Data
|
protected java.lang.String |
x_Login
|
protected java.lang.String |
x_Tran_Key
|
protected java.lang.String |
x_Version
|
| Constructor Summary | |
protected |
AuthorizeNet()
|
| Method Summary | |
void |
addMerchantDefinedField(java.lang.String fieldName,
java.lang.String fieldValue)
Add Merchant Defined Field The Authorize.net transaction gateway has the ability to handle merchant defined fields in addition to the required and optional fields defined in the AIM manual. |
void |
addOptionalField(java.lang.String fieldName,
java.lang.String fieldValue)
Add an optional field to the Authorize.net transaction request. |
protected java.lang.String |
calcMD5Hash(java.lang.String input)
|
java.lang.String |
getAmount()
Returns the amount value for this transaction as set by the setAmount() method. |
protected char |
getDelimChar()
get delimiter character |
protected boolean |
getDelimData()
is data delimited |
java.lang.String |
getHost()
Returns the Authorize.net gateway host value as set by the setHost() method. |
java.lang.String |
getLogin()
Returns the Authorize.net Merchant Login ID as set by the setLogin method. |
java.lang.String |
getPath()
Returns the path portion of the Authorize.net URL as set by setPath() or setURL(). |
int |
getPort()
Returns the Authorize.net gateway port as set by the setPort method or setURL(). |
java.lang.String |
getPostData()
Returns the request string that was submitted to the Authorize.net gateway. |
java.lang.String |
getResponseApprovalCode()
Gets the ResponseApprovalCode after transaction has been submitted. |
java.lang.String |
getResponseAVSResultCode()
Gets the Address Verification Result Code aftger the transaction has been submitted. |
byte[] |
getResponseBytes()
Returns the response byte array received from the Authorize.net gateway. |
java.lang.String |
getResponseCode()
Gets the response code after the transaction has been submitted. |
java.lang.String |
getResponseReasonCode()
gets the response reason code after the transaction has been submitted. |
java.lang.String |
getResponseReasonText()
Gets the Response Reason Text after the transaction has been submitted. |
java.lang.String |
getResponseSubCode()
Gets the Response Sub Code after the transaction has been submitted. |
java.lang.String |
getResponseTransactionID()
Gets Response Transaction ID after the transaction has been submitted. |
java.lang.String |
getResponseValue(int responsePosition)
Get Response Value by index from Authorize.net Gateway Transaction. |
java.lang.String |
getTranKey()
Returns the Authorize.net Merchant Transaction Key as set by the setTranKey() method. |
protected java.lang.String |
getVersion()
get Version |
protected java.util.Properties |
loadPropFile(java.lang.String propFileName)
Load the properties file |
protected void |
parseANetResponse(byte[] httpResponse)
|
void |
reloadProperties()
Re-Load the Properties File Useful if you want to modify the existing properties in real time without restarting the application. |
void |
reloadProperties(java.lang.String propFileName)
Re-Load the Properties File Useful if you want to modify the properties in real time without restarting the application. |
java.lang.String |
removeOptionalField(java.lang.String fieldName)
Remove Optional Field If you have previously set an optional field you can remove the field with the method. |
void |
removeTestMode()
Remove Test Mode Remove Test Mode omits the argument x_Test_Request completely. |
void |
setAmount(java.lang.String amount)
Sets the amount value for this transaction. |
void |
setDelimChar(char delimChar)
set delimiter character |
protected void |
setDelimData(boolean delimData)
set Delimit Data |
void |
setHost(java.lang.String host)
Sets the Authorize.net gateway host. |
void |
setLogin(java.lang.String loginID)
Sets the Authorize.net Merchant Login ID |
void |
setMerchantInfo(java.lang.String loginID,
java.lang.String tranKey)
Sets the Authorize.net Merchant Login ID and Transaction Key. |
void |
setPath(java.lang.String path)
Sets the Authorize.net gateway path. |
void |
setPort(int port)
Sets the Authorize.net gateway port Defaults to 443. |
void |
setTestMode(boolean value)
Set Test Mode Authorize.net supports testing by passing the argument x_Test_Request=true. |
void |
setTranKey(java.lang.String tranKey)
Sets the Authorize.net Merchant Transaction Key |
void |
setURL(java.lang.String host,
int port,
java.lang.String path)
set the components of the Authorize.net URL |
protected void |
setVersion(java.lang.String version)
set Version |
abstract void |
submit()
|
protected void |
submitANetGet()
|
protected void |
submitANetPost(java.lang.String host,
int port,
java.lang.String path,
byte[] postdata)
|
protected void |
submitANetPost(java.lang.String host,
int port,
java.lang.String path,
java.lang.String postdata)
|
protected void |
validateProperties(java.util.Properties p)
Validate Properties |
protected boolean |
verifyMD5Hash()
|
protected boolean |
verifyMD5Hash(java.lang.String md5HashValue)
|
protected boolean |
verifyMinimumFieldsSet()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected java.lang.String host
protected int port
protected java.lang.String path
protected char x_Delim_Char
protected java.lang.String postData
protected java.lang.String merchantMD5HashValue
protected byte[] rawResponse
protected java.lang.String x_Version
protected java.lang.String x_Delim_Data
protected java.lang.String x_Login
protected java.lang.String x_Tran_Key
protected java.lang.String x_Amount
| Constructor Detail |
protected AuthorizeNet()
| Method Detail |
protected java.util.Properties loadPropFile(java.lang.String propFileName)
throws java.io.IOException,
InvalidPropException
java.io.IOException
InvalidPropException
public void reloadProperties()
throws java.io.IOException,
InvalidPropException
java.io.IOException
InvalidPropException
public void reloadProperties(java.lang.String propFileName)
throws java.io.IOException,
InvalidPropException
propFileName - the name of the file to read the properties from.
java.io.IOException
InvalidPropException
protected void validateProperties(java.util.Properties p)
throws InvalidPropException
p - Properties object
InvalidPropExceptionprotected void setVersion(java.lang.String version)
protected java.lang.String getVersion()
protected void setDelimData(boolean delimData)
delimData - The default value is true.protected boolean getDelimData()
public void setDelimChar(char delimChar)
delimChar - the character used to delimit data in the responseprotected char getDelimChar()
public void setMerchantInfo(java.lang.String loginID,
java.lang.String tranKey)
This is an alternative method to setting the login ID and transaction key with individual calls.
loginID - Merchant Login IDtranKey - public void setLogin(java.lang.String loginID)
loginID - Merchant Login IDsetMerchantInfo()public java.lang.String getLogin()
setLogin method.
public void setTranKey(java.lang.String tranKey)
tranKey - transaction keysetMerchantInfo()public java.lang.String getTranKey()
setTranKey() method.
public void setAmount(java.lang.String amount)
amount - the amount of the transaction.public java.lang.String getAmount()
setAmount() method.
public void setHost(java.lang.String host)
host - the Authorize.net gatway hostsetURL()public java.lang.String getHost()
setHost() method.
public void setPort(int port)
port - the port the gateway is running onsetURL()public int getPort()
setPort method or setURL().
public void setPath(java.lang.String path)
path - the Authorize.net gateway pathsetURL()public java.lang.String getPath()
setPath() or setURL().
public void setURL(java.lang.String host,
int port,
java.lang.String path)
host - tbdport - tbdpath - tbdpublic java.lang.String getPostData()
submit() has been called.
public byte[] getResponseBytes()
submit() has been called.
public void setTestMode(boolean value)
value - true or falseremoveTestMode()public void removeTestMode()
setTestMode()
public void addOptionalField(java.lang.String fieldName,
java.lang.String fieldValue)
x_Address and for the zip it is x_Zip. Therefore you
would call this method twice with the following values:
addOptionalField("x_Address","123 Main St.")
addOptionalField("x_Zip","10101")
fieldName - field name as defined in the AIMfieldValue - value of field being setpublic java.lang.String removeOptionalField(java.lang.String fieldName)
fieldName - Name of optional parameter to be removedprotected void parseANetResponse(byte[] httpResponse)
protected boolean verifyMD5Hash()
protected boolean verifyMD5Hash(java.lang.String md5HashValue)
protected java.lang.String calcMD5Hash(java.lang.String input)
public java.lang.String getResponseValue(int responsePosition)
When a transaction is submitted to the Authoirze.net gateway, a comma seperated list of result fields is returned. The first seven fields are accessible using method from this class as they are the most important in determining whether a transaction was successful or not. The remaining 50+ fields can be access by index number using this method. Refer to the AIM manual for definitions of what other response fields are available.
responsePosition - index number of the reponse fieldgetResponseCode(),
getResponseSubCode(),
getResponseReasonCode(),
getResponseReasonText(),
getResponseApprovalCode(),
getResponseAVSResultCode(),
getResponseTransactionIDpublic java.lang.String getResponseCode()
public java.lang.String getResponseSubCode()
public java.lang.String getResponseReasonCode()
public java.lang.String getResponseReasonText()
public java.lang.String getResponseApprovalCode()
public java.lang.String getResponseAVSResultCode()
public java.lang.String getResponseTransactionID()
public void addMerchantDefinedField(java.lang.String fieldName,
java.lang.String fieldValue)
// echoed in position 69 of the response API
addMerchantDefinedField("any_key_you_want","This can be any information you want associated with the transaction")
// echoed in position 70 of the response API
addMerchantDefinedField("another_key","Some more information")
// echoed in position 71 of the responseAPI
addMerchantDefinedField("merchant_comment","This is a test transaction")
fieldName - namefieldValue - valueprotected boolean verifyMinimumFieldsSet()
protected void submitANetGet()
protected void submitANetPost(java.lang.String host,
int port,
java.lang.String path,
java.lang.String postdata)
throws java.lang.Exception
java.lang.Exception
protected void submitANetPost(java.lang.String host,
int port,
java.lang.String path,
byte[] postdata)
throws java.lang.Exception
java.lang.Exception
public abstract void submit()
throws java.lang.Exception
java.lang.Exception
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||