Skip to content

[Wise] Save intake form pages with UpdateWiseOnboardingAdditionalData - #104695

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

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

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 the intake form PR, #104696 (the UI-only business onboarding pages, branch @mikolajpochec/wise-intake-form). Please review only the changes on top of it.

This PR wires the onboarding pages to the server, as agreed with Georgia: the form is built in one PR and its command is wired in the next, so the App does not wait on the backend. Each page is saved when the user leaves it with Next, and the onboarding continues on any device from what the server saved.

What it adds:

  • The UpdateWiseOnboardingAdditionalData WRITE command and updateWiseOnboardingAdditionalData in src/libs/actions/Wise.ts. DynamicFormFlow's onPageSubmit calls it with bankAccountID, step (the page key: representative or business) and inputs (that page's answers as JSON, keyed by field). The address is one object (street, city, state, zipCode, country). The read-only legal business name is not sent, since it comes from the bank account.
  • ID files go with the request as their own parameters, idDocument_0 to idDocument_4, like the Corpay onboarding pages send theirs, since a request carries only files and plain values. Web uploads them to the KYC bucket, as the doc says.
  • It is a normal queued write, so pages can be saved offline and sync later. Saving a page clears that page's earlier server errors. If the save fails, the form shows a general error.
  • Server field errors (400 Validation failed) are read from wiseBusinessOnboardingForm.errorFields, keyed by the form's input keys: the street as address, the other address parts as address.city, address.state, address.zipCode and address.country, and every other answer under its field key. The user has usually moved on when the answer comes back, so the flow goes back to the first page with a rejected answer the user can change, where the error shows under the field. An error on the read-only legal name, or under a key no page collects, does not move the user: the page they are on shows the form's "fix the errors" alert. That check lives in getPageWithServerError, so the terms page in the next PR uses the same one.
  • Resume: a visit that opens without a page (Get started, or a later resume) calls OpenReimbursementAccountPage with the bankAccountID, as the doc says, and waits for it. The business answers in reimbursementAccount.achData.wise.business then replace the ones in the form draft before the flow renders, since they can come from another device. The representative's details come from the user's private personal details, where the doc stores them, through the prefill from the intake PR. Offline, the flow opens from the local draft without waiting. If the connection drops before the read returns, the flow opens from the local draft too, and the read is not made again during that visit.
  • WiseBusinessOnboardingForm's type also allows the form's own errors and errorFields, so actions can write server errors to it.

Important

HOLD on Auth: UpdateWiseOnboardingAdditionalData does not exist yet, and OpenReimbursementAccountPage does not return achData.wise yet. Until they land, every page save ends in the general error and a resume starts from the local draft.

The SSN is not sent with the representative page. DynamicFormFlow keeps sensitive answers out of onPageSubmit on purpose: a queued write is stored on the device until it syncs, for as long as the device stays offline. The next PR (stacked on this one) sends the SSN with SubmitWiseBusinessOnboarding, as a request that is never queued, so the SSN is never written to the device's storage. See the open questions.


Points I'd like to discuss

Open questions
  1. When is the SSN sent? The doc saves it with the representative page. This PR keeps it out of the page save, because every page save is stored in the request queue on the device until it syncs. The next PR sends it with SubmitWiseBusinessOnboarding, as a request that is not queued and only runs online, so the SSN is never written to the device's storage. For that, Submit needs an ssn parameter in Auth, and Auth writes it to additionalData.wise.representative.ssn there. The cost is that the SSN is typed again after a reload or on another device (question 2). Options: (a) keep it on Submit, as in this stack; (b) send it with the representative page save, as the doc says, which stores it in the device's request queue until that save syncs.
  2. Where a resumed visit lands. The doc says a resume lands after the saved step. The flow resumes on the first page with a missing answer. The SSN is kept in memory only, and the ID files come back from the server only as S3 keys, so a new visit always starts on the representative page with the SSN and ID empty. The business page comes back filled. Honoring step would need two things: Auth keeps the SSN from the page save and returns ssnLast4, and the form treats a saved SSN and saved ID files as answered. Worth a follow-up?
  3. File parameters. Files are sent as idDocument_0 to idDocument_4 with step: representative, and Web maps them to documents.ID_DOCUMENT. Corpay sends one file per key, but this field takes up to five. Is this the naming Web will read?
  4. Field error format. The flow expects 400 Validation failed to merge errorFields into wiseBusinessOnboardingForm, keyed by the form's input keys, the way the doc describes it for SubmitWiseKYCRequirement: the street as address (not address.street, although the request sends it inside the address object), the other parts as address.city, address.state, address.zipCode and address.country, and every other answer under its field key. An error under any other key moves nobody and shows only the general "fix the errors" alert. Can Auth send them that way?
  5. The representative page updates Profile. The doc stores the representative's name, date of birth, phone and address in the user's private personal details. So saving this page also changes Profile > Private. Is that intended? The prefill only fills answers the draft does not have yet, so a device with an older draft keeps it.
  6. OpenReimbursementAccountPage replaces the shared reimbursementAccount. The workspace bank account flow uses the same key, and its page fetches again when it opens, so I don't expect a conflict. OK to rely on that?
  7. One draft for every bank account (intake PR decision 9). Server answers replace the draft's business answers only when the server has some. When an account has nothing saved yet, business answers typed for another account still show.
  8. A failed save blocks Next until the user changes an answer. That is how FormProvider handles a form's server error. The error shows on the page the user is on, and a new visit clears it. Should a failure without field errors stay quiet instead, and show up only at Submit?
  9. Going back to a rejected page. When a page save is rejected after the user has moved on, the flow moves them back to that page right away. The error shows under the field, but nothing says why they were moved. The doc only says "400 Validation failed - field errors for that page". Options: (a) keep the jump; (b) let the error wait until the user reaches that page, the confirmation page's row, or Submit; (c) keep the jump and add a message that says why.
Not in this PR
  • SubmitWiseBusinessOnboarding on the terms page, which also sends the SSN (stacked on this PR).
  • Showing saved ID files after a resume, and the "I don't have an SSN" link.
  • Enhanced due diligence pages, which save their answers through the same command.
  • The commands themselves in Auth and Web.

Fixed Issues

$ https://github.com/Expensify/Expensify/issues/696839
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> and press Get started
  2. Verify that an OpenReimbursementAccountPage request with the bankAccountID is sent, and that the page shows a loader until it returns
  3. Verify that the representative page opens, prefilled from Profile > Private
  4. Fill in the SSN, upload two image files as the ID, and press Next
  5. Verify that an UpdateWiseOnboardingAdditionalData request is sent with bankAccountID, step: representative, inputs holding the names, phone, date of birth and the address as one object (no SSN), and two files, idDocument_0 and idDocument_1
  6. Verify that the business page opens. While the command is missing in Auth, the request fails and "Oops... something went wrong and your request could not be completed. Please try again later." shows above Next
  7. Change any answer and verify that the error goes away. Choose a role, an industry and a description, then press Next
  8. Verify that an UpdateWiseOnboardingAdditionalData request is sent with step: business and inputs holding companyRole, industryCategories and description, without the legal business name
  9. Close the flow. Until OpenReimbursementAccountPage returns achData.wise, stand in for the server's saved answers in the read's response, since the page reads them only from the response of this visit's read. In Chrome DevTools > Network, right-click the OpenReimbursementAccountPage request from step 2 > Override content, and add this entry at the end of the response's onyxData array (create the array if the response has none): {"onyxMethod": "merge", "key": "reimbursementAccount", "value": {"achData": {"bankAccountID": <bankAccountID>, "wise": {"step": "business", "business": {"companyRole": "DIRECTOR", "industryCategories": ["SOFTWARE_DEVELOPMENT_PUBLISHING"], "description": "Saved on another device"}}}}}. Save the override
  10. Press Get started again, wait for the loader to finish and go to the business page
  11. Verify that the business page shows Director, Software development publishing and "Saved on another device", replacing what was typed in step 7. Remove the override
  12. On the business page, run Onyx.merge('wiseBusinessOnboardingForm', {errorFields: {'address.zipCode': {1: 'Invalid ZIP'}}}) in the console
  13. Verify that the flow goes back to the representative page and shows "Invalid ZIP" under the ZIP code
  14. Go to the business page with Next, then run Onyx.merge('wiseBusinessOnboardingForm', {errorFields: {companyName: {1: 'Name does not match'}}}) in the console
  15. Verify that the flow stays on the business page and shows the "fix the errors" alert above Next, since the legal name cannot be changed there
  • Verify that no errors appear in the JS console

Offline tests

  1. Open the representative page from Tests step 1 and go offline
  2. Fill in the page and press Next
  3. Verify that the business page opens right away and no request is sent
  4. Go back online
  5. Verify that the queued UpdateWiseOnboardingAdditionalData request is sent
  6. Go offline, close the flow and press Get started again
  7. Verify that no OpenReimbursementAccountPage request is made, and that the flow opens from the answers on this device without a loader
  8. Go back online and verify that no OpenReimbursementAccountPage request is made while the representative page stays open
  9. Close the flow, set the network tab's throttling to Slow 4G, press Get started and go offline while the loader shows
  10. Verify that the loader ends and the flow opens from the answers on this device

QA Steps

Once UpdateWiseOnboardingAdditionalData and the achData.wise part of OpenReimbursementAccountPage are in Auth (until then, these steps end in the general error from Tests step 6):

Precondition: an account with the wiseReimbursements beta and a USD business bank account in Wallet, signed in on two devices (device A and device B).

  1. On device A, open Settings > Wallet, open the bank account's global reimbursements page and press Get started
  2. Fill in the representative page, with the SSN and an ID file, and press Next
  3. Verify that the business page opens with no error
  4. Choose a role, an industry and a description, and press Next
  5. Verify that the confirmation page opens with no error, then close the flow
  6. On device B, open the same bank account's global reimbursements page and press Get started
  7. Verify that a loader shows, then the representative page opens, prefilled from Profile > Private, with the SSN and ID empty
  8. Fill in the SSN and ID, press Next, and verify that the business page shows the role, industry and description chosen on device A
  • 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 save [Wise] Save intake form pages with UpdateWiseOnboardingAdditionalData Oct 22, 2026
@codecov

codecov Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Codecov Report

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

Files with missing lines Coverage Δ
src/CONST/index.ts 95.90% <ø> (ø)
src/ROUTES.ts 34.16% <100.00%> (+1.34%) ⬆️
src/SCREENS.ts 100.00% <ø> (ø)
src/components/DynamicForm/index.tsx 92.59% <100.00%> (+0.22%) ⬆️
...components/DynamicForm/renderers/textRenderers.tsx 96.96% <100.00%> (+0.09%) ⬆️
...nents/DynamicForm/utils/formatDynamicFieldValue.ts 97.50% <100.00%> (+0.13%) ⬆️
src/libs/API/types.ts 100.00% <ø> (ø)
src/libs/CountryUtils.ts 94.11% <100.00%> (+2.45%) ⬆️
src/libs/Navigation/linkingConfig/config.ts 62.50% <ø> (ø)
src/libs/actions/Wise.ts 100.00% <100.00%> (ø)
... and 10 more
... and 369 files with indirect coverage changes

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