1
0
mirror of synced 2025-12-22 00:48:00 +08:00

🆕 #2258 【小程序】增加自定义组件之物流和售后相关接口

This commit is contained in:
liming1019
2021-08-13 17:55:35 +08:00
committed by GitHub
parent 3f42a162c2
commit e785b1f9a7
16 changed files with 681 additions and 14 deletions

View File

@@ -0,0 +1,75 @@
package cn.binarywang.wx.miniapp.api.impl;
import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.bean.shop.request.WxMaShopAfterSaleAddRequest;
import cn.binarywang.wx.miniapp.bean.shop.request.WxMaShopAfterSaleGetRequest;
import cn.binarywang.wx.miniapp.bean.shop.request.WxMaShopAfterSaleUpdateRequest;
import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopAfterSaleGetResponse;
import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopBaseResponse;
import cn.binarywang.wx.miniapp.test.ApiTestModule;
import com.google.inject.Inject;
import me.chanjar.weixin.common.error.WxErrorException;
import org.testng.annotations.Guice;
import org.testng.annotations.Test;
import java.util.ArrayList;
import java.util.Arrays;
import static org.assertj.core.api.Assertions.assertThat;
/**
* @author liming1019
*/
@Test
@Guice(modules = ApiTestModule.class)
public class WxMaShopAfterSaleServiceImplTest {
@Inject
private WxMaService wxService;
@Test
public void testAdd() throws WxErrorException {
WxMaShopAfterSaleAddRequest.ProductInfosBean productInfosBean = WxMaShopAfterSaleAddRequest.ProductInfosBean.builder()
.outProductId("234245")
.outSkuId("23424")
.productCnt(5)
.build();
WxMaShopAfterSaleAddRequest request = WxMaShopAfterSaleAddRequest.builder()
.outOrderId("xxxxx")
.outAftersaleId("xxxxxx")
.openid("oTVP50O53a7jgmawAmxKukNlq3XI")
.type(1)
.createTime("2020-12-01 00:00:00")
.status(1)
.finishAllAftersale(0)
.path("/pages/aftersale.html?out_aftersale_id=xxxxx")
.refund(100L)
.productInfos(new ArrayList<>(Arrays.asList(productInfosBean)))
.build();
WxMaShopBaseResponse response = wxService.getShopAfterSaleService().add(request);
assertThat(response).isNotNull();
}
@Test
public void testGet() throws WxErrorException {
WxMaShopAfterSaleGetRequest request = WxMaShopAfterSaleGetRequest.builder()
.openid("oTVP50O53a7jgmawAmxKukNlq3XI")
.orderId(32434234L)
.outOrderId("xxxxx")
.build();
WxMaShopAfterSaleGetResponse response = wxService.getShopAfterSaleService().get(request);
assertThat(response).isNotNull();
}
@Test
public void testUpdate() throws WxErrorException {
WxMaShopAfterSaleUpdateRequest request = WxMaShopAfterSaleUpdateRequest.builder()
.outOrderId("xxxxx")
.openid("oTVP50O53a7jgmawAmxKukNlq3XI")
.outAftersaleId("xxxxxx")
.status(1)
.finishAllAftersale(0)
.build();
WxMaShopBaseResponse response = wxService.getShopAfterSaleService().update(request);
assertThat(response).isNotNull();
}
}

View File

@@ -0,0 +1,61 @@
package cn.binarywang.wx.miniapp.api.impl;
import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.bean.shop.request.WxMaShopDeliveryRecieveRequest;
import cn.binarywang.wx.miniapp.bean.shop.request.WxMaShopDeliverySendRequest;
import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopBaseResponse;
import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopDeliveryGetCompanyListResponse;
import cn.binarywang.wx.miniapp.test.ApiTestModule;
import com.google.inject.Inject;
import me.chanjar.weixin.common.error.WxErrorException;
import org.testng.annotations.Guice;
import org.testng.annotations.Test;
import java.util.ArrayList;
import java.util.Arrays;
import static org.testng.Assert.assertNotNull;
/**
* @author liming1019
*/
@Test
@Guice(modules = ApiTestModule.class)
public class WxMaShopDeliveryServiceImplTest {
@Inject
private WxMaService wxService;
@Test
public void testGetCompanyList() throws WxErrorException {
WxMaShopDeliveryGetCompanyListResponse response = wxService.getShopDeliveryService().getCompanyList();
assertNotNull(response);
}
@Test
public void testSend() throws WxErrorException {
WxMaShopDeliverySendRequest.DeliveryListBean deliveryListBean = WxMaShopDeliverySendRequest.DeliveryListBean.builder()
.deliveryId("SF")
.waybillId("23424324253")
.build();
WxMaShopDeliverySendRequest request = WxMaShopDeliverySendRequest.builder()
.orderId(123456L)
.outOrderId("xxxxx")
.openid("oTVP50O53a7jgmawAmxKukNlq3XI")
.finishAllDelivery(0)
.deliveryList(new ArrayList<>(Arrays.asList(deliveryListBean)))
.build();
WxMaShopBaseResponse response = wxService.getShopDeliveryService().send(request);
assertNotNull(response);
}
@Test
public void testReceive() throws WxErrorException {
WxMaShopDeliveryRecieveRequest request = WxMaShopDeliveryRecieveRequest.builder()
.openid("oTVP50O53a7jgmawAmxKukNlq3XI")
.orderId(123456L)
.outOrderId("xxxxx")
.build();
WxMaShopBaseResponse response = wxService.getShopDeliveryService().receive(request);
assertNotNull(response);
}
}