A mock payment gateway, East African centered. Mobile Money and Card Payments.
# Mock Payment Gateway
A provider-agnostic **mock payment gateway** that behaves like a real third-party payment
provider (in the spirit of Pesapal, Flutterwave, and other East African payment gateways) so
applications can perform complete end-to-end payment integration testing without touching a real
provider.
Built with **.NET 8**, **MySQL** (via Dapper), Serilog structured logging, and Swagger. Fully
Dockerized.
## Features
- Mobile Money payments (MTN, Airtel) with a simulated STK push → PIN entry → processing flow
- Card payments (Visa, Mastercard) with a simplified processing flow
- A realistic transaction state machine (`Created → Pending → Processing → Completed/Failed/Cancelled/Expired`)
with timestamped state history
- Payouts (bank transfer and mobile money transfer) with their own lifecycle
- Configurable webhooks: normal, delayed, duplicate, lost, disabled, out-of-order, and
invalid-signature delivery — all HMAC-signed
- A **Scenario Engine** with 16 built-in scenarios (happy path, declines, timeouts, random success
rates, stuck transactions, webhook mischief, etc.) — fully configurable in `appsettings.json`
- Two provider profiles — **Generic** and **Pesapal** — that change response shape, status naming,
and auth mechanism via a single config switch
- API-key authentication (Generic profile) and bearer-token authentication (Pesapal profile)
- Idempotency support via an `Idempotency-Key` header
- Admin/logging APIs for viewing transactions, payouts, webhook deliveries, errors, and scenario
executions
- Health checks, Swagger UI, structured logging, and Docker Compose for one-command startup
## Quickstart
```bash
docker compose up --build
```
This starts MySQL and the gateway. On first boot the app creates the `paymentmock` database,
applies the schema in `PaymentMock/Scripts/001_create_schema.sql`, and seeds gateway account
balances from `002_seed_data.sql` — no manual migration step required, and it's safe to restart at
any time (scripts are ide …