diff options
author | Christian Grothoff <christian@grothoff.org> | 2024-07-25 17:13:40 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2024-07-29 12:18:48 +0200 |
commit | d825ef10974b1a9087874f289985f988e2e1b440 (patch) | |
tree | 690a0a421da1d57813d4c8b2ad4e6f738aebde9c /src/exchangedb | |
parent | ccb799456e4010c0258929605512449fd0beaf87 (diff) |
first test passes, party
Diffstat (limited to 'src/exchangedb')
-rw-r--r-- | src/exchangedb/exchange_do_insert_kyc_attributes.sql | 34 | ||||
-rw-r--r-- | src/exchangedb/pg_insert_kyc_attributes.c | 7 |
2 files changed, 21 insertions, 20 deletions
diff --git a/src/exchangedb/exchange_do_insert_kyc_attributes.sql b/src/exchangedb/exchange_do_insert_kyc_attributes.sql index 3a50b1824..12f76c17d 100644 --- a/src/exchangedb/exchange_do_insert_kyc_attributes.sql +++ b/src/exchangedb/exchange_do_insert_kyc_attributes.sql @@ -35,8 +35,6 @@ CREATE FUNCTION exchange_do_insert_kyc_attributes( LANGUAGE plpgsql AS $$ DECLARE - orig_reserve_pub BYTEA; - orig_reserve_found BOOLEAN; my_trigger_outcome_serial INT8; my_lmsi INT8; my_i INT4; @@ -87,7 +85,7 @@ UPDATE legitimization_processes AND provider_name=in_provider_name RETURNING legitimization_measure_serial_id INTO my_lmsi; -out_ok = FOUND; +out_ok=FOUND; IF out_ok THEN @@ -96,25 +94,23 @@ THEN WHERE legitimization_measure_serial_id=my_lmsi; END IF; --- If the h_payto refers to a reserve in the original requirements --- update the originating reserve's birthday. -SELECT reserve_pub - INTO orig_reserve_pub - FROM exchange.legitimization_requirements - WHERE h_payto=in_h_payto - AND NOT reserve_pub IS NULL; -orig_reserve_found = FOUND; +UPDATE reserves + SET birthday=in_birthday + WHERE (reserve_pub IN + (SELECT reserve_pub + FROM reserves_in + WHERE wire_source_h_payto=in_h_payto) ) +-- The next 3 clauses primarily serve to limit +-- unnecessary updates for reserves we do not +-- care about anymore. + AND ( ((current_balance).frac > 0) OR + ((current_balance).val > 0 ) ) + AND (expiration_date > in_collection_time_ts); -IF orig_reserve_found -THEN - UPDATE exchange.reserves - SET birthday=in_birthday - WHERE reserve_pub=orig_reserve_pub; -END IF; IF in_to_investigate THEN - INSERT INTO exchange.aml_status + INSERT INTO aml_status (h_payto ,status) VALUES @@ -124,7 +120,7 @@ THEN UPDATE SET status=EXCLUDED.status | 1; END IF; -FOR i IN 1..array_length(ina_events,1) +FOR i IN 1..COALESCE(array_length(ina_events,1),0) LOOP ini_event = ina_events[i]; INSERT INTO kyc_events diff --git a/src/exchangedb/pg_insert_kyc_attributes.c b/src/exchangedb/pg_insert_kyc_attributes.c index ba0843e19..11fac71e5 100644 --- a/src/exchangedb/pg_insert_kyc_attributes.c +++ b/src/exchangedb/pg_insert_kyc_attributes.c @@ -76,7 +76,9 @@ TEH_PG_insert_kyc_attributes ( GNUNET_PQ_query_param_timestamp (&collection_time), GNUNET_PQ_query_param_absolute_time (&expiration_time), GNUNET_PQ_query_param_timestamp (&expiration), - TALER_PQ_query_param_json (account_properties), + NULL == account_properties + ? GNUNET_PQ_query_param_null () + : TALER_PQ_query_param_json (account_properties), TALER_PQ_query_param_json (new_rules), GNUNET_PQ_query_param_array_ptrs_string (num_events, events, @@ -98,6 +100,9 @@ TEH_PG_insert_kyc_attributes ( GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Inserting KYC attributes, wake up on %s\n", kyc_completed_notify_s); + GNUNET_break (NULL != new_rules); + GNUNET_break (NULL != h_payto); + GNUNET_break (NULL != enc_attributes); PREPARE (pg, "insert_kyc_attributes", "SELECT " |