taler-typescript-core

Wallet core logic and WebUIs for various components
Log | Files | Refs | Submodules | README | LICENSE

commit b36a1cb508fc1dd5421dc92221d25a115c0f3eab
parent 09bb08db467efb0449c22b8958454d9ce1c5d1f2
Author: Sebastian <sebasjm@gmail.com>
Date:   Fri,  7 Jun 2024 15:53:18 -0300

takin currency from instructed

Diffstat:
Mpackages/taler-wallet-core/src/transactions.ts | 13++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)

diff --git 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,