| | |
| | | package com.stylefeng.guns.modular.huifu.biz; |
| | | |
| | | import cn.hutool.core.date.DateUtil; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | 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; |
| | | import com.huifu.bspay.sdk.opps.core.exception.BasePayException; |
| | | import com.huifu.bspay.sdk.opps.core.net.BasePayRequest; |
| | | import com.huifu.bspay.sdk.opps.core.utils.RsaUtils; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.account.req.UserWithdrawalReq; |
| | | import com.stylefeng.guns.modular.huifu.properties.HuiFuProperties; |
| | | import com.stylefeng.guns.core.util.RequestSeqUtil; |
| | | import com.stylefeng.guns.modular.huifu.properties.HuiFuProperties; |
| | | import com.stylefeng.guns.modular.system.model.UserWithdrawal; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.security.KeyFactory; |
| | | import java.security.PrivateKey; |
| | | import java.security.Signature; |
| | | import java.security.spec.PKCS8EncodedKeySpec; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Base64; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | |
| | | /** |
| | | * 斗拱进件业务 |
| | |
| | | cardInfo.put("cert_validity_type", "1"); |
| | | } |
| | | paramsInfo.put("card_info", cardInfo.toJSONString()); |
| | | // 结算卡信息 |
| | | JSONArray cashConfigArr = new JSONArray(); |
| | | JSONObject cashConfig = new JSONObject(); |
| | | /** |
| | | * T1:下一工作日到银行账户; |
| | | * D1:下一自然日到银行账户; |
| | | * D0:当日到银行账户;默认D0; |
| | | * DM:当日到账;到账资金不包括当天的交易资金; |
| | | * 示例值:T1 |
| | | */ |
| | | cashConfig.put("cash_type", "D1"); |
| | | cashConfig.put("fix_amt", "0.00"); |
| | | cashConfig.put("weekday_fix_amt", "0.00"); |
| | | cashConfig.put("weekday_fee_rate", "0.00"); |
| | | cashConfigArr.add(cashConfig); |
| | | paramsInfo.put("cash_config", cashConfigArr.toJSONString()); |
| | | log.info("用户业务入驻返回参数:{}", paramsInfo); |
| | | // 3. 发起API调用 |
| | | Map<String, Object> response = BasePayRequest.requestBasePay("v2/user/busi/open", paramsInfo, null, false);; |
| | |
| | | paramsInfo.put("req_seq_id", RequestSeqUtil.generateForHuiFu()); |
| | | // 请求日期 |
| | | paramsInfo.put("req_date", DateUtil.format(new Date(),"yyyyMMdd")); |
| | | // 渠道商/商户汇付Id |
| | | paramsInfo.put("upper_huifu_id", huiFuProperties.getUpperHuifuId()); |
| | | // 结算卡信息 |
| | | JSONObject cardInfo = new JSONObject(); |
| | | cardInfo.put("card_type", "1"); |
| | |
| | | cardInfo.put("cert_validity_type", "1"); |
| | | } |
| | | paramsInfo.put("card_info", cardInfo.toJSONString()); |
| | | // 结算卡信息 |
| | | JSONArray cashConfigArr = new JSONArray(); |
| | | JSONObject cashConfig = new JSONObject(); |
| | | /** |
| | | * T1:下一工作日到银行账户; |
| | | * D1:下一自然日到银行账户; |
| | | * D0:当日到银行账户;默认D0; |
| | | * DM:当日到账;到账资金不包括当天的交易资金; |
| | | * 示例值:T1 |
| | | */ |
| | | cashConfig.put("switch_state", "1"); |
| | | cashConfig.put("cash_type", "D1"); |
| | | cashConfig.put("fix_amt", "0.00"); |
| | | cashConfig.put("weekday_fix_amt", "0.00"); |
| | | cashConfig.put("weekday_fee_rate", "0.00"); |
| | | cashConfigArr.add(cashConfig); |
| | | paramsInfo.put("cash_config", cashConfigArr.toJSONString()); |
| | | log.info("用户业务入驻修改返回参数:{}", paramsInfo); |
| | | |
| | | // 3. 发起API调用 |
| | | Map<String, Object> response = BasePayRequest.requestBasePay("v2/user/busi/modify", paramsInfo, null, false);; |
| | | log.info("用户业务入驻修改返回参数:{}", response); |