public class BaseGatewayAction extends BaseAction
Modifier and Type | Field and Description |
---|---|
protected boolean |
enableJsonExceptionHandling
Set to true when using Json
|
protected JsonException |
exception
An object to return exception information when action class is called using Json
|
protected boolean |
requiresLogin
Set to true if request requires login
|
ACTION_CONFIRM_ORDER, ACTION_CUSTOMER_LOGIN, ACTION_ENTER_CHECKOUT, ACTION_NEW_CUSTOMER_VISIT, ACTION_PAYMENT_METHOD_SELECTED, ACTION_PRODUCT_VIEWED, ACTION_REMOVE_FROM_CART, AGREED_COOKIES, appEng, COOKIE_MAX_AGE_IN_SECS, CUSTOMER_LOCALE, CUSTOMER_NAME, CUSTOMER_UUID, GUEST_CUSTOMER_ID, KKLOGIN, MY_ACCOUNT_URL, SEO_DELIM, SEO_DIRECTORY, SEO_OFF, SEO_PARAMETERS, SEO_PRODS_FOR_MANU, SEO_PRODS_FOR_MANU_CODE, SEO_SEARCH_BY_MANU_BY_LINK, SEO_SEARCH_BY_MANU_BY_LINK_CODE, SEO_SEL_CAT, SEO_SEL_CAT_CODE, SEO_SEL_PROD, SEO_SEL_PROD_CODE, SEO_TYPE, SEO_TYPE_LENGTH, strutsSession, TAG_BIRTH_DATE, TAG_CART_TOTAL, TAG_CATEGORIES_TIME_VIEWED, TAG_CATEGORIES_VIEWED, TAG_COUNTRY_CODE, TAG_IS_MALE, TAG_LOGIN_DATE, TAG_MANUFACTURERS_TIME_VIEWED, TAG_MANUFACTURERS_VIEWED, TAG_ORDER_PAGE_SIZE, TAG_PROD_PAGE_SIZE, TAG_PRODUCTS_IN_CART, TAG_PRODUCTS_IN_WISHLIST, TAG_PRODUCTS_TIME_IN_CART, TAG_PRODUCTS_TIME_IN_WISHLIST, TAG_PRODUCTS_TIME_VIEWED, TAG_PRODUCTS_VIEWED, TAG_REVIEW_PAGE_SIZE, TAG_SEARCH_STRING, TAG_WISHLIST_TOTAL, WELCOME
Constructor and Description |
---|
BaseGatewayAction() |
Modifier and Type | Method and Description |
---|---|
protected void |
addParameters(com.konakart.appif.PaymentDetailsIf pd,
java.util.List<com.konakart.appif.NameValueIf> newParameters)
Add more parameters to the PaymentDetails object.
|
protected void |
customizeConnection(java.net.HttpURLConnection connection)
Deprecated.
|
protected void |
customizeConnection(java.net.HttpURLConnection connection,
com.konakart.appif.PaymentDetailsIf pd,
java.util.List<com.konakart.appif.NameValueIf> paramList)
This method is normally specialized in the sub class to customize the connection
|
protected java.lang.String |
getCustomerIPAddress(javax.servlet.http.HttpServletRequest request) |
java.lang.String |
getData(com.konakart.appif.PaymentDetailsIf pd,
java.util.List<com.konakart.appif.NameValueIf> ccParmList)
Sends data to the payment gateway via a GET.
|
JsonException |
getException() |
protected java.lang.StringBuffer |
getGatewayRequest(com.konakart.appif.PaymentDetailsIf pd,
java.util.List<com.konakart.appif.NameValueIf> ccParmList)
This method can be specialized in the super class to customize the format of the request
|
java.lang.String |
getLogFileDirectory(KKAppEng kkAppEng) |
protected java.lang.String |
getParameterFromPaymentDetails(java.lang.String paramName,
com.konakart.appif.PaymentDetailsIf pd)
Get the value of the parameter with the specified name from the PaymentDetails object
|
protected java.net.Proxy |
getProxy(KKAppEng kkAppEng) |
protected java.lang.String |
handleException(javax.servlet.http.HttpServletRequest request,
java.lang.Exception e)
A common method that contains the code to deal with exceptions
|
protected java.util.HashMap<java.lang.String,java.lang.String> |
hashParameters(com.konakart.appif.PaymentDetailsIf pd,
java.util.List<com.konakart.appif.NameValueIf> ccParmList)
This method is optionally called from the sub class to load up the parameters into a
HashTable for efficient subsequent processing
|
boolean |
isEnableJsonExceptionHandling() |
java.lang.String |
postData(com.konakart.appif.PaymentDetailsIf pd,
java.util.List<com.konakart.appif.NameValueIf> ccParmList)
Sends data to the payment gateway via a POST.
|
java.lang.String |
postData(java.lang.StringBuffer postData,
com.konakart.appif.PaymentDetailsIf pd,
java.util.List<com.konakart.appif.NameValueIf> ccParmList)
Sends data to the payment gateway via a POST.
|
protected void |
saveIPNrecord(KKAppEng kkAppEng,
int orderId,
java.lang.String moduleCode,
java.lang.String gatewayFullResponse,
java.lang.String gatewayResult,
java.lang.String gatewayTransactionId,
java.lang.String konakartResultDescription,
int konakartResultId)
Saves an IPN History record.
|
protected void |
saveIPNrecord(KKAppEng kkAppEng,
int orderId,
java.lang.String moduleCode,
java.lang.String gatewayFullResponse,
java.lang.String gatewayResult,
java.lang.String gatewayTransactionId,
java.lang.String konakartResultDescription,
int konakartResultId,
java.lang.String txType,
java.math.BigDecimal txAmount)
Saves an IPN History record.
|
protected void |
sendOrderConfirmationMail(KKAppEng kkAppEng,
int orderId,
boolean success)
Send an order confirmation eMail.
|
protected void |
sendOrderConfirmationMail(KKAppEng kkAppEng,
java.lang.String sessionId,
java.lang.String countryCode,
int orderId,
boolean success)
Send an order confirmation eMail.
|
java.lang.String |
sendPaymentData(com.konakart.appif.PaymentDetailsIf pd,
java.util.List<com.konakart.appif.NameValueIf> parmList)
Send the payment data.
|
void |
setEnableJsonExceptionHandling(boolean enableJsonExceptionHandling) |
void |
setException(JsonException exception) |
protected java.lang.String |
translatePaymentInstrumentTypePaymentModuleSubCode(java.lang.String paymentInstrumentType)
Get the paymentInstrumentType from the gateway and return the paymentModuleSubCode in
order to indicate what type of payment has been used in the order.
|
protected void |
validateOrder(com.konakart.appif.OrderIf order,
java.lang.String code)
Validate the order and ensure that we are using the correct payment gateway
|
changeSession, checkSSL, escapeFormInput, getBaseURL, getCustomerEvent, getForward, getJspEng, getKKAppEng, getKKCookie, getKKCookie, getRedirectURL, insertCustomerEvent, insertCustomerEvent, insertCustomerEvent, insertCustomerEvent, insertCustomerEvent, kkURLEncode, loggedIn, loggedIn, loggedIn, login, manageCookieLogout, noNull, setJspEng, setKKCookie, setKKCookie, setServletRequest, setSession, setupResponseForSEORedirect, setupResponseForSSLRedirect, updateRecentlyViewedProducts
addActionError, addActionMessage, addFieldError, clearActionErrors, clearErrors, clearErrorsAndMessages, clearFieldErrors, clearMessages, clone, doDefault, execute, getActionErrors, getActionMessages, getErrorMessages, getErrors, getFieldErrors, getFormatted, getLocale, getText, getText, getText, getText, getText, getText, getText, getText, getText, getTexts, getTexts, hasActionErrors, hasActionMessages, hasErrors, hasFieldErrors, hasKey, input, pause, setActionErrors, setActionMessages, setContainer, setFieldErrors, validate
protected JsonException exception
protected boolean enableJsonExceptionHandling
protected boolean requiresLogin
protected void validateOrder(com.konakart.appif.OrderIf order, java.lang.String code) throws KKAppException
order
- the ordercode
- the codeKKAppException
- an unexpected KKAppException exceptionpublic java.lang.String sendPaymentData(com.konakart.appif.PaymentDetailsIf pd, java.util.List<com.konakart.appif.NameValueIf> parmList) throws java.io.IOException
pd
- payment detailsparmList
- parameter listjava.io.IOException
- if we get an IOException communication with the gatewaypublic java.lang.String postData(com.konakart.appif.PaymentDetailsIf pd, java.util.List<com.konakart.appif.NameValueIf> ccParmList) throws java.io.IOException
pd
- the PaymentDetails objectccParmList
- the ccParmListjava.io.IOException
- an unexpected IOException exceptionpublic java.lang.String postData(java.lang.StringBuffer postData, com.konakart.appif.PaymentDetailsIf pd, java.util.List<com.konakart.appif.NameValueIf> ccParmList) throws java.io.IOException
postData
- The data to be posted. Can be null.pd
- the PaymentDetails objectccParmList
- the ccParmListjava.io.IOException
- an unexpected IOException exceptionpublic java.lang.String getData(com.konakart.appif.PaymentDetailsIf pd, java.util.List<com.konakart.appif.NameValueIf> ccParmList) throws java.io.IOException
pd
- the payment detailsccParmList
- the ccParmListjava.io.IOException
- an unexpected IOException exceptionprotected java.lang.StringBuffer getGatewayRequest(com.konakart.appif.PaymentDetailsIf pd, java.util.List<com.konakart.appif.NameValueIf> ccParmList)
pd
- the PaymentDetailsccParmList
- the credit card parameterspublic java.lang.String getLogFileDirectory(KKAppEng kkAppEng)
kkAppEng
- the kkAppEngprotected java.util.HashMap<java.lang.String,java.lang.String> hashParameters(com.konakart.appif.PaymentDetailsIf pd, java.util.List<com.konakart.appif.NameValueIf> ccParmList)
pd
- PaymentDetails objectccParmList
- name value pair list of CC parametersprotected java.lang.String getParameterFromPaymentDetails(java.lang.String paramName, com.konakart.appif.PaymentDetailsIf pd)
paramName
- parameter name to look uppd
- PaymentDetails objectprotected void customizeConnection(java.net.HttpURLConnection connection, com.konakart.appif.PaymentDetailsIf pd, java.util.List<com.konakart.appif.NameValueIf> paramList)
connection
- the HTTP connection objectpd
- the Payment DetailsparamList
- Additional parameters (typically credit card details but can also be any
miscellaneous extra parameters that may be required)@Deprecated protected void customizeConnection(java.net.HttpURLConnection connection)
connection
- the connectionprotected void sendOrderConfirmationMail(KKAppEng kkAppEng, int orderId, boolean success) throws com.konakart.app.KKException
kkAppEng
- the kkAppEngorderId
- the orderIdsuccess
- the successcom.konakart.app.KKException
- an unexpected KKException exceptionprotected void sendOrderConfirmationMail(KKAppEng kkAppEng, java.lang.String sessionId, java.lang.String countryCode, int orderId, boolean success) throws com.konakart.app.KKException
kkAppEng
- the kkAppEngsessionId
- the sessionIdcountryCode
- the countryCodeorderId
- the orderIdsuccess
- the successcom.konakart.app.KKException
- an unexpected KKException exceptionprotected void saveIPNrecord(KKAppEng kkAppEng, int orderId, java.lang.String moduleCode, java.lang.String gatewayFullResponse, java.lang.String gatewayResult, java.lang.String gatewayTransactionId, java.lang.String konakartResultDescription, int konakartResultId) throws com.konakart.app.KKException
kkAppEng
- the KKAppEng application engine which should contain a valid sessionIdorderId
- the orderId involved in the transactionmoduleCode
- the code of the modulegatewayFullResponse
- full response from the gatewaygatewayResult
- summary gateway responsegatewayTransactionId
- an Id from the gateway that identifies the transactionkonakartResultDescription
- KonaKart result descriptionkonakartResultId
- KonaKart result codecom.konakart.app.KKException
- an unexpected KKException exceptionprotected void saveIPNrecord(KKAppEng kkAppEng, int orderId, java.lang.String moduleCode, java.lang.String gatewayFullResponse, java.lang.String gatewayResult, java.lang.String gatewayTransactionId, java.lang.String konakartResultDescription, int konakartResultId, java.lang.String txType, java.math.BigDecimal txAmount) throws com.konakart.app.KKException
kkAppEng
- the KKAppEng application engine which should contain a valid sessionIdorderId
- the orderId involved in the transactionmoduleCode
- the code of the modulegatewayFullResponse
- full response from the gatewaygatewayResult
- summary gateway responsegatewayTransactionId
- an Id from the gateway that identifies the transactionkonakartResultDescription
- KonaKart result descriptionkonakartResultId
- KonaKart result codetxType
- Transaction TypetxAmount
- Transaction Amountcom.konakart.app.KKException
- an unexpected KKException exceptionprotected void addParameters(com.konakart.appif.PaymentDetailsIf pd, java.util.List<com.konakart.appif.NameValueIf> newParameters)
pd
- the PaymentDetails objectnewParameters
- The parameters to set.protected java.lang.String getCustomerIPAddress(javax.servlet.http.HttpServletRequest request)
request
- the requestprotected java.net.Proxy getProxy(KKAppEng kkAppEng)
kkAppEng
- the KKAppEng application engine which should contain a valid sessionIdprotected java.lang.String handleException(javax.servlet.http.HttpServletRequest request, java.lang.Exception e)
handleException
in class BaseAction
request
- the HttpServletRequest requeste
- Exception to handlepublic JsonException getException()
public void setException(JsonException exception)
exception
- the exception to setpublic boolean isEnableJsonExceptionHandling()
public void setEnableJsonExceptionHandling(boolean enableJsonExceptionHandling)
enableJsonExceptionHandling
- the enableJsonExceptionHandling to setprotected java.lang.String translatePaymentInstrumentTypePaymentModuleSubCode(java.lang.String paymentInstrumentType)
paymentInstrumentType
- the paymentInstrumentType received from the gatewayCopyright © 2018 DS Data Systems UK Ltd.