diff options
author | Florian Dold <florian@dold.me> | 2022-10-15 11:52:07 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2022-10-15 11:53:16 +0200 |
commit | e075134ffc94fda3582b179122bda594d91a962b (patch) | |
tree | 547920b2aa07bdb9f2c87a0c1f8c35dbcd64c8f7 /packages/taler-wallet-core/src/operations/transactions.ts | |
parent | 4d70391f3db386766a516bdecc3d1d265c5d49a1 (diff) | |
download | wallet-core-e075134ffc94fda3582b179122bda594d91a962b.tar.xz |
wallet-core: simplify coin record
we only track the allocation now, not the remaining amount
Diffstat (limited to 'packages/taler-wallet-core/src/operations/transactions.ts')
-rw-r--r-- | packages/taler-wallet-core/src/operations/transactions.ts | 8 |
1 files changed, 5 insertions, 3 deletions
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, |