• Welcome to KonaKart Community Forum. Please login or sign up.
 

Issue in redirection from payment gateway

Started by pooja, February 23, 2015, 01:54:08 am

Previous topic - Next topic

pooja

Hi,

I have added a new payment module which is BROWSER_PAYMENT_GATEWAY. I redirect to their site and pass 'sessionId' in the custom parameters. After processing payment, when it gets redirected to my site, it passes that sessionId in the response which I use for maintaining a user session and show him a confirmation message.
     Sometimes it works. But many times it fails without any exception and no message is shown. Instead customer sees login screen. Below is the code which I have added to the execute method in my action :
{
       String sessionId = null;
        KKAppEng kkAppEng = null;
        try {
            if (request == null){
               return KKLOGIN;
            }
            sessionId = request.getParameter(someAction.CUSTOM);
            if (sessionId == null){
                return KKLOGIN;
            }
            // Get an instance of the KonaKart engine
            kkAppEng = this.getKKAppEng(request, response);

            /*
             * Use the session of the logged in user to initialize kkAppEng
             */
            try            {
                kkAppEng.getEng().checkSession(sessionId);
            } catch (KKException e){
                return KKLOGIN;
            }
            // Log in the user
            kkAppEng.getCustomerMgr().loginBySession(sessionId);
           
         // Check that order is there and valid
                  OrderIf checkoutOrder = kkAppEng.getOrderMgr().getCheckoutOrder();
                  if (checkoutOrder == null) {
                     return "Checkout";
                  }
}

I am facing an issue from a long time. Also 'checkSession' code cannot be checked.  Once sessionId parameter was received as null which per my understanding should not happen.

I badly need help here. Can anybody please help me on this? I am not getting which step is going wrong .
Requesting for a guideline.
Thanks in advance.

julie

What I suggest is that you contibute your module to the community (Contributions section of forum) and maybe someone can try it out and help you.

pooja

Thanks for reply.
I can do that. But meanwhile can you please let me know if passing a sessionId and using that again to restore customer session is a right way to get it.
Or please suggest if there is a better way to do that.

I have used reference of Paypal which is also a Browser_payment_gateway. That retrieves uuid from response from paypal, which in turn gets SSOToken to get order id and session id.

I just use sessionId to log in a user and then I use the code below directly:
OrderIf checkoutOrder = kkAppEng.getOrderMgr().getCheckoutOrder();
                  if (checkoutOrder == null) {
                     return "Checkout";
                  }

   Does checkout order return null or it is still maintained?

Any help will be appreciated.
Thank you.

pooja

Hi Julie,

I have contributed the module. (Reference : http://www.konakart.com/forum/index.php/topic,1997.msg7654.html#msg7654).

Requesting to test it for any issue.
Thank you for your cooperation.

julie

I wanted to reproduce your problem but can't get it to run at all. Can you provide some instructions as to how anyone can run what you just submitted? It seems to be missing all variables required to configure the gateway.

pooja

 Apologies for the config missing attachment.
Actually I have implemented in a little different way.
I tried to use paypal as a  guideline later.
But got stuck at the following code:
  /*
         * Create a session here which will be used by the IPN callback
         */
        SSOTokenIf ssoToken = new SSOToken();
        String sessionId = getEng().login(sd.getPayuCallbackUsername(),
                sd.getPayuCallbackPassword());

   I cannot pass password of the logged in user as KK does not provide a way to access passwords and if I provide a certain username/password credentials to login, it will always login as that particular user which I don't want. (Please correct me if I got anything wrong here.)
   I want to retain session of logged in customer so that I can show an appropriate message.

Can anybody please guide on how can I achieve that?
Also it will be great if anyone can post a code snippet of how  a payment module is called from  JSP on the checkout page .

Thank you in advance.

pooja

 We are live and because of this issue we are facing lot of problems.

  Any guideline would be a great help.

  Thank you.