App icon indicating copy to clipboard operation
App copied to clipboard

[$250] Expense - Merchant's ‘Duplicate’ error message does not disappear after changing i

Open IuliiaHerets opened this issue 1 year ago • 14 comments

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: v9.0.67-1 Reproducible in staging?: Y Reproducible in production?: Y Email or phone of affected tester (no customers): [email protected] Issue reported by: Applause Internal Team

Action Performed:

  1. Open the URL: https://staging.new.expensify.com/
  2. Create a WS
  3. Create and submit an expense to the WS with: Amount: 123, Merchant: hhh
  4. Repeat step 3
  5. Click on 'Search' between Settings & Inbox
  6. Find the expense and do a click on it
  7. Change the merchant name

Expected Result:

After changing the merchant's name, the error message below merchant should disappear.

Actual Result:

After changing the merchant's name, the error message persists. (If you change the amount, the error disappear. However, the error appears below the merchant and it is understood that it is caused by the merchant, not by the amount)

Workaround:

Unknown

Platforms:

  • [ ] Android: Standalone
  • [ ] Android: HybridApp
  • [ ] Android: mWeb Chrome
  • [ ] iOS: Standalone
  • [ ] iOS: HybridApp
  • [ ] iOS: mWeb Safari
  • [x] MacOS: Chrome / Safari
  • [x] MacOS: Desktop

Screenshots/Videos

https://github.com/user-attachments/assets/7dc347fc-3c25-414d-b665-0c811e5e87d6

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021861836931662502944
  • Upwork Job ID: 1861836931662502944
  • Last Price Increase: 2024-11-27
Issue OwnerCurrent Issue Owner: @sobitneupane

IuliiaHerets avatar Nov 27 '24 13:11 IuliiaHerets

Triggered auto assignment to @garrettmknight (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

melvin-bot[bot] avatar Nov 27 '24 13:11 melvin-bot[bot]

Edited by proposal-police: This proposal was edited at 2024-12-03 11:50:40 UTC.

Proposal

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

After changing the merchant's name, the error message persists. (If you change the amount, the error disappear. However, the error appears below the merchant and it is understood that it is caused by the merchant, not by the amount)

What is the root cause of that problem?

The duplicate detection only applies to the amount, not to the merchant (we can try when submitting two expenses with the same amount and different merchant and two expenses with the different amount and the same merchant to verify that).

But duplicatedTransaction violation is mapping to the merchant although the reason is the dup amount

https://github.com/Expensify/App/blob/3541c88fa1f2f9208dda09ab5b478c4342127f3b/src/hooks/useViolations.ts#L21

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

Change this to amount

https://github.com/Expensify/App/blob/3541c88fa1f2f9208dda09ab5b478c4342127f3b/src/hooks/useViolations.ts#L21

What alternative solutions did you explore? (Optional)

nkdengineer avatar Nov 27 '24 13:11 nkdengineer

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

melvin-bot[bot] avatar Nov 27 '24 18:11 melvin-bot[bot]

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

melvin-bot[bot] avatar Nov 27 '24 18:11 melvin-bot[bot]

Proposal

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

Expense - Merchant's ‘Duplicate’ error message does not disappear after changing i

What is the root cause of that problem?

When calling the UpdateMoneyRequestMerchant api, Backend didn't return the correct response if the transaction is not duplicated. Screenshot_16

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

For solving this on frontend side. we should add the onyxData merge block at the above line of API call in the updateMoneyRequestMerchant when the transaction is not duplicated.

    onyxData.successData?.push({
        onyxMethod: Onyx.METHOD.MERGE,
        key: `${ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS}${transactionID}`,
        value: null,
    });

And we should find the duplicated transaction id and set it as null too.

What alternative solutions did you explore? (Optional)

We can also solve this to send the correct response from Backend.

Contributor details

Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~01aff093c9a804b145

luckydaniel1993 avatar Nov 28 '24 16:11 luckydaniel1993

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

melvin-bot[bot] avatar Nov 28 '24 16:11 melvin-bot[bot]

Proposal

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

Expense - Merchant's ‘Duplicate’ error message does not disappear after changing i

What is the root cause of that problem?

After changing the merchant name, UpdateMoneyRequestMerchant api doesn't return the correct response. The duplicatedTransaction violation should depend on the merchant name, but it seems, now backend trigger this violation based on the amount.

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

We should fix the backend logic to consider the merchant name, not the amount.

What alternative solutions did you explore? (Optional)

I'm not sure when we should show 'Duplicate' warning but if we have to show this on the expenses where both amount and merchant name are the same, then we should fix the current workflow.

David-0910 avatar Nov 29 '24 18:11 David-0910

📣 @David-0910! 📣 Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork. Please follow these steps:

  1. Make sure you've read and understood the contributing guidelines.
  2. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  3. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details. Screen Shot 2022-11-16 at 4 42 54 PM Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>

melvin-bot[bot] avatar Nov 29 '24 18:11 melvin-bot[bot]

@garrettmknight, @sobitneupane Huh... This is 4 days overdue. Who can take care of this?

melvin-bot[bot] avatar Dec 03 '24 09:12 melvin-bot[bot]

Thanks for the proposal, everyone.

@nkdengineer, could you please provide more details in your proposal, particularly in the root cause section? The current statement seems to validate your solution but doesn't provide much insight into the actual root cause.

Also, aren't we supposed to show the Duplicate error message only if both the merchant and the amount are the same?

sobitneupane avatar Dec 03 '24 11:12 sobitneupane

@sobitneupane I updated my proposal with the detail RCA

nkdengineer avatar Dec 03 '24 11:12 nkdengineer

Also, aren't we supposed to show the Duplicate error message only if both the merchant and the amount are the same?

Yes, the duplicate error will appear whenever you create another expense with the same amount.

nkdengineer avatar Dec 03 '24 11:12 nkdengineer

Thanks for the proposal, @nkdengineer

The duplicate detection only applies to the amount, not to the merchant (we can try when submitting two expenses with the same amount and different merchant and two expenses with the different amount and the same merchant to verify that).

First, I would like confirmation from the internal engineering team: Do we currently detect two transactions as probable duplicates based solely on having the same amount, regardless of the merchant?

  • If this is not expected behavior, I suggest making the necessary changes in the backend.
  • If this is expected behavior, let's proceed with @nkdengineer's proposal to display the duplicate message below the amount field instead of the merchant field.

🎀 👀 🎀 C+ reviewed

sobitneupane avatar Dec 04 '24 12:12 sobitneupane

Triggered auto assignment to @aldo-expensify, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

melvin-bot[bot] avatar Dec 04 '24 12:12 melvin-bot[bot]

@aldo-expensify Please help to check this comment when you have a chance.

nkdengineer avatar Dec 09 '24 05:12 nkdengineer

Looking at OldDot, it looks like @nkdengineer is correct. In OldDot, we warn about duplicates if the amount is the same, no matter if the merchant is different:

image

@garrettmknight do you know if this is correct?

aldo-expensify avatar Dec 09 '24 21:12 aldo-expensify

@garrettmknight, @sobitneupane, @aldo-expensify Eep! 4 days overdue now. Issues have feelings too...

melvin-bot[bot] avatar Dec 10 '24 09:12 melvin-bot[bot]

@garrettmknight @sobitneupane @aldo-expensify this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

melvin-bot[bot] avatar Dec 11 '24 09:12 melvin-bot[bot]

@garrettmknight Can you check this comment here?

nkdengineer avatar Dec 11 '24 09:12 nkdengineer

@garrettmknight, @sobitneupane, @aldo-expensify 6 days overdue. This is scarier than being forced to listen to Vogon poetry!

melvin-bot[bot] avatar Dec 12 '24 09:12 melvin-bot[bot]

I thought this was for the updated dupe detection functionality we're working on. My bad - I'll close for now.

garrettmknight avatar Dec 12 '24 19:12 garrettmknight