Open m-natarajan opened 2 hours ago
Triggered auto assignment to @sakluger (Bug
), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.
Adding a UK zip code to a GBP payment card errors out incorrectly
We only check valid zip code and not check valid us post code
isValidUKPostalCode
UK_POST_CODE: /^(GIR 0AA|[A-Z]{1,2}\d{1,2} ?\d[A-Z]{2}|[A-Z]{1,2}\d[A-Z] ?\d[A-Z]{2})$/i,
function isValidUKPostalCode(postalCode: string): boolean {
return CONST.REGEX.UK_POST_CODE.test(postalCode);
}
validate
function to use isValidUKPostalCode
here if (data?.currency === CONST.PAYMENT_CARD_CURRENCY.GBP) {
if(values.addressZipCode && !ValidationUtils.isValidUKPostalCode(values.addressZipCode))
errors.addressZipCode = translate(label.error.addressZipCode);
} else {
if (values.addressZipCode && !ValidationUtils.isValidZipCode(values.addressZipCode)) {
errors.addressZipCode = translate(label.error.addressZipCode);
}
}
Notes: we should add isValidUKPostalCode
to other places where we validate zip code
Simply we only need to update isValidZipCode
to use UK_POST_CODE
regex
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Version Number: 9.0.63-1 Reproducible in staging?: Y Reproducible in production?: Y If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: If this was caught during regression testing, add the test name, ID and link from TestRail: Email or phone of affected tester (no customers): Logs: https://stackoverflow.com/c/expensify/questions/4856 Expensify/Expensify Issue URL: Issue reported by: @muttmuure Slack conversation (hyperlinked to channel name): ts_external_expensify_bugs
Action Performed:
Expected Result:
A UK post code is accepted
Actual Result:
The Zip Code field shows an error.
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Add any screenshot/video evidence
View all open jobs on GitHub