diff options
author | Florian Dold <florian@dold.me> | 2024-06-21 18:42:59 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2024-06-21 18:42:59 +0200 |
commit | fab9a1176a1f5f42c9b9385c09f0d1571ad7e3e3 (patch) | |
tree | 870c94aaac7732b725c85c2437f7fb85caa23712 /packages/taler-wallet-core | |
parent | 043b7aefa91234f73209e810c85cf0d1ee7ca8d0 (diff) | |
download | wallet-core-fab9a1176a1f5f42c9b9385c09f0d1571ad7e3e3.tar.xz |
wallet-core: use correct wallet-selected amount in withdrawal
Diffstat (limited to 'packages/taler-wallet-core')
-rw-r--r-- | packages/taler-wallet-core/src/withdraw.ts | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/packages/taler-wallet-core/src/withdraw.ts b/packages/taler-wallet-core/src/withdraw.ts index b10c454f0..981c85ba4 100644 --- a/packages/taler-wallet-core/src/withdraw.ts +++ b/packages/taler-wallet-core/src/withdraw.ts @@ -3303,14 +3303,18 @@ export async function acceptWithdrawalFromUri( "amount required, as withdrawal operation has flexible amount", ); } - amount = req.amount as AmountString; + amount = Amounts.stringify(req.amount); } else { - if (req.amount != null && !p.info.editableAmount) { - throw Error( - `mismatched amount, amount is fixed by bank (${p.info.amount}) but client provided different amount (${req.amount})`, - ); + if (req.amount == null) { + amount = p.info.amount; + } else { + if (!p.info.editableAmount) { + throw Error( + `mismatched amount, amount is fixed by bank (${p.info.amount}) but client provided different amount (${req.amount})`, + ); + } + amount = Amounts.stringify(req.amount); } - amount = p.info.amount; } logger.info(`confirming withdrawal with tx ${p.transactionId}`); |