Skip to content

Commit 8eb028f

Browse files
committed
添加读取支付回调内容接口
1 parent b277982 commit 8eb028f

File tree

3 files changed

+281
-0
lines changed

3 files changed

+281
-0
lines changed

weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/WxMpService.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -577,4 +577,12 @@ public interface WxMpService {
577577
* @param outTradeNo
578578
*/
579579
WxMpPayResult getJSSDKPayResult(String transactionId, String outTradeNo);
580+
581+
/**
582+
* 读取支付结果通知
583+
* 详见http://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_7
584+
* @param xmlData
585+
* @return
586+
*/
587+
WxMpPayCallback getJSSDKCallbackData(String xmlData);
580588
}

weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/WxMpServiceImpl.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -747,6 +747,19 @@ public WxMpPayResult getJSSDKPayResult(String transactionId, String outTradeNo)
747747
}
748748
return new WxMpPayResult();
749749
}
750+
751+
@Override
752+
public WxMpPayCallback getJSSDKCallbackData(String xmlData) {
753+
try {
754+
XStream xstream = XStreamInitializer.getInstance();
755+
xstream.alias("xml", WxMpPayResult.class);
756+
WxMpPayCallback wxMpCallback = (WxMpPayCallback) xstream.fromXML(xmlData);
757+
return wxMpCallback;
758+
} catch (Exception e){
759+
e.printStackTrace();
760+
}
761+
return new WxMpPayCallback();
762+
}
750763

751764

752765
}
Lines changed: 260 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,260 @@
1+
package me.chanjar.weixin.mp.bean.result;
2+
3+
import java.io.Serializable;
4+
5+
/**
6+
* pre> 订单支付状态回调
7+
*
8+
* 支付结果通知(详见http://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_7)
9+
*
10+
* /pre>
11+
*
12+
* @author ukid
13+
*/
14+
public class WxMpPayCallback implements Serializable {
15+
private String return_code;
16+
private String return_msg;
17+
18+
private String appid;
19+
private String mch_id;
20+
private String device_info;
21+
private String nonce_str;
22+
private String sign;
23+
private String result_code;
24+
private String err_code;
25+
private String err_code_des;
26+
private String openid;
27+
private String is_subscribe;
28+
private String trade_type;
29+
private String bank_type;
30+
private String total_fee;
31+
private String fee_type;
32+
private String cash_fee;
33+
private String cash_fee_type;
34+
private String coupon_fee;
35+
private String coupon_count;
36+
private String coupon_batch_id_$n;
37+
private String coupon_id_$n;
38+
private String coupon_fee_$n;
39+
private String transaction_id;
40+
private String out_trade_no;
41+
private String attach;
42+
private String time_end;
43+
44+
public String getReturn_code() {
45+
return return_code;
46+
}
47+
48+
public String getReturn_msg() {
49+
return return_msg;
50+
}
51+
52+
public String getAppid() {
53+
return appid;
54+
}
55+
56+
public String getMch_id() {
57+
return mch_id;
58+
}
59+
60+
public String getDevice_info() {
61+
return device_info;
62+
}
63+
64+
public String getNonce_str() {
65+
return nonce_str;
66+
}
67+
68+
public String getSign() {
69+
return sign;
70+
}
71+
72+
public String getResult_code() {
73+
return result_code;
74+
}
75+
76+
public String getErr_code() {
77+
return err_code;
78+
}
79+
80+
public String getErr_code_des() {
81+
return err_code_des;
82+
}
83+
84+
public String getOpenid() {
85+
return openid;
86+
}
87+
88+
public String getIs_subscribe() {
89+
return is_subscribe;
90+
}
91+
92+
public String getTrade_type() {
93+
return trade_type;
94+
}
95+
96+
public String getBank_type() {
97+
return bank_type;
98+
}
99+
100+
public String getTotal_fee() {
101+
return total_fee;
102+
}
103+
104+
public String getFee_type() {
105+
return fee_type;
106+
}
107+
108+
public String getCash_fee() {
109+
return cash_fee;
110+
}
111+
112+
public String getCash_fee_type() {
113+
return cash_fee_type;
114+
}
115+
116+
public String getCoupon_fee() {
117+
return coupon_fee;
118+
}
119+
120+
public String getCoupon_count() {
121+
return coupon_count;
122+
}
123+
124+
public String getCoupon_batch_id_$n() {
125+
return coupon_batch_id_$n;
126+
}
127+
128+
public String getCoupon_id_$n() {
129+
return coupon_id_$n;
130+
}
131+
132+
public String getCoupon_fee_$n() {
133+
return coupon_fee_$n;
134+
}
135+
136+
public String getTransaction_id() {
137+
return transaction_id;
138+
}
139+
140+
public String getOut_trade_no() {
141+
return out_trade_no;
142+
}
143+
144+
public String getAttach() {
145+
return attach;
146+
}
147+
148+
public String getTime_end() {
149+
return time_end;
150+
}
151+
152+
public void setReturn_code(String return_code) {
153+
this.return_code = return_code;
154+
}
155+
156+
public void setReturn_msg(String return_msg) {
157+
this.return_msg = return_msg;
158+
}
159+
160+
public void setAppid(String appid) {
161+
this.appid = appid;
162+
}
163+
164+
public void setMch_id(String mch_id) {
165+
this.mch_id = mch_id;
166+
}
167+
168+
public void setDevice_info(String device_info) {
169+
this.device_info = device_info;
170+
}
171+
172+
public void setNonce_str(String nonce_str) {
173+
this.nonce_str = nonce_str;
174+
}
175+
176+
public void setSign(String sign) {
177+
this.sign = sign;
178+
}
179+
180+
public void setResult_code(String result_code) {
181+
this.result_code = result_code;
182+
}
183+
184+
public void setErr_code(String err_code) {
185+
this.err_code = err_code;
186+
}
187+
188+
public void setErr_code_des(String err_code_des) {
189+
this.err_code_des = err_code_des;
190+
}
191+
192+
public void setOpenid(String openid) {
193+
this.openid = openid;
194+
}
195+
196+
public void setIs_subscribe(String is_subscribe) {
197+
this.is_subscribe = is_subscribe;
198+
}
199+
200+
public void setTrade_type(String trade_type) {
201+
this.trade_type = trade_type;
202+
}
203+
204+
public void setBank_type(String bank_type) {
205+
this.bank_type = bank_type;
206+
}
207+
208+
public void setTotal_fee(String total_fee) {
209+
this.total_fee = total_fee;
210+
}
211+
212+
public void setFee_type(String fee_type) {
213+
this.fee_type = fee_type;
214+
}
215+
216+
public void setCash_fee(String cash_fee) {
217+
this.cash_fee = cash_fee;
218+
}
219+
220+
public void setCash_fee_type(String cash_fee_type) {
221+
this.cash_fee_type = cash_fee_type;
222+
}
223+
224+
public void setCoupon_fee(String coupon_fee) {
225+
this.coupon_fee = coupon_fee;
226+
}
227+
228+
public void setCoupon_count(String coupon_count) {
229+
this.coupon_count = coupon_count;
230+
}
231+
232+
public void setCoupon_batch_id_$n(String coupon_batch_id_$n) {
233+
this.coupon_batch_id_$n = coupon_batch_id_$n;
234+
}
235+
236+
public void setCoupon_id_$n(String coupon_id_$n) {
237+
this.coupon_id_$n = coupon_id_$n;
238+
}
239+
240+
public void setCoupon_fee_$n(String coupon_fee_$n) {
241+
this.coupon_fee_$n = coupon_fee_$n;
242+
}
243+
244+
public void setTransaction_id(String transaction_id) {
245+
this.transaction_id = transaction_id;
246+
}
247+
248+
public void setOut_trade_no(String out_trade_no) {
249+
this.out_trade_no = out_trade_no;
250+
}
251+
252+
public void setAttach(String attach) {
253+
this.attach = attach;
254+
}
255+
256+
public void setTime_end(String time_end) {
257+
this.time_end = time_end;
258+
}
259+
260+
}

0 commit comments

Comments
 (0)