Repository navigation
feat(messenger): group requests take a total split between people - #1917
Merged
Merged
Conversation
The amount entry now asks for the total, titled Total Amount, and the summary labels it total. Select People reads Split Between in the request flow; group send keeps its title. The total is split in the currency's smallest unit: each share gets floor(T/N) and the T mod N leftover units go one each to the first non-creator shares in roster order, so the shares sum to T. Request is disabled when T < N. Each share's native_amount now comes from that split, and the button reads "Request <largest share> Each".
When the total does not divide evenly, the summary button shows the smaller share with a tilde: $100 split three ways reads "Request ~$33.33 Each" instead of "Request $33.34 Each". An even split keeps the exact share. The label under the amount reads "Total".
Created's amount was the largest share. It is now the total the creator typed, which is what iOS sends (Analytics.paymentRequestCreated in PaymentRequestCreateViewModel.swift). The catalogue description and EVENTS.md say so.
This was referenced Oct 31, 2026
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 payment requests now take the total the creator wants back, not an amount per person. The app splits that total between everyone checked, per the "Splitting the total" section of the spec in code-payments/flipcash-client-orchestrator#85.
Splitting
splitTotalinNewRequestDraft.ktworks in the currency's smallest unit. With a total of T units and N shares, each share getsfloor(T / N). TheT mod Nunits left over go one each to the first non-creator shares in roster order. The creator's share takes a unit only once every other share has one, since that share is marked paid at creation. Shares always sum to T. When T < N there's no valid split, socanSendis false and Request stays disabled.$100 between the creator and two others comes out as $33.33 (creator), $33.34, $33.33.
NewSplitRequest.sharesis now a list ofNewShare(userId, amount), andasGroupChatPaymentRequestsets each share'snative_amountfrom its own amount. The singleperPersonfield is gone.Copy
GroupSelectPeopleContenttakes atitle, and group send keeps the "Select People" default.<share>Each" and updates as the selection changes. When the total splits evenly,<share>is the exact share. When it doesn't,<share>is the smaller share with "~" in front, since some shares are a cent more: $100 between three reads "Request ~$33.33 Each", and $100.02 between three reads "Request $33.34 Each". This replaces theaction_requestFromPeopleplural.Analytics
"Payment Request: Created" now reports the total as its amount, not the largest share, so $100 split three ways reports $100. iOS already sends the total (
Analytics.paymentRequestCreated(payerCount:amount:error:)inPaymentRequestCreateViewModel.swift). The event's description inevents.tomlandEVENTS.mdsays the amount is the request's total, split between everyone in it, the creator included when they are.Tests
NewRequestDraftTestcovers spec cases 14, 15 and 49–53: the even splits, the remainder skipping the creator, a deselected creator, and a total too small to split.RequestCopyTestchecks the button for cases 49 and 53, with and without "~".RequestMoneyAnalyticsTestchecks that a $5 request between the creator and two others reports $5.