大家好,我是小悟
电商收付通,需要拥有开通了合作工具箱的微信支付服务商的相关参数才可以使用,涉及的参数有:
服务商平台商户号
服务商平台商户号绑定的appId
微信支付平台apiV3密钥
服务商平台商户API证书序列号
服务商平台商户API证书
微信支付平台证书序列号
微信支付平台证书
前面几个参数可以从微信商户后台直接获取,但平台证书序列号和微信支付平台证书需要前几个参数调用接口从微信获取。在后台,可以新增多个服务商信息,省的替换参数了。
public AjaxResult wechatPlatCert(WxServiceInfo wxServiceInfo) {
String mchId = wxServiceInfo.getMchId();
String mchSerialNo = wxServiceInfo.getMchSerialNo();
String mchPrivateKeyPath = wxServiceInfo.getMchPrivateKeyPath();
String wechatApiV3 = wxServiceInfo.getWechatApiV3();
String wechatPlatCertSavePath = wxServiceInfo.getWechatPlatCertSavePath();
CertificateResult certResult = Certificate.getCertByAPI(mchId, 5, mchSerialNo, mchPrivateKeyPath, wechatApiV3, wechatPlatCertSavePath);
String wechatSerialNo = certResult.getWechatSerialNo();
String wechatPubKeyPath = certResult.getWechatPubKeyPath();
if (StringUtils.isBlank(wechatSerialNo)) {
return AjaxResult.error("证书生成失败");
}
return AjaxResult.success(certResult);
}
当把服务商信息新增好后,在给二级商户进件时,就可以通过选择服务商的形式,来告诉系统当前应该获取选中的服务商参数信息来调用接口进行进件。后续的操作比如合单支付、分账、提现、退款等和支付有关的很清楚如何操作了。
@GetMapping("/serviceList")
public AjaxResult serviceList() {
List<WxServiceInfo> list = wxServiceInfoService.list();
List<Object> newList = new ArrayList<>(list.size());
if (CollectionUtils.isNotEmpty(list)) {
newList = list.stream().map(item -> {
Map<String, Object> map = new HashMap<>(3);
map.put("value", item.getServiceId());
String label = item.getAppName() + "-" + item.getMchId();
if (StringUtils.equals("1", item.getDelFlag())) {
label = item.getAppName() + "-" + item.getMchId() + "-已删除";
}
map.put("label", label);
return map;
}).collect(Collectors.toList());
}
return AjaxResult.success(newList);
}
如果手动添加分账接收方,也需要选中服务商信息。
收付通在手,生意你有。
公众号【悟空码字】后台回复【收付通多服务商】获取账号密码。
您的一键三连,是我更新的最大动力,谢谢
山水有相逢,来日皆可期,谢谢阅读,我们再会
我手中的金箍棒,上能通天,下能探海