/** * Payment execution. * * @return Response */ public function executeAction() { /** * The execute action will generate the Paypal web * checkout form before redirecting. */ $formView = $this->redsysManager->processPayment(); return new Response($this->templatingEngine->render('PaypalWebCheckoutBundle:Paypal:process.html.twig', ['paypal_form' => $formView])); }
/** * Payment execution. * * @return Response */ public function executeAction() { /** * The execute action will generate the Redsys * checkout form before redirecting */ $formView = $this->redsysManager->processPayment(); return new Response($this->templatingEngine->render('RedsysBundle:Redsys:process.html.twig', ['redsys_form' => $formView])); }
/** * Payment execution. * * @param Request $request Request element * * @return RedirectResponse */ public function resultAction(Request $request) { $redirectRoute = $this->redirectionRoutes->getRedirectionRoute('success'); try { $this->redsysManager->processResult($request->request->all()); } catch (PaymentException $e) { /** * Must redirect to fail route. */ $redirectRoute = $this->redirectionRoutes->getRedirectionRoute('failure'); } $redirectUrl = $this->urlGenerator->generate($redirectRoute->getRoute(), $redirectRoute->getRouteAttributes($this->paymentBridge->getOrderId())); return new RedirectResponse($redirectUrl); }
public function testPaymentSuccess() { $dsResponse = 0; $dsAuthorisationCode = '222FFF'; $dsCardCountry = 'ESP'; $dsCardType = 'y'; $dsConsumerLanguage = 'y'; $dsDate = 'X'; $dsHour = 'X'; $dsSecurePayment = '1'; $parameters = array('Ds_Date' => $dsDate, 'Ds_Hour' => $dsHour, 'Ds_Terminal' => '1', 'Ds_SecurePayment' => $dsSecurePayment, 'Ds_Signature' => '9A163AA5034368367665866E62D603A5A92C5D35', 'Ds_Response' => $dsResponse, 'Ds_Amount' => '99', 'Ds_Order' => '0001', 'Ds_MerchantCode' => '999008881', 'Ds_Currency' => '978', 'Ds_TransactionType' => '2', 'Ds_MerchantData' => 'Mis datos', 'Ds_Card_Country' => $dsCardCountry, 'Ds_AuthorisationCode' => $dsAuthorisationCode, 'Ds_ConsumerLanguage' => $dsConsumerLanguage, 'Ds_Card_Type' => $dsCardType); $this->paymentEventDispatcher->expects($this->once())->method('notifyPaymentOrderDone')->with($this->equalTo($this->paymentBridge)); $this->redsysMethod->expects($this->any())->method('setDsResponse')->with($this->equalTo($dsResponse))->will($this->returnValue($this->redsysMethod)); $this->redsysMethod->expects($this->any())->method('setDsAuthorisationCode')->with($this->equalTo($dsAuthorisationCode))->will($this->returnValue($this->redsysMethod)); $this->redsysMethod->expects($this->any())->method('setDsCardCountry')->with($this->equalTo($dsCardCountry))->will($this->returnValue($this->redsysMethod)); $this->redsysMethod->expects($this->any())->method('setDsCardType')->with($this->equalTo($dsCardType))->will($this->returnValue($this->redsysMethod)); $this->redsysMethod->expects($this->any())->method('setDsConsumerLanguage')->with($this->equalTo($dsConsumerLanguage))->will($this->returnValue($this->redsysMethod)); $this->redsysMethod->expects($this->any())->method('setDsDate')->with($this->equalTo($dsDate))->will($this->returnValue($this->redsysMethod)); $this->redsysMethod->expects($this->any())->method('setDsHour')->with($this->equalTo($dsHour))->will($this->returnValue($this->redsysMethod)); $this->redsysMethod->expects($this->any())->method('setDsSecurePayment')->with($this->equalTo($dsSecurePayment))->will($this->returnValue($this->redsysMethod)); $this->paymentEventDispatcher->expects($this->once())->method('notifyPaymentOrderDone')->with($this->equalTo($this->paymentBridge)); $this->paymentEventDispatcher->expects($this->once())->method('notifyPaymentOrderSuccess')->with($this->equalTo($this->paymentBridge)); $this->redsysManager->processResult($parameters); }