aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2024-11-07 22:26:50 +0100
committerFlorian Dold <florian@dold.me>2024-11-07 22:26:50 +0100
commit7af02519be095b214d2820fb57318ab74157a02e (patch)
treeb8e80ad1bbfa0745e7075b1a8e52bde2021e4d69
parentd70efe619e1c2ba0b02d6af41aea9cd8455ab0ee (diff)
use TEH_kyc_run_measure_instant, derive provider_name from process_row
-rw-r--r--src/exchange/taler-exchange-httpd_common_kyc.c35
-rw-r--r--src/exchangedb/pg_lookup_active_legitimization.c5
-rw-r--r--src/exchangedb/pg_lookup_active_legitimization.h2
-rw-r--r--src/include/taler_exchangedb_plugin.h2
4 files changed, 23 insertions, 21 deletions
diff --git a/src/exchange/taler-exchange-httpd_common_kyc.c b/src/exchange/taler-exchange-httpd_common_kyc.c
index f0545e503..0cf57347a 100644
--- a/src/exchange/taler-exchange-httpd_common_kyc.c
+++ b/src/exchange/taler-exchange-httpd_common_kyc.c
@@ -480,8 +480,6 @@ TEH_kyc_finished (
kat->scope = *scope;
kat->process_row = process_row;
kat->account_id = *account_id;
- kat->provider_name
- = GNUNET_strdup (provider_name);
if (NULL != provider_user_id)
kat->provider_user_id
= GNUNET_strdup (provider_user_id);
@@ -498,6 +496,7 @@ TEH_kyc_finished (
TEH_plugin->cls,
process_row,
&kat->measure_index,
+ &kat->provider_name,
&kat->jmeasures);
switch (qs)
{
@@ -514,6 +513,11 @@ TEH_kyc_finished (
break;
}
}
+ /* We optionally pass in the provider name to double check with DB. */
+ GNUNET_assert ( (NULL == provider_name) || (0 == strcasecmp (provider_name,
+ kat->
+ provider_name)) )
+ ;
kat->aml_history = json_array ();
kat->kyc_history = json_array ();
qs = TEH_plugin->lookup_aml_history (
@@ -674,7 +678,7 @@ TEH_kyc_run_measure_instant (
return TEH_kyc_finished (
scope,
- 0, /* FIXME: Start process! */
+ process_row,
instant_ms,
account_id,
"SKIP",
@@ -1841,31 +1845,20 @@ legitimization_check_run (
/* We have an 'instant' measure which means we must run the
AML program immediately instead of waiting for the account owner
to select some measure and contribute their KYC data. */
- json_t *attributes
- = json_object (); /* instant: empty attributes */
- GNUNET_assert (NULL != attributes);
- lch->kat
- = TEH_kyc_finished (
- &lch->scope,
- 0LL,
- instant_ms,
- &lch->h_payto,
- "SKIP", /* provider */
- NULL,
- NULL,
- GNUNET_TIME_UNIT_FOREVER_ABS,
- attributes,
- &legi_check_aml_trigger_cb,
- lch);
- json_decref (attributes);
+ lch->kat = TEH_kyc_run_measure_instant (
+ &lch->scope,
+ instant_ms,
+ &lch->h_payto,
+ &legi_check_aml_trigger_cb,
+ lch
+ );
if (NULL == lch->kat)
{
GNUNET_break (0);
legi_fail (lch,
TALER_EC_EXCHANGE_KYC_AML_PROGRAM_FAILURE,
NULL);
- goto cleanup;
}
goto cleanup;
}
diff --git a/src/exchangedb/pg_lookup_active_legitimization.c b/src/exchangedb/pg_lookup_active_legitimization.c
index 38c95fd4d..819bbf636 100644
--- a/src/exchangedb/pg_lookup_active_legitimization.c
+++ b/src/exchangedb/pg_lookup_active_legitimization.c
@@ -31,6 +31,7 @@ TEH_PG_lookup_active_legitimization (
void *cls,
uint64_t legitimization_process_serial_id,
uint32_t *measure_index,
+ char **provider_name,
json_t **jmeasures)
{
struct PostgresClosure *pg = cls;
@@ -45,6 +46,9 @@ TEH_PG_lookup_active_legitimization (
GNUNET_PQ_result_spec_uint32 (
"measure_index",
measure_index),
+ GNUNET_PQ_result_spec_string (
+ "provider_section",
+ provider_name),
GNUNET_PQ_result_spec_end
};
@@ -53,6 +57,7 @@ TEH_PG_lookup_active_legitimization (
"SELECT "
" lm.jmeasures"
",lp.measure_index"
+ ",lp.provider_section"
" FROM legitimization_processes lp"
" JOIN legitimization_measures lm"
" USING (legitimization_measure_serial_id)"
diff --git a/src/exchangedb/pg_lookup_active_legitimization.h b/src/exchangedb/pg_lookup_active_legitimization.h
index f7bce41cb..52e508e9b 100644
--- a/src/exchangedb/pg_lookup_active_legitimization.h
+++ b/src/exchangedb/pg_lookup_active_legitimization.h
@@ -34,6 +34,7 @@
* row in legitimization_processes table to access
* @param[out] measure_index set to the measure the
* process is trying to satisfy
+ * @param[out] provider_name name of the provider, must be freed by caller
* @param[out] jmeasures set to the legitimization
* measures that were put on the account
* @return database transaction status
@@ -43,6 +44,7 @@ TEH_PG_lookup_active_legitimization (
void *cls,
uint64_t legitimization_process_serial_id,
uint32_t *measure_index,
+ char **provider_name,
json_t **jmeasures);
diff --git a/src/include/taler_exchangedb_plugin.h b/src/include/taler_exchangedb_plugin.h
index 39d971f09..c633675d8 100644
--- a/src/include/taler_exchangedb_plugin.h
+++ b/src/include/taler_exchangedb_plugin.h
@@ -7559,6 +7559,7 @@ struct TALER_EXCHANGEDB_Plugin
* row in legitimization_processes table to access
* @param[out] measure_index set to the measure the
* process is trying to satisfy
+ * @param[out] provider_name name of the provider, must be freed by caller
* @param[out] jmeasures set to the legitimization
* measures that were put on the account
* @return database transaction status
@@ -7568,6 +7569,7 @@ struct TALER_EXCHANGEDB_Plugin
void *cls,
uint64_t legitimization_process_serial_id,
uint32_t *measure_index,
+ char **provider_name,
json_t **jmeasures);