LCOV - code coverage report
Current view: top level - exchangedb - pg_kycauth_in_insert.c (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 22 22
Test Date: 2025-12-28 14:06:02 Functions: 100.0 % 1 1

            Line data    Source code
       1              : /*
       2              :    This file is part of TALER
       3              :    Copyright (C) 2024 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/pg_kycauth_in_insert.c
      18              :  * @brief Implementation of the kycauth_in_insert function for Postgres
      19              :  * @author Christian Grothoff
      20              :  */
      21              : #include "taler/platform.h"
      22              : #include "taler/taler_error_codes.h"
      23              : #include "taler/taler_dbevents.h"
      24              : #include "taler/taler_pq_lib.h"
      25              : #include "pg_kycauth_in_insert.h"
      26              : #include "pg_helper.h"
      27              : 
      28              : 
      29              : enum GNUNET_DB_QueryStatus
      30           16 : TEH_PG_kycauth_in_insert (
      31              :   void *cls,
      32              :   const union TALER_AccountPublicKeyP *account_pub,
      33              :   const struct TALER_Amount *credit_amount,
      34              :   struct GNUNET_TIME_Timestamp execution_date,
      35              :   const struct TALER_FullPayto debit_account_uri,
      36              :   const char *section_name,
      37              :   uint64_t serial_id)
      38              : {
      39           16 :   struct PostgresClosure *pg = cls;
      40              :   struct TALER_NormalizedPaytoHashP h_normalized_payto;
      41              :   struct TALER_FullPaytoHashP h_full_payto;
      42              : 
      43           16 :   TALER_full_payto_hash (debit_account_uri,
      44              :                          &h_full_payto);
      45           16 :   TALER_full_payto_normalize_and_hash (debit_account_uri,
      46              :                                        &h_normalized_payto);
      47              :   {
      48           16 :     struct TALER_KycCompletedEventP rep = {
      49           16 :       .header.size = htons (sizeof (rep)),
      50           16 :       .header.type = htons (TALER_DBEVENT_EXCHANGE_KYC_COMPLETED),
      51              :       .h_payto = h_normalized_payto
      52              :     };
      53              :     char *notify_s
      54           16 :       = GNUNET_PQ_get_event_notify_channel (&rep.header);
      55           16 :     struct GNUNET_PQ_QueryParam params[] = {
      56           16 :       GNUNET_PQ_query_param_auto_from_type (account_pub),
      57           16 :       GNUNET_PQ_query_param_uint64 (&serial_id),
      58           16 :       TALER_PQ_query_param_amount (pg->conn,
      59              :                                    credit_amount),
      60           16 :       GNUNET_PQ_query_param_auto_from_type (&h_full_payto),
      61           16 :       GNUNET_PQ_query_param_auto_from_type (&h_normalized_payto),
      62           16 :       GNUNET_PQ_query_param_string (debit_account_uri.full_payto),
      63           16 :       GNUNET_PQ_query_param_string (section_name),
      64           16 :       GNUNET_PQ_query_param_timestamp (&execution_date),
      65           16 :       GNUNET_PQ_query_param_string (notify_s),
      66              :       GNUNET_PQ_query_param_end
      67              :     };
      68              :     enum GNUNET_DB_QueryStatus qs;
      69              : 
      70           16 :     PREPARE (pg,
      71              :              "kycauth_in_insert",
      72              :              "CALL"
      73              :              " exchange_do_kycauth_in_insert"
      74              :              " ($1,$2,$3,$4,$5,$6,$7,$8,$9);");
      75           16 :     qs = GNUNET_PQ_eval_prepared_non_select (
      76              :       pg->conn,
      77              :       "kycauth_in_insert",
      78              :       params);
      79           16 :     GNUNET_free (notify_s);
      80           16 :     return qs;
      81              :   }
      82              : }
        

Generated by: LCOV version 2.0-1