java.lang.Object | +--CacheableCommandImpl | +--com.ibm.commerce.command.AbstractECTargetableCommand | +--com.ibm.commerce.command.TaskCommandImpl | +--com.ibm.commerce.command.BusinessPolicyCommandImpl | +--com.ibm.commerce.payment.commands.DoPaymentTestCmdImpl
This DoPaymentTestCmdImpl
Task Command Implementation is called
by the DoPaymentMPFCmdImpl
command to process payment for the
order when the TestPaymentMethod policy is used.
If the command is successful, the command will return the
OrderConstants.ORDER_AUTH_ALLOWED
status to the calling
command.
If unsuccessful, the command throws the ECApplicationException specifying an Error Code and the Error View named by the constant com.ibm.commerce.DoPaymentPolicyCmd.ERROR_TASK_NAME or the one named by the setErrorViewName() method.
This implementation of the DoPaymentPolicyCmd
Task Command does
not have any returnData to pass to the calling command.
This command uses the following AccessBeans:
This command calls the following TaskCommands:
Field Summary |
---|
Fields inherited from class com.ibm.commerce.command. BusinessPolicyCommandImpl |
policyId,
requestProperties |
Fields inherited from class com.ibm.commerce.command. AbstractECTargetableCommand |
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,
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 | |
---|---|
DoPaymentTestCmdImpl() |
Method Summary | |
---|---|
protected
void |
checkParameters() Deprecated. Use validateParameters() instead. |
AccountAccessBean |
getAccount() Returns the AccountAccessBean representing the Account associated with the order. |
protected
java.lang.Long |
getAccountId() Returns the account ID of the Account associated with the order. |
protected
java.lang.Long |
getBuyerPOId() Returns the internal ID of the BuyerPO record if a buyer purchase order number is specified. |
protected
java.lang.String |
getCardBrand() Gets the credit card brand. |
protected
java.lang.Integer |
getCardExpiryMonth() Gets the credit card Expiry Month. |
protected
java.lang.Integer |
getCardExpiryYear() Gets the credit card Expiry Year. |
protected
java.lang.String |
getCardNumber() Gets the credit card number. |
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() Returns the name of the error view to use for reporting error. |
protected
OrderAccessBean |
getOrder() Returns the OrderAccessBean representing the order being processed. |
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() Returns the TypedProperty object containing the payment attributes passed to this command by the calling command. |
byte[] |
getReturnData() Returns the byte Array containing Return Data from the Payment System. |
protected
java.math.BigDecimal |
getTotalAmount() Returns the totalAmount attribute passed to the command by the calling command. |
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 account property of the command. |
void |
setBuyerPOId(java.lang.Long n) Sets optional buyerPOId if the customer (buyer) had specified a buyer purchase order number. |
protected
void |
setCardBrand(java.lang.String cardBrand) Sets the credit card brand. |
protected
void |
setCardExpiryMonth(java.lang.Integer cardExpiryMonth) Sets the credit card Expiry Month. |
protected
void |
setCardExpiryYear(java.lang.Integer cardExpiryYear) Sets the credit card Expiry Year. |
protected
void |
setCardNumber(java.lang.String cardNumber) Sets the credit card number. |
void |
setErrorViewName(java.lang.String sEVN) Sets the error view to be used to report error. |
void |
setOrder(
OrderAccessBean ab) Sets the order 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 |
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. AbstractECTargetableCommand |
accessControlCheck,
checkIsAllowed,
checkResourcePermission,
createCommandExecutionEvent,
execute,
finalize,
getAccCheck,
getCommandContext,
getCommandIfName,
getCommandName,
getCommandStoreId,
getDefaultProperties,
getResources,
getStoreId,
getUser,
getUserId,
setAccCheck,
setCommandContext,
setCommandIfName,
setCommandStoreId,
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 |
Constructor Detail |
---|
public DoPaymentTestCmdImpl()
Method Detail |
---|
protected void checkParameters() throws ECException
checkParameters
in class
AbstractECTargetableCommand
ECException.
ECException
public AccountAccessBean getAccount()
protected java.lang.Long getAccountId() throws javax.ejb.CreateException, javax.ejb.FinderException, javax.naming.NamingException, java.rmi.RemoteException
javax.ejb.CreateException
javax.ejb.FinderException
javax.naming.NamingException
java.rmi.RemoteException
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()
public java.lang.String getContentType()
null
if the type is not known.
getContentType
in interface
DoPaymentPolicyCmd
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
.protected java.lang.String getErrorViewName()
protected OrderAccessBean getOrder()
public java.lang.String getOrderState()
getOrderState
in interface
DoPaymentPolicyCmd
protected TypedProperty getPaymentAttributes()
public byte[] getReturnData()
getReturnData
in interface
DoPaymentPolicyCmd
protected java.math.BigDecimal getTotalAmount()
public static boolean isCardExpiryDateValid(int expiryMonth, int expiryYear)
expiryMonth
- the calender month of the expiry date (1 for
January, 2 for February, and so on.)expiryYear
- the calender year of the expiry datepublic boolean isReadyToCallExecute()
isReadyToCallExecute
in class
AbstractECTargetableCommand
public void performExecute() throws ECException
performExecute
in interface
ECCommand
performExecute
in class
AbstractECTargetableCommand
ECException
public static java.lang.String removeSpaceAndHyphenFromString(java.lang.String aCardNumber)
aCardNumber
- the card number to be examined and strippedpublic void reset()
This is useful if the command instance is to be called multiple times with different command parameters.
reset
in class
AbstractECTargetableCommand
public void setAccount(AccountAccessBean abAccount)
This is optional. Skip this if none of the trading agreements used by the order items of the order are associated with an account.
setAccount
in interface
DoPaymentPolicyCmd
abAccount
- the AccountAccessBean representing the account the
order is associated withpublic void setBuyerPOId(java.lang.Long n)
setBuyerPOId
in interface
DoPaymentPolicyCmd
n
- the internal ID of the BuyerPO record representing the
purchase order number specifiedprotected void setCardBrand(java.lang.String cardBrand)
cardBrand
- the credit card brandprotected void setCardExpiryMonth(java.lang.Integer cardExpiryMonth)
cardExpiryMonth
- the credit card Expiry
Monthprotected void setCardExpiryYear(java.lang.Integer cardExpiryYear)
cardExpiryYear
- the credit card Expiry
Yearprotected void setCardNumber(java.lang.String cardNumber)
cardNumber
- the credit card numberpublic void setErrorViewName(java.lang.String sEVN)
setErrorViewName
in interface
DoPaymentPolicyCmd
sEVN
- the Error View nameDoPaymentPolicyCmd.ERRTASK_NAME
public void setOrder(OrderAccessBean ab)
setOrder
in interface
DoPaymentPolicyCmd
protected void setOrderState(java.lang.String orderState)
orderState
- a String
representing the preferred
order statepublic void setPaymentAttributes(TypedProperty paymentAttributes)
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 yearNote that this command stores the credit card brand in the PAYMETHOD column of the ORDPAYMTHD table. If the credit card brand specified is longer than five characters it is truncated before being stored in the ORDPAYMTHD table.
setPaymentAttributes
in interface
DoPaymentPolicyCmd
paymentAttributes
- the TypedProperty object that contains all
the command parameters to be passed to this command.public void setTotalAmount(java.math.BigDecimal totalAmount)
setTotalAmount
in interface
DoPaymentPolicyCmd
totalAmount
- the total price of the Order for which payment
is to be processed.public void validateParameters() throws ECException
validateParameters
in interface
ECCommand
validateParameters
in class
AbstractECTargetableCommand
ECException