01a0234b - fix(buy): show and send exact CHF with rappen - #926
Merged
Conversation
Stop rounding the buy amount to whole francs. After a CHF-to-shares conversion, snap the field to shares times list so 7299 REALU at 1.37 quotes 9999.63, not 10000.
TaprootFreak
marked this pull request as ready for review
August 21, 2026 09:40
Contributor
Author
|
EN: DE: DetailsRequired checks on Grok prefilter on this head: 0 findings. One Codex logic note about sell double-rounding on four-decimal strings was declined: the sell amount field is digits-only whole shares, and |
TaprootFreak
added a commit
that referenced
this pull request
Aug 24, 2026
…able from state (#934) EN: The buy amount field keeps the typed value instead of being overwritten by the conversion. Quotes still use the Rappen-exact payable. Tests pin currency-switch and quote wiring so that regression cannot return silently. DE: Das Betragsfeld behält die Eingabe statt sie mit dem Umrechnungsergebnis zu überschreiben. Quotes laufen weiter über den rappengenauen Betrag. Tests pinnen Währungswechsel und Quote-Verdrahtung, damit die Regression nicht still zurückkommt. <details> <summary>Details</summary> Since #926 the conversion result was written back into `fiatText`, and the BuyView listener synced it into the amount TextField after every conversion. Editing became impossible: every keystroke or backspace was overwritten with shares × list price 250ms later (prefill 300 → 299.46; deleting digits snapped back to the next whole-share multiple and got stuck). Reported by a customer via RealUnit (only the default amount worked) and reproduced on-device. Fix: - Conversion results land in a new `payableText` only; `fiatText` always keeps the user's own text (typing in the shares field still converts into the fiat field, that path is unchanged output). - All quote requests (initial, listener re-fetch, gate retries in `PaymentActionButton`) use `quoteAmountText`: the Rappen-exact payable when a conversion is live, otherwise the typed amount. The #926 goal (quote and details in Rappen, no whole-franc rounding) stays intact. - The details page keeps rendering the charge echoed by the quote, unchanged. - Tests pin: deleting digits keeps the typed text; currency switch preserves `fiatText`; `getPaymentInfo` is called with the live payable rather than the field text. The exact charge is visible on the confirmation/details page. An optional display line under the field (`payableText` is already in state) is a product choice and is not part of this PR. `flutter analyze` clean on the touched files; `flutter test` of the three buy test files: 31 passed. </details> --------- Co-authored-by: TaprootFreak <142087526+TaprootFreak@users.noreply.github.com>
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.
EN:
The buy flow now shows and quotes exact CHF with rappen instead of rounding to whole francs.
DE:
Der Kauf zeigt und quotet exakte CHF mit Rappen, statt auf ganze Franken zu runden.
Details
Typing 10000 CHF for REALU at 1.37 yields 7299 shares. The field now snaps to 9999.63 (shares times list in Rappen), the quote request keeps that amount, and payment details render two decimal places.
chargedFiatAmountsnaps to Rappen only. Sell still sends an integer share count.