This method can be called by a payment gateway to provide
automated integration.

This action performs some basic setup then hands control directly
to the payment handler's "callback" action.

@param $request Current Request Object
682
public function callback($request)
    {
        // If post data exists, process. Otherwise provide error
        if ($this->payment_handler === null) {
            // Redirect to error page
            return $this->redirect(Controller::join_links(
                Director::BaseURL(),
                $this->config()->url_segment,
                'complete',
                'error'
            ));
        }
        
        // Hand the request over to the payment handler
        return $this
            ->payment_handler
            ->handleRequest($request, $this->model);
    }
18593
public function execute($request): void
    {
        RequestNotSupportedException::assertSupports($this, $request);

        /** @var SyliusPaymentInterface $payment */
        $payment = $request->getModel();

        /** @var OrderInterface $order */
        $order = $payment->getOrder();

        $this->gateway->execute($status = new GetStatus($payment));
        if ($status->isNew()) {
            try {
                $this->gateway->execute($convert = new Convert($payment, 'array', $request->getToken()));
                $payment->setDetails($convert->getResult());
            } catch (RequestNotSupportedException $e) {
                $totalAmount = $order->getTotal();
                $payumPayment = new PayumPayment();
                $payumPayment->setNumber($order->getNumber());
                $payumPayment->setTotalAmount($totalAmount);
                $payumPayment->setCurrencyCode($order->getCurrencyCode());
                $payumPayment->setClientEmail($order->getCustomer()->getEmail());
                $payumPayment->setClientId($order->getCustomer()->getId());
                $payumPayment->setDescription($this->paymentDescriptionProvider->getPaymentDescription($payment));
                $payumPayment->setDetails($payment->getDetails());

                $this->gateway->execute($convert = new Convert($payumPayment, 'array', $request->getToken()));
                $payment->setDetails($convert->getResult());
            }
        }

        $details = ArrayObject::ensureArrayObject($payment->getDetails());

        try {
            $request->setModel($details);
            $this->gateway->execute($request);
        } finally {
            $payment->setDetails((array) $details);
        }
    }
1324364
public function execute($request)
    {
        RequestNotSupportedException::assertSupports($this, $request);

        /** @var PaymentInterface $payment */
        $payment = $request->getSource();

        $this->gateway->execute($currency = new GetCurrency($payment->getCurrencyCode()));
        $divisor = pow(10, $currency->exp);

        $details = ArrayObject::ensureArrayObject($payment->getDetails());

        $details['VendorTxCode'] = $payment->getNumber();
        $details['Amount'] = $payment->getTotalAmount() / $divisor;
        $details['Currency'] = $payment->getCurrencyCode();
        $details['Description'] = $payment->getDescription();
        $details['CustomerEMail'] = $payment->getClientEmail();

        $request->setResult((array) $details);
    }
1123829
public function resultAction(Request $request)
    {
        try {
            $this
                ->gestpayManager
                ->processResult($request->query->all());
        } catch (PaymentException $e) {
            $this
                ->logger
                ->log(
                    'error',
                    'Gestpay error "'.$e->getMessage(),
                    GestpayMethod::METHOD_NAME
                );
        }

        return new Response('OK');
    }
557901
public function setRequest($request)
    {
        $return = parent::setRequest($request);
        $this->setURLParams($this->getRequest()->allParams());

        return $return;
    }
603401
private function cors($request)
  {
    $origin  = $request->server->http_origin;
    $allowed = Config::get('cors.allowedOrigins');

    if (in_array('*', $allowed) || in_array($origin, $allowed) ) {
      $this->withHeaders($request);
    }
  }
1061223
protected function signRequest($request)
    {
        $url = $request->getUrl(true);
        $url->getQuery()->add('key', $this->key);

        $request->setUrl($url);
    }
1092794
public function doRequest($request)
    {
        $this->createApplication();
        $zendRequest = $this->application->getRequest();

        $uri = new HttpUri($request->getUri());
        $queryString = $uri->getQuery();
        $method = strtoupper($request->getMethod());

        $zendRequest->setCookies(new Parameters($request->getCookies()));

        $query = [];
        $post = [];
        $content = $request->getContent();
        if ($queryString) {
            parse_str($queryString, $query);
        }

        if ($method !== HttpRequest::METHOD_GET) {
            $post = $request->getParameters();
        }

        $zendRequest->setQuery(new Parameters($query));
        $zendRequest->setPost(new Parameters($post));
        $zendRequest->setFiles(new Parameters($request->getFiles()));
        $zendRequest->setContent($content);
        $zendRequest->setMethod($method);
        $zendRequest->setUri($uri);
        $requestUri = $uri->getPath();
        if (!empty($queryString)) {
            $requestUri .= '?' . $queryString;
        }

        $zendRequest->setRequestUri($requestUri);

        $zendRequest->setHeaders($this->extractHeaders($request));
        $this->application->run();

        // get the response *after* the application has run, because other ZF
        //     libraries like API Agility may *replace* the application's response
        //
        $zendResponse = $this->application->getResponse();

        $this->zendRequest = $zendRequest;

        $exception = $this->application->getMvcEvent()->getParam('exception');
        if ($exception instanceof \Exception) {
            throw $exception;
        }

        $response = new Response(
            $zendResponse->getBody(),
            $zendResponse->getStatusCode(),
            $zendResponse->getHeaders()->toArray()
        );

        return $response;
    }
614616
public function execute($request)
    {
        RequestNotSupportedException::assertSupports($this, $request);

        $model = ArrayObject::ensureArrayObject($request->getModel());

        if (null === $model['error_code']) {
            $request->markNew();
            return;
        }

        if (self::SUCCESS === $model['error_code']) {
            $request->markCaptured();
            return;
        }

        $request->markFailed();

    }
223650
protected function doRequest($request)
    {
        if (!$this->firstRequest) {
            $this->initialize($request);
        }
        $this->firstRequest = false;

        $this->applyBindings();
        $this->applyContextualBindings();
        $this->applyInstances();
        $this->applyApplicationHandlers();

        $request = Request::createFromBase($request);
        $response = $this->kernel->handle($request);

        $method = new \ReflectionMethod(get_class($this->app), 'callTerminableMiddleware');
        $method->setAccessible(true);
        $method->invoke($this->app, $response);

        return $response;
    }
1201574
public function execute($request)
    {
        RequestNotSupportedException::assertSupports($this, $request);

        $details = ArrayObject::ensureArrayObject($request->getModel());

        if (isset($details['RtnCode']) === false) {
            $request->markNew();

            return;
        }

        if ($details['RtnCode'] === '2') {
            $request->markPending();

            return;
        }

        if ($details['RtnCode'] === '1') {
            if (isset($details['Action']) === true) {
                switch ($details['Action']) {
                    case 'C':
                        $request->markCaptured();
                        break;
                    case 'R':
                        $request->markRefunded();
                        break;
                    case 'E':
                    case 'N':
                        $request->markCanceled();
                        break;
                }

                return;
            } else {
                $request->markCaptured();

                return;
            }
        }

        $request->markFailed();
    }
361067
public function handleClientRequest($request)
    {
        $this->client_data->m = substr($request->server['path_info'], 1);
        $this->client_data->p = $request->get;
    }
492551
private function createRequest(Request $request = null): void
    {
        if (!$this->request && is_null($request)) {
            $request = ServerRequest::fromGlobals()
                ->withParsedBody(json_decode(file_get_contents('php://input')));
        }

        $this->container->set(Request::class, $request);
        $this->request = $request;
    }
312250
public function execute($request)
    {
        RequestNotSupportedException::assertSupports($this, $request);


        $details = ArrayObject::ensureArrayObject($request->getModel());

        /** if no payment type provided in config, execute a choose payment type action
         so that user can choose the payment type*/
        if ($details[PayBoxRequestParams::PBX_TYPEPAIEMENT] == null
            && $this->api->getOptions()['type_paiement'] == null) {
            $choosePaymentTypeRequest = new ChoosePaymentType($details);
            $this->gateway->execute($choosePaymentTypeRequest);
        }

        $httpRequest = new GetHttpRequest();
        $this->gateway->execute($httpRequest);

        if (isset($httpRequest->query['error_code'])) {
            $details->replace($httpRequest->query);
        } else {
            $this->api->doPayment((array)$details);
        }
    }
384294
public function callback($request)
    {
        $this->extend('onBeforeCallback');
        
        $data = $this->request->postVars();
        $status = "error";
        $order_id = 0;
        $payment_id = 0;

        $error_url = Controller::join_links(
            Director::absoluteBaseURL(),
            Payment_Controller::config()->url_segment,
            'complete',
            'error'
        );

        $vars = array(
            "SiteConfig" => SiteConfig::current_site_config(),
            "RedirectURL" => $error_url
        );

        // Check if CallBack data exists and install id matches the saved ID
        if (
            isset($data) && // Data and order are set
            (isset($data['instId']) && isset($data['cartId']) && isset($data['transStatus']) && isset($data["callbackPW"])) && // check required
            $this->payment_gateway->InstallID == $data['instId'] && // The current install ID matches the postback ID
            $this->payment_gateway->ResponsePassword == $data["callbackPW"]
        ) {
            $order_id = $data['cartId'];
            $payment_id = $data['transId'];
            $status = $data['transStatus'];
            
            $success_url = Controller::join_links(
                Director::absoluteBaseURL(),
                Payment_Controller::config()->url_segment,
                'complete',
                $order_id
            );

            if ($data['transStatus'] == 'Y') {
                $status = 'paid';
                $vars["RedirectURL"] = $success_url;
            } else {
                $status = 'failed';
            }
        } else {
            return $this->httpError(500);
        }
        
        $payment_data = ArrayData::array_to_object(array(
            "OrderID" => $order_id,
            "PaymentProvider" => "WorldPay",
            "PaymentID" => $payment_id,
            "Status" => $status,
            "GatewayData" => $data
        ));
        
        $this
            ->setPaymentData($payment_data)
            ->customise($vars);
        
        $this->extend('onAfterCallback');
        
        return $this->renderWith(array("Worldpay_callback"));
    }
167884
private function setRequest(Request $request = null)
    {
        $this->request = $request;
        $this->override = null;
    }
762810
public function handleRequest($request = null)
    {
        $this->submitted = true;

        $requestData = $this->requestHandler->handleRequest($this, $request);

        $validRequestData = $this->checkFieldsSubmitted($this->fields, $requestData);

        if ($this->submitted === true && !empty($validRequestData)) {
            $this->data = $validRequestData;
            $this->setRequiredFieldErrors();
        }
        else {
            $this->submitted = false;
        }

        if (isset($this->restoreDataHandler)) {
            if ($this->isSubmitted()) {
                $this->restoreDataHandler->setRestorableData($this, $this->data, $request);
            }
            else {
                $restoredData = $this->restoreDataHandler->restoreData($this, $request);

                if (is_array($restoredData) && !empty($restoredData)) {
                    $this->data = $restoredData;
                }
            }
        }

        if (isset($this->eventDispatcher)) {
            $event = new FormHandlerRequestEvent($this, $request, $this->data);
            $this->eventDispatcher->dispatch('form_handler.request', $event);
            $this->data = $event->getFormData();
        }
    }