Skip to content

feat(ledger): add wallet transaction ledger dashboard with reconcilia…#56

Merged
Obiajulu-gif merged 1 commit into
Chainmove:mainfrom
Joycejay17:feat/wallet-transaction-ledger
Jun 21, 2026
Merged

feat(ledger): add wallet transaction ledger dashboard with reconcilia…#56
Obiajulu-gif merged 1 commit into
Chainmove:mainfrom
Joycejay17:feat/wallet-transaction-ledger

Conversation

@Joycejay17

Copy link
Copy Markdown
Contributor

Build wallet transaction ledger dashboard with reconciliation views

Closes #47

Summary

What changed?

Adds a role-aware wallet transaction ledger dashboard that gives investors, drivers, and admins a transparent, ledger-style view of every balance movement — wallet funding, repayments, payouts, internal credits/debits, and provider references (e.g. Paystack / mock references) — plus an admin-facing reconciliation view to spot failed, pending, duplicated, and unreconciled transactions.

New API

  • GET /api/transactions/ledger — role-aware list with:
    • search by description, provider reference, or related ID
    • filters by date range, type, status, provider/method, and reconciliation state
    • pagination (page / pageSize)
    • balance summary aggregates (total / completed / pending / failed counts and amounts, duplicate-reference count)
    • access scoped by role: non-admins are forced to their own userId; admins can additionally scope by userId / userType and see the global ledger.
  • GET /api/transactions/ledger/export — CSV export that honors the same filters (admin CSV includes user columns).

Reconciliation

Reconciliation status is derived from each transaction (no schema migration), classifying entries as reconciled, pending, failed, or duplicate. Duplicate detection groups by provider reference within the filtered scope to flag potential double-postings. Admins get a banner when duplicates are present.

UI

  • Shared TransactionLedger client component: balance summary cards, filter bar, ledger table, transaction detail drawer, pagination, and explicit empty / loading / error states.
  • Ledger pages for each role with sidebar links:
    • dashboard/admin/ledger (global, server-guarded via requireAdminAccess)
    • dashboard/investor/ledger
    • dashboard/driver/ledger
  • Credits vs. debits are visually distinguished; pending/failed/duplicate states use clear status badges.

Area changed

Check all that apply:

  • Frontend / UI
  • Backend / API routes
  • Auth / Privy
  • Payments / Paystack
  • Email / Resend
  • Stellar / Soroban
  • MongoDB models
  • Documentation
  • Tests
  • Security

Contributor safety checklist

  • I did not commit .env.local or real secrets.
  • I did not expose server-only variables in client-side code.
  • I used mock mode or my own sandbox/test credentials.
  • I did not add deployment steps for contributor PRs.
  • I did not add maintainer-only credentials.

Testing

Commands run:

npm run lint        # passes (only 2 pre-existing warnings, unrelated to this change)
npx tsc --noEmit    # no new errors from this change (pre-existing errors in unrelated files remain)
npm run build       # passes; new routes compile (/api/transactions/ledger[/export], /dashboard/{admin,investor,driver}/ledger)

Screenshots / demo

Add screenshots of the admin/investor/driver ledger views before submitting.

Notes for maintainers

  • Reconciliation status is computed on read rather than stored, so no model migration is required. If persistent reconciliation tracking (e.g. an admin "mark as reconciled" action) is desired later, a reconciliationStatus field on Transaction could back it.
  • Duplicate detection is scoped to the active filter set for performance and relevance.
  • Pre-existing tsc errors in unrelated files (e.g. models/User.ts, src/server/admin/require-admin.ts, src/server/analytics/shared.ts) were left untouched per the contribution guidance to keep the PR focused.

Acceptance criteria

  • Users can view their own transaction history.
  • Admins can view and filter global transaction records.
  • Ledger entries show type, amount, status, date, reference, and source.
  • Pending/failed transactions are visually clear.
  • Data access is properly scoped by role.
  • Empty/loading/error states are implemented.
  • npm run lint and npm run build pass.

…tion views

Add role-aware transaction ledger dashboards for admins, investors, and
drivers covering wallet funding, repayments, payouts, internal credits/
debits, and provider references.

- New ledger API (app/api/transactions/ledger) with search, date/type/
  status/provider/reference filters, pagination, and balance summaries
- Derived reconciliation status (reconciled/pending/failed/duplicate) to
  surface failed, pending, and duplicated provider references
- CSV export endpoint honoring the active filters
- Shared TransactionLedger component: summary cards, filters, detail
  drawer, pagination, and empty/loading/error states
- Admin (global), investor, and driver ledger pages plus sidebar links
- Access scoped by role: users see only their own records, admins see all
@Obiajulu-gif Obiajulu-gif merged commit a9396fd into Chainmove:main Jun 21, 2026
1 check failed
@Obiajulu-gif

Copy link
Copy Markdown
Collaborator

@Joycejay17 great work there

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[HARD][DASHBOARD] Build wallet transaction ledger dashboard with reconciliation views

2 participants