Koleksi utama wallet merchant. Satu wallet per store.
Definisi model
app/Models/Wallet.php — Wallet extends MongoDB\Laravel\Eloquent\Model
| Properti | Nilai | Sumber |
|---|---|---|
| Collection | wallets | Wallet.php:15 |
| Connection | mongodb | Wallet.php:14 |
$guarded | [] (mass-assign semua) | Wallet.php:17 |
$hidden | ['pin_hash'] | Wallet.php:22-24 |
| SoftDeletes | ✅ | Wallet.php:12 |
| Primary key | UUID string | Wallet.php:18-20,44-46 |
Field
| Field | Tipe | Default | Cast | Sumber |
|---|---|---|---|---|
id | string UUID | generated | — | Wallet.php:45 |
store_id | string | — | — | WalletService.php:91 |
user_id | string | — | — | WalletService.php:92 |
doku_sub_account_id | string | — | — | WalletService.php:93 |
pin_hash | string (bcrypt) | — | — | WalletService.php:94 |
status | string | 'inactive' | — | Wallet.php:35, WalletService.php:95 ('active') |
balance | integer | 0 | integer | Wallet.php:33,26 |
pending_balance | integer | 0 | integer | Wallet.php:34,27 |
activated_at | datetime (Carbon) | — | datetime | WalletService.php:96, Wallet.php:29 |
processing_balance | integer (virtual) | — | — | accessor Wallet.php:78-84 |
available_balance | integer (virtual) | — | — | accessor Wallet.php:100-123 |
total_withdrawn | integer (virtual) | — | — | accessor Wallet.php:89-95 |
bank_accounts | array of object | [] | — | WalletController.php:595 |
deleted_at | datetime | — | — | SoftDeletes |
created_at | datetime (BSON) | auto | — | — |
updated_at | datetime (BSON) | auto | — | — |
bank_accounts (embedded array)
Dari WalletController.php:570-577:
[
{
"id": "uuid",
"bank_code": "string max 12",
"bank_name": "string max 100",
"account_number": "string 10-20 digit",
"account_name": "string max 40",
"created_at": "ISO8601 string"
}
]Relasi
| Nama | Tipe | FK | Sumber |
|---|---|---|---|
store | belongsTo | Store.id ← store_id | Wallet.php:50-52 |
user | belongsTo | User.id ← user_id | Wallet.php:53-55 |
transactions | hasMany | WalletTransaction.wallet_id ← id | Wallet.php:57-63 |
Index & constraint
- Tidak ada index didefinisikan di model
- Tidak ada unique constraint di DB
- Primary key: UUID string
Contoh dokumen
{
"_id": ObjectId("..."),
"id": "550e8400-e29b-41d4-a716-446655440000",
"store_id": "<store.id>",
"user_id": "<user.id>",
"doku_sub_account_id": "DOKU-xxx",
"pin_hash": "$2y$...",
"status": "active",
"balance": 150000,
"pending_balance": 0,
"processing_balance": 0,
"total_withdrawn": 0,
"activated_at": ISODate("2026-01-01T00:00:00Z"),
"bank_accounts": [
{
"id": "uuid-acc-1",
"bank_code": "014",
"bank_name": "BCA",
"account_number": "1234567890",
"account_name": "John Doe",
"created_at": "2026-01-01T00:00:00+00:00"
}
],
"created_at": ISODate("..."),
"updated_at": ISODate("...")
}Seeder
database/seeders/BackfillWalletFieldsSeeder.php — hanya menambahkan default processing_balance=0 ke wallets existing. Tidak ada seeder untuk create contoh data.
Referensi
- Alur Wallet — alur topup & withdraw
app/Models/Wallet.php— modelapp/Services/WalletService.php— serviceapp/Http/Controllers/WalletController.php— controller