aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2024-06-10 19:56:29 +0200
committerFlorian Dold <florian@dold.me>2024-06-10 19:56:29 +0200
commit99e73bee7070477b66e0f1db29ac03da92f128f8 (patch)
tree2fb4e2b13e8a766c709f471f94731ca9158b8654
parent472899f066ce29b86bdc6b02a621f755a7c3b260 (diff)
downloadwallet-core-99e73bee7070477b66e0f1db29ac03da92f128f8.tar.xz
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.
-rw-r--r--packages/taler-wallet-core/src/withdraw.ts45
1 files changed, 37 insertions, 8 deletions
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, {