Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

存在多个租户配置的时候,调用某些接口的时候会报 平台证书序列号Wechatpay-Serial错误 #49

Closed
sunt89 opened this issue Sep 7, 2021 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@sunt89
Copy link

sunt89 commented Sep 7, 2021

image
如图,会存在多个租户配置
调用添加分账接收者及调用分账接口的时候会返回以下错误 {"code":"PARAM_ERROR","message":"平台证书序列号Wechatpay-Serial错误"}

临时去除掉其中一个租户配置,再次调用接口的时候能够正常执行。

@NotFound403
Copy link
Collaborator

需要更详细的调试信息,尽量不要在issues中使用截图

@sunt89
Copy link
Author

sunt89 commented Sep 8, 2021

需要更详细的调试信息,尽量不要在issues中使用截图

public X509WechatCertificateInfo getCertificate() { for (String serial : CERTIFICATE_MAP.keySet()) { X509Certificate x509Cert = (X509Certificate) CERTIFICATE_MAP.get(serial); try { x509Cert.checkValidity(); X509WechatCertificateInfo x509WechatCertificateInfo = new X509WechatCertificateInfo(); x509WechatCertificateInfo.setWechatPaySerial(serial); x509WechatCertificateInfo.setX509Certificate(x509Cert); return x509WechatCertificateInfo; } catch (Exception e) { log.warn("the wechat certificate is invalid , {}", e.getMessage()); // Async? wechatMetaContainer.getTenantIds().forEach(this::refreshCertificate); } } throw new PayException("failed to obtain wechat pay x509Certificate "); }

问题原因可能出在这个地方,刷新平台证书的时候是每个tenantId 都进行刷新,但是存的时候是 存的 serial , certificate 的map,实际在取 平台证书的时候,没有根据tenantId进行获取。

@NotFound403
Copy link
Collaborator

证书序列号一般认为是唯一的,目前根据租户特征增加了一个检索项,参考 1.0.12快照分支(将来是正式1.0.12分支)中的SignatureProvider重构部分

@NotFound403 NotFound403 added the comppatibility there is a comppatibility label Sep 8, 2021
@NotFound403 NotFound403 self-assigned this Sep 8, 2021
@sunt89
Copy link
Author

sunt89 commented Sep 8, 2021

证书序列号一般认为是唯一的,目前根据租户特征增加了一个检索项,参考 1.0.12快照分支(将来是正式1.0.12分支)中的SignatureProvider重构部分

好的 谢谢,我这边打包测试了下1.0.12的代码。还是会存在问题
在refreshCertificate中少了两行代码,没有设置serialNo和tenantId
x509WechatCertificateInfo.setWechatPaySerial(responseSerialNo);
x509WechatCertificateInfo.setTenantId(tenantId);

@NotFound403
Copy link
Collaborator

证书序列号一般认为是唯一的,目前根据租户特征增加了一个检索项,参考 1.0.12快照分支(将来是正式1.0.12分支)中的SignatureProvider重构部分

好的 谢谢,我这边打包测试了下1.0.12的代码。还是会存在问题
在refreshCertificate中少了两行代码,没有设置serialNo和tenantId
x509WechatCertificateInfo.setWechatPaySerial(responseSerialNo);
x509WechatCertificateInfo.setTenantId(tenantId);

已经修正

@ty1314925
Copy link

1.0.12版本什么时候可以发布,有遇到相同问题

@NotFound403 NotFound403 added bug Something isn't working and removed comppatibility there is a comppatibility labels Mar 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants