| | |
| | | import java.security.PrivateKey; |
| | | import java.security.Signature; |
| | | import java.security.spec.PKCS8EncodedKeySpec; |
| | | import java.util.Base64; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | import java.util.TreeMap; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | import org.omg.PortableServer.SERVANT_RETENTION_POLICY_ID; |
| | | import org.slf4j.Logger; |
| | |
| | | private static final String BALANCE_QUERY_INTERFACE = "/api/member/balance_query_a"; |
| | | private static final String BALANCE_WITHDRAW_INTERFACE = "/api/member/balance_withdraw_a"; |
| | | private static final String BALANCE_PAY = "/api/account/balance_pay"; |
| | | private static final String WITHDRAW_LIST = "/api/query/query_user_withdraw_list"; |
| | | // 创建支付订单 |
| | | private static final String CREATE_PAYMENT_INTERFACE = "/api/payment/create_payment"; |
| | | private static final String CREATE_PAYMENT_INTERFACE_CODE = "/api/payment/create_payment_qrcode"; |
| | |
| | | System.err.println(jsonObject); |
| | | return "success"; |
| | | } |
| | | public static String queryBalanceList() |
| | | throws Exception { |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddHHmmss"); |
| | | Date date = new Date(); |
| | | String format = simpleDateFormat.format(date); |
| | | date.setDate(date.getDate()-10); |
| | | String format1 = simpleDateFormat.format(date); |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | // data.put("app_id", APP_ID); |
| | | data.put("start_date", format1); |
| | | data.put("end_date", format); |
| | | data.put("page_index", "01"); |
| | | data.put("page_size", "01"); |
| | | data.put("member_id", "FZ17343419268427877"); |
| | | JSONObject body = new JSONObject(); |
| | | // body.put("merId", MER_ID); |
| | | 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/" + WITHDRAW_LIST, body); |
| | | JSONObject resJsonObject = JSONObject.parseObject(result); |
| | | if (resJsonObject.get("error_msg")!=null){ |
| | | return resJsonObject.getString("error_msg"); |
| | | } |
| | | String string = resJsonObject.getString("resCipher"); |
| | | String decrypt = decrypt(string); |
| | | JSONObject jsonObject = JSONObject.parseObject(decrypt); |
| | | System.err.println(jsonObject); |
| | | return "success"; |
| | | } |
| | | |
| | | public static void main(String[] args) throws Exception { |
| | | // createPayment1("CZ192818331231230901", 1, "0.01", |
| | |
| | | // ,"6228480469852935177"); |
| | | // updateAccount("test945622121","周帅","19983174515" |
| | | // ,"6228480469852935177"); |
| | | updateAccount("test945622121","周帅","19983174515" |
| | | ,"6228480469852935177"); |
| | | // queryBalance("test945622121"); |
| | | // balancePay("PAY100388123123", "test945622121","0.05", ""); |
| | | // 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("TX98633336569","0.05","test945622121","https://xq.xqzhihui.com/api/user/client/app-user-withdraw/base/callbackA"); |
| | | // 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(); |
| | | |
| | | data.put("order_no", orderNo); |
| | | data.put("app_id", APP_ID); |
| | | data.put("pay_amt", payAmt); |
| | |
| | | String string = resJsonObject.getString("resCipher"); |
| | | String decrypt = decrypt(string); |
| | | JSONObject jsonObject = JSONObject.parseObject(decrypt); |
| | | System.err.println("转账到用户余额"+jsonObject); |
| | | return jsonObject; |
| | | } |
| | | public static JSONObject balanceWithdraw(String orderNo,String payAmt, String memberId,String notifyUrl) throws Exception { |
| | |
| | | body.put("reqTime", DateUtils.dateTimeNow("yyyyMMddHHmmsssss")); |
| | | String result = sendPost(BASE_URL + BALANCE_WITHDRAW_INTERFACE, body); |
| | | JSONObject resJsonObject = JSONObject.parseObject(result); |
| | | System.err.println(resJsonObject); |
| | | System.err.println("提现返回参数---未解签"+resJsonObject); |
| | | if (resJsonObject.getString("error_msg")!=null){ |
| | | return resJsonObject; |
| | | } |
| | | String string = resJsonObject.getString("resCipher"); |
| | | String decrypt = decrypt(string); |
| | | JSONObject jsonObject = JSONObject.parseObject(decrypt); |
| | | System.err.println("提现返回的响应结果"+jsonObject); |
| | | return jsonObject; |
| | | } |
| | | |