LCOV - code coverage report
Current view: top level - backend - taler-merchant-httpd_private-delete-report-ID.c (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 14 0
Test Date: 2025-12-29 21:26:17 Functions: 0.0 % 1 0

            Line data    Source code
       1              : /*
       2              :   This file is part of TALER
       3              :   (C) 2025 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
      12              :   details.
      13              : 
      14              :   You should have received a copy of the GNU Affero General Public License
      15              :   along with TALER; see the file COPYING.  If not, see
      16              :   <http://www.gnu.org/licenses/>
      17              : */
      18              : /**
      19              :  * @file merchant/backend/taler-merchant-httpd_private-delete-report-ID.c
      20              :  * @brief implementation of DELETE /private/reports/$REPORT_ID
      21              :  * @author Christian Grothoff
      22              :  */
      23              : #include "platform.h"
      24              : #include "taler-merchant-httpd_private-delete-report-ID.h"
      25              : #include <taler/taler_json_lib.h>
      26              : 
      27              : 
      28              : MHD_RESULT
      29            0 : TMH_private_delete_report (const struct TMH_RequestHandler *rh,
      30              :                            struct MHD_Connection *connection,
      31              :                            struct TMH_HandlerContext *hc)
      32              : {
      33            0 :   const char *report_id_str = hc->infix;
      34              :   unsigned long long report_id;
      35              :   enum GNUNET_DB_QueryStatus qs;
      36              :   char dummy;
      37              : 
      38              :   (void) rh;
      39              : 
      40            0 :   if (1 !=
      41            0 :       sscanf (report_id_str,
      42              :               "%llu%c",
      43              :               &report_id,
      44              :               &dummy))
      45              :   {
      46            0 :     GNUNET_break_op (0);
      47            0 :     return TALER_MHD_reply_with_error (connection,
      48              :                                        MHD_HTTP_BAD_REQUEST,
      49              :                                        TALER_EC_GENERIC_PARAMETER_MALFORMED,
      50              :                                        "report_id");
      51              :   }
      52              : 
      53            0 :   qs = TMH_db->delete_report (TMH_db->cls,
      54            0 :                               hc->instance->settings.id,
      55              :                               (uint64_t) report_id);
      56            0 :   if (qs < 0)
      57              :   {
      58            0 :     GNUNET_break_op (0);
      59            0 :     return TALER_MHD_reply_with_error (connection,
      60              :                                        MHD_HTTP_INTERNAL_SERVER_ERROR,
      61              :                                        TALER_EC_GENERIC_DB_STORE_FAILED,
      62              :                                        "delete_report");
      63              :   }
      64            0 :   if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
      65              :   {
      66            0 :     return TALER_MHD_reply_with_error (connection,
      67              :                                        MHD_HTTP_NOT_FOUND,
      68              :                                        TALER_EC_MERCHANT_GENERIC_REPORT_UNKNOWN,
      69              :                                        report_id_str);
      70              :   }
      71            0 :   return TALER_MHD_reply_static (connection,
      72              :                                  MHD_HTTP_NO_CONTENT,
      73              :                                  NULL,
      74              :                                  NULL,
      75              :                                  0);
      76              : }
        

Generated by: LCOV version 2.0-1