diff options
author | Christian Grothoff <christian@grothoff.org> | 2024-09-05 13:12:44 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2024-09-05 13:12:44 +0200 |
commit | c39040ad2c4939b21d6ad57240a8a47dbc8f68e3 (patch) | |
tree | 7257508fd647269616c33a10cc5583e8f1a9b6d9 | |
parent | e11fc05b8715de3d90710f15dc21171142360bd4 (diff) |
add notification for KYC long pollers on trigger_kyc_rule
-rw-r--r-- | src/exchangedb/exchange_do_insert_aml_decision.sql | 2 | ||||
-rw-r--r-- | src/exchangedb/exchange_do_trigger_kyc_rule_for_account.sql | 6 | ||||
-rw-r--r-- | src/exchangedb/pg_trigger_kyc_rule_for_account.c | 15 |
3 files changed, 20 insertions, 3 deletions
diff --git a/src/exchangedb/exchange_do_insert_aml_decision.sql b/src/exchangedb/exchange_do_insert_aml_decision.sql index 4c08d5969..ca37e10ff 100644 --- a/src/exchangedb/exchange_do_insert_aml_decision.sql +++ b/src/exchangedb/exchange_do_insert_aml_decision.sql @@ -15,7 +15,7 @@ -- DROP FUNCTION IF EXISTS exchange_do_insert_aml_decision; -CREATE OR REPLACE FUNCTION exchange_do_insert_aml_decision( +CREATE FUNCTION exchange_do_insert_aml_decision( IN in_h_payto BYTEA, IN in_decision_time INT8, IN in_expiration_time INT8, diff --git a/src/exchangedb/exchange_do_trigger_kyc_rule_for_account.sql b/src/exchangedb/exchange_do_trigger_kyc_rule_for_account.sql index 504b133f3..4ddf57952 100644 --- a/src/exchangedb/exchange_do_trigger_kyc_rule_for_account.sql +++ b/src/exchangedb/exchange_do_trigger_kyc_rule_for_account.sql @@ -24,6 +24,7 @@ CREATE FUNCTION exchange_do_trigger_kyc_rule_for_account( IN in_now INT8, IN in_jmeasures TEXT, IN in_display_priority INT4, + IN in_notify_s TEXT, OUT out_legitimization_measure_serial_id INT8, OUT out_bad_kyc_auth BOOL) LANGUAGE plpgsql @@ -95,4 +96,9 @@ THEN out_legitimization_measure_serial_id; END IF; +EXECUTE FORMAT ( + 'NOTIFY %s' + ,in_notify_s); + + END $$; diff --git a/src/exchangedb/pg_trigger_kyc_rule_for_account.c b/src/exchangedb/pg_trigger_kyc_rule_for_account.c index bc7b81a74..e6f5ffcf9 100644 --- a/src/exchangedb/pg_trigger_kyc_rule_for_account.c +++ b/src/exchangedb/pg_trigger_kyc_rule_for_account.c @@ -41,6 +41,13 @@ TEH_PG_trigger_kyc_rule_for_account ( struct PostgresClosure *pg = cls; struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get (); + struct TALER_KycCompletedEventP rep = { + .header.size = htons (sizeof (rep)), + .header.type = htons (TALER_DBEVENT_EXCHANGE_KYC_COMPLETED), + .h_payto = *h_payto + }; + char *notify_str + = GNUNET_PQ_get_event_notify_channel (&rep.header); struct GNUNET_PQ_QueryParam params[] = { GNUNET_PQ_query_param_auto_from_type (h_payto), NULL == set_account_pub @@ -55,6 +62,7 @@ TEH_PG_trigger_kyc_rule_for_account ( GNUNET_PQ_query_param_absolute_time (&now), TALER_PQ_query_param_json (jmeasures), GNUNET_PQ_query_param_uint32 (&display_priority), + GNUNET_PQ_query_param_string (notify_str), GNUNET_PQ_query_param_end }; struct GNUNET_PQ_ResultSpec rs[] = { @@ -66,6 +74,7 @@ TEH_PG_trigger_kyc_rule_for_account ( bad_kyc_auth), GNUNET_PQ_result_spec_end }; + enum GNUNET_DB_QueryStatus qs; PREPARE (pg, "trigger_kyc_rule_for_account", @@ -75,11 +84,13 @@ TEH_PG_trigger_kyc_rule_for_account ( " ,out_bad_kyc_auth" " AS bad_kyc_auth" " FROM exchange_do_trigger_kyc_rule_for_account" - "($1, $2, $3, $4, $5, $6, $7);"); + "($1, $2, $3, $4, $5, $6, $7, $8);"); - return GNUNET_PQ_eval_prepared_singleton_select ( + qs = GNUNET_PQ_eval_prepared_singleton_select ( pg->conn, "trigger_kyc_rule_for_account", params, rs); + GNUNET_free (notify_str); + return qs; } |