From fe8749c3f81547d080ea23d580497750d52fed91 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Thu, 25 May 2023 19:26:40 +0200 Subject: wallet-core: implement cancelAbortingTransaction for deposit groups --- .../taler-wallet-core/src/operations/transactions.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'packages/taler-wallet-core/src/operations/transactions.ts') diff --git a/packages/taler-wallet-core/src/operations/transactions.ts b/packages/taler-wallet-core/src/operations/transactions.ts index 74df9acfb..84f879f58 100644 --- a/packages/taler-wallet-core/src/operations/transactions.ts +++ b/packages/taler-wallet-core/src/operations/transactions.ts @@ -75,6 +75,7 @@ import { } from "./common.js"; import { abortDepositGroup, + cancelAbortingDepositGroup, computeDepositTransactionStatus, processDepositGroup, resumeDepositGroup, @@ -1401,6 +1402,23 @@ export async function suspendTransaction( } } +export async function cancelAbortingTransaction( + ws: InternalWalletState, + transactionId: string, +): Promise { + const tx = parseTransactionIdentifier(transactionId); + if (!tx) { + throw Error("invalid transaction ID"); + } + switch (tx.tag) { + case TransactionType.Deposit: + await cancelAbortingDepositGroup(ws, tx.depositGroupId); + return; + default: + logger.warn(`unable to suspend transaction of type '${tx.tag}'`); + } +} + /** * Resume a suspended transaction. */ -- cgit v1.2.3