com.ibm.commerce.payment.commands
Class DoPaymentMPFInternalCmdImpl

com.ibm.commerce.payment.commands.DoPaymentMPFInternalCmdImpl
All Implemented Interfaces:
DoInventory, DoPaymentMPFInternalCmd, ECCommand, TaskCommand

public class DoPaymentMPFInternalCmdImpl
implements DoPaymentMPFInternalCmd, DoInventory

This DoPaymentMPFInternalCmd Task Command Implementation is called by the DoPaymentMPFCmdImpl Task Command to process payment for an order using the WebSphere Payment Manager when the payMethodId url parameter was specified with the OrderProcess command. This Task Command Implementation is a renamed version of the original DoPaymentMPFCmdImpl class and is mainly for backward compatibility. It does not support any of the new function introduced with WCBE.

This DoPaymentMPFInternalCmd implementation class is independent of the Payment Manager cassette that would be used to process the payment for the order. It uses the Cashier profile specified by the payMethodId parameter to direct the Cashier to gather parameters needed by the Payment Manager cassette. This command implementation supports both non-Wallet based Payment Manager Cassettes and Wallet-based Payment Manager Cassettes.

If the command is successful, the OrderProcessCmd will set the Order status to the value specified by this command.

If unsuccessful, the command throws the ECApplicationException specifying an Error Code and the Error View named by the com.ibm.commerce.DoPaymentCmd.ERROR_TASK_NAME.

The DoPaymentMPFInternalCmdImpl class may result in non-empty returnData for the OrderProcessCmd dependent on the Cassette.


Field Summary
static java.lang.String BILLTO_ADDRESS1
           
static java.lang.String BILLTO_CITY
           
static java.lang.String BILLTO_COUNTRY
           
static java.lang.String BILLTO_COUNTRY_CODE
           
static java.lang.String BILLTO_FIRSTNAME
           
static java.lang.String BILLTO_LASTNAME
           
static java.lang.String BILLTO_MIDDLENAME
           
static java.lang.String BILLTO_STATE
           
static java.lang.String BILLTO_ZIPCODE
           
static java.lang.String BUYER_LANGUAGE_ID
           
static java.lang.String CARD_EXPIRY
           
static java.lang.String CARD_NUMBER
           
static java.lang.String CURRENCY_ALPHA_CODE
           
static java.lang.String PAYMTHD_PSRVR
           
static java.lang.String PAYMTHD_SET
           
static int PRC_DUPLICATE_OBJECT
           
static int SRC_CONNECTION_TO_PM_FAILED
           
static int SRC_INITIALIZATION_MESSAGE
           
static int SRC_ORDER
           
static int SRC_USER_NOT_AUTHORIZED
           
 
Fields inherited from interface com.ibm.commerce.payment.commands.DoPaymentMPFInternalCmd
CC_VALID_Y_RANGE, COPYRIGHT, defaultCommandClassName, ERR_CODE_BAD_CCNUM, ERR_CODE_BAD_SYS, ERR_CODE_BAD_XDATE, ERR_CODE_MISSING_PARAM, ERRTASK_NAME, MESSAGE_FOR_BUYER, NAME, NVP_FIELD, PM_MESSAGE_FOR_BUYER, PM_MESSAGE_FOR_MERCHANT, PM_PRIMARY_RC, PM_SECONDARY_RC, WCSHOSTNAME, WCSWEBSERVERPORT, WEBPATH
 
Constructor Summary
DoPaymentMPFInternalCmdImpl()
           
 
Method Summary
protected  void checkParameters()
          Checks the validity of customer-supplied parameters.
 java.lang.String getContentType()
          Returns the Content Type (or MIME type) of the return data, or null if the type is not known.
protected  java.lang.String getCurrencyExponent()
           
protected  java.lang.String getDisplayPaymentStateForTrace(int anPaymentState)
          Returns the display String represnting the Payment State as returned by Payment Manager for Trace purposes.
protected  java.lang.String getNumericCountryCode(java.lang.String productVendor, java.lang.String country)
          Returns the numeric country/region code for the specified country/region as specified by the product/vendor in the Country Code Table (COUNTCODE).
protected  java.lang.String getNumericCurrencyCode()
           
protected  OrderAccessBean getOrderAccessBean()
          This method will first check if the local variable is set or not.
protected  java.lang.Long getOrderId()
           
 java.lang.String getOrderState()
          Returns the single character String value that the called command wants the Calling command to use to set the Status of the order.
protected  TypedProperty getPaymentAttributes()
           
protected  java.lang.Integer getPaymentMethodId()
           
protected  java.math.BigInteger getPMTotalAmount()
           
protected  java.lang.String getProfileName()
           
 byte[] getReturnData()
          Returns the byte Array containing Return Data from the Payment Manager.
protected  java.math.BigDecimal getTotalAmount()
           
 boolean isReadyToCallExecute()
          This method is called by the Command Framework to check if all basic mandatory parameters have been set for this command.
 void performExecute()
          Performs the main business logic of the command.
 java.util.Hashtable query(java.lang.String queryString)
          The Cashier calls this method to construct a Hashtable of keywords and values which result from processing the input query string.
 void reset()
          Resets the instance variables of the command.
protected  void setContentType(java.lang.String sContentType)
           
protected  void setCurrencyExponent(java.lang.String astrCurrencyExponent)
           
protected  void setNumericCurrencyCode(java.lang.String astrCurrencyCode)
           
protected  void setOrderAccessBean(OrderAccessBean abOrder)
           
 void setOrderId(java.lang.Long orderId)
          Sets the orderId property of the command.
protected  void setOrderState(java.lang.String orderState)
           
 void setPaymentAttributes(TypedProperty paymentAttributes)
          Sets the paymentAttributes property of the command.
 void setPaymentMethodId(java.lang.Integer nPayMthdId)
           
protected  void setPMTotalAmount(java.math.BigInteger biPMTotalAmount)
           
protected  void setProfileName(java.lang.String strProfileName)
           
protected  void setReturnData(byte[] ba)
           
 void setTotalAmount(java.math.BigDecimal totalAmount)
          Sets the totalAmount property of the command.
protected  void setupNumericCurrencyCodeAndPMTotalAmount()
           
protected  void setupProfileName(java.lang.Integer nStoreId, java.lang.Integer nPayMthdId)
           
protected  void updateOrderPaymentMethod()
           
protected  void updatePaymentStatus()
           
 void validateParameters()
          Checks the validity of customer-supplied parameters.
 
Methods inherited from interface com.ibm.commerce.command.ECCommand
checkIsAllowed, checkResourcePermission, execute, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getDefaultProperties, getResources, getStoreId, getUser, getUserId, setAccCheck, setCommandContext, setCommandIfName, setDefaultProperties
 

Field Detail

BILLTO_ADDRESS1

public static final java.lang.String BILLTO_ADDRESS1

BILLTO_CITY

public static final java.lang.String BILLTO_CITY

BILLTO_COUNTRY

public static final java.lang.String BILLTO_COUNTRY

BILLTO_COUNTRY_CODE

public static final java.lang.String BILLTO_COUNTRY_CODE

BILLTO_FIRSTNAME

public static final java.lang.String BILLTO_FIRSTNAME

BILLTO_LASTNAME

public static final java.lang.String BILLTO_LASTNAME

BILLTO_MIDDLENAME

public static final java.lang.String BILLTO_MIDDLENAME

BILLTO_STATE

public static final java.lang.String BILLTO_STATE

BILLTO_ZIPCODE

public static final java.lang.String BILLTO_ZIPCODE

BUYER_LANGUAGE_ID

public static final java.lang.String BUYER_LANGUAGE_ID

CARD_EXPIRY

public static final java.lang.String CARD_EXPIRY

CARD_NUMBER

public static final java.lang.String CARD_NUMBER

CURRENCY_ALPHA_CODE

public static final java.lang.String CURRENCY_ALPHA_CODE

PAYMTHD_PSRVR

public static final java.lang.String PAYMTHD_PSRVR

PAYMTHD_SET

public static final java.lang.String PAYMTHD_SET

PRC_DUPLICATE_OBJECT

public static final int PRC_DUPLICATE_OBJECT

SRC_CONNECTION_TO_PM_FAILED

public static final int SRC_CONNECTION_TO_PM_FAILED

SRC_INITIALIZATION_MESSAGE

public static final int SRC_INITIALIZATION_MESSAGE

SRC_ORDER

public static final int SRC_ORDER

SRC_USER_NOT_AUTHORIZED

public static final int SRC_USER_NOT_AUTHORIZED
Constructor Detail

DoPaymentMPFInternalCmdImpl

public DoPaymentMPFInternalCmdImpl()
Method Detail

checkParameters

protected void checkParameters()
                        throws ECException
Checks the validity of customer-supplied parameters.

getContentType

public java.lang.String getContentType()
Returns the Content Type (or MIME type) of the return data, or null if the type is not known.
Specified by:
getContentType in interface DoPaymentMPFInternalCmd
Returns:
a String containing the name of the MIME type of the return data, or null if the type is not known

getCurrencyExponent

protected java.lang.String getCurrencyExponent()

getDisplayPaymentStateForTrace

protected java.lang.String getDisplayPaymentStateForTrace(int anPaymentState)
Returns the display String represnting the Payment State as returned by Payment Manager for Trace purposes.
Parameters:
anPaymentState - the numeric payment state from Payment Manager.
Returns:
the display String for the specified payment state.

getNumericCountryCode

protected java.lang.String getNumericCountryCode(java.lang.String productVendor,
                                                 java.lang.String country)
                                          throws ECException
Returns the numeric country/region code for the specified country/region as specified by the product/vendor in the Country Code Table (COUNTCODE).
Throws:
ECException -  

getNumericCurrencyCode

protected java.lang.String getNumericCurrencyCode()

getOrderAccessBean

protected OrderAccessBean getOrderAccessBean()
This method will first check if the local variable is set or not. If not set it will attempt to get it by create a new AccessBean.

getOrderId

protected java.lang.Long getOrderId()

getOrderState

public java.lang.String getOrderState()
Returns the single character String value that the called command wants the Calling command to use to set the Status of the order. If the returned String is null, the Calling command will decide the value to use for the Status
Specified by:
getOrderState in interface DoPaymentMPFInternalCmd
Returns:
java.lang.String

getPaymentAttributes

protected TypedProperty getPaymentAttributes()

getPaymentMethodId

protected java.lang.Integer getPaymentMethodId()

getPMTotalAmount

protected java.math.BigInteger getPMTotalAmount()

getProfileName

protected java.lang.String getProfileName()

getReturnData

public byte[] getReturnData()
Returns the byte Array containing Return Data from the Payment Manager. This method returns a zero length byte array if there is no rturn data from the Payment Manager.
Specified by:
getReturnData in interface DoPaymentMPFInternalCmd
Returns:
byte[]

getTotalAmount

protected java.math.BigDecimal getTotalAmount()

isReadyToCallExecute

public boolean isReadyToCallExecute()
This method is called by the Command Framework to check if all basic mandatory parameters have been set for this command. This is done before the Framework calls the performExecute method of the command.

performExecute

public void performExecute()
                    throws ECException
Performs the main business logic of the command.
Specified by:
performExecute in interface ECCommand
Following copied from interface: com.ibm.commerce.command.ECCommand
Throws:
com.ibm.commerce.command.CommandException - The superclass for all ECExceptions.

query

public java.util.Hashtable query(java.lang.String queryString)
                          throws com.ibm.commerce.payment.commands.CashierException
The Cashier calls this method to construct a Hashtable of keywords and values which result from processing the input query string.

This method is defined by the com.ibm.etill.cashier.Queryable interface.

Parameters:
queryString - a SelectStatement element from a Cashier profile
Throws:
com.ibm.commerce.payment.commands.CashierException - if there is an error creating and populating the result Hashtable.

reset

public void reset()
Resets the instance variables of the command. The reset() method will reset all instance variables. If the command includes any output values that are accessible via getters, then make sure those values are no longer needed before calling this method to reset the instance variables of the command.

This is useful if the command instance is to be called multiple times with different command parameters.


setContentType

protected void setContentType(java.lang.String sContentType)

setCurrencyExponent

protected void setCurrencyExponent(java.lang.String astrCurrencyExponent)

setNumericCurrencyCode

protected void setNumericCurrencyCode(java.lang.String astrCurrencyCode)

setOrderAccessBean

protected void setOrderAccessBean(OrderAccessBean abOrder)

setOrderId

public void setOrderId(java.lang.Long orderId)
Description copied from interface: DoPaymentMPFInternalCmd
Sets the orderId property of the command.
Specified by:
setOrderId in interface DoPaymentMPFInternalCmd
Following copied from interface: com.ibm.commerce.payment.commands.DoPaymentMPFInternalCmd
Parameters:
orderId - the order reference number of the Order for which payment is to be processed.

setOrderState

protected void setOrderState(java.lang.String orderState)

setPaymentAttributes

public void setPaymentAttributes(TypedProperty paymentAttributes)
Sets the paymentAttributes property of the command.
Specified by:
setPaymentAttributes in interface DoPaymentMPFInternalCmd
Parameters:
requestProperties - the requestProperties object that contains all the command parameters are to be passed to this command.

Some of the Payment Attributes that may be passed to the command are:

       Keyword                         Value
     ===========        ====================================
     payMethodId        PayMthd_Id of the Cashier Profile to use
     cardBrand          The credit card brand.
     cardNumber         The credit card number              
     cardExpiryMonth    The credit card exipration month  
     cardExpiryYear     The credit card exipration year   
     $XXXXXX            Protocol Data Value for $XXXXXX
 
where $XXXXXX are special Protocol Data Keyword defined by the Payment Manager Cassette. (The Protocol Data keywords all start with the "$" character.)

For this command, the payMethodId attribute is mandatory. The cardBrand and cardNumber attributes, if specified, must both be present. Same is true for the cardExpiryMonth and the cardExpiryYear attributes.

Note: The cardBrand attribute must match the BrandID used to configure the Merchant Account in the Payment Manager. The BrandID is case-sensitive.


setPaymentMethodId

public void setPaymentMethodId(java.lang.Integer nPayMthdId)

setPMTotalAmount

protected void setPMTotalAmount(java.math.BigInteger biPMTotalAmount)

setProfileName

protected void setProfileName(java.lang.String strProfileName)

setReturnData

protected void setReturnData(byte[] ba)

setTotalAmount

public void setTotalAmount(java.math.BigDecimal totalAmount)
Sets the totalAmount property of the command.
Specified by:
setTotalAmount in interface DoPaymentMPFInternalCmd
Parameters:
totalAmount - the total price of the Order for which payment is to be processed.

setupNumericCurrencyCodeAndPMTotalAmount

protected void setupNumericCurrencyCodeAndPMTotalAmount()
                                                 throws javax.ejb.CreateException,
                                                        javax.ejb.FinderException,
                                                        javax.naming.NamingException,
                                                        java.rmi.RemoteException,
                                                        ECException

setupProfileName

protected void setupProfileName(java.lang.Integer nStoreId,
                                java.lang.Integer nPayMthdId)
                         throws javax.ejb.CreateException,
                                javax.ejb.FinderException,
                                javax.naming.NamingException,
                                java.rmi.RemoteException,
                                ECException

updateOrderPaymentMethod

protected void updateOrderPaymentMethod()
                                 throws javax.ejb.CreateException,
                                        javax.ejb.FinderException,
                                        javax.naming.NamingException,
                                        java.rmi.RemoteException

updatePaymentStatus

protected void updatePaymentStatus()
                            throws javax.ejb.CreateException,
                                   javax.ejb.FinderException,
                                   javax.naming.NamingException,
                                   java.rmi.RemoteException

validateParameters

public void validateParameters()
                        throws ECException
Checks the validity of customer-supplied parameters.
Specified by:
validateParameters in interface ECCommand
Following copied from interface: com.ibm.commerce.command.ECCommand
Throws:
ECException. -