diff options
author | Sebastian <sebasjm@gmail.com> | 2024-06-10 17:54:25 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2024-06-10 17:54:25 -0300 |
commit | d96c47a00a34244f790d544aeed29e9880ae578d (patch) | |
tree | af8906c2dfffd27d323ccf4e13be3a3d93e8954d | |
parent | 689d58a5c79e98fec733c3cda31146620d8bde1d (diff) | |
download | wallet-core-d96c47a00a34244f790d544aeed29e9880ae578d.tar.xz |
fix #8886 actually, fee are added not substracted
-rw-r--r-- | packages/bank-ui/src/pages/PaytoWireTransferForm.tsx | 50 | ||||
-rw-r--r-- | packages/taler-util/src/http-client/types.ts | 4 |
2 files changed, 14 insertions, 40 deletions
diff --git a/packages/bank-ui/src/pages/PaytoWireTransferForm.tsx b/packages/bank-ui/src/pages/PaytoWireTransferForm.tsx index bb408e497..90b41d331 100644 --- a/packages/bank-ui/src/pages/PaytoWireTransferForm.tsx +++ b/packages/bank-ui/src/pages/PaytoWireTransferForm.tsx @@ -114,14 +114,8 @@ export function PaytoWireTransferForm({ const wireFee = config.wire_transfer_fees === undefined ? Amounts.zeroOfCurrency(config.currency) - // Amounts.parseOrThrow("YEIN:2.5") : Amounts.parseOrThrow(config.wire_transfer_fees); - const amountAfterFee = - !parsedAmount || Amounts.cmp(parsedAmount, wireFee) < 1 - ? undefined - : Amounts.sub(parsedAmount, wireFee).amount; - const errorsWire = undefinedIfEmpty({ account: !account ? i18n.str`Required` @@ -634,16 +628,16 @@ export function PaytoWireTransferForm({ </div> )} </div> - <div class="px-4 my-4"> - <div class="grid max-w-2xl grid-cols-1 gap-x-6 gap-y-8 sm:grid-cols-6"> - <div class="sm:col-span-6"> - <dl class="mt-4 space-y-4"> - {Amounts.isZero(wireFee) ? undefined : ( + {Amounts.isZero(wireFee) ? undefined : ( + <div class="px-4 my-4"> + <div class="grid max-w-2xl grid-cols-1 gap-x-6 gap-y-8 sm:grid-cols-6"> + <div class="sm:col-span-6"> + <dl class="mt-4 space-y-4"> <Fragment> <div class="flex items-center justify-between "> <dt class="flex items-center text-sm text-gray-600"> <span> - <i18n.Translate>Fee</i18n.Translate> + <i18n.Translate>Cost</i18n.Translate> </span> </dt> <dd class="text-sm text-gray-900"> @@ -656,31 +650,11 @@ export function PaytoWireTransferForm({ </dd> </div> </Fragment> - )}{" "} - {!parsedAmount || !amountAfterFee ? undefined : ( - <Fragment> - <div class="flex items-center justify-between border-t-2 afu pt-4"> - <dt class="flex items-center text-sm text-gray-600"> - <span> - <i18n.Translate> - Recipient will receive - </i18n.Translate> - </span> - </dt> - <dd class="text-sm text-gray-900"> - <RenderAmount - value={amountAfterFee} - withColor - spec={config.currency_specification} - /> - </dd> - </div> - </Fragment> - )} - </dl> + </dl> + </div> </div> </div> - </div> + )} <div class="flex items-center justify-between gap-x-6 border-t border-gray-900/10 px-4 py-4 sm:px-8"> {routeCancel ? ( <a @@ -895,10 +869,8 @@ function validateAmount( if (Amounts.isZero(amount)) { return i18n.str`Can't transfer zero amount`; } - if (Amounts.cmp(amount, fee) < 1) { - return i18n.str`Should be higher than fees`; - } - if (Amounts.cmp(limit, amount) === -1) { + const amountWithFee = Amounts.add(amount, fee).amount; + if (Amounts.cmp(limit, amountWithFee) === -1) { return i18n.str`Balance is not enough`; } return undefined; diff --git a/packages/taler-util/src/http-client/types.ts b/packages/taler-util/src/http-client/types.ts index f05bbc91a..0ef0bd65a 100644 --- a/packages/taler-util/src/http-client/types.ts +++ b/packages/taler-util/src/http-client/types.ts @@ -360,6 +360,7 @@ export const codecForCoreBankConfig = (): Codec<TalerCorebankApi.Config> => ), ) .property("wire_type", codecOptionalDefault(codecForString(), "iban")) + .property("wire_transfer_fees", codecOptional(codecForAmountString())) .build("TalerCorebankApi.Config"); //FIXME: implement this codec @@ -1312,10 +1313,11 @@ export const codecForBankWithdrawalOperationStatus = ), ) .property("amount", codecOptional(codecForAmountString())) + .property("currency", codecOptional(codecForCurrencyName())) .property("suggested_amount", codecOptional(codecForAmountString())) .property("card_fees", codecOptional(codecForAmountString())) .property("sender_wire", codecOptional(codecForPaytoString())) - .property("suggested_exchange", codecOptional(codecForString())) + .property("suggested_exchange", codecOptional(codecForURL())) .property("confirm_transfer_url", codecOptional(codecForURL())) .property("wire_types", codecForList(codecForString())) .property("selected_reserve_pub", codecOptional(codecForString())) |