diff options
author | Florian Dold <florian@dold.me> | 2023-04-23 22:49:42 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2023-04-23 22:49:42 +0200 |
commit | eff3920bd5a2bff58d66ac72ba8bd2c1577f452f (patch) | |
tree | 1e7435da254b56bb9b8a543ce488aeb84f032ac9 /packages/taler-wallet-core/src/operations/transactions.ts | |
parent | 321252040efdb0712a38b3488297a7a802c5cb59 (diff) | |
download | wallet-core-eff3920bd5a2bff58d66ac72ba8bd2c1577f452f.tar.xz |
wallet-core: further towards deposit DD37
Diffstat (limited to 'packages/taler-wallet-core/src/operations/transactions.ts')
-rw-r--r-- | packages/taler-wallet-core/src/operations/transactions.ts | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/packages/taler-wallet-core/src/operations/transactions.ts b/packages/taler-wallet-core/src/operations/transactions.ts index 884844ba6..1a511583a 100644 --- a/packages/taler-wallet-core/src/operations/transactions.ts +++ b/packages/taler-wallet-core/src/operations/transactions.ts @@ -81,6 +81,7 @@ import { import { computeDepositTransactionStatus, processDepositGroup, + suspendDepositGroup, } from "./deposits.js"; import { getExchangeDetails } from "./exchanges.js"; import { @@ -1615,7 +1616,19 @@ export async function retryTransaction( export async function suspendTransaction( ws: InternalWalletState, transactionId: string, -): Promise<void> {} +): Promise<void> { + const tx = parseTransactionIdentifier(transactionId); + if (!tx) { + throw Error("invalid transaction ID"); + } + switch (tx.tag) { + case TransactionType.Deposit: + await suspendDepositGroup(ws, tx.depositGroupId); + return; + default: + logger.warn(`unable to suspend transaction of type '${tx.tag}'`); + } +} /** * Resume a suspended transaction. @@ -1623,7 +1636,16 @@ export async function suspendTransaction( export async function resumeTransaction( ws: InternalWalletState, transactionId: string, -): Promise<void> {} +): Promise<void> { + const tx = parseTransactionIdentifier(transactionId); + if (!tx) { + throw Error("invalid transaction ID"); + } + switch (tx.tag) { + default: + logger.warn(`unable to resume transaction of type '${tx.tag}'`); + } +} /** * Permanently delete a transaction based on the transaction ID. |