diff options
author | Florian Dold <florian@dold.me> | 2023-08-03 19:24:04 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2023-08-03 19:24:04 +0200 |
commit | ee47aa4837fedcaa8257b57138ea34fda220d2b7 (patch) | |
tree | 33fb9e52d148cdd30e234586fe77abecff3856cd /packages/taler-wallet-core/src/operations/pay-peer-pull-credit.ts | |
parent | 57e86b759e0376238f993fea1617609977fefb46 (diff) | |
download | wallet-core-ee47aa4837fedcaa8257b57138ea34fda220d2b7.tar.xz |
fix integration tests
Instead of using the deprecated runUntilDone, we now wait
for specific notifications.
The old way doesn't work, since p2p push transactions are not considered
done until the counterparty has accepted the payment.
Diffstat (limited to 'packages/taler-wallet-core/src/operations/pay-peer-pull-credit.ts')
-rw-r--r-- | packages/taler-wallet-core/src/operations/pay-peer-pull-credit.ts | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/packages/taler-wallet-core/src/operations/pay-peer-pull-credit.ts b/packages/taler-wallet-core/src/operations/pay-peer-pull-credit.ts index c7e13754f..ac501aae2 100644 --- a/packages/taler-wallet-core/src/operations/pay-peer-pull-credit.ts +++ b/packages/taler-wallet-core/src/operations/pay-peer-pull-credit.ts @@ -436,16 +436,25 @@ async function handlePeerPullCreditCreatePurse( logger.info(`reserve merge response: ${j2s(resp)}`); - await ws.db + const transactionId = constructTransactionIdentifier({ + tag: TransactionType.PeerPullCredit, + pursePub: pullIni.pursePub, + }); + + const transitionInfo = await ws.db .mktx((x) => [x.peerPullPaymentInitiations]) .runReadWrite(async (tx) => { const pi2 = await tx.peerPullPaymentInitiations.get(pursePub); if (!pi2) { return; } + const oldTxState = computePeerPullCreditTransactionState(pi2); pi2.status = PeerPullPaymentInitiationStatus.PendingReady; await tx.peerPullPaymentInitiations.put(pi2); + const newTxState = computePeerPullCreditTransactionState(pi2); + return { oldTxState, newTxState }; }); + notifyTransition(ws, transactionId, transitionInfo); return TaskRunResult.finished(); } |