How avishek23fe10cii00021/idempotent-payment-gateway works
This is an Express payment gateway centered on retry-safe POST /charges: it validates a request, coordinates an idempotency claim or lease takeover, charges through a key-deduplicating processor, persists the charge, then stores and returns a replayable response. The README also documents conflict, decline, and in-progress outcomes. The schema is represented as the durable state boundary; migration/schema details and any real processor integration were not sampled, so no unsupported implementation links are inferred.
Main entry points: server.ts Charge routes · prismaClient.ts Prisma client · idempotency.ts Idempotency runner · errors.ts Idempotency errors
Components 8
HTTP API
- Charge routes
src/server.ts
Idempotency coordination
- Idempotency runner
src/idempotency.ts - Idempotency errors
src/errors.ts
Charge processing
- Fake processor
src/processor.ts
Persistent state
- Charge records
src/server.ts - Idempotency records
prisma/schema.prisma - Prisma client
src/prismaClient.ts
Other components
- API caller
Connections 11
- API caller → Charge routes: submits charge
README.md - Charge routes → Idempotency runner: runs safely
src/server.ts - Charge routes → Fake processor: requests charge
src/server.ts - Charge routes → Charge records: upserts charge
src/server.ts - Charge routes → Prisma client: uses database client
src/server.ts - Idempotency runner → Prisma client: claims and completes
src/idempotency.ts - Prisma client → Idempotency records: accesses records
- Prisma client → Charge records: accesses records
src/server.ts - Idempotency runner → Idempotency errors: throws conflicts
src/idempotency.ts - Charge routes → Idempotency errors: maps outcomes
src/server.ts - Charge routes → API caller: returns response
README.md