Skip to content

Verifactu — events

Scaffolded stub — replace with proper documentation when this module is next touched.

Per-module slice of docs/events-catalog.md (auto-generated). Update both files when adding or removing events.

Published

EventWherePayload
verifactu.record.rejectedservices/submission_queue.pyclinic_id, record_id, invoice_id, AEAT error summary — emitted when AEAT rejects a record.

Subscribed

EventHandlerModeEffect
invoice.paidevents.on_invoice_paidown-session, payload-only (ADR 0019)Queues the fiscal record for the paid invoice.
verifactu.record.rejectedtasks.on_rejected_eventown-session (spawns a task)Emails the clinic admins, throttled to one alert per clinic per 30 min.

Both are wired through VerifactuModule.get_event_handlers(), so they are subscribed only while the module is installed (issue #91 / ADR 0020).

Adding a new event

  1. Add the constant to backend/app/core/events/types.py (EventType).
  2. Publish from a service method after flush() — the bus runs handlers inline, before the request commits. Pass db=db so transactional subscribers can join the transaction (ADR 0019, issue #183).
  3. Add the row to the table(s) above.
  4. Run python backend/scripts/generate_catalogs.py to refresh the global catalog.