mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-04-05 17:38:05 +08:00
🆕 【微信支付】新增v3分账查询接口,同时修改分账查询结果接口增加分账明细单号字段detail_id
This commit is contained in:
parent
13f9c64643
commit
f5ac3b181e
@ -121,6 +121,10 @@ public class ProfitSharingQueryResult extends BaseWxPayResult implements Seriali
|
||||
* 分账失败原因
|
||||
*/
|
||||
private String failReason;
|
||||
/**
|
||||
* 分账明细单号
|
||||
*/
|
||||
private String detailId;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
@ -132,6 +136,7 @@ public class ProfitSharingQueryResult extends BaseWxPayResult implements Seriali
|
||||
", result='" + result + '\'' +
|
||||
", finishTime='" + finishTime + '\'' +
|
||||
", failReason='" + failReason + '\'' +
|
||||
", detailId='" + detailId + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,62 @@
|
||||
package com.github.binarywang.wxpay.bean.profitsharing.v3;
|
||||
|
||||
import com.github.binarywang.wxpay.bean.request.BaseWxPayRequest;
|
||||
import com.github.binarywang.wxpay.constant.WxPayConstants;
|
||||
import com.github.binarywang.wxpay.exception.WxPayException;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
import lombok.*;
|
||||
import lombok.experimental.Accessors;
|
||||
import me.chanjar.weixin.common.annotation.Required;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author lyt 2023/08/21 15:44
|
||||
* @version 1.0
|
||||
*/
|
||||
@Data
|
||||
@Builder(builderMethodName = "newBuilder")
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ProfitSharingQueryRequest implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:子商户号
|
||||
* 是否必填:是
|
||||
* 描述:微信支付分配的子商户号,即分账的出资商户号。
|
||||
* </pre>
|
||||
*/
|
||||
@SerializedName("sub_mchid")
|
||||
private String subMchId;
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:微信支付订单号.
|
||||
* 变量名:transaction_id
|
||||
* 是否必填:是
|
||||
* String(32)
|
||||
* 示例值:4208450740201411110007820472
|
||||
* 描述:微信支付订单号
|
||||
* </pre>
|
||||
*/
|
||||
@XStreamAlias("transaction_id")
|
||||
@Required
|
||||
private String transactionId;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:商户分账单号.
|
||||
* 变量名:out_order_no
|
||||
* 是否必填:是
|
||||
* String(64)
|
||||
* 示例值:P20150806125346
|
||||
* 描述:查询分账结果,输入申请分账时的商户分账单号; 查询分账完结的执行结果,输入发起分账完结时的商户分账单号
|
||||
* </pre>
|
||||
*/
|
||||
@XStreamAlias("out_order_no")
|
||||
@Required
|
||||
private String outOrderNo;
|
||||
|
||||
}
|
@ -112,7 +112,7 @@ public class ProfitSharingResult implements Serializable {
|
||||
* </pre>
|
||||
*/
|
||||
@SerializedName("amount")
|
||||
private Long amount;
|
||||
private Integer amount;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
|
@ -274,4 +274,22 @@ public interface ProfitSharingV3Service {
|
||||
* @date 2022-12-09
|
||||
*/
|
||||
ProfitSharingBillResult getProfitSharingBill(ProfitSharingBillRequest request) throws WxPayException;
|
||||
/**
|
||||
* <pre>
|
||||
* 请求分账查询API
|
||||
*
|
||||
* 发起分账请求后,可调用此接口查询分账结果
|
||||
* 文档详见: https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter8_1_2.shtml
|
||||
* 接口链接: https://api.mch.weixin.qq.com/v3/profitsharing/orders/{out_order_no}
|
||||
*
|
||||
* 注意:
|
||||
* 发起解冻剩余资金请求后,可调用此接口查询解冻剩余资金的结果
|
||||
* </pre>
|
||||
*
|
||||
* @param request {@link ProfitSharingQueryRequest} 针对某一笔分账订单的分账方法
|
||||
* @return {@link ProfitSharingResult} 微信返回的分账查询结果
|
||||
* @throws WxPayException the wx pay exception
|
||||
* @see <a href="https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter8_1_2.shtml">微信文档</a>
|
||||
*/
|
||||
ProfitSharingResult profitSharingQuery(ProfitSharingQueryRequest request) throws WxPayException;
|
||||
}
|
||||
|
@ -166,6 +166,34 @@ public class ProfitSharingV3ServiceImpl implements ProfitSharingV3Service {
|
||||
return GSON.fromJson(result, ProfitSharingBillResult.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 请求分账查询API
|
||||
*
|
||||
* 发起分账请求后,可调用此接口查询分账结果
|
||||
* 文档详见: https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter8_1_2.shtml
|
||||
* 接口链接: https://api.mch.weixin.qq.com/v3/profitsharing/orders/{out_order_no}
|
||||
*
|
||||
* 注意:
|
||||
* 发起解冻剩余资金请求后,可调用此接口查询解冻剩余资金的结果
|
||||
* </pre>
|
||||
*
|
||||
* @param request {@link ProfitSharingQueryRequest} 针对某一笔分账订单的分账方法
|
||||
* @return {@link ProfitSharingResult} 微信返回的分账查询结果
|
||||
* @throws WxPayException the wx pay exception
|
||||
* @see <a href="https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter8_1_2.shtml">微信文档</a>
|
||||
*/
|
||||
@Override
|
||||
public ProfitSharingResult profitSharingQuery(ProfitSharingQueryRequest request) throws WxPayException {
|
||||
String url = String.format("%s/v3/profitsharing/orders/%s?transaction_id=%s", this.payService.getPayBaseUrl(),
|
||||
request.getOutOrderNo(), request.getOutOrderNo());
|
||||
if(StringUtils.isNotEmpty(request.getSubMchId())){
|
||||
url += "&sub_mchid=" + request.getSubMchId();
|
||||
}
|
||||
String result = this.payService.getV3(url);
|
||||
return GSON.fromJson(result, ProfitSharingResult.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