com.ibm.etill.cashier
Class Cashier

java.lang.Object
  com.ibm.etill.cashier.Cashier
All Implemented Interfaces:
CommandConstants

public class Cashier
extends java.lang.Object
implements CommandConstants

The cashier is a component that allows merchant software to fully utilize new cassettes without having to modify any code. The cashier utilizes payment option profiles for each cassette to describe the set of required cassette-specific parameters as well as the methods for collecting that information from the merchant software environment. The merchant software must be coded only once to call the cashier for order creation (instead of the acceptPayment or receivePayment commands). From that point on, new cassettes can be added to the environment by adding new profiles. In addition, applications can use the profile information to dynamically build checkout/buy pages that present the list of available payment options to the buyer.


Field Summary
Fields inherited from interface com.ibm.etill.cashier.CommandConstants
ABOUT, ACCEPTPAYMENT, APPROVE, APPROVEREVERSAL, BATCHCLOSE, BATCHOPEN, BATCHPURGE, CANCELORDER, CASSETTECONTROL, CLOSEORDER, commands, CREATEACCOUNT, CREATEMERCHANT, CREATEMERCHANTCASSETTEOBJECT, CREATEMEREVENTLISTENER, CREATEPAYSYSTEM, CREATESNMEVENTLISTENER, CREATESYSTEMCASSETTEOBJECT, DELETEACCOUNT, DELETEBATCH, DELETEMERCHANT, DELETEMERCHANTCASSETTEOBJECT, DELETEMEREVENTLISTENER, DELETEPAYSYSTEM, DELETESNMEVENTLISTENER, DELETESYSTEMCASSETTEOBJECT, DEPOSIT, DEPOSITREVERSAL, MODIFYACCOUNT, MODIFYCASSETTE, MODIFYMERCHANT, MODIFYMERCHANTCASSETTEOBJECT, MODIFYMEREVENTLISTENER, MODIFYPAYSERVER, MODIFYPAYSYSTEM, MODIFYSNMEVENTLISTENER, MODIFYSYSTEMCASSETTEOBJECT, MODIFYUSERSTATUS, QUERYACCOUNTS, QUERYBATCHES, QUERYCASSETTES, QUERYCREDITS, QUERYEVENTLISTENERS, QUERYMERCHANTS, QUERYORDERS, QUERYPAYMENTS, QUERYPAYMENTSERVER, QUERYPAYSYSTEMS, QUERYUSERS, RECEIVEPAYMENT, REFUND, REFUNDREVERSAL, SETUSERACCESSRIGHTS
Constructor Summary
Cashier(java.lang.String profileDirectory)
Constructs a cashier.
Cashier(java.lang.String profileDirectory, java.lang.String paymentManagerHostname, int paymentManagerPort, java.lang.String socksHostname, int socksPort, java.lang.String userid, java.lang.String password, boolean useSSL)
Constructs a cashier and specifies WebSphere Commerce Payments configuration information (including socks server information).
Cashier(java.lang.String profileDirectory, java.lang.String paymentManagerHostname, int paymentManagerPort, java.lang.String userid, java.lang.String password, boolean useSSL)
Constructs a cashier and specifies Commerce Payments configuration information (excluding socks server information).
Method Summary
CheckPaymentResponse checkPayment(java.lang.String merchantNumber, java.lang.String orderNumber)
This method checks the status of an order on WebSphere Commerce Payments system.
CheckPaymentResponse checkPayment(java.lang.String profileName, java.lang.String merchantNumber, java.lang.String orderNumber)
This method checks the status of an order on WebSphere Commerce Payments system.
PaymentServerResponse collectPayment(java.lang.String profileName, java.util.Locale locale, java.util.Hashtable environmentValues)
This method creates an order on WebSphere Commerce Payments system.
PaymentServerResponse collectPayment(java.lang.String profileName, java.util.Locale locale, java.util.Hashtable environmentValues, java.sql.Connection connection)
This method creates an order on WebSphere Commerce Payments system.
PaymentServerResponse collectPayment(java.lang.String profileName, java.util.Locale locale, java.util.Hashtable environmentValues, Queryable queryable)
This method creates an order on WebSphere Commerce Payments system.
boolean doesCommandRequireConnection(int command, java.lang.String profileName)
Returns an indication of whether or not the referenced profile will require a Connection object when calling the command.
boolean doesProfileRequireConnection(java.lang.String profileName)
Returns an indication of whether or not the referenced profile will require a Connection object when calling collectPayment.
boolean doesProfileUseWallet(java.lang.String profileName)
Returns an indication of whether or not the specified profile uses a wallet.
java.lang.String getBuyPageInformation(java.lang.String profileName)
Returns the Buy Page Information for CollectPayment of the specified profile.
java.lang.String getBuyPageInformation(java.lang.String profileName, int command)
Returns the Buy Page Information for the specified profile and command.
java.lang.String getBuyPageInformationReference(java.lang.String profileName)
Returns the Buy Page Information reference for CollectPayment of the specified profile.
java.lang.String getBuyPageInformationReference(java.lang.String profileName, int command)
Returns the Buy Page Information reference for the specified profile and command.
PaymentServerClient getPaymentServerClient(java.lang.String profileName)
Returns a PaymentServerClient which can be used to issue API commands to WebSphere Commerce Payments.
PaymentServerResponse issueCommand(int command, java.lang.String profileName, java.util.Locale locale, java.util.Map environmentValues)
This method issues a command on WebSphere Commerce Payments system.
PaymentServerResponse issueCommand(int command, java.lang.String profileName, java.util.Locale locale, java.util.Map environmentValues, java.sql.Connection connection)
This method issues a command on WebSphere Commerce Payments system.
PaymentServerResponse issueCommand(int command, java.lang.String profileName, java.util.Locale locale, java.util.Map environmentValues, Queryable queryable)
This method issues a command on WebSphere Commerce Payments system.
void setDTDPath(java.lang.String DTDPath)
Sets the DTD path to be used by the Cashier.
void setPassword(java.lang.String password)
Sets the password to be used by the Cashier.
void setTraceClass(CashierTrace cashierTrace)
Sets the class which the cashier will use to trace.
void setUserid(java.lang.String userid)
Sets the userid to be used by the Cashier.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

Cashier

public Cashier(java.lang.String profileDirectory)
        throws CashierException
Constructs a cashier. When using this constructor, it is assumed that all profiles used by this instance will contain Commerce Payments configuration information.
Parameters:
profileDirectory - directory in which profiles are located.
Throws:
CashierException - if there is an error using the cashier.

Cashier

public Cashier(java.lang.String profileDirectory,
               java.lang.String paymentManagerHostname,
               int paymentManagerPort,
               java.lang.String userid,
               java.lang.String password,
               boolean useSSL)
        throws CashierException
Constructs a cashier and specifies Commerce Payments configuration information (excluding socks server information).
Parameters:
profileDirectory - directory in which profiles are located.
paymentManagerHostname - hostname of WebSphere Commerce Payments.
paymentManagerPort - port number of WebSphere Commerce Payments.
userid - user id used to access WebSphere Commerce Payments.
password - password correxponding to the user id parameter.
useSSL - indication of whether to use SSL to secure the communication between the cashier and WebSphere Commerce Payments.
Throws:
CashierException - if there is an error using the cashier.

Cashier

public Cashier(java.lang.String profileDirectory,
               java.lang.String paymentManagerHostname,
               int paymentManagerPort,
               java.lang.String socksHostname,
               int socksPort,
               java.lang.String userid,
               java.lang.String password,
               boolean useSSL)
        throws CashierException
Constructs a cashier and specifies WebSphere Commerce Payments configuration information (including socks server information).
Parameters:
profileDirectory - directory in which profiles are located.
paymentManagerHostname - hostname of WebSphere Commerce Payments.
paymentManagerPort - port number of WebSphere Commerce Payments.
socksHostname - hostname of the socks server. null if not using a socks server
socksPort - port number of the socks server. -1 if not using a socks server
userid - user id used to access WebSphere Commerce Payments.
password - password corresponding to the user id parameter.
useSSL - indication of whether to use SSL to secure the communication between the cashier and WebSphere Commerce Payments.
Throws:
CashierException - if there is an error using the cashier.
Method Detail

setTraceClass

public void setTraceClass(CashierTrace cashierTrace)
Sets the class which the cashier will use to trace.
Parameters:
cashierTrace - the CashierTrace instance which the cashier will use.

setPassword

public void setPassword(java.lang.String password)
Sets the password to be used by the Cashier.
Parameters:
password - the password which the cashier will use when communicating with WebSphere Commerce Payments. Will be overridden if PaymentManagerConfiguration is in the profile.

setUserid

public void setUserid(java.lang.String userid)
Sets the userid to be used by the Cashier.
Parameters:
userid - the userid which the cashier will use when communicating with WebSphere Commerce Payments. Will be overridden if PaymentManagerConfiguration is in the profile.

setDTDPath

public void setDTDPath(java.lang.String DTDPath)
Sets the DTD path to be used by the Cashier.
Parameters:
DTDPath - the DTD path which the cashier will use when communicating with WebSphere Commerce Payments. Will be overridden if PaymentManagerConfiguration is in the profile.

collectPayment

public PaymentServerResponse collectPayment(java.lang.String profileName,
                                            java.util.Locale locale,
                                            java.util.Hashtable environmentValues)
                                     throws CashierException,
                                            ProfileException,
                                            PaymentServerCommunicationException
This method creates an order on WebSphere Commerce Payments system.
Parameters:
profileName - name of the profile (without the '.profile' extension).
locale - locale.
environmentValues - values from the order processing environment.
Throws:
CashierException - if there is an error using the cashier.
ProfileException - if there is an error with the referenced profile.
PaymentServerCommunicationException - if there is an error communicating with WebSphere Commerce Payments.

collectPayment

public PaymentServerResponse collectPayment(java.lang.String profileName,
                                            java.util.Locale locale,
                                            java.util.Hashtable environmentValues,
                                            java.sql.Connection connection)
                                     throws CashierException,
                                            ProfileException,
                                            PaymentServerCommunicationException
This method creates an order on WebSphere Commerce Payments system.
Parameters:
profileName - name of the profile (without the '.profile' extension).
locale - locale.
environmentValues - values from the order processing environment.
connection - Connection to be used to look up database values. (close it yourself after this call)
Throws:
CashierException - if there is an error using the cashier.
ProfileException - if there is an error with the referenced profile.
PaymentServerCommunicationException - if there is an error communicating with WebSphere Commerce Payments.

collectPayment

public PaymentServerResponse collectPayment(java.lang.String profileName,
                                            java.util.Locale locale,
                                            java.util.Hashtable environmentValues,
                                            Queryable queryable)
                                     throws CashierException,
                                            ProfileException,
                                            PaymentServerCommunicationException
This method creates an order on WebSphere Commerce Payments system.
Parameters:
profileName - name of the profile (without the '.profile' extension).
locale - locale.
environmentValues - values from the order processing environment.
queryable - Queryable to be used to look up database values.
Throws:
CashierException - if there is an error using the cashier.
ProfileException - if there is an error with the referenced profile.
PaymentServerCommunicationException - if there is an error communicating with WebSphere Commerce Payments.

checkPayment

public CheckPaymentResponse checkPayment(java.lang.String merchantNumber,
                                         java.lang.String orderNumber)
                                  throws CashierException,
                                         ProfileException,
                                         PaymentServerCommunicationException
This method checks the status of an order on WebSphere Commerce Payments system.
Parameters:
merchantNumber - WebSphere Commerce Payments merchant number.
orderNumber - WebSphere Commerce Payments order number.
Throws:
CashierException - if there is an error using the cashier.
PaymentServerCommunicationException - if there is an error communicating with WebSphere Commerce Payments.
ProfileException

checkPayment

public CheckPaymentResponse checkPayment(java.lang.String profileName,
                                         java.lang.String merchantNumber,
                                         java.lang.String orderNumber)
                                  throws CashierException,
                                         ProfileException,
                                         PaymentServerCommunicationException
This method checks the status of an order on WebSphere Commerce Payments system.
Parameters:
profileName - name of the profile used to create the order (without the '.profile' extension).
merchantNumber - WebSphere Commerce Payments merchant number.
orderNumber - WebSphere Commerce Payments order number.
Throws:
CashierException - if there is an error using the cashier.
ProfileException - if there is an error with the referenced profile.
PaymentServerCommunicationException - if there is an error communicating with WebSphere Commerce Payments.

getBuyPageInformation

public java.lang.String getBuyPageInformation(java.lang.String profileName)
                                       throws ProfileException
Returns the Buy Page Information for CollectPayment of the specified profile.
Parameters:
profileName - name of the profile (without the '.profile' extension).
Returns:
the buy page information for CollectPayment of the specified profile. null if no buy page information was specified for CollectPayment of the profile
Throws:
ProfileException - if there is an error with the referenced profile.

getBuyPageInformationReference

public java.lang.String getBuyPageInformationReference(java.lang.String profileName)
                                                throws ProfileException
Returns the Buy Page Information reference for CollectPayment of the specified profile.
Parameters:
profileName - name of the profile (without the '.profile' extension).
Returns:
the buy page information reference for CollectPayment of the specified profile. null if no buy page information reference was specified for CollectPayment of the profile
Throws:
ProfileException - if there is an error with the referenced profile.

getBuyPageInformation

public java.lang.String getBuyPageInformation(java.lang.String profileName,
                                              int command)
                                       throws ProfileException
Returns the Buy Page Information for the specified profile and command.
Parameters:
profileName - name of the profile (without the '.profile' extension).
command - Cashier.ACCEPTPAYMENT or Cashier.RECEIVEPAYMENT.
Returns:
the buy page information for the specified profile and command. null if no buy page information was specified for the profile and command
Throws:
ProfileException - if there is an error with the referenced profile.

getBuyPageInformationReference

public java.lang.String getBuyPageInformationReference(java.lang.String profileName,
                                                       int command)
                                                throws ProfileException
Returns the Buy Page Information reference for the specified profile and command.
Parameters:
profileName - name of the profile (without the '.profile' extension).
command - Cashier.ACCEPTPAYMENT or Cashier.RECEIVEPAYMENT.
Returns:
the buy page information reference for the specified profile and command. null if no buy page information reference was specified in the profile and command
Throws:
ProfileException - if there is an error with the referenced profile.

doesProfileUseWallet

public boolean doesProfileUseWallet(java.lang.String profileName)
                             throws ProfileException
Returns an indication of whether or not the specified profile uses a wallet.
Parameters:
profileName - name of the profile (without the '.profile' extension).
Returns:
an indication of whether or not the specified profile uses a wallet.
Throws:
ProfileException - if there is an error with the referenced profile.

doesProfileRequireConnection

public boolean doesProfileRequireConnection(java.lang.String profileName)
                                     throws ProfileException
Returns an indication of whether or not the referenced profile will require a Connection object when calling collectPayment.
Parameters:
profileName - name of the profile (without the '.profile' extension).
Returns:
an indication of whether or not the specified profile requires the use of a Connection
Throws:
ProfileException - if there is an error with the referenced profile.

doesCommandRequireConnection

public boolean doesCommandRequireConnection(int command,
                                            java.lang.String profileName)
                                     throws ProfileException
Returns an indication of whether or not the referenced profile will require a Connection object when calling the command.
Parameters:
command - constant representing the command from CommandConstants.
profileName - name of the profile (without the '.profile' extension).
Returns:
an indication of whether or not the specified profile requires the use of a Connection
Throws:
ProfileException - if there is an error with the referenced profile.

getPaymentServerClient

public PaymentServerClient getPaymentServerClient(java.lang.String profileName)
                                           throws ProfileException
Returns a PaymentServerClient which can be used to issue API commands to WebSphere Commerce Payments. The argument to this method should be the name of the profile used to create a given command. The PaymentServerClient which is returned can be used to issue subsequent API commends for the order/payment (e.g. APPROVE, DEPOSIT, CANCELORDER).
Parameters:
profileName - name of the profile used to create a command (without the '.profile' extension).
Returns:
an initialized PaymentServerClient
Throws:
ProfileException - if there is an error with the referenced profile.

issueCommand

public PaymentServerResponse issueCommand(int command,
                                          java.lang.String profileName,
                                          java.util.Locale locale,
                                          java.util.Map environmentValues)
                                   throws CashierException,
                                          ProfileException,
                                          PaymentServerCommunicationException
This method issues a command on WebSphere Commerce Payments system.
Parameters:
command - constant from CommandConstants specifying command.
profileName - name of the profile (without the '.profile' extension).
locale - locale.
environmentValues - values from the order processing environment.
Throws:
CashierException - if there is an error using the cashier.
ProfileException - if there is an error with the referenced profile.
PaymentServerCommunicationException - if there is an error communicating with WebSphere Commerce Payments.

issueCommand

public PaymentServerResponse issueCommand(int command,
                                          java.lang.String profileName,
                                          java.util.Locale locale,
                                          java.util.Map environmentValues,
                                          java.sql.Connection connection)
                                   throws CashierException,
                                          ProfileException,
                                          PaymentServerCommunicationException
This method issues a command on WebSphere Commerce Payments system.
Parameters:
command - constant from CommandConstants specifying command.
profileName - name of the profile (without the '.profile' extension).
locale - locale.
environmentValues - values from the order processing environment.
connection - Connection to be used to look up database values. (close it yourself after this call)
Throws:
CashierException - if there is an error using the cashier.
ProfileException - if there is an error with the referenced profile.
PaymentServerCommunicationException - if there is an error communicating with WebSphere Commerce Payments.

issueCommand

public PaymentServerResponse issueCommand(int command,
                                          java.lang.String profileName,
                                          java.util.Locale locale,
                                          java.util.Map environmentValues,
                                          Queryable queryable)
                                   throws CashierException,
                                          ProfileException,
                                          PaymentServerCommunicationException
This method issues a command on WebSphere Commerce Payments system.
Parameters:
command - constant from CommandConstants specifying command.
profileName - name of the profile (without the '.profile' extension).
locale - locale.
environmentValues - values from the order processing environment.
queryable - Queryable to be used to look up database values.
Throws:
CashierException - if there is an error using the cashier.
ProfileException - if there is an error with the referenced profile.
PaymentServerCommunicationException - if there is an error communicating with WebSphere Commerce Payments.

Feedback