fix: align withdraw minimum, gate, and summary math#223
Merged
Conversation
The amount-screen minimum and the summary's "Less fee"/"Net amount" used to compute through different rounding paths, producing user-visible math mismatches at certain rates (e.g. minimum displayed as ¥80 with summary fee shown as ¥78). Display, gate, and summary now derive from one half-up-rounded fee × rate, so the three numbers always match. The Next button below the fee is enabled and surfaces a "Withdrawal Amount Too Small" dialog instead of being silently disabled. Subtitle copy reads "Minimum withdrawal X" in red. Verified-state and submission paths are unchanged.
NumberFormatter.decimal(from:) is locale-aware and parses "0.69" as 0 on non-"." separator locales (and through the .none-style fallback in the parse chain), so isBelowMinimumWithdraw fired even when the user entered exactly the displayed minimum. The keypad always emits "." regardless of device locale, matching what Decimal(string:) expects — and what EnterAmountView.isExceedingLimit already uses.
Captures the locale-parsing trap that wasted hours on the withdraw minimum gate. NumberFormatter.decimal(from:) silently parses "0.69" as 0 on non-"." locales; Decimal(string:) is the established pattern for keypad input and matches EnterAmountView.isExceedingLimit.
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.
Summary
Below-fee withdrawals now surface a dialog from Next instead of disabling the button silently, with the floor shown as "Minimum withdrawal X" in red. Displayed minimum, the validation gate, and the summary's fee/net all derive from one rounded fee value, so the three numbers stay consistent across rates and currencies. Verified-state and submission paths are untouched.
Test plan