From df6f50028339c033982b94662e8ab465383095b3 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Tue, 20 Feb 2024 02:19:41 +0100 Subject: wallet-core: count deposits towards pendingOutgoing --- packages/taler-wallet-core/src/withdraw.ts | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'packages/taler-wallet-core/src/withdraw.ts') diff --git a/packages/taler-wallet-core/src/withdraw.ts b/packages/taler-wallet-core/src/withdraw.ts index 3f4b3ef70..b34ad521d 100644 --- a/packages/taler-wallet-core/src/withdraw.ts +++ b/packages/taler-wallet-core/src/withdraw.ts @@ -1685,7 +1685,11 @@ export async function processWithdrawalGroup( case WithdrawalGroupStatus.PendingQueryingStatus: return processQueryReserve(ws, withdrawalGroupId, cancellationToken); case WithdrawalGroupStatus.PendingWaitConfirmBank: - return await processReserveBankStatus(ws, withdrawalGroupId); + return await processReserveBankStatus( + ws, + withdrawalGroupId, + cancellationToken, + ); case WithdrawalGroupStatus.PendingAml: // FIXME: Handle this case, withdrawal doesn't support AML yet. return TaskRunResult.backoff(); @@ -2233,6 +2237,7 @@ async function processBankRegisterReserve( async function processReserveBankStatus( ws: InternalWalletState, withdrawalGroupId: string, + cancellationToken: CancellationToken, ): Promise { const withdrawalGroup = await getWithdrawalGroupRecordTx(ws.db, { withdrawalGroupId, @@ -2258,15 +2263,16 @@ async function processReserveBankStatus( if (!uriResult) { throw Error(`can't parse withdrawal URL ${bankInfo.talerWithdrawUri}`); } - const url = new URL( + const bankStatusUrl = new URL( `withdrawal-operation/${uriResult.withdrawalOperationId}`, uriResult.bankIntegrationApiBaseUrl, ); - url.searchParams.set("long_poll_ms", "30000"); + bankStatusUrl.searchParams.set("long_poll_ms", "30000"); - logger.info(`long-polling for withdrawal operation at ${url.href}`); - const statusResp = await ws.http.fetch(url.href, { + logger.info(`long-polling for withdrawal operation at ${bankStatusUrl.href}`); + const statusResp = await ws.http.fetch(bankStatusUrl.href, { timeout: getReserveRequestTimeout(withdrawalGroup), + cancellationToken, }); logger.info( `long-polling for withdrawal operation returned status ${statusResp.status}`, -- cgit v1.2.3