#646 修复申请退款接口组装退款代金券空指针的问题

This commit is contained in:
Binary Wang 2018-06-26 21:16:13 +08:00
parent 82e2371847
commit 4710354d96

View File

@ -1,14 +1,14 @@
package com.github.binarywang.wxpay.bean.result; package com.github.binarywang.wxpay.bean.result;
import java.io.Serializable;
import java.util.List;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.thoughtworks.xstream.annotations.XStreamAlias; import com.thoughtworks.xstream.annotations.XStreamAlias;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.List;
/** /**
* <pre> * <pre>
* 微信支付-申请退款返回结果. * 微信支付-申请退款返回结果.
@ -108,7 +108,13 @@ public class WxPayRefundResult extends BaseWxPayResult implements Serializable {
*/ */
public void composeRefundCoupons() { public void composeRefundCoupons() {
List<WxPayRefundCouponInfo> coupons = Lists.newArrayList(); List<WxPayRefundCouponInfo> coupons = Lists.newArrayList();
for (int i = 0; i < this.getCouponRefundCount(); i++) { Integer refundCount = this.getCouponRefundCount();
if (refundCount == null) {
//无退款代金券信息
return;
}
for (int i = 0; i < refundCount; i++) {
coupons.add( coupons.add(
new WxPayRefundCouponInfo( new WxPayRefundCouponInfo(
this.getXmlValue("xml/coupon_refund_id_" + i), this.getXmlValue("xml/coupon_refund_id_" + i),
@ -117,6 +123,7 @@ public class WxPayRefundResult extends BaseWxPayResult implements Serializable {
) )
); );
} }
this.setRefundCoupons(coupons); this.setRefundCoupons(coupons);
} }
} }