Skip to content

feat(miniapp): 添加虚拟支付退款推送(xpay_refund_notify)事件字段#3896

Merged
binarywang merged 3 commits intodevelopfrom
copilot/add-refund-notification-fields
Mar 3, 2026
Merged

feat(miniapp): 添加虚拟支付退款推送(xpay_refund_notify)事件字段#3896
binarywang merged 3 commits intodevelopfrom
copilot/add-refund-notification-fields

Conversation

Copy link
Contributor

Copilot AI commented Mar 3, 2026

WxMaMessage 缺少微信虚拟支付退款推送事件(xpay_refund_notify)的字段支持,导致开发者无法直接解析退款回调消息。

Changes

  • WxMaMessage — 新增 xpay_refund_notify 推送事件全部字段:

    字段 类型 说明
    wxRefundId String 微信退款单号
    mchRefundId String 商户退款单号
    wxOrderId String 对应支付单微信单号
    mchOrderId String 对应支付单商户单号
    refundFee Integer 退款金额(分)
    retCode Integer 退款结果(0=成功)
    retMsg String 退款失败原因
    refundStartTimestamp Long 开始退款时间戳
    refundSuccTimestamp Long 退款成功时间戳
    wxpayRefundTransactionId String 退款微信支付单号
    retryTimes Integer 重试次数
    teamInfo WxMaXPayTeamInfo 拼团信息
  • WxMaXPayTeamInfo(新增)— 拼团信息 POJO,复用于 xpay_goods_deliver_notifyxpay_refund_notify 两个推送事件,字段:activityIdteamIdteamTypeteamAction

  • WxMaConstants.XPayNotifyEvent — 新增常量 REFUND = "xpay_refund_notify"

  • WxMaMessageTest — 新增 testXPayRefundNotifyFromXmltestXPayRefundNotifyFromJson 两个测试用例,覆盖所有退款字段及 TeamInfo 嵌套对象的反序列化正确性

参考文档:虚拟支付退款推送

Original prompt

This section details on the original issue you should resolve

<issue_title>小程序微信支付回调消息事件</issue_title>
<issue_description>### 简要描述
需要在WxMaMessage里面新增关于 微信虚拟支付退款产生的通知事件相关字段

官方文档地址

请提供所需功能对应的微信官方文档地址以便进行确认。
https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/virtual-payment.html#%E9%80%80%E6%AC%BE%E6%8E%A8%E9%80%81xpay-refund-notify</issue_description>

Comments on the Issue (you are @copilot in this section)


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Co-authored-by: binarywang <1343140+binarywang@users.noreply.github.com>
Copilot AI changed the title [WIP] Add refund notification fields to WxMaMessage feat(miniapp): 添加虚拟支付退款推送(xpay_refund_notify)事件字段 Mar 3, 2026
@binarywang binarywang marked this pull request as ready for review March 3, 2026 08:29
Copilot AI review requested due to automatic review settings March 3, 2026 08:29
Copy link

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 为小程序消息模型补齐“虚拟支付退款推送事件(xpay_refund_notify)”的字段解析能力,使 SDK 使用方可以直接通过 WxMaMessage 读取退款回调的关键数据。

Changes:

  • WxMaMessage 中新增 xpay_refund_notify 事件的退款单号、订单号、金额、结果、时间戳、重试次数及拼团信息等字段
  • 新增 WxMaXPayTeamInfo POJO,用于承载拼团信息(TeamInfo)
  • WxMaConstants.XPayNotifyEvent 中新增 REFUND = "xpay_refund_notify" 常量

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/constant/WxMaConstants.java 增加 xpay_refund_notify 事件常量,便于路由/判断事件类型
weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/xpay/WxMaXPayTeamInfo.java 新增拼团信息数据结构,供回调消息字段复用
weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/WxMaMessage.java 增加退款推送事件字段定义与(JSON/XML)映射注解

Comment on lines +317 to +321
// xpay_refund_notify 退款推送字段

/**
* 微信退款单号.
* xpay_refund_notify
Copy link

Copilot AI Mar 3, 2026

Choose a reason for hiding this comment

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

新增 xpay_refund_notify 字段后,建议在现有 WxMaMessageTest 中补充对应的 fromXml/fromJson 解析用例(含 TeamInfo 嵌套对象),以确保字段名大小写、类型(Integer/Long)及反序列化行为在后续重构时不会回归。当前 PR 仅新增字段定义,缺少针对该事件的覆盖。

Copilot uses AI. Check for mistakes.
@binarywang
Copy link
Owner

@copilot apply changes based on the comments in this thread

Co-authored-by: binarywang <1343140+binarywang@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 3, 2026

@copilot apply changes based on the comments in this thread

已在 WxMaMessageTest 中新增两个测试方法(commit 55ccf0a):

  • testXPayRefundNotifyFromXml — 验证 XML 格式解析,含所有退款字段及 TeamInfo 嵌套对象
  • testXPayRefundNotifyFromJson — 验证 JSON 格式解析,同样覆盖 TeamInfo 嵌套对象

@binarywang binarywang merged commit 108b00b into develop Mar 3, 2026
1 check passed
@binarywang binarywang deleted the copilot/add-refund-notification-fields branch March 3, 2026 13:49
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.

小程序微信支付回调消息事件

3 participants