App icon indicating copy to clipboard operation
App copied to clipboard

[HOLD for payment 2021-09-17] Change error message copy when an age below 18 is entered in the Requestor Information DoB field

Open MitchExpensify opened this issue 5 years ago β€’ 16 comments

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Action Performed:

  1. Go to https://new.expensify.com/bank-account/requestor
  2. Enter a date of birth that makes the requestor under 18 years old e.g. 2015-01-01
  3. Fill out all other fields and enable the checkbox
  4. Click Save & Continue
  5. See an error message that reads "Please enter a valid date of birth"

Expected Result:

Send a specific error message that reads "Requestors must be over 18 years old"

Actual Result:

We send a vague error message that doesn't communicate the specific problem with the date of birth entry - "Please enter a valid date of birth"

Workaround:

Enter an older date of birth but how would a user know to do that?

Platform:

Where is this issue occurring?

  • [x] - Web
  • [x] - iOS
  • [x] - Android
  • [x] - Desktop App
  • [x] - Mobile Web

Version Number: v1.0.91-0

Vid:

https://user-images.githubusercontent.com/36425901/131914635-108e4303-36a3-4065-bfb2-90c53103a4fe.mov

View all open jobs on GitHub

MitchExpensify avatar Sep 02 '21 20:09 MitchExpensify

Triggered auto assignment to @alexpensify (AutoAssignerTriage), see https://stackoverflow.com/c/expensify/questions/4749 for more details.

MelvinBot avatar Sep 02 '21 20:09 MelvinBot

It looks like the error is thrown from the backend. We could add the same validation on the frontend too.

Proposed Solution In RequestorStep, we call isValidIdentity. This function exists in ValidationUtils.

Add a new function isValidAge

// Add in CONST
VALID_MIN_AGE: 18

function isValidAge(dob) {
    return moment().diff(moment(dob), 'years') > CONST.VALID_MIN_AGE; // or >=
}

and we need to add the following lines in the function after the isValidDate call.

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


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

Add relevant translations:

en: {
   bankAccount: {
       error: {
         age: 'Requestors must be over 18 years old',
       }
   }
}

// and add the same for Spanish

es: {
   bankAccount: {
       error: {
         age: 'Los solicitantes deben ser mayores de 18 aΓ±os',
       }
   }
}

One small addition can be made to the translation by keeping the age dynamic:

age: (age) =>  `Requestors must be over ${age} years old`,

// and pass in the translate call as:
showBankAccountFormValidationError(translateLocal('bankAccount.error.age', {age: CONST.VALID_MIN_AGE}))

akshayasalvi avatar Sep 02 '21 21:09 akshayasalvi

Triggered auto assignment to @adelekennedy (External), see https://stackoverflow.com/c/expensify/questions/8582 for more details.

MelvinBot avatar Sep 03 '21 16:09 MelvinBot

@alexpensify is out until Tuesday. Issue looks good and good external candidate!

MitchExpensify avatar Sep 03 '21 16:09 MitchExpensify

Created a job in Upwork!

Internal: https://www.upwork.com/ab/applicants/1433924712138452992/job-details External: https://www.upwork.com/jobs/~0193c7ce2cc67ec805

adelekennedy avatar Sep 03 '21 22:09 adelekennedy

Triggered auto assignment to @pecanoro (Exported), see https://stackoverflow.com/c/expensify/questions/7972 for more details.

MelvinBot avatar Sep 03 '21 22:09 MelvinBot

Adding a test will fix it

ZaydImr avatar Sep 05 '21 04:09 ZaydImr

Not overdue

adelekennedy avatar Sep 06 '21 16:09 adelekennedy

The proposal is good, I am not sure if I would add the constant though, it seems a bit overkill. However, besides that, it looks good.

pecanoro avatar Sep 06 '21 16:09 pecanoro

Can do without the const

akshayasalvi avatar Sep 07 '21 02:09 akshayasalvi

@akshayasalvi just hired you in Upwork!

adelekennedy avatar Sep 07 '21 17:09 adelekennedy

PR raised

akshayasalvi avatar Sep 08 '21 23:09 akshayasalvi

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

botify avatar Sep 09 '21 20:09 botify

πŸš€ Deployed to staging by @pecanoro in version: 1.0.95-2 πŸš€

platform result
πŸ€– android πŸ€– success βœ…
πŸ–₯ desktop πŸ–₯ success βœ…
🍎 iOS 🍎 success βœ…
πŸ•Έ web πŸ•Έ success βœ…

botify avatar Sep 09 '21 22:09 botify

πŸš€ Deployed to production by @roryabraham in version: 1.0.96-0 πŸš€

platform result
πŸ€– android πŸ€– success βœ…
πŸ–₯ desktop πŸ–₯ success βœ…
🍎 iOS 🍎 success βœ…
πŸ•Έ web πŸ•Έ success βœ…

botify avatar Sep 10 '21 19:09 botify

@akshayasalvi paid you through Upwork and ended the contract, the job is now closed!

adelekennedy avatar Sep 17 '21 21:09 adelekennedy