From 5ed3b2cfe1aa0cb31c589b308cc70684a20dd368 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Tue, 11 Apr 2023 19:44:51 +0200 Subject: store user-type with merchant settings --- .../taler-merchant-httpd_private-post-instances.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'src/backend/taler-merchant-httpd_private-post-instances.c') diff --git a/src/backend/taler-merchant-httpd_private-post-instances.c b/src/backend/taler-merchant-httpd_private-post-instances.c index 89bd937e..4d9320ba 100644 --- a/src/backend/taler-merchant-httpd_private-post-instances.c +++ b/src/backend/taler-merchant-httpd_private-post-instances.c @@ -1,6 +1,6 @@ /* This file is part of TALER - (C) 2020, 2021 Taler Systems SA + (C) 2020-2023 Taler Systems SA TALER is free software; you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as @@ -149,6 +149,7 @@ TMH_private_post_instances (const struct TMH_RequestHandler *rh, struct TALER_MERCHANTDB_InstanceAuthSettings ias; json_t *payto_uris; const char *auth_token = NULL; + const char *uts = "business"; struct TMH_WireMethod *wm_head = NULL; struct TMH_WireMethod *wm_tail = NULL; json_t *jauth; @@ -159,6 +160,10 @@ TMH_private_post_instances (const struct TMH_RequestHandler *rh, (const char **) &is.id), GNUNET_JSON_spec_string ("name", (const char **) &is.name), + GNUNET_JSON_spec_mark_optional ( + GNUNET_JSON_spec_string ("user_type", + &uts), + NULL), GNUNET_JSON_spec_mark_optional ( GNUNET_JSON_spec_string ("email", (const char **) &is.email), @@ -204,6 +209,20 @@ TMH_private_post_instances (const struct TMH_RequestHandler *rh, : MHD_NO; } + if (NULL == uts) + uts = "business"; + if (GNUNET_OK != + TALER_KYCLOGIC_kyc_user_type_from_string (uts, + &is.ut)) + { + GNUNET_break_op (0); + GNUNET_JSON_parse_free (spec); + return TALER_MHD_reply_with_error (connection, + MHD_HTTP_BAD_REQUEST, + TALER_EC_GENERIC_PARAMETER_MALFORMED, + "user_type"); + } + { enum GNUNET_GenericReturnValue ret; -- cgit v1.2.3