|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
com.ibm.commerce.payment.commands.DoPaymentPMCmdImpl
The DoPaymentPMCmdImpl command implements the
DoPaymentPolicy
business policy command, which is
called by the DoPaymentMPFCmdImpl task command to process payment for an order.
The DoPaymentPMCmdImpl command passes environment variables to the Payment Manager Cashier. The Cashier will only use the value from the environment if directed to do so by the Cashier profile specified by the DoPaymentPMCmdImpl command with the CollectPayment call.
The following table summarizes environment variables that the DoPaymentPMCmdImpl command passes to the Payment Manager Cashier:
Environment variable name | Description |
---|---|
The following variables are mandatory variables received by the DoPaymentPMCmdImpl command from the DoPaymentMPFCmdImpl. | |
storeId | The value for the store identification number |
Order | The Order Access Bean of the order. |
totalAmount | The amount of the order to be send to WebSphere Payment Manager. |
The following variables are optional variables received by the DoPaymentPMCmdImpl command from the DoPaymentMPFCmdImpl. | |
Account | The Account Access Bean of the order. |
BuyerPOId | The value for the Buyer Purchase Order identification number |
errorViewName | The error view name passed in by the Caller. |
The following variables are optional variables received by the DoPaymentPMCmdImpl command from the command URL. (through setting PaymentAttributes of the command) | |
billtoAddressId | The value for the order identification number. This parameter is actually a parameter for the OrderProcess command. If the parameter is present, OrderProcess would store the addressId in the Orders table. The DoPaymentPMCmdImpl command uses the addressId from the Orders table to create several billto_xxxx environment variables to pass to the Cashier. The billto_xxx environment variables are described in this table. |
cardExpiryMonth cardExpiryYear |
These parameters must be specified as a pair -- If one is
present, the other must also be present. Otherwise, it is an error. cardExpiryMonth is a number representing the month of expiration for the payment card. For example, 1 for January, 2 for February, and so on. cardExpiryYear is the year of expiration for the payment card. DoPaymentPMCmdImpl will check if the date specified has already expired or if the date is too far in the future (more than 10 years). If the date passes these checks, DoPaymentPMCmdImpl will create a new environment variable called "card_expiry" with the value "yyyymm" from the cardExpiryYear ("yyyy") and cardExpiryMonth left-padded with "0" if the month is less than 10. |
cardBrand cardNumber |
These parameters must be specified as a pair -- If one is
present, the other must also be present. Otherwise, it is an error. cardBrand represents the type of payment card the customer is using. It must match the BrandID used to configure the Payment Manager Account for the Merchant or Store. The name is case-sensitive. cardNumber is the payment card number, for example 4111 - 1111- 1111- 1111. Note the embedded blanks, trailing blanks and hyphens. These formats are allowed in WebSphere Commerce Suite, but are not recognized by Payment Manager. DoPaymentPMCmdImpl calls the CheckCCNumberCmd task command to verify the cardNumber for the specified cardBrand. If the number passes the check, DoPaymentPMCmdImpl creates a new environment variable called card_number with all embedded and trailing blanks and embedded "-" removed. The WebSphere Commerce Suite-supplied Cashier profile specifies the card_number environment variable as a value for the Payment Manager "$PAN" parameter which is the Payment Manager parameter name for credit card number and does not allow non-numeric characters. |
The following variables are environment variables that are always passed. | |
WebPath | The WebSphere Commerce Suit application server Web path. (For example, /webapp/wcs/stores/servlet |
WCSHostName | The domain-qualified host name of the WebSphere Commerce Suite host. |
WCSWebServerPort | The WebSphere Commerce Suite Web server Port. Generally port 80. |
CommandContext | Reference to the CommandContext of the command. This is needed if the Cashier Extension needs to call a task command. The CommandContext has many useful methods. See documentation on the CommandContext interface for detail. |
The following variables are mandatory parameters required by Payment Manager for all cassettes. | |
CURRENCY | A code indicating the currency AMOUNT is in. This is the numeric currency code as per ISO 4217. |
AMOUNT | The amount is in the currency's smallest denomination. For example, for USD (U.S. dollars), the amount would be in cents, not dollars. |
The following variables are optional parameters required by Payment Manager for all cassettes. | |
AMOUNTEXP10 | Amount Exponent (power of 10). The exponential value by which AMOUNT (which is the amount in the sub-unit of a country's currency) is multiplied to get the amount in the country's main currency unit (such as pesos or dollars). For example, you would multiply the amount in cents by 10 to the power "-2" to get the amount in dollars. This value is 0 for countries with no currency sub-unit. |
The following variables are gathered by DoPaymentPMCmdImpl command from other sources | |
billto_firstname billto_middlename billto_lastname billto_address1 billto_city billto_state billto_country billto_zipcode |
These variables are derived from the Address entry
identified by billtoAddressId. These environment variables are in the language entered by the shopper and may not be appropriate for use as values for the $AVS.xxxx parameters for some cassettes. For example, both the Cassette for SET and the Cassette for CyberCash allow only ASCII or English ASCII characters to be used for the $AVS.xxxx parameters and thus cannot use these environment variables unless it is verified that the variables only contain ASCII or English ASCII characters. |
billto_country_code | This variable is derived using the Country Code table
and the billto_country variable. Some of the Payment Manager cassettes require this for
Address Verification Service (AVS). If no Country Code entry can be found for the country, a code of "999" will be passed as the value for the billto_country_code environment variable. The country codes used by the Payment Manager are the numeric country codes specified by ISO 3166-1. The numeric codes are maintained by the United Nations Statistics Division in New York. See http://www.un.org/Depts/unsd/methods/m49alpha.htm for the current list. If the Cashier profile uses billto_country_code you should not allow the customer to enter the country name in a bill-to address form as free-form text. That may result in the server not being able to find an exact match for the country in the country code table. Instead, use a dropdown list of country names for the customer to select as input for the country. |
card_number | This is derived from the cardNumber variable described above. |
card_expiry | This is derived from the cardExpiryMonth and the cardExpiryYear variables described above. |
currency_alpha_code | This code is derived from the Orders table. |
Behavior
PaymentConstants.ERR_CODE_MISSING_PARAM
(190) - Missing parameterPaymentConstants.ERR_CODE_MISSING_PARAM
(1005) - Bad credit card numberPaymentConstants.ERR_CODE_BAD_XDATE
(1006) - Bad expiry datePaymentConstants.ERR_CODE_BAD_SYS
(1007) - A system error has occurred.PaymentConstants.ERR_CODE_PM_COMM_ERR
(1950)
- Communication to Payment System failed. (Connection to Payment Manager Failed.)PaymentConstants.ERR_CODE_PM_REJECTED
(1952)
- Payment System rejected the command due to error.
(WebSphere Payment Manager Operation "p" for StoreId "s"
OrderId "m" failed. WebSphere Payment Manager PrimaryRC=x, SecondaryRC=y.)
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 | |
DoPaymentPMCmdImpl()
|
Method Summary | |
protected void |
checkParameters()
Checks the validity of customer-supplied parameters. |
protected AccountAccessBean |
getAccount()
Returns the AccountAccessBean representing the Account. |
protected java.lang.Long |
getAccountId()
This returns the Account ID. |
protected java.lang.Long |
getBuyerPOId()
Returns the internal ID of the BuyerPO record passed to the command. |
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.Double |
getCurrencyFactor()
|
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 |
getErrorViewName()
Returns the errorViewName attribute passed to this command. |
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 |
getOrder()
Returns the OrderAccessBean representing the Order. |
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. |
protected java.math.BigInteger |
getPMTotalAmount()
|
protected java.lang.String |
getPONumber()
Returns the PONumber attribute passed to the command by the calling command. |
protected java.lang.String |
getProfileName()
Returns the profileName attribute passed to the command by the calling command. |
byte[] |
getReturnData()
Returns the byte Array containing Return Data from the Payment Manager. |
protected java.math.BigDecimal |
getTotalAmount()
Returns the totalAmount attribute passed to the command by the calling command. |
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. |
void |
setAccount(AccountAccessBean abAccount)
Sets the abAccount property of the command. |
void |
setBuyerPOId(java.lang.Long n)
Sets optional buyerPOId. |
protected void |
setContentType(java.lang.String sContentType)
Set Content Type. |
protected void |
setCurrencyExponent(java.lang.String astrCurrencyExponent)
Sets Currency Exponent. |
protected void |
setCurrencyFactor(java.lang.Double d)
Sets Currency Factor. |
void |
setErrorViewName(java.lang.String sEVN)
Optional error view name passed in by the Caller. |
protected void |
setNumericCurrencyCode(java.lang.String astrCurrencyCode)
Set Numeric Currency Code. |
void |
setOrder(OrderAccessBean ab)
The order to be ReApproved. |
protected void |
setOrderState(java.lang.String orderState)
Set Order State. |
void |
setPaymentAttributes(TypedProperty paymentAttributes)
Sets the paymentAttributes property of the command. |
protected void |
setPMTotalAmount(java.math.BigInteger biPMTotalAmount)
Sets total amount for WebSphere Payment Manager. |
protected void |
setPONumber(java.lang.String sPONumber)
Sets Purchase Order number. |
protected void |
setProfileName(java.lang.String s)
Sets the Profile Name. |
protected void |
setReturnData(byte[] ba)
Sets the Return Data. |
void |
setTotalAmount(java.math.BigDecimal totalAmount)
Sets the totalAmount property of the command. |
protected void |
setupNumericCurrencyCodeAndPMTotalAmount()
This method is called by performExecute to convert the totalAmount to an integer amount usable by the Payment Manager. |
protected void |
updateOrderPaymentMethod()
This is called by performExecute to create a new ORDPAYMTHD row with payment info |
void |
validateParameters()
Checks the validity of customer-supplied parameters. |
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 |
public DoPaymentPMCmdImpl()
Method Detail |
protected void checkParameters() throws ECException
protected AccountAccessBean getAccount()
protected java.lang.Long getAccountId() throws javax.ejb.CreateException, javax.ejb.FinderException, javax.naming.NamingException, java.rmi.RemoteException
protected java.lang.Long getBuyerPOId()
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 knownprotected java.lang.String getCurrencyExponent()
protected java.lang.Double getCurrencyFactor()
protected java.lang.String getDisplayPaymentStateForTrace(int anPaymentState)
anPaymentState
- the numeric payment state from Payment Manager.protected java.lang.String getErrorViewName()
protected java.lang.String getNumericCountryCode(java.lang.String productVendor, java.lang.String country) throws ECException
ECException
- protected java.lang.String getNumericCurrencyCode()
protected OrderAccessBean getOrder()
public java.lang.String getOrderState()
getOrderState
in interface DoPaymentPolicyCmd
protected TypedProperty getPaymentAttributes()
protected java.math.BigInteger getPMTotalAmount()
protected java.lang.String getPONumber()
protected java.lang.String getProfileName()
public byte[] getReturnData()
getReturnData
in interface DoPaymentPolicyCmd
protected java.math.BigDecimal getTotalAmount()
public boolean isReadyToCallExecute()
public void performExecute() throws ECException
performExecute
in interface ECCommand
com.ibm.commerce.command.ECCommand
com.ibm.commerce.command.CommandException
- The superclass for all ECExceptions.public java.util.Hashtable query(java.lang.String queryString) throws com.ibm.commerce.payment.commands.CashierException
This method is defined by the com.ibm.etill.cashier.Queryable interface.
queryString
- a SelectStatement element from a Cashier profilecom.ibm.commerce.payment.commands.CashierException
- if there is an error creating and populating the
result Hashtable.public void reset()
This is useful if the command instance is to be called multiple times with different command parameters.
public void setAccount(AccountAccessBean abAccount)
DoPaymentPolicyCmd
setAccount
in interface DoPaymentPolicyCmd
com.ibm.commerce.payment.commands.DoPaymentPolicyCmd
abAccount
- the AccountAccessBean of the Order is associated withpublic void setBuyerPOId(java.lang.Long n)
setBuyerPOId
in interface DoPaymentPolicyCmd
com.ibm.commerce.payment.commands.DoPaymentPolicyCmd
nBuyerPOId
- the Buyer Purchase Order Reference Number of the Order is associated withprotected void setContentType(java.lang.String sContentType)
protected void setCurrencyExponent(java.lang.String astrCurrencyExponent)
protected void setCurrencyFactor(java.lang.Double d)
public void setErrorViewName(java.lang.String sEVN)
setErrorViewName
in interface DoPaymentPolicyCmd
protected void setNumericCurrencyCode(java.lang.String astrCurrencyCode)
public void setOrder(OrderAccessBean ab)
setOrder
in interface DoPaymentPolicyCmd
com.ibm.commerce.payment.commands.DoPaymentPolicyCmd
abOrder
- the OrderAccessBean of the Order for which payment
is to be processed.protected void setOrderState(java.lang.String orderState)
public void setPaymentAttributes(TypedProperty paymentAttributes)
setPaymentAttributes
in interface DoPaymentPolicyCmd
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 =========== ==================================== profileName Name 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 $XXXXXXwhere $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 profileName 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.
protected void setPMTotalAmount(java.math.BigInteger biPMTotalAmount)
protected void setPONumber(java.lang.String sPONumber)
protected void setProfileName(java.lang.String s)
protected void setReturnData(byte[] ba)
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.protected void setupNumericCurrencyCodeAndPMTotalAmount() throws javax.ejb.CreateException, javax.ejb.FinderException, javax.naming.NamingException, java.rmi.RemoteException, ECException
protected void updateOrderPaymentMethod() throws javax.ejb.CreateException, javax.ejb.FinderException, javax.naming.NamingException, java.rmi.RemoteException
public void validateParameters() throws ECException
validateParameters
in interface ECCommand
com.ibm.commerce.command.ECCommand
ECException.
-
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |