Skip to content
Open
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 @@ -183,4 +183,67 @@ WxChannelBaseResponse addComplaintEvidence(String complaintId, String content, L
* @throws WxErrorException 异常
*/
WxChannelBaseResponse merchantUpdateAfterSale(AfterSaleMerchantUpdateParam param) throws WxErrorException;

/**
* 商家获取保障单列表
* 文档地址:https://developers.weixin.qq.com/doc/channels/API/channels-shop-aftersale/guarantee/api_searchguaranteeorder
*
* @param param 参数
* @return 保障单列表
*
* @throws WxErrorException 异常
*/
GuaranteeOrderListResponse listGuaranteeOrder(GuaranteeOrderListParam param) throws WxErrorException;

/**
* 获取保障单详情
* 文档地址:https://developers.weixin.qq.com/doc/channels/API/channels-shop-aftersale/guarantee/api_getguaranteeorder
*
* @param guaranteeOrderId 保障单号
* @return 保障单详情
*
* @throws WxErrorException 异常
*/
GuaranteeOrderInfo getGuaranteeOrder(String guaranteeOrderId) throws WxErrorException;

/**
* 商家同意保障单申请
* 文档地址:https://developers.weixin.qq.com/doc/channels/API/channels-shop-aftersale/guarantee/api_merchantacceptguarantee
*
* @param guaranteeOrderId 保障单号
*
* @throws WxErrorException 异常
*/
void acceptGuarantee(String guaranteeOrderId) throws WxErrorException;

/**
* 商家协商保障单
* 文档地址:https://developers.weixin.qq.com/doc/channels/API/channels-shop-aftersale/guarantee/api_merchantmodifyguarantee
*
* @param req 参数
*
* @throws WxErrorException 异常
*/
void modifyGuarantee(GuaranteeModifyRequest req) throws WxErrorException;

/**
* 商家举证保障单
* 文档地址:https://developers.weixin.qq.com/doc/channels/API/channels-shop-aftersale/guarantee/api_merchantproofguarantee
*
* @param req 参数
*
* @throws WxErrorException 异常
*/
void proofGuarantee(GuaranteeProofRequest req) throws WxErrorException;

/**
* 商家拒绝保障单申请
* 文档地址:https://developers.weixin.qq.com/doc/channels/API/channels-shop-aftersale/guarantee/api_merchantrefuseguarantee
*
* @param guaranteeOrderId 保障单号
* @param reason 拒绝原因
*
* @throws WxErrorException 异常
*/
void refuseGuarantee(String guaranteeOrderId, String reason) throws WxErrorException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,40 @@ public WxChannelBaseResponse merchantUpdateAfterSale(AfterSaleMerchantUpdatePara
return ResponseUtils.decode(resJson, WxChannelBaseResponse.class);
}

@Override
public GuaranteeOrderListResponse listGuaranteeOrder(GuaranteeOrderListParam param) throws WxErrorException {
String resJson = shopService.post(GUARANTEE_ORDER_LIST_URL, param);
return ResponseUtils.decode(resJson, GuaranteeOrderListResponse.class);
}

@Override
public GuaranteeOrderInfo getGuaranteeOrder(String guaranteeOrderId) throws WxErrorException {
GuaranteeOrderIdParam param = new GuaranteeOrderIdParam(guaranteeOrderId);
String resJson = shopService.post(GUARANTEE_ORDER_GET_URL, param);
GuaranteeOrderInfoResponse response = ResponseUtils.decode(resJson, GuaranteeOrderInfoResponse.class);
return response.getGuaranteeOrder();
}

@Override
public void acceptGuarantee(String guaranteeOrderId) throws WxErrorException {
GuaranteeOrderIdParam param = new GuaranteeOrderIdParam(guaranteeOrderId);
shopService.post(GUARANTEE_ORDER_ACCEPT_URL, param);
}

@Override
public void modifyGuarantee(GuaranteeModifyRequest req) throws WxErrorException {
shopService.post(GUARANTEE_ORDER_MODIFY_URL, req);
}

@Override
public void proofGuarantee(GuaranteeProofRequest req) throws WxErrorException {
shopService.post(GUARANTEE_ORDER_PROOF_URL, req);
}

@Override
public void refuseGuarantee(String guaranteeOrderId, String reason) throws WxErrorException {
GuaranteeRefuseRequest req = new GuaranteeRefuseRequest(guaranteeOrderId, reason);
shopService.post(GUARANTEE_ORDER_REFUSE_URL, req);
}

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

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

/**
* 商家协商保障单请求参数.
*/
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@JsonInclude(Include.NON_NULL)
public class GuaranteeModifyRequest extends GuaranteeOrderIdParam {

private static final long serialVersionUID = -7142671437465099549L;

/** 协商金额(单位:分). */
@JsonProperty("amount")
private Integer amount;

/** 协商描述. */
@JsonProperty("desc")
private String desc;

public GuaranteeModifyRequest(String guaranteeOrderId, Integer amount, String desc) {
super(guaranteeOrderId);
this.amount = amount;
this.desc = desc;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package me.chanjar.weixin.channel.bean.after;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
* 保障单id参数.
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@JsonInclude(Include.NON_NULL)
public class GuaranteeOrderIdParam implements Serializable {

private static final long serialVersionUID = 773665483877442194L;

/** 保障单号. */
@JsonProperty("guarantee_order_id")
private String guaranteeOrderId;
Comment on lines +23 to +24
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Serialize the guarantee id as guarantee_id

The guarantee APIs expect the request field to be guarantee_id, not guarantee_order_id; because all detail/action DTOs inherit this field, calls to get/accept/modify/proof/refuse a guarantee send the id under the wrong key and are treated as missing the required guarantee id even when the caller passes a valid value.

Useful? React with 👍 / 👎.

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

import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
* 保障单信息.
*/
@Data
@NoArgsConstructor
public class GuaranteeOrderInfo implements Serializable {

private static final long serialVersionUID = -2590210285444450666L;

/** 保障单号. */
@JsonProperty("guarantee_order_id")
private String guaranteeOrderId;

/** 订单号. */
@JsonProperty("order_id")
private String orderId;

/** 保障单状态. */
@JsonProperty("status")
private Integer status;

/** 保障单类型. */
@JsonProperty("type")
private Integer type;

/** 申请原因. */
@JsonProperty("reason")
private String reason;

/** 创建时间. */
@JsonProperty("create_time")
private Long createTime;

/** 更新时间. */
@JsonProperty("update_time")
private Long updateTime;

/** 买家openid. */
@JsonProperty("openid")
private String openid;

/** 买家unionid. */
@JsonProperty("unionid")
private String unionid;

/** 商品信息. */
@JsonProperty("product_info")
private AfterSaleProductInfo productInfo;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
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;

/**
* 保障单详情响应.
*/
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class GuaranteeOrderInfoResponse extends WxChannelBaseResponse {

private static final long serialVersionUID = 7532731716811792648L;

/** 保障单详情. */
@JsonProperty("guarantee_order")
private GuaranteeOrderInfo guaranteeOrder;
Comment on lines +20 to +21
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Decode guarantee details from guarantee_info

The get-guarantee response body uses guarantee_info, but this response DTO looks for guarantee_order; after a successful API call getGuaranteeOrder() therefore returns null because Jackson never populates the field.

Useful? React with 👍 / 👎.

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

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
* 保障单列表请求参数.
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@JsonInclude(Include.NON_NULL)
public class GuaranteeOrderListParam implements Serializable {

private static final long serialVersionUID = -8822052330671632588L;

/** 订单创建启始时间 unix时间戳. */
@JsonProperty("begin_create_time")
private Long beginCreateTime;

/** 订单创建结束时间,end_create_time减去begin_create_time不得大于24小时 unix时间戳. */
@JsonProperty("end_create_time")
private Long endCreateTime;

/** 保障单更新起始时间. */
@JsonProperty("begin_update_time")
private Long beginUpdateTime;

/** 保障单更新结束时间,end_update_time减去begin_update_time不得大于24小时. */
@JsonProperty("end_update_time")
private Long endUpdateTime;

/** 翻页参数,从第二页开始传,来源于上一页的返回值. */
@JsonProperty("next_key")
private String nextKey;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package me.chanjar.weixin.channel.bean.after;

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

/**
* 保障单列表响应.
*/
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class GuaranteeOrderListResponse extends WxChannelBaseResponse {

private static final long serialVersionUID = -6136894046806166855L;

/** 保障单号列表. */
@JsonProperty("guarantee_order_id_list")
private List<String> guaranteeOrderIdList;
Comment on lines +20 to +22
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Decode the returned guarantee list

The search-guarantee endpoint returns a guarantee_list array of guarantee objects, not guarantee_order_id_list; with this mapping, successful list responses expose no guarantees to callers, so pagination can succeed while the actual results are silently dropped.

Useful? React with 👍 / 👎.


/** 翻页参数. */
@JsonProperty("next_key")
private String nextKey;

/** 是否还有数据. */
@JsonProperty("has_more")
private Boolean hasMore;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package me.chanjar.weixin.channel.bean.after;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

/**
* 商家举证保障单请求参数.
*/
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@JsonInclude(Include.NON_NULL)
public class GuaranteeProofRequest extends GuaranteeOrderIdParam {

private static final long serialVersionUID = -4521077589624343197L;

/** 举证图片media_id列表. */
@JsonProperty("media_ids")
private List<String> mediaIds;

/** 举证描述. */
@JsonProperty("desc")
private String desc;
Comment on lines +22 to +28
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Nest proof evidence under proof_info

The proof endpoint expects evidence as a proof_info object with text and image_ids, but this request sends top-level media_ids and desc; merchant proof submissions with images or text will arrive in the wrong shape and be rejected or ignored by the API.

Useful? React with 👍 / 👎.


public GuaranteeProofRequest(String guaranteeOrderId, List<String> mediaIds, String desc) {
super(guaranteeOrderId);
this.mediaIds = mediaIds;
this.desc = desc;
}
}
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.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

/**
* 商家拒绝保障单请求参数.
*/
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@JsonInclude(Include.NON_NULL)
public class GuaranteeRefuseRequest extends GuaranteeOrderIdParam {

private static final long serialVersionUID = 6632720364917208597L;

/** 拒绝原因. */
@JsonProperty("reason")
private String reason;

public GuaranteeRefuseRequest(String guaranteeOrderId, String reason) {
super(guaranteeOrderId);
this.reason = reason;
}
}
Loading
Loading