Skip to content

[CDA] Add workspace reimbursement country settings #96084

Description

@arosiclair

Part of the project

Main issue: https://github.com/Expensify/Expensify/issues/594776
Doc section: https://docs.google.com/document/d/1qmjliYT6Ce2lASacicvFqlvyFkihLd1wdYs5tGOmylE/edit?tab=t.0#heading=h.ri8s0oxwn42y

Feature Description

We’ll update the Payments section in the WorkspaceWorkflowsPage here
When the main payments toggle is enabled, we’ll show the Collect employee bank details toggle in subMenuItems

  • If policy.reimbursement.countries contains any country that is NOT the policy’s primary bank account (policy.achAccount), the Collect employee bank details toggle will already be enabled.
  • Enabling the Collect employee bank details toggle should show a MenuItemWithTopDescription for the policy’s bank account countries
    • Title should be a comma separated list reimbursement countries in the policy
      • Countries are the keys in policy.reimbursement.countries
      • We’ll use the mapping of country ISO codes to pretty names in CONST.ALL_COUNTRIES
      • Countries with a pendingAction will be shown in light gray text. A pending delete will also have strikethrough text.
    • Description = “Business bank account countries”
  • Pressing the menu item should open a new page in the RHP WorkspaceReimbursementCountrySelector
    • The page will have a SelectionList with CONST.ALL_COUNTRIES as options
    • Countries in policy.reimbursement.countries will be selected
    • If the policy has a bank account setup (policy.achAccount), it’s country will be disabled so it cannot be deselected
    • Selecting “Save” will call a new action Policy.setReimbursementCountries
      • Calls the SetReimbursementCountries API command with policyID and countryISOList (comma separated string)
      • Optimistic data:
        • Adds/removes the country in policy.reimbursement.countries with pendingAction
        • Clear policy.reimbursement.countries.errors
      • Success data: clears the pending action
      • Failure data:
        • revert changes to policy.reimbursement.countries
        • set an error on policy.reimbursement.countries.errors
  • When an error occurs and policy.reimbursement.countries.errors is set, we’ll show a RBR on the path Workspaces > {workspace} > Workflows > Payments > Business bank account countries
    • Workspaces button: add an additional check in usePolicyIndicatorChecks
    • Workspaces page: add an additional check in WorkspaceRowBrickRoadIndicator
    • Workspace settings page: set brickRoadIndicator on the workflows menu item
    • Business bank account countries: display a dismissible error using OfflineWithFeedback
      • Error message: "Your reimbursement countries update failed. Please try again."

Manual Test Steps

Payments toggle reveals collect bank details toggle

  1. As the admin, go to Workspaces > {workspace} > Workflows
  2. Enable the Payments toggle
  3. Verify
    • The bank account setup button is shown
    • A new Collect employee bank details toggle is shown
  4. As the admin, in Workflows > Payments, enable the Collect employee bank details toggle
  5. Verify a Business bank account countries item is shown

Edit reimbursement countries

  1. As the admin, connect a bank account
  2. Select the Business bank account countries push row
  3. Verify
    • The country selector page opens in the RHP with a selection list of all countries
    • The country for the policy’s bank account is selected and disabled so it cannot be deselected
  4. Select one or more countries and select Save
  5. Verify the setting shows a list of the selected countries
  6. Deselect a country and select Save
  7. Verify the country is removed from the list

Toggle and set countries offline

  1. As the admin, go to Workspaces > {workspace} > Workflows > Payments
  2. Enable Collect employee bank details and add a country
  3. Save
  4. Go offline
  5. Remove the selected country and add another one
  6. Verify
    • The removed country shows as light gray with strikethrough text
    • The added country shows as light gray
  7. Go online
  8. Verify
    • The removed country is removed
    • The added country is fully opaque

Failure shows RBR

  1. Enable Simulate failing network requests in test settings
  2. As the admin, go to Workspaces > {workspace} > Workflows > Payments
  3. Enable Collect employee bank details and add a Business bank account country
  4. Verify a RBR (red brick road) is shown on the path Workspaces > {workspace} > Workflows > Payments > Business bank account countries
  5. Disable Simulate failing network requests
  6. Add another business bank account country
  7. Verify the RBR is cleared

Automated Tests

We’ll add tests for the reimbursement countries list to verify it displays the correct list of countries.

Issue OwnerCurrent Issue Owner: @bernhardoj

Metadata

Metadata

Labels

Type

No type

Projects

Status
CRITICAL

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions