fix: Fix errors and small improvements
This commit is contained in:
@@ -79,6 +79,8 @@ class LogsHandler
|
||||
// Форматируем дату для отображения (убираем микросекунды и временную зону для читаемости)
|
||||
$formattedDatetime = $this->formatDateTime($datetime);
|
||||
|
||||
$message = rtrim($message, ' [] []');
|
||||
|
||||
$parsed[] = [
|
||||
'datetime' => $formattedDatetime,
|
||||
'datetime_raw' => $datetime,
|
||||
|
||||
@@ -64,6 +64,7 @@ class SignatureValidator
|
||||
$calculatedHash = bin2hex(hash_hmac($algorithm, $checkString, $secretKey, true));
|
||||
|
||||
if (! hash_equals($calculatedHash, $data['hash'])) {
|
||||
$this->logger->error('Request with invalid Telegram Signature. Check Telegram Bot Token is correct.');
|
||||
throw new TelegramInvalidSignatureException('Invalid Telegram signature!');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ use Openguru\OpenCartFramework\Contracts\ExceptionHandlerInterface;
|
||||
use Openguru\OpenCartFramework\Http\JsonResponse;
|
||||
use Openguru\OpenCartFramework\Http\Response;
|
||||
use Openguru\OpenCartFramework\Telegram\Exceptions\TelegramInvalidSignatureException;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Throwable;
|
||||
|
||||
class CustomExceptionHandler implements ExceptionHandlerInterface
|
||||
|
||||
Reference in New Issue
Block a user