单个实例下,构造支付config和notificationConfig 报错"The corresponding provider for the merchant already exists."
Closed this issue · 1 comments
egosodv commented
错误描述
应当考虑sdk使用者存在单实例运行,没有将下单和回调分成多个服务的情况
重现bug的步骤
在一个服务中,同时构造支付config和回调通知config抛出异常
预期行为
对notificationconfig和config分别处理,不抛出异常
导致错误的代码片段
protected AbstractAutoCertificateProvider(
String requestUrl,
CertificateHandler certificateHandler,
AeadCipher aeadCipher,
HttpClient httpClient,
String merchantId,
Map<String, Map<String, X509Certificate>> wechatPayCertificateMap,
int updateInterval) {
this.merchantId = merchantId;
synchronized (AbstractAutoCertificateProvider.class) {
if (!wechatPayCertificateMap.containsKey(merchantId)) {
wechatPayCertificateMap.put(merchantId, new HashMap<>());
} else {
throw new IllegalStateException(
"The corresponding provider for the merchant already exists.");
}
}
操作系统
Windows 10
Java 版本
Java 8
wechatpay-java 版本
v0.2.7
其他信息
No response