From e9683e5ae9d3f7e6f3e16d01a280592075861548 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Mon, 8 Jan 2024 21:43:02 +0100 Subject: wallet-core: properly filter possible exchanges for withdrawals --- packages/taler-wallet-core/src/operations/withdraw.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'packages/taler-wallet-core/src/operations') diff --git a/packages/taler-wallet-core/src/operations/withdraw.ts b/packages/taler-wallet-core/src/operations/withdraw.ts index 49c0e4a14..56f1d91bb 100644 --- a/packages/taler-wallet-core/src/operations/withdraw.ts +++ b/packages/taler-wallet-core/src/operations/withdraw.ts @@ -35,6 +35,7 @@ import { Duration, ExchangeBatchWithdrawRequest, ExchangeListItem, + ExchangeUpdateStatus, ExchangeWireAccount, ExchangeWithdrawBatchResponse, ExchangeWithdrawRequest, @@ -1945,12 +1946,21 @@ export async function getWithdrawalDetailsForUri( } } - const possibleExchangesResp = await listExchanges(ws); + const currency = Amounts.currencyOf(info.amount); + + const listExchangesResp = await listExchanges(ws); + const possibleExchanges = listExchangesResp.exchanges.filter((x) => { + return ( + x.currency === currency && + (x.exchangeUpdateStatus === ExchangeUpdateStatus.Ready || + x.exchangeUpdateStatus === ExchangeUpdateStatus.ReadyUpdate) + ); + }); return { amount: Amounts.stringify(info.amount), defaultExchangeBaseUrl: info.suggestedExchange, - possibleExchanges: possibleExchangesResp.exchanges, + possibleExchanges, }; } -- cgit v1.2.3