更新支付回调

This commit is contained in:
yaooo 2023-09-23 16:32:37 +08:00
parent d0b44d71d3
commit 6058a4e21a
2 changed files with 16 additions and 43 deletions

View File

@ -64,46 +64,21 @@ class Auth extends BaseController
{
public function dotest()
{
$notify = [
'mchid' => '1635725673',
'appid' => 'wx9d68c92b550ddd1e',
'out_trade_no' => 'bzj20230923161859650e9f73c308f',
'transaction_id' => '4200001919202309239135900670',
'trade_type' => 'APP',
'trade_state' => 'SUCCESS',
'trade_state_desc' => '支付成功',
'bank_type' => 'OTHERS',
'attach' => 'margin',
'success_time' => '2023-09-23T16:19:07+08:00',
'payer' => [
'openid' => 'okLE26lLqzkfg9cdxoSuPd6ApHyo',
],
'amount' => [
'total' => 1,
'payer_total' => 1,
'currency' => 'CNY',
'payer_currency' => 'CNY',
],
'scene_info' => [
'device_id' => 'shop system',
]
$repository = app()->make(StoreOrderRepository::class);
$param = [
"status" => 0,
"is_del" => 0,
"mer_id" => 1,
"pay_type" => 1,
"attach" => "margin",
"order_info" => '{"is_margin":1,"margin":"0.01"}',
"pay_price" => 0.01,
"order_sn" => "bzj" . date('YmdHis') . uniqid(),
"body" =>'哈哈哈',
];
event('pay_success_margin', ['order_sn' => $notify['out_trade_no'], 'data' => $notify, 'is_combine' => 0]);
// $repository = app()->make(StoreOrderRepository::class);
// $param = [
// "status" => 0,
// "is_del" => 0,
// "mer_id" => 1,
// "pay_type" => 1,
// "attach" => "margin",
// "order_info" => '{"is_margin":1,"margin":"0.01"}',
// "pay_price" => 0.01,
// "order_sn" => "bzj" . date('YmdHis') . uniqid(),
// "body" =>'哈哈哈',
// ];
// $payType = 'weixinApp';
// $service = new PayService($payType, $param);
// $payInfo = $service->pay(User::where(['uid'=>1])->find());
$payType = 'weixinApp';
$service = new PayService($payType, $param);
$payInfo = $service->pay(User::where(['uid'=>1])->find());
return app('json')->success([]);
}

View File

@ -590,9 +590,8 @@ class WechatService
$this->application->payment = new PaymentService($this->application->merchant);
//TODO 微信支付
return $this->application->payment->handleNotify(function ($notify, $successful) {
Log::info('微信支付成功回调000' . var_export($notify, 1));
Log::info('微信支付成功回调' . var_export($notify, 1));
if (!$successful) return false;
Log::info('微信支付成功回调111' . var_export($notify, 1));
try {
event('pay_success_' . $notify['attach'], ['order_sn' => $notify['out_trade_no'], 'data' => $notify, 'is_combine' => 0]);
} catch (\Exception $e) {
@ -606,9 +605,8 @@ class WechatService
public function handleNotifyV3()
{
return $this->application->v3Pay->handleNotify(function ($notify, $successful) {
Log::info('微信支付成功回调0' . var_export($notify, 1));
Log::info('微信支付成功回调' . var_export($notify, 1));
if (!$successful) return false;
Log::info('微信支付成功回调222' . var_export($notify, 1));
try {
event('pay_success_' . $notify['attach'], ['order_sn' => $notify['out_trade_no'], 'data' => $notify, 'is_combine' => 0]);
} catch (\Exception $e) {