Skip to content

Commit b35645e

Browse files
NotePlusbinarywang
NotePlus
authored and
binarywang
committed
🆕【微信支付】新增查询特约商户设置的允许服务商分账的最大比例的V3接口
1 parent a3a8295 commit b35645e

File tree

3 files changed

+53
-2
lines changed

3 files changed

+53
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package com.github.binarywang.wxpay.bean.profitsharingV3;
2+
3+
import java.io.Serializable;
4+
5+
import com.google.gson.annotations.SerializedName;
6+
import lombok.Data;
7+
8+
/**
9+
* 微信V3接口-查询特约商户设置的允许服务商分账的最大比例结果类
10+
*
11+
* @author 狂龙骄子
12+
* @since 4.4.0
13+
* @date 2022-12-09
14+
*/
15+
@Data
16+
public class ProfitSharingMerchantMaxRatioQueryResult implements Serializable {
17+
private static final long serialVersionUID = -6259241881199571683L;
18+
19+
/** 子商户号 */
20+
@SerializedName("sub_mchid")
21+
private String subMchId;
22+
23+
/** 子商户允许服务商分账的最大比例,单位万分比,比如 2000表示20% */
24+
@SerializedName("max_ratio")
25+
private Integer maxRatio;
26+
27+
}

Diff for: weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/ProfitSharingV3Service.java

+19-1
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,27 @@
88
* 微信支付V3-资金应用-分账
99
*
1010
* @author pg 2021-6-23
11-
* created on 2021-6-23
11+
* @date 2021-6-23
1212
*/
1313
public interface ProfitSharingV3Service {
14+
/**
15+
* <pre>
16+
* 查询最大分账比例
17+
*
18+
* 可调用此接口查询特约商户设置的允许服务商分账的最大比例
19+
* 文档详见: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter8_1_7.shtml
20+
* 接口链接: https://api.mch.weixin.qq.com/v3/profitsharing/merchant-configs/{sub_mchid}
21+
* </pre>
22+
*
23+
* @param subMchId 子商户号(微信支付分配的子商户号,即分账的出资商户号)
24+
* @return {@link ProfitSharingMerchantMaxRatioQueryResult} 特约商户设置的允许服务商分账的最大比例结果
25+
* @throws WxPayException the wx pay exception
26+
* @see <a href="https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter8_1_7.shtml">服务商平台>>API字典>>资金应用>>分账>>查询最大分账比例</a>
27+
* @since 4.4.0
28+
* @date 2022-12-09
29+
*/
30+
ProfitSharingMerchantMaxRatioQueryResult getProfitSharingMerchantMaxRatio(String subMchId) throws WxPayException;
31+
1432
/**
1533
* <pre>
1634
* 请求分账API

Diff for: weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/ProfitSharingV3ServiceImpl.java

+7-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import com.github.binarywang.wxpay.bean.ecommerce.SignatureHeader;
44
import com.github.binarywang.wxpay.bean.profitsharingV3.*;
5-
import com.github.binarywang.wxpay.config.WxPayConfig;
65
import com.github.binarywang.wxpay.exception.WxPayException;
76
import com.github.binarywang.wxpay.service.ProfitSharingV3Service;
87
import com.github.binarywang.wxpay.service.WxPayService;
@@ -31,6 +30,13 @@ public class ProfitSharingV3ServiceImpl implements ProfitSharingV3Service {
3130
private static final Gson GSON = new GsonBuilder().create();
3231
private final WxPayService payService;
3332

33+
@Override
34+
public ProfitSharingMerchantMaxRatioQueryResult getProfitSharingMerchantMaxRatio(String subMchId) throws WxPayException {
35+
String url = String.format("%s/v3/profitsharing/merchant-configs/%s", this.payService.getPayBaseUrl(), subMchId);
36+
String result = this.payService.getV3(url);
37+
return GSON.fromJson(result, ProfitSharingMerchantMaxRatioQueryResult.class);
38+
}
39+
3440
@Override
3541
public ProfitSharingResult profitSharing(ProfitSharingRequest request) throws WxPayException {
3642
String url = String.format("%s/v3/profitsharing/orders", this.payService.getPayBaseUrl());

0 commit comments

Comments
 (0)