aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2024-08-05 08:26:44 +0200
committerChristian Grothoff <christian@grothoff.org>2024-08-05 08:26:44 +0200
commit88a52ce02d3317ecee8aa54a45825670cd5c3e85 (patch)
treee3de6c2eef7e82d62f1d29a0cbe7ddd28818ae38
parentf33402662663b201cb911050643902d303e23165 (diff)
persist new_measure name to ensure we can validate the signature later
-rw-r--r--src/exchange/taler-exchange-httpd_aml-decision.c1
-rw-r--r--src/exchangedb/0005-legitimization_outcomes.sql7
-rw-r--r--src/exchangedb/exchange_do_insert_aml_decision.sql5
-rw-r--r--src/exchangedb/pg_insert_aml_decision.c6
-rw-r--r--src/exchangedb/pg_insert_aml_decision.h2
-rw-r--r--src/exchangedb/pg_lookup_kyc_requirement_by_row.c1
-rw-r--r--src/include/taler_exchangedb_plugin.h2
7 files changed, 22 insertions, 2 deletions
diff --git a/src/exchange/taler-exchange-httpd_aml-decision.c b/src/exchange/taler-exchange-httpd_aml-decision.c
index 67e1246eb..5eeec080f 100644
--- a/src/exchange/taler-exchange-httpd_aml-decision.c
+++ b/src/exchange/taler-exchange-httpd_aml-decision.c
@@ -154,6 +154,7 @@ TEH_handler_post_aml_decision (
properties,
new_rules,
to_investigate,
+ new_measure,
jmeasures,
justification,
officer_pub,
diff --git a/src/exchangedb/0005-legitimization_outcomes.sql b/src/exchangedb/0005-legitimization_outcomes.sql
index 16e5b5890..1c7405c99 100644
--- a/src/exchangedb/0005-legitimization_outcomes.sql
+++ b/src/exchangedb/0005-legitimization_outcomes.sql
@@ -28,6 +28,7 @@ BEGIN
',decision_time INT8 NOT NULL'
',expiration_time INT8 NOT NULL'
',jproperties TEXT'
+ ',new_measure_name TEXT'
',to_investigate BOOL NOT NULL'
',is_active BOOL NOT NULL DEFAULT(TRUE)'
',jnew_rules TEXT'
@@ -60,6 +61,12 @@ BEGIN
,partition_suffix
);
PERFORM comment_partitioned_column(
+ 'name of the measure to trigger immediately, NULL for none'
+ ,'new_measure_name'
+ ,'legitimization_outcomes'
+ ,partition_suffix
+ );
+ PERFORM comment_partitioned_column(
'time when the decision expires and the expiration jnew_rules should be applied'
,'expiration_time'
,'legitimization_outcomes'
diff --git a/src/exchangedb/exchange_do_insert_aml_decision.sql b/src/exchangedb/exchange_do_insert_aml_decision.sql
index 9c86f13f3..e6bcf40f8 100644
--- a/src/exchangedb/exchange_do_insert_aml_decision.sql
+++ b/src/exchangedb/exchange_do_insert_aml_decision.sql
@@ -22,6 +22,7 @@ CREATE OR REPLACE FUNCTION exchange_do_insert_aml_decision(
IN in_properties TEXT,
IN in_new_rules TEXT,
IN in_to_investigate BOOLEAN,
+ IN in_new_measure_name TEXT,
IN in_jmeasures TEXT,
IN in_justification TEXT,
IN in_decider_pub BYTEA,
@@ -133,6 +134,7 @@ INSERT INTO legitimization_outcomes
,decision_time
,expiration_time
,jproperties
+ ,new_measure_name
,to_investigate
,jnew_rules
)
@@ -141,6 +143,7 @@ INSERT INTO legitimization_outcomes
,in_decision_time
,in_expiration_time
,in_properties
+ ,in_new_measure_name
,in_to_investigate
,in_new_rules
)
@@ -178,5 +181,5 @@ INSERT INTO kyc_alerts
END $$;
-COMMENT ON FUNCTION exchange_do_insert_aml_decision(BYTEA, INT8, INT8, TEXT, TEXT, BOOLEAN, TEXT, TEXT, BYTEA, BYTEA, TEXT)
+COMMENT ON FUNCTION exchange_do_insert_aml_decision(BYTEA, INT8, INT8, TEXT, TEXT, BOOLEAN, TEXT, TEXT, TEXT, BYTEA, BYTEA, TEXT)
IS 'Checks whether the AML officer is eligible to make AML decisions and if so inserts the decision into the table';
diff --git a/src/exchangedb/pg_insert_aml_decision.c b/src/exchangedb/pg_insert_aml_decision.c
index f33aa0a01..281f18541 100644
--- a/src/exchangedb/pg_insert_aml_decision.c
+++ b/src/exchangedb/pg_insert_aml_decision.c
@@ -36,6 +36,7 @@ TEH_PG_insert_aml_decision (
const json_t *properties,
const json_t *new_rules,
bool to_investigate,
+ const char *new_measure_name,
const json_t *jmeasures,
const char *justification,
const struct TALER_AmlOfficerPublicKeyP *decider_pub,
@@ -61,6 +62,9 @@ TEH_PG_insert_aml_decision (
: GNUNET_PQ_query_param_null (),
TALER_PQ_query_param_json (new_rules),
GNUNET_PQ_query_param_bool (to_investigate),
+ NULL != new_measure_name
+ ? TALER_PQ_query_param_string (new_measure_name)
+ : GNUNET_PQ_query_param_null (),
NULL != jmeasures
? TALER_PQ_query_param_json (jmeasures)
: GNUNET_PQ_query_param_null (),
@@ -88,7 +92,7 @@ TEH_PG_insert_aml_decision (
",out_account_unknown"
",out_last_date"
" FROM exchange_do_insert_aml_decision"
- "($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11);");
+ "($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12);");
qs = GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
"do_insert_aml_decision",
params,
diff --git a/src/exchangedb/pg_insert_aml_decision.h b/src/exchangedb/pg_insert_aml_decision.h
index ab75845ff..cdb8d66b3 100644
--- a/src/exchangedb/pg_insert_aml_decision.h
+++ b/src/exchangedb/pg_insert_aml_decision.h
@@ -37,6 +37,7 @@
* @param properties JSON object with properties to set for the account
* @param new_rules JSON array with new AML/KYC rules
* @param to_investigate true if AML staff should look more into this account
+ * @param new_measure_name name of the @a jmeasures measure that was triggered, or NULL for none
* @param jmeasures a JSON with LegitimizationMeasures to apply to the
* account, or NULL to not apply any measure right now
* @param justification human-readable text justifying the decision
@@ -57,6 +58,7 @@ TEH_PG_insert_aml_decision (
const json_t *properties,
const json_t *new_rules,
bool to_investigate,
+ const char *new_measure_name,
const json_t *jmeasures,
const char *justification,
const struct TALER_AmlOfficerPublicKeyP *decider_pub,
diff --git a/src/exchangedb/pg_lookup_kyc_requirement_by_row.c b/src/exchangedb/pg_lookup_kyc_requirement_by_row.c
index 65ce7aba5..17397a5d7 100644
--- a/src/exchangedb/pg_lookup_kyc_requirement_by_row.c
+++ b/src/exchangedb/pg_lookup_kyc_requirement_by_row.c
@@ -73,6 +73,7 @@ TEH_PG_lookup_kyc_requirement_by_row (
// we probably want to join with THAT lo and not
// the possibly dated lo for the given row.
// Or: don't join at all with lo and simplify?
+ // What do we _really_ want here?
PREPARE (pg,
"lookup_kyc_requirement_by_row",
"SELECT "
diff --git a/src/include/taler_exchangedb_plugin.h b/src/include/taler_exchangedb_plugin.h
index 3a6610f3d..21b6a0e21 100644
--- a/src/include/taler_exchangedb_plugin.h
+++ b/src/include/taler_exchangedb_plugin.h
@@ -7495,6 +7495,7 @@ struct TALER_EXCHANGEDB_Plugin
* @param properties JSON object with properties to set for the account
* @param new_rules JSON array with new AML/KYC rules
* @param to_investigate true if AML staff should look more into this account
+ * @param new_measure_name name of the @a jmeasures measure that was triggered, or NULL for none
* @param jmeasures a JSON with LegitimizationMeasures to apply to the
* account, or NULL to not apply any measure right now
* @param justification human-readable text justifying the decision
@@ -7515,6 +7516,7 @@ struct TALER_EXCHANGEDB_Plugin
const json_t *properties,
const json_t *new_rules,
bool to_investigate,
+ const char *new_measure_name,
const json_t *jmeasures,
const char *justification,
const struct TALER_AmlOfficerPublicKeyP *decider_pub,