Skip to content

feat(chat): send cash into a group chat as a cash link - #1574

Merged
bmc08gt merged 1 commit into
code/cashfrom
feat/group-chat-cash-link
Sep 25, 2026
Merged

bmc08gt merged 1 commit into
code/cashfrom
feat/group-chat-cash-link

Conversation

@bmc08gt

@bmc08gt bmc08gt commented Sep 25, 2026

Copy link
Copy Markdown
Collaborator

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. LinkCardClassifier already turns a link-only message into a LinkCard.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

  • Send path. ChatCashLinks.sendToChat is a new entry point in :shared:session. It creates a gift card, funds it, then posts Linkify.cashLink(entropy) through ChatCoordinator.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 under NonCancellable, so leaving the chat mid-send can't strand a funded link that was never posted.
  • Shared funding. Funding and cancelling move out of GiftCardSharingDelegate into GiftCardFunding, 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.
  • Chat. OnSendCash now lets a group through and skips the tip-DM fee branch. The null participant arm of OnSendRequested calls sendToChat, then uses the existing send state, SendComplete, and error handling. ChatBottomBar drops the group check.
  • Analytics. Sent Cash has no property for where the cash went, so a group send reports Send Cash Link with a new Cash Link Choice value, Posted to group chat. It reports Failure too, which the drift note in events.toml now records. EVENTS.md is regenerated.

No proto change: the message is plain text, and group CashContent stays reserved.

Out of scope: ProfileShortcuts.kt's commented-out onSendCash and the orphaned GiftCardFundingWorker.

Tests

  • ChatCashLinkDelegateTest: funds then posts exactly the URL; a failed post cancels the gift card; a failed fund posts nothing.
  • ChatGroupCashLinkTest: a group OnSendCash opens amount entry; a group send goes to ChatCashLinks and reports Send Cash Link; contact and tip sends still go to their delegates.
  • TransferEventsTest: the new Cash Link Choice value.

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.
@bmc08gt bmc08gt self-assigned this Sep 25, 2026
@github-actions github-actions Bot added type: feature New functionality area: session and removed type: feature New functionality labels Sep 25, 2026
@bmc08gt
bmc08gt merged commit d5bb203 into code/cash Sep 25, 2026
4 checks passed
bmc08gt added a commit that referenced this pull request Sep 26, 2026
#1576 added recentReactionsStore, emojiCatalogLoader, toastController
and userProfileDataSource to ChatViewModel and updated the tests that
built it, but ChatGroupCashLinkTest came in with #1574 just before and
was missed. On code/cash the messenger unit tests do not compile.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant