Skip to content

[Wise] Submit business onboarding with SubmitWiseBusinessOnboarding - #104697

Closed
mikolajpochec wants to merge 3 commits into
Expensify:mainfrom
software-mansion-labs:@mikolajpochec/wise-intake-submit
Closed

mikolajpochec wants to merge 3 commits into
Expensify:mainfrom
software-mansion-labs:@mikolajpochec/wise-intake-submit

Conversation

@mikolajpochec

@mikolajpochec mikolajpochec commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

Explanation of Change

Part of Wise Release 1 (US business onboarding).

Important

Stacked on two PRs: the intake form PR, #104696 (the onboarding pages, branch @mikolajpochec/wise-intake-form), and the page saves PR, #104695 (UpdateWiseOnboardingAdditionalData, branch @mikolajpochec/wise-intake-save). Please review only the changes on top of them.

This PR submits the business onboarding to Wise from the terms page. The answers are already on the server, since each page is saved when the user leaves it, so Confirm only sends what those saves did not.

What it adds:

  • The SubmitWiseBusinessOnboarding command and submitWiseBusinessOnboarding in src/libs/actions/Wise.ts. Confirm on the terms page calls it with bankAccountID, termsAccepted, the representative's ssn, and policyID when the onboarding started from Workspace > Workflows (the dynamic routes pass the workspace's policyID down to the terms page). A Wallet entry sends no policyID.
  • It is sent with makeRequestWithSideEffects, not as a queued write, so the request and the SSN in it are never stored in the request queue on the device, and a request that loses its connection is never sent again later. It still goes after any page save left in the queue, since Auth reads the answers those saves store.
  • Confirm shows a spinner while the request runs and does not send twice. The loading flag and the error live in a RAM-only key, wiseBusinessOnboardingSubmit, not on the shared reimbursementAccount. So a failed Submit puts no red dot on the Account tab or the workspace rows, and an app closed during the request never leaves Confirm loading. The error shows the App's standard way, above Confirm in FormAlertWithSubmitButton.
  • If Wise rejects an answer the user can change on an onboarding page (400 Validation failed, as field errors on wiseBusinessOnboardingForm), the terms page goes back to the onboarding, which opens that page (from the page saves PR). There the error shows under the field. An error on the read-only legal name, or under a key no page collects, keeps the user on the terms page with the error above Confirm. Both pages decide this with the same getPageWithServerError. Each Submit first clears the field errors of the previous attempt, so an old one cannot send the next attempt back.
  • Submit is a live call, as the doc says: Confirm is disabled offline, as it already was. If the connection drops during the request, the spinner stops and the error shows above Confirm.
  • On success the form's draft, its errors and the SSN kept in memory are dropped, and the flow closes.
  • The SSN is held in memory until Confirm and leaves the device only in this request. If it is gone, for example after a reload on the terms page, Confirm goes back to the confirmation page instead of submitting, and that page sends the user to the representative page to type it again.
  • The App's request logs, which go to the server and to Sentry, now redact ssn. This also covers UpdatePersonalDetailsForWallet, which sends one too.

Note

After a successful Submit the doc opens the hosted form kickout. That page is built in its own PR, not merged yet, so for now Confirm closes the flow. The navigation to the kickout lands once that PR merges.

Important

HOLD on Auth: SubmitWiseBusinessOnboarding does not exist yet. Until it lands, Confirm ends in the generic error.


Points I'd like to discuss

Open questions
  1. The mandate. The doc's Submit takes termsAcceptance and mandateAcceptance, and Web builds them from two booleans. The terms page has three boxes (the certification, Expensify's terms, Wise's terms), and none of them is a direct-debit mandate (intake PR decision 7). This PR sends termsAccepted: true and no mandateAccepted. Do we need a fourth box with the mandate wording, or does one of the three cover it?
  2. The SSN goes with Submit, as a request that is not queued. That keeps the SSN off the device's storage entirely (see the page saves PR for the cost: it is typed again after a reload or on another device). Auth then needs an ssn parameter on SubmitWiseBusinessOnboarding, and saves it to additionalData.wise.representative.ssn before it creates the profile. makeRequestWithSideEffects is the API's discouraged path, so this is a pattern to agree on. Options: (a) keep the request that is not queued; (b) make Submit a normal queued write, which stores the SSN in the request queue on the device until it finishes and sends it again after a crash; (c) send the SSN with the representative page save, as the doc says, with the same storage as (b) for as long as the device is offline.
  3. Which Wise terms are accepted. The Wise links on the terms page go to Wise's general terms and privacy pages (CONST.WISE.TERMS_URL, PRIVACY_URL). Web saves the accepted wording with the acceptance, so the wording should be final before this ships (intake PR decision 12).
  4. Submit's error message. A failed Submit shows the generic error. Auth can show its own message, such as Wise's reason, by merging errors into wiseBusinessOnboardingSubmit in its response, since the server can update a RAM-only key like any other. Should it, or is the generic message enough?
  5. After a rejected answer. The user fixes it on its page, then goes through the confirmation and terms pages again and ticks the boxes again. Should the boxes stay ticked?
  6. Wise rejects a value from the bank account. Submit has Auth send the legal name, EIN, address and website from the bank account, and no onboarding page collects them. If Wise rejects one, the user stays on the terms page with the error and has nowhere in this flow to fix it. Options: (a) keep the error above Confirm for Release 1; (b) a specific message that points to the bank account's details or to Concierge; (c) a page in the flow that edits those values.
Not in this PR
  • The hosted form kickout after Submit, built in its own PR.
  • Wise's embedded page and the status pages.
  • The commands themselves in Auth and Web.

Fixed Issues

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

Tests

Precondition: an account with the wiseReimbursements beta and a USD business bank account in Wallet. Note its bankAccountID. Open the browser's network tab.

  1. Open /settings/wallet/global-reimbursements/<bankAccountID>, press Get started, fill in both pages (with the SSN and an ID file) and press Confirm on the confirmation page
  2. On the terms page, tick two of the three boxes and press Confirm
  3. Verify that "Please accept all of the terms to continue." shows and no request is sent
  4. Tick the third box and press Confirm
  5. Verify that a SubmitWiseBusinessOnboarding request is sent with bankAccountID, termsAccepted, the SSN typed in step 1 and no policyID, and that Confirm shows a spinner while it runs
  6. Verify that, while the command is missing in Auth, the spinner stops, "Oops... something went wrong and your request could not be completed. Please try again later." shows above Confirm, and the page stays open
  7. Verify that no red dot shows on the Account tab, and none on the workspace rows in Workspaces
  8. Press Confirm again and verify that a new request is sent
  9. In DevTools > Network, right-click the last SubmitWiseBusinessOnboarding request > Override content, replace the response with {"jsonCode": 400, "onyxData": [{"onyxMethod": "merge", "key": "wiseBusinessOnboardingForm", "value": {"errorFields": {"description": {"1": "Too vague"}}}}]}, save it, and press Confirm
  10. Verify that the flow goes back and opens the business page with "Too vague" under the description
  11. Press Next and Confirm to get back to the terms page, tick every box, change description in the override to registrationNumber, and press Confirm
  12. Verify that the terms page stays open and shows the generic error above Confirm. Remove the override
  13. Open the onboarding from Workspace > Workflows > Payments (the global reimbursements banner), go through it to the terms page and press Confirm
  14. Verify that the request also has the workspace's policyID
  15. On the terms page, reload the browser, tick the boxes and press Confirm
  16. Verify that no request is sent and the confirmation page opens. Press Confirm there and verify that the representative page opens to take the SSN again
  17. Once Auth has the command: press Confirm with every box ticked
  18. Verify that the flow closes when the request succeeds, and that the form's draft (wiseBusinessOnboardingFormDraft) is empty
  • Verify that no errors appear in the JS console

Offline tests

  1. Go through the onboarding to the terms page and tick every box
  2. Go offline
  3. Verify that Confirm is disabled and the offline indicator shows, since Submit is a live call
  4. Go back online
  5. Verify that Confirm is enabled and pressing it sends SubmitWiseBusinessOnboarding
  6. Set the network tab's throttling to Slow 4G, press Confirm, and while the spinner shows open DevTools > Application > IndexedDB > OnyxDB > keyvaluepairs
  7. Verify that networkRequestQueue and networkOngoingRequestQueue do not hold the SSN or a SubmitWiseBusinessOnboarding request
  8. Press Confirm again and go offline while the spinner shows
  9. Verify that the spinner stops and the generic error shows above Confirm
  10. Go back online and verify that no SubmitWiseBusinessOnboarding request is sent until Confirm is pressed again

QA Steps

Once SubmitWiseBusinessOnboarding is in Auth (until then, Confirm ends in the generic error from Tests step 6):

Precondition: an account with the wiseReimbursements beta, two USD business bank accounts, and a workspace whose Workflows > Payments shows the global reimbursements banner.

  1. Open Settings > Wallet, open the first bank account's global reimbursements page and press Get started
  2. Fill in both pages (with the SSN and an ID file) and press Confirm on the confirmation page
  3. On the terms page, tick two of the three boxes and press Confirm
  4. Verify that "Please accept all of the terms to continue." shows
  5. Go offline and verify that Confirm is disabled, then go back online
  6. Tick the third box and press Confirm
  7. Verify that Confirm shows a spinner, then the flow closes
  8. Open the workspace's Workflows > Payments and start the onboarding from the global reimbursements banner for the second bank account
  9. Go through it to the terms page, tick every box and press Confirm
  10. Verify that Confirm shows a spinner, then the flow closes
  • 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

@melvin-bot

melvin-bot Bot commented Oct 22, 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

@mikolajpochec mikolajpochec changed the title @mikolajpochec/wise intake submit [Wise] Submit business onboarding with SubmitWiseBusinessOnboarding Oct 22, 2026
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.

1 participant