aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/operations/pay-peer-pull-debit.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2023-06-30 16:14:58 +0200
committerFlorian Dold <florian@dold.me>2023-06-30 16:14:58 +0200
commitd4ee96138774e8bc469f172bbb6276af89d6f240 (patch)
treeeda5bc6833306727f711cc5aedd5f307fa8b1f67 /packages/taler-wallet-core/src/operations/pay-peer-pull-debit.ts
parent7523ffa9105f71a6a4c201d3ee46dbfccc929cea (diff)
downloadwallet-core-d4ee96138774e8bc469f172bbb6276af89d6f240.tar.xz
wallet-core: rename OperationAttempt->TaskRun, do not allow task result values anymore
Diffstat (limited to 'packages/taler-wallet-core/src/operations/pay-peer-pull-debit.ts')
-rw-r--r--packages/taler-wallet-core/src/operations/pay-peer-pull-debit.ts30
1 files changed, 12 insertions, 18 deletions
diff --git a/packages/taler-wallet-core/src/operations/pay-peer-pull-debit.ts b/packages/taler-wallet-core/src/operations/pay-peer-pull-debit.ts
index 9d8fabfb2..1aa332439 100644
--- a/packages/taler-wallet-core/src/operations/pay-peer-pull-debit.ts
+++ b/packages/taler-wallet-core/src/operations/pay-peer-pull-debit.ts
@@ -62,8 +62,8 @@ import {
import { assertUnreachable } from "../util/assertUnreachable.js";
import { checkLogicInvariant } from "../util/invariants.js";
import {
- OperationAttemptResult,
- OperationAttemptResultType,
+ TaskRunResult,
+ TaskRunResultType,
TaskIdentifiers,
constructTaskIdentifier,
runTaskWithErrorReporting,
@@ -89,12 +89,12 @@ async function handlePurseCreationConflict(
ws: InternalWalletState,
peerPullInc: PeerPullPaymentIncomingRecord,
resp: HttpResponse,
-): Promise<OperationAttemptResult> {
+): Promise<TaskRunResult> {
const pursePub = peerPullInc.pursePub;
const errResp = await readTalerErrorResponse(resp);
if (errResp.code !== TalerErrorCode.EXCHANGE_GENERIC_INSUFFICIENT_FUNDS) {
await failPeerPullDebitTransaction(ws, pursePub);
- return OperationAttemptResult.finishedEmpty();
+ return TaskRunResult.finished();
}
// FIXME: Properly parse!
@@ -167,13 +167,13 @@ async function handlePurseCreationConflict(
}
await tx.peerPullPaymentIncoming.put(myPpi);
});
- return OperationAttemptResult.finishedEmpty();
+ return TaskRunResult.finished();
}
async function processPeerPullDebitPendingDeposit(
ws: InternalWalletState,
peerPullInc: PeerPullPaymentIncomingRecord,
-): Promise<OperationAttemptResult> {
+): Promise<TaskRunResult> {
const peerPullPaymentIncomingId = peerPullInc.peerPullPaymentIncomingId;
const pursePub = peerPullInc.pursePub;
@@ -299,21 +299,18 @@ async function processPeerPullDebitPendingDeposit(
default: {
const errResp = await readTalerErrorResponse(httpResp);
return {
- type: OperationAttemptResultType.Error,
+ type: TaskRunResultType.Error,
errorDetail: errResp,
};
}
}
- return {
- type: OperationAttemptResultType.Finished,
- result: undefined,
- };
+ return TaskRunResult.finished();
}
async function processPeerPullDebitAbortingRefresh(
ws: InternalWalletState,
peerPullInc: PeerPullPaymentIncomingRecord,
-): Promise<OperationAttemptResult> {
+): Promise<TaskRunResult> {
const peerPullPaymentIncomingId = peerPullInc.peerPullPaymentIncomingId;
const abortRefreshGroupId = peerPullInc.abortRefreshGroupId;
checkLogicInvariant(!!abortRefreshGroupId);
@@ -357,13 +354,13 @@ async function processPeerPullDebitAbortingRefresh(
});
notifyTransition(ws, transactionId, transitionInfo);
// FIXME: Shouldn't this be finished in some cases?!
- return OperationAttemptResult.pendingEmpty();
+ return TaskRunResult.pending();
}
export async function processPeerPullDebit(
ws: InternalWalletState,
peerPullPaymentIncomingId: string,
-): Promise<OperationAttemptResult> {
+): Promise<TaskRunResult> {
const peerPullInc = await ws.db
.mktx((x) => [x.peerPullPaymentIncoming])
.runReadOnly(async (tx) => {
@@ -379,10 +376,7 @@ export async function processPeerPullDebit(
case PeerPullDebitRecordStatus.AbortingRefresh:
return await processPeerPullDebitAbortingRefresh(ws, peerPullInc);
}
- return {
- type: OperationAttemptResultType.Finished,
- result: undefined,
- };
+ return TaskRunResult.finished();
}
export async function confirmPeerPullDebit(