From 090c532b3adcf404c3b602c899c1e995762e0ace Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 10 Apr 2023 10:48:32 +0200 Subject: return AML status together with KYC status --- src/exchangedb/pg_lookup_kyc_requirement_by_row.c | 19 ++++++++++++++----- src/exchangedb/pg_lookup_kyc_requirement_by_row.h | 3 +++ 2 files changed, 17 insertions(+), 5 deletions(-) (limited to 'src/exchangedb') diff --git a/src/exchangedb/pg_lookup_kyc_requirement_by_row.c b/src/exchangedb/pg_lookup_kyc_requirement_by_row.c index 6542aa28f..9651359e2 100644 --- a/src/exchangedb/pg_lookup_kyc_requirement_by_row.c +++ b/src/exchangedb/pg_lookup_kyc_requirement_by_row.c @@ -30,9 +30,11 @@ TEH_PG_lookup_kyc_requirement_by_row ( void *cls, uint64_t requirement_row, char **requirements, + enum TALER_AmlDecisionState *aml_status, struct TALER_PaytoHashP *h_payto) { struct PostgresClosure *pg = cls; + uint32_t status; struct GNUNET_PQ_QueryParam params[] = { GNUNET_PQ_query_param_uint64 (&requirement_row), GNUNET_PQ_query_param_end @@ -42,19 +44,26 @@ TEH_PG_lookup_kyc_requirement_by_row ( requirements), GNUNET_PQ_result_spec_auto_from_type ("h_payto", h_payto), + GNUNET_PQ_result_spec_uint32 ("status", + &status), GNUNET_PQ_result_spec_end }; -/* Used in #postgres_lookup_kyc_requirement_by_row() */ + enum GNUNET_DB_QueryStatus qs; + PREPARE (pg, "lookup_legitimization_requirement_by_row", "SELECT " - " required_checks" - ",h_payto" - " FROM legitimization_requirements" + " lr.required_checks" + ",lr.h_payto" + ",aml.status" + " FROM legitimization_requirements lr" + " JOIN aml_status aml USING (h_payto)" " WHERE legitimization_requirement_serial_id=$1;"); - return GNUNET_PQ_eval_prepared_singleton_select ( + qs = GNUNET_PQ_eval_prepared_singleton_select ( pg->conn, "lookup_legitimization_requirement_by_row", params, rs); + *aml_status = (enum TALER_AmlDecisionState) status; + return qs; } diff --git a/src/exchangedb/pg_lookup_kyc_requirement_by_row.h b/src/exchangedb/pg_lookup_kyc_requirement_by_row.h index 12d726187..3d223c985 100644 --- a/src/exchangedb/pg_lookup_kyc_requirement_by_row.h +++ b/src/exchangedb/pg_lookup_kyc_requirement_by_row.h @@ -32,6 +32,7 @@ * @param cls closure * @param requirement_row identifies requirement to look up * @param[out] requirements provider that must be checked + * @param[out] aml_status set to the AML status of the account * @param[out] h_payto account that must be KYC'ed * @return database transaction status */ @@ -40,5 +41,7 @@ TEH_PG_lookup_kyc_requirement_by_row ( void *cls, uint64_t requirement_row, char **requirements, + enum TALER_AmlDecisionState *aml_status, struct TALER_PaytoHashP *h_payto); + #endif -- cgit v1.2.3