申请退款接口

This commit is contained in:
liming
2022-08-31 15:54:44 +08:00
parent 57ff6a80ec
commit 81bb1f3563
4 changed files with 59 additions and 2 deletions

View File

@@ -1,6 +1,8 @@
package cn.binarywang.wx.miniapp.api;
import cn.binarywang.wx.miniapp.bean.shop.request.WxMaShopPayCreateOrderRequest;
import cn.binarywang.wx.miniapp.bean.shop.request.WxMaShopPayOrderRefundRequest;
import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopBaseResponse;
import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopPayCreateOrderResponse;
import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopPayGetOrderResponse;
import me.chanjar.weixin.common.error.WxErrorException;
@@ -31,4 +33,14 @@ public interface WxMaShopPayService {
* @throws WxErrorException
*/
WxMaShopPayGetOrderResponse getOrder(String trade_no) throws WxErrorException;
/**
* 订单退款
* 文档地址:<a href="https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/ministore/wxafunds/API/order/refunds_order.html">文档地址</a>
*
* @param request
* @return
* @throws WxErrorException
*/
WxMaShopBaseResponse refundOrder(WxMaShopPayOrderRefundRequest request) throws WxErrorException;
}

View File

@@ -3,6 +3,8 @@ package cn.binarywang.wx.miniapp.api.impl;
import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.api.WxMaShopPayService;
import cn.binarywang.wx.miniapp.bean.shop.request.WxMaShopPayCreateOrderRequest;
import cn.binarywang.wx.miniapp.bean.shop.request.WxMaShopPayOrderRefundRequest;
import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopBaseResponse;
import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopPayCreateOrderResponse;
import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopPayGetOrderResponse;
import lombok.RequiredArgsConstructor;
@@ -10,8 +12,7 @@ import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.common.util.json.WxGsonBuilder;
import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Shop.Pay.CREATE_ORDER;
import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Shop.Pay.GET_ORDER;
import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Shop.Pay.*;
/**
* 小程序支付管理订单相关接口
@@ -34,4 +35,10 @@ public class WxMaShopPayServiceImpl implements WxMaShopPayService {
String response = this.wxMaService.post(GET_ORDER, tradeNo);
return WxGsonBuilder.create().fromJson(response, WxMaShopPayGetOrderResponse.class);
}
@Override
public WxMaShopBaseResponse refundOrder(WxMaShopPayOrderRefundRequest request) throws WxErrorException {
String response = this.wxMaService.post(REFUND_ORDER, request);
return WxGsonBuilder.create().fromJson(response, WxMaShopBaseResponse.class);
}
}