How yashtyagee/pratyavartan works
Pratyavartan is an autonomous payment-recovery service for failed merchant transactions, with a FastAPI backend and a Next.js merchant console. Its main workflow ingests and validates failure events, records pending payment state, diagnoses failures, applies compliance stopping rules, then selects recovery, monitoring, or escalation. Successful customer payments return through a signed webhook and update stored state. The console also exposes live audit and recovery information and lets merchants run simulations. Backend orchestration and storage links follow the README architecture; unsampled subsystem wiring is omitted where uncertain.
Main entry points: main.py API gateway · orchestrator.py Recovery orchestrator · db.py Payment and audit ledger · razorpay_service.py Payment actions
Components 18
Recovery workflow
- API gateway
main.py - Recovery orchestrator
orchestrator.py - AI diagnosis
ai_agent.py
State and compliance
- Payment and audit ledger
db.py - Compliance gate
compliance_gate.py - Customer memory
memory.py
External services
- Payment actions
razorpay_service.py - Voice synthesis
voice_engine.py
Merchant console
- War room
revive-site/src/app/console/page.tsx - Console data hooks
revive-site/src/lib/console-api.ts - Simulation playground
revive-site/src/components/console/simulation-playground.tsx - Product experience
revive-site/src/app/page.tsx
Other components
- Merchant
- Customer
- Razorpay
- Paytm
- Sarvam / gTTS
- Razorpay APIs
Connections 22
- Razorpay → API gateway: sends failure webhook
- Paytm → API gateway: sends callbacks
- Merchant → Simulation playground: starts simulations
- Simulation playground → API gateway: calls simulation endpoints
- API gateway → Payment and audit ledger: records payment state
- API gateway → Recovery orchestrator: starts recovery
- Recovery orchestrator → Compliance gate: checks stopping rules
- Recovery orchestrator → AI diagnosis: requests diagnosis
- Recovery orchestrator → Payment actions: dispatches recovery actions
- Payment actions → Razorpay APIs: creates payment links
- Payment actions → Payment and audit ledger: logs recovery events
- Recovery orchestrator → Voice synthesis: requests voice outreach
- Voice synthesis → Sarvam / gTTS: synthesizes audio
- Voice synthesis → Payment and audit ledger: logs voice events
- Customer → Razorpay APIs: completes payment
- Razorpay → API gateway: sends signed payment result
- API gateway → Payment and audit ledger: updates recovered status
- War room → Console data hooks: loads live data
- Console data hooks → API gateway: polls console endpoints
- Merchant → War room: views operations
- Product experience → War room: links to console
- Recovery orchestrator → Customer memory: uses customer context