补齐 WxChannelAfterSaleService 缺失的 9 个官方售后端点(含保障单与工单同步)#4034
Conversation
There was a problem hiding this comment.
Pull request overview
本 PR 面向 weixin-java-channel 模块的售后能力补全:将微信小店官方文档中缺失的一组售后/保障单/工单同步相关端点补齐到 SDK(URL 常量、Service 接口、实现类以及配套请求/响应模型),并在现有 TestNG 用例中增加覆盖入口,保持与当前 ResponseUtils.decode(...) 解码路径一致。
Changes:
- 在
WxChannelApiUrlConstants.AfterSale中新增 9 个售后相关端点常量,并在WxChannelAfterSaleService/WxChannelAfterSaleServiceImpl中补齐对应方法实现。 - 新增多组请求/响应模型(含工单同步的嵌套结构),用于对接新增端点的入参/出参。
- 在
WxChannelAfterSaleServiceImplTest中新增对应方法的调用用例入口。
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| weixin-java-channel/src/test/java/me/chanjar/weixin/channel/api/impl/WxChannelAfterSaleServiceImplTest.java | 增加新增端点的集成式调用用例入口 |
| weixin-java-channel/src/main/java/me/chanjar/weixin/channel/constant/WxChannelApiUrlConstants.java | 补齐售后相关 API URL 常量 |
| weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/after/SyncWorkOrderParam.java | 新增工单同步请求模型(含嵌套结构) |
| weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/after/GuaranteeOrderResponse.java | 新增保障单详情响应模型(当前使用 JsonNode 承载) |
| weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/after/GuaranteeOrderIdParam.java | 新增保障单号请求模型 |
| weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/after/GuaranteeMerchantProofParam.java | 新增保障单举证请求模型 |
| weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/after/GuaranteeMerchantModifyParam.java | 新增保障单协商请求模型 |
| weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/after/AfterSaleVirtualTelNumResponse.java | 新增虚拟号兑换响应模型 |
| weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/after/AfterSaleRefundPriceDiffParam.java | 新增退差价请求模型 |
| weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/after/AfterSaleHandleFastExchangeReceiptParam.java | 新增极速换货处理请求模型(含一个待强类型化字段) |
| weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/after/AfterSaleGenAfterSaleOrderParam.java | 新增代客发起售后请求模型 |
| weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/after/AfterSaleCreateResponse.java | 新增售后创建类响应模型 |
| weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/WxChannelAfterSaleService.java | 在售后 Service 接口中新增 9 个方法定义 |
| weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/impl/WxChannelAfterSaleServiceImpl.java | 在售后 Service 实现中补齐 9 个端点的调用与解码 |
| @JsonProperty("reject_confirm_exchange") | ||
| private List<Object> rejectConfirmExchange; |
| @JsonProperty("guarantee_order") | ||
| private JsonNode guaranteeOrder; |
🤖 Augment PR SummarySummary: This PR completes the missing Weixin Channel after-sale APIs in Changes:
Technical Notes: New endpoints follow existing JSON model conventions (Jackson annotations + Lombok) and reuse the common decode path for typed responses. 🤖 Was this summary useful? React with 👍 or 👎 |
| public class AfterSaleCreateResponse extends WxChannelBaseResponse { | ||
| private static final long serialVersionUID = 2680676438284658410L; | ||
|
|
||
| @JsonProperty("aftersale_id") |
There was a problem hiding this comment.
AfterSaleCreateResponse maps the returned id as @JsonProperty("aftersale_id"), but the official response examples for genaftersaleorder/refundpricediff show after_sale_order_id; if the API actually returns after_sale_order_id, afterSaleId will always deserialize as null.
Severity: medium
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
| @Data | ||
| @EqualsAndHashCode(callSuper = true) | ||
| @JsonInclude(JsonInclude.Include.NON_NULL) | ||
| public class AfterSaleGenAfterSaleOrderParam extends AfterSaleRefundPriceDiffParam { |
There was a problem hiding this comment.
AfterSaleGenAfterSaleOrderParam currently lacks the exchange_sku_info payload (e.g., new_sku_id) that the official docs require when type=EXCHANGE, so callers can’t represent that request shape via the SDK.
Severity: medium
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
| private String merchantText; | ||
|
|
||
| @JsonProperty("reject_confirm_exchange") | ||
| private List<Object> rejectConfirmExchange; |
There was a problem hiding this comment.
reject_confirm_exchange is documented as an array of media_id strings, but the model uses List<Object>; this weak typing makes it easy to send non-string elements and drift from the documented request contract.
Severity: low
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fcde07ccff
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| public class AfterSaleCreateResponse extends WxChannelBaseResponse { | ||
| private static final long serialVersionUID = 2680676438284658410L; | ||
|
|
||
| @JsonProperty("aftersale_id") |
There was a problem hiding this comment.
Map the created after-sale order id
When genAfterSaleOrder or refundPriceDiff succeeds against the current /channels/ec/aftersale API family, the created售后单号 is returned with the same after_sale_order_id name used by the rest of this service's after-sale models, not the legacy aftersale_id spelling. With only this mapping, AfterSaleCreateResponse#getAfterSaleId() stays null on successful creation/refund-price-difference calls, so callers cannot read the id they need for follow-up operations like get/accept/reject.
Useful? React with 👍 / 👎.
| public class GuaranteeOrderIdParam implements Serializable { | ||
| private static final long serialVersionUID = 4325797703077757139L; | ||
|
|
||
| @JsonProperty("guarantee_order_id") |
There was a problem hiding this comment.
Serialize the guarantee id as guarantee_id
The guarantee APIs expect the request field to be guarantee_id, but this shared DTO emits guarantee_order_id. Because getGuaranteeOrder, merchantAcceptGuarantee, merchantModifyGuarantee, and merchantProofGuarantee all inherit this field, callers who pass a valid guarantee id still send it under the wrong key and the API treats the required id as missing.
Useful? React with 👍 / 👎.
| public class GuaranteeOrderResponse extends WxChannelBaseResponse { | ||
| private static final long serialVersionUID = 3977781489692530604L; | ||
|
|
||
| @JsonProperty("guarantee_order") |
There was a problem hiding this comment.
Decode guarantee details from guarantee_info
For successful guarantee detail responses, the body field is guarantee_info, but this response DTO only looks for guarantee_order. Once the request id serialization is fixed, getGuaranteeOrder() can return errcode=0 while getGuaranteeOrder()'s payload remains null, dropping the details callers requested.
Useful? React with 👍 / 👎.
| @JsonProperty("content") | ||
| private String content; | ||
|
|
||
| @JsonProperty("pic_list") | ||
| private List<String> picList; |
There was a problem hiding this comment.
Nest guarantee proof evidence under proof_info
For merchant proof submissions that include text or images, the endpoint expects the evidence nested under proof_info using fields such as text and image_ids, but this DTO sends top-level content and pic_list. After a valid guarantee id is supplied, the proof payload is still in the wrong shape and will be rejected or ignored by the API.
Useful? React with 👍 / 👎.
weixin-java-channel的售后服务接口缺失微信小店官方文档中已提供的 9 个端点,导致代客售后、极速换货处理、保障单处理和工单同步场景无法通过 SDK 调用。本变更按官方文档补齐端点常量、服务接口、实现与请求/响应模型,统一接入现有解码路径。
接口面补齐(Service + Impl)
genAfterSaleOrder、refundPriceDiff、applyVirtualTelNum、handleFastExchangeReceipt、getGuaranteeOrder、merchantAcceptGuarantee、merchantModifyGuarantee、merchantProofGuarantee、syncWorkOrderWxChannelAfterSaleServiceImpl完成对应调用实现,复用ResponseUtils.decode(...)返回类型化结果API 常量补齐(AfterSale URL)
WxChannelApiUrlConstants.AfterSale增加 9 个缺失端点常量,覆盖代客售后、退差价、虚拟号、极速换货、保障单与工单同步数据模型补齐(严格对齐官方字段)
AfterSaleGenAfterSaleOrderParamAfterSaleRefundPriceDiffParamAfterSaleHandleFastExchangeReceiptParamGuaranteeOrderIdParamGuaranteeMerchantModifyParamGuaranteeMerchantProofParamSyncWorkOrderParam(含工单嵌套结构)AfterSaleCreateResponseAfterSaleVirtualTelNumResponseGuaranteeOrderResponse示例(新增端点调用方式)