refactor(mcwl-pay): 优化支付宝证书路径加载方式
parent
4c90ed1bb8
commit
f458e9e3cb
|
@ -564,6 +564,11 @@ public class AliPayServiceImpl implements AliPayService {
|
|||
|
||||
public AlipayConfig getAlipayConfig() throws FileNotFoundException {
|
||||
|
||||
// 使用 ClassPathResource 获取资源
|
||||
ClassPathResource appCertResource = new ClassPathResource(aliConfig.getAppCertPath());
|
||||
ClassPathResource alipayCertResource = new ClassPathResource(aliConfig.getAlipayCertPath());
|
||||
ClassPathResource rootCertResource = new ClassPathResource(aliConfig.getAlipayRootCertPath());
|
||||
|
||||
AlipayConfig config = new AlipayConfig();
|
||||
|
||||
// 设置网关地址
|
||||
|
@ -581,13 +586,13 @@ public class AliPayServiceImpl implements AliPayService {
|
|||
// 设置应用公钥证书路径(线上)
|
||||
// config.setAppCertPath(getClass().getResource("/cert/appCertPublicKey.crt").getPath());
|
||||
// 设置应用公钥证书路径(沙箱)
|
||||
config.setAppCertPath(ResourceUtils.getFile("classpath:" + aliConfig.getAppCertPath()).getAbsolutePath());
|
||||
config.setAppCertPath(appCertResource.getAbsolutePath());
|
||||
|
||||
// 设置支付宝公钥证书路径
|
||||
config.setAlipayPublicCertPath(ResourceUtils.getFile("classpath:" + aliConfig.getAlipayCertPath()).getAbsolutePath());
|
||||
config.setAlipayPublicCertPath(alipayCertResource.getAbsolutePath());
|
||||
|
||||
// 设置支付宝根证书路径
|
||||
config.setRootCertPath(ResourceUtils.getFile("classpath:" + aliConfig.getAlipayRootCertPath()).getAbsolutePath());
|
||||
config.setRootCertPath(rootCertResource.getAbsolutePath());
|
||||
|
||||
// 设置字符编码格式
|
||||
config.setCharset("UTF-8");
|
||||
|
|
Loading…
Reference in New Issue