aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/operations/tip.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/tip.ts
parent7523ffa9105f71a6a4c201d3ee46dbfccc929cea (diff)
wallet-core: rename OperationAttempt->TaskRun, do not allow task result values anymore
Diffstat (limited to 'packages/taler-wallet-core/src/operations/tip.ts')
-rw-r--r--packages/taler-wallet-core/src/operations/tip.ts25
1 files changed, 8 insertions, 17 deletions
diff --git a/packages/taler-wallet-core/src/operations/tip.ts b/packages/taler-wallet-core/src/operations/tip.ts
index 18ef03c51..e56fb1e8d 100644
--- a/packages/taler-wallet-core/src/operations/tip.ts
+++ b/packages/taler-wallet-core/src/operations/tip.ts
@@ -62,8 +62,8 @@ import {
constructTaskIdentifier,
makeCoinAvailable,
makeCoinsVisible,
- OperationAttemptResult,
- OperationAttemptResultType,
+ TaskRunResult,
+ TaskRunResultType,
} from "./common.js";
import { updateExchangeFromUrl } from "./exchanges.js";
import {
@@ -241,17 +241,14 @@ export async function prepareTip(
export async function processTip(
ws: InternalWalletState,
walletTipId: string,
-): Promise<OperationAttemptResult> {
+): Promise<TaskRunResult> {
const tipRecord = await ws.db
.mktx((x) => [x.tips])
.runReadOnly(async (tx) => {
return tx.tips.get(walletTipId);
});
if (!tipRecord) {
- return {
- type: OperationAttemptResultType.Finished,
- result: undefined,
- };
+ return TaskRunResult.finished();
}
switch (tipRecord.status) {
@@ -259,10 +256,7 @@ export async function processTip(
case TipRecordStatus.DialogAccept:
case TipRecordStatus.Done:
case TipRecordStatus.SuspendidPickup:
- return {
- type: OperationAttemptResultType.Finished,
- result: undefined,
- };
+ return TaskRunResult.finished();
}
const transactionId = constructTransactionIdentifier({
@@ -324,7 +318,7 @@ export async function processTip(
logger.trace(`got transient tip error`);
// FIXME: wrap in another error code that indicates a transient error
return {
- type: OperationAttemptResultType.Error,
+ type: TaskRunResultType.Error,
errorDetail: makeErrorDetail(
TalerErrorCode.WALLET_UNEXPECTED_REQUEST_ERROR,
getHttpResponseErrorDetails(merchantResp),
@@ -376,7 +370,7 @@ export async function processTip(
if (!isValid) {
return {
- type: OperationAttemptResultType.Error,
+ type: TaskRunResultType.Error,
errorDetail: makeErrorDetail(
TalerErrorCode.WALLET_TIPPING_COIN_SIGNATURE_INVALID,
{},
@@ -430,10 +424,7 @@ export async function processTip(
notifyTransition(ws, transactionId, transitionInfo);
ws.notify({ type: NotificationType.BalanceChange });
- return {
- type: OperationAttemptResultType.Finished,
- result: undefined,
- };
+ return TaskRunResult.finished();
}
export async function acceptTip(