From b36a1cb508fc1dd5421dc92221d25a115c0f3eab Mon Sep 17 00:00:00 2001 From: Sebastian Date: Fri, 7 Jun 2024 15:53:18 -0300 Subject: takin currency from instructed --- packages/taler-wallet-core/src/transactions.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'packages/taler-wallet-core/src/transactions.ts') 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, -- cgit v1.2.3