exchange

Base system with REST service to issue digital coins, run by the payment service provider
Log | Files | Refs | Submodules | README | LICENSE

taler-exchange-httpd_aml-measures-get.c (2448B)


      1 /*
      2   This file is part of TALER
      3   Copyright (C) 2024 Taler Systems SA
      4 
      5   TALER is free software; you can redistribute it and/or modify it under the
      6   terms of the GNU Affero General Public License as published by the Free Software
      7   Foundation; either version 3, or (at your option) any later version.
      8 
      9   TALER is distributed in the hope that it will be useful, but WITHOUT ANY
     10   WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
     11   A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more details.
     12 
     13   You should have received a copy of the GNU Affero General Public License along with
     14   TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
     15 */
     16 /**
     17  * @file taler-exchange-httpd_aml-measures-get.c
     18  * @brief Return summary information about KYC measures
     19  * @author Christian Grothoff
     20  */
     21 #include "taler/platform.h"
     22 #include <gnunet/gnunet_util_lib.h>
     23 #include <jansson.h>
     24 #include <microhttpd.h>
     25 #include <pthread.h>
     26 #include "taler/taler_json_lib.h"
     27 #include "taler/taler_mhd_lib.h"
     28 #include "taler/taler_kyclogic_lib.h"
     29 #include "taler/taler_signatures.h"
     30 #include "taler-exchange-httpd.h"
     31 #include "taler-exchange-httpd_aml-measures-get.h"
     32 
     33 
     34 MHD_RESULT
     35 TEH_handler_aml_measures_get (
     36   struct TEH_RequestContext *rc,
     37   const struct TALER_AmlOfficerPublicKeyP *officer_pub,
     38   const char *const args[])
     39 {
     40   static json_t *roots;
     41   static json_t *programs;
     42   static json_t *checks;
     43   static json_t *default_rules;
     44 
     45   if (NULL == roots)
     46   {
     47     TALER_KYCLOGIC_get_measure_configuration (&roots,
     48                                               &programs,
     49                                               &checks,
     50                                               &default_rules);
     51   }
     52   if (NULL != args[0])
     53   {
     54     GNUNET_break_op (0);
     55     return TALER_MHD_reply_with_error (
     56       rc->connection,
     57       MHD_HTTP_NOT_FOUND,
     58       TALER_EC_GENERIC_ENDPOINT_UNKNOWN,
     59       rc->url);
     60   }
     61   return TALER_MHD_REPLY_JSON_PACK (
     62     rc->connection,
     63     MHD_HTTP_OK,
     64     GNUNET_JSON_pack_array_incref ("default_rules",
     65                                    default_rules),
     66     GNUNET_JSON_pack_object_incref ("roots",
     67                                     roots),
     68     GNUNET_JSON_pack_object_incref ("programs",
     69                                     programs),
     70     GNUNET_JSON_pack_object_incref ("checks",
     71                                     checks));
     72 }
     73 
     74 
     75 /* end of taler-exchange-httpd_aml-measures_get.c */