Skip to content

[Due for payment 2026-11-25] [$175] Mock bank is displayed as a selectable option for a new user to connect in Personal cards #105757

Open

Description

@m-natarajan

If you haven’t already, check out our contributing guidelines for onboarding. To join our Slack channel, fill out this form.


Version Number: 9.5.27-2
Reproducible in staging?: Expected
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from BrowserStack:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: @dylanexpensify
Slack conversation (hyperlinked to channel name): #Expensify Bugs

Action Performed:

  1. Login as new user
  2. Navigate to Wallet
  3. Click on the "Add personal card"
  4. Selects United States as Country
  5. Observe the Bank options to select

Expected Result:

Mock bank is not a selectable option under Who's your bank?

Actual Result:

Mock bank is a selectable option

Workaround:

Unknown

Platforms:

Select the officially supported platforms where the issue was reproduced:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari

Screenshots/Videos

Recording.3763.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
Issue OwnerCurrent Issue Owner: @truph01

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Nov 3, 2026
  2. MelvinBot commented on Nov 3, 2026

    @MelvinBot
    Contributor

    Proposal

    What is the root cause of that problem?

    The personal card "Who's your bank?" list shows every value in CONST.PERSONAL_CARDS.BANKS, and that list includes MOCK_BANK. Nothing hides it in production.

    The workspace company card flow already hides Mock Bank outside non-production environments. The personal card flow, added in Add personal card steps, copied that screen but left out the filter.

    Code references

    What changes do you think we should make in order to solve the problem?

    In the personal card SelectBankStep:

    1. Read ONYXKEYS.ACTIVE_SERVER with useOnyx, defaulting to getActiveServer(), the same way the workspace step does.
    2. Filter CONST.PERSONAL_CARDS.BANKS before mapping. Keep MOCK_BANK only when CONFIG.ENVIRONMENT !== CONST.ENVIRONMENT.PRODUCTION or activeServer !== CONST.SERVER.PRODUCTION.

    Mock Bank stays available for dev and staging testing. Production users no longer see it.

    Add a unit test that checks Mock Bank is hidden in production and shown otherwise.

    What alternative solutions did you explore? (Optional)

    Move the visibility check into a shared CardUtils helper, for example shouldShowMockBank(activeServer). Both bank steps would then use it, so the two lists can't drift apart again.


    Next Steps for Contributor+ team:
    To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/105757) to create a draft PR.
    To refine: @MelvinBot <your feedback>
    To reject: Explain why you are rejecting Melvin's proposal.


    view run

  3. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Nov 3, 2026
  4. melvin-bot commented on Nov 3, 2026

    @melvin-bot

    Triggered auto assignment to Contributor-plus team member for initial proposal review - @truph01 (External)

  5. changed the title [-]Mock bank is displayed as a selectable option for a new user to connect in Personal cards[/-] [+][$175] Mock bank is displayed as a selectable option for a new user to connect in Personal cards[/+] on Nov 3, 2026
  6. melvin-bot commented on Nov 3, 2026

    @melvin-bot
  7. Aschio12 commented on Nov 3, 2026

    @Aschio12

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    In production, a new user who goes to Wallet > Add personal card and picks United States sees "Mock Bank" in the "Who's your bank?" list. It is a test-only option and should only appear on dev and staging.

    What is the root cause of that problem?

    The personal card bank screen builds its list from every value in CONST.PERSONAL_CARDS.BANKS, and that list includes MOCK_BANK. src/pages/settings/Wallet/PersonalCards/steps/SelectBankStep.tsx maps the whole list with no filter.

    The workspace company card screen (src/pages/workspace/companyCards/addNew/SelectBankStep.tsx) does hide Mock Bank in production. Its filter is written inline inside that component, so when the personal card screen was built from it, the filter was not carried over. Nothing shares the rule, so the two screens drifted apart.

    What changes do you think we should make in order to solve the problem?

    Put the "is Mock Bank allowed here" rule in one place and use it on both screens:

    1. In src/libs/CardUtils.ts, add a small pure helper, for example shouldShowMockBank(activeServer). It returns true unless the app is running in production on the production server. That is the same condition the workspace screen uses today: CONFIG.ENVIRONMENT !== PRODUCTION || activeServer !== SERVER.PRODUCTION.
    2. In the personal card SelectBankStep, read ONYXKEYS.ACTIVE_SERVER the same way the workspace screen does (useOnyx(ONYXKEYS.ACTIVE_SERVER) with getActiveServer() as the default). Filter out MOCK_BANK when the helper returns false, before mapping the list.
    3. In the workspace SelectBankStep, replace the inline Mock Bank condition with the same helper. Behavior there does not change.

    Dev and staging still show Mock Bank for testing. Production users no longer see it on either screen.

    What alternative solutions did you explore? (Optional)

    • Copy the inline filter into the personal screen. It fixes the bug, but leaves two copies of the rule, which is how this bug appeared. A shared helper means the next bank screen cannot forget it.
    • Remove MOCK_BANK from CONST.PERSONAL_CARDS.BANKS. This would break dev and staging testing, and the icon map in CardUtils.getPersonalBankCardDetailsImage still expects the key.

    Automated Tests

    Add unit tests for the helper in tests/unit/CardUtilsTest.ts, with CONFIG.ENVIRONMENT mocked:

    • Production environment and production server: returns false.
    • Production environment but a non-production server: returns true.
    • Non-production environment: returns true.

    Contributor details
    Your Expensify account email: aschalewdere2@gmail.com
    Upwork Profile Link: https://www.upwork.com/freelancers/~01b64b281fe1263953

  8. melvin-bot commented on Nov 3, 2026

    @melvin-bot

    ✅ Contributor details stored successfully. Thank you for contributing to Expensify!

  9. camesenin commented on Nov 3, 2026

    @camesenin
  10. melvin-bot commented on Nov 3, 2026

    @melvin-bot

    ✅ Contributor details stored successfully. Thank you for contributing to Expensify!

  11. sumit-2007-git commented on Nov 3, 2026

    @sumit-2007-git

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    In production, when a user goes to Wallet > Add personal card and selects United States, "Mock Bank" is displayed as a selectable option in the "Who's your bank?" list. "Mock Bank" is for dev/staging testing only and should not appear in production.

    What is the root cause of that problem?

    In src/pages/settings/Wallet/PersonalCards/steps/SelectBankStep.tsx (line 55):

    const data = Object.values(CONST.PERSONAL_CARDS.BANKS).map((bank) => ({

    CONST.PERSONAL_CARDS.BANKS contains MOCK_BANK: 'Mock Bank'.

    In the workspace company cards flow (src/pages/workspace/companyCards/addNew/SelectBankStep.tsx:62-71), MOCK_BANK is explicitly filtered out unless in non-production:

    if (bank === CONST.COMPANY_CARDS.BANKS.MOCK_BANK) {
        return CONFIG.ENVIRONMENT !== CONST.ENVIRONMENT.PRODUCTION || activeServer !== CONST.SERVER.PRODUCTION;
    }

    However, the personal cards SelectBankStep.tsx maps the constant list directly without applying this filter, causing Mock Bank to leak into production.

    What changes do you think we should make in order to solve the problem?

    Align src/pages/settings/Wallet/PersonalCards/steps/SelectBankStep.tsx with the established pattern from src/pages/workspace/companyCards/addNew/SelectBankStep.tsx:

    1. Import CONFIG from @src/CONFIG and getActiveServer from @libs/ApiUtils.
    2. Retrieve activeServer using useOnyx:
    const [activeServer = getActiveServer()] = useOnyx(ONYXKEYS.ACTIVE_SERVER);
    1. Filter CONST.PERSONAL_CARDS.BANKS before mapping:
    --- a/src/pages/settings/Wallet/PersonalCards/steps/SelectBankStep.tsx
    +++ b/src/pages/settings/Wallet/PersonalCards/steps/SelectBankStep.tsx
    @@ -16,6 +16,8 @@
     import useThemeStyles from '@hooks/useThemeStyles';
     
    +import {getActiveServer} from '@libs/ApiUtils';
     import {getPersonalBankCardDetailsImage} from '@libs/CardUtils';
     
     import variables from '@styles/variables';
    @@ -23,6 +25,7 @@
     import {setAddNewPersonalCardStepAndData} from '@userActions/PersonalCards';
     
    +import CONFIG from '@src/CONFIG';
     import CONST from '@src/CONST';
     import ONYXKEYS from '@src/ONYXKEYS';
    @@ -31,6 +34,7 @@ function SelectBankStep() {
         const {isOffline} = useNetwork();
     
    +    const [activeServer = getActiveServer()] = useOnyx(ONYXKEYS.ACTIVE_SERVER);
         const [addNewPersonalCard] = useOnyx(ONYXKEYS.ADD_NEW_PERSONAL_CARD);
         const [bankSelected, setBankSelected] = useState<ValueOf<typeof CONST.PERSONAL_CARDS.BANKS> | null | undefined>(addNewPersonalCard?.data?.selectedBank);
    @@ -52,7 +56,13 @@ function SelectBankStep() {
         };
     
    -    const data = Object.values(CONST.PERSONAL_CARDS.BANKS).map((bank) => ({
    +    const data = Object.values(CONST.PERSONAL_CARDS.BANKS)
    +        .filter((bank) => {
    +            if (bank === CONST.PERSONAL_CARDS.BANKS.MOCK_BANK) {
    +                return CONFIG.ENVIRONMENT !== CONST.ENVIRONMENT.PRODUCTION || activeServer !== CONST.SERVER.PRODUCTION;
    +            }
    +            return true;
    +        })
    +        .map((bank) => ({
             value: bank,
             text: bank === CONST.PERSONAL_CARDS.BANKS.OTHER ? translate('workspace.companyCards.addNewCard.other') : bank,

    What alternative solutions did you explore? (Optional)

    Extracting a shared helper function shouldShowMockBank(activeServer) in CardUtils.ts was explored. However, applying the check directly in SelectBankStep.tsx matches the existing company cards implementation cleanly without touching unrelated files or introducing regression risk.

    What automated tests can you add to prevent this from re-occurring?

    In tests/unit/PersonalCardsSelectBankStepTest.tsx:

    • Verify that when CONFIG.ENVIRONMENT === CONST.ENVIRONMENT.PRODUCTION and activeServer === CONST.SERVER.PRODUCTION, Mock Bank is excluded from the list.
    • Verify that when CONFIG.ENVIRONMENT !== CONST.ENVIRONMENT.PRODUCTION, Mock Bank is present and selectable.

    Contributor Track Record & Details

    • Proven Open-Source Contributor: Successfully merged pull requests in major enterprise repositories including Microsoft .NET runtime (PR reference: dotnet/runtime#136828).
    • Ready for Fast Turnaround: Full environment configured, ready to push clean PR with passing Jest tests immediately upon assignment.
  12. sumit-2007-git commented on Nov 4, 2026

    @sumit-2007-git

    Contributor details
    Your Expensify account email: sumitkeshri.1237373@gmail.com
    Upwork Profile Link: https://www.upwork.com/freelancers/~015b34e130d9aad41d

  13. 8 remaining items

  14. truph01 commented on Nov 12, 2026

    @truph01
    Contributor

    @MelvinBot Your proposal looks good #105757 (comment). Draft PR

  15. MelvinBot commented on Nov 12, 2026

    @MelvinBot
    Contributor

    🤖 Web test steps verification results: ⚠️ partial

    Verified the dev web flow, including Mock Bank and real-bank options; new-user status was not independently confirmed. Production UI was not tested.
    DNS failure after advancing with Chase selected

    Step Status
    Open WalletAuthenticated user opened Wallet successfully.
    ✅
    Click Add personal cardCountry selection appeared.
    ✅
    Select United StatesThe bank selection screen appeared.
    ✅
    Verify bank optionsMock Bank remained available in development, alongside real banks. Selecting Chase advanced to an external handoff that failed DNS resolution; the screenshot shows that blocker, not the bank list.
    DNS failure after advancing with Chase selected
    ✅

    Created draft PR: Hide Mock Bank from personal cards in production, assigned to truph01.

    All 39,103 executed tests passed, including five new regression cases. Typecheck and Storybook passed; tooling limitations are documented in the PR.

    The branch is upstream because I cannot push to your fork. To copy it, fetch claude-hideMockPersonalBank from upstream and push it to your fork.


    view run · no recording available

  16. expensify-chore-bot commented on Nov 17, 2026

    @expensify-chore-bot

    Triggered auto assignment to @pecanoro, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

  17. changed the title [-][$175] Mock bank is displayed as a selectable option for a new user to connect in Personal cards[/-] [+][Due for payment 2026-11-25] [$175] Mock bank is displayed as a selectable option for a new user to connect in Personal cards[/+] on Nov 18, 2026
  18. melvin-bot commented on Nov 18, 2026

    @melvin-bot

    @truph01

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.5.41-2 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

    If no regressions arise, payment will be issued on 2026-11-25. 🎊

    The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the Contributor+ Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]. If no checklist is needed for this issue, you can click: [no checklist button]

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

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributorOverdue

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions