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

PayPal Integration - Konakart Admin Portlet

Started by vetal324, February 04, 2014, 06:07:29 pm

Previous topic - Next topic

vetal324

Does anybody have experience in Liferay-Konakart integration?

I have added Konakart Store and Konakart Administration portlets to my Liferay site, and made some configuration.
I need to configure PayPal payment module.

What should be set as Callback URL? (the default value is http://host:port/konakart/PayPalCallback.action )
As I understand, this is struts action, which receives payment status from PayPal. I have replaced host and port with my domain, but it's not working for me... I receive error 'There has been an unexpected problem Unfortunately we have encountered a malfunction.' when I try to checkout product.
Any ideas?
Which things may I miss in PayPal configuration?

Should I make some change into Liferay's ROOT/WEB-INF/web.xml file? It seems http://localhost:8080/konakart/PayPalCallback.action is not accessible in Liferay...
However, I can access http://localhost:8780/konakart/PayPalCallback.action (if I startup konakart separately).
As I understand, Konakart portlet should work even without separate Konakart running... So, how can I generate similar PayPal callback URL in Liferay ? 

Please, share any thoughts, examples, sources, etc.

Regards,
Vitaliy

trevor

I'm no Liferay expert but shouldn't it "just" be a case of figuring out the URL that you need to give to Liferay so that it calls the callback action class.

Maybe you can figure it out by seeing how it maps other action classes. For example if you see what the Liferay URL is required to call another action class like LogIn.action you may be able to construct the URL for PayPalCallback.action.

vetal324

Thanks, Trevor!

Does anybody have more detailed information on this?

Regards

vetal324

Here is the stack trace:

08-Feb 13:35:05 ERROR (?:handleException:?) A customer has received the following exception ( ref: 1391866505479 )
com.konakart.app.KKException: The String parameter called hostPort must be given a value. It cannot be set to null or be left empty.
   at com.konakart.bl.BaseMgr.checkRequired(Unknown Source)
   at com.konakart.bl.modules.payment.PaymentMgr.getPaymentDetails(Unknown Source)
   at com.konakart.app.KKEng.getPaymentDetails(Unknown Source)
   at com.konakart.app.KKEng.getPaymentDetails(Unknown Source)
   at com.konakart.actions.CheckoutConfirmationSubmitAction.execute(Unknown Source)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:601)
   at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:446)
   at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:285)
   at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
   at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:256)
   at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:242)
        ....

nithesh0591@gmail.com

I am also getting the same error. How to solve t

Laxman Rana

Hi,
You need to do couple of things for paypal integration.

1) Open "CheckoutConfirmationSubmitAction" java file and make below changes.

public String execute() {
.......
String hostAndPort = "";
            if (!kkAppEng.isPortlet())
            {
                // Throws exception if called when running as a portlet
                hostAndPort = request.getServerName() + ":" + request.getServerPort();
            }else{ /*************this is the new code that need to be added ************/

            PortletRequest portletRequest = (PortletRequest) request.getAttribute("javax.portlet.request");

            log.debug("CheckoutConfirmationSubmitAction.execute() -- portletRequest : "+portletRequest);
            log.debug("CheckoutConfirmationSubmitAction.execute() -- ServerName : "+portletRequest.getServerName());
            log.debug("CheckoutConfirmationSubmitAction.execute() -- ServerHost : "+portletRequest.getServerPort());

            hostAndPort = portletRequest.getServerName() + ":" + portletRequest.getServerPort();
            }
.....
}


2) You need to alter/increase "configuration_value' column size. By default it is 256.

ALTER TABLE `konakart`.`configuration` CHANGE COLUMN `configuration_value` `configuration_value` VARCHAR(1000) NOT NULL ;

3) Change Callback URL
http://PUBLICIP:PORT/web/guest/shop?p_p_id=KonaKart_Storefront_WAR_konakart&p_p_lifecycle=0&p_p_state=normal&p_p_mode=view&p_p_col_id=column-1&p_p_col_count=1&_KonaKart_Storefront_WAR_konakart_struts.portlet.action=%2FPayPalCallback.action&_KonaKart_Storefront_WAR_konakart_struts.portlet.mode=view

4) Change Return URL
http://PUBLICIP:PORT/web/guest/shop?p_p_id=KonaKart_Storefront_WAR_konakart&p_p_lifecycle=0&p_p_state=normal&p_p_mode=view&p_p_col_id=column-1&p_p_col_count=1&_KonaKart_Storefront_WAR_konakart_struts.portlet.action=%2FCheckoutFinished.action&_KonaKart_Storefront_WAR_konakart_struts.portlet.mode=view

5) Cancel URL
http://PUBLICIP:PORT/web/guest/shop?p_p_id=KonaKart_Storefront_WAR_konakart&p_p_lifecycle=0&p_p_state=normal&p_p_mode=view&p_p_col_id=column-1&p_p_col_count=1&_KonaKart_Storefront_WAR_konakart_struts.portlet.action=%2FCheckoutPaymentError.action&_KonaKart_Storefront_WAR_konakart_struts.portlet.mode=view

Note :
You need to enter your public ip and port which paypal can refer. Also, "shop" is a page where store front is added. You can change accordingly.

Hope this helps

Let me know if you need any other help.

Thanks,
Laxman Rana
www.surekhatech.com

Tortolo

Quote from: Laxman Rana on May 13, 2014, 04:00:10 pm

You need to enter your public ip and port which paypal can refer. Also, "shop" is a page where store front is added. You can change accordingly.


Hi, thanks for the helpful post but where do I find the public ip? Is that the ip that my site is hosted on? Does it need to be a dedicated ip?