Log transaksi wallet (deposit, withdraw, settlement). Tidak ada SoftDeletes.
Definisi model
app/Models/WalletTransaction.php
| Properti | Nilai | Sumber |
|---|---|---|
| Collection | wallet_transactions | WalletTransaction.php:14 |
$guarded | [] | WalletTransaction.php:16 |
| SoftDeletes | ❌ | — |
| Primary key | UUID string | WalletTransaction.php:17-19 |
Konstanta
Type (WalletTransaction.php:21-23):
TYPE_DEPOSIT = 'deposit'TYPE_WITHDRAWAL = 'withdrawal'TYPE_SETTLEMENT = 'settlement'
Status (WalletTransaction.php:25-29):
STATUS_PENDING = 'pending'STATUS_PROCESSING = 'processing'STATUS_SUCCESS = 'success'STATUS_FAILED = 'failed'STATUS_CANCELLED = 'cancelled'
Field
| Field | Tipe | Default | Cast | Sumber |
|---|---|---|---|---|
id | string UUID | generated | — | WalletTransaction.php:61 |
wallet_id | string | — | — | WalletService.php:353, WalletController.php:279 |
store_id | string | — | — | WalletService.php:354, WalletController.php:280 |
user_id | string | — | — | WalletService.php:355, WalletController.php:281 |
type | string | — | — | WalletService.php:356,248, WalletController.php:282 |
amount | integer | — | integer | WalletService.php:357,249, WalletController.php:283 |
fee | integer | 0 | integer | WalletTransaction.php:52,40 |
fees | object/array | — | — | WalletController.php:284 |
net_amount | integer | auto-compute | integer | WalletTransaction.php:64, WalletService.php:359 |
status | string | 'pending' | string | WalletTransaction.php:53,40 |
reference_id | string | — | — | WalletService.php:361, WalletController.php:287 |
reference_type | string | — | — | WalletService.php:362 ('order') |
description | string | 'Pembayaran order' | — | WalletService.php:344,363,253 |
metadata | array/object | — | array | WalletService.php:254-260 |
bank_account | object | — | — | WalletController.php:291-297 |
doku_payout_invoice | string | — | — | WalletController.php:289 |
rejection_reason | string/null | null | — | WalletController.php:290 |
completed_at | datetime | — | datetime | WalletService.php:364,294, WalletTransaction.php:44 |
created_at | datetime | auto | datetime | WalletTransaction.php:47 |
updated_at | datetime | auto | datetime | WalletTransaction.php:48 |
metadata (deposit/withdrawal di WalletService)
Dari WalletService.php:254-260:
{
"bank_code": "string",
"account_number": "string",
"account_name": "string",
"invoice_number": "WD-<storeId>-<timestamp>",
"initiated_by": "<userId>"
}bank_account (embedded, dari WalletController)
Dari WalletController.php:291-297:
{
"id": "uuid",
"bank_code": "string",
"bank_name": "string",
"account_number": "string",
"account_name": "string"
}Relasi
| Nama | Tipe | FK | Sumber |
|---|---|---|---|
wallet | belongsTo | Wallet.id ← wallet_id | WalletTransaction.php:69-73 |
store | belongsTo | Store.id ← store_id | :74-76 |
user | belongsTo | User.id ← user_id | :77-79 |
order | belongsTo | Order.id ← reference_id | :81-87 |
Boot creating
WalletTransaction.php:59-66:
- Set UUID id
- Auto-compute
net_amount = amount - feejika belum di-set
Contoh dokumen
{
"_id": ObjectId("..."),
"id": "uuid-tx-1",
"wallet_id": "<wallet.id>",
"store_id": "<store.id>",
"user_id": "<user.id>",
"type": "withdraw",
"amount": 100000,
"fee": 0,
"fees": { "total_fee": 5000 },
"net_amount": 100000,
"status": "PENDING",
"reference_id": "WDR-20260105-...",
"description": "Penarikan ke BCA - 1234567890",
"doku_payout_invoice": "WD-20260105-...",
"rejection_reason": null,
"bank_account": {
"id": "uuid-acc",
"bank_code": "014",
"bank_name": "BCA",
"account_number": "1234567890",
"account_name": "John Doe"
},
"created_at": ISODate("..."),
"updated_at": ISODate("...")
}Referensi
- Alur Wallet — alur topup & withdraw
app/Models/WalletTransaction.php— model + konstantaapp/Services/WalletService.php— service (processDeposit, dead code requestWithdrawal)app/Http/Controllers/WalletController.php— controller withdraw