commit cd30e6c2368d8256499d99285dc8bb1a3d514f16
parent 778e1d9d7b589ae0a5a131f3645b5e1a91f081a5
Author: bohdan-potuzhnyi <bohdan.potuzhnyi@gmail.com>
Date: Mon, 4 Aug 2025 18:52:08 +0200
Merge branch 'master' into dev/bohdan-potuzhnyi/donau-integration
Diffstat:
5 files changed, 88 insertions(+), 5 deletions(-)
diff --git a/src/backenddb/merchant-0022.sql b/src/backenddb/merchant-0022.sql
@@ -0,0 +1,42 @@
+--
+-- This file is part of TALER
+-- Copyright (C) 2025 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 merchant-0022.sql
+-- @brief Add phone number for merchant instances
+-- @author Christian Grothoff
+
+
+BEGIN;
+
+-- Check patch versioning is in place.
+SELECT _v.register_patch('merchant-0022', NULL, NULL);
+
+SET search_path TO merchant;
+
+ALTER TABLE merchant_instances
+ ADD COLUMN phone_number TEXT DEFAULT NULL,
+ ADD COLUMN phone_validated BOOL DEFAULT FALSE,
+ ADD COLUMN email_validated BOOL DEFAULT FALSE,
+ DROP COLUMN user_type;
+
+COMMENT ON COLUMN merchant_instances.phone_number
+ IS 'Phone number of the merchant to use for password reset (and to contact the merchant as the backend operator); optional if 2-FA is not used and/or for legacy instances';
+COMMENT ON COLUMN merchant_instances.phone_validated
+ IS 'TRUE if the merchant backend validated the phone number';
+COMMENT ON COLUMN merchant_instances.email_validated
+ IS 'TRUE if the merchant backend validated the e-mail address';
+
+COMMIT;
diff --git a/src/backenddb/pg_insert_instance.c b/src/backenddb/pg_insert_instance.c
@@ -56,6 +56,9 @@ TMH_PG_insert_instance (
(NULL == is->logo)
? GNUNET_PQ_query_param_null ()
: GNUNET_PQ_query_param_string (is->logo),
+ (NULL == is->phone)
+ ? GNUNET_PQ_query_param_null ()
+ : GNUNET_PQ_query_param_string (is->phone),
GNUNET_PQ_query_param_end
};
struct GNUNET_PQ_QueryParam params_priv[] = {
@@ -82,9 +85,9 @@ TMH_PG_insert_instance (
",website"
",email"
",logo"
- ",user_type)"
+ ",phone_number)"
"VALUES"
- "($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, 0)");
+ "($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14)");
qs = GNUNET_PQ_eval_prepared_non_select (pg->conn,
"insert_instance",
params);
diff --git a/src/backenddb/pg_lookup_instances.c b/src/backenddb/pg_lookup_instances.c
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2022, 2023 Taler Systems SA
+ Copyright (C) 2022--2025 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
@@ -105,6 +105,10 @@ lookup_instances_cb (void *cls,
&is.jurisdiction),
GNUNET_PQ_result_spec_bool ("use_stefan",
&is.use_stefan),
+ GNUNET_PQ_result_spec_bool ("phone_validated",
+ &is.phone_validated),
+ GNUNET_PQ_result_spec_bool ("email_validated",
+ &is.email_validated),
GNUNET_PQ_result_spec_relative_time (
"default_wire_transfer_delay",
&is.default_wire_transfer_delay),
@@ -119,6 +123,10 @@ lookup_instances_cb (void *cls,
&is.email),
NULL),
GNUNET_PQ_result_spec_allow_null (
+ GNUNET_PQ_result_spec_string ("phone_number",
+ &is.phone),
+ NULL),
+ GNUNET_PQ_result_spec_allow_null (
GNUNET_PQ_result_spec_string ("logo",
&is.logo),
NULL),
@@ -184,6 +192,9 @@ TMH_PG_lookup_instances (void *cls,
",mi.default_pay_delay"
",mi.website"
",mi.email"
+ ",mi.phone_number"
+ ",mi.phone_validated"
+ ",mi.email_validated"
",mi.logo"
",mk.merchant_priv"
" FROM merchant_instances mi"
@@ -205,6 +216,9 @@ TMH_PG_lookup_instances (void *cls,
",mi.default_pay_delay"
",mi.website"
",mi.email"
+ ",mi.phone_number"
+ ",mi.phone_validated"
+ ",mi.email_validated"
",mi.logo"
",mk.merchant_priv"
" FROM merchant_instances mi"
@@ -260,6 +274,9 @@ TMH_PG_lookup_instance (void *cls,
",mi.default_pay_delay"
",mi.website"
",mi.email"
+ ",mi.phone_number"
+ ",mi.phone_validated"
+ ",mi.email_validated"
",mi.logo"
",mk.merchant_priv"
" FROM merchant_instances mi"
@@ -275,7 +292,6 @@ TMH_PG_lookup_instance (void *cls,
",mi.auth_salt"
",mi.merchant_id"
",mi.merchant_name"
- ",mi.user_type"
",mi.address"
",mi.jurisdiction"
",mi.use_stefan"
@@ -283,6 +299,9 @@ TMH_PG_lookup_instance (void *cls,
",mi.default_pay_delay"
",mi.website"
",mi.email"
+ ",mi.phone_number"
+ ",mi.phone_validated"
+ ",mi.email_validated"
",mi.logo"
",mk.merchant_priv"
" FROM merchant_instances mi"
diff --git a/src/backenddb/pg_update_instance.c b/src/backenddb/pg_update_instance.c
@@ -51,6 +51,9 @@ TMH_PG_update_instance (void *cls,
(NULL == is->logo)
? GNUNET_PQ_query_param_null ()
: GNUNET_PQ_query_param_string (is->logo),
+ (NULL == is->phone)
+ ? GNUNET_PQ_query_param_null ()
+ : GNUNET_PQ_query_param_string (is->phone),
GNUNET_PQ_query_param_end
};
@@ -67,6 +70,7 @@ TMH_PG_update_instance (void *cls,
",website=$8"
",email=$9"
",logo=$10"
+ ",phone_number=$11"
" WHERE merchant_id=$1");
return GNUNET_PQ_eval_prepared_non_select (pg->conn,
"update_instance",
diff --git a/src/include/taler_merchantdb_plugin.h b/src/include/taler_merchantdb_plugin.h
@@ -185,11 +185,16 @@ struct TALER_MERCHANTDB_InstanceSettings
char *website;
/**
- * email contact for customers
+ * email contact for password reset / possibly admin / customers
*/
char *email;
/**
+ * phone contact for password reset / possibly admin / customers
+ */
+ char *phone;
+
+ /**
* merchant's logo data uri
*/
char *logo;
@@ -211,6 +216,16 @@ struct TALER_MERCHANTDB_InstanceSettings
bool use_stefan;
/**
+ * True of @e phone was validated.
+ */
+ bool phone_validated;
+
+ /**
+ * True of @e email was validated.
+ */
+ bool email_validated;
+
+ /**
* If the frontend does NOT specify an execution date, how long should
* we tell the exchange to wait to aggregate transactions before
* executing the wire transfer? This delay is added to the current