LCOV - code coverage report
Current view: top level - exchangedb - insert_kyc_requirement_process.c (source / functions) Coverage Total Hit
Test: coverage.info Lines: 87.5 % 16 14
Test Date: 2026-04-14 15:39:31 Functions: 100.0 % 1 1

            Line data    Source code
       1              : /*
       2              :    This file is part of TALER
       3              :    Copyright (C) 2022 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 exchangedb/insert_kyc_requirement_process.c
      18              :  * @brief Implementation of the insert_kyc_requirement_process function for Postgres
      19              :  * @author Christian Grothoff
      20              :  */
      21              : #include "taler/taler_pq_lib.h"
      22              : #include "exchange-database/insert_kyc_requirement_process.h"
      23              : #include "helper.h"
      24              : #include <gnunet/gnunet_pq_lib.h>
      25              : 
      26              : 
      27              : enum GNUNET_DB_QueryStatus
      28           11 : TALER_EXCHANGEDB_insert_kyc_requirement_process (
      29              :   struct TALER_EXCHANGEDB_PostgresContext *pg,
      30              :   const struct TALER_NormalizedPaytoHashP *h_payto,
      31              :   uint32_t measure_index,
      32              :   uint64_t legitimization_measure_serial_id,
      33              :   const char *provider_name,
      34              :   const char *provider_account_id,
      35              :   const char *provider_legitimization_id,
      36              :   uint64_t *process_row)
      37              : {
      38              :   struct GNUNET_TIME_Absolute now
      39           11 :     = GNUNET_TIME_absolute_get ();
      40           11 :   struct GNUNET_PQ_QueryParam params[] = {
      41           11 :     GNUNET_PQ_query_param_auto_from_type (h_payto),
      42           11 :     GNUNET_PQ_query_param_absolute_time (&now),
      43           11 :     GNUNET_PQ_query_param_string (provider_name),
      44              :     (NULL != provider_account_id)
      45            0 :     ? GNUNET_PQ_query_param_string (provider_account_id)
      46           11 :     : GNUNET_PQ_query_param_null (),
      47              :     (NULL != provider_legitimization_id)
      48            0 :     ? GNUNET_PQ_query_param_string (provider_legitimization_id)
      49           11 :     : GNUNET_PQ_query_param_null (),
      50           11 :     GNUNET_PQ_query_param_uint64 (&legitimization_measure_serial_id),
      51           11 :     GNUNET_PQ_query_param_uint32 (&measure_index),
      52              :     GNUNET_PQ_query_param_end
      53              :   };
      54           11 :   struct GNUNET_PQ_ResultSpec rs[] = {
      55           11 :     GNUNET_PQ_result_spec_uint64 ("legitimization_process_serial_id",
      56              :                                   process_row),
      57              :     GNUNET_PQ_result_spec_end
      58              :   };
      59              : 
      60           11 :   PREPARE (pg,
      61              :            "insert_kyc_requirement_process",
      62              :            "INSERT INTO legitimization_processes"
      63              :            "  (h_payto"
      64              :            "  ,start_time"
      65              :            "  ,provider_name"
      66              :            "  ,provider_user_id"
      67              :            "  ,provider_legitimization_id"
      68              :            "  ,legitimization_measure_serial_id"
      69              :            "  ,measure_index"
      70              :            "  ) VALUES "
      71              :            "  ($1, $2, $3, $4, $5, $6, $7)"
      72              :            " ON CONFLICT (legitimization_measure_serial_id,measure_index)"
      73              :            " DO UPDATE"
      74              :            "   SET h_payto=$1"
      75              :            "      ,start_time=$2"
      76              :            "      ,provider_name=$3"
      77              :            "      ,provider_user_id=$4"
      78              :            "      ,provider_legitimization_id=$5"
      79              :            " RETURNING legitimization_process_serial_id");
      80           11 :   return GNUNET_PQ_eval_prepared_singleton_select (
      81              :     pg->conn,
      82              :     "insert_kyc_requirement_process",
      83              :     params,
      84              :     rs);
      85              : }
        

Generated by: LCOV version 2.0-1