com.ibm.commerce.payment.commands
Class DoPaymentMPFCmdImpl

java.lang.Object
  |
  +--CacheableCommandImpl
        |
        +--com.ibm.commerce.command.AbstractECTargetableCommand
              |
              +--com.ibm.commerce.command.TaskCommandImpl
                    |
                    +--com.ibm.commerce.payment.commands.DoPaymentMPFCmdImpl
All Implemented Interfaces:
DoInventory, DoPaymentCmd, ECCommand, ECTargetableCommand, TaskCommand

public class DoPaymentMPFCmdImpl
extends TaskCommandImpl
implements DoPaymentCmd, DoInventory

Default DoPayment task command implementation.

Parameters:

Parameter Name Type Descriptions
orderId Long The ID of the Order
totalAmount BigDecimal The Total Amount to be authorized
policyId Long The ID of the Payment Policy to use for the Purchase.
tcId Long The ID of the Payment Term and Condition to use for the Purchase.
paymentAttributes TypedProperty The payment attributes (eor example,.g. all the name-value pairs from the OrderProcess command)

Note: If any of the Trading Agreement used by Order Items of the Order has Payment Terms and Conditions, then tcId is mandatory. If tcId is specified, policyId is ignored. The UsablePaymentTCListDataBean may be used to return a list of PaymentTCInfo beans representing common Payment Terms and Conditions specified by Trading Agreements used. If the none of the Trading Agreement has Payment Terms and Conditions, the DataBean returns PaymentTCInfo beans with the tcId attributes set to the empty string. In that case, the PaymentTCInfo beans represent Payment Policies supported by the Store.

Behavior:

Returned Parameters:

Error View Name:

ErrorCodes:

This command uses the following AccessBeans:

This command calls the following TaskCommands:

This command calls the following BusinessPolicyCommands:

See Also:
UsablePaymentTCListDataBean., Serialized Form

Field Summary
static java.lang.String APPROVAL_AMOUNT
          Environment variable name for the approval amount parameter.
static java.lang.String BILLTO_ADDRESS1
          Environment variable name for the address line 1 field of the billto address.
static java.lang.String BILLTO_ADDRESS2
          Environment variable name for the address line 2 field of the billto address.
static java.lang.String BILLTO_CITY
          Environment variable name for the city field in the billto address.
static java.lang.String BILLTO_COUNTRY
          Environment variable name for the country field in the billto address.
static java.lang.String BILLTO_COUNTRY_CODE
          Environment variable name for the country code field in the billto address.
static java.lang.String BILLTO_EMAIL_ADDR1
          Environment variable name for the email address 1 field of the billto address.
static java.lang.String BILLTO_FIRSTNAME
          Environment variable name for the first name of the recipient in the billto address.
static java.lang.String BILLTO_LASTNAME
          Environment variable name for the last name of the recipient in the billto address.
static java.lang.String BILLTO_MIDDLENAME
          Environment variable name for the middle name of the recipient in the billto address.
static java.lang.String BILLTO_PHONE_NUMBER
          Environment variable name for the phone number field of the billto address.
static java.lang.String BILLTO_STATE
          Environment variable name for the state or province field in the billto address.
static java.lang.String BILLTO_ZIPCODE
          Environment variable name for the zip code or postal code field in the billto address.
static java.lang.String BUYER_LANGUAGE_ID
          Environment variable name for the buyer language ID.
static java.lang.String CARD_EXPIRY
          Environment variable name for the card expiry date parameter.
static java.lang.String CARD_NUMBER
          Environment variable name for the card number parameter.
static java.lang.String CURRENCY_ALPHA_CODE
          Environment variable name for the alpha currency code.
static java.lang.String CURRENCY_FACTOR
          Environment variable name for the currency factor parameter.
static java.lang.String LANGUAGE_ENCODING
          Environment variable name for the language encoding parameter.
static java.lang.String PAYMTHD_PSRVR
          Constant value used to populate the ORDPAYMTHD.PAYMETHOD field to indicate that the order has been submitted to WebSphere Commerce Payments for processing.
static java.lang.String PAYMTHD_SET
          Constant value once used by the predecessor product of WebSphere Commerce to populate the ORDPAYMTHD.PAYMETHOD field to indicate that the payment for the order was processed by the payment cassette for SET.
static int PRC_DUPLICATE_OBJECT
          The WebSphere Commerce Payments primary return code for a duplicate object error.
static int PRC_VALUE_ERROR
          The WebSphere Commerce Payments primary return code for a duplicate object error.
static int SRC_AMOUNT
          The WebSphere Commerce Payments secondary return code indicating that the error is referring to the amount field.
static int SRC_CONNECTION_TO_PM_FAILED
          The WebSphere Commerce Payments secondary return code indicating that there was a communication failure.
static int SRC_INITIALIZATION_MESSAGE
          The WebSphere Commerce Payments secondary return code indicating an initialization message is included in the response.
static int SRC_ORDER
          The WebSphere Commerce Payments secondary return code indicating the respnse refers to an order entity.
static int SRC_USER_NOT_AUTHORIZED
          The WebSphere Commerce Payments secondary return code indicating that the user is not authorized to perform the requested operation.
static java.lang.String TOTAL_SHIPPING_AMOUNT
          Environment variable name for the total shipping amount parameter.
static java.lang.String TOTAL_TAX_AMOUNT
          Environment variable name for the total tax amount parameter.
 
Fields inherited from class com.ibm.commerce.command. AbstractECTargetableCommand
commandContext
 
Fields inherited from interface com.ibm.commerce.payment.commands. DoPaymentCmd
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, NVP_FIELD, PM_MESSAGE_FOR_BUYER, PM_MESSAGE_FOR_MERCHANT, PM_PRIMARY_RC, PM_SECONDARY_RC, WCSHOSTNAME, WCSWEBSERVERPORT, WEBPATH
 
Fields inherited from interface com.ibm.commerce.command. ECTargetableCommand
COPYRIGHT
 
Fields inherited from interface com.ibm.commerce.command. ECCommand
defaultCommandClassName
 
Constructor Summary
DoPaymentMPFCmdImpl()
           
 
Method Summary
protected   AccountAccessBean getAccount()
          Returns the AccountAccessBean representing the Account if an Account ID is set.
protected  java.lang.Long getAccountId()
          Returns the common Account ID if one is specified by the trading agreements used by the order items of the order being processed.
protected  java.lang.Long getBuyerPOId()
          Returns the internal ID of the BuyerPO record if a buyer purchase order number is specified.
 java.lang.String getContentType()
          Returns the Content Type (or MIME type) of the return data, or null if the type is not known.
protected  OrderAccessBean getOrder()
          Returns the OrderAccessBean representing the Order.
protected  java.lang.Long getOrderId()
          Returns the order ID of the order being processed.
 java.lang.String getOrderState()
          Returns the single character String value that this command wants the Calling command to use to set the Status of the order.
protected  TypedProperty getPaymentAttributes()
          Returns the TypedProperty object containing the payment attributes passed to this command by the calling command.
protected  java.lang.Integer getPaymentMethodId()
          Returns the payMethodId attribute passed to the command by the caller.
protected  java.lang.Long getPolicyId()
          Returns the policyId attribute passed to the command by the caller.
protected  java.lang.String getPONumber()
          Returns the PONumber attribute passed to the command by the caller.
 byte[] getReturnData()
          Returns the byte Array containing Return Data from the payment system.
protected  java.lang.String getTcId()
          Returns the tcId attribute passed to the command by the caller.
protected  java.math.BigDecimal getTotalAmount()
          Returns the total order amount passed to the command by the caller.
 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.
 void reset()
          Resets the instance variables of the command.
protected  void setAccountId(java.lang.Long n)
          Sets the Account ID.
protected  void setBuyerPOId(java.lang.Long n)
          Sets the buyerPO ID.
protected  void setContentType(java.lang.String sContentType)
          Sets the Content Type (or MIME type) of the return data.
 void setOrderId(java.lang.Long orderId)
          Sets the orderId property of the command.
protected  void setOrderState(java.lang.String orderState)
          Sets the order state to be returned to the caller.
 void setPaymentAttributes( TypedProperty paymentAttributes)
          Sets the paymentAttributes property of the command.
 void setPaymentMethodId(java.lang.Integer nPayMthdId)
          Sets the Payment Method Id
 void setPolicyId(java.lang.Long n)
          Sets the policyId property of the command.
protected  void setPONumber(java.lang.String sPONumber)
          Sets the purchase order number.
protected  void setReturnData(byte[] ba)
          Sets the Return Data to be returned to the caller.
protected  void setTcId(java.lang.String s)
          Sets the tcId property of the command.
 void setTotalAmount(java.math.BigDecimal totalAmount)
          Sets the totalAmount property of the command.
 
Methods inherited from class com.ibm.commerce.command. AbstractECTargetableCommand
accessControlCheck, checkIsAllowed, checkParameters, checkResourcePermission, createCommandExecutionEvent, execute, finalize, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getCommandStoreId, getDefaultProperties, getResources, getStoreId, getUser, getUserId, setAccCheck, setCommandContext, setCommandIfName, setCommandStoreId, setDefaultProperties, validateParameters
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PRC_VALUE_ERROR

public static final int PRC_VALUE_ERROR
The WebSphere Commerce Payments primary return code for a duplicate object error.
See Also:
Constant Field Values

PRC_DUPLICATE_OBJECT

public static final int PRC_DUPLICATE_OBJECT
The WebSphere Commerce Payments primary return code for a duplicate object error.
See Also:
Constant Field Values

SRC_INITIALIZATION_MESSAGE

public static final int SRC_INITIALIZATION_MESSAGE
The WebSphere Commerce Payments secondary return code indicating an initialization message is included in the response.
See Also:
Constant Field Values

SRC_ORDER

public static final int SRC_ORDER
The WebSphere Commerce Payments secondary return code indicating the respnse refers to an order entity.
See Also:
Constant Field Values

SRC_CONNECTION_TO_PM_FAILED

public static final int SRC_CONNECTION_TO_PM_FAILED
The WebSphere Commerce Payments secondary return code indicating that there was a communication failure.
See Also:
Constant Field Values

SRC_USER_NOT_AUTHORIZED

public static final int SRC_USER_NOT_AUTHORIZED
The WebSphere Commerce Payments secondary return code indicating that the user is not authorized to perform the requested operation.
See Also:
Constant Field Values

SRC_AMOUNT

public static final int SRC_AMOUNT
The WebSphere Commerce Payments secondary return code indicating that the error is referring to the amount field.
See Also:
Constant Field Values

PAYMTHD_SET

public static final java.lang.String PAYMTHD_SET
Constant value once used by the predecessor product of WebSphere Commerce to populate the ORDPAYMTHD.PAYMETHOD field to indicate that the payment for the order was processed by the payment cassette for SET.
See Also:
Constant Field Values

PAYMTHD_PSRVR

public static final java.lang.String PAYMTHD_PSRVR
Constant value used to populate the ORDPAYMTHD.PAYMETHOD field to indicate that the order has been submitted to WebSphere Commerce Payments for processing.
See Also:
Constant Field Values

BILLTO_FIRSTNAME

public static final java.lang.String BILLTO_FIRSTNAME
Environment variable name for the first name of the recipient in the billto address.
See Also:
Constant Field Values

BILLTO_MIDDLENAME

public static final java.lang.String BILLTO_MIDDLENAME
Environment variable name for the middle name of the recipient in the billto address.
See Also:
Constant Field Values

BILLTO_LASTNAME

public static final java.lang.String BILLTO_LASTNAME
Environment variable name for the last name of the recipient in the billto address.
See Also:
Constant Field Values

BILLTO_ADDRESS1

public static final java.lang.String BILLTO_ADDRESS1
Environment variable name for the address line 1 field of the billto address.
See Also:
Constant Field Values

BILLTO_CITY

public static final java.lang.String BILLTO_CITY
Environment variable name for the city field in the billto address.
See Also:
Constant Field Values

BILLTO_STATE

public static final java.lang.String BILLTO_STATE
Environment variable name for the state or province field in the billto address.
See Also:
Constant Field Values

BILLTO_ZIPCODE

public static final java.lang.String BILLTO_ZIPCODE
Environment variable name for the zip code or postal code field in the billto address.
See Also:
Constant Field Values

BILLTO_COUNTRY

public static final java.lang.String BILLTO_COUNTRY
Environment variable name for the country field in the billto address.
See Also:
Constant Field Values

BILLTO_COUNTRY_CODE

public static final java.lang.String BILLTO_COUNTRY_CODE
Environment variable name for the country code field in the billto address. The country code is the ISO-3166 numeric country code.
See Also:
Constant Field Values

BILLTO_ADDRESS2

public static final java.lang.String BILLTO_ADDRESS2
Environment variable name for the address line 2 field of the billto address.
See Also:
Constant Field Values

BILLTO_PHONE_NUMBER

public static final java.lang.String BILLTO_PHONE_NUMBER
Environment variable name for the phone number field of the billto address.
See Also:
Constant Field Values

BILLTO_EMAIL_ADDR1

public static final java.lang.String BILLTO_EMAIL_ADDR1
Environment variable name for the email address 1 field of the billto address.
See Also:
Constant Field Values

LANGUAGE_ENCODING

public static final java.lang.String LANGUAGE_ENCODING
Environment variable name for the language encoding parameter.
See Also:
Constant Field Values

CURRENCY_FACTOR

public static final java.lang.String CURRENCY_FACTOR
Environment variable name for the currency factor parameter.
See Also:
Constant Field Values

TOTAL_TAX_AMOUNT

public static final java.lang.String TOTAL_TAX_AMOUNT
Environment variable name for the total tax amount parameter.
See Also:
Constant Field Values

TOTAL_SHIPPING_AMOUNT

public static final java.lang.String TOTAL_SHIPPING_AMOUNT
Environment variable name for the total shipping amount parameter.
See Also:
Constant Field Values

CARD_NUMBER

public static final java.lang.String CARD_NUMBER
Environment variable name for the card number parameter.
See Also:
Constant Field Values

CARD_EXPIRY

public static final java.lang.String CARD_EXPIRY
Environment variable name for the card expiry date parameter.
See Also:
Constant Field Values

APPROVAL_AMOUNT

public static final java.lang.String APPROVAL_AMOUNT
Environment variable name for the approval amount parameter.
See Also:
Constant Field Values

CURRENCY_ALPHA_CODE

public static final java.lang.String CURRENCY_ALPHA_CODE
Environment variable name for the alpha currency code.
See Also:
Constant Field Values

BUYER_LANGUAGE_ID

public static final java.lang.String BUYER_LANGUAGE_ID
Environment variable name for the buyer language ID.
See Also:
Constant Field Values
Constructor Detail

DoPaymentMPFCmdImpl

public DoPaymentMPFCmdImpl()
Method Detail

getAccount

protected AccountAccessBean getAccount()
Returns the AccountAccessBean representing the Account if an Account ID is set. If no Account ID is set, null is returned.

This method will first check if the local variable iabAccount is set. If not set, it will attempt to retrieve the AccountAccessBean using the specified Account ID.

Returns:
the AccountAccessBean

getAccountId

protected java.lang.Long getAccountId()
Returns the common Account ID if one is specified by the trading agreements used by the order items of the order being processed. If there is no Account associated with any of the trading agreements, null is returned.
Returns:
the Account ID

getBuyerPOId

protected java.lang.Long getBuyerPOId()
Returns the internal ID of the BuyerPO record if a buyer purchase order number is specified. Otherwise returns a null.
Returns:
the internal ID of the BuyerPO record or null

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 DoPaymentCmd
Returns:
a String containing the name of the MIME type of the return data, or null if the type is not known

getOrder

protected OrderAccessBean getOrder()
Returns the OrderAccessBean representing the Order.

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.

Returns:
the OrderAccessBean

getOrderId

protected java.lang.Long getOrderId()
Returns the order ID of the order being processed.
Returns:
the order ID

getOrderState

public java.lang.String getOrderState()
Returns the single character String value that this 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 DoPaymentCmd
Returns:
the preferred order state

getPaymentAttributes

protected TypedProperty getPaymentAttributes()
Returns the TypedProperty object containing the payment attributes passed to this command by the calling command.
Returns:
the payment attributes passed by the caller
See Also:
setPaymentAttributes(TypedProperty paymentAttributes)

getPaymentMethodId

protected java.lang.Integer getPaymentMethodId()
Returns the payMethodId attribute passed to the command by the caller.
Returns:
the payMethodId attribute value
See Also:
setPaymentAttributes(TypedProperty paymentAttributes)

getPolicyId

protected java.lang.Long getPolicyId()
Returns the policyId attribute passed to the command by the caller.
Returns:
the policyId attribute value
See Also:
setPaymentAttributes(TypedProperty paymentAttributes)

getPONumber

protected java.lang.String getPONumber()
Returns the PONumber attribute passed to the command by the caller.
Returns:
the PONumber attribute value
See Also:
setPaymentAttributes(TypedProperty paymentAttributes)

getReturnData

public byte[] getReturnData()
Returns the byte Array containing Return Data from the payment system.

This method returns a zero length byte array if there is no return data from the payment system.

Specified by:
getReturnData in interface DoPaymentCmd
Returns:
the return data from the payment system

getTcId

protected java.lang.String getTcId()
Returns the tcId attribute passed to the command by the caller. This is the internal ID of the Payment Terms and Conditions selected for use in processing payment for the order.
Returns:
the tcId attribute value
See Also:
setPaymentAttributes(TypedProperty paymentAttributes)

getTotalAmount

protected java.math.BigDecimal getTotalAmount()
Returns the total order amount passed to the command by the caller.
Returns:
the total order amount in the currency of the order

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.
Overrides:
isReadyToCallExecute in class AbstractECTargetableCommand
Returns:
true if we can execute the command; false otherwise.

performExecute

public void performExecute()
                    throws ECException
Performs the main business logic of the command.
Specified by:
performExecute in interface ECCommand
Overrides:
performExecute in class AbstractECTargetableCommand
Throws:
ECException

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.

Overrides:
reset in class AbstractECTargetableCommand

setAccountId

protected void setAccountId(java.lang.Long n)
Sets the Account ID. This is the common Account ID if one is specified by the trading agreements used by the order items of the order being processed. If there is no common Account ID, this method should not be called.
Parameters:
n - the Account ID

setBuyerPOId

protected void setBuyerPOId(java.lang.Long n)
Sets the buyerPO ID. This is the internal ID of the BuyerPO record associated with the purchase order number specified by the buyer. If no purchase order number is specified, this method should not be called.
Parameters:
n - the buyerPO ID

setContentType

protected void setContentType(java.lang.String sContentType)
Sets the Content Type (or MIME type) of the return data. If there is no return data or the MIME type is not known, this method should not be called.
Parameters:
sContentType - a String containing the name of the MIME type of the return data if any

setOrderId

public void setOrderId(java.lang.Long orderId)
Sets the orderId property of the command.
Specified by:
setOrderId in interface DoPaymentCmd
Parameters:
orderId - the order reference number of the Order for which payment is to be processed.

setOrderState

protected void setOrderState(java.lang.String orderState)
Sets the order state to be returned to the caller. This is the order state that the command would like the order to be moved to. It is up to the caller of this command to change the order status accordingly.
Parameters:
orderState - a String representing the preferred order state

setPaymentAttributes

public void setPaymentAttributes(TypedProperty paymentAttributes)
Sets the paymentAttributes property of the command.

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

       Keyword                         Value
     ===========        ====================================
     tcId               ID of the Payment Term and Condition to use
     policyId           ID of the Payayment Policy to use.
     payMethodId        PayMthd_Id of the Cashier Profile to use
     PONumber           The purchase order number
     cardBrand          The credit card brand.
     cardNumber         The credit card number
     cardExpiryMonth    The credit card exipration month
     cardExpiryYear     The credit card exipration year

The first three attributes (tcId, policyId and payMethodId) determines how the payment is to be processed. At least one of the three must be specified and tcId is mandatory if any of the Order items of the Order uses a Trading Agreement that includes Payment Terms and Conditions.

If tcId is specified, policyId and payMethodId are ignored. If tcId is not specified, either policyId or payMethodId must be specified. If policyId is specified, payMethodId is ignored.

The payMethodId attribute is for backward compatibility only. This attribute will only have effect if neither the icId and policyId attributes are present. See the WebSphere Commerce Migration Guide for information.

The PONumber attribute is required if the Account associated with the trading agreements used for the order includes a Purchase Order Terms and Conditions.

The cardBrand and cardNumber attributes, if specified, must both be present. Same is true for the cardExpiryMonth and the cardExpiryYear attributes.

The cardBrand attribute must match the BrandID used to configure the Merchant Account if WebSphere Commerce Payments is used. The BrandID is case-sensitive.

Note: other payment attributes may be specified dependent on the payment method used to process the payment.

Specified by:
setPaymentAttributes in interface DoPaymentCmd
Parameters:
paymentAttributes - the requestProperties object that contains all the command parameters are to be passed to this command.

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

       Keyword                         Value
     ===========        ====================================
     cardBrand          The credit card brand.  
     cardNumber         The credit card number              
     cardExpiryMonth    The credit card exipration month  
     cardExpiryYear     The credit card exipration year   
Refer to the documentation for the command implementation class for the actual Payment Attributes that are defined for the command.
See Also:
com.ibm.commerce.payment.commands.DoPaymentMPFCmdImpl.

setPaymentMethodId

public void setPaymentMethodId(java.lang.Integer nPayMthdId)
Sets the Payment Method Id

setPolicyId

public void setPolicyId(java.lang.Long n)
Sets the policyId property of the command.
Parameters:
n - The ID of the Payment Policy to be used to process payment for this Order.

setPONumber

protected void setPONumber(java.lang.String sPONumber)
Sets the purchase order number.
Parameters:
sPONumber - the purchase order number specified by the buyer
See Also:
setPaymentAttributes(TypedProperty paymentAttributes)

setReturnData

protected void setReturnData(byte[] ba)
Sets the Return Data to be returned to the caller.
Parameters:
ba - the byte array containing the return data

setTcId

protected void setTcId(java.lang.String s)
Sets the tcId property of the command.
Parameters:
s - the ID of the Payment Term and Condition to be used to process payment for this Order.

setTotalAmount

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