логи для нотификации tbank
Deploy / deploy (push) Successful in 56s

This commit is contained in:
Раис Юсупалиев
2026-06-20 00:26:48 +03:00
parent 65c07f1da3
commit cbcd9ca1bc
3 changed files with 45 additions and 3 deletions
+24
View File
@@ -241,9 +241,23 @@ async def handle_tbank_payment_notification(
notification: TBankPaymentNotification,
service: AggregatorService = Depends(get_aggregator_service),
) -> PlainTextResponse:
logger.info(
"tbank_notification_received",
order_id=notification.OrderId,
status=notification.Status,
success=notification.Success,
payment_id=notification.PaymentId,
error_code=notification.ErrorCode,
amount=notification.Amount,
)
try:
response_body = await service.handle_tbank_payment_notification(notification)
except InvalidTBankPaymentNotificationError as exc:
logger.warning(
"tbank_notification_rejected",
order_id=notification.OrderId,
reason="invalid_token",
)
raise HTTPException(
status_code=status.HTTP_400_BAD_REQUEST,
detail={
@@ -252,6 +266,11 @@ async def handle_tbank_payment_notification(
},
) from exc
except TBankPaymentNotificationProcessingError as exc:
logger.error(
"tbank_notification_processing_failed",
order_id=notification.OrderId,
exc_info=True,
)
raise HTTPException(
status_code=status.HTTP_503_SERVICE_UNAVAILABLE,
detail={
@@ -260,6 +279,11 @@ async def handle_tbank_payment_notification(
},
) from exc
except AggregatorServiceError as exc:
logger.error(
"tbank_notification_processing_failed",
order_id=notification.OrderId,
exc_info=True,
)
raise HTTPException(
status_code=status.HTTP_503_SERVICE_UNAVAILABLE,
detail={