diff options
Diffstat (limited to 'packages/taler-wallet-core/src/pay-peer-pull-debit.ts')
-rw-r--r-- | packages/taler-wallet-core/src/pay-peer-pull-debit.ts | 39 |
1 files changed, 26 insertions, 13 deletions
diff --git a/packages/taler-wallet-core/src/pay-peer-pull-debit.ts b/packages/taler-wallet-core/src/pay-peer-pull-debit.ts index f71fdcee7..62472c7f8 100644 --- a/packages/taler-wallet-core/src/pay-peer-pull-debit.ts +++ b/packages/taler-wallet-core/src/pay-peer-pull-debit.ts @@ -26,6 +26,7 @@ import { AcceptPeerPullPaymentResponse, Amounts, + CancellationToken, CoinRefreshRequest, ConfirmPeerPullDebitRequest, ContractTermsUtil, @@ -63,6 +64,14 @@ import { readTalerErrorResponse, } from "@gnu-taler/taler-util/http"; import { + TaskRunResult, + TaskRunResultType, + TransactionContext, + TransitionResult, + constructTaskIdentifier, + spendCoins, +} from "./common.js"; +import { DbReadWriteTransaction, InternalWalletState, PeerPullDebitRecordStatus, @@ -75,17 +84,6 @@ import { createRefreshGroup, timestampPreciseToDb, } from "./index.js"; -import { assertUnreachable } from "./util/assertUnreachable.js"; -import { PeerCoinRepair, selectPeerCoins } from "./util/coinSelection.js"; -import { checkLogicInvariant } from "./util/invariants.js"; -import { - TaskRunResult, - TaskRunResultType, - TransactionContext, - TransitionResult, - constructTaskIdentifier, - spendCoins, -} from "./common.js"; import { codecForExchangePurseStatus, getTotalPeerPaymentCost, @@ -96,6 +94,9 @@ import { notifyTransition, parseTransactionIdentifier, } from "./transactions.js"; +import { assertUnreachable } from "./util/assertUnreachable.js"; +import { PeerCoinRepair, selectPeerCoins } from "./util/coinSelection.js"; +import { checkLogicInvariant } from "./util/invariants.js"; const logger = new Logger("pay-peer-pull-debit.ts"); @@ -413,6 +414,7 @@ async function handlePurseCreationConflict( async function processPeerPullDebitPendingDeposit( ws: InternalWalletState, peerPullInc: PeerPullPaymentIncomingRecord, + cancellationToken: CancellationToken, ): Promise<TaskRunResult> { const pursePub = peerPullInc.pursePub; @@ -445,6 +447,7 @@ async function processPeerPullDebitPendingDeposit( const httpResp = await ws.http.fetch(purseDepositUrl.href, { method: "POST", body: depositPayload, + cancellationToken, }); const ctx = new PeerPullDebitTransactionContext( @@ -489,6 +492,7 @@ async function processPeerPullDebitPendingDeposit( async function processPeerPullDebitAbortingRefresh( ws: InternalWalletState, peerPullInc: PeerPullPaymentIncomingRecord, + _cancellationToken: CancellationToken, ): Promise<TaskRunResult> { const peerPullDebitId = peerPullInc.peerPullDebitId; const abortRefreshGroupId = peerPullInc.abortRefreshGroupId; @@ -538,6 +542,7 @@ async function processPeerPullDebitAbortingRefresh( export async function processPeerPullDebit( ws: InternalWalletState, peerPullDebitId: string, + cancellationToken: CancellationToken, ): Promise<TaskRunResult> { const peerPullInc = await ws.db.runReadOnlyTx( ["peerPullDebit"], @@ -551,9 +556,17 @@ export async function processPeerPullDebit( switch (peerPullInc.status) { case PeerPullDebitRecordStatus.PendingDeposit: - return await processPeerPullDebitPendingDeposit(ws, peerPullInc); + return await processPeerPullDebitPendingDeposit( + ws, + peerPullInc, + cancellationToken, + ); case PeerPullDebitRecordStatus.AbortingRefresh: - return await processPeerPullDebitAbortingRefresh(ws, peerPullInc); + return await processPeerPullDebitAbortingRefresh( + ws, + peerPullInc, + cancellationToken, + ); } return TaskRunResult.finished(); } |