55 lines
1.7 KiB
PHP
55 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace App\Api\Controllers;
|
|
|
|
use Illuminate\Http\Request;
|
|
use XuanChen\UnionPay\UnionPay;
|
|
use Response;
|
|
|
|
class UnionPayController extends Controller
|
|
{
|
|
|
|
public function index()
|
|
{
|
|
$user_ext_info = [
|
|
'mobile_no' => '15663876870',
|
|
'user_code' => '1',
|
|
'user_code_type' => '8521475DDDeeee',
|
|
'dev_id' => '1',
|
|
];
|
|
dd(json_encode($user_ext_info));
|
|
$str = 'msg_type=00&msg_txn_code=002100&msg_crrltn_id=12345678901234567890123456789000&msg_flg=0&msg_sender=01&msg_time=20130318162412&msg_sys_sn=12345678900987654321&msg_ver=0.1&mchnt_no=8981231234567890&term_no=12345678&shop_no=086123456123456789&req_serial_no=12345678900987654321&orig_req_serial_no=12345678900987654321&enc_card_no=123123123123123123123sdfadqerqr&acq_term_sn=123456&refer_no=123456789012&sett_date=20130318&txn_date=20130318&txn_time=162850&orig_amt=10000&discount_amt=2000&pay_amt=8000&pay_mode=1';
|
|
parse_str($str, $arr_str);
|
|
|
|
$action = new UnionPay($arr_str);
|
|
$sign = $action->getSign();
|
|
$action->sign = $sign;
|
|
$res = $action->checkSign(true);
|
|
dump($sign);
|
|
dump($res);
|
|
|
|
}
|
|
|
|
/**
|
|
* Notes: 银联接口
|
|
* @Author: 玄尘
|
|
* @Date : 2020/9/28 16:31
|
|
* @param Request $request
|
|
* @return mixed
|
|
*/
|
|
public function query(Request $request)
|
|
{
|
|
$inputs = $request->all();
|
|
$sign = $inputs['sign'];
|
|
unset($inputs['sign']);
|
|
|
|
$action = new UnionPay($inputs, $sign);
|
|
$action->start();
|
|
$action->updateOutData();
|
|
|
|
return $action->respond();
|
|
|
|
}
|
|
|
|
}
|