diff --git a/app/services/yookassa_service.py b/app/services/yookassa_service.py index 671a5fa6..8403b89f 100644 --- a/app/services/yookassa_service.py +++ b/app/services/yookassa_service.py @@ -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',