🆕 #1768 微信支付增加电商收付通完结分账和退款接口

* 微信收付通增加完结分账和退款接口
This commit is contained in:
f00lish
2020-09-18 14:07:03 +08:00
committed by GitHub
parent b660bfd4a0
commit 115f910e3c
5 changed files with 572 additions and 0 deletions

View File

@@ -213,4 +213,28 @@ public interface EcommerceService {
*/
ReturnOrdersResult returnOrders(ReturnOrdersRequest request) throws WxPayException;
/**
* <pre>
* 完结分账API
* 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/profitsharing/chapter3_5.shtml
* </pre>
*
* @param request 完结分账请求
* @return 返回数据 return orders result
* @throws WxPayException the wx pay exception
*/
ProfitSharingResult finishOrder(FinishOrderRequest request) throws WxPayException;
/**
* <pre>
* 退款申请API
* 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/refunds/chapter3_1.shtml
* </pre>
*
* @param request 退款请求
* @return 返回数据 return refunds result
* @throws WxPayException the wx pay exception
*/
RefundsResult refunds(RefundsRequest request) throws WxPayException;
}

View File

@@ -162,6 +162,20 @@ public class EcommerceServiceImpl implements EcommerceService {
return GSON.fromJson(response, ReturnOrdersResult.class);
}
@Override
public ProfitSharingResult finishOrder(FinishOrderRequest request) throws WxPayException {
String url = String.format("%s/v3/ecommerce/profitsharing/finish-order", this.payService.getPayBaseUrl());
String response = this.payService.postV3(url, GSON.toJson(request));
return GSON.fromJson(response, ProfitSharingResult.class);
}
@Override
public RefundsResult refunds(RefundsRequest request) throws WxPayException {
String url = String.format("%s/v3/ecommerce/refunds/apply", this.payService.getPayBaseUrl());
String response = this.payService.postV3(url, GSON.toJson(request));
return GSON.fromJson(response, RefundsResult.class);
}
private boolean verifyNotifySign(SignatureHeader header, String data) {
String beforeSign = String.format("%s\n%s\n%s\n",
header.getTimeStamp(),