aboutsummaryrefslogtreecommitdiff
path: root/packages/bank-ui/src/pages/PaytoWireTransferForm.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'packages/bank-ui/src/pages/PaytoWireTransferForm.tsx')
-rw-r--r--packages/bank-ui/src/pages/PaytoWireTransferForm.tsx50
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;