Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,10 @@
**Spring Boot 配置示例:**

```properties
# 使用 HttpClient 5.x(推荐,MP/CP/Channel/QiDian 模块默认)
# 使用 HttpClient 5.x(推荐,MP/MiniApp/CP/Channel/QiDian 模块默认)
wx.mp.config-storage.http-client-type=HttpComponents

# 使用 HttpClient 4.x(兼容模式,MiniApp 模块默认
# 使用 HttpClient 4.x(兼容模式)
wx.mp.config-storage.http-client-type=HttpClient

# 使用 OkHttp
Expand All @@ -153,11 +153,10 @@ wx.mp.config-storage.http-client-type=HTTP_COMPONENTS # 注意使用大写下
```

**注意事项:**
1. **MiniApp 模块**已提供 `HttpComponents`(HttpClient 5.x)类型的配置选项,但当前默认仍为 HttpClient 4.x;如需启用 HttpClient 5.x,请确保所使用的集成模块(如 `wx-java-miniapp-spring-boot-starter`、`wx-java-miniapp-solon-plugin`)版本已支持该选项
2. **MP、Channel、QiDian 模块**已完整支持 HttpClient 5.x,默认推荐使用
3. **CP 模块**的支持情况取决于具体使用的 Starter 版本,请参考对应模块文档
4. 如需使用 OkHttp 或 Jodd-http,需在项目中添加对应的依赖(scope为provided)
5. HttpClient 4.x 和 HttpClient 5.x 可以共存,按需配置即可
1. **MP、MiniApp、Channel、QiDian 模块**已完整支持 HttpClient 5.x,默认推荐使用
2. **CP 模块**的支持情况取决于具体使用的 Starter 版本,请参考对应模块文档
3. 如需使用 OkHttp 或 Jodd-http,需在项目中添加对应的依赖(scope为provided)
4. HttpClient 4.x 和 HttpClient 5.x 可以共存,按需配置即可


---------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public WxPayService wxPayService() {
payConfig.setKeyPath(StringUtils.trimToNull(this.properties.getKeyPath()));
payConfig.setUseSandboxEnv(this.properties.isUseSandboxEnv());
payConfig.setNotifyUrl(StringUtils.trimToNull(this.properties.getNotifyUrl()));
payConfig.setRefundNotifyUrl(StringUtils.trimToNull(this.properties.getRefundNotifyUrl()));
//以下是apiv3以及支付分相关
payConfig.setServiceId(StringUtils.trimToNull(this.properties.getServiceId()));
payConfig.setPayScoreNotifyUrl(StringUtils.trimToNull(this.properties.getPayScoreNotifyUrl()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ public class WxPayProperties {
*/
private String notifyUrl;

/**
* 退款结果异步回调地址,通知url必须为直接可访问的url,不能携带参数.
*/
private String refundNotifyUrl;

/**
* 微信支付分授权回调地址
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public WxPayService wxPayService() {
payConfig.setKeyPath(StringUtils.trimToNull(this.properties.getKeyPath()));
payConfig.setUseSandboxEnv(this.properties.isUseSandboxEnv());
payConfig.setNotifyUrl(StringUtils.trimToNull(this.properties.getNotifyUrl()));
payConfig.setRefundNotifyUrl(StringUtils.trimToNull(this.properties.getRefundNotifyUrl()));
//以下是apiv3以及支付分相关
payConfig.setServiceId(StringUtils.trimToNull(this.properties.getServiceId()));
payConfig.setPayScoreNotifyUrl(StringUtils.trimToNull(this.properties.getPayScoreNotifyUrl()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ public class WxPayProperties {
*/
private String notifyUrl;

/**
* 退款结果异步回调地址,通知url必须为直接可访问的url,不能携带参数
*/
private String refundNotifyUrl;

/**
* 微信支付分回调地址
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,9 @@ public void checkAndSign(WxPayConfig config) throws WxPayException {
if (StringUtils.isBlank(this.getOpUserId())) {
this.setOpUserId(config.getMchId());
}

if (StringUtils.isBlank(this.getNotifyUrl())) {
this.setNotifyUrl(config.getRefundNotifyUrl());
}
super.checkAndSign(config);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,13 @@ public class WxPayConfig {
*/
private String subMchId;
/**
* 微信支付异步回掉地址,通知url必须为直接可访问的url,不能携带参数.
* 微信支付异步回调地址,通知url必须为直接可访问的url,不能携带参数.
*/
private String notifyUrl;
/**
* 退款结果异步回调地址,通知url必须为直接可访问的url,不能携带参数.
*/
private String refundNotifyUrl;
/**
* 交易类型.
* <pre>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,13 +263,19 @@ public WxPayRefundResult refundV2(WxPayRefundRequest request) throws WxPayExcept

@Override
public WxPayRefundV3Result refundV3(WxPayRefundV3Request request) throws WxPayException {
if (StringUtils.isBlank(request.getNotifyUrl())) {
request.setNotifyUrl(this.getConfig().getRefundNotifyUrl());
}
String url = String.format("%s/v3/refund/domestic/refunds", this.getPayBaseUrl());
String response = this.postV3WithWechatpaySerial(url, GSON.toJson(request));
return GSON.fromJson(response, WxPayRefundV3Result.class);
}

@Override
public WxPayRefundV3Result partnerRefundV3(WxPayPartnerRefundV3Request request) throws WxPayException {
if (StringUtils.isBlank(request.getNotifyUrl())) {
request.setNotifyUrl(this.getConfig().getRefundNotifyUrl());
}
if (StringUtils.isBlank(request.getSubMchid())) {
request.setSubMchid(this.getConfig().getSubMchId());
}
Expand Down