From 727c0f3d4d92e6fe2e3d1bdf4cb2e00dca01bd52 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Thu, 7 Mar 2024 17:53:35 +0100 Subject: wallet-core: get rid of max_wire_fee --- packages/taler-wallet-core/src/coinSelection.ts | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) (limited to 'packages/taler-wallet-core/src/coinSelection.ts') diff --git a/packages/taler-wallet-core/src/coinSelection.ts b/packages/taler-wallet-core/src/coinSelection.ts index 672d0ee79..7c22f63db 100644 --- a/packages/taler-wallet-core/src/coinSelection.ts +++ b/packages/taler-wallet-core/src/coinSelection.ts @@ -75,11 +75,6 @@ export interface CoinSelectionTally { */ amountPayRemaining: AmountJson; - /** - * Allowance given by the merchant towards wire fees - */ - amountWireFeeLimitRemaining: AmountJson; - /** * Allowance given by the merchant towards deposit fees * (and wire fees after wire fee limit is exhausted) @@ -110,17 +105,9 @@ function tallyFees( if (!tally.wireFeeCoveredForExchange.has(exchangeBaseUrl)) { const wf = wireFeesPerExchange[exchangeBaseUrl] ?? Amounts.zeroOfCurrency(currency); - const wfForgiven = Amounts.min(tally.amountWireFeeLimitRemaining, wf); - tally.amountWireFeeLimitRemaining = Amounts.sub( - tally.amountWireFeeLimitRemaining, - wfForgiven, - ).amount; // The remaining, amortized amount needs to be paid by the // wallet or covered by the deposit fee allowance. - let wfRemaining = Amounts.divide( - Amounts.sub(wf, wfForgiven).amount, - wireFeeAmortization, - ); + let wfRemaining = Amounts.divide(wf, wireFeeAmortization); // This is the amount forgiven via the deposit fee allowance. const wfDepositForgiven = Amounts.min( tally.amountDepositFeeLimitRemaining, @@ -183,7 +170,7 @@ export async function selectPayCoins( wex: WalletExecutionContext, req: SelectPayCoinRequestNg, ): Promise { - const { contractTermsAmount, depositFeeLimit, wireFeeLimit } = req; + const { contractTermsAmount, depositFeeLimit } = req; if (logger.shouldLogTrace()) { logger.trace(`selecting coins for ${j2s(req)}`); @@ -218,7 +205,6 @@ export async function selectPayCoins( let tally: CoinSelectionTally = { amountPayRemaining: contractTermsAmount, - amountWireFeeLimitRemaining: wireFeeLimit, amountDepositFeeLimitRemaining: depositFeeLimit, customerDepositFees: Amounts.zeroOfCurrency(currency), customerWireFees: Amounts.zeroOfCurrency(currency), @@ -640,7 +626,6 @@ export interface SelectPayCoinRequestNg { restrictWireMethod: string; contractTermsAmount: AmountJson; depositFeeLimit: AmountJson; - wireFeeLimit: AmountJson; wireFeeAmortization: number; prevPayCoins?: PreviousPayCoins; requiredMinimumAge?: number; @@ -910,7 +895,6 @@ export function emptyTallyForPeerPayment( customerDepositFees: zero, lastDepositFee: zero, amountDepositFeeLimitRemaining: zero, - amountWireFeeLimitRemaining: zero, customerWireFees: zero, wireFeeCoveredForExchange: new Set(), }; -- cgit v1.2.3