aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-webextension/src/components
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2024-03-06 21:15:30 +0100
committerFlorian Dold <florian@dold.me>2024-03-07 00:03:59 +0100
commit7ba1d1f3351e58a331e99337afea0fbedb6eb828 (patch)
tree60b7a485cd317c1fe55276acdc0e055cd9353bfb /packages/taler-wallet-webextension/src/components
parent618caa117111b9fed6a792b6816fc724483eb349 (diff)
downloadwallet-core-7ba1d1f3351e58a331e99337afea0fbedb6eb828.tar.xz
refactor coin selection, report maxEffectiveSpendAmount
Diffstat (limited to 'packages/taler-wallet-webextension/src/components')
-rw-r--r--packages/taler-wallet-webextension/src/components/PaymentButtons.tsx22
1 files changed, 13 insertions, 9 deletions
diff --git a/packages/taler-wallet-webextension/src/components/PaymentButtons.tsx b/packages/taler-wallet-webextension/src/components/PaymentButtons.tsx
index 8cb1c49dd..731bcfed9 100644
--- a/packages/taler-wallet-webextension/src/components/PaymentButtons.tsx
+++ b/packages/taler-wallet-webextension/src/components/PaymentButtons.tsx
@@ -22,20 +22,19 @@ import {
PreparePayResultType,
TranslatedString,
parsePayUri,
- stringifyPayUri,
} from "@gnu-taler/taler-util";
-import { Fragment, h, VNode } from "preact";
+import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
+import { useTranslationContext } from "@gnu-taler/web-util/browser";
+import { Fragment, VNode, h } from "preact";
import { useState } from "preact/hooks";
+import { useBackendContext } from "../context/backend.js";
+import { Button } from "../mui/Button.js";
+import { ButtonHandler } from "../mui/handlers.js";
+import { assertUnreachable } from "../utils/index.js";
import { Amount } from "./Amount.js";
import { Part } from "./Part.js";
import { QR } from "./QR.js";
import { LinkSuccess, WarningBox } from "./styled/index.js";
-import { useTranslationContext } from "@gnu-taler/web-util/browser";
-import { Button } from "../mui/Button.js";
-import { ButtonHandler } from "../mui/handlers.js";
-import { assertUnreachable } from "../utils/index.js";
-import { useBackendContext } from "../context/backend.js";
-import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
interface Props {
payStatus: PreparePayResult;
@@ -118,7 +117,12 @@ export function PaymentButtons({
}
case "fee-gap": {
BalanceMessage = i18n.str`Balance looks like it should be enough, but doesn't cover all fees requested by the merchant and payment processor. Please ensure there is at least ${Amounts.stringifyValue(
- payStatus.balanceDetails.feeGapEstimate,
+ Amounts.stringify(
+ Amounts.sub(
+ amount,
+ payStatus.balanceDetails.maxEffectiveSpendAmount,
+ ).amount,
+ ),
)} ${
amount.currency
} more balance in your wallet or ask your merchant to cover more of the fees.`;