Skip to content
Merged
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 @@ -532,6 +532,15 @@ <T> T combineTransactions(TradeTypeEnum tradeType,
*/
RefundNotifyResult parseRefundNotifyResult(String notifyData, SignatureHeader header) throws WxPayException;

/**
* @deprecated 从 4.8.5.B 起,请改用使用 {@link SignatureHeader} 的同名方法;5.0 将移除。
*/
@Deprecated
default RefundNotifyResult parseRefundNotifyResult(String notifyData,
com.github.binarywang.wxpay.bean.ecommerce.SignatureHeader header) throws WxPayException {

@augmentcode augmentcode Bot Aug 18, 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.

此重载会让原本可用的 parseRefundNotifyResult(notifyData, null) 变成二义性调用:两个 SignatureHeader 类型没有继承关系,而上方 Javadoc 又将 null 定义为跳过验签的支持用法,因此现有调用方升级后无法重新编译。其他位置也会发生相同问题:weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/EcommerceService.java:562

Severity: medium

Other Locations
  • weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/EcommerceService.java:562

Fix This in Augment

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

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

已在后续 PR #4096 修复:旧 SignatureHeader 现继承新类型,使旧重载成为更具体的候选,parseRefundNotifyResult(notifyData, null) 与提现同类调用不再二义。

Comment on lines +539 to +540

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 避免让允许的 null 调用产生重载歧义

新增参数类型互不相关的重载后,下游原本合法的 service.parseRefundNotifyResult(notifyData, null) 会因无法在两个 SignatureHeader 重载之间选择而编译失败;相邻 Javadoc 明确说明 null 表示不校验请求头。parseWithdrawNotifyResult 的新增重载也有相同问题,因此需要让两个参数类型具备明确的继承关系,或采用不会使现有 null 调用歧义的兼容方案;当前反射测试只能确认签名存在,无法发现此源码兼容性回归。

AGENTS.md reference: AGENTS.md:L47-L48

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

已在后续 PR #4096 修复。单参数重载不能消除原有的两参数 null 调用歧义,因此采用旧头继承新头的方案,使旧重载成为更具体的匹配。

return parseRefundNotifyResult(notifyData, toUnifiedSignatureHeader(header));
}
Comment on lines 533 to +542

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

已在后续 PR #4096 修复:采用旧头继承新头,而非增加单参数重载;这样保留原有两参数 null 调用且无歧义。


/**
* <pre>
* 提现状态变更通知回调数据处理
Expand All @@ -545,6 +554,15 @@ <T> T combineTransactions(TradeTypeEnum tradeType,
*/
WithdrawNotifyResult parseWithdrawNotifyResult(String notifyData, SignatureHeader header) throws WxPayException;

/**
* @deprecated 从 4.8.5.B 起,请改用使用 {@link SignatureHeader} 的同名方法;5.0 将移除。
*/
@Deprecated
default WithdrawNotifyResult parseWithdrawNotifyResult(String notifyData,
com.github.binarywang.wxpay.bean.ecommerce.SignatureHeader header) throws WxPayException {
return parseWithdrawNotifyResult(notifyData, toUnifiedSignatureHeader(header));
}

/**
* <pre>
* 二级商户账户余额提现API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,12 @@ public void shouldKeepLegacyTransactionResultAndTradeTypeAvailable() {
Assert.assertNotNull(result);
Assert.assertEquals(TradeTypeEnum.JSAPI.name(), "JSAPI");
}

@Test
public void shouldKeepLegacyRefundAndWithdrawNotificationSignatures() throws Exception {
Class<?> legacyHeader = com.github.binarywang.wxpay.bean.ecommerce.SignatureHeader.class;

Assert.assertNotNull(EcommerceService.class.getMethod("parseRefundNotifyResult", String.class, legacyHeader));
Assert.assertNotNull(EcommerceService.class.getMethod("parseWithdrawNotifyResult", String.class, legacyHeader));
Comment on lines +25 to +26

@augmentcode augmentcode Bot Aug 18, 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.

这两项断言仅验证反射能发现方法,未执行 default 委托或校验旧头字段 signedserialNo 到新字段的映射;因此适配后验签失败、委托到错误方法等行为回归仍会测试通过。

Severity: low

Fix This in Augment

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

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

已在后续 PR #4096 补充回归测试,验证旧头与新头的继承关系,以及 signed/serialNo 到 signature/serial 的字段映射。

}
}