diff options
author | Florian Dold <florian@dold.me> | 2023-07-06 20:17:59 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2023-07-06 20:17:59 +0200 |
commit | 8b06874f42715b0397a6735ff330e5f75eb0cb86 (patch) | |
tree | 608049f43d04fc375fe9e3f6599c18d4296fb479 /packages/taler-wallet-core/src/wallet.ts | |
parent | d98f048fd65c46cd774eabdef8599efb75153ac3 (diff) | |
download | wallet-core-8b06874f42715b0397a6735ff330e5f75eb0cb86.tar.gz wallet-core-8b06874f42715b0397a6735ff330e5f75eb0cb86.tar.bz2 wallet-core-8b06874f42715b0397a6735ff330e5f75eb0cb86.zip |
wallet-core: support passing transactionId to confirmPay
Diffstat (limited to 'packages/taler-wallet-core/src/wallet.ts')
-rw-r--r-- | packages/taler-wallet-core/src/wallet.ts | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/packages/taler-wallet-core/src/wallet.ts b/packages/taler-wallet-core/src/wallet.ts index ca86cbb14..e457ba003 100644 --- a/packages/taler-wallet-core/src/wallet.ts +++ b/packages/taler-wallet-core/src/wallet.ts @@ -1260,7 +1260,20 @@ async function dispatchRequestInternal<Op extends WalletApiOperation>( } case WalletApiOperation.ConfirmPay: { const req = codecForConfirmPayRequest().decode(payload); - return await confirmPay(ws, req.proposalId, req.sessionId); + let proposalId; + if (req.proposalId) { + // legacy client support + proposalId = req.proposalId; + } else if (req.transactionId) { + const txIdParsed = parseTransactionIdentifier(req.transactionId); + if (txIdParsed?.tag != TransactionType.Payment) { + throw Error("payment transaction ID required"); + } + proposalId = txIdParsed.proposalId; + } else { + throw Error("transactionId or (deprecated) proposalId required"); + } + return await confirmPay(ws, proposalId, req.sessionId); } case WalletApiOperation.AbortTransaction: { const req = codecForAbortTransaction().decode(payload); |