Przeglądaj źródła

fix(wechatpay): 修复平台证书验证逻辑

- 调整平台公钥实例获取逻辑,支持 PUB_KEY_ID_ 开头的序列号识别
- 优化证书验证流程,提高支付回调处理的准确性
- 保持时间偏移校验逻辑不变,确保安全性
runphp 3 miesięcy temu
rodzic
commit
aaaf93ea23
1 zmienionych plików z 1 dodań i 1 usunięć
  1. 1 1
      src/Service/NotifyService.php

+ 1 - 1
src/Service/NotifyService.php

@@ -27,7 +27,7 @@ class NotifyService
         $nonce = $headers['Wechatpay-Nonce'] ?? ''; // 请根据实际情况获取
         
         $apiv3Key = $this->config->api_v3_key;
-        $platformPublicKeyInstance = $this->config->platform_cert;
+        $platformPublicKeyInstance = str_starts_with($serial,'PUB_KEY_ID_')?$this->config->public_key:$this->config->platform_cert;
 
         $timeOffsetStatus = 300 >= abs(Formatter::timestamp() - (int)$timestamp);
         if (!$timeOffsetStatus) {