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

商户证书序列号获取不到 #189

Closed
ssdai123 opened this issue Jun 25, 2023 · 1 comment · Fixed by #194
Closed

商户证书序列号获取不到 #189

ssdai123 opened this issue Jun 25, 2023 · 1 comment · Fixed by #194
Labels
documentation Improvements or additions to documentation

Comments

@ssdai123
Copy link

错误描述

我是在商户平台下载证书了,也生成了证书,但是我没有拿到 商户证书序列号,按你们SDK文档描述,感觉代码上也有错误。
具体原因如下:

    Config config =
            new RSAAutoCertificateConfig.Builder()
                    .merchantId(merchantId)
                    .privateKeyFromPath(privateKeyPath)
                    .merchantSerialNumber(merchantSerialNumber)
                    .apiV3Key(apiV3key)
                    .build();

PrivacyEncryptor encryptor = config.createEncryptor();
String wechatPayCertificateSerialNumber = encryptor.getWechatpaySerial();

config 对象在初始化时候需要使用这个商户证书序列号,但是我拿不到,而你们提供的代码,获取又是从config里面获取。config 可能都会初始化失败。又何谈获取数据? 另外你们文档 PrivacyEncryptor 这个返回值的类型写的是 PrivateEncryptor ,而实际上根本就没提供这个类。

重现bug的步骤

Config config =
new RSAAutoCertificateConfig.Builder()
.merchantId(merchantId)
.privateKeyFromPath(privateKeyPath)
.merchantSerialNumber(merchantSerialNumber)
.apiV3Key(apiV3key)
.build();
PrivacyEncryptor encryptor = config.createEncryptor();
String wechatPayCertificateSerialNumber = encryptor.getWechatpaySerial();

预期行为

理论上这里获取 商户证书序列号 不应该从config 获取,而且获取 商户证书序列号 应该是在 定义config对象之前。

导致错误的代码片段

No response

操作系统

win10

Java 版本

java8

wechatpay-java 版本

com.github.wechatpay-apiv3 wechatpay-java 0.2.9

其他信息

com.github.wechatpay-apiv3 wechatpay-java 0.2.9
@ssdai123 ssdai123 added the bug Something isn't working label Jun 25, 2023
@xy-peng
Copy link
Contributor

xy-peng commented Jun 26, 2023

  1. 你混淆了商户证书和微信支付平台证书。两者的解释先请看微信支付文档中心的 证书和私钥
  2. 如何获取商户证书序列号,请看 如何查看证书序列号?
  3. 【 PrivacyEncryptor 这个返回值的类型写的是 PrivateEncryptor】这里文档确实写错了,我改正下。

@xy-peng xy-peng added documentation Improvements or additions to documentation and removed bug Something isn't working labels Jun 26, 2023
@xy-peng xy-peng linked a pull request Jul 11, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants