|
@@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.json.JSONObject;
|
|
import cn.hutool.json.JSONObject;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
import cn.hutool.json.JSONUtil;
|
|
|
import com.github.microservice.app.stream.StreamHelper;
|
|
import com.github.microservice.app.stream.StreamHelper;
|
|
|
|
|
+import com.github.microservice.models.requestModel.SuperCooperatorResponseModel;
|
|
|
import com.github.microservice.models.requestModel.SuperResponseModel;
|
|
import com.github.microservice.models.requestModel.SuperResponseModel;
|
|
|
import com.github.microservice.models.type.PaymentType;
|
|
import com.github.microservice.models.type.PaymentType;
|
|
|
import com.github.microservice.net.ResultContent;
|
|
import com.github.microservice.net.ResultContent;
|
|
@@ -26,6 +27,8 @@ import com.zhongshu.payment.client.payModel.commn.ClosePayOrderParam;
|
|
|
import com.zhongshu.payment.client.payModel.commn.CreateOrderParam;
|
|
import com.zhongshu.payment.client.payModel.commn.CreateOrderParam;
|
|
|
import com.zhongshu.payment.client.payModel.commn.PayNotifyParam;
|
|
import com.zhongshu.payment.client.payModel.commn.PayNotifyParam;
|
|
|
import com.zhongshu.payment.client.payModel.commn.PayOrderParam;
|
|
import com.zhongshu.payment.client.payModel.commn.PayOrderParam;
|
|
|
|
|
+import com.zhongshu.payment.client.payModel.cooperator.CooperatorParam;
|
|
|
|
|
+import com.zhongshu.payment.client.payModel.cooperator.model.*;
|
|
|
import com.zhongshu.payment.client.payModel.unionFrictionlessPay.model.*;
|
|
import com.zhongshu.payment.client.payModel.unionFrictionlessPay.model.*;
|
|
|
import com.github.microservice.types.unionFrictionlessPayType.ContractState;
|
|
import com.github.microservice.types.unionFrictionlessPayType.ContractState;
|
|
|
import com.github.microservice.types.unionFrictionlessPayType.UnionUserOpenType;
|
|
import com.github.microservice.types.unionFrictionlessPayType.UnionUserOpenType;
|
|
@@ -43,6 +46,7 @@ import com.zhongshu.payment.server.core.service.pay.SuperPayService;
|
|
|
import com.zhongshu.payment.server.core.service.pay.impl.unionFrictionlessPay.config.UnionFrictionlessPayApiConfig;
|
|
import com.zhongshu.payment.server.core.service.pay.impl.unionFrictionlessPay.config.UnionFrictionlessPayApiConfig;
|
|
|
import com.zhongshu.payment.server.core.service.pay.impl.unionFrictionlessPay.config.UnionFrictionlessPayConfig;
|
|
import com.zhongshu.payment.server.core.service.pay.impl.unionFrictionlessPay.config.UnionFrictionlessPayConfig;
|
|
|
import com.zhongshu.payment.server.core.service.pay.impl.unionFrictionlessPay.config.UnionPaymentConfig;
|
|
import com.zhongshu.payment.server.core.service.pay.impl.unionFrictionlessPay.config.UnionPaymentConfig;
|
|
|
|
|
+import com.zhongshu.payment.server.core.service.pay.impl.unionFrictionlessPay.config.WithdrawConfig;
|
|
|
import com.zhongshu.payment.server.core.utils.AesUtils;
|
|
import com.zhongshu.payment.server.core.utils.AesUtils;
|
|
|
import com.zhongshu.payment.server.core.utils.CommonUtil;
|
|
import com.zhongshu.payment.server.core.utils.CommonUtil;
|
|
|
import jakarta.servlet.ServletInputStream;
|
|
import jakarta.servlet.ServletInputStream;
|
|
@@ -105,6 +109,9 @@ public class UnionFrictionlessPayMainService extends SuperPayService {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
RechargeRecordDao rechargeRecordDao;
|
|
RechargeRecordDao rechargeRecordDao;
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ WithdrawConfig withdrawConfig;
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 发起签约
|
|
* 发起签约
|
|
|
*
|
|
*
|
|
@@ -701,6 +708,171 @@ public class UnionFrictionlessPayMainService extends SuperPayService {
|
|
|
return ResultContent.buildFail("暂未实现");
|
|
return ResultContent.buildFail("暂未实现");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ //------------------------提现 start ------------------------
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 查询商户可提现金额
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param param
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ public ResultContent queryWithdrawBalance(CooperatorParam param) {
|
|
|
|
|
+ QueryWithdrawBalanceParam requestParam = new QueryWithdrawBalanceParam();
|
|
|
|
|
+ requestParam.setMchntNo(getMchntNo(param.getShopId()));
|
|
|
|
|
+ requestParam.setSysId(withdrawConfig.getSysid());
|
|
|
|
|
+ requestParam.setAppType(withdrawConfig.getAppType());
|
|
|
|
|
+
|
|
|
|
|
+ String url = payApiConfig.getUrl(UnionFrictionlessPayApiConfig.queryWithdrawBalance);
|
|
|
|
|
+ SuperCooperatorResponseModel requestAPI = unionRequestService.requestCooperatorAPI
|
|
|
|
|
+ (url, requestParam, QueryWithdrawBalanceResponse.class);
|
|
|
|
|
+ if (requestAPI.isFailed()) {
|
|
|
|
|
+ return ResultContent.buildFail(requestAPI.getMsg());
|
|
|
|
|
+ }
|
|
|
|
|
+ QueryWithdrawBalanceResponse response = (QueryWithdrawBalanceResponse) requestAPI;
|
|
|
|
|
+ return ResultContent.buildSuccess();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 提现
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param param
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ public ResultContent processWithdraw(CooperatorParam param) {
|
|
|
|
|
+ ProcessWithdrawParam requestParam = new ProcessWithdrawParam();
|
|
|
|
|
+ requestParam.setMchntNo(getMchntNo(param.getShopId()));
|
|
|
|
|
+ requestParam.setSysId(withdrawConfig.getSysid());
|
|
|
|
|
+ requestParam.setAppType(withdrawConfig.getAppType());
|
|
|
|
|
+ String sysOrderId = collectionIdService.getNextNo();
|
|
|
|
|
+ requestParam.setSysOrderId(sysOrderId);
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ String url = payApiConfig.getUrl(UnionFrictionlessPayApiConfig.processWithdraw);
|
|
|
|
|
+ SuperCooperatorResponseModel requestAPI = unionRequestService.requestCooperatorAPI
|
|
|
|
|
+ (url, requestParam, ProcessWithdrawResponse.class);
|
|
|
|
|
+ if (requestAPI.isFailed()) {
|
|
|
|
|
+ return ResultContent.buildFail(requestAPI.getMsg());
|
|
|
|
|
+ }
|
|
|
|
|
+ ProcessWithdrawResponse response = (ProcessWithdrawResponse) requestAPI;
|
|
|
|
|
+ return ResultContent.buildSuccess();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 提现状态查询
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param param
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ public ResultContent queryOrderStatus(CooperatorParam param) {
|
|
|
|
|
+ QueryOrderStatusParam requestParam = new QueryOrderStatusParam();
|
|
|
|
|
+
|
|
|
|
|
+ String url = payApiConfig.getUrl(UnionFrictionlessPayApiConfig.queryOrderStatus);
|
|
|
|
|
+ SuperCooperatorResponseModel requestAPI = unionRequestService.requestCooperatorAPI
|
|
|
|
|
+ (url, requestParam, QueryOrderStatusResponse.class);
|
|
|
|
|
+ if (requestAPI.isFailed()) {
|
|
|
|
|
+ return ResultContent.buildFail(requestAPI.getMsg());
|
|
|
|
|
+ }
|
|
|
|
|
+ QueryOrderStatusResponse response = (QueryOrderStatusResponse) requestAPI;
|
|
|
|
|
+ return ResultContent.buildSuccess();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 收钱吧-D+0开通权限查询
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param param
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ public ResultContent queryWithdrawAuthstatus(CooperatorParam param) {
|
|
|
|
|
+ QueryWithdrawAuthstatusParam requestParam = new QueryWithdrawAuthstatusParam();
|
|
|
|
|
+
|
|
|
|
|
+ String url = payApiConfig.getUrl(UnionFrictionlessPayApiConfig.queryWithdrawAuthstatus);
|
|
|
|
|
+ SuperCooperatorResponseModel requestAPI = unionRequestService.requestCooperatorAPI
|
|
|
|
|
+ (url, requestParam, QueryWithdrawAuthstatusResponse.class);
|
|
|
|
|
+ if (requestAPI.isFailed()) {
|
|
|
|
|
+ return ResultContent.buildFail(requestAPI.getMsg());
|
|
|
|
|
+ }
|
|
|
|
|
+ QueryWithdrawAuthstatusResponse response = (QueryWithdrawAuthstatusResponse) requestAPI;
|
|
|
|
|
+ return ResultContent.buildSuccess();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 收钱吧-平台方通知开通D+0提现
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param param
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ public ResultContent openWithdraw(CooperatorParam param) {
|
|
|
|
|
+ OpenWithdrawParam requestParam = new OpenWithdrawParam();
|
|
|
|
|
+ String url = payApiConfig.getUrl(UnionFrictionlessPayApiConfig.openWithdraw);
|
|
|
|
|
+ SuperCooperatorResponseModel requestAPI = unionRequestService.requestCooperatorAPI
|
|
|
|
|
+ (url, requestParam, OpenWithdrawResponse.class);
|
|
|
|
|
+ if (requestAPI.isFailed()) {
|
|
|
|
|
+ return ResultContent.buildFail(requestAPI.getMsg());
|
|
|
|
|
+ }
|
|
|
|
|
+ OpenWithdrawResponse response = (OpenWithdrawResponse) requestAPI;
|
|
|
|
|
+
|
|
|
|
|
+ return ResultContent.buildSuccess();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 得到商户的 银联 商户号
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param shopOid
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ public String getMchntNo(String shopOid) {
|
|
|
|
|
+ return "898460107800191";
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 提现结果回调
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param request
|
|
|
|
|
+ * @param sysOrderId
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ @SneakyThrows
|
|
|
|
|
+ public ResultContent withDrawNotify(HttpServletRequest request, String sysOrderId) {
|
|
|
|
|
+ ServletInputStream inputStream = request.getInputStream();
|
|
|
|
|
+ StringBuffer stringBuffer = new StringBuffer();
|
|
|
|
|
+ BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
|
|
|
|
|
+ String s;
|
|
|
|
|
+ //读取回调请求体
|
|
|
|
|
+ while ((s = bufferedReader.readLine()) != null) {
|
|
|
|
|
+ stringBuffer.append(s);
|
|
|
|
|
+ }
|
|
|
|
|
+ String body = stringBuffer.toString();
|
|
|
|
|
+ log.info("body: {}", body);
|
|
|
|
|
+// PayNotifyResponse notifyResponse = jsonHelper.toObject(body, PayNotifyResponse.class);
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ Map<String, String> header = new HashMap<>();
|
|
|
|
|
+ log.info("stringBuffer: {}", stringBuffer.toString());
|
|
|
|
|
+ Enumeration<String> exception = request.getHeaderNames();
|
|
|
|
|
+ while (exception.hasMoreElements()) {
|
|
|
|
|
+ String key = exception.nextElement();
|
|
|
|
|
+ String value = request.getHeader(key);
|
|
|
|
|
+ log.info("key: {}, value: {}", key, value);
|
|
|
|
|
+ header.put(key, value);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ String authorization = request.getHeader("X-Authorization");
|
|
|
|
|
+ log.info("authorization: {}", authorization);
|
|
|
|
|
+ Map<String, String[]> map = request.getParameterMap();
|
|
|
|
|
+ Map<String, String> paramMap = new LinkedHashMap<>();
|
|
|
|
|
+ map.forEach((String key, String[] values) -> {
|
|
|
|
|
+ log.info("key: {}, values: {}", key, values);
|
|
|
|
|
+ paramMap.put(key, values[0]);
|
|
|
|
|
+ });
|
|
|
|
|
+ JSONObject jsonObject = new JSONObject(paramMap);
|
|
|
|
|
+ QueryOrderStatusResponse orderStatusResponse = JSONUtil.toBean(jsonObject, QueryOrderStatusResponse.class);
|
|
|
|
|
+
|
|
|
|
|
+ return ResultContent.buildSuccess();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //------------------------提现 end-- ------------------------
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 查询签约的信息
|
|
* 查询签约的信息
|
|
|
*
|
|
*
|