com.indus.toolkit.authorizenet
Class AuthorizeNetToolkit

java.lang.Object
  |
  +--com.indus.toolkit.authorizenet.AuthorizeNetToolkit

public class AuthorizeNetToolkit
extends java.lang.Object

This is the main toolkit class that exposes function to user which connects to Authorize.Net server.

Example:

AuthorizeNetToolkit tk = new AuthorizeNetToolkit();

//Only mandatory parameters are passed through the constructor.
//If you wish to set additional parameters, use the setter methods.
//Check the code below
CCInputHolder input = new CCInputHolder(
"1.00", "03/03",
"4007000000027", "your_userid",
"your_password");


input.setTestRequest(true);
//Sets the transaction in test mode.
//This will override the settings on
//Authorize.net web site.
input.setAddress(
"23 Main Street.");
input.setCity(
"New York");
input.setState(
"NY");
input.setZip(
"23232");
input.setCountry(
"USA");
input.setCardCode(
"232");
input.setFirstName(
"John");
input.setLastName(
"Momento");

//Submit the request. The response will be sent to the response
//object.
CCResponseHolder response = tk.submitRequest(input);

//Response object will be NULL if
if(response == null){
//Some error occurred.
Throwable = tk.getLastError();
//Handle the error here.
}else{
System.out.println(
"Response code = " + response.getResponseCode());
System.out.println(
"Response text = " + response.getResponseReasonText());
}


Constructor Summary
AuthorizeNetToolkit()
          Constructs a Toolkit for Authorize.Net
 
Method Summary
 java.lang.Throwable getLastError()
          This method returns the last error.
 CCResponseHolder submitRequest(CCInputHolder input)
          This is method sends a request to Authorize.Net servers using SSL and returns the response back through a CCResponseHolder object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AuthorizeNetToolkit

public AuthorizeNetToolkit()
Constructs a Toolkit for Authorize.Net
Method Detail

getLastError

public java.lang.Throwable getLastError()
This method returns the last error.

submitRequest

public CCResponseHolder submitRequest(CCInputHolder input)
This is method sends a request to Authorize.Net servers using SSL and returns the response back through a CCResponseHolder object.
Returns:
On successful communication, a CCResponseHolder object is returned. In case of a failure a null is returned. The caller method should check for null and call the getLastError() method to get details about the error.

IMPORTANT: A failure in this case does NOT mean a rejection of a credit card transaction, it means that the toolkit could not communicate with the Authorize.Net servers.