Supplier event logger

components/event_logger/client.py emits supplier events to Payability’s internal EventLogger service, so a supplier’s Entrust identity-verification lifecycle is visible in the platform event stream that Growth & Retention, Compliance and analytics consume.

This is a different channel from EventBridge. EventBridge carries machine-to-machine process notifications between services; EventLogger records supplier-scoped, human-readable events against a supplier timeline. The Entrust flow writes to both, plus HubSpot.

Contract

Built on the internal eventlogger SDK (EventLoggerClient.captureMessage), which posts to <dsn>/capture-message.

Endpoint

EVENT_LOGGER_URL — https://api.payability.com/eventlogger/ in release, an API Gateway stage URL in dev

Instance

EVENT_LOGGER_INSTANCE_ID (8001)

Auth

EVENT_LOGGER_KEY (Secrets Manager)

Target

TargetTypes.SUPPLIER, targeted by supplier_key

Message type

EventTypes.EVENT

send_entrust_status_event(…​)

def send_entrust_status_event(
        self,
        supplier_key: str,
        status: str,
        workflow_run_id: str = None,
        person_id: str = None,
        verdict: str = None,
        logger: logging.Logger = None
) -> bool

Sends "Entrust identity verification: {status}" with the correlating ids in extra:

extra key Value

status

The lifecycle status — the same EntrustVerificationStatus values HubSpot receives: in_progress, verified, in_review, denied.

tool

Always ENTRUST, so consumers can distinguish this from other identity-verification sources.

verdict

VERIFIED / NOT_VERIFIED, when a terminal verdict exists (omitted for in_progress and review).

workflow_run_id

The Onfido run id, when known.

person_id

The supplier owner, when known.

Structured data goes in extra because the SDK’s context kwarg is not persisted by its build_msg.

Lazy, guarded construction

The client is instantiated eagerly by the endpoint handler and the worker, but the underlying SDK client is built on first use and its outcome cached:

  • Missing EVENT_LOGGER_URL, EVENT_LOGGER_INSTANCE_ID or EVENT_LOGGER_KEY → a warning is logged once and emission becomes a permanent no-op for that process. Leaving the URL empty is therefore a supported way to disable emission in an environment.

  • A construction failure (the SDK asserts on bad configuration) is logged, reported to Sentry, and cached as failed so it is not retried on every event.

Best effort by design

Like HubSpot, EventLogger is a downstream, non-authoritative sink. Every send is wrapped: failures are logged, captured to Sentry, and returned as False. The method never raises, so it can never fail Entrust session creation or the SWF aftermath task.

Because failures are swallowed, a missing supplier event is invisible in the underwriting data. If the event stream looks incomplete, check Sentry for SupplierEventLogger errors and verify the three EVENT_LOGGER_* values in the environment.

Callers

Caller Emits

interface/web_api/endpoint_handling/create_entrust_session.py

in_progress right after the session is persisted, alongside the HubSpot sync.

task/entrust/handle_identity_document_validation_response/implementation.py

verified / in_review / denied from __sync_external_status, which drives HubSpot and EventLogger together. The terminal path also passes verdict.

The worker injects it into TaskFactory as supplier_event_logger (swf_app.py); execute_task.py builds one too, so the Entrust reprocess path can construct the task.

Dependency

The eventlogger package is a private git dependency (https://github.com/Payability/EventLoggerPySDK.git, see [tool.uv.sources] in pyproject.toml), so installing requires git access — the same GIT_TOKEN as pyb-sdk.

Tests

development/unit_tests/components_/test_supplier_event_logger.py.