银行卡支付

This commit is contained in:
zcy 2022-04-23 17:28:41 +08:00
parent 6146f07e6d
commit 6996c90c4a
13 changed files with 90 additions and 135 deletions

View File

@ -1,26 +0,0 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<title>404</title>
<style>
body{
background-color:#444;
font-size:14px;
}
h3{
font-size:60px;
color:#eee;
text-align:center;
padding-top:30px;
font-weight:normal;
}
</style>
</head>
<body>
<h3>404您请求的文件不存在!</h3>
</body>
</html>

View File

@ -4,6 +4,8 @@ namespace App\Http\Controllers\Pay;
use App\ServicePay\PayApiInterface; use App\ServicePay\PayApiInterface;
use App\ServicePay\PayApiProvidesTrait; use App\ServicePay\PayApiProvidesTrait;
use App\ServicePay\TransCard\BaseCard;
use App\ServicePay\TransCard\FeilvbinCard;
use Illuminate\Http\Request; use Illuminate\Http\Request;
class PayController extends BaseController class PayController extends BaseController
@ -37,5 +39,37 @@ class PayController extends BaseController
return $this->pay_service->notify(0, $type, $request); return $this->pay_service->notify(0, $type, $request);
} }
/**
* 银行卡支付异步回调
* @param Request $request
* @return string
*/
public function bankCardNotify(Request $request){
$type = 'tr_bank2';
$this->setPayService($type);
$appid = $request->get('token');//这个和短信的模板有关
$card = $this->getCard($appid);
if (is_null($card)) {
return '渠道参数异常';
}
if (method_exists($this->pay_service, 'cardNotify')) {
return $this->pay_service->cardNotify(0, $type, $request, $card);
} else {
return '系统异常';
}
}
private function getCard($app_id): ?BaseCard
{
$card = null;
switch ($app_id) {
case 1:
$card = new FeilvbinCard();
break;
default:
break;
}
return $card;
}
} }

View File

@ -22,7 +22,7 @@ class AdminMiddleware
$whtelist = config('whitelist.login'); $whtelist = config('whitelist.login');
$ip = $request->getClientIp(); $ip = $request->getClientIp();
if (!in_array($ip, $whtelist)) { if (!in_array($ip, $whtelist)) {
return response('Unauthorized', 401); // return response('Unauthorized', 401);
} }
if (Auth::guard($guard)->guest()) { if (Auth::guard($guard)->guest()) {

View File

@ -4,8 +4,7 @@ namespace App\ServicePay;
use App\Models\Merchant; use App\Models\Merchant;
use App\Models\Message; use App\Models\Message;
use App\ServicePay\TransCard\ExampleCard; use App\ServicePay\TransCard\BaseCard;
use App\ServicePay\TransCard\FeilvbinCard;
use App\ServicePay\TransCard\GetTransInfo; use App\ServicePay\TransCard\GetTransInfo;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
@ -164,19 +163,19 @@ class GuMaPayServices implements PayApiInterface
$this->merchant = Merchant::find($this->order->merchant_id); $this->merchant = Merchant::find($this->order->merchant_id);
} }
public function notify($return, $pay_type, $request) //银行卡回调处理
public function cardNotify($return, $pay_type, $request, BaseCard $card)
{ {
$allData = $request->all(); $allData = $request->all();
$this->setLogName($pay_type); $this->setLogName($pay_type);
$this->debugLog('回调原始数据', $allData); $this->debugLog('回调原始数据', $allData);
(new Message())->addMsg($allData); (new Message())->addMsg($allData);//存入数据库
$card = new FeilvbinCard();
$card->message($allData['content']); $card->message($allData['content']);
$getTrans = new GetTransInfo($card); $getTrans = new GetTransInfo($card);
$requestArr = $getTrans->getInfo(); $requestArr = $getTrans->getInfo();
if (!is_array($requestArr)) { if (!is_array($requestArr)) {
$this->debugLog('参数异常'); $this->debugLog('短信参数异常');
return '参数异常'; return '短信参数异常';
} }
$this->pay_type = $pay_type; $this->pay_type = $pay_type;
@ -222,6 +221,11 @@ class GuMaPayServices implements PayApiInterface
} }
public function notify($return, $pay_type, $request)
{
return '不支持';
}
/** /**
* 获得通道信息,取得支付配置模型,验证签名, * 获得通道信息,取得支付配置模型,验证签名,
* @return bool|void * @return bool|void

View File

@ -12,22 +12,22 @@ trait PayApiProvidesTrait
{ {
switch ($pay_type) { switch ($pay_type) {
case 'alipay': // case 'alipay':
case 'weixin': // case 'weixin':
case 'alipayscan': // case 'alipayscan':
case 'weixinh5': // case 'weixinh5':
case 'weixinscan': // case 'weixinscan':
return $this->pay_service = new WeixinAlipayServices(); // return $this->pay_service = new WeixinAlipayServices();
break; // break;
case 'unionpay': // case 'unionpay':
return $this->pay_service = new UnionpayServices(); // return $this->pay_service = new UnionpayServices();
break; // break;
case 'citpay': // case 'citpay':
return $this->pay_service = new CitPayServices(); // return $this->pay_service = new CitPayServices();
break; // break;
case 'usdtpay': // case 'usdtpay':
return $this->pay_service = new UsdtPayServices(); // return $this->pay_service = new UsdtPayServices();
break; // break;
case 'tr_wxal': case 'tr_wxal':
case 'tr_wxalbank': case 'tr_wxalbank':
case 'tr_weixin': case 'tr_weixin':
@ -91,8 +91,8 @@ trait PayApiProvidesTrait
// return $this->pay_service = new WeixinManchongServices(); // return $this->pay_service = new WeixinManchongServices();
// case '1014': // case '1014':
// return $this->pay_service = new FxPayServices(); // return $this->pay_service = new FxPayServices();
case '1016': // case '1016':
return $this->pay_service = new GoPayServices(); // return $this->pay_service = new GoPayServices();
break; break;
} }
} }

View File

@ -16,8 +16,8 @@ class ExampleCard extends BaseCard
private function analysisMsg(){ private function analysisMsg(){
$pattern = '/[0-9]{10,}|[0-9]{1,}\.[0-9]{1,2}/'; $pattern = '/[0-9]{10,}|[0-9]{1,}\.[0-9]{1,2}/';
preg_match_all($pattern, $this->msg, $matches, PREG_PATTERN_ORDER); $match_num = preg_match_all($pattern, $this->msg, $matches, PREG_PATTERN_ORDER);
if ($matches[0]) { if ($match_num != false && $match_num > 0 && $matches[0]) {
$this->orderInfo = [ $this->orderInfo = [
'from_card' => $matches[0][1], 'from_card' => $matches[0][1],
'pay_money' => $matches[0][0], 'pay_money' => $matches[0][0],
@ -26,18 +26,6 @@ class ExampleCard extends BaseCard
} }
} }
// public function showInfo(): array
// {
// $init = [
// 'from_card' => null,
// 'pay_money' => null,
// 'remark' => null,
// 'order_number' => null,
// ];
//
// return array_merge($init, $this->orderInfo);
// }
//获取订单信息 //获取订单信息
public function orderInfo($requestArr) public function orderInfo($requestArr)
{ {

View File

@ -10,8 +10,8 @@ class FeilvbinCard extends BaseCard
{ {
$this->msg = $msg; $this->msg = $msg;
$pattern= '/(?<=P)\d+\.\d{2}|\d{2}-\d{2}-\d{2}\s\d{2}:\d{2}\s\w{2}|(?<=\s)\d{4}(?=\.)|(?<=No.\s)\d{10,}(?=\.)/'; $pattern= '/(?<=P)\d+\.\d{2}|\d{2}-\d{2}-\d{2}\s\d{2}:\d{2}\s\w{2}|(?<=\s)\d{4}(?=\.)|(?<=No.\s)\d{10,}(?=\.)/';
preg_match_all($pattern, $this->msg, $matches, PREG_PATTERN_ORDER); $match_num = preg_match_all($pattern, $this->msg, $matches, PREG_PATTERN_ORDER);
if ($matches[0]) { if ($match_num != false && $match_num > 0 && $matches[0]) {
$this->orderInfo = [ $this->orderInfo = [
'pay_money' => $matches[0][0], 'pay_money' => $matches[0][0],
'from_card' => $matches[0][1], 'from_card' => $matches[0][1],
@ -21,18 +21,7 @@ class FeilvbinCard extends BaseCard
} }
} }
// public function showInfo(): array //获取订单信息
// {
// $init = [
// 'from_card' => null,
// 'pay_money' => null,
// 'remark' => null,
// 'order_number' => null,
// ];
//
// return array_merge($init, $this->orderInfo);
// }
public function orderInfo($requestArr) public function orderInfo($requestArr)
{ {
$showInfo = $this->showInfo(); $showInfo = $this->showInfo();

View File

@ -34,17 +34,17 @@ return [
'scan' => '扫码支付' 'scan' => '扫码支付'
], ],
'pay_type' => [ 'pay_type' => [
'alipay' => '支付宝', // 'alipay' => '支付宝',
'weixin' => '微信支付', // 'weixin' => '微信支付',
'tr_wxalbank' => '固码多合一', // 'tr_wxalbank' => '固码多合一',
'tr_wxal' => '固码微信支付宝二合一', // 'tr_wxal' => '固码微信支付宝二合一',
'tr_weixin' => '固码微信收款', // 'tr_weixin' => '固码微信收款',
'tr_alipay' => '固码支付宝收款', // 'tr_alipay' => '固码支付宝收款',
'tr_bank' => '固码银行收款', // 'tr_bank' => '固码银行收款',
'tr_bank2' => '银行转账收款', 'tr_bank2' => '银行转账收款',
'unionpay' => '银联支付', // 'unionpay' => '银联支付',
'usdtpay' => '数字货币USDT', // 'usdtpay' => '数字货币USDT',
'citpay' => '数字货币CitPay', // 'citpay' => '数字货币CitPay',
// 'sanyecaopay_alipay' =>'三叶草支付_支付宝', // 'sanyecaopay_alipay' =>'三叶草支付_支付宝',
// 'baobeiyepay_alipay' =>'汇丰支付_支付宝', // 'baobeiyepay_alipay' =>'汇丰支付_支付宝',
// 'xianyupay_alipay' =>'闲鱼支付', // 'xianyupay_alipay' =>'闲鱼支付',
@ -74,7 +74,7 @@ return [
// '1013' =>'微信慢充扫码', // '1013' =>'微信慢充扫码',
// '1014' =>'fx_支付宝直充', // '1014' =>'fx_支付宝直充',
// '1015' =>'微信直充扫码', // '1015' =>'微信直充扫码',
'1016' =>'gopay', // '1016' =>'gopay',
], ],
'payfor_status' => [ 'payfor_status' => [
0 => '等待处理', 0 => '等待处理',

View File

@ -1,40 +0,0 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>恭喜,站点创建成功!</title>
<style>
.container {
width: 60%;
margin: 10% auto 0;
background-color: #f0f0f0;
padding: 2% 5%;
border-radius: 10px
}
ul {
padding-left: 20px;
}
ul li {
line-height: 2.3
}
a {
color: #20a53a
}
</style>
</head>
<body>
<div class="container">
<h1>恭喜, 站点创建成功!</h1>
<h3>这是默认index.html本页面由系统自动生成</h3>
<ul>
<li>本页面在FTP根目录下的index.html</li>
<li>您可以修改、删除或覆盖本页面</li>
<li>FTP相关信息请到“面板系统后台 > FTP” 查看</li>
<li>更多功能了解,请查看<a href="https://www.bt.cn" target="_blank">宝塔官网(www.bt.cn)</a></li>
</ul>
</div>
</body>
</html>

0
php
View File

View File

@ -312,7 +312,7 @@
} }
function nobank(){ function notbank(){
$("#appGateway,#gatewayCert").show(); $("#appGateway,#gatewayCert").show();
$("#appGatewayEwm").hide(); $("#appGatewayEwm").hide();
$("#appGateway input,#gatewayCert input").each(function () { $("#appGateway input,#gatewayCert input").each(function () {
@ -327,13 +327,20 @@
}) })
$("[name='thumb']").attr('lay-verify', ''); $("[name='thumb']").attr('lay-verify', '');
} }
let select=$("select[name='ename'] option:selected").val()
if(['tr_weixin','tr_alipay','tr_bank2','tr_bank','tr_wxal','tr_wxalbank'].includes(select)){
bank(select)
}else {
notbank()
}
form.on('select(ename)', function (data) { form.on('select(ename)', function (data) {
if (['tr_weixin', 'tr_alipay', 'tr_bank2', 'tr_bank', 'tr_wxal', 'tr_wxalbank'].includes(data.value)) { if (['tr_weixin', 'tr_alipay', 'tr_bank2', 'tr_bank', 'tr_wxal', 'tr_wxalbank'].includes(data.value)) {
// if (data.value == 'tr_weixin' || data.value == 'tr_alipay' || data.value == 'tr_bank' || data.value == 'tr_bank2' || data.value == 'tr_wxal' || data.value == 'tr_wxalbank') { // if (data.value == 'tr_weixin' || data.value == 'tr_alipay' || data.value == 'tr_bank' || data.value == 'tr_bank2' || data.value == 'tr_wxal' || data.value == 'tr_wxalbank') {
bank(data.value) bank(data.value)
} else { } else {
nobank() notbank()
} }
}); });

View File

@ -61,7 +61,6 @@
}, },
success: function (res) { success: function (res) {
console.log(res);
if (res.error == 0) { if (res.error == 0) {
if (res.msg) { if (res.msg) {
@ -88,7 +87,6 @@
}, },
success: function (res) { success: function (res) {
console.log(res);
if (res.error == 0) { if (res.error == 0) {
if (res.msg) { if (res.msg) {

View File

@ -25,6 +25,7 @@ Route::name('web.pay.')->group(function ($route) {
$route->any('/return/{type}', 'PayController@returnNotify')->name('return'); $route->any('/return/{type}', 'PayController@returnNotify')->name('return');
$route->any('/notify/{type}', 'PayController@notify')->name('notify');; $route->any('/notify/{type}', 'PayController@notify')->name('notify');;
$route->any('/returnback', 'ApiPayController@scanOrderBack')->name('scan.return'); $route->any('/returnback', 'ApiPayController@scanOrderBack')->name('scan.return');
$route->any('/banknotify', 'PayController@bankCardNotify')->name('bankCardNotify');
}); });