# Domain Modules - QRIS Soundbox Platform v1

## 1. Merchant & Onboarding Domain
### Tanggung jawab
- merchant registration
- KYC / KYB workflow
- document collection
- approval / rejection
- fee profile assignment
- settlement destination registration (bank/partner payout reference)
- outlet and terminal creation

### Submodule
- Merchant Registry
- Onboarding Workflow
- Document Service
- Fee Profile Management
- Settlement Destination Management
- Outlet Management
- Terminal Management

## 2. Payment Integration Domain
### Tanggung jawab
- partner QRIS integration
- bank integration
- SNAP BI configuration
- callback handling
- signature verification
- reconciliation feed import/export

### Submodule
- Partner Credential Vault
- QRIS Connector
- SNAP BI Connector
- Callback Receiver
- Signature Validator
- Reconciliation Importer

## 3. Transaction Domain
### Tanggung jawab
- create transaction
- static vs dynamic QR transaction lifecycle
- transaction status management
- timeout, expiry, and cancel flow
- idempotency control

### Submodule
- Transaction Registry
- Transaction State Machine
- QR Generation Orchestrator
- Transaction Query Service
- Refund/Dispute Hook Interface

## 4. Ledger & Settlement Domain
### Tanggung jawab
- mencatat efek finansial transaksi
- menghitung fee platform dan merchant payable
- membuat settlement batch
- menginisiasi payout request ke partner payout (bukan menampung dana di perusahaan)
- menangani payout failure
- support reconciliation

### Submodule
- Ledger Entry Service
- Merchant Balance Calculator
- Fee Engine
- Settlement Batch Service
- Payout Execution Service
- Adjustment Service
- Reconciliation Service

## 5. Device / TMS Domain
### Tanggung jawab
- device registration
- provisioning
- auth credential management
- merchant/outlet/terminal binding
- heartbeat and presence
- config management
- command delivery
- capability registry
- firmware and compatibility tracking

### Submodule
- Device Registry
- Provisioning Service
- Device Binding Service
- Heartbeat Service
- Device Auth Service
- Capability Profile Service
- Config Management Service
- Command Center Service
- Firmware Tracking Service

## 6. Notification Domain
### Tanggung jawab
- payment success notification
- audio/display payload preparation
- routing based on device capability
- retry and ack tracking
- duplicate suppression

### Submodule
- Notification Orchestrator
- Payload Formatter
- Delivery Tracker
- Retry Worker
- Ack Processor

## 7. Operations & Governance Domain
### Tanggung jawab
- admin portal actions
- audit logging
- alerting
- role-based access
- compliance visibility
- fraud / risk checks

### Submodule
- Admin Management
- RBAC Service
- Audit Log Service
- Monitoring & Alerting
- Risk/Fraud Rule Service
- Incident Tracker

## 8. Domain Boundary Notes
- Payment Integration tidak boleh menampung logic device
- Device/TMS tidak boleh menampung source of truth transaksi
- Ledger & Settlement tidak boleh bergantung pada notifikasi device
- Notification hanya boleh membaca transaction state final/eligible
- Admin UI harus memakai policy dan RBAC lintas domain
