summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2022-06-14 22:43:38 +0200
committerChristian Grothoff <christian@grothoff.org>2022-06-14 22:43:38 +0200
commit568d27abe561195d46b15ab150da314690fb0152 (patch)
tree3f35d0d32dbff5245581c0fd464b13dfb2e29351 /src
parent963477e0640284a54b6e13c947940a0fd1e47bf3 (diff)
downloadexchange-568d27abe561195d46b15ab150da314690fb0152.tar.gz
exchange-568d27abe561195d46b15ab150da314690fb0152.tar.bz2
exchange-568d27abe561195d46b15ab150da314690fb0152.zip
-include purse deposits in aggregation coin value analysis; note issues discovered with deposit fee waiver logic
Diffstat (limited to 'src')
-rw-r--r--src/auditor/taler-helper-auditor-aggregation.c24
-rw-r--r--src/auditor/taler-helper-auditor-reserves.c2
2 files changed, 19 insertions, 7 deletions
diff --git a/src/auditor/taler-helper-auditor-aggregation.c b/src/auditor/taler-helper-auditor-aggregation.c
index 20edb5f3d..1c22a48b2 100644
--- a/src/auditor/taler-helper-auditor-aggregation.c
+++ b/src/auditor/taler-helper-auditor-aggregation.c
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2016-2021 Taler Systems SA
+ Copyright (C) 2016-2022 Taler Systems SA
TALER is free software; you can redistribute it and/or modify it under the
terms of the GNU Affero Public License as published by the Free Software
@@ -400,7 +400,7 @@ check_transaction_history_for_deposit (
struct TALER_Amount spent;
struct TALER_Amount merchant_loss;
const struct TALER_Amount *deposit_fee;
- int refund_deposit_fee;
+ bool refund_deposit_fee;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Checking transaction history of coin %s\n",
@@ -421,8 +421,8 @@ check_transaction_history_for_deposit (
to reconstruct the order of the events, so instead of subtracting we
compute positive (deposit, melt) and negative (refund) values separately
here, and then subtract the negative from the positive at the end (after
- the loops). *///
- refund_deposit_fee = GNUNET_NO;
+ the loops). */
+ refund_deposit_fee = false;
deposit_fee = NULL;
for (const struct TALER_EXCHANGEDB_TransactionList *tl = tl_head;
NULL != tl;
@@ -515,7 +515,9 @@ check_transaction_history_for_deposit (
&merchant_loss,
amount_with_fee);
/* If there is a refund, we give back the deposit fee */
- refund_deposit_fee = GNUNET_YES;
+ /* FIXME: wrong: only if this is a FULL
+ refund we refund the deposit fee! */
+ refund_deposit_fee = true;
}
/* Check that the fees given in the transaction list and in dki match */
if (0 !=
@@ -555,6 +557,13 @@ check_transaction_history_for_deposit (
&expenditures,
amount_with_fee);
break;
+ case TALER_EXCHANGEDB_TT_PURSE_DEPOSIT:
+ amount_with_fee = &tl->details.purse_deposit->amount;
+ if (! tl->details.purse_deposit->refunded)
+ TALER_ARL_amount_add (&expenditures,
+ &expenditures,
+ amount_with_fee);
+ break;
}
} /* for 'tl' */
@@ -565,11 +574,14 @@ check_transaction_history_for_deposit (
"Aggregation loss due to refunds is %s\n",
TALER_amount2s (&merchant_loss));
*deposit_gain = *merchant_gain;
- if ( (GNUNET_YES == refund_deposit_fee) &&
+ if ( (refund_deposit_fee) &&
(NULL != deposit_fee) )
{
/* We had a /deposit operation AND a /refund operation,
and should thus not charge the merchant the /deposit fee */
+ /* FIXME: this is wrong, the merchant never pays either
+ fee, the deposit fee is simply not charged to the coin
+ IF there is a full refund. */
TALER_ARL_amount_add (merchant_gain,
merchant_gain,
deposit_fee);
diff --git a/src/auditor/taler-helper-auditor-reserves.c b/src/auditor/taler-helper-auditor-reserves.c
index 17d628399..d6a202765 100644
--- a/src/auditor/taler-helper-auditor-reserves.c
+++ b/src/auditor/taler-helper-auditor-reserves.c
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2016-2021 Taler Systems SA
+ Copyright (C) 2016-2022 Taler Systems SA
TALER is free software; you can redistribute it and/or modify it under the
terms of the GNU Affero Public License as published by the Free Software