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] [$500] [CRITICAL] Delegated Splits - Allow selecting a payer from the splits page #40379

Closed
youssef-lr opened this issue Apr 17, 2024 · 70 comments
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

Comments

@youssef-lr
Copy link
Contributor

youssef-lr commented Apr 17, 2024

Implement this section of the Uneven Split Design Doc (the section is copied below if you can't access the document)

Context

Currently when creating a split, the current user is automatically set as the payer of the split and the person that needs to be paid back by the other participants.

Problem

We currently don't allow selecting a different payer of the split. There are real world use cases where we'd want to create a split on behalf of someone else. e.g.

You are heavily entrenched in the NewDot ecosystem and would like to utilize split with your social group. However, they are resistant to trying a new app. With Group Chat and delegated splits, you are able to create splits on their behalf. You are able to continue leveraging NewDot, your social circle can enjoy the benefits of NewDot in a hands-off environment, and Expensify reaps the benefits of a highly viral, member-driven strategy for gaining new customers.

Solution

Screenshot 2024-04-17 at 21 52 54

Enhance the split page by allowing the selection of a different payer by creating a payer selector page, which should display all of the splits participants and allow selecting one of them.

Implementation details

  1. We'll begin by adding a MenuItem in the MoneyTemporaryForRefactorRequestConfirmationList that will allow us to navigate to the new page:
<MenuItem
    label={translate('moneyRequestConfirmationList.paidBy')}
    description={personalDetailsOfPayer.login}
    title={personalDetailsOfPayee.displayName}
    icon={personalDetailsOfPayee.icons}
    onPress={() => }}
    shouldShowRightIcon
    titleWithTooltips={payeeTooltipDetails}
/>

Note: in the current code it's called a payee instead of payer. That's because the code is meant for all types of IOUs, we can keep it as payee, but in the context of splits the payee is the same as the payer (as they paid for the split bill).

The icon prop passed to the menu item is what allows us to display their avatar, so we should make use of ReportUtils.getIcons to retrieve them for the selected payer accountID by passing their personalDetails to it, which is already available in the confirmation page component.

  1. Create a new IOU request step page, called IOURequestStepSplitPayer This will work very similar to how we select a task assignee (we can copy most of the code from that page and adjust it), the navigation to this page will be triggered from the onPress handler in the MenuItem above.

  2. The navigation config of this new page should be consistent with other steps like amount, merchant, etc. It should have this route: create/split/confirmation/<transactionID>/<reportActionID>/payer

  3. The page will subscribe to the TRANSACTION_DRAFT Onyx key which will allow it to retrieve the split participants which we can then display similar to how we display a report’s participants, except we’ll also allow selecting one user from the list. The selected payer should have a green check mark next to it.

  4. Once a user is selected, it will call a new IOU action which will set the payer accountID in the transaction draft and then navigate the user back to the split page:

function setSplitPayer(transactionID: string, payerAccountID: number) {
    Onyx.merge(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID}`, {splitPayerAccountIDs: [payerAccountID]});
}

Note: we're planning to support multiple payers in the future. For now the splitPayerAccountIDs should hold a single accountID.

  1. Finally, we need to send the array of splitPayerAccoutIDs to the backend here which should be present in the Onyx transaction. Passed to splitBill from here.
Issue OwnerCurrent Issue Owner: @
Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01da88a2530aad1346
  • Upwork Job ID: 1787475123627106304
  • Last Price Increase: 2024-05-06
@youssef-lr youssef-lr added External Added to denote the issue can be worked on by a contributor Bug Something is broken. Auto assigns a BugZero manager. labels Apr 17, 2024
@youssef-lr youssef-lr self-assigned this Apr 17, 2024
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Apr 17, 2024
Copy link

melvin-bot bot commented Apr 17, 2024

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

@melvin-bot melvin-bot bot added the Daily KSv2 label Apr 17, 2024
Copy link

melvin-bot bot commented Apr 17, 2024

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

@youssef-lr youssef-lr changed the title [CRITICAL] Delegated Splits - Allow selecting a payer from the splits page [$500] [CRITICAL] Delegated Splits - Allow selecting a payer from the splits page Apr 17, 2024
Copy link

melvin-bot bot commented Apr 17, 2024

⚠️ Could not update price automatically because there is no linked Upwork Job ID. The BZ team member will need to update the price manually in Upwork.

@nkdengineer
Copy link
Contributor

Proposal

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

Allow selecting a payer from the splits page

What is the root cause of that problem?

This is a new feature

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

Since the implementation is detail enough and no need to add more solution. I'd love to work on this issue.

What alternative solutions did you explore? (Optional)

NA

@nkdengineer
Copy link
Contributor

@youssef-lr Do I need to update more detail in my proposal? I see that the implementation here #40379 (comment) is detail enough.

@youssef-lr
Copy link
Contributor Author

youssef-lr commented Apr 17, 2024

@nkdengineer Not really! If you can give this top priority, I'm ready to assign you!

@nkdengineer
Copy link
Contributor

@youssef-lr Sure, I can priority this.

@youssef-lr
Copy link
Contributor Author

Awesome, thanks!

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

Thanks, I will open PR early in the morning.

@kevinksullivan
Copy link
Contributor

Hi @nkdengineer thanks for taking this on! Full disclosure, this PR is associated with a deadline, so we need to get this done as quickly as possible. Like @youssef-lr said, this should be prioritized above any other work you are doing for us.

Also, please provide a daily update along with an ETA of when you expect this PR to be merged. As soon as you need a review or are blocked on moving this forward, post here and DM me on slack. Thank you!

@abzokhattab
Copy link
Contributor

can work on this now, PR can be ready in an hour if nkdengineer is not available tonight

@rafecolton rafecolton assigned rafecolton and unassigned youssef-lr Apr 17, 2024
@rafecolton
Copy link
Member

Taking over management of this issue from @youssef-lr

@nkdengineer
Copy link
Contributor

Hi @nkdengineer thanks for taking this on! Full disclosure, this PR is associated with a deadline, so we need to get this done as quickly as possible. Like @youssef-lr said, this should be prioritized above any other work you are doing for us.

Sure, I will priority this issue.

Also, please provide a daily update along with an ETA of when you expect this PR to be merged. As soon as you need a review or are blocked on moving this forward, post here and DM me on slack. Thank you!

I'm working on the PR, will open it in a few hours.

@rafecolton
Copy link
Member

Thanks @nkdengineer! I'll be on pretty early tomorrow, so I'm looking forward to seeing your progress! Is your Slack handle @NKDengineer?

@nkdengineer
Copy link
Contributor

Thanks @nkdengineer! I'll be on pretty early tomorrow, so I'm looking forward to seeing your progress! Is your Slack handle @nkdengineer?

@rafecolton Yes, this is my slack.

@melvin-bot melvin-bot bot added Reviewing Has a PR in review and removed Daily KSv2 labels Apr 18, 2024
@joekaufmanexpensify
Copy link
Contributor

Same

@joekaufmanexpensify
Copy link
Contributor

PR still in progress

@melvin-bot melvin-bot bot added the Overdue label May 27, 2024
@youssef-lr youssef-lr changed the title [$500] [CRITICAL] Delegated Splits - Allow selecting a payer from the splits page [HOLD] [$500] [CRITICAL] Delegated Splits - Allow selecting a payer from the splits page May 27, 2024
@youssef-lr
Copy link
Contributor Author

Holding this until we fix these issues and I'll continue working on it.

https://github.com/Expensify/Expensify/issues/323235
https://github.com/Expensify/Expensify/issues/395703
#42021
#30140

@youssef-lr youssef-lr added Weekly KSv2 and removed Daily KSv2 labels May 27, 2024
@melvin-bot melvin-bot bot removed the Overdue label May 27, 2024
@youssef-lr
Copy link
Contributor Author

@joekaufmanexpensify I think we can issue payments here, @nkdengineer and @dukenv0307 have worked on the original scope of the issue. This might take a while before I continue working on this as we need to refactor things a bit before continuing with the implementation https://expensify.slack.com/archives/C05RECHFBEW/p1716809169081189

@joekaufmanexpensify
Copy link
Contributor

Sounds good! I'm gonna hold off on adding a new regression test for now, since it seems like this feature is not live yet. But happy to issue payment.

@joekaufmanexpensify
Copy link
Contributor

Payment summary is here.

@joekaufmanexpensify
Copy link
Contributor

@nkdengineer $500 sent and contract ended!

@joekaufmanexpensify
Copy link
Contributor

@dukenv0307 $500 sent and contract ended!

@joekaufmanexpensify
Copy link
Contributor

Upwork job closed.

@joekaufmanexpensify
Copy link
Contributor

internal portions are held

@youssef-lr
Copy link
Contributor Author

We've paused working on this based on https://expensify.slack.com/archives/CC7NECV4L/p1717525527830119

@joekaufmanexpensify joekaufmanexpensify added Monthly KSv2 and removed Weekly KSv2 labels Jun 10, 2024
@joekaufmanexpensify
Copy link
Contributor

Sounds good!

@joekaufmanexpensify
Copy link
Contributor

Still paused

@melvin-bot melvin-bot bot added the Overdue label Jul 11, 2024
@rafecolton
Copy link
Member

Still paused

@melvin-bot melvin-bot bot removed the Overdue label Jul 11, 2024
@joekaufmanexpensify
Copy link
Contributor

Still paused

@joekaufmanexpensify
Copy link
Contributor

Same

@joekaufmanexpensify
Copy link
Contributor

Same.

@joekaufmanexpensify
Copy link
Contributor

@youssef-lr is there anything left here, or are we good to close this one? The #vip-split project got closed in GH, so trying to determine whether we should move this to another project, or just close.

@joekaufmanexpensify
Copy link
Contributor

@youssef-lr P2P isn't going to be prioritized anytime soon, so feels like no reason to leave this open for now. We can always revisit this when it is prioritized again if there is anything left to do here.

I'm going to go ahead and close this one for now, but feel free to LMK if you disagree with that!

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
Projects
None yet
Development

No branches or pull requests

9 participants