Skip to content

Alerting

components.payment_gateway.internal.alerting.alert_on_error_processing_authorisation_request

alert_on_error_processing_authorisation_request(
    request, message=None
)
Source code in components/payment_gateway/internal/alerting.py
def alert_on_error_processing_authorisation_request(
    request: "AuthorisationRequest",
    message: str | None = None,
) -> None:
    if _ignore_alert():
        return

    try:
        title = f"Error processing Adyen authorisation request {request.schemeUniqueTransactionId}"
        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_authorisation_request",
                    "transaction_id": request.schemeUniqueTransactionId,
                }
            ),
        )
    except Exception as e:
        current_logger.exception(f"Error sending Datadog alert: {e}")

components.payment_gateway.internal.alerting.alert_on_error_processing_card_order_notification

alert_on_error_processing_card_order_notification(
    request, message=None
)
Source code in components/payment_gateway/internal/alerting.py
def alert_on_error_processing_card_order_notification(
    request: "CardOrderNotificationRequest",
    message: str | None = None,
) -> None:
    if _ignore_alert():
        return

    try:
        title = f"Error processing Adyen card order notification {request.data.id}"
        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_configuration_notification_v1",
                    "card_order_notification_id": mandatory(request.data.id),
                    "payment_instrument_id": mandatory(
                        request.data.paymentInstrumentId
                    ),
                    "card_order_item_id": mandatory(request.data.cardOrderItemId),
                }
            ),
        )
    except Exception as e:
        current_logger.exception(f"Error sending Datadog alert: {e}")

components.payment_gateway.internal.alerting.alert_on_error_processing_payment_instrument_notification

alert_on_error_processing_payment_instrument_notification(
    request, message=None
)
Source code in components/payment_gateway/internal/alerting.py
def alert_on_error_processing_payment_instrument_notification(
    request: "PaymentNotificationRequest",
    message: str | None = None,
) -> None:
    if _ignore_alert():
        return

    try:
        payment_instrument_id = mandatory(request.data.paymentInstrument).id
        title = f"Error processing Adyen payment instrument notification for {payment_instrument_id}"
        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_configuration_notification_v1",
                    "payment_instrument_id": payment_instrument_id,
                }
            ),
        )
    except Exception as e:
        current_logger.exception(f"Error sending Datadog alert: {e}")

components.payment_gateway.internal.alerting.alert_on_error_processing_transfer

alert_on_error_processing_transfer(data, message=None)
Source code in components/payment_gateway/internal/alerting.py
def alert_on_error_processing_transfer(
    data: "TransferData",
    message: str | None = None,
) -> None:
    if _ignore_alert():
        return

    try:
        title = f"Error processing Adyen transfer {data.id}:{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",
                    "transfer_type": mandatory(data.type),
                    "transfer_id": mandatory(data.id),
                    "transfer_sequence_number": str(mandatory(data.sequenceNumber)),
                }
            ),
        )
    except Exception as e:
        current_logger.exception(f"Error sending Datadog alert: {e}")

components.payment_gateway.internal.alerting.alert_on_error_processing_transfer_notification

alert_on_error_processing_transfer_notification(
    notification, message=None
)
Source code in components/payment_gateway/internal/alerting.py
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}")