diff options
Diffstat (limited to 'packages/taler-wallet-webextension')
3 files changed, 20 insertions, 22 deletions
diff --git a/packages/taler-wallet-webextension/src/components/HistoryItem.tsx b/packages/taler-wallet-webextension/src/components/HistoryItem.tsx index 9be9326b2..8e48a2e9f 100644 --- a/packages/taler-wallet-webextension/src/components/HistoryItem.tsx +++ b/packages/taler-wallet-webextension/src/components/HistoryItem.tsx @@ -26,7 +26,7 @@ import { DenomLossEventType, parsePaytoUri, } from "@gnu-taler/taler-util"; -import { h, VNode } from "preact"; +import { Fragment, h, VNode } from "preact"; import { useTranslationContext } from "@gnu-taler/web-util/browser"; import { Avatar } from "../mui/Avatar.js"; import { Pages } from "../NavigationBar.js"; @@ -49,6 +49,8 @@ export function HistoryItem(props: { tx: Transaction }): VNode { */ switch (tx.type) { case TransactionType.Withdrawal: + //withdrawal that has not been confirmed are hidden + if (!tx.exchangeBaseUrl) return <Fragment /> return ( <Layout id={tx.transactionId} diff --git a/packages/taler-wallet-webextension/src/cta/Withdraw/state.ts b/packages/taler-wallet-webextension/src/cta/Withdraw/state.ts index 90ad65d6e..da3b1eeb2 100644 --- a/packages/taler-wallet-webextension/src/cta/Withdraw/state.ts +++ b/packages/taler-wallet-webextension/src/cta/Withdraw/state.ts @@ -213,10 +213,7 @@ export function useComponentStateFromURI({ const uriInfo = await api.wallet.call( WalletApiOperation.PrepareBankIntegratedWithdrawal, - { - talerWithdrawUri, - selectedExchange: updatedExchangeByUser, - }, + { talerWithdrawUri }, ); const { amount, @@ -225,12 +222,12 @@ export function useComponentStateFromURI({ confirmTransferUrl, status, } = uriInfo.info; - const txInfo = - uriInfo.transactionId === undefined - ? undefined - : await api.wallet.call(WalletApiOperation.GetTransactionById, { - transactionId: uriInfo.transactionId, - }); + const txInfo = await api.wallet.call( + WalletApiOperation.GetTransactionById, + { + transactionId: uriInfo.transactionId, + }, + ); return { talerWithdrawUri, status, @@ -292,9 +289,6 @@ export function useComponentStateFromURI({ transactionId: string; confirmTransferUrl: string | undefined; }> { - if (!txId) { - throw Error("can't confirm transaction"); - } const res = await api.wallet.call(WalletApiOperation.ConfirmWithdrawal, { exchangeBaseUrl: exchange, amount, @@ -370,15 +364,16 @@ function exchangeSelectionState( onExchangeUpdated(current); } }, [current]); - - const safeAmount = !infoAmount ? Amounts.zeroOfCurrency(currency) : infoAmount - const [choosenAmount, setChoosenAmount] = useState(safeAmount) + + const safeAmount = !infoAmount + ? Amounts.zeroOfCurrency(currency) + : infoAmount; + const [choosenAmount, setChoosenAmount] = useState(safeAmount); if (selectedExchange.status !== "ready") { return selectedExchange; } - return useCallback((): | State.Success | State.LoadingUriError @@ -520,8 +515,8 @@ function exchangeSelectionState( amount: { value: choosenAmount, onInput: pushAlertOnError(async (v) => { - setChoosenAmount(v) - }) + setChoosenAmount(v); + }), }, talerWithdrawUri, ageRestriction, diff --git a/packages/taler-wallet-webextension/src/cta/Withdraw/test.ts b/packages/taler-wallet-webextension/src/cta/Withdraw/test.ts index 785fab996..5bbf5f6c8 100644 --- a/packages/taler-wallet-webextension/src/cta/Withdraw/test.ts +++ b/packages/taler-wallet-webextension/src/cta/Withdraw/test.ts @@ -26,6 +26,7 @@ import { ExchangeListItem, ExchangeTosStatus, ScopeType, + TransactionIdStr, } from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { expect } from "chai"; @@ -111,7 +112,7 @@ describe("Withdraw CTA states", () => { WalletApiOperation.PrepareBankIntegratedWithdrawal, undefined, { - transactionId: "123", + transactionId: "123" as TransactionIdStr, info: { status: "pending", operationId: "123", @@ -153,7 +154,7 @@ describe("Withdraw CTA states", () => { WalletApiOperation.PrepareBankIntegratedWithdrawal, undefined, { - transactionId: "123", + transactionId: "123" as TransactionIdStr, info: { status: "pending", operationId: "123", |