Skip to content

[HOLD for payment 2024-03-13] [$500] Split - "Enter a merchant name" error message appears while scanning is in process #34916

Closed

Description

@lanitochka17

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: 1.4.29-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: https://expensify.testrail.io/index.php?/tests/view/4211017
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 have created a workspace and invited a member as employee

  1. As the employee, go to the Workspace chat
  2. Tap on the "+" button and select "Split bill"
  3. On "Scan" option, upload any image and create the Split
  4. On the Workspace chat, tap on the split preview while it is still scanning
  5. Scroll down to "Merchant" field

Expected Result:

Error message for missing merchant should not appear while the scanning is in process

Actual Result:

Error message for missing merchant appears while scanning is in process

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

Bug6350890_1705948714600.Xfyp7681_1_.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01e28b0f9e8a41bb6e
  • Upwork Job ID: 1749515793504890880
  • Last Price Increase: 2024-02-14
  • Automatic offers:
    • situchan | Contributor | 28146340
    • bernhardoj | Contributor | 0

Activity

  1. added
    ExternalAdded to denote the issue can be worked on by a contributor
    BugSomething is broken. Auto assigns a BugZero manager.
    on Jan 22, 2024
  2. changed the title [-]Split - "Enter a merchant name" error message appears while scanning is in process[/-] [+][$500] Split - "Enter a merchant name" error message appears while scanning is in process[/+] on Jan 22, 2024
  3. melvin-bot commented on Jan 22, 2024

    @melvin-bot
  4. lanitochka17 commented on Jan 22, 2024

    @lanitochka17
    Author

    We think that this bug might be related to #vip-split-p2p-chat-groups

  5. dukenv0307 commented on Jan 23, 2024

    @dukenv0307
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    Error message for missing merchant appears while scanning is in process

    What is the root cause of that problem?

    We always display the error if merchant is missed without checking the scan is scanning or not

    error={shouldDisplayMerchantError || (shouldDisplayFieldError && TransactionUtils.isMerchantMissing(transaction)) ? translate('common.error.enterMerchant') : ''}

    What changes do you think we should make in order to solve the problem?

    We should pass isScaning from SplitbillDetailPage into MoneyRequestConfirmationList and use it to not display any error if the request is scaning

    error={shouldDisplayMerchantError || (shouldDisplayFieldError && TransactionUtils.isMerchantMissing(transaction)) ? translate('common.error.enterMerchant') : ''}

    Or we can wait for MoneyRequestConfirmationList to be removed and then handle it in MoneyTemporaryForRefactorRequestConfirmationList

    What alternative solutions did you explore? (Optional)

    NA

  6. jeremy-croff commented on Jan 23, 2024

    @jeremy-croff
    Contributor

    I'm actually unable to reproduce.
    Is it specific to some receipts?

  7. bernhardoj commented on Jan 23, 2024

    @bernhardoj
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    The merchant field shows an error on a split bill details page while the receipt is still scanning.

    What is the root cause of that problem?

    Currently, we show the error if shouldDisplayMerchantError or shouldDisplayFieldError is true.

    error={shouldDisplayMerchantError || (shouldDisplayFieldError && TransactionUtils.isMerchantMissing(transaction)) ? translate('common.error.enterMerchant') : ''}

    shouldDisplayFieldError will be false when the receipt is still scanning.

    const shouldDisplayFieldError = useMemo(() => {
    if (!props.isEditingSplitBill) {
    return false;
    }
    return (props.hasSmartScanFailed && TransactionUtils.hasMissingSmartscanFields(transaction)) || (didConfirmSplit && TransactionUtils.areRequiredFieldsEmpty(transaction));

    But shouldDisplayMerchantError is always true because isScanRequest is always false.

    const shouldDisplayMerchantError = props.isPolicyExpenseChat && !props.isScanRequest && isMerchantEmpty;

    The shouldDisplayMerchantError was added in #32486. The condition was added in both MoneyRequestConfirmationList and MoneyTemporaryForRefactorRequestConfirmationList (with a different name). I'm pretty sure they just copied it from MoneyTemporaryForRefactorRequestConfirmationList to MoneyRequetConfirmationList without testing the existence of isScanRequest (it's not available on both pages).

    The isScanRequest is added in #29473 where it was added for the money request create page only, and not for the split bill details page intentionally.

    The reason for the condition is to not show a merchant field if we are going to create a new scan request (just like other field, such as amount), but this condition is not applicable for the split bill details page (which still uses MoneyRequestConfirmationList). On MoneyRequestConfirmationList, we use this condition to decide whether to show an error or not which is not correct.

    If we look at MoneyRequestView, we can see the condition to decide whether to show the merchant error or not.

    hasErrors = canEdit && TransactionUtils.hasMissingSmartscanFields(transaction);

    error={hasErrors && isPolicyExpenseChat && isEmptyMerchant ? translate('common.error.enterMerchant') : ''}

    And that's the one that we should follow.

    What changes do you think we should make in order to solve the problem?

    We can update shouldDisplayMerchantError to:

    const shouldDisplayMerchantError = props.isPolicyExpenseChat && shouldDisplayFieldError && isMerchantEmpty;
    

    Then we can remove the shouldDisplayFieldError here

    error={shouldDisplayMerchantError || (shouldDisplayFieldError && TransactionUtils.isMerchantMissing(transaction)) ? translate('common.error.enterMerchant') : ''}

    If we later migrate to MoneyTemporaryForRefactorRequestConfirmationList, then we need to pass isEditingSplitBill as false from IOURequestStepConfirmation

  8. neonbhai commented on Jan 24, 2024

    @neonbhai
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    Split - "Enter a merchant name" error message appears while scanning is in process

    What is the root cause of that problem?

    This happens as this condition evaluates to true:

    error={shouldDisplayMerchantError || (shouldDisplayFieldError && TransactionUtils.isMerchantMissing(transaction)) ? translate('common.error.enterMerchant') : ''}

    shouldDisplayFieldErrors would evaluate to be true if there is any missing field in the request.

    The problem is we OR the result of shouldDisplayMerchantError, which does not use the variable correctly.

    We use shouldDisplayMerchantError to check if the report requires merchant and if an error should be shown

    We use this to only show merchant errors, in places where it is a required field.

    What changes do you think we should make in order to solve the problem?

    
The || condition here should be an && condition:
    


    error={shouldDisplayMerchantError || (shouldDisplayFieldError && TransactionUtils.isMerchantMissing(transaction)) ? translate('common.error.enterMerchant') : ''}

    error={shouldDisplayMerchantError && shouldDisplayFieldError && TransactionUtils.isMerchantMissing(transaction) ? translate('common.error.enterMerchant') : ''}

    We should also add shouldDisplayMerchantError check for brickRoadIndicator prop condition here:

    brickRoadIndicator={shouldDisplayFieldError && TransactionUtils.isMerchantMissing(transaction) ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : ''}

    brickRoadIndicator={shouldDisplayMerchantError && shouldDisplayFieldError && TransactionUtils.isMerchantMissing(transaction) ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : ''}

    Result:

    Before
    Screen.Recording.2024-01-23.at.1.51.04.AM.mov
    After
    Screen.Recording.2024-01-23.at.1.46.30.AM.mov

    Alternatively

    For a finer change, since merchant is not a required field for Split Request, while showing error, we should check for !isSplitBill condition:

    error={shouldDisplayMerchantError || (shouldDisplayFieldError && !isSplitBill 
    && TransactionUtils.isMerchantMissing(transaction)) ? translate('common.error.enterMerchant') : ''}
  9. neonbhai commented on Jan 24, 2024

    @neonbhai
    Contributor

    @lanitochka17 hi, looks like we don't have a C+ assigned here 🤔

  10. situchan commented on Jan 24, 2024

    @situchan
    Contributor

    Even BZ member not assigned here 🤔

    I can take this as C+

  11. melvin-bot commented on Jan 30, 2024

    @melvin-bot

    6 days overdue. This is scarier than being forced to listen to Vogon poetry!

  12. melvin-bot commented on Feb 1, 2024

    @melvin-bot

    8 days overdue is a lot. Should this be a Weekly issue? If so, feel free to change it!

  13. 86 remaining items

  14. srikarparsi commented on Mar 26, 2024

    @srikarparsi
    Contributor

    Cool, in that case do you want to check off the boxes @situchan or is there something pending before payment?

  15. srikarparsi commented on Apr 2, 2024

    @srikarparsi
    Contributor

    @situchan, do you think you can complete the checklist whenever you get a chance?

  16. melvin-bot commented on Apr 5, 2024

    @melvin-bot

    @anmurali, @srikarparsi, @bernhardoj, @situchan Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

  17. anmurali commented on Apr 9, 2024

    @anmurali

    @situchan - bump on the checklist.

  18. melvin-bot commented on Apr 12, 2024

    @melvin-bot

    @anmurali, @srikarparsi, @bernhardoj, @situchan Whoops! This issue is 2 days overdue. Let's get this updated quick!

  19. melvin-bot commented on Apr 16, 2024

    @melvin-bot

    @anmurali, @srikarparsi, @bernhardoj, @situchan 6 days overdue. This is scarier than being forced to listen to Vogon poetry!

  20. anmurali commented on Apr 17, 2024

    @anmurali

    Since the regression test exists here, and everyone's been paid, I will close this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2EngineeringExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions