aboutsummaryrefslogtreecommitdiff
path: root/src/exchangedb
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2024-07-28 16:10:42 +0200
committerChristian Grothoff <christian@grothoff.org>2024-07-29 12:18:49 +0200
commit5fd27712c37297d1b32d5a0d6a37823bfcf19a39 (patch)
tree6a520519a111570a81f48330f1409c359b167669 /src/exchangedb
parent55e4498e02d4c4e37d4533fbb26de31d574a962b (diff)
work on test_kyc_api
Diffstat (limited to 'src/exchangedb')
-rw-r--r--src/exchangedb/exchange_do_trigger_kyc_rule_for_account.sql9
-rw-r--r--src/exchangedb/pg_lookup_kyc_process_by_account.c20
-rw-r--r--src/exchangedb/pg_trigger_kyc_rule_for_account.c6
-rw-r--r--src/exchangedb/pg_trigger_kyc_rule_for_account.h9
4 files changed, 29 insertions, 15 deletions
diff --git a/src/exchangedb/exchange_do_trigger_kyc_rule_for_account.sql b/src/exchangedb/exchange_do_trigger_kyc_rule_for_account.sql
index e681b129b..f835bbc2b 100644
--- a/src/exchangedb/exchange_do_trigger_kyc_rule_for_account.sql
+++ b/src/exchangedb/exchange_do_trigger_kyc_rule_for_account.sql
@@ -16,7 +16,8 @@
CREATE OR REPLACE FUNCTION exchange_do_trigger_kyc_rule_for_account(
IN in_h_payto BYTEA,
- IN in_payto_uri TEXT,
+ IN in_account_pub BYTEA, -- can be NULL
+ IN in_payto_uri TEXT, -- can be NULL
IN in_now INT8,
IN in_jmeasures TEXT,
IN in_display_priority INT4,
@@ -39,10 +40,12 @@ IF NOT FOUND
THEN
INSERT INTO wire_targets
(payto_uri
- ,wire_target_h_payto)
+ ,wire_target_h_payto
+ ,target_pub)
VALUES
(in_payto_uri
- ,in_h_payto)
+ ,in_h_payto
+ ,in_account_pub)
RETURNING
access_token
INTO my_access_token;
diff --git a/src/exchangedb/pg_lookup_kyc_process_by_account.c b/src/exchangedb/pg_lookup_kyc_process_by_account.c
index 2002d3cb3..ce86bdc0c 100644
--- a/src/exchangedb/pg_lookup_kyc_process_by_account.c
+++ b/src/exchangedb/pg_lookup_kyc_process_by_account.c
@@ -43,17 +43,21 @@ TEH_PG_lookup_kyc_process_by_account (
GNUNET_PQ_query_param_end
};
struct GNUNET_PQ_ResultSpec rs[] = {
- GNUNET_PQ_result_spec_uint64 ("legitimization_process_serial_id",
- process_row),
- GNUNET_PQ_result_spec_absolute_time ("expiration_time",
- expiration),
+ GNUNET_PQ_result_spec_uint64 (
+ "legitimization_process_serial_id",
+ process_row),
+ GNUNET_PQ_result_spec_absolute_time (
+ "expiration_time",
+ expiration),
GNUNET_PQ_result_spec_allow_null (
- GNUNET_PQ_result_spec_string ("provider_user_id",
- provider_account_id),
+ GNUNET_PQ_result_spec_string (
+ "provider_user_id",
+ provider_account_id),
NULL),
GNUNET_PQ_result_spec_allow_null (
- GNUNET_PQ_result_spec_string ("provider_legitimization_id",
- provider_legitimization_id),
+ GNUNET_PQ_result_spec_string (
+ "provider_legitimization_id",
+ provider_legitimization_id),
NULL),
GNUNET_PQ_result_spec_end
};
diff --git a/src/exchangedb/pg_trigger_kyc_rule_for_account.c b/src/exchangedb/pg_trigger_kyc_rule_for_account.c
index 7d6753e64..7220419cf 100644
--- a/src/exchangedb/pg_trigger_kyc_rule_for_account.c
+++ b/src/exchangedb/pg_trigger_kyc_rule_for_account.c
@@ -31,6 +31,7 @@ TEH_PG_trigger_kyc_rule_for_account (
void *cls,
const char *payto_uri,
const struct TALER_PaytoHashP *h_payto,
+ const union TALER_AccountPublicKeyP *account_pub,
const json_t *jmeasures,
uint32_t display_priority,
uint64_t *requirement_row)
@@ -40,6 +41,9 @@ TEH_PG_trigger_kyc_rule_for_account (
= GNUNET_TIME_absolute_get ();
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (h_payto),
+ NULL == account_pub
+ ? GNUNET_PQ_query_param_null ()
+ : GNUNET_PQ_query_param_auto_from_type (account_pub),
NULL == payto_uri
? GNUNET_PQ_query_param_null ()
: GNUNET_PQ_query_param_string (payto_uri),
@@ -61,7 +65,7 @@ TEH_PG_trigger_kyc_rule_for_account (
" out_legitimization_measure_serial_id"
" AS legitimization_measure_serial_id"
" FROM exchange_do_trigger_kyc_rule_for_account"
- "($1, $2, $3, $4, $5);");
+ "($1, $2, $3, $4, $5, $6);");
return GNUNET_PQ_eval_prepared_singleton_select (
pg->conn,
diff --git a/src/exchangedb/pg_trigger_kyc_rule_for_account.h b/src/exchangedb/pg_trigger_kyc_rule_for_account.h
index e525c6199..7c8db0445 100644
--- a/src/exchangedb/pg_trigger_kyc_rule_for_account.h
+++ b/src/exchangedb/pg_trigger_kyc_rule_for_account.h
@@ -30,10 +30,12 @@
* Insert KYC requirement for @a h_payto account into table.
*
* @param cls closure
- * @param payto_uri account that must be KYC'ed,
- * can be NULL if @a h_payto is already
- * guaranteed to be in wire_targets
+ * @param payto_uri account that must be KYC'ed,
+ * can be NULL if @a h_payto is already
+ * guaranteed to be in wire_targets
* @param h_payto hash of @a payto_uri
+ * @param account_pub public key to enable for the
+ * KYC authorization, NULL if not known
* @param jmeasures serialized MeasureSet to put in place
* @param display_priority priority of the rule
* @param[out] requirement_row set to legitimization requirement row for this check
@@ -44,6 +46,7 @@ TEH_PG_trigger_kyc_rule_for_account (
void *cls,
const char *payto_uri,
const struct TALER_PaytoHashP *h_payto,
+ const union TALER_AccountPublicKeyP *account_pub,
const json_t *jmeasures,
uint32_t display_priority,
uint64_t *requirement_row);