Skip to content

Commit 9e0b87a

Browse files
lizhengwubinarywang
authored andcommitted
🎨 #3337 【视频号小店】 订单详情字段补充、售后新特性补充
1 parent 11d525c commit 9e0b87a

19 files changed

+507
-61
lines changed

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

+31-3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
import java.util.List;
55
import me.chanjar.weixin.channel.bean.after.AfterSaleInfoResponse;
66
import me.chanjar.weixin.channel.bean.after.AfterSaleListResponse;
7+
import me.chanjar.weixin.channel.bean.after.AfterSaleReasonResponse;
8+
import me.chanjar.weixin.channel.bean.after.AfterSaleRejectReasonResponse;
79
import me.chanjar.weixin.channel.bean.base.WxChannelBaseResponse;
810
import me.chanjar.weixin.channel.bean.complaint.ComplaintOrderResponse;
911
import me.chanjar.weixin.common.error.WxErrorException;
@@ -39,26 +41,31 @@ AfterSaleListResponse listIds(Long beginCreateTime, Long endCreateTime, String n
3941
AfterSaleInfoResponse get(String afterSaleOrderId) throws WxErrorException;
4042

4143
/**
42-
* 同意退款
44+
* 同意售后
45+
* 文档地址 https://developers.weixin.qq.com/doc/channels/API/aftersale/acceptapply.html
4346
*
4447
* @param afterSaleOrderId 售后单号
4548
* @param addressId 同意退货时传入地址id
49+
* @param acceptType 1. 同意退货退款,并通知用户退货; 2. 确认收到货并退款给用户。 如果不填则将根据当前的售后单状态自动选择相应操作。对于仅退款的情况,由于只存在一种同意的场景,无需填写此字段。
4650
* @return BaseResponse
4751
*
4852
* @throws WxErrorException 异常
4953
*/
50-
WxChannelBaseResponse accept(String afterSaleOrderId, String addressId) throws WxErrorException;
54+
WxChannelBaseResponse accept(String afterSaleOrderId, String addressId, Integer acceptType) throws WxErrorException;
5155

5256
/**
5357
* 拒绝售后
58+
* 文档地址 https://developers.weixin.qq.com/doc/channels/API/aftersale/rejectapply.html
5459
*
5560
* @param afterSaleOrderId 售后单号
5661
* @param rejectReason 拒绝原因
62+
* @param rejectReasonType 拒绝原因枚举值
63+
* @see #getRejectReason()
5764
* @return BaseResponse
5865
*
5966
* @throws WxErrorException 异常
6067
*/
61-
WxChannelBaseResponse reject(String afterSaleOrderId, String rejectReason) throws WxErrorException;
68+
WxChannelBaseResponse reject(String afterSaleOrderId, String rejectReason, Integer rejectReasonType) throws WxErrorException;
6269

6370
/**
6471
* 上传退款凭证
@@ -108,4 +115,25 @@ WxChannelBaseResponse addComplaintEvidence(String complaintId, String content, L
108115
* @throws WxErrorException 异常
109116
*/
110117
ComplaintOrderResponse getComplaint(String complaintId) throws WxErrorException;
118+
119+
120+
/**
121+
* 获取全量售后原因
122+
* 文档地址:https://developers.weixin.qq.com/doc/channels/API/aftersale/getaftersalereason.html
123+
*
124+
* @return 售后原因
125+
*
126+
* @throws WxErrorException 异常
127+
*/
128+
AfterSaleReasonResponse getAllReason() throws WxErrorException;
129+
130+
/**
131+
* 获取拒绝售后原因
132+
* 文档地址:https://developers.weixin.qq.com/doc/channels/API/aftersale/getrejectreason.html
133+
*
134+
* @return 拒绝售后原因
135+
*
136+
* @throws WxErrorException 异常
137+
*/
138+
AfterSaleRejectReasonResponse getRejectReason() throws WxErrorException;
111139
}

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

+22-21
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,19 @@
11
package me.chanjar.weixin.channel.api.impl;
22

3-
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.AfterSale.AFTER_SALE_ACCEPT_URL;
4-
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.AfterSale.AFTER_SALE_GET_URL;
5-
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.AfterSale.AFTER_SALE_LIST_URL;
6-
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.AfterSale.AFTER_SALE_REJECT_URL;
7-
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.AfterSale.AFTER_SALE_UPLOAD_URL;
8-
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Complaint.ADD_COMPLAINT_MATERIAL_URL;
9-
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Complaint.ADD_COMPLAINT_PROOF_URL;
10-
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Complaint.GET_COMPLAINT_ORDER_URL;
11-
12-
import java.util.List;
133
import lombok.extern.slf4j.Slf4j;
144
import me.chanjar.weixin.channel.api.WxChannelAfterSaleService;
15-
import me.chanjar.weixin.channel.bean.after.AfterSaleAcceptParam;
16-
import me.chanjar.weixin.channel.bean.after.AfterSaleIdParam;
17-
import me.chanjar.weixin.channel.bean.after.AfterSaleInfoResponse;
18-
import me.chanjar.weixin.channel.bean.after.AfterSaleListParam;
19-
import me.chanjar.weixin.channel.bean.after.AfterSaleListResponse;
20-
import me.chanjar.weixin.channel.bean.after.AfterSaleRejectParam;
21-
import me.chanjar.weixin.channel.bean.after.RefundEvidenceParam;
5+
import me.chanjar.weixin.channel.bean.after.*;
226
import me.chanjar.weixin.channel.bean.base.WxChannelBaseResponse;
237
import me.chanjar.weixin.channel.bean.complaint.ComplaintOrderResponse;
248
import me.chanjar.weixin.channel.bean.complaint.ComplaintParam;
259
import me.chanjar.weixin.channel.util.ResponseUtils;
2610
import me.chanjar.weixin.common.error.WxErrorException;
2711

12+
import java.util.List;
13+
14+
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.AfterSale.*;
15+
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Complaint.*;
16+
2817
/**
2918
* 视频号小店 售后服务实现
3019
*
@@ -56,15 +45,15 @@ public AfterSaleInfoResponse get(String afterSaleOrderId) throws WxErrorExceptio
5645
}
5746

5847
@Override
59-
public WxChannelBaseResponse accept(String afterSaleOrderId, String addressId) throws WxErrorException {
60-
AfterSaleAcceptParam param = new AfterSaleAcceptParam(afterSaleOrderId, addressId);
48+
public WxChannelBaseResponse accept(String afterSaleOrderId, String addressId, Integer acceptType) throws WxErrorException {
49+
AfterSaleAcceptParam param = new AfterSaleAcceptParam(afterSaleOrderId, addressId, acceptType);
6150
String resJson = shopService.post(AFTER_SALE_ACCEPT_URL, param);
6251
return ResponseUtils.decode(resJson, WxChannelBaseResponse.class);
6352
}
6453

6554
@Override
66-
public WxChannelBaseResponse reject(String afterSaleOrderId, String rejectReason) throws WxErrorException {
67-
AfterSaleRejectParam param = new AfterSaleRejectParam(afterSaleOrderId, rejectReason);
55+
public WxChannelBaseResponse reject(String afterSaleOrderId, String rejectReason, Integer rejectReasonType) throws WxErrorException {
56+
AfterSaleRejectParam param = new AfterSaleRejectParam(afterSaleOrderId, rejectReason, rejectReasonType);
6857
String resJson = shopService.post(AFTER_SALE_REJECT_URL, param);
6958
return ResponseUtils.decode(resJson, WxChannelBaseResponse.class);
7059
}
@@ -100,4 +89,16 @@ public ComplaintOrderResponse getComplaint(String complaintId) throws WxErrorExc
10089
String resJson = shopService.post(GET_COMPLAINT_ORDER_URL, reqJson);
10190
return ResponseUtils.decode(resJson, ComplaintOrderResponse.class);
10291
}
92+
93+
@Override
94+
public AfterSaleReasonResponse getAllReason() throws WxErrorException {
95+
String resJson = shopService.post(AFTER_SALE_REASON_GET_URL, "{}");
96+
return ResponseUtils.decode(resJson, AfterSaleReasonResponse.class);
97+
}
98+
99+
@Override
100+
public AfterSaleRejectReasonResponse getRejectReason() throws WxErrorException {
101+
String resJson = shopService.post(AFTER_SALE_REJECT_REASON_GET_URL, "{}");
102+
return ResponseUtils.decode(resJson, AfterSaleRejectReasonResponse.class);
103+
}
103104
}

Diff for: weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/after/AfterSaleAcceptParam.java

+10
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,21 @@ public class AfterSaleAcceptParam extends AfterSaleIdParam {
1919
@JsonProperty("address_id")
2020
private String addressId;
2121

22+
/** 针对退货退款同意售后的阶段: 1. 同意退货退款,并通知用户退货; 2. 确认收到货并退款给用户。 如果不填则将根据当前的售后单状态自动选择相应操作。对于仅退款的情况,由于只存在一种同意的场景,无需填写此字段。*/
23+
@JsonProperty("accept_type")
24+
private Integer acceptType;
25+
2226
public AfterSaleAcceptParam() {
2327
}
2428

2529
public AfterSaleAcceptParam(String afterSaleOrderId, String addressId) {
2630
super(afterSaleOrderId);
2731
this.addressId = addressId;
2832
}
33+
34+
public AfterSaleAcceptParam(String afterSaleOrderId, String addressId, Integer acceptType) {
35+
super(afterSaleOrderId);
36+
this.addressId = addressId;
37+
this.acceptType = acceptType;
38+
}
2939
}

Diff for: weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/after/AfterSaleInfo.java

+4
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,8 @@ public class AfterSaleInfo implements Serializable {
8282
/** 纠纷id,该字段可用于获取纠纷信息 */
8383
@JsonProperty("complaint_id")
8484
private String complaintId;
85+
86+
/** 仅在待商家审核退款退货申请或收货期间返回,表示操作剩余时间(秒数)*/
87+
@JsonProperty("deadline")
88+
private Long deadline;
8589
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package me.chanjar.weixin.channel.bean.after;
2+
3+
import com.fasterxml.jackson.annotation.JsonProperty;
4+
import lombok.Data;
5+
import lombok.NoArgsConstructor;
6+
7+
import java.io.Serializable;
8+
9+
/**
10+
* 全量售后原因
11+
*
12+
* @author lizhengwu
13+
* @date 2024/7/24
14+
*/
15+
@Data
16+
@NoArgsConstructor
17+
public class AfterSaleReason implements Serializable {
18+
19+
private static final long serialVersionUID = -3674527884494606230L;
20+
21+
/**
22+
* 售后原因枚举
23+
*/
24+
@JsonProperty("reason")
25+
private Integer reason;
26+
27+
/**
28+
* 售后原因说明
29+
*/
30+
@JsonProperty("reason_text")
31+
private String reasonText;
32+
33+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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+
import java.util.List;
10+
11+
/**
12+
* 售后原因
13+
*
14+
*
15+
* @author lizhengwu
16+
*/
17+
@Data
18+
@NoArgsConstructor
19+
@EqualsAndHashCode
20+
public class AfterSaleReasonResponse extends WxChannelBaseResponse {
21+
22+
23+
private static final long serialVersionUID = -580378623915041396L;
24+
25+
@JsonProperty("reason_list")
26+
private List<AfterSaleReason> reasonList;
27+
28+
}

Diff for: weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/after/AfterSaleRejectParam.java

+15-1
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,29 @@
1515
public class AfterSaleRejectParam extends AfterSaleIdParam {
1616

1717
private static final long serialVersionUID = -7507483859864253314L;
18-
/** 拒绝原因 */
18+
/**
19+
* 拒绝原因
20+
*/
1921
@JsonProperty("reject_reason")
2022
private String rejectReason;
2123

24+
/**
25+
* 拒绝原因枚举值
26+
*/
27+
@JsonProperty("reject_reason_type")
28+
private Integer rejectReasonType;
29+
2230
public AfterSaleRejectParam() {
2331
}
2432

2533
public AfterSaleRejectParam(String afterSaleOrderId, String rejectReason) {
2634
super(afterSaleOrderId);
2735
this.rejectReason = rejectReason;
2836
}
37+
38+
public AfterSaleRejectParam(String afterSaleOrderId, String rejectReason, Integer rejectReasonType) {
39+
super(afterSaleOrderId);
40+
this.rejectReason = rejectReason;
41+
this.rejectReasonType = rejectReasonType;
42+
}
2943
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package me.chanjar.weixin.channel.bean.after;
2+
3+
import com.fasterxml.jackson.annotation.JsonProperty;
4+
import lombok.Data;
5+
import lombok.NoArgsConstructor;
6+
7+
import java.io.Serializable;
8+
9+
/**
10+
* 拒绝售后原因
11+
*
12+
* @author lizhengwu
13+
* @date 2024/7/24
14+
*/
15+
@Data
16+
@NoArgsConstructor
17+
public class AfterSaleRejectReason implements Serializable {
18+
19+
private static final long serialVersionUID = -3672834150982780L;
20+
21+
/**
22+
* 售后拒绝原因枚举
23+
*/
24+
@JsonProperty("reject_reason_type")
25+
private Integer rejectReasonType;
26+
27+
/**
28+
* 售后拒绝原因说明
29+
*/
30+
@JsonProperty("reject_reason_type_text")
31+
private String rejectReasonTypeText;
32+
33+
/**
34+
* 售后拒绝原因默认描述
35+
*/
36+
@JsonProperty("reject_reason")
37+
private String rejectReason;
38+
39+
}
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.JsonProperty;
4+
import lombok.Data;
5+
import lombok.EqualsAndHashCode;
6+
import lombok.NoArgsConstructor;
7+
import me.chanjar.weixin.channel.bean.base.WxChannelBaseResponse;
8+
9+
import java.util.List;
10+
11+
/**
12+
* 售后原因
13+
*
14+
* @author lizhengwu
15+
*/
16+
@Data
17+
@NoArgsConstructor
18+
@EqualsAndHashCode
19+
public class AfterSaleRejectReasonResponse extends WxChannelBaseResponse {
20+
21+
private static final long serialVersionUID = -7946679037747710613L;
22+
23+
/**
24+
* 售后原因列表
25+
*/
26+
@JsonProperty("reject_reason_list")
27+
private List<AfterSaleRejectReason> rejectReasonList;
28+
29+
}

Diff for: weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/after/RefundInfo.java

+4
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,8 @@ public class RefundInfo implements Serializable {
1818
/** 退款金额(分) */
1919
@JsonProperty("amount")
2020
private Integer amount;
21+
22+
/** 标明售后单退款直接原因, 枚举值详情请参考 {@link me.chanjar.weixin.channel.enums.RefundReason} */
23+
@JsonProperty("refund_reason")
24+
private Integer refundReason;
2125
}

0 commit comments

Comments
 (0)