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

          Line data    Source code
       1             : /*
       2             :    This file is part of TALER
       3             :    Copyright (C) 2024, 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 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_lookup_pending_legitimization.c
      18             :  * @brief Implementation of the lookup_pending_legitimization function for Postgres
      19             :  * @author Christian Grothoff
      20             :  */
      21             : #include "platform.h"
      22             : #include "taler_error_codes.h"
      23             : #include "taler_dbevents.h"
      24             : #include "taler_pq_lib.h"
      25             : #include "pg_lookup_pending_legitimization.h"
      26             : #include "pg_helper.h"
      27             : 
      28             : 
      29             : enum GNUNET_DB_QueryStatus
      30          11 : TEH_PG_lookup_pending_legitimization (
      31             :   void *cls,
      32             :   uint64_t legitimization_measure_serial_id,
      33             :   struct TALER_AccountAccessTokenP *access_token,
      34             :   struct TALER_NormalizedPaytoHashP *h_payto,
      35             :   json_t **jmeasures,
      36             :   bool *is_finished,
      37             :   bool *is_wallet)
      38             : {
      39          11 :   struct PostgresClosure *pg = cls;
      40          11 :   struct GNUNET_PQ_QueryParam params[] = {
      41          11 :     GNUNET_PQ_query_param_uint64 (&legitimization_measure_serial_id),
      42             :     GNUNET_PQ_query_param_end
      43             :   };
      44          11 :   struct GNUNET_PQ_ResultSpec rs[] = {
      45          11 :     TALER_PQ_result_spec_json (
      46             :       "jmeasures",
      47             :       jmeasures),
      48          11 :     GNUNET_PQ_result_spec_auto_from_type (
      49             :       "h_normalized_payto",
      50             :       h_payto),
      51          11 :     GNUNET_PQ_result_spec_auto_from_type (
      52             :       "access_token",
      53             :       access_token),
      54          11 :     GNUNET_PQ_result_spec_bool (
      55             :       "is_finished",
      56             :       is_finished),
      57          11 :     GNUNET_PQ_result_spec_bool (
      58             :       "is_wallet",
      59             :       is_wallet),
      60             :     GNUNET_PQ_result_spec_end
      61             :   };
      62             : 
      63          11 :   PREPARE (pg,
      64             :            "lookup_pending_legitimization",
      65             :            "SELECT "
      66             :            " lm.jmeasures"
      67             :            ",kt.h_normalized_payto"
      68             :            ",kt.is_wallet"
      69             :            ",lm.access_token"
      70             :            ",lm.is_finished"
      71             :            " FROM legitimization_measures lm"
      72             :            " JOIN kyc_targets kt"
      73             :            "   USING (access_token)"
      74             :            " WHERE lm.legitimization_measure_serial_id=$1;");
      75          11 :   return GNUNET_PQ_eval_prepared_singleton_select (
      76             :     pg->conn,
      77             :     "lookup_pending_legitimization",
      78             :     params,
      79             :     rs);
      80             : }

Generated by: LCOV version 1.16