Skip to content

[Payment due @jayeshmangwani] Add country selection for EUR auto-update government rates - #101809

Merged
neil-marcellini merged 31 commits into
Expensify:mainfrom
ShridharGoel:government-rates-eur-country
Oct 8, 2026
Merged

neil-marcellini merged 31 commits into
Expensify:mainfrom
ShridharGoel:government-rates-eur-country

Conversation

@ShridharGoel

@ShridharGoel ShridharGoel commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Explanation of Change

EUR is shared by several countries with different mileage rates, so the workspace's currency alone cannot pick a country like it does for USD, CAD, GBP, and AUD. This PR adds a Country selection for EUR workspaces to the Auto-update government rates flow:

  • The toggle now shows for EUR workspaces. Turning it on opens a new Country selection page with the seven supported countries (Austria, Belgium, Finland, Germany, Netherlands, Portugal, Spain) instead of writing anything right away.
  • Picking a country turns the toggle on with that country, copies that country's current rates onto the workspace, and corrects the distance unit to kilometers when needed. Dismissing the page without choosing leaves the toggle off.
  • A Country row shows under the toggle while auto-update is on for an EUR workspace, and the country can be changed from there. Changing the country copies the new country's rates onto the workspace.
  • Switching the workspace currency to EUR while auto-update is on opens a Distance rates source country selection page with the seven supported countries. Picking a country applies the currency change and enables auto-update for that country. Going back without choosing leaves the currency unchanged.
  • Switching the workspace currency to another supported currency (USD, CAD, GBP, AUD) while auto-update is on shows a warning that the new country's government mileage rates will be used instead.
  • Switching the currency clears the stored country on the server, and the Country row disappears.
  • Turning the toggle off remembers the country, so turning it back on restores it without reopening the selection page.
  • Non-EUR workspaces are unchanged: they derive the country from the currency and never show the Country row.

Depends on the backend changes in https://github.com/Expensify/Auth/pull/24694 and https://github.com/Expensify/Web-Expensify/pull/56338, which need to merge and deploy first.

Fixed Issues

$ https://github.com/Expensify/Expensify/issues/683060
PROPOSAL:

Tests

  1. Open a Collect or Control workspace that uses EUR as the output currency and go to Distance rates > Settings.
  2. Verify the Auto-update government rates toggle is visible with the copy "Automatically create new rates when your country publishes new guidance."
  3. Turn the toggle on. Verify the Country selection page opens and lists Austria, Belgium, Finland, Germany, Netherlands, Portugal, and Spain.
  4. Go back without selecting a country. Verify the toggle stays off and no rates were added.
  5. Turn the toggle on again, select Germany, and tap Save. Verify you return to settings, the toggle is on, the Country row shows Germany, and the toggle copy now reads "when Germany publishes new guidance".
  6. Open the Distance rates list. Verify a 2004 Germany rate for €0.30/km was added, and that the distance unit is kilometers.
  7. Tap the Country row, change the country to Spain, and tap Save. Verify the Country row shows Spain and a 7/17/23 Spain rate for €0.26/km was added.
  8. Turn the toggle off and back on. Verify the country is remembered and the selection page does not open.
  9. On a workspace that uses USD, open Distance rates > Settings. Verify no Country row appears and the toggle copy still mentions the United States.
  10. On a workspace with auto-update on and currency set to something other than EUR, go to Overview > Currency and select EUR. Verify a Distance rates source country page opens with the country list. Select Austria and tap Save. Verify the currency changes to EUR and the Country row shows Austria.
  11. Repeat step 10 but go back without selecting a country. Verify the currency stays unchanged.
  12. On an EUR workspace with auto-update on, go to Overview > Currency and select GBP. Verify a warning modal says the government mileage rates published by Great Britain will be used instead. Confirm and verify the currency changes and the Country row disappears.
  • Verify that no errors appear in the JS console

Offline tests

  1. On an EUR workspace, go offline and open Distance rates > Settings.
  2. Turn the Auto-update government rates toggle on and select a country.
  3. Verify the toggle and the Country row show the pending state, and that they settle to the selected values once the network connection returns.

QA Steps

Same as tests.

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

@melvin-bot

melvin-bot Bot commented Sep 21, 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

@codecov

codecov Bot commented Sep 21, 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/CONST/index.ts 95.90% <ø> (+0.06%) ⬆️
src/SCREENS.ts 100.00% <ø> (ø)
...gation/linkingConfig/RELATIONS/WORKSPACE_TO_RHP.ts 100.00% <ø> (ø)
src/libs/Navigation/linkingConfig/config.ts 62.50% <ø> (ø)
src/ROUTES.ts 31.93% <71.42%> (+0.67%) ⬆️
...gation/AppNavigator/ModalStackNavigators/index.tsx 7.58% <0.00%> (-0.08%) ⬇️
src/libs/actions/Policy/DistanceRate.ts 54.18% <0.00%> (-3.46%) ⬇️
src/libs/actions/Policy/Policy.ts 71.24% <71.42%> (+0.58%) ⬆️
.../pages/workspace/WorkspaceOverviewCurrencyPage.tsx 82.85% <72.72%> (-0.93%) ⬇️
src/hooks/useApplyWorkspaceCurrencyChange.ts 70.83% <70.83%> (ø)
... and 6 more
... and 547 files with indirect coverage changes

@JmillsExpensify
JmillsExpensify self-requested a review September 22, 2026 19:55
@ShridharGoel ShridharGoel changed the title Add country selection for EUR auto-update government rates [HOLD] Add country selection for EUR auto-update government rates Sep 24, 2026
@ShridharGoel
ShridharGoel force-pushed the government-rates-eur-country branch 3 times, most recently from 9fd6767 to f54dcc5 Compare September 29, 2026 06:27
@ShridharGoel
ShridharGoel force-pushed the government-rates-eur-country branch from 12406a3 to 7fca4f0 Compare September 29, 2026 13:31
@ShridharGoel
ShridharGoel marked this pull request as ready for review September 29, 2026 13:31
@ShridharGoel
ShridharGoel requested review from a team as code owners September 29, 2026 13:31
@melvin-bot
melvin-bot Bot requested review from jayeshmangwani and neil-marcellini and removed request for a team September 29, 2026 13:31
@melvin-bot

melvin-bot Bot commented Sep 29, 2026

Copy link
Copy Markdown

@jayeshmangwani @neil-marcellini One of you needs to 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]

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

Looking quite good, but a few things to fix. Please add some automated tests since those are required. Unit tests for the added and changed actions are probably fine.

Here's one NAB an AI pointed out which we should fix in a follow up:

The optimistic rate copy never adds rates when a new country is picked.

The server only returns rates for the stored country, and only when the page opens.
So the rates loaded on the client are either empty (no country yet) or the old country's.
The filter correctly prevents copying the wrong country's rates. But offline, the toggle turns on and no rates appear until the device reconnects.

Comment thread src/hooks/useApplyWorkspaceCurrencyChange.ts Outdated
Comment thread src/pages/workspace/distanceRates/PolicyDistanceRatesSettingsPage.tsx Outdated
Comment thread src/components/GovernmentRateCountrySelector.tsx Outdated
Comment thread src/hooks/useApplyWorkspaceCurrencyChange.ts Outdated
@github-actions

Copy link
Copy Markdown
Contributor

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

@JmillsExpensify

Copy link
Copy Markdown
Contributor

Kicked off an adhoc, though I still need to wait for the Web PRs to hit staging, right?

@github-actions

This comment has been minimized.

@JmillsExpensify

Copy link
Copy Markdown
Contributor

I just tried the adhoc on a Collect policy, correctly got the upgrade modal, and then upgraded. After upgrading, I get this error.

CleanShot 2026-09-29 at 18 44 50@2x

@JmillsExpensify

Copy link
Copy Markdown
Contributor

After dismissing the above error, I did see the country selector, but then I got the same error upon saving an EU country.

@JmillsExpensify

Copy link
Copy Markdown
Contributor

Trying on another policy I get the same error.

@JmillsExpensify

Copy link
Copy Markdown
Contributor

Let me know if I should wait for more Web/Auth PRs

@ShridharGoel

Copy link
Copy Markdown
Contributor Author

@JmillsExpensify Auth is not deployed yet. After that, Web-E can be merged and deployed and then we'll be able to test this on adhoc builds.

Copy link
Copy Markdown
Contributor

Cool, figured. Thanks for confirming!

@neil-marcellini

Copy link
Copy Markdown
Contributor

I will review again once C+ approves.

@jayeshmangwani

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 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
    • 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 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.
  • 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
Android.mov
Android: mWeb Chrome
Mweb-chrome.mov
iOS: HybridApp
iOS.mov
iOS: mWeb Safari
mweb-safari.mov
MacOS: Chrome / Safari
web.mov

@jayeshmangwani

Copy link
Copy Markdown
Contributor

@ShridharGoel PR looks good. Just one confirmation on the behavior that might be a bug here:

When we toggle on Auto-update government rate and select a country, the selected country is remembered when we go back to Settings. However, after logging out and logging back in, no country is shown when we go to Settings.

Is this the expected behavior?

no-country-pre.mov

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

LGTM 🚀

@melvin-bot melvin-bot Bot changed the title Add country selection for EUR auto-update government rates [Payment due @jayeshmangwani] Add country selection for EUR auto-update government rates Oct 6, 2026
@melvin-bot

melvin-bot Bot commented Oct 6, 2026

Copy link
Copy Markdown

🎯 @jayeshmangwani, 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/683060.

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.

Copy link
Copy Markdown
Contributor

I don't think that is expected.

@ShridharGoel

Copy link
Copy Markdown
Contributor Author

Thanks for pointing this out, created a BE fix.

@neil-marcellini

Copy link
Copy Markdown
Contributor

Holding for a little bit for the backend fixes.

@neil-marcellini

Copy link
Copy Markdown
Contributor

That BE fix is deployed so I'll aim to review again today.

Copy link
Copy Markdown
Contributor

That'd be great. We're currently planning on announcing this update next week, as mileage is one of the highlight messages.

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

(Neil's AI agent)

A few non-blocking comments inline.

Comment thread src/libs/PolicyDistanceRatesUtils.ts
Comment thread src/pages/workspace/WorkspaceOverviewCurrencyGovernmentRateCountryPage.tsx Outdated
Comment thread src/pages/workspace/WorkspaceOverviewCurrencyGovernmentRateCountryPage.tsx Outdated
Comment thread src/pages/workspace/upgrade/WorkspaceUpgradePage.tsx Outdated
Comment thread src/libs/actions/Policy/Policy.ts
@neil-marcellini

neil-marcellini commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Good to go thanks. You can fix the non-blocking comments in the follow-up, but I see you're already working on it, so I'll review again and officially approve. I tweaked one thing in the tests and updated it to this.

On a workspace with auto-update on and currency set to something other than EUR, go to Overview > Currency and select EUR.

@ShridharGoel

Copy link
Copy Markdown
Contributor Author

@neil-marcellini It's ready again

Copy link
Copy Markdown
Contributor

Thanks for the urgency Shridhar!

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

Great work thanks!

@neil-marcellini
neil-marcellini merged commit 0c05c5e into Expensify:main Oct 8, 2026
36 of 37 checks passed
@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

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

@OSBotify

OSBotify commented Oct 8, 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.

@OSBotify OSBotify mentioned this pull request Oct 8, 2026
90 tasks done
@OSBotify

OSBotify commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/neil-marcellini in version: 9.5.6-0 🚀

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

@MelvinBot

Copy link
Copy Markdown
Contributor

A help site update is needed. I opened Docs updates for E/A#101809 Add EUR country selection to government rate auto-updates.

This PR adds EUR support and renames the toggle, so these sentences in Set Distance Rates became wrong:

  • "available for workspaces with a default currency of USD, CAD, GBP, AUD, NOK, SEK, or ZAR" now leaves out EUR.
  • "Enable Auto-update government rates." The toggle is now Auto-update government rate. EUR workspaces also select a country and click Save.
  • "Kilometers for Canada, Australia, Norway, Sweden, and South Africa" now leaves out the seven EUR countries.

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


view run

@OSBotify

OSBotify commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/puneetlath in version: 9.5.6-6 🚀

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

Bundle Size Analysis (Sentry):

@melvin-bot

melvin-bot Bot commented Oct 9, 2026

Copy link
Copy Markdown

🤖 Payment issue created: #103661

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.

6 participants