Skip to content

Add VBA onboarding stage hydration - #10278

Open
georgeweiler wants to merge 7 commits into
mainfrom
vba-onboarding-stage
Open

georgeweiler wants to merge 7 commits into
mainfrom
vba-onboarding-stage

Conversation

@georgeweiler

@georgeweiler georgeweiler commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add a persisted seven-stage vbaOnboardingStage contract for Mobile routing
  • hydrateVbaOnboarding refreshes KYC state from the customer's account via KycController:refreshVbaOnboardingStatus before reading the stage gates, then maps Iron/SumSub getters (KycVendor / KycProvider / KycStatus from feat(kyc-controller): add VBA onboarding KYC getters #10279) to a routable stage
  • the refresh action is delegated via a local structural messenger-action type, so this package compiles without a kyc-controller release that already exports it (KYC PR merges first)
  • load authoritative autoramp accounts through the new NeoBankService:getAutoramps action before deciding whether account creation is needed
  • automatically register the Money Account wallet and create an autoramp after KYC acceptance
  • coalesce overlapping hydration polls to avoid duplicate signatures and account creation

This is a simplified replacement for #10116. KYC flow interpretation stays in KycController; this PR imports the shared enums/action types from @metamask/kyc-controller rather than declaring them locally.

Depends on: #10279 (KYC getters + VBA status refresh). Until that lands, this branch is expected not to typecheck against main's kyc-controller package — that is intentional.

The proxy is expected to support authenticated GET /neobank/autoramps requests.

Testing

  • yarn jest src/NeoBankService.test.ts src/RampsController.test.ts --runInBand --no-coverage
  • yarn workspace @metamask/ramps-controller run test
  • yarn build (may fail until feat(kyc-controller): add VBA onboarding KYC getters #10279 merges)
  • yarn workspace @metamask/ramps-controller run messenger-action-types:check
  • targeted ESLint for changed files
  • yarn changelog:validate

🤖 Generated with Claude Code


Note

High Risk
Touches KYC gating, wallet registration (keyring signatures), and neobank autoramp creation with new cross-controller messenger contracts and persisted onboarding state.

Overview
Adds VBA (Virtual Bank Account) onboarding for Mobile: a persisted vbaOnboardingStage and hydrateVbaOnboarding, which reads Iron KYC session/disclaimer state via new KycController messenger actions, maps it to seven routable stages (email OTP through completed), and after approval registers the Money Account wallet, syncs autoramps from the backend, and creates one only when none is usable for the wallet.

NeoBankService:getAutoramps calls authenticated GET /neobank/autoramps, maps responses like single-autoramp fetch, and is wired into hydration so local autoramp cache matches the server before deciding whether to create.

Breaking: hosts must delegate KycController:getSessionStatusForVendor, hasCompletedVendorDisclaimers, and hasCompletedSessionDisclaimers, plus NeoBankService:getAutoramps. Adds @metamask/kyc-controller dependency. Overlapping hydrateVbaOnboarding calls are coalesced to avoid duplicate signatures and autoramp creation during polling; setup failures leave the previous stage unchanged.

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

Co-authored-by: Cursor <cursoragent@cursor.com>
@georgeweiler
georgeweiler requested a review from a team as a code owner September 17, 2026 01:41
@georgeweiler
georgeweiler deployed to default-branch September 17, 2026 01:41 — with GitHub Actions Active
Co-authored-by: Cursor <cursoragent@cursor.com>
@georgeweiler
georgeweiler requested a review from a team as a code owner September 17, 2026 01:42

@cursor cursor Bot left a comment

Copy link
Copy Markdown

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.

Comment thread packages/ramps-controller/src/RampsController.ts
Comment thread packages/ramps-controller/src/RampsController.ts
Co-authored-by: Cursor <cursoragent@cursor.com>

@cursor cursor Bot left a comment

Copy link
Copy Markdown

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.

Comment thread packages/ramps-controller/src/RampsController.ts
georgeweiler and others added 2 commits September 16, 2026 20:20
Drop local KycVendor/KycProvider/KycStatus stubs and action types in favor
of the package exports introduced in #10279.

Co-authored-by: Cursor <cursoragent@cursor.com>
…t on hydrate

Before reading the VBA stage gates, hydrateVbaOnboarding now calls
KycController:refreshVbaOnboardingStatus so each stage reflects the vendor
account (vendor-terms re-signing, KYC status) rather than only device-local
state. The action is declared as a local structural messenger-action type so
the ramps package does not require a kyc-controller release that already
exports it (the KYC PR merges first).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…not finalStatus

finalStatus is already 'pending' once the session + consents exist (pre-SumSub),
so route to KycRequired until vendorStatus/kycStatus leaves 'new'/'retry';
only show KycPending once the applicant has actually submitted.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@cursor cursor Bot left a comment

Copy link
Copy Markdown

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 and found 1 potential issue.

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 24656d6. Configure here.

if (vendorStatus === 'pending' || kycStatus === 'pending') {
return this.#setVbaOnboardingStage(VbaOnboardingStage.KycPending);
}
return this.#setVbaOnboardingStage(VbaOnboardingStage.KycRequired);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Partial KYC approval completes onboarding

High Severity

The new stage mapping treats any of finalStatus, vendorStatus, or kycStatus being approved as KYC acceptance. The documented vendor-processing state (kycStatus: approved, finalStatus: pending) therefore skips KycPending and proceeds to wallet registration, autoramp creation, and Completed before the vendor has finalized.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 24656d6. Configure here.

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.

1 participant