Appearance
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.
| Card | Source |
|---|---|
| Cash in clearing | sum(LedgerEntry.amountCents) over every Account.type = "asset". DR − CR. |
| IVA payable to SAT | vecnet_iva_payable account. CR − DR. |
| Merchant liability | merchant_pending + merchant_available + merchant_rolling_reserve summed across all merchants. |
| Free cash | cash − 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
accountIdin 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 inclosed(Pending audit) state.- Full ledger entry table.
Removed surfaces (don't bring them back)
| Old URL | Why it's gone |
|---|---|
/finances/configurations | Per-merchant module flags moved to /merchants/[id]/finance-config tab. |
/finances/fee-rules | Fees are edited at /merchants/[id]/fees; the global read-only list duplicated data. |
/finances/settlements/treasury | Merged into /finances. |
/finances/balances/journals and /balance-snapshots | Flattened to /finances/journals and /finances/snapshots. |
| Old Hub navigation cards | The sidebar already exposes the children. |
Legacy /treasury/* and /settlements/* URLs 302-redirect to their new /finances/* homes.