mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-04-05 17:38:05 +08:00
🆕 #2258 【小程序】增加自定义组件之物流和售后相关接口
This commit is contained in:
parent
3f42a162c2
commit
e785b1f9a7
@ -377,18 +377,20 @@ public interface WxMaService extends WxService {
|
||||
*/
|
||||
WxImgProcService getImgProcService();
|
||||
|
||||
// /**
|
||||
// * 返回小程序交易组件-售后服务接口
|
||||
// * @return
|
||||
// */
|
||||
// WxMaShopAfterSaleService getShopAfterSaleService();
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 返回小程序交易组件-物流服务接口
|
||||
// * @return
|
||||
// */
|
||||
// WxMaShopDeliveryService getShopDeliveryService();
|
||||
/**
|
||||
* 返回小程序交易组件-售后服务接口
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
WxMaShopAfterSaleService getShopAfterSaleService();
|
||||
|
||||
|
||||
/**
|
||||
* 返回小程序交易组件-物流服务接口
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
WxMaShopDeliveryService getShopDeliveryService();
|
||||
|
||||
|
||||
/**
|
||||
|
@ -1,10 +1,44 @@
|
||||
package cn.binarywang.wx.miniapp.api;
|
||||
|
||||
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 me.chanjar.weixin.common.error.WxErrorException;
|
||||
|
||||
/**
|
||||
* 小程序交易组件-售后服务
|
||||
*
|
||||
* @author boris
|
||||
* @author liming1019
|
||||
*/
|
||||
public interface WxMaShopAfterSaleService {
|
||||
/**
|
||||
* 创建售后
|
||||
*
|
||||
* @param request
|
||||
* @return WxMaShopBaseResponse
|
||||
* @throws WxErrorException
|
||||
*/
|
||||
WxMaShopBaseResponse add(WxMaShopAfterSaleAddRequest request) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* 获取订单下售后单
|
||||
*
|
||||
* @param request
|
||||
* @return WxMaShopAfterSaleGetResponse
|
||||
* @throws WxErrorException
|
||||
*/
|
||||
WxMaShopAfterSaleGetResponse get(WxMaShopAfterSaleGetRequest request) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* 更新售后
|
||||
*
|
||||
* @param request
|
||||
* @return WxMaShopBaseResponse
|
||||
* @throws WxErrorException
|
||||
*/
|
||||
WxMaShopBaseResponse update(WxMaShopAfterSaleUpdateRequest request) throws WxErrorException;
|
||||
|
||||
}
|
||||
|
@ -1,10 +1,42 @@
|
||||
package cn.binarywang.wx.miniapp.api;
|
||||
|
||||
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 me.chanjar.weixin.common.error.WxErrorException;
|
||||
|
||||
/**
|
||||
* 小程序交易组件-物流发货服务
|
||||
*
|
||||
* @author boris
|
||||
* @author liming1019
|
||||
*/
|
||||
public interface WxMaShopDeliveryService {
|
||||
/**
|
||||
* 获取快递公司列表
|
||||
*
|
||||
* @return WxMaShopDeliveryGetCompanyListResponse
|
||||
* @throws WxErrorException
|
||||
*/
|
||||
WxMaShopDeliveryGetCompanyListResponse getCompanyList() throws WxErrorException;
|
||||
|
||||
/**
|
||||
* 订单发货
|
||||
*
|
||||
* @param request
|
||||
* @return WxMaShopBaseResponse
|
||||
* @throws WxErrorException
|
||||
*/
|
||||
WxMaShopBaseResponse send(WxMaShopDeliverySendRequest request) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* 订单确认收货
|
||||
*
|
||||
* @param request
|
||||
* @return WxMaShopBaseResponse
|
||||
* @throws WxErrorException
|
||||
*/
|
||||
WxMaShopBaseResponse receive(WxMaShopDeliveryRecieveRequest request) throws WxErrorException;
|
||||
|
||||
}
|
||||
|
@ -70,6 +70,8 @@ public abstract class BaseWxMaServiceImpl<H, P> implements WxMaService, RequestH
|
||||
private final WxMaShopCatService shopCatService = new WxMaShopCatServiceImpl(this);
|
||||
private final WxMaShopImgService shopImgService = new WxMaShopImgServiceImpl(this);
|
||||
private final WxMaShopAuditService shopAuditService = new WxMaShopAuditServiceImpl(this);
|
||||
private final WxMaShopAfterSaleService shopAfterSaleService = new WxMaShopAfterSaleServiceImpl(this);
|
||||
private final WxMaShopDeliveryService shopDeliveryService = new WxMaShopDeliveryServiceImpl(this);
|
||||
private final WxMaLinkService linkService = new WxMaLinkServiceImpl(this);
|
||||
private final WxMaReimburseInvoiceService reimburseInvoiceService = new WxMaReimburseInvoiceServiceImpl(this);
|
||||
private Map<String, WxMaConfig> configMap;
|
||||
@ -546,6 +548,16 @@ public abstract class BaseWxMaServiceImpl<H, P> implements WxMaService, RequestH
|
||||
return this.shopAuditService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxMaShopAfterSaleService getShopAfterSaleService() {
|
||||
return this.shopAfterSaleService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxMaShopDeliveryService getShopDeliveryService() {
|
||||
return this.shopDeliveryService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxMaLinkService getLinkService() {
|
||||
return this.linkService;
|
||||
|
@ -2,18 +2,81 @@ package cn.binarywang.wx.miniapp.api.impl;
|
||||
|
||||
import cn.binarywang.wx.miniapp.api.WxMaService;
|
||||
import cn.binarywang.wx.miniapp.api.WxMaShopAfterSaleService;
|
||||
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.json.WxMaGsonBuilder;
|
||||
import com.google.gson.JsonObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import me.chanjar.weixin.common.enums.WxType;
|
||||
import me.chanjar.weixin.common.error.WxError;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import me.chanjar.weixin.common.util.json.GsonParser;
|
||||
|
||||
import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Shop.Aftersale.*;
|
||||
import static cn.binarywang.wx.miniapp.constant.WxMaConstants.ERRCODE;
|
||||
|
||||
/**
|
||||
* @author boris
|
||||
* @author liming1019
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class WxMaShopAfterSaleServiceImpl implements WxMaShopAfterSaleService {
|
||||
private final WxMaService service;
|
||||
private final WxMaService wxMaService;
|
||||
|
||||
|
||||
/**
|
||||
* 创建售后
|
||||
*
|
||||
* @param request
|
||||
* @return WxMaShopBaseResponse
|
||||
* @throws WxErrorException
|
||||
*/
|
||||
@Override
|
||||
public WxMaShopBaseResponse add(WxMaShopAfterSaleAddRequest request) throws WxErrorException {
|
||||
String responseContent = this.wxMaService.post(AFTERSALE_ADD, request);
|
||||
JsonObject jsonObject = GsonParser.parse(responseContent);
|
||||
if (jsonObject.get(ERRCODE).getAsInt() != 0) {
|
||||
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
|
||||
}
|
||||
return WxMaGsonBuilder.create().fromJson(responseContent, WxMaShopBaseResponse.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取订单下售后单
|
||||
*
|
||||
* @param request
|
||||
* @return WxMaShopAfterSaleGetResponse
|
||||
* @throws WxErrorException
|
||||
*/
|
||||
@Override
|
||||
public WxMaShopAfterSaleGetResponse get(WxMaShopAfterSaleGetRequest request) throws WxErrorException {
|
||||
String responseContent = this.wxMaService.post(AFTERSALE_GET, request);
|
||||
JsonObject jsonObject = GsonParser.parse(responseContent);
|
||||
if (jsonObject.get(ERRCODE).getAsInt() != 0) {
|
||||
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
|
||||
}
|
||||
return WxMaGsonBuilder.create().fromJson(responseContent, WxMaShopAfterSaleGetResponse.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新售后
|
||||
*
|
||||
* @param request
|
||||
* @return
|
||||
* @throws WxErrorException
|
||||
*/
|
||||
@Override
|
||||
public WxMaShopBaseResponse update(WxMaShopAfterSaleUpdateRequest request) throws WxErrorException {
|
||||
String responseContent = this.wxMaService.post(AFTERSALE_UPDATE, request);
|
||||
JsonObject jsonObject = GsonParser.parse(responseContent);
|
||||
if (jsonObject.get(ERRCODE).getAsInt() != 0) {
|
||||
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
|
||||
}
|
||||
return WxMaGsonBuilder.create().fromJson(responseContent, WxMaShopBaseResponse.class);
|
||||
}
|
||||
}
|
||||
|
@ -2,15 +2,78 @@ package cn.binarywang.wx.miniapp.api.impl;
|
||||
|
||||
import cn.binarywang.wx.miniapp.api.WxMaService;
|
||||
import cn.binarywang.wx.miniapp.api.WxMaShopDeliveryService;
|
||||
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.json.WxMaGsonBuilder;
|
||||
import com.google.gson.JsonObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import me.chanjar.weixin.common.enums.WxType;
|
||||
import me.chanjar.weixin.common.error.WxError;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import me.chanjar.weixin.common.util.json.GsonParser;
|
||||
|
||||
import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Shop.Delivery.*;
|
||||
import static cn.binarywang.wx.miniapp.constant.WxMaConstants.ERRCODE;
|
||||
|
||||
/**
|
||||
* @author boris
|
||||
* @author liming1019
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class WxMaShopDeliveryServiceImpl implements WxMaShopDeliveryService {
|
||||
private final WxMaService service;
|
||||
private final WxMaService wxMaService;
|
||||
|
||||
/**
|
||||
* 获取快递公司列表
|
||||
*
|
||||
* @return WxMaShopDeliveryGetCompanyListResponse
|
||||
* @throws WxErrorException
|
||||
*/
|
||||
@Override
|
||||
public WxMaShopDeliveryGetCompanyListResponse getCompanyList() throws WxErrorException {
|
||||
String responseContent = this.wxMaService.post(GET_COMPANY_LIST, new JsonObject());
|
||||
JsonObject jsonObject = GsonParser.parse(responseContent);
|
||||
if (jsonObject.get(ERRCODE).getAsInt() != 0) {
|
||||
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
|
||||
}
|
||||
return WxMaGsonBuilder.create().fromJson(responseContent, WxMaShopDeliveryGetCompanyListResponse.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单发货
|
||||
*
|
||||
* @param request
|
||||
* @return WxMaShopBaseResponse
|
||||
* @throws WxErrorException
|
||||
*/
|
||||
@Override
|
||||
public WxMaShopBaseResponse send(WxMaShopDeliverySendRequest request) throws WxErrorException {
|
||||
String responseContent = this.wxMaService.post(DELIVERY_SEND, request);
|
||||
JsonObject jsonObject = GsonParser.parse(responseContent);
|
||||
if (jsonObject.get(ERRCODE).getAsInt() != 0) {
|
||||
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
|
||||
}
|
||||
return WxMaGsonBuilder.create().fromJson(responseContent, WxMaShopBaseResponse.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单确认收货
|
||||
*
|
||||
* @param request
|
||||
* @return WxMaShopBaseResponse
|
||||
* @throws WxErrorException
|
||||
*/
|
||||
@Override
|
||||
public WxMaShopBaseResponse receive(WxMaShopDeliveryRecieveRequest request) throws WxErrorException {
|
||||
String responseContent = this.wxMaService.post(DELIVERY_RECEIVE, request);
|
||||
JsonObject jsonObject = GsonParser.parse(responseContent);
|
||||
if (jsonObject.get(ERRCODE).getAsInt() != 0) {
|
||||
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
|
||||
}
|
||||
return WxMaGsonBuilder.create().fromJson(responseContent, WxMaShopBaseResponse.class);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,69 @@
|
||||
package cn.binarywang.wx.miniapp.bean.shop.request;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author liming1019
|
||||
* @date 2021/8/12
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
public class WxMaShopAfterSaleAddRequest implements Serializable {
|
||||
private static final long serialVersionUID = 6652525413062887786L;
|
||||
|
||||
/**
|
||||
* out_order_id : xxxxx
|
||||
* out_aftersale_id : xxxxxx
|
||||
* openid : oTVP50O53a7jgmawAmxKukNlq3XI
|
||||
* type : 1
|
||||
* create_time : 2020-12-01 00:00:00
|
||||
* status : 1
|
||||
* finish_all_aftersale : 0
|
||||
* path : /pages/aftersale.html?out_aftersale_id=xxxxx
|
||||
* refund : 100
|
||||
* product_infos : [{"out_product_id":"234245","out_sku_id":"23424","product_cnt":5}]
|
||||
*/
|
||||
|
||||
@SerializedName("out_order_id")
|
||||
private String outOrderId;
|
||||
@SerializedName("out_aftersale_id")
|
||||
private String outAftersaleId;
|
||||
@SerializedName("openid")
|
||||
private String openid;
|
||||
@SerializedName("type")
|
||||
private Integer type;
|
||||
@SerializedName("create_time")
|
||||
private String createTime;
|
||||
@SerializedName("status")
|
||||
private Integer status;
|
||||
@SerializedName("finish_all_aftersale")
|
||||
private Integer finishAllAftersale;
|
||||
@SerializedName("path")
|
||||
private String path;
|
||||
@SerializedName("refund")
|
||||
private Long refund;
|
||||
@SerializedName("product_infos")
|
||||
private List<ProductInfosBean> productInfos;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
public static class ProductInfosBean implements Serializable {
|
||||
/**
|
||||
* out_product_id : 234245
|
||||
* out_sku_id : 23424
|
||||
* product_cnt : 5
|
||||
*/
|
||||
|
||||
@SerializedName("out_product_id")
|
||||
private String outProductId;
|
||||
@SerializedName("out_sku_id")
|
||||
private String outSkuId;
|
||||
@SerializedName("product_cnt")
|
||||
private Integer productCnt;
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package cn.binarywang.wx.miniapp.bean.shop.request;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author liming1019
|
||||
* @date 2021/8/12
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
public class WxMaShopAfterSaleGetRequest implements Serializable {
|
||||
private static final long serialVersionUID = -1275475147400719521L;
|
||||
|
||||
/**
|
||||
* order_id : 32434234
|
||||
* out_order_id : xxxxx
|
||||
* openid : oTVP50O53a7jgmawAmxKukNlq3XI
|
||||
*/
|
||||
|
||||
@SerializedName("order_id")
|
||||
private Long orderId;
|
||||
@SerializedName("out_order_id")
|
||||
private String outOrderId;
|
||||
@SerializedName("openid")
|
||||
private String openid;
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package cn.binarywang.wx.miniapp.bean.shop.request;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author liming1019
|
||||
* @date 2021/8/12
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
public class WxMaShopAfterSaleUpdateRequest implements Serializable {
|
||||
private static final long serialVersionUID = 2712027510252221370L;
|
||||
|
||||
/**
|
||||
* out_order_id : xxxxx
|
||||
* openid : oTVP50O53a7jgmawAmxKukNlq3XI
|
||||
* out_aftersale_id : xxxxxx
|
||||
* status : 1
|
||||
* finish_all_aftersale : 0
|
||||
*/
|
||||
|
||||
@SerializedName("out_order_id")
|
||||
private String outOrderId;
|
||||
@SerializedName("openid")
|
||||
private String openid;
|
||||
@SerializedName("out_aftersale_id")
|
||||
private String outAftersaleId;
|
||||
@SerializedName("status")
|
||||
private Integer status;
|
||||
@SerializedName("finish_all_aftersale")
|
||||
private Integer finishAllAftersale;
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package cn.binarywang.wx.miniapp.bean.shop.request;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author liming1019
|
||||
* @date 2021/8/12
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
public class WxMaShopDeliveryRecieveRequest implements Serializable {
|
||||
private static final long serialVersionUID = 1540854758624081221L;
|
||||
|
||||
/**
|
||||
* order_id : 123456
|
||||
* out_order_id : xxxxx
|
||||
* openid : oTVP50O53a7jgmawAmxKukNlq3XI
|
||||
*/
|
||||
|
||||
@SerializedName("order_id")
|
||||
private Long orderId;
|
||||
@SerializedName("out_order_id")
|
||||
private String outOrderId;
|
||||
@SerializedName("openid")
|
||||
private String openid;
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
package cn.binarywang.wx.miniapp.bean.shop.request;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author liming1019
|
||||
* @date 2021/8/12
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
public class WxMaShopDeliverySendRequest implements Serializable {
|
||||
private static final long serialVersionUID = -4034672301224469057L;
|
||||
|
||||
/**
|
||||
* order_id : 123456
|
||||
* out_order_id : xxxxx
|
||||
* openid : oTVP50O53a7jgmawAmxKukNlq3XI
|
||||
* finish_all_delivery : 0
|
||||
* delivery_list : [{"delivery_id":"SF","waybill_id":"23424324253"}]
|
||||
*/
|
||||
|
||||
@SerializedName("order_id")
|
||||
private Long orderId;
|
||||
@SerializedName("out_order_id")
|
||||
private String outOrderId;
|
||||
@SerializedName("openid")
|
||||
private String openid;
|
||||
@SerializedName("finish_all_delivery")
|
||||
private Integer finishAllDelivery;
|
||||
@SerializedName("delivery_list")
|
||||
private List<DeliveryListBean> deliveryList;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
public static class DeliveryListBean implements Serializable {
|
||||
/**
|
||||
* delivery_id : SF
|
||||
* waybill_id : 23424324253
|
||||
*/
|
||||
|
||||
@SerializedName("delivery_id")
|
||||
private String deliveryId;
|
||||
@SerializedName("waybill_id")
|
||||
private String waybillId;
|
||||
}
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
package cn.binarywang.wx.miniapp.bean.shop.response;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class WxMaShopAfterSaleGetResponse extends WxMaShopBaseResponse implements Serializable {
|
||||
private static final long serialVersionUID = 213666907103837748L;
|
||||
|
||||
@SerializedName("aftersale_infos")
|
||||
private List<AftersaleInfosBean> aftersaleInfos;
|
||||
|
||||
@Data
|
||||
public static class AftersaleInfosBean implements Serializable {
|
||||
/**
|
||||
* out_order_id : xxxxx
|
||||
* out_aftersale_id : xxxxxx
|
||||
* openid : oTVP50O53a7jgmawAmxKukNlq3XI
|
||||
* type : 1
|
||||
* create_time : 2020-12-01 00:00:00
|
||||
* path : /pages/order.html?out_order_id=xxxxx
|
||||
* status : 1
|
||||
* refund : 100
|
||||
* product_infos : [{"out_product_id":"234245","out_sku_id":"23424","product_cnt":5}]
|
||||
*/
|
||||
|
||||
@SerializedName("out_order_id")
|
||||
private String outOrderId;
|
||||
@SerializedName("out_aftersale_id")
|
||||
private String outAftersaleId;
|
||||
@SerializedName("openid")
|
||||
private String openid;
|
||||
@SerializedName("type")
|
||||
private Integer type;
|
||||
@SerializedName("create_time")
|
||||
private String createTime;
|
||||
@SerializedName("path")
|
||||
private String path;
|
||||
@SerializedName("status")
|
||||
private Integer status;
|
||||
@SerializedName("refund")
|
||||
private Long refund;
|
||||
@SerializedName("product_infos")
|
||||
private List<ProductInfosBean> productInfos;
|
||||
|
||||
@Data
|
||||
public static class ProductInfosBean implements Serializable {
|
||||
/**
|
||||
* out_product_id : 234245
|
||||
* out_sku_id : 23424
|
||||
* product_cnt : 5
|
||||
*/
|
||||
|
||||
@SerializedName("out_product_id")
|
||||
private String outProductId;
|
||||
@SerializedName("out_sku_id")
|
||||
private String outSkuId;
|
||||
@SerializedName("product_cnt")
|
||||
private Integer productCnt;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package cn.binarywang.wx.miniapp.bean.shop.response;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class WxMaShopDeliveryGetCompanyListResponse extends WxMaShopBaseResponse implements Serializable {
|
||||
private static final long serialVersionUID = -1478684494303814483L;
|
||||
|
||||
@SerializedName("company_list")
|
||||
private List<CompanyListBean> companyList;
|
||||
|
||||
@Data
|
||||
public static class CompanyListBean implements Serializable {
|
||||
/**
|
||||
* delivery_id : SF
|
||||
* delivery_name : 顺丰速运
|
||||
*/
|
||||
|
||||
@SerializedName("delivery_id")
|
||||
private String deliveryId;
|
||||
@SerializedName("delivery_name")
|
||||
private String deliveryName;
|
||||
}
|
||||
}
|
@ -348,6 +348,18 @@ public class WxMaApiUrlConstants {
|
||||
String AUDIT_RESULT = "https://api.weixin.qq.com/shop/audit/result";
|
||||
String GET_MINIAPP_CERTIFICATE = "https://api.weixin.qq.com/shop/audit/get_miniapp_certificate";
|
||||
}
|
||||
|
||||
interface Delivery {
|
||||
String GET_COMPANY_LIST = "https://api.weixin.qq.com/shop/delivery/get_company_list";
|
||||
String DELIVERY_SEND = "https://api.weixin.qq.com/shop/delivery/send";
|
||||
String DELIVERY_RECEIVE = "https://api.weixin.qq.com/shop/delivery/recieve";
|
||||
}
|
||||
|
||||
interface Aftersale {
|
||||
String AFTERSALE_ADD = "https://api.weixin.qq.com/shop/aftersale/add";
|
||||
String AFTERSALE_GET = "https://api.weixin.qq.com/shop/aftersale/get";
|
||||
String AFTERSALE_UPDATE = "https://api.weixin.qq.com/shop/aftersale/update";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user