2025-03-27 14:49:57 +08:00

113 lines
3.7 KiB
Java

package com.xkrs.allinpay.test;
import com.xkrs.allinpay.SybPayService;
import java.util.Map;
public class ApiTestV2 {
public static void main(String[] args) throws Exception {
// testPay();//统一下单,异步类交易
// testScanPay();//统一扫码,被扫交易
// testCancel();//撤销
testRefund();//退款
// testQuery();//查询
}
/**
* chnlid;205299480
* randomstr;281692226001
* trxcode;VSP501
* sign;S3+78r3sPP/F1EV9ICo+fBu4UKC8nY47QAcTyVJSrzGX4/advm7B2lqrzjzGiMmrNpFiRy8zrNmBjPV94q484Q==
* errmsg;缺少必要字段 terminal_info(UP01A5100)
* cmid;625141525
* trxid;250310119743017937
* trxstatus;3045
* accttype;99
* reqsn;1741585763289
* fintime;20250310134920
* cusid;990440148166000
* appid;00000003
* initamt;1
* acct;000000
* bankcode;0000
* trxamt;1
* retcode;SUCCESS
*/
public static void testScanPay() throws Exception {
SybPayService service = new SybPayService();
String reqsn = String.valueOf(System.currentTimeMillis());
Map<String, String> map = service.scanPay(1, reqsn, "标题", "备注", "134775931316089668", "", "", "", "");
print(map);
}
/**
* chnlid;205299480
* randomstr;134591333810
* trxcode;VSP501
* sign;UZwP/m6ZbZhSkjgpa27a0VdKElbzR1OgTH+BwPtUcLRy9v34DaQKb1C55Sd06+f6kkQ+VsrgEN8ocFtEiRd7TA==
* errmsg;缺少必要字段 terminal_info(UP01A5100)
* cmid;625141525
* trxid;250310119743017937
* trxstatus;3045
* accttype;99
* reqsn;1741585763289
* fintime;20250310134920
* cusid;990440148166000
* appid;00000003
* initamt;1
* acct;000000
* bankcode;0000
* trxamt;1
* retcode;SUCCESS
*/
public static void testQuery() throws Exception {
SybPayService service = new SybPayService();
Map<String, String> map = service.query("", "250310119743017937");
print(map);
}
public static void testRefund() throws Exception {
SybPayService service = new SybPayService();
String reqsn = String.valueOf(System.currentTimeMillis());
// Map<String, String> map = service.refund(1, reqsn, "", "1742278978287");
Map<String, String> map = service.refund(1, reqsn, "250326129022241524", "");
print(map);
}
public static void testCancel() throws Exception {
SybPayService service = new SybPayService();
String reqsn = String.valueOf(System.currentTimeMillis());
Map<String, String> map = service.cancel(1, reqsn, "1741655699800", "");
print(map);
}
/**
* randomstr;319561317577
* trxcode;VSP501
* cusid;990440148166000
* appid;00000003
* sign;twRKyHVn5prsyy469n+/XfZ/SGsPwfJwQGu0MbWZHV83sxOuFBIJ78QYyRIWg/QdBIkxRuuCSlnhg7rZk6TFEw==
* payinfo;https://syb.allinpay.com/apiweb/h5unionpay/native?key=GCnOxovaUMsSEXeDw8RhG%2Fcy
* trxid;250310112843002292
* trxstatus;0000
* reqsn;1741585650888
* retcode;SUCCESS
*/
public static void testPay() throws Exception {
SybPayService service = new SybPayService();
String reqsn = String.valueOf(System.currentTimeMillis());
Map<String, String> map = service.pay(1, reqsn, "W01", "标题", "备注", "", "123", "http://8.142.26.238:6801/pay/notify", "", "", "", "", "", "", "", "", "", "", "", "");
print(map);
}
public static void print(Map<String, String> map) {
System.out.println("返回数据如下:");
if (map != null) {
for (String key : map.keySet()) {
System.out.println(key + ";" + map.get(key));
}
}
}
}