Skip to content

Add the Wallet entry points for the pending digital wallet approval - #101282

Merged
mountiny merged 9 commits into
Expensify:mainfrom
dukenv0307:fix/98617-part-2
Sep 23, 2026
Merged

mountiny merged 9 commits into
Expensify:mainfrom
dukenv0307:fix/98617-part-2

Conversation

@dukenv0307

Copy link
Copy Markdown
Contributor

Explanation of Change

Add the Wallet entry points for the pending digital wallet approval

Fixed Issues

$ #98617
PROPOSAL:

Tests

Precondition: have an account with a pending-approval Expensify card

  1. Go to Home page
  2. Verify you can see Expensify Card review task
  3. Click review button will open the Confirm your request page
  4. Go to wallet page
  5. Verify you can see the green dot in LHN and the green message below the card
  6. Click review button will open the Confirm your request page
  7. Open the card detail page
  8. Verify you can see the green message with review button
  9. Click review button will open the Confirm your request page
  10. Click Deny
  11. If it's successful, verify that the green dot and message disappear, if it's failed the error message is shown
  12. Click Confirm
  13. Verify the request validation code is shown
  14. Enter the code
  15. If it's successful, verify that the green dot and message disappear, if it's failed the error message is shown
  • Verify that no errors appear in the JS console

Offline tests

Same as above

QA Steps

Same as above

  • 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 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)
  • 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)
  • 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.
  • 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
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
Screen.Recording.2026-09-15.at.17.16.49.mov
Screen.Recording.2026-09-15.at.17.17.33.mov
Screen.Recording.2026-09-15.at.17.21.44.mov

@dukenv0307
dukenv0307 marked this pull request as ready for review September 16, 2026 04:37
@melvin-bot

melvin-bot Bot commented Sep 16, 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 bun ./scripts/generateTranslations.ts --help

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

@dukenv0307
dukenv0307 requested review from a team as code owners September 16, 2026 04:37
@melvin-bot
melvin-bot Bot requested review from aimane-chnaif and joekaufmanexpensify and removed request for a team September 16, 2026 04:37
@melvin-bot

melvin-bot Bot commented Sep 16, 2026

Copy link
Copy Markdown

@aimane-chnaif 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 September 16, 2026 04:37
@codecov

codecov Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.

Files with missing lines Coverage Δ
src/hooks/useAccountIndicatorChecks.ts 100.00% <100.00%> (ø)
...rc/hooks/useRefreshPendingDigitalWalletApproval.ts 100.00% <100.00%> (ø)
src/libs/CardUtils.ts 86.97% <100.00%> (+0.09%) ⬆️
.../Navigation/linkingConfig/RELATIONS/HOME_TO_RHP.ts 100.00% <ø> (ø)
...igation/linkingConfig/RELATIONS/SETTINGS_TO_RHP.ts 100.00% <ø> (ø)
...imeSensitiveSection/hooks/useTimeSensitiveCards.ts 100.00% <100.00%> (ø)
...ome/TimeSensitiveSection/useTimeSensitiveItems.tsx 74.60% <ø> (-1.16%) ⬇️
.../pages/settings/Wallet/ExpensifyCardPage/index.tsx 70.81% <100.00%> (+0.31%) ⬆️
src/pages/settings/Wallet/WalletPage/index.tsx 0.00% <ø> (ø)
...c/pages/settings/useInitialSettingsPageMenuData.ts 72.65% <100.00%> (+0.21%) ⬆️
... and 8 more
... and 10 files with indirect coverage changes

@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: 77ffd9b1c1

ℹ️ 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/libs/actions/Card.ts Resolved
@joekaufmanexpensify

Copy link
Copy Markdown
Contributor

I will test 👍

@github-actions

Copy link
Copy Markdown
Contributor

🚧 joekaufmanexpensify has triggered a test Expensify/App build. You can view the workflow run here.

@github-actions

This comment has been minimized.

@MelvinBot

Copy link
Copy Markdown
Contributor

🤖 Code review. The feature logic reads well and the helper extraction into CardUtils is a genuine cleanup. Three things I'd change before this merges, plus nits. CI is green apart from Check independent approval. I reviewed code only — I did not run the flow, since it needs an account with a pending-approval Expensify Card.


1. This adds a new backTo, which the navigation guide prohibits

getUrlWithBackToParam is marked @deprecated: "Usage of getUrlWithBackToParam is prohibited. This is legacy code and no new occurrences should be added" (src/ROUTES.ts:46-54). The no-restricted-syntax disable added to silence the second half says the same thing verbatim — "Do not add new backTo params to screens" (src/libs/Navigation/types.ts:169). Both justifications ("Legacy route generation, consistent with other wallet routes") describe why the rule exists rather than an exemption from it.

The documented replacement is exactly this shape — one screen, several entry points, back = wherever you came from. There is a precedent in the file you already touched: the sibling "Add details" CTA navigates with createDynamicRoute(DYNAMIC_ROUTES.MISSING_PERSONAL_DETAILS.getRoute(String(item.cardID))) (src/pages/settings/Wallet/PaymentMethodListItem.tsx:337), and MISSING_PERSONAL_DETAILS already declares the identical entry-screen set you need — HOME, WALLET.ROOT, WALLET.DOMAIN_CARD (src/ROUTES.ts:312-330) — with :cardID carried in the suffix.

Switching deletes most of this PR's navigation plumbing: the backTo param and both eslint-disables, goBackToEntryPoint, the route-string comparison in navigateToAddCardToDigitalWallet, and the HOME_TO_RHP → SETTINGS_TO_RHP shuffle. The cost is the URL changing shape, which needs the "Backward compatibility for changed paths" handling from NAVIGATION.md. Since the feature isn't live yet that looks cheap, but it's your call — if you keep backTo, please get a navigation-team sign-off linked in the PR description, because both code comments explicitly say not to add one.

2. "Is this card pending approval" is filtered four different ways

The new isActiveExpensifyCard guard is only applied on two of the four surfaces:

Surface State filter
LHN / Wallet menu green dot — hasCardPendingDigitalWalletApproval isActiveExpensifyCard
Home task — useTimeSensitiveCards isActiveExpensifyCard
Wallet page row — PaymentMethodList.tsx:464,520 list pre-filter only (ACTIVE_STATES and not expired)
Card details row — ExpensifyCardPage/index.tsx:150 none

Concretely: a card that gets closed or terminated while an approval is pending keeps the pendingDigitalWalletApproval NVP, so the card details page shows a Review CTA with no green dot and no Home task backing it. Conversely an expired-but-active-state card gets the dot and the Home task but no Wallet page row. Adding isActiveExpensifyCard(card) && to the ExpensifyCardPage find (and ideally a shared getCardPendingDigitalWalletApproval(cards) that all four call) makes the four agree.

3. Header back and dismiss diverge when there is no backTo

goBackToEntryPoint falls back to SETTINGS_WALLET_DOMAIN_CARD.getRoute(cardID), but your own test asserts that with no backTo the background page is the Wallet root, and DOMAIN_CARD is itself an RHP screen over that root. So on a refresh or a cold link, the header back button pushes the card details RHP, while Escape / overlay click / swipe-back / Android back dismiss to the Wallet page. Worth deciding which one is right — a dynamic route (item 1) makes both paths agree for free.

Nits
  • Naming collision. isActiveExpensifyCard (CardUtils.ts:1733) means ACTIVE_STATES.includes(state), but isActiveCard in the same file (CardUtils.ts:1275) means "not closed/deactivated, suspended only if frozen" — a strictly wider set. Same for hasActiveExpensifyCardSelector sitting next to hasIssuedExpensifyCardSelector, which uses the other definition. Something like isExpensifyCardInActiveState would stop the next reader picking the wrong one.
  • Dead field. digitalWalletProvider is assigned unconditionally at PaymentMethodList.tsx:521 even when digitalWalletApprovalCardID is undefined. Harmless, but the grouped branch just above sets the pair together — worth matching.
  • Untested. navigateToAddCardToDigitalWallet is the most fragile new logic (it decides the entry point by string-comparing the active route), and it has no test. The navigation tests cover the URL, not this.
  • No throttle on the focus read. useRefreshPendingDigitalWalletApproval now fires GetExpensifyCardPendingWalletApproval from three screens, so a Wallet → card details → Wallet round trip is three reads. RAM_ONLY_IS_CHECKING_PENDING_WALLET_APPROVAL already tracks in-flight state and could gate it.
  • Duplicate copy key. addCardToDigitalWallet.review duplicates common.review, which already returns 'Review' when called with no amount. Not a regression (you moved the old …confirmDigitalWalletAddition.cta), just one fewer string to translate.

Everything else looks right to me: all 11 locales updated consistently, typographic quotes preserved byte-for-byte on the moved strings, no stale references to the removed homePage.timeSensitiveSection.confirmDigitalWalletAddition.* keys, and the new CardUtils unit tests cover the interesting branches including the closed-card case.


view run

@MelvinBot

Copy link
Copy Markdown
Contributor

🤖 Code quality pass. Separate from my earlier review — I'm not repeating the backTo, active-state, or back-button points here. Two things worth changing, then small stuff.


1. The new row duplicates one that already exists 20 lines above it, and renders in a different colour

PaymentMethodListItem now has two green-dot-plus-success-button CTA rows sitting next to each other: the hand-rolled "Add details" row at PaymentMethodListItem.tsx:324-342 and the new PendingDigitalWalletApprovalRow at :343-349 — same wrapper (pv3 + ph5/ph8), same green dot, same SMALL + SUCCESS button, same layout. Both can render on the same card row.

Your version is the better one — it reuses DotIndicatorMessage instead of assembling Icon + Text by hand. So rather than adding a second implementation, the new component should absorb the old one: pass the message and the CTA label/handler in and delete lines 324-342.

One thing blocks that today, and it's worth fixing either way: textStyles={styles.textSuccess} overrides the message to green. DotIndicatorMessage type="success" otherwise renders at theme.textSupporting (DotIndicatorMessage.tsx:109 → getDotIndicatorTextStyles), which is exactly the mutedNormalTextLabel the "Add details" row uses. None of the other four type="success" call sites in the app override it. Drop textStyles and the two rows match each other and the rest of the app; keep it and they're green-and-grey side by side.

2. translate('addCardToDigitalWallet.' + getWalletProviderNameKey(...)) is written out three times

Every caller has to know the addCardToDigitalWallet. prefix and glue it on. The first two then build the same sentence from it. Having getWalletProviderNameKey return the full translation key removes the concatenation from all three.

While you're there — the new shouldStartSentence boolean reads as getWalletProviderNameKey(provider, true) at the call site, which says nothing to the reader. A second function (getWalletProviderSentenceNameKey) or an options object would carry its own meaning.

Small stuff
  • No-op coalesce. selectors/Card.ts:123 does hasActiveExpensifyCard(cardList ?? undefined), but OnyxEntry<CardList> is already CardList | undefined, so the ?? never fires. hasIssuedExpensifyCardSelector right above just passes the value through.
  • Two props that always travel together. digitalWalletApprovalCardID + digitalWalletProvider (PaymentMethodListItem.tsx:87-92) are set as a pair in the grouped branch and read as a pair. One pendingDigitalWalletApproval?: {cardID, walletProvider} field would make the "both or neither" invariant hold by construction, and would have prevented the unconditional assignment at PaymentMethodList.tsx:521.
  • Half-alias. PaymentMethodListItem.tsx:157 aliases item.digitalWalletApprovalCardID, but the render site reads item.digitalWalletProvider directly. Pick one.
  • Import style. PendingDigitalWalletApprovalRow is imported relatively in PaymentMethodListItem and via @pages/... in ExpensifyCardPage. Both work; matching them makes the shared component easier to find.

Worth saying what's good, since most of this diff is cleanup rather than feature code: pulling the card predicates out of useTimeSensitiveCards into CardUtils and dropping the manual hasActiveExpensifyCard accumulator genuinely simplifies that loop; hasActiveExpensifyCardSelector reducing the card list to a boolean is the right shape for a collection selector; swapping the inline cardList?.[cardID] for cardByIdSelector reuses what was already there; and the new CardUtils tests cover the branches that matter rather than just the happy path.


view run

@aimane-chnaif

aimane-chnaif commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible 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 checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified that the composer does not automatically focus or open the keyboard on mobile unless explicitly intended. This includes checking that returning the app from the background does not unexpectedly open the keyboard.
  • I verified tests pass on all platforms & I tested again on:
    • Android: HybridApp
    • Android: mWeb Chrome
    • iOS: HybridApp
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified proper code patterns were followed (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 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)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • 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)
    • Any 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)
    • All JSX used for rendering exists in the render method
    • The 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
  • 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 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.
  • For any bug fix or new feature in this PR, I verified that sufficient unit tests are included to prevent regressions in this 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 have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Android: HybridApp
Android: mWeb Chrome
iOS: HybridApp
ios.mov
iOS: mWeb Safari
MacOS: Chrome / Safari
web.mov

updated:

web.mov

@MelvinBot

MelvinBot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

🤖 Regression hunt on 119a8c7. Two behaviour changes hit flows that already shipped, one adds API traffic to two existing pages. Everything else I checked came back clean, including a runtime smoke test on web.


1. The already-shipped add-to-digital-wallet URL now has two different "back" destinations

This is the one I'd fix. Before this PR, the RHP had no onBackButtonPress, so every dismissal route agreed. Now:

  • Header back button → goBackToEntryPoint, which with no backTo in the URL resolves to SETTINGS_WALLET_DOMAIN_CARD.getRoute(cardID). DOMAIN_CARD is itself an RHP over the Wallet root (SETTINGS_TO_RHP.ts:31), so this pushes the card details RHP rather than dismissing.
  • Escape / overlay click / swipe-back / Android back → default dismiss, which lands on the Wallet root, exactly as your own test asserts (addCardToDigitalWalletUrlTests.ts:32-34).

Every URL that exists today is backTo-less, so this is the default path, not an edge case: open the flow from the card details page, refresh, press back — you get the card details page pushed on top instead of a pop.

2. Removing the screen from HOME_TO_RHP changes where an existing URL lands

HOME_TO_RHP.ts previously pinned Home under /settings/wallet/card/:cardID/add-to-digital-wallet. A backTo-less link that resolves to Home today now resolves to the Wallet page. That is clearly the better default going forward, but it is a change to a URL that already works, so it's worth a deliberate "yes, that's fine" rather than being a side effect of the relation move.

3. Two existing pages now fire an API read on every focus

useRefreshPendingDigitalWalletApproval is now called from WalletPage and ExpensifyCardPage as well as Home. GetExpensifyCardPendingWalletApproval has no in-flight guard (Card.ts:1574-1584), so for any cardholder a Wallet → card details → back-to-Wallet round trip is three reads, and closing the approval RHP re-focuses Wallet for a fourth. RAM_ONLY_IS_CHECKING_PENDING_WALLET_APPROVAL already tracks in-flight state and could gate it.

4. Still open from the last review

The card details page applies no card-state filter before showing the Review row (ExpensifyCardPage/index.tsx:150), while the green dot and the Home task both require isActiveExpensifyCard. A card closed while an approval is pending keeps the NVP, so that page shows a Review CTA with nothing else backing it.


Ruled out — checked and clean
  • HAS_PENDING_CARD_INFO widening (useAccountIndicatorChecks.ts:76) can now win the first-truthy race over HAS_SUBSCRIPTION_INFO and HAS_PARTIALLY_SETUP_BANK_ACCOUNT_INFO. Harmless: status only feeds the dot colour and DebugTabView, so no user-visible message or route depends on which info status wins.
  • PaymentMethodList new fields can't leak. Only the Wallet page passes shouldShowAssignedCards; ConnectExistingBusinessBankAccountPage and WorkspaceInvoiceVBASection don't, so the Review row can't appear in those lists.
  • getWalletProviderNameKey signature change is backward compatible — shouldStartSentence defaults to false, and the one pre-existing caller that omits it (AddCardToDigitalWalletPage.tsx:75) resolves to the same keys as before.
  • Removed homePage.timeSensitiveSection.confirmDigitalWalletAddition.* keys have no remaining consumers besides .subtitle, and all 11 locales were updated with byte-identical typographic quotes on the moved strings.
  • card.state ?? 0 in isActiveExpensifyCard is a no-op — ACTIVE_STATES is [2, 3, 4, 7], so 0 was never a member.
  • The entry-point heuristic reads the right value. getActiveRouteWithoutParams() returns a leading-slash path (Navigation.ts:750-752), matching the `/${getRoute(...)}` it's compared against, and SCREENS.HOME is a tab-root screen, so getActiveRoute() on Home returns /home rather than a focused report path.
  • deferNavigate ordering is correct — both route reads happen synchronously in the press handler, only the navigate is deferred (Card.ts:239-245).
  • The two tests that mock useTimeSensitiveCards never supplied hasActiveExpensifyCard, so dropping it from the return shape changes nothing for them.
🤖 Web smoke test: ✅ pass

On dev NewDot web on fix/98617-part-2, Home, Settings, and Settings > Wallet all render normally for an account with no Expensify Card, with no pending-wallet-approval UI anywhere. No non-200 network responses on any of the three surfaces.

Full Wallet settings page with no approval banner or Review button
Step Status
Home page loads normally and shows no "card addition needs your approval" itemHome rendered with normal task list and Discover sections; searches for "card addition" and "needs your approval" both returned no match.
Home page with no pending-approval card item
✅
Settings shows the Wallet menu row with no green dot / info indicatorAccount settings sidebar shows the Wallet row with a plain wallet icon and no dot or badge.
Account settings sidebar showing Wallet row with no green dot
✅
Settings > Wallet page loads normally with no approval message and no Review buttonRendered Bank accounts, Cards, and Expensify Wallet (Beta) sections. A Review button lookup and a search for "approval" both returned no match.
Full Wallet settings page with no approval banner or Review button
✅
No JavaScript console errors across Home, Settings, and Settings > WalletPartial check only — the web harness has no console-capture API. Used the network log as a proxy: every request across all three surfaces returned 200.
⚠️

The precondition for the feature itself — an account with a pending-approval Expensify Card — isn't something I can produce, so items 1 and 4 above are from reading the code, not from reproducing them.


view run · view recording

@aimane-chnaif

Copy link
Copy Markdown
Contributor

The digital wallet approval row and the connection-status message in the Wallet list differ in many ways.

Context: the Wallet page's assigned-cards list is the only list that shows cards, and it always passes shouldShowConnectionStatus (WalletPage/index.tsx:730). So every Expensify Card row there already has a connectionStatus: the Active/Inactive badge, with no message.

Structural

  1. The hover highlight doesn't cover the Review row.
  2. Only the connection message hides card errors. A connection message sets shouldShowCardErrorMessages to false unless the card has a pending action, so the card's own errors don't show twice. The approval row ignores this, so it and an error message can show together.
  3. Only the connection message hides the row's red dot. When a message shows, the row's red dot is dropped because the message explains it (brickRoadIndicator: connectionStatus.message ? undefined : ...). The approval row has no such rule. The row doesn't add a dot for a pending approval either, even though the Settings > Wallet menu item now shows a green one.

Visual

Connection message (ConnectionStatusMessage) Approval row (DotIndicatorMessage + Button)
4. Vertical spacing wrapper mb2: 8px bottom, 0 top pv3: 12px top and bottom
5. Gap between dot and text mr2 overrides the 12px margin → 8px offlineFeedbackErrorDot → 12px
6. Line height lineHeightNormal (red) or lineHeightScale.label (grey) none set (offlineFeedbackText only sets verticalAlign: middle)

Rendering differences

  • Text: the connection message always goes through RenderHTML, so links work via onLinkPress. DotIndicatorMessage renders plain Text unless the string contains HTML tags, and has no link handler. It also sets userSelectText on non-touch devices; ConnectionStatusMessage doesn't.
  • Screens: the approval row also appears on the card details page. Connection messages only appear in the Wallet list.

The hover highlight doesn't cover the Review row:

Screenshot 2026-09-17 at 9 40 59 AM Screenshot 2026-09-17 at 9 41 08 AM

Vertical spacing:

Gap between dot and text:

Screenshot 2026-09-17 at 9 43 40 AM Screenshot 2026-09-17 at 9 43 46 AM
Screen.Recording.2026-09-17.at.9.28.55.AM.mov

Since this is already pre-existing, we can consider this out of scope. Follow-up if needed.

@aimane-chnaif

Copy link
Copy Markdown
Contributor

2 indicators appear when request failed:

Screenshot 2026-09-17 at 9 50 54 AM

@aimane-chnaif

Copy link
Copy Markdown
Contributor

Central pane is inconsistent between

  • Add button in "We need your shipping address"
  • Review button in and "Digital wallet card addition needs your approval"
Screen.Recording.2026-09-17.at.10.05.46.AM.mov
Screen.Recording.2026-09-17.at.10.06.43.AM.mov

@aimane-chnaif aimane-chnaif left a comment

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.

There are inconsistency issues above. (not sure blocker or not)
Otherwise looks good.

@joekaufmanexpensify

Copy link
Copy Markdown
Contributor

I'm going to hold off from testing on adhoc until the above issues are resolved. Please ping me once this is ready @dukenv0307

@mountiny

Copy link
Copy Markdown
Contributor

@Expensify/design any feedback on this PR?

I feel like this error message is not exactly as we would want it to look like #101282 (comment)

@dannymcclain

Copy link
Copy Markdown
Contributor

I feel like this error message is not exactly as we would want it to look like #101282 (comment)

I agree, but I'm not sure which one we should show? Does it make sense to only show the error on the Confirm your request screen so we don't double up dots on the main screen?

Comment thread src/selectors/Card.ts
hasAssignedCardMatching(cardsList, (card) => card.bank === CONST.EXPENSIFY_CARD.BANK && isActiveCard(card));

/** Reduces the card list to a boolean so consumers don't re-render on unrelated card changes. */
const hasActiveExpensifyCardSelector = (cardList: OnyxEntry<CardList>): boolean => hasActiveExpensifyCard(cardList ?? undefined);

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.

Can you add unit test for this selector?

@joekaufmanexpensify

Copy link
Copy Markdown
Contributor

Nice, going to test today!

@joekaufmanexpensify

Copy link
Copy Markdown
Contributor

Tested and working pretty well. Only issue is when I approve I'm seeing an error on the wallet page. It doesn't block the apple pay approval, the card was successfully added. But is confusing from UX perspective. Here are logs. Codex thinks we are incorrectly sending a duplicate request, and the rejection of it after the first one's approved is resulting in the error.

image

@dukenv0307

Copy link
Copy Markdown
Contributor Author

@MelvinBot Investigate #101282 (comment)

@MelvinBot

Copy link
Copy Markdown
Contributor

Root cause

Two ApproveDigitalWalletCardAddition writes go out for one confirmation. The first consumes the pending approval and succeeds (card lands in Apple Wallet, Success page renders). The second comes back with the backend's "This card has no digital wallet addition waiting to be confirmed", and this PR is guaranteed to surface that as a red error on the Wallet page. joekaufmanexpensify's Codex read is correct.

The screenshot proves the source: the first red line is common.genericErrorMessage, written only by buildCardLoadingOnyxData's failureData, which in this flow is only reached via approveDigitalWalletCardAddition.

There are two separate bugs here, and both need fixing.

1. Nothing stops a second send

The only re-entry guard is card.isLoading — requestStatus feeds the isLoading prop, which is the sole thing disabling the Verify button at BaseValidateCodeForm.tsx:417. That flag is set by an async Onyx optimistic merge, so for at least one render after submit the button is still live, and confirmRequest/denyRequest have no one-shot guard of their own.

Worse, clearCardListErrors writes isLoading: false, and validateAndSubmitForm calls clearError() before submitting. So an error-clearing path actively re-opens the lock mid-flight. And the write is a bare API.write — no writeWithNoDuplicatesConflictAction, so a queued duplicate is sent rather than collapsed, and shouldRetry defaults to true.

2. A late failure is guaranteed to leak to the Wallet page

Even one stray error lands where you can't dismiss it in context:

  • The page clears CARD_LIST errors only on mount and unmount. An error arriving mid-session is never cleared.
  • The Success screen renders no OfflineWithFeedback, so the RHP has nowhere to show it.
  • PaymentMethodList.tsx:334 suppresses card errors only while isCardPendingDigitalWalletApproval(card) is true — and the successful approve cleared that NVP. Suppression switches off at exactly the moment the error lands.

Recommended fix

  1. One-shot guard: early-return from confirmRequest/denyRequest when submittedRequest is already set. This alone stops the reported symptom.
  2. Switch to API.writeWithNoDuplicatesConflictAction for APPROVE_DIGITAL_WALLET_CARD_ADDITION so a queued duplicate is collapsed instead of sent.
  3. Stop clearCardListErrors writing isLoading: false — it's an error-clearing helper silently unlocking an in-flight gate.
  4. Clear CARD_LIST errors when the flow resolves, not just on unmount, so a late failure can't leak behind the Success page.
Evidence, what I could not verify, and two related things I noticed

Not verified: I could not query VictoriaLogs in this run, so I have no production confirmation of the exact trigger for the duplicate. What is confirmed from code is that (a) the error can only come from a failed ApproveDigitalWalletCardAddition, and (b) there is no dedupe or one-shot guard preventing a second one. Which specific path fired it — a double submit in the async gap, the magic-code auto-submit followed by an Enter/Verify press, or a SequentialQueue retry after the client missed the first response — needs the logs. a3d2f0e2ff6264fe-SJC filtered to that account with command=ApproveDigitalWalletCardAddition will settle it: sub-second gap means a double UI submit; a backoff-shaped gap means a queue retry. Fix 1 and 2 cover all three.

Ruled out: I checked whether the new useRefreshPendingDigitalWalletApproval hook could be responsible. It can't — getExpensifyCardPendingWalletApproval is an API.read that parks behind waitForWrites, so it emits no write and can't land a stale pending approval from before the approve.

Also worth fixing while you're here:

  • isVerifying is never reset after success. If pendingDigitalWalletApproval ever comes back (backend hasn't cleared it yet when a refresh read lands), requestStatus flips resolved → failed and the Success page is replaced by the magic-code screen again.
  • The durable belt-and-braces fix is backend idempotency: a repeat approve for an already-resolved request should return success rather than a user-visible error. That's outside the App repo, so it needs an internal engineer — but the App-side fixes above are sufficient on their own.

I did not run the flow — reproducing it needs an account with a pending-approval Expensify Card, which the test account doesn't have. This is a static analysis.


Next Steps: Reply with @MelvinBot <your feedback> to refine this.


view run

@melvin-bot

melvin-bot Bot commented Sep 19, 2026

Copy link
Copy Markdown

I could not review this diff, so I did not approve the workflow runs. An Expensify employee will review it and approve them manually.

@dukenv0307

Copy link
Copy Markdown
Contributor Author

@joekaufmanexpensify I fixed, could you please test it 1 more time 🙏 ?

@github-actions

Copy link
Copy Markdown
Contributor

🚧 mountiny has triggered a test Expensify/App build. You can view the workflow run here.

@github-actions

This comment has been minimized.

@joekaufmanexpensify

Copy link
Copy Markdown
Contributor

Ran into an issue trying to setup testing, discussing here

@joekaufmanexpensify joekaufmanexpensify left a comment

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 tried again, and I was able to successfully retest. Working well, all good from my perspective. 👍

@dukenv0307

Copy link
Copy Markdown
Contributor Author

@mountiny All yours

@mountiny
mountiny merged commit 1f4912c into Expensify:main Sep 23, 2026
37 of 38 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

🚧 mountiny has triggered a test Expensify/App build. You can view the workflow run here.

@OSBotify

Copy link
Copy Markdown
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
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/mountiny in version: 9.4.93-0 🚀

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

@MelvinBot

Copy link
Copy Markdown
Contributor

Yes — help site changes are required, and the draft PR is up: Docs updates for E/A#101282 Wallet entry points for digital wallet approval.

docs/articles/ says nothing about wallet additions that need cardholder approval. A cardholder routed down the yellow path now sees a prompt in three places with no article explaining it.

What I changed

One file: docs/articles/new-expensify/expensify-card/Add-Expensify-Card-to-Apple-Pay-or-Google-Wallet.md (+57/-4).

  • Where to find an Expensify Card wallet addition that needs your approval — all three entry points (Home > Time sensitive, the Cards section of the Wallet page, the card details page) plus the green dot next to Wallet in the Account menu. The last three are what this PR added.
  • How to approve or deny an Expensify Card addition to Apple Wallet or Google Wallet — Review → Confirm your request → Confirm/Deny, the Let's verify it's you security code step on Confirm only, then Got it.
  • What happens after you approve or deny an Expensify Card wallet addition — Success!, Request denied, and the prompt clearing everywhere.
  • Corrected the existing web-app FAQ answer: you still can't provision a card from a browser, but you can approve or deny there.
  • Three new FAQ entries, plus updated keywords and internalScope.
How I mapped the code to the docs, and what I verified

The entry points this PR added. All three render the same component:

Copy. Every bolded string in the article is verbatim from en.ts:2885-2904. The confirmation button is common.buttonConfirm = Got it (en.ts:74). The security code step is confirm-only — AddCardToDigitalWalletPage.tsx:126-142 shows denyRequest submits with no validate code.

I also documented the Digital wallet fallback: getWalletProviderNameKey(provider, true) returns digitalWalletCapitalized when the request doesn't name the wallet, so the prompt can read "Digital wallet card addition needs your approval".

Live UI. Verified on dev NewDot web that the Account tab opens the settings menu, the item is labeled Wallet, and the card list sits under the Cards section heading. I could not reproduce the approval state itself — it needs a card whose tokenization was routed for extra authentication — so the approval-specific strings come from en.ts, not from a screenshot.

Prior art. [No QA] Docs updates for E/A#99044 Approving Expensify Card additions to digital wallets documented the Home entry point from Part 1. stephanieelliott closed it unmerged on 2026-09-18, so none of it landed. The new PR supersedes it and covers the whole flow, and picks up the bolding fix the automated HelpDot review flagged there.

Not changed. The Classic and NewDot Cardholder-Settings-and-Features.md articles and Report-Suspicious-Activity.md mention digital wallets only in passing; nothing in them went stale.

@dukenv0307, please review the linked help site PR and confirm it reflects the current behavior. Then mark the linked help site PR Ready for review

@joekaufmanexpensify

Copy link
Copy Markdown
Contributor

Just tested, working well on staging 👍

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/lakchote in version: 9.4.93-3 🚀

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

Bundle Size Analysis (Sentry):

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

Labels

InternalQA This pull request required internal QA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants