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

【视频号小店】 订单详情字段补充、售后新特性补充 #3337

Merged
merged 4 commits into from
Jul 29, 2024
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
Expand Up @@ -4,6 +4,8 @@
import java.util.List;
import me.chanjar.weixin.channel.bean.after.AfterSaleInfoResponse;
import me.chanjar.weixin.channel.bean.after.AfterSaleListResponse;
import me.chanjar.weixin.channel.bean.after.AfterSaleReasonResponse;
import me.chanjar.weixin.channel.bean.after.AfterSaleRejectReasonResponse;
import me.chanjar.weixin.channel.bean.base.WxChannelBaseResponse;
import me.chanjar.weixin.channel.bean.complaint.ComplaintOrderResponse;
import me.chanjar.weixin.common.error.WxErrorException;
Expand Down Expand Up @@ -39,26 +41,31 @@ AfterSaleListResponse listIds(Long beginCreateTime, Long endCreateTime, String n
AfterSaleInfoResponse get(String afterSaleOrderId) throws WxErrorException;

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

/**
* 拒绝售后
* 文档地址 https://developers.weixin.qq.com/doc/channels/API/aftersale/rejectapply.html
*
* @param afterSaleOrderId 售后单号
* @param rejectReason 拒绝原因
* @param rejectReasonType 拒绝原因枚举值
* @see #getRejectReason()
* @return BaseResponse
*
* @throws WxErrorException 异常
*/
WxChannelBaseResponse reject(String afterSaleOrderId, String rejectReason) throws WxErrorException;
WxChannelBaseResponse reject(String afterSaleOrderId, String rejectReason, Integer rejectReasonType) throws WxErrorException;

/**
* 上传退款凭证
Expand Down Expand Up @@ -108,4 +115,25 @@ WxChannelBaseResponse addComplaintEvidence(String complaintId, String content, L
* @throws WxErrorException 异常
*/
ComplaintOrderResponse getComplaint(String complaintId) throws WxErrorException;


/**
* 获取全量售后原因
* 文档地址:https://developers.weixin.qq.com/doc/channels/API/aftersale/getaftersalereason.html
*
* @return 售后原因
*
* @throws WxErrorException 异常
*/
AfterSaleReasonResponse getAllReason() throws WxErrorException;

/**
* 获取拒绝售后原因
* 文档地址:https://developers.weixin.qq.com/doc/channels/API/aftersale/getrejectreason.html
*
* @return 拒绝售后原因
*
* @throws WxErrorException 异常
*/
AfterSaleRejectReasonResponse getRejectReason() throws WxErrorException;
}
Original file line number Diff line number Diff line change
@@ -1,30 +1,19 @@
package me.chanjar.weixin.channel.api.impl;

import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.AfterSale.AFTER_SALE_ACCEPT_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.AfterSale.AFTER_SALE_GET_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.AfterSale.AFTER_SALE_LIST_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.AfterSale.AFTER_SALE_REJECT_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.AfterSale.AFTER_SALE_UPLOAD_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Complaint.ADD_COMPLAINT_MATERIAL_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Complaint.ADD_COMPLAINT_PROOF_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Complaint.GET_COMPLAINT_ORDER_URL;

import java.util.List;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.channel.api.WxChannelAfterSaleService;
import me.chanjar.weixin.channel.bean.after.AfterSaleAcceptParam;
import me.chanjar.weixin.channel.bean.after.AfterSaleIdParam;
import me.chanjar.weixin.channel.bean.after.AfterSaleInfoResponse;
import me.chanjar.weixin.channel.bean.after.AfterSaleListParam;
import me.chanjar.weixin.channel.bean.after.AfterSaleListResponse;
import me.chanjar.weixin.channel.bean.after.AfterSaleRejectParam;
import me.chanjar.weixin.channel.bean.after.RefundEvidenceParam;
import me.chanjar.weixin.channel.bean.after.*;
import me.chanjar.weixin.channel.bean.base.WxChannelBaseResponse;
import me.chanjar.weixin.channel.bean.complaint.ComplaintOrderResponse;
import me.chanjar.weixin.channel.bean.complaint.ComplaintParam;
import me.chanjar.weixin.channel.util.ResponseUtils;
import me.chanjar.weixin.common.error.WxErrorException;

import java.util.List;

import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.AfterSale.*;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Complaint.*;

/**
* 视频号小店 售后服务实现
*
Expand Down Expand Up @@ -56,15 +45,15 @@ public AfterSaleInfoResponse get(String afterSaleOrderId) throws WxErrorExceptio
}

@Override
public WxChannelBaseResponse accept(String afterSaleOrderId, String addressId) throws WxErrorException {
AfterSaleAcceptParam param = new AfterSaleAcceptParam(afterSaleOrderId, addressId);
public WxChannelBaseResponse accept(String afterSaleOrderId, String addressId, Integer acceptType) throws WxErrorException {
AfterSaleAcceptParam param = new AfterSaleAcceptParam(afterSaleOrderId, addressId, acceptType);
String resJson = shopService.post(AFTER_SALE_ACCEPT_URL, param);
return ResponseUtils.decode(resJson, WxChannelBaseResponse.class);
}

@Override
public WxChannelBaseResponse reject(String afterSaleOrderId, String rejectReason) throws WxErrorException {
AfterSaleRejectParam param = new AfterSaleRejectParam(afterSaleOrderId, rejectReason);
public WxChannelBaseResponse reject(String afterSaleOrderId, String rejectReason, Integer rejectReasonType) throws WxErrorException {
AfterSaleRejectParam param = new AfterSaleRejectParam(afterSaleOrderId, rejectReason, rejectReasonType);
String resJson = shopService.post(AFTER_SALE_REJECT_URL, param);
return ResponseUtils.decode(resJson, WxChannelBaseResponse.class);
}
Expand Down Expand Up @@ -100,4 +89,16 @@ public ComplaintOrderResponse getComplaint(String complaintId) throws WxErrorExc
String resJson = shopService.post(GET_COMPLAINT_ORDER_URL, reqJson);
return ResponseUtils.decode(resJson, ComplaintOrderResponse.class);
}

@Override
public AfterSaleReasonResponse getAllReason() throws WxErrorException {
String resJson = shopService.post(AFTER_SALE_REASON_GET_URL, "{}");
return ResponseUtils.decode(resJson, AfterSaleReasonResponse.class);
}

@Override
public AfterSaleRejectReasonResponse getRejectReason() throws WxErrorException {
String resJson = shopService.post(AFTER_SALE_REJECT_REASON_GET_URL, "{}");
return ResponseUtils.decode(resJson, AfterSaleRejectReasonResponse.class);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,21 @@ public class AfterSaleAcceptParam extends AfterSaleIdParam {
@JsonProperty("address_id")
private String addressId;

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

public AfterSaleAcceptParam() {
}

public AfterSaleAcceptParam(String afterSaleOrderId, String addressId) {
super(afterSaleOrderId);
this.addressId = addressId;
}

public AfterSaleAcceptParam(String afterSaleOrderId, String addressId, Integer acceptType) {
super(afterSaleOrderId);
this.addressId = addressId;
this.acceptType = acceptType;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,8 @@ public class AfterSaleInfo implements Serializable {
/** 纠纷id,该字段可用于获取纠纷信息 */
@JsonProperty("complaint_id")
private String complaintId;

/** 仅在待商家审核退款退货申请或收货期间返回,表示操作剩余时间(秒数)*/
@JsonProperty("deadline")
private Long deadline;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package me.chanjar.weixin.channel.bean.after;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
* 全量售后原因
*
* @author lizhengwu
* @date 2024/7/24
*/
@Data
@NoArgsConstructor
public class AfterSaleReason implements Serializable {

private static final long serialVersionUID = -3674527884494606230L;

/**
* 售后原因枚举
*/
@JsonProperty("reason")
private Integer reason;

/**
* 售后原因说明
*/
@JsonProperty("reason_text")
private String reasonText;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package me.chanjar.weixin.channel.bean.after;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import me.chanjar.weixin.channel.bean.base.WxChannelBaseResponse;

import java.util.List;

/**
* 售后原因
*
*
* @author lizhengwu
*/
@Data
@NoArgsConstructor
@EqualsAndHashCode
public class AfterSaleReasonResponse extends WxChannelBaseResponse {


private static final long serialVersionUID = -580378623915041396L;

@JsonProperty("reason_list")
private List<AfterSaleReason> reasonList;

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,29 @@
public class AfterSaleRejectParam extends AfterSaleIdParam {

private static final long serialVersionUID = -7507483859864253314L;
/** 拒绝原因 */
/**
* 拒绝原因
*/
@JsonProperty("reject_reason")
private String rejectReason;

/**
* 拒绝原因枚举值
*/
@JsonProperty("reject_reason_type")
private Integer rejectReasonType;

public AfterSaleRejectParam() {
}

public AfterSaleRejectParam(String afterSaleOrderId, String rejectReason) {
super(afterSaleOrderId);
this.rejectReason = rejectReason;
}

public AfterSaleRejectParam(String afterSaleOrderId, String rejectReason, Integer rejectReasonType) {
super(afterSaleOrderId);
this.rejectReason = rejectReason;
this.rejectReasonType = rejectReasonType;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package me.chanjar.weixin.channel.bean.after;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
* 拒绝售后原因
*
* @author lizhengwu
* @date 2024/7/24
*/
@Data
@NoArgsConstructor
public class AfterSaleRejectReason implements Serializable {

private static final long serialVersionUID = -3672834150982780L;

/**
* 售后拒绝原因枚举
*/
@JsonProperty("reject_reason_type")
private Integer rejectReasonType;

/**
* 售后拒绝原因说明
*/
@JsonProperty("reject_reason_type_text")
private String rejectReasonTypeText;

/**
* 售后拒绝原因默认描述
*/
@JsonProperty("reject_reason")
private String rejectReason;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package me.chanjar.weixin.channel.bean.after;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import me.chanjar.weixin.channel.bean.base.WxChannelBaseResponse;

import java.util.List;

/**
* 售后原因
*
* @author lizhengwu
*/
@Data
@NoArgsConstructor
@EqualsAndHashCode
public class AfterSaleRejectReasonResponse extends WxChannelBaseResponse {

private static final long serialVersionUID = -7946679037747710613L;

/**
* 售后原因列表
*/
@JsonProperty("reject_reason_list")
private List<AfterSaleRejectReason> rejectReasonList;

}
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,8 @@ public class RefundInfo implements Serializable {
/** 退款金额(分) */
@JsonProperty("amount")
private Integer amount;

/** 标明售后单退款直接原因, 枚举值详情请参考 {@link me.chanjar.weixin.channel.enums.RefundReason} */
@JsonProperty("refund_reason")
private Integer refundReason;
}
Loading