diff options
author | Sebastian <sebasjm@gmail.com> | 2023-02-20 12:36:48 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2023-02-20 12:36:48 -0300 |
commit | 0b6b757f659cc1a1c770d994c05c361033b56c06 (patch) | |
tree | 228bc5aeb81ac934a3bf39e711fd8b13416a6aa0 /packages/taler-wallet-core/src/operations | |
parent | 2c57d4212838b70106f302ecc362a07e870e4068 (diff) | |
download | wallet-core-0b6b757f659cc1a1c770d994c05c361033b56c06.tar.xz |
don't use outdated purchase info
Diffstat (limited to 'packages/taler-wallet-core/src/operations')
-rw-r--r-- | packages/taler-wallet-core/src/operations/pay-merchant.ts | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/packages/taler-wallet-core/src/operations/pay-merchant.ts b/packages/taler-wallet-core/src/operations/pay-merchant.ts index f84ac2567..19cd9c9e8 100644 --- a/packages/taler-wallet-core/src/operations/pay-merchant.ts +++ b/packages/taler-wallet-core/src/operations/pay-merchant.ts @@ -2697,8 +2697,13 @@ export async function processPurchaseQueryRefund( await ws.db .mktx((x) => [x.purchases]) .runReadWrite(async (tx) => { - purchase.purchaseStatus = PurchaseStatus.Paid; - await tx.purchases.put(purchase); + const p = await tx.purchases.get(proposalId); + if (!p) { + logger.warn("purchase does not exist anymore"); + return; + } + p.purchaseStatus = PurchaseStatus.Paid; + await tx.purchases.put(p); }); // No new refunds, but we still need to notify |