App icon indicating copy to clipboard operation
App copied to clipboard

[$500] `Pay` button appears for the approved report

Open kavimuru 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: Reproducible in staging?: needs reproduction Reproducible in production?: needs reproduction If this was caught during regression testing, add the test name, ID and link from TestRail: Email or phone of affected tester (no customers): Logs: https://stackoverflow.com/c/expensify/questions/4856 Expensify/Expensify Issue URL: Issue reported by: @JmillsExpensify Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1705978407170839

Action Performed:

  1. submit a expense report to approver
  2. Approve the expense report

Expected Result:

"pay" button should disappear

Actual Result:

"pay" button still appears

Workaround:

Can the user still use Expensify without this being fixed? Have you informed them of the workaround?

Platforms:

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

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

Screenshots/Videos

Add any screenshot/video evidence

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01649969eb5b52cb20
  • Upwork Job ID: 1750230674366476288
  • Last Price Increase: 2024-01-24

kavimuru avatar Jan 23 '24 08:01 kavimuru

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

melvin-bot[bot] avatar Jan 23 '24 08:01 melvin-bot[bot]

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

melvin-bot[bot] avatar Jan 24 '24 18:01 melvin-bot[bot]

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

melvin-bot[bot] avatar Jan 24 '24 18:01 melvin-bot[bot]

Still seeing this daily

JmillsExpensify avatar Jan 25 '24 03:01 JmillsExpensify

Proposal

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

Pay option is still appears after approving the expense.

What is the root cause of that problem?

It's simply because we don't hide the pay button when the expense is approved. https://github.com/Expensify/App/blob/0d0b0a8c9b073c30a9b54de15066789d17f7c718/src/components/MoneyReportHeader.tsx#L68-L71

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

Hide the button when the expense is approved by adding !isApproved condition to shouldShowPayButton.

(we need to do this in ReportPreview too)

but how will the expense get paid if the pay button is hidden and it's not automatically reimbursed?

bernhardoj avatar Jan 25 '24 03:01 bernhardoj

It is partially a duplicate of https://github.com/Expensify/App/issues/34951 where the Pay button should be hidden when auto-reimbursement is enabled, but we'd also need to check if the user is a Reimburser (not just an admin). Assigning myself to take it over.

marcochavezf avatar Jan 25 '24 16:01 marcochavezf

Thanks for the proposal @bernhardoj, but this GH will be internal since it will require BE changes.

marcochavezf avatar Jan 25 '24 16:01 marcochavezf

Current assignee @c3024 is eligible for the Internal assigner, not assigning anyone new.

melvin-bot[bot] avatar Jan 25 '24 16:01 melvin-bot[bot]

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

melvin-bot[bot] avatar Jan 29 '24 15:01 melvin-bot[bot]

Working on it

marcochavezf avatar Jan 29 '24 15:01 marcochavezf

PRs up to only display the Pay button to the reimburser (and not all admins):

  • https://github.com/Expensify/Web-Expensify/pull/40709
  • https://github.com/Expensify/App/pull/35347

marcochavezf avatar Jan 30 '24 02:01 marcochavezf

Starting leave so re-assigning!

NicMendonca avatar Jan 31 '24 19:01 NicMendonca

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

melvin-bot[bot] avatar Jan 31 '24 19:01 melvin-bot[bot]

Updated the App PR from latest main and mark it ready for review

marcochavezf avatar Feb 06 '24 00:02 marcochavezf

⚠️ Looks like this issue was linked to a Deploy Blocker here

If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

If a regression has occurred and you are the assigned CM follow the instructions here.

If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

melvin-bot[bot] avatar Feb 13 '24 11:02 melvin-bot[bot]

@marcochavezf, @twisterdotcom, @c3024 Whoops! This issue is 2 days overdue. Let's get this updated quick!

melvin-bot[bot] avatar Feb 13 '24 15:02 melvin-bot[bot]

Is it? What do we need to do here?

twisterdotcom avatar Feb 13 '24 15:02 twisterdotcom

Seems there's an edge case for indirect reimbursement, discussing here

marcochavezf avatar Feb 13 '24 17:02 marcochavezf

Reviewing label has been removed, please complete the "BugZero Checklist".

melvin-bot[bot] avatar Feb 13 '24 18:02 melvin-bot[bot]

The solution for this issue has been :rocket: deployed to production :rocket: in version 1.4.40-5 and is now subject to a 7-day regression period :calendar:. Here is the list of pull requests that resolve this issue:

  • https://github.com/Expensify/App/pull/35347

If no regressions arise, payment will be issued on 2024-02-20. :confetti_ball:

For reference, here are some details about the assignees on this issue:

  • @c3024 requires payment (Needs manual offer from BZ)

melvin-bot[bot] avatar Feb 13 '24 18:02 melvin-bot[bot]

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:

  • [ ] [@c3024] The PR that introduced the bug has been identified. Link to the PR:
  • [ ] [@c3024] 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:
  • [ ] [@c3024] 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:
  • [ ] [@c3024] Determine if we should create a regression test for this bug.
  • [ ] [@c3024] 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.
  • [ ] [@twisterdotcom] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

melvin-bot[bot] avatar Feb 13 '24 18:02 melvin-bot[bot]

Coming from this convo, we'd need to update the Pay button logic based on the reimbursement settings:

None - No pay button at all. The final report destination is either closed or approved based on “Submit & Close” or “Submit & Approve” mode.
Direct - Pay using Expensify shown to the admin that is configured for payment in the workspace (i.e the “assigned reimburser”)
Indirect - Pay elsewhere show to all admins

marcochavezf avatar Feb 13 '24 22:02 marcochavezf

@c3024 want to handle this as well please?

twisterdotcom avatar Feb 14 '24 11:02 twisterdotcom

Yes @twisterdotcom . Thanks

c3024 avatar Feb 14 '24 12:02 c3024

Also coming from the same convo, we want to simplify this condition in favor of the group policies (we will remove the free plan soon) cc @c3024

marcochavezf avatar Feb 15 '24 21:02 marcochavezf

Also we'd need to update this condition for the report preview.

marcochavezf avatar Feb 15 '24 21:02 marcochavezf

@marcochavezf you're working on a PR for this, correct?

trjExpensify avatar Feb 19 '24 10:02 trjExpensify

Hi @c3024, I was wondering if you've had a chance to work on this? If not, no worries at all, I'm more than happy to take care of the pending changes by creating a PR today.

marcochavezf avatar Feb 19 '24 16:02 marcochavezf

My bad, I misunderstood that I'd take this as C+ for review. 😄 I will make the PR right away.

Could you confirm these?

REIMBURSEMENT_YES: 'reimburseYes', = Direct
            REIMBURSEMENT_NO: 'reimburseNo', = None
            REIMBURSEMENT_MANUAL: 'reimburseManual', = Indirect

Also coming from the same convo, we want to simplify this condition in favor of the group policies (we will remove the free plan soon).

This means isPaidGroupPolicy is always true henceforth, right?

@marcochavezf

c3024 avatar Feb 19 '24 17:02 c3024

Thanks @c3024, yeah the meaning of the reimbursement values is correct and also yes, the isPaidGroupPolicy will be always true

marcochavezf avatar Feb 19 '24 17:02 marcochavezf