From def4b0c04c64a3deec41a87fcaf9ee5b4277d674 Mon Sep 17 00:00:00 2001 From: baptiste Date: Tue, 20 Sep 2016 14:43:02 +0200 Subject: [PATCH] return orderId on success response --- Controller/PaymentController.php | 11 ++++++----- Helper/PaymentHelper.php | 7 ++++--- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Controller/PaymentController.php b/Controller/PaymentController.php index 0d3b18c..94fde70 100644 --- a/Controller/PaymentController.php +++ b/Controller/PaymentController.php @@ -193,22 +193,23 @@ public function paymentFinalizeSecureAction(Request $request, $orderId) $this->get('translator')->trans('appventus_mangopay.alert.pre_authorisation.success') ); - return $this->redirect($this->get('appventus_mangopay.payment_helper')->generateSuccessUrl()); + return $this->redirect($this->get('appventus_mangopay.payment_helper')->generateSuccessUrl($orderId)); } /** * @param Request $request The request + * @param int $orderId * * This method shows the congratulations * - * @Route("/success", name="appventus_mangopaybundle_payment_success") - * + * @Route("/success/{orderId}", name="appventus_mangopaybundle_payment_success") * @return Response */ - public function successAction(Request $request) + public function successAction(Request $request, $orderId) { return $this->render( - 'AppVentusMangopayBundle::success.html.twig' + 'AppVentusMangopayBundle::success.html.twig', + [ 'orderId' => $orderId ] ); } } diff --git a/Helper/PaymentHelper.php b/Helper/PaymentHelper.php index b5d0d36..7781f73 100644 --- a/Helper/PaymentHelper.php +++ b/Helper/PaymentHelper.php @@ -59,7 +59,7 @@ public function prepareCardRegistrationCallback(User $user, Order $order) ) ); - $successRedirect = $this->generateSuccessUrl(); + $successRedirect = $this->generateSuccessUrl($order->getId()); return array( 'callback' => 'payAjaxOrRedirect("' @@ -195,8 +195,9 @@ public function cancelPreAuthForOrder(Order $order, CardPreAuthorisation $preAut } } - public function generateSuccessUrl() + public function generateSuccessUrl($orderId) { - return $this->router->generate('appventus_mangopaybundle_payment_success'); + return $this->router->generate('appventus_mangopaybundle_payment_success', ['orderId' => $orderId]); } + }