Skip to content

feat(miniapp): Add xpay_subscribe_ios_refund_query_notify event support#3974

Open
Copilot wants to merge 2 commits intodevelopfrom
copilot/add-ios-refund-notification-fields
Open

feat(miniapp): Add xpay_subscribe_ios_refund_query_notify event support#3974
Copilot wants to merge 2 commits intodevelopfrom
copilot/add-ios-refund-notification-fields

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 30, 2026

WxMaMessage was missing all fields for the WeChat virtual payment iOS refund query push notification (xpay_subscribe_ios_refund_query_notify), and WxConsts.EventType had no constant for this event type.

Changes

  • WxConsts.EventType — add XPAY_SUBSCRIBE_IOS_REFUND_QUERY_NOTIFY = "xpay_subscribe_ios_refund_query_notify"

  • WxMaMessage — add 8 fields matching the WxaVirtualPayIosRefundQueryNotifyEvent spec:

    XML/JSON field Java field Description
    refund_time refundTime 问询时间,Unix 时间戳
    order_time orderTime 退款订单对应交易时间,Unix 时间戳
    channel_bill channelBill Apple 支付票据号
    bundleid bundleid Apple bundleId
    product_id xpayProductId 道具 id
    p_count pCount 道具/代币数量
    refund_request_reason refundRequestReason 用户请求退款原因
    provide_status provideStatus 发货状态(0未发货/1已发货/2发货中)
  • WxMaMessageTest — add XML and JSON parsing tests covering all new fields, asserting against the new WxConsts.EventType.XPAY_SUBSCRIBE_IOS_REFUND_QUERY_NOTIFY constant

Copilot AI changed the title [WIP] Add missing fields for iOS refund notification in WxMaMessage feat(miniapp): Add xpay_subscribe_ios_refund_query_notify event support Apr 30, 2026
Copilot AI requested a review from binarywang April 30, 2026 08:04
@binarywang binarywang marked this pull request as ready for review April 30, 2026 11:50
Copilot AI review requested due to automatic review settings April 30, 2026 11:50
@augmentcode
Copy link
Copy Markdown

augmentcode Bot commented Apr 30, 2026

🤖 Augment PR Summary

Summary: Adds MiniApp support for the WeChat virtual payment iOS refund query push event (xpay_subscribe_ios_refund_query_notify).

Changes:

  • Introduces WxConsts.EventType.XPAY_SUBSCRIBE_IOS_REFUND_QUERY_NOTIFY so the new event can be identified consistently.
  • Extends WxMaMessage with event-specific fields (e.g., refund/order time, Apple bill/bundle id, product info, refund reason, shipping status).
  • Adds XML and JSON parsing tests for the new event to ensure the new fields deserialize correctly.

Technical Notes: Field mappings are added via @SerializedName and @XStreamAlias to support both JSON and XML payload formats.

🤖 Was this summary useful? React with 👍 or 👎

Copy link
Copy Markdown

@augmentcode augmentcode Bot left a comment

Choose a reason for hiding this comment

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

Review completed. 1 suggestion posted.

Fix All in Augment

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

@SerializedName("provide_status")
@XStreamAlias("provide_status")
@XStreamConverter(value = XStreamCDataConverter.class)
private String provideStatus;
Copy link
Copy Markdown

@augmentcode augmentcode Bot Apr 30, 2026

Choose a reason for hiding this comment

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

WxMaMessage.java:539 — The WeChat spec for WxaVirtualPayIosRefundQueryNotifyEvent also includes pay_order_id (退款对应支付订单号), but there’s no corresponding field here, so callers can’t read that value.

Severity: medium

Other Locations
  • weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/bean/WxMaMessageTest.java:479
  • weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/bean/WxMaMessageTest.java:504
  • weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/bean/WxMaMessageTest.java:516

Fix This in Augment

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

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

该 PR 为小程序虚拟支付 iOS 退款查询通知事件 xpay_subscribe_ios_refund_query_notify 增加事件类型常量,并在 WxMaMessage 中补齐该事件推送报文的缺失字段,同时新增对应的 XML/JSON 解析测试,以完善 miniapp 消息推送解析能力。

Changes:

  • WxConsts.EventType 中新增 XPAY_SUBSCRIBE_IOS_REFUND_QUERY_NOTIFY 事件常量
  • WxMaMessage 中新增 8 个与该事件对应的字段映射(XML/JSON)
  • WxMaMessageTest 中新增 XML 与 JSON 两种格式的解析测试覆盖新字段与新常量

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

File Description
weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/bean/WxMaMessageTest.java 新增该事件的 XML/JSON 解析测试与字段断言
weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/WxMaMessage.java 为 iOS 退款查询通知事件补齐字段定义与序列化注解
weixin-java-common/src/main/java/me/chanjar/weixin/common/api/WxConsts.java 新增事件类型常量 XPAY_SUBSCRIBE_IOS_REFUND_QUERY_NOTIFY

Comment on lines +475 to +476
@XStreamConverter(value = XStreamCDataConverter.class)
private String refundTime;
Copy link

Copilot AI Apr 30, 2026

Choose a reason for hiding this comment

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

这里的 refund_time 在文档中是 Unix 时间戳(数值语义),但当前用 String + XStreamCDataConverter 建模,会导致调用方需要自行解析且与本类里其他时间戳字段(如 ComplaintTime/RefundStartTimestamp 等 Long 类型)不一致。建议将 refundTime 改为 Long(或 Integer/Long 统一口径),并移除该字段上的 XStreamCDataConverter(数值字段通常不需要 CDATA converter),同时相应更新测试断言。

Suggested change
@XStreamConverter(value = XStreamCDataConverter.class)
private String refundTime;
private Long refundTime;

Copilot uses AI. Check for mistakes.
Comment on lines +484 to +485
@XStreamConverter(value = XStreamCDataConverter.class)
private String orderTime;
Copy link

Copilot AI Apr 30, 2026

Choose a reason for hiding this comment

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

order_time 同样是 Unix 时间戳字段,目前用 String 表达会弱化类型信息且与本类既有的 Long 时间戳字段不一致。建议将 orderTime 改为 Long,并去掉 XStreamCDataConverter(如果需要兼容字符串/数值两种 JSON 表达,可保留 Long 并依赖 Gson/XStream 的数值解析能力),同时调整对应测试。

Suggested change
@XStreamConverter(value = XStreamCDataConverter.class)
private String orderTime;
private Long orderTime;

Copilot uses AI. Check for mistakes.
Comment on lines +520 to +521
@XStreamConverter(value = XStreamCDataConverter.class)
private String pCount;
Copy link

Copilot AI Apr 30, 2026

Choose a reason for hiding this comment

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

p_count 是数量字段(数值语义),目前用 String 建模不利于后续做数值比较/计算,也与本类中类似字段(如 RefundFee/RetryTimes 等 Integer)不一致。建议将 pCount 改为 Integer,并移除 XStreamCDataConverter,同时更新解析测试断言。

Suggested change
@XStreamConverter(value = XStreamCDataConverter.class)
private String pCount;
private Integer pCount;

Copilot uses AI. Check for mistakes.
Comment on lines +538 to +539
@XStreamConverter(value = XStreamCDataConverter.class)
private String provideStatus;
Copy link

Copilot AI Apr 30, 2026

Choose a reason for hiding this comment

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

provide_status 表示枚举状态(0/1/2),建议用 Integer 而不是 String 来建模,避免调用方自行解析且与本类其它状态字段(如 retCode/teamType 等 Integer)保持一致;相应可移除 XStreamCDataConverter 并更新测试断言。

Suggested change
@XStreamConverter(value = XStreamCDataConverter.class)
private String provideStatus;
private Integer provideStatus;

Copilot uses AI. Check for mistakes.
Comment on lines +502 to +506
/**
* 虚拟支付 iOS 退款查询通知
* 文档:https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/virtual-payment/ios.html
*/
public static final String XPAY_SUBSCRIBE_IOS_REFUND_QUERY_NOTIFY = "xpay_subscribe_ios_refund_query_notify";
Copy link

Copilot AI Apr 30, 2026

Choose a reason for hiding this comment

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

仓库里小程序虚拟支付通知事件名已在 WxMaConstants.XPayNotifyEvent 中集中维护(含 xpay_refund_notify/xpay_complaint_notify 等)。这里单独在 WxConsts.EventType 新增一个 XPAY_* 常量会造成事件常量来源分散;建议要么把该事件也补充到 WxMaConstants.XPayNotifyEvent 并在 miniapp 场景统一使用它,要么在 WxConsts 中补齐同类 XPAY 通知常量以保持一致。

Copilot uses AI. Check for mistakes.
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.

小程序消息推送WxMaMessage缺少虚拟支付ios退款通知【xpay_subscribe_ios_refund_query_notify】相关字段

3 participants