mirror of
https://gitee.com/durcframework/SOP.git
synced 2025-08-11 21:57:56 +08:00
3.0.0
This commit is contained in:
@@ -56,6 +56,7 @@ public class AlipayClientPostTest extends TestBase {
|
|||||||
|
|
||||||
System.out.println("----------- 请求信息 -----------");
|
System.out.println("----------- 请求信息 -----------");
|
||||||
System.out.println("请求参数:" + buildParamQuery(params));
|
System.out.println("请求参数:" + buildParamQuery(params));
|
||||||
|
System.out.println("URL参数:" + buildUrlQuery(params));
|
||||||
System.out.println("商户秘钥:" + privateKey);
|
System.out.println("商户秘钥:" + privateKey);
|
||||||
String content = AlipaySignature.getSignContent(params);
|
String content = AlipaySignature.getSignContent(params);
|
||||||
System.out.println("待签名内容:" + content);
|
System.out.println("待签名内容:" + content);
|
||||||
|
@@ -5,6 +5,8 @@ import junit.framework.TestCase;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.net.URLEncoder;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -73,4 +75,16 @@ public class TestBase extends TestCase {
|
|||||||
return sb.toString().substring(1);
|
return sb.toString().substring(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected static String buildUrlQuery(Map<String, String> params) {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
for (Map.Entry<String, String> entry : params.entrySet()) {
|
||||||
|
try {
|
||||||
|
sb.append("&").append(entry.getKey()).append("=").append(URLEncoder.encode(entry.getValue(), "UTF-8"));
|
||||||
|
} catch (UnsupportedEncodingException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return sb.toString().substring(1);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user