You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[HOLD for payment 2024-01-25] [$250] Scan - Message for Merchant requirement disappears after entering amount for failed scanning #33876
Version Number: 1.4.21-1 Reproducible in staging?: y Reproducible in production?: y 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: Applause - Internal Team Slack conversation:
Action Performed:
Go to 1:1 DM > + Request money > Scan.
Create a scan request with a receipt that will fail the scanning.
When the scanning fails, navigate to request details page.
Click Amount and enter an amount.
Expected Result:
Error message for merchant will not disappear because the merchant is not entered yet.
Actual Result:
The error message for empty merchant disappears after entering amount.
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
changed the title [-]Scan - Message for Merchant requirement disappears after entering amount for failed scanning[/-][+][$500] Scan - Message for Merchant requirement disappears after entering amount for failed scanning[/+]on Jan 3, 2024
Please re-state the problem that we are trying to solve in this issue.
The merchant error is shown even if the merchant is not required on failed scan.
What is the root cause of that problem?
We calculate the hasErrors value here using TransactionUtils.hasMissingSmartscanFields, which checks for missing amount, date, and merchant (if the merchant is required):
However, when showing the merchant error, we check only hasErrors (which comes from the missing amount) and the empty merchant, without checking if the merchant is required:
Since the "is merchant required" will be reusable now, we should move it out from TransactionUtils.areRequiredFieldsEmpty into a new function I mentioned above:
What alternative solutions did you explore? (Optional)
Probably a preferable approach for me: we should move away from using the general hasErrors, and use field-dedicated variables, like hasAmountError, hasMerchantError, hasDateError, built using the corresponding TransactionUtils.is*Missing functions.
Because currently, we basically persorm the same check for each field twice: first time - when calculating the hasErrors, and then – when checking each field error for RBR:
changed the title [-][$250] Scan - Message for Merchant requirement disappears after entering amount for failed scanning[/-][+][HOLD for payment 2024-01-25] [$250] Scan - Message for Merchant requirement disappears after entering amount for failed scanning[/+]on Jan 18, 2024
The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.26-2 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve 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:
[@mountiny] The PR that introduced the bug has been identified. Link to the PR:
[@mountiny] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
[@mountiny] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
[@namhihi237 / @shubham1206agra] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
[@NicMendonca] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:
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:
[@shubham1206agra] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion: Not Required
[@shubham1206agra] Determine if we should create a regression test for this bug. No as the steps should be present in general flow itself.
[@shubham1206agra] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
[@NicMendonca] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:
Activity
[-]Scan - Message for Merchant requirement disappears after entering amount for failed scanning[/-][+][$500] Scan - Message for Merchant requirement disappears after entering amount for failed scanning[/+]melvin-bot commentedon Jan 3, 2024
Job added to Upwork: https://www.upwork.com/jobs/~0164ff788c4c52bbb1
melvin-bot commentedon Jan 3, 2024
Triggered auto assignment to @NicMendonca (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.melvin-bot commentedon Jan 3, 2024
Bug0 Triage Checklist (Main S/O)
Platformsin OP are ✅)melvin-bot commentedon Jan 3, 2024
Triggered auto assignment to Contributor-plus team member for initial proposal review - @shubham1206agra (
External)namhihi237 commentedon Jan 3, 2024
Proposal
Please re-state the problem that we are trying to solve in this issue.
Error message for merchant will not disappear because the merchant is not entered yet.
What is the root cause of that problem?
In here when we add the amount the function will be return false, so the error on merchant disappear
App/src/libs/TransactionUtils.ts
Lines 428 to 430 in 273fa79
App/src/components/ReportActionItem/MoneyRequestView.js
Lines 170 to 173 in 3826e5d
In here the
isMerchantMissingis true but isFromExpenseReport is false with chat 1-1.App/src/libs/TransactionUtils.ts
Lines 156 to 161 in 273fa79
What changes do you think we should make in order to solve the problem?
Based on the expectation, we only required merchant for policy expense chat, so we should add the condition
isPolicyExpenseChathereApp/src/components/ReportActionItem/MoneyRequestView.js
Lines 248 to 250 in 6e5a5a2
What alternative solutions did you explore? (Optional)
paultsimura commentedon Jan 3, 2024
As per #33786 (comment), the merchant is not required on the 1:1 requests with receipts. So I'd say this is an expected behavior.
@mountiny could you please confirm/correct?
shubham1206agra commentedon Jan 3, 2024
@mountiny Should we show error on merchant if the merchant is no longer required?
paultsimura commentedon Jan 3, 2024
Proposal
Please re-state the problem that we are trying to solve in this issue.
The merchant error is shown even if the merchant is not required on failed scan.
What is the root cause of that problem?
We calculate the
hasErrorsvalue here usingTransactionUtils.hasMissingSmartscanFields, which checks for missing amount, date, and merchant (if the merchant is required):App/src/components/ReportActionItem/MoneyRequestView.js
Lines 169 to 173 in 3c58a05
However, when showing the merchant error, we check only
hasErrors(which comes from the missing amount) and the empty merchant, without checking if the merchant is required:App/src/components/ReportActionItem/MoneyRequestView.js
Lines 241 to 250 in 3c58a05
What changes do you think we should make in order to solve the problem?
We should introduce another variable, e.g.:
And use it as well to determine whether to show the merchant error:
Since the "is merchant required" will be reusable now, we should move it out from
TransactionUtils.areRequiredFieldsEmptyinto a new function I mentioned above:What alternative solutions did you explore? (Optional)
Probably a preferable approach for me: we should move away from using the general
hasErrors, and use field-dedicated variables, likehasAmountError,hasMerchantError,hasDateError, built using the correspondingTransactionUtils.is*Missingfunctions.Because currently, we basically persorm the same check for each field twice: first time - when calculating the
hasErrors, and then – when checking each field error for RBR:App/src/components/ReportActionItem/MoneyRequestView.js
Line 249 in 3c58a05
App/src/components/ReportActionItem/MoneyRequestView.js
Line 262 in 3c58a05
App/src/components/ReportActionItem/MoneyRequestView.js
Line 212 in 3c58a05
27 remaining items
[-][$250] Scan - Message for Merchant requirement disappears after entering amount for failed scanning[/-][+][HOLD for payment 2024-01-25] [$250] Scan - Message for Merchant requirement disappears after entering amount for failed scanning[/+]melvin-bot commentedon Jan 18, 2024
Reviewinglabel has been removed, please complete the "BugZero Checklist".melvin-bot commentedon Jan 18, 2024
The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.26-2 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-01-25. 🎊
For reference, here are some details about the assignees on this issue:
melvin-bot commentedon Jan 18, 2024
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:
NicMendonca commentedon Jan 29, 2024
@shubham1206agra can you accept the offer please?
NicMendonca commentedon Jan 29, 2024
@namhihi237 you've been paid!
shubham1206agra commentedon Jan 30, 2024
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:
NicMendonca commentedon Jan 30, 2024
@shubham1206agra you've been paid!