diff options
author | Sebastian <sebasjm@gmail.com> | 2023-04-19 12:42:47 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2023-04-19 12:42:47 -0300 |
commit | d483a3f5574355ed9c43eb6ddea59e5734323cf0 (patch) | |
tree | 2f4e3830512b50808b396991791c3c8877e5676e /packages/taler-wallet-core/src/util/coinSelection.ts | |
parent | 7330f0daf907133876baf8831c44ec34cec326e5 (diff) |
fix #7704
Diffstat (limited to 'packages/taler-wallet-core/src/util/coinSelection.ts')
-rw-r--r-- | packages/taler-wallet-core/src/util/coinSelection.ts | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/packages/taler-wallet-core/src/util/coinSelection.ts b/packages/taler-wallet-core/src/util/coinSelection.ts index 176d636fc..3b986d72b 100644 --- a/packages/taler-wallet-core/src/util/coinSelection.ts +++ b/packages/taler-wallet-core/src/util/coinSelection.ts @@ -48,7 +48,11 @@ import { AllowedExchangeInfo, DenominationRecord, } from "../db.js"; -import { getExchangeDetails, isWithdrawableDenom } from "../index.js"; +import { + getExchangeDetails, + isWithdrawableDenom, + WalletConfig, +} from "../index.js"; import { InternalWalletState } from "../internal-wallet-state.js"; import { getMerchantPaymentBalanceDetails } from "../operations/balance.js"; import { checkDbInvariant, checkLogicInvariant } from "./invariants.js"; @@ -664,6 +668,7 @@ export async function selectCandidates( export function selectWithdrawalDenominations( amountAvailable: AmountJson, denoms: DenominationRecord[], + denomselAllowLate: boolean = false, ): DenomSelectionState { let remaining = Amounts.copy(amountAvailable); @@ -675,7 +680,7 @@ export function selectWithdrawalDenominations( let totalCoinValue = Amounts.zeroOfCurrency(amountAvailable.currency); let totalWithdrawCost = Amounts.zeroOfCurrency(amountAvailable.currency); - denoms = denoms.filter(isWithdrawableDenom); + denoms = denoms.filter((d) => isWithdrawableDenom(d, denomselAllowLate)); denoms.sort((d1, d2) => Amounts.cmp( DenominationRecord.getValue(d2), @@ -737,6 +742,7 @@ export function selectForcedWithdrawalDenominations( amountAvailable: AmountJson, denoms: DenominationRecord[], forcedDenomSel: ForcedDenomSel, + denomselAllowLate: boolean, ): DenomSelectionState { const selectedDenoms: { count: number; @@ -746,7 +752,7 @@ export function selectForcedWithdrawalDenominations( let totalCoinValue = Amounts.zeroOfCurrency(amountAvailable.currency); let totalWithdrawCost = Amounts.zeroOfCurrency(amountAvailable.currency); - denoms = denoms.filter(isWithdrawableDenom); + denoms = denoms.filter((d) => isWithdrawableDenom(d, denomselAllowLate)); denoms.sort((d1, d2) => Amounts.cmp( DenominationRecord.getValue(d2), |