Repository navigation
[Wise] Save intake form pages with UpdateWiseOnboardingAdditionalData - #104695
Closed
mikolajpochec wants to merge 2 commits into
Closed
mikolajpochec wants to merge 2 commits into
mikolajpochec wants to merge 2 commits into
Conversation
|
Hey, I noticed you changed If you want to automatically generate translations for other locales, an Expensify employee will have to:
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 --helpTypically, you'd want to translate only what you changed by running |
38 tasks done
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
UpdateWiseOnboardingAdditionalDataWRITE command andupdateWiseOnboardingAdditionalDatainsrc/libs/actions/Wise.ts.DynamicFormFlow'sonPageSubmitcalls it withbankAccountID,step(the page key:representativeorbusiness) andinputs(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.idDocument_0toidDocument_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.wiseBusinessOnboardingForm.errorFields, keyed by the form's input keys: the street asaddress, the other address parts asaddress.city,address.state,address.zipCodeandaddress.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 ingetPageWithServerError, so the terms page in the next PR uses the same one.OpenReimbursementAccountPagewith thebankAccountID, as the doc says, and waits for it. The business answers inreimbursementAccount.achData.wise.businessthen 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 ownerrorsanderrorFields, so actions can write server errors to it.Important
HOLD on Auth:
UpdateWiseOnboardingAdditionalDatadoes not exist yet, andOpenReimbursementAccountPagedoes not returnachData.wiseyet. 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.
DynamicFormFlowkeeps sensitive answers out ofonPageSubmiton 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 withSubmitWiseBusinessOnboarding, 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
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 anssnparameter in Auth, and Auth writes it toadditionalData.wise.representative.ssnthere. 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.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. Honoringstepwould need two things: Auth keeps the SSN from the page save and returnsssnLast4, and the form treats a saved SSN and saved ID files as answered. Worth a follow-up?idDocument_0toidDocument_4withstep: representative, and Web maps them todocuments.ID_DOCUMENT. Corpay sends one file per key, but this field takes up to five. Is this the naming Web will read?errorFieldsintowiseBusinessOnboardingForm, keyed by the form's input keys, the way the doc describes it forSubmitWiseKYCRequirement: the street asaddress(notaddress.street, although the request sends it inside theaddressobject), the other parts asaddress.city,address.state,address.zipCodeandaddress.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?OpenReimbursementAccountPagereplaces the sharedreimbursementAccount. 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?FormProviderhandles 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?Not in this PR
SubmitWiseBusinessOnboardingon the terms page, which also sends the SSN (stacked on this PR).Fixed Issues
$ https://github.com/Expensify/Expensify/issues/696839
PROPOSAL:
Tests
Precondition: an account with the
wiseReimbursementsbeta and a USD business bank account in Wallet. Note itsbankAccountID. Open the browser's network tab./settings/wallet/global-reimbursements/<bankAccountID>and press Get startedOpenReimbursementAccountPagerequest with thebankAccountIDis sent, and that the page shows a loader until it returnsUpdateWiseOnboardingAdditionalDatarequest is sent withbankAccountID,step: representative,inputsholding the names, phone, date of birth and the address as one object (no SSN), and two files,idDocument_0andidDocument_1UpdateWiseOnboardingAdditionalDatarequest is sent withstep: businessandinputsholdingcompanyRole,industryCategoriesanddescription, without the legal business nameOpenReimbursementAccountPagereturnsachData.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 theOpenReimbursementAccountPagerequest from step 2 > Override content, and add this entry at the end of the response'sonyxDataarray (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 overrideOnyx.merge('wiseBusinessOnboardingForm', {errorFields: {'address.zipCode': {1: 'Invalid ZIP'}}})in the consoleOnyx.merge('wiseBusinessOnboardingForm', {errorFields: {companyName: {1: 'Name does not match'}}})in the consoleOffline tests
UpdateWiseOnboardingAdditionalDatarequest is sentOpenReimbursementAccountPagerequest is made, and that the flow opens from the answers on this device without a loaderOpenReimbursementAccountPagerequest is made while the representative page stays openQA Steps
Once
UpdateWiseOnboardingAdditionalDataand theachData.wisepart ofOpenReimbursementAccountPageare in Auth (until then, these steps end in the general error from Tests step 6):Precondition: an account with the
wiseReimbursementsbeta and a USD business bank account in Wallet, signed in on two devices (device A and device B).PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari