| | |
| | | package com.xinquan.common.core.utils; |
| | | |
| | | import cn.hutool.core.util.RandomUtil; |
| | | import cn.hutool.http.HttpRequest; |
| | | import cn.hutool.http.HttpResponse; |
| | | import cn.hutool.http.HttpUtil; |
| | |
| | | private static final String PAYMENT_REFUND_INTERFACE = "/api/payment/payment_refund"; |
| | | private static final String QUERY_PAYMENT_INTERFACE = "/api/query/query_payment"; |
| | | private static final String MERCHANT_PAY_INTERFACE = "/api/account/merchant_pay"; |
| | | // 查询用户列表 |
| | | private static final String QUERY_USER_LIST = "/api/query/query_user_list"; |
| | | // 接口地址 TODO |
| | | private static final String BASE_URL = "https://payapi.juhefu.com/"; |
| | | // 支付宝支付渠道 |
| | |
| | | private static final String PAY_CHANNEL_WECHAT_THiRD = "wx"; |
| | | // 微信小程序id TODO |
| | | private static final String WX_APP_ID = ""; |
| | | public static void main(String[] args) throws Exception { |
| | | // createPayment1("CZ192818331231230901", 1, "0.01", |
| | | // "充值", "充值", |
| | | // "127.0.0.1", "o4Q_v6QMqkcO7kIOOxp-x1-UpOww", |
| | | // "https://xq.xqzhihui.com/api/order/client/order/order/base/callback") |
| | | //// "https://xq.xqzhihui.com/api/order/client/order/order/base/callback") |
| | | // ; |
| | | // String orderNo = OrderUtil.getOrderNoForPrefix("User"); |
| | | // long time = new Date().getTime(); |
| | | // String s = RandomUtil.randomNumbers(4); |
| | | // String s1 = "FZ" + time + s; |
| | | // System.err.println(s1); |
| | | // createUser(s1,"周帅","00" |
| | | // ,"130682198203061982" |
| | | // ,"18132621790" |
| | | // ,"6221801210000822611"); |
| | | // updateAccount("FZ17403857003793677","邱仕珍","13682696011" |
| | | // ,"4367427200563236884"); |
| | | // updateAccount("test945622121","周帅","19983174515" |
| | | // ,"6228480469852935177"); |
| | | // balancePay("CZ09809217341", "FZ17343419268427877","0.01", ""); |
| | | // queryBalance("FZ17343419268427877"); |
| | | // String decrypt = decrypt("z8Che/JwxrGj/oTOuAvU8HFN6vXL/OqeioV41ZuPV/xVQPt9vCHHc1R5LgAO51Hq5ilD9wqsminRvSiJj6Fs/Bfk8espZSOO2g1OE7FZyqcLB1w01MSWyxfQT8nc2GH/EfOKXCuaKBCeyW24OvW3ng=="); |
| | | // System.err.println(decrypt); |
| | | // balanceWithdraw("TX1000928371648172","0.01","FZ17343419268427877","https://xq.xqzhihui.com/api/user/client/app-user-withdraw/base/callbackA"); |
| | | queryUserList("441424198104061249"); |
| | | // queryBalanceList("FZ17427173417891435"); |
| | | // queryPayment("002212025032410341110750073154527547392"); |
| | | } |
| | | public static String queryUserList(String identifier) |
| | | throws Exception { |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | // data.put("app_id", APP_ID); |
| | | data.put("app_id", "app_e7301b75-19f1-40e5-96ac-0fee847d4da0"); |
| | | data.put("member_type", "01"); |
| | | data.put("identifier", identifier); |
| | | data.put("page_index", "1"); |
| | | data.put("page_size", "10"); |
| | | JSONObject body = new JSONObject(); |
| | | body.put("merId", "1120241105365033"); |
| | | body.put("sign", sign(JSONObject.toJSONString(data))); |
| | | // body.put("reqCipher", |
| | | // EncryptUtils.aes256ECBPkcs7PaddingEncrypt(JSONObject.toJSONString(data), AES_KEY)); |
| | | body.put("reqCipher", |
| | | EncryptUtils.aes256ECBPkcs7PaddingEncrypt(JSONObject.toJSONString(data), "6d548eb01bad44bbbb4a23743e733103")); |
| | | body.put("reqTime", DateUtils.dateTimeNow("yyyyMMddHHmmsssss")); |
| | | System.err.println(body); |
| | | // String result = sendPost(BASE_URL + CREATE_USER_INTERFACE, body); |
| | | String result = sendPost("https://payapi.juhefu.com/" + QUERY_USER_LIST, body); |
| | | JSONObject resJsonObject = JSONObject.parseObject(result); |
| | | System.err.println(resJsonObject); |
| | | if (resJsonObject.get("error_msg")!=null){ |
| | | return resJsonObject.getString("error_msg"); |
| | | } |
| | | String string = resJsonObject.getString("resCipher"); |
| | | String decrypt = decrypt(string); |
| | | System.err.println(decrypt); |
| | | JSONObject jsonObject = JSONObject.parseObject(decrypt); |
| | | System.err.println(jsonObject); |
| | | if (jsonObject!=null){ |
| | | return jsonObject.getJSONObject("data").getString("member_id"); |
| | | } |
| | | return null; |
| | | } |
| | | /** |
| | | * 创建用户 |
| | | * |
| | |
| | | System.err.println(decrypt); |
| | | JSONObject jsonObject = JSONObject.parseObject(decrypt); |
| | | if (resJsonObject.get("error_msg")!=null){ |
| | | System.err.println("添加银行卡失败没有获取到分账id"+resJsonObject.get("error_msg")); |
| | | return resJsonObject.getString("error_msg"); |
| | | } |
| | | return "success"; |
| | | } |
| | | |
| | | public static String updateAccount( |
| | | String memberId |
| | | ,String username |
| | |
| | | data.put("card_id", cardId); |
| | | data.put("card_name", username); |
| | | data.put("tel_no", telNo); |
| | | data.put("bank_acct_type", "2"); |
| | | JSONObject body = new JSONObject(); |
| | | // body.put("merId", MER_ID); |
| | | body.put("merId", "1120241105365033"); |
| | |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | // data.put("app_id", APP_ID); |
| | | data.put("app_id", "app_e7301b75-19f1-40e5-96ac-0fee847d4da0"); |
| | | data.put("app_id", APP_ID); |
| | | data.put("member_id", memberId); |
| | | data.put("member_type", "01"); |
| | | JSONObject body = new JSONObject(); |
| | | // body.put("merId", MER_ID); |
| | | body.put("merId", "1120241105365033"); |
| | |
| | | System.err.println(jsonObject); |
| | | return "success"; |
| | | } |
| | | public static String queryBalanceList() |
| | | public static String queryBalanceList(String member_id) |
| | | throws Exception { |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddHHmmss"); |
| | | Date date = new Date(); |
| | |
| | | data.put("end_date", format); |
| | | data.put("page_index", "01"); |
| | | data.put("page_size", "01"); |
| | | data.put("member_id", "FZ17343419268427877"); |
| | | data.put("member_id", member_id); |
| | | JSONObject body = new JSONObject(); |
| | | // body.put("merId", MER_ID); |
| | | body.put("merId", "1120241105365033"); |
| | |
| | | return "success"; |
| | | } |
| | | |
| | | public static void main(String[] args) throws Exception { |
| | | // createPayment1("CZ192818331231230901", 1, "0.01", |
| | | // "充值", "充值", |
| | | // "127.0.0.1", "o4Q_v6QMqkcO7kIOOxp-x1-UpOww", |
| | | // "https://xq.xqzhihui.com/api/order/client/order/order/base/callback") |
| | | //// "https://xq.xqzhihui.com/api/order/client/order/order/base/callback") |
| | | // ; |
| | | // String orderNo = OrderUtil.getOrderNoForPrefix("User"); |
| | | // createUser("test945622121","周帅","00" |
| | | // ,"513902200006257079" |
| | | // ,"19983174515" |
| | | // ,"6228480469852935177"); |
| | | // updateAccount("test945622121","周帅","19983174515" |
| | | // ,"6228480469852935177"); |
| | | // updateAccount("test945622121","周帅","19983174515" |
| | | // ,"6228480469852935177"); |
| | | // balancePay("CZ09809217341", "FZ17343419268427877","0.01", ""); |
| | | // queryBalance("FZ17343419268427877"); |
| | | |
| | | // String decrypt = decrypt("z8Che/JwxrGj/oTOuAvU8HFN6vXL/OqeioV41ZuPV/xVQPt9vCHHc1R5LgAO51Hq5ilD9wqsminRvSiJj6Fs/Bfk8espZSOO2g1OE7FZyqcLB1w01MSWyxfQT8nc2GH/EfOKXCuaKBCeyW24OvW3ng=="); |
| | | // System.err.println(decrypt); |
| | | // balanceWithdraw("TX1000928371648172","0.01","FZ17343419268427877","https://xq.xqzhihui.com/api/user/client/app-user-withdraw/base/callbackA"); |
| | | queryBalanceList(); |
| | | } |
| | | |
| | | public static JSONObject balancePay(String orderNo, String memberId, String payAmt, String notifyUrl) throws Exception { |
| | | JSONObject data = new JSONObject(); |