merchant

Merchant backend to process payments, run by merchants
Log | Files | Refs | Submodules | README | LICENSE

commit ae52368483af8b18ac3a3b68d30d4aca1871b067
parent 66f0f2d7acaba870e2b8aa18cddcecb2a30cee2d
Author: Christian Grothoff <christian@grothoff.org>
Date:   Tue, 23 Jun 2020 10:30:17 +0200

clarify with/without wire fee issue

Diffstat:
Msrc/backenddb/merchant-0001.sql | 2++
Msrc/backenddb/plugin_merchantdb_postgres.c | 9+++++----
Msrc/include/taler_merchantdb_plugin.h | 4+++-
3 files changed, 10 insertions(+), 5 deletions(-)

diff --git 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 @@ -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, diff --git a/src/include/taler_merchantdb_plugin.h b/src/include/taler_merchantdb_plugin.h @@ -1540,7 +1540,9 @@ struct TALER_MERCHANTDB_Plugin * @param exchange_url the exchange that made the transfer * @param payto_uri account that received 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