Skip to content

feat: show connection status and last sync time for bank accounts and cards#93852

Open
marufsharifi wants to merge 90 commits into
Expensify:mainfrom
marufsharifi:feat/show-connection-status-and-last-sync-for-bank-accounts-and-cards
Open

feat: show connection status and last sync time for bank accounts and cards#93852
marufsharifi wants to merge 90 commits into
Expensify:mainfrom
marufsharifi:feat/show-connection-status-and-last-sync-for-bank-accounts-and-cards

Conversation

@marufsharifi

@marufsharifi marufsharifi commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Explanation of Change

This PR adds connection health visibility for bank accounts and cards in the wallet/payment connection surfaces.

For bank accounts, it updates the displayed statuses and related RBR/action copy so users can see whether an account is Active, Incomplete, Pending, Verifying, or Locked, and take the appropriate existing action when needed.

For cards, it adds Active/Inactive connection status, last sync information for direct-feed and personal cards, and the issue-specific RBR/action behavior for broken personal card and company card connections.

Fixed Issues

$ #91300
PROPOSAL:

Tests

Precondition:

  • Logged in to a walletConnectionStatus beta account.
  • For Workflow Bank Account flows, use a Submit workspace.

Card Flows

  1. Active personal card with sync date
    • Go to Settings > Wallet > Cards.
    • Verify the personal card shows Active and Synced [relative date].
  2. Personal card never synced
    • Go to Settings > Wallet > Cards.
    • Verify the personal card shows Active and Never synced.
  3. Inactive personal card
    • Go to Settings > Wallet > Cards.
    • Verify the personal card shows Inactive, Please fix this connection, and the Fix button.
  4. Inactive company card as admin
    • Log in as a workspace admin.
    • Go to Settings > Wallet > Cards.
    • Verify the company card shows Inactive, Please fix this connection in company cards, and no Fix button.
  5. Inactive company card as employee
    • Log in as a non-admin employee.
    • Go to Settings > Wallet > Cards.
    • Verify the company card shows Inactive, Please ask an admin to fix this connection, and no Fix button or company cards link.

Bank Account Flows

  1. Active bank account
    • Go to Settings > Wallet > Bank accounts.
    • Verify the payment account shows Active with no RBR/action.
  2. Incomplete bank account
    • Go to Settings > Wallet > Bank accounts.
    • Verify the payment account shows Incomplete, Finish adding bank account, and the Finish button.
  3. Pending bank account
    • Go to Settings > Wallet > Bank accounts.
    • Verify the payment account shows Pending, Please confirm test transactions, and the Confirm button.
  4. Verifying bank account
    • Go to Settings > Wallet > Bank accounts.
    • Verify the payment account shows Verifying with the tooltip We're reviewing your documentation and no RBR/action.
  5. Locked bank account
    • Go to Settings > Wallet > Bank accounts.
    • Verify the payment account shows Locked, This account requires attention, and the Unlock button.

Workflow Bank Account Flows

  1. Workspace payment account statuses
    • Go to Settings > Workspaces > [Workspace] > Workflows.
    • Verify the payment account section matches the expected state below:
State Expected result
Active Shows Active with no RBR/action.
Incomplete Shows Incomplete, Finish adding bank account, and Finish.
Pending Shows Pending, Please confirm test transactions, and Confirm.
Verifying Shows Verifying with the tooltip We're reviewing your documentation and no RBR/action.
Locked Shows Locked, This account requires attention, and Unlock.
  • Verify that no errors appear in the JS console

Offline tests

Same as tests

QA Steps

Same as tests

// TODO: These must be filled out, or the issue title must include "[No QA]."

  • 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
  • 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 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
    • 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.

Screenshots/Videos

Android: Native

Card Flows

One

Screenshot 2026-06-19 at 11 55 58 PM

Two

Screenshot 2026-06-19 at 11 57 04 PM

Three

Screenshot 2026-06-19 at 11 57 38 PM

Four

Screenshot 2026-06-19 at 11 58 54 PM

Five

Screenshot 2026-06-19 at 11 59 19 PM

Bank Account Flows

One

Screenshot 2026-06-20 at 12 00 24 AM

Two

Screenshot 2026-06-19 at 11 51 37 PM

Three

Screenshot 2026-06-20 at 12 01 20 AM

Four

Screenshot 2026-06-20 at 12 02 00 AM

Five

Screenshot 2026-06-20 at 12 02 45 AM

Workflow Bank Account Flows

One

Screenshot 1405-04-10 at 5 12 34 PM
Android: mWeb Chrome

Card Flows

One

Screenshot 2026-06-20 at 1 00 33 AM

Two

Screenshot 2026-06-20 at 1 01 09 AM

Three

Screenshot 2026-06-20 at 1 01 45 AM

Four

Screenshot 2026-06-20 at 1 02 23 AM

Five

Screenshot 2026-06-20 at 1 03 09 AM

Bank Account Flows

One

Screenshot 2026-06-20 at 1 04 09 AM

Two

Screenshot 2026-06-20 at 1 04 47 AM

Three

Screenshot 2026-06-20 at 1 05 21 AM

Four

Screenshot 2026-06-20 at 1 05 51 AM

Five

Screenshot 2026-06-20 at 1 06 35 AM

Workflow Bank Account Flows

One

Screenshot 1405-04-10 at 5 14 45 PM
iOS: Native

Card Flows

One

Screenshot 2026-06-20 at 1 25 12 AM

Two

Screenshot 2026-06-20 at 1 28 03 AM

Three

Screenshot 2026-06-20 at 1 29 10 AM

Four

Screenshot 2026-06-20 at 1 29 53 AM

Five

Screenshot 2026-06-20 at 1 30 23 AM

Bank Account Flows

One

Screenshot 2026-06-20 at 1 31 03 AM

Two

Screenshot 2026-06-20 at 1 31 43 AM

Three

Screenshot 2026-06-20 at 1 32 11 AM

Four

Screenshot 2026-06-20 at 1 32 44 AM

Five

Screenshot 2026-06-20 at 1 33 12 AM

Workflow Bank Account Flows

One

Screenshot 1405-04-10 at 4 55 43 PM
iOS: mWeb Safari

Card Flows

One

Screenshot 2026-06-20 at 1 39 05 AM

Two

Screenshot 2026-06-20 at 1 40 26 AM

Three

Screenshot 2026-06-20 at 1 40 54 AM

Four

Screenshot 2026-06-20 at 1 41 24 AM

Five

Screenshot 2026-06-20 at 1 41 54 AM

Bank Account Flows

One

Screenshot 2026-06-20 at 1 42 27 AM

Two

Screenshot 2026-06-20 at 1 43 06 AM

Three

Screenshot 2026-06-20 at 1 43 41 AM

Four

Screenshot 2026-06-20 at 1 44 08 AM

Five

Screenshot 2026-06-20 at 1 44 37 AM

Workflow Bank Account Flows

One

Screenshot 1405-04-10 at 4 58 59 PM
MacOS: Chrome / Safari

Card Flows

One

1

Two

2

Three

3

Four

4

Five

5

Bank Account Flows

One

Screenshot 2026-06-20 at 12 04 27 AM

Two

6

Three

Screenshot 2026-06-20 at 12 05 20 AM

Four

Screen.Recording.2026-06-20.at.12.06.17.AM.mov

Five

Screenshot 2026-06-20 at 12 06 42 AM

Workflow Bank Account Flows

One

Screenshot 1405-04-10 at 4 41 07 PM

@melvin-bot

melvin-bot Bot commented Jun 17, 2026

Copy link
Copy Markdown

Hey, I noticed you changed src/languages/en.ts in a PR from a fork. For security reasons, translations are not generated automatically for PRs from forks.

If you want to automatically generate translations for other locales, an Expensify employee will have to:

  1. Look at the code and make sure there are no malicious changes.
  2. Run the Generate static translations GitHub workflow. If you have write access and the K2 extension, you can simply click: [this button]

Alternatively, if you are an external contributor, you can run the translation script locally with your own OpenAI API key. To learn more, try running:

npx ts-node ./scripts/generateTranslations.ts --help

Typically, you'd want to translate only what you changed by running npx ts-node ./scripts/generateTranslations.ts --compare-ref main

@marufsharifi
marufsharifi marked this pull request as ready for review June 18, 2026 18:58
@marufsharifi
marufsharifi requested review from a team as code owners June 18, 2026 18:58
@melvin-bot
melvin-bot Bot requested review from heyjennahay and mkhutornyi and removed request for a team and heyjennahay June 18, 2026 18:58
@melvin-bot

melvin-bot Bot commented Jun 18, 2026

Copy link
Copy Markdown

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

@melvin-bot
melvin-bot Bot removed the request for review from a team June 18, 2026 18:58
Comment thread src/pages/workspace/workflows/WorkspaceWorkflowsPage.tsx Outdated
Comment thread src/pages/workspace/workflows/WorkspaceWorkflowsPage.tsx Outdated
Comment thread src/pages/settings/Wallet/PaymentMethodList.tsx Outdated
Comment thread src/pages/settings/Wallet/PaymentMethodListItem.tsx Outdated
Comment thread src/pages/settings/Wallet/PaymentMethodList.tsx Outdated
Comment on lines -328 to -343
// The card should be grouped to a specific domain and such domain already exists in a assignedCardsGrouped
if (assignedCardsGrouped.some((item) => item.isGroupedCardDomain && item.description === card.domainName) && !isAdminIssuedVirtualCard) {
const domainGroupIndex = assignedCardsGrouped.findIndex((item) => item.isGroupedCardDomain && item.description === card.domainName);
const assignedCardsGroupedItem = assignedCardsGrouped.at(domainGroupIndex);
if (domainGroupIndex >= 0 && assignedCardsGroupedItem) {
assignedCardsGroupedItem.errors = {...assignedCardsGrouped.at(domainGroupIndex)?.errors, ...card.errors};
if (
card.fraud === CONST.EXPENSIFY_CARD.FRAUD_TYPES.DOMAIN ||
card.fraud === CONST.EXPENSIFY_CARD.FRAUD_TYPES.INDIVIDUAL ||
Object.keys(assignedCardsGroupedItem.errors).length > 0
) {
assignedCardsGroupedItem.brickRoadIndicator = CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR;
}
}
continue;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Are you able to test this domain flow? I am not sure we should remove this entire domain card grouping logic.

@mkhutornyi

Copy link
Copy Markdown
Contributor

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 987214eef9

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/pages/settings/Wallet/PaymentMethodList.tsx Outdated
Comment thread src/pages/workspace/workflows/WorkspaceWorkflowsPage.tsx Outdated
@MelvinBot

Copy link
Copy Markdown
Contributor

Review

Thanks for the PR! The feature looks well-organized, but CI is currently red across 4 checks (typecheck, ESLint, test, checklist) and every failure traces back to this diff. These are all blocking and need to be addressed before review can proceed.

🔴 Must fix (blocking CI)

1. Translation keys only added to en.ts — all 9 other locales now fail typecheck + the translation unit test.
The new walletPage.cardLastSynced, cardNeverSynced, cardStatus, and bankAccountStatus keys were added to src/languages/en.ts but not to the other locale files. Because each locale is typed as TranslationDeepObject<typeof en>, de/es/fr/it/ja/nl/pl/pt-BR/zh-hans.ts all fail with TS2739: ... is missing the following properties, and TranslateTest › Does es locale have all the keys fails. You at minimum need to add the keys to es.ts; the rest are auto-translated, but the keys must exist.

2. paymentMethod.accountData?.state is not typed (typecheck + ESLint failure).
PaymentMethodList.tsx:491Property 'state' does not exist on type 'AccountData | AccountData' (TS2339), which also produces the no-unsafe-argument ESLint error at 491:109. PaymentMethod['accountData'] doesn't expose state the way the workspace bankAccountConnectedToWorkspace?.accountData did. You'll need to read state from the correct field/type.

3. onActionPress / onLinkPress signatures don't match TextLink/MenuItem props (typecheck).
PaymentMethodListItem.tsx:244 and :250(e: GestureResponderEvent | KeyboardEvent | undefined) => void and (e: GestureResponderEvent | KeyboardEvent) => void aren't assignable to the expected ((event: GestureResponderEvent | KeyboardEvent) => void) & ((event: GestureResponderEvent) => void). Align the handler param types in ConnectionStatusDetails with what the consuming components expect.

4. Nested ternaries (ESLint no-nested-ternary).

Extract these into helper functions or if/else blocks.

🟡 Worth a look (logic/design — please verify)

Details
  • Last-sync / connection status now applied to Expensify cards. The new cardConnectionStatus and appendCardLastSync(...) are set in the Expensify-card branch at PaymentMethodList.tsx:388-389. Expensify cards typically have no lastScrape, so they'll render "Never synced" and an Active/Inactive pill. The PR description scopes last-sync to "direct-feed and personal cards" — is showing this on Expensify cards intended?

  • Domain grouping for assigned cards was removed. The block that grouped admin-issued virtual cards by domainName (and aggregated errors/brickRoad onto the group) is gone, along with isGroupedCardDomain. This is a meaningful UX change for workspaces with many cards in one domain. The comment at PaymentMethodList.tsx:379 explains the intent — just confirming this de-grouping was approved in the proposal, since it affects every wallet with grouped domain cards, not only broken connections.

  • InlineRBRMessage action fires regardless of write permission. In WorkspaceWorkflowsPage, the inline message's onActionPress={handleBankAccountPress} is rendered/usable even though the MenuItem onPress is gated behind canWritePayments. Consider gating the inline action the same way.

  • getBankAccountConnectionStatus(undefined) returns "Incomplete / Finish adding bank account". Worth confirming an existing-but-stateless achAccount can't briefly hit the case undefined branch and show a misleading "finish adding" RBR.

Note on pushing a fix

I'm not the PR author or an assignee, so I can't push these fixes to the branch myself. The author can knock out items 1–4 to get CI green; if you'd like me to take a pass at them, add me as an assignee and reply with @MelvinBot fix the failing checks.

@mkhutornyi

Copy link
Copy Markdown
Contributor

The layout is quite different from design. I think the PR is quite not ready yet.

Screenshot 2026-06-19 at 7 38 00 AM Screenshot 2026-06-19 at 7 38 22 AM

@marufsharifi

Copy link
Copy Markdown
Contributor Author

@mkhutornyi, I am checking all feedback in order. thanks.

@mkhutornyi

Copy link
Copy Markdown
Contributor

I know it's hard to test all cases of bank account and card flow so in Tests steps, please add hardcoded mock Onyx data which has all cases shown in design. It should have 9 bank/card connections below:

  • Bank account: Verified, Setup, Pending, Verifying, Locked
  • Card: Active, Inactive (direct feed - employee), Inactive (direct feed - admin), Inactive (personal card)

@mkhutornyi

mkhutornyi commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

How about adding beta until this feature is fully QA'ed by internal team and QA? So non-beta users still see old UI.
This way, we can avoid revert and fix follow-up issues they'll report.

brickRoadIndicator={hasReimburserError ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined}
/>
{canAccessSubmit2026Features ? (
<Hoverable>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I am not sure this is the right approach.
Hoverable means trigger action when clicked right?
But when click error message, nothing happens.

@mkhutornyi

mkhutornyi commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

I am not sure this is the right approach. Hoverable means trigger action when clicked right? But when click error message, nothing happens. Cursor is also text, not pointer.

I think error message should not be hoverable.

@Expensify/design what do you think?

Screen.Recording.2026-07-17.at.12.16.19.PM.mov

@marufsharifi

Copy link
Copy Markdown
Contributor Author

I think we should disable hover on error message.

@mkhutornyi, we checked this with design here: #93852 (comment)

Design team was okay with keeping the error message inside the hover area, with the spacing adjustment:

I don't mind it inside of the hover area, but I think we need to remove 4px of padding from the top of the error row and add 4px more padding to the bottom

So I kept the error message inside the hover area and applied the spacing polish based on that feedback.

@marufsharifi

Copy link
Copy Markdown
Contributor Author

This is only needed for workspace workflows page right? No need on Wallet page

The submit2026 beta needs to be enabled for both Wallet and Workflows.

The only extra requirement is for Workflows: it also needs to be tested with a Submit workspace

@mkhutornyi

Copy link
Copy Markdown
Contributor

This is only needed for workspace workflows page right? No need on Wallet page

The submit2026 beta needs to be enabled for both Wallet and Workflows.

Can you share permalink on Wallet page where this beta is used?
We're always showing bank accounts and cards without this beta

@marufsharifi

Copy link
Copy Markdown
Contributor Author

Can you share permalink on Wallet page where this beta is used?

Wallet rows are always shown — the beta only gates the new connection-status / last-sync UI:

  • Beta gate: PaymentMethodList.tsx#L231 (
    const shouldShowConnectionStatus = isBetaEnabled(CONST.BETAS.SUBMIT_2026);
    )
  • Bank status uses it: PaymentMethodList.tsx#L575 (
    const bankConnectionStatus = shouldShowConnectionStatus && !isMissingPersonalInfo ? getBankAccountConnectionStatus(getBankAccountState(paymentMethod.accountData)) : undefined;
    )
    Without submit2026, users see the old UI (no status badges, no sync info). With it, they see the new connection-status behavior.

@marufsharifi

Copy link
Copy Markdown
Contributor Author

3. Consider extracting + testing the card connection-status logic

@marufsharifi Let's do this!

@mkhutornyi, added this with unit tests.

Comment thread src/pages/settings/Wallet/PaymentMethodList.tsx Outdated
@mkhutornyi

Copy link
Copy Markdown
Contributor

Regression analysis from AI:

🔴 1. The beta gate is too broad — two undocumented surfaces inherit the feature

shouldShowConnectionStatus = isBetaEnabled(CONST.BETAS.SUBMIT_2026) lives inside PaymentMethodList, which has three consumers — but the PR describes, tests, and screenshots only Wallet:

Consumer In PR scope?
src/pages/settings/Wallet/WalletPage/index.tsx:890 (×2) ✅ yes
src/pages/workspace/ConnectExistingBusinessBankAccountPage.tsx:105 no
src/pages/workspace/invoices/WorkspaceInvoiceVBASection.tsx:267 no

Neither of the latter two passes shouldShowAssignedCards, so both take the bank-account branch and get connectionStatus on every row. For beta users these two pages change without design review or a test step.

ConnectExistingBusinessBankAccountPage is the worse of the two. It's a picker — "Choose an existing account". Every non-OPEN account now renders a red brick road, a danger-toned badge, and an action button:

  • Incomplete → "Finish adding bank account" + Finish
  • Pending → "Please confirm test transactions" + Confirm

That button routes to paymentMethodPresshandleItemPress, which fires setWorkspaceReimbursement(...) — i.e. it connects the account to the workspace. So a button labeled "Finish" performs the picker's select-and-connect mutation. It does also navigate onward via navigateToBankAccountRoute for partially-setup accounts, so it isn't catastrophic — but turning a picker list into a wall of RBRs with mutating action buttons isn't what this PR set out to do.

Suggested fix: hoist the gate to a prop (e.g. shouldShowConnectionStatus) that only WalletPage opts into, rather than reading the beta inside the shared component.


🟠 2. "Unlock" in the Invoices section doesn't unlock

WorkspaceInvoiceVBASection passes no excludeStates, so LOCKED business accounts appear. With the beta on they get "This account requires attention" + an Unlock action, which mapBankStatusToRowStatus routes via requiresUnlockHandler to onUnlockPress = that page's onThreeDotsMenuPress = paymentMethodPressed.

That function has zero LOCKED handling — it only calls setPaymentMethod, opening the delete/default popover. Compare WalletPage/index.tsx:340, which does have the pressLockedBankAccount(...) + navigateToConciergeChat(...) branch.

To be precise about severity: handleRowPress already routed locked rows to onThreeDotsMenuPress on main, so the destination isn't new — but main only showed a passive "Locked" badge. This PR is what attaches the word "Unlock" to that action. So it's a labeling regression on pre-existing routing: the button now promises something it doesn't do.


🟡 3. The "Review" badge disappears for setup-state bank accounts

if (connectionStatus) {
    badgeText = shouldShowDefaultBadge ? translate('paymentMethodList.defaultPaymentMethod') : undefined;
} else if (isInLockedState) {  } else if (isNeedingAction) { badgeText = translate('common.review'); }

isAccountNeedingAction = isAccountInSetupState(account) || !!account.isMissingPersonalInfo.

The isMissingPersonalInfo half is safe — bankConnectionStatus is explicitly undefined when isMissingPersonalInfo, so those rows keep main's behavior. But the isAccountInSetupState half (SETUP/VERIFYING/PENDING) does get a connectionStatus, so its green "Review" badge is silently replaced by the new Incomplete/Pending/Verifying badge, and isBadgeSuccess is dropped on that branch — so the badge flips green → red.

Plausibly the intent, but it's a deliberate copy/color change that isn't called out anywhere. Worth confirming with design.


Also worth a look (not a regression)

The translation-key string dispatch is back in PaymentMethodList:

if (cardConnectionStatusDisplay.messageKey === 'walletPage.cardStatus.fixConnectionIn' && policyIDForCard) {  }
else if (cardConnectionStatusDisplay.messageKey === 'walletPage.cardStatus.fixConnection') {  }
else if (cardConnectionStatusDisplay.messageKey === 'walletPage.cardStatus.askAdminToFixConnection') {  }

This is the same pattern that was flagged for actionKey === 'walletPage.bankAccountStatus.unlock' and fixed via requiresUnlockHandler — and the util already returns shouldUseCompanyCardsLink / shouldUsePersonalCardFix, which encode exactly this. Using the flags is type-safe (avoiding the parameterized-key translate() problem that I assume motivated the string compare) and closes a latent hole: if messageKey === 'fixConnectionIn' but policyIDForCard were falsy, no branch matches → cardConnectionMessage stays undefined while shouldShowCardConnectionMessage is true, so the error is suppressed and no message renders. Unreachable today, but the redundant && policyIDForCard guard is what creates the gap.

if (cardConnectionStatusDisplay.shouldUseCompanyCardsLink && policyIDForCard) {
    cardConnectionMessage = translate('walletPage.cardStatus.fixConnectionIn', `${environmentURL}/${ROUTES.WORKSPACE_COMPANY_CARDS.getRoute(policyIDForCard)}`);
} else if (cardConnectionStatusDisplay.shouldUsePersonalCardFix) {
    cardConnectionMessage = translate('walletPage.cardStatus.fixConnection');
} else if (cardConnectionStatusDisplay.messageKey) {
    cardConnectionMessage = translate('walletPage.cardStatus.askAdminToFixConnection');
}

@flaviadefaria

Copy link
Copy Markdown
Contributor

Can we try to have this ready by next week? It's been a while since we opened this issue, and we have other issues blocked on this one.

@mkhutornyi

Copy link
Copy Markdown
Contributor

We're almost close.
@marufsharifi can you please address last comments?

@marufsharifi

Copy link
Copy Markdown
Contributor Author

@mkhutornyi, could you check again when you get a chance? Thanks!

  1. The "Review" badge disappears for setup-state bank accounts

This is intentional based on the issue requirements: Setup should become Incomplete, Pending stays Pending, and Verifying stays Verifying with its tooltip. So the generic Review badge is replaced by the specific connection status from the OP: #91300 (comment)

isMissingPersonalInfo still keeps the old behavior because connectionStatus is not set for that case.

@mkhutornyi

Copy link
Copy Markdown
Contributor

@codex review

@mkhutornyi

Copy link
Copy Markdown
Contributor

@MelvinBot review

@MelvinBot

Copy link
Copy Markdown
Contributor

Review

Solid PR — cleanly gated behind the walletConnectionStatus beta, non-beta code paths are preserved (the shouldShowConnectionStatus guards short-circuit to the original behavior), and there's good unit-test coverage for the new util functions. I verified the wallet Unlock button correctly reaches the existing locked-account Concierge flow (onActionPress/onUnlockPress both fall through to paymentMethodPressed, which handles LOCKED), so no issue there.

One thing worth addressing plus a couple of minor nits:

1. Card status message logic is duplicated (DRY)

getCardConnectionStatusDisplay already computes messageKey from the shouldUseCompanyCardsLink / isPersonalCard / else branches, but PaymentMethodList ignores that messageKey (uses it only as a truthiness check) and re-runs the exact same three-way branch to build cardConnectionMessage. So the decision lives in two places and can drift.

Compare the bank flow, which does this cleanly: the util returns keys and mapBankStatusToRowStatus just translates them. The card flow could do the same — translate(cardConnectionStatusDisplay.messageKey) directly, special-casing only the fixConnectionIn link variant that needs the route param interpolated.

2. Minor

  • getBankAccountState / hasBankAccountAllowDebit are one-line property-access wrappers (accountData?.state, !!accountData?.allowDebit) that add exported API + tests for little value. They also drop the original 'state' in account.accountData type guard — worth double-checking that's safe for every accountData shape passed in (vs. AccountData specifically).
  • LOCKED uses labelKey common.locked while every other bank status lives under the new bankAccountStatus object — functionally fine, just slightly inconsistent grouping.
  • card.lastScrape.replace(' ', 'T') replaces only the first space — fine for the standard YYYY-MM-DD HH:mm:ss format, but it assumes that shape.

Nothing blocking. The DRY consolidation in #1 is the main one I'd like to see before merge.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: 36f7944ff9

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@melvin-bot

melvin-bot Bot commented Jul 18, 2026

Copy link
Copy Markdown

We did not find an internal engineer to review this PR, trying to assign a random engineer to # as well as to this PR... Please reach out for help on Slack if no one gets assigned!

@melvin-bot

melvin-bot Bot commented Jul 18, 2026

Copy link
Copy Markdown

We did not find an internal engineer to review this PR, trying to assign a random engineer to # as well as to this PR... Please reach out for help on Slack if no one gets assigned!

@melvin-bot

melvin-bot Bot commented Jul 18, 2026

Copy link
Copy Markdown

We did not find an internal engineer to review this PR, trying to assign a random engineer to # as well as to this PR... Please reach out for help on Slack if no one gets assigned!

@mkhutornyi

Copy link
Copy Markdown
Contributor

Something went wrong with pullbear auto assignment.

@Gonals all yours

@MelvinBot

Copy link
Copy Markdown
Contributor

Regression scan

No regressions found for users without the walletConnectionStatus beta. The new feature is consistently gated (shouldShowConnectionStatus / canAccessWalletConnectionStatusFeatures / isBetaEnabled), and the refactors to shared code paths that run for everyone are behavior-preserving. That said, because this PR restructures shared components (PaymentMethodList, PaymentMethodListItem, WorkspaceWorkflowsPage) and two shared utils, the non-beta paths are the real regression surface and are worth a QA pass. Details below.

What I checked (shared paths that run for all users)

Verified equivalent (safe):

  • Domain-card policy lookupgetPolicyIDFromDomainName now centralizes match(REGEX)?.[1]?.toUpperCase(). Both refactored callers — getDescriptionForPolicyDomainCard and createPoliciesForDomainCardsSelector — produce the same output as before (uppercasing preserved). I confirmed no other code used the inline regex, so the only non-refactor caller of the new helper is the beta-gated wallet path.
  • excludeStates filter in PaymentMethodList — the added !bankAccountState || guard is logically equivalent to the old !excludeStates.includes(state) for both defined and undefined states.
  • PaymentMethodListItem props — for items without connectionStatus (i.e. every non-beta row), badgeText, badgeIcon, isBadgeSuccess, isBadgeError, and brickRoadIndicator resolve to the same values as before the refactor; the row still renders menuItem directly (no Hoverable wrapper). shouldShowErrorMessages={!!item.errors && (item.shouldShowErrorMessages ?? true)} reduces to the old !!item.errors when shouldShowErrorMessages is unset.
  • WorkspaceWorkflowsPage — the extracted handleBankAccountPress and the non-beta branch of bankAccountMenuItemProps reproduce the original inline onPress logic and MenuItem props exactly; the beta branch is only taken when canAccessWalletConnectionStatusFeatures is true.

Recommended QA focus (non-beta accounts)

Since the shared components were restructured, please verify these still behave as before for accounts without the beta:

  1. Wallet → Cards: a company card with a broken/error connection still shows its error/RBR message; personal cards still render titles/descriptions and grouping unchanged.
  2. Wallet → Bank accounts: locked / setup / review badges and the three-dots menu still appear as before.
  3. Workspace → Workflows → payment account: the Setup/Locked badges, dot indicator, brick road, and the locked-account press → Concierge flow all still work.
  4. Domain (workspace-feed) cards across the app still show the correct workspace name in their description.

If those four are unchanged with the beta off, this PR is regression-clean on existing behavior.

@marufsharifi

Copy link
Copy Markdown
Contributor Author

@Gonals, could you please take a look at this pr when you get a chance. thanks.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants