From ae52368483af8b18ac3a3b68d30d4aca1871b067 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Tue, 23 Jun 2020 10:30:17 +0200 Subject: clarify with/without wire fee issue --- src/backenddb/merchant-0001.sql | 2 ++ src/backenddb/plugin_merchantdb_postgres.c | 9 +++++---- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'src/backenddb') diff --git a/src/backenddb/merchant-0001.sql b/src/backenddb/merchant-0001.sql index b89f7792..f6f91f34 100644 --- a/src/backenddb/merchant-0001.sql +++ b/src/backenddb/merchant-0001.sql @@ -364,6 +364,8 @@ COMMENT ON COLUMN merchant_transfers.verified IS 'true once we got an acceptable response from the exchange for this transfer'; COMMENT ON COLUMN merchant_transfers.confirmed IS 'true once the merchant confirmed that this transfer was received'; +COMMENT ON COLUMN merchant_transfers.credit_amount_val + IS 'actual value of the (aggregated) wire transfer, excluding the wire fee'; CREATE TABLE IF NOT EXISTS merchant_transfer_signatures (credit_serial BIGINT PRIMARY KEY diff --git a/src/backenddb/plugin_merchantdb_postgres.c b/src/backenddb/plugin_merchantdb_postgres.c index fc1e3acc..8c6eb802 100644 --- a/src/backenddb/plugin_merchantdb_postgres.c +++ b/src/backenddb/plugin_merchantdb_postgres.c @@ -3242,7 +3242,7 @@ RETRY: GNUNET_PQ_query_param_string (payto_uri), GNUNET_PQ_query_param_string (instance_id), GNUNET_PQ_query_param_auto_from_type (wtid), - TALER_PQ_query_param_amount (&td->total_amount), + TALER_PQ_query_param_amount (&td->total_amount), /* excludes wire fee */ GNUNET_PQ_query_param_end }; struct GNUNET_PQ_ResultSpec rs[] = { @@ -3551,7 +3551,9 @@ postgres_lookup_deposits_by_contract_and_coin ( * @param cls closure * @param exchange_url the exchange that made the transfer * @param wtid wire transfer subject - * @param[out] total_amount amount that was transferred (in total, minus @a wire_fee) + * @param[out] total_amount amount that was debited from our + * aggregate balance at the exchange (in total, sum of + * the wire transfer amount and the @a wire_fee) * @param[out] wire_fee the wire fee the exchange charged * @param[out] execution_time when the transfer was executed by the exchange * @param[out] verified did we confirm the transfer was OK @@ -3574,6 +3576,7 @@ postgres_lookup_transfer ( GNUNET_PQ_query_param_end }; uint8_t verified8; + /** Amount we got actually credited, _excludes_ the wire fee */ struct TALER_Amount credit_amount; struct GNUNET_PQ_ResultSpec rs[] = { TALER_PQ_RESULT_SPEC_AMOUNT ("credit_amount", @@ -3596,8 +3599,6 @@ postgres_lookup_transfer ( if (qs > 0) { *verified = (0 != verified8); - // FIXME: unclear if table stores 'total' including or excluding fee :-(. - // Check and update DOCS and taler_exchange_service.h header! if (0 > TALER_amount_add (total_amount, &credit_amount, -- cgit v1.2.3