Skip to content

Handle errors for missing KBA data#68749

Merged
MonilBhavsar merged 46 commits intomainfrom
monil-kbaCardChanges
Nov 10, 2025
Merged

Handle errors for missing KBA data#68749
MonilBhavsar merged 46 commits intomainfrom
monil-kbaCardChanges

Conversation

@MonilBhavsar
Copy link
Contributor

@MonilBhavsar MonilBhavsar commented Aug 19, 2025

Explanation of Change

Fixed Issues

Part of https://github.com/Expensify/Expensify/issues/524583
PROPOSAL:

Tests

Pre requisite: An EU/UK bank account on EU/UK workspace so EU/UK virtual card can be issued

  1. As an admin, Issued virtual expensify card
  2. As a new user who does not have personal details set, tried to "Reveal card" details
  3. Ensured an error was displayed, and user was asked to fill personal details and hence the card details were revealed.
  • Verify that no errors appear in the JS console

Offline tests

QA Steps

Regression testing

  1. On a domain with Expensify card (Applause test domain should work, else let me know and I can confirm)
  2. Have an admin issue a virtual card to user.
  3. From Wallet page, Click on Reveal details and ensure it works.
  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
    • MacOS: Desktop
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I verified there are no new alerts related to the canBeMissing param for useOnyx
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
      • If any non-english text was added/modified, I used JaimeGPT to get English > Spanish translation. I then posted it in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I verified that similar component doesn't exist in the codebase
  • I verified that all props are defined accurately and each prop has a /** comment above it */
  • I verified that each file is named correctly
  • I verified that each component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
  • I verified that the only data being stored in component state is data necessary for rendering and nothing else
  • In component if we are not using the full Onyx data that we loaded, I've added the proper selector in order to ensure the component only re-renders when the data it is using changes
  • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
  • I verified that component internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
  • I verified that all JSX used for rendering exists in the render method
  • I verified that each component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions

Screenshots/Videos

Android: Native See MacOS: Chrome / Safari
Android: mWeb Chrome See MacOS: Chrome / Safari
iOS: Native Simulator Screenshot - iPhone 16 Pro - 2025-08-26 at 18 31 45 Simulator Screenshot - iPhone 16 Pro - 2025-08-26 at 18 34 45
iOS: mWeb Safari See MacOS: Chrome / Safari
MacOS: Chrome / Safari
Screen.Recording.2025-11-04.at.11.48.10.PM.mov
MacOS: Desktop

See MacOS: Chrome / Safari

@MonilBhavsar MonilBhavsar self-assigned this Aug 19, 2025
@MonilBhavsar MonilBhavsar marked this pull request as ready for review August 19, 2025 17:42
@MonilBhavsar MonilBhavsar requested a review from a team as a code owner August 19, 2025 17:42
@MonilBhavsar MonilBhavsar removed the request for review from a team August 19, 2025 17:43
@melvin-bot melvin-bot bot requested a review from mjasikowski August 19, 2025 17:43
@melvin-bot
Copy link

melvin-bot bot commented Aug 19, 2025

@mjasikowski 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]

@MonilBhavsar MonilBhavsar removed the request for review from mjasikowski August 19, 2025 17:44
Copy link
Member

@rafecolton rafecolton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few comments:

  1. I'm not sure if "private personal details" is a user-facing term or not (cc @jamesdeanexpensify)
  2. It looks like we are calling it Account not Settings
  3. I think it's a suboptimal experience to error here and require the user to go to a different page and back without either giving them a link or directing them to Profile using an RBR. Though I also don't want to expand the scope of this change. Would love some feedback from @Expensify/design on this one

@jamesdeanexpensify
Copy link
Contributor

jamesdeanexpensify commented Aug 20, 2025

I would say Please update your personal details under Account > Profile > Private, then try again.

But one question - is there a specific field they need to update? Or what specifically do they need to do next?

@rafecolton
Copy link
Member

But one question - is there a specific field they need to update? Or what specifically do they need to do next?

Ultimately they will need DOB, address, and phone number. So the updates required are one or more of those, whichever are missing.

@jamesdeanexpensify
Copy link
Contributor

Got it - so it won't be "updating" those fields, it will be more like "adding"?

@rafecolton
Copy link
Member

Yes. For more context, for physical card activation, all those fields should be set already and hitting this error is an edge case. The user is most likely to see this when trying to activate an admin-issued virtual card

@jamesdeanexpensify
Copy link
Contributor

Cool! I like this then, if you're good with it:

Please add your personal details under Account > Profile > Private, then try again.

@rafecolton
Copy link
Member

I do like it, though I'd like it even more if we could specify the fields

i.e. Please add your address and date of birth under Account > Profile > Private, then try again.

@jamesdeanexpensify
Copy link
Contributor

Oh totally - I didn't know we could make it dynamic. Even better!

@rafecolton
Copy link
Member

If you can dream it, we can build it 😉

@shawnborton
Copy link
Contributor

I feel like we should proactively put an RBR on Settings > Profile in this case, right? Like why wait until the user tries to reveal details, we should probably just let that user know ahead of time we need them to fill out information in their profile.

Otherwise I like where you landed with copy suggestions.

Other suggestions while we are here, because I've never actually seen these screens before... @MonilBhavsar can you show us a video of the whole flow?

For this, we need some extra space under the headline and above the number input. I also feel like the animation is too small?
CleanShot 2025-08-21 at 09 25 13@2x

For this, we could use some extra margin below the RBR message.
CleanShot 2025-08-21 at 09 25 43@2x

@shawnborton
Copy link
Contributor

For this copy you are suggest:

Please add your address and date of birth under Account > Profile > Private, then try again.

Can we make Private be a hyperlink that actually directs the user to that section of the app?

@dannymcclain
Copy link
Contributor

Agree with all of Shawn's comments above! Dig the copy.

I feel like we should proactively put an RBR on Settings > Profile in this case, right? Like why wait until the user tries to reveal details, we should probably just let that user know ahead of time we need them to fill out information in their profile.

How will we know when/if we should RBR profile? Once they order a card? I'm down to do something proactive if we know it's going to be an issue, just want to make sure we can know it's going to be an issue at the right time.

@shawnborton
Copy link
Contributor

I was thinking once they get assigned a card from the admin.

@dannymcclain
Copy link
Contributor

Right on - that makes sense to me. I'm for it.

@MonilBhavsar
Copy link
Contributor Author

I feel like we should proactively put an RBR on Settings > Profile in this case, right?

I like it. Let me give it a try.

@shawnborton here it is. The user has been issued a physical card and a virtual card by an admin and user is trying to activate physical card and reveal details of virtual card

Screen.Recording.2025-08-21.at.10.08.46.PM.mov

@joekaufmanexpensify
Copy link
Contributor

Would we just be adding the RBR to add personal details if they're issued a virtual card with no personal details set? Because we already collect the personal details in the flow to order a physical card, so i feel like it isn't really needed there.

@rafecolton
Copy link
Member

@DylanDylann can you do a final review please?

Copy link
Member

@rafecolton rafecolton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MonilBhavsar were you planning to address the lingering comments from @DylanDylann's prior review? Otherwise LGTM!

Comment on lines +46 to +58
// Update error state when error is cleared in Onyx DB
useEffect(() => {
setCardsDetailsErrors((prevErrors) => {
const clearedErrors = {...prevErrors};
Object.keys(clearedErrors).forEach((cardID) => {
if (cardListErrors[cardID] && Object.keys(cardListErrors[cardID]).length > 0) {
return;
}
delete clearedErrors[Number(cardID)];
});
return clearedErrors;
});
}, [cardListErrors]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it benefit from a comment?

}

if (response?.jsonCode === 404) {
// eslint-disable-next-line prefer-promise-reject-errors
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Were you planning to address this @MonilBhavsar?

@DylanDylann
Copy link
Contributor

The new update looks good to me

@melvin-bot melvin-bot bot requested a review from mollfpr November 10, 2025 07:46
@melvin-bot
Copy link

melvin-bot bot commented Nov 10, 2025

@mollfpr 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]

@MonilBhavsar
Copy link
Contributor Author

Merging as Rafe is ooo for two days

@MonilBhavsar MonilBhavsar merged commit 4fc9d7b into main Nov 10, 2025
36 checks passed
@MonilBhavsar MonilBhavsar deleted the monil-kbaCardChanges branch November 10, 2025 14:22
@OSBotify
Copy link
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@OSBotify
Copy link
Contributor

🚀 Deployed to staging by https://github.com/MonilBhavsar in version: 9.2.49-0 🚀

platform result
🖥 desktop 🖥 success ✅
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 failure ❌

@IuliiaHerets
Copy link

@MonilBhavsar QA team can't test this PR, we can't use EU/UK card.
Can you check it internal?

@OSBotify
Copy link
Contributor

🚀 Deployed to staging by https://github.com/MonilBhavsar in version: 9.2.49-0 🚀

platform result
🖥 desktop 🖥 success ✅
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 failure ❌

@MonilBhavsar
Copy link
Contributor Author

Yes, @joekaufmanexpensify has a card and should be able to help us 🙏

@joekaufmanexpensify
Copy link
Contributor

Yep, I will test in a bit 👍

@joekaufmanexpensify
Copy link
Contributor

tested on staging and worked well!

@IuliiaHerets
Copy link

@jamesdeanexpensify thank you! Can we check it off?

@jamesdeanexpensify
Copy link
Contributor

@IuliiaHerets was that meant for me or @joekaufmanexpensify ?

@joekaufmanexpensify
Copy link
Contributor

I think it was. I checked it off 👍

@IuliiaHerets
Copy link

@jamesdeanexpensify sorry, tagged you by mistake

@jamesdeanexpensify
Copy link
Contributor

All good!

@OSBotify
Copy link
Contributor

🚀 Deployed to staging by https://github.com/MonilBhavsar in version: 9.2.52-0 🚀

platform result
🖥 desktop 🖥 success ✅
🕸 web 🕸 cancelled 🔪
🤖 android 🤖 cancelled 🔪
🍎 iOS 🍎 failure ❌

@OSBotify
Copy link
Contributor

🚀 Deployed to production by https://github.com/cristipaval in version: 9.2.54-1 🚀

platform result
🖥 desktop 🖥 success ✅
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

@OSBotify
Copy link
Contributor

🚀 Deployed to staging by https://github.com/MonilBhavsar in version: 9.2.52-0 🚀

platform result
🖥 desktop 🖥 success ✅
🕸 web 🕸 cancelled 🔪
🤖 android 🤖 cancelled 🔪
🍎 iOS 🍎 failure ❌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.