-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
[HOLD for payment 2025-02-05] [HOLD for payment 2025-02-04] [$250] Valid Australian postcodes are not accepted when adding a payment card #55493
Comments
Triggered auto assignment to @stephanieelliott ( |
🚨 Edited by proposal-police: This proposal was edited at 2025-01-21 02:05:46 UTC. ProposalPlease re-state the problem that we are trying to solve in this issue.An error message is shown "Please enter a valid ZIP code using the format: 12345, 12345-1234, 12345 1234." What is the root cause of that problem?We are using REGEX and error message for US when adding a payment card so it will consider Australian postcodes as invalid App/src/components/AddPaymentCard/PaymentCardForm.tsx Lines 168 to 170 in bec182c
App/src/libs/ValidationUtils.ts Lines 167 to 170 in bec182c
Line 1999 in bec182c
What changes do you think we should make in order to solve the problem?We can use Lines 3712 to 3714 in bec182c
Do the same with the remaining currencies GPB and NZD What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?None What alternative solutions did you explore? (Optional)NA Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job. |
|
ProposalPlease re-state the problem that we are trying to solve in this issue.Valid Australian postcodes are not accepted when adding a payment card What is the root cause of that problem?
What changes do you think we should make in order to solve the problem?
+ PAYMENT_CARD_CURRENCY_COUNTRY: {
+ USD: 'US',
+ AUD: 'AU',
+ GBP: 'GB',
+ NZD: 'NZ',
+ },
const countryByCurreny = data?.currency ? CONST.PAYMENT_CARD_CURRENCY_COUNTRY?.[data?.currency] : CONST.PAYMENT_CARD_CURRENCY_COUNTRY.USD;
const zipSampleFormat = (countryByCurreny && (CONST.COUNTRY_ZIP_REGEX_DATA?.[countryByCurreny] as CountryZipRegex)?.samples) ?? '';
const zipFormat = translate('common.zipCodeExampleFormat', {zipSampleFormat});
if (values.addressZipCode && !ValidationUtils.isValidZipCode(values.addressZipCode, countryByCurreny)) {
errors.addressZipCode = translate('privatePersonalDetails.error.incorrectZipFormat', {zipFormat});
}
hint={zipFormat}
function isValidZipCode(zipCode: string, country?: Country): boolean {
const countryRegexDetails = (country ? CONST.COUNTRY_ZIP_REGEX_DATA?.[country] : {}) as CountryZipRegex;
const countrySpecificZipRegex = countryRegexDetails?.regex;
if (countrySpecificZipRegex) {
return countrySpecificZipRegex.test(zipCode);
}
return CONST.REGEX.ZIP_CODE.test(zipCode);
}
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?NA What alternative solutions did you explore? (Optional)ResultMonosnap.screencast.2025-01-21.07-49-21.mp4 |
Job added to Upwork: https://www.upwork.com/jobs/~021881781580181945077 |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @Pujan92 ( |
ProposalPlease re-state the problem that we are trying to solve in this issue.Valid Australian postcodes are not accepted when adding a payment card What is the root cause of that problem?
What changes do you think we should make in order to solve the problem?
![]()
CURRENCY_COUNTRY_CODE: {
USD: 'US',
AUD: 'AU',
GBP: 'GB',
NZD: 'NZ',
}
const countryByCurreny = data?.currency ? CONST.CURRENCY_COUNTRY_CODE?.[data?.currency] : CONST.CURRENCY_COUNTRY_CODE.USD;
function isValidZipCode(zipCode: string, country?: Country): boolean {
const countryRegexDeta = (country ? CONST.COUNTRY_ZIP_REGEX_DATA?.[country] : {}) as CountryRegexDetails;
const regex = countryRegexDeta?.regex;
if (regex) {
return regex.test(zipCode);
}
return CONST.REGEX.ZIP_CODE.test(zipCode);
}
const countryByCurreny = data?.currency ? CONST.CURRENCY_COUNTRY_CODE?.[data?.currency] : CONST.CURRENCY_COUNTRY_CODE.USD;
const zipFormat = translate('common.zipCodeExampleFormat', {zipSampleFormat}); and pass it to What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?What alternative solutions did you explore? (Optional)Screen.Recording.2025-01-22.at.12.28.43.AM.mov |
ProposalPlease re-state the problem that we are trying to solve in this issueValid Australian postcodes are not accepted when adding a payment card. What is the root cause of that problem?The root cause of the current issue is this code block which only supports US based post codes. Context (cc @Pujan92)
after long discussions where @sakluger asked the team on Slack regarding post code validation in OD, the decision was:
Given this, I removed the validation completely in the PR, only keeping the 'must not be empty' validation on the field. Important We went with this solution because we determined (ref1, ref2) that any other solution like mapping each country to extract the specific zip code based on the selected currency does not make sense, is too computationally expensive and it's not worth it when we can go with a simple and inclusive regex.
@Krishna2323 Added back the logic which I removed in the other issue 😅 because the problem was that, since no validation was present on the field other than 'must not be empty', when inputting special characters What changes do you think we should make in order to solve the problem?Since the team confirmed in #52642 (comment) (quoted above) that we shouldn't have country specific post code validation, in order to align with OD, I think we should do the following:
Steps to implement:
if (values.addressZipCode && !ValidationUtils.isValidPaymentZipCode(values.addressZipCode)) { // <- updated validation function
errors.addressZipCode = translate('addPaymentCardPage.error.addressZipCode'); // <- updated validation error message
} this ensures we validate using the new regex. We also changed the validation error message to already existing and more generic one: ✅ What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?Create test scenarios for the new post code validation regex to test that:
Result video (before / after)MacOS: Chrome
|
@Pujan92, @stephanieelliott Eep! 4 days overdue now. Issues have feelings too... |
I just caught a convo of someone being blocked from adding a payment card as well.
Can we revert this and/or get the fix CP'd today? Adding a billing card is incredibly important to conversion. Let's also add a super explicit code note to not touch the validation logic for post codes. |
📣 @ikevin127 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app! Offer link |
@ikevin127 your proposal looks good. Are you able to work on a PR in the next couple of hours? We want to get the fix CPed today. |
Agree with @luacmartins Just to confirm, do we need to remove that validation or switch the validation with ALPHANUMERIC_WITH_SPACE_AND_HYPHEN as @ikevin127 mentioned? |
I think we should switch to |
@luacmartins PR #55812 is ready for review! 🚀
@trjExpensify Indeed I can appreciate the importance of being able to add payment cards for subscription purposes, hopefully we merge the fix today so a revert won't be necessary 🤞 ✅ I made sure to add a comment as instructed to explicitly state that tempering with the postcode validation logic without understanding the context can disrupt users adding payment cards, see comment. |
Thanks for the swift work on the PR, and adding the note! Thanks @ZhenjaHorbach for jumping on the review of the PR right away! |
|
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.89-8 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue: If no regressions arise, payment will be issued on 2025-02-04. 🎊 For reference, here are some details about the assignees on this issue:
|
@Pujan92 / @ikevin127 @trjExpensify @Pujan92 / @ikevin127 The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button] |
@trjExpensify Please unassign me and assign @ZhenjaHorbach as they reviewed the PR. Thanks! |
Sure, done! |
📣 @ZhenjaHorbach 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app! Offer link |
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.90-6 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue: If no regressions arise, payment will be issued on 2025-02-05. 🎊 For reference, here are some details about the assignees on this issue:
|
@ikevin127 / @ZhenjaHorbach @trjExpensify @ikevin127 / @ZhenjaHorbach The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button] |
BugZero Checklist:
Bug classificationSource of bug:
Where bug was reported:
Who reported the bug:
Regression Test ProposalPrecondition: Create at least 1 workspace to have the Subscription section show up in Settings.
Do we agree 👍 or 👎. |
Let's add/update the test for this one since it's a core flow and has been broken a couple of times. |
cc @trjExpensify for payments (due today on 4th) |
Yuuup! Regression test request created. Payment summary as follows:
Paid, closing! |
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.87-3
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: @VictoriaExpensify
Slack conversation (hyperlinked to channel name): retain
Action Performed:
Expected Result:
Should accept the valid postal codes
Actual Result:
An error message is shown "Please enter a valid ZIP code using the format: 12345, 12345-1234, 12345 1234."
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
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @trjExpensifyThe text was updated successfully, but these errors were encountered: