aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2024-11-11 13:53:05 +0100
committerFlorian Dold <florian@dold.me>2024-11-11 13:53:05 +0100
commitbd30ea8df7e7bcd459c639ac48f15683601e59f8 (patch)
treeab984b70d49b45ddfdda70cf5b5d77d6f3b2f921
parente9125316643461b8af190263aacac79d8fe7998f (diff)
fix query, implement full successor_measure support in kyc-info
-rw-r--r--src/exchange/taler-exchange-httpd_kyc-info.c54
-rw-r--r--src/exchangedb/exchange_do_insert_successor_measure.sql2
-rw-r--r--src/exchangedb/pg_insert_successor_measure.c5
3 files changed, 55 insertions, 6 deletions
diff --git a/src/exchange/taler-exchange-httpd_kyc-info.c b/src/exchange/taler-exchange-httpd_kyc-info.c
index 4b0689c07..e5eb8d3a9 100644
--- a/src/exchange/taler-exchange-httpd_kyc-info.c
+++ b/src/exchange/taler-exchange-httpd_kyc-info.c
@@ -652,9 +652,8 @@ TEH_handler_kyc_info (
TALER_KYCLOGIC_rules_free (lrs);
lrs = NULL;
}
- else
+ else if (0 == strcmp (successor_measure->prog_name, "SKIP"))
{
-
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Running successor measure %s.\n", successor_measure->
measure_name);
@@ -683,6 +682,57 @@ TEH_handler_kyc_info (
res = MHD_YES;
goto cleanup;
}
+ else
+ {
+ bool unknown_account;
+ struct GNUNET_TIME_Timestamp decision_time
+ = GNUNET_TIME_timestamp_get ();
+ struct GNUNET_TIME_Timestamp last_date;
+ json_t *succ_jmeasures = TALER_KYCLOGIC_get_jmeasures (
+ lrs,
+ successor_measure->measure_name);
+
+ GNUNET_assert (NULL != succ_jmeasures);
+ qs = TEH_plugin->insert_successor_measure (
+ TEH_plugin->cls,
+ &kyp->h_payto,
+ decision_time,
+ successor_measure->measure_name,
+ succ_jmeasures,
+ &unknown_account,
+ &last_date);
+ json_decref (succ_jmeasures);
+ if (qs <= 0)
+ {
+ GNUNET_break (0);
+ res = TALER_MHD_reply_with_ec (
+ rc->connection,
+ TALER_EC_GENERIC_DB_STORE_FAILED,
+ "insert_successor_measure");
+ goto cleanup;
+ }
+ if (unknown_account)
+ {
+ res = TALER_MHD_reply_with_ec (
+ rc->connection,
+ TALER_EC_EXCHANGE_GENERIC_BANK_ACCOUNT_UNKNOWN,
+ NULL);
+ goto cleanup;
+ }
+ if (GNUNET_TIME_timestamp_cmp (last_date,
+ >=,
+ decision_time))
+ {
+ res = TALER_MHD_reply_with_ec (
+ rc->connection,
+ TALER_EC_EXCHANGE_AML_DECISION_MORE_RECENT_PRESENT,
+ "later decision exists");
+ goto cleanup;
+ }
+ /* Back to default rules. */
+ TALER_KYCLOGIC_rules_free (lrs);
+ lrs = NULL;
+ }
}
}
diff --git a/src/exchangedb/exchange_do_insert_successor_measure.sql b/src/exchangedb/exchange_do_insert_successor_measure.sql
index d96af2927..591976695 100644
--- a/src/exchangedb/exchange_do_insert_successor_measure.sql
+++ b/src/exchangedb/exchange_do_insert_successor_measure.sql
@@ -143,7 +143,7 @@ INSERT INTO legitimization_outcomes
,'{}'
,in_new_measure_name
,FALSE
- ,in_new_rules
+ ,NULL
)
RETURNING
outcome_serial_id
diff --git a/src/exchangedb/pg_insert_successor_measure.c b/src/exchangedb/pg_insert_successor_measure.c
index 099360005..554154de4 100644
--- a/src/exchangedb/pg_insert_successor_measure.c
+++ b/src/exchangedb/pg_insert_successor_measure.c
@@ -47,7 +47,6 @@ TEH_PG_insert_successor_measure (
struct GNUNET_TIME_Timestamp expiration_time = {
.abs_time = GNUNET_TIME_UNIT_FOREVER_ABS,
};
- struct TALER_FullPaytoHashP h_full_payto;
char *notify_s
= GNUNET_PQ_get_event_notify_channel (&rep.header);
struct GNUNET_PQ_QueryParam params[] = {
@@ -74,11 +73,11 @@ TEH_PG_insert_successor_measure (
PREPARE (pg,
"do_insert_successor_measure",
"SELECT"
- ",out_account_unknown"
+ " out_account_unknown"
",out_last_date"
",out_legitimization_measure_serial_id"
" FROM exchange_do_insert_successor_measure"
- "($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14);");
+ "($1, $2, $3, $4, $5);");
qs = GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
"do_insert_successor_measure",
params,