You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
payment/app/Controller/Payment/ReturnController.php

28 lines
799 B
PHP

<?php
declare(strict_types=1);
namespace App\Controller\Payment;
use App\Service\RequestService;
use Hyperf\HttpServer\Contract\RequestInterface;
use Hyperf\HttpServer\Contract\ResponseInterface;
use Psr\Http\Message\ResponseInterface as Psr7ResponseInterface;
class ReturnController extends AbstractController
{
private RequestService $requestService;
public function __construct(RequestService $requestService)
{
$this->requestService = $requestService;
}
public function go(RequestInterface $request, ResponseInterface $response): Psr7ResponseInterface
{
$token = $request->route('token');
$requestLog = $this->requestService->getRequestLogByToken($token);
return $response->redirect($requestLog->getDataValue('return_url'));
}
}