D
Engineering

wallet_transactions

Schema collection wallet_transactions — transaksi wallet termasuk withdraw dengan security safeguard.

Collection: wallet_transactions

Menyimpan semua transaksi wallet — deposit, withdraw, fee, refund.

Struktur Dokumen

json
{
  "_id": "uuid-string",
  "wallet_id": "uuid-string",
  "type": "withdraw",
  "amount": 100000,
  "status": "SUCCESS",
  "fees": {
    "service_fee": 5000,
    "doku_fee": 3000
  },
  "bank_account": {
    "bank_code": "BCA",
    "account_number": "1234567890",
    "account_name": "John Doe"
  },
  "doku_payout_invoice": "INV-20260625-abc123",
  "service_fee_transfer": {
    "invoice": "TRF-20260625-def456",
    "amount": 5000,
    "destination": "SAC-xxxx-xxxxxxxxxxxxx",
    "status": "SUCCESS",
    "transferred_at": "2026-06-25T14:30:00.000000Z"
  },
  "balance_check_info": {
    "doku_balance": 200000,
    "required_amount": 100000,
    "shortfall": 0
  },
  "processed_by": "admin@dazo.id",
  "processing_started_at": "2026-06-25T14:29:00.000000Z",
  "completed_at": "2026-06-25T14:30:00.000000Z",
  "rejected_by": null,
  "rejection_reason": null,
  "created_at": "2026-06-25T14:00:00.000000Z",
  "updated_at": "2026-06-25T14:30:00.000000Z"
}

Field

FieldTypeDeskripsi
_idstring (UUID)Primary key
wallet_idstring (UUID)Foreign key ke wallets._id
typestringTipe transaksi: deposit, withdraw, fee, refund
amountintJumlah transaksi
statusstringStatus: PENDING, PROCESSING, SUCCESS, REJECTED, FAILED
feesobjectFee breakdown
fees.service_feeintService fee Dazo
fees.doku_feeintFee DOKU
bank_accountobjectRekening tujuan (untuk withdraw)
doku_payout_invoicestringInvoice DOKU payout
service_fee_transferobjectInfo transfer service fee
balance_check_infoobjectInfo balance check (jika gagal)
processed_bystringEmail admin yang proses
processing_started_atDateTimeWaktu mulai diproses
completed_atDateTimeWaktu selesai
rejected_bystringEmail admin yang reject
rejection_reasonstringAlasan reject

Status Flow

plaintext
PENDING → PROCESSING → SUCCESS
    │           │
    │           └→ FAILED (DOKU error)
    │
    └→ REJECTED (admin reject)

Query Umum

javascript
// Withdraw pending
db.wallet_transactions.find({ type: "withdraw", status: "PENDING" })

// Withdraw processing (stuck >1 jam)
db.wallet_transactions.find({
  status: "PROCESSING",
  processing_started_at: { $lt: ISODate("2026-06-25T13:00:00Z") }
})

// Failed service fee transfer
db.wallet_transactions.find({
  "service_fee_transfer.status": "FAILED"
})