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 11package me .chanjar .weixin .mp .api ;
22
33import me .chanjar .weixin .common .exception .WxErrorException ;
4+ import me .chanjar .weixin .mp .bean .pay .WxPayJsSDKCallback ;
45import me .chanjar .weixin .mp .bean .pay .request .WxEntPayRequest ;
56import me .chanjar .weixin .mp .bean .pay .request .WxPayRefundRequest ;
67import me .chanjar .weixin .mp .bean .pay .request .WxPaySendRedpackRequest ;
@@ -63,6 +64,13 @@ public interface WxMpPayService {
6364 */
6465 WxPayRefundResult refund (WxPayRefundRequest request , File keyFile ) throws WxErrorException ;
6566
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+
6674 /**
6775 * <pre>
6876 * 计算Map键值对是否和签名相符,
Original file line number Diff line number Diff line change 77import me .chanjar .weixin .common .util .xml .XStreamInitializer ;
88import me .chanjar .weixin .mp .api .WxMpPayService ;
99import me .chanjar .weixin .mp .api .WxMpService ;
10+ import me .chanjar .weixin .mp .bean .pay .WxPayJsSDKCallback ;
1011import me .chanjar .weixin .mp .bean .pay .request .*;
1112import me .chanjar .weixin .mp .bean .pay .result .*;
1213import org .apache .commons .codec .digest .DigestUtils ;
@@ -96,6 +97,18 @@ private void checkParameters(WxPayRefundRequest request) throws WxErrorException
9697 }
9798 }
9899
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+
99112 @ Override
100113 public boolean checkJSSDKCallbackDataSignature (Map <String , String > kvm ,
101114 String signature ) {
You can’t perform that action at this time.
0 commit comments