#320 增加“拉取订单评价数据“接口方法
This commit is contained in:
@@ -2,7 +2,6 @@ package com.github.binarywang.wxpay.service.impl;
|
||||
|
||||
import com.github.binarywang.utils.qrcode.QrcodeUtils;
|
||||
import com.github.binarywang.wxpay.bean.coupon.*;
|
||||
import com.github.binarywang.wxpay.bean.notify.WxPayRefundNotifyResult;
|
||||
import com.github.binarywang.wxpay.bean.request.*;
|
||||
import com.github.binarywang.wxpay.bean.result.*;
|
||||
import com.github.binarywang.wxpay.constant.WxPayConstants;
|
||||
@@ -16,10 +15,13 @@ import com.github.binarywang.wxpay.testbase.XmlWxPayConfig;
|
||||
import com.google.inject.Inject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.testng.annotations.*;
|
||||
import org.testng.annotations.Guice;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.testng.Assert.*;
|
||||
@@ -90,7 +92,7 @@ public class WxPayServiceAbstractImplTest {
|
||||
|
||||
@Test
|
||||
public void testDownloadBill() throws Exception {
|
||||
WxPayBillResult wxPayBillResult = this.payService.downloadBill("20170101", BillType.ALL, "GZIP", "1111111");
|
||||
WxPayBillResult wxPayBillResult = this.payService.downloadBill("20170831", BillType.ALL, null, "1111111");
|
||||
//前一天没有账单记录返回null
|
||||
assertNotNull(wxPayBillResult);
|
||||
//必填字段为空时,抛出异常
|
||||
@@ -313,10 +315,24 @@ public class WxPayServiceAbstractImplTest {
|
||||
@Test
|
||||
public void testQueryCouponInfo() throws Exception {
|
||||
WxPayCouponInfoQueryResult result = this.payService.queryCouponInfo(WxPayCouponInfoQueryRequest.newBuilder()
|
||||
.openid("onqOjjrXT-776SpHnfexGm1_P7iE")
|
||||
.openid("ojOQA0y9o-Eb6Aep7uVTdbkJqrP4")
|
||||
.couponId("11")
|
||||
.stockId("1121")
|
||||
.build());
|
||||
this.logger.info(result.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* 目前调用接口总报“系统繁忙,清稍后再试”,怀疑根本没法使用
|
||||
*/
|
||||
@Test
|
||||
public void testQueryComment() throws Exception {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.add(Calendar.DAY_OF_MONTH, -2);
|
||||
Date beginDate = calendar.getTime();
|
||||
calendar.add(Calendar.MONTH, -1);
|
||||
Date endDate = calendar.getTime();
|
||||
this.payService.queryComment(beginDate, endDate, 0, null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.github.binarywang.wxpay.util;
|
||||
|
||||
import com.google.common.base.Splitter;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import static com.github.binarywang.wxpay.constant.WxPayConstants.SignType.HMAC_SHA256;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 测试中使用的测试数据参考的是官方文档,地址:
|
||||
* https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=4_3
|
||||
* Created by BinaryWang on 2017/9/2.
|
||||
* </pre>
|
||||
*
|
||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||
*/
|
||||
public class SignUtilsTest {
|
||||
@Test
|
||||
public void testCreateSign() throws Exception {
|
||||
String signKey = "192006250b4c09247ec02edce69f6a2d";
|
||||
String message = "appid=wxd930ea5d5a258f4f&body=test&device_info=1000&mch_id=10000100&nonce_str=ibuaiVcKdpRxkhJA";
|
||||
assertEquals(SignUtils.createSign((Splitter.on("&").withKeyValueSeparator("=").split(message)), signKey, null),
|
||||
"9A0A8659F005D6984697E2CA0A9CF3B7");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateSign_HMACSHA256() throws Exception {
|
||||
String signKey = "192006250b4c09247ec02edce69f6a2d";
|
||||
final String message = "appid=wxd930ea5d5a258f4f&body=test&device_info=1000&mch_id=10000100&nonce_str=ibuaiVcKdpRxkhJA";
|
||||
String sign = SignUtils.createSign(Splitter.on("&").withKeyValueSeparator("=").split(message),
|
||||
signKey, HMAC_SHA256);
|
||||
assertEquals(sign, "6A9AE1657590FD6257D693A078E1C3E4BB6BA4DC30B23E0EE2496E54170DACD6");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCheckSign() throws Exception {
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user