public class DoPaymentPMCmdImpl extends BusinessPolicyCommandImpl implements DoPaymentPolicyCmd, DoInventory, Queryable
The DoPaymentPMCmdImpl command passes environment variables to the Payment 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 Cashier.collectPayment() call.
The following table summarizes the parameters passed to the command and environment variables that the command passes to the Payment Cashier:
Parameter / Environment variable | Description |
---|---|
The following parameters are mandatory parameters received by the DoPaymentPMCmdImpl command from the DoPaymentMPFCmdImpl class. | |
storeId | The value for the store identification number |
Order | The OrderAccessBean representing the order. |
totalAmount | The amount of the order to be sent to WebSphere Commerce Payments. |
The following parameters are optional parameters received by the DoPaymentPMCmdImpl command from the DoPaymentMPFCmdImpl class. | |
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 parameters are optional parameters received by the DoPaymentPMCmdImpl command from the command URL. (through setting PaymentAttributes of the command) | |
cardExpiryMonth cardExpiryYear |
These two 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 two 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 WebSphere Commerce Payments 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, but are not recognized by WebSphere Commerce Payments. 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-supplied Cashier profile specifies the card_number environment variable as a value for the WebSphere Commerce Payments "$PAN" parameter which is the WebSphere Commerce Payments parameter name for credit card number and does not allow non-numeric characters. |
The following variables are environment variables that are always passed by DoPaymentPMCmdImpl to the Cashier. | |
storeId | The store ID from the storeId parameter above. |
orderId | The order ID from the Order parameter above. |
WebPath | The WebSphere Commerce application server web path. (For example, /webapp/wcs/stores/servlet |
WCSHostName | The domain-qualified host name of the WebSphere Commerce web server. |
WCSWebServerPort | The WebSphere Commerce 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. |
buyer_language_id | The language ID of the buyer from the Command Context above. |
language_encoding | The character encoding for the language of the buyer as specified by the entry in the LANGUAGE table for the language ID. |
The following Environment variables are mandatory parameters required by WebSphere Commerce Payments for all cassettes for the Cashier.collectPayment call. | |
CURRENCY | A code indicating the currency AMOUNT is in. This is the numeric currency code as per ISO 4217. |
AMOUNT | The total amount of the order. In the case of a backorder a padding, as specified by the BOPMPADFACTOR field in the STORE table, will be added to the total order amount in case the total amount changes later when the inventory is available. The customer will only be charged for the actual amount when the order is released.
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 Environment variables are used by WebSphere Commerce Payments for all cassettes if present. | |
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.
DoPaymentPMCmdImpl always passes this to the Cashier. |
PONumber | The purchase order number specified by the buyer when submitting the order for processing.
DoPaymentPMCmdImpl passes this to the Cashier if it is present. |
The following variables are gathered by DoPaymentPMCmdImpl command from other sources | |
approval_amount | The amount to be approved in the currency's smallest denomination.
The value for this variable is the same as the value for the AMOUNT variable except for the backorder case. In the event of a backorder situation, a small amount, as specified by the appropriate row in the CURFORMAT table for the store and currency, is used as the approval amount. The full amount will only be authorized when sufficient inventory can be allocated to release the backorder |
billtoAddressId | The Address ID of the billto address.
This parameter is either obtained from the order or from the Payment Terms and Conditions. If the Payment Terms and Conditions used includes a billto address, that take precedence over the billto address stored in the addressId field in the Orders table. The DoPaymentPMCmdImpl command uses the information from the Address table to create several billto_xxxx environment variables to pass to the Cashier. The billto_xxx environment variables are described below. |
billto_firstname billto_middlename billto_lastname billto_address1 billto_address2 billto_city billto_state billto_country billto_zipcode billto_phone_number billto_email_addr1 |
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. Certain payment cassette may 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 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 in 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 currency alpha code is obtained from the Orders table. |
Behavior
Returned Parameters:
Default Error View Name:
ErrorCodes:
This command uses the following AccessBeans:
This command calls the following TaskCommands:
Constructor and Description |
---|
DoPaymentPMCmdImpl()
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
protected void | checkParameters()
Deprecated.
Use validateParameters() instead.
|
protected AccountAccessBean | getAccount()
Deprecated.
Returns the AccountAccessBean representing the Account associated with the order.
|
protected java.lang.Long | getAccountId()
Deprecated.
Returns the account ID of the Account associated with the order.
|
protected java.lang.Long | getBuyerPOId()
Deprecated.
Returns the internal ID of the BuyerPO record if a buyer purchase order number is specified.
|
java.lang.String | getContentType()
Deprecated.
Returns the Content Type (or MIME type) of the return data, or null if the type is not known.
|
protected java.lang.String | getCurrencyExponent()
Deprecated.
Returns the currency exponent.
|
protected java.lang.Double | getCurrencyFactor()
Deprecated.
instead of using the currency factor, use the currency exponent methods to shift the decimal point getCurrencyExponent()
|
protected java.sql.Connection | getDBConnection()
Deprecated.
Returns the connection to WebSphere Commerce database.
|
protected java.lang.String | getDisplayPaymentStateForTrace(int anPaymentState)
Deprecated.
Returns the display String represnting the Payment State as returned by WebSphere Commerce Payments for Trace purposes.
|
protected java.lang.String | getErrorViewName()
Deprecated.
Returns the name of the error view to use for reporting error.
|
static java.lang.String | getNiceBytes(byte[] bytes)
Deprecated.
|
static java.lang.String | getNiceBytes(java.lang.String s)
Deprecated.
|
protected java.lang.String | getNumericCountryCode(java.lang.String productVendor, java.lang.String country)
Deprecated.
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()
Deprecated.
Returns the numeric currency code.
|
protected OrderAccessBean | getOrder()
Deprecated.
Returns the OrderAccessBean representing the Order being processed.
|
java.lang.String | getOrderState()
Deprecated.
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()
Deprecated.
Returns the TypedProperty object containing the payment attributes passed to this command by the calling command.
|
protected java.math.BigInteger | getPMTotalAmount()
Deprecated.
Returns the total amount normalized for WebSphere Commerce Payments.
|
protected java.lang.String | getPONumber()
Deprecated.
Returns the PONumber attribute passed to the command by the calling command.
|
protected java.lang.String | getProfileName()
Deprecated.
Returns the profileName attribute passed to the command by the calling command.
|
byte[] | getReturnData()
Deprecated.
Returns the byte Array containing Return Data from WebSphere Commerce Payments.
|
protected java.math.BigDecimal | getTotalAmount()
Deprecated.
Returns the totalAmount attribute passed to the command by the calling command.
|
boolean | isReadyToCallExecute()
Deprecated.
This method is called by the Command Framework to check if all basic mandatory parameters have been set for this command.
|
void | performExecute()
Deprecated.
Performs the main business logic of the command.
|
java.util.Hashtable | query(java.lang.String queryString)
Deprecated.
The Cashier calls this method to construct a Hashtable of keywords and values which result from processing the input query string.
|
void | reset()
Deprecated.
Resets the instance variables of the command.
|
void | setAccount(AccountAccessBean abAccount)
Deprecated.
Sets the account property of the command.
|
void | setBuyerPOId(java.lang.Long n)
Deprecated.
Sets optional buyerPOId if the customer (buyer) had specified a buyer purchase order number.
|
protected void | setContentType(java.lang.String sContentType)
Deprecated.
Sets Content Type (or MIME type) of the returned data.
|
protected void | setCurrencyExponent(java.lang.String astrCurrencyExponent)
Deprecated.
Sets Currency Exponent.
|
protected void | setCurrencyFactor(java.lang.Double d)
Deprecated.
instead of using the currency factor, use the currency exponent methods to shift the decimal point setCurrencyExponent(String)
|
void | setErrorViewName(java.lang.String sEVN)
Deprecated.
Sets the error view to be used to report error.
|
protected void | setNumericCurrencyCode(java.lang.String astrCurrencyCode)
Deprecated.
Sets Numeric Currency Code.
|
void | setOrder(OrderAccessBean ab)
Deprecated.
Sets the order property of the command.
|
protected void | setOrderState(java.lang.String orderState)
Deprecated.
Sets the order state to be returned to the caller.
|
void | setPaymentAttributes(TypedProperty paymentAttributes)
Deprecated.
Sets the paymentAttributes property of the command.
|
protected void | setPMTotalAmount(java.math.BigInteger biPMTotalAmount)
Deprecated.
Sets the total amount normalized for input to WebSphere Commerce Payments.
|
protected void | setPONumber(java.lang.String sPONumber)
Deprecated.
Sets the Purchase Order Number attribute.
|
protected void | setProfileName(java.lang.String s)
Deprecated.
Sets the Profile Name attribute.
|
protected void | setReturnData(byte[] ba)
Deprecated.
Sets the Return Data to be returned to the caller.
|
void | setTotalAmount(java.math.BigDecimal totalAmount)
Deprecated.
Sets the totalAmount property of the command.
|
protected void | setupNumericCurrencyCodeAndPMTotalAmount()
Deprecated.
This method retrieves the numeric currency code from the SETCURR Table and converts the totalAmount into a normalized form required for input to WebSphere Commerce Payments.
|
protected void | updateOrderPaymentMethod()
Deprecated.
This method is called by performExecute to create a new ORDPAYMTHD row with payment info.
|
void | validateParameters()
Deprecated.
Checks the validity of customer-supplied parameters.
|
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()
protected java.lang.String getCurrencyExponent()
protected java.lang.Double getCurrencyFactor()
Currency factor is the multiplication factor that could be used to convert a currency amount to its lowest denomination. For example, the currency factor for US Dollar is 100. To convert US $5.00 to cents, multiply the currency amount by the currency factor of 100. You get 500 cents.
protected java.sql.Connection getDBConnection() throws java.sql.SQLException, ECException
protected java.lang.String getDisplayPaymentStateForTrace(int anPaymentState)
protected java.lang.String getErrorViewName()
protected java.lang.String getNumericCountryCode(java.lang.String productVendor, java.lang.String country) throws ECException
protected java.lang.String getNumericCurrencyCode()
protected OrderAccessBean getOrder()
public java.lang.String getOrderState()
protected TypedProperty getPaymentAttributes()
protected java.math.BigInteger getPMTotalAmount()
protected java.lang.String getPONumber()
protected java.lang.String getProfileName()
public byte[] getReturnData()
protected java.math.BigDecimal getTotalAmount()
public boolean isReadyToCallExecute()
public void performExecute() throws ECException
public static java.lang.String getNiceBytes(java.lang.String s)
public static java.lang.String getNiceBytes(byte[] bytes)
public java.util.Hashtable query(java.lang.String queryString) throws CashierException
This method is defined by the com.ibm.etill.cashier.Queryable interface.
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)
public void setBuyerPOId(java.lang.Long n)
protected void setContentType(java.lang.String sContentType)
protected void setCurrencyExponent(java.lang.String astrCurrencyExponent)
protected void setCurrencyFactor(java.lang.Double d)
Currency factor is the multiplication factor that could be used to convert a currency amount to its lowest denomination. For example, the currency factor for US Dollar is 100. To convert US $5.00 to cents, multiply the currency amount by the currency factor of 100. You get 500 cents.
public void setErrorViewName(java.lang.String sEVN)
protected void setNumericCurrencyCode(java.lang.String astrCurrencyCode)
public void setOrder(OrderAccessBean ab)
protected void setOrderState(java.lang.String orderState)
public void setPaymentAttributes(TypedProperty paymentAttributes)
Some of the Payment Attributes that may be passed to the command are:
Keyword Value =========== ==================================== PONumber The purchase order number profileName The 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
For this command implementation, the profileName attribute is mandatory. This parameter normally comes from the properties field of the Policy Table entry for the payment policy used. This is the short name of the file on the file system without the .profile extension.
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 in WebSphere Commerce Payments. The BrandID is case-sensitive.
The PONumber attribute is required if the Account associated with the trading agreements used for the order includes a Purchase Order Terms and Conditions.
protected void setPMTotalAmount(java.math.BigInteger biPMTotalAmount)
The normalized amount is the amount converted to the smallest denomination for the currency. For example, if the total amount is US $10.95, PMTotalAmount is 1095 in cents, which is the lowest denomination for this currency. If there is no smaller denomination other than the main currency unit for the currency, the normalized amount is the same as the totalAmount.
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)
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