[$250] Merge - Inconsistent merge flow for same phone number
If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Version Number: V9.2.59-1 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from BrowserStack: Exploratory Email or phone of affected tester (no customers): Slottwo1 [email protected] Issue reported by: Applause Internal Team Device used: Redminote 10s android 13 App Component: User Settings
Action Performed:
- Go to https://staging.new.expensify.com/home
- Tap Account → Security → Merge Account
- Enter the formatted phone number: +1-(201)-867-5309
- Tap checkmark - I understand this is not reversible
- Tap Next
- Note that the message "We don’t do merging here" / "Merge not done here" is shown
- Go back
- Enter the same phone number without formatting by removing the hyphen and bracket: +12018675309
- Tap Next and note the correct error: "No existing account to merge"
Expected Result:
The same number (formatted or unformatted) must direct to the same validation page. If the formatting is incorrect, the user should not be allowed to navigate to the next page. An inline error below the phone number field should appear saying "Please enter the number in correct format", and only after fixing it, navigation should continue. Both formats should ultimately show the same final message: "No existing account to merge", since the number used is the same.
Actual Result:
For the same phone number, tapping Next takes the user to different pages: Formatted number → Shows "Merge not done here" Unformatted number → Shows "No existing account to merge" correctly
Workaround:
Unknown
Platforms:
- [x] Android: App
- [x] Android: mWeb Chrome
- [ ] iOS: App
- [ ] iOS: mWeb Safari
- [ ] iOS: mWeb Chrome
- [x] Windows: Chrome
- [ ] MacOS: Chrome / Safari
- [ ] MacOS: Desktop
Screenshots/Videos
https://github.com/user-attachments/assets/a27afa5d-c6ef-4209-a154-99747547f26c
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~021993335432097438954
- Upwork Job ID: 1993335432097438954
- Last Price Increase: 2025-11-25
Issue Owner
Current Issue Owner: @muttmuure
Triggered auto assignment to @muttmuure (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.
Job added to Upwork: https://www.upwork.com/jobs/~021993335432097438954
Triggered auto assignment to Contributor-plus team member for initial proposal review - @dukenv0307 (External)
Proposal
Please re-state the problem that we are trying to solve in this issue.
For the same phone number, tapping Next takes the user to different pages: Formatted number → Shows "Merge not done here" Unformatted number → Shows "No existing account to merge" correctly
What is the root cause of that problem?
We don't convert the phone number to the correct format before triggering GetValidateCodeForAccountMerge API, so BE returns a different error code for each format
What changes do you think we should make in order to solve the problem?
we should parse the phone number to the correct format like what we did before calling OpenReport.
Update requestValidationCodeForAccountMerge
function requestValidationCodeForAccountMerge(email: string, validateCodeResent = false, countryCode: number = CONST.DEFAULT_COUNTRY_CODE) {
// Normalize the email/phone input similar to how it's done in filterOptions
const parsedPhoneNumber = parsePhoneNumber(appendCountryCode(Str.removeSMSDomain(email), countryCode));
const normalizedEmail = parsedPhoneNumber.possible && parsedPhoneNumber.number?.e164 ? parsedPhoneNumber.number.e164 : email.toLowerCase();
...
in AccountValidatePage, update this line to
requestValidationCodeForAccountMerge(email, true, countryCode);
What alternative solutions did you explore? (Optional)
We also can do the same for mergeWithValidateCodeAction
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
Triggered auto assignment to @Julesssss, see https://stackoverflow.com/c/expensify/questions/7972 for more details.
📣 @paulnjs You have been assigned to this job! Please apply to the Upwork job and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑💻 Once you apply to this job, your Upwork ID will be stored and you will be automatically hired for future jobs! Keep in mind: Code of Conduct | Contributing 📖
@muttmuure, please remove the Reviewing label and bump to Daily as payment is due
Awaiting payment still