diff options
Diffstat (limited to 'packages/taler-wallet-core/src/operations/tip.ts')
-rw-r--r-- | packages/taler-wallet-core/src/operations/tip.ts | 25 |
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( |