获取订单详情接口

This commit is contained in:
liming
2022-08-31 15:40:30 +08:00
parent db5826cfcf
commit 57ff6a80ec
4 changed files with 123 additions and 2 deletions

View File

@@ -2,6 +2,7 @@ package cn.binarywang.wx.miniapp.api;
import cn.binarywang.wx.miniapp.bean.shop.request.WxMaShopPayCreateOrderRequest;
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;
/**
@@ -19,6 +20,15 @@ public interface WxMaShopPayService {
* @return 创建订单结果
* @throws WxErrorException .
*/
WxMaShopPayCreateOrderResponse createOrder(WxMaShopPayCreateOrderRequest request)
throws WxErrorException;
WxMaShopPayCreateOrderResponse createOrder(WxMaShopPayCreateOrderRequest request) throws WxErrorException;
/**
* 查询订单详情
* 文档地址:<a href="https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/ministore/wxafunds/API/order/get_order_detail.html">文档地址</a>
*
* @param trade_no
* @return
* @throws WxErrorException
*/
WxMaShopPayGetOrderResponse getOrder(String trade_no) throws WxErrorException;
}

View File

@@ -4,12 +4,14 @@ 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.response.WxMaShopPayCreateOrderResponse;
import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopPayGetOrderResponse;
import lombok.RequiredArgsConstructor;
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;
/**
* 小程序支付管理订单相关接口
@@ -26,4 +28,10 @@ public class WxMaShopPayServiceImpl implements WxMaShopPayService {
String response = this.wxMaService.post(CREATE_ORDER, request);
return WxGsonBuilder.create().fromJson(response, WxMaShopPayCreateOrderResponse.class);
}
@Override
public WxMaShopPayGetOrderResponse getOrder(String tradeNo) throws WxErrorException {
String response = this.wxMaService.post(GET_ORDER, tradeNo);
return WxGsonBuilder.create().fromJson(response, WxMaShopPayGetOrderResponse.class);
}
}