🆕【微信支付】新增查询特约商户设置的允许服务商分账的最大比例的V3接口

This commit is contained in:
NotePlus 2022-12-11 07:48:34 +00:00 committed by binarywang
parent a3a8295262
commit b35645ee67
3 changed files with 53 additions and 2 deletions

View File

@ -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;
}

View File

@ -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 {
/**
* <pre>
* 查询最大分账比例
*
* 可调用此接口查询特约商户设置的允许服务商分账的最大比例
* 文档详见: 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}
* </pre>
*
* @param subMchId 子商户号微信支付分配的子商户号即分账的出资商户号
* @return {@link ProfitSharingMerchantMaxRatioQueryResult} 特约商户设置的允许服务商分账的最大比例结果
* @throws WxPayException the wx pay exception
* @see <a href="https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter8_1_7.shtml">服务商平台>>API字典>>资金应用>>分账>>查询最大分账比例</a>
* @since 4.4.0
* @date 2022-12-09
*/
ProfitSharingMerchantMaxRatioQueryResult getProfitSharingMerchantMaxRatio(String subMchId) throws WxPayException;
/**
* <pre>
* 请求分账API

View File

@ -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());