mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2026-02-17 13:49:26 +08:00
🆕 #1758 微信支付增加电商收付通服务商和二级商户余额查询接口
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.github.binarywang.wxpay.service;
|
||||
|
||||
import com.github.binarywang.wxpay.bean.ecommerce.*;
|
||||
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;
|
||||
|
||||
@@ -127,4 +128,50 @@ public interface EcommerceService {
|
||||
* @return 解密后通知数据
|
||||
*/
|
||||
PartnerTransactionsNotifyResult parsePartnerNotifyResult(String notifyData, SignatureHeader header) throws WxPayException;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 服务商账户实时余额
|
||||
* 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pages/amount.shtml
|
||||
* </pre>
|
||||
*
|
||||
* @param accountType 服务商账户类型
|
||||
* @return 返回数据
|
||||
*/
|
||||
FundBalanceResult spNowBalance(SpAccountTypeEnum accountType) throws WxPayException;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 服务商账户日终余额
|
||||
* 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pages/amount.shtml
|
||||
* </pre>
|
||||
*
|
||||
* @param accountType 服务商账户类型
|
||||
* @param date 查询日期 2020-09-11
|
||||
* @return 返回数据
|
||||
*/
|
||||
FundBalanceResult spDayEndBalance(SpAccountTypeEnum accountType, String date) throws WxPayException;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 二级商户号账户实时余额
|
||||
* 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pages/amount.shtml
|
||||
* </pre>
|
||||
*
|
||||
* @param subMchid 二级商户号
|
||||
* @return 返回数据
|
||||
*/
|
||||
FundBalanceResult subNowBalance(String subMchid) throws WxPayException;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 二级商户号账户日终余额
|
||||
* 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pages/amount.shtml
|
||||
* </pre>
|
||||
*
|
||||
* @param subMchid 二级商户号
|
||||
* @param date 查询日期 2020-09-11
|
||||
* @return 返回数据
|
||||
*/
|
||||
FundBalanceResult subDayEndBalance(String subMchid, String date) throws WxPayException;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.github.binarywang.wxpay.service.impl;
|
||||
|
||||
import com.github.binarywang.wxpay.bean.ecommerce.*;
|
||||
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;
|
||||
import com.github.binarywang.wxpay.service.EcommerceService;
|
||||
@@ -115,6 +116,38 @@ public class EcommerceServiceImpl implements EcommerceService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public FundBalanceResult spNowBalance(SpAccountTypeEnum accountType) throws WxPayException {
|
||||
String url = String.format("%s/v3/merchant/fund/balance/%s", this.payService.getPayBaseUrl(), accountType);
|
||||
URI uri = URI.create(url);
|
||||
String response = this.payService.getV3(uri);
|
||||
return GSON.fromJson(response, FundBalanceResult.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FundBalanceResult spDayEndBalance(SpAccountTypeEnum accountType, String date) throws WxPayException {
|
||||
String url = String.format("%s/v3/merchant/fund/dayendbalance/%s?date=%s", this.payService.getPayBaseUrl(), accountType, date);
|
||||
URI uri = URI.create(url);
|
||||
String response = this.payService.getV3(uri);
|
||||
return GSON.fromJson(response, FundBalanceResult.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FundBalanceResult subNowBalance(String subMchid) throws WxPayException {
|
||||
String url = String.format("%s/v3/ecommerce/fund/balance/%s", this.payService.getPayBaseUrl(), subMchid);
|
||||
URI uri = URI.create(url);
|
||||
String response = this.payService.getV3(uri);
|
||||
return GSON.fromJson(response, FundBalanceResult.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FundBalanceResult subDayEndBalance(String subMchid, String date) throws WxPayException {
|
||||
String url = String.format("%s/v3/ecommerce/fund/enddaybalance/%s?date=%s", this.payService.getPayBaseUrl(), subMchid, date);
|
||||
URI uri = URI.create(url);
|
||||
String response = this.payService.getV3(uri);
|
||||
return GSON.fromJson(response, FundBalanceResult.class);
|
||||
}
|
||||
|
||||
private boolean verifyNotifySign(SignatureHeader header, String data) {
|
||||
String beforeSign = String.format("%s\n%s\n%s\n",
|
||||
header.getTimeStamp(),
|
||||
|
||||
Reference in New Issue
Block a user