Expensify / App

Welcome to New Expensify: a complete re-imagination of financial collaboration, centered around chat. Help us build the next generation of Expensify by sharing feedback and contributing to the code.
https://new.expensify.com
MIT License
3.35k stars 2.78k forks source link

[LOW] [Splits] [$500] IOU - When paying a deleted IOU disappears and RBR does not appear when going online #38338

Open kbecciv opened 6 months ago

kbecciv commented 6 months ago

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.52-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/4424536 Issue reported by: Applause - Internal Team

Action Performed:

  1. Open NewDot app or https://staging.new.expensify.com/
  2. Log in to account A and B in incognito mode
  3. [User B] Request money from User A
  4. [User A] Go offline
  5. [User A] Open the IOU report and tap Pay elsewhere
  6. [User B] Delete the IOU
  7. [User A] Go online

Expected Result:

The deleted IOU should not disappear when you pay and should appear RBR when you go online

Actual Result:

When paying a deleted IOU disappears and RBR does not appear when going online

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Add any screenshot/video evidence

https://github.com/Expensify/App/assets/93399543/7933a1bd-6eb5-48ef-9ff0-25f3404b2ac3

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01606c57f19fab1b0c
  • Upwork Job ID: 1768749861959938048
  • Last Price Increase: 2024-08-08
melvin-bot[bot] commented 6 months ago

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

kbecciv commented 6 months ago

@mallenexpensify I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors.

kbecciv commented 6 months ago

We think that this bug might be related to #vip-bills CC @quinthar

melvin-bot[bot] commented 6 months ago

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

melvin-bot[bot] commented 6 months ago

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

mallenexpensify commented 6 months ago

Was able to reproduce, pretty sure we're filing this in #vip-split. Going to add there.
@akinwale I marked this External, do you agree?

akinwale commented 6 months ago

@akinwale I marked this External, do you agree?

Yes. It makes sense to let the user know that the attempted payment actually failed.

ijmalik commented 6 months ago

Proposal

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

  1. Open NewDot app or https://staging.new.expensify.com/
  2. Log in to account A and B in incognito mode
  3. [User B] Request money from User A
  4. [User A] Go offline
  5. [User A] Open the IOU report and tap Pay elsewhere
  6. [User B] Delete the IOU
  7. [User A] Go online
  8. Paid IOU disappears and RBR does not appear when going online

What is the root cause of that problem? In Step-6, [User B] deletes the IOU, removing it from the server. When [User A] goes online, an API call sends a PayMoneyRequest. Since the related paid IOU no longer exists on the server, the server responds with an error message.

PayMoneyRequest is sent to the server and a response is received before the ReconnectApp request. I have tested it more than 50 times on staging/local system

1- Response of https://dev.new.expensify.com:8082/api/PayMoneyRequest?

{
    "code": 666,
    "jsonCode": 666,
    "type": "Expensify\\Libs\\Error\\ExpError",
    "UUID": "15599214-3cf5-486d-a718-7473f9a66461",
    "message": "The request has been deleted since you started reviewing it",
    "title": "",
    "data": {
        "onyxData": [
            {
                "onyxMethod": "merge",
                "key": "reportActions_7570059040520446",
                "value": {
                    "8410491383366069554": {
                        "errors": {
                            "1717213301956141": "The request has been deleted since you started reviewing it"
                        }
                    }
                }
            }
        ]
    },
    "htmlMessage": "",
    "onyxData": [
        {
            "onyxMethod": "merge",
            "key": "reportActions_7570059040520446",
            "value": {
                "8410491383366069554": {
                    "errors": {
                        "1717213301956141": "The request has been deleted since you started reviewing it"
                    }
                }
            }
        }
    ],
    "requestID": "88cc307e4aac9fe6-SIN"
}

This error message should be shown to the user, but following the ReconnectApp response, the deleted IOU data from Onyx at the client side removes the IOU for [User A], causing the IOU to disappear and the RBR not to be shown

2- Response of https://dev.new.expensify.com:8082/api/ReconnectApp?

{
    "onyxData": [
        {
            "key": "reportActions_5865121211484369",
            "onyxMethod": "merge",
            "value": {
                "5066949385780238245": {
                    "message": [
                        {
                            "deleted": "2024-06-01 03:41:13.452",
                            "type": "TEXT"
                        }
                    ],
                    "originalMessage": {
                        "deleted": "2024-06-01 03:41:13.452"
                    }
                }
            }
        },
        {
            "key": "report_7535596232475694",
            "onyxMethod": "set",
            "value": null
        },
        {
            "key": "reportActions_7535596232475694",
            "onyxMethod": "set",
            "value": null
        },
        {
            "key": "report_7570059040520446",
            "onyxMethod": "set",
            "value": null
        },
        {
            "key": "reportActions_7570059040520446",
            "onyxMethod": "set",
            "value": null
        },
        {
            "key": "transactions_4222740866756488814",
            "onyxMethod": "set",
            "value": null
        },
        {
            "key": "reportActions_7570059040520446",
            "onyxMethod": "set",
            "value": null
        },
        {
            "key": "report_7570059040520446",
            "onyxMethod": "set",
            "value": null
        },
        {
            "key": "reportActions_5865121211484369",
            "onyxMethod": "merge",
            "value": {
                "5066949385780238245": {
                    "message": [
                        {
                            "deleted": "2024-06-01 03:41:13.452",
                            "html": "",
                            "isDeletedParentAction": false,
                            "isEdited": false,
                            "text": "",
                            "type": "COMMENT",
                            "whisperedTo": []
                        }
                    ],
                    "originalMessage": {
                        "deleted": "2024-06-01 03:41:13.452"
                    }
                }
            }
        },
        {
            "key": "report_7535596232475694",
            "onyxMethod": "set",
            "value": null
        },
        {
            "key": "reportActions_7535596232475694",
            "onyxMethod": "set",
            "value": null
        },
        {
            "key": "report_5865121211484369",
            "onyxMethod": "merge",
            "value": {
                "iouReportID": null,
                "lastActorAccountID": 16328678,
                "lastMessageHtml": "",
                "lastMessageText": "",
                "lastVisibleActionCreated": "2024-06-01 03:39:54.784"
            }
        }
    ],
    "lastUpdateID": "418604732",
    "previousUpdateID": "418603927",
    "jsonCode": 200,
    "requestID": "88cc30863a5aa98e-SIN"
}

What changes do you think we should make in order to solve the problem? https://github.com/Expensify/App/blob/0cb2dc052f01b6a024ac872ad8bf628159fe7873/src/libs/actions/OnyxUpdates.ts#L35 We change it as

const filteredOnyxData = filterOutPaidIOUDeletions(response.onyxData);
const onyxDataUpdatePromise = filteredOnyxData ? updateHandler(filteredOnyxData) : Promise.resolve();

Since the response of ReconnectApp directly updates Onyx, we need to filter the server response of ReconnectApp in the filterOutPaidIOUDeletions function to prevent data deletion from Onyx (Client Side). I think we should have to modify this file or possibly another part of the middlewares to achieve this.

PayMoneyRequest and its response are fine and do not require changes.

Before Code Change:

https://github.com/Expensify/App/assets/2220885/f6ed1945-36d0-433e-a9be-e8a818fab865

After Code Change:

https://github.com/Expensify/App/assets/2220885/e314658d-4eba-4c0e-b679-ac8157861d99

What alternative solutions did you explore? Don't allow to pay IOU offline.

melvin-bot[bot] commented 6 months ago

๐Ÿ“ฃ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? ๐Ÿ’ธ

mallenexpensify commented 6 months ago

@akinwale can you please review the proposal above? Thx

melvin-bot[bot] commented 5 months ago

๐Ÿ“ฃ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? ๐Ÿ’ธ

melvin-bot[bot] commented 5 months ago

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

melvin-bot[bot] commented 5 months ago

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

mallenexpensify commented 5 months ago

Removed @akinwale , was ten days without a review of the proposal. @abdulrahuman5196 , can you please review the above? https://github.com/Expensify/App/issues/38338#issuecomment-2014433112

abdulrahuman5196 commented 5 months ago

Hi, will review this today.

melvin-bot[bot] commented 5 months ago

๐Ÿ“ฃ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? ๐Ÿ’ธ

abdulrahuman5196 commented 5 months ago

On @ijmalik 's proposal here - https://github.com/Expensify/App/issues/38338#issuecomment-2014433112. I don't agree on the solution suggested to make changes in the central SaveResponseInOnyx.ts component to fix this particular case. I think we don't have any proposals to approve yet.

melvin-bot[bot] commented 5 months ago

@mallenexpensify @abdulrahuman5196 this issue is now 4 weeks old, please consider:

Thanks!

melvin-bot[bot] commented 5 months ago

@mallenexpensify, @abdulrahuman5196 Whoops! This issue is 2 days overdue. Let's get this updated quick!

abdulrahuman5196 commented 5 months ago

We don't have proposals pending for review .

melvin-bot[bot] commented 5 months ago

๐Ÿ“ฃ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? ๐Ÿ’ธ

melvin-bot[bot] commented 5 months ago

@mallenexpensify, @abdulrahuman5196 Whoops! This issue is 2 days overdue. Let's get this updated quick!

abdulrahuman5196 commented 5 months ago

We don't have proposals to review.

mallenexpensify commented 5 months ago

Throwing retest-weekly on here since it's been open a while.

melvin-bot[bot] commented 5 months ago

๐Ÿ“ฃ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? ๐Ÿ’ธ

melvin-bot[bot] commented 5 months ago

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

abdulrahuman5196 commented 5 months ago

Waiting on retest

melvin-bot[bot] commented 5 months ago

๐Ÿ“ฃ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? ๐Ÿ’ธ

melvin-bot[bot] commented 5 months ago

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

mallenexpensify commented 5 months ago

Waiting on retest (leaving a daily cuz it should be retested soon)

melvin-bot[bot] commented 4 months ago

@mallenexpensify, @abdulrahuman5196 Whoops! This issue is 2 days overdue. Let's get this updated quick!

mallenexpensify commented 4 months ago

Checking on process and timeline for 'retest-weekly' label in #qa https://expensify.slack.com/archives/C9YU7BX5M/p1714532562694299

melvin-bot[bot] commented 4 months ago

๐Ÿ“ฃ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? ๐Ÿ’ธ

melvin-bot[bot] commented 4 months ago

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

mvtglobally commented 4 months ago

Issue is reproducible during KI retests.

https://github.com/Expensify/App/assets/43995119/ade31de8-8397-4e5a-aa1c-328e626d5873

mallenexpensify commented 4 months ago

We have site issues and deploy freeze, I'll revisit next week.

melvin-bot[bot] commented 4 months ago

๐Ÿ“ฃ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? ๐Ÿ’ธ

melvin-bot[bot] commented 4 months ago

@mallenexpensify, @abdulrahuman5196 Eep! 4 days overdue now. Issues have feelings too...

mallenexpensify commented 4 months ago

Waiting on proposals, since it's [LOW], I'm not eager to raise the price about $500 right now.

melvin-bot[bot] commented 4 months ago

๐Ÿ“ฃ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? ๐Ÿ’ธ

mallenexpensify commented 4 months ago

Still waiting

wildan-m commented 4 months ago

I believe the current behavior is as expected, with the deletion process received by the API server first and the payment approval action being sent later when the user online. Or I missed some steps?

melvin-bot[bot] commented 4 months ago

@mallenexpensify, @abdulrahuman5196 Whoops! This issue is 2 days overdue. Let's get this updated quick!

melvin-bot[bot] commented 4 months ago

๐Ÿ“ฃ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? ๐Ÿ’ธ

mallenexpensify commented 4 months ago

@wildan-m , I'm unsure. Thanks for the comment. @abdulrahuman5196 , do you know?

melvin-bot[bot] commented 3 months ago

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

abdulrahuman5196 commented 3 months ago

I believe the current behavior is as expected, with the deletion process received by the API server first and the payment approval action being sent later when the user online. Or I missed some steps?

@wildan-m , I'm unsure. Thanks for the comment. @abdulrahuman5196 , do you know?

@mallenexpensify Can we confirm this experience with someone else as well if you are unsure? Because the above mentioned is the steps from the dev perspective. But in terms of customer perspective, customer marked a request as paid, but it suddenly disappeared without showing error or anything. So IMO this is a bug, but would be good to confirm as well.

mallenexpensify commented 3 months ago

Here's the TestRail from where the bug was found.

image

the deletion process received by the API server first and the payment approval action being sent later when the user online

Even if this is the case, it appears this would still be a bug if it's not functioning as intended, based on the TestRail case above. I'm unsure how best to fix though

melvin-bot[bot] commented 3 months ago

๐Ÿ“ฃ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? ๐Ÿ’ธ

ijmalik commented 3 months ago

Proposal

[Updated] https://github.com/Expensify/App/issues/38338#issuecomment-2014433112