mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-05-02 11:48:54 +08:00
🆕【微信支付】增加查询结算账户、查询分账结果、查询分账回退结果和申请分账账单等V3接口
This commit is contained in:
parent
87c33ac776
commit
0d1320a48f
@ -11,6 +11,8 @@ import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 查询结算账户返回对象信息
|
||||
*
|
||||
* @see <a href="https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter11_1_4.shtml">查询结算账户</a>
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@ -51,4 +53,12 @@ public class SettlementInfoResult implements Serializable {
|
||||
*/
|
||||
@SerializedName("verify_result")
|
||||
private String verifyResult;
|
||||
/**
|
||||
* 汇款验证失败原因
|
||||
*
|
||||
* @since 4.4.0
|
||||
* @date 2022.12.09
|
||||
*/
|
||||
@SerializedName("verify_fail_reason")
|
||||
private String verifyFailReason;
|
||||
}
|
||||
|
@ -0,0 +1,55 @@
|
||||
package com.github.binarywang.wxpay.bean.profitsharingV3;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 微信V3接口-申请分账账单请求类
|
||||
*
|
||||
* @author 狂龙骄子
|
||||
* @since 4.4.0
|
||||
* @date 2022-12-09
|
||||
*/
|
||||
@Data
|
||||
@Builder(builderMethodName = "newBuilder")
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ProfitSharingBillRequest implements Serializable {
|
||||
private static final long serialVersionUID = 5200819754873844593L;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:子商户号
|
||||
* 是否必填:否
|
||||
* 描述:不填则默认返回服务商下的所有分账账单。如需下载某个子商户下的分账账单,则填指定的子商户号。
|
||||
* </pre>
|
||||
*/
|
||||
@SerializedName("sub_mchid")
|
||||
private String subMchId;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:账单日期
|
||||
* 是否必填:是
|
||||
* 描述:格式yyyy-MM-DD,仅支持三个月内的账单下载申请。
|
||||
* </pre>
|
||||
*/
|
||||
@SerializedName("bill_date")
|
||||
private String billDate;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:压缩类型
|
||||
* 是否必填:否
|
||||
* 描述:不填则默认是数据流。枚举值:GZIP:返回格式为.gzip的压缩包账单。
|
||||
* </pre>
|
||||
*/
|
||||
@SerializedName("tar_type")
|
||||
private String tarType;
|
||||
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
package com.github.binarywang.wxpay.bean.profitsharingV3;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 微信V3接口-申请分账账单结果类
|
||||
*
|
||||
* @author 狂龙骄子
|
||||
* @since 4.4.0
|
||||
* @date 2022-12-09
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
public class ProfitSharingBillResult implements Serializable {
|
||||
private static final long serialVersionUID = -704896948531566657L;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:账单下载地址
|
||||
* 变量名:download_url
|
||||
* 是否必填:是
|
||||
* 类型:string[1,2048]
|
||||
* 描述:
|
||||
* 供下一步请求账单文件的下载地址,该地址30s内有效。
|
||||
* 示例值:https://api.mch.weixin.qq.com/v3/bill/downloadurl?token=xxx
|
||||
* </pre>
|
||||
*/
|
||||
@SerializedName(value = "download_url")
|
||||
private String downloadUrl;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:哈希类型
|
||||
* 变量名:hash_type
|
||||
* 是否必填:是
|
||||
* 类型:string[1, 32]
|
||||
* 描述:
|
||||
* 原始账单(gzip需要解压缩)的摘要值,用于校验文件的完整性。
|
||||
* 示例值:SHA1
|
||||
* </pre>
|
||||
*/
|
||||
@SerializedName(value = "hash_type")
|
||||
private String hashType;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:哈希值
|
||||
* 变量名:hash_value
|
||||
* 是否必填:是
|
||||
* 类型:string[1,1024]
|
||||
* 描述:
|
||||
* 原始账单(gzip需要解压缩)的摘要值,用于校验文件的完整性。
|
||||
* 示例值:79bb0f45fc4c42234a918000b2668d689e2bde04
|
||||
* </pre>
|
||||
*/
|
||||
@SerializedName(value = "hash_value")
|
||||
private String hashValue;
|
||||
}
|
@ -51,7 +51,7 @@ public class WxPayOrderNotifyResultConverter extends AbstractReflectionConverter
|
||||
super.marshal(original, writer, context);
|
||||
WxPayOrderNotifyResult obj = (WxPayOrderNotifyResult) original;
|
||||
List<WxPayOrderNotifyCoupon> list = obj.getCouponList();
|
||||
if (list == null || list.size() == 0) {
|
||||
if (list == null || list.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
|
@ -49,8 +49,8 @@ public interface Applyment4SubService {
|
||||
ApplymentStateQueryResult queryApplyStatusByApplymentId(String applymentId) throws WxPayException;
|
||||
|
||||
/**
|
||||
* 通过申请单号查询申请状态
|
||||
* 文档详见: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/tool/applyment4sub/chapter3_4.shtml
|
||||
* 根据特约子商户ID查询结算账户
|
||||
* 文档详见: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter11_1_4.shtml
|
||||
* 接口链接:https://api.mch.weixin.qq.com/v3/apply4sub/sub_merchants/{sub_mchid}/settlement
|
||||
*
|
||||
* @param subMchid 本服务商进件、已签约的特约商户号。
|
||||
@ -61,7 +61,7 @@ public interface Applyment4SubService {
|
||||
|
||||
/**
|
||||
* 修改结算帐号
|
||||
* 文档详见: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/tool/applyment4sub/chapter3_3.shtml
|
||||
* 文档详见: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter11_1_3.shtml
|
||||
* 接口链接:https://api.mch.weixin.qq.com/v3/apply4sub/sub_merchants/{sub_mchid}/modify-settlement
|
||||
*
|
||||
* @param subMchid 特约商户号
|
||||
|
@ -51,7 +51,7 @@ public interface ProfitSharingV3Service {
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 查询分账结果API
|
||||
* 查询分账结果API(商户平台)
|
||||
*
|
||||
* 发起分账请求后,可调用此接口查询分账结果
|
||||
* 文档详见: https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter8_1_2.shtml
|
||||
@ -69,6 +69,27 @@ public interface ProfitSharingV3Service {
|
||||
*/
|
||||
ProfitSharingResult getProfitSharingResult(String outOrderNo, String transactionId) throws WxPayException;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 查询分账结果API(服务商平台)
|
||||
*
|
||||
* 发起分账请求后,可调用此接口查询分账结果
|
||||
* 文档详见: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter8_1_2.shtml
|
||||
* 接口链接:https://api.mch.weixin.qq.com/v3/profitsharing/orders/{out_order_no}
|
||||
*
|
||||
* 注意:
|
||||
* • 发起解冻剩余资金请求后,可调用此接口查询解冻剩余资金的结果
|
||||
* </pre>
|
||||
*
|
||||
* @param outOrderNo 商户系统内部的分账单号,在商户系统内部唯一,同一分账单号多次请求等同一次。只能是数字、大小写字母_-|*@ 。
|
||||
* @param transactionId 微信支付订单号
|
||||
* @param subMchId 微信支付分配的子商户号,即分账的出资商户号。
|
||||
* @return {@link ProfitSharingResult} 微信返回的分账结果
|
||||
* @throws WxPayException the wx pay exception
|
||||
* @see <a href="https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter8_1_2.shtml">微信文档</a>
|
||||
*/
|
||||
ProfitSharingResult getProfitSharingResult(String outOrderNo, String transactionId, String subMchId) throws WxPayException;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 请求分账回退API
|
||||
@ -94,7 +115,7 @@ public interface ProfitSharingV3Service {
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 查询分账回退结果API
|
||||
* 查询分账回退结果API(商户平台)
|
||||
*
|
||||
* 商户需要核实回退结果,可调用此接口查询回退结果
|
||||
* 文档详见: https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter8_1_4.shtml
|
||||
@ -112,6 +133,27 @@ public interface ProfitSharingV3Service {
|
||||
*/
|
||||
ProfitSharingReturnResult getProfitSharingReturnResult(String outOrderNo, String outReturnNo) throws WxPayException;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 查询分账回退结果API(服务商平台)
|
||||
*
|
||||
* 商户需要核实回退结果,可调用此接口查询回退结果
|
||||
* 文档详见: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter8_1_3.shtml
|
||||
* 接口链接:https://api.mch.weixin.qq.com/v3/profitsharing/return-orders/{out_return_no}
|
||||
*
|
||||
* 注意:
|
||||
* • 如果分账回退接口返回状态为处理中,可调用此接口查询回退结果
|
||||
* </pre>
|
||||
*
|
||||
* @param outOrderNo 原发起分账请求时使用的商户系统内部的分账单号
|
||||
* @param outReturnNo 调用回退接口提供的商户系统内部的回退单号
|
||||
* @param subMchId 微信支付分配的子商户号,即分账的回退方商户号。
|
||||
* @return {@link ProfitSharingReturnResult} 微信返回的分账回退结果
|
||||
* @throws WxPayException the wx pay exception
|
||||
* @see <a href="https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter8_1_3.shtml">微信文档</a>
|
||||
*/
|
||||
ProfitSharingReturnResult getProfitSharingReturnResult(String outOrderNo, String outReturnNo, String subMchId) throws WxPayException;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 解冻剩余资金API
|
||||
@ -198,4 +240,21 @@ public interface ProfitSharingV3Service {
|
||||
*/
|
||||
ProfitSharingNotifyData getProfitSharingNotifyData(String notifyData, SignatureHeader header) throws WxPayException;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 申请分账账单
|
||||
*
|
||||
* 微信支付按天提供分账账单文件,商户可以通过该接口获取账单文件的下载地址
|
||||
* 文档详见: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter8_1_11.shtml
|
||||
* 接口链接: https://api.mch.weixin.qq.com/v3/profitsharing/bills
|
||||
* </pre>
|
||||
*
|
||||
* @param request 申请分账账单请求实体({@link ProfitSharingBillRequest})
|
||||
* @return {@link ProfitSharingBillResult} 申请分账账单结果类
|
||||
* @throws WxPayException the wx pay exception
|
||||
* @see <a href="https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter8_1_11.shtml">服务商平台>>API字典>>资金应用>>分账>>申请分账账单API</a>
|
||||
* @since 4.4.0
|
||||
* @date 2022-12-09
|
||||
*/
|
||||
ProfitSharingBillResult getProfitSharingBill(ProfitSharingBillRequest request) throws WxPayException;
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
@ -52,6 +53,13 @@ public class ProfitSharingV3ServiceImpl implements ProfitSharingV3Service {
|
||||
return GSON.fromJson(result, ProfitSharingResult.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProfitSharingResult getProfitSharingResult(String outOrderNo, String transactionId, String subMchId) throws WxPayException {
|
||||
String url = String.format("%s/v3/profitsharing/orders/%s?sub_mchid=%s&transaction_id=%s", this.payService.getPayBaseUrl(), outOrderNo, subMchId, transactionId);
|
||||
String result = this.payService.getV3(url);
|
||||
return GSON.fromJson(result, ProfitSharingResult.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProfitSharingReturnResult profitSharingReturn(ProfitSharingReturnRequest request) throws WxPayException {
|
||||
String url = String.format("%s/v3/profitsharing/return-orders", this.payService.getPayBaseUrl());
|
||||
@ -67,6 +75,13 @@ public class ProfitSharingV3ServiceImpl implements ProfitSharingV3Service {
|
||||
return GSON.fromJson(result, ProfitSharingReturnResult.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProfitSharingReturnResult getProfitSharingReturnResult(String outOrderNo, String outReturnNo, String subMchId) throws WxPayException {
|
||||
String url = String.format("%s/v3/profitsharing/return-orders/%s?sub_mchid=%s&out_order_no=%s", this.payService.getPayBaseUrl(), outReturnNo, subMchId, outOrderNo);
|
||||
String result = this.payService.getV3(url);
|
||||
return GSON.fromJson(result, ProfitSharingReturnResult.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProfitSharingUnfreezeResult profitSharingUnfreeze(ProfitSharingUnfreezeRequest request) throws WxPayException {
|
||||
String url = String.format("%s/v3/profitsharing/orders/unfreeze", this.payService.getPayBaseUrl());
|
||||
@ -115,6 +130,19 @@ public class ProfitSharingV3ServiceImpl implements ProfitSharingV3Service {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProfitSharingBillResult getProfitSharingBill(ProfitSharingBillRequest request) throws WxPayException {
|
||||
String url = String.format("%s/v3/profitsharing/bills?bill_date=%s", this.payService.getPayBaseUrl(), request.getBillDate());
|
||||
if (StringUtils.isNotBlank(request.getSubMchId())) {
|
||||
url = String.format("%s&sub_mchid=%s", url, request.getSubMchId());
|
||||
}
|
||||
if (StringUtils.isNotBlank(request.getTarType())) {
|
||||
url = String.format("%s&tar_type=%s", url, request.getTarType());
|
||||
}
|
||||
String result = this.payService.getV3(url);
|
||||
return GSON.fromJson(result, ProfitSharingBillResult.class);
|
||||
}
|
||||
|
||||
private ProfitSharingNotifyData parseNotifyData(String data, SignatureHeader header) throws WxPayException {
|
||||
if (Objects.nonNull(header) && !this.verifyNotifySign(header, data)) {
|
||||
throw new WxPayException("非法请求,头部信息验证失败");
|
||||
|
Loading…
Reference in New Issue
Block a user