Skip to content

补齐 WxChannelAfterSaleService 缺失的 9 个官方售后端点(含保障单与工单同步)#4034

Open
Copilot wants to merge 2 commits into
developfrom
copilot/add-wxchannel-aftersale-endpoints
Open

补齐 WxChannelAfterSaleService 缺失的 9 个官方售后端点(含保障单与工单同步)#4034
Copilot wants to merge 2 commits into
developfrom
copilot/add-wxchannel-aftersale-endpoints

Conversation

Copilot AI commented May 31, 2026

Copy link
Copy Markdown
Contributor

weixin-java-channel 的售后服务接口缺失微信小店官方文档中已提供的 9 个端点,导致代客售后、极速换货处理、保障单处理和工单同步场景无法通过 SDK 调用。
本变更按官方文档补齐端点常量、服务接口、实现与请求/响应模型,统一接入现有解码路径。

  • 接口面补齐(Service + Impl)

    • 新增 9 个服务方法:genAfterSaleOrderrefundPriceDiffapplyVirtualTelNumhandleFastExchangeReceiptgetGuaranteeOrdermerchantAcceptGuaranteemerchantModifyGuaranteemerchantProofGuaranteesyncWorkOrder
    • WxChannelAfterSaleServiceImpl 完成对应调用实现,复用 ResponseUtils.decode(...) 返回类型化结果
  • API 常量补齐(AfterSale URL)

    • WxChannelApiUrlConstants.AfterSale 增加 9 个缺失端点常量,覆盖代客售后、退差价、虚拟号、极速换货、保障单与工单同步
  • 数据模型补齐(严格对齐官方字段)

    • 新增请求/响应模型:
      • AfterSaleGenAfterSaleOrderParam
      • AfterSaleRefundPriceDiffParam
      • AfterSaleHandleFastExchangeReceiptParam
      • GuaranteeOrderIdParam
      • GuaranteeMerchantModifyParam
      • GuaranteeMerchantProofParam
      • SyncWorkOrderParam(含工单嵌套结构)
      • AfterSaleCreateResponse
      • AfterSaleVirtualTelNumResponse
      • GuaranteeOrderResponse
  • 示例(新增端点调用方式)

@Override
public AfterSaleCreateResponse refundPriceDiff(AfterSaleRefundPriceDiffParam param) throws WxErrorException {
  String resJson = shopService.post(AFTER_SALE_REFUND_PRICE_DIFF_URL, param);
  return ResponseUtils.decode(resJson, AfterSaleCreateResponse.class);
}

Copilot AI changed the title [WIP] Add missing after sale endpoints for WxChannelAfterSaleService 补齐 WxChannelAfterSaleService 缺失的 9 个官方售后端点(含保障单与工单同步) Jun 1, 2026
@binarywang binarywang added this to the 4.8.5 milestone Jun 1, 2026
@binarywang binarywang marked this pull request as ready for review July 1, 2026 01:57
Copilot AI review requested due to automatic review settings July 1, 2026 01:57

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 个端点的调用与解码

Comment on lines +27 to +28
@JsonProperty("reject_confirm_exchange")
private List<Object> rejectConfirmExchange;
Comment on lines +14 to +15
@JsonProperty("guarantee_order")
private JsonNode guaranteeOrder;
@augmentcode

augmentcode Bot commented Jul 1, 2026

Copy link
Copy Markdown
🤖 Augment PR Summary

Summary: This PR completes the missing Weixin Channel after-sale APIs in weixin-java-channel, covering additional aftersale initiation flows and guarantee/work-order capabilities.

Changes:

  • Added 9 new aftersale service methods to WxChannelAfterSaleService and implemented them in WxChannelAfterSaleServiceImpl using the existing shopService.post(...) + ResponseUtils.decode(...) pattern.
  • Extended WxChannelApiUrlConstants.AfterSale with the corresponding 9 endpoint URL constants.
  • Introduced new request/response models for: aftersale creation (代客发起/退差价), virtual tel number exchange, fast-exchange receipt handling, guarantee order operations, and work-order sync.
  • Added TestNG coverage in WxChannelAfterSaleServiceImplTest to exercise the new endpoints through the injected WxChannelService.

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 👎

@augmentcode augmentcode Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review completed. 3 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

public class AfterSaleCreateResponse extends WxChannelBaseResponse {
private static final long serialVersionUID = 2680676438284658410L;

@JsonProperty("aftersale_id")

@augmentcode augmentcode Bot Jul 1, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

Fix This in Augment

🤖 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 {

@augmentcode augmentcode Bot Jul 1, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

private String merchantText;

@JsonProperty("reject_confirm_exchange")
private List<Object> rejectConfirmExchange;

@augmentcode augmentcode Bot Jul 1, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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")

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 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")

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, 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")

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

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 👍 / 👎.

Comment on lines +15 to +19
@JsonProperty("content")
private String content;

@JsonProperty("pic_list")
private List<String> picList;

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 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[weixin-java-channel] WxChannelAfterSaleService 缺失代客售后/保障单等9个端点

3 participants