|
|
@@ -35,7 +35,7 @@ public class AllinpaySDK {
|
|
|
HttpConnectionUtil http = new HttpConnectionUtil(SybConstants.SYB_APIURL + "/h5unionpay/unionorder");
|
|
|
http.init();
|
|
|
|
|
|
- // 构建请求参数
|
|
|
+ // 构建请求参数 - 使用与测试代码相同的逻辑
|
|
|
TreeMap<String, String> params = new TreeMap<>();
|
|
|
if (!SybUtil.isEmpty(SybConstants.SYB_ORGID)) {
|
|
|
params.put("orgid", SybConstants.SYB_ORGID);
|
|
|
@@ -59,18 +59,21 @@ public class AllinpaySDK {
|
|
|
if (!SybUtil.isEmpty(truename)) params.put("truename", truename);
|
|
|
if (!SybUtil.isEmpty(idno)) params.put("idno", idno);
|
|
|
|
|
|
- // 生成签名
|
|
|
- String appkey = getAppKey();
|
|
|
+ // 生成签名 - 使用与测试代码相同的逻辑
|
|
|
+ String appkey = "MD5".equals(SybConstants.SIGN_TYPE) ? SybConstants.SYB_MD5_APPKEY :
|
|
|
+ "RSA".equals(SybConstants.SIGN_TYPE) ? SybConstants.SYB_RSACUSPRIKEY :
|
|
|
+ SybConstants.SYB_SM2PPRIVATEKEY;
|
|
|
+
|
|
|
params.put("sign", SybUtil.unionSign(params, appkey, SybConstants.SIGN_TYPE));
|
|
|
|
|
|
- // 发送请求
|
|
|
- byte[] responseBytes = http.postParams(params, true);
|
|
|
- String response = new String(responseBytes, "UTF-8");
|
|
|
+ // 发送请求 - 使用与测试代码相同的逻辑
|
|
|
+ byte[] response = http.postParams(params, true);
|
|
|
+ String responseStr = new String(response, "UTF-8");
|
|
|
|
|
|
http.destory();
|
|
|
|
|
|
// 处理响应
|
|
|
- Map<String, String> resultMap = SybPayService.handleResult(response);
|
|
|
+ Map<String, String> resultMap = SybPayService.handleResult(responseStr);
|
|
|
|
|
|
if ("SUCCESS".equals(resultMap.get("retcode"))) {
|
|
|
String payUrl = resultMap.get("payinfo");
|
|
|
@@ -492,7 +495,7 @@ public class AllinpaySDK {
|
|
|
} catch (Exception e) {
|
|
|
System.out.println("HTTP连接测试异常: " + e.getMessage());
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
*/
|
|
|
}
|
|
|
}
|