mirror of
https://github.com/BEDOLAGA-DEV/remnawave-bedolaga-telegram-bot.git
synced 2026-02-27 23:00:53 +00:00
fix: handle YooKassa NotFoundError gracefully in get_payment_info
Catch NotFoundError (404) separately from generic exceptions. Old/expired payments return 404 from YooKassa API — this is expected and should be logged as WARNING without traceback, not ERROR.
This commit is contained in:
@@ -5,6 +5,7 @@ from typing import Any
|
||||
import structlog
|
||||
from yookassa import Configuration, Payment as YooKassaPayment
|
||||
from yookassa.domain.common.confirmation_type import ConfirmationType
|
||||
from yookassa.domain.exceptions.not_found_error import NotFoundError as YooKassaNotFoundError
|
||||
from yookassa.domain.request.payment_request_builder import PaymentRequestBuilder
|
||||
|
||||
from app.config import settings
|
||||
@@ -412,6 +413,12 @@ class YooKassaService:
|
||||
}
|
||||
logger.warning('Платеж не найден в YooKassa ID', payment_id_in_yookassa=payment_id_in_yookassa)
|
||||
return None
|
||||
except YooKassaNotFoundError:
|
||||
logger.warning(
|
||||
'Платеж не найден в YooKassa (404)',
|
||||
payment_id_in_yookassa=payment_id_in_yookassa,
|
||||
)
|
||||
return None
|
||||
except Exception as e:
|
||||
logger.error(
|
||||
'Ошибка получения информации о платеже YooKassa',
|
||||
|
||||
Reference in New Issue
Block a user