com.konakart.actions.gateways
Class BaseGatewayAction

java.lang.Object
  extended by org.apache.struts.action.Action
      extended by com.konakart.actions.BaseAction
          extended by com.konakart.actions.gateways.BaseGatewayAction
Direct Known Subclasses:
AuthorizenetAction, BarclaycardSmartPayApi3DResponseAction, BarclaycardSmartPayApiAction, BarclaycardSmartPayApiNotificationAction, BarclaycardSmartPayHostedNotificationAction, BarclaycardSmartPayHostedResponseAction, BluepayAction, CaledonAction, ChronoPayAction, CommideaVanguardBaseAction, CyberSourceAction, CyberSourceHOPResponseAction, CyberSourceResponseAction, ElinkAction, Eway_auAction, MoneyBookersAction, NetpayintlAction, PayflowProAction, PayjunctionAction, PayPalAction, UsaepayAction, WorldPayAction, WorldPayXMLRedirectAction, WorldPayXMLRedirectResponseAction, YourpayAction

public class BaseGatewayAction
extends BaseAction

Base Gateway Action for KonaKart application.


Field Summary
 
Fields inherited from class com.konakart.actions.BaseAction
ACTION_CONFIRM_ORDER, ACTION_CUSTOMER_LOGIN, ACTION_ENTER_CHECKOUT, ACTION_NEW_CUSTOMER_VISIT, ACTION_PAYMENT_METHOD_SELECTED, ACTION_PRODUCT_VIEWED, ACTION_REMOVE_FROM_CART, COOKIE_MAX_AGE_IN_SECS, CUSTOMER_LOCALE, CUSTOMER_NAME, CUSTOMER_UUID, defaultStoreIdFromWebXml, GUEST_CUSTOMER_ID, loginForward, SEO_DELIM, SEO_DIRECTORY, SEO_OFF, SEO_PARAMETERS, SEO_PRODS_FOR_MANU, SEO_PRODS_FOR_MANU_CODE, SEO_SEARCH_BY_MANU, SEO_SEARCH_BY_MANU_BY_LINK, SEO_SEARCH_BY_MANU_BY_LINK_CODE, SEO_SEARCH_BY_MANU_CODE, SEO_SEL_CAT, SEO_SEL_CAT_CODE, SEO_SEL_PROD, SEO_SEL_PROD_CODE, SEO_TYPE, SEO_TYPE_LENGTH, TAG_BIRTH_DATE, TAG_CART_TOTAL, TAG_CATEGORIES_VIEWED, TAG_COUNTRY_CODE, TAG_IS_MALE, TAG_LOGIN_DATE, TAG_MANUFACTURERS_VIEWED, TAG_ORDER_PAGE_SIZE, TAG_PROD_PAGE_SIZE, TAG_PRODUCTS_IN_CART, TAG_PRODUCTS_IN_WISHLIST, TAG_PRODUCTS_VIEWED, TAG_REVIEW_PAGE_SIZE, TAG_SEARCH_STRING, TAG_WISHLIST_TOTAL
 
Fields inherited from class org.apache.struts.action.Action
defaultLocale, servlet
 
Constructor Summary
BaseGatewayAction()
           
 
Method Summary
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
 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.
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.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
 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 sendOrderConfirmationMail(KKAppEng kkAppEng, int orderId, boolean success)
          Send an order confirmation eMail.
protected  void sendOrderConfirmationMail(com.konakart.appif.KKEngIf eng, java.lang.String sessionId, java.lang.String countryCode, int orderId, boolean success)
          Send an order confirmation eMail.
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
 
Methods inherited from class com.konakart.actions.BaseAction
checkSSL, clearErrors, getCatMessage, getCustomerEvent, getDefaultStoreIdFromWebXml, getForward, getKKAppEng, getKKCookie, getKKCookie, handleException, insertCustomerEvent, insertCustomerEvent, insertCustomerEvent, insertCustomerEvent, insertCustomerEvent, isOnePageCheckout, kkURLEncode, loggedIn, manageCookieLogout, runningInPortal, setDefaultStoreIdFromWebXml, setKKCookie, setKKCookie, setupResponseForSEORedirect, updateRecentlyViewedProducts
 
Methods inherited from class org.apache.struts.action.Action
addErrors, addMessages, execute, execute, generateToken, getDataSource, getDataSource, getErrors, getLocale, getMessages, getResources, getResources, getServlet, isCancelled, isTokenValid, isTokenValid, resetToken, saveErrors, saveErrors, saveErrors, saveMessages, saveMessages, saveToken, setLocale, setServlet
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseGatewayAction

public BaseGatewayAction()
Method Detail

validateOrder

protected void validateOrder(com.konakart.appif.OrderIf order,
                             java.lang.String code)
                      throws KKAppException
Validate the order and ensure that we are using the correct payment gateway

Parameters:
order -
code -
Throws:
KKAppException

postData

public java.lang.String postData(com.konakart.appif.PaymentDetailsIf pd,
                                 java.util.List<com.konakart.appif.NameValueIf> ccParmList)
                          throws java.io.IOException
Sends data to the payment gateway via a POST. Parameters are received from the PaymentDetails object and the credit card parameters that have just been input by the customer are sent in a separate list; the ccParmList. Any miscellaneous parameters can also be added to the ccParmList if required.

Parameters:
pd - the PaymentDetails object
ccParmList -
Returns:
The response to the post
Throws:
java.io.IOException

postData

public 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
Sends data to the payment gateway via a POST. Parameters are received from the PaymentDetails object and the credit card parameters that have just been input by the customer are sent in a separate list; the ccParmList. Any miscellaneous parameters can also be added to the ccParmList if required. If postData is not null, then the data it contains is used instead of the data from the PaymentDetails and ccParmList.

Parameters:
postData - The data to be posted. Can be null.
pd - the PaymentDetails object
ccParmList -
Returns:
The response to the post
Throws:
java.io.IOException

getData

public java.lang.String getData(com.konakart.appif.PaymentDetailsIf pd,
                                java.util.List<com.konakart.appif.NameValueIf> ccParmList)
                         throws java.io.IOException
Sends data to the payment gateway via a GET. Parameters are received from the PaymentDetails object and the credit card parameters that have just been input by the customer are send in a separate list; the ccParmList

Parameters:
pd -
ccParmList -
Returns:
The response to the post
Throws:
java.io.IOException

getGatewayRequest

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

Parameters:
pd - the PaymentDetails
ccParmList - the credit card parameters
Returns:
a StringBuffer containing the gateway request

getLogFileDirectory

public java.lang.String getLogFileDirectory(KKAppEng kkAppEng)
Parameters:
kkAppEng -
Returns:
Returns the logFileDirectory. We look it up every time.

hashParameters

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

Parameters:
pd - PaymentDetails object
ccParmList - name value pair list of CC parameters
Returns:
a hash map containing the parameters for rapid lookup

getParameterFromPaymentDetails

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

Parameters:
paramName - parameter name to look up
pd - PaymentDetails object
Returns:
value of the parameter or null if the parameter is not found

customizeConnection

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

Parameters:
connection - the HTTP connection object
pd - the Payment Details
paramList - Additional parameters (typically credit card details but can also be any miscellaneous extra parameters that may be required)

customizeConnection

@Deprecated
protected void customizeConnection(java.net.HttpURLConnection connection)
Deprecated. 

This method is normally specialized in the sub class to customize the connection

Parameters:
connection -

sendOrderConfirmationMail

protected void sendOrderConfirmationMail(KKAppEng kkAppEng,
                                         int orderId,
                                         boolean success)
                                  throws com.konakart.app.KKException
Send an order confirmation eMail. The template used is different if the order is successful or not.

Parameters:
kkAppEng -
orderId -
success -
Throws:
com.konakart.app.KKException

sendOrderConfirmationMail

protected void sendOrderConfirmationMail(com.konakart.appif.KKEngIf eng,
                                         java.lang.String sessionId,
                                         java.lang.String countryCode,
                                         int orderId,
                                         boolean success)
                                  throws com.konakart.app.KKException
Send an order confirmation eMail. The template used is different if the order is successful or not.

Parameters:
eng -
sessionId -
countryCode -
orderId -
success -
Throws:
com.konakart.app.KKException

saveIPNrecord

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)
                      throws com.konakart.app.KKException
Saves an IPN History record. The KKAppEng should have a logged-in user with a valid sessionId.

Parameters:
kkAppEng - the KKAppEng application engine which should contain a valid sessionId
orderId - the orderId involved in the transaction
moduleCode - the code of the module
gatewayFullResponse - full response from the gateway
gatewayResult - summary gateway response
gatewayTransactionId - an Id from the gateway that identifies the transaction
konakartResultDescription - KonaKart result description
konakartResultId - KonaKart result code
Throws:
com.konakart.app.KKException

addParameters

protected void addParameters(com.konakart.appif.PaymentDetailsIf pd,
                             java.util.List<com.konakart.appif.NameValueIf> newParameters)
Add more parameters to the PaymentDetails object. Normally this method would be on the PaymentDetails class but it's placed here instead because of the automatic code generation that occurs on the PaymentDetails class for web services, JSON and RMI etc.

Parameters:
pd - the PaymentDetails object
newParameters - The parameters to set.


Copyright © 2011 DS Data Systems UK Ltd.