coupons = Lists.newArrayList();
+ for (int j = 0; j < refundRecord.getCouponRefundCount(); j++) {
+ coupons.add(
+ new RefundRecord.RefundCoupon(
+ this.getXmlValueIfExists(xmlPath, "xml.coupon_refund_id_" + i + "_" + j, String.class),
+ this.getXmlValueIfExists(xmlPath, "xml.coupon_refund_fee_" + i + "_" + j, Integer.class)
+ )
+ );
+ }
+ }
+
}
}
@@ -241,7 +273,7 @@ public class WxPayRefundQueryResult extends WxPayBaseResult {
*
*/
@XStreamAlias("refund_fee")
- private String refundFee;
+ private Integer refundFee;
/**
*
@@ -254,7 +286,7 @@ public class WxPayRefundQueryResult extends WxPayBaseResult {
*
*/
@XStreamAlias("settlement_refund_fee")
- private String settlementRefundFee;
+ private Integer settlementRefundFee;
/**
*
@@ -293,7 +325,7 @@ public class WxPayRefundQueryResult extends WxPayBaseResult {
*
*/
@XStreamAlias("coupon_refund_fee")
- private String couponRefundFee;
+ private Integer couponRefundFee;
/**
*
@@ -306,7 +338,7 @@ public class WxPayRefundQueryResult extends WxPayBaseResult {
*
*/
@XStreamAlias("coupon_refund_count")
- private String couponRefundCount;
+ private Integer couponRefundCount;
private List refundCoupons;
@@ -364,19 +396,19 @@ public class WxPayRefundQueryResult extends WxPayBaseResult {
this.refundChannel = refundChannel;
}
- public String getRefundFee() {
+ public Integer getRefundFee() {
return refundFee;
}
- public void setRefundFee(String refundFee) {
+ public void setRefundFee(Integer refundFee) {
this.refundFee = refundFee;
}
- public String getSettlementRefundFee() {
+ public Integer getSettlementRefundFee() {
return settlementRefundFee;
}
- public void setSettlementRefundFee(String settlementRefundFee) {
+ public void setSettlementRefundFee(Integer settlementRefundFee) {
this.settlementRefundFee = settlementRefundFee;
}
@@ -396,19 +428,19 @@ public class WxPayRefundQueryResult extends WxPayBaseResult {
this.couponType = couponType;
}
- public String getCouponRefundFee() {
+ public Integer getCouponRefundFee() {
return couponRefundFee;
}
- public void setCouponRefundFee(String couponRefundFee) {
+ public void setCouponRefundFee(Integer couponRefundFee) {
this.couponRefundFee = couponRefundFee;
}
- public String getCouponRefundCount() {
+ public Integer getCouponRefundCount() {
return couponRefundCount;
}
- public void setCouponRefundCount(String couponRefundCount) {
+ public void setCouponRefundCount(Integer couponRefundCount) {
this.couponRefundCount = couponRefundCount;
}
@@ -446,6 +478,8 @@ public class WxPayRefundQueryResult extends WxPayBaseResult {
* 100
* 退款代金券批次ID ,$n为下标,$m为下标,从0开始编号
*
+ *
+ * @deprecated 貌似是被去掉了,但不知是何时!
*/
@XStreamAlias("coupon_refund_batch_id")
private String couponRefundBatchId;
@@ -474,9 +508,15 @@ public class WxPayRefundQueryResult extends WxPayBaseResult {
*
*/
@XStreamAlias("coupon_refund_fee")
- private String couponRefundFee;
+ private Integer couponRefundFee;
- public RefundCoupon(String couponRefundBatchId, String couponRefundId, String couponRefundFee) {
+ public RefundCoupon(String couponRefundId, Integer couponRefundFee) {
+ this.couponRefundId = couponRefundId;
+ this.couponRefundFee = couponRefundFee;
+ }
+
+ @Deprecated
+ public RefundCoupon(String couponRefundBatchId, String couponRefundId, Integer couponRefundFee) {
this.couponRefundBatchId = couponRefundBatchId;
this.couponRefundId = couponRefundId;
this.couponRefundFee = couponRefundFee;
@@ -484,5 +524,6 @@ public class WxPayRefundQueryResult extends WxPayBaseResult {
}
}
+
}
diff --git a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpPayServiceImplTest.java b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpPayServiceImplTest.java
index 31fc0c06..418b710b 100644
--- a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpPayServiceImplTest.java
+++ b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpPayServiceImplTest.java
@@ -13,8 +13,6 @@ import me.chanjar.weixin.mp.bean.pay.result.*;
import org.testng.annotations.Guice;
import org.testng.annotations.Test;
-import java.io.File;
-
/**
* 测试支付相关接口
* Created by Binary Wang on 2016/7/28.
@@ -90,7 +88,6 @@ public class WxMpPayServiceImplTest {
*/
@Test
public void testQueryRedpack() throws Exception {
- File keyFile = new File("E:\\dlt.p12");
WxPayRedpackQueryResult redpackResult = this.wxService.getPayService().queryRedpack("aaaa");
System.err.println(redpackResult);
}
diff --git a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/bean/pay/result/WxPayRefundQueryResultTest.java b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/bean/pay/result/WxPayRefundQueryResultTest.java
new file mode 100644
index 00000000..9427bd01
--- /dev/null
+++ b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/bean/pay/result/WxPayRefundQueryResultTest.java
@@ -0,0 +1,49 @@
+package me.chanjar.weixin.mp.bean.pay.result;
+
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/**
+ *
+ * Created by Binary Wang on 2016-12-29.
+ * @author binarywang(Binary Wang)
+ *
+ */
+public class WxPayRefundQueryResultTest {
+ @Test
+ public void composeRefundRecords() throws Exception {
+ /*
+ 该xml字符串来自于官方文档示例
+ */
+ String xmlString = "\n" +
+ " \n" +
+ " \n" +
+ " \n" +
+ " \n" +
+ " \n" +
+ " 1\n" +
+ " 1\n" +
+ " \n" +
+ " \n" +
+ " \n" +
+ " \n" +
+ " \n" +
+ " \n" +
+ " \n" +
+ "";
+
+ WxPayRefundQueryResult result = new WxPayRefundQueryResult();
+ result.setRefundCount(1);
+ result.composeRefundRecords(xmlString);
+
+ Assert.assertNotNull(result.getRefundRecords());
+ Assert.assertEquals(result.getRefundRecords().size(), 1);
+ Assert.assertEquals(result.getRefundRecords().get(0).getRefundId(), "2008450740201411110000174436");
+ Assert.assertEquals(result.getRefundRecords().get(0).getRefundFee().intValue(), 1);
+ Assert.assertEquals(result.getRefundRecords().get(0).getOutRefundNo(), "1415701182");
+ Assert.assertEquals(result.getRefundRecords().get(0).getRefundStatus(), "PROCESSING");
+
+ }
+
+}