Skip to content

Commit 1c17974

Browse files
authored
新增视频号小店保障单模块接口支持
1 parent 383881f commit 1c17974

12 files changed

Lines changed: 435 additions & 0 deletions

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

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,4 +183,67 @@ WxChannelBaseResponse addComplaintEvidence(String complaintId, String content, L
183183
* @throws WxErrorException 异常
184184
*/
185185
WxChannelBaseResponse merchantUpdateAfterSale(AfterSaleMerchantUpdateParam param) throws WxErrorException;
186+
187+
/**
188+
* 商家获取保障单列表
189+
* 文档地址:https://developers.weixin.qq.com/doc/channels/API/channels-shop-aftersale/guarantee/api_searchguaranteeorder
190+
*
191+
* @param param 参数
192+
* @return 保障单列表
193+
*
194+
* @throws WxErrorException 异常
195+
*/
196+
GuaranteeOrderListResponse listGuaranteeOrder(GuaranteeOrderListParam param) throws WxErrorException;
197+
198+
/**
199+
* 获取保障单详情
200+
* 文档地址:https://developers.weixin.qq.com/doc/channels/API/channels-shop-aftersale/guarantee/api_getguaranteeorder
201+
*
202+
* @param guaranteeOrderId 保障单号
203+
* @return 保障单详情
204+
*
205+
* @throws WxErrorException 异常
206+
*/
207+
GuaranteeOrderInfo getGuaranteeOrder(String guaranteeOrderId) throws WxErrorException;
208+
209+
/**
210+
* 商家同意保障单申请
211+
* 文档地址:https://developers.weixin.qq.com/doc/channels/API/channels-shop-aftersale/guarantee/api_merchantacceptguarantee
212+
*
213+
* @param guaranteeOrderId 保障单号
214+
*
215+
* @throws WxErrorException 异常
216+
*/
217+
void acceptGuarantee(String guaranteeOrderId) throws WxErrorException;
218+
219+
/**
220+
* 商家协商保障单
221+
* 文档地址:https://developers.weixin.qq.com/doc/channels/API/channels-shop-aftersale/guarantee/api_merchantmodifyguarantee
222+
*
223+
* @param req 参数
224+
*
225+
* @throws WxErrorException 异常
226+
*/
227+
void modifyGuarantee(GuaranteeModifyRequest req) throws WxErrorException;
228+
229+
/**
230+
* 商家举证保障单
231+
* 文档地址:https://developers.weixin.qq.com/doc/channels/API/channels-shop-aftersale/guarantee/api_merchantproofguarantee
232+
*
233+
* @param req 参数
234+
*
235+
* @throws WxErrorException 异常
236+
*/
237+
void proofGuarantee(GuaranteeProofRequest req) throws WxErrorException;
238+
239+
/**
240+
* 商家拒绝保障单申请
241+
* 文档地址:https://developers.weixin.qq.com/doc/channels/API/channels-shop-aftersale/guarantee/api_merchantrefuseguarantee
242+
*
243+
* @param guaranteeOrderId 保障单号
244+
* @param reason 拒绝原因
245+
*
246+
* @throws WxErrorException 异常
247+
*/
248+
void refuseGuarantee(String guaranteeOrderId, String reason) throws WxErrorException;
186249
}

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

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,4 +130,40 @@ public WxChannelBaseResponse merchantUpdateAfterSale(AfterSaleMerchantUpdatePara
130130
return ResponseUtils.decode(resJson, WxChannelBaseResponse.class);
131131
}
132132

133+
@Override
134+
public GuaranteeOrderListResponse listGuaranteeOrder(GuaranteeOrderListParam param) throws WxErrorException {
135+
String resJson = shopService.post(GUARANTEE_ORDER_LIST_URL, param);
136+
return ResponseUtils.decode(resJson, GuaranteeOrderListResponse.class);
137+
}
138+
139+
@Override
140+
public GuaranteeOrderInfo getGuaranteeOrder(String guaranteeOrderId) throws WxErrorException {
141+
GuaranteeOrderIdParam param = new GuaranteeOrderIdParam(guaranteeOrderId);
142+
String resJson = shopService.post(GUARANTEE_ORDER_GET_URL, param);
143+
GuaranteeOrderInfoResponse response = ResponseUtils.decode(resJson, GuaranteeOrderInfoResponse.class);
144+
return response.getGuaranteeOrder();
145+
}
146+
147+
@Override
148+
public void acceptGuarantee(String guaranteeOrderId) throws WxErrorException {
149+
GuaranteeOrderIdParam param = new GuaranteeOrderIdParam(guaranteeOrderId);
150+
shopService.post(GUARANTEE_ORDER_ACCEPT_URL, param);
151+
}
152+
153+
@Override
154+
public void modifyGuarantee(GuaranteeModifyRequest req) throws WxErrorException {
155+
shopService.post(GUARANTEE_ORDER_MODIFY_URL, req);
156+
}
157+
158+
@Override
159+
public void proofGuarantee(GuaranteeProofRequest req) throws WxErrorException {
160+
shopService.post(GUARANTEE_ORDER_PROOF_URL, req);
161+
}
162+
163+
@Override
164+
public void refuseGuarantee(String guaranteeOrderId, String reason) throws WxErrorException {
165+
GuaranteeRefuseRequest req = new GuaranteeRefuseRequest(guaranteeOrderId, reason);
166+
shopService.post(GUARANTEE_ORDER_REFUSE_URL, req);
167+
}
168+
133169
}
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 = -7142671437465099549L;
20+
21+
/** 协商金额(单位:分). */
22+
@JsonProperty("amount")
23+
private Integer amount;
24+
25+
/** 协商描述. */
26+
@JsonProperty("desc")
27+
private String desc;
28+
29+
public GuaranteeModifyRequest(String guaranteeOrderId, Integer amount, String desc) {
30+
super(guaranteeOrderId);
31+
this.amount = amount;
32+
this.desc = desc;
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+
* 保障单id参数.
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 = 773665483877442194L;
21+
22+
/** 保障单号. */
23+
@JsonProperty("guarantee_order_id")
24+
private String guaranteeOrderId;
25+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
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.NoArgsConstructor;
7+
8+
/**
9+
* 保障单信息.
10+
*/
11+
@Data
12+
@NoArgsConstructor
13+
public class GuaranteeOrderInfo implements Serializable {
14+
15+
private static final long serialVersionUID = -2590210285444450666L;
16+
17+
/** 保障单号. */
18+
@JsonProperty("guarantee_order_id")
19+
private String guaranteeOrderId;
20+
21+
/** 订单号. */
22+
@JsonProperty("order_id")
23+
private String orderId;
24+
25+
/** 保障单状态. */
26+
@JsonProperty("status")
27+
private Integer status;
28+
29+
/** 保障单类型. */
30+
@JsonProperty("type")
31+
private Integer type;
32+
33+
/** 申请原因. */
34+
@JsonProperty("reason")
35+
private String reason;
36+
37+
/** 创建时间. */
38+
@JsonProperty("create_time")
39+
private Long createTime;
40+
41+
/** 更新时间. */
42+
@JsonProperty("update_time")
43+
private Long updateTime;
44+
45+
/** 买家openid. */
46+
@JsonProperty("openid")
47+
private String openid;
48+
49+
/** 买家unionid. */
50+
@JsonProperty("unionid")
51+
private String unionid;
52+
53+
/** 商品信息. */
54+
@JsonProperty("product_info")
55+
private AfterSaleProductInfo productInfo;
56+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package me.chanjar.weixin.channel.bean.after;
2+
3+
import com.fasterxml.jackson.annotation.JsonProperty;
4+
import lombok.Data;
5+
import lombok.EqualsAndHashCode;
6+
import lombok.NoArgsConstructor;
7+
import me.chanjar.weixin.channel.bean.base.WxChannelBaseResponse;
8+
9+
/**
10+
* 保障单详情响应.
11+
*/
12+
@Data
13+
@NoArgsConstructor
14+
@EqualsAndHashCode(callSuper = true)
15+
public class GuaranteeOrderInfoResponse extends WxChannelBaseResponse {
16+
17+
private static final long serialVersionUID = 7532731716811792648L;
18+
19+
/** 保障单详情. */
20+
@JsonProperty("guarantee_order")
21+
private GuaranteeOrderInfo guaranteeOrder;
22+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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 GuaranteeOrderListParam implements Serializable {
19+
20+
private static final long serialVersionUID = -8822052330671632588L;
21+
22+
/** 订单创建启始时间 unix时间戳. */
23+
@JsonProperty("begin_create_time")
24+
private Long beginCreateTime;
25+
26+
/** 订单创建结束时间,end_create_time减去begin_create_time不得大于24小时 unix时间戳. */
27+
@JsonProperty("end_create_time")
28+
private Long endCreateTime;
29+
30+
/** 保障单更新起始时间. */
31+
@JsonProperty("begin_update_time")
32+
private Long beginUpdateTime;
33+
34+
/** 保障单更新结束时间,end_update_time减去begin_update_time不得大于24小时. */
35+
@JsonProperty("end_update_time")
36+
private Long endUpdateTime;
37+
38+
/** 翻页参数,从第二页开始传,来源于上一页的返回值. */
39+
@JsonProperty("next_key")
40+
private String nextKey;
41+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package me.chanjar.weixin.channel.bean.after;
2+
3+
import com.fasterxml.jackson.annotation.JsonProperty;
4+
import java.util.List;
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 GuaranteeOrderListResponse extends WxChannelBaseResponse {
17+
18+
private static final long serialVersionUID = -6136894046806166855L;
19+
20+
/** 保障单号列表. */
21+
@JsonProperty("guarantee_order_id_list")
22+
private List<String> guaranteeOrderIdList;
23+
24+
/** 翻页参数. */
25+
@JsonProperty("next_key")
26+
private String nextKey;
27+
28+
/** 是否还有数据. */
29+
@JsonProperty("has_more")
30+
private Boolean hasMore;
31+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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.util.List;
7+
import lombok.Data;
8+
import lombok.EqualsAndHashCode;
9+
import lombok.NoArgsConstructor;
10+
11+
/**
12+
* 商家举证保障单请求参数.
13+
*/
14+
@Data
15+
@NoArgsConstructor
16+
@EqualsAndHashCode(callSuper = true)
17+
@JsonInclude(Include.NON_NULL)
18+
public class GuaranteeProofRequest extends GuaranteeOrderIdParam {
19+
20+
private static final long serialVersionUID = -4521077589624343197L;
21+
22+
/** 举证图片media_id列表. */
23+
@JsonProperty("media_ids")
24+
private List<String> mediaIds;
25+
26+
/** 举证描述. */
27+
@JsonProperty("desc")
28+
private String desc;
29+
30+
public GuaranteeProofRequest(String guaranteeOrderId, List<String> mediaIds, String desc) {
31+
super(guaranteeOrderId);
32+
this.mediaIds = mediaIds;
33+
this.desc = desc;
34+
}
35+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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 GuaranteeRefuseRequest extends GuaranteeOrderIdParam {
18+
19+
private static final long serialVersionUID = 6632720364917208597L;
20+
21+
/** 拒绝原因. */
22+
@JsonProperty("reason")
23+
private String reason;
24+
25+
public GuaranteeRefuseRequest(String guaranteeOrderId, String reason) {
26+
super(guaranteeOrderId);
27+
this.reason = reason;
28+
}
29+
}

0 commit comments

Comments
 (0)