def alert_on_error_processing_transfer_notification(
notification: "TransferNotificationRequest",
message: str | None = None,
) -> None:
if _ignore_alert():
return
try:
title = f"Error processing Adyen transfer notification {notification.data.id}:{notification.data.sequenceNumber}"
legacy_datadog_api.Event.create( # type: ignore[attr-defined, no-untyped-call]
title=title,
text=message or title,
priority="normal",
alert_type="error",
tags=_tag_list(
{
"api": "adyen_balance_platform_transfer_notification_v4",
"message_type": mandatory(value=notification.type),
"transfer_type": mandatory(notification.data.type),
"transfer_id": mandatory(notification.data.id),
"transfer_sequence_number": str(
mandatory(notification.data.sequenceNumber)
),
}
),
)
except Exception as e:
current_logger.exception(f"Error sending Datadog alert: {e}")