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

[Pay meow][$500] [Held requests] Pay with Expensify button does not include amount after approving held request #39342

Closed
6 tasks done
m-natarajan opened this issue Mar 31, 2024 · 29 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor

Comments

@m-natarajan
Copy link

m-natarajan commented Mar 31, 2024

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


issue found when validating #33124
Version Number: 1.4.58-2
Reproducible in staging?: y
Reproducible in production?: n
If this was caught during regression testing, add the test name, ID and link from TestRail: n/a
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:

Precondition:

  • Admin and employee are in the Collect workspace.
  1. [Employee] Request money from the workspace chat.
  2. [Employee] Create a money request
  3. [Employee] Hold the request.
  4. [Admin] Go to expense report.
  5. [Admin] Click Approve button.
  6. [Admin] Approve all the request.

Expected Result:

After approving all the held request, Pay with Expensify button will update to include the total amount (this is the case when approving two requests where one of the requests is held).

Actual Result:

After approving all the held request, Pay with Expensify button does not include the total amount. It only includes the total amount after visiting the transaction thread.

Workaround:

unknonw

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

Bug6433521_1711916993122.20240401_041807.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01e05ae27f1f02458c
  • Upwork Job ID: 1774870331469250560
  • Last Price Increase: 2024-04-01
  • Automatic offers:
    • hoangzinh | Reviewer | 0
@m-natarajan m-natarajan added DeployBlockerCash This issue or pull request should block deployment Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Mar 31, 2024
Copy link

melvin-bot bot commented Mar 31, 2024

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

Copy link

melvin-bot bot commented Mar 31, 2024

Triggered auto assignment to @neil-marcellini (DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

@github-actions github-actions bot added Engineering Hourly KSv2 and removed Daily KSv2 labels Mar 31, 2024
Copy link
Contributor

👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

  1. Identify the pull request that introduced this issue and revert it.
  2. Find someone who can quickly fix the issue.
  3. Fix the issue yourself.

@nkdengineer
Copy link
Contributor

nkdengineer commented Apr 1, 2024

Proposal

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

After approving all the held request, Pay with Expensify button does not include the total amount. It only includes the total amount after visiting the transaction thread.

What is the root cause of that problem?

We set the formattedAmount prop as empty string if all transactions are held. After we approve the money request, the hold reason isn't cleared in transaction so this check is still true and Pay with Expensify button doesn't include amount.

When we open the transaction thread report, OpenReport is called and it returns the hold reason of transaction as empty. It leads this check is false and then the amount appears after going back from transaction thread report.

formattedAmount={!ReportUtils.hasOnlyHeldExpenses(moneyRequestReport.reportID) ? displayedAmount : ''}

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

Since all hold transactions will be un-held after we approve the money request, we can add the check approve report here to display the amount if the report is approved

formattedAmount={(!ReportUtils.hasOnlyHeldExpenses(moneyRequestReport.reportID) || ReportUtils.isReportApproved(moneyRequestReport))? displayedAmount : ''}

formattedAmount={!ReportUtils.hasOnlyHeldExpenses(moneyRequestReport.reportID) ? displayedAmount : ''}

formattedAmount={!ReportUtils.hasOnlyHeldExpenses(moneyRequestReport.reportID) ? displayedAmount : ''}

What alternative solutions did you explore? (Optional)

In approveMoneyRequest function, we can set the hold comment of all transactions to empty in optimisticData and then

revert it to the current hold comment in failureData

function approveMoneyRequest(expenseReport: OnyxTypes.Report | EmptyObject, full?: boolean) {

Alternatively, we can hide the approve button if all requests are held

@allgandalf
Copy link
Contributor

allgandalf commented Apr 1, 2024

const onSubmit = (full: boolean) => {
if (isApprove) {
IOU.approveMoneyRequest(moneyRequestReport, full);

Proposal

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

After we approve a money request, we don't see the amount in pay with expensify button.

What is the root cause of that problem?

After the recent PR, we can approve held requests as well

Now when we approve a held request we essentially call submit in ProcessMoneyReportHoldMenu:

const onSubmit = (full: boolean) => {
if (isApprove) {
IOU.approveMoneyRequest(moneyRequestReport, full);

Here we check if the request is a approve one, and if yes then we call approveMoneyRequest and we pass the second parameter as full now we take full variable from the below:

onFirstOptionSubmit={() => onSubmit(false)}
onSecondOptionSubmit={() => onSubmit(true)}

Now you can see that as approve is a first option we set the value of full as false, this same value is passed to approveMoneyRequest and we never really approve these request, as we will only approve requests if we pass the first option as true.

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

We need to update the submit function to always pass true if we have to approve a request:
The full condition was passed for some other case IMO and we just used it for approve request as well:

const onSubmit = (full: boolean) => {
        if (isApprove) {
            IOU.approveMoneyRequest(moneyRequestReport, true);
        } else if (chatReport && paymentType) {
            IOU.payMoneyRequest(paymentType, chatReport, moneyRequestReport, full);
        }
        onClose();
    };

What alternative solutions did you explore? (Optional)

If the first and second options are used to determine whether to approve full or partial transaction, then we can have a check of how many buttons exist, if only one button exists then we should update the approveMoneyRequest such that it will pass true if we have only one button and will pass full is we have 2 options

@neil-marcellini
Copy link
Contributor

I think the problem should be described a bit differently, based on the following from the PR where this issue was found.

Whenever all money requests are on hold the total amount on approve/pay button shouldn't be displayed and it should redirect the user to modal with just one confirmation button asking to pay the full amount - since there are no "unheld" requests

The expected result is that the pay button should not display the amount when all requests are on hold.
The actual result is that it displays the amount after viewing the transaction thread.

@neil-marcellini
Copy link
Contributor

@BartoszGrajdek are you around to help fix this?

@neil-marcellini
Copy link
Contributor

@robertjchen would you be willing to take this over since you reviewed the PR and have the most context? I'll keep working on it until I hear otherwise.

@robertjchen
Copy link
Contributor

sounds good, I can take it! This can definitely be handled by contributors 👍

@robertjchen robertjchen added the External Added to denote the issue can be worked on by a contributor label Apr 1, 2024
Copy link

melvin-bot bot commented Apr 1, 2024

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

@melvin-bot melvin-bot bot changed the title Hold request - Pay with Expensify button does not include amount after approving held request [$500] Hold request - Pay with Expensify button does not include amount after approving held request Apr 1, 2024
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Apr 1, 2024
Copy link

melvin-bot bot commented Apr 1, 2024

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

@hoangzinh
Copy link
Contributor

@nkdengineer @GandalfGwaihir Thanks for proposals, everyone

  • @GandalfGwaihir I don't think your proposal has correct RCA. Moreover, your solution doesn't look good. It might cause calculate incorrect totalAmount here in case of partial approve
  • @nkdengineer's proposal looks good to me. RCA is correct and his alternative solution looks good. I just want to add a recommended is that, we only "set the hold comment of all transactions to empty in optimisticData" when [Admin] approves all requests

Link to selected proposal #39342 (comment)

🎀👀🎀 C+ reviewed

Copy link

melvin-bot bot commented Apr 3, 2024

Current assignee @robertjchen is eligible for the choreEngineerContributorManagement assigner, not assigning anyone new.

@robertjchen
Copy link
Contributor

Looks good to me as well, let's move forward with @nkdengineer 's proposal 👍

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Apr 3, 2024
Copy link

melvin-bot bot commented Apr 3, 2024

📣 @hoangzinh 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job

Copy link

melvin-bot bot commented Apr 3, 2024

📣 @nkdengineer You have been assigned to this job!
Please apply to the Upwork job and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Once you apply to this job, your Upwork ID will be stored and you will be automatically hired for future jobs!
Keep in mind: Code of Conduct | Contributing 📖

@nkdengineer
Copy link
Contributor

@hoangzinh The PR is here.

@melvin-bot melvin-bot bot removed the Weekly KSv2 label Apr 29, 2024
Copy link

melvin-bot bot commented Apr 29, 2024

This issue has not been updated in over 15 days. @robertjchen, @hoangzinh, @mallenexpensify, @nkdengineer eroding to Monthly issue.

P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!

@melvin-bot melvin-bot bot added the Monthly KSv2 label Apr 29, 2024
@nkdengineer
Copy link
Contributor

@mallenexpensify The PR is deployed to production last month. Can you please add weekly label again and I think we're ready for payment here? Thanks.

@mallenexpensify mallenexpensify added Daily KSv2 and removed Reviewing Has a PR in review Monthly KSv2 labels May 1, 2024
@mallenexpensify
Copy link
Contributor

mallenexpensify commented May 1, 2024

Contributor: @nkdengineer paid $500 via Upwork
Contributor+: @hoangzinh paid $500 via Upwork.

@nkdengineer can you please accept the job and reply here once you have?

PR hit production on 4/22, automation failed here, I updated labels and such.

@mallenexpensify mallenexpensify changed the title [$500] [Held requests] Pay with Expensify button does not include amount after approving held request [Pay meow][$500] [Held requests] Pay with Expensify button does not include amount after approving held request May 1, 2024
@nkdengineer
Copy link
Contributor

@mallenexpensify Offer accepted, thanks 🙏

@mallenexpensify
Copy link
Contributor

@nkdengineer paid, updated main payment comment above.

@hoangzinh can you fill out the BZ checklist? Looks like it didn't auto-post here, pasted below

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

  • [@] The PR that introduced the bug has been identified. Link to the PR:
  • [@] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
  • [@] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
  • [@] Determine if we should create a regression test for this bug.
  • [@] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
  • [@bz] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:l

@melvin-bot melvin-bot bot added the Overdue label May 6, 2024
Copy link

melvin-bot bot commented May 7, 2024

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

@hoangzinh
Copy link
Contributor

BugZero Checklist:

Regression Test Proposal

Precondition: Create a collect workspace and invite some users as employee

  1. Sign in as an Employee in the above collect workspace
  2. [Employee] Create two requests in the workspace chat
  3. [Employee] Go to transaction thread report of a request and hold the request
  4. [Employee] Submit the report
  5. Sign in as an Admin in the above collect workspace
  6. [Admin] Go to expense report and click on approve button
  7. [Admin] Approve all requests
  8. [Admin] Verify that the "Pay with Expensify" button appears and it includes the total amount

Do we agree 👍 or 👎

@melvin-bot melvin-bot bot removed the Overdue label May 7, 2024
@mallenexpensify
Copy link
Contributor

Thanks @hoangzinh , TestRail GH created

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 Engineering External Added to denote the issue can be worked on by a contributor
Projects
No open projects
Archived in project
Development

No branches or pull requests

8 participants