...
|
...
|
@@ -8,6 +8,7 @@ import com.yoho.core.common.utils.MD5; |
|
|
import org.junit.Test;
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.util.Collections;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
...
|
...
|
@@ -31,11 +32,14 @@ public class PayTest { |
|
|
data.put("msgType", "trade.precreate"); // 微信:wx.unifiedOrder, 支付宝:trade.precreate, 全民付:qmf.order, 银联云闪付:uac.appOrder
|
|
|
data.put("requestTimestamp", DateUtil.date2String(new Date(), "yyyy-MM-dd HH:mm:ss"));
|
|
|
// 支付宝- 31945075157
|
|
|
data.put("merOrderId", "31945075157");
|
|
|
data.put("merOrderId", "31942222222222");
|
|
|
data.put("mid", "898310148160568"); //商户号 仅用于支付宝和云闪付
|
|
|
data.put("tid","00000001"); //终端号
|
|
|
data.put("instMid", "APPDEFAULT"); // 机构商户号
|
|
|
data.put("totalAmount", 1);
|
|
|
// 回调接口 http://api-test3.dev.yohocorp.com/payment/weixin_notify
|
|
|
data.put("notifyUrl", "http://testapi.yohops.com/payment/weixin_notify");
|
|
|
|
|
|
|
|
|
|
|
|
data.put("sign", getSign(data));
|
...
|
...
|
@@ -126,19 +130,25 @@ public class PayTest { |
|
|
* 订单查询接口
|
|
|
*/
|
|
|
@Test
|
|
|
public void testQuary(){
|
|
|
public void testQuary() throws Exception{
|
|
|
|
|
|
JSONObject data = new JSONObject();
|
|
|
data.put("msgSrc","WWW.TEST.COM");
|
|
|
// 支付宝
|
|
|
data.put("msgType", "query"); // 微信:wx.unifiedOrder, 支付宝:trade.precreate, 全民付:qmf.order, 银联云闪付:uac.appOrder
|
|
|
data.put("requestTimestamp", DateUtil.date2String(new Date(), "yyyy-MM-dd HH:mm:ss"));
|
|
|
data.put("merOrderId", "24455075157");
|
|
|
data.put("merOrderId", "319450751581111111");
|
|
|
data.put("mid", "898310148160568"); //商户号 仅用于支付宝和云闪付
|
|
|
data.put("tid","00000001"); //终端号
|
|
|
data.put("instMid", "APPDEFAULT"); // 机构商户号
|
|
|
|
|
|
|
|
|
data.put("sign", getSign(data));
|
|
|
|
|
|
HttpClient httpClient = new HttpClient();
|
|
|
httpClient.init();
|
|
|
String result = httpClient.post(url, JSON.toJSONString(data));
|
|
|
System.out.println(result);
|
|
|
}
|
|
|
|
|
|
|
...
|
...
|
@@ -146,20 +156,25 @@ public class PayTest { |
|
|
* 订单退款
|
|
|
*/
|
|
|
@Test
|
|
|
public void testRefund(){
|
|
|
public void testRefund()throws Exception{
|
|
|
|
|
|
JSONObject data = new JSONObject();
|
|
|
data.put("msgSrc","WWW.TEST.COM");
|
|
|
// 支付宝
|
|
|
data.put("msgType", "refund"); // 微信:wx.unifiedOrder, 支付宝:trade.precreate, 全民付:qmf.order, 银联云闪付:uac.appOrder
|
|
|
data.put("requestTimestamp", DateUtil.date2String(new Date(), "yyyy-MM-dd HH:mm:ss"));
|
|
|
data.put("merOrderId", "24455075157");
|
|
|
data.put("merOrderId", "319450751589999");
|
|
|
data.put("mid", "898310148160568"); //商户号 仅用于支付宝和云闪付
|
|
|
data.put("tid","00000001"); //终端号
|
|
|
data.put("instMid", "APPDEFAULT"); // 机构商户号
|
|
|
data.put("refundAmount",1);
|
|
|
|
|
|
data.put("sign", getSign(data));
|
|
|
|
|
|
HttpClient httpClient = new HttpClient();
|
|
|
httpClient.init();
|
|
|
String result = httpClient.post(url, JSON.toJSONString(data));
|
|
|
System.out.println(result);
|
|
|
}
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -184,4 +199,13 @@ public class PayTest { |
|
|
|
|
|
// 回调接口
|
|
|
|
|
|
|
|
|
@Test
|
|
|
public void tes(){
|
|
|
|
|
|
BigDecimal bigDecimal = new BigDecimal("22.88");
|
|
|
System.out.println(bigDecimal);
|
|
|
|
|
|
}
|
|
|
|
|
|
} |
...
|
...
|
|