|
@@ -25,25 +25,25 @@ public class PayService {
|
|
|
|
|
|
|
|
// https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_api.php?chapter=9_1
|
|
// https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_api.php?chapter=9_1
|
|
|
public static UnifiedorderResponse unifiedorder(UnifiedorderRequest request,String apiKey) {
|
|
public static UnifiedorderResponse unifiedorder(UnifiedorderRequest request,String apiKey) {
|
|
|
- return request(UnifiedorderResponse.class,unifiedorder,"POST",request,apiKey,null);
|
|
|
|
|
|
|
+ return request(UnifiedorderResponse.class,unifiedorder,"POST",request,apiKey,null,null);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_api.php?chapter=9_2
|
|
// https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_api.php?chapter=9_2
|
|
|
public static OrderqueryResponse orderquery(OrderqueryRequest request, String apiKey) {
|
|
public static OrderqueryResponse orderquery(OrderqueryRequest request, String apiKey) {
|
|
|
- return request(OrderqueryResponse.class,orderquery,"POST",request,apiKey,null);
|
|
|
|
|
|
|
+ return request(OrderqueryResponse.class,orderquery,"POST",request,apiKey,null,null);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_api.php?chapter=9_3
|
|
// https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_api.php?chapter=9_3
|
|
|
public static CloseorderResponse closeorder(CloseorderRequest request, String apiKey) {
|
|
public static CloseorderResponse closeorder(CloseorderRequest request, String apiKey) {
|
|
|
- return request(CloseorderResponse.class,closeorder,"POST",request,apiKey,null);
|
|
|
|
|
|
|
+ return request(CloseorderResponse.class,closeorder,"POST",request,apiKey,null,null);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_api.php?chapter=9_4
|
|
// https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_api.php?chapter=9_4
|
|
|
- public static RefundResponse refund(RefundRequest request, String apiKey,InputStream certInputStream) {
|
|
|
|
|
- return request(RefundResponse.class,refund,"POST",request,apiKey,certInputStream);
|
|
|
|
|
|
|
+ public static RefundResponse refund(RefundRequest request, String apiKey,InputStream certInputStream,String keyPassword) {
|
|
|
|
|
+ return request(RefundResponse.class,refund,"POST",request,apiKey,certInputStream,keyPassword);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private static <T extends PayBaseResponse> T request(Class<T> clazz, String requestUrl, String requestMethod, Object requestBean, String apiKey,InputStream certInputStream) {
|
|
|
|
|
|
|
+ private static <T extends PayBaseResponse> T request(Class<T> clazz, String requestUrl, String requestMethod, Object requestBean, String apiKey,InputStream certInputStream,String keyPassword) {
|
|
|
MrxuAssert.validateBean(requestBean);
|
|
MrxuAssert.validateBean(requestBean);
|
|
|
String jsonStr = JSONUtil.toJsonStr(requestBean);
|
|
String jsonStr = JSONUtil.toJsonStr(requestBean);
|
|
|
TreeMap<String, Object> parameters = JSONUtil.toBean(jsonStr,new TreeMap<String, String>().getClass());
|
|
TreeMap<String, Object> parameters = JSONUtil.toBean(jsonStr,new TreeMap<String, String>().getClass());
|
|
@@ -51,7 +51,7 @@ public class PayService {
|
|
|
String sign = WeixinUtil.createSign(parameters,apiKey);
|
|
String sign = WeixinUtil.createSign(parameters,apiKey);
|
|
|
parameters.put("sign", sign);
|
|
parameters.put("sign", sign);
|
|
|
String requestXML = WeixinUtil.getRequestXml(parameters);
|
|
String requestXML = WeixinUtil.getRequestXml(parameters);
|
|
|
- String resultStr = HttpUtil.httpsRequest(requestUrl,requestMethod,requestXML,certInputStream);
|
|
|
|
|
|
|
+ String resultStr = HttpUtil.httpsRequest(requestUrl,requestMethod,requestXML,certInputStream,keyPassword);
|
|
|
MrxuAssert.isNotEmpty(resultStr,"微信未响应");
|
|
MrxuAssert.isNotEmpty(resultStr,"微信未响应");
|
|
|
System.out.println(resultStr);
|
|
System.out.println(resultStr);
|
|
|
JSONObject resultJson = WeixinUtil.doXMLParse(resultStr);
|
|
JSONObject resultJson = WeixinUtil.doXMLParse(resultStr);
|