From 318f54418467e31c9b4b71d82d2cf00932fc167c Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Wed, 24 May 2023 14:59:54 +0200 Subject: wallet-core: implement deletion for new refund implementation --- .../taler-wallet-core/src/operations/transactions.ts | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'packages/taler-wallet-core/src/operations/transactions.ts') diff --git a/packages/taler-wallet-core/src/operations/transactions.ts b/packages/taler-wallet-core/src/operations/transactions.ts index 41c74f4d1..647b9dd90 100644 --- a/packages/taler-wallet-core/src/operations/transactions.ts +++ b/packages/taler-wallet-core/src/operations/transactions.ts @@ -71,6 +71,7 @@ import { assertUnreachable } from "../util/assertUnreachable.js"; import { checkDbInvariant, checkLogicInvariant } from "../util/invariants.js"; import { constructTaskIdentifier, TaskIdentifiers } from "../util/retries.js"; import { + constructTombstone, makeTombstoneId, resetOperationTimeout, runOperationWithErrorReporting, @@ -1615,7 +1616,22 @@ export async function deleteTransaction( } case TransactionType.Refund: { - // FIXME: Implement! + const refundGroupId = parsedTx.refundGroupId; + await ws.db + .mktx((x) => [x.refundGroups, x.tombstones]) + .runReadWrite(async (tx) => { + const refundRecord = await tx.refundGroups.get(refundGroupId); + if (!refundRecord) { + return; + } + await tx.refundGroups.delete(refundGroupId); + await tx.tombstones.put({ + id: constructTombstone({ + tag: TombstoneTag.DeleteRefund, + refundGroupId, + }), + }); + }); return; } -- cgit v1.2.3