/** * @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); }
/** * @Then /^there should be no ("[^"]+" payments) in the registry$/ */ public function paymentShouldNotExistInTheRegistry(PaymentMethodInterface $paymentMethod) { $payments = $this->paymentRepository->findBy(['method' => $paymentMethod]); Assert::same($payments, []); }
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]); }
/** * @Then /^there should be no ("[^"]+" payments) in the registry$/ */ public function paymentShouldNotExistInTheRegistry(PaymentMethodInterface $paymentMethod) { $payments = $this->paymentRepository->findBy(['method' => $paymentMethod]); expect($payments)->toBe([]); }