com.ibm.etill.framework.clientapi
Class PaymentServerTestClient

java.lang.Object
  com.ibm.etill.framework.clientapi.PaymentServerClient
      com.ibm.etill.framework.clientapi.PaymentServerTestClient

public class PaymentServerTestClient
extends PaymentServerClient

The test client is intended to support merchant programmers who need to develop merchant applications that will use payment types that do not yet exist. It is a subclass of PaymentServerClient and can be used throughout most of the merchant's program as a PaymentServerClient. However, when issueCommand is called against a test client, instead of sending the command to Commerce Payments the test client retrieves an XML document from a standard location and uses that as the response. These XML documents should reflect what would be returned by Commerce Payments if the new payment cassette actually existed.


Field Summary
Fields inherited from class com.ibm.etill.framework.clientapi.PaymentServerClient
dtdPath, hostName, httpHeaderFields, lastRequest, lastXML, socket, socksHostName, socksPort, tcpPort
Constructor Summary
PaymentServerTestClient()
Default constructor.
PaymentServerTestClient(java.lang.String dtdPath, java.lang.String hostName, int tcpPort)
This constructor creates a Commerce Payments test client.
PaymentServerTestClient(java.lang.String dtdPath, java.lang.String hostName, int tcpPort, java.util.Hashtable httpHeaderFields)
This constructor creates a Commerce Payments test client.
PaymentServerTestClient(java.lang.String dtdPath, java.lang.String hostName, int tcpPort, java.lang.String socksHostName, int socksPort)
This constructor creates a Commerce Payments test client.
PaymentServerTestClient(java.lang.String dtdPath, java.lang.String hostName, int tcpPort, java.lang.String socksHostName, int socksPort, java.util.Hashtable httpHeaderFields)
This constructor creates a Commerce Payments test client.
Method Summary
protected java.net.Socket connect()
Connect
PaymentServerResponse issueCommand(java.lang.String command, java.util.Hashtable keywordValuePairs, java.lang.String basicAuthUserid, java.lang.String basicAuthPassword)
Send commands to Commerce Payments.
Methods inherited from class com.ibm.etill.framework.clientapi.PaymentServerClient
addLocaleToHttpHeader, close, finalize, getHostname, getHTTPHeaderFields, getLastRequest, getLastXML, getPort, getSocksHostname, getSocksPort, init, init, init, init, issueCommand, issueCommand, issueCommand
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

PaymentServerTestClient

public PaymentServerTestClient()
Default constructor.

PaymentServerTestClient

public PaymentServerTestClient(java.lang.String dtdPath,
                               java.lang.String hostName,
                               int tcpPort,
                               java.lang.String socksHostName,
                               int socksPort,
                               java.util.Hashtable httpHeaderFields)
This constructor creates a Commerce Payments test client.
Parameters:
hostName - -- host name of Commerce Payments.
tcpPort - -- port number of the HTTP server used by Commerce Payments. Default is 80.
socksHostName - -- socks server's host name.
socksPort - -- socks server's port number.
httpHeaderFields - -- the HTTP header fields hashtable

PaymentServerTestClient

public PaymentServerTestClient(java.lang.String dtdPath,
                               java.lang.String hostName,
                               int tcpPort,
                               java.lang.String socksHostName,
                               int socksPort)
This constructor creates a Commerce Payments test client.
Parameters:
hostName - -- host name of Commerce Payments.
tcpPort - -- port number of the HTTP server used by Commerce Payments. Default is 80.
socksHostName - -- socks server's host name.
socksPort - -- socks server's port number.

PaymentServerTestClient

public PaymentServerTestClient(java.lang.String dtdPath,
                               java.lang.String hostName,
                               int tcpPort,
                               java.util.Hashtable httpHeaderFields)
This constructor creates a Commerce Payments test client.
Parameters:
hostName - -- host name of Commerce Payments.
tcpPort - -- port number of the HTTP server used by Commerce Payments. Default is 80.
httpHeaderFields - -- the HTTP header fields hashtable

PaymentServerTestClient

public PaymentServerTestClient(java.lang.String dtdPath,
                               java.lang.String hostName,
                               int tcpPort)
This constructor creates a Commerce Payments test client.
Parameters:
hostName - -- host name of Commerce Payments.
tcpPort - -- port number of the HTTP server used by Commerce Payments. Default is 80.
Method Detail

connect

protected java.net.Socket connect()
                           throws java.io.IOException
Connect

- create and connect a socket

- will be overridden by SSL client (and other subclasses)

Overrides:
connect in class PaymentServerClient
Throws:
java.io.IOException

issueCommand

public PaymentServerResponse issueCommand(java.lang.String command,
                                          java.util.Hashtable keywordValuePairs,
                                          java.lang.String basicAuthUserid,
                                          java.lang.String basicAuthPassword)
                                   throws PaymentServerClientException,
                                          PaymentServerAuthorizationException,
                                          PaymentServerCommunicationException
Send commands to Commerce Payments. IssueCommand throws exceptions in the event of errors or other processing problems.
Overrides:
issueCommand in class PaymentServerClient
Parameters:
command - -- the Commerce Payments API command name.
keywordValuePairs - -- the keyword-value pairs to be sent with the Commerce Payments API command.
basicAuthUserid - -- user name used for the basic authentication.
basicAuthPassword - -- password used for the basic authentication.
Returns:
a PaymentServerResponse object.
Throws:
PaymentServerAuthorizationException - This exception is thrown when the command to Commerce Payments is rejected with HTTP 401, Not authorized. It generally indicates either:
  • The merchant programmer provided an incorrect user/password
  • The user has not been properly configured within WebSphere
    PaymentServerCommunicationException - This exception is thrown when CAL is having trouble communicating with Commerce Payments. This exception can mean:
    • CAL received a bad HTTP response; this generally means that something is wrong with the Payment Servlet and or the WebServer/WebSphere configuration.
    • CAL took an IOException, which means that the TCP and or SSL layers threw an IOException (could not connect to Commerce Payments or the connection went down prematurely) If this exception does result from an IOException, the IOException is stored within the communication exception (and can be accessed by the merchant programmer).
      PaymentServerClientException - This is the internal exception thrown by CAL.

Feedback