Skip to content

Commit 7795387

Browse files
authored
🆕 #4106 【视频号】支持售后保障单相关接口
1 parent ade05b7 commit 7795387

13 files changed

Lines changed: 589 additions & 0 deletions

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,6 @@ sonar-project.properties
5555
.factorypath
5656
*.zip
5757
.worktrees
58+
59+
# Local Superpowers working documents; do not commit.
60+
/docs/superpowers/

weixin-java-channel/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,11 @@
8484
<artifactId>testng</artifactId>
8585
<scope>test</scope>
8686
</dependency>
87+
<dependency>
88+
<groupId>org.mockito</groupId>
89+
<artifactId>mockito-core</artifactId>
90+
<scope>test</scope>
91+
</dependency>
8792
<dependency>
8893
<groupId>ch.qos.logback</groupId>
8994
<artifactId>logback-classic</artifactId>

weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/WxChannelAfterSaleService.java

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,4 +199,76 @@ WxChannelBaseResponse addComplaintEvidence(String complaintId, String content, L
199199
* @throws WxErrorException 异常
200200
*/
201201
WxChannelBaseResponse merchantUpdateAfterSale(AfterSaleMerchantUpdateParam param) throws WxErrorException;
202+
203+
/**
204+
* 获取保障单列表。
205+
* 文档地址:https://developers.weixin.qq.com/doc/channels/API/channels-shop-aftersale/guarantee/api_searchguaranteeorder
206+
*
207+
* @param param 查询参数
208+
* @return 保障单列表
209+
* @throws WxErrorException 异常
210+
*/
211+
default GuaranteeOrderListResponse listGuaranteeOrder(GuaranteeOrderListParam param) throws WxErrorException {
212+
throw new UnsupportedOperationException();
213+
}
214+
215+
/**
216+
* 获取保障单详情。
217+
* 文档地址:https://developers.weixin.qq.com/doc/channels/API/channels-shop-aftersale/guarantee/api_getguaranteeorder
218+
*
219+
* @param guaranteeOrderId 保障单号
220+
* @return 保障单详情
221+
* @throws WxErrorException 异常
222+
*/
223+
default GuaranteeOrderInfoResponse getGuaranteeOrder(String guaranteeOrderId) throws WxErrorException {
224+
throw new UnsupportedOperationException();
225+
}
226+
227+
/**
228+
* 同意保障单申请。
229+
* 文档地址:https://developers.weixin.qq.com/doc/channels/API/channels-shop-aftersale/guarantee/api_merchantacceptguarantee
230+
*
231+
* @param guaranteeOrderId 保障单号
232+
* @return 响应结果
233+
* @throws WxErrorException 异常
234+
*/
235+
default WxChannelBaseResponse acceptGuarantee(String guaranteeOrderId) throws WxErrorException {
236+
throw new UnsupportedOperationException();
237+
}
238+
239+
/**
240+
* 商家协商保障单。
241+
* 文档地址:https://developers.weixin.qq.com/doc/channels/API/channels-shop-aftersale/guarantee/api_merchantmodifyguarantee
242+
*
243+
* @param request 协商参数
244+
* @return 响应结果
245+
* @throws WxErrorException 异常
246+
*/
247+
default WxChannelBaseResponse modifyGuarantee(GuaranteeModifyRequest request) throws WxErrorException {
248+
throw new UnsupportedOperationException();
249+
}
250+
251+
/**
252+
* 商家举证保障单。
253+
* 文档地址:https://developers.weixin.qq.com/doc/channels/API/channels-shop-aftersale/guarantee/api_merchantproofguarantee
254+
*
255+
* @param request 举证参数
256+
* @return 响应结果
257+
* @throws WxErrorException 异常
258+
*/
259+
default WxChannelBaseResponse proofGuarantee(GuaranteeProofRequest request) throws WxErrorException {
260+
throw new UnsupportedOperationException();
261+
}
262+
263+
/**
264+
* 拒绝保障单申请。
265+
* 文档地址:https://developers.weixin.qq.com/doc/channels/API/channels-shop-aftersale/guarantee/api_merchantrefuseguarantee
266+
*
267+
* @param request 拒绝参数
268+
* @return 响应结果
269+
* @throws WxErrorException 异常
270+
*/
271+
default WxChannelBaseResponse refuseGuarantee(GuaranteeRefuseRequest request) throws WxErrorException {
272+
throw new UnsupportedOperationException();
273+
}
202274
}

weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/impl/WxChannelAfterSaleServiceImpl.java

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,4 +136,42 @@ public WxChannelBaseResponse merchantUpdateAfterSale(AfterSaleMerchantUpdatePara
136136
return ResponseUtils.decode(resJson, WxChannelBaseResponse.class);
137137
}
138138

139+
@Override
140+
public GuaranteeOrderListResponse listGuaranteeOrder(GuaranteeOrderListParam param) throws WxErrorException {
141+
String resJson = shopService.post(GUARANTEE_ORDER_LIST_URL, param);
142+
return ResponseUtils.decode(resJson, GuaranteeOrderListResponse.class);
143+
}
144+
145+
@Override
146+
public GuaranteeOrderInfoResponse getGuaranteeOrder(String guaranteeOrderId) throws WxErrorException {
147+
GuaranteeOrderIdParam param = new GuaranteeOrderIdParam(guaranteeOrderId);
148+
String resJson = shopService.post(GUARANTEE_ORDER_GET_URL, param);
149+
return ResponseUtils.decode(resJson, GuaranteeOrderInfoResponse.class);
150+
}
151+
152+
@Override
153+
public WxChannelBaseResponse acceptGuarantee(String guaranteeOrderId) throws WxErrorException {
154+
GuaranteeOrderIdParam param = new GuaranteeOrderIdParam(guaranteeOrderId);
155+
String resJson = shopService.post(GUARANTEE_ORDER_ACCEPT_URL, param);
156+
return ResponseUtils.decode(resJson, WxChannelBaseResponse.class);
157+
}
158+
159+
@Override
160+
public WxChannelBaseResponse modifyGuarantee(GuaranteeModifyRequest request) throws WxErrorException {
161+
String resJson = shopService.post(GUARANTEE_ORDER_MODIFY_URL, request);
162+
return ResponseUtils.decode(resJson, WxChannelBaseResponse.class);
163+
}
164+
165+
@Override
166+
public WxChannelBaseResponse proofGuarantee(GuaranteeProofRequest request) throws WxErrorException {
167+
String resJson = shopService.post(GUARANTEE_ORDER_PROOF_URL, request);
168+
return ResponseUtils.decode(resJson, WxChannelBaseResponse.class);
169+
}
170+
171+
@Override
172+
public WxChannelBaseResponse refuseGuarantee(GuaranteeRefuseRequest request) throws WxErrorException {
173+
String resJson = shopService.post(GUARANTEE_ORDER_REFUSE_URL, request);
174+
return ResponseUtils.decode(resJson, WxChannelBaseResponse.class);
175+
}
176+
139177
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package me.chanjar.weixin.channel.bean.after;
2+
3+
import com.fasterxml.jackson.annotation.JsonInclude;
4+
import com.fasterxml.jackson.annotation.JsonInclude.Include;
5+
import com.fasterxml.jackson.annotation.JsonProperty;
6+
import lombok.Data;
7+
import lombok.EqualsAndHashCode;
8+
import lombok.NoArgsConstructor;
9+
10+
/**
11+
* 商家协商保障单请求参数。
12+
*/
13+
@Data
14+
@NoArgsConstructor
15+
@EqualsAndHashCode(callSuper = true)
16+
@JsonInclude(Include.NON_NULL)
17+
public class GuaranteeModifyRequest extends GuaranteeOrderIdParam {
18+
19+
private static final long serialVersionUID = 4268864541609439068L;
20+
21+
/** 商品破损程度。 */
22+
@JsonProperty("bad_level")
23+
private Integer badLevel;
24+
25+
/** 商家协商备注。 */
26+
@JsonProperty("merchant_remark")
27+
private String merchantRemark;
28+
29+
public GuaranteeModifyRequest(String guaranteeOrderId, Integer badLevel, String merchantRemark) {
30+
super(guaranteeOrderId);
31+
this.badLevel = badLevel;
32+
this.merchantRemark = merchantRemark;
33+
}
34+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package me.chanjar.weixin.channel.bean.after;
2+
3+
import com.fasterxml.jackson.annotation.JsonInclude;
4+
import com.fasterxml.jackson.annotation.JsonInclude.Include;
5+
import com.fasterxml.jackson.annotation.JsonProperty;
6+
import java.io.Serializable;
7+
import lombok.AllArgsConstructor;
8+
import lombok.Data;
9+
import lombok.NoArgsConstructor;
10+
11+
/**
12+
* 保障单号参数。
13+
*/
14+
@Data
15+
@NoArgsConstructor
16+
@AllArgsConstructor
17+
@JsonInclude(Include.NON_NULL)
18+
public class GuaranteeOrderIdParam implements Serializable {
19+
20+
private static final long serialVersionUID = -6638498743123537413L;
21+
22+
/** 保障单号。 */
23+
@JsonProperty("guarantee_order_id")
24+
private String guaranteeOrderId;
25+
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
package me.chanjar.weixin.channel.bean.after;
2+
3+
import com.fasterxml.jackson.annotation.JsonProperty;
4+
import java.io.Serializable;
5+
import lombok.Data;
6+
import lombok.EqualsAndHashCode;
7+
import lombok.NoArgsConstructor;
8+
import me.chanjar.weixin.channel.bean.base.WxChannelBaseResponse;
9+
10+
/**
11+
* 保障单详情响应。
12+
*/
13+
@Data
14+
@NoArgsConstructor
15+
@EqualsAndHashCode(callSuper = true)
16+
public class GuaranteeOrderInfoResponse extends WxChannelBaseResponse {
17+
18+
private static final long serialVersionUID = 7354122991247317485L;
19+
20+
/** 保障单详情。 */
21+
@JsonProperty("guarantee_order")
22+
private GuaranteeOrder guaranteeOrder;
23+
24+
/**
25+
* 保障单详情。
26+
*/
27+
@Data
28+
@NoArgsConstructor
29+
public static class GuaranteeOrder implements Serializable {
30+
31+
private static final long serialVersionUID = -2398976447575813507L;
32+
33+
/** 保障单号。 */
34+
@JsonProperty("guarantee_order_id")
35+
private String guaranteeOrderId;
36+
37+
/** 保障单状态。 */
38+
@JsonProperty("status")
39+
private String status;
40+
41+
/** 商品信息。 */
42+
@JsonProperty("product_info")
43+
private ProductInfo productInfo;
44+
}
45+
46+
/**
47+
* 详情商品信息。
48+
*/
49+
@Data
50+
@NoArgsConstructor
51+
public static class ProductInfo implements Serializable {
52+
53+
private static final long serialVersionUID = -2455740986246085934L;
54+
55+
/** 商品 SPU ID。 */
56+
@JsonProperty("product_id")
57+
private String productId;
58+
}
59+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
package me.chanjar.weixin.channel.bean.after;
2+
3+
import com.fasterxml.jackson.annotation.JsonInclude;
4+
import com.fasterxml.jackson.annotation.JsonInclude.Include;
5+
import com.fasterxml.jackson.annotation.JsonProperty;
6+
import java.io.Serializable;
7+
import java.util.List;
8+
import lombok.Data;
9+
import lombok.NoArgsConstructor;
10+
11+
/**
12+
* 保障单列表请求参数。
13+
*/
14+
@Data
15+
@NoArgsConstructor
16+
@JsonInclude(Include.NON_NULL)
17+
public class GuaranteeOrderListParam implements Serializable {
18+
19+
private static final long serialVersionUID = 1622570776364341988L;
20+
21+
@JsonProperty("guarantee_order_id_list")
22+
private List<String> guaranteeOrderIdList;
23+
24+
@JsonProperty("order_id_list")
25+
private List<String> orderIdList;
26+
27+
@JsonProperty("type")
28+
private Integer type;
29+
30+
@JsonProperty("begin_time")
31+
private Long beginTime;
32+
33+
@JsonProperty("end_time")
34+
private Long endTime;
35+
36+
@JsonProperty("status_list")
37+
private String statusList;
38+
39+
@JsonProperty("offset")
40+
private Integer offset;
41+
42+
@JsonProperty("limit")
43+
private Integer limit;
44+
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
package me.chanjar.weixin.channel.bean.after;
2+
3+
import com.fasterxml.jackson.annotation.JsonProperty;
4+
import java.io.Serializable;
5+
import java.util.List;
6+
import lombok.Data;
7+
import lombok.EqualsAndHashCode;
8+
import lombok.NoArgsConstructor;
9+
import me.chanjar.weixin.channel.bean.base.WxChannelBaseResponse;
10+
11+
/**
12+
* 保障单列表响应。
13+
*/
14+
@Data
15+
@NoArgsConstructor
16+
@EqualsAndHashCode(callSuper = true)
17+
public class GuaranteeOrderListResponse extends WxChannelBaseResponse {
18+
19+
private static final long serialVersionUID = 9105476087203713187L;
20+
21+
/** 保障单总数。 */
22+
@JsonProperty("total_num")
23+
private Integer totalNum;
24+
25+
/** 保障单列表。 */
26+
@JsonProperty("guarantee_order_list")
27+
private List<GuaranteeOrder> guaranteeOrderList;
28+
29+
/**
30+
* 保障单列表项。
31+
*/
32+
@Data
33+
@NoArgsConstructor
34+
public static class GuaranteeOrder implements Serializable {
35+
36+
private static final long serialVersionUID = 7151952524213202281L;
37+
38+
/** 保障单号。 */
39+
@JsonProperty("guarantee_order_id")
40+
private String guaranteeOrderId;
41+
42+
/** 保障单状态。 */
43+
@JsonProperty("status")
44+
private String status;
45+
46+
/** 商品信息列表。 */
47+
@JsonProperty("product_info")
48+
private List<ProductInfo> productInfo;
49+
}
50+
51+
/**
52+
* 列表商品信息。
53+
*/
54+
@Data
55+
@NoArgsConstructor
56+
public static class ProductInfo implements Serializable {
57+
58+
private static final long serialVersionUID = -2565763879505631638L;
59+
60+
/** 商品 SPU ID。 */
61+
@JsonProperty("product_id")
62+
private String productId;
63+
}
64+
}

0 commit comments

Comments
 (0)