summaryrefslogtreecommitdiff
path: root/src/backenddb/plugin_merchantdb_postgres.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2023-04-11 19:44:51 +0200
committerChristian Grothoff <christian@grothoff.org>2023-04-11 19:44:51 +0200
commit5ed3b2cfe1aa0cb31c589b308cc70684a20dd368 (patch)
tree858e253a3393febe8207e5870e59e04946fa6958 /src/backenddb/plugin_merchantdb_postgres.c
parentfeaf7bae8baf8ec701d02374e18a6b978dcfb9f8 (diff)
downloadmerchant-5ed3b2cfe1aa0cb31c589b308cc70684a20dd368.tar.gz
merchant-5ed3b2cfe1aa0cb31c589b308cc70684a20dd368.tar.bz2
merchant-5ed3b2cfe1aa0cb31c589b308cc70684a20dd368.zip
store user-type with merchant settings
Diffstat (limited to 'src/backenddb/plugin_merchantdb_postgres.c')
-rw-r--r--src/backenddb/plugin_merchantdb_postgres.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/backenddb/plugin_merchantdb_postgres.c b/src/backenddb/plugin_merchantdb_postgres.c
index b49bc54a..5553c059 100644
--- a/src/backenddb/plugin_merchantdb_postgres.c
+++ b/src/backenddb/plugin_merchantdb_postgres.c
@@ -482,6 +482,7 @@ lookup_instances_cb (void *cls,
{
bool no_auth;
bool no_salt;
+ uint32_t ut32;
struct GNUNET_PQ_ResultSpec rs[] = {
GNUNET_PQ_result_spec_uint64 ("merchant_serial",
&lic->instance_serial),
@@ -499,6 +500,8 @@ lookup_instances_cb (void *cls,
&lic->is.id),
GNUNET_PQ_result_spec_string ("merchant_name",
&lic->is.name),
+ GNUNET_PQ_result_spec_uint32 ("user_type",
+ &ut32),
TALER_PQ_result_spec_json ("address",
&lic->is.address),
TALER_PQ_result_spec_json ("jurisdiction",
@@ -547,6 +550,7 @@ lookup_instances_cb (void *cls,
lic->qs = GNUNET_DB_STATUS_HARD_ERROR;
return;
}
+ lic->is.ut = (enum TALER_KYCLOGIC_KycUserType) ut32;
lic->qs = GNUNET_PQ_eval_prepared_multi_select (lic->pg->conn,
"lookup_accounts",
params,
@@ -699,12 +703,14 @@ postgres_insert_instance (
const struct TALER_MERCHANTDB_InstanceAuthSettings *ias)
{
struct PostgresClosure *pg = cls;
+ uint32_t ut32 = (uint32_t) is->ut;
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (merchant_pub),
GNUNET_PQ_query_param_auto_from_type (&ias->auth_hash),
GNUNET_PQ_query_param_auto_from_type (&ias->auth_salt),
GNUNET_PQ_query_param_string (is->id),
GNUNET_PQ_query_param_string (is->name),
+ GNUNET_PQ_query_param_uint32 (&ut32),
TALER_PQ_query_param_json (is->address),
TALER_PQ_query_param_json (is->jurisdiction),
TALER_PQ_query_param_amount (&is->default_max_deposit_fee),
@@ -1057,6 +1063,7 @@ postgres_update_instance (void *cls,
const struct TALER_MERCHANTDB_InstanceSettings *is)
{
struct PostgresClosure *pg = cls;
+ uint32_t ut32 = (uint32_t) is->ut;
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_string (is->id),
GNUNET_PQ_query_param_string (is->name),
@@ -1077,6 +1084,7 @@ postgres_update_instance (void *cls,
(NULL == is->logo)
? GNUNET_PQ_query_param_null ()
: GNUNET_PQ_query_param_string (is->logo),
+ GNUNET_PQ_query_param_uint32 (&ut32),
GNUNET_PQ_query_param_end
};
@@ -7627,6 +7635,7 @@ postgres_connect (void *cls)
",auth_salt"
",merchant_id"
",merchant_name"
+ ",user_type"
",address"
",jurisdiction"
",default_max_deposit_fee_val"
@@ -7649,6 +7658,7 @@ postgres_connect (void *cls)
",auth_salt"
",merchant_id"
",merchant_name"
+ ",user_type"
",address"
",jurisdiction"
",default_max_deposit_fee_val"
@@ -7671,6 +7681,7 @@ postgres_connect (void *cls)
",auth_salt"
",merchant_id"
",merchant_name"
+ ",user_type"
",address"
",jurisdiction"
",default_max_deposit_fee_val"
@@ -7684,7 +7695,7 @@ postgres_connect (void *cls)
",email"
",logo)"
"VALUES"
- "($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17)"),
+ "($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18)"),
/* for postgres_insert_instance() */
GNUNET_PQ_make_prepare ("insert_keys",
"INSERT INTO merchant_keys"
@@ -7771,7 +7782,8 @@ postgres_connect (void *cls)
",website=$12"
",email=$13"
",logo=$14"
- " WHERE merchant_id = $1"),
+ ",user_type=$15"
+ " WHERE merchant_id=$1"),
/* for postgres_update_instance_auth() */
GNUNET_PQ_make_prepare ("update_instance_auth",
"UPDATE merchant_instances SET"