feat: 新增银行回调
This commit is contained in:
parent
46b747495b
commit
5804bf6daf
|
@ -73,9 +73,6 @@ class PaymentNew
|
||||||
}
|
}
|
||||||
// Guzzle HTTP client
|
// Guzzle HTTP client
|
||||||
$client = new Client();
|
$client = new Client();
|
||||||
// var_dump($orderId);
|
|
||||||
var_dump(1111111111111111111111111111111111111111111);
|
|
||||||
var_dump($PaymentChannelId);
|
|
||||||
// 请求数据
|
// 请求数据
|
||||||
$payload = [
|
$payload = [
|
||||||
"Amount" => $money,
|
"Amount" => $money,
|
||||||
|
@ -86,7 +83,7 @@ class PaymentNew
|
||||||
"PayeeBankName" => $payeeBankName,
|
"PayeeBankName" => $payeeBankName,
|
||||||
"PayeeIFSCCode" => "",
|
"PayeeIFSCCode" => "",
|
||||||
"PaymentChannelId" => $PaymentChannelId,
|
"PaymentChannelId" => $PaymentChannelId,
|
||||||
"ShopInformUrl" => "http://149.129.107.38",
|
"ShopInformUrl" => "http:/38.54.94.131/api/withdraw/callback",
|
||||||
"ShopOrderId" => $orderId . "",
|
"ShopOrderId" => $orderId . "",
|
||||||
"ShopUserLongId" => "776ae472-d4fc-435c-9639-be5763138d95"
|
"ShopUserLongId" => "776ae472-d4fc-435c-9639-be5763138d95"
|
||||||
];
|
];
|
||||||
|
|
|
@ -126,40 +126,48 @@ class WithdrawController
|
||||||
$withdraw = Withdraw::create([
|
$withdraw = Withdraw::create([
|
||||||
'user_id' => $user_id,
|
'user_id' => $user_id,
|
||||||
'amount' => $money,
|
'amount' => $money,
|
||||||
'status' => 2,
|
'status' => 1,
|
||||||
'createtime2' => date('Y-m-d H:i:s'),
|
'createtime2' => date('Y-m-d H:i:s'),
|
||||||
'username' => $user->username,
|
'username' => $user->username,
|
||||||
'status_text' => '已到账',
|
'status_text' => '申请中',
|
||||||
]);
|
]);
|
||||||
//获取刚刚存入数据库的id(订单号)
|
//获取刚刚存入数据库的id(订单号)
|
||||||
$orderId = $withdraw->id;
|
$orderId = $withdraw->id;
|
||||||
PaymentNew::pushMoney($money, $userbank->bank_username, $userbank->account, $userbank->bank_name,$orderId);
|
$res = PaymentNew::pushMoney($money, $userbank->bank_username, $userbank->account, $userbank->bank_name,$orderId);
|
||||||
// var_dump($res);
|
|
||||||
// //逻辑错误需要修改
|
// //逻辑错误需要修改
|
||||||
// if ($res['Success'] == 200) {
|
if ($res['Success']) {
|
||||||
// Withdraw::create([
|
$withdraw->update([
|
||||||
// 'user_id' => $user_id,
|
'status' => 2, //
|
||||||
// 'amount' => $money,
|
'status_text' => '已到账',
|
||||||
// 'status' => 2,
|
'order_number' => $res['TrackingNumber'] ?? null,
|
||||||
// 'createtime2' => date('Y-m-d H:i:s'),
|
]);
|
||||||
// 'username' => $user->username,
|
return ApiResponseApp::success(null, '转账成功');
|
||||||
// 'status_text' => '已到账',
|
} else {
|
||||||
// ]);
|
return ApiResponseApp::error(null, '转账失败');
|
||||||
// return ApiResponseApp::success(null, '转账成功');
|
}
|
||||||
// } else {
|
return ApiResponseApp::success(null, '转账成功');
|
||||||
// return ApiResponseApp::error(null, '转账失败');
|
|
||||||
// }
|
|
||||||
// return ApiResponseApp::success(null, '转账成功');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Apidoc\Title("请求回调")
|
* @Apidoc\Title("请求回调")
|
||||||
* @Apidoc\Url("api/withdraw/callback")
|
* @Apidoc\Url("api/withdraw/callback")
|
||||||
* @Apidoc\Method("GET")
|
* @Apidoc\Method("POST")
|
||||||
*/
|
*/
|
||||||
public function callback(Request $request)
|
public function callback(Request $request)
|
||||||
{
|
{
|
||||||
var_dump($request->all());
|
$callbackData = $request->all();
|
||||||
|
|
||||||
|
$orderId = $callbackData['TrackingNumber'] ?? null;
|
||||||
|
$failedMessage = $callbackData['FailedMessage'] ?? null;
|
||||||
|
$withdraw = Withdraw::where('order_number', $orderId)->first();
|
||||||
|
//$failedMessage为null就是成功
|
||||||
|
if ($failedMessage != null) {
|
||||||
|
$withdraw->update([
|
||||||
|
'status' => 3,
|
||||||
|
'status_text' => '支付失败: ' . $failedMessage,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue