Skip to content

feat(money): show bank microdeposits in activity - #38408

Merged
wenfix merged 21 commits into
mainfrom
microdeposits
Nov 2, 2026
Merged

wenfix merged 21 commits into
mainfrom
microdeposits

Conversation

@wenfix

@wenfix wenfix commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Description

Money accounts are US virtual bank accounts. When a user links their bank, the bank sends small test credits (microdeposits) that appear on the user's bank statement with no explanation. This adds those credits to Money activity so the user can recognise them.

The rows are read from neobank-proxy GET /neobank/customers/{id}/microdeposits through a new NeoBankService.getMicrodeposits() and polled once a minute while the Money screen is focused and the app is foregrounded, paused when offline. The fetch is skipped unless the profile has an approved KYC decision or the Money wallet already has a VBA registration or autoramp, so pre-onboarding users never pay for it. A 404 (no MoonPay customer yet) resolves to an empty list; other failures are logged and do not hide the rest of the feed.

Rows are display-only: MoonPay exposes no confirm endpoint and reports no further state. The list is cumulative across deposit rounds, and the payload has no id, so rows use a synthetic key built from timestamp, amount, currency and counterparty.

The mobile messenger also had to start delegating AuthenticationController:getSessionProfile, which getMoonpayCustomerId() needs to resolve the customer before the list request.

Backend: va-mmcx-onramp-api#1377 (the route this client reads).

Changelog

CHANGELOG entry: Added bank test deposits to Money activity, so users can recognise the small credits their bank sends when linking an account

Related issues

Fixes: TRAM-4327

Manual testing steps

Feature: Bank microdeposits in Money activity

  Scenario: A linked bank sends verification deposits
    Given the wallet has a primary Money account
    When the user opens Money
    Then an Activity section lists one "Test deposit" row per microdeposit
    And each row shows the amount, its currency and the sending bank
    And the same rows appear under the Deposits filter

MoonPay's sandbox cannot create microdeposits, so this was verified on the iOS simulator against a stubbed neobank-proxy serving the route's real schema. With the route deployed, the app needs no other change.

Screenshots/Recordings

After

vba-microdeposit

Pre-merge author checklist

Performance checks (if applicable)

  • I've tested on Android
    • Ideally on a mid-range device; emulator is acceptable
  • I've tested with a power user scenario
    • Use these power-user SRPs to import wallets with many accounts and tokens
  • I've instrumented key operations with Sentry traces for production performance metrics

For performance guidelines and tooling, see the Performance Guide.

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Note

Medium Risk
Touches Money activity merge/settling behavior and adds authenticated neobank polling with new messenger delegation; scope is localized but feed correctness and unnecessary API calls depend on the fetch gates.

Overview
Adds bank test deposit (microdeposit) rows to Money activity so users can match small verification credits on their bank statement. Data comes from a new useMoneyMicrodeposits hook that calls NeoBankService.getMicrodeposits() on a slow poll while Money is focused; fetches are gated on approved KYC or existing VBA registration/autoramp, plus unlocked wallet and connectivity.

Microdeposits are merged into All and Deposits via useMoneyActivityItems, sorted by time with synthetic ids, and exempt from the Accounts-API watermark so they are not hidden while other pages load. MicrodepositActivityItem renders display-only rows (no detail navigation). Pull-to-refresh refetches microdeposits with the rest of the feed.

Supporting changes: shared hasVbaWalletEvidence helper (replacing duplicated logic in VBA home card), moneyFormatIncomingAmount for neobank and microdeposit amounts, shared MONEY_POLL_INTERVAL_MS / MONEY_SLOW_POLL_INTERVAL_MS, and AuthenticationController:getSessionProfile delegation on the NeoBank service messenger for customer id resolution.

Reviewed by Cursor Bugbot for commit 08e52f2. Bugbot is set up for automated code reviews on this repo. Configure here.

Adds a microdeposit row to Money activity, fed by
NeoBankService.getMicrodeposits() through neobank-proxy and gated by the
moneyMicrodepositsEnabled flag.

- New `microdeposit` MoneyActivityItem kind, merged into All and Deposits
  and exempt from the Accounts-API watermark (the list is fetched whole)
- useMoneyMicrodeposits polls every 10s (60s on LOW hardware + slow
  cellular), pauses off-focus/background/offline, and swallows fetch
  failures so they cannot hide the rest of the feed. 404 already resolves
  to [] in the controller.
- Rows use a synthetic id from created_at/amount/currency/counterparty,
  since MoonPay's payload has no id and is cumulative across rounds.
- Dedicated flag selector next to the VBA activity flags.
NeoBankService.getMicrodeposits resolves the MoonPay customer id through
WalletRegistrationService.getMoonpayCustomerId(), which reads the canonical
profile id with AuthenticationController:getSessionProfile. The service
messenger only delegated getBearerToken, so every call threw "A handler for
AuthenticationController:getSessionProfile has not been delegated to
NeoBankService" before any request left the app.
@github-actions

Copy link
Copy Markdown
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@github-actions github-actions Bot added size-L pr-not-ready-for-e2e Skip E2E and block merging. Remove this label once the PR is ready to run the E2E tests. labels Oct 28, 2026
@metamask-ci metamask-ci Bot added the team-money-movement issues related to Money Movement features label Oct 28, 2026
@metamask-ci

metamask-ci Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

PR template — items to address before "Ready for review"

Warnings — informational, address before merging:

  • Pre-merge author checklist has unchecked items (e.g. "I've applied the right labels on the PR (see labeling guidelines). Not required for external contributors."). Every box must be consciously checked — see docs/readme/ready-for-review.md.

See docs/readme/ready-for-review.md for the full Definition of Ready for Review.

@wenfix
wenfix marked this pull request as ready for review October 28, 2026 14:20
@wenfix
wenfix requested review from a team as code owners October 28, 2026 14:20

@cursor cursor Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Adds moneyMicrodepositsEnabled to the flag name enum, the default values and
the feature flag registry so the flag is part of the app's flag inventory and
QA coverage report. Production default stays off; the remote flag is created
in the flag service separately.
Row title is "Test Deposit"; the subtitle is the counterparty bank when the
API reports one, otherwise "From your bank".
@wenfix
wenfix requested a review from a team as a code owner October 28, 2026 16:36
The fetch now runs whenever a primary Money Account exists and the device is
online. The flag, its selector, tests, enum entry and registry entry come out
together; the follow-up re-adds them once the flag service has the flag.
Microdeposits can only arrive after the account is verified and a bank is
linked, so the extra fetch is skipped unless the profile has an approved KYC
decision or the Money wallet already has a provider registration or autoramp.

Both signals come from Redux (KycController state and RampsController state),
so the gate costs no network request. The registration/autoramp fallback keeps
the rows visible for users whose persisted KYC session did not survive a
reinstall or predates the KycController.

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.

There are 3 total unresolved issues (including 1 from previous review).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 6fda0f9. Configure here.

Skip the query while the wallet is locked and disable focus/reconnect
refetches, matching the auth-gated query pattern used elsewhere. Pull-to-refresh
now re-checks the same gate because query.refetch() ignores enabled.

A failed poll now rejects instead of resolving to an empty list, so React Query
keeps the last good rows instead of hiding them until the next success.
useMoneyActivityItems already resolves the primary Money account through
useMoneyAccountTransactions, so the microdeposit hook now takes that address
instead of reading selectPrimaryMoneyAccount again. That keeps one source of
truth for the address and stops the hook from throwing when a screen renders
Money with a minimal background state.

Read the KeyringController lock state defensively for the same reason.
The activity hook now polls microdeposits through useQuery, which needs a
QueryClientProvider this view test does not render. Mock the hook like the
other data hooks in the file.
28.1.0 carries NeoBankService.getMicrodeposits. The 28.0.0 breaking change
(RampsController must delegate NeoBankService:listAutorampTransactions) is
already covered because the mobile messenger spreads
RAMPS_CONTROLLER_REQUIRED_SERVICE_ACTIONS.
The pinned controller now ships NeoBankMicrodeposit and getMicrodeposits, so
the structural copy and the runtime narrowing in asMicrodepositService are no
longer needed. The hook calls the service directly.
@amitabh94 amitabh94 removed the pr-not-ready-for-e2e Skip E2E and block merging. Remove this label once the PR is ready to run the E2E tests. label Oct 28, 2026
amitabh94
amitabh94 previously approved these changes Oct 28, 2026
The activity view now reaches useMoneyMicrodeposits through the real bucketing
hook, and that useQuery needs a QueryClientProvider this view test does not
render. Mock the leaf data hook like the other activity sources.
ramps-controller 28 adds the persisted autorampTransactionRecords key, so the
Engine fixture must carry it.
@wenfix wenfix closed this Oct 28, 2026
@wenfix wenfix reopened this Oct 28, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 28, 2026
# Conflicts:
#	package.json
#	yarn.lock
@wenfix
wenfix requested a review from a team as a code owner October 28, 2026 18:48
@MetaMask MetaMask unlocked this conversation Oct 28, 2026
Extract the nested conditional so the refetchInterval expression reads as one
ternary, clearing typescript:S3358.
@wenfix

wenfix commented Oct 28, 2026

Copy link
Copy Markdown
Contributor Author

Fixed the typescript:S3358 nested ternary in useMoneyMicrodeposits.ts in cfd53a9: the poll interval is now computed before useQuery, so refetchInterval reads as a single ternary.

@github-actions

github-actions Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Smart E2E Test Selection

Selected E2E tags: ALL

AI Confidence: 100

E2E reasoning

Expand to read

Hard rule seed mandates ALL due to locale changes in locales/languages/en.json (3 new microdeposit strings: 'microdeposit', 'microdeposit_from', 'microdeposit_from_bank'). These copy strings feed UI label selectors used in E2E tests and are not cosmetic.

Additionally, the changes have broad functional impact:

  1. Engine messenger change (CRITICAL): neo-bank-service-messenger.ts adds 'AuthenticationController:getSessionProfile' action delegation — a core Engine infrastructure change that could affect authentication flows across the app.

  2. Money/Card feature (SmokeMoney): New microdeposit activity feature added to the Money activity feed — new hook (useMoneyMicrodeposits), new component (MicrodepositActivityItem), new types, and integration into mergeMoneyActivity/buildMoneyActivityBuckets. This directly affects the Card activity view and Money home view.

  3. VBA refactoring (SmokeMoney): hasVbaWalletEvidence extracted to shared utility, affecting useVbaHomeCard logic which determines what card is shown on Money home.

  4. Activity feed changes (SmokeWalletPlatform): The activity list merging logic is modified to include microdeposits, which could affect transaction history display.

The locale change hard rule alone justifies ALL. The Engine messenger change and broad Money/Card feature additions reinforce this conservative selection.

View run

meltingice1337
meltingice1337 previously approved these changes Oct 29, 2026
lint-staged's markdown Prettier pass reflowed the table while the merge staged
every file from main. Restore main's blob so the PR carries no unrelated
Predict changes.
- Drop the duplicate `autorampTransactionRecords` key the merge left in
  the initial-background-state fixture.
- Share the VBA wallet-evidence predicate between the microdeposit gate
  and `getVbaHomeCard`, trimming both sides like RampsController does.
- Move the Money poll intervals into `constants/polling.ts`; poll
  microdeposits once a minute instead of every 10s, since they appear at
  most a few times during onboarding.
- Share the signed-amount formatter between neobank and microdeposit
  display info.
- Stop exporting the hook-local query key.
@wenfix
wenfix requested a review from a team as a code owner October 29, 2026 11:49
Resolve the yarn.lock conflict by taking main's lockfile: main already
resolves `@metamask/ramps-controller@^28.0.0` to 28.1.0, so the branch's
redundant `^28.1.0` bump (and its lock entry) is dropped. The PR no longer
touches package.json or yarn.lock.
@github-actions github-actions Bot added size-XL and removed size-L labels Oct 29, 2026
The merge's lint-staged prettier pass rewrapped a markdown table in a
file this PR does not need to touch, which pulled in Predict codeowner
review. Restore main's version so the PR's CODEOWNERS surface is only
the Money/Ramp/Engine files it actually changes.
…olling

ReactQueryService already maps AppState onto TanStack's focus manager,
and the query does not set refetchIntervalInBackground, so the interval
pauses in the background on its own. useIsFocused plus the offline gate
are all the hook needs.
@wenfix
wenfix removed the request for review from a team October 29, 2026 12:55
@sonarqubecloud

Copy link
Copy Markdown

@wenfix
wenfix enabled auto-merge November 2, 2026 15:32
@wenfix
wenfix added this pull request to the merge queue Nov 2, 2026
Merged via the queue into main with commit 69bad40 Nov 2, 2026
117 of 120 checks passed
@wenfix
wenfix deleted the microdeposits branch November 2, 2026 15:52
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 2, 2026
@metamask-ci metamask-ci Bot added the release-8.20.0 Issue or pull request that will be included in release 8.20.0 label Nov 2, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-8.20.0 Issue or pull request that will be included in release 8.20.0 size-XL team-money-movement issues related to Money Movement features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants