LCOV - code coverage report
Current view: top level - backenddb - delete_tos_accepted_early.c (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 23 0
Test Date: 2026-09-11 17:45:24 Functions: 0.0 % 1 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/backenddb/delete_tos_accepted_early.c
      18              :  * @brief Implementation of the delete_tos_accepted_early function for Postgres
      19              :  * @author Christian Grothoff
      20              :  */
      21              : #include "platform.h"
      22              : #include <taler/taler_pq_lib.h>
      23              : #include <taler/taler_dbevents.h>
      24              : #include "merchant-database/delete_tos_accepted_early.h"
      25              : #include "helper.h"
      26              : 
      27              : 
      28              : enum GNUNET_DB_QueryStatus
      29            0 : TALER_MERCHANTDB_delete_tos_accepted_early (
      30              :   struct TALER_MERCHANTDB_PostgresContext *pg,
      31              :   const char *merchant_id,
      32              :   const char *exchange_url)
      33              : {
      34            0 :   struct TALER_MERCHANTDB_MerchantKycStatusChangeEventP ev = {
      35            0 :     .header.size = htons (sizeof (ev)),
      36            0 :     .header.type = htons (TALER_DBEVENT_MERCHANT_EXCHANGE_KYC_STATUS_CHANGED),
      37              :     .merchant_pub = pg->current_merchant_pub
      38              :   };
      39            0 :   struct TALER_MERCHANTDB_InstanceKycStatusChangeEventP hdr = {
      40            0 :     .header.size = htons (sizeof (hdr)),
      41            0 :     .header.type = htons (TALER_DBEVENT_MERCHANT_KYC_STATUS_CHANGED),
      42              :     .merchant_pub = pg->current_merchant_pub
      43              :   };
      44            0 :   char *notify_s = GNUNET_PQ_get_event_notify_channel (&hdr.header);
      45            0 :   struct GNUNET_PQ_QueryParam params[] = {
      46            0 :     GNUNET_PQ_query_param_string (exchange_url),
      47            0 :     GNUNET_PQ_query_param_null (),
      48            0 :     GNUNET_PQ_query_param_fixed_size (
      49              :       &ev,
      50              :       offsetof (struct TALER_MERCHANTDB_MerchantKycStatusChangeEventP, h_wire)),
      51            0 :     GNUNET_PQ_query_param_string (notify_s),
      52              :     GNUNET_PQ_query_param_end
      53              :   };
      54              :   bool changed;
      55            0 :   struct GNUNET_PQ_ResultSpec rs[] = {
      56            0 :     GNUNET_PQ_result_spec_bool ("changed", &changed),
      57              :     GNUNET_PQ_result_spec_end
      58              :   };
      59              :   enum GNUNET_DB_QueryStatus qs;
      60              : 
      61            0 :   GNUNET_assert (NULL != pg->current_merchant_id);
      62            0 :   GNUNET_assert (0 == strcmp (merchant_id,
      63              :                               pg->current_merchant_id));
      64            0 :   TMH_PQ_prepare_anon (pg,
      65              :                        "SELECT merchant_do_set_tos_accepted_early"
      66              :                        " ($1, $2, $3, $4) AS changed");
      67            0 :   qs = GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
      68              :                                                   "",
      69              :                                                   params,
      70              :                                                   rs);
      71            0 :   GNUNET_free (notify_s);
      72            0 :   if (qs <= 0)
      73            0 :     return qs;
      74              :   return changed
      75              :          ? GNUNET_DB_STATUS_SUCCESS_ONE_RESULT
      76            0 :          : GNUNET_DB_STATUS_SUCCESS_NO_RESULTS;
      77              : }
        

Generated by: LCOV version 2.0-1