[$250] Expense - Merchant's ‘Duplicate’ error message does not disappear after changing i
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:
- Open the URL: https://staging.new.expensify.com/
- Create a WS
- Create and submit an expense to the WS with: Amount: 123, Merchant: hhh
- Repeat step 3
- Click on 'Search' between Settings & Inbox
- Find the expense and do a click on it
- 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
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 Owner
Current Issue Owner: @sobitneupane
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.
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)
Job added to Upwork: https://www.upwork.com/jobs/~021861836931662502944
Triggered auto assignment to Contributor-plus team member for initial proposal review - @sobitneupane (External)
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.
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
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
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! 📣 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:
- Make sure you've read and understood the contributing guidelines.
- 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.
- 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.
- Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>
@garrettmknight, @sobitneupane Huh... This is 4 days overdue. Who can take care of this?
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 I updated my proposal with the detail RCA
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.
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
Triggered auto assignment to @aldo-expensify, see https://stackoverflow.com/c/expensify/questions/7972 for more details.
@aldo-expensify Please help to check this comment when you have a chance.
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:
@garrettmknight do you know if this is correct?
@garrettmknight, @sobitneupane, @aldo-expensify Eep! 4 days overdue now. Issues have feelings too...
@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!
@garrettmknight Can you check this comment here?
@garrettmknight, @sobitneupane, @aldo-expensify 6 days overdue. This is scarier than being forced to listen to Vogon poetry!
I thought this was for the updated dupe detection functionality we're working on. My bad - I'll close for now.