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-01-12 22:36:41 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/platform.h"
      25              : #include "taler/taler_fakebank_lib.h"
      26              : #include "taler/taler_bank_service.h"
      27              : #include "taler/taler_mhd_lib.h"
      28              : #include <gnunet/gnunet_mhd_compat.h>
      29              : #include "fakebank.h"
      30              : #include "fakebank_tbr.h"
      31              : #include "fakebank_tbr_get_history.h"
      32              : #include "fakebank_tbr_get_root.h"
      33              : 
      34              : 
      35              : MHD_RESULT
      36            0 : TALER_FAKEBANK_tbr_main_ (
      37              :   struct TALER_FAKEBANK_Handle *h,
      38              :   struct MHD_Connection *connection,
      39              :   const char *account,
      40              :   const char *url,
      41              :   const char *method,
      42              :   const char *upload_data,
      43              :   size_t *upload_data_size,
      44              :   void **con_cls)
      45              : {
      46            0 :   GNUNET_log (GNUNET_ERROR_TYPE_INFO,
      47              :               "Fakebank - Anastasis API: serving URL `%s' for account `%s'\n",
      48              :               url,
      49              :               account);
      50              : 
      51            0 :   if ( (0 == strcmp (url,
      52            0 :                      "/config")) &&
      53            0 :        (0 == strcasecmp (method,
      54              :                          MHD_HTTP_METHOD_GET)) )
      55              :   {
      56              :     /* GET /config */
      57            0 :     return TALER_MHD_REPLY_JSON_PACK (
      58              :       connection,
      59              :       MHD_HTTP_OK,
      60              :       GNUNET_JSON_pack_string ("version",
      61              :                                "0:0:0"),
      62              :       GNUNET_JSON_pack_string ("currency",
      63              :                                h->currency),
      64              :       GNUNET_JSON_pack_string ("implementation",
      65              :                                "urn:net:taler:specs:bank:fakebank"),
      66              :       GNUNET_JSON_pack_string ("name",
      67              :                                "taler-revenue"));
      68              :   }
      69              : 
      70            0 :   if (0 == strcasecmp (method,
      71              :                        MHD_HTTP_METHOD_GET))
      72              :   {
      73            0 :     if ( (0 == strcmp (url,
      74            0 :                        "/history")) &&
      75              :          (NULL != account) )
      76            0 :       return TALER_FAKEBANK_tbr_get_history (h,
      77              :                                              connection,
      78              :                                              account,
      79              :                                              con_cls);
      80            0 :     if (0 == strcmp (url,
      81              :                      "/"))
      82            0 :       return TALER_FAKEBANK_tbr_get_root (h,
      83              :                                           connection);
      84              :   }
      85              :   /* Unexpected URL path, just close the connection. */
      86            0 :   TALER_LOG_ERROR ("Breaking URL: %s %s\n",
      87              :                    method,
      88              :                    url);
      89            0 :   GNUNET_break_op (0);
      90            0 :   return TALER_MHD_reply_with_error (
      91              :     connection,
      92              :     MHD_HTTP_NOT_FOUND,
      93              :     TALER_EC_GENERIC_ENDPOINT_UNKNOWN,
      94              :     url);
      95              : }
        

Generated by: LCOV version 2.0-1