Backend Modules
apps.payments — Gateways, MFS & Webhooks
Payment transaction processing, bKash/Nagad SMS webhook ingestion, and SMS dispatch logs.
apps.payments — Gateways, MFS & Webhooks
IMPLEMENTED
- Location:
backend/apps/payments/ - Responsibilities: Payment gateway configurations, transaction tracking, SMS webhook parsing, signature verification, and SMS delivery logging.
1. Database Models (5 Models)
| Model Name | Purpose | Key Fields |
|---|---|---|
PaymentGateway | Gateway configuration (bKash, Nagad, SSLCommerz) | name, gateway_type, is_active, api_key, webhook_secret |
PaymentTransaction | Completed or pending customer payment | trx_id, customer, amount, status, payment_method |
PaymentAttempt | Tracks raw payment attempt iterations and errors | transaction, attempt_number, response_payload, status |
InboundPaymentEvent | Raw webhook event payload buffer | gateway, raw_payload, status, trx_id, parsed_amount |
SmsLog | Log of all inbound/outbound SMS communications | phone, message, status, direction, gateway_response |
2. Webhook Signature Security
The SMS webhook endpoint (/api/v1/payments/sms/webhook/) requires:
- Tenant Resolution Exclusively from Host: No
tenantortenant_idaccepted in body payload. - Signature Verification: Validates
X-Signatureor configured gateway webhook token againsttenant.payment_gateways. - Asynchronous Dispatch: The HTTP view returns
200 ACCEPTEDwithin 50ms, delegating transaction matching and ledger creation to Celery (process_payment_event).
apps.finance — Double-Entry Ledger & Accounts
Architectural core of financial integrity, ledger entries, invoice line items, and adjustments.
apps.network — MikroTik RouterOS & OLT Chassis
Core network operations, POP branches, MikroTik RouterOS v7 integration, OLT optical diagnostics, and online sessions.