mirror of
https://github.com/dromara/payment-spring-boot.git
synced 2026-03-13 21:33:41 +08:00
📝 修改文档
This commit is contained in:
25
README.md
25
README.md
@@ -45,7 +45,7 @@ Starter,支持微信优惠券,代金券、商家券、智慧商圈、商家
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cn.felord</groupId>
|
<groupId>cn.felord</groupId>
|
||||||
<artifactId>payment-spring-boot-starter</artifactId>
|
<artifactId>payment-spring-boot-starter</artifactId>
|
||||||
<version>1.0.20.RELEASE</version>
|
<version>1.0.21.RELEASE</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -73,6 +73,29 @@ Starter,支持微信优惠券,代金券、商家券、智慧商圈、商家
|
|||||||
~~关于集成配置请详细阅读[payment-spring-boot GitHub文档](https://dromara.github.io/payment-spring-boot)
|
~~关于集成配置请详细阅读[payment-spring-boot GitHub文档](https://dromara.github.io/payment-spring-boot)
|
||||||
中[快速接入](https://dromara.github.io/payment-spring-boot/#/quick_start)章节 (暂时不可用)~~
|
中[快速接入](https://dromara.github.io/payment-spring-boot/#/quick_start)章节 (暂时不可用)~~
|
||||||
|
|
||||||
|
[关于微信支付公钥](https://pay.weixin.qq.com/doc/v3/merchant/4012153196)
|
||||||
|
微信官方推出了微信支付公钥产品以替代原来的微信平台证书,我们对此进行了适配
|
||||||
|
相关配置如下
|
||||||
|
```yaml
|
||||||
|
wechat:
|
||||||
|
pay:
|
||||||
|
v3:
|
||||||
|
# 租户id
|
||||||
|
<tentantId>:
|
||||||
|
# 是否使用微信支付公钥验签 默认false
|
||||||
|
enable-wechat-pay-public: true
|
||||||
|
# 微信支付公钥id
|
||||||
|
wechat-pay-public-key-id: PUB_KEY_ID_1111213
|
||||||
|
# 微信支付公钥路径
|
||||||
|
wechat-pay-public-key-path: 'pub_key.pem'
|
||||||
|
|
||||||
|
wechat-pay-public-key-absolute-path: ''
|
||||||
|
# 是否启用签名验签方法切换 默认false
|
||||||
|
switch-verify-sign-method: true
|
||||||
|
```
|
||||||
|
- 对于旧版本商户,若不使用微信支付公钥,则不需要配置上述对应参数,则默认使用微信平台证书验签。
|
||||||
|
- 对于新进件的商户,微信官方默认启用支付公钥,需要配置上述参数。其中 `switch-verify-sign-method` 参数不需要配置
|
||||||
|
- 若旧版版商户使用微信支付公钥,则需要配置上述参数,并启用 `switch-verify-sign-method : true` [原理参考](https://pay.weixin.qq.com/doc/v3/merchant/4012154180)。<font color=red>当完成从平台证书切换到微信支付公钥后,请务必将`switch-verify-sign-method`参数设置为false 或删除该字段</font>
|
||||||
### 调用示例
|
### 调用示例
|
||||||
|
|
||||||
#### 开启支付
|
#### 开启支付
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cn.felord</groupId>
|
<groupId>cn.felord</groupId>
|
||||||
<artifactId>payment-spring-boot-starter</artifactId>
|
<artifactId>payment-spring-boot-starter</artifactId>
|
||||||
<version>1.0.20.RELEASE</version>
|
<version>1.0.21.RELEASE</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
```
|
```
|
||||||
## 采用技术
|
## 采用技术
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
```xml
|
```xml
|
||||||
<properties>
|
<properties>
|
||||||
<!-- 修改为你对应的Spring Boot版本号 -->
|
<!-- 修改为你对应的Spring Boot版本号 -->
|
||||||
<spring-boot.version>2.4.0</spring-boot.version>
|
<spring-boot.version>2.7.18</spring-boot.version>
|
||||||
</properties>
|
</properties>
|
||||||
```
|
```
|
||||||
然后安装使用
|
然后安装使用
|
||||||
|
|||||||
@@ -256,7 +256,7 @@ public class SignatureProvider {
|
|||||||
private synchronized void refreshCertificate(String tenantId) {
|
private synchronized void refreshCertificate(String tenantId) {
|
||||||
|
|
||||||
WechatMetaBean wechatMetaBean = wechatMetaContainer.getWechatMeta(tenantId);
|
WechatMetaBean wechatMetaBean = wechatMetaContainer.getWechatMeta(tenantId);
|
||||||
if (wechatMetaBean.getV3().getEnableWechatPayPublic() && wechatMetaBean.getV3().getSwitchVerifySignMethod()){
|
if (wechatMetaBean.getV3().getEnableWechatPayPublic() && !wechatMetaBean.getV3().getSwitchVerifySignMethod()){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String url = WechatPayV3Type.CERT.uri(WeChatServer.CHINA);
|
String url = WechatPayV3Type.CERT.uri(WeChatServer.CHINA);
|
||||||
@@ -485,11 +485,8 @@ public class SignatureProvider {
|
|||||||
|
|
||||||
public boolean isSwitchVerifySignMethod(String tenantId) {
|
public boolean isSwitchVerifySignMethod(String tenantId) {
|
||||||
|
|
||||||
String publicKeyId=wechatMetaContainer.getWechatMeta(tenantId).getV3().getWechatPayPublicKeyId();
|
return wechatMetaContainer.getWechatMeta(tenantId).getV3().getSwitchVerifySignMethod()
|
||||||
|
&& wechatMetaContainer.getWechatMeta(tenantId).getV3().getEnableWechatPayPublic();
|
||||||
Boolean switchVerifySignMethod = wechatMetaContainer.getWechatMeta(tenantId).getV3().getSwitchVerifySignMethod();
|
|
||||||
|
|
||||||
return switchVerifySignMethod && StringUtils.hasLength(publicKeyId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getWechatPublicKeyId(String tenantId) {
|
public String getWechatPublicKeyId(String tenantId) {
|
||||||
|
|||||||
Reference in New Issue
Block a user