diff --git a/core/lib/Thelia/Model/Module.php b/core/lib/Thelia/Model/Module.php index b967e484..117fa00a 100644 --- a/core/lib/Thelia/Model/Module.php +++ b/core/lib/Thelia/Model/Module.php @@ -275,7 +275,7 @@ class Module extends BaseModule $instance = $this->getModuleInstance($container); if (! $instance instanceof DeliveryModuleInterface) { - throw new \InvalidArgumentException(sprintf('Module "%s" is not a payment module', $this->getCode())); + throw new \InvalidArgumentException(sprintf('Module "%s" is not a delivery module', $this->getCode())); } return $instance; diff --git a/local/modules/PayPal/Controller/PayPalResponseController.php b/local/modules/PayPal/Controller/PayPalResponseController.php index ca5589af..50a2ab9f 100644 --- a/local/modules/PayPal/Controller/PayPalResponseController.php +++ b/local/modules/PayPal/Controller/PayPalResponseController.php @@ -384,7 +384,12 @@ class PayPalResponseController extends OrderController $deliveryAddress = $cart->getCustomer()->getDefaultAddress(); /** @var \Thelia\Model\Module $deliveryModule */ - $deliveryModule = ModuleQuery::create()->filterByActivate(1)->findOne(); + /*$deliveryModule = ModuleQuery::create()->filterByActivate(1)->findOne();*/ + $order = $this->getSession()->getOrder(); + if (null !== $order) { + $deliveryModule = $order->getModuleRelatedByDeliveryModuleId(); + } + /** @var \Thelia\Model\Module $paymentModule */ $paymentModule = ModuleQuery::create()->findPk(PayPal::getModuleId());