Skip to content

[Payment due @ZhenjaHorbach] [No QA][Wise] Recover when App and Auth disagree on whether a payment needs a Wise quote - #108156

Merged
danieldoglas merged 19 commits into
Expensify:mainfrom
heekinho:wise-quote-recovery
Dec 4, 2026

Conversation

@heekinho

@heekinho heekinho commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Explanation of Change

App decides on its own whether to show the Wise quote before paying, and it can't always get that right, because it doesn't know the country of the employee's deposit account. This keeps App's check, so domestic payments stay optimistic, and recovers when App and Auth disagree:

  • Auth needs a quote App didn't ask for. App keeps each payment it sends from a Wise account without a quote until the response arrives. When the backend answers with the wiseQuoteRequired signal (https://github.com/Expensify/Web-Expensify/pull/59075), GlobalReimbursementPayError drops the failed PAY action and the report error. WiseQuoteRequiredPayModal then gets the quote for the same bank account and opens Confirm payment, which pays again with the confirmed quote. A payment this tab didn't send, such as one from another tab, keeps the error as before.
  • Auth has no quote for a payment App asked one for. getWiseQuote records when the server has answered. When the answer has no quote, Confirm payment and the bulk carousel show the amounts without fees and pay without a quote, instead of staying open with Pay disabled.

Search bulk pay doesn't open one quote per report. A bulk payment that needs a quote keeps today's error on its row.

Fixed Issues

$ https://github.com/Expensify/Expensify/issues/708923
PROPOSAL: N/A

Tests

Precondition: an admin on the wiseReimbursements beta (Troubleshoot > Beta overrides on a dev build) of a workspace that pays from an approved USD Wise business account. Debug mode on.

Note

Turn on the wiseReimbursements override even if the account is on the all beta. The all beta doesn't enable wiseReimbursements, and without it App doesn't treat the payment as a Wise one, so the report only shows "Unexpected error. Please try again later."

Auth needs a quote App didn't ask for:

  1. Have an employee whose default deposit account is a GBP account registered with Wise submit a USD report, and approve it.
  2. Open the expense report, click its header and pick Debug (not Debug on the report preview, which edits the report action). In Details, set depositCurrency inside nextStep to "USD" and press Save, so App pays without a quote.
  3. Press Pay and pick the Wise bank account.
  4. Verify that Confirm payment opens with the quote, and that the report shows no error.
  5. Press Pay in Confirm payment.
  6. Verify that the report is paid.
CheckQuote.mov

Auth has no quote for a payment App asked one for:

  1. Have an employee whose default deposit account is a US account submit a USD report, and approve it.
  2. Open the expense report, click its header and pick Debug (not Debug on the report preview, which edits the report action). In Details, set depositCurrency inside nextStep to "GBP" and press Save, so App asks for a quote.
  3. Press Pay and pick the Wise bank account.
  4. Verify that Confirm payment shows the report amount with no fees, and that Pay is enabled.
  5. Press Pay in Confirm payment.
  6. Verify that the report is paid.
US.mov

Unit and UI tests: GlobalReimbursementPayErrorTest, WiseQuoteUtilsTest, usePayWithWiseQuote.test, PayMoneyRequestTest, WiseQuoteConfirmModalWrapperTest, WiseQuoteCarouselModalWrapperTest and WiseQuoteRequiredPayModalTest.

  • Verify that no errors appear in the JS console

Offline tests

N/A. Confirm payment keeps Pay disabled while offline, as before.

QA Steps

N/A. Still behind the beta flag.

  • 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 verified any copy / text that was added to the app 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 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 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 the PR adds or modifies the UI:
    • I asked an AI agent to review the changes for accessibility issues and addressed its findings.
    • I tested with a screen reader (VoiceOver on macOS) and verified all new/changed elements are reachable with a logical focus order.
    • I verified all new/changed elements have meaningful accessible names and roles.
    • I verified state changes are announced (e.g. checked/unchecked, expanded/collapsed, selected).
  • 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

@heekinho heekinho changed the title [HOLD App#107742][HOLD Web#59075][No QA][Wise] Recover when App and Auth disagree on whether a payment needs a Wise quote [No QA][Wise] Recover when App and Auth disagree on whether a payment needs a Wise quote Dec 1, 2026
# Conflicts:
#	src/types/onyx/index.ts
@codecov

codecov Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ Changes either increased or maintained existing code coverage, great job!

Files with missing lines Coverage Δ
src/ONYXKEYS.ts 100.00% <ø> (ø)
...nts/Modal/Global/WiseQuoteCarouselModalWrapper.tsx 95.12% <100.00%> (+95.12%) ⬆️
...ents/Modal/Global/WiseQuoteConfirmModalWrapper.tsx 93.10% <100.00%> (+93.10%) ⬆️
src/components/WiseQuoteRequiredPayModal.tsx 100.00% <100.00%> (ø)
src/libs/BankAccountUtils.ts 99.08% <ø> (ø)
src/libs/DebugUtils.ts 68.64% <ø> (ø)
src/libs/ExportOnyxState/masking.ts 93.92% <ø> (ø)
src/libs/Middleware/GlobalReimbursementPayError.ts 100.00% <100.00%> (ø)
src/libs/Navigation/AppNavigator/AuthScreens.tsx 81.81% <ø> (ø)
src/libs/WiseQuoteUtils.ts 100.00% <100.00%> (+5.55%) ⬆️
... and 6 more
... and 7518 files with indirect coverage changes

@heekinho
heekinho marked this pull request as ready for review December 1, 2026 10:40
@heekinho
heekinho requested review from a team as code owners December 1, 2026 10:40
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-12-01T11:01:46.062459Z 39df47f Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@expensify-chore-bot
expensify-chore-bot Bot requested review from garrettmknight and removed request for a team December 1, 2026 10:40
@expensify-chore-bot

Copy link
Copy Markdown

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

@expensify-chore-bot
expensify-chore-bot Bot removed the request for review from a team December 1, 2026 10:40
@heekinho
heekinho requested review from a team and danieldoglas December 1, 2026 10:41
@expensify-chore-bot
expensify-chore-bot Bot requested review from grgia and removed request for a team December 1, 2026 10:41
@expensify-chore-bot

Copy link
Copy Markdown

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

@expensify-chore-bot
expensify-chore-bot Bot requested review from JmillsExpensify and removed request for a team December 1, 2026 10:41
@heekinho
heekinho requested review from a team and removed request for JmillsExpensify December 1, 2026 10:41
@expensify-chore-bot
expensify-chore-bot Bot requested review from NicolasBonet and flaviadefaria and removed request for a team December 1, 2026 10:41
@heekinho

heekinho commented Dec 3, 2026

Copy link
Copy Markdown
Contributor Author

Iterated on Daniel's review. Checking the Perf issue now.

@heekinho

heekinho commented Dec 3, 2026

Copy link
Copy Markdown
Contributor Author

The perf issue was in the baseline step (main). I've updated it and it seems to be gone.

@ZhenjaHorbach

ZhenjaHorbach commented Dec 4, 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 any copy / text that was added to the app 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 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
    • 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
    • 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 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 the PR adds or modifies the UI:
    • I asked an AI agent to review the changes for accessibility issues and addressed its findings.
    • I tested with a screen reader (VoiceOver on macOS) and verified all new/changed elements are reachable with a logical focus order.
    • I verified all new/changed elements have meaningful accessible names and roles.
    • I verified state changes are announced (e.g. checked/unchecked, expanded/collapsed, selected).
  • 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
Screen.Recording.2026-12-04.at.10.50.39.mov
Android: mWeb Chrome
Screen.Recording.2026-12-04.at.10.49.55.mov
iOS: HybridApp
Screen.Recording.2026-12-04.at.10.50.39.mov
iOS: mWeb Safari
Screen.Recording.2026-12-04.at.10.49.55.mov
MacOS: Chrome / Safari
Screen.Recording.2026-12-04.at.10.44.06.mov

Comment thread src/libs/WiseQuoteUtils.ts Outdated

/** Whether the server answered the report's quote request with no quote, because the payment doesn't go through Wise */
function isPaidWithoutWiseQuote(report: Pick<Report, 'wiseQuote' | 'wiseQuoteRequest'> | undefined): boolean {
return !report?.wiseQuote && !!report?.wiseQuoteRequest?.hasResponse;

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.

If GetWiseQuote returns an error without a quote, this is true, so Pay is enabled, and the error is hidden
Should we exclude that case?

So I hope we need to update this something like this

return !report?.wiseQuote && !!report?.wiseQuoteRequest?.hasResponse && !report?.errorFields?.wiseQuote;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch, updated in eb13b60. One failed request can't reach that state: a refused quote comes back as an error, so only failureData runs and hasResponse stays false. But overlapping quote requests can leave hasResponse: true from one request next to an error from another, so isPaidWithoutWiseQuote now also requires no errorFields.wiseQuote, with a test for that case.

@ZhenjaHorbach

Copy link
Copy Markdown
Contributor

But overall changes look good!

@grgia

grgia commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

Retested on web Chrome at 268cfd3, on a local backend against the Wise sandbox. Nothing is simulated. App and Auth disagree because the employee changes their default deposit account while the admin has the report open.

✅ Two reports paid offline that Auth needs a quote for

Back online, Confirm payment opens for one report and then the other, each with its own quote. Both end up paid with no error. Pressing Cancel on each instead puts the report back to Approved with Pay available.

q4-offline-two.mp4

✅ Bulk pay with one report Auth has no quote for

SW b 2 shows no fees and Pay all is enabled. Both reports are paid.

Confirm payment for two reports, the first without fees

✅ No loop when the quote prompt's payment is rejected

The employee moved to a GBP account while Confirm payment was open without a quote. The payment fails once, the prompt does not open again, and the report keeps Pay with the usual error.

Report back to Approved with one error

✅ Single report Auth needs a quote for

Confirm payment opens with the quote and no report error. Pay completes the payment.

✅ Payment sent while a second tab is open

No Confirm payment in either tab. The report stays Approved with the usual error.

@ZhenjaHorbach

Copy link
Copy Markdown
Contributor

@heekinho
Can you fix the conflicts, please?
And this comment
#108156 (comment)
And we can merge!

@github-actions

github-actions Bot commented Dec 4, 2026

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.

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

Tests well, good from my perspective!

@heekinho

heekinho commented Dec 4, 2026

Copy link
Copy Markdown
Contributor Author

Done, @ZhenjaHorbach. Thanks!

@melvin-bot melvin-bot Bot changed the title [No QA][Wise] Recover when App and Auth disagree on whether a payment needs a Wise quote [Payment due @ZhenjaHorbach] [No QA][Wise] Recover when App and Auth disagree on whether a payment needs a Wise quote Dec 4, 2026
@melvin-bot

melvin-bot Bot commented Dec 4, 2026

Copy link
Copy Markdown

🎯 @ZhenjaHorbach, thanks for reviewing and testing this PR! 🎉

A payment issue will be created for your review once this PR is deployed to production.
E/E issue linked to the PR - https://www.github.com/Expensify/Expensify/issues/708923.

If payment is not needed (e.g., regression PR review fix etc), react with 👎 to this comment to prevent the payment issue from being created.

@danieldoglas
danieldoglas merged commit d36083b into Expensify:main Dec 4, 2026
51 of 53 checks passed
@github-actions

github-actions Bot commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

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

@OSBotify

OSBotify commented Dec 4, 2026

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.

@github-actions

github-actions Bot commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

@OSBotify

OSBotify commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/danieldoglas in version: 9.5.59-2 🚀

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

@MelvinBot

Copy link
Copy Markdown
Contributor

No help site update needed — this PR fixes Wise payment quote handling behind the existing beta flag without releasing the feature or making any existing article sentence incorrect.


view run

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