From 99e73bee7070477b66e0f1db29ac03da92f128f8 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Mon, 10 Jun 2024 19:56:29 +0200 Subject: wallet-core: fix long-polling issue We must specify the old_state, because otherwise the withdrawal operation status returns query immediately in state "selected", causing the withdrawal to go into back-off. --- packages/taler-wallet-core/src/withdraw.ts | 45 ++++++++++++++++++++++++------ 1 file changed, 37 insertions(+), 8 deletions(-) (limited to 'packages') diff --git a/packages/taler-wallet-core/src/withdraw.ts b/packages/taler-wallet-core/src/withdraw.ts index b88b1d5c6..6aa3b186a 100644 --- a/packages/taler-wallet-core/src/withdraw.ts +++ b/packages/taler-wallet-core/src/withdraw.ts @@ -731,15 +731,35 @@ export function computeWithdrawalTransactionActions( case WithdrawalGroupStatus.Done: return [TransactionAction.Delete]; case WithdrawalGroupStatus.PendingRegisteringBank: - return [TransactionAction.Retry, TransactionAction.Suspend, TransactionAction.Abort]; + return [ + TransactionAction.Retry, + TransactionAction.Suspend, + TransactionAction.Abort, + ]; case WithdrawalGroupStatus.PendingReady: - return [TransactionAction.Retry, TransactionAction.Suspend, TransactionAction.Abort]; + return [ + TransactionAction.Retry, + TransactionAction.Suspend, + TransactionAction.Abort, + ]; case WithdrawalGroupStatus.PendingQueryingStatus: - return [TransactionAction.Retry, TransactionAction.Suspend, TransactionAction.Abort]; + return [ + TransactionAction.Retry, + TransactionAction.Suspend, + TransactionAction.Abort, + ]; case WithdrawalGroupStatus.PendingWaitConfirmBank: - return [TransactionAction.Retry, TransactionAction.Suspend, TransactionAction.Abort]; + return [ + TransactionAction.Retry, + TransactionAction.Suspend, + TransactionAction.Abort, + ]; case WithdrawalGroupStatus.AbortingBank: - return [TransactionAction.Retry, TransactionAction.Suspend, TransactionAction.Fail]; + return [ + TransactionAction.Retry, + TransactionAction.Suspend, + TransactionAction.Fail, + ]; case WithdrawalGroupStatus.SuspendedAbortingBank: return [TransactionAction.Resume, TransactionAction.Fail]; case WithdrawalGroupStatus.SuspendedQueryingStatus: @@ -751,9 +771,17 @@ export function computeWithdrawalTransactionActions( case WithdrawalGroupStatus.SuspendedReady: return [TransactionAction.Resume, TransactionAction.Abort]; case WithdrawalGroupStatus.PendingAml: - return [TransactionAction.Retry, TransactionAction.Resume, TransactionAction.Abort]; + return [ + TransactionAction.Retry, + TransactionAction.Resume, + TransactionAction.Abort, + ]; case WithdrawalGroupStatus.PendingKyc: - return [TransactionAction.Retry, TransactionAction.Resume, TransactionAction.Abort]; + return [ + TransactionAction.Retry, + TransactionAction.Resume, + TransactionAction.Abort, + ]; case WithdrawalGroupStatus.SuspendedAml: return [TransactionAction.Resume, TransactionAction.Abort]; case WithdrawalGroupStatus.SuspendedKyc: @@ -1934,7 +1962,7 @@ async function processWithdrawalGroupPendingReady( "can't get funding uri from uninitialized wg", ); const exchangeBaseUrl = withdrawalGroup.exchangeBaseUrl; - logger.trace(`updating exchange beofre processing wg`) + logger.trace(`updating exchange beofre processing wg`); await fetchFreshExchange(wex, withdrawalGroup.exchangeBaseUrl); if (withdrawalGroup.denomsSel.selectedDenoms.length === 0) { @@ -2617,6 +2645,7 @@ async function processReserveBankStatus( uriResult.bankIntegrationApiBaseUrl, ); bankStatusUrl.searchParams.set("long_poll_ms", "30000"); + bankStatusUrl.searchParams.set("old_state", "selected"); logger.info(`long-polling for withdrawal operation at ${bankStatusUrl.href}`); const statusResp = await wex.http.fetch(bankStatusUrl.href, { -- cgit v1.2.3