Skip to content

Commit 06dc88f

Browse files
Copilotbinarywang
andauthored
完善电子回单接口文档注释并处理审查反馈
Agent-Logs-Url: https://github.com/binarywang/WxJava/sessions/8e47db93-4c11-4263-a22d-8823b3f7d2b8 Co-authored-by: binarywang <1343140+binarywang@users.noreply.github.com>
1 parent 8009b15 commit 06dc88f

5 files changed

Lines changed: 23 additions & 11 deletions

File tree

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,11 @@ public interface MerchantTransferService {
110110
* 请求URL:https://api.mch.weixin.qq.com/v3/fund-app/mch-transfer/elecsign/out-bill-no/{out_bill_no}
111111
* 请求方式:GET
112112
*
113-
* @param outBatchNo the out batch no
113+
* @param outBillNo 商户转账单号
114114
* @return electronic bill result
115115
* @throws WxPayException the wx pay exception
116116
*/
117-
ElectronicBillResult queryElectronicBill(String outBatchNo) throws WxPayException;
117+
ElectronicBillResult queryElectronicBill(String outBillNo) throws WxPayException;
118118

119119
/**
120120
* 转账明细电子回单受理API

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,11 @@ public interface PartnerTransferService {
118118
* 请求URL:https://api.mch.weixin.qq.com/v3/fund-app/mch-transfer/elecsign/out-bill-no/{out_bill_no}
119119
* 请求方式:GET
120120
*
121-
* @param outBatchNo 商家批次单号
121+
* @param outBillNo 商户转账单号
122122
* @return 返回数据 fund balance result
123123
* @throws WxPayException the wx pay exception
124124
*/
125-
BillReceiptResult queryBillReceipt(String outBatchNo) throws WxPayException;
125+
BillReceiptResult queryBillReceipt(String outBillNo) throws WxPayException;
126126

127127
/**
128128
* 转账明细电子回单受理API

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ public ElectronicBillResult applyElectronicBill(ElectronicBillApplyRequest reque
9898
}
9999

100100
@Override
101-
public ElectronicBillResult queryElectronicBill(String outBatchNo) throws WxPayException {
102-
String url = String.format("%s/v3/fund-app/mch-transfer/elecsign/out-bill-no/%s", this.wxPayService.getPayBaseUrl(), outBatchNo);
101+
public ElectronicBillResult queryElectronicBill(String outBillNo) throws WxPayException {
102+
String url = String.format("%s/v3/fund-app/mch-transfer/elecsign/out-bill-no/%s", this.wxPayService.getPayBaseUrl(), outBillNo);
103103
String response = wxPayService.getV3(url);
104104
return GSON.fromJson(response, ElectronicBillResult.class);
105105
}

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -206,17 +206,17 @@ public BillReceiptResult receiptBill(ReceiptBillRequest request) throws WxPayExc
206206
* 查询转账电子回单API
207207
* 接口说明
208208
* 适用对象:直连商户 服务商
209-
* 文档详见: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/transfer/chapter4_2.shtml
210-
* 请求URL:https://api.mch.weixin.qq.com/v3/transfer/bill-receipt/{out_batch_no}
209+
* 文档详见: https://pay.weixin.qq.com/doc/v3/merchant/4012716436
210+
* 请求URL:https://api.mch.weixin.qq.com/v3/fund-app/mch-transfer/elecsign/out-bill-no/{out_bill_no}
211211
* 请求方式:GET
212212
*
213-
* @param outBatchNo 商家批次单号
213+
* @param outBillNo 商户转账单号
214214
* @return 返回数据 fund balance result
215215
* @throws WxPayException the wx pay exception
216216
*/
217217
@Override
218-
public BillReceiptResult queryBillReceipt(String outBatchNo) throws WxPayException {
219-
String url = String.format("%s/v3/fund-app/mch-transfer/elecsign/out-bill-no/%s", this.payService.getPayBaseUrl(), outBatchNo);
218+
public BillReceiptResult queryBillReceipt(String outBillNo) throws WxPayException {
219+
String url = String.format("%s/v3/fund-app/mch-transfer/elecsign/out-bill-no/%s", this.payService.getPayBaseUrl(), outBillNo);
220220
String response = this.payService.getV3(url);
221221
return GSON.fromJson(response, BillReceiptResult.class);
222222
}

weixin-java-pay/src/test/java/com/github/binarywang/wxpay/service/impl/TransferReceiptApiCompatibilityTest.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ public class TransferReceiptApiCompatibilityTest {
1919

2020
private static final String BASE_URL = "https://api.mch.weixin.qq.com";
2121

22+
/**
23+
* 验证直连商户电子回单接口已切换到新版fund-app路径。
24+
*/
2225
public void shouldUseNewMerchantTransferElecsignApiPath() throws WxPayException {
2326
RequestCaptureHandler handler = new RequestCaptureHandler();
2427
WxPayService wxPayService = handler.createWxPayService();
@@ -33,6 +36,9 @@ public void shouldUseNewMerchantTransferElecsignApiPath() throws WxPayException
3336
Assert.assertEquals(handler.lastGetUrl, BASE_URL + "/v3/fund-app/mch-transfer/elecsign/out-bill-no/plfk2020042013");
3437
}
3538

39+
/**
40+
* 验证服务商电子回单接口已切换到新版fund-app路径。
41+
*/
3642
public void shouldUseNewPartnerTransferElecsignApiPath() throws WxPayException {
3743
RequestCaptureHandler handler = new RequestCaptureHandler();
3844
WxPayService wxPayService = handler.createWxPayService();
@@ -49,6 +55,9 @@ public void shouldUseNewPartnerTransferElecsignApiPath() throws WxPayException {
4955
Assert.assertEquals(handler.lastGetUrl, BASE_URL + "/v3/fund-app/mch-transfer/elecsign/out-bill-no/plfk2020042013");
5056
}
5157

58+
/**
59+
* 验证新版字段名能够正确反序列化到现有结果对象。
60+
*/
5261
public void shouldDeserializeNewResponseFieldNames() {
5362
Gson gson = new Gson();
5463
BillReceiptResult billReceiptResult =
@@ -62,6 +71,9 @@ public void shouldDeserializeNewResponseFieldNames() {
6271
Assert.assertEquals(electronicBillResult.getSignatureStatus(), "FINISHED");
6372
}
6473

74+
/**
75+
* 通过动态代理拦截WxPayService请求并记录URL/请求体,便于断言接口路径和参数。
76+
*/
6577
private static class RequestCaptureHandler implements InvocationHandler {
6678
private String lastPostUrl;
6779
private String lastPostBody;

0 commit comments

Comments
 (0)