🎨 修复小程序支付管理获取订单详情接口请求参数格式错误

This commit is contained in:
liming1019 2022-09-11 20:33:20 +08:00 committed by GitHub
parent 3918005b1f
commit 310e1d91be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View File

@ -7,9 +7,11 @@ 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 com.google.gson.JsonObject;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.common.util.json.GsonHelper;
import me.chanjar.weixin.common.util.json.WxGsonBuilder;
import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Shop.Pay.*;
@ -32,7 +34,8 @@ public class WxMaShopPayServiceImpl implements WxMaShopPayService {
@Override
public WxMaShopPayGetOrderResponse getOrder(String tradeNo) throws WxErrorException {
String response = this.wxMaService.post(GET_ORDER, tradeNo);
JsonObject request = GsonHelper.buildJsonObject("trade_no", tradeNo);
String response = this.wxMaService.post(GET_ORDER, request);
return WxGsonBuilder.create().fromJson(response, WxMaShopPayGetOrderResponse.class);
}

View File

@ -3,6 +3,7 @@ package cn.binarywang.wx.miniapp.api.impl;
import cn.binarywang.wx.miniapp.api.WxMaService;
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 cn.binarywang.wx.miniapp.test.ApiTestModule;
import com.google.inject.Inject;
import org.testng.annotations.Guice;
@ -37,4 +38,10 @@ public class WxMaShopPayServiceImplTest {
WxMaShopPayCreateOrderResponse response = wxService.getWxMaShopPayService().createOrder(request);
assertThat(response).isNotNull();
}
@Test
public void testGetOrder() throws Exception {
WxMaShopPayGetOrderResponse response = wxService.getWxMaShopPayService().getOrder("457243057210572800");
assertThat(response).isNotNull();
}
}