-
Notifications
You must be signed in to change notification settings - Fork 3k
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 2024-04-09] [$500] On Validate your bank account page, no invalid amount error if the lasts digits are "0" #37974
Comments
Triggered auto assignment to @alexpensify ( |
@alexpensify FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors. |
ProposalPlease re-state the problem that we are trying to solve in this issue.User can input the test transaction amount with more than 8 digit if the leading and trailing amount is 0s. What is the root cause of that problem?The input is validated using the regex as shown below where the max digit is 8 (and 2 digit for decimal). App/src/pages/ReimbursementAccount/ConnectBankAccount/components/BankAccountValidationForm.tsx Lines 67 to 75 in a2c24e1
It's validating using App/src/pages/ReimbursementAccount/ConnectBankAccount/components/BankAccountValidationForm.tsx Lines 46 to 53 in a2c24e1
The problem here is that we test the regex with What changes do you think we should make in order to solve the problem?We should test the regex with the untouched user input, that is
|
ProposalPlease re-state the problem that we are trying to solve in this issue.On Validate your bank account page, no invalid amount error if the lasts digits are "0" What is the root cause of that problem?We have current regex which doesn't account for the trailing zeros if there is no decimal value What changes do you think we should make in order to solve the problem?We need to update the const amountRegex = RegExp(String.raw`^-?(0|[1-9]\d{0,7})([${getPermittedDecimalSeparator(decimalSeparator)}]\d*?[1-9](0{0,${CurrencyUtils.getCurrencyDecimals(outputCurrency)}})?)?$`, 'i'); Also updated const filterInput = (amount: string, amountRegex?: RegExp) => {
let value = amount ? amount.toString().trim() : '';
// Remove leading zeros except when the value is '0'
value = value.replace(/^0+(?!=\.|$)/, '');
if (value === '' || Number.isNaN(Number(value)) || !Math.abs(Str.fromUSDToNumber(value, false)) || (amountRegex && !amountRegex.test(value))) {
return '';
}
return value;
};
Result Video:simplescreenrecorder-2024-03-22_19.49.44.mp4 |
@m-natarajan can you pls explain from where did you got the
|
@alexpensify Whoops! This issue is 2 days overdue. Let's get this updated quick! |
No update yet, I need to test. |
I'll test this one tomorrow. |
No update |
Still on my testing list. |
bump @alexpensify |
Perfect timing since I was testing this one right now. Ok, so I confirmed that if you input a all zeros, there will be an error. The issue is isolated to when you input numbers then have trailing zeros. ErrorNo ErrorI believe we should fix this one. If you input a valid number and a trailing zero, the process will try to save the account. |
Job added to Upwork: https://www.upwork.com/jobs/~015f8c244843935a8f |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @hungvu193 ( |
@hungvu193 - can you please review the proposals to identify if one fixes this issue? Thanks! |
@alexpensify , you tested this on the bank account page, does this work same as the amount validation page? |
I think that's fine. However you can check the testcases on your proposal, it failed on these cases where we have trailing zeros or only dot without any number. |
@GandalfGwaihir RegEx is expensive. This RegEx you're trying to modify is already a complex one, we shouldn't add more to it, especially when there's much simpler solution that works for all cases and has no disadvantage |
Thanks for the feedback @hungvu193 @tienifr , will try to improve proposal next time 😄 |
❌ There was an error making the offer to @hungvu193 for the Reviewer role. The BZ member will need to manually hire the contributor. |
❌ There was an error making the offer to @tienifr for the Contributor role. The BZ member will need to manually hire the contributor. |
@hungvu193 PR #39039 is ready to review |
Cool, now we wait for automation here. |
|
The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.58-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 2024-04-09. 🎊 For reference, here are some details about the assignees on this issue:
|
BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:
|
@tienifr and @hungvu193 - to prepare for the payment process, please accept the invitation for the following Upwork job: https://www.upwork.com/jobs/~015f8c244843935a8f Thanks! I'll complete the process tomorrow. |
I've just accepted. Thank you. |
@alexpensify I've accepted as well, thanks! |
Thanks! Everyone has been paid in Upwork. Payouts due: 2024-04-09
Upwork job is here. |
If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Version Number: 1.4.49-0
Reproducible in staging?: y
Reproducible in production?: y
If this was caught during regression testing, add the test name, ID and link from TestRail: n/a
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: applause internal team
Slack conversation:
Action Performed:
Pre-requisite: user must be logged in and have created a workspace.
Expected Result:
The invalid amount error should be displayed if the number entered has more than 8 digits.
Actual Result:
The invalid amount error is not displayed if the last digits are "0".
Workaround:
unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Add any screenshot/video evidence
Bug6406504_1709873247666.Fjxr0832_1_.mp4
View all open jobs on GitHub
Upwork Automation - Do Not Edit
The text was updated successfully, but these errors were encountered: