Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
package cn.binarywang.wx.miniapp.api;

import cn.binarywang.wx.miniapp.bean.shop.request.WxMaShopAcceptReturnRequest;
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.WxMaShopAfterSaleListRequest;
import cn.binarywang.wx.miniapp.bean.shop.request.WxMaShopAfterSaleUpdateRequest;
import cn.binarywang.wx.miniapp.bean.shop.request.WxMaShopAfterSaleUploadReturnInfoRequest;
import cn.binarywang.wx.miniapp.bean.shop.request.WxMaShopUploadCerficatesRequest;
import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopAfterSaleAddResponse;
import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopAfterSaleGetResponse;
import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopAfterSaleListResponse;
import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopBaseResponse;
import cn.binarywang.wx.miniapp.bean.shop.request.*;
import cn.binarywang.wx.miniapp.bean.shop.response.*;
import me.chanjar.weixin.common.error.WxErrorException;

/**
Expand Down Expand Up @@ -38,6 +29,15 @@ public interface WxMaShopAfterSaleService {
*/
WxMaShopAfterSaleGetResponse get(WxMaShopAfterSaleGetRequest request) throws WxErrorException;

/**
* 获取售后单详情(EC版)
*
* @param request
* @return WxMaShopEcAfterSaleGetResponse
* @throws WxErrorException
*/
WxMaShopEcAfterSaleGetResponse get(WxMaShopEcAfterSaleGetRequest request) throws WxErrorException;

/**
* 更新售后
*
Expand All @@ -49,9 +49,10 @@ public interface WxMaShopAfterSaleService {

/**
* 用户取消售后申请
*
* @param outAfterSaleId 商家自定义订单ID
* @param afterSaleId 与out_aftersale_id二选一
* @param openId 用户openid
* @param afterSaleId 与out_aftersale_id二选一
* @param openId 用户openid
* @return
* @throws WxErrorException
*/
Expand All @@ -60,6 +61,7 @@ WxMaShopBaseResponse cancel(String outAfterSaleId, Long afterSaleId, String open

/**
* 用户上传退货物流
*
* @param request
* @return
* @throws WxErrorException
Expand All @@ -69,6 +71,7 @@ WxMaShopBaseResponse uploadReturnInfo(WxMaShopAfterSaleUploadReturnInfoRequest r

/**
* 商家同意退款
*
* @param outAfterSaleId
* @param afterSaleId
* @return
Expand All @@ -79,6 +82,7 @@ WxMaShopBaseResponse acceptRefund(String outAfterSaleId, Long afterSaleId)

/**
* 商家同意退货
*
* @param request
* @return
* @throws WxErrorException
Expand All @@ -88,6 +92,7 @@ WxMaShopBaseResponse acceptReturn(WxMaShopAcceptReturnRequest request)

/**
* 商家拒绝售后
*
* @param outAfterSaleId
* @param afterSaleId
* @return
Expand All @@ -98,6 +103,7 @@ WxMaShopBaseResponse reject(String outAfterSaleId, Long afterSaleId)

/**
* 商家上传退款凭证
*
* @param request
* @return
* @throws WxErrorException
Expand All @@ -107,6 +113,7 @@ WxMaShopBaseResponse uploadCertificates(WxMaShopUploadCerficatesRequest request)

/**
* 商家更新订单售后期
*
* @param outOrderId
* @param orderId
* @param openid
Expand All @@ -115,10 +122,11 @@ WxMaShopBaseResponse uploadCertificates(WxMaShopUploadCerficatesRequest request)
* @throws WxErrorException
*/
WxMaShopBaseResponse updateDeadline(String outOrderId, Long orderId, String openid,
Long afterSaleDeadline) throws WxErrorException;
Long afterSaleDeadline) throws WxErrorException;

/**
* 获取售后单详情
*
* @param request
* @return
* @throws WxErrorException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,8 @@

import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.api.WxMaShopAfterSaleService;
import cn.binarywang.wx.miniapp.bean.shop.request.WxMaShopAcceptReturnRequest;
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.WxMaShopAfterSaleListRequest;
import cn.binarywang.wx.miniapp.bean.shop.request.WxMaShopAfterSaleUpdateRequest;
import cn.binarywang.wx.miniapp.bean.shop.request.WxMaShopAfterSaleUploadReturnInfoRequest;
import cn.binarywang.wx.miniapp.bean.shop.request.WxMaShopUploadCerficatesRequest;
import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopAfterSaleAddResponse;
import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopAfterSaleGetResponse;
import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopAfterSaleListResponse;
import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopBaseResponse;
import cn.binarywang.wx.miniapp.bean.shop.request.*;
import cn.binarywang.wx.miniapp.bean.shop.response.*;
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
import com.google.gson.JsonObject;
import lombok.RequiredArgsConstructor;
Expand Down Expand Up @@ -70,6 +61,23 @@ public WxMaShopAfterSaleGetResponse get(WxMaShopAfterSaleGetRequest request) thr
return WxMaGsonBuilder.create().fromJson(responseContent, WxMaShopAfterSaleGetResponse.class);
}

/**
* 获取售后单详情(EC版)
*
* @param request
* @return WxMaShopEcAfterSaleGetResponse
* @throws WxErrorException
*/
@Override
public WxMaShopEcAfterSaleGetResponse get(WxMaShopEcAfterSaleGetRequest request) throws WxErrorException {
String responseContent = this.wxMaService.post(ECAFTERSALE_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, WxMaShopEcAfterSaleGetResponse.class);
}

/**
* 更新售后
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package cn.binarywang.wx.miniapp.bean.shop.request;

import com.google.gson.annotations.SerializedName;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
* @author liming1019
* created on 2022/8/25
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class WxMaShopEcAfterSaleGetRequest implements Serializable {

private static final long serialVersionUID = -1967384908983649001L;

@SerializedName("aftersale_id")
private Long aftersaleId;
@SerializedName("out_aftersale_id")
private String outAftersaleId;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
package cn.binarywang.wx.miniapp.bean.shop.response;

import com.google.gson.annotations.SerializedName;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;

/**
* @author liming1019
* created on 2022/8/25
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class WxMaShopEcAfterSaleGetResponse extends WxMaShopBaseResponse implements Serializable {

private static final long serialVersionUID = -338753264205536337L;

@SerializedName("after_sales_order")
private AfterSalesOrderDTO afterSalesOrder;

@Data
public static class AfterSalesOrderDTO implements Serializable {
@SerializedName("out_aftersale_id")
private String outAftersaleId;
@SerializedName("aftersale_id")
private Long aftersaleId;
@SerializedName("out_order_id")
private String outOrderId;
@SerializedName("order_id")
private Long orderId;
@SerializedName("product_info")
private ProductInfoDTO productInfo;
@SerializedName("type")
private Integer type;
@SerializedName("return_info")
private ReturnInfoDTO returnInfo;
@SerializedName("orderamt")
private Integer orderamt;
@SerializedName("refund_reason_type")
private Integer refundReasonType;
@SerializedName("refund_reason")
private String refundReason;
@SerializedName("status")
private Integer status;
@SerializedName("create_time")
private String createTime;
@SerializedName("update_time")
private String updateTime;

@Data
public static class ProductInfoDTO implements Serializable {
@SerializedName("out_product_id")
private Integer outProductId;
@SerializedName("out_sku_id")
private Integer outSkuId;
@SerializedName("product_cnt")
private Integer productCnt;
}

@Data
public static class ReturnInfoDTO implements Serializable {
@SerializedName("order_return_time")
private String orderReturnTime;
@SerializedName("delivery_id")
private String deliveryId;
@SerializedName("waybill_id")
private String waybillId;
@SerializedName("delivery_name")
private String deliveryName;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,8 @@ interface Aftersale {
String AFTERSALE_UPLOAD_CERTIFICATES = "https://api.weixin.qq.com/shop/ecaftersale/upload_certificates";
String AFTERSALE_UPLOAD_DEADLINE = "https://api.weixin.qq.com/shop/aftersale/update_deadline";
String AFTERSALE_GET_LIST = "https://api.weixin.qq.com/shop/ecaftersale/get_list";
String AFTERSALE_GET = "https://api.weixin.qq.com/shop/ecaftersale/get";
String AFTERSALE_GET = "https://api.weixin.qq.com/shop/aftersale/get";
String ECAFTERSALE_GET = "https://api.weixin.qq.com/shop/ecaftersale/get";
}

interface Sharer {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
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.request.WxMaShopEcAfterSaleGetRequest;
import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopAfterSaleGetResponse;
import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopBaseResponse;
import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopEcAfterSaleGetResponse;
import cn.binarywang.wx.miniapp.test.ApiTestModule;
import com.google.inject.Inject;
import me.chanjar.weixin.common.error.WxErrorException;
Expand Down Expand Up @@ -71,4 +73,14 @@ public void testUpdate() throws WxErrorException {
WxMaShopBaseResponse response = wxService.getShopAfterSaleService().update(request);
assertThat(response).isNotNull();
}

@Test
public void testEcGet() throws WxErrorException {
WxMaShopEcAfterSaleGetRequest request = WxMaShopEcAfterSaleGetRequest.builder()
.aftersaleId(123L)
.outAftersaleId("aso_123124341")
.build();
WxMaShopEcAfterSaleGetResponse response = wxService.getShopAfterSaleService().get(request);
assertThat(response).isNotNull();
}
}