taler-typescript-core

Wallet core logic and WebUIs for various components
Log | Files | Refs | Submodules | README | LICENSE

commit 1f33c7b37ecf4a6ca476b387fc526885753ad572
parent 1a3f894084bde73ca0663b4fce449648ee483ea9
Author: Sebastian <sebasjm@gmail.com>
Date:   Thu, 25 Sep 2025 16:09:19 -0300

fix #10459

Diffstat:
Mpackages/bank-ui/src/pages/regional/CreateCashout.tsx | 27++++++++++++++-------------
1 file changed, 14 insertions(+), 13 deletions(-)

diff --git a/packages/bank-ui/src/pages/regional/CreateCashout.tsx b/packages/bank-ui/src/pages/regional/CreateCashout.tsx @@ -233,7 +233,7 @@ export function CreateCashout({ ); const higerThanMin = form.isDebit - ? Amounts.cmp(inputAmount, rate.cashout_min_amount) === 1 + ? Amounts.cmp(inputAmount, rate.cashout_min_amount) >= 0 : true; const notZero = Amounts.isNonZero(inputAmount); @@ -269,7 +269,7 @@ export function CreateCashout({ doAsync(); }, [form.amount, form.isDebit, notZero, higerThanMin, rate.cashout_fee]); - const calc = + const calc = calculationResult === "amount-is-too-small" ? zeroCalc : calculationResult; const balanceAfter = IntAmounts.toIntAmount( @@ -286,20 +286,20 @@ export function CreateCashout({ ? i18n.str`Required` : !inputAmount ? i18n.str`Invalid` - : Amounts.isZero( - balanceLimit.deduce(calc.debit).getResultZeroIfNegative(), - ) - ? i18n.str`Balance is not enough` - : calculationResult === "amount-is-too-small" - ? i18n.str`Amount needs to be higher` - : Amounts.cmp(calc.debit, rate.cashout_min_amount) < 0 + : calculationResult === "amount-is-too-small" + ? i18n.str`Amount needs to be higher` + : Amounts.isZero( + balanceLimit.deduce(calculationResult.debit).getResultZeroIfNegative(), + ) + ? i18n.str`Balance is not enough` + : Amounts.cmp(calculationResult.debit, rate.cashout_min_amount) < 0 ? i18n.str`It is not possible to cashout less than ${ Amounts.stringifyValueWithSpec( Amounts.parseOrThrow(rate.cashout_min_amount), regional_currency_specification, ).normal - }` - : Amounts.isZero(calc.credit) + }: ${Amounts.stringify(calculationResult.debit)}` + : Amounts.isZero(calculationResult.credit) ? i18n.str`The total transfer to the destination will be zero` : undefined, }); @@ -753,7 +753,7 @@ export interface IntAmountJson extends AmountJson { /** * Helper to manipulate amounts that can be negative. - * + * */ export class IntAmounts { readonly result: IntAmountJson; @@ -779,7 +779,8 @@ export class IntAmounts { getResultZeroIfNegative(): IntAmountJson { return this.result.negative - ? IntAmounts.toIntAmount(Amounts.zeroOfCurrency(this.result.currency)).result + ? IntAmounts.toIntAmount(Amounts.zeroOfCurrency(this.result.currency)) + .result : this.result; } /**