LCOV - code coverage report
Current view: top level - exchange - taler-exchange-httpd_terms.c (source / functions) Hit Total Coverage
Test: coverage.info Lines: 12 12 100.0 %
Date: 2025-07-09 07:38:29 Functions: 3 3 100.0 %

          Line data    Source code
       1             : /*
       2             :   This file is part of TALER
       3             :   Copyright (C) 2019, 2021 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_terms.c
      18             :  * @brief Handle /terms requests to return the terms of service
      19             :  * @author Christian Grothoff
      20             :  */
      21             : #include "taler/platform.h"
      22             : #include <gnunet/gnunet_util_lib.h>
      23             : #include <gnunet/gnunet_json_lib.h>
      24             : #include <jansson.h>
      25             : #include <microhttpd.h>
      26             : #include "taler/taler_mhd_lib.h"
      27             : #include "taler-exchange-httpd_responses.h"
      28             : #include "taler-exchange-httpd_terms.h"
      29             : 
      30             : /**
      31             :  * Our terms of service.
      32             :  */
      33             : static struct TALER_MHD_Legal *tos;
      34             : 
      35             : 
      36             : /**
      37             :  * Our privacy policy.
      38             :  */
      39             : static struct TALER_MHD_Legal *pp;
      40             : 
      41             : 
      42             : MHD_RESULT
      43           6 : TEH_handler_terms (struct TEH_RequestContext *rc,
      44             :                    const char *const args[])
      45             : {
      46             :   (void) args;
      47           6 :   return TALER_MHD_reply_legal (rc->connection,
      48             :                                 tos);
      49             : }
      50             : 
      51             : 
      52             : MHD_RESULT
      53           4 : TEH_handler_privacy (struct TEH_RequestContext *rc,
      54             :                      const char *const args[])
      55             : {
      56             :   (void) args;
      57           4 :   return TALER_MHD_reply_legal (rc->connection,
      58             :                                 pp);
      59             : }
      60             : 
      61             : 
      62             : void
      63          21 : TEH_load_terms (const struct GNUNET_CONFIGURATION_Handle *cfg)
      64             : {
      65          21 :   tos = TALER_MHD_legal_load (cfg,
      66             :                               "exchange",
      67             :                               "TERMS_DIR",
      68             :                               "TERMS_ETAG");
      69          21 :   if (NULL == tos)
      70          21 :     GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
      71             :                 "Terms of service not configured\n");
      72          21 :   pp = TALER_MHD_legal_load (cfg,
      73             :                              "exchange",
      74             :                              "PRIVACY_DIR",
      75             :                              "PRIVACY_ETAG");
      76          21 :   if (NULL == pp)
      77          21 :     GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
      78             :                 "Privacy policy not configured\n");
      79          21 : }
      80             : 
      81             : 
      82             : /* end of taler-exchange-httpd_terms.c */

Generated by: LCOV version 1.16