Sylius\Bundle\PayumBundle\Controller\PayumController::prepareCaptureAction PHP Method

prepareCaptureAction() public method

public prepareCaptureAction ( Request $request, mixed $tokenValue ) : Response
$request Symfony\Component\HttpFoundation\Request
$tokenValue mixed
return Symfony\Component\HttpFoundation\Response
    public function prepareCaptureAction(Request $request, $tokenValue)
    {
        $configuration = $this->requestConfigurationFactory->create($this->orderMetadata, $request);
        $order = $this->orderRepository->findOneByTokenValue($tokenValue);
        if (null === $order) {
            throw new NotFoundHttpException(sprintf('Order with token "%s" does not exist.', $tokenValue));
        }
        $request->getSession()->set('sylius_order_id', $order->getId());
        $options = $configuration->getParameters()->get('redirect');
        $payment = $order->getLastNewPayment();
        if (null === $payment) {
            throw new NotFoundHttpException(sprintf('Order with token "%s" has no pending payments.', $tokenValue));
        }
        $captureToken = $this->getTokenFactory()->createCaptureToken($payment->getMethod()->getGateway(), $payment, isset($options['route']) ? $options['route'] : null, isset($options['parameters']) ? $options['parameters'] : []);
        $view = View::createRedirect($captureToken->getTargetUrl());
        return $this->viewHandler->handle($configuration, $view);
    }