Example #1
0
 /**
  * @param Request $request
  * @param $lastNewPaymentId
  *
  * @return Response
  */
 public function prepareCaptureAction(Request $request, $lastNewPaymentId)
 {
     $configuration = $this->requestConfigurationFactory->create($this->paymentMetadata, $request);
     $payment = $this->paymentRepository->find($lastNewPaymentId);
     Assert::notNull($payment);
     $request->getSession()->set('sylius_order_id', $payment->getOrder()->getId());
     $captureToken = $this->getTokenFactory()->createCaptureToken($payment->getMethod()->getGateway(), $payment, $configuration->getParameters()->get('redirect[route]', null, true), $configuration->getParameters()->get('redirect[parameters]', [], true));
     $view = View::createRedirect($captureToken->getTargetUrl());
     return $this->viewHandler->handle($configuration, $view);
 }
Example #2
0
 /**
  * @Then /^there should be no ("[^"]+" payments) in the registry$/
  */
 public function paymentShouldNotExistInTheRegistry(PaymentMethodInterface $paymentMethod)
 {
     $payments = $this->paymentRepository->findBy(['method' => $paymentMethod]);
     Assert::same($payments, []);
 }
Example #3
0
 function it_throws_an_exception_if_payment_still_exist(PaymentRepositoryInterface $paymentRepository, PaymentMethodInterface $paypalPaymentMethod, PaymentInterface $payment)
 {
     $paymentRepository->findBy(['method' => $paypalPaymentMethod])->willReturn([$payment]);
     $this->shouldThrow(NotEqualException::class)->during('paymentShouldNotExistInTheRegistry', [$paypalPaymentMethod]);
 }
Example #4
0
 /**
  * @Then /^there should be no ("[^"]+" payments) in the registry$/
  */
 public function paymentShouldNotExistInTheRegistry(PaymentMethodInterface $paymentMethod)
 {
     $payments = $this->paymentRepository->findBy(['method' => $paymentMethod]);
     expect($payments)->toBe([]);
 }