How almousleckdev/zellapay works
ZellaPay is a Gabon-focused payment aggregator: merchants submit collection or payout requests through an authenticated, idempotent REST API; domain services route them to mobile-money operators, update payment state and the double-entry ledger, and publish signed webhook outcomes. The repository also includes merchant/key administration, webhook management, and a sandbox simulator. The sampled composition root shows service and store assembly; README capabilities include reconciliation and refunds, but the tree has no substantive implementation for those yet. Some worker and operator-gateway runtime links are documented but not visible in sampled source.
Main entry points: collections/service.go Collections · payouts/service.go Payouts · webhooks/service.go Webhook delivery · server.go API server
Components 23
Merchant API
- API server
internal/apiserver/server.go - Collection routes
internal/collections/httpapi/routes.go - Payout routes
internal/payouts/httpapi/routes.go - Webhook routes
internal/webhooks/httpapi/routes.go - Merchant auth
internal/merchants/httpauth/middleware.go - Idempotency
internal/platform/idempotency/middleware.go
Payment operations
- Collections
internal/collections/service.go - Payouts
internal/payouts/service.go - Double-entry ledger
internal/ledger/entry.go - Refunds
internal/collections
Core services
- Merchant services
internal/merchants/service.go - Webhook delivery
internal/webhooks/service.go - Background worker
cmd/worker/main.go - Reconciliation
internal/reconciliation
Storage and integrations
- Collection store
internal/collections/pgstore/query.go - Payout store
internal/payouts/pgstore/query.go - Ledger store
internal/ledger/pgstore/accounts.go - Operator router
internal/operators/router/router.go - Sandbox simulator
internal/operators/simulator/simulator.go - Operator callbacks
internal/callbacks/callbacks.go - Webhook store
internal/webhooks/pgstore/deliveries.go
Other components
- Merchant
- Merchant endpoint
Connections 30
- Merchant → API server: submits requests
README.md - API server → Collection routes: mounts routes
internal/apiserver/server.go - API server → Payout routes: mounts routes
internal/apiserver/server.go - API server → Webhook routes: mounts routes
internal/apiserver/server.go - Collection routes → Merchant auth: guards with
internal/collections/httpapi/routes.go - Payout routes → Merchant auth: guards with
internal/payouts/httpapi/routes.go - Webhook routes → Merchant auth: guards with
internal/webhooks/httpapi/routes.go - Collection routes → Idempotency: guards writes
internal/collections/httpapi/routes.go - Payout routes → Idempotency: guards writes
internal/payouts/httpapi/routes.go - Webhook routes → Idempotency: guards writes
internal/webhooks/httpapi/routes.go - Collection routes → Collections: handles requests
- Payout routes → Payouts: handles requests
- Webhook routes → Webhook delivery: handles requests
- Collections → Collection store: persists state
- Payouts → Payout store: persists state
- Collections → Double-entry ledger: posts entries
internal/collections/service.go - Payouts → Double-entry ledger: posts entries
internal/payouts/service.go - Collections → Operator router: routes payments
- Payouts → Operator router: routes payouts
- Operator router → Sandbox simulator: dispatches to
- Operator callbacks → Collections: updates status
- Operator callbacks → Payouts: updates status
- Collections → Webhook delivery: emits outcomes
- Payouts → Webhook delivery: emits outcomes
- Webhook delivery → Webhook store: records deliveries
- Webhook delivery → Merchant endpoint: sends signed events
README.md - Background worker → Webhook delivery: runs delivery jobs
README.md - Merchant → Merchant services: administers keys
- Refunds → Double-entry ledger: reverses collection
README.md - Reconciliation → Operator router: matches statements