@@ -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={
|
||||
|
||||
Reference in New Issue
Block a user