Repository navigation
feat(chat): send cash into a group chat as a cash link - #1574
Merged
Merged
Conversation
The $ button was hidden in group chats because a group has no single participant to pay. It now opens the chat's amount sheet, and on confirm the app funds a cash link and posts its bare URL into the group. The transcript already draws a link-only message as a cash card, so the card shows the amount and the first member to tap it claims the funds. The link is funded before anything is posted. If the post fails, the gift card's remote send is cancelled so the funds return. The send runs under NonCancellable so leaving the chat mid-send can't strand a funded link that was never posted. Funding and cancelling move out of GiftCardSharingDelegate into GiftCardFunding so the bill's "Send as Link" and the group send share one path. ChatCashLinks is a new entry point in :shared:session; ChatViewModel routes a group send to it and skips the tip-DM fee check. Analytics reports the group send as Send Cash Link with a new Cash Link Choice value, "Posted to group chat", since Sent Cash has no way to say where the cash went.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Group chats hid the
$button because a group has no single participant to pay. This lets a group send cash as a cash link: the app funds the link and posts its bare URL into the group as an ordinary text message.LinkCardClassifieralready turns a link-only message into aLinkCard.Cash, so the transcript shows the card with the amount and no text bubble. The first member to tap it claims the funds.Brief: code-payments/flipcash-client-orchestrator#22.
What changes
ChatCashLinks.sendToChatis a new entry point in:shared:session. It creates a gift card, funds it, then postsLinkify.cashLink(entropy)throughChatCoordinator.sendMessage. Nothing is posted unless funding succeeds. If the post fails, it cancels the remote send so the funds return, and reports the failure. It runs underNonCancellable, so leaving the chat mid-send can't strand a funded link that was never posted.GiftCardSharingDelegateintoGiftCardFunding, so the bill's "Send as Link" and the group send use one path. The bill path keeps its own error UI and bill dismissal.OnSendCashnow lets a group through and skips the tip-DM fee branch. Thenullparticipant arm ofOnSendRequestedcallssendToChat, then uses the existing send state,SendComplete, and error handling.ChatBottomBardrops the group check.Sent Cashhas no property for where the cash went, so a group send reportsSend Cash Linkwith a newCash Link Choicevalue,Posted to group chat. It reports Failure too, which thedriftnote inevents.tomlnow records.EVENTS.mdis regenerated.No proto change: the message is plain text, and group
CashContentstays reserved.Out of scope:
ProfileShortcuts.kt's commented-outonSendCashand the orphanedGiftCardFundingWorker.Tests
ChatCashLinkDelegateTest: funds then posts exactly the URL; a failed post cancels the gift card; a failed fund posts nothing.ChatGroupCashLinkTest: a groupOnSendCashopens amount entry; a group send goes toChatCashLinksand reportsSend Cash Link; contact and tip sends still go to their delegates.TransferEventsTest: the newCash Link Choicevalue.