How e-ugine/idempotent-ingestion-engine works
This is a FastAPI payment-ingestion API that accepts a payment intent once per account and idempotency key; it simulates charging and does not connect to a real payment processor. The workflow routes a validated request, derives an account identity from the bearer token, and invokes the idempotency service, which checks for key reuse or an in-flight request and returns a stored or fresh result. PostgreSQL’s account/key uniqueness constraint provides the concurrency guard. The README documents bounded polling and stale-request handling; source excerpts show these in the service. Authentication is only a token-shape check here, not external identity verification.
Main entry points: payments.py Payment Route · payment_service.py Idempotency Service · router.py API Router · base.py Engine and Sessions
Components 11
HTTP API
- FastAPI App
app/main.py - API Router
app/api/v1/router.py - Payment Route
app/api/v1/payments.py - Payment Schemas
app/schemas/payment.py - Account Identity
app/dependencies.py
Idempotency Processing
- Idempotency Service
app/services/payment_service.py
Persistence
- Database Settings
app/config.py - Engine and Sessions
app/db/base.py - Idempotency Record
app/db/models/idempotency_key.py - PostgreSQL
Other components
- Client
Connections 11
- Client → Payment Route: submits payment
README.md - FastAPI App → API Router: mounts routes
app/main.py - API Router → Payment Route: registers route
app/api/v1/router.py - Payment Route → Payment Schemas: validates request
app/api/v1/payments.py - Payment Route → Account Identity: resolves account
app/api/v1/payments.py - Payment Route → Engine and Sessions: gets session
- Payment Route → Idempotency Service: processes payment
app/api/v1/payments.py - Idempotency Service → Payment Schemas: builds response
app/services/payment_service.py - Engine and Sessions → Database Settings: loads database URL
app/db/base.py - Idempotency Service → Idempotency Record: reads and writes
app/services/payment_service.py - Idempotency Record → PostgreSQL: maps unique-key table
README.md