diff options
Diffstat (limited to 'packages/taler-wallet-core/src/transactions.ts')
-rw-r--r-- | packages/taler-wallet-core/src/transactions.ts | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/packages/taler-wallet-core/src/transactions.ts b/packages/taler-wallet-core/src/transactions.ts index bcf3fcaf6..0f7b1c3ca 100644 --- a/packages/taler-wallet-core/src/transactions.ts +++ b/packages/taler-wallet-core/src/transactions.ts @@ -739,12 +739,15 @@ function buildTransactionForBankIntegratedWithdraw( if (wg.wgInfo.withdrawalType !== WithdrawalRecordType.BankIntegrated) { throw Error(""); } - checkDbInvariant(wg.wgInfo.bankInfo.currency !== undefined, "wg uninitialized"); + const instructedCurrency = + wg.instructedAmount === undefined + ? undefined + : Amounts.currencyOf(wg.instructedAmount); + const currency = wg.wgInfo.bankInfo.currency ?? instructedCurrency; + checkDbInvariant(currency !== undefined, "wg uninitialized (missing currency)"); const txState = computeWithdrawalTransactionStatus(wg); - - const zero = Amounts.stringify( - Amounts.zeroOfCurrency(wg.wgInfo.bankInfo.currency), - ); + + const zero = Amounts.stringify(Amounts.zeroOfCurrency(currency)); return { type: TransactionType.Withdrawal, txState, |