mirror of
https://github.com/jeequan/jeepay
synced 2024-11-17 23:08:03 +08:00
优化支付参数配置界面支持JSON生成和自定义;敏感数据脱敏
This commit is contained in:
parent
d657b58b6d
commit
2b7a2cbdee
@ -188,6 +188,7 @@ CREATE TABLE `t_pay_interface_define` (
|
||||
`if_name` VARCHAR(20) NOT NULL COMMENT '接口名称',
|
||||
`is_mch_mode` TINYINT(6) NOT NULL DEFAULT 1 COMMENT '是否支持普通商户模式: 0-不支持, 1-支持',
|
||||
`is_isv_mode` TINYINT(6) NOT NULL DEFAULT 1 COMMENT '是否支持服务商子商户模式: 0-不支持, 1-支持',
|
||||
`config_page_type` TINYINT(6) NOT NULL DEFAULT 1 COMMENT '支付参数配置页面类型:1-JSON渲染,2-自定义',
|
||||
`isv_params` VARCHAR(4096) DEFAULT NULL COMMENT 'ISV接口配置定义描述,json字符串',
|
||||
`isvsub_mch_params` VARCHAR(4096) DEFAULT NULL COMMENT '特约商户接口配置定义描述,json字符串',
|
||||
`normal_mch_params` VARCHAR(4096) DEFAULT NULL COMMENT '普通商户接口配置定义描述,json字符串',
|
||||
@ -574,25 +575,25 @@ INSERT INTO t_pay_way (way_code, way_name) VALUES ('YSF_BAR', '云闪付条码')
|
||||
INSERT INTO t_pay_way (way_code, way_name) VALUES ('YSF_JSAPI', '云闪付jsapi');
|
||||
|
||||
-- 初始化支付接口定义
|
||||
INSERT INTO t_pay_interface_define (if_code, if_name, is_mch_mode, is_isv_mode, isv_params, isvsub_mch_params, normal_mch_params, way_codes, icon, bg_color, state, remark)
|
||||
VALUES ('alipay', '支付宝官方', 1, 1,
|
||||
'[{"name":"sandbox","desc":"环境配置","type":"radio","verify":"","values":"1,0","titles":"沙箱环境,生产环境","verify":"required"},{"name":"pid","desc":"合作伙伴身份(PID)","type":"text","verify":"required"},{"name":"appId","desc":"应用App ID","type":"text","verify":"required"},{"name":"privateKey", "desc":"应用私钥", "type": "textarea","verify":"required"},{"name":"alipayPublicKey", "desc":"支付宝公钥(不使用证书时必填)", "type": "textarea"},{"name":"signType","desc":"接口签名方式(推荐使用RSA2)","type":"radio","verify":"","values":"RSA,RSA2","titles":"RSA,RSA2","verify":"required"},{"name":"useCert","desc":"公钥证书","type":"radio","verify":"","values":"1,0","titles":"使用证书(请使用RSA2私钥),不使用证书"},{"name":"appPublicCert","desc":"应用公钥证书(.crt格式)","type":"file","verify":""},{"name":"alipayPublicCert","desc":"支付宝公钥证书(.crt格式)","type":"file","verify":""},{"name":"alipayRootCert","desc":"支付宝根证书(.crt格式)","type":"file","verify":""}]',
|
||||
INSERT INTO t_pay_interface_define (if_code, if_name, is_mch_mode, is_isv_mode, config_page_type, isv_params, isvsub_mch_params, normal_mch_params, way_codes, icon, bg_color, state, remark)
|
||||
VALUES ('alipay', '支付宝官方', 1, 1, 1,
|
||||
'[{"name":"sandbox","desc":"环境配置","type":"radio","verify":"","values":"1,0","titles":"沙箱环境,生产环境","verify":"required"},{"name":"pid","desc":"合作伙伴身份(PID)","type":"text","verify":"required"},{"name":"appId","desc":"应用App ID","type":"text","verify":"required"},{"name":"privateKey", "desc":"应用私钥", "type": "textarea","verify":"required","star":"1"},{"name":"alipayPublicKey", "desc":"支付宝公钥(不使用证书时必填)", "type": "textarea","star":"1"},{"name":"signType","desc":"接口签名方式(推荐使用RSA2)","type":"radio","verify":"","values":"RSA,RSA2","titles":"RSA,RSA2","verify":"required"},{"name":"useCert","desc":"公钥证书","type":"radio","verify":"","values":"1,0","titles":"使用证书(请使用RSA2私钥),不使用证书"},{"name":"appPublicCert","desc":"应用公钥证书(.crt格式)","type":"file","verify":""},{"name":"alipayPublicCert","desc":"支付宝公钥证书(.crt格式)","type":"file","verify":""},{"name":"alipayRootCert","desc":"支付宝根证书(.crt格式)","type":"file","verify":""}]',
|
||||
'[{"name":"appAuthToken", "desc":"子商户app_auth_token", "type": "text","readonly":"readonly"},{"name":"refreshToken", "desc":"子商户刷新token", "type": "hidden","readonly":"readonly"},{"name":"expireTimestamp", "desc":"authToken有效期(13位时间戳)", "type": "hidden","readonly":"readonly"}]',
|
||||
'[{"name":"sandbox","desc":"环境配置","type":"radio","verify":"","values":"1,0","titles":"沙箱环境,生产环境","verify":"required"},{"name":"appId","desc":"应用App ID","type":"text","verify":"required"},{"name":"privateKey", "desc":"应用私钥", "type": "textarea","verify":"required"},{"name":"alipayPublicKey", "desc":"支付宝公钥(不使用证书时必填)", "type": "textarea"},{"name":"signType","desc":"接口签名方式(推荐使用RSA2)","type":"radio","verify":"","values":"RSA,RSA2","titles":"RSA,RSA2","verify":"required"},{"name":"useCert","desc":"公钥证书","type":"radio","verify":"","values":"1,0","titles":"使用证书(请使用RSA2私钥),不使用证书"},{"name":"appPublicCert","desc":"应用公钥证书(.crt格式)","type":"file","verify":""},{"name":"alipayPublicCert","desc":"支付宝公钥证书(.crt格式)","type":"file","verify":""},{"name":"alipayRootCert","desc":"支付宝根证书(.crt格式)","type":"file","verify":""}]',
|
||||
'[{"name":"sandbox","desc":"环境配置","type":"radio","verify":"","values":"1,0","titles":"沙箱环境,生产环境","verify":"required"},{"name":"appId","desc":"应用App ID","type":"text","verify":"required"},{"name":"privateKey", "desc":"应用私钥", "type": "textarea","verify":"required","star":"1"},{"name":"alipayPublicKey", "desc":"支付宝公钥(不使用证书时必填)", "type": "textarea","star":"1"},{"name":"signType","desc":"接口签名方式(推荐使用RSA2)","type":"radio","verify":"","values":"RSA,RSA2","titles":"RSA,RSA2","verify":"required"},{"name":"useCert","desc":"公钥证书","type":"radio","verify":"","values":"1,0","titles":"使用证书(请使用RSA2私钥),不使用证书"},{"name":"appPublicCert","desc":"应用公钥证书(.crt格式)","type":"file","verify":""},{"name":"alipayPublicCert","desc":"支付宝公钥证书(.crt格式)","type":"file","verify":""},{"name":"alipayRootCert","desc":"支付宝根证书(.crt格式)","type":"file","verify":""}]',
|
||||
'[{"wayCode": "ALI_JSAPI"}, {"wayCode": "ALI_WAP"}, {"wayCode": "ALI_BAR"}, {"wayCode": "ALI_APP"}, {"wayCode": "ALI_PC"}, {"wayCode": "ALI_QR"}]',
|
||||
'http://jeequan.oss-cn-beijing.aliyuncs.com/jeepay/img/alipay.png', '#1779FF', 1, '支付宝官方通道');
|
||||
|
||||
INSERT INTO t_pay_interface_define (if_code, if_name, is_mch_mode, is_isv_mode, isv_params, isvsub_mch_params, normal_mch_params, way_codes, icon, bg_color, state, remark)
|
||||
VALUES ('wxpay', '微信支付官方', 1, 1,
|
||||
'[{"name":"mchId", "desc":"微信支付商户号", "type": "text","verify":"required"},{"name":"appId","desc":"应用App ID","type":"text","verify":"required"},{"name":"appSecret","desc":"应用AppSecret","type":"text","verify":"required"},{"name":"oauth2Url", "desc":"oauth2地址(置空将使用官方)", "type": "text"},{"name":"key", "desc":"API密钥", "type": "textarea","verify":"required"},{"name":"apiVersion", "desc":"微信支付API版本", "type": "radio","values":"V2,V3","titles":"V2,V3","verify":"required"},{"name":"apiV3Key", "desc":"API V3秘钥(V3接口必填)", "type": "textarea","verify":""},{"name":"serialNo", "desc":"序列号(V3接口必填)", "type": "textarea","verify":""},{"name":"cert", "desc":"API证书(.p12格式)", "type": "file","verify":""},{"name":"apiClientKey", "desc":"私钥文件(.pem格式)", "type": "file","verify":""}]',
|
||||
INSERT INTO t_pay_interface_define (if_code, if_name, is_mch_mode, is_isv_mode, config_page_type, isv_params, isvsub_mch_params, normal_mch_params, way_codes, icon, bg_color, state, remark)
|
||||
VALUES ('wxpay', '微信支付官方', 1, 1, 1,
|
||||
'[{"name":"mchId", "desc":"微信支付商户号", "type": "text","verify":"required"},{"name":"appId","desc":"应用App ID","type":"text","verify":"required"},{"name":"appSecret","desc":"应用AppSecret","type":"text","verify":"required","star":"1"},{"name":"oauth2Url", "desc":"oauth2地址(置空将使用官方)", "type": "text"},{"name":"key", "desc":"API密钥", "type": "textarea","verify":"required","star":"1"},{"name":"apiVersion", "desc":"微信支付API版本", "type": "radio","values":"V2,V3","titles":"V2,V3","verify":"required"},{"name":"apiV3Key", "desc":"API V3秘钥(V3接口必填)", "type": "textarea","verify":"","star":"1"},{"name":"serialNo", "desc":"序列号(V3接口必填)", "type": "textarea","verify":"","star":"1"},{"name":"cert", "desc":"API证书(.p12格式)", "type": "file","verify":""},{"name":"apiClientKey", "desc":"私钥文件(.pem格式)", "type": "file","verify":""}]',
|
||||
'[{"name":"subMchId","desc":"子商户ID","type":"text","verify":"required"},{"name":"subMchAppId","desc":"子账户appID(线上支付必填)","type":"text","verify":""}]',
|
||||
'[{"name":"mchId", "desc":"微信支付商户号", "type": "text","verify":"required"},{"name":"appId","desc":"应用App ID","type":"text","verify":"required"},{"name":"appSecret","desc":"应用AppSecret","type":"text","verify":"required"},{"name":"oauth2Url", "desc":"oauth2地址(置空将使用官方)", "type": "text"},{"name":"key", "desc":"API密钥", "type": "textarea","verify":"required"},{"name":"apiVersion", "desc":"微信支付API版本", "type": "radio","values":"V2,V3","titles":"V2,V3","verify":"required"},{"name":"apiV3Key", "desc":"API V3秘钥(V3接口必填)", "type": "textarea","verify":""},{"name":"serialNo", "desc":"序列号(V3接口必填)", "type": "textarea","verify":""},{"name":"cert", "desc":"API证书(.p12格式)", "type": "file","verify":""},{"name":"apiClientKey", "desc":"私钥文件(.pem格式)", "type": "file","verify":""}]',
|
||||
'[{"name":"mchId", "desc":"微信支付商户号", "type": "text","verify":"required"},{"name":"appId","desc":"应用App ID","type":"text","verify":"required"},{"name":"appSecret","desc":"应用AppSecret","type":"text","verify":"required","star":"1"},{"name":"oauth2Url", "desc":"oauth2地址(置空将使用官方)", "type": "text"},{"name":"key", "desc":"API密钥", "type": "textarea","verify":"required","star":"1"},{"name":"apiVersion", "desc":"微信支付API版本", "type": "radio","values":"V2,V3","titles":"V2,V3","verify":"required"},{"name":"apiV3Key", "desc":"API V3秘钥(V3接口必填)", "type": "textarea","verify":"","star":"1"},{"name":"serialNo", "desc":"序列号(V3接口必填)", "type": "textarea","verify":"","star":"1" },{"name":"cert", "desc":"API证书(.p12格式)", "type": "file","verify":""},{"name":"apiClientKey", "desc":"私钥文件(.pem格式)", "type": "file","verify":""}]',
|
||||
'[{"wayCode": "WX_APP"}, {"wayCode": "WX_H5"}, {"wayCode": "WX_NATIVE"}, {"wayCode": "WX_JSAPI"}, {"wayCode": "WX_BAR"}, {"wayCode": "WX_LITE"}]',
|
||||
'http://jeequan.oss-cn-beijing.aliyuncs.com/jeepay/img/wxpay.png', '#04BE02', 1, '微信官方通道');
|
||||
|
||||
INSERT INTO t_pay_interface_define (if_code, if_name, is_mch_mode, is_isv_mode, isv_params, isvsub_mch_params, normal_mch_params, way_codes, icon, bg_color, state, remark)
|
||||
VALUES ('ysfpay', '云闪付官方', 0, 1,
|
||||
'[{"name":"sandbox","desc":"环境配置","type":"radio","verify":"","values":"1,0","titles":"沙箱环境,生产环境","verify":"required"},{"name":"serProvId","desc":"服务商开发ID[serProvId]","type":"text","verify":"required"},{"name":"isvPrivateCertFile","desc":"服务商私钥文件(.pfx格式)","type":"file","verify":"required"},{"name":"isvPrivateCertPwd","desc":"服务商私钥文件密码","type":"text","verify":"required"},{"name":"ysfpayPublicKey","desc":"云闪付开发公钥(证书管理页面可查询)","type":"textarea","verify":"required"},{"name":"acqOrgCode","desc":"可用支付机构编号","type":"text","verify":"required"}]',
|
||||
INSERT INTO t_pay_interface_define (if_code, if_name, is_mch_mode, is_isv_mode, config_page_type, isv_params, isvsub_mch_params, normal_mch_params, way_codes, icon, bg_color, state, remark)
|
||||
VALUES ('ysfpay', '云闪付官方', 0, 1, 1,
|
||||
'[{"name":"sandbox","desc":"环境配置","type":"radio","verify":"","values":"1,0","titles":"沙箱环境,生产环境","verify":"required"},{"name":"serProvId","desc":"服务商开发ID[serProvId]","type":"text","verify":"required"},{"name":"isvPrivateCertFile","desc":"服务商私钥文件(.pfx格式)","type":"file","verify":"required"},{"name":"isvPrivateCertPwd","desc":"服务商私钥文件密码","type":"text","verify":"required","star":"1"},{"name":"ysfpayPublicKey","desc":"云闪付开发公钥(证书管理页面可查询)","type":"textarea","verify":"required","star":"1"},{"name":"acqOrgCode","desc":"可用支付机构编号","type":"text","verify":"required"}]',
|
||||
'[{"name":"merId","desc":"商户编号","type":"text","verify":"required"}]',
|
||||
NULL,
|
||||
'[{"wayCode": "YSF_BAR"}, {"wayCode": "ALI_JSAPI"}, {"wayCode": "WX_JSAPI"}, {"wayCode": "ALI_BAR"}, {"wayCode": "WX_BAR"}]',
|
||||
|
@ -10,5 +10,35 @@ ALTER TABLE `t_mch_notify_record` ADD COLUMN `notify_count_limit` INT(11) NOT NU
|
||||
## -- ++++ ++++
|
||||
|
||||
|
||||
-- 支付接口定义表 新增支付参数配置页面是否为自定义
|
||||
ALTER TABLE `t_pay_interface_define` ADD COLUMN `config_page_type` TINYINT(6) NOT NULL DEFAULT 1 COMMENT '支付参数配置页面类型:1-JSON渲染,2-自定义' after `is_isv_mode`;
|
||||
|
||||
-- 优化支付接口定义初始化,新增是否为脱敏数据
|
||||
DELETE FROM t_pay_interface_define WHERE if_code = 'alipay';
|
||||
INSERT INTO t_pay_interface_define (if_code, if_name, is_mch_mode, is_isv_mode, config_page_type, isv_params, isvsub_mch_params, normal_mch_params, way_codes, icon, bg_color, state, remark)
|
||||
VALUES ('alipay', '支付宝官方', 1, 1, 1,
|
||||
'[{"name":"sandbox","desc":"环境配置","type":"radio","verify":"","values":"1,0","titles":"沙箱环境,生产环境","verify":"required"},{"name":"pid","desc":"合作伙伴身份(PID)","type":"text","verify":"required"},{"name":"appId","desc":"应用App ID","type":"text","verify":"required"},{"name":"privateKey", "desc":"应用私钥", "type": "textarea","verify":"required","star":"1"},{"name":"alipayPublicKey", "desc":"支付宝公钥(不使用证书时必填)", "type": "textarea","star":"1"},{"name":"signType","desc":"接口签名方式(推荐使用RSA2)","type":"radio","verify":"","values":"RSA,RSA2","titles":"RSA,RSA2","verify":"required"},{"name":"useCert","desc":"公钥证书","type":"radio","verify":"","values":"1,0","titles":"使用证书(请使用RSA2私钥),不使用证书"},{"name":"appPublicCert","desc":"应用公钥证书(.crt格式)","type":"file","verify":""},{"name":"alipayPublicCert","desc":"支付宝公钥证书(.crt格式)","type":"file","verify":""},{"name":"alipayRootCert","desc":"支付宝根证书(.crt格式)","type":"file","verify":""}]',
|
||||
'[{"name":"appAuthToken", "desc":"子商户app_auth_token", "type": "text","readonly":"readonly"},{"name":"refreshToken", "desc":"子商户刷新token", "type": "hidden","readonly":"readonly"},{"name":"expireTimestamp", "desc":"authToken有效期(13位时间戳)", "type": "hidden","readonly":"readonly"}]',
|
||||
'[{"name":"sandbox","desc":"环境配置","type":"radio","verify":"","values":"1,0","titles":"沙箱环境,生产环境","verify":"required"},{"name":"appId","desc":"应用App ID","type":"text","verify":"required"},{"name":"privateKey", "desc":"应用私钥", "type": "textarea","verify":"required","star":"1"},{"name":"alipayPublicKey", "desc":"支付宝公钥(不使用证书时必填)", "type": "textarea","star":"1"},{"name":"signType","desc":"接口签名方式(推荐使用RSA2)","type":"radio","verify":"","values":"RSA,RSA2","titles":"RSA,RSA2","verify":"required"},{"name":"useCert","desc":"公钥证书","type":"radio","verify":"","values":"1,0","titles":"使用证书(请使用RSA2私钥),不使用证书"},{"name":"appPublicCert","desc":"应用公钥证书(.crt格式)","type":"file","verify":""},{"name":"alipayPublicCert","desc":"支付宝公钥证书(.crt格式)","type":"file","verify":""},{"name":"alipayRootCert","desc":"支付宝根证书(.crt格式)","type":"file","verify":""}]',
|
||||
'[{"wayCode": "ALI_JSAPI"}, {"wayCode": "ALI_WAP"}, {"wayCode": "ALI_BAR"}, {"wayCode": "ALI_APP"}, {"wayCode": "ALI_PC"}, {"wayCode": "ALI_QR"}]',
|
||||
'http://jeequan.oss-cn-beijing.aliyuncs.com/jeepay/img/alipay.png', '#1779FF', 1, '支付宝官方通道');
|
||||
|
||||
DELETE FROM t_pay_interface_define WHERE if_code = 'wxpay';
|
||||
INSERT INTO t_pay_interface_define (if_code, if_name, is_mch_mode, is_isv_mode, config_page_type, isv_params, isvsub_mch_params, normal_mch_params, way_codes, icon, bg_color, state, remark)
|
||||
VALUES ('wxpay', '微信支付官方', 1, 1, 1,
|
||||
'[{"name":"mchId", "desc":"微信支付商户号", "type": "text","verify":"required"},{"name":"appId","desc":"应用App ID","type":"text","verify":"required"},{"name":"appSecret","desc":"应用AppSecret","type":"text","verify":"required","star":"1"},{"name":"oauth2Url", "desc":"oauth2地址(置空将使用官方)", "type": "text"},{"name":"key", "desc":"API密钥", "type": "textarea","verify":"required","star":"1"},{"name":"apiVersion", "desc":"微信支付API版本", "type": "radio","values":"V2,V3","titles":"V2,V3","verify":"required"},{"name":"apiV3Key", "desc":"API V3秘钥(V3接口必填)", "type": "textarea","verify":"","star":"1"},{"name":"serialNo", "desc":"序列号(V3接口必填)", "type": "textarea","verify":"","star":"1"},{"name":"cert", "desc":"API证书(.p12格式)", "type": "file","verify":""},{"name":"apiClientKey", "desc":"私钥文件(.pem格式)", "type": "file","verify":""}]',
|
||||
'[{"name":"subMchId","desc":"子商户ID","type":"text","verify":"required"},{"name":"subMchAppId","desc":"子账户appID(线上支付必填)","type":"text","verify":""}]',
|
||||
'[{"name":"mchId", "desc":"微信支付商户号", "type": "text","verify":"required"},{"name":"appId","desc":"应用App ID","type":"text","verify":"required"},{"name":"appSecret","desc":"应用AppSecret","type":"text","verify":"required","star":"1"},{"name":"oauth2Url", "desc":"oauth2地址(置空将使用官方)", "type": "text"},{"name":"key", "desc":"API密钥", "type": "textarea","verify":"required","star":"1"},{"name":"apiVersion", "desc":"微信支付API版本", "type": "radio","values":"V2,V3","titles":"V2,V3","verify":"required"},{"name":"apiV3Key", "desc":"API V3秘钥(V3接口必填)", "type": "textarea","verify":"","star":"1"},{"name":"serialNo", "desc":"序列号(V3接口必填)", "type": "textarea","verify":"","star":"1" },{"name":"cert", "desc":"API证书(.p12格式)", "type": "file","verify":""},{"name":"apiClientKey", "desc":"私钥文件(.pem格式)", "type": "file","verify":""}]',
|
||||
'[{"wayCode": "WX_APP"}, {"wayCode": "WX_H5"}, {"wayCode": "WX_NATIVE"}, {"wayCode": "WX_JSAPI"}, {"wayCode": "WX_BAR"}, {"wayCode": "WX_LITE"}]',
|
||||
'http://jeequan.oss-cn-beijing.aliyuncs.com/jeepay/img/wxpay.png', '#04BE02', 1, '微信官方通道');
|
||||
|
||||
DELETE FROM t_pay_interface_define WHERE if_code = 'ysfpay';
|
||||
INSERT INTO t_pay_interface_define (if_code, if_name, is_mch_mode, is_isv_mode, config_page_type, isv_params, isvsub_mch_params, normal_mch_params, way_codes, icon, bg_color, state, remark)
|
||||
VALUES ('ysfpay', '云闪付官方', 0, 1, 1,
|
||||
'[{"name":"sandbox","desc":"环境配置","type":"radio","verify":"","values":"1,0","titles":"沙箱环境,生产环境","verify":"required"},{"name":"serProvId","desc":"服务商开发ID[serProvId]","type":"text","verify":"required"},{"name":"isvPrivateCertFile","desc":"服务商私钥文件(.pfx格式)","type":"file","verify":"required"},{"name":"isvPrivateCertPwd","desc":"服务商私钥文件密码","type":"text","verify":"required","star":"1"},{"name":"ysfpayPublicKey","desc":"云闪付开发公钥(证书管理页面可查询)","type":"textarea","verify":"required","star":"1"},{"name":"acqOrgCode","desc":"可用支付机构编号","type":"text","verify":"required"}]',
|
||||
'[{"name":"merId","desc":"商户编号","type":"text","verify":"required"}]',
|
||||
NULL,
|
||||
'[{"wayCode": "YSF_BAR"}, {"wayCode": "ALI_JSAPI"}, {"wayCode": "WX_JSAPI"}, {"wayCode": "ALI_BAR"}, {"wayCode": "WX_BAR"}]',
|
||||
'http://jeequan.oss-cn-beijing.aliyuncs.com/jeepay/img/ysfpay.png', 'red', 1, '云闪付官方通道');
|
||||
|
||||
|
||||
|
@ -70,6 +70,11 @@ public class PayInterfaceDefine extends BaseModel implements Serializable {
|
||||
*/
|
||||
private Byte isIsvMode;
|
||||
|
||||
/**
|
||||
* 支付参数配置页面类型:1-JSON渲染,2-自定义
|
||||
*/
|
||||
private Byte configPageType;
|
||||
|
||||
/**
|
||||
* ISV接口配置定义描述,json字符串
|
||||
*/
|
||||
|
@ -21,12 +21,13 @@ import com.jeequan.jeepay.core.model.params.alipay.AlipayIsvParams;
|
||||
import com.jeequan.jeepay.core.model.params.wxpay.WxpayIsvParams;
|
||||
import com.jeequan.jeepay.core.model.params.ysf.YsfpayIsvParams;
|
||||
|
||||
/*
|
||||
/**
|
||||
* 抽象类 isv参数定义
|
||||
*
|
||||
* @author terrfly
|
||||
* @site https://www.jeepay.vip
|
||||
* @date 2021/6/8 16:33
|
||||
* @modify ZhuXiao
|
||||
*/
|
||||
public abstract class IsvParams {
|
||||
|
||||
@ -42,4 +43,9 @@ public abstract class IsvParams {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 敏感数据脱敏
|
||||
*/
|
||||
public abstract String deSenData();
|
||||
|
||||
}
|
||||
|
@ -39,4 +39,9 @@ public abstract class NormalMchParams {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 敏感数据脱敏
|
||||
*/
|
||||
public abstract String deSenData();
|
||||
|
||||
}
|
||||
|
@ -15,8 +15,12 @@
|
||||
*/
|
||||
package com.jeequan.jeepay.core.model.params.alipay;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jeequan.jeepay.core.model.params.IsvParams;
|
||||
import com.jeequan.jeepay.core.utils.StringKit;
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
/*
|
||||
* 支付宝 isv参数定义
|
||||
@ -58,4 +62,17 @@ public class AlipayIsvParams extends IsvParams {
|
||||
/** 支付宝根证书 **/
|
||||
private String alipayRootCert;
|
||||
|
||||
@Override
|
||||
public String deSenData() {
|
||||
|
||||
AlipayIsvParams isvParams = this;
|
||||
if (StringUtils.isNotBlank(this.privateKey)) {
|
||||
isvParams.setPrivateKey(StringKit.str2Star(this.privateKey, 4, 4, 6));
|
||||
}
|
||||
if (StringUtils.isNotBlank(this.alipayPublicKey)) {
|
||||
isvParams.setAlipayPublicKey(StringKit.str2Star(this.alipayPublicKey, 6, 6, 6));
|
||||
}
|
||||
return ((JSONObject) JSON.toJSON(isvParams)).toJSONString();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,8 +15,12 @@
|
||||
*/
|
||||
package com.jeequan.jeepay.core.model.params.alipay;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jeequan.jeepay.core.model.params.NormalMchParams;
|
||||
import com.jeequan.jeepay.core.utils.StringKit;
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
/*
|
||||
* 支付宝 普通商户参数定义
|
||||
@ -55,5 +59,17 @@ public class AlipayNormalMchParams extends NormalMchParams {
|
||||
/** 支付宝根证书 **/
|
||||
private String alipayRootCert;
|
||||
|
||||
@Override
|
||||
public String deSenData() {
|
||||
|
||||
AlipayNormalMchParams mchParams = this;
|
||||
if (StringUtils.isNotBlank(this.privateKey)) {
|
||||
mchParams.setPrivateKey(StringKit.str2Star(this.privateKey, 4, 4, 6));
|
||||
}
|
||||
if (StringUtils.isNotBlank(this.alipayPublicKey)) {
|
||||
mchParams.setAlipayPublicKey(StringKit.str2Star(this.alipayPublicKey, 6, 6, 6));
|
||||
}
|
||||
return ((JSONObject) JSON.toJSON(mchParams)).toJSONString();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,8 +15,12 @@
|
||||
*/
|
||||
package com.jeequan.jeepay.core.model.params.wxpay;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jeequan.jeepay.core.model.params.IsvParams;
|
||||
import com.jeequan.jeepay.core.utils.StringKit;
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
/*
|
||||
* 微信官方支付 配置参数
|
||||
@ -61,4 +65,23 @@ public class WxpayIsvParams extends IsvParams {
|
||||
/** 私钥文件(.pem格式) **/
|
||||
private String apiClientKey;
|
||||
|
||||
|
||||
@Override
|
||||
public String deSenData() {
|
||||
|
||||
WxpayIsvParams isvParams = this;
|
||||
if (StringUtils.isNotBlank(this.appSecret)) {
|
||||
isvParams.setAppSecret(StringKit.str2Star(this.appSecret, 4, 4, 6));
|
||||
}
|
||||
if (StringUtils.isNotBlank(this.key)) {
|
||||
isvParams.setKey(StringKit.str2Star(this.key, 4, 4, 6));
|
||||
}
|
||||
if (StringUtils.isNotBlank(this.apiV3Key)) {
|
||||
isvParams.setApiV3Key(StringKit.str2Star(this.apiV3Key, 4, 4, 6));
|
||||
}
|
||||
if (StringUtils.isNotBlank(this.serialNo)) {
|
||||
isvParams.setSerialNo(StringKit.str2Star(this.serialNo, 4, 4, 6));
|
||||
}
|
||||
return ((JSONObject)JSON.toJSON(isvParams)).toJSONString();
|
||||
}
|
||||
}
|
||||
|
@ -15,8 +15,12 @@
|
||||
*/
|
||||
package com.jeequan.jeepay.core.model.params.wxpay;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jeequan.jeepay.core.model.params.NormalMchParams;
|
||||
import com.jeequan.jeepay.core.utils.StringKit;
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
/*
|
||||
* 微信官方支付 配置参数
|
||||
@ -28,34 +32,72 @@ import lombok.Data;
|
||||
@Data
|
||||
public class WxpayNormalMchParams extends NormalMchParams {
|
||||
|
||||
/** 应用App ID */
|
||||
/**
|
||||
* 应用App ID
|
||||
*/
|
||||
private String appId;
|
||||
|
||||
/** 应用AppSecret */
|
||||
/**
|
||||
* 应用AppSecret
|
||||
*/
|
||||
private String appSecret;
|
||||
|
||||
/** 微信支付商户号 */
|
||||
/**
|
||||
* 微信支付商户号
|
||||
*/
|
||||
private String mchId;
|
||||
|
||||
/** oauth2地址 */
|
||||
/**
|
||||
* oauth2地址
|
||||
*/
|
||||
private String oauth2Url;
|
||||
|
||||
/** API密钥 */
|
||||
/**
|
||||
* API密钥
|
||||
*/
|
||||
private String key;
|
||||
|
||||
/** 微信支付API版本 **/
|
||||
/**
|
||||
* 微信支付API版本
|
||||
**/
|
||||
private String apiVersion;
|
||||
|
||||
/** API V3秘钥 **/
|
||||
/**
|
||||
* API V3秘钥
|
||||
**/
|
||||
private String apiV3Key;
|
||||
|
||||
/** 序列号 **/
|
||||
/**
|
||||
* 序列号
|
||||
**/
|
||||
private String serialNo;
|
||||
|
||||
/** API证书(.p12格式)**/
|
||||
/**
|
||||
* API证书(.p12格式)
|
||||
**/
|
||||
private String cert;
|
||||
|
||||
/** 私钥文件(.pem格式) **/
|
||||
/**
|
||||
* 私钥文件(.pem格式)
|
||||
**/
|
||||
private String apiClientKey;
|
||||
|
||||
@Override
|
||||
public String deSenData() {
|
||||
WxpayNormalMchParams mchParams = this;
|
||||
if (StringUtils.isNotBlank(this.appSecret)) {
|
||||
mchParams.setAppSecret(StringKit.str2Star(this.appSecret, 4, 4, 6));
|
||||
}
|
||||
if (StringUtils.isNotBlank(this.key)) {
|
||||
mchParams.setKey(StringKit.str2Star(this.key, 4, 4, 6));
|
||||
}
|
||||
if (StringUtils.isNotBlank(this.apiV3Key)) {
|
||||
mchParams.setApiV3Key(StringKit.str2Star(this.apiV3Key, 4, 4, 6));
|
||||
}
|
||||
if (StringUtils.isNotBlank(this.serialNo)) {
|
||||
mchParams.setSerialNo(StringKit.str2Star(this.serialNo, 4, 4, 6));
|
||||
}
|
||||
return ((JSONObject) JSON.toJSON(mchParams)).toJSONString();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,8 +15,12 @@
|
||||
*/
|
||||
package com.jeequan.jeepay.core.model.params.ysf;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jeequan.jeepay.core.model.params.IsvParams;
|
||||
import com.jeequan.jeepay.core.utils.StringKit;
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
/*
|
||||
* 云闪付 配置信息
|
||||
@ -46,4 +50,17 @@ public class YsfpayIsvParams extends IsvParams {
|
||||
/** acqOrgCodeList 支付机构号 **/
|
||||
private String acqOrgCode;
|
||||
|
||||
@Override
|
||||
public String deSenData() {
|
||||
|
||||
YsfpayIsvParams isvParams = this;
|
||||
if (StringUtils.isNotBlank(this.isvPrivateCertPwd)) {
|
||||
isvParams.setIsvPrivateCertPwd(StringKit.str2Star(this.isvPrivateCertPwd, 0, 3, 6));
|
||||
}
|
||||
if (StringUtils.isNotBlank(this.ysfpayPublicKey)) {
|
||||
isvParams.setYsfpayPublicKey(StringKit.str2Star(this.ysfpayPublicKey, 6, 6, 6));
|
||||
}
|
||||
return ((JSONObject) JSON.toJSON(isvParams)).toJSONString();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -16,6 +16,7 @@
|
||||
package com.jeequan.jeepay.core.utils;
|
||||
|
||||
import cn.hutool.core.net.url.UrlBuilder;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.Map;
|
||||
@ -65,4 +66,83 @@ public class StringKit {
|
||||
return url.startsWith("http://") ||url.startsWith("https://");
|
||||
}
|
||||
|
||||
/**
|
||||
* 对字符加星号处理:除前面几位和后面几位外,其他的字符以星号代替
|
||||
*
|
||||
* @param content 传入的字符串
|
||||
* @param frontNum 保留前面字符的位数
|
||||
* @param endNum 保留后面字符的位数
|
||||
* @return 带星号的字符串
|
||||
*/
|
||||
public static String str2Star2(String content, int frontNum, int endNum) {
|
||||
if (frontNum >= content.length() || frontNum < 0) {
|
||||
return content;
|
||||
}
|
||||
if (endNum >= content.length() || endNum < 0) {
|
||||
return content;
|
||||
}
|
||||
if (frontNum + endNum >= content.length()) {
|
||||
return content;
|
||||
}
|
||||
String starStr = "";
|
||||
for (int i = 0; i < (content.length() - frontNum - endNum); i++) {
|
||||
starStr = starStr + "*";
|
||||
}
|
||||
return content.substring(0, frontNum) + starStr
|
||||
+ content.substring(content.length() - endNum, content.length());
|
||||
}
|
||||
|
||||
/**
|
||||
* 对字符加星号处理:除前面几位和后面几位外,其他的字符以星号代替
|
||||
*
|
||||
* @param content 传入的字符串
|
||||
* @param frontNum 保留前面字符的位数
|
||||
* @param endNum 保留后面字符的位数
|
||||
* @param starNum 指定star的数量
|
||||
* @return 带星号的字符串
|
||||
*/
|
||||
public static String str2Star(String content, int frontNum, int endNum, int starNum) {
|
||||
if (frontNum >= content.length() || frontNum < 0) {
|
||||
return content;
|
||||
}
|
||||
if (endNum >= content.length() || endNum < 0) {
|
||||
return content;
|
||||
}
|
||||
if (frontNum + endNum >= content.length()) {
|
||||
return content;
|
||||
}
|
||||
String starStr = "";
|
||||
for (int i = 0; i < starNum; i++) {
|
||||
starStr = starStr + "*";
|
||||
}
|
||||
return content.substring(0, frontNum) + starStr
|
||||
+ content.substring(content.length() - endNum, content.length());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 合并两个json字符串
|
||||
* key相同,则后者覆盖前者的值
|
||||
* key不同,则合并至前者
|
||||
* @param originStr
|
||||
* @param mergeStr
|
||||
* @return 合并后的json字符串
|
||||
*/
|
||||
public static String marge(String originStr, String mergeStr) {
|
||||
|
||||
if (StringUtils.isAnyBlank(originStr, mergeStr)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
JSONObject originJSON = JSONObject.parseObject(originStr);
|
||||
JSONObject mergeJSON = JSONObject.parseObject(mergeStr);
|
||||
|
||||
if (originJSON == null || mergeJSON == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
originJSON.putAll(mergeJSON);
|
||||
return originJSON.toJSONString();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,21 +15,26 @@
|
||||
*/
|
||||
package com.jeequan.jeepay.mgr.ctrl.isv;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jeequan.jeepay.core.aop.MethodLog;
|
||||
import com.jeequan.jeepay.core.constants.ApiCodeEnum;
|
||||
import com.jeequan.jeepay.core.constants.CS;
|
||||
import com.jeequan.jeepay.core.entity.PayInterfaceConfig;
|
||||
import com.jeequan.jeepay.core.entity.PayInterfaceDefine;
|
||||
import com.jeequan.jeepay.core.model.ApiRes;
|
||||
import com.jeequan.jeepay.core.model.params.IsvParams;
|
||||
import com.jeequan.jeepay.core.mq.MqCommonService;
|
||||
import com.jeequan.jeepay.core.utils.StringKit;
|
||||
import com.jeequan.jeepay.mgr.ctrl.CommonCtrl;
|
||||
import com.jeequan.jeepay.service.impl.PayInterfaceConfigService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 服务商支付接口管理类
|
||||
@ -67,8 +72,16 @@ public class IsvPayInterfaceConfigController extends CommonCtrl {
|
||||
@GetMapping("/{isvNo}/{ifCode}")
|
||||
public ApiRes getByMchNo(@PathVariable(value = "isvNo") String isvNo, @PathVariable(value = "ifCode") String ifCode) {
|
||||
PayInterfaceConfig payInterfaceConfig = payInterfaceConfigService.getByInfoIdAndIfCode(CS.INFO_TYPE_ISV, isvNo, ifCode);
|
||||
if (payInterfaceConfig != null && payInterfaceConfig.getIfRate() != null) {
|
||||
payInterfaceConfig.setIfRate(payInterfaceConfig.getIfRate().multiply(new BigDecimal("100")));
|
||||
if (payInterfaceConfig != null) {
|
||||
if (payInterfaceConfig.getIfRate() != null) {
|
||||
payInterfaceConfig.setIfRate(payInterfaceConfig.getIfRate().multiply(new BigDecimal("100")));
|
||||
}
|
||||
if (StringUtils.isNotBlank(payInterfaceConfig.getIfParams())) {
|
||||
IsvParams isvParams = IsvParams.factory(payInterfaceConfig.getIfCode(), payInterfaceConfig.getIfParams());
|
||||
if (isvParams != null) {
|
||||
payInterfaceConfig.setIfParams(isvParams.deSenData());
|
||||
}
|
||||
}
|
||||
}
|
||||
return ApiRes.ok(payInterfaceConfig);
|
||||
}
|
||||
@ -105,6 +118,9 @@ public class IsvPayInterfaceConfigController extends CommonCtrl {
|
||||
//若配置存在,为saveOrUpdate添加ID,第一次配置添加创建者
|
||||
if (dbRecoed != null) {
|
||||
payInterfaceConfig.setId(dbRecoed.getId());
|
||||
|
||||
// 合并支付参数
|
||||
payInterfaceConfig.setIfParams(StringKit.marge(dbRecoed.getIfParams(), payInterfaceConfig.getIfParams()));
|
||||
}else {
|
||||
payInterfaceConfig.setCreatedUid(userId);
|
||||
payInterfaceConfig.setCreatedBy(realName);
|
||||
|
@ -26,6 +26,7 @@ import com.jeequan.jeepay.core.entity.MchApp;
|
||||
import com.jeequan.jeepay.core.model.ApiRes;
|
||||
import com.jeequan.jeepay.core.mq.MqCommonService;
|
||||
import com.jeequan.jeepay.core.utils.JsonKit;
|
||||
import com.jeequan.jeepay.core.utils.StringKit;
|
||||
import com.jeequan.jeepay.mgr.ctrl.CommonCtrl;
|
||||
import com.jeequan.jeepay.service.impl.MchAppService;
|
||||
import com.jeequan.jeepay.service.impl.MchInfoService;
|
||||
@ -59,14 +60,7 @@ public class MchAppController extends CommonCtrl {
|
||||
public ApiRes list() {
|
||||
MchApp mchApp = getObject(MchApp.class);
|
||||
|
||||
LambdaQueryWrapper<MchApp> wrapper = MchApp.gw();
|
||||
if (StringUtils.isNotEmpty(mchApp.getMchNo())) wrapper.eq(MchApp::getMchNo, mchApp.getMchNo());
|
||||
if (StringUtils.isNotEmpty(mchApp.getAppId())) wrapper.eq(MchApp::getAppId, mchApp.getAppId());
|
||||
if (StringUtils.isNotEmpty(mchApp.getAppName())) wrapper.eq(MchApp::getAppName, mchApp.getAppName());
|
||||
if (mchApp.getState() != null) wrapper.eq(MchApp::getState, mchApp.getState());
|
||||
wrapper.orderByDesc(MchApp::getCreatedAt);
|
||||
|
||||
IPage<MchApp> pages = mchAppService.page(getIPage(), wrapper);
|
||||
IPage<MchApp> pages = mchAppService.selectPage(getIPage(), mchApp);
|
||||
return ApiRes.ok(pages);
|
||||
}
|
||||
|
||||
@ -101,7 +95,7 @@ public class MchAppController extends CommonCtrl {
|
||||
@PreAuthorize("hasAnyAuthority('ENT_MCH_APP_VIEW', 'ENT_MCH_APP_EDIT')")
|
||||
@GetMapping("/{appId}")
|
||||
public ApiRes detail(@PathVariable("appId") String appId) {
|
||||
MchApp mchApp = mchAppService.getById(appId);
|
||||
MchApp mchApp = mchAppService.selectById(appId);
|
||||
if (mchApp == null) {
|
||||
return ApiRes.fail(ApiCodeEnum.SYS_OPERATION_FAIL_SELETE);
|
||||
}
|
||||
|
@ -20,14 +20,19 @@ import com.jeequan.jeepay.core.aop.MethodLog;
|
||||
import com.jeequan.jeepay.core.constants.ApiCodeEnum;
|
||||
import com.jeequan.jeepay.core.constants.CS;
|
||||
import com.jeequan.jeepay.core.entity.MchApp;
|
||||
import com.jeequan.jeepay.core.entity.MchInfo;
|
||||
import com.jeequan.jeepay.core.entity.PayInterfaceConfig;
|
||||
import com.jeequan.jeepay.core.entity.PayInterfaceDefine;
|
||||
import com.jeequan.jeepay.core.model.ApiRes;
|
||||
import com.jeequan.jeepay.core.model.params.NormalMchParams;
|
||||
import com.jeequan.jeepay.core.mq.MqCommonService;
|
||||
import com.jeequan.jeepay.core.utils.JsonKit;
|
||||
import com.jeequan.jeepay.core.utils.StringKit;
|
||||
import com.jeequan.jeepay.mgr.ctrl.CommonCtrl;
|
||||
import com.jeequan.jeepay.service.impl.MchAppService;
|
||||
import com.jeequan.jeepay.service.impl.MchInfoService;
|
||||
import com.jeequan.jeepay.service.impl.PayInterfaceConfigService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@ -47,8 +52,9 @@ import java.util.List;
|
||||
public class MchPayInterfaceConfigController extends CommonCtrl {
|
||||
|
||||
@Autowired private PayInterfaceConfigService payInterfaceConfigService;
|
||||
@Autowired private MchAppService mchAppService;
|
||||
@Autowired private MqCommonService mqCommonService;
|
||||
@Autowired private MchAppService mchAppService;
|
||||
@Autowired private MchInfoService mchInfoService;
|
||||
|
||||
/**
|
||||
* @Author: ZhuXiao
|
||||
@ -72,8 +78,25 @@ public class MchPayInterfaceConfigController extends CommonCtrl {
|
||||
@GetMapping("/{appId}/{ifCode}")
|
||||
public ApiRes getByAppId(@PathVariable(value = "appId") String appId, @PathVariable(value = "ifCode") String ifCode) {
|
||||
PayInterfaceConfig payInterfaceConfig = payInterfaceConfigService.getByInfoIdAndIfCode(CS.INFO_TYPE_MCH_APP, appId, ifCode);
|
||||
if (payInterfaceConfig != null && payInterfaceConfig.getIfRate() != null) {
|
||||
payInterfaceConfig.setIfRate(payInterfaceConfig.getIfRate().multiply(new BigDecimal("100")));
|
||||
if (payInterfaceConfig != null) {
|
||||
// 费率转换为百分比数值
|
||||
if (payInterfaceConfig.getIfRate() != null) {
|
||||
payInterfaceConfig.setIfRate(payInterfaceConfig.getIfRate().multiply(new BigDecimal("100")));
|
||||
}
|
||||
|
||||
// 敏感数据脱敏
|
||||
if (StringUtils.isNotBlank(payInterfaceConfig.getIfParams())) {
|
||||
MchApp mchApp = mchAppService.getById(appId);
|
||||
MchInfo mchInfo = mchInfoService.getById(mchApp.getMchNo());
|
||||
|
||||
// 普通商户的支付参数执行数据脱敏
|
||||
if (mchInfo.getType() == CS.MCH_TYPE_NORMAL) {
|
||||
NormalMchParams mchParams = NormalMchParams.factory(payInterfaceConfig.getIfCode(), payInterfaceConfig.getIfParams());
|
||||
if (mchParams != null) {
|
||||
payInterfaceConfig.setIfParams(mchParams.deSenData());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return ApiRes.ok(payInterfaceConfig);
|
||||
}
|
||||
@ -116,6 +139,9 @@ public class MchPayInterfaceConfigController extends CommonCtrl {
|
||||
//若配置存在,为saveOrUpdate添加ID,第一次配置添加创建者
|
||||
if (dbRecoed != null) {
|
||||
payInterfaceConfig.setId(dbRecoed.getId());
|
||||
|
||||
// 合并支付参数
|
||||
payInterfaceConfig.setIfParams(StringKit.marge(dbRecoed.getIfParams(), payInterfaceConfig.getIfParams()));
|
||||
}else {
|
||||
payInterfaceConfig.setCreatedUid(userId);
|
||||
payInterfaceConfig.setCreatedBy(realName);
|
||||
|
@ -57,15 +57,9 @@ public class MchAppController extends CommonCtrl {
|
||||
@GetMapping
|
||||
public ApiRes list() {
|
||||
MchApp mchApp = getObject(MchApp.class);
|
||||
mchApp.setMchNo(getCurrentMchNo());
|
||||
|
||||
LambdaQueryWrapper<MchApp> wrapper = MchApp.gw();
|
||||
wrapper.eq(MchApp::getMchNo, getCurrentMchNo());
|
||||
if (StringUtils.isNotEmpty(mchApp.getAppId())) wrapper.eq(MchApp::getAppId, mchApp.getAppId());
|
||||
if (StringUtils.isNotEmpty(mchApp.getAppName())) wrapper.eq(MchApp::getAppName, mchApp.getAppName());
|
||||
if (mchApp.getState() != null) wrapper.eq(MchApp::getState, mchApp.getState());
|
||||
wrapper.orderByDesc(MchApp::getCreatedAt);
|
||||
|
||||
IPage<MchApp> pages = mchAppService.page(getIPage(true), wrapper);
|
||||
IPage<MchApp> pages = mchAppService.selectPage(getIPage(true), mchApp);
|
||||
return ApiRes.ok(pages);
|
||||
}
|
||||
|
||||
@ -97,7 +91,7 @@ public class MchAppController extends CommonCtrl {
|
||||
@PreAuthorize("hasAnyAuthority('ENT_MCH_APP_VIEW', 'ENT_MCH_APP_EDIT')")
|
||||
@GetMapping("/{appId}")
|
||||
public ApiRes detail(@PathVariable("appId") String appId) {
|
||||
MchApp mchApp = mchAppService.getById(appId);
|
||||
MchApp mchApp = mchAppService.selectById(appId);
|
||||
|
||||
if (mchApp == null || !mchApp.getMchNo().equals(getCurrentMchNo())) {
|
||||
return ApiRes.fail(ApiCodeEnum.SYS_OPERATION_FAIL_SELETE);
|
||||
|
@ -18,16 +18,20 @@ package com.jeequan.jeepay.mch.ctrl.merchant;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jeequan.jeepay.core.aop.MethodLog;
|
||||
import com.jeequan.jeepay.core.constants.CS;
|
||||
import com.jeequan.jeepay.core.entity.MchApp;
|
||||
import com.jeequan.jeepay.core.entity.MchInfo;
|
||||
import com.jeequan.jeepay.core.entity.PayInterfaceConfig;
|
||||
import com.jeequan.jeepay.core.entity.PayInterfaceDefine;
|
||||
import com.jeequan.jeepay.core.exception.BizException;
|
||||
import com.jeequan.jeepay.core.model.ApiRes;
|
||||
import com.jeequan.jeepay.core.model.params.NormalMchParams;
|
||||
import com.jeequan.jeepay.core.mq.MqCommonService;
|
||||
import com.jeequan.jeepay.core.utils.JsonKit;
|
||||
import com.jeequan.jeepay.core.utils.StringKit;
|
||||
import com.jeequan.jeepay.mch.ctrl.CommonCtrl;
|
||||
import com.jeequan.jeepay.service.impl.MchInfoService;
|
||||
import com.jeequan.jeepay.service.impl.PayInterfaceConfigService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@ -78,8 +82,24 @@ public class MchPayInterfaceConfigController extends CommonCtrl {
|
||||
@GetMapping("/{appId}/{ifCode}")
|
||||
public ApiRes getByMchNo(@PathVariable(value = "appId") String appId, @PathVariable(value = "ifCode") String ifCode) {
|
||||
PayInterfaceConfig payInterfaceConfig = payInterfaceConfigService.getByInfoIdAndIfCode(CS.INFO_TYPE_MCH_APP, appId, ifCode);
|
||||
if (payInterfaceConfig != null && payInterfaceConfig.getIfRate() != null) {
|
||||
payInterfaceConfig.setIfRate(payInterfaceConfig.getIfRate().multiply(new BigDecimal("100")));
|
||||
if (payInterfaceConfig != null) {
|
||||
// 费率转换为百分比数值
|
||||
if (payInterfaceConfig.getIfRate() != null) {
|
||||
payInterfaceConfig.setIfRate(payInterfaceConfig.getIfRate().multiply(new BigDecimal("100")));
|
||||
}
|
||||
|
||||
// 敏感数据脱敏
|
||||
if (StringUtils.isNotBlank(payInterfaceConfig.getIfParams())) {
|
||||
MchInfo mchInfo = mchInfoService.getById(getCurrentMchNo());
|
||||
|
||||
// 普通商户的支付参数执行数据脱敏
|
||||
if (mchInfo.getType() == CS.MCH_TYPE_NORMAL) {
|
||||
NormalMchParams mchParams = NormalMchParams.factory(payInterfaceConfig.getIfCode(), payInterfaceConfig.getIfParams());
|
||||
if (mchParams != null) {
|
||||
payInterfaceConfig.setIfParams(mchParams.deSenData());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return ApiRes.ok(payInterfaceConfig);
|
||||
}
|
||||
@ -117,6 +137,9 @@ public class MchPayInterfaceConfigController extends CommonCtrl {
|
||||
//若配置存在,为saveOrUpdate添加ID,第一次配置添加创建者
|
||||
if (dbRecoed != null) {
|
||||
payInterfaceConfig.setId(dbRecoed.getId());
|
||||
|
||||
// 合并支付参数
|
||||
payInterfaceConfig.setIfParams(StringKit.marge(dbRecoed.getIfParams(), payInterfaceConfig.getIfParams()));
|
||||
}else {
|
||||
payInterfaceConfig.setCreatedUid(userId);
|
||||
payInterfaceConfig.setCreatedBy(realName);
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.jeequan.jeepay.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jeequan.jeepay.core.constants.ApiCodeEnum;
|
||||
import com.jeequan.jeepay.core.constants.CS;
|
||||
@ -8,7 +10,9 @@ import com.jeequan.jeepay.core.entity.MchPayPassage;
|
||||
import com.jeequan.jeepay.core.entity.PayInterfaceConfig;
|
||||
import com.jeequan.jeepay.core.entity.PayOrder;
|
||||
import com.jeequan.jeepay.core.exception.BizException;
|
||||
import com.jeequan.jeepay.core.utils.StringKit;
|
||||
import com.jeequan.jeepay.service.mapper.MchAppMapper;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@ -49,4 +53,30 @@ public class MchAppService extends ServiceImpl<MchAppMapper, MchApp> {
|
||||
throw new BizException(ApiCodeEnum.SYS_OPERATION_FAIL_DELETE);
|
||||
}
|
||||
}
|
||||
|
||||
public MchApp selectById(String appId) {
|
||||
MchApp mchApp = this.getById(appId);
|
||||
if (mchApp == null) {
|
||||
return null;
|
||||
}
|
||||
mchApp.setAppSecret(StringKit.str2Star(mchApp.getAppSecret(), 6, 6, 6));
|
||||
|
||||
return mchApp;
|
||||
}
|
||||
|
||||
public IPage<MchApp> selectPage(IPage iPage, MchApp mchApp) {
|
||||
|
||||
LambdaQueryWrapper<MchApp> wrapper = MchApp.gw();
|
||||
if (StringUtils.isNotBlank(mchApp.getMchNo())) wrapper.eq(MchApp::getMchNo, mchApp.getMchNo());
|
||||
if (StringUtils.isNotEmpty(mchApp.getAppId())) wrapper.eq(MchApp::getAppId, mchApp.getAppId());
|
||||
if (StringUtils.isNotEmpty(mchApp.getAppName())) wrapper.eq(MchApp::getAppName, mchApp.getAppName());
|
||||
if (mchApp.getState() != null) wrapper.eq(MchApp::getState, mchApp.getState());
|
||||
wrapper.orderByDesc(MchApp::getCreatedAt);
|
||||
|
||||
IPage<MchApp> pages = this.page(iPage, wrapper);
|
||||
|
||||
pages.getRecords().stream().forEach(item -> item.setAppSecret(StringKit.str2Star(item.getAppSecret(), 6, 6, 6)));
|
||||
|
||||
return pages;
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
<!-- 根据支付方式查询可用的支付接口列表 -->
|
||||
<select id="selectAvailablePayInterfaceList" resultType="com.alibaba.fastjson.JSONObject" parameterType="java.util.Map">
|
||||
select pid.if_code ifCode, pid.if_name ifName, pid.bg_color bgColor, pid.icon icon, pic.if_params ifParams, pic.if_rate ifRate from t_pay_interface_define pid
|
||||
select pid.if_code ifCode, pid.if_name ifName, pid.config_page_type configPageType, pid.bg_color bgColor, pid.icon icon, pic.if_params ifParams, pic.if_rate ifRate from t_pay_interface_define pid
|
||||
inner join t_pay_interface_config pic on pid.if_code = pic.if_code
|
||||
where JSON_CONTAINS(pid.way_codes, JSON_OBJECT('wayCode', #{wayCode}))
|
||||
and pid.state = 1
|
||||
|
@ -8,6 +8,7 @@
|
||||
<result column="if_name" property="ifName" />
|
||||
<result column="is_mch_mode" property="isMchMode" />
|
||||
<result column="is_isv_mode" property="isIsvMode" />
|
||||
<result column="config_page_type" property="configPageType" />
|
||||
<result column="isv_params" property="isvParams" />
|
||||
<result column="isvsub_mch_params" property="isvsubMchParams" />
|
||||
<result column="normal_mch_params" property="normalMchParams" />
|
||||
|
Loading…
Reference in New Issue
Block a user