Skip to content

Commit e1d447f

Browse files
committed
fix: 兼容旧版退款提现通知解析
1 parent 2f1aa7b commit e1d447f

2 files changed

Lines changed: 26 additions & 0 deletions

File tree

weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/EcommerceService.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,15 @@ <T> T combineTransactions(TradeTypeEnum tradeType,
532532
*/
533533
RefundNotifyResult parseRefundNotifyResult(String notifyData, SignatureHeader header) throws WxPayException;
534534

535+
/**
536+
* @deprecated 从 4.8.5.B 起,请改用使用 {@link SignatureHeader} 的同名方法;5.0 将移除。
537+
*/
538+
@Deprecated
539+
default RefundNotifyResult parseRefundNotifyResult(String notifyData,
540+
com.github.binarywang.wxpay.bean.ecommerce.SignatureHeader header) throws WxPayException {
541+
return parseRefundNotifyResult(notifyData, toUnifiedSignatureHeader(header));
542+
}
543+
535544
/**
536545
* <pre>
537546
* 提现状态变更通知回调数据处理
@@ -545,6 +554,15 @@ <T> T combineTransactions(TradeTypeEnum tradeType,
545554
*/
546555
WithdrawNotifyResult parseWithdrawNotifyResult(String notifyData, SignatureHeader header) throws WxPayException;
547556

557+
/**
558+
* @deprecated 从 4.8.5.B 起,请改用使用 {@link SignatureHeader} 的同名方法;5.0 将移除。
559+
*/
560+
@Deprecated
561+
default WithdrawNotifyResult parseWithdrawNotifyResult(String notifyData,
562+
com.github.binarywang.wxpay.bean.ecommerce.SignatureHeader header) throws WxPayException {
563+
return parseWithdrawNotifyResult(notifyData, toUnifiedSignatureHeader(header));
564+
}
565+
548566
/**
549567
* <pre>
550568
* 二级商户账户余额提现API

weixin-java-pay/src/test/java/com/github/binarywang/wxpay/service/LegacyEcommerceApiCompatibilityTest.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,12 @@ public void shouldKeepLegacyTransactionResultAndTradeTypeAvailable() {
1717
Assert.assertNotNull(result);
1818
Assert.assertEquals(TradeTypeEnum.JSAPI.name(), "JSAPI");
1919
}
20+
21+
@Test
22+
public void shouldKeepLegacyRefundAndWithdrawNotificationSignatures() throws Exception {
23+
Class<?> legacyHeader = com.github.binarywang.wxpay.bean.ecommerce.SignatureHeader.class;
24+
25+
Assert.assertNotNull(EcommerceService.class.getMethod("parseRefundNotifyResult", String.class, legacyHeader));
26+
Assert.assertNotNull(EcommerceService.class.getMethod("parseWithdrawNotifyResult", String.class, legacyHeader));
27+
}
2028
}

0 commit comments

Comments
 (0)