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

[HOLD][$250] Expense - 'Pay elsewhere' button is present by default #50180

Open
1 of 6 tasks
lanitochka17 opened this issue Oct 3, 2024 · 27 comments
Open
1 of 6 tasks
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Monthly KSv2 Reviewing Has a PR in review

Comments

@lanitochka17
Copy link

lanitochka17 commented Oct 3, 2024

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: .0.44-3
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

Issue found when executing PR #49967

Action Performed:

Precondition: 2 new accounts

  1. User A create a workspace and invite user B to the workspace as an employee
  2. As user B, create an expense on the workspace
  3. As user A, confirm that you can see the expense that user B made
  4. As user A, go to Settings > Workspaces > your_workspace > More features and turn on "Workflows"
  5. Go to Workflows tab and turn on "Make or track payments"

Expected Result:

On step 3. There is no "Pay with Expensify" and/or "Pay elsewhere" button for the expense
On step 5. "Make or track payments" is off

Actual Result:

On step 3. There is "Pay with Expensify" and/or "Pay elsewhere" button for the expense
On step 5. "Make or track payments" is on

Workaround:

Unknown

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
Bug6623551_1727980582761.2_users_ex.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021842318443819585425
  • Upwork Job ID: 1842318443819585425
  • Last Price Increase: 2024-10-04
  • Automatic offers:
    • dukenv0307 | Reviewer | 104363115
    • truph01 | Contributor | 104363116
Issue OwnerCurrent Issue Owner: @dukenv0307
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Oct 3, 2024
Copy link

melvin-bot bot commented Oct 3, 2024

Triggered auto assignment to @adelekennedy (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
Copy link
Author

@adelekennedy 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

@adelekennedy adelekennedy added the External Added to denote the issue can be worked on by a contributor label Oct 4, 2024
@melvin-bot melvin-bot bot changed the title Expense - 'Pay elsewhere' button is present by default [$250] Expense - 'Pay elsewhere' button is present by default Oct 4, 2024
Copy link

melvin-bot bot commented Oct 4, 2024

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Oct 4, 2024
Copy link

melvin-bot bot commented Oct 4, 2024

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

@truph01
Copy link
Contributor

truph01 commented Oct 5, 2024

Edited by proposal-police: This proposal was edited at 2024-10-08 05:22:45 UTC.

Proposal

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

On step 3. There is "Pay with Expensify" and/or "Pay elsewhere" button for the expense
On step 5. "Make or track payments" is on

What is the root cause of that problem?

  • The reimbursementChoice is always reimburseManual when enabling policy workflows.

  • That leads to when user B create an expense on the workspace, there is "Pay with Expensify" and/or "Pay elsewhere" button for the expense, because canIOUBePaid is true:

const canIOUBePaid = useMemo(() => getCanIOUBePaid(), [getCanIOUBePaid]);

because of isPayer is true:

if (policy?.reimbursementChoice === CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_MANUAL || onlyShowPayElsewhere) {

It is why we encountered the bug: "There is "Pay with Expensify" and/or "Pay elsewhere" button for the expense" in OP.

  • Also, in workspace workflow page, if reimbursementChoice is reimburseManual, the toggle button is on:

isActive: policy?.reimbursementChoice !== CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_NO,

It is why we encountered the bug: ""Make or track payments" is on" in OP.

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

  • When creating a new workspace, the reimbursementChoice should be set to reimburseNo in optimistic data

  • BE needs to fix it so that the reimbursementChoice data has default value is reimburseNo when creating new workspace or when turning on policy workflows feature.

What alternative solutions did you explore? (Optional)

  • BE needs to fix it so that the reimbursementChoice data has default value is undefined when creating new workspace or when turning on policy workflows feature.

  • Then, we need to update condition:

isActive: policy?.reimbursementChoice !== CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_NO,

to:

                isActive: policy?.reimbursementChoice !== CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_NO && !!policy?.reimbursementChoice,

@dukenv0307
Copy link
Contributor

The reimbursementChoice is always reimburseManual when enabling policy workflows.

I think the reimburseManual is reimburseManual even when users create new WS, right?

@dukenv0307
Copy link
Contributor

dukenv0307 commented Oct 8, 2024

@truph01

I don't really understand your mean, we should show the Pay with EPSF or Pay elsewhere after users enable workflow so why should we do that?

When turning on workflow feature, the reimbursementChoice should be set to reimburseNo in optimistic data:

reimburseNo means the Pay with EPSF or Pay elsewhere is not shown?

@truph01
Copy link
Contributor

truph01 commented Oct 8, 2024

@dukenv0307 I’ve updated the proposal to provide more details in response to your questions.

@dukenv0307
Copy link
Contributor

Thanks @truph01. I like your main solution

🎀👀🎀 C+ reviewed

Copy link

melvin-bot bot commented Oct 8, 2024

Triggered auto assignment to @AndrewGable, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@melvin-bot melvin-bot bot added Overdue and removed Help Wanted Apply this label when an issue is open to proposals by contributors labels Oct 10, 2024
Copy link

melvin-bot bot commented Oct 10, 2024

📣 @dukenv0307 🎉 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 Oct 10, 2024

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

Offer link
Upwork job
Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@truph01
Copy link
Contributor

truph01 commented Oct 11, 2024

@AndrewGable Please help note this issue requires BE change, as I mentioned in proposal.

@AndrewGable
Copy link
Contributor

AndrewGable commented Oct 11, 2024

Ah got it - I will need a bit of time before digging into that, will let you know when I have some time available.

@adelekennedy
Copy link

working on PR!

@melvin-bot melvin-bot bot removed the Overdue label Oct 14, 2024
@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Oct 14, 2024
@truph01
Copy link
Contributor

truph01 commented Oct 14, 2024

It seems like the BE team is working on a fix based on this comment. In the meantime, @dukenv0307, could you please review the offline scenario for this PR?

@dukenv0307
Copy link
Contributor

@truph01 The PR looks good, but I think we should hold the PR for BE

@dukenv0307
Copy link
Contributor

@AndrewGable any updates on BE fix?

@AndrewGable
Copy link
Contributor

No - I am unable to look into this for the time being, focused on higher priority tasks.

@adelekennedy
Copy link

@dukenv0307 do we need to hold the PR for the BE fix if we can't prioritize that for now? Or should we drop the urgency of this issue until the BE is ready?

@dukenv0307
Copy link
Contributor

@adelekennedy Yeah, I think we can hold the PR for the BE fix cc @truph01

@adelekennedy adelekennedy added Monthly KSv2 and removed Weekly KSv2 labels Oct 24, 2024
@adelekennedy adelekennedy changed the title [$250] Expense - 'Pay elsewhere' button is present by default [HOLD][$250] Expense - 'Pay elsewhere' button is present by default Oct 24, 2024
@dukenv0307
Copy link
Contributor

@AndrewGable Any updates on this one?

@truph01
Copy link
Contributor

truph01 commented Dec 6, 2024

@AndrewGable Could you check this issue once you have a chance? Thanks

@dukenv0307
Copy link
Contributor

@AndrewGable any updates?

@dukenv0307
Copy link
Contributor

friendly bump @AndrewGable

@dukenv0307
Copy link
Contributor

@AndrewGable any updates?

@AndrewGable
Copy link
Contributor

Can you make a new internal backend issue and I can get this on the list for someone to work on? Thanks.

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. External Added to denote the issue can be worked on by a contributor Monthly KSv2 Reviewing Has a PR in review
Projects
No open projects
Status: Polish
Development

No branches or pull requests

5 participants