Skip to content

Commit 4710354

Browse files
committed
binarywang#646 修复申请退款接口组装退款代金券空指针的问题
1 parent 82e2371 commit 4710354

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/result/WxPayRefundResult.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
package com.github.binarywang.wxpay.bean.result;
22

3+
import java.io.Serializable;
4+
import java.util.List;
5+
36
import com.google.common.collect.Lists;
47
import com.thoughtworks.xstream.annotations.XStreamAlias;
58
import lombok.Data;
69
import lombok.EqualsAndHashCode;
710
import lombok.NoArgsConstructor;
811

9-
import java.io.Serializable;
10-
import java.util.List;
11-
1212
/**
1313
* <pre>
1414
* 微信支付-申请退款返回结果.
@@ -108,7 +108,13 @@ public class WxPayRefundResult extends BaseWxPayResult implements Serializable {
108108
*/
109109
public void composeRefundCoupons() {
110110
List<WxPayRefundCouponInfo> coupons = Lists.newArrayList();
111-
for (int i = 0; i < this.getCouponRefundCount(); i++) {
111+
Integer refundCount = this.getCouponRefundCount();
112+
if (refundCount == null) {
113+
//无退款代金券信息
114+
return;
115+
}
116+
117+
for (int i = 0; i < refundCount; i++) {
112118
coupons.add(
113119
new WxPayRefundCouponInfo(
114120
this.getXmlValue("xml/coupon_refund_id_" + i),
@@ -117,6 +123,7 @@ public void composeRefundCoupons() {
117123
)
118124
);
119125
}
126+
120127
this.setRefundCoupons(coupons);
121128
}
122129
}

0 commit comments

Comments
 (0)