com.ibm.commerce.payment.extensions
Class GenericExtension

java.lang.Object
  |
  +--com.ibm.commerce.payment.extensions.GenericExtension

public class GenericExtension
extends java.lang.Object

This class is used by several WebSphere Commerce Cashier Profiles to generate values for an extension parameter specified in the cashier profile.

It implements the com.ibm.etill.cashier.CashierExtension interface.


Field Summary
protected static java.lang.String CHAR_ENCODING_8859_1
           
protected static java.lang.String KEY_CANCELURL
           
protected static java.lang.String KEY_EXPIRY
           
protected static java.lang.String KEY_FAILUREURL
           
protected static java.lang.String KEY_ORDERDESCRIPTION
           
protected static java.lang.String KEY_PAN
           
protected static java.lang.String KEY_SERVICEURL
           
protected static java.lang.String KEY_SUCCESSURL
           
protected static java.lang.String KEY_TRANSMETHOD
           
protected static java.lang.String UNSPECIFIED_BRAND
           
 
Constructor Summary
GenericExtension()
          GenericExtension default constructor.
 
Method Summary
protected  java.lang.String getCancelUrl(java.util.Hashtable parms)
          Prepare CancelURL for the WebSphere Commerce Payments ReceivePayment command.
protected  java.lang.String getCardExpiry(java.util.Hashtable parms)
          Returns the value of the cardExpiry parameter.
protected  java.lang.String getCardNumber(java.util.Hashtable parms)
          Returns the value of the cardNumber parameter.
protected  java.lang.String getFailureUrl(java.util.Hashtable parms)
          Prepare FailureURL for the WebSphere Commerce Payments ReceivePayment command for the Cassette for SET.
protected  java.lang.String getOrderDescription(java.util.Hashtable parms)
          Get the OrderDescription by calling the GetOrderDesc Task Command.
protected  java.lang.String getServiceUrl(java.util.Hashtable parms)
          Prepare ServiceURL for the WebSphere Commerce Payments ReceivePayment command for the Cassette for SET.
protected  java.lang.String getSuccessUrl(java.util.Hashtable parms)
          Prepare SuccessURL for the WebSphere Commerce Payments ReceivePayment command for the Cassette for SET.
protected  java.lang.String getTransMethod(java.util.Hashtable parms)
          Get the TransMethod parameter value for a Cassette.
 java.lang.String getValue(java.lang.String keyword, java.util.Hashtable parms, java.util.Hashtable paymentParms, java.sql.Connection dsConn, CashierTrace traceService, java.util.Locale locale)
          This method is called by the Cashier to give the CashierExtension an opportunity to construct and return a value for the specified keyword.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KEY_ORDERDESCRIPTION

protected static final java.lang.String KEY_ORDERDESCRIPTION
See Also:
Constant Field Values

KEY_SUCCESSURL

protected static final java.lang.String KEY_SUCCESSURL
See Also:
Constant Field Values

KEY_FAILUREURL

protected static final java.lang.String KEY_FAILUREURL
See Also:
Constant Field Values

KEY_CANCELURL

protected static final java.lang.String KEY_CANCELURL
See Also:
Constant Field Values

KEY_SERVICEURL

protected static final java.lang.String KEY_SERVICEURL
See Also:
Constant Field Values

KEY_TRANSMETHOD

protected static final java.lang.String KEY_TRANSMETHOD
See Also:
Constant Field Values

KEY_PAN

protected static final java.lang.String KEY_PAN
See Also:
Constant Field Values

KEY_EXPIRY

protected static final java.lang.String KEY_EXPIRY
See Also:
Constant Field Values

UNSPECIFIED_BRAND

protected static final java.lang.String UNSPECIFIED_BRAND
See Also:
Constant Field Values

CHAR_ENCODING_8859_1

protected static final java.lang.String CHAR_ENCODING_8859_1
See Also:
Constant Field Values
Constructor Detail

GenericExtension

public GenericExtension()
GenericExtension default constructor.
Method Detail

getCancelUrl

protected java.lang.String getCancelUrl(java.util.Hashtable parms)
                                 throws ECException
Prepare CancelURL for the WebSphere Commerce Payments ReceivePayment command.
Parameters:
parms - the Hashtable containing the parameters (name-value pairs) passed to the Cashier Extension.
Returns:
the Cancel URL.
Throws:
ECException.
ECException

getCardExpiry

protected java.lang.String getCardExpiry(java.util.Hashtable parms)
                                  throws ECException
Returns the value of the cardExpiry parameter.
Parameters:
parms - the Hashtable containing the parameters (name-value pairs) passed to the Cashier Extension.
Returns:
the card expiry date normally in the form of YYYYMM where YYYY is the year and MM is the 2-digit month of the year.
Throws:
ECException.
ECException

getCardNumber

protected java.lang.String getCardNumber(java.util.Hashtable parms)
                                  throws ECException
Returns the value of the cardNumber parameter.
Parameters:
parms - the Hashtable containing the parameters (name-value pairs) passed to the Cashier Extension.
Returns:
the card number.
Throws:
ECException.
ECException

getFailureUrl

protected java.lang.String getFailureUrl(java.util.Hashtable parms)
                                  throws ECException
Prepare FailureURL for the WebSphere Commerce Payments ReceivePayment command for the Cassette for SET.
Parameters:
parms - the Hashtable containing the parameters (name-value pairs) passed to the Cashier Extension.
Returns:
the Failure URL.
Throws:
ECException.
ECException

getOrderDescription

protected java.lang.String getOrderDescription(java.util.Hashtable parms)
                                        throws ECException
Get the OrderDescription by calling the GetOrderDesc Task Command.
Parameters:
parms - the Hashtable containing the parameters (name-value pairs) passed to the Cashier Extension.
Returns:
a String formed by encoding the byte array returned from the GetOrderDesc Task Command using the "8859_1" character-encoding.
Throws:
ECException.
ECException

getServiceUrl

protected java.lang.String getServiceUrl(java.util.Hashtable parms)
                                  throws ECException
Prepare ServiceURL for the WebSphere Commerce Payments ReceivePayment command for the Cassette for SET.
Parameters:
parms - the Hashtable containing the parameters (name-value pairs) passed to the Cashier Extension.
Returns:
the Service URL.
Throws:
ECException.
ECException

getSuccessUrl

protected java.lang.String getSuccessUrl(java.util.Hashtable parms)
                                  throws ECException
Prepare SuccessURL for the WebSphere Commerce Payments ReceivePayment command for the Cassette for SET.
Parameters:
parms - The Hashtable containing the parameters (name-value pairs) passed to the Cashier Extension.
Returns:
The Success URL.
Throws:
ECException.
ECException

getTransMethod

protected java.lang.String getTransMethod(java.util.Hashtable parms)
                                   throws ECException
Get the TransMethod parameter value for a Cassette.

The TransMethod parameter value returned will be "0" if the communication channel from the shopper's browser to the merchant server is secure. Otherwise return a "1".

For reference, these returned TransMethod values are as defined by the SET Consortium for MIA.

As of today, only the Cassette for SET uses this parameter when Merchant-Initiated Authorization is used.

Parameters:
parms - The Hashtable containing the parameters (name-value pairs) passed to the Cashier Extension.
Returns:
"0" if the communication channel from the shopper's browser to the merchant server is secure. Otherwise "1" is returned.
Throws:
ECException.
ECException

getValue

public java.lang.String getValue(java.lang.String keyword,
                                 java.util.Hashtable parms,
                                 java.util.Hashtable paymentParms,
                                 java.sql.Connection dsConn,
                                 CashierTrace traceService,
                                 java.util.Locale locale)
                          throws CashierException
This method is called by the Cashier to give the CashierExtension an opportunity to construct and return a value for the specified keyword.

Several of the Standard WebSphere Commerce Cashier Profiles use this method to generate values for the extension parameter specified in the profile. The two parameters that use this method are:

Note that the DataSource Connection parameter is generally null as WebSphere Commerce does not pass a DataSource Connection to the Cashier.

Parameters:
keyword - WebSphere Commerce Payments Protocol Data keyword (for example, "$ORDERDESCRIPTION", "$TRANSMETHOD", "$AVS.STATEPROVINCE", etc.)
parms - The Hashtable containing the parameters (name-value pairs) passed to the Cashier Extension.
paymentParms - Payment parameters collected up to this point
dsConn - DataSource Connection to be used for looking up database values
traceService - Trace Service instance for tracing to merchant server log
locale - Locale
Returns:
a String representing the value to be used for the keyword specified.
Throws:
CashierException