Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【小程序】增加新版自定义交易组件获取售后单详情API #2797

Merged
merged 1 commit into from
Aug 28, 2022
Merged
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 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 String outProductId;
@SerializedName("out_sku_id")
private String 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,15 @@ 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();
}

}