优化
This commit is contained in:
@@ -1,14 +1,339 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
return [
|
return [
|
||||||
//公钥和私钥
|
//分配的渠道号
|
||||||
|
'msg_sender' => '660134',
|
||||||
|
//打印在小票上,由活动标题、优惠金额、原始金额组合而成
|
||||||
|
'pos_receipt' => '本时生活,优惠生活',
|
||||||
|
//广告,用于打印在小票上
|
||||||
|
'pos_ad' => '',
|
||||||
|
//营销联盟广告,用于打印在小票上
|
||||||
|
'pos_mkt_ad' => '本时生活,优惠生活',
|
||||||
|
//银联渠道id
|
||||||
|
'agent_id' => '299',
|
||||||
|
//银联网点id
|
||||||
|
'outlet_id' => '2009300919918',
|
||||||
|
//用于银商与sp分润的金额(是佣金的一部分), 以分为单位
|
||||||
|
'serv_chg' => 0,
|
||||||
|
//佣金
|
||||||
|
'commission' => 0,
|
||||||
|
//证书
|
||||||
'check' => [
|
'check' => [
|
||||||
'self' => [
|
'self' => [
|
||||||
'private' => storage_path('cert/self/private_rsa.pem'),
|
'private' => storage_path('cert/unionpay/self/private_rsa.pem'),
|
||||||
'public' => storage_path('cert/self/public_rsa.pem'),
|
'public' => storage_path('cert/unionpay/self/public_rsa.pem'),
|
||||||
],
|
],
|
||||||
'unionpay' => [
|
'unionpay' => [
|
||||||
'public' => storage_path('cert/unionpay/public_rsa.pem'),
|
'public' => storage_path('cert/unionpay/public_rsa.pem'),
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
'type' => [
|
||||||
|
'002025' => '查询',
|
||||||
|
'002100' => '交易',
|
||||||
|
'002101' => '冲正',
|
||||||
|
'002102' => '撤销',
|
||||||
|
],
|
||||||
|
'log_type' => [
|
||||||
|
'002025' => 'query',
|
||||||
|
'002100' => 'freezecoupon',
|
||||||
|
'002101' => 'reversal',
|
||||||
|
'002102' => 'annul',
|
||||||
|
],
|
||||||
|
//需要校验的数据
|
||||||
|
'validator' => [
|
||||||
|
'002025' => [
|
||||||
|
"msg_type",
|
||||||
|
"msg_txn_code",
|
||||||
|
"msg_crrltn_id",
|
||||||
|
"msg_flg",
|
||||||
|
"msg_sender",
|
||||||
|
"msg_time",
|
||||||
|
"msg_ver",
|
||||||
|
"msg_sys_sn",
|
||||||
|
"req_serial_no",
|
||||||
|
"mkt_code",
|
||||||
|
"amount",
|
||||||
|
"avl_amt",
|
||||||
|
],
|
||||||
|
'002100' => [
|
||||||
|
"msg_type",
|
||||||
|
"msg_txn_code",
|
||||||
|
"msg_crrltn_id",
|
||||||
|
"msg_flg",
|
||||||
|
"msg_sender",
|
||||||
|
"msg_time",
|
||||||
|
"msg_sys_sn",
|
||||||
|
"msg_ver",
|
||||||
|
"req_serial_no",
|
||||||
|
"orig_req_serial_no",
|
||||||
|
"sett_date",
|
||||||
|
"txn_date",
|
||||||
|
"txn_time",
|
||||||
|
"orig_amt",
|
||||||
|
"discount_amt",
|
||||||
|
],
|
||||||
|
'002101' => [
|
||||||
|
"msg_type",
|
||||||
|
"msg_txn_code",
|
||||||
|
"msg_crrltn_id",
|
||||||
|
"msg_flg",
|
||||||
|
"msg_sender",
|
||||||
|
"msg_time",
|
||||||
|
"msg_sys_sn",
|
||||||
|
"msg_ver",
|
||||||
|
"req_serial_no",
|
||||||
|
"orig_req_serial_no",
|
||||||
|
],
|
||||||
|
'002102' => [
|
||||||
|
"msg_type",
|
||||||
|
"msg_txn_code",
|
||||||
|
"msg_crrltn_id",
|
||||||
|
"msg_flg",
|
||||||
|
"msg_sender",
|
||||||
|
"msg_time",
|
||||||
|
"msg_sys_sn",
|
||||||
|
"msg_ver",
|
||||||
|
"req_serial_no",
|
||||||
|
"orig_req_serial_no",
|
||||||
|
],
|
||||||
|
],
|
||||||
|
//入库基础数据
|
||||||
|
'regular' => [
|
||||||
|
'002025' => [
|
||||||
|
"msg_type",
|
||||||
|
"msg_txn_code",
|
||||||
|
"msg_crrltn_id",
|
||||||
|
"msg_flg",
|
||||||
|
"msg_sender",
|
||||||
|
"msg_time",
|
||||||
|
"msg_ver",
|
||||||
|
"msg_sys_sn",//自己添加的基础数据
|
||||||
|
"req_serial_no",//自己添加的基础数据
|
||||||
|
"mkt_code",//自己添加的基础数据
|
||||||
|
],
|
||||||
|
'002100' => [
|
||||||
|
"msg_type",
|
||||||
|
"msg_txn_code",
|
||||||
|
"msg_crrltn_id",
|
||||||
|
"msg_flg",
|
||||||
|
"msg_sender",
|
||||||
|
"msg_time",
|
||||||
|
"msg_sys_sn",
|
||||||
|
"msg_ver",
|
||||||
|
"req_serial_no",//自己添加的基础数据
|
||||||
|
"orig_req_serial_no",//自己添加的基础数据
|
||||||
|
"sett_date",//自己添加的基础数据
|
||||||
|
],
|
||||||
|
'002101' => [
|
||||||
|
"msg_type",
|
||||||
|
"msg_txn_code",
|
||||||
|
"msg_crrltn_id",
|
||||||
|
"msg_flg",
|
||||||
|
"msg_sender",
|
||||||
|
"msg_time",
|
||||||
|
"msg_sys_sn",
|
||||||
|
"msg_ver",
|
||||||
|
"req_serial_no",//自己添加的基础数据
|
||||||
|
"orig_req_serial_no",//自己添加的基础数据
|
||||||
|
],
|
||||||
|
'002102' => [
|
||||||
|
"msg_type",
|
||||||
|
"msg_txn_code",
|
||||||
|
"msg_crrltn_id",
|
||||||
|
"msg_flg",
|
||||||
|
"msg_sender",
|
||||||
|
"msg_time",
|
||||||
|
"msg_sys_sn",
|
||||||
|
"msg_ver",
|
||||||
|
"req_serial_no",//自己添加的基础数据
|
||||||
|
"orig_req_serial_no",//自己添加的基础数据
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'fields' => [
|
||||||
|
//聚合营销优惠查询接口
|
||||||
|
'002025' => [
|
||||||
|
'in' => [
|
||||||
|
"msg_type" => "报文类型",
|
||||||
|
"msg_txn_code" => "交易代码",
|
||||||
|
"msg_crrltn_id" => "报文流水号",
|
||||||
|
"msg_flg" => "报文请求应答标志",
|
||||||
|
"msg_sender" => "报文发送方",
|
||||||
|
"msg_time" => "报文日期",
|
||||||
|
"msg_sys_sn" => "平台流水号",
|
||||||
|
"msg_ver" => "报文版本号",
|
||||||
|
"req_serial_no" => "查询流水号",
|
||||||
|
"shop_no" => "门店号",
|
||||||
|
"term_no" => "受理终端号",
|
||||||
|
"service_code" => "受理方式",
|
||||||
|
"voucher_no" => "受理凭证号",
|
||||||
|
"mkt_code" => "聚合营销码",
|
||||||
|
"mkt_mode" => "聚合营销类型",
|
||||||
|
"embedded_mchnt_no" => "发起渠道商户号",
|
||||||
|
"currency_code" => "货币代码",
|
||||||
|
"amount" => "消费金额",
|
||||||
|
"avl_amt" => "可优惠金额",
|
||||||
|
"term_sp_chnl_no" => "终端指定SP渠道号",
|
||||||
|
"func_code" => "功能码",
|
||||||
|
"times" => "次数",
|
||||||
|
"pay_mode" => "支付方式",
|
||||||
|
//用户附加信息
|
||||||
|
"user_ext_info" => [
|
||||||
|
"mobile_no" => "手机号",
|
||||||
|
"user_code" => "用户号",
|
||||||
|
"user_code_type" => "用户号类型",
|
||||||
|
"dev_id" => "设备id",
|
||||||
|
],
|
||||||
|
"sign" => "签名域",
|
||||||
|
],
|
||||||
|
'out' => [
|
||||||
|
"msg_type" => "报文类型",
|
||||||
|
"msg_txn_code" => "交易代码",
|
||||||
|
"msg_crrltn_id" => "报文流水号",
|
||||||
|
"msg_flg" => "报文请求应答标志",
|
||||||
|
"msg_sender" => "报文发送方",
|
||||||
|
"msg_time" => "报文日期",
|
||||||
|
"msg_sys_sn" => "平台流水号",
|
||||||
|
"msg_rsp_code" => "响应码",
|
||||||
|
"msg_rsp_desc" => "响应码描述",
|
||||||
|
"discount" => "折扣金额",
|
||||||
|
"actual_amt" => "折后应收金额",
|
||||||
|
"pos_display" => "POS显示",
|
||||||
|
"pos_receipt" => "POS小票",
|
||||||
|
"pos_ad" => "POS广告",
|
||||||
|
"pos_mkt_ad" => "Pos_营销联盟广告",
|
||||||
|
"sign" => "签名域",
|
||||||
|
],
|
||||||
|
],
|
||||||
|
//销账交易接口
|
||||||
|
'002100' => [
|
||||||
|
'in' => [
|
||||||
|
"msg_type" => "报文类型",
|
||||||
|
"msg_txn_code" => "交易代码",
|
||||||
|
"msg_crrltn_id" => "消息关联号",
|
||||||
|
"msg_flg" => "报文请求应答标志",
|
||||||
|
"msg_sender" => "报文发送方",
|
||||||
|
"msg_time" => "报文日期",
|
||||||
|
"msg_sys_sn" => "平台流水号",
|
||||||
|
"msg_ver" => "报文版本号",
|
||||||
|
"shop_no" => "门店号",
|
||||||
|
"term_no" => "终端号",
|
||||||
|
"req_serial_no" => "销券流水号",
|
||||||
|
"orig_req_serial_no" => "原查询流水号",
|
||||||
|
"enc_card_no" => "加密卡号",
|
||||||
|
"part_card_no" => "部分卡号",
|
||||||
|
"acq_term_sn" => "受理终端流水号",
|
||||||
|
"refer_no" => "检索参考号",
|
||||||
|
"sett_date" => "清算日期",
|
||||||
|
"txn_date" => "交易日期",
|
||||||
|
"txn_time" => "交易时间",
|
||||||
|
"orig_amt" => "原始金额",
|
||||||
|
"discount_amt" => "优惠的金额",
|
||||||
|
"pay_amt" => "支付金额",
|
||||||
|
"pay_mode" => "支付方式",
|
||||||
|
"order_no" => "订单号",
|
||||||
|
"trans_crrltn_no" => "交易关联流水号",
|
||||||
|
"equity_no" => "权益号",
|
||||||
|
"card_no" => "全卡号",
|
||||||
|
"sign" => "签名数据",
|
||||||
|
],
|
||||||
|
'out' => [
|
||||||
|
"msg_type" => "报文类型",
|
||||||
|
"msg_txn_code" => "交易代码",
|
||||||
|
"msg_crrltn_id" => "消息关联号",
|
||||||
|
"msg_flg" => "报文请求应答标志",
|
||||||
|
"msg_sender" => "报文发送方",
|
||||||
|
"msg_time" => "报文日期",
|
||||||
|
"msg_sys_sn" => "平台流水号",
|
||||||
|
"msg_ver" => "报文版本号",
|
||||||
|
"msg_rsp_code" => "响应码",
|
||||||
|
"msg_rsp_desc" => "响应码描述",
|
||||||
|
"orig_amt" => "原始金额",
|
||||||
|
"discount_amt" => "折扣金额",
|
||||||
|
"pay_amt" => "支付金额",
|
||||||
|
"serv_chg" => "服务费",
|
||||||
|
"commission" => "佣金",
|
||||||
|
"ad" => "广告",
|
||||||
|
"pos_receipt" => "POS优惠",
|
||||||
|
"coupon_no" => "凭证号",
|
||||||
|
"coupon_type" => "凭证类型",
|
||||||
|
"sp_biz_code" => "SP统计码",
|
||||||
|
"charge_code" => "计费码",
|
||||||
|
"pos_event_title" => "SP活动主题",
|
||||||
|
"sp_contact" => "SP联系电话",
|
||||||
|
"sp_name" => "SP名称",
|
||||||
|
"event_no" => "活动号",
|
||||||
|
"td_code" => "二维码",
|
||||||
|
"memo" => "附言",
|
||||||
|
"mkt_sp_chnl_no" => "营销渠道号",
|
||||||
|
"point_amt" => "积分抵扣金额",
|
||||||
|
"sign" => "签名数据",
|
||||||
|
],
|
||||||
|
],
|
||||||
|
//销账冲正通知接口
|
||||||
|
'002101' => [
|
||||||
|
'in' => [
|
||||||
|
"msg_type" => "报文类型",
|
||||||
|
"msg_txn_code" => "交易代码",
|
||||||
|
"msg_crrltn_id" => "消息关联号",
|
||||||
|
"msg_flg" => "报文请求应答标志",
|
||||||
|
"msg_sender" => "报文发送方",
|
||||||
|
"msg_time" => "报文日期",
|
||||||
|
"msg_sys_sn" => "平台流水号",
|
||||||
|
"msg_ver" => "报文版本号",
|
||||||
|
"shop_no" => "门店号",
|
||||||
|
"term_no" => "终端号",
|
||||||
|
"req_serial_no" => "冲正流水号",
|
||||||
|
"orig_req_serial_no" => "原始销账流水号",
|
||||||
|
"trans_crrltn_no" => "交易关联流水号",
|
||||||
|
"sign" => "签名数据",
|
||||||
|
],
|
||||||
|
'out' => [
|
||||||
|
"msg_type" => "报文类型",
|
||||||
|
"msg_txn_code" => "交易代码",
|
||||||
|
"msg_crrltn_id" => "消息关联号",
|
||||||
|
"msg_flg" => "报文请求应答标志",
|
||||||
|
"msg_sender" => "报文发送方",
|
||||||
|
"msg_time" => "报文日期",
|
||||||
|
"msg_sys_sn" => "平台流水号",
|
||||||
|
"msg_ver" => "报文版本号",
|
||||||
|
"msg_rsp_code" => "响应码",
|
||||||
|
"msg_rsp_desc" => "响应码描述",
|
||||||
|
"sign" => "签名数据",
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'002102' => [
|
||||||
|
'in' => [
|
||||||
|
"msg_type" => "报文类型",
|
||||||
|
"msg_txn_code" => "交易代码",
|
||||||
|
"msg_crrltn_id" => "消息关联号",
|
||||||
|
"msg_flg" => "报文请求应答标志",
|
||||||
|
"msg_sender" => "报文发送方",
|
||||||
|
"msg_time" => "报文日期",
|
||||||
|
"msg_sys_sn" => "平台流水号",
|
||||||
|
"msg_ver" => "报文版本号",
|
||||||
|
"shop_no" => "门店号",
|
||||||
|
"term_no" => "终端号",
|
||||||
|
"req_serial_no" => "撤销流水号",
|
||||||
|
"orig_req_serial_no" => "原始销账流水号",
|
||||||
|
"trans_crrltn_no" => "交易关联流水号",
|
||||||
|
"sign" => "签名数据",
|
||||||
|
],
|
||||||
|
'out' => [
|
||||||
|
"msg_type" => "报文类型",
|
||||||
|
"msg_txn_code" => "交易代码",
|
||||||
|
"msg_crrltn_id" => "消息关联号",
|
||||||
|
"msg_flg" => "报文请求应答标志",
|
||||||
|
"msg_sender" => "报文发送方",
|
||||||
|
"msg_time" => "报文日期",
|
||||||
|
"msg_sys_sn" => "平台流水号",
|
||||||
|
"msg_ver" => "报文版本号",
|
||||||
|
"msg_rsp_code" => "响应码",
|
||||||
|
"msg_rsp_desc" => "响应码描述",
|
||||||
|
"ad" => "广告",
|
||||||
|
"td_code" => "二维码",
|
||||||
|
"sign" => "签名数据",
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
],
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -3,8 +3,9 @@
|
|||||||
namespace XuanChen\UnionPay\Action;
|
namespace XuanChen\UnionPay\Action;
|
||||||
|
|
||||||
use XuanChen\Coupon\Coupon;
|
use XuanChen\Coupon\Coupon;
|
||||||
|
use XuanChen\UnionPay\Contracts\Contracts;
|
||||||
|
|
||||||
class Query
|
class Query implements Contracts
|
||||||
{
|
{
|
||||||
|
|
||||||
public $outlet_id;
|
public $outlet_id;
|
||||||
|
|||||||
@@ -6,8 +6,9 @@ use App\Models\ActivityCoupon;
|
|||||||
use App\Models\UnionpayLog;
|
use App\Models\UnionpayLog;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use XuanChen\Coupon\Coupon;
|
use XuanChen\Coupon\Coupon;
|
||||||
|
use XuanChen\UnionPay\Contracts\Contracts;
|
||||||
|
|
||||||
class Redemption
|
class Redemption implements Contracts
|
||||||
{
|
{
|
||||||
|
|
||||||
public $outlet_id;
|
public $outlet_id;
|
||||||
@@ -36,16 +37,12 @@ class Redemption
|
|||||||
//获取银联渠道
|
//获取银联渠道
|
||||||
$user = User::find($this->agent_id);
|
$user = User::find($this->agent_id);
|
||||||
|
|
||||||
if ($query) {
|
|
||||||
$coupon = Coupon::Redemption($user, $query->mkt_code, $this->params['orig_amt'] / 100, $this->outlet_id, '');
|
$coupon = Coupon::Redemption($user, $query->mkt_code, $this->params['orig_amt'] / 100, $this->outlet_id, '');
|
||||||
if (!is_array($coupon)) {
|
if (!is_array($coupon)) {
|
||||||
$this->outdata['msg_rsp_code'] = '9999';
|
$this->outdata['msg_rsp_code'] = '9999';
|
||||||
$this->outdata['msg_rsp_desc'] = $coupon;
|
$this->outdata['msg_rsp_desc'] = $coupon;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
$this->outdata['msg_rsp_code'] = '9999';
|
|
||||||
$this->outdata['msg_rsp_desc'] = '未查询到前置接口,获取券码失败。';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,8 +5,9 @@ namespace XuanChen\UnionPay\Action;
|
|||||||
use App\Models\UnionpayLog;
|
use App\Models\UnionpayLog;
|
||||||
use XuanChen\Coupon\Coupon;
|
use XuanChen\Coupon\Coupon;
|
||||||
use App\Models\Coupon as CouponModel;
|
use App\Models\Coupon as CouponModel;
|
||||||
|
use XuanChen\UnionPay\Contracts\Contracts;
|
||||||
|
|
||||||
class Reversal
|
class Reversal implements Contracts
|
||||||
{
|
{
|
||||||
|
|
||||||
public $outlet_id;
|
public $outlet_id;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace XuanChen\UnionPay\Contracts;
|
namespace XuanChen\UnionPay\Contracts;
|
||||||
|
|
||||||
interface CheckCouponContracts
|
interface Contracts
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -11,4 +11,6 @@ interface CheckCouponContracts
|
|||||||
*/
|
*/
|
||||||
function start();
|
function start();
|
||||||
|
|
||||||
|
function back();
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace XuanChen\Coupon\Contracts;
|
|
||||||
|
|
||||||
interface CouponContracts
|
|
||||||
{
|
|
||||||
|
|
||||||
//发券接口
|
|
||||||
function grant();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Notes: 查询卡券详情
|
|
||||||
* @Author: 玄尘
|
|
||||||
* @Date : 2020/6/29 15:15
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
function detail();
|
|
||||||
|
|
||||||
//作废接口
|
|
||||||
function destroy();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Notes: 核销执行入口
|
|
||||||
* @Author: 玄尘
|
|
||||||
* @Date : 2020/6/29 14:49
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
function start();
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace XuanChen\UnionPay\Traits;
|
|
||||||
|
|
||||||
use App\Models\Log as LogModel;
|
|
||||||
|
|
||||||
trait Log
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Notes: 插入日志
|
|
||||||
* @Author: 玄尘
|
|
||||||
* @Date : 2020/6/30 10:29
|
|
||||||
* @param $url
|
|
||||||
* @param $method
|
|
||||||
* @param $params
|
|
||||||
* @param string $type
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function createLog($url, $method, $params, $type = 'pingan')
|
|
||||||
{
|
|
||||||
$data = [
|
|
||||||
'path' => $url,
|
|
||||||
'method' => $method,
|
|
||||||
'type' => $type,
|
|
||||||
'in_source' => $params,
|
|
||||||
];
|
|
||||||
|
|
||||||
$info = LogModel::create($data);
|
|
||||||
|
|
||||||
return $info;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Notes: 更新日志
|
|
||||||
* @Author: 玄尘
|
|
||||||
* @Date : 2020/6/30 10:29
|
|
||||||
* @param $log
|
|
||||||
* @param $params
|
|
||||||
*/
|
|
||||||
public static function updateLog($log, $params)
|
|
||||||
{
|
|
||||||
$log->out_source = $params;
|
|
||||||
$log->save();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user