Skip to content

fix(tip): round a converted DM fee floor up - #889

Merged
bmc08gt merged 1 commit into
mainfrom
fix/tip-floor-rounding
Sep 28, 2026
Merged

bmc08gt merged 1 commit into
mainfrom
fix/tip-floor-rounding

Conversation

@bmc08gt

@bmc08gt bmc08gt commented Sep 28, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes Bugsnag 6a67781: "tip below the recipient's chat initialization fee", 117 events from 22 users, still firing on 2026.9.1 and 2026.9.2.

TipFloor.toOpenDM converts the recipient's fee into the sender's currency, and converted(to:rates:) rounds that to the nearest cent. The Start Chatting sheet submits exactly that floor. When the conversion lands under the half cent, the floor comes out below the fee: 600 INR at 95.95 INR/USD is $6.2533, stated as $6.25, which is 599.69 INR. The client check passes because it compares against the same rounded figure, and the server denies the tip.

converted(to:rates:) now takes a roundingUp flag, backed by FiatAmount.ceiledToSmallestUnit() and Decimal.roundedUp(to:). toOpenDM is the only caller that sets it, so display conversions still round half-up. A fee that converts exactly is unchanged.

Regression_6a677815fdca5cb0d6a9ef7e covers the INR case above, an entry of $6.25 no longer clearing that floor, a 1500 NGN fee at 1326 NGN/USD, and an exact conversion that stays at $6.00.

Android has the same rounding in TipPaymentDelegate.inCurrency; the fix is code-payments/code-android-app#1597.

A second path to a similar denial is still open on both platforms: toOpenDM never checks the recipient's fee against the regional tip-preset minimum.

The Start Chatting sheet submits the floor TipFloor.toOpenDM states, and
that floor rounded the converted fee to the nearest cent. A 600 INR fee
at 95.95 INR/USD is $6.2533, stated as $6.25, which is 599.69 INR. The
client accepted it and the server denied it (Bugsnag 6a67781).

converted(to:rates:) takes a roundingUp flag and toOpenDM is the only
caller that sets it, so display conversions still round half-up. A fee
that converts exactly is unchanged.
@bmc08gt
bmc08gt force-pushed the fix/tip-floor-rounding branch from 52dd82b to dde9c26 Compare September 28, 2026 18:44
@bmc08gt
bmc08gt merged commit f0b159f into main Sep 28, 2026
1 check failed
bmc08gt added a commit that referenced this pull request Oct 1, 2026
`let floor = try #require(floor(for: ...))` resolves `floor` to the local
being declared once #require expands, so Xcode 26.3 fails with "cannot
call value of non-function type 'TipFloor'". That broke App vectors
(build) in the vector gate on every run since #889. Rename the helper to
statedFloor(for:).
@bmc08gt
bmc08gt deleted the fix/tip-floor-rounding branch October 5, 2026 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant