This service simulates a marketing event pipeline for a fintech application.
The system:
- Accepts user behavioral events via HTTP.
- Applies declarative messaging rules.
- Prevents duplicate or excessive messages.
- Produces outbound send requests (stubbed).
- Exposes an audit/debug endpoint to explain decisions.
The goal is to demonstrate clean modeling, idempotency, deduplication, and auditability.
- signup_completed
- link_bank_success
- payment_initiated
- payment_failed
-
WELCOME_EMAIL Trigger: signup_completed Condition: marketing_opt_in == true Limit: once per user
-
BANK_LINK_NUDGE_SMS Trigger: link_bank_success Condition: within 24h after signup_completed
-
INSUFFICIENT_FUNDS_EMAIL Trigger: payment_failed Condition: failure_reason == INSUFFICIENT_FUNDS Limit: once per user per calendar day
-
HIGH_RISK_ALERT (internal) Trigger: payment_failed Condition: attempt_number >= 3 Output: logs only
POST /events GET /audit/{user_id}
- In-memory only
- Single process
- UTC everywhere
- No auth, queues, retries, metrics
- Rules defined in code
- Deduplication by user_id + template (+ day)
- HIGH_RISK_ALERT logged only
❗️тут
Сервис моделирует маркетинговый pipeline событий для финтех-приложения.
Система:
- Принимает события по HTTP
- Применяет правила
- Делает дедупликацию
- Формирует outbound-запросы
- Даёт audit/debug API
- signup_completed
- link_bank_success
- payment_initiated
- payment_failed
- WELCOME_EMAIL — при signup_completed и marketing_opt_in
- BANK_LINK_NUDGE_SMS — link_bank_success в течение 24ч
- INSUFFICIENT_FUNDS_EMAIL — 1 раз в день
- HIGH_RISK_ALERT — attempt_number >= 3, только лог
- Всё в памяти
- Один процесс
- UTC
- Без auth и очередей
- Правила только в коде