diff options
author | Florian Dold <florian@dold.me> | 2024-04-03 16:21:33 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2024-04-03 16:21:33 +0200 |
commit | 65a656163797e9dd298b34ec916b982082db7f52 (patch) | |
tree | 1a226c657639c69194ddf7682a805bf2aa14191c /packages/taler-wallet-core/src/transactions.ts | |
parent | 5417b8b7b866f1c4f4d99d6ec9ad001af67822b6 (diff) | |
download | wallet-core-65a656163797e9dd298b34ec916b982082db7f52.tar.gz wallet-core-65a656163797e9dd298b34ec916b982082db7f52.tar.bz2 wallet-core-65a656163797e9dd298b34ec916b982082db7f52.zip |
wallet-core: allow deposits with balance locked behind refresh
Diffstat (limited to 'packages/taler-wallet-core/src/transactions.ts')
-rw-r--r-- | packages/taler-wallet-core/src/transactions.ts | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/packages/taler-wallet-core/src/transactions.ts b/packages/taler-wallet-core/src/transactions.ts index e404c0354..463aa97ba 100644 --- a/packages/taler-wallet-core/src/transactions.ts +++ b/packages/taler-wallet-core/src/transactions.ts @@ -894,10 +894,14 @@ function buildTransactionForDeposit( ort?: OperationRetryRecord, ): Transaction { let deposited = true; - for (const d of dg.statusPerCoin) { - if (d == DepositElementStatus.DepositPending) { - deposited = false; + if (dg.statusPerCoin) { + for (const d of dg.statusPerCoin) { + if (d == DepositElementStatus.DepositPending) { + deposited = false; + } } + } else { + deposited = false; } const trackingState: DepositTransactionTrackingState[] = []; @@ -911,6 +915,17 @@ function buildTransactionForDeposit( }); } + let wireTransferProgress = 0; + if (dg.statusPerCoin) { + wireTransferProgress = + (100 * + dg.statusPerCoin.reduce( + (prev, cur) => prev + (cur === DepositElementStatus.Wired ? 1 : 0), + 0, + )) / + dg.statusPerCoin.length; + } + const txState = computeDepositTransactionStatus(dg); return { type: TransactionType.Deposit, @@ -927,13 +942,7 @@ function buildTransactionForDeposit( tag: TransactionType.Deposit, depositGroupId: dg.depositGroupId, }), - wireTransferProgress: - (100 * - dg.statusPerCoin.reduce( - (prev, cur) => prev + (cur === DepositElementStatus.Wired ? 1 : 0), - 0, - )) / - dg.statusPerCoin.length, + wireTransferProgress, depositGroupId: dg.depositGroupId, trackingState, deposited, |