🆕 #2772 【小程序】增加小程序支付管理之创建订单接口

This commit is contained in:
liming1019
2022-08-10 22:44:43 +08:00
committed by GitHub
parent ab26565377
commit cfa92390f2
8 changed files with 195 additions and 0 deletions

View File

@@ -515,4 +515,10 @@ public interface WxMaService extends WxService {
* @return getWxMaShopCouponService
*/
WxMaShopCouponService getWxMaShopCouponService();
/**
* 小程序支付管理-订单支付
* @return getWxMaShopPayService
*/
WxMaShopPayService getWxMaShopPayService();
}

View File

@@ -0,0 +1,24 @@
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 me.chanjar.weixin.common.error.WxErrorException;
/**
* 小程序支付管理订单相关接口
*
* @author liming1019
*/
public interface WxMaShopPayService {
/**
* 创建订单
* 文档地址:<a href="https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/ministore/wxafunds/API/order/create_order.html">文档地址</a>
*
* @param request 创建订单参数
* @return 创建订单结果
* @throws WxErrorException .
*/
WxMaShopPayCreateOrderResponse createOrder(WxMaShopPayCreateOrderRequest request)
throws WxErrorException;
}

View File

@@ -83,6 +83,7 @@ public abstract class BaseWxMaServiceImpl<H, P> implements WxMaService, RequestH
private final WxMaProductService productService = new WxMaProductServiceImpl(this);
private final WxMaProductOrderService productOrderService = new WxMaProductOrderServiceImpl(this);
private final WxMaShopCouponService wxMaShopCouponService = new WxMaShopCouponServiceImpl(this);
private final WxMaShopPayService wxMaShopPayService = new WxMaShopPayServiceImpl(this);
private Map<String, WxMaConfig> configMap;
private int retrySleepMillis = 1000;
private int maxRetryTimes = 5;
@@ -612,4 +613,8 @@ public abstract class BaseWxMaServiceImpl<H, P> implements WxMaService, RequestH
return this.wxMaShopCouponService;
}
@Override
public WxMaShopPayService getWxMaShopPayService() {
return this.wxMaShopPayService;
}
}

View File

@@ -0,0 +1,29 @@
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.response.WxMaShopPayCreateOrderResponse;
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;
/**
* 小程序支付管理订单相关接口
*
* @author liming1019
*/
@RequiredArgsConstructor
@Slf4j
public class WxMaShopPayServiceImpl implements WxMaShopPayService {
private final WxMaService wxMaService;
@Override
public WxMaShopPayCreateOrderResponse createOrder(WxMaShopPayCreateOrderRequest request) throws WxErrorException {
String response = this.wxMaService.post(CREATE_ORDER, request);
return WxGsonBuilder.create().fromJson(response, WxMaShopPayCreateOrderResponse.class);
}
}