ksh 银行卡

This commit is contained in:
zcy 2022-05-01 16:14:45 +08:00
parent ca5ae4060f
commit 08be6033d9
5 changed files with 48 additions and 3 deletions

View File

@ -6,6 +6,7 @@ use App\ServicePay\PayApiInterface;
use App\ServicePay\PayApiProvidesTrait;
use App\ServicePay\TransCard\BaseCard;
use App\ServicePay\TransCard\FeilvbinCard;
use App\ServicePay\TransCard\KshCard;
use Illuminate\Http\Request;
class PayController extends BaseController
@ -66,6 +67,9 @@ class PayController extends BaseController
case 1:
$card = new FeilvbinCard();
break;
case 2:
$card=new KshCard();
break;
default:
break;
}

View File

@ -121,7 +121,7 @@ class GuMaPayServices implements PayApiInterface
$filedir = $dir . 'code.blade.php';
}
if (file_exists($filedir)) {
if ($file!='' && file_exists($filedir)) {
return view('web.order.' . $lange . '.code', $data);
} else {
return view('web.order.code', $data);
@ -134,7 +134,7 @@ class GuMaPayServices implements PayApiInterface
public function verify()
{
$params = $this->result_data;
return true;
$allData = $this->request->all();
if (isset($allData['token'])) {
if ($this->pay_config['app_id'] == $allData['token']) {

View File

@ -15,6 +15,7 @@ abstract class BaseCard
'pay_money' => null,
'remark' => null,
'order_number' => null,
'from_name' => null,
];
return array_merge($init, $this->orderInfo);

View File

@ -0,0 +1,40 @@
<?php
namespace App\ServicePay\TransCard;
use App\Models\Order;
class KshCard extends BaseCard
{
public function message($msg)
{
$this->msg = $msg;
$pattern= '/^[A-Z0-9]{9,12}(?=\s)|(?<=Ksh)[\d]+\.[\d]{2}|(?<=from\s)[a-zA-z]*\s[a-zA-z]*|(?<=\s)\d+(?=\s)/';
$match_num = preg_match_all($pattern, $this->msg, $matches, PREG_PATTERN_ORDER);
if ($match_num != false && $match_num > 0 && $matches[0]) {
$this->orderInfo = [
'pay_money' => $matches[0][1],
'from_card' => $matches[0][3],
'from_name' => $matches[0][2],
'order_number' => $matches[0][0],
];
}
}
//获取订单信息
public function orderInfo($requestArr)
{
$showInfo = $this->showInfo();
$ewm_account = $showInfo['from_card'];
$order_money = $showInfo['pay_money'];
$from_name = $showInfo['from_name'];
$order_money = number_format($order_money, 2, ',', '');
//查找未支付的订单
$t = date('Y-m-d H:i:s');
return Order::where('order_at', '<', $t)
->where('order_money', $order_money)
->where('ewm_account', $ewm_account)
// ->whereIn('status', [0, 2])
->orderBy('id', 'desc')->first();
}
}