From efbde0e16033542ae104f5365be5cee6e65ef7b0 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 29 Mar 2023 00:06:24 -0300 Subject: handle kyc error on invoice and transfer --- .../src/wallet/DeveloperPage.tsx | 21 ++++++++++++++------- .../src/wallet/Transaction.tsx | 15 ++++++++------- 2 files changed, 22 insertions(+), 14 deletions(-) (limited to 'packages/taler-wallet-webextension') diff --git a/packages/taler-wallet-webextension/src/wallet/DeveloperPage.tsx b/packages/taler-wallet-webextension/src/wallet/DeveloperPage.tsx index 2db2041d4..339e69213 100644 --- a/packages/taler-wallet-webextension/src/wallet/DeveloperPage.tsx +++ b/packages/taler-wallet-webextension/src/wallet/DeveloperPage.tsx @@ -140,12 +140,19 @@ export function View({ }); } const api = useBackendContext(); + const fileRef = useRef(null); async function onImportDatabase(str: string): Promise { return api.wallet.call(WalletApiOperation.ImportDb, { dump: JSON.parse(str), }); } + + const hook = useAsyncAsHook(() => + api.wallet.call(WalletApiOperation.ListExchanges, {}), + ); + const exchangeList = hook && !hook.hasError ? hook.response.exchanges : []; + const currencies: { [ex: string]: string } = {}; const money_by_exchange = coins.reduce( (prev, cur) => { @@ -171,7 +178,6 @@ export function View({ [exchange_name: string]: CalculatedCoinfInfo[]; }, ); - const exchanges = Object.keys(money_by_exchange); const [tagName, setTagName] = useState(""); const [logLevel, setLogLevel] = useState("info"); @@ -324,27 +330,28 @@ export function View({ variant="contained" onClick={async () => { const result = await Promise.all( - exchanges.map(async (ex) => { + exchangeList.map(async (exchange) => { + const url = exchange.exchangeBaseUrl; const oldKeys = JSON.stringify( - await (await fetch(`${ex}keys`)).json(), + await (await fetch(`${url}keys`)).json(), ); const oldWire = JSON.stringify( - await (await fetch(`${ex}wire`)).json(), + await (await fetch(`${url}wire`)).json(), ); const newKeys = JSON.stringify( await ( - await fetch(`${ex}keys`, { cache: "no-cache" }) + await fetch(`${url}keys`, { cache: "no-cache" }) ).json(), ); const newWire = JSON.stringify( await ( - await fetch(`${ex}wire`, { cache: "no-cache" }) + await fetch(`${url}wire`, { cache: "no-cache" }) ).json(), ); return oldKeys !== newKeys || newWire !== oldWire; }), ); - const ex = exchanges.filter((e, i) => result[i]); + const ex = exchangeList.filter((e, i) => result[i]); if (!ex.length) { alert("no exchange was outdated"); } else { diff --git a/packages/taler-wallet-webextension/src/wallet/Transaction.tsx b/packages/taler-wallet-webextension/src/wallet/Transaction.tsx index b9b1aa198..217a77575 100644 --- a/packages/taler-wallet-webextension/src/wallet/Transaction.tsx +++ b/packages/taler-wallet-webextension/src/wallet/Transaction.tsx @@ -879,13 +879,14 @@ export function TransactionView({ kind="neutral" /> {transaction.extendedStatus === - ExtendedStatus.Pending /** pending is not-pay */ && ( - } - kind="neutral" - /> - )} + ExtendedStatus.Pending /** pending is not-pay */ && + !transaction.error && ( + } + kind="neutral" + /> + )}