thelia-modules / PayPal

Paypal module for Thelia ecommerce solution
8 stars 28 forks source link

Cannot commit because a nested transaction was rolled back #32

Open MageGaHell opened 7 years ago

MageGaHell commented 7 years ago

Hello, i've juts installed this PayPal module (v3.0.4), by .zip, on a Thelia v2.3.3 and i'm trying to make it work on sandbox mode.

After login in my sandbox client PayPal account and select the paiement from PayPal Balance, i've this error:

RollbackException in ConnectionWrapper.php line 228:
Cannot commit because a nested transaction was rolled back
in ConnectionWrapper.php line 228
at ConnectionWrapper->commit() in PayPalResponseController.php line 502
at PayPalResponseController->executeExpressCheckoutAction(false) in PayPalResponseController.php line 200
at PayPalResponseController->invoiceExpressCheckoutOkAction('9050')
at call_user_func_array(array(object(PayPalResponseController), 'invoiceExpressCheckoutOkAction'), array('9050')) in HttpKernel.php line 139
at HttpKernel->handleRaw(object(Request), '1') in HttpKernel.php line 62
at HttpKernel->handle(object(Request), '1', true) in TheliaHttpKernel.php line 76
at TheliaHttpKernel->handle(object(Request), '1', true) in ParamInitMiddleware.php line 87
at ParamInitMiddleware->handle(object(Request), '1', true) in SessionMiddleware.php line 80
at SessionMiddleware->handle(object(Request), '1', true) in StackedHttpKernel.php line 23
at StackedHttpKernel->handle(object(Request), '1', true) in Kernel.php line 185
at Kernel->handle(object(Request)) in index_dev.php line 37

URL : /index_dev.php/module/paypal/invoice/express/checkout/ok/9050?paymentId=PAY-25396479JU317294DLC7JEJQ&token=EC-44147866VW5330942&PayerID=J8W83ZED6ECZN

In the module log, i've have: 03-07-2017 10:58:04 Cannot commit because a nested transaction was rolled back critical_500 03-07-2017 10:58:03 Module "Carousel" is not a payment module critical_500 03-07-2017 10:58:01 Express checkout begin with cart 9050 critical_100

Weird. Why it check the "Carousel" Module ?

Any idea for making PayPal work ?

TheCoreDev31 commented 4 years ago

Any idea ??? I'm interested too !

TheCoreDev31 commented 4 years ago

Problem seems to be that Paypal's delivery module search method doesn't filter correctly on module's type. It returns the first module he encounters, whatever it is a delivery module or not. In your case, it returns "Carousel", in my case, it returns "Cheque" ou "Front".

$deliveryModule = ModuleQuery::create()->filterByActivate(1)->findOne();

TheCoreDev31 commented 4 years ago

I suggest this modification, line 386 of PayPal/Controller/PayPalResponseController.php :

/* @var \Thelia\Model\Module $deliveryModule / /$deliveryModule = ModuleQuery::create()->filterByActivate(1)->findOne();/ $order = $this->getSession()->getOrder(); if (null !== $order) { $deliveryModule = $order->getModuleRelatedByDeliveryModuleId(); }

roadster31 commented 4 years ago

Could you please make a PR ?