mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2026-02-15 12:56:26 +08:00
完善查询退款接口,并重构部分支付接口的实现,简化代码
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
package me.chanjar.weixin.mp.bean.pay.result;
|
||||
|
||||
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Created by Binary Wang on 2016-12-29.
|
||||
* @author <a href="https://github.com/binarywang">binarywang(Binary Wang)</a>
|
||||
* </pre>
|
||||
*/
|
||||
public class WxPayRefundQueryResultTest {
|
||||
@Test
|
||||
public void composeRefundRecords() throws Exception {
|
||||
/*
|
||||
该xml字符串来自于官方文档示例
|
||||
*/
|
||||
String xmlString = "<xml>\n" +
|
||||
" <appid><![CDATA[wx2421b1c4370ec43b]]></appid>\n" +
|
||||
" <mch_id><![CDATA[10000100]]></mch_id>\n" +
|
||||
" <nonce_str><![CDATA[TeqClE3i0mvn3DrK]]></nonce_str>\n" +
|
||||
" <out_refund_no_0><![CDATA[1415701182]]></out_refund_no_0>\n" +
|
||||
" <out_trade_no><![CDATA[1415757673]]></out_trade_no>\n" +
|
||||
" <refund_count>1</refund_count>\n" +
|
||||
" <refund_fee_0>1</refund_fee_0>\n" +
|
||||
" <refund_id_0><![CDATA[2008450740201411110000174436]]></refund_id_0>\n" +
|
||||
" <refund_status_0><![CDATA[PROCESSING]]></refund_status_0>\n" +
|
||||
" <result_code><![CDATA[SUCCESS]]></result_code>\n" +
|
||||
" <return_code><![CDATA[SUCCESS]]></return_code>\n" +
|
||||
" <return_msg><![CDATA[OK]]></return_msg>\n" +
|
||||
" <sign><![CDATA[1F2841558E233C33ABA71A961D27561C]]></sign>\n" +
|
||||
" <transaction_id><![CDATA[1008450740201411110005820873]]></transaction_id>\n" +
|
||||
"</xml>";
|
||||
|
||||
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");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user