How b-mohid/ondc-tax-split-engine works
The ONDC Tax Split Engine accepts on_confirm requests and coordinates validation, dependency resolution, tax calculation, payouts, ledgering, and compliance queuing. Its FastAPI API is the main entry point; an orchestrator owns the processing actions, including compensation after payout failures. The README documents the end-to-end stages and fallback behavior; sampled source confirms key calls and storage behavior. Some internal wiring is unsampled, so the graph omits uncertain links rather than inferring them.
Main entry points: orchestrator.py Processing orchestrator · main.py FastAPI endpoints · service.py Compliance outbox · database.py SQLite database
Components 17
Request entry
- FastAPI endpoints
app/api/main.py
Settlement processing
- Processing orchestrator
app/services/orchestrator.py - Payload ingestion
app/ingestion/service.py - Idempotency store
app/infrastructure/idempotency.py - Dependency resolver
app/graph/resolver.py - Tax engine
app/tax/engine.py - Split execution
app/split/engine.py
Financial records
- Settlement ledger
app/compliance/service.py - Compliance outbox
app/compliance/service.py - SQLite database
app/infrastructure/database.py
Domain and integrations
- GSTN client
app/services/gstn_client.py - Payout provider
app/settlement/provider.py - Domain models
app/domain/models.py
Other components
- ONDC sender
- API client
- GSTN service
- Payout network
Connections 20
- ONDC sender → FastAPI endpoints: submits event
README.md - API client → FastAPI endpoints: calls endpoints
README.md - FastAPI endpoints → Processing orchestrator: processes request
app/api/main.py - FastAPI endpoints → Settlement ledger: reads entries
app/api/main.py - FastAPI endpoints → Compliance outbox: reads queue
app/api/main.py - FastAPI endpoints → Idempotency store: reads records
app/api/main.py - Processing orchestrator → Payload ingestion: validates payload
app/services/orchestrator.py - Payload ingestion → Idempotency store: checks and stores
app/ingestion/service.py - Processing orchestrator → Dependency resolver: resolves graph
README.md - Processing orchestrator → Tax engine: computes taxes
app/services/orchestrator.py - Tax engine → GSTN client: looks up rates
app/tax/engine.py - GSTN client → GSTN service: requests rates
app/services/gstn_client.py - Processing orchestrator → Split execution: executes splits
app/services/orchestrator.py - Split execution → Payout provider: executes or reverses
app/split/engine.py - Payout provider → Payout network: sends payouts
README.md - Processing orchestrator → Settlement ledger: writes settlement
app/services/orchestrator.py - Processing orchestrator → Compliance outbox: enqueues filings
app/services/orchestrator.py - Settlement ledger → SQLite database: persists entries
app/compliance/service.py - Compliance outbox → SQLite database: stores outbox rows
app/compliance/service.py - SQLite database → Compliance outbox: initializes schema
app/infrastructure/database.py