微信apiV2方式 支持证书配置项;

This commit is contained in:
terrfly 2021-08-12 15:28:38 +08:00
parent d062225965
commit dae2d4a63c
1 changed files with 6 additions and 0 deletions

View File

@ -46,6 +46,7 @@ import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl;
import me.chanjar.weixin.mp.config.impl.WxMpDefaultConfigImpl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -378,6 +379,11 @@ public class ConfigContextService {
if (CS.PAY_IF_VERSION.WX_V2.equals(apiVersion)) { // 微信API V2
wxPayConfig.setSignType(WxPayConstants.SignType.MD5);
// api证书
if(StringUtils.isNotBlank(cert)){
wxPayConfig.setKeyPath(channelCertConfigKitBean.getCertFilePath(cert));
}
} else if (CS.PAY_IF_VERSION.WX_V3.equals(apiVersion)) { // 微信API V3
wxPayConfig.setApiV3Key(apiV3Key);
wxPayConfig.setCertSerialNo(serialNo);