KonaKart Community Forum

Installation / Configuration => Programming of KonaKart => Topic started by: pooja on February 23, 2015, 01:54:08 am

Title: Issue in redirection from payment gateway
Post by: pooja on February 23, 2015, 01:54:08 am
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.
Title: Re: Issue in redirection from payment gateway
Post by: julie on February 23, 2015, 08:00:38 am
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.
Title: Re: Issue in redirection from payment gateway
Post by: pooja on February 24, 2015, 12:32:42 am
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.
Title: Re: Issue in redirection from payment gateway
Post by: pooja on March 02, 2015, 05:05:23 am
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.
Title: Re: Issue in redirection from payment gateway
Post by: julie on March 02, 2015, 08:20:29 am
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.
Title: Re: Issue in redirection from payment gateway
Post by: pooja on March 10, 2015, 04:49:02 am
 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.
Title: Re: Issue in redirection from payment gateway
Post by: pooja on March 11, 2015, 03:19:15 am
 We are live and because of this issue we are facing lot of problems.

  Any guideline would be a great help.

  Thank you.