Browse Source

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

master
Binary Wang 6 years ago
parent
commit
4710354d96
1 changed files with 11 additions and 4 deletions
  1. +11
    -4
      weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/result/WxPayRefundResult.java

+ 11
- 4
weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/result/WxPayRefundResult.java 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);
} }
} }

Loading…
Cancel
Save