diff options
author | Florian Dold <florian@dold.me> | 2024-02-20 00:57:02 +0100 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2024-02-20 00:57:02 +0100 |
commit | 578bd4b1ed12049800556460359cb55a1e8545a2 (patch) | |
tree | 8d7846882b342ceaa1048d5a42120ae973d6ce49 /packages/taler-wallet-core/src/deposits.ts | |
parent | e10df554c9746971be0ec3f39a9cd98520066380 (diff) | |
download | wallet-core-578bd4b1ed12049800556460359cb55a1e8545a2.tar.gz wallet-core-578bd4b1ed12049800556460359cb55a1e8545a2.tar.bz2 wallet-core-578bd4b1ed12049800556460359cb55a1e8545a2.zip |
taler-harness: test for balance during a pending refresh operation
Diffstat (limited to 'packages/taler-wallet-core/src/deposits.ts')
-rw-r--r-- | packages/taler-wallet-core/src/deposits.ts | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/packages/taler-wallet-core/src/deposits.ts b/packages/taler-wallet-core/src/deposits.ts index dc3831595..6f247501e 100644 --- a/packages/taler-wallet-core/src/deposits.ts +++ b/packages/taler-wallet-core/src/deposits.ts @@ -95,7 +95,11 @@ import { generateDepositPermissions, getTotalPaymentCost, } from "./pay-merchant.js"; -import { createRefreshGroup, getTotalRefreshCost } from "./refresh.js"; +import { + CreateRefreshGroupResult, + createRefreshGroup, + getTotalRefreshCost, +} from "./refresh.js"; import { constructTransactionIdentifier, notifyTransition, @@ -532,7 +536,7 @@ async function refundDepositGroup( const currency = Amounts.currencyOf(depositGroup.totalPayCost); - await ws.db.runReadWriteTx( + const res = await ws.db.runReadWriteTx( [ "depositGroups", "refreshGroups", @@ -553,8 +557,9 @@ async function refundDepositGroup( coinPub: depositGroup.payCoinSelection.coinPubs[i], }); } + let refreshRes: CreateRefreshGroupResult | undefined = undefined; if (isDone) { - const rgid = await createRefreshGroup( + refreshRes = await createRefreshGroup( ws, tx, currency, @@ -565,12 +570,19 @@ async function refundDepositGroup( depositGroupId: newDg.depositGroupId, }), ); - newDg.abortRefreshGroupId = rgid.refreshGroupId; + newDg.abortRefreshGroupId = refreshRes.refreshGroupId; } await tx.depositGroups.put(newDg); + return { refreshRes }; }, ); + if (res?.refreshRes) { + for (const notif of res.refreshRes.notifications) { + ws.notify(notif); + } + } + return TaskRunResult.backoff(); } |