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.52k stars 2.87k forks source link

[$250] IOU - Payment turns into Submitted expense for a short time #42719

Closed lanitochka17 closed 2 months ago

lanitochka17 commented 5 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.76-5 Reproducible in staging?: Y Reproducible in production?: Y If this was caught during regression testing, add the test name, ID and link from TestRail: N/A Issue reported by: Applause - Internal Team

Action Performed:

  1. Log in as a Gmail account
  2. Navigate to FAB - Pay someone
  3. Enter any amount
  4. Enter a new Gmail address without an Expensify account
  5. Create the IOU

Expected Result:

It should remain as a paid IOU

Actual Result:

Payment turns into Submitted expense. It reverts back in a few seconds if you open the IOU or refresh the page

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/78819774/180de32b-e892-497d-97f1-407b3d0f470b

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01b66ef1fd86c13a9c
  • Upwork Job ID: 1795517213267488768
  • Last Price Increase: 2024-05-28
melvin-bot[bot] commented 5 months ago

Triggered auto assignment to @greg-schroeder (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.

lanitochka17 commented 5 months ago

@greg-schroeder FYI 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

melvin-bot[bot] commented 5 months ago

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

melvin-bot[bot] commented 5 months ago

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

alexrasla commented 5 months ago

Proposal

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

The problem we are trying to solve here is that sometimes when we "Pay Someone" with an email account that is not registered with Expensify, we run into a bug that causes the text to say owes instead of paid after some time.

What is the root cause of that problem?

The root cause of this problem is that the latest report data is not being read from the Onxy data store. The report read from the allReports here is outdated when read, saying that the Onxy report has a statusNum: 1 (REPORT.STATUS_NUM.OPEN), and thus rendering the default text of iou.payerOwes. However, if we read the latest stored data in the Onxy report, the statusNum would be 4 (REPORT.STATUS_NUM.REIMBURSED), which would cause the ReportUtils.isSettled function to return true, and thus returns the correct iou.payerPaid text here.

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

In order to solve this problem, we just need to read the latest Onxy report data when checking if the report isSettled here. Once we have the latest data from the Onxy store, the statusNum will be 4 and will equal REPORT.STATUS_NUM.REIMBURSED, and the correct paid text will show on the UI.

What alternative solutions did you explore? (Optional)

I explored changing the isSettled to also check if report.statusNum == REPORT.STATUS_NUM.OPEN, but that doesn't seem to make logical sense to see if a report is settled.

Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

jjcoffee commented 5 months ago

Pretty sure this is a BE issue as the IOU displays correctly initially and then turns into a submitted expense once the SendMoneyElsewhere call completes. SendMoneyElsewhere returns an onyx update that sets the report to submitted:

{
"stateNum": 1,
"statusNum": 1,
}

cc @greg-schroeder

greg-schroeder commented 5 months ago

Ah, fair enough. Okay I will move Internal then

greg-schroeder commented 5 months ago

Updated

greg-schroeder commented 5 months ago

Waiting for an internal engineer to grab this

greg-schroeder commented 5 months ago

Same as above

melvin-bot[bot] commented 4 months ago

@jjcoffee @greg-schroeder this issue was created 2 weeks ago. Are we close to a solution? Let's make sure we're treating this as a top priority. Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

greg-schroeder commented 4 months ago

No updates here yet

greg-schroeder commented 3 months ago

Still waiting for an engineer to pick this up as it's internal

mvtglobally commented 3 months ago

Issue not reproducible during KI retests. (First week)

mvtglobally commented 2 months ago

Issue not reproducible during KI retests. (Second week)

greg-schroeder commented 2 months ago

I'm going to close this as not reproducible, but please reopen if you disagree.