| | |
| | | package com.stylefeng.guns.modular.huifu.biz; |
| | | |
| | | import cn.hutool.core.date.DateUtil; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.google.gson.JsonObject; |
| | | import com.huifu.bspay.sdk.opps.core.BasePay; |
| | | import com.huifu.bspay.sdk.opps.core.config.MerConfig; |
| | |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public Map<String, Object> userBusinessOpen(UserWithdrawalReq userWithdrawalReq) throws Exception { |
| | | public Map<String, Object> userBusinessOpen(UserWithdrawal userWithdrawal) throws Exception { |
| | | // 1. 数据初始化,填入对应的商户配置 |
| | | MerConfig merConfig = new MerConfig(); |
| | | merConfig.setProcutId(huiFuProperties.getProductId()); |
| | |
| | | // 2.组装请求参数 |
| | | Map<String, Object> paramsInfo = new HashMap<>(); |
| | | // 汇付ID |
| | | paramsInfo.put("huifu_id", "6666000105765113"); |
| | | paramsInfo.put("huifu_id", userWithdrawal.getCusId()); |
| | | // 请求流水号 |
| | | paramsInfo.put("req_seq_id", RequestSeqUtil.generateForHuiFu()); |
| | | // 请求日期 |
| | | paramsInfo.put("req_date", DateUtil.format(new Date(),"yyyyMMdd")); |
| | | // 渠道商/商户汇付Id |
| | | paramsInfo.put("upper_huifu_id", "6666000003084836"); |
| | | // 乐接活配置当合作平台为乐接活,必填 |
| | | paramsInfo.put("ljh_data", "test"); |
| | | // 汇薪云配置当合作平台为汇薪云,必填 |
| | | paramsInfo.put("hxy_data", "test"); |
| | | // 结算信息配置 |
| | | paramsInfo.put("settle_config", "{\"settle_cycle\":\"D1\",\"min_amt\":\"0.01\",\"remained_amt\":\"10.00\",\"settle_abstract\":\"结算摘要\",\"out_settle_flag\":\"2\",\"settle_batch_no\":\"300\",\"fixed_ratio\":\"2\"}"); |
| | | // 结算卡信息 |
| | | paramsInfo.put("card_info", "{\"card_type\":\"0\",\"card_name\":\"交通银行股份有限公司\",\"card_no\":\"6217001210064762121\",\"prov_id\":\"310000\",\"area_id\":\"310100\",\"branch_code\":\"105305264815\",\"cert_type\":\"00\",\"cert_no\":\"110101197003077513\",\"cert_validity_type\":\"0\",\"cert_begin_date\":\"20210806\",\"cert_end_date\":\"20410806\",\"mp\":\"15556622368\"}"); |
| | | paramsInfo.put("upper_huifu_id", huiFuProperties.getUpperHuifuId()); |
| | | //// 结算信息配置 |
| | | //paramsInfo.put("settle_config", "{\"settle_cycle\":\"D1\",\"min_amt\":\"0.01\",\"remained_amt\":\"10.00\",\"settle_abstract\":\"结算摘要\",\"out_settle_flag\":\"2\",\"settle_batch_no\":\"300\",\"fixed_ratio\":\"2\"}"); |
| | | //// 结算卡信息 |
| | | JSONObject cardInfo = new JSONObject(); |
| | | cardInfo.put("card_type", "1"); |
| | | cardInfo.put("card_name", userWithdrawal.getBindAcctName()); |
| | | cardInfo.put("card_no", userWithdrawal.getBankCardCode()); |
| | | cardInfo.put("prov_id", userWithdrawal.getBankCardProvinceCode()); |
| | | cardInfo.put("area_id", userWithdrawal.getBankCardCityCode()); |
| | | cardInfo.put("cert_type", "00"); |
| | | String[] certificateExpireDateArr = userWithdrawal.getCertificateExpireTime().split(","); |
| | | String startDateStr = certificateExpireDateArr[0]; |
| | | // 个人证件有效期开始日期 |
| | | cardInfo.put("cert_begin_date", startDateStr.replace("-", "")); |
| | | // 个人证件有效期截止日期 |
| | | String endDateStr = certificateExpireDateArr[1]; |
| | | if (!"长期".equals(endDateStr)) { |
| | | String formatEndDate = endDateStr.replace("-", ""); |
| | | cardInfo.put("cert_end_date", formatEndDate); |
| | | // 个人证件有效期类型 |
| | | cardInfo.put("cert_validity_type", "0"); |
| | | }else { |
| | | // 个人证件有效期类型 |
| | | cardInfo.put("cert_validity_type", "1"); |
| | | } |
| | | paramsInfo.put("card_info", cardInfo.toJSONString()); |
| | | // 3. 发起API调用 |
| | | Map<String, Object> response = BasePayRequest.requestBasePay("v2/user/busi/open", paramsInfo, null, false);; |
| | | log.info("用户业务入驻返回参数:" + response); |