Skip to content
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

[$500] Scan - Unknown Merchant is shown instead of error when leaving scanning to fail in details page #34438

Closed
6 tasks done
kbecciv opened this issue Jan 12, 2024 · 8 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors

Comments

@kbecciv
Copy link

kbecciv commented Jan 12, 2024

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.24-7
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:

  1. Go to workspace chat.
  2. Create a scan request with receipt that will fail the scanning.
  3. Go to details page while it is still scanning.
  4. Wait for it to fail.

Expected Result:

When the scanning fails, "Enter a merchant name" message will appear on Merchant row.

Actual Result:

When the scanning fails, it shows "Unknown Merchant" in Merchant field.
When user returns to the report and back to details page, "Unknown Merchant" disappears and it is replaced with "Enter a merchant name" message.

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

Bug6340066_1705060282853.bandicam_2024-01-12_02-30-06-211__1_.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01f64fe18fc04bd638
  • Upwork Job ID: 1745791608083116032
  • Last Price Increase: 2024-01-12
@kbecciv kbecciv added External Added to denote the issue can be worked on by a contributor Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jan 12, 2024
@melvin-bot melvin-bot bot changed the title Scan - Unknown Merchant is shown instead of error when leaving scanning to fail in details page [$500] Scan - Unknown Merchant is shown instead of error when leaving scanning to fail in details page Jan 12, 2024
Copy link

melvin-bot bot commented Jan 12, 2024

Job added to Upwork: https://www.upwork.com/jobs/~01f64fe18fc04bd638

Copy link

melvin-bot bot commented Jan 12, 2024

Triggered auto assignment to @abekkala (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Jan 12, 2024
Copy link

melvin-bot bot commented Jan 12, 2024

Triggered auto assignment to Contributor-plus team member for initial proposal review - @mollfpr (External)

@DylanDylann
Copy link
Contributor

DylanDylann commented Jan 12, 2024

Proposal

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

When the scanning fails, it shows "Unknown Merchant" in Merchant field.
When user returns to the report and back to details page, "Unknown Merchant" disappears and it is replaced with "Enter a merchant name" message.

What is the root cause of that problem?

In this case, The BE return "Unknown Merchant"
But in here don't check is transactionMerchant is "Unknown Merchant"

const isEmptyMerchant = transactionMerchant === '' || transactionMerchant === CONST.TRANSACTION.PARTIAL_TRANSACTION_MERCHANT;

so the isEmptyMerchant is false

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

const isEmptyMerchant = transactionMerchant === '' || transactionMerchant === CONST.TRANSACTION.PARTIAL_TRANSACTION_MERCHANT;

we should return isEmptyMerchant is true if transactionMerchant is "Unknown Merchant"

    const isEmptyMerchant = transactionMerchant === '' || transactionMerchant === CONST.TRANSACTION.PARTIAL_TRANSACTION_MERCHANT || transactionMerchant === CONST.TRANSACTION.UNKNOWN_MERCHANT;

Optional:

function isMerchantMissing(transaction: Transaction) {
const isMerchantEmpty = transaction.merchant === CONST.TRANSACTION.PARTIAL_TRANSACTION_MERCHANT || transaction.merchant === '';

We also should update here by adding the condition to check || transactionMerchant === CONST.TRANSACTION.UNKNOWN_MERCHANT;

What alternative solutions did you explore? (Optional)

@Shubham1429
Copy link

Proposal

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

If the user is on the details page of a scan request and the scanning fails, then it shows UNKOWN MERCHANT instead of the usual error message i.e Enter a merchant name. If the user goes back and then opens the details page again, then he can see the appropriate error message.

What is the root cause of that problem?

If the scanning fails, merchant is returned as Unknown Merchant and in the MoneyRequestView.js file there is no check for that particular value.

const isEmptyMerchant = transactionMerchant === '' || transactionMerchant === CONST.TRANSACTION.PARTIAL_TRANSACTION_MERCHANT;

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

Create a new function in TransactionUtils.ts file that checks if the merchant is empty, (none) or unknown and use it in line 141 of MoneyRequestView.js file.

function isEmptyMerchant(transaction: Transaction) {
    return transaction.merchant === CONST.TRANSACTION.PARTIAL_TRANSACTION_MERCHANT || transaction.merchant === CONST.TRANSACTION.UNKNOWN_MERCHANT || transaction.merchant === ''
}

What alternative solutions did you explore? (Optional)

We can also just add the unknown merchant check in the existing condition.

Eg:

    const isEmptyMerchant = transactionMerchant === '' || transactionMerchant === CONST.TRANSACTION.PARTIAL_TRANSACTION_MERCHANT || transactionMerchant === CONST.TRANSACTION.UNKNOWN_MERCHANT;

@mollfpr
Copy link
Contributor

mollfpr commented Jan 12, 2024

@kbecciv @abekkala, I need help understanding the expected result more. This PR #26155 shows the Unknown Merchant value in Merchant input and the red dot error.

Screenshot 2024-01-13 at 00 10 54

Should we empty the input while showing the error or keep the Unknown Merchant value?


Another issue with the money request preview is that it briefly shows the Unknown Merchant value.

@melvin-bot melvin-bot bot added the Overdue label Jan 14, 2024
Copy link

melvin-bot bot commented Jan 15, 2024

@abekkala, @mollfpr Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@abekkala
Copy link
Contributor

When the scanning fails, it shows "Unknown Merchant" in Merchant field.

This is expected with the SmartScan feature

@melvin-bot melvin-bot bot removed the Overdue label Jan 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors
Projects
None yet
Development

No branches or pull requests

5 participants