mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2026-02-18 06:06:23 +08:00
🆕 #1916 【微信支付】电商收付通增加关闭普通支付单的接口
This commit is contained in:
@@ -166,6 +166,17 @@ public interface EcommerceService {
|
||||
*/
|
||||
PartnerTransactionsResult queryPartnerTransactions(PartnerTransactionsQueryRequest request) throws WxPayException;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 关闭普通订单API
|
||||
* 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/e_transactions/chapter3_6.shtml
|
||||
* </pre>
|
||||
*
|
||||
* @param request 关闭普通订单请求
|
||||
* @throws WxPayException the wx pay exception
|
||||
*/
|
||||
void closePartnerTransactions(PartnerTransactionsCloseRequest request) throws WxPayException;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 服务商账户实时余额
|
||||
|
||||
@@ -149,6 +149,12 @@ public class EcommerceServiceImpl implements EcommerceService {
|
||||
return GSON.fromJson(response, PartnerTransactionsResult.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closePartnerTransactions(PartnerTransactionsCloseRequest request) throws WxPayException {
|
||||
String url = String.format("%s/v3/pay/partner/transactions/out-trade-no/%s/close", this.payService.getPayBaseUrl(), request.getOutTradeNo());
|
||||
String response = this.payService.postV3(url, GSON.toJson(request));
|
||||
}
|
||||
|
||||
@Override
|
||||
public FundBalanceResult spNowBalance(SpAccountTypeEnum accountType) throws WxPayException {
|
||||
String url = String.format("%s/v3/merchant/fund/balance/%s", this.payService.getPayBaseUrl(), accountType);
|
||||
|
||||
@@ -100,7 +100,13 @@ public class WxPayServiceApacheHttpImpl extends BaseWxPayServiceImpl {
|
||||
try (CloseableHttpResponse response = httpClient.execute(httpPost)) {
|
||||
//v3已经改为通过状态码判断200 204 成功
|
||||
int statusCode = response.getStatusLine().getStatusCode();
|
||||
String responseString = EntityUtils.toString(response.getEntity(), StandardCharsets.UTF_8);
|
||||
//post方法有可能会没有返回值的情况
|
||||
String responseString;
|
||||
if (response.getEntity() == null) {
|
||||
responseString = null;
|
||||
}else {
|
||||
responseString = EntityUtils.toString(response.getEntity(), StandardCharsets.UTF_8);
|
||||
}
|
||||
if (HttpStatus.SC_OK == statusCode || HttpStatus.SC_NO_CONTENT == statusCode) {
|
||||
this.log.info("\n【请求地址】:{}\n【请求数据】:{}\n【响应数据】:{}", url, requestStr, responseString);
|
||||
return responseString;
|
||||
@@ -166,7 +172,13 @@ public class WxPayServiceApacheHttpImpl extends BaseWxPayServiceImpl {
|
||||
try (CloseableHttpResponse response = httpClient.execute(httpPost)) {
|
||||
//v3已经改为通过状态码判断200 204 成功
|
||||
int statusCode = response.getStatusLine().getStatusCode();
|
||||
String responseString = EntityUtils.toString(response.getEntity(), StandardCharsets.UTF_8);
|
||||
//post方法有可能会没有返回值的情况
|
||||
String responseString;
|
||||
if (response.getEntity() == null) {
|
||||
responseString = null;
|
||||
}else {
|
||||
responseString = EntityUtils.toString(response.getEntity(), StandardCharsets.UTF_8);
|
||||
}
|
||||
if (HttpStatus.SC_OK == statusCode || HttpStatus.SC_NO_CONTENT == statusCode) {
|
||||
this.log.info("\n【请求地址】:{}\n【响应数据】:{}", url, responseString);
|
||||
return responseString;
|
||||
|
||||
Reference in New Issue
Block a user