How krestovsky13/payment works
Payment Service accepts authenticated, idempotent payment requests, persists them with an outbox event, and processes queued events asynchronously to update payment status and optionally send a webhook. The graph includes payment creation and lookup, persistence/outbox, and the RabbitMQ retry/DLQ processing path. Relationships in unsampled subsystems are included only where the README or SOURCE INDEX supports them; detailed database and retry internals were not inspected.
Main entry points: handlers.py Payment routes · app.py API runtime · make_payment.py Create payment · processing_payment.py Process payment
Components 24
HTTP API
- API runtime
src/core/app.py - Payment routes
src/api/v1/payment/handlers.py - API key check
src/api/deps.py - Payment API schema
src/api/v1/payment/schemas.py
Payment application
- Create payment
src/application/payments/use_cases/make_payment.py - Get payment
src/application/payments/use_cases/get_payment.py - Process payment
src/application/payments/use_cases/processing_payment.py - Payment lifecycle
src/domain/payment/entities.py - Payment values
src/domain/payment/value_objects.py - Payment repository port
src/domain/payment/repositories.py - Outbox port and events
src/application/ports/outbox.py
Persistence and outbox
- SQL repositories
src/infrastructure/db/repositories - Database models
src/infrastructure/db/models - SQL database
- SQL unit of work
src/infrastructure/db/uow.py - Outbox worker
src/infrastructure/outbox/worker.py - Dependency wiring
src/core/containter.py
Message processing
- Consumer runtime
cmd/consumer.py - Message router
src/infrastructure/mq/router.py - Payment message handler
src/infrastructure/mq/handlers/payments.py - Queue topology
src/infrastructure/mq/topology.py - RabbitMQ
Other components
- API client
- Webhook endpoint
Connections 31
- API client → API runtime: sends request
README.md - API runtime → Payment routes: registers routes
src/core/app.py - Payment routes → API key check: checks API key
src/api/v1/payment/handlers.py - Payment routes → Payment API schema: uses schemas
src/api/v1/payment/handlers.py - Payment routes → Create payment: creates payment
src/api/v1/payment/handlers.py - Payment routes → Get payment: fetches payment
src/api/v1/payment/handlers.py - Create payment → Payment lifecycle: creates entity
src/application/payments/use_cases/make_payment.py - Create payment → Payment repository port: stores payment
src/application/payments/use_cases/make_payment.py - Create payment → Outbox port and events: records event
src/application/payments/use_cases/make_payment.py - Get payment → Payment repository port: loads payment
src/application/payments/use_cases/get_payment.py - Process payment → Payment repository port: loads and updates
src/application/payments/use_cases/processing_payment.py - Process payment → Payment lifecycle: changes status
src/application/payments/use_cases/processing_payment.py - Process payment → Webhook endpoint: posts webhook
src/application/payments/use_cases/processing_payment.py - Payment routes → Payment values: builds remittance
src/api/v1/payment/handlers.py - Payment lifecycle → Payment values: uses values
src/domain/payment/entities.py - Dependency wiring → SQL repositories: provides repositories
src/core/containter.py - SQL repositories → Payment repository port: implements port
src/infrastructure/db/repositories/payment.py - SQL repositories → Database models: maps records
src/infrastructure/db/repositories/payment.py - Database models → SQL database: persists records
README.md - Dependency wiring → SQL unit of work: provides unit of work
src/core/containter.py - Dependency wiring → Outbox worker: provides worker
src/core/containter.py - API runtime → Outbox worker: starts worker
src/core/app.py - Outbox worker → Outbox port and events: reads and marks
src/infrastructure/outbox/worker.py - Outbox worker → RabbitMQ: publishes events
src/infrastructure/outbox/worker.py - Consumer runtime → Message router: starts consumer
cmd/consumer.py - Message router → Payment message handler: routes messages
src/infrastructure/mq/router.py - Payment message handler → Process payment: invokes processing
src/infrastructure/mq/handlers/payments.py - API runtime → Queue topology: declares queues
src/core/app.py - Queue topology → RabbitMQ: configures queues
src/infrastructure/mq/topology.py - RabbitMQ → Payment message handler: delivers messages
README.md - Payment message handler → RabbitMQ: retries or dead-letters
README.md