Don't trigger KYC flow if item.key is exactly Elsewhere in Search - #81448
Conversation
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
|
@MelvinBot can you please review this PR |
There was a problem hiding this comment.
Pull request overview
This PR fixes an issue where selecting "Mark as paid" from the Pay dropdown in the Reports page was incorrectly triggering the bank account (KYC) flow. The fix adds a specific check to ensure that when the payment method is exactly "Elsewhere" (which is the key for "Mark as paid"), the KYC flow is not triggered.
Changes:
- Added a condition to prevent KYC flow trigger when
item.keyequalsCONST.IOU.PAYMENT_TYPE.ELSEWHERE - Ensures "Mark as paid" works correctly without requiring bank account setup
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
🔍 Code ReviewPR: Don't trigger KYC flow if item.key is exactly Elsewhere in Search SummaryThis PR adds a condition to prevent the KYC/bank account flow from triggering when the user selects "Mark as Paid" (payment type AnalysisThe Change: - if (!!selectedPolicy || shouldSelectPaymentMethod) {
+ if ((!!selectedPolicy || shouldSelectPaymentMethod) && item.key !== CONST.IOU.PAYMENT_TYPE.ELSEWHERE) {Root Cause Understanding: ✅ Correct The issue occurs because:
Review Feedback
The fix is sound. When Minor ObservationI noticed that const shouldSelectPaymentMethod = paymentMethod !== CONST.IOU.PAYMENT_TYPE.ELSEWHERE && (isPaymentMethod || !isEmpty(latestBankItems));This ensures An alternative approach (as noted in @nyomanjyotisa's proposal) would be to fix this at the source in Verdict✅ Approved - This is a correct, minimal fix for the deploy blocker. The change ensures "Mark as Paid" bypasses the KYC flow and proceeds directly to marking the expense as paid, which matches the expected behavior confirmed by @joekaufmanexpensify. Note: PR checks are passing. Ready for merge once a human reviewer approves. |
|
@hungvu193 Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
Code Review CompleteI've completed the inline review of this PR. The change looks good overall - it's a targeted fix that prevents the KYC flow from being triggered when "Mark as paid" (Elsewhere) is selected. Summary
The implementation correctly adds an additional condition to exclude the "Elsewhere" payment type from triggering the KYC flow, which aligns with the business requirement confirmed with @joekaufmanexpensify. Any specific feedback has been posted as inline comments on the relevant lines. |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / Safari |
|
🚧 @Julesssss has triggered a test Expensify/App build. You can view the workflow run here. |
Don't trigger KYC flow if item.key is exactly Elsewhere in Search (cherry picked from commit 4ef16e3) (cherry-picked to staging by Julesssss)
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
Requested QA testing here. |
|
🚀 Cherry-picked to staging by https://github.com/Julesssss in version: 9.3.11-52 🚀
|
|
🚀 Deployed to production by https://github.com/Julesssss in version: 9.3.12-1 🚀
|
|
🚀 Cherry-picked to staging by https://github.com/Julesssss in version: 9.3.13-1 🚀
|
|
🚀 Cherry-picked to staging by https://github.com/Julesssss in version: 9.3.15-0 🚀
|
|
🚀 Deployed to production by https://github.com/lakchote in version: 9.3.15-10 🚀
|
Explanation of Change
We created this PR to make sure that
shouldSelectPaymentMethodis false if paymentMethod isElsewhere.But we also needed to make sure that selectedPolicy is falsy for certain cases. This PR takes care of that but @MrMuzyk is currently not available so this is a more succinct fix.
I confirmed with @joekaufmanexpensify that the
Mark as paidbutton shouldn't trigger the bank account flow and that's what this PR does. If the item.key is exactly "Elsewhere" which it only is whenMark as paidis pressed, then it avoids triggering the bank account flow.Fixed Issues
$ #81349
PROPOSAL:
Tests
Offline tests
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
Same as tests
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand 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
Screen.Recording.2026-02-04.at.5.03.55.PM.mov
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari