fix(kyc): collect countryAndTINs for non-Swiss residents + tighten phone validator#604
Conversation
… validator - service: non-Swiss registration must POST countryAndTINs (currently fails at compile because Registration lacks the field) - widget: PhoneNumberField must reject implausible national numbers for +41/+49 (currently 2/6 cases fail because the validator only checks "digits, >=6")
- KycRegistrationAddressStep: Swiss-tax-residence toggle (Switch). When off, reveals a tax-residence country dropdown and a required TIN text field. Hidden by default so the Swiss-only path stays unchanged. - KycRegistrationPage: owns swissTaxResidenceCtrl + taxCountryCtrl + tinCtrl; on submit builds a CountryAndTin entry when the toggle is off, passes countryAndTINs into the cubit. - KycRegistrationSubmitCubit.submit: accepts optional countryAndTINs and threads it into Registration so it reaches the register-complete DTO. - Strings: swissTaxResidence, taxResidenceCountry, taxIdentificationNumber, tinHint, tinRequired (DE + EN), regenerated i18n.dart. - New widget tests pin the conditional rendering, the required-TIN validator path, and the controller round-trip. Existing golden test updated for the new required params.
|
Conflicts! |
|
Re API as Decision Authority ( 1. 2. If the API doesn't already return phone-format info per supported country (e.g. on Fix itself looks correct. The non-Swiss path closing the |
|
Converted to draft — needs a rebase on the current 1. KYC merge conflicts on A rebase attempt failed on commit
Both files were touched on
The resolution requires judgement calls about interaction (does Swiss-char-validation apply when tax-residence toggle is on? how does the wallet-status prefill interact with the tax-residence default?), so it's not mechanical — leaving it for you rather than guessing. 2. Tier 3 cache-key fix needs to be on the branch After the org transfer to GitHub Actions reads the workflow file from the PR head, so this PR's own Tier-3 run won't pick up the fix until the rebase brings No urgency — when you next pick this PR up, a fresh rebase on |
… rule The phone validator's _isPlausibleNationalNumber returned false in the default branch, so any prefix without a dedicated case (e.g. one added to [prefixes] later, or a future API-driven list) would silently reject every number from that country as too short until the switch was updated. Enforce the length rule only for prefixes we have an explicit format for and fail open otherwise; +41/+49 behaviour is unchanged. Add a regression test for an unruled prefix.
|
Note: rebase onto staging skipped — content conflicts in |
PortfolioChartCubit defaults to the threeMonths period, which filters price points relative to DateTime.now(). The 'flat-value series still spreads lines via the 5% floor' test pinned its points to fixed 2026-Q1 dates without selecting a period, so once wall-clock time moved more than three months past them the default window filtered every point out, the series became empty, and horizontalLineValues collapsed to [] — a deterministic, calendar-triggered failure that began on 2026-06-02 and reddens every branch's Analyze & Test. Select TimePeriod.all (the all-time window, minX = first price time, no now-dependency) so the fixed-date points are always visible, mirroring the sibling flat-series tests. The 5%-floor behaviour under test is period- independent, so the assertions are unchanged.
|
Stacked the fix from #639 onto this branch (cherry-picked |
Summary
Closes two registration funnel defects surfaced in the previous BitBox test session.
1. Non-Swiss registration was always rejected with 400
countryAndTINs is required when swissTaxResidence is false.Registrationmodel now carries an optionalcountryAndTINslist (forwarded to the existingRealUnitRegistrationRequestDto.countryAndTINs; not added to the EIP-712 envelope).RealUnitRegistrationService._completeRegistrationpropagates the field.KycRegistrationAddressStepadds a Swiss-tax-residence toggle. When off, a tax-residence country dropdown and a required TIN text field are revealed; the page collects them into aCountryAndTinentry and passes it through the cubit on submit.2.
PhoneNumberFieldaccepted implausible national numbers (only required + digits + length >= 6) and surfaced the failure as a backend 400.+41= 9 digits,+49= 10-11 digits). Unknown prefixes are rejected by default rather than silently allowed.Test plan
flutter analyze— no issuesflutter test test/packages/service/dfx/real_unit_registration_service_happy_test.dart— service-boundary regression covers non-Swiss caseflutter test test/widgets/form/phone_number_field_test.dart— 6 widget tests (required, digits-only, implausible +41, valid +41, implausible +49, valid +49)flutter test test/screens/kyc/steps/registration/steps/kyc_registration_address_step_test.dart— 4 widget tests pin the toggle behavior and TIN validatorNotes
swissTaxResidence,taxResidenceCountry,taxIdentificationNumber,tinHint,tinRequired.