LCOV - code coverage report
Current view: top level - bank-lib - fakebank_tbr.c (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 15 0
Test Date: 2026-04-14 15:39:31 Functions: 0.0 % 1 0

            Line data    Source code
       1              : /*
       2              :   This file is part of TALER
       3              :   (C) 2016-2024 Taler Systems SA
       4              : 
       5              :   TALER is free software; you can redistribute it and/or
       6              :   modify it under the terms of the GNU General Public License
       7              :   as published by the Free Software Foundation; either version 3,
       8              :   or (at your option) any later version.
       9              : 
      10              :   TALER is distributed in the hope that it will be useful,
      11              :   but WITHOUT ANY WARRANTY; without even the implied warranty of
      12              :   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      13              :   GNU General Public License for more details.
      14              : 
      15              :   You should have received a copy of the GNU General Public
      16              :   License along with TALER; see the file COPYING.  If not,
      17              :   see <http://www.gnu.org/licenses/>
      18              : */
      19              : /**
      20              :  * @file bank-lib/fakebank_tbr.c
      21              :  * @brief main entry point for the Taler Bank Revenue API
      22              :  * @author Christian Grothoff <christian@grothoff.org>
      23              :  */
      24              : #include "taler/taler_fakebank_lib.h"
      25              : #include "taler/taler_bank_service.h"
      26              : #include "taler/taler_mhd_lib.h"
      27              : #include <gnunet/gnunet_mhd_compat.h>
      28              : #include "fakebank.h"
      29              : #include "fakebank_tbr.h"
      30              : #include "fakebank_tbr_get_history.h"
      31              : #include "fakebank_tbr_get_root.h"
      32              : 
      33              : 
      34              : MHD_RESULT
      35            0 : TALER_FAKEBANK_tbr_main_ (
      36              :   struct TALER_FAKEBANK_Handle *h,
      37              :   struct MHD_Connection *connection,
      38              :   const char *account,
      39              :   const char *url,
      40              :   const char *method,
      41              :   const char *upload_data,
      42              :   size_t *upload_data_size,
      43              :   void **con_cls)
      44              : {
      45            0 :   GNUNET_log (GNUNET_ERROR_TYPE_INFO,
      46              :               "Fakebank - Anastasis API: serving URL `%s' for account `%s'\n",
      47              :               url,
      48              :               account);
      49              : 
      50            0 :   if ( (0 == strcmp (url,
      51            0 :                      "/config")) &&
      52            0 :        (0 == strcasecmp (method,
      53              :                          MHD_HTTP_METHOD_GET)) )
      54              :   {
      55              :     /* GET /config */
      56            0 :     return TALER_MHD_REPLY_JSON_PACK (
      57              :       connection,
      58              :       MHD_HTTP_OK,
      59              :       GNUNET_JSON_pack_string ("version",
      60              :                                "0:0:0"),
      61              :       GNUNET_JSON_pack_string ("currency",
      62              :                                h->currency),
      63              :       GNUNET_JSON_pack_string ("implementation",
      64              :                                "urn:net:taler:specs:bank:fakebank"),
      65              :       GNUNET_JSON_pack_string ("name",
      66              :                                "taler-revenue"));
      67              :   }
      68              : 
      69            0 :   if (0 == strcasecmp (method,
      70              :                        MHD_HTTP_METHOD_GET))
      71              :   {
      72            0 :     if ( (0 == strcmp (url,
      73            0 :                        "/history")) &&
      74              :          (NULL != account) )
      75            0 :       return TALER_FAKEBANK_tbr_get_history (h,
      76              :                                              connection,
      77              :                                              account,
      78              :                                              con_cls);
      79            0 :     if (0 == strcmp (url,
      80              :                      "/"))
      81            0 :       return TALER_FAKEBANK_tbr_get_root (h,
      82              :                                           connection);
      83              :   }
      84              :   /* Unexpected URL path, just close the connection. */
      85            0 :   TALER_LOG_ERROR ("Breaking URL: %s %s\n",
      86              :                    method,
      87              :                    url);
      88            0 :   GNUNET_break_op (0);
      89            0 :   return TALER_MHD_reply_with_error (
      90              :     connection,
      91              :     MHD_HTTP_NOT_FOUND,
      92              :     TALER_EC_GENERIC_ENDPOINT_UNKNOWN,
      93              :     url);
      94              : }
        

Generated by: LCOV version 2.0-1