Skip to content

Finances surface

The /finances section of the admin app is finops' single entry point to Vecnet's money state. The sidebar has one parent (Finances) with four clickable children: Accounts, Journals, Snapshots, Settlements. The parent itself opens Treasury — Vecnet's own liquidity dashboard.

Gated by canViewTreasury(role) — visible to superadmin and finops, hidden from integrations.

/finances — Treasury landing

The parent click lands here. Four KPI cards + a clearing-accounts table + pending payouts panel, all live from the ledger.

CardSource
Cash in clearingsum(LedgerEntry.amountCents) over every Account.type = "asset". DR − CR.
IVA payable to SATvecnet_iva_payable account. CR − DR.
Merchant liabilitymerchant_pending + merchant_available + merchant_rolling_reserve summed across all merchants.
Free cashcash − iva − merchantLiability.

A date-range filter (from_date / to_date, default = today) scopes the "Inflows (range)" / "Outflows (range)" columns of the clearing table — splits Vecnet clearing from per-acquirer clearing (tonder, menta). The pending-payouts panel counts every Settlement in closed ∪ accepted and shows the total net payable, with a "View pending →" link to /finances/settlements?tab=pending.

/finances/accounts

Cross-merchant Chart of Accounts browser. Filters: type, kind, acquirer, currency, active, free-text q (matches accountCode or name). Pagination 50/page.

Columns: account code (mono, primary link) · name · type badge · kind · owner (merchant commercialName or "Vecnet") · currency · live balance · last activity.

Per-row queries are batched: one groupBy resolves balances for every account on the page, one findFirst resolves last-activity per row. Avoids the N+1 trap.

Drill-down: /finances/accounts/[id] shows current balance, the last 7 BalanceSnapshot rows rendered as a text-bar sparkline, and the most recent 50 ledger entries with their parent Journal link.

/finances/journals

Global Journal list. Each Journal is the header row for one financial event (payment, refund, settlement close, reserve held/released, manual adjustment, IVA fee leg). Filters: date range, merchant, category, type. Pagination 50/page.

Columns: date · merchant · category badge · type (in/out) · gross · fee · IVA · net · eye-link to detail. Drill-down at /finances/journals/[id] lists every LedgerEntry inside the journal — account code, category, debit, credit, IVA.

The Journal model carries grossCents, feeCents, ivaCents, netCents, rrCents denormalised at write time so reports never re-aggregate.

/finances/snapshots

Date-ranged BalanceSnapshot browser. Two views:

  • Pivot (no accountId in URL): rows = accounts, columns = dates in range, cells = end-of-day balance. Capped at 14 columns; widen the date range and the earliest columns collapse into an "earlier" indicator.
  • Single account: per-day balance + inflows + outflows for one account.

Populated by workers/daily-snapshots.ts (BullMQ cron at 23:30 America/Mexico_City; supports --run-once for manual triggers and tests).

/finances/settlements

Operations queue for merchant payouts. Four tabs: All, Pending (closed ∪ accepted), Confirmed (paid), Rejected (failed). Search (merchant name or displayId), date range, eye-link to detail.

Each row shows the synthetic readable settlement id (set-t1-bitso-121-20260527-1779894104192), merchant, channel badge (t1 = online, t2 = terminal), period date, net payable, status, SPEI ref.

Detail at /finances/settlements/[id]:

  • Header: displayId + channel badge.
  • 4–8 KPIs (gross, OUT fees, IN fees + margin if canViewInFees, reserve held/released, adjustments, net payable).
  • Three download buttons: PDF (merchant-facing), CSV (merchant-facing), XLSX (Spanish "Resumen de Liquidación"); plus an Internal CSV for finops/superadmin.
  • SettlementActions — the audit→accept→confirm state machine.
  • AdjustmentsPanel — manual signed adjustments allowed only in closed (Pending audit) state.
  • Full ledger entry table.

Removed surfaces (don't bring them back)

Old URLWhy it's gone
/finances/configurationsPer-merchant module flags moved to /merchants/[id]/finance-config tab.
/finances/fee-rulesFees are edited at /merchants/[id]/fees; the global read-only list duplicated data.
/finances/settlements/treasuryMerged into /finances.
/finances/balances/journals and /balance-snapshotsFlattened to /finances/journals and /finances/snapshots.
Old Hub navigation cardsThe sidebar already exposes the children.

Legacy /treasury/* and /settlements/* URLs 302-redirect to their new /finances/* homes.

Vecnet — Build Spec v0.2 · Obsidian Terminal