diff --git a/app/Admin/Controllers/Unionpay/IndexController.php b/app/Admin/Controllers/Unionpay/IndexController.php deleted file mode 100644 index a18086d..0000000 --- a/app/Admin/Controllers/Unionpay/IndexController.php +++ /dev/null @@ -1,91 +0,0 @@ - - * @Date : 2019/9/18 14:50 - * @return Grid - */ - protected function grid() - { - $grid = new Grid(new UnionpayLog); - - $grid->disableActions(); - $grid->disableCreateButton(); - $grid->model()->orderBy('id', 'desc'); - - $grid->filter(function ($filter) { - $filter->column(1 / 2, function ($filter) { - $filter->equal('msg_txn_code', '交易类型')->select(config('unionpay.type')); - }); - $filter->column(1 / 2, function ($filter) { - $filter->equal('req_serial_no', '流水号'); - $filter->equal('orig_req_serial_no', '原流水号'); - }); - }); - - $grid->column('id', '#ID#'); - $grid->column('msg_txn_code', '交易类型') - ->using(config('unionpay.type')) - ->label(); - - // $grid->column('msg_crrltn_id', '消息关联号'); - $grid->column('msg_time', '报文日期'); - $grid->column('mkt_code', '券码'); - $grid->column('msg_sys_sn', '平台流水号'); - $grid->column('req_serial_no', '流水号'); - $grid->column('orig_req_serial_no', '原流水号'); - $grid->column('status', '状态') - ->using(UnionpayLog::STATUS) - ->label([ - 0 => 'success', - 1 => 'warning', - ]); - - $grid->column('in_source', '请求参数') - ->display(function ($title, $column) { - return '点击展开'; - })->modal(InData::class); - - $grid->column('out_source', '返回参数') - ->display(function ($title, $column) { - return '点击展开'; - })->modal(OutData::class); - - // $grid->column('sett_date', '清算日期'); - $grid->column('created_at', '注册时间'); - $grid->disableExport(false); - - $grid->export(function ($export) { - $export->filename($this->title . date("YmdHis")); - }); - - return $grid; - } - -} diff --git a/app/Admin/Renderable/Unionpay/InData.php b/app/Admin/Renderable/Unionpay/InData.php deleted file mode 100644 index 4e6882b..0000000 --- a/app/Admin/Renderable/Unionpay/InData.php +++ /dev/null @@ -1,26 +0,0 @@ -in_source; - - if (is_array($in_source) && count($in_source) > 1) { - $table = new Table(['名称', '值'], $in_source, ['panel', ' panel-default']); - - return $table->render(); - } - } - -} \ No newline at end of file diff --git a/app/Admin/Renderable/Unionpay/OutData.php b/app/Admin/Renderable/Unionpay/OutData.php deleted file mode 100644 index c79c3d8..0000000 --- a/app/Admin/Renderable/Unionpay/OutData.php +++ /dev/null @@ -1,25 +0,0 @@ -out_source; - - if (is_array($out_source) && count($out_source) > 1) { - unset($out_source['sign']); - $table = new Table(['名称', '值'], $out_source, ['panel ', 'panel-success']); - - return $table->render(); - } - } - -} \ No newline at end of file diff --git a/app/Admin/routes.php b/app/Admin/routes.php index 41217c7..9010744 100644 --- a/app/Admin/routes.php +++ b/app/Admin/routes.php @@ -55,7 +55,4 @@ Route::group([ $router->resource('activitycoupons', 'Activity\CouponController'); $router->resource('activitycouponlogs', 'Activity\LogController'); - //银联日志 - $router->resource('unionpays', 'Unionpay\IndexController'); - }); diff --git a/app/Api/Controllers/UnionPayController.php b/app/Api/Controllers/UnionPayController.php deleted file mode 100644 index e8480fc..0000000 --- a/app/Api/Controllers/UnionPayController.php +++ /dev/null @@ -1,46 +0,0 @@ - $b); - $action = new UnionPay($request->all()); - // $sign = $action->getSign(false); - $sign = 'd8e5bf46d0d9f1da702170c2e141d85cf3ca785106886dbfedb3310ee9ce2ca3f18a2e6c179ec9908fc4f41d05df463634106918bdbefc63b8f199c7d2f3b0d45510b4dd6ccdf4549e11a8551a5098b14c01fdaa5840a4608f462fdafdc14b8f2a35471da315d8245a4ef6281b6e04bd22d5a266500a6caf6e5203202c37111d'; - $action->sign = $sign; - $res = $action->checkSign(false, false); - dump('签名: ' . $sign); - $res_str = ($res === true) ? '成功' : '失败'; - dump('验签结果:' . $res_str); - dd($action); - - } - - /** - * Notes: 银联接口 - * @Author: 玄尘 - * @Date : 2020/9/28 16:31 - * @param Request $request - * @return mixed - */ - public function query(Request $request) - { - $inputs = $request->all(); - $app = app('xuanchen.unionpay'); - $app->setParams($inputs); - $app->start(); - - return $app->respond(); - } - -} diff --git a/app/Api/routes.php b/app/Api/routes.php index f6db5eb..6a30333 100644 --- a/app/Api/routes.php +++ b/app/Api/routes.php @@ -20,8 +20,4 @@ Route::group(['prefix' => 'V1'], function () { Route::post('ticket/cancel', 'WoController@cancel'); //退业务 Route::post('ticket/query', 'WoController@query'); //退业务 - //银联相关 - Route::post('unionpay/index', 'UnionPayController@index'); - Route::post('unionpay/query', 'UnionPayController@query'); - }); diff --git a/app/Models/UnionpayLog.php b/app/Models/UnionpayLog.php deleted file mode 100644 index c0ac23e..0000000 --- a/app/Models/UnionpayLog.php +++ /dev/null @@ -1,25 +0,0 @@ - 'array', - 'out_source' => 'array', - ]; - - const STATUS_SUCCESS = 1; - const STATUS_ERROR = 0; - const STATUS = [ - self::STATUS_SUCCESS => '成功', - self::STATUS_ERROR => '失败', - ]; - - public function coupon() - { - return $this->hasOne(Coupon::class, 'redemptionCode', 'mkt_code'); - } - -} diff --git a/config/unionpay.php b/config/unionpay.php new file mode 100644 index 0000000..16904cb --- /dev/null +++ b/config/unionpay.php @@ -0,0 +1,564 @@ + true, + 'unionpay_url' => [ + 'code' => 'http://dev.spserv.yxlm.chinaums.com:25941/spapigateway/v2/markting/sp/coupon/order/get', + ], + //不进行sign校验 + 'nosign' => [ + 'openid', + 'code', + ], + //分配的渠道号 + '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' => [ + 'self' => [ + 'private' => storage_path('cert/unionpay/self/private_rsa.pem'), + 'public' => storage_path('cert/unionpay/self/public_rsa.pem'), + ], + 'unionpay' => [ + 'public' => storage_path('cert/unionpay/public_rsa.pem'), + ], + ], + 'type' => [ + '002025' => '查询', + '002100' => '交易', + '002101' => '冲正', + '002102' => '撤销', + 'openid' => '封装openid参数', + '106040' => '领券', + '012100' => '核销通知', + ], + 'log_type' => [ + '002025' => 'query', + '002100' => 'freezecoupon', + '002101' => 'reversal', + '002102' => 'annul', + 'openid' => 'openid', + '106040' => 'getcode', + '012100' => 'notify', + ], + //需要校验的数据 + '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", + ], + //封装openid参数 + 'openid' => [ + "msg_type", + "msg_txn_code", + "msg_crrltn_id", + "msg_sender", + "callback_type", + "callback_url", + ], + //本时生活领券 + 'code' => [ + "msg_type", + "msg_txn_code", + "msg_crrltn_id", + "msg_sender", + "issue_user_id", + "event_no", + "mobile", + ], + + //本时生活领券 + '106040' => [ + 'msg_type', + 'msg_txn_code', + 'msg_crrltn_id', + // 'msg_flg', + 'msg_sender', + 'msg_time', + 'msg_sys_sn', + 'msg_ver', + 'sp_chnl_no', + 'sp_order_no', + 'order_date', + 'event_no', + 'issue_user_id', + ], + //回调核销信息 + '012100' => [ + 'msg_type', + 'msg_txn_code', + 'msg_crrltn_id', + 'msg_flg', + 'msg_sender', + 'msg_time', + 'msg_sys_sn', + 'msg_ver', + 'mchnt_no', + 'term_no', + 'shop_no', + 'req_serial_no', + 'coupon_no', + 'orig_amt', + 'discount_amt', + 'pay_amt', + 'event_no', + 'trans_crrltn_no', + 'order_no', + 'order_no', + 'order_no', + 'order_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",//自己添加的基础数据 + ], + //封装获取openid数据 + 'openid' => [ + "msg_type", + "msg_txn_code", + "msg_crrltn_id", + "msg_sender", + ], + //本时生活领券 + 'code' => [ + "msg_type", + "msg_txn_code", + "msg_crrltn_id", + "msg_sender", + ], + //去联盟领券 + '106040' => [ + 'msg_type', + 'msg_txn_code', + 'msg_crrltn_id', + // 'msg_flg', + 'msg_sender', + 'msg_time', + 'msg_sys_sn', + 'msg_ver', + ], + //回调核销信息 + '012100' => [ + 'msg_type', + 'msg_txn_code', + 'msg_crrltn_id', + 'msg_sender', + 'msg_time', + 'msg_sys_sn', + 'msg_ver', + 'req_serial_no', + 'sett_date', + ], + ], + '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" => "签名数据", + ], + ], + + 'openid' => [ + 'in' => [ + "msg_type" => "报文类型", + "msg_txn_code" => "交易代码", + "msg_crrltn_id" => "消息关联号", + "msg_sender" => "报文发送方", + "callback_type" => "回调类型", + "callback_url" => "回调地址", + ], + 'out' => [ + "msg_sender" => "报文类型", + "nonce_str" => "随机码", + "timestamp" => "时间戳", + "auth_scope" => "授权类型", + "callback_type" => "回调类型", + "callback_url" => "回调地址", + "sign" => "签名数据", + ], + ], + + 'code' => [ + 'in' => [ + "msg_type" => "报文类型", + "msg_txn_code" => "交易代码", + "msg_crrltn_id" => "消息关联号", + "msg_sender" => "报文发送方", + "issue_user_id" => "发券平台渠道用户id",//领取微信活动的券码送微信的openid + "event_no" => "活动号", + "mobile" => "手机号", + ], + 'out' => [ + "code" => "优惠券", + "sign" => "签名数据", + ], + ], + //去联盟领券 + '106040' => [ + '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" => "交易关联流水号", + 'sp_chnl_no' => "渠道方", + 'sp_order_no' => "第三方订单号", + 'order_date' => "订单日期", + 'event_no' => "活动号", + 'issue_user_id' => "发券平台渠道用户id", + ], + '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" => "签名数据", + ], + ], + + //回调核销信息 + '012100' => [ + 'in' => [ + "msg_type" => "报文类型", + "msg_txn_code" => "交易代码", + "msg_crrltn_id" => "消息关联号", + "msg_flg" => "报文请求应答标志", + "msg_sender" => "报文发送方", + "msg_time" => "报文日期", + "msg_sys_sn" => "平台流水号", + "msg_ver" => "报文版本号", + "mchnt_no" => "商户号", + "term_no" => "终端号", + "shop_no" => "门店号", + "req_serial_no" => "销券流水号", + "coupon_no" => "凭证号", + "coupon_type" => "凭证类型", + "enc_card_no" => "加密卡号", + "acq_term_sn" => "受理终端流水号", + "refer_no" => "检索参考号", + "sett_date" => "清算日期", + "txn_date" => "交易日期", + "txn_time" => "交易时间", + "orig_amt" => "原始金额", + "discount_amt" => "优惠的金额", + "pay_amt" => "支付金额", + "pay_mode" => "支付方式", + "event_no" => "活动号", + "trans_crrltn_no" => "交易关联流水号", + "equity_no" => "权益号", + "order_no" => "订单号", + "point" => "使用的积分数量", + "point_amt" => "积分抵扣金额", + "point_account_no" => "积分账户号", + "mkt_uuid" => "联盟码申请流水号", + "custom_info" => "第三方自定义域", + ], + ], + + ], +];