1
0
mirror of synced 2025-12-07 22:08:14 +08:00

Implement WeChat Mini Program complaint handling service with all core APIs

Co-authored-by: binarywang <1343140+binarywang@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2025-08-31 15:07:14 +00:00
parent 3d744e3f85
commit eab5466b3d
15 changed files with 1069 additions and 0 deletions

View File

@@ -0,0 +1,159 @@
package cn.binarywang.wx.miniapp.api;
import cn.binarywang.wx.miniapp.bean.complaint.*;
import me.chanjar.weixin.common.error.WxErrorException;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
/**
* 小程序交易投诉接口
*
* @author <a href="https://github.com/binarywang">Binary Wang</a>
* created on 2025-01-01
*/
public interface WxMaComplaintService {
/**
* <pre>
* 查询投诉单列表API
* 商户可通过调用此接口,查询指定时间段的所有用户投诉信息,以分页输出查询结果。
* 文档详见: https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/guarantee/complaint.html
* </pre>
*
* @param request {@link WxMaComplaintRequest} 查询投诉单列表请求数据
* @return {@link WxMaComplaintResult} 微信返回的投诉单列表
* @throws WxErrorException the wx error exception
*/
WxMaComplaintResult queryComplaints(WxMaComplaintRequest request) throws WxErrorException;
/**
* <pre>
* 查询投诉单详情API
* 商户可通过调用此接口,查询指定投诉单的用户投诉详情,包含投诉内容、投诉关联订单、投诉人联系方式等信息,方便商户处理投诉。
* 文档详见: https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/guarantee/complaint.html
* </pre>
*
* @param request {@link WxMaComplaintDetailRequest} 投诉单详情请求数据
* @return {@link WxMaComplaintDetailResult} 微信返回的投诉单详情
* @throws WxErrorException the wx error exception
*/
WxMaComplaintDetailResult getComplaint(WxMaComplaintDetailRequest request) throws WxErrorException;
/**
* <pre>
* 查询投诉协商历史API
* 商户可通过调用此接口,查询指定投诉的用户商户协商历史,以分页输出查询结果,方便商户根据处理历史来制定后续处理方案。
* 文档详见: https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/guarantee/complaint.html
* </pre>
*
* @param request {@link WxMaNegotiationHistoryRequest} 请求数据
* @return {@link WxMaNegotiationHistoryResult} 微信返回结果
* @throws WxErrorException the wx error exception
*/
WxMaNegotiationHistoryResult queryNegotiationHistorys(WxMaNegotiationHistoryRequest request) throws WxErrorException;
/**
* <pre>
* 创建投诉通知回调地址API
* 商户通过调用此接口创建投诉通知回调URL当用户产生新投诉且投诉状态已变更时微信会通过回调URL通知商户。
* 文档详见: https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/guarantee/complaint.html
* </pre>
*
* @param request {@link WxMaComplaintNotifyUrlRequest} 请求数据
* @return {@link WxMaComplaintNotifyUrlResult} 微信返回结果
* @throws WxErrorException the wx error exception
*/
WxMaComplaintNotifyUrlResult addComplaintNotifyUrl(WxMaComplaintNotifyUrlRequest request) throws WxErrorException;
/**
* <pre>
* 查询投诉通知回调地址API
* 商户通过调用此接口查询投诉通知的回调URL。
* 文档详见: https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/guarantee/complaint.html
* </pre>
*
* @return {@link WxMaComplaintNotifyUrlResult} 微信返回结果
* @throws WxErrorException the wx error exception
*/
WxMaComplaintNotifyUrlResult getComplaintNotifyUrl() throws WxErrorException;
/**
* <pre>
* 更新投诉通知回调地址API
* 商户通过调用此接口更新投诉通知的回调URL。
* 文档详见: https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/guarantee/complaint.html
* </pre>
*
* @param request {@link WxMaComplaintNotifyUrlRequest} 请求数据
* @return {@link WxMaComplaintNotifyUrlResult} 微信返回结果
* @throws WxErrorException the wx error exception
*/
WxMaComplaintNotifyUrlResult updateComplaintNotifyUrl(WxMaComplaintNotifyUrlRequest request) throws WxErrorException;
/**
* <pre>
* 删除投诉通知回调地址API
* 当商户不再需要推送通知时可通过调用此接口删除投诉通知的回调URL取消通知回调。
* 文档详见: https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/guarantee/complaint.html
* </pre>
*
* @throws WxErrorException the wx error exception
*/
void deleteComplaintNotifyUrl() throws WxErrorException;
/**
* <pre>
* 提交回复API
* 商户可通过调用此接口提交回复内容。其中上传图片凭证需首先调用商户上传反馈图片接口得到图片id再将id填入请求。
* 回复可配置文字链,传入跳转链接文案和跳转链接字段,用户点击即可跳转对应页面
* 文档详见: https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/guarantee/complaint.html
* </pre>
*
* @param request {@link WxMaResponseRequest} 请求数据
* @throws WxErrorException the wx error exception
*/
void submitResponse(WxMaResponseRequest request) throws WxErrorException;
/**
* <pre>
* 反馈处理完成API
* 商户可通过调用此接口,反馈投诉单已处理完成。
* 文档详见: https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/guarantee/complaint.html
* </pre>
*
* @param request {@link WxMaCompleteRequest} 请求数据
* @throws WxErrorException the wx error exception
*/
void complete(WxMaCompleteRequest request) throws WxErrorException;
/**
* <pre>
* 商户上传反馈图片API
* 商户可通过调用此接口上传反馈图片凭证,上传成功后可在提交回复时使用。
* 文档详见: https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/guarantee/complaint.html
* </pre>
*
* @param imageFile 需要上传的图片文件
* @return String 微信返回的媒体文件标识Id
* @throws WxErrorException the wx error exception
* @throws IOException IO异常
*/
String uploadResponseImage(File imageFile) throws WxErrorException, IOException;
/**
* <pre>
* 商户上传反馈图片API
* 商户可通过调用此接口上传反馈图片凭证,上传成功后可在提交回复时使用。
* 文档详见: https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/guarantee/complaint.html
* </pre>
*
* @param inputStream 需要上传的图片文件流
* @param fileName 需要上传的图片文件名
* @return String 微信返回的媒体文件标识Id
* @throws WxErrorException the wx error exception
* @throws IOException IO异常
*/
String uploadResponseImage(InputStream inputStream, String fileName) throws WxErrorException, IOException;
}

View File

@@ -605,4 +605,13 @@ public interface WxMaService extends WxService {
* @return 同城配送服务对象WxMaIntracityService
*/
WxMaIntracityService getIntracityService();
/**
* 获取交易投诉服务对象。
* <br>
* 文档https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/guarantee/complaint.html
*
* @return 交易投诉服务对象WxMaComplaintService
*/
WxMaComplaintService getComplaintService();
}

View File

@@ -165,6 +165,7 @@ public abstract class BaseWxMaServiceImpl<H, P> implements WxMaService, RequestH
new WxMaExpressDeliveryReturnServiceImpl(this);
private final WxMaPromotionService wxMaPromotionService = new WxMaPromotionServiceImpl(this);
private final WxMaIntracityService intracityService = new WxMaIntracityServiceImpl(this);
private final WxMaComplaintService complaintService = new WxMaComplaintServiceImpl(this);
private Map<String, WxMaConfig> configMap = new HashMap<>();
private int retrySleepMillis = 1000;
@@ -1030,4 +1031,9 @@ public abstract class BaseWxMaServiceImpl<H, P> implements WxMaService, RequestH
public WxMaIntracityService getIntracityService() {
return this.intracityService;
}
@Override
public WxMaComplaintService getComplaintService() {
return this.complaintService;
}
}

View File

@@ -0,0 +1,99 @@
package cn.binarywang.wx.miniapp.api.impl;
import cn.binarywang.wx.miniapp.api.WxMaComplaintService;
import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.bean.complaint.*;
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
import com.google.gson.JsonObject;
import lombok.RequiredArgsConstructor;
import me.chanjar.weixin.common.bean.CommonUploadParam;
import me.chanjar.weixin.common.error.WxError;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.common.util.fs.FileUtils;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.UUID;
import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Complaint.*;
/**
* 小程序交易投诉接口实现
*
* @author <a href="https://github.com/binarywang">Binary Wang</a>
* created on 2025-01-01
*/
@RequiredArgsConstructor
public class WxMaComplaintServiceImpl implements WxMaComplaintService {
private static final String JSON_CONTENT_TYPE = "application/json";
private final WxMaService wxMaService;
@Override
public WxMaComplaintResult queryComplaints(WxMaComplaintRequest request) throws WxErrorException {
String responseContent = this.wxMaService.post(QUERY_COMPLAINTS_URL, request.toJson());
return WxMaGsonBuilder.create().fromJson(responseContent, WxMaComplaintResult.class);
}
@Override
public WxMaComplaintDetailResult getComplaint(WxMaComplaintDetailRequest request) throws WxErrorException {
String responseContent = this.wxMaService.post(GET_COMPLAINT_URL, request.toJson());
return WxMaGsonBuilder.create().fromJson(responseContent, WxMaComplaintDetailResult.class);
}
@Override
public WxMaNegotiationHistoryResult queryNegotiationHistorys(WxMaNegotiationHistoryRequest request) throws WxErrorException {
String responseContent = this.wxMaService.post(QUERY_NEGOTIATION_HISTORY_URL, request.toJson());
return WxMaGsonBuilder.create().fromJson(responseContent, WxMaNegotiationHistoryResult.class);
}
@Override
public WxMaComplaintNotifyUrlResult addComplaintNotifyUrl(WxMaComplaintNotifyUrlRequest request) throws WxErrorException {
String responseContent = this.wxMaService.post(ADD_COMPLAINT_NOTIFY_URL, request.toJson());
return WxMaGsonBuilder.create().fromJson(responseContent, WxMaComplaintNotifyUrlResult.class);
}
@Override
public WxMaComplaintNotifyUrlResult getComplaintNotifyUrl() throws WxErrorException {
String responseContent = this.wxMaService.get(GET_COMPLAINT_NOTIFY_URL, null);
return WxMaGsonBuilder.create().fromJson(responseContent, WxMaComplaintNotifyUrlResult.class);
}
@Override
public WxMaComplaintNotifyUrlResult updateComplaintNotifyUrl(WxMaComplaintNotifyUrlRequest request) throws WxErrorException {
String responseContent = this.wxMaService.post(UPDATE_COMPLAINT_NOTIFY_URL, request.toJson());
return WxMaGsonBuilder.create().fromJson(responseContent, WxMaComplaintNotifyUrlResult.class);
}
@Override
public void deleteComplaintNotifyUrl() throws WxErrorException {
this.wxMaService.post(DELETE_COMPLAINT_NOTIFY_URL, "{}");
}
@Override
public void submitResponse(WxMaResponseRequest request) throws WxErrorException {
this.wxMaService.post(SUBMIT_RESPONSE_URL, request.toJson());
}
@Override
public void complete(WxMaCompleteRequest request) throws WxErrorException {
this.wxMaService.post(COMPLETE_COMPLAINT_URL, request.toJson());
}
@Override
public String uploadResponseImage(File imageFile) throws WxErrorException, IOException {
String result = this.wxMaService.upload(UPLOAD_RESPONSE_IMAGE_URL,
CommonUploadParam.fromFile("image", imageFile));
JsonObject jsonResult = WxMaGsonBuilder.create().fromJson(result, JsonObject.class);
return jsonResult.get("media_id").getAsString();
}
@Override
public String uploadResponseImage(InputStream inputStream, String fileName) throws WxErrorException, IOException {
try {
return this.uploadResponseImage(FileUtils.createTmpFile(inputStream, UUID.randomUUID().toString(), fileName));
} catch (IOException e) {
throw new WxErrorException(WxError.builder().errorMsg(e.getMessage()).build(), e);
}
}
}

View File

@@ -0,0 +1,38 @@
package cn.binarywang.wx.miniapp.bean.complaint;
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
import com.google.gson.annotations.SerializedName;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* 小程序投诉单详情请求实体
*
* @author <a href="https://github.com/binarywang">Binary Wang</a>
* created on 2025-01-01
*/
@Data
@Builder(builderMethodName = "newBuilder")
@NoArgsConstructor
@AllArgsConstructor
public class WxMaComplaintDetailRequest implements Serializable {
private static final long serialVersionUID = 3244929701614280806L;
/**
* <pre>
* 字段名:投诉单号
* 是否必填:是
* 描述:投诉单对应的投诉单号
* </pre>
*/
@SerializedName("complaint_id")
private String complaintId;
public String toJson() {
return WxMaGsonBuilder.create().toJson(this);
}
}

View File

@@ -0,0 +1,166 @@
package cn.binarywang.wx.miniapp.bean.complaint;
import cn.binarywang.wx.miniapp.bean.WxMaBaseResponse;
import com.google.gson.annotations.SerializedName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.util.List;
/**
* 小程序投诉单详情结果
*
* @author <a href="https://github.com/binarywang">Binary Wang</a>
* created on 2025-01-01
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class WxMaComplaintDetailResult extends WxMaBaseResponse {
/**
* <pre>
* 字段名:投诉单号
* 是否必填:是
* 描述:投诉单对应的投诉单号
* </pre>
*/
@SerializedName("complaint_id")
private String complaintId;
/**
* <pre>
* 字段名:投诉时间
* 是否必填:是
* 描述用户提交投诉的时间遵循rfc3339标准格式格式为YYYY-MM-DDTHH:mm:ss+TIMEZONE
* </pre>
*/
@SerializedName("complaint_time")
private String complaintTime;
/**
* <pre>
* 字段名:投诉详情
* 是否必填:是
* 描述:用户提交的投诉详情
* </pre>
*/
@SerializedName("complaint_detail")
private String complaintDetail;
/**
* <pre>
* 字段名:投诉状态
* 是否必填:是
* 描述投诉单状态WAITING_MERCHANT_RESPONSE-等待商户回复 MERCHANT_RESPONSED-商户已回复 WAITING_USER_RESPONSE-等待用户回复 USER_RESPONSED-用户已回复 COMPLAINT_COMPLETED-投诉已完成
* </pre>
*/
@SerializedName("complaint_state")
private String complaintState;
/**
* <pre>
* 字段名投诉人openid
* 是否必填:是
* 描述投诉人在小程序的openid
* </pre>
*/
@SerializedName("openid")
private String openid;
/**
* <pre>
* 字段名:投诉人联系方式
* 是否必填:否
* 描述:投诉人联系方式,可能为空
* </pre>
*/
@SerializedName("phone_number")
private String phoneNumber;
/**
* <pre>
* 字段名:被投诉订单信息
* 是否必填:是
* 描述:被投诉的订单信息
* </pre>
*/
@SerializedName("complaint_order_info")
private ComplaintOrderInfo complaintOrderInfo;
/**
* <pre>
* 字段名:投诉材料
* 是否必填:否
* 描述:用户上传的投诉相关的图片凭证
* </pre>
*/
@SerializedName("complaint_media_list")
private List<ComplaintMedia> complaintMediaList;
/**
* 被投诉订单信息
*/
@Data
public static class ComplaintOrderInfo implements Serializable {
private static final long serialVersionUID = 3244929701614280806L;
/**
* <pre>
* 字段名:商户订单号
* 是否必填:是
* 描述:商户系统内部订单号
* </pre>
*/
@SerializedName("transaction_id")
private String transactionId;
/**
* <pre>
* 字段名:微信订单号
* 是否必填:是
* 描述:微信支付系统生成的订单号
* </pre>
*/
@SerializedName("out_trade_no")
private String outTradeNo;
/**
* <pre>
* 字段名:订单金额
* 是否必填:是
* 描述:订单金额,单位为分
* </pre>
*/
@SerializedName("amount")
private Integer amount;
}
/**
* 投诉材料
*/
@Data
public static class ComplaintMedia implements Serializable {
private static final long serialVersionUID = 3244929701614280806L;
/**
* <pre>
* 字段名:媒体文件业务类型
* 是否必填:是
* 描述媒体文件对应的业务类型USER_COMPLAINT_IMAGE-用户投诉图片
* </pre>
*/
@SerializedName("media_type")
private String mediaType;
/**
* <pre>
* 字段名媒体文件请求URL
* 是否必填:是
* 描述微信返回的媒体文件请求URL通过该URL可以获取到对应的媒体文件图片、视频等
* </pre>
*/
@SerializedName("media_url")
private String mediaUrl;
}
}

View File

@@ -0,0 +1,38 @@
package cn.binarywang.wx.miniapp.bean.complaint;
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
import com.google.gson.annotations.SerializedName;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* 小程序投诉通知回调URL请求实体
*
* @author <a href="https://github.com/binarywang">Binary Wang</a>
* created on 2025-01-01
*/
@Data
@Builder(builderMethodName = "newBuilder")
@NoArgsConstructor
@AllArgsConstructor
public class WxMaComplaintNotifyUrlRequest implements Serializable {
private static final long serialVersionUID = 3244929701614280806L;
/**
* <pre>
* 字段名:通知地址
* 是否必填:是
* 描述通知地址仅支持https
* </pre>
*/
@SerializedName("url")
private String url;
public String toJson() {
return WxMaGsonBuilder.create().toJson(this);
}
}

View File

@@ -0,0 +1,37 @@
package cn.binarywang.wx.miniapp.bean.complaint;
import cn.binarywang.wx.miniapp.bean.WxMaBaseResponse;
import com.google.gson.annotations.SerializedName;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 小程序投诉通知回调URL结果
*
* @author <a href="https://github.com/binarywang">Binary Wang</a>
* created on 2025-01-01
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class WxMaComplaintNotifyUrlResult extends WxMaBaseResponse {
/**
* <pre>
* 字段名:通知地址
* 是否必填:是
* 描述通知地址仅支持https
* </pre>
*/
@SerializedName("url")
private String url;
/**
* <pre>
* 字段名:签名串
* 是否必填:是
* 描述:用于验证通知消息的签名串
* </pre>
*/
@SerializedName("signature")
private String signature;
}

View File

@@ -0,0 +1,68 @@
package cn.binarywang.wx.miniapp.bean.complaint;
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
import com.google.gson.annotations.SerializedName;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* 小程序交易投诉查询请求实体
*
* @author <a href="https://github.com/binarywang">Binary Wang</a>
* created on 2025-01-01
*/
@Data
@Builder(builderMethodName = "newBuilder")
@NoArgsConstructor
@AllArgsConstructor
public class WxMaComplaintRequest implements Serializable {
private static final long serialVersionUID = 3244929701614280806L;
/**
* <pre>
* 字段名:开始日期
* 是否必填:是
* 描述查询的起始时间格式为YYYY-MM-DD例如2021-01-01
* </pre>
*/
@SerializedName("begin_date")
private String beginDate;
/**
* <pre>
* 字段名:结束日期
* 是否必填:是
* 描述查询的结束时间格式为YYYY-MM-DD例如2021-01-31
* </pre>
*/
@SerializedName("end_date")
private String endDate;
/**
* <pre>
* 字段名:分页大小
* 是否必填:否
* 描述单次拉取条目最大为50不传默认为10
* </pre>
*/
@SerializedName("limit")
private Integer limit = 10;
/**
* <pre>
* 字段名:分页开始位置
* 是否必填:否
* 描述该次请求的分页开始位置从0开始计数例如offset=10表示从第11条记录开始返回不传默认为0
* </pre>
*/
@SerializedName("offset")
private Integer offset = 0;
public String toJson() {
return WxMaGsonBuilder.create().toJson(this);
}
}

View File

@@ -0,0 +1,156 @@
package cn.binarywang.wx.miniapp.bean.complaint;
import cn.binarywang.wx.miniapp.bean.WxMaBaseResponse;
import com.google.gson.annotations.SerializedName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.util.List;
/**
* 小程序交易投诉查询结果
*
* @author <a href="https://github.com/binarywang">Binary Wang</a>
* created on 2025-01-01
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class WxMaComplaintResult extends WxMaBaseResponse {
/**
* <pre>
* 字段名:投诉单信息
* 是否必填:是
* 描述:查询返回的投诉单信息
* </pre>
*/
@SerializedName("data")
private List<Complaint> data;
/**
* <pre>
* 字段名:总数
* 是否必填:是
* 描述:总投诉单条数,用于分页展示
* </pre>
*/
@SerializedName("total_count")
private Integer totalCount;
/**
* 投诉单信息
*/
@Data
public static class Complaint implements Serializable {
private static final long serialVersionUID = 3244929701614280806L;
/**
* <pre>
* 字段名:投诉单号
* 是否必填:是
* 描述:投诉单对应的投诉单号
* </pre>
*/
@SerializedName("complaint_id")
private String complaintId;
/**
* <pre>
* 字段名:投诉时间
* 是否必填:是
* 描述用户提交投诉的时间遵循rfc3339标准格式格式为YYYY-MM-DDTHH:mm:ss+TIMEZONE
* </pre>
*/
@SerializedName("complaint_time")
private String complaintTime;
/**
* <pre>
* 字段名:投诉详情
* 是否必填:是
* 描述:用户提交的投诉详情
* </pre>
*/
@SerializedName("complaint_detail")
private String complaintDetail;
/**
* <pre>
* 字段名:投诉状态
* 是否必填:是
* 描述投诉单状态WAITING_MERCHANT_RESPONSE-等待商户回复 MERCHANT_RESPONSED-商户已回复 WAITING_USER_RESPONSE-等待用户回复 USER_RESPONSED-用户已回复 COMPLAINT_COMPLETED-投诉已完成
* </pre>
*/
@SerializedName("complaint_state")
private String complaintState;
/**
* <pre>
* 字段名投诉人openid
* 是否必填:是
* 描述投诉人在小程序的openid
* </pre>
*/
@SerializedName("openid")
private String openid;
/**
* <pre>
* 字段名:投诉人联系方式
* 是否必填:否
* 描述:投诉人联系方式,可能为空
* </pre>
*/
@SerializedName("phone_number")
private String phoneNumber;
/**
* <pre>
* 字段名:被投诉订单信息
* 是否必填:是
* 描述:被投诉的订单信息
* </pre>
*/
@SerializedName("complaint_order_info")
private ComplaintOrderInfo complaintOrderInfo;
}
/**
* 被投诉订单信息
*/
@Data
public static class ComplaintOrderInfo implements Serializable {
private static final long serialVersionUID = 3244929701614280806L;
/**
* <pre>
* 字段名:商户订单号
* 是否必填:是
* 描述:商户系统内部订单号
* </pre>
*/
@SerializedName("transaction_id")
private String transactionId;
/**
* <pre>
* 字段名:微信订单号
* 是否必填:是
* 描述:微信支付系统生成的订单号
* </pre>
*/
@SerializedName("out_trade_no")
private String outTradeNo;
/**
* <pre>
* 字段名:订单金额
* 是否必填:是
* 描述:订单金额,单位为分
* </pre>
*/
@SerializedName("amount")
private Integer amount;
}
}

View File

@@ -0,0 +1,38 @@
package cn.binarywang.wx.miniapp.bean.complaint;
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
import com.google.gson.annotations.SerializedName;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* 小程序反馈处理完成请求实体
*
* @author <a href="https://github.com/binarywang">Binary Wang</a>
* created on 2025-01-01
*/
@Data
@Builder(builderMethodName = "newBuilder")
@NoArgsConstructor
@AllArgsConstructor
public class WxMaCompleteRequest implements Serializable {
private static final long serialVersionUID = 3244929701614280806L;
/**
* <pre>
* 字段名:投诉单号
* 是否必填:是
* 描述:投诉单对应的投诉单号
* </pre>
*/
@SerializedName("complaint_id")
private String complaintId;
public String toJson() {
return WxMaGsonBuilder.create().toJson(this);
}
}

View File

@@ -0,0 +1,58 @@
package cn.binarywang.wx.miniapp.bean.complaint;
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
import com.google.gson.annotations.SerializedName;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* 小程序查询投诉协商历史请求实体
*
* @author <a href="https://github.com/binarywang">Binary Wang</a>
* created on 2025-01-01
*/
@Data
@Builder(builderMethodName = "newBuilder")
@NoArgsConstructor
@AllArgsConstructor
public class WxMaNegotiationHistoryRequest implements Serializable {
private static final long serialVersionUID = 3244929701614280806L;
/**
* <pre>
* 字段名:投诉单号
* 是否必填:是
* 描述:投诉单对应的投诉单号
* </pre>
*/
@SerializedName("complaint_id")
private String complaintId;
/**
* <pre>
* 字段名:分页大小
* 是否必填:否
* 描述单次拉取条目最大为50不传默认为10
* </pre>
*/
@SerializedName("limit")
private Integer limit = 10;
/**
* <pre>
* 字段名:分页开始位置
* 是否必填:否
* 描述该次请求的分页开始位置从0开始计数例如offset=10表示从第11条记录开始返回不传默认为0
* </pre>
*/
@SerializedName("offset")
private Integer offset = 0;
public String toJson() {
return WxMaGsonBuilder.create().toJson(this);
}
}

View File

@@ -0,0 +1,88 @@
package cn.binarywang.wx.miniapp.bean.complaint;
import cn.binarywang.wx.miniapp.bean.WxMaBaseResponse;
import com.google.gson.annotations.SerializedName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.util.List;
/**
* 小程序查询投诉协商历史结果
*
* @author <a href="https://github.com/binarywang">Binary Wang</a>
* created on 2025-01-01
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class WxMaNegotiationHistoryResult extends WxMaBaseResponse {
/**
* <pre>
* 字段名:协商历史
* 是否必填:是
* 描述:协商历史记录
* </pre>
*/
@SerializedName("data")
private List<NegotiationHistory> data;
/**
* <pre>
* 字段名:总数
* 是否必填:是
* 描述:总协商历史条数,用于分页展示
* </pre>
*/
@SerializedName("total_count")
private Integer totalCount;
/**
* 协商历史
*/
@Data
public static class NegotiationHistory implements Serializable {
private static final long serialVersionUID = 3244929701614280806L;
/**
* <pre>
* 字段名:操作时间
* 是否必填:是
* 描述操作时间遵循rfc3339标准格式格式为YYYY-MM-DDTHH:mm:ss+TIMEZONE
* </pre>
*/
@SerializedName("operate_time")
private String operateTime;
/**
* <pre>
* 字段名:操作类型
* 是否必填:是
* 描述操作类型USER_CREATE_COMPLAINT-用户提交投诉 USER_CONTINUE_COMPLAINT-用户继续投诉 MERCHANT_RESPONSE-商户回复 MERCHANT_CONFIRM_COMPLETE-商户确认完成处理
* </pre>
*/
@SerializedName("operate_type")
private String operateType;
/**
* <pre>
* 字段名:操作内容
* 是否必填:是
* 描述:具体的操作内容
* </pre>
*/
@SerializedName("operate_details")
private String operateDetails;
/**
* <pre>
* 字段名:图片凭证
* 是否必填:否
* 描述:操作过程中上传的图片凭证
* </pre>
*/
@SerializedName("image_list")
private List<String> imageList;
}
}

View File

@@ -0,0 +1,79 @@
package cn.binarywang.wx.miniapp.bean.complaint;
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
import com.google.gson.annotations.SerializedName;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.List;
/**
* 小程序提交回复请求实体
*
* @author <a href="https://github.com/binarywang">Binary Wang</a>
* created on 2025-01-01
*/
@Data
@Builder(builderMethodName = "newBuilder")
@NoArgsConstructor
@AllArgsConstructor
public class WxMaResponseRequest implements Serializable {
private static final long serialVersionUID = 3244929701614280806L;
/**
* <pre>
* 字段名:投诉单号
* 是否必填:是
* 描述:投诉单对应的投诉单号
* </pre>
*/
@SerializedName("complaint_id")
private String complaintId;
/**
* <pre>
* 字段名:回复内容
* 是否必填:是
* 描述具体的回复内容长度不超过200字符
* </pre>
*/
@SerializedName("response_content")
private String responseContent;
/**
* <pre>
* 字段名:回复图片
* 是否必填:否
* 描述回复的图片凭证最多可传5张图片由图片上传接口返回
* </pre>
*/
@SerializedName("response_images")
private List<String> responseImages;
/**
* <pre>
* 字段名:跳转链接
* 是否必填:否
* 描述:点击跳转链接
* </pre>
*/
@SerializedName("jump_url")
private String jumpUrl;
/**
* <pre>
* 字段名:跳转链接文案
* 是否必填:否
* 描述跳转链接文案在response_content中展示的跳转链接文案长度不超过10个字符
* </pre>
*/
@SerializedName("jump_url_text")
private String jumpUrlText;
public String toJson() {
return WxMaGsonBuilder.create().toJson(this);
}
}

View File

@@ -964,4 +964,34 @@ public class WxMaApiUrlConstants {
String GET_CITY = "https://api.weixin.qq.com/cgi-bin/express/intracity/getcity";
}
/**
* 小程序交易投诉接口
*
* <pre>
* 文档地址https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/guarantee/complaint.html
* </pre>
*/
public interface Complaint {
/** 查询投诉单列表 */
String QUERY_COMPLAINTS_URL = "https://api.weixin.qq.com/cgi-bin/miniapp/complaint/list";
/** 查询投诉单详情 */
String GET_COMPLAINT_URL = "https://api.weixin.qq.com/cgi-bin/miniapp/complaint/detail";
/** 查询投诉协商历史 */
String QUERY_NEGOTIATION_HISTORY_URL = "https://api.weixin.qq.com/cgi-bin/miniapp/complaint/negotiation/history";
/** 创建投诉通知回调地址 */
String ADD_COMPLAINT_NOTIFY_URL = "https://api.weixin.qq.com/cgi-bin/miniapp/complaint/notify/add";
/** 查询投诉通知回调地址 */
String GET_COMPLAINT_NOTIFY_URL = "https://api.weixin.qq.com/cgi-bin/miniapp/complaint/notify/get";
/** 更新投诉通知回调地址 */
String UPDATE_COMPLAINT_NOTIFY_URL = "https://api.weixin.qq.com/cgi-bin/miniapp/complaint/notify/update";
/** 删除投诉通知回调地址 */
String DELETE_COMPLAINT_NOTIFY_URL = "https://api.weixin.qq.com/cgi-bin/miniapp/complaint/notify/delete";
/** 提交回复 */
String SUBMIT_RESPONSE_URL = "https://api.weixin.qq.com/cgi-bin/miniapp/complaint/response";
/** 反馈处理完成 */
String COMPLETE_COMPLAINT_URL = "https://api.weixin.qq.com/cgi-bin/miniapp/complaint/complete";
/** 上传反馈图片 */
String UPLOAD_RESPONSE_IMAGE_URL = "https://api.weixin.qq.com/cgi-bin/miniapp/complaint/upload";
}
}