|
@@ -9,8 +9,17 @@ import cn.hutool.crypto.SecureUtil;
|
|
|
import cn.hutool.crypto.symmetric.DES;
|
|
|
import cn.hutool.crypto.symmetric.SymmetricAlgorithm;
|
|
|
import cn.hutool.crypto.symmetric.SymmetricCrypto;
|
|
|
+import cn.hutool.http.HttpRequest;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.eptok.yspay.opensdkjava.fund.MercFundApi;
|
|
|
+import com.eptok.yspay.opensdkjava.pojo.vo.OnlineReqDataVo;
|
|
|
+import com.eptok.yspay.opensdkjava.util.Base64Utils;
|
|
|
+import com.eptok.yspay.opensdkjava.util.DateUtil;
|
|
|
+import com.eptok.yspay.opensdkjava.util.SrcDesUtil;
|
|
|
+import com.eptok.yspay.opensdkjava.util.YsOnlineSignUtils;
|
|
|
+import com.eptok.yspay.opensdkjava.util.YsfSignUtil;
|
|
|
import com.qs.mp.admin.domain.Coupon;
|
|
|
import com.qs.mp.admin.domain.CouponTicket;
|
|
|
import com.qs.mp.admin.domain.GoodsCard;
|
|
@@ -27,6 +36,7 @@ import com.qs.mp.common.utils.DateUtils;
|
|
|
import com.qs.mp.common.utils.RSAUtil;
|
|
|
import com.qs.mp.common.utils.WebhookService;
|
|
|
import com.qs.mp.common.utils.html.EscapeUtil;
|
|
|
+import com.qs.mp.common.utils.http.OkHttpUtil;
|
|
|
import com.qs.mp.common.utils.uuid.IdUtils;
|
|
|
import com.qs.mp.common.utils.uuid.UUID;
|
|
|
import com.qs.mp.framework.service.IWxSubscribeMessage;
|
|
@@ -41,10 +51,12 @@ import com.qs.mp.utils.SecurityUtils;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
import org.apache.commons.lang3.RandomStringUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.apache.http.client.methods.HttpRequestBase;
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.boot.test.context.SpringBootTest;
|
|
|
|
|
|
import java.io.IOException;
|
|
@@ -102,11 +114,85 @@ public class MyTest {
|
|
|
@Autowired
|
|
|
private TicketOrderTask ticketOrderTask;
|
|
|
|
|
|
- public static void main(String[] args) {
|
|
|
- WebhookService.sendAlertDing("mayday,mayday,上上下下,左右左右,BABA");
|
|
|
+ @Value("${ys-pay.serverUrl}")
|
|
|
+ private String serverUrl;
|
|
|
|
|
|
- String decrypt = AESUtil.decrypt("75213771c6c781d62136e39180303be03f0a99761114c1264f116051a9e95108");
|
|
|
- System.out.println("decrypt = " + decrypt);
|
|
|
+ @Value("${ys-pay.partner-id}")
|
|
|
+ private String partnerId;
|
|
|
+
|
|
|
+ @Value("${ys-pay.private-key-pass}")
|
|
|
+ private String privateKeyPass;
|
|
|
+
|
|
|
+
|
|
|
+ @Test
|
|
|
+ void test18() {
|
|
|
+ walletService.h5Pay(null,"023902109123",100,"测试测试测试");
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ void test17() {
|
|
|
+ OnlineReqDataVo req = new OnlineReqDataVo();
|
|
|
+ //请求路径,建议配置在项目的配置文件里面
|
|
|
+ String reqUrl = "https://commonapi.ysepay.com/gateway.do";
|
|
|
+ //私钥证书存放路径,建议配置在项目的配置文件里面
|
|
|
+ String privateKeyFilePath = "/Users/cup/Downloads/ysPayPre.pfx";
|
|
|
+ //ys公钥证书存放地址 建议配置在项目的配置文件里面
|
|
|
+ String publicKeyFilePath = "/Users/cup/Downloads/ysPayPub.cer";
|
|
|
+ //私钥证书密钥,建议配置在项目的配置文件里面
|
|
|
+ String privateKeyPassworde = "FAl9S8TmGB80";
|
|
|
+
|
|
|
+ //商户在银盛支付平台开设的用户号[商户号],接入时需要替换成自己的
|
|
|
+ req.setPartnerId(partnerId);
|
|
|
+ req.setReqUrl(reqUrl);
|
|
|
+ req.setPrivateKeyFilePath(privateKeyFilePath);
|
|
|
+ req.setPrivateKeyPassword(privateKeyPassworde);
|
|
|
+ req.setYsPublicKeyFilePath(publicKeyFilePath);
|
|
|
+ //商户余额查询业务参数
|
|
|
+ Map<String, Object> bizContent = new HashMap<>();
|
|
|
+ bizContent.put("merchant_usercode", partnerId);//商户号
|
|
|
+ req.setParamData(bizContent);
|
|
|
+ String result = null;
|
|
|
+ try{
|
|
|
+ logger.info("账户余额查询调用sdk接口addScanMerc请求入参为:"+ JSONObject.toJSONString(req));
|
|
|
+ //根据返回结果处理自己的业务逻辑,result内容详见接口文档
|
|
|
+ result = MercFundApi.getFundAccount(req);
|
|
|
+ }catch (Exception e){
|
|
|
+ logger.info("账户余额查询失败:"+ e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ void test16() throws Exception {
|
|
|
+
|
|
|
+ Map<String,String> mapData = new HashMap<>();
|
|
|
+ mapData.put("partner_id", partnerId);
|
|
|
+ mapData.put("method","ysepay.authenticate.three.key.element.precise");
|
|
|
+ mapData.put("timestamp", DateUtil.getDateNow());
|
|
|
+ mapData.put("sign_type", "RSA");
|
|
|
+ mapData.put("charset", "utf-8");
|
|
|
+ mapData.put("version", "3.0");
|
|
|
+ mapData.put("notify_url","http://127.0.0.1");
|
|
|
+// mapData.put("out_trade_no", "202003276843192280647119");
|
|
|
+
|
|
|
+ JSONObject json = new JSONObject();
|
|
|
+ json.put("out_trade_no", DateUtil.getDateNowYmd() + DateUtil.getRandom(6));
|
|
|
+ json.put("shopdate","20200328");
|
|
|
+ json.put("bank_account_name", "张三");
|
|
|
+ json.put("bank_account_no", "6212260488888888888");
|
|
|
+ json.put("id_card", SrcDesUtil.encryptData("ecolosha","41022319940916602X"));
|
|
|
+ mapData.put("biz_content",json.toString());
|
|
|
+ //参数签名
|
|
|
+ try{
|
|
|
+ String mp1688 = YsfSignUtil.sign(mapData, "/Users/cup/Downloads/ysPayPre.pfx",privateKeyPass);
|
|
|
+ System.out.println("mp1688 = " + mp1688);
|
|
|
+ mapData.put("sign", mp1688);
|
|
|
+
|
|
|
+ } catch (Exception e){
|
|
|
+ System.err.println("签名异常" + e);
|
|
|
+ }
|
|
|
+
|
|
|
+ String post = OkHttpUtil.post("https://openapi.ysepay.com/gateway.do", mapData);
|
|
|
+ System.out.println("返回" + post);
|
|
|
|
|
|
}
|
|
|
|