LCOV - code coverage report
Current view: top level - auditor - taler-auditor-httpd_get-monitoring-kycauth-in-inconsistency.c (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 28 0
Test Date: 2026-09-09 15:11:34 Functions: 0.0 % 2 0

            Line data    Source code
       1              : /*
       2              :    This file is part of TALER
       3              :    Copyright (C) 2026 Taler Systems SA
       4              : 
       5              :    TALER is free software; you can redistribute it and/or modify it under the
       6              :    terms of the GNU 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 General Public License for more details.
      12              : 
      13              :    You should have received a copy of the GNU General Public License along with
      14              :    TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
      15              :  */
      16              : /**
      17              :  * @file src/auditor/taler-auditor-httpd_get-monitoring-kycauth-in-inconsistency.c
      18              :  * @brief return list of KYCAUTH incoming wire transfer inconsistencies
      19              :  * @author Christian Grothoff
      20              :  */
      21              : #include <gnunet/gnunet_util_lib.h>
      22              : #include <gnunet/gnunet_json_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-auditor-httpd.h"
      29              : #include "taler-auditor-httpd_get-monitoring-kycauth-in-inconsistency.h"
      30              : #define TALER_AUDITORDB_KYCAUTH_IN_INCONSISTENCY_RESULT_CLOSURE json_t
      31              : #include "auditor-database/iterate_kycauth_in_inconsistencies.h"
      32              : #include "auditor-database/preflight.h"
      33              : 
      34              : 
      35              : /**
      36              :  * Add kycauth-in-inconsistency to the list.
      37              :  *
      38              :  * @param[in,out] list a `json_t *` array to extend
      39              :  * @param dc struct of inconsistencies
      40              :  * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop iterating
      41              :  */
      42              : static enum GNUNET_GenericReturnValue
      43            0 : process_kycauth_in_inconsistency (
      44              :   json_t *list,
      45              :   const struct TALER_AUDITORDB_KycauthInInconsistency *dc)
      46              : {
      47              :   json_t *obj;
      48              : 
      49            0 :   obj = GNUNET_JSON_PACK (
      50              :     GNUNET_JSON_pack_uint64 ("row_id",
      51              :                              dc->serial_id),
      52              :     GNUNET_JSON_pack_uint64 ("bank_row_id",
      53              :                              dc->bank_row_id),
      54              :     TALER_JSON_pack_amount ("amount_exchange_expected",
      55              :                             &dc->amount_exchange_expected),
      56              :     TALER_JSON_pack_amount ("amount_wired",
      57              :                             &dc->amount_wired),
      58              :     GNUNET_JSON_pack_data_auto ("account_pub",
      59              :                                 &dc->account_pub),
      60              :     TALER_JSON_pack_time_abs_human ("timestamp",
      61              :                                     dc->timestamp),
      62              :     TALER_JSON_pack_full_payto ("account",
      63              :                                 dc->account),
      64              :     GNUNET_JSON_pack_string ("diagnostic",
      65              :                              dc->diagnostic),
      66              :     GNUNET_JSON_pack_bool ("suppressed",
      67              :                            dc->suppressed)
      68              :     );
      69            0 :   GNUNET_break (0 ==
      70              :                 json_array_append_new (list,
      71              :                                        obj));
      72            0 :   return GNUNET_OK;
      73              : }
      74              : 
      75              : 
      76              : enum MHD_Result
      77            0 : TAH_get_monitoring_kycauth_in_inconsistency (
      78              :   struct TAH_RequestHandler *rh,
      79              :   struct MHD_Connection *connection,
      80              :   void **connection_cls,
      81              :   const char *upload_data,
      82              :   size_t *upload_data_size,
      83              :   const char *const args[])
      84              : {
      85              :   json_t *ja;
      86              :   enum GNUNET_DB_QueryStatus qs;
      87            0 :   int64_t limit = -20;
      88              :   uint64_t offset;
      89            0 :   bool return_suppressed = false;
      90              : 
      91              :   (void) rh;
      92              :   (void) connection_cls;
      93              :   (void) upload_data;
      94              :   (void) upload_data_size;
      95            0 :   if (GNUNET_SYSERR ==
      96            0 :       TALER_AUDITORDB_preflight (TAH_apg))
      97              :   {
      98            0 :     GNUNET_break (0);
      99            0 :     return TALER_MHD_reply_with_error (connection,
     100              :                                        MHD_HTTP_INTERNAL_SERVER_ERROR,
     101              :                                        TALER_EC_GENERIC_DB_SETUP_FAILED,
     102              :                                        NULL);
     103              :   }
     104            0 :   TAH_PARSE_REQUEST_LIMIT (connection,
     105              :                                    "limit",
     106              :                                    &limit);
     107            0 :   if (limit < 0)
     108            0 :     offset = TAH_SAFE_UINT64_MAX;
     109              :   else
     110            0 :     offset = 0;
     111            0 :   TAH_PARSE_SAFE_REQUEST_NUMBER (connection,
     112              :                                   "offset",
     113              :                                   &offset);
     114              :   {
     115              :     const char *ret_s
     116            0 :       = MHD_lookup_connection_value (connection,
     117              :                                      MHD_GET_ARGUMENT_KIND,
     118              :                                      "return_suppressed");
     119            0 :     if ( (NULL != ret_s) &&
     120            0 :          (0 == strcmp (ret_s,
     121              :                        "true")) )
     122              :     {
     123            0 :       return_suppressed = true;
     124              :     }
     125              :   }
     126            0 :   ja = json_array ();
     127            0 :   GNUNET_break (NULL != ja);
     128            0 :   qs = TALER_AUDITORDB_iterate_kycauth_in_inconsistencies (
     129              :     TAH_apg,
     130              :     limit,
     131              :     offset,
     132              :     return_suppressed,
     133              :     &process_kycauth_in_inconsistency,
     134              :     ja);
     135            0 :   if (0 > qs)
     136              :   {
     137            0 :     GNUNET_break (0);
     138            0 :     json_decref (ja);
     139            0 :     return TALER_MHD_reply_with_error (connection,
     140              :                                        MHD_HTTP_INTERNAL_SERVER_ERROR,
     141              :                                        TALER_EC_GENERIC_DB_FETCH_FAILED,
     142              :                                        "kycauth-in-inconsistency");
     143              :   }
     144            0 :   return TAH_reply_json_records (connection,
     145              :                                  ja);
     146              : }
     147              : 
     148              : 
     149              : /* end of taler-auditor-httpd_get-monitoring-kycauth-in-inconsistency.c */
        

Generated by: LCOV version 2.0-1