新增创建订单发起支付

This commit is contained in:
2023-03-03 10:50:17 +08:00
parent e620c3f360
commit e13dcd1998
7 changed files with 202 additions and 12 deletions
+20
View File
@@ -4,6 +4,8 @@ namespace App\Controller;
use App\Request\InquiryRequest;
use App\Services\InquiryService;
use Extend\Wechat\WechatPay;
use Hyperf\Snowflake\IdGeneratorInterface;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
use Psr\Http\Message\ResponseInterface;
@@ -49,4 +51,22 @@ class InquiryController extends AbstractController
$data = $InquiryService->getPatientInquiryCase();
return $this->response->json($data);
}
public function addInquiryOrderTest(){
$WechatPay = new WechatPay(2);
$generator = $this->container->get(IdGeneratorInterface::class);
$out_trade_no = $generator->generate();
dump($out_trade_no);
// 获取jsapi的prepay_id
$total = 100;
$openid = "o9gYG441zEAHuYoNX7lwFKiQBzKE";
$result = $WechatPay->getJsapiPrepayId($out_trade_no,$total,$openid);
// 获取小程序支付配置
$config = $WechatPay->getAppletsPayConfig($result['prepay_id']);
dump($config);
}
}
+17
View File
@@ -0,0 +1,17 @@
<?php
namespace App\Controller;
use App\Utils\Log;
/**
* 支付
*/
class PayController extends AbstractController
{
// 微信支付回调
public function wxCallBack(){
$request_params = $this->request->all();
Log::getInstance()->info(json_encode($request_params,JSON_UNESCAPED_UNICODE));
}
}