Repository navigation
fix(requests): show insufficient funds when a token can't cover the share - #1161
Merged
Merged
Conversation
…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.
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.
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.
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.payBlockcompares the full share to the balance).Session.pricecaps the amount at the balance, sohasSufficientFunds(for: amount)always passed. The check now uses the uncapped share fromselectedBalance.enteredFiat(for:rate:), the same quoteGiveViewModeluses. 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.