elf 1 year ago
parent 4d1b34bf26
commit 4c7d99a894

@ -45,7 +45,7 @@ class MineCommand extends HyperfCommand
public function handle(): void
{
$this->unionPay();
$this->queryOrder();
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]);
@ -359,4 +359,17 @@ class MineCommand extends HyperfCommand
$result = $paymentService->payment($data, $this->getApp(), $this->getToken());
var_dump($result);
}
public function queryOrder()
{
/**
* @var PaymentService $paymentService
*/
$paymentService = $this->container->make(PaymentService::class);
$data = [
'outOrderNo' => '2023081910162800001',
];
$order = $paymentService->queryOrder($data, $this->getApp());
var_dump($order->toArray());
}
}

@ -145,4 +145,16 @@ class PaymentController extends AbstractController
];
return $this->success($result);
}
public function queryOrder(RequestInterface $request)
{
[$app, $data, $token] = $this->parseReqest($request, UnbindCardRequest::class);
$order = $this->paymentService->queryOrder($data, $app);
$result = [
'finishTime' => $order->finished_at,
'amount' => $order->amount,
'status' => $order->status,
];
return $this->success($result);
}
}

@ -15,6 +15,11 @@ class ApiList
'url' => '/api/cust/v3.0.0/bindCard',
'signParams' => 'orgNo|merchantNo|terminalNo|loginNo|requestDate|cardNo|bankMobile',
],
'query-order' => [
'description' => '交易订单信息查询',
'url' => '/api/wallet/v3.0.0/queryOrder',
'signParams' => 'orgNo|merchantNo|terminalNo|requestDate|tradeId',
],
'bind-card-check' => [
'description' => '个人银行卡签约-确认绑卡',
'url' => '/api/cust/v3.0.0/bindCardCheck',

@ -466,4 +466,11 @@ class Baofu
$data['authContent'] = $params['authContent'];
return $this->api('auth-bind', $data);
}
public function queryOrder($params){
$data = [];
$data['loginNo'] = $params['loginNo'];
$data['tradeId'] = $params['tradeId'];
return $this->api('query-order', $data);
}
}

@ -471,4 +471,35 @@ class PaymentService extends AbstractService
throw $e;
}
}
public function queryOrder(array $data, App $app)
{
$order = Order::where('app_id', $app->app_id)->where('out_order_no', $data['outOrderNo'])->first();
if (empty($order)) {
throw new BusinessException('订单不存在');
}
try {
$baofu = new Baofu();
$result = $baofu->queryOrder([
'loginNo' => $order->member_id,
'tradeId' => $order->order_no,
]);
$info = [
'member_id' => $order->member_id,
'order_no' => $order->order_no,
'third_order_no' => $result['requestNo'] ?? '',
'status' => $result['status'],
'amount' => $result['amount'],
'finished_at' => $result['finishDate'],
'error_message' => $result['errorMsg'] ?? '',
'transaction_id' => $result['transactionId'] ?? '',
'out_transaction_id' => $result['outTransactionId'] ?? '',
];
return $this->updateOrder($info);
} catch (ApiException $e) {
throw $e;
}
}
}

@ -20,6 +20,7 @@ Router::addGroup('/payment',function () {
Router::post('/pwd-modify', [PaymentController::class, 'pwdModify']);
Router::post('/payment', [PaymentController::class, 'payment']);
Router::post('/confirm-pay', [PaymentController::class, 'payment']);
Router::post('/query-order', [PaymentController::class, 'queryOrder']);
Router::post('/transfer-pay', [PaymentController::class, 'transferPay']);
Router::post('/query-bind-cards', [PaymentController::class, 'queryBindCards']);
Router::post('/query-user', [PaymentController::class, 'queryUser']);

Loading…
Cancel
Save