diff options
author | Christian Grothoff <christian@grothoff.org> | 2023-04-11 19:44:51 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2023-04-11 19:44:51 +0200 |
commit | 5ed3b2cfe1aa0cb31c589b308cc70684a20dd368 (patch) | |
tree | 858e253a3393febe8207e5870e59e04946fa6958 /src/backend | |
parent | feaf7bae8baf8ec701d02374e18a6b978dcfb9f8 (diff) | |
download | merchant-5ed3b2cfe1aa0cb31c589b308cc70684a20dd368.tar.gz merchant-5ed3b2cfe1aa0cb31c589b308cc70684a20dd368.tar.bz2 merchant-5ed3b2cfe1aa0cb31c589b308cc70684a20dd368.zip |
store user-type with merchant settings
Diffstat (limited to 'src/backend')
6 files changed, 50 insertions, 10 deletions
diff --git a/src/backend/Makefile.am b/src/backend/Makefile.am index 99548ef8..c6b99bfc 100644 --- a/src/backend/Makefile.am +++ b/src/backend/Makefile.am @@ -130,7 +130,7 @@ taler_merchant_httpd_SOURCES = \ taler-merchant-httpd_spa.c \ taler-merchant-httpd_spa.h \ taler-merchant-httpd_statics.c \ - taler-merchant-httpd_statics.h + taler-merchant-httpd_statics.h taler_merchant_httpd_LDADD = \ $(top_builddir)/src/backenddb/libtalermerchantdb.la \ @@ -138,6 +138,7 @@ taler_merchant_httpd_LDADD = \ -ltalertemplating \ -ltalermhd \ -ltalerbank \ + -ltalerkyclogic \ -ltalerjson \ -ltalerutil \ -ltalerpq \ diff --git a/src/backend/taler-merchant-httpd_private-get-instances-ID-kyc.c b/src/backend/taler-merchant-httpd_private-get-instances-ID-kyc.c index e25da307..e7ab0468 100644 --- a/src/backend/taler-merchant-httpd_private-get-instances-ID-kyc.c +++ b/src/backend/taler-merchant-httpd_private-get-instances-ID-kyc.c @@ -698,8 +698,7 @@ kyc_with_exchange (void *cls, eh, ekr->exchange_kyc_serial, &h_payto, - /* FIXME-#7796: get from settings! */ - TALER_KYCLOGIC_KYC_UT_BUSINESS, + ekr->kc->mi->settings.ut, kc->timeout, &exchange_check_cb, ekr); diff --git a/src/backend/taler-merchant-httpd_private-get-instances-ID.c b/src/backend/taler-merchant-httpd_private-get-instances-ID.c index 5cc7764f..c51d3de0 100644 --- a/src/backend/taler-merchant-httpd_private-get-instances-ID.c +++ b/src/backend/taler-merchant-httpd_private-get-instances-ID.c @@ -1,6 +1,6 @@ /* This file is part of TALER - (C) 2019-2021 Taler Systems SA + (C) 2019-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 published by the Free Software @@ -73,6 +73,9 @@ get_instances_ID (struct TMH_MerchantInstance *mi, ja), GNUNET_JSON_pack_string ("name", mi->settings.name), + GNUNET_JSON_pack_string ( + "user_type", + TALER_KYCLOGIC_kyc_user_type2s (mi->settings.ut)), GNUNET_JSON_pack_allow_null ( GNUNET_JSON_pack_string ("website", mi->settings.website)), diff --git a/src/backend/taler-merchant-httpd_private-get-instances.c b/src/backend/taler-merchant-httpd_private-get-instances.c index dc0f566f..50b5c0c2 100644 --- a/src/backend/taler-merchant-httpd_private-get-instances.c +++ b/src/backend/taler-merchant-httpd_private-get-instances.c @@ -1,6 +1,6 @@ /* This file is part of TALER - (C) 2019-2021 Taler Systems SA + (C) 2019-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 published by the Free Software @@ -74,6 +74,9 @@ add_instance (void *cls, GNUNET_JSON_PACK ( GNUNET_JSON_pack_string ("name", mi->settings.name), + GNUNET_JSON_pack_string ( + "user_type", + TALER_KYCLOGIC_kyc_user_type2s (mi->settings.ut)), GNUNET_JSON_pack_allow_null ( GNUNET_JSON_pack_string ("website", mi->settings.website)), diff --git a/src/backend/taler-merchant-httpd_private-patch-instances-ID.c b/src/backend/taler-merchant-httpd_private-patch-instances-ID.c index 5bd53a57..77a75da4 100644 --- a/src/backend/taler-merchant-httpd_private-patch-instances-ID.c +++ b/src/backend/taler-merchant-httpd_private-patch-instances-ID.c @@ -64,7 +64,7 @@ patch_instances_ID (struct TMH_MerchantInstance *mi, struct TALER_MERCHANTDB_InstanceSettings is; json_t *payto_uris; const char *name; - // FIXME-#7796: uint32_t ut; + const char *uts = "business"; struct TMH_WireMethod *wm_head = NULL; struct TMH_WireMethod *wm_tail = NULL; struct GNUNET_JSON_Specification spec[] = { @@ -72,7 +72,10 @@ patch_instances_ID (struct TMH_MerchantInstance *mi, &payto_uris), GNUNET_JSON_spec_string ("name", &name), - // FIXME-#7796: GNUNET_JSON_spec_uint32 ("user_type", &ut), + GNUNET_JSON_spec_mark_optional ( + GNUNET_JSON_spec_string ("user_type", + &uts), + NULL), GNUNET_JSON_spec_mark_optional ( GNUNET_JSON_spec_string ("website", (const char **) &is.website), @@ -121,7 +124,19 @@ patch_instances_ID (struct TMH_MerchantInstance *mi, ? MHD_YES : MHD_NO; } - // FIXME-#7796: is.user_type = (enum TALER_KYCLOGIC_KycUserType) ut; + 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"); + } if (! TMH_location_object_valid (is.address)) { GNUNET_break_op (0); @@ -187,7 +202,7 @@ patch_instances_ID (struct TMH_MerchantInstance *mi, /* Check for equality of settings */ if (! ( (0 == strcmp (mi->settings.name, name)) && - // FIXME-#7796: (mi->settings.user_type == is.user_type) && + (mi->settings.ut == is.ut) && ((mi->settings.email == is.email) || (NULL != is.email && NULL != mi->settings.email && 0 == strcmp (mi->settings.email, 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; @@ -160,6 +161,10 @@ TMH_private_post_instances (const struct TMH_RequestHandler *rh, 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), NULL), @@ -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; |