From e075134ffc94fda3582b179122bda594d91a962b Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Sat, 15 Oct 2022 11:52:07 +0200 Subject: wallet-core: simplify coin record we only track the allocation now, not the remaining amount --- packages/taler-wallet-core/src/operations/transactions.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'packages/taler-wallet-core/src/operations/transactions.ts') diff --git a/packages/taler-wallet-core/src/operations/transactions.ts b/packages/taler-wallet-core/src/operations/transactions.ts index c7ff4161a..1e7f982bc 100644 --- a/packages/taler-wallet-core/src/operations/transactions.ts +++ b/packages/taler-wallet-core/src/operations/transactions.ts @@ -540,7 +540,6 @@ function buildTransactionForTip( /** * For a set of refund with the same executionTime. - * */ interface MergedRefundInfo { executionTime: TalerProtocolTimestamp; @@ -556,7 +555,7 @@ function mergeRefundByExecutionTime( const refundByExecTime = rs.reduce((prev, refund) => { const key = `${refund.executionTime.t_s}`; - //refunds counts if applied + // refunds count if applied const effective = refund.type === RefundState.Applied ? Amounts.sub( @@ -582,7 +581,10 @@ function mergeRefundByExecutionTime( v.amountAppliedEffective, effective, ).amount; - v.amountAppliedRaw = Amounts.add(v.amountAppliedRaw).amount; + v.amountAppliedRaw = Amounts.add( + v.amountAppliedRaw, + refund.refundAmount, + ).amount; v.firstTimestamp = TalerProtocolTimestamp.min( v.firstTimestamp, refund.obtainedTime, -- cgit v1.2.3