223 lines
3.0 KiB
Markdown
223 lines
3.0 KiB
Markdown
# Database Schema Draft - QRIS Soundbox Platform v1
|
|
|
|
## 1. merchants
|
|
- id
|
|
- merchant_code
|
|
- legal_name
|
|
- brand_name
|
|
- status
|
|
- onboarding_status
|
|
- fee_profile_id
|
|
- settlement_account_reference
|
|
- settlement_account_type
|
|
- payout_mode
|
|
- created_at
|
|
- updated_at
|
|
|
|
## 2. merchant_documents
|
|
- id
|
|
- merchant_id
|
|
- document_type
|
|
- document_url
|
|
- verification_status
|
|
- created_at
|
|
|
|
## 3. outlets
|
|
- id
|
|
- merchant_id
|
|
- outlet_code
|
|
- name
|
|
- address
|
|
- status
|
|
- created_at
|
|
- updated_at
|
|
|
|
## 4. terminals
|
|
- id
|
|
- outlet_id
|
|
- terminal_code
|
|
- qr_mode
|
|
- partner_reference
|
|
- status
|
|
- created_at
|
|
- updated_at
|
|
|
|
## 5. devices
|
|
- id
|
|
- device_code
|
|
- serial_number
|
|
- vendor
|
|
- model
|
|
- firmware_version
|
|
- communication_mode
|
|
- capability_profile_json
|
|
- auth_method
|
|
- status
|
|
- last_seen_at
|
|
- created_at
|
|
- updated_at
|
|
|
|
## 6. device_bindings
|
|
- id
|
|
- device_id
|
|
- merchant_id
|
|
- outlet_id
|
|
- terminal_id
|
|
- active_flag
|
|
- bound_at
|
|
- unbound_at
|
|
|
|
## 7. device_heartbeats
|
|
- id
|
|
- device_id
|
|
- received_at
|
|
- network_strength
|
|
- battery_level
|
|
- firmware_version
|
|
- state
|
|
- payload_json
|
|
|
|
## 8. device_configs
|
|
- id
|
|
- device_id
|
|
- config_version
|
|
- config_json
|
|
- active_flag
|
|
- created_at
|
|
|
|
## 9. device_commands
|
|
- id
|
|
- device_id
|
|
- command_name
|
|
- command_payload_json
|
|
- command_status
|
|
- requested_by
|
|
- requested_at
|
|
- ack_at
|
|
|
|
## 10. transactions
|
|
- id
|
|
- transaction_code
|
|
- merchant_id
|
|
- outlet_id
|
|
- terminal_id
|
|
- device_id
|
|
- qr_mode
|
|
- initiation_mode
|
|
- partner_reference
|
|
- amount
|
|
- currency
|
|
- status
|
|
- created_at
|
|
- paid_at
|
|
- expired_at
|
|
- updated_at
|
|
|
|
## 11. transaction_events
|
|
- id
|
|
- transaction_id
|
|
- event_type
|
|
- source
|
|
- payload_json
|
|
- created_at
|
|
|
|
## 12. notifications
|
|
- id
|
|
- transaction_id
|
|
- device_id
|
|
- delivery_channel
|
|
- payload_type
|
|
- delivery_status
|
|
- retry_count
|
|
- ack_status
|
|
- sent_at
|
|
- ack_at
|
|
|
|
## 13. ledger_entries
|
|
- id
|
|
- merchant_id
|
|
- transaction_id
|
|
- entry_type
|
|
- amount
|
|
- direction
|
|
- balance_effect
|
|
- created_at
|
|
|
|
## 14. settlements
|
|
- id
|
|
- merchant_id
|
|
- settlement_period_start
|
|
- settlement_period_end
|
|
- gross_amount
|
|
- fee_amount
|
|
- net_amount
|
|
- payout_status
|
|
- payout_reference
|
|
- created_at
|
|
- paid_at
|
|
|
|
## 15. settlement_items
|
|
- id
|
|
- settlement_id
|
|
- transaction_id
|
|
- gross_amount
|
|
- fee_amount
|
|
- net_amount
|
|
|
|
## 16. payout_attempts
|
|
- id
|
|
- settlement_id
|
|
- partner_reference
|
|
- amount
|
|
- status
|
|
- response_payload_json
|
|
- attempted_at
|
|
|
|
## 17. reconciliation_records
|
|
- id
|
|
- reconciliation_type
|
|
- entity_type
|
|
- entity_id
|
|
- external_reference
|
|
- internal_amount
|
|
- external_amount
|
|
- status
|
|
- notes
|
|
- created_at
|
|
|
|
## 18. audit_logs
|
|
- id
|
|
- actor_type
|
|
- actor_id
|
|
- action
|
|
- entity_type
|
|
- entity_id
|
|
- before_json
|
|
- after_json
|
|
- source_ip
|
|
- created_at
|
|
|
|
## 19. users
|
|
- id
|
|
- name
|
|
- email
|
|
- password_hash
|
|
- role_id
|
|
- status
|
|
- created_at
|
|
|
|
## 20. roles
|
|
- id
|
|
- name
|
|
- permissions_json
|
|
- created_at
|
|
|
|
## 21. Index penting
|
|
- transactions(partner_reference)
|
|
- transactions(merchant_id, created_at)
|
|
- notifications(device_id, delivery_status)
|
|
- device_heartbeats(device_id, received_at)
|
|
- device_bindings(device_id, active_flag)
|
|
- settlements(merchant_id, payout_status)
|
|
- ledger_entries(merchant_id, created_at)
|