ljl 1 year ago
parent 5143e96d14
commit 4577a9492a

@ -4,6 +4,7 @@ declare(strict_types=1);
namespace App\Command;
use App\Helper\Baofu\Baofu;
use App\Helper\Log;
use App\Helper\Platform\Notification;
use App\Helper\Platform\Signer;
@ -45,7 +46,7 @@ class MineCommand extends HyperfCommand
public function handle(): void
{
$this->getRequestData();
$this->paymentNotify();
return;
// $this->notify('http://ceshi-shop.hkcpex.com/index.php/pay/notify/baofu_f_register', $this->getApp(), ['userId' => '30684']);
$this->notify('http://ceshi-shop.hkcpex.com/index.php/pay/notify/baofu_f_bind_card', $this->getApp(), ['userId' => '23121', 'bindCardFlag' => true]);
@ -404,4 +405,57 @@ class MineCommand extends HyperfCommand
$order = $paymentService->queryOrder($data, $this->getApp());
var_dump($order->toArray());
}
public function paymentNotify() {
/**
* @var PaymentService $paymentService
*/
$paymentService = $this->container->make(PaymentService::class);
/**
* @var RequestService $requestService
*/
$requestService = $this->container->make(RequestService::class);
$params = json_decode('{"orgNo":"1274207","merchantNo":"1274207","terminalNo":"82254","orderStatus":"FINISH","tradeId":"2023082115523700001","paidType":"","orderMoney":"100","loginId":"1f32d22ff571ebc692bd50785c883ca8","finishTime":"20230821155509","orderId":"23082100711351457","errorMsg":"成功","signature":"c369c2670607f4e840d7a9644e854da9b1858aa9df1c465fa893b8a9610bde561704fe8f63af41cb1528f601a6fafcbb42ec7fa4838cdc76dc86593ae0c60ae15bae227e60a82ce376a4a7c137047f3db0bb366c21e484458abed0bb9135b653948f90b7d0b4c89d29e0b1939915c80d49c6e6cc0549a1eb84fb2c14704d81fd"}', true);
$token = 'f49e9fc5bf6f4768fb47a5721ede7d47';
$baofu = new Baofu();
if (!$baofu->notifyVerify($params, 'payment')) {
Log::info('paymentNotifyVerifyFail: ', $params);
return $baofu->notifySuccess();
}
$requestLog = $requestService->getRequestLogByToken($token);
$info = [
'member_id' => $params['loginId'],
'order_no' => $params['tradeId'],
'third_order_no' => $params['orderId'],
'status' => $params['orderStatus'],
'amount' => $params['orderMoney'],
'finished_at' => $params['finishTime'],
'error_message' => $params['errorMsg'],
'transaction_id' => $params['transactionId'] ?? '',
'out_transaction_id' => $params['outTransactionId'] ?? '',
];
$order = $paymentService->updateOrder($info, ['APPLY_SUCCESS', 'PROCESS', 'CONFIRM_SUCCESS']);
if (empty($order)) {
return $baofu->notifySuccess();
}
$result = $this->notify(
$requestLog->getDataValue('notifyUrl'),
$requestLog->app,
[
'amount' => $order->amount,
'status' => $order->status,
'userId' => $order->user_id,
'orderNo' => $order->order_no,
'outOrderNo' => $order->out_order_no,
'finishTime' => $order->finished_at,
]
);
$baofu->notifySuccess();
}
}
Loading…
Cancel
Save