feat(kyc-controller): Iron Money KYC path + status polling - #9852
feat(kyc-controller): Iron Money KYC path + status polling#9852amitabh94 wants to merge 3 commits into
Conversation
Introduce vendor:'iron' flow (no MoonPay Check/Auth frames) with KycService clients for Iron customers/disclaimers/consents and user-keyed GET /kyc/status, so Money can drive toast state against the planned Milestone 1 API contract.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 3 potential issues.
❌ 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 a40fa2f. Configure here.
| // eslint-disable-next-line @typescript-eslint/no-floating-promises | ||
| tick(); | ||
| }, this.#userStatusPollIntervalMs); | ||
| this.#userStatusPollTimer.unref(); |
There was a problem hiding this comment.
Timer unref crashes clients
High Severity
#ensureUserStatusPolling always calls .unref() on the setTimeout handle. In extension and React Native runtimes that handle is a number without unref, so the first pending refreshKycStatus poll throws and breaks Money status polling. Sibling session-status polling in this file avoids unref; other packages guard with an existence check.
Reviewed by Cursor Bugbot for commit a40fa2f. Configure here.
| this.#ensureUserStatusPolling(); | ||
| } else { | ||
| this.#stopUserStatusPolling(); | ||
| } |
There was a problem hiding this comment.
Reset restarts status polling
Medium Severity
When reset() lands during an in-flight refreshKycStatus, #fetchAndApplyUserStatus returns the cached status (often still pending, since reset preserves userStatus). refreshKycStatus then calls #ensureUserStatusPolling() and restarts the poll loop that reset just stopped.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit a40fa2f. Configure here.
Add PR link and formatting for changelog, fix JSDoc/restricted-syntax/jest matcher lint errors, and apply Prettier to the package. Co-authored-by: Cursor <cursoragent@cursor.com>
Use oxfmt (not Prettier) so import order and markdown alignment match the monorepo misc formatter. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Demo topology update (for reviewers): Iron feature commit This PR (#9852) should stay targeting |
## Summary - `neobank-demo` already includes Sébastien’s `feat/kyc-controller` stack and the Iron feature commit from #9852 (`a40fa2fc3f`, merged by George). - This PR cherry-picks the remaining #9852 CI fixes (`lint` / changelog PR link / `oxfmt`) so the demo branch matches the Iron tip for package publish/preview and mobile consumption. - Keeps #9852 targeting `feat/kyc-controller` for the eventual mainline path via #9615. Does **not** merge to `main`. ## Context (demo topology) - Integration branch: `neobank-demo` (owner: @georgeweiler) — umbrella PR #9853 → `main` - Iron feature PR (mainline stack): #9852 → `feat/kyc-controller` - KYC controller PR: #9615 → `main` ## Test plan - [ ] Confirm diff is formatting/lint/changelog only (no Iron behavior change) - [ ] CI green on this PR - [ ] After merge, `@metamaskbot publish-preview` on #9853 (or this PR) if mobile needs a preview pin of `@metamask/kyc-controller` Made with [Cursor](https://cursor.com) --------- Co-authored-by: Cursor <cursoragent@cursor.com>


Summary
vendor: 'iron'KYC flow for MetaMask Money:idle → terms → session → submit(SumSub) → done/errorwith no MoonPay Check/Auth frames.KycServicewith Milestone 1 contract clients (mocked in tests):POST /vendors/iron/customers,GET /vendors/iron/disclaimers,POST /vendors/iron/kyc-required,POST /consents,GET /kyc/status, pluscreateUkycSession({ vendorId: 'iron' })without MoonPay metadata.createIronCustomer,refreshKycStatus,KycController:statusChanged, persisteduserStatus*fields, and mapssession_not_in_valid_state→completed.Stacking
feat/kyc-controller(feat: KYC controller #9615)va-mmcx-kyc-api(not merged yet). Clients are implemented against the planned contract; tests mock fetch.Deferred (follow-ups)
need-more-information/terminal-failure/ retryable SumSub session id)Test plan
yarn workspace @metamask/kyc-controller run test(100% coverage)yarn workspace @metamask/kyc-controller run messenger-action-types:check/consents+/kyc/statusexistMade with Cursor