diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/profitsharingV3/ProfitSharingMerchantMaxRatioQueryResult.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/profitsharingV3/ProfitSharingMerchantMaxRatioQueryResult.java new file mode 100644 index 0000000000000000000000000000000000000000..ec5ed92d51f9d035411f88b1d1a7fc8674633064 --- /dev/null +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/profitsharingV3/ProfitSharingMerchantMaxRatioQueryResult.java @@ -0,0 +1,27 @@ +package com.github.binarywang.wxpay.bean.profitsharingV3; + +import java.io.Serializable; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; + +/** + * 微信V3接口-查询特约商户设置的允许服务商分账的最大比例结果类 + * + * @author 狂龙骄子 + * @since 4.4.0 + * @date 2022-12-09 + */ +@Data +public class ProfitSharingMerchantMaxRatioQueryResult implements Serializable { + private static final long serialVersionUID = -6259241881199571683L; + + /** 子商户号 */ + @SerializedName("sub_mchid") + private String subMchId; + + /** 子商户允许服务商分账的最大比例,单位万分比,比如 2000表示20% */ + @SerializedName("max_ratio") + private Integer maxRatio; + +} diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/ProfitSharingV3Service.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/ProfitSharingV3Service.java index 7150d6f30773e1ff83399e827e29352495a6df8b..c884ba602d17e067f44f29ff42e3996689e732fe 100644 --- a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/ProfitSharingV3Service.java +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/ProfitSharingV3Service.java @@ -8,9 +8,27 @@ import com.github.binarywang.wxpay.exception.WxPayException; * 微信支付V3-资金应用-分账 * * @author pg 2021-6-23 - * created on 2021-6-23 + * @date 2021-6-23 */ public interface ProfitSharingV3Service { + /** + *
+   * 查询最大分账比例
+   *
+   * 可调用此接口查询特约商户设置的允许服务商分账的最大比例
+   * 文档详见: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter8_1_7.shtml
+   * 接口链接: https://api.mch.weixin.qq.com/v3/profitsharing/merchant-configs/{sub_mchid}
+   * 
+ * + * @param subMchId 子商户号(微信支付分配的子商户号,即分账的出资商户号) + * @return {@link ProfitSharingMerchantMaxRatioQueryResult} 特约商户设置的允许服务商分账的最大比例结果 + * @throws WxPayException the wx pay exception + * @see 服务商平台>>API字典>>资金应用>>分账>>查询最大分账比例 + * @since 4.4.0 + * @date 2022-12-09 + */ + ProfitSharingMerchantMaxRatioQueryResult getProfitSharingMerchantMaxRatio(String subMchId) throws WxPayException; + /** *
    * 请求分账API
diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/ProfitSharingV3ServiceImpl.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/ProfitSharingV3ServiceImpl.java
index 92d724177f2d5e5f17aa1d042753d43e3190a7cb..d43facd24c5cc8583a98b9f98755a94afd8b3634 100644
--- a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/ProfitSharingV3ServiceImpl.java
+++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/ProfitSharingV3ServiceImpl.java
@@ -2,7 +2,6 @@ package com.github.binarywang.wxpay.service.impl;
 
 import com.github.binarywang.wxpay.bean.ecommerce.SignatureHeader;
 import com.github.binarywang.wxpay.bean.profitsharingV3.*;
-import com.github.binarywang.wxpay.config.WxPayConfig;
 import com.github.binarywang.wxpay.exception.WxPayException;
 import com.github.binarywang.wxpay.service.ProfitSharingV3Service;
 import com.github.binarywang.wxpay.service.WxPayService;
@@ -31,6 +30,13 @@ public class ProfitSharingV3ServiceImpl implements ProfitSharingV3Service {
   private static final Gson GSON = new GsonBuilder().create();
   private final WxPayService payService;
 
+  @Override
+  public ProfitSharingMerchantMaxRatioQueryResult getProfitSharingMerchantMaxRatio(String subMchId) throws WxPayException {
+    String url = String.format("%s/v3/profitsharing/merchant-configs/%s", this.payService.getPayBaseUrl(), subMchId);
+    String result = this.payService.getV3(url);
+    return GSON.fromJson(result, ProfitSharingMerchantMaxRatioQueryResult.class);
+  }
+
   @Override
   public ProfitSharingResult profitSharing(ProfitSharingRequest request) throws WxPayException {
     String url = String.format("%s/v3/profitsharing/orders", this.payService.getPayBaseUrl());