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 /packages/bank-ui/src/pages | |
parent | 689d58a5c79e98fec733c3cda31146620d8bde1d (diff) | |
download | wallet-core-d96c47a00a34244f790d544aeed29e9880ae578d.tar.xz |
fix #8886 actually, fee are added not substracted
Diffstat (limited to 'packages/bank-ui/src/pages')
-rw-r--r-- | packages/bank-ui/src/pages/PaytoWireTransferForm.tsx | 50 |
1 files changed, 11 insertions, 39 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; |