com.ibm.commerce.payment.commands
Class DoPaymentTestCmdImpl

java.lang.Object
  |
  +--com.ibm.commerce.command.AbstractECCommand
        |
        +--com.ibm.commerce.command.TaskCommandImpl
              |
              +--com.ibm.commerce.command.BusinessPolicyCommandImpl
                    |
                    +--com.ibm.commerce.payment.commands.DoPaymentTestCmdImpl
All Implemented Interfaces:
BusinessPolicyCommand, DoPaymentPolicyCmd, ECCommand, TaskCommand

public class DoPaymentTestCmdImpl
extends BusinessPolicyCommandImpl
implements DoPaymentPolicyCmd

This DoPaymentTestCmdImpl Task Command Implementation is called by the OrderProcessCmd Controller Command to process payment for an order.

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 constant com.ibm.commerce.DoPaymentCmd.ERROR_TASK_NAME.

This implementation of the DoPaymentCmd Task Command does not have any returnData for the OrderProcessCmd.


Fields inherited from class com.ibm.commerce.command.BusinessPolicyCommandImpl
policyId, requestProperties
 
Fields inherited from class com.ibm.commerce.command.AbstractECCommand
commandContext
 
Fields inherited from interface com.ibm.commerce.payment.commands.DoPaymentPolicyCmd
CC_VALID_Y_RANGE, COPYRIGHT, defaultCommandClassName, 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
DoPaymentTestCmdImpl()
           
 
Method Summary
protected  void checkParameters()
          Checks the validity of customer-supplied parameters.
 AccountAccessBean getAccount()
           
protected  java.lang.Long getAccountId()
           
protected  java.lang.Long getBuyerPOId()
           
protected  java.lang.String getCardBrand()
           
protected  java.lang.Integer getCardExpiryMonth()
           
protected  java.lang.Integer getCardExpiryYear()
           
protected  java.lang.String getCardNumber()
           
 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 getErrorViewName()
           
protected  OrderAccessBean getOrder()
          This method will first check if the local variable is set or not.
 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()
           
 byte[] getReturnData()
          Returns the byte Array containing Return Data from the Payment System.
protected  java.math.BigDecimal getTotalAmount()
           
static boolean isCardExpiryDateValid(int expiryMonth, int expiryYear)
          Checks if the specified expiry date (expiryMonth and expiryYear) is valid.
 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.
static java.lang.String removeSpaceAndHyphenFromString(java.lang.String aCardNumber)
          Returns a new string that is free of any spaces and hyphenated characters.
 void reset()
          Resets the instance variables of the command.
 void setAccount(AccountAccessBean abAccount)
          Sets the abAccount property of the command.
 void setBuyerPOId(java.lang.Long n)
          Set Optional buyerPOId.
protected  void setCardBrand(java.lang.String cardBrand)
           
protected  void setCardExpiryMonth(java.lang.Integer cardExpiryMonth)
           
protected  void setCardExpiryYear(java.lang.Integer cardExpiryYear)
           
protected  void setCardNumber(java.lang.String cardNumber)
           
 void setErrorViewName(java.lang.String sEVN)
          Optional error view name passed in by the Caller.
 void setOrder(OrderAccessBean ab)
          The order to be ReApproved.
protected  void setOrderState(java.lang.String orderState)
           
 void setPaymentAttributes(TypedProperty paymentAttributes)
          Sets the paymentAttributes property of the command.
 void setTotalAmount(java.math.BigDecimal totalAmount)
          Sets the totalAmount property of the command.
 void validateParameters()
          Checks the validity of customer-supplied parameters.
 
Methods inherited from class com.ibm.commerce.command.BusinessPolicyCommandImpl
getPolicyId, getRequestProperties, setPolicyId, setRequestProperties
 
Methods inherited from class com.ibm.commerce.command.AbstractECCommand
accessControlCheck, checkIsAllowed, checkResourcePermission, execute, finalize, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getDefaultProperties, getResources, getStoreId, getUser, getUserId, setAccCheck, setCommandContext, setCommandIfName, setDefaultProperties
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.ibm.commerce.command.BusinessPolicyCommand
getPolicyId, getRequestProperties, setPolicyId, setRequestProperties
 
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
 

Constructor Detail

DoPaymentTestCmdImpl

public DoPaymentTestCmdImpl()
Method Detail

checkParameters

protected void checkParameters()
                        throws ECException
Checks the validity of customer-supplied parameters.
Overrides:
checkParameters in class AbstractECCommand
Following copied from class: com.ibm.commerce.command.AbstractECCommand
Throws:
ECException. -  

getAccount

public AccountAccessBean getAccount()

getAccountId

protected java.lang.Long getAccountId()
                               throws javax.ejb.CreateException,
                                      javax.ejb.FinderException,
                                      javax.naming.NamingException,
                                      java.rmi.RemoteException

getBuyerPOId

protected java.lang.Long getBuyerPOId()

getCardBrand

protected java.lang.String getCardBrand()

getCardExpiryMonth

protected java.lang.Integer getCardExpiryMonth()

getCardExpiryYear

protected java.lang.Integer getCardExpiryYear()

getCardNumber

protected java.lang.String getCardNumber()

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 DoPaymentPolicyCmd
Returns:
a String containing the name of the MIME type of the return data, or null if the type is not known. Since this command implementation does not have return data, the method returns null.

getErrorViewName

protected java.lang.String getErrorViewName()

getOrder

protected OrderAccessBean getOrder()
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.

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 empty or null, the Calling command will decide the value to use for the Status
Specified by:
getOrderState in interface DoPaymentPolicyCmd
Returns:
java.lang.String

getPaymentAttributes

protected TypedProperty getPaymentAttributes()

getReturnData

public byte[] getReturnData()
Returns the byte Array containing Return Data from the Payment System. The Payment System used by this command does not use Return Data. Therefore return null.
Specified by:
getReturnData in interface DoPaymentPolicyCmd
Returns:
byte[]

getTotalAmount

protected java.math.BigDecimal getTotalAmount()

isCardExpiryDateValid

public static boolean isCardExpiryDateValid(int expiryMonth,
                                            int expiryYear)
Checks if the specified expiry date (expiryMonth and expiryYear) is valid.
Parameters:
expiryMonth - the calender month of the expiry date (1 for January, 2 for February, and so on.)
expiryYear - the calender year of the expiry date
Returns:
ture if the expiry date is valid.

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 AbstractECCommand
Following copied from class: com.ibm.commerce.command.AbstractECCommand
Returns:
boolean - true if we can execute the command false if we canot execute the command

performExecute

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

removeSpaceAndHyphenFromString

public static java.lang.String removeSpaceAndHyphenFromString(java.lang.String aCardNumber)
Returns a new string that is free of any spaces and hyphenated characters. If the supplied string is already free of spaces and hyphens the same string may be returned.
Parameters:
aCardNumber - the card number to be examined and stripped
Returns:
a string free of spaces and hyphenated characters ('-')

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 AbstractECCommand

setAccount

public void setAccount(AccountAccessBean abAccount)
Description copied from interface: DoPaymentPolicyCmd
Sets the abAccount property of the command.
Specified by:
setAccount in interface DoPaymentPolicyCmd
Following copied from interface: com.ibm.commerce.payment.commands.DoPaymentPolicyCmd
Parameters:
abAccount - the AccountAccessBean of the Order is associated with

setBuyerPOId

public void setBuyerPOId(java.lang.Long n)
Set Optional buyerPOId.
Specified by:
setBuyerPOId in interface DoPaymentPolicyCmd
Following copied from interface: com.ibm.commerce.payment.commands.DoPaymentPolicyCmd
Parameters:
nBuyerPOId - the Buyer Purchase Order Reference Number of the Order is associated with

setCardBrand

protected void setCardBrand(java.lang.String cardBrand)

setCardExpiryMonth

protected void setCardExpiryMonth(java.lang.Integer cardExpiryMonth)

setCardExpiryYear

protected void setCardExpiryYear(java.lang.Integer cardExpiryYear)

setCardNumber

protected void setCardNumber(java.lang.String cardNumber)

setErrorViewName

public void setErrorViewName(java.lang.String sEVN)
Optional error view name passed in by the Caller.
Specified by:
setErrorViewName in interface DoPaymentPolicyCmd

setOrder

public void setOrder(OrderAccessBean ab)
The order to be ReApproved.
Specified by:
setOrder in interface DoPaymentPolicyCmd
Following copied from interface: com.ibm.commerce.payment.commands.DoPaymentPolicyCmd
Parameters:
abOrder - the OrderAccessBean 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 DoPaymentPolicyCmd
Parameters:
requestProperties - the requestProperties object that contains all the command parameters are to be passed to this command.

This command requires the following Payment Attributes:

       Keyword                         Value
     ===========        ====================================
     cardBrand          The credit card brand.  Represents the credit card type used.
     cardNumber         The credit card number              
     cardExpiryMonth    The credit card exipration month  
     cardExpiryYear     The credit card exipration year   
 
Note that this command stores the credit card brand in the PAYMETHOD column of the ORDPAYMTHD table and the size of the column is limited to five characters long.

setTotalAmount

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

validateParameters

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