How indra2215/razorpay works
The Payment State Recovery Engine is a FastAPI/SQLite service with a dashboard for investigating payment-state drift and safely handling repairs. Its main workflow is to expose a case, reconstruct its evidence timeline, obtain a typed diagnosis, then pass any proposed action through deterministic invariant and idempotency checks before execution and audit. Separate capabilities include synthetic scenario seeding, batch evaluation, Razorpay order creation, and signed webhook ingestion. The excerpts establish the API orchestration and core decision boundaries; some timeline, evaluation, and UI internals were not shown, so those relationships are limited to documented behavior.
Main entry points: main.py FastAPI service · repair.py Deterministic repair gate · db.py SQLite ledger · ai.py Typed diagnosis
Components 13
API and dashboard
- FastAPI service
app/main.py - Case dashboard
static/index.html - Batch evaluation
app/main.py
Evidence and diagnosis
- Case timeline
app/main.py - Typed diagnosis
app/ai.py
Repair safety
- Scenarios and invariants
app/domain.py - Deterministic repair gate
app/repair.py - SQLite ledger
app/db.py
Payment integrations
- Order creation
app/main.py - Webhook ingestion
app/main.py
Other components
- Merchant user
- Razorpay
- OpenAI-compatible model
Connections 17
- Merchant user → FastAPI service: uses
README.md - FastAPI service → Case dashboard: serves
README.md - FastAPI service → Case timeline: reconstructs
app/main.py - Case timeline → SQLite ledger: reads evidence
app/main.py - FastAPI service → Typed diagnosis: requests diagnosis
app/main.py - Typed diagnosis → OpenAI-compatible model: requests diagnosis
app/ai.py - FastAPI service → Deterministic repair gate: submits action
app/main.py - Deterministic repair gate → Scenarios and invariants: checks invariants
app/repair.py - Deterministic repair gate → SQLite ledger: records repair
app/repair.py - FastAPI service → SQLite ledger: reads and writes
app/main.py - FastAPI service → Batch evaluation: runs batch
README.md - Batch evaluation → Typed diagnosis: diagnoses cases
app/main.py - Batch evaluation → Deterministic repair gate: tests repairs
app/main.py - FastAPI service → Order creation: routes request
app/main.py - Order creation → Razorpay: creates order
app/main.py - Razorpay → Webhook ingestion: sends events
README.md - Webhook ingestion → SQLite ledger: stores event
app/main.py