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

Highlight all errors in VBA flow - Personal information and Additional information steps #5259

Merged
merged 30 commits into from
Oct 4, 2021

Conversation

aldo-expensify
Copy link
Contributor

@aldo-expensify aldo-expensify commented Sep 15, 2021

Details

Changes:

  • isValidIdentity became validateIdentity, which returns an object with the errors.
  • Show all highlighted errors together in Personal information Step (/bank-account/personal-information)
  • Show all highlighted errors together in Additional information Step (/bank-account/contract)
  • Updated errors in reimbursementAccountPropTypes to accommodate beneficial owners errors in "Additional information Step (/bank-account/contract)"

Fixed Issues

$ #4785

We are working in this issue step by step. This PR updates the error handling specifically for the company information step in the VBA flow.

Tests AND QA Steps

Setup

  1. Create account and verify it
  2. Login in NewDot, create workspace and start the flow to add VBA
  3. Do the first step "Add bank account" using any option (Log into your bank / Connect manually). Use data from step (2) or (3) of this SO.
  4. Fill Company Step form with the available information from the SO, missing fields can be filled with anything that passes validations, then, click "Save & Continue"
  5. You should be in the "Personal Information" step (/bank-account/personal-information)

Personal Information Step

  1. Click "Save & continue" before filling anything, all fields are mandatory and all of them should have inline errors:Screen Shot 2021-09-30 at 1 35 02 PM

  2. Start filling the different fields. Each field's inline errors should disappear as soon as they are changed. Use Alberta as first name and Charleson as last name.

  3. Choose as "Date of birth" a recent date, example:2021-10-10

  4. Click "Save & continue". The "Date of birth" should have the error "Requestors must be over 18 years old"Screen Shot 2021-09-30 at 1 38 04 PM

  5. Choose as "Date of birth" a date older than 18 years, example: 2000-10-10

  6. Click "Save & continue". If all fields pass the validation, we should get to the "Additional information" step (/bank-account/contract)

Additional information Step (beneficial owners)

  1. Click "Save & continue", you should see the following errors:

Screen Shot 2021-09-30 at 1 50 02 PM

  1. Clicking any of the mandatory checkbox should remove the inline error of the clicked checkbox.
  2. Check the checkbox next to "Somebody else owns more than 25%..."
  3. Click the link below the new form with the text "Add another individual who owns..."
  4. You should have two nested forms asking for information on the "Additional beneficial owner":Screen Shot 2021-09-30 at 1 52 00 PM
  5. Scroll down and click "Save & continue", all mandatory fields should have inline errors:Screen Shot 2021-09-30 at 1 52 59 PM
  6. Filling information on fields should clear the inline errors on them. Verify that filling a field in one "Additional beneficial owner" removes only the error for that nested form and not for any other "Additional beneficial owner" form.
  7. Fill all mandatory fields with valid information and click "Save & continue".
  8. We should be on the next step: Validate

Tested On

  • Web
  • Mobile Web
  • Desktop
  • iOS
  • Android

Screenshots

Web

Mobile Web

Desktop

iOS

Android

@aldo-expensify aldo-expensify self-assigned this Sep 15, 2021
@aldo-expensify
Copy link
Contributor Author

Pending:

  • Update ACHContract step
  • Date of birth field has two different validations which end up in two different errors. With the newer way of handling errors, how do we handle this case?

if (!isValidDate(identity.dob)) {
showBankAccountFormValidationError(translateLocal('bankAccount.error.dob'));
showBankAccountErrorModal();
return false;
}
if (!isValidAge(identity.dob)) {
showBankAccountFormValidationError(translateLocal('bankAccount.error.age'));
showBankAccountErrorModal();
return false;
}

Maybe the errors object should have the translated error message instead of true as value. For example:

errors.dob = translateLocal('bankAccount.error.age');

@aldo-expensify
Copy link
Contributor Author

@marcaaron , before continuing further, can I have your thoughts on this:

  • Store string values in reimbursementAccount.errors instead of booleans. Why? because that would add support for fields that can have more than one error message. If you look at the ValidationUtils.js here, dob has two possible different errors

@marcaaron
Copy link
Contributor

Store string values in reimbursementAccount.errors instead of booleans. Why? because that would add support for fields that can have more than one error message. If you look at the ValidationUtils.js here, dob has two possible different errors

That feels kind of like we are moving backwards and will have to change a lot to make it all consistent. It might be something we could consider for the design doc we are planning, but not something I'd probably not implement in this PR.

Rather than store the error text could we have the input handle multiple error keys somehow?

@aldo-expensify
Copy link
Contributor Author

Rather than store the error text could we have the input handle multiple error keys somehow?

Yes, I would say is possible without too much effort and uglyness, it is just one field that has this problem.

I'll change them to boolean again and handle dob errors with different keys.

Copy link
Contributor

@marcaaron marcaaron left a comment

Choose a reason for hiding this comment

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

I know this is still in draft but just ran through to leave some comments since I took a look.

src/libs/ValidationUtils.js Outdated Show resolved Hide resolved
src/libs/ValidationUtils.js Outdated Show resolved Hide resolved
src/libs/ValidationUtils.js Outdated Show resolved Hide resolved
src/pages/ReimbursementAccount/BeneficialOwnersStep.js Outdated Show resolved Hide resolved
src/pages/ReimbursementAccount/BeneficialOwnersStep.js Outdated Show resolved Hide resolved
@aldo-expensify
Copy link
Contributor Author

The error for missing State uses two lines, taking up too much space:

Screen Shot 2021-09-30 at 12 08 17 PM

I think we should use a shorter text

@marcaaron
Copy link
Contributor

Nice catch, since the feature is not being broadly promoted yet, I maybe would suggest creating a new issue for this and continuing to focus on solving the multiple errors issue.

@aldo-expensify
Copy link
Contributor Author

@flodnv 's PR removed the error message "Requestors must be over 18 years old"

I'm introducing it again because of this slack comment, but changing the "requestor" wording.

luacmartins
luacmartins previously approved these changes Oct 1, 2021
Copy link
Contributor

@luacmartins luacmartins left a comment

Choose a reason for hiding this comment

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

LGTM and tests well. Great work!

Copy link
Contributor

@marcaaron marcaaron left a comment

Choose a reason for hiding this comment

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

Changes look good. There is just one place that needs to be addressed. The rest of my notes are NAB.

src/libs/ReimbursementAccountUtils.js Outdated Show resolved Hide resolved
src/pages/ReimbursementAccount/BeneficialOwnersStep.js Outdated Show resolved Hide resolved
src/pages/ReimbursementAccount/BeneficialOwnersStep.js Outdated Show resolved Hide resolved
src/pages/ReimbursementAccount/RequestorStep.js Outdated Show resolved Hide resolved
return {beneficialOwners};
});
if (inputKey === 'dob') {
this.clearError(`beneficialOwnersErrors.${ownerIndex}.dobAge`);
Copy link
Contributor

Choose a reason for hiding this comment

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

NAB, I think this is OK for now. But we're going to have to figure out a better way to handle individual fields with multiple possible errors in the future.


if (inputKey === 'dob') {
this.clearError('dobAge');
}
Copy link
Contributor

Choose a reason for hiding this comment

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

NAB, I think this logic could benefit from some brief documentation explaining that dob is unique from other fields as there are two kinds of validation happening.

Probably eventually we could have something like dob_invalid and dob_minimumAge where the front part indicates the fieldName and the next part indicates which error. Or move to a structure like

errors: {
    identity: {
        dob: {
            invalid: true,
            minimumAge: true,
        }
    }
}

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 leaving the same comment on each part we do something with 'dob' related to multiple errors/validations

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 like this structure 😬

errors: {
    identity: {
        dob: {
            invalid: true,
            minimumAge: 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 this looks like a good way of handling the multiple errors

@marcaaron
Copy link
Contributor

Testing now and everything looks good except "First name" "Last name" and "Personal address" fields on the beneficial owners step look to be not required when a form is submitted without any info?

I'm not sure that's right. I think we need this information? But it would be good to have someone from ops verify.

2021-10-04_07-23-54

@marcaaron
Copy link
Contributor

I think we should just go ahead and add a isRequiredFulfilled for each of those checks since I can't think of why they would not be required. 🤔

@marcaaron
Copy link
Contributor

We can also do this in a follow up.

@marcaaron
Copy link
Contributor

Another weird thing is that even though I've entered no date of birth I see this:

2021-10-04_07-31-00

Which implies that a valid date has been entered in the first place.

@marcaaron marcaaron merged commit f9f0b3f into main Oct 4, 2021
@marcaaron marcaaron deleted the aldo_show-errors-vba-requestor branch October 4, 2021 17:32
@OSBotify
Copy link
Contributor

OSBotify commented Oct 4, 2021

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@aldo-expensify
Copy link
Contributor Author

Another weird thing is that even though I've entered no date of birth I see this:

2021-10-04_07-31-00

Which implies that a valid date has been entered in the first place.

I'll look into it

@aldo-expensify
Copy link
Contributor Author

Testing now and everything looks good except "First name" "Last name" and "Personal address" fields on the beneficial owners step look to be not required when a form is submitted without any info?

I'm not sure that's right. I think we need this information? But it would be good to have someone from ops verify.

Asked in #ops, Katie also thinks this should be required information.

https://expensify.slack.com/archives/C6PHQ660K/p1633368748485700?thread_ts=1633368702.484800&cid=C6PHQ660K

Copy link
Contributor

@luacmartins luacmartins left a comment

Choose a reason for hiding this comment

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

LGTM and tests well! Thanks @aldo-expensify!

@OSBotify
Copy link
Contributor

OSBotify commented Oct 4, 2021

🚀 Deployed to staging by @marcaaron in version: 1.1.4-1 🚀

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

@OSBotify
Copy link
Contributor

OSBotify commented Oct 6, 2021

🚀 Deployed to production by @chiragsalian in version: 1.1.5-1 🚀

platform result
🤖 android 🤖 success ✅
🖥 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
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants