-
-
Notifications
You must be signed in to change notification settings - Fork 9.1k
fix: 兼容旧版退款提现通知解析 #4095
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: 兼容旧版退款提现通知解析 #4095
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 { | ||
|
Comment on lines
+539
to
+540
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 新增参数类型互不相关的重载后,下游原本合法的 AGENTS.md reference: AGENTS.md:L47-L48 Useful? React with 👍 / 👎.
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 已在后续 PR #4096 修复:采用旧头继承新头,而非增加单参数重载;这样保留原有两参数 null 调用且无歧义。 |
||
|
|
||
| /** | ||
| * <pre> | ||
| * 提现状态变更通知回调数据处理 | ||
|
|
@@ -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 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 已在后续 PR #4096 补充回归测试,验证旧头与新头的继承关系,以及 signed/serialNo 到 signature/serial 的字段映射。 |
||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
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🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
There was a problem hiding this comment.
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) 与提现同类调用不再二义。