exchange

Base system with REST service to issue digital coins, run by the payment service provider
Log | Files | Refs | Submodules | README | LICENSE

commit 97a767743cbbad2886d285f2885d3761bcb58d4a
parent 2684bbee26d4408f20b1fbe8540d483e0925ac46
Author: Florian Dold <florian@dold.me>
Date:   Thu, 31 Oct 2024 11:43:06 +0100

only insert kyc_attributes if there is a process row

Diffstat:
Msrc/exchange/taler-exchange-httpd_common_kyc.c | 2+-
Msrc/exchangedb/exchange_do_insert_kyc_attributes.sql | 31+++++++++++++++++--------------
Msrc/exchangedb/pg_insert_kyc_attributes.c | 11++++++++++-
3 files changed, 28 insertions(+), 16 deletions(-)

diff --git a/src/exchange/taler-exchange-httpd_common_kyc.c b/src/exchange/taler-exchange-httpd_common_kyc.c @@ -322,7 +322,7 @@ kyc_aml_finished ( "Stored encrypted KYC process #%llu attributes: %d\n", (unsigned long long) kat->process_row, qs); - if (qs <= 0) + if (qs < 0) { GNUNET_break (0); if (NULL != kat->response) diff --git a/src/exchangedb/exchange_do_insert_kyc_attributes.sql b/src/exchangedb/exchange_do_insert_kyc_attributes.sql @@ -68,20 +68,23 @@ RETURNING INTO my_trigger_outcome_serial; -INSERT INTO kyc_attributes - (h_payto - ,collection_time - ,expiration_time - ,encrypted_attributes - ,legitimization_serial - ,trigger_outcome_serial - ) VALUES - (in_h_payto - ,in_collection_time_ts - ,in_expiration_time_ts - ,in_enc_attributes - ,in_process_row - ,my_trigger_outcome_serial); +IF in_process_row IS NOT NULL +THEN + INSERT INTO kyc_attributes + (h_payto + ,collection_time + ,expiration_time + ,encrypted_attributes + ,legitimization_serial + ,trigger_outcome_serial + ) VALUES + (in_h_payto + ,in_collection_time_ts + ,in_expiration_time_ts + ,in_enc_attributes + ,in_process_row + ,my_trigger_outcome_serial); +END IF; UPDATE legitimization_processes SET provider_user_id=in_provider_account_id diff --git a/src/exchangedb/pg_insert_kyc_attributes.c b/src/exchangedb/pg_insert_kyc_attributes.c @@ -26,6 +26,13 @@ #include "pg_helper.h" +/* + * FIXME: + * This function does *so* much more than inserting KYC attributes. + * Sometimes it doesn't even insert KYC attributes at all. + * => Rename? + */ + enum GNUNET_DB_QueryStatus TEH_PG_insert_kyc_attributes ( void *cls, @@ -56,7 +63,9 @@ TEH_PG_insert_kyc_attributes ( char *kyc_completed_notify_s = GNUNET_PQ_get_event_notify_channel (&rep.header); struct GNUNET_PQ_QueryParam params[] = { - GNUNET_PQ_query_param_uint64 (&process_row), + (0 == process_row) + ? GNUNET_PQ_query_param_null () + : GNUNET_PQ_query_param_uint64 (&process_row), GNUNET_PQ_query_param_auto_from_type (h_payto), GNUNET_PQ_query_param_uint32 (&birthday), GNUNET_PQ_query_param_string (provider_name),