Delegate post-merge registration routing to the KYC flow#716
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the post-account-merge "Wallet registration not complete" error (red banner) in the RealUnit app, the CONTRIBUTING-aligned way.
When a new wallet signs up with an email that already belongs to an existing DFX account (account merge) and that account has no prior RealUnit registration,
GET /v1/realunit/registrationreturnsstate=NewRegistration. The email-verification step, however, calledregisterWallet(POST /register/wallet) unconditionally — that endpoint only adds a wallet to an existing registration, so the API returns400 "No RealUnit registration found".Root cause — runtime-confirmed (PROD App Insights)
GET /v1/realunit/registration→ 200 (state=NewRegistration, userData present from existing KYC)POST /v1/realunit/register/wallet→ 400{"message":"No RealUnit registration found"}(×4 retries)POST /v1/realunit/register/complete→ 201RealUnitRegistrationstep untilregister/completecreated it. 7-day breadth: 7× this 400 (affects every merge into a DFX account without a prior RealUnit registration).Fix (app-only) — single source of registration routing
The email-verification flow is reduced to its actual job: confirm the merge (detect the JWT account change) and hand back to the KYC flow.
KycCubitis now the only place that interprets the registrationstateand routes it (addWallet → link wallet, NewRegistration → full registration form, AlreadyRegistered → forward) — per CONTRIBUTING.md "API as Decision Authority". This removes the duplicated, unconditionalregister/walletcall.Dead code removed accordingly:
_completeRegistration,_mergeDetected, theRealUnitRegistrationServicedependency, theKycEmailVerificationRegistrationFailurestate, and the now-unused i18n keyregisterEmailVerificationRegistrationFailed(de + en).Tests
kyc_step_states_testupdated for the removed state.Test plan
flutter analyzecleanflutter test --exclude-tags golden— full suite passes (2312)Supersedes #711 (minimal variant) and the earlier incorrect MergeProcessing PRs DFXswiss/api#3848 + #709.