Skip to content

01a0234b - fix(buy): show and send exact CHF with rappen - #926

Merged
TaprootFreak merged 1 commit into
stagingfrom
feat/01a0234b-exact-chf-display
Aug 21, 2026
Merged

01a0234b - fix(buy): show and send exact CHF with rappen#926
TaprootFreak merged 1 commit into
stagingfrom
feat/01a0234b-exact-chf-display

Conversation

@TaprootFreak

Copy link
Copy Markdown
Contributor

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.

chargedFiatAmount snaps to Rappen only. Sell still sends an integer share count.

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
TaprootFreak marked this pull request as ready for review August 21, 2026 09:40
@TaprootFreak

Copy link
Copy Markdown
Contributor Author

EN:
Ready after 1 review pass.
Buy quotes and displays exact CHF with rappen instead of whole francs.

DE:
Bereit nach 1 Review-Durchlauf.
Kauf quotet und zeigt exakte CHF mit Rappen statt ganzen Franken.

Details

Required checks on bca07711: Analyze & Test, Visual Regression, Coverage Floor Gate all success. BitBox quirks audit success. Maestro handbook flows skipped without tier3:full (documented label gate). mergeable MERGEABLE. No open review threads or comments.

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 300,75 still becomes 301.

@TaprootFreak
TaprootFreak merged commit a6d204f into staging Aug 21, 2026
10 checks passed
@TaprootFreak
TaprootFreak deleted the feat/01a0234b-exact-chf-display branch August 21, 2026 10:40
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>
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