Skip to content

fix(requests): show insufficient funds when a token can't cover the share - #1161

Merged
bmc08gt merged 5 commits into
mainfrom
fix/request-pay-insufficient-funds
Oct 29, 2026
Merged

bmc08gt merged 5 commits into
mainfrom
fix/request-pay-insufficient-funds

Conversation

@bmc08gt

@bmc08gt bmc08gt commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

Paying a request share from a token that doesn't cover it sent a short amount instead of showing the insufficient funds dialog. A $1 share paid from $0.72 of Launch It sent $0.72, the server rejected it with payment must pay the share exactly: paid 0.724055, share is 1 USD, and the app showed Couldn't Send. Android shows insufficient funds here (RequestPayFlow.payBlock compares the full share to the balance).

Session.price caps the amount at the balance, so hasSufficientFunds(for: amount) always passed. The check now uses the uncapped share from selectedBalance.enteredFiat(for:rate:), the same quote GiveViewModel uses. The capped amount is still what gets sent, so the half-cent rounding tolerance still applies.

The dialog's subtitle also changes for requests: a share can't be lowered, so "try again with a lower amount" becomes "select a different Community Currency". Android gets the same copy in code-payments/code-android-app#1879.

On the sim, the same request and balance now show "You're $0.28 Short" with Add More Cash, and nothing is sent.

…hare

Session.price caps the amount at the token balance, so the balance check
before sending always passed. Paying a $1 share from $0.72 of Launch It
sent $0.72 and the server rejected it ("payment must pay the share
exactly"), which showed Couldn't Send.

The check now uses the uncapped share from enteredFiat(for:rate:), as
GiveViewModel does, so the swipe shows the insufficient funds dialog.
The capped amount is still what gets sent.
@bmc08gt bmc08gt self-assigned this Oct 29, 2026
A request share is a fixed amount, so "try again with a lower amount" had no way to act on it. The subtitle now points at paying with a different currency.
Resolving on main moves swift-nio-http2 1.44.0 -> 1.46.0 and swift-system 1.6.4 -> 1.8.1 and changes originHash, so the checked-in file was out of date with the manifests.
@bmc08gt
bmc08gt merged commit d08b715 into main Oct 29, 2026
4 checks passed
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