commit 508e9b8262143e1dce7e3649a9ec1538e8ef218b
parent c0221ed2443671d1d888529cd2ce64879a85fc3a
Author: Christian Grothoff <christian@grothoff.org>
Date: Tue, 2 Jun 2026 21:51:48 +0200
tos-required boilerpate (#11183)
Diffstat:
5 files changed, 44 insertions(+), 3 deletions(-)
diff --git a/src/exchange/taler-exchange-httpd.c b/src/exchange/taler-exchange-httpd.c
@@ -147,6 +147,8 @@ json_t *TEH_hard_limits;
json_t *TEH_zero_limits;
+char *TEH_tos_etag;
+
char *TEH_shopping_url;
/**
@@ -2354,6 +2356,16 @@ exchange_serve_process_config (const char *cfg_fn)
"exchange",
"SHOPPING_URL");
}
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_string (TEH_cfg,
+ "exchange",
+ "TERMS_ETAG",
+ &TEH_tos_etag))
+ {
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_WARNING,
+ "exchange",
+ "TERMS_ETAG");
+ }
if ( (NULL != TEH_shopping_url) &&
(! TALER_is_web_url (TEH_shopping_url)) )
{
diff --git a/src/exchange/taler-exchange-httpd.h b/src/exchange/taler-exchange-httpd.h
@@ -160,6 +160,11 @@ extern struct TALER_Amount TEH_stefan_log;
extern struct TALER_Amount TEH_tiny_amount;
/**
+ * ETag of the terms of service we are currently using.
+ */
+extern char *TEH_tos_etag;
+
+/**
* URL where users can discover shops accepting digital cash
* issued by this exchange. Can be NULL.
*/
diff --git a/src/exchange/taler-exchange-httpd_get-kyc-check-H_NORMALIZED_PAYTO.c b/src/exchange/taler-exchange-httpd_get-kyc-check-H_NORMALIZED_PAYTO.c
@@ -18,7 +18,6 @@
* @brief Handle request for generic KYC check.
* @author Christian Grothoff
*/
-#include "platform.h" /* UNNECESSARY? */
#include <gnunet/gnunet_util_lib.h>
#include <gnunet/gnunet_json_lib.h>
#include <jansson.h>
@@ -27,8 +26,7 @@
#include "taler/taler_json_lib.h"
#include "taler/taler_kyclogic_lib.h"
#include "taler/taler_mhd_lib.h"
-#include "taler/taler_signatures.h" /* UNNECESSARY? */
-#include "taler/taler_dbevents.h" /* UNNECESSARY? */
+#include "taler/taler_dbevents.h"
#include "taler-exchange-httpd_get-keys.h"
#include "taler-exchange-httpd_get-kyc-check-H_NORMALIZED_PAYTO.h"
#include "taler-exchange-httpd_post-kyc-wallet.h"
@@ -220,6 +218,7 @@ TEH_handler_kyc_check (
bool aml_review;
bool kyc_required;
bool access_ok = false;
+ bool tos_required;
enum GNUNET_GenericReturnValue is_wallet;
uint64_t rule_gen = 0;
@@ -475,6 +474,11 @@ TEH_handler_kyc_check (
: ( (GNUNET_YES == is_wallet)
? "wallet"
: "account"));
+ tos_required = false;
+ if (TEH_kyc_swap_tos_acceptance)
+ {
+ /* FIXME-#11183: derive tos_required from jrules! */
+ }
jlimits = TALER_KYCLOGIC_rules_to_limits (jrules,
is_wallet);
if (NULL == jlimits)
@@ -506,6 +510,11 @@ TEH_handler_kyc_check (
GNUNET_JSON_pack_data_auto ("access_token",
&access_token),
GNUNET_JSON_pack_allow_null (
+ GNUNET_JSON_pack_string ("tos_required",
+ tos_required
+ ? TEH_tos_etag
+ : NULL)),
+ GNUNET_JSON_pack_allow_null (
GNUNET_JSON_pack_array_steal ("limits",
jlimits)));
}
diff --git a/src/include/taler/exchange/get-kyc-check-H_NORMALIZED_PAYTO.h b/src/include/taler/exchange/get-kyc-check-H_NORMALIZED_PAYTO.h
@@ -57,6 +57,17 @@ struct TALER_EXCHANGE_AccountKycStatus
*/
struct TALER_AccountAccessTokenP access_token;
+ /**
+ * Set if and only if the client must next accept the
+ * terms of service and KYC_SWAP_TOS_ACCEPTANCE is enabled.
+ * In this case, the value given is the ETag of the /terms
+ * that the customer must accept to proceed. If the customer
+ * already accepted these terms, the merchant backend will
+ * use this to signal the terms acceptance without requiring
+ * the user to again interact with it.
+ */
+ const char *tos_required;
+
};
diff --git a/src/lib/exchange_api_get-kyc-check-H_NORMALIZED_PAYTO.c b/src/lib/exchange_api_get-kyc-check-H_NORMALIZED_PAYTO.c
@@ -119,6 +119,10 @@ parse_account_status (
GNUNET_JSON_spec_fixed_auto ("access_token",
&status->access_token),
GNUNET_JSON_spec_mark_optional (
+ GNUNET_JSON_spec_string ("tos_required",
+ &status->tos_required),
+ NULL),
+ GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_array_const ("limits",
&limits),
NULL),