Skip to content

Commit

Permalink
return orderId on success response
Browse files Browse the repository at this point in the history
  • Loading branch information
BFoucher committed Sep 20, 2016
1 parent f46b25f commit def4b0c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
11 changes: 6 additions & 5 deletions Controller/PaymentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ]
);
}
}
7 changes: 4 additions & 3 deletions Helper/PaymentHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function prepareCardRegistrationCallback(User $user, Order $order)
)
);

$successRedirect = $this->generateSuccessUrl();
$successRedirect = $this->generateSuccessUrl($order->getId());

return array(
'callback' => 'payAjaxOrRedirect("'
Expand Down Expand Up @@ -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]);
}

}

0 comments on commit def4b0c

Please sign in to comment.