|
|
@@ -1,8 +1,8 @@
|
|
|
package org.springblade.pay.tonglianPayment.utils;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
|
import org.springblade.pay.tonglianPayment.dto.PaymentDTO;
|
|
|
|
|
|
-import java.util.HashMap;
|
|
|
import java.util.Map;
|
|
|
import java.util.TreeMap;
|
|
|
|
|
|
@@ -115,9 +115,9 @@ public class SybPayService {
|
|
|
}
|
|
|
|
|
|
public Map<String, String> payNew(long trxamt, String reqsn, String paytype, String body, String remark, String acct, String validtime, String notify_url, String limit_pay,
|
|
|
- String idno, String truename, String asinfo, String sub_appid, String goods_tag, String benefitdetail, String chnlstoreid, String subbranch,
|
|
|
- String extendparams, String cusip, String fqnum, String cusId, String appId, String orgid, String transactionType, String sybMdAppkey,
|
|
|
- String sybRsacusprikey, String sybRsatlpubkey, String sybSmpprivatekey, String sybSmtlpubkey) throws Exception {
|
|
|
+ String idno, String truename, String asinfo, String sub_appid, String goods_tag, String benefitdetail, String chnlstoreid, String subbranch,
|
|
|
+ String extendparams, String cusip, String fqnum, String cusId, String appId, String orgid, String transactionType, String sybMdAppkey,
|
|
|
+ String sybRsacusprikey, String sybRsatlpubkey, String sybSmpprivatekey, String sybSmtlpubkey) throws Exception {
|
|
|
|
|
|
|
|
|
TreeMap<String, String> params = new TreeMap<String, String>();
|
|
|
@@ -125,14 +125,18 @@ public class SybPayService {
|
|
|
params.put("appid", appId);
|
|
|
if (!SybUtil.isEmpty(orgid)) {
|
|
|
params.put("orgid", orgid);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
params.put("orgid", "");
|
|
|
}
|
|
|
params.put("version", "12");
|
|
|
params.put("trxamt", String.valueOf(trxamt));
|
|
|
params.put("reqsn", reqsn);
|
|
|
params.put("notify_url", notify_url);
|
|
|
- params.put("body", body);
|
|
|
+ if (ObjectUtils.isNotNull(body)) {
|
|
|
+ params.put("body", body.substring(0, 20));
|
|
|
+ } else {
|
|
|
+ params.put("body", body);
|
|
|
+ }
|
|
|
params.put("remark", remark);
|
|
|
params.put("validtime", validtime);
|
|
|
params.put("limit_pay", "");
|
|
|
@@ -144,13 +148,13 @@ public class SybPayService {
|
|
|
appkey = sybRsacusprikey;
|
|
|
} else if (transactionType.equals("SM2")) {
|
|
|
appkey = sybSmpprivatekey;
|
|
|
- }else if (transactionType.equals("RSA2")) {
|
|
|
+ } else if (transactionType.equals("RSA2")) {
|
|
|
appkey = sybRsatlpubkey;
|
|
|
} else {
|
|
|
appkey = sybMdAppkey;
|
|
|
}
|
|
|
params.put("sign", String.valueOf(SybUtil.unionSign(params, appkey, transactionType)));
|
|
|
- System.out.println("支付数据:"+params);
|
|
|
+ System.out.println("支付数据:" + params);
|
|
|
return params;
|
|
|
}
|
|
|
|
|
|
@@ -175,9 +179,9 @@ public class SybPayService {
|
|
|
String appkey = "";
|
|
|
if (SybConstants.SIGN_TYPE.equals("RSA")) {
|
|
|
appkey = SybConstants.SYB_RSACUSPRIKEY;
|
|
|
- }else if (SybConstants.SIGN_TYPE.equals("SM2")) {
|
|
|
+ } else if (SybConstants.SIGN_TYPE.equals("SM2")) {
|
|
|
appkey = SybConstants.SYB_SM2PPRIVATEKEY;
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
appkey = SybConstants.SYB_MD5_APPKEY;
|
|
|
}
|
|
|
params.put("sign", SybUtil.unionSign(params, appkey, SybConstants.SIGN_TYPE));
|
|
|
@@ -189,7 +193,7 @@ public class SybPayService {
|
|
|
}
|
|
|
|
|
|
public Map<String, String> refund(long trxamt, String reqsn, String oldtrxid, String oldreqsn, String cusId, String appId, String orgid, String transactionType, String sybMdAppkey,
|
|
|
- String sybRsacusprikey, String sybRsatlpubkey, String sybSmpprivatekey, String sybSmtlpubkey,String url) throws Exception {
|
|
|
+ String sybRsacusprikey, String sybRsatlpubkey, String sybSmpprivatekey, String sybSmtlpubkey, String url) throws Exception {
|
|
|
TreeMap<String, String> params = new TreeMap<String, String>();
|
|
|
if (!SybUtil.isEmpty(orgid)) {
|
|
|
params.put("orgid", orgid);
|
|
|
@@ -214,11 +218,11 @@ public class SybPayService {
|
|
|
}
|
|
|
|
|
|
public Map<String, String> refundNew(long trxamt, String reqsn, String oldtrxid, String oldreqsn, String cusId, String appId, String orgid, String transactionType, String sybMdAppkey,
|
|
|
- String sybRsacusprikey, String sybRsatlpubkey, String sybSmpprivatekey, String sybSmtlpubkey,String url,String sybRsaPublickey) throws Exception {
|
|
|
+ String sybRsacusprikey, String sybRsatlpubkey, String sybSmpprivatekey, String sybSmtlpubkey, String url, String sybRsaPublickey) throws Exception {
|
|
|
TreeMap<String, String> params = new TreeMap<String, String>();
|
|
|
if (!SybUtil.isEmpty(orgid)) {
|
|
|
params.put("orgid", orgid);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
params.put("orgid", "");
|
|
|
}
|
|
|
params.put("cusid", cusId);
|
|
|
@@ -260,9 +264,9 @@ public class SybPayService {
|
|
|
String appkey = "";
|
|
|
if (SybConstants.SIGN_TYPE.equals("RSA")) {
|
|
|
appkey = SybConstants.SYB_RSACUSPRIKEY;
|
|
|
- }else if (SybConstants.SIGN_TYPE.equals("SM2")) {
|
|
|
+ } else if (SybConstants.SIGN_TYPE.equals("SM2")) {
|
|
|
appkey = SybConstants.SYB_SM2PPRIVATEKEY;
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
appkey = SybConstants.SYB_MD5_APPKEY;
|
|
|
}
|
|
|
params.put("sign", SybUtil.unionSign(params, appkey, SybConstants.SIGN_TYPE));
|
|
|
@@ -286,9 +290,9 @@ public class SybPayService {
|
|
|
String appkey = "";
|
|
|
if (transactionType.equals("RSA")) {
|
|
|
appkey = sybRsacusprikey;
|
|
|
- }else if (transactionType.equals("SM2")) {
|
|
|
+ } else if (transactionType.equals("SM2")) {
|
|
|
appkey = sybSmpprivatekey;
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
appkey = sybMdAppkey;
|
|
|
}
|
|
|
if (SybUtil.validSign(tmap, appkey, transactionType)) {
|