Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update "Additional details" form in KYC wallet upgrade flow #6752

Merged
merged 8 commits into from
Dec 14, 2021

Conversation

marcaaron
Copy link
Contributor

@marcaaron marcaaron commented Dec 14, 2021

Details

Improves the "Additional details" step of the KYC Wallet Upgrade flow so it behaves like the VBA.

Fixed Issues

$ https://github.com/Expensify/Expensify/issues/188531

Tests

  1. Login with an account that has a SILVER wallet
  2. Trigger the KYC flow by attempting to send money to another user via the FAB + button
  3. Upload doc and video in the Onfido screen
  4. Test the "Additional details" form on the next screen
  5. Make sure submitting the form without any details will highlight which fields are required
  6. Test that you cannot add an address with a PO Box
  7. Test that server errors are presented above the "Save & continue" button and validation errors have a "Fix the errors" link
  8. Close form and re-trigger. Verify that the user details are not cleared out and "remembered".

QA Steps

Internal QA - perform tests above with a new account on the "Send Money" beta

Tested On

  • Web
  • Mobile Web - Onfido does not work on simulator so I manually skipped that step
  • Desktop
  • iOS
  • Android

Screenshots

Web

2021-12-13_18-54-33
2021-12-13_18-54-24
2021-12-13_18-54-16

Mobile Web

2021-12-14_08-23-30
2021-12-14_08-08-54
2021-12-14_08-08-33

Desktop

2021-12-14_08-33-15
2021-12-14_08-32-25

iOS

2021-12-14_10-17-44

Android

2021-12-14_10-22-39
2021-12-14_10-22-31
2021-12-14_10-22-15

@marcaaron marcaaron self-assigned this Dec 14, 2021
@marcaaron marcaaron changed the title [WIP] Add fix the errors to additional details step Update "Additional details" form in KYC wallet upgrade flow Dec 14, 2021
@marcaaron marcaaron added the InternalQA This pull request required internal QA label Dec 14, 2021

const newErrors = lodashCloneDeep(errors);
lodashUnset(newErrors, fieldName);
Wallet.setAdditionalDetailsErrors(newErrors);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about maybe taking the time to abstract some of the logic out of ReimbursementAccountUtils to reuse here, but decided not to since this will all be replaced eventually by our new forms system whenever it is ready.

function clearError(props, path) {
const errors = getErrors(props);
if (!lodashGet(errors, path, false)) {
// No error found for this path
return;
}
// Clear the existing errors
const newErrors = lodashCloneDeep(errors);
lodashUnset(newErrors, path);
BankAccounts.setBankAccountFormValidationErrors(newErrors);
}

I will create a follow up to address this if it looks like the forms project will take a long time.

@marcaaron marcaaron marked this pull request as ready for review December 14, 2021 20:23
@marcaaron marcaaron requested a review from a team as a code owner December 14, 2021 20:23
@MelvinBot MelvinBot requested review from nickmurray47 and removed request for a team December 14, 2021 20:23
Copy link
Contributor

@nickmurray47 nickmurray47 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good to me! Had a couple basic comments to add


setAdditionalDetailsLoading(true);
setAdditionalDetailsErrors(null);
setAdditionalDetailsErrorMessage();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even though the default argument is set to '', I think it'd be clearer here to have setAdditionalDetailsErrorMessage('') to make it more obvious that we are clearing the error message. Otherwise, I'm thinking that some other message is getting set.

Thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure I can get behind that reasoning.

@@ -115,6 +115,9 @@ export default {
// Stores information about additional details form entry
WALLET_ADDITIONAL_DETAILS: 'walletAdditionalDetails',

// Stores values put into the additional details step of the wallet KYC flow
WALLET_ADDITIONAL_DETAILS_DRAFT: 'walletAdditionalDetailsDraft',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A little bit confused by this key name, why DRAFT over something like WALLET_ADDITIONAL_DETAILS_KYC

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it a DRAFT because the user might not finish but will need to come back to it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm following the pattern we initially set up here:

App/src/ONYXKEYS.js

Lines 133 to 134 in 1c80150

// Stores draft information about the active reimbursement account being set up
REIMBURSEMENT_ACCOUNT_DRAFT: 'reimbursementAccountDraft',

And yeah they are drafts since if the user bails on the flow and returns later they can pick up where they left off.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This hopefully will be a detail of all forms eventually but for now we have to store it somewhere.

// object with field names as keys and boolean for values
const errorFields = _.reduce(response.data.fieldNames, (errors, fieldName) => ({
...errors,
[fieldName]: true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 like the change to booleans for values, will keep this refactor in mind

Comment on lines +254 to 256
onFixTheErrorsLinkPressed={() => {
this.form.scrollTo({y: 0, animated: true});
}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

@marcaaron
Copy link
Contributor Author

Updated!

Copy link
Contributor

@nickmurray47 nickmurray47 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@nickmurray47 nickmurray47 merged commit c993662 into main Dec 14, 2021
@nickmurray47 nickmurray47 deleted the marcaaron-additionalDetailsFormFix branch December 14, 2021 23:32
@MelvinBot
Copy link

Triggered auto assignment to @marcaaron (InternalQA), see https://stackoverflow.com/c/expensify/questions/5042 for more details.

@botify
Copy link

botify commented Dec 14, 2021

@nickmurray47 looks like this was merged without passing tests. Please add a note explaining why this was done and remove the Emergency label if this is not an emergency.

@OSBotify
Copy link
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.

@nickmurray47
Copy link
Contributor

looks like this was merged without passing tests. Please add a note explaining why this was done and remove the Emergency label if this is not an emergency.

This doesn't look right to me, going to remove the Emergency label unless you think it's necessary @marcaaron

@marcaaron
Copy link
Contributor Author

Ya I think this is a bug and this did pass all the tests.

@OSBotify
Copy link
Contributor

🚀 Deployed to staging by @nickmurray47 in version: 1.1.20-3 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 failure ❌
🕸 web 🕸 success ✅

@Julesssss
Copy link
Contributor

Julesssss commented Dec 17, 2021

I tried to verify this to unblock the deploy checklist, but unfortunately I'm blocked by this bug in the Onfido flow for Android mWeb 😞

@marcaaron
Copy link
Contributor Author

Ah thanks @Julesssss! I think we can check this off if everything else is working - nobody should be triggering the KYC flow in product yet and we're going to need to E2E test the entire flow on all platforms eventually.

@Julesssss
Copy link
Contributor

Ah that's great, thanks for confirming 👍

@OSBotify
Copy link
Contributor

🚀 Deployed to production by @Julesssss in version: 1.1.21-1 🚀

platform result
🤖 android 🤖 failure ❌
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
InternalQA This pull request required internal QA
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants