summaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/operations
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2024-02-13 11:46:34 +0100
committerFlorian Dold <florian@dold.me>2024-02-13 11:46:34 +0100
commit3a62b8522e6b7cb587bbb0c3ce606527e918e06d (patch)
treed680c3fb8f5b86bd80caa440cacfb90a4426bd23 /packages/taler-wallet-core/src/operations
parentc4c89f401431a50a41580aea6b4182277eec7a7f (diff)
downloadwallet-core-3a62b8522e6b7cb587bbb0c3ce606527e918e06d.tar.gz
wallet-core-3a62b8522e6b7cb587bbb0c3ce606527e918e06d.tar.bz2
wallet-core-3a62b8522e6b7cb587bbb0c3ce606527e918e06d.zip
wallet-core: operation status for recoup
Diffstat (limited to 'packages/taler-wallet-core/src/operations')
-rw-r--r--packages/taler-wallet-core/src/operations/recoup.ts11
1 files changed, 7 insertions, 4 deletions
diff --git a/packages/taler-wallet-core/src/operations/recoup.ts b/packages/taler-wallet-core/src/operations/recoup.ts
index a6270783e..2dd88b614 100644
--- a/packages/taler-wallet-core/src/operations/recoup.ts
+++ b/packages/taler-wallet-core/src/operations/recoup.ts
@@ -43,6 +43,7 @@ import {
CoinRecord,
CoinSourceType,
RecoupGroupRecord,
+ RecoupOperationStatus,
RefreshCoinSource,
WalletStoresV1,
WithdrawCoinSource,
@@ -51,6 +52,7 @@ import {
timestampPreciseToDb,
} from "../db.js";
import { InternalWalletState } from "../internal-wallet-state.js";
+import { PendingTaskType } from "../pending-types.js";
import { checkDbInvariant } from "../util/invariants.js";
import { GetReadWriteAccess } from "../util/query.js";
import {
@@ -59,9 +61,8 @@ import {
constructTaskIdentifier,
} from "./common.js";
import { createRefreshGroup } from "./refresh.js";
-import { internalCreateWithdrawalGroup } from "./withdraw.js";
import { constructTransactionIdentifier } from "./transactions.js";
-import { PendingTaskType } from "../pending-types.js";
+import { internalCreateWithdrawalGroup } from "./withdraw.js";
const logger = new Logger("operations/recoup.ts");
@@ -316,7 +317,7 @@ export async function processRecoupGroup(
}
const ps = recoupGroup.coinPubs.map(async (x, i) => {
try {
- await processRecoup(ws, recoupGroupId, i);
+ await processRecoupForCoin(ws, recoupGroupId, i);
} catch (e) {
logger.warn(`processRecoup failed: ${e}`);
throw e;
@@ -406,6 +407,7 @@ export async function processRecoupGroup(
return;
}
rg2.timestampFinished = timestampPreciseToDb(TalerPreciseTimestamp.now());
+ rg2.operationStatus = RecoupOperationStatus.Finished;
if (rg2.scheduleRefreshCoins.length > 0) {
await createRefreshGroup(
ws,
@@ -479,6 +481,7 @@ export async function createRecoupGroup(
timestampStarted: timestampPreciseToDb(TalerPreciseTimestamp.now()),
recoupFinishedPerCoin: coinPubs.map(() => false),
scheduleRefreshCoins: [],
+ operationStatus: RecoupOperationStatus.Pending,
};
for (let coinIdx = 0; coinIdx < coinPubs.length; coinIdx++) {
@@ -499,7 +502,7 @@ export async function createRecoupGroup(
/**
* Run the recoup protocol for a single coin in a recoup group.
*/
-async function processRecoup(
+async function processRecoupForCoin(
ws: InternalWalletState,
recoupGroupId: string,
coinIdx: number,