fix: use per-owner address country to determine proof-of-address requirement for beneficial owners#92389
Draft
aswin-s wants to merge 7 commits into
Draft
Conversation
…ess requirement When a beneficial owner has UK citizenship but a non-UK residential address (e.g. US), the Documents sub-step was incorrectly skipped because the skip-pages predicate in BeneficialOwnerDetailsFormPages only checked nationality, not residential address country. Fixes two related defects: 1. BeneficialOwnerDetailsFormPages.tsx: tighten the GB skip condition to also require address country is GB (or unset). If the owner lives outside the UK, Documents must be shown regardless of citizenship. 2. getNeededDocumentsStatusForBeneficialOwner: add beneficialOwnerAddressCountry as a 4th param; set isProofOfAddressNeeded when address country ≠ account country (address mismatch case). 3. Documents.tsx / Confirmation.tsx: read address country from draft and pass it to the utility function. Fixes Expensify#90494
…ddress mismatch to GBP - Replace inline DOCUMENTS skip condition with getNeededDocumentsStatusForBeneficialOwner so both the skip decision and document requirements stay in sync from a single source - Scope isAddressCountryMismatch to GBP currency to match existing document requirement logic
…ource, guard comment, tests - BeneficialOwnerDetailsFormPages: use country from getCurrencyForNonUSDBankAccount (includes achData fallback) instead of draft-only countryStepCountryValue - Confirmation: read beneficialOwnerAddressCountry directly from draft key consistent with Documents.tsx instead of going through getValuesForBeneficialOwner - getNeededDocumentsStatusForBeneficialOwner: add comment explaining the empty-string guard on accountCountry/beneficialOwnerAddressCountry - Add unit tests for getNeededDocumentsStatusForBeneficialOwner covering all document flags and the new address-country mismatch parameter
…redundant Onyx subscription - isAddressCountryMismatch now requires GBP currency, consistent with all other GBP-specific document requirements and the signer info analog - BeneficialOwnerDetailsFormPages uses policyID prop directly for the policy lookup instead of subscribing to REIMBURSEMENT_ACCOUNT to re-derive it via achData.policyID - Update test to assert CAD mismatch does not trigger proof of address
… nationality and address country Eliminates three parallel manual per-owner key derivations by reading nationality and country from the shared utility that already centralises this logic. Removes unused SafeString/NATIONALITY/COUNTRY imports from Confirmation.tsx and Documents.tsx.
a346edc to
219c0fe
Compare
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.
Explanation of Change
The Documents page (proof-of-address upload) for beneficial owners in a GBP workspace was silently skipped when the owner's residential address country differed from the bank account country — for example, a GB-national with a US residential address on a GBP account.
Two defects fixed:
getNeededDocumentsStatusForBeneficialOwner.ts—isProofOfAddressNeededonly triggered for EUR workspaces or whenisCopyOfIDNeededwas true (GBP + non-GB nationality). It never checked whether the beneficial owner's address country differed from the bank account country. Added a fourth parameterbeneficialOwnerAddressCountryand anisAddressCountryMismatchflag (scoped to GBP) that is folded intoisProofOfAddressNeeded.BeneficialOwnerDetailsFormPages.tsx— The skip-pages predicate derived the owner's address country via a manually-constructed Onyx key. This is now sourced fromgetValuesForBeneficialOwner, the shared utility already used by sibling components, removing duplicated key construction across three files (BeneficialOwnerDetailsFormPages,Confirmation,Documents).Fixed Issues
$ #90494
PROPOSAL: #90494 (comment)
Tests
isCopyOfIDNeededpath still works).Offline tests
The beneficial owner form saves to Onyx draft — no online-only paths are affected. The address country value is read from the same draft key in all states.
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari