🆕 #1885 【微信支付】电商收付通增加资金账单下载的接口

This commit is contained in:
f00lish
2020-11-24 09:05:07 +08:00
committed by GitHub
parent 57ab245093
commit b4da5c9fe4
9 changed files with 285 additions and 24 deletions

View File

@@ -1,7 +1,7 @@
package com.github.binarywang.wxpay.service;
import com.github.binarywang.wxpay.bean.ecommerce.*;
import com.github.binarywang.wxpay.bean.ecommerce.enums.BillTypeEnum;
import com.github.binarywang.wxpay.bean.ecommerce.enums.FundBillTypeEnum;
import com.github.binarywang.wxpay.bean.ecommerce.enums.SpAccountTypeEnum;
import com.github.binarywang.wxpay.bean.ecommerce.enums.TradeTypeEnum;
import com.github.binarywang.wxpay.exception.WxPayException;
@@ -394,12 +394,24 @@ public interface EcommerceService {
* 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pages/bill.shtml
* </pre>
*
* @param billType 账单类型
* @param request 二级商户号。
* @return 返回数据 return bill result
* @param request 请求信息
* @return 返回数据 return trade bill result
* @throws WxPayException the wx pay exception
*/
BillResult applyBill(BillTypeEnum billType, BillRequest request) throws WxPayException;
TradeBillResult applyBill(TradeBillRequest request) throws WxPayException;
/**
* <pre>
* 申请资金账单API
* 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/bill/chapter3_2.shtml
* </pre>
*
* @param billType 账单类型。
* @param request 请求信息。
* @return 返回数据 return fund bill result
* @throws WxPayException the wx pay exception
*/
FundBillResult applyFundBill(FundBillTypeEnum billType, FundBillRequest request) throws WxPayException;
/**
* <pre>

View File

@@ -1,7 +1,7 @@
package com.github.binarywang.wxpay.service.impl;
import com.github.binarywang.wxpay.bean.ecommerce.*;
import com.github.binarywang.wxpay.bean.ecommerce.enums.BillTypeEnum;
import com.github.binarywang.wxpay.bean.ecommerce.enums.FundBillTypeEnum;
import com.github.binarywang.wxpay.bean.ecommerce.enums.SpAccountTypeEnum;
import com.github.binarywang.wxpay.bean.ecommerce.enums.TradeTypeEnum;
import com.github.binarywang.wxpay.exception.WxPayException;
@@ -295,10 +295,17 @@ public class EcommerceServiceImpl implements EcommerceService {
}
@Override
public BillResult applyBill(BillTypeEnum billType, BillRequest request) throws WxPayException {
public TradeBillResult applyBill(TradeBillRequest request) throws WxPayException {
String url = String.format("%s/v3/bill/tradebill?%s", this.payService.getPayBaseUrl(), this.parseURLPair(request));
String response = this.payService.getV3(URI.create(url));
return GSON.fromJson(response, TradeBillResult.class);
}
@Override
public FundBillResult applyFundBill(FundBillTypeEnum billType, FundBillRequest request) throws WxPayException {
String url = String.format(billType.getUrl(), this.payService.getPayBaseUrl(), this.parseURLPair(request));
String response = this.payService.getV3(URI.create(url));
return GSON.fromJson(response, BillResult.class);
return GSON.fromJson(response, FundBillResult.class);
}
@Override