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.
30 lines
743 B
PHTML
30 lines
743 B
PHTML
2 years ago
|
<?php
|
||
|
|
||
|
declare(strict_types=1);
|
||
|
|
||
|
namespace App\Controller\Payment;
|
||
|
|
||
|
use App\Request\JsapiPayRequest;
|
||
|
use Hyperf\HttpServer\Contract\RequestInterface;
|
||
|
use App\Service\PaymentService;
|
||
|
|
||
|
class PayController extends AbstractController
|
||
|
{
|
||
|
private PaymentService $paymentService;
|
||
|
|
||
|
public function __construct(PaymentService $paymentService)
|
||
|
{
|
||
|
$this->paymentService = $paymentService;
|
||
|
}
|
||
|
|
||
|
public function jsapi(RequestInterface $request)
|
||
|
{
|
||
|
$form = new JsapiPayRequest($request->all());
|
||
|
$order = $this->paymentService->jsapiPay($form->getApp(), $form->getData());
|
||
|
return $this->success([
|
||
|
'pay_url' => $order->pay_url,
|
||
|
'order_no' => $order->order_no,
|
||
|
]);
|
||
|
}
|
||
|
}
|