增加银联支付方式;增加部分util方法

This commit is contained in:
xiaoyu 2023-02-06 15:34:07 +08:00
parent 04ef385be2
commit 7320203f1e
20 changed files with 600 additions and 1 deletions

View File

@ -723,6 +723,14 @@ INSERT INTO t_pay_way (way_code, way_name) VALUES ('YSF_JSAPI', '云闪付jsapi'
INSERT INTO t_pay_way (way_code, way_name) VALUES ('PP_PC', 'PayPal支付');
INSERT INTO t_pay_way (way_code, way_name) VALUES ('UP_APP', '银联App支付');
INSERT INTO t_pay_way (way_code, way_name) VALUES ('UP_WAP', '银联手机网站支付');
INSERT INTO t_pay_way (way_code, way_name) VALUES ('UP_QR', '银联二维码(主扫)');
INSERT INTO t_pay_way (way_code, way_name) VALUES ('UP_BAR', '银联二维码(被扫)');
INSERT INTO t_pay_way (way_code, way_name) VALUES ('UP_B2B', '银联企业网银支付');
INSERT INTO t_pay_way (way_code, way_name) VALUES ('UP_PC', '银联网关支付');
INSERT INTO t_pay_way (way_code, way_name) VALUES ('UP_JSAPI', '银联Js支付');
-- 初始化支付接口定义
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, 2,

View File

@ -265,3 +265,14 @@ VALUES ('plspay', '计全付', 1, 0, 1,
'[{"name":"signType","desc":"签名方式","type":"radio","verify":"required","values":"MD5,RSA2","titles":"MD5,RSA2"},{"name":"merchantNo","desc":"计全付商户号","type":"text","verify":"required"},{"name":"appId","desc":"应用ID","type":"text","verify":"required"},{"name":"appSecret","desc":"md5秘钥","type":"textarea","verify":"required","star":"1"},{"name":"rsa2AppPrivateKey","desc":"RSA2: 应用私钥","type":"textarea","verify":"required","star":"1"},{"name":"rsa2PayPublicKey","desc":"RSA2: 支付网关公钥","type":"textarea","verify":"required","star":"1"}]',
'[{"wayCode": "ALI_APP"}, {"wayCode": "ALI_BAR"}, {"wayCode": "ALI_JSAPI"}, {"wayCode": "ALI_LITE"}, {"wayCode": "ALI_PC"}, {"wayCode": "ALI_QR"}, {"wayCode": "ALI_WAP"}, {"wayCode": "WX_APP"}, {"wayCode": "WX_BAR"}, {"wayCode": "WX_H5"}, {"wayCode": "WX_JSAPI"}, {"wayCode": "WX_LITE"}, {"wayCode": "WX_NATIVE"}]',
'http://jeequan.oss-cn-beijing.aliyuncs.com/jeepay/img/plspay.svg', '#0CACFF', 1, '计全付');
## -- ++++ [v1.15.0] ===>
-- 增加银联支付
INSERT INTO t_pay_way (way_code, way_name) VALUES ('UP_APP', '银联App支付');
INSERT INTO t_pay_way (way_code, way_name) VALUES ('UP_WAP', '银联手机网站支付');
INSERT INTO t_pay_way (way_code, way_name) VALUES ('UP_QR', '银联二维码(主扫)');
INSERT INTO t_pay_way (way_code, way_name) VALUES ('UP_BAR', '银联二维码(被扫)');
INSERT INTO t_pay_way (way_code, way_name) VALUES ('UP_B2B', '银联企业网银支付');
INSERT INTO t_pay_way (way_code, way_name) VALUES ('UP_PC', '银联网关支付');
INSERT INTO t_pay_way (way_code, way_name) VALUES ('UP_JSAPI', '银联Js支付');

View File

@ -175,6 +175,14 @@ public class CS {
String WX_H5 = "WX_H5"; //微信H5支付
String WX_NATIVE = "WX_NATIVE"; //微信扫码支付
String UP_APP = "UP_APP"; // 银联App支付
String UP_WAP = "UP_WAP"; // 银联手机网站支付
String UP_QR = "UP_QR"; // 银联二维码(主扫)
String UP_BAR = "UP_BAR"; // 银联二维码(被扫)
String UP_B2B = "UP_B2B"; // 银联企业网银支付
String UP_PC = "UP_PC"; // 银联网关支付
String UP_JSAPI = "UP_JSAPI"; // 银联JS支付
String PP_PC = "PP_PC"; // Paypal 支付
}

View File

@ -16,6 +16,7 @@
package com.jeequan.jeepay.core.utils;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.date.SystemClock;
import com.jeequan.jeepay.core.exception.BizException;
import org.apache.commons.lang3.StringUtils;
@ -125,4 +126,9 @@ public class DateKit {
}
}
/** 公共函数,获取当前时间。 **/
public static Long currentTimeMillis(){
// System.currentTimeMillis(); // fortify 检测属于安全漏洞
return SystemClock.now();
}
}

View File

@ -175,4 +175,49 @@ public class StringKit {
return originJSON.toJSONString();
}
/*
* 功能描述: 数据自动脱敏
* @param str
* @Return: java.lang.String
* @Author: terrfly
* @Date: 2021/7/20 17:07
*/
public static String autoDesensitization(String str){
if(StringUtils.isEmpty(str)){
return str;
}
int len = str.length();
if(len == 1) return "*"; // 1位
if(len <= 3) return StringUtils.repeat("*", len - 1) + str.substring(len - 1); //小于等于三位 格式为 **A
// 公式 脱敏数据占据2/3 的范围
// 假设 采用6的倍数组进行循环最少两组 循环次数为n, 原始位数为 x, 加密数据为原始数据的两倍即 2x ,
// 6x·n = len 缩小范围使得x=n 7X=len
int x = (len >= 7 && len % 7 == 0 ) ? len / 7 : len / 7 + 1;
int startIndex = 0; //截取原始字符串的位置
String result = ""; //最终结果
while(startIndex < len){
for(int i = 1; i <= 3; i++){ // 三个一组
if(startIndex + x > len){ // 最后一组
int y = len - startIndex;
result += i == 1 ? str.substring(startIndex, startIndex + y) : StringUtils.repeat("*", y);
startIndex = startIndex + y;
break;
}
// 只有第一组是原始数据 其他全部为*代替
result += i == 1 ? str.substring(startIndex, startIndex + x) : StringUtils.repeat("*", x);
startIndex = startIndex + x;
}
}
return result;
}
}

View File

@ -0,0 +1,37 @@
/*
* Copyright (c) 2021-2031, 河北计全科技有限公司 (https://www.jeequan.com & jeequan@126.com).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jeequan.jeepay.pay.rqrs.payorder.payway;
import com.jeequan.jeepay.core.constants.CS;
import com.jeequan.jeepay.pay.rqrs.payorder.CommonPayDataRQ;
import lombok.Data;
/*
* 支付方式 UPACP_APP
*
* @author jmdhappy
* @site https://www.jeequan.com
* @date 2021/12/1 19:57
*/
@Data
public class UpAppOrderRQ extends CommonPayDataRQ {
/** 构造函数 **/
public UpAppOrderRQ(){
this.setWayCode(CS.PAY_WAY_CODE.UP_APP);
}
}

View File

@ -0,0 +1,44 @@
/*
* Copyright (c) 2021-2031, 河北计全科技有限公司 (https://www.jeequan.com & jeequan@126.com).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jeequan.jeepay.pay.rqrs.payorder.payway;
import com.jeequan.jeepay.core.constants.CS;
import com.jeequan.jeepay.pay.rqrs.payorder.CommonPayDataRS;
import lombok.Data;
/*
* 支付方式 UPACP_APP
*
* @author jmdhappy
* @site https://www.jeequan.com
* @date 2021/12/1 19:57
*/
@Data
public class UpAppOrderRS extends CommonPayDataRS {
private String payData;
@Override
public String buildPayDataType(){
return CS.PAY_DATA_TYPE.YSF_APP;
}
@Override
public String buildPayData(){
return payData;
}
}

View File

@ -0,0 +1,37 @@
/*
* Copyright (c) 2021-2031, 河北计全科技有限公司 (https://www.jeequan.com & jeequan@126.com).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jeequan.jeepay.pay.rqrs.payorder.payway;
import com.jeequan.jeepay.core.constants.CS;
import com.jeequan.jeepay.pay.rqrs.payorder.CommonPayDataRQ;
import lombok.Data;
/*
* 支付方式 UPACP_B2B
*
* @author jmdhappy
* @site https://www.jeequan.com
* @date 2021/12/1 19:57
*/
@Data
public class UpB2bOrderRQ extends CommonPayDataRQ {
/** 构造函数 **/
public UpB2bOrderRQ(){
this.setWayCode(CS.PAY_WAY_CODE.UP_B2B);
}
}

View File

@ -0,0 +1,31 @@
/*
* Copyright (c) 2021-2031, 河北计全科技有限公司 (https://www.jeequan.com & jeequan@126.com).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jeequan.jeepay.pay.rqrs.payorder.payway;
import com.jeequan.jeepay.pay.rqrs.payorder.CommonPayDataRS;
import lombok.Data;
/*
* 支付方式 UPACP_B2B
*
* @author jmdhappy
* @site https://www.jeequan.com
* @date 2021/12/1 19:57
*/
@Data
public class UpB2bOrderRS extends CommonPayDataRS {
}

View File

@ -0,0 +1,43 @@
/*
* Copyright (c) 2021-2031, 河北计全科技有限公司 (https://www.jeequan.com & jeequan@126.com).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jeequan.jeepay.pay.rqrs.payorder.payway;
import com.jeequan.jeepay.core.constants.CS;
import com.jeequan.jeepay.pay.rqrs.payorder.CommonPayDataRQ;
import lombok.Data;
import javax.validation.constraints.NotBlank;
/*
* 支付方式 UPACP_BAR
*
* @author jmdhappy
* @site https://www.jeequan.com
* @date 2021/12/1 19:57
*/
@Data
public class UpBarOrderRQ extends CommonPayDataRQ {
/** 用户 支付条码 **/
@NotBlank(message = "支付条码不能为空")
private String authCode;
/** 构造函数 **/
public UpBarOrderRQ(){
this.setWayCode(CS.PAY_WAY_CODE.UP_BAR);
}
}

View File

@ -0,0 +1,31 @@
/*
* Copyright (c) 2021-2031, 河北计全科技有限公司 (https://www.jeequan.com & jeequan@126.com).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jeequan.jeepay.pay.rqrs.payorder.payway;
import com.jeequan.jeepay.pay.rqrs.payorder.CommonPayDataRS;
import lombok.Data;
/*
* 支付方式 UPACP_BAR
*
* @author jmdhappy
* @site https://www.jeequan.com
* @date 2021/12/1 19:57
*/
@Data
public class UpBarOrderRS extends CommonPayDataRS {
}

View File

@ -0,0 +1,48 @@
/*
* Copyright (c) 2021-2031, 河北计全科技有限公司 (https://www.jeequan.com & jeequan@126.com).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jeequan.jeepay.pay.rqrs.payorder.payway;
import com.jeequan.jeepay.core.constants.CS;
import com.jeequan.jeepay.pay.rqrs.payorder.UnifiedOrderRQ;
import lombok.Data;
import javax.validation.constraints.NotBlank;
/*
* 支付方式 UP_JSAPI
*
* @author jmdhappy
* @site https://www.jeequan.com
* @date 2021/6/8 17:34
*/
@Data
public class UpJsapiOrderRQ extends UnifiedOrderRQ {
/** 支付宝用户ID **/
@NotBlank(message = "用户ID不能为空")
private String userId;
/** 构造函数 **/
public UpJsapiOrderRQ(){
this.setWayCode(CS.PAY_WAY_CODE.UP_JSAPI);
}
@Override
public String getChannelUserId(){
return this.userId;
}
}

View File

@ -0,0 +1,46 @@
/*
* Copyright (c) 2021-2031, 河北计全科技有限公司 (https://www.jeequan.com & jeequan@126.com).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jeequan.jeepay.pay.rqrs.payorder.payway;
import com.jeequan.jeepay.core.constants.CS;
import com.jeequan.jeepay.core.utils.JsonKit;
import com.jeequan.jeepay.pay.rqrs.payorder.UnifiedOrderRS;
import lombok.Data;
/*
* 支付方式 UP_JSAPI
*
* @author jmdhappy
* @site https://www.jeequan.com
* @date 2022/3/17 12:34
*/
@Data
public class UpJsapiOrderRS extends UnifiedOrderRS {
/** 调起支付插件的云闪付订单号 **/
private String redirectUrl;
@Override
public String buildPayDataType(){
return CS.PAY_DATA_TYPE.YSF_APP;
}
@Override
public String buildPayData(){
return JsonKit.newJson("redirectUrl", redirectUrl).toString();
}
}

View File

@ -0,0 +1,37 @@
/*
* Copyright (c) 2021-2031, 河北计全科技有限公司 (https://www.jeequan.com & jeequan@126.com).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jeequan.jeepay.pay.rqrs.payorder.payway;
import com.jeequan.jeepay.core.constants.CS;
import com.jeequan.jeepay.pay.rqrs.payorder.CommonPayDataRQ;
import lombok.Data;
/*
* 支付方式 UPACP_PC
*
* @author jmdhappy
* @site https://www.jeequan.com
* @date 2021/12/1 19:57
*/
@Data
public class UpPcOrderRQ extends CommonPayDataRQ {
/** 构造函数 **/
public UpPcOrderRQ(){
this.setWayCode(CS.PAY_WAY_CODE.UP_PC);
}
}

View File

@ -0,0 +1,31 @@
/*
* Copyright (c) 2021-2031, 河北计全科技有限公司 (https://www.jeequan.com & jeequan@126.com).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jeequan.jeepay.pay.rqrs.payorder.payway;
import com.jeequan.jeepay.pay.rqrs.payorder.CommonPayDataRS;
import lombok.Data;
/*
* 支付方式 UPACP_PC
*
* @author jmdhappy
* @site https://www.jeequan.com
* @date 2021/12/1 19:57
*/
@Data
public class UpPcOrderRS extends CommonPayDataRS {
}

View File

@ -0,0 +1,37 @@
/*
* Copyright (c) 2021-2031, 河北计全科技有限公司 (https://www.jeequan.com & jeequan@126.com).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jeequan.jeepay.pay.rqrs.payorder.payway;
import com.jeequan.jeepay.core.constants.CS;
import com.jeequan.jeepay.pay.rqrs.payorder.CommonPayDataRQ;
import lombok.Data;
/*
* 支付方式 UPACP_QR
*
* @author jmdhappy
* @site https://www.jeequan.com
* @date 2021/12/1 19:57
*/
@Data
public class UpQrOrderRQ extends CommonPayDataRQ {
/** 构造函数 **/
public UpQrOrderRQ(){
this.setWayCode(CS.PAY_WAY_CODE.UP_QR);
}
}

View File

@ -0,0 +1,31 @@
/*
* Copyright (c) 2021-2031, 河北计全科技有限公司 (https://www.jeequan.com & jeequan@126.com).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jeequan.jeepay.pay.rqrs.payorder.payway;
import com.jeequan.jeepay.pay.rqrs.payorder.CommonPayDataRS;
import lombok.Data;
/*
* 支付方式 UPACP_QR
*
* @author jmdhappy
* @site https://www.jeequan.com
* @date 2021/12/1 19:57
*/
@Data
public class UpQrOrderRS extends CommonPayDataRS {
}

View File

@ -0,0 +1,37 @@
/*
* Copyright (c) 2021-2031, 河北计全科技有限公司 (https://www.jeequan.com & jeequan@126.com).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jeequan.jeepay.pay.rqrs.payorder.payway;
import com.jeequan.jeepay.core.constants.CS;
import com.jeequan.jeepay.pay.rqrs.payorder.CommonPayDataRQ;
import lombok.Data;
/*
* 支付方式 UPACP_WAP
*
* @author jmdhappy
* @site https://www.jeequan.com
* @date 2021/12/1 19:57
*/
@Data
public class UpWapOrderRQ extends CommonPayDataRQ {
/** 构造函数 **/
public UpWapOrderRQ(){
this.setWayCode(CS.PAY_WAY_CODE.UP_WAP);
}
}

View File

@ -0,0 +1,31 @@
/*
* Copyright (c) 2021-2031, 河北计全科技有限公司 (https://www.jeequan.com & jeequan@126.com).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jeequan.jeepay.pay.rqrs.payorder.payway;
import com.jeequan.jeepay.pay.rqrs.payorder.CommonPayDataRS;
import lombok.Data;
/*
* 支付方式 UPACP_WAP
*
* @author jmdhappy
* @site https://www.jeequan.com
* @date 2021/12/1 19:57
*/
@Data
public class UpWapOrderRS extends CommonPayDataRS {
}

View File

@ -37,7 +37,7 @@
<properties>
<isys.version>1.16.0</isys.version> <!-- 指定当前[项目]版本号 -->
<projectRootDir>${basedir}</projectRootDir>
<java.version>1.8</java.version> <!-- 指定java版本号 -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <!-- 项目构建输出编码 -->