#392 微信支付增加企业付款到银行卡的相关接口

This commit is contained in:
Binary Wang
2017-12-21 23:49:57 +08:00
parent 34a974bc28
commit 0240fffa1c
10 changed files with 178 additions and 14 deletions

View File

@@ -68,5 +68,17 @@ public interface EntPayService {
*
* @param request 请求对象
*/
EntPayBankResult payToBankCard(EntPayBankRequest request) throws WxPayException;
EntPayBankResult payBank(EntPayBankRequest request) throws WxPayException;
/**
* 企业付款到银行卡查询.
* <pre>
* 用于对商户企业付款到银行卡操作进行结果查询,返回付款操作详细结果。
* 文档详见https://pay.weixin.qq.com/wiki/doc/api/tools/mch_pay.php?chapter=24_3
* 接口链接https://api.mch.weixin.qq.com/mmpaysptrans/query_bank
* </pre>
*
* @param partnerTradeNo 商户订单号
*/
EntPayBankQueryResult queryPayBank(String partnerTradeNo) throws WxPayException;
}

View File

@@ -75,7 +75,7 @@ public class EntPayServiceImpl implements EntPayService {
}
@Override
public EntPayBankResult payToBankCard(EntPayBankRequest request) throws WxPayException {
public EntPayBankResult payBank(EntPayBankRequest request) throws WxPayException {
File publicKeyFile = this.buildPublicKeyFile();
request.setEncBankNo(this.encryptRSA(publicKeyFile, request.getEncBankNo()));
request.setEncTrueName(this.encryptRSA(publicKeyFile, request.getEncTrueName()));
@@ -90,6 +90,19 @@ public class EntPayServiceImpl implements EntPayService {
return result;
}
@Override
public EntPayBankQueryResult queryPayBank(String partnerTradeNo) throws WxPayException {
EntPayBankQueryRequest request = new EntPayBankQueryRequest();
request.setPartnerTradeNo(partnerTradeNo);
request.checkAndSign(this.payService.getConfig());
String url = this.payService.getPayBaseUrl() + "/mmpaysptrans/query_bank";
String responseContent = this.payService.post(url, request.toXML(), true);
EntPayBankQueryResult result = BaseWxPayResult.fromXML(responseContent, EntPayBankQueryResult.class);
result.checkResult(this.payService, request.getSignType(), true);
return result;
}
private String encryptRSA(File publicKeyFile, String srcString) throws WxPayException {
try {
Security.addProvider(new BouncyCastleProvider());