File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed
weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change 1
1
package me .chanjar .weixin .mp .api ;
2
2
3
3
import me .chanjar .weixin .common .exception .WxErrorException ;
4
+ import me .chanjar .weixin .mp .bean .pay .WxPayJsSDKCallback ;
4
5
import me .chanjar .weixin .mp .bean .pay .request .WxEntPayRequest ;
5
6
import me .chanjar .weixin .mp .bean .pay .request .WxPayRefundRequest ;
6
7
import me .chanjar .weixin .mp .bean .pay .request .WxPaySendRedpackRequest ;
@@ -63,6 +64,13 @@ public interface WxMpPayService {
63
64
*/
64
65
WxPayRefundResult refund (WxPayRefundRequest request , File keyFile ) throws WxErrorException ;
65
66
67
+ /**
68
+ * 读取支付结果通知
69
+ * 详见http://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_7
70
+ *
71
+ */
72
+ WxPayJsSDKCallback getJSSDKCallbackData (String xmlData ) throws WxErrorException ;
73
+
66
74
/**
67
75
* <pre>
68
76
* 计算Map键值对是否和签名相符,
Original file line number Diff line number Diff line change 7
7
import me .chanjar .weixin .common .util .xml .XStreamInitializer ;
8
8
import me .chanjar .weixin .mp .api .WxMpPayService ;
9
9
import me .chanjar .weixin .mp .api .WxMpService ;
10
+ import me .chanjar .weixin .mp .bean .pay .WxPayJsSDKCallback ;
10
11
import me .chanjar .weixin .mp .bean .pay .request .*;
11
12
import me .chanjar .weixin .mp .bean .pay .result .*;
12
13
import org .apache .commons .codec .digest .DigestUtils ;
@@ -96,6 +97,18 @@ private void checkParameters(WxPayRefundRequest request) throws WxErrorException
96
97
}
97
98
}
98
99
100
+ @ Override
101
+ public WxPayJsSDKCallback getJSSDKCallbackData (String xmlData ) throws WxErrorException {
102
+ try {
103
+ XStream xstream = XStreamInitializer .getInstance ();
104
+ xstream .alias ("xml" , WxPayJsSDKCallback .class );
105
+ return (WxPayJsSDKCallback ) xstream .fromXML (xmlData );
106
+ } catch (Exception e ) {
107
+ e .printStackTrace ();
108
+ throw new WxErrorException (WxError .newBuilder ().setErrorMsg ("发生异常" + e .getMessage ()).build ());
109
+ }
110
+ }
111
+
99
112
@ Override
100
113
public boolean checkJSSDKCallbackDataSignature (Map <String , String > kvm ,
101
114
String signature ) {
You can’t perform that action at this time.
0 commit comments