Skip to content

Commit cd034c4

Browse files
authored
🆕 #2664 【微信支付】电商收付通(分账)增加查询订单剩余待分金额的接口
1 parent 403d9c5 commit cd034c4

File tree

4 files changed

+103
-0
lines changed

4 files changed

+103
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package com.github.binarywang.wxpay.bean.ecommerce;
2+
3+
4+
import com.google.gson.annotations.SerializedName;
5+
import lombok.Data;
6+
import lombok.NoArgsConstructor;
7+
8+
9+
/**
10+
* 查询订单剩余待分金额API 请求对象
11+
*
12+
* @author mshyh
13+
* @date 2022/05/26
14+
*/
15+
16+
17+
@Data
18+
@NoArgsConstructor
19+
public class ProfitSharingOrdersUnSplitAmountRequest {
20+
21+
/**
22+
* <pre>
23+
* 字段名:微信订单号
24+
* 变量名:transaction_id
25+
* 是否必填:是
26+
* 类型:string[1, 32]
27+
* 描述:微信支付订单号
28+
* 示例值:4208450740201411110007820472
29+
* </pre>
30+
*/
31+
@SerializedName(value = "transaction_id")
32+
private String transactionId;
33+
34+
35+
36+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
package com.github.binarywang.wxpay.bean.ecommerce;
2+
3+
import com.google.gson.annotations.SerializedName;
4+
import lombok.Data;
5+
import lombok.NoArgsConstructor;
6+
7+
8+
9+
/**
10+
* 查询订单剩余待分金额API 结果响应
11+
*
12+
* @author mshyh
13+
* @date 2022/05/26
14+
*/
15+
16+
@Data
17+
@NoArgsConstructor
18+
public class ProfitSharingOrdersUnSplitAmountResult {
19+
20+
/**
21+
* <pre>
22+
* 字段名:微信支付订单号
23+
* 变量名:transaction_id
24+
* 是否必填:是
25+
* 类型:string[1,32]
26+
* 描述:微信支付订单号。
27+
* 示例值:4208450740201411110007820472
28+
* </pre>
29+
*/
30+
@SerializedName(value = "transaction_id")
31+
private String transactionId;
32+
33+
/**
34+
* <pre>
35+
* 字段名:订单剩余待分金额
36+
* 变量名:unsplit_amount
37+
* 是否必填:是
38+
* 类型:int
39+
* 描述:订单剩余待分金额,整数,单位为分。
40+
* 示例值:1000
41+
* </pre>
42+
*/
43+
@SerializedName(value = "unsplit_amount")
44+
private Integer unsplitAmount;
45+
46+
47+
}

weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/EcommerceService.java

+12
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,18 @@ public interface EcommerceService {
252252
*/
253253
ProfitSharingResult queryProfitSharing(ProfitSharingQueryRequest request) throws WxPayException;
254254

255+
/**
256+
* <pre>
257+
* 查询订单剩余待分金额API
258+
* 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter7_4_9.shtml
259+
* </pre>
260+
*
261+
* @param request 查询订单剩余待分金额请求
262+
* @return 返回数据 profit sharing UnSplitAmount result
263+
* @throws WxPayException the wx pay exception
264+
*/
265+
ProfitSharingOrdersUnSplitAmountResult queryProfitSharingOrdersUnsplitAmount(ProfitSharingOrdersUnSplitAmountRequest request) throws WxPayException;
266+
255267
/**
256268
* <pre>
257269
* 添加分账接收方API

weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/EcommerceServiceImpl.java

+8
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,14 @@ public ProfitSharingResult queryProfitSharing(ProfitSharingQueryRequest request)
200200
return GSON.fromJson(response, ProfitSharingResult.class);
201201
}
202202

203+
@Override
204+
public ProfitSharingOrdersUnSplitAmountResult queryProfitSharingOrdersUnsplitAmount(ProfitSharingOrdersUnSplitAmountRequest request) throws WxPayException {
205+
String url = String.format("%s/v3/ecommerce/profitsharing/orders/%s/amounts",
206+
this.payService.getPayBaseUrl(), request.getTransactionId());
207+
String response = this.payService.getV3(url);
208+
return GSON.fromJson(response, ProfitSharingOrdersUnSplitAmountResult.class);
209+
}
210+
203211
@Override
204212
public ProfitSharingReceiverResult addReceivers(ProfitSharingReceiverRequest request) throws WxPayException {
205213
String url = String.format("%s/v3/ecommerce/profitsharing/receivers/add", this.payService.getPayBaseUrl());

0 commit comments

Comments
 (0)