commit 7370e96bfa1bf3881df424eee48387f77d94be1f
parent be08da9e1ba53d980134bd026cad4a74db1aa944
Author: Christian Grothoff <christian@grothoff.org>
Date: Sun, 7 Jul 2024 10:06:18 +0200
first draft for kyc-upload
Diffstat:
11 files changed, 389 insertions(+), 141 deletions(-)
diff --git a/src/auditor/Makefile.am b/src/auditor/Makefile.am
@@ -316,7 +316,6 @@ check_SCRIPTS = \
test-revocation.sh \
test-sync.sh
-.NOTPARALLEL:
# TESTS = $(check_SCRIPTS)
EXTRA_DIST = \
diff --git a/src/exchange/taler-exchange-httpd_kyc-start.c b/src/exchange/taler-exchange-httpd_kyc-start.c
@@ -624,11 +624,12 @@ TEH_handler_kyc_start (
GNUNET_JSON_pack_array_steal ("limits",
kyp->limits)));
}
-
+ l
/* KYC not required */
GNUNET_log (GNUNET_ERROR_TYPE_START,
"KYC not required %llu\n",
(unsigned long long) kyp->requirement_row);
+
return TALER_MHD_reply_static (
rc->connection,
MHD_HTTP_NO_CONTENT,
diff --git a/src/exchange/taler-exchange-httpd_kyc-upload.c b/src/exchange/taler-exchange-httpd_kyc-upload.c
@@ -47,6 +47,12 @@ struct UploadContext
unsigned long long measure_index;
/**
+ * Index in the legitimization measures table this ID
+ * refers to.
+ */
+ unsigned long long legitimization_measure_serial_id;
+
+ /**
* Our post processor.
*/
struct MHD_PostProcessor *pp;
@@ -263,8 +269,6 @@ TEH_handler_kyc_upload (struct TEH_RequestContext *rc,
{
struct UploadContext *uc = rc->rh_ctx;
- // FIXME: decode ID to access token + measure index!
-
if (NULL == uc)
{
const char *slash;
@@ -313,9 +317,10 @@ TEH_handler_kyc_upload (struct TEH_RequestContext *rc,
TALER_EC_GENERIC_PARAMETER_MALFORMED,
"Access token in ID is malformed");
}
- if (1 != sscanf (slash + 1,
- "%llu%c",
+ if (2 != sscanf (slash + 1,
+ "%llu/%llu%c",
&uc->measure_index,
+ &uc->legitimization_measure_serial_id,
&dummy))
{
GNUNET_break_op (0);
@@ -323,7 +328,7 @@ TEH_handler_kyc_upload (struct TEH_RequestContext *rc,
rc->connection,
MHD_HTTP_NOT_FOUND,
TALER_EC_GENERIC_PARAMETER_MALFORMED,
- "Measure index in ID is malformed");
+ "ID is malformed");
}
return MHD_YES;
}
@@ -338,61 +343,123 @@ TEH_handler_kyc_upload (struct TEH_RequestContext *rc,
return mres;
}
finish_key (uc);
- // FIXME: convert access token + measure index
- // somehow into h_payto and process_row +
- // figure out where we store the measure index!
- // (is that the process_row???)
- // => review spec!
+
{
- uint64_t process_row;
+ uint64_t legi_process_row;
struct TALER_PaytoHashP h_payto;
- struct GNUNET_TIME_Timestamp now;
- struct GNUNET_TIME_Absolute expiration_time;
- void *enc_attributes;
- size_t enc_attributes_size;
enum GNUNET_DB_QueryStatus qs;
+ json_t *jmeasures;
- now = GNUNET_TIME_timestamp_get ();
-
- TALER_CRYPTO_kyc_attributes_encrypt (
- &TEH_attribute_key,
- uc->result,
- &enc_attributes,
- &enc_attributes_size);
- qs = TEH_plugin->insert_kyc_attributes (
+ qs = TEH_plugin->lookup_pending_legitimization (
TEH_plugin->cls,
- process_row,
+ uc->legitimization_measure_serial_id,
+ &uc->access_token,
&h_payto,
- 0 /* birthday unknown */,
- now,
- NULL /* provider name */,
- NULL /* provider account */,
- NULL /* provider legi ID */,
- expiration_time,
- enc_attributes_size,
- enc_attributes,
- false /* require aml??? Pass do not know? */
- );
- GNUNET_free (enc_attributes);
+ &jmeasures);
if (qs < 0)
{
GNUNET_break (0);
return TALER_MHD_reply_with_error (
rc->connection,
MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_GENERIC_DB_STORE_FAILED,
- "insert_kyc_attributes");
+ TALER_EC_GENERIC_DB_FETCH_FAILED,
+ "lookup_pending_legitimization");
}
- if (0 == qs)
+ if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
{
// FIXME: should check for idempotency!
+
+ /* Note: we do not distinguish between row ID unknown and
+ access token wrong here; this is on purpose to
+ minimize information leakage (but we could distinguish
+ the two in the future to help diagnose issues) */
+ GNUNET_break_op (0);
+ return TALER_MHD_reply_with_error (
+ rc->connection,
+ MHD_HTTP_NOT_FOUND,
+ TALER_EC_EXCHANGE_KYC_CHECK_REQUEST_UNKNOWN,
+ NULL);
+ }
+ // FIXME: Do sanity checks on jmeasures vs. POSTed data:
+ //
+ // assert ! jmeasures.verboten
+ // MeasureInformation mi = jmeasures.measures[measure_index]
+ // Have: mi.{check_name,prog_name,context}
+ // assert kyc_checks[check_name].type == form
+ // assert input data matches form requirements...
+
+ json_decref (jmeasures);
+
+ /* Setup KYC process (which we will then immediately 'finish') */
+ qs = TEH_plugin->insert_kyc_requirement_process (
+ TEH_plugin->cls,
+ &h_payto,
+ uc->measure_index,
+ uc->legitimization_measure_serial_id,
+ "FORM", // FIXME: correct??? or allow NULL?
+ NULL, /* provider account ID */
+ NULL, /* provider legi ID */
+ &legi_process_row);
+ if (qs <= 0)
+ {
+ GNUNET_break (0);
return TALER_MHD_reply_with_error (
rc->connection,
- MHD_HTTP_CONFLICT,
- TALER_EC_EXCHANGE_KYC_FORM_ALREADY_UPLOADED,
- "insert_kyc_attributes");
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_GENERIC_DB_STORE_FAILED,
+ "insert_kyc_requirement_process");
+ }
+
+ /* Now finally encrypt and store attribute data */
+ {
+ struct GNUNET_TIME_Timestamp now;
+ struct GNUNET_TIME_Absolute expiration_time;
+ void *enc_attributes;
+ size_t enc_attributes_size;
+
+ now = GNUNET_TIME_timestamp_get ();
+
+ TALER_CRYPTO_kyc_attributes_encrypt (
+ &TEH_attribute_key,
+ uc->result,
+ &enc_attributes,
+ &enc_attributes_size);
+ qs = TEH_plugin->insert_kyc_attributes (
+ TEH_plugin->cls,
+ legi_process_row,
+ &h_payto,
+ 0 /* birthday unknown */,
+ now,
+ NULL /* provider name */,
+ NULL /* provider account */,
+ NULL /* provider legi ID */,
+ expiration_time,
+ enc_attributes_size,
+ enc_attributes,
+ false /* require aml??? Pass do not know? */
+ );
+ GNUNET_free (enc_attributes);
+ if (qs < 0)
+ {
+ GNUNET_break (0);
+ return TALER_MHD_reply_with_error (
+ rc->connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_GENERIC_DB_STORE_FAILED,
+ "insert_kyc_attributes");
+ }
+ if (0 == qs)
+ {
+ // FIXME: should check for idempotency!
+ return TALER_MHD_reply_with_error (
+ rc->connection,
+ MHD_HTTP_CONFLICT,
+ TALER_EC_EXCHANGE_KYC_FORM_ALREADY_UPLOADED,
+ "insert_kyc_attributes");
+ }
}
}
+
return TALER_MHD_reply_static (
rc->connection,
MHD_HTTP_NO_CONTENT,
diff --git a/src/exchangedb/Makefile.am b/src/exchangedb/Makefile.am
@@ -170,6 +170,7 @@ libtaler_plugin_exchangedb_postgres_la_SOURCES = \
pg_insert_aml_officer.h pg_insert_aml_officer.c \
pg_test_aml_officer.h pg_test_aml_officer.c \
pg_lookup_aml_officer.h pg_lookup_aml_officer.c \
+ pg_lookup_pending_legitimization.h pg_lookup_pending_legitimization.c \
pg_trigger_aml_process.h pg_trigger_aml_process.c \
pg_insert_aml_decision.h pg_insert_aml_decision.c \
pg_select_aggregation_transient.h pg_select_aggregation_transient.c \
diff --git a/src/exchangedb/pg_insert_kyc_requirement_process.c b/src/exchangedb/pg_insert_kyc_requirement_process.c
@@ -30,6 +30,8 @@ enum GNUNET_DB_QueryStatus
TEH_PG_insert_kyc_requirement_process (
void *cls,
const struct TALER_PaytoHashP *h_payto,
+ uint32_t measure_index,
+ uint64_t legitimization_measure_serial_id,
const char *provider_name,
const char *provider_account_id,
const char *provider_legitimization_id,
@@ -48,6 +50,8 @@ TEH_PG_insert_kyc_requirement_process (
(NULL != provider_legitimization_id)
? GNUNET_PQ_query_param_string (provider_legitimization_id)
: GNUNET_PQ_query_param_null (),
+ GNUNET_PQ_query_param_uint64 (&legitimization_measure_serial_id),
+ GNUNET_PQ_query_param_uint32 (&measure_index),
GNUNET_PQ_query_param_end
};
struct GNUNET_PQ_ResultSpec rs[] = {
@@ -64,8 +68,10 @@ TEH_PG_insert_kyc_requirement_process (
" ,provider_name"
" ,provider_user_id"
" ,provider_legitimization_id"
+ " ,legitimization_measure_serial_id"
+ " ,measure_index"
" ) VALUES "
- " ($1, $2, $3, $4, $5)"
+ " ($1, $2, $3, $4, $5, $6, $7)"
" RETURNING legitimization_process_serial_id");
return GNUNET_PQ_eval_prepared_singleton_select (
pg->conn,
diff --git a/src/exchangedb/pg_insert_kyc_requirement_process.h b/src/exchangedb/pg_insert_kyc_requirement_process.h
@@ -31,6 +31,11 @@
*
* @param cls closure
* @param h_payto account that must be KYC'ed
+ * @param measure_index which of the measures in
+ * jmeasures does this KYC process relate to
+ * @param legitimization_measure_serial_id which
+ * legitimization measure set does this KYC process
+ * relate to (uniquely identifies jmeasures)
* @param provider_name provider that must be checked
* @param provider_account_id provider account ID
* @param provider_legitimization_id provider legitimization ID
@@ -41,6 +46,8 @@ enum GNUNET_DB_QueryStatus
TEH_PG_insert_kyc_requirement_process (
void *cls,
const struct TALER_PaytoHashP *h_payto,
+ uint32_t measure_index,
+ uint64_t legitimization_measure_serial_id,
const char *provider_name,
const char *provider_account_id,
const char *provider_legitimization_id,
diff --git a/src/exchangedb/pg_lookup_aml_officer.c b/src/exchangedb/pg_lookup_aml_officer.c
@@ -64,8 +64,9 @@ TEH_PG_lookup_aml_officer (
",last_change"
" FROM aml_staff"
" WHERE decider_pub=$1;");
- return GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
- "lookup_aml_officer",
- params,
- rs);
+ return GNUNET_PQ_eval_prepared_singleton_select (
+ pg->conn,
+ "lookup_aml_officer",
+ params,
+ rs);
}
diff --git a/src/exchangedb/pg_lookup_pending_legitimization.c b/src/exchangedb/pg_lookup_pending_legitimization.c
@@ -0,0 +1,67 @@
+/*
+ This file is part of TALER
+ Copyright (C) 2024 Taler Systems SA
+
+ TALER is free software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the Free Software
+ Foundation; either version 3, or (at your option) any later version.
+
+ TALER is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along with
+ TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+ */
+/**
+ * @file exchangedb/pg_lookup_pending_legitimization.c
+ * @brief Implementation of the lookup_pending_legitimization function for Postgres
+ * @author Christian Grothoff
+ */
+#include "platform.h"
+#include "taler_error_codes.h"
+#include "taler_dbevents.h"
+#include "taler_pq_lib.h"
+#include "pg_lookup_pending_legitimization.h"
+#include "pg_helper.h"
+
+
+enum GNUNET_DB_QueryStatus
+TEH_PG_lookup_pending_legitimization (
+ void *cls,
+ uint64_t legitimization_measure_serial_id,
+ const struct TALER_AccountAccessTokenP *access_token,
+ struct TALER_PaytoHashP *h_payto,
+ json_t **jmeasures)
+{
+ struct PostgresClosure *pg = cls;
+ struct GNUNET_PQ_QueryParam params[] = {
+ GNUNET_PQ_query_param_uint64 (&legitimization_measure_serial_id),
+ GNUNET_PQ_query_param_auto_from_type (access_token),
+ GNUNET_PQ_query_param_end
+ };
+ struct GNUNET_PQ_ResultSpec rs[] = {
+ TALER_PQ_result_spec_json ("jmeasures",
+ jmeasures),
+ GNUNET_PQ_result_spec_auto_from_type ("wire_target_h_payto",
+ h_payto),
+ GNUNET_PQ_result_spec_end
+ };
+
+ PREPARE (pg,
+ "lookup_pending_legitimization",
+ "SELECT "
+ " lm.jmeasures"
+ ",wt.wire_target_h_payto"
+ " FROM legitimization_measures lm"
+ " JOIN wire_targets wt"
+ " ON (lm.access_token = wt.access_token)"
+ " WHERE legitimization_measure_serial_id=$1"
+ " AND access_token=$1"
+ " AND NOT is_finished;");
+ return GNUNET_PQ_eval_prepared_singleton_select (
+ pg->conn,
+ "lookup_pending_legitimization",
+ params,
+ rs);
+}
diff --git a/src/exchangedb/pg_lookup_pending_legitimization.h b/src/exchangedb/pg_lookup_pending_legitimization.h
@@ -0,0 +1,52 @@
+/*
+ This file is part of TALER
+ Copyright (C) 2024 Taler Systems SA
+
+ TALER is free software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the Free Software
+ Foundation; either version 3, or (at your option) any later version.
+
+ TALER is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along with
+ TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+ */
+/**
+ * @file exchangedb/pg_lookup_pending_legitimization.h
+ * @brief implementation of the lookup_pending_legitimization function for Postgres
+ * @author Christian Grothoff
+ */
+#ifndef PG_LOOKUP_PENDING_LEGITIMIZATION_H
+#define PG_LOOKUP_PENDING_LEGITIMIZATION_H
+
+#include "taler_util.h"
+#include "taler_json_lib.h"
+#include "taler_exchangedb_plugin.h"
+
+
+/**
+ * Lookup measure data for a legitimization process.
+ *
+ * @param cls closure
+ * @param legitimization_measure_serial_id
+ * row in legitimization_measures table to access
+ * @param access_token
+ * token for access control that must match
+ * @param[out] h_payto set to the the hash of the
+ * payto URI of the account undergoing legitimization
+ * @param[out] jmeasures set to the legitimization
+ * measures that were put on the account
+ * @return database transaction status
+ */
+enum GNUNET_DB_QueryStatus
+TEH_PG_lookup_pending_legitimization (
+ void *cls,
+ uint64_t legitimization_measure_serial_id,
+ const struct TALER_AccountAccessTokenP *access_token,
+ struct TALER_PaytoHashP *h_payto,
+ json_t **jmeasures);
+
+
+#endif
diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c
@@ -53,6 +53,7 @@
#include "pg_lookup_records_by_table.h"
#include "pg_lookup_kyc_status_by_token.h"
#include "pg_lookup_serial_by_table.h"
+#include "pg_lookup_pending_legitimization.h"
#include "pg_select_account_merges_above_serial_id.h"
#include "pg_select_all_purse_decisions_above_serial_id.h"
#include "pg_select_purse.h"
@@ -740,6 +741,8 @@ libtaler_plugin_exchangedb_postgres_init (void *cls)
= &TEH_PG_lookup_signkey_revocation;
plugin->lookup_denomination_key
= &TEH_PG_lookup_denomination_key;
+ plugin->lookup_pending_legitimization
+ = &TEH_PG_lookup_pending_legitimization;
plugin->insert_auditor_denom_sig
= &TEH_PG_insert_auditor_denom_sig;
plugin->select_auditor_denom_sig
diff --git a/src/include/taler_exchangedb_plugin.h b/src/include/taler_exchangedb_plugin.h
@@ -4764,8 +4764,9 @@ struct TALER_EXCHANGEDB_Plugin
* @param list list to free
*/
void
- (*free_coin_transaction_list) (void *cls,
- struct TALER_EXCHANGEDB_TransactionList *list);
+ (*free_coin_transaction_list) (
+ void *cls,
+ struct TALER_EXCHANGEDB_TransactionList *list);
/**
@@ -4779,10 +4780,11 @@ struct TALER_EXCHANGEDB_Plugin
* @return query status of the transaction
*/
enum GNUNET_DB_QueryStatus
- (*lookup_wire_transfer)(void *cls,
- const struct TALER_WireTransferIdentifierRawP *wtid,
- TALER_EXCHANGEDB_AggregationDataCallback cb,
- void *cb_cls);
+ (*lookup_wire_transfer)(
+ void *cls,
+ const struct TALER_WireTransferIdentifierRawP *wtid,
+ TALER_EXCHANGEDB_AggregationDataCallback cb,
+ void *cb_cls);
/**
@@ -4832,12 +4834,13 @@ struct TALER_EXCHANGEDB_Plugin
* @return transaction status code
*/
enum GNUNET_DB_QueryStatus
- (*insert_wire_fee)(void *cls,
- const char *wire_method,
- struct GNUNET_TIME_Timestamp start_date,
- struct GNUNET_TIME_Timestamp end_date,
- const struct TALER_WireFeeSet *fees,
- const struct TALER_MasterSignatureP *master_sig);
+ (*insert_wire_fee)(
+ void *cls,
+ const char *wire_method,
+ struct GNUNET_TIME_Timestamp start_date,
+ struct GNUNET_TIME_Timestamp end_date,
+ const struct TALER_WireFeeSet *fees,
+ const struct TALER_MasterSignatureP *master_sig);
/**
@@ -4854,15 +4857,15 @@ struct TALER_EXCHANGEDB_Plugin
* @return transaction status code
*/
enum GNUNET_DB_QueryStatus
- (*insert_global_fee)(void *cls,
- struct GNUNET_TIME_Timestamp start_date,
- struct GNUNET_TIME_Timestamp end_date,
- const struct TALER_GlobalFeeSet *fees,
- struct GNUNET_TIME_Relative purse_timeout,
- struct GNUNET_TIME_Relative history_expiration,
- uint32_t purse_account_limit,
-
- const struct TALER_MasterSignatureP *master_sig);
+ (*insert_global_fee)(
+ void *cls,
+ struct GNUNET_TIME_Timestamp start_date,
+ struct GNUNET_TIME_Timestamp end_date,
+ const struct TALER_GlobalFeeSet *fees,
+ struct GNUNET_TIME_Relative purse_timeout,
+ struct GNUNET_TIME_Relative history_expiration,
+ uint32_t purse_account_limit,
+ const struct TALER_MasterSignatureP *master_sig);
/**
@@ -4878,13 +4881,14 @@ struct TALER_EXCHANGEDB_Plugin
* @return query status of the transaction
*/
enum GNUNET_DB_QueryStatus
- (*get_wire_fee)(void *cls,
- const char *type,
- struct GNUNET_TIME_Timestamp date,
- struct GNUNET_TIME_Timestamp *start_date,
- struct GNUNET_TIME_Timestamp *end_date,
- struct TALER_WireFeeSet *fees,
- struct TALER_MasterSignatureP *master_sig);
+ (*get_wire_fee)(
+ void *cls,
+ const char *type,
+ struct GNUNET_TIME_Timestamp date,
+ struct GNUNET_TIME_Timestamp *start_date,
+ struct GNUNET_TIME_Timestamp *end_date,
+ struct TALER_WireFeeSet *fees,
+ struct TALER_MasterSignatureP *master_sig);
/**
@@ -4902,15 +4906,16 @@ struct TALER_EXCHANGEDB_Plugin
* @return query status of the transaction
*/
enum GNUNET_DB_QueryStatus
- (*get_global_fee)(void *cls,
- struct GNUNET_TIME_Timestamp date,
- struct GNUNET_TIME_Timestamp *start_date,
- struct GNUNET_TIME_Timestamp *end_date,
- struct TALER_GlobalFeeSet *fees,
- struct GNUNET_TIME_Relative *purse_timeout,
- struct GNUNET_TIME_Relative *history_expiration,
- uint32_t *purse_account_limit,
- struct TALER_MasterSignatureP *master_sig);
+ (*get_global_fee)(
+ void *cls,
+ struct GNUNET_TIME_Timestamp date,
+ struct GNUNET_TIME_Timestamp *start_date,
+ struct GNUNET_TIME_Timestamp *end_date,
+ struct TALER_GlobalFeeSet *fees,
+ struct GNUNET_TIME_Relative *purse_timeout,
+ struct GNUNET_TIME_Relative *history_expiration,
+ uint32_t *purse_account_limit,
+ struct TALER_MasterSignatureP *master_sig);
/**
@@ -4924,10 +4929,11 @@ struct TALER_EXCHANGEDB_Plugin
* @return transaction status
*/
enum GNUNET_DB_QueryStatus
- (*get_expired_reserves)(void *cls,
- struct GNUNET_TIME_Timestamp now,
- TALER_EXCHANGEDB_ReserveExpiredCallback rec,
- void *rec_cls);
+ (*get_expired_reserves)(
+ void *cls,
+ struct GNUNET_TIME_Timestamp now,
+ TALER_EXCHANGEDB_ReserveExpiredCallback rec,
+ void *rec_cls);
/**
@@ -4993,19 +4999,20 @@ struct TALER_EXCHANGEDB_Plugin
* @return transaction status code
*/
enum GNUNET_DB_QueryStatus
- (*do_reserve_open)(void *cls,
- const struct TALER_ReservePublicKeyP *reserve_pub,
- const struct TALER_Amount *total_paid,
- const struct TALER_Amount *reserve_payment,
- uint32_t min_purse_limit,
- const struct TALER_ReserveSignatureP *reserve_sig,
- struct GNUNET_TIME_Timestamp desired_expiration,
- struct GNUNET_TIME_Timestamp now,
- const struct TALER_Amount *open_fee,
- bool *no_funds,
- struct TALER_Amount *reserve_balance,
- struct TALER_Amount *open_cost,
- struct GNUNET_TIME_Timestamp *final_expiration);
+ (*do_reserve_open)(
+ void *cls,
+ const struct TALER_ReservePublicKeyP *reserve_pub,
+ const struct TALER_Amount *total_paid,
+ const struct TALER_Amount *reserve_payment,
+ uint32_t min_purse_limit,
+ const struct TALER_ReserveSignatureP *reserve_sig,
+ struct GNUNET_TIME_Timestamp desired_expiration,
+ struct GNUNET_TIME_Timestamp now,
+ const struct TALER_Amount *open_fee,
+ bool *no_funds,
+ struct TALER_Amount *reserve_balance,
+ struct TALER_Amount *open_cost,
+ struct GNUNET_TIME_Timestamp *final_expiration);
/**
@@ -5090,15 +5097,16 @@ struct TALER_EXCHANGEDB_Plugin
* @return transaction status code
*/
enum GNUNET_DB_QueryStatus
- (*insert_reserve_closed)(void *cls,
- const struct TALER_ReservePublicKeyP *reserve_pub,
- struct GNUNET_TIME_Timestamp execution_date,
- const char *receiver_account,
- const struct
- TALER_WireTransferIdentifierRawP *wtid,
- const struct TALER_Amount *amount_with_fee,
- const struct TALER_Amount *closing_fee,
- uint64_t close_request_row);
+ (*insert_reserve_closed)(
+ void *cls,
+ const struct TALER_ReservePublicKeyP *reserve_pub,
+ struct GNUNET_TIME_Timestamp execution_date,
+ const char *receiver_account,
+ const struct
+ TALER_WireTransferIdentifierRawP *wtid,
+ const struct TALER_Amount *amount_with_fee,
+ const struct TALER_Amount *closing_fee,
+ uint64_t close_request_row);
/**
@@ -5153,11 +5161,12 @@ struct TALER_EXCHANGEDB_Plugin
* @return transaction status code
*/
enum GNUNET_DB_QueryStatus
- (*wire_prepare_data_get)(void *cls,
- uint64_t start_row,
- uint64_t limit,
- TALER_EXCHANGEDB_WirePreparationIterator cb,
- void *cb_cls);
+ (*wire_prepare_data_get)(
+ void *cls,
+ uint64_t start_row,
+ uint64_t limit,
+ TALER_EXCHANGEDB_WirePreparationIterator cb,
+ void *cb_cls);
/**
@@ -5218,10 +5227,11 @@ struct TALER_EXCHANGEDB_Plugin
* @return transaction status code
*/
enum GNUNET_DB_QueryStatus
- (*select_coin_deposits_above_serial_id)(void *cls,
- uint64_t serial_id,
- TALER_EXCHANGEDB_DepositCallback cb,
- void *cb_cls);
+ (*select_coin_deposits_above_serial_id)(
+ void *cls,
+ uint64_t serial_id,
+ TALER_EXCHANGEDB_DepositCallback cb,
+ void *cb_cls);
/**
@@ -5362,10 +5372,11 @@ struct TALER_EXCHANGEDB_Plugin
* @return transaction status code
*/
enum GNUNET_DB_QueryStatus
- (*select_refreshes_above_serial_id)(void *cls,
- uint64_t serial_id,
- TALER_EXCHANGEDB_RefreshesCallback cb,
- void *cb_cls);
+ (*select_refreshes_above_serial_id)(
+ void *cls,
+ uint64_t serial_id,
+ TALER_EXCHANGEDB_RefreshesCallback cb,
+ void *cb_cls);
/**
@@ -5379,10 +5390,11 @@ struct TALER_EXCHANGEDB_Plugin
* @return transaction status code
*/
enum GNUNET_DB_QueryStatus
- (*select_refunds_above_serial_id)(void *cls,
- uint64_t serial_id,
- TALER_EXCHANGEDB_RefundCallback cb,
- void *cb_cls);
+ (*select_refunds_above_serial_id)(
+ void *cls,
+ uint64_t serial_id,
+ TALER_EXCHANGEDB_RefundCallback cb,
+ void *cb_cls);
/**
@@ -5396,10 +5408,11 @@ struct TALER_EXCHANGEDB_Plugin
* @return transaction status code
*/
enum GNUNET_DB_QueryStatus
- (*select_reserves_in_above_serial_id)(void *cls,
- uint64_t serial_id,
- TALER_EXCHANGEDB_ReserveInCallback cb,
- void *cb_cls);
+ (*select_reserves_in_above_serial_id)(
+ void *cls,
+ uint64_t serial_id,
+ TALER_EXCHANGEDB_ReserveInCallback cb,
+ void *cb_cls);
/**
@@ -5452,11 +5465,11 @@ struct TALER_EXCHANGEDB_Plugin
* @return transaction status code
*/
enum GNUNET_DB_QueryStatus
- (*select_wire_out_above_serial_id)(void *cls,
- uint64_t serial_id,
- TALER_EXCHANGEDB_WireTransferOutCallback
- cb,
- void *cb_cls);
+ (*select_wire_out_above_serial_id)(
+ void *cls,
+ uint64_t serial_id,
+ TALER_EXCHANGEDB_WireTransferOutCallback cb,
+ void *cb_cls);
/**
* Function called to select outgoing wire transfers the exchange
@@ -5489,10 +5502,11 @@ struct TALER_EXCHANGEDB_Plugin
* @return transaction status code
*/
enum GNUNET_DB_QueryStatus
- (*select_recoup_above_serial_id)(void *cls,
- uint64_t serial_id,
- TALER_EXCHANGEDB_RecoupCallback cb,
- void *cb_cls);
+ (*select_recoup_above_serial_id)(
+ void *cls,
+ uint64_t serial_id,
+ TALER_EXCHANGEDB_RecoupCallback cb,
+ void *cb_cls);
/**
@@ -6757,6 +6771,11 @@ struct TALER_EXCHANGEDB_Plugin
*
* @param cls closure
* @param h_payto account that must be KYC'ed
+ * @param measure_index which of the measures in
+ * jmeasures does this KYC process relate to
+ * @param legitimization_measure_serial_id which
+ * legitimization measure set does this KYC process
+ * relate to (uniquely identifies jmeasures)
* @param provider_name provider that must be checked
* @param provider_account_id provider account ID
* @param provider_legitimization_id provider legitimization ID
@@ -6767,6 +6786,8 @@ struct TALER_EXCHANGEDB_Plugin
(*insert_kyc_requirement_process)(
void *cls,
const struct TALER_PaytoHashP *h_payto,
+ uint32_t measure_index,
+ uint64_t legitimization_measure_serial_id,
const char *provider_name,
const char *provider_account_id,
const char *provider_legitimization_id,
@@ -7232,6 +7253,29 @@ struct TALER_EXCHANGEDB_Plugin
/**
+ * Lookup measure data for a legitimization process.
+ *
+ * @param cls closure
+ * @param legitimization_measure_serial_id
+ * row in legitimization_measures table to access
+ * @param access_token
+ * token for access control that must match
+ * @param[out] h_payto set to the the hash of the
+ * payto URI of the account undergoing legitimization
+ * @param[out] jmeasures set to the legitimization
+ * measures that were put on the account
+ * @return database transaction status
+ */
+ enum GNUNET_DB_QueryStatus
+ (*lookup_pending_legitimization)(
+ void *cls,
+ uint64_t legitimization_measure_serial_id,
+ const struct TALER_AccountAccessTokenP *access_token,
+ struct TALER_PaytoHashP *h_payto,
+ json_t **jmeasures);
+
+
+ /**
* Insert an AML decision. Inserts into AML history and insert or updates AML
* status.
*