LCOV - code coverage report
Current view: top level - backenddb - pg_insert_deposit_to_transfer.c (source / functions) Hit Total Coverage
Test: coverage.info Lines: 0 25 0.0 %
Date: 2025-06-23 16:22:09 Functions: 0 1 0.0 %

          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 backenddb/pg_insert_deposit_to_transfer.c
      18             :  * @brief Implementation of the insert_deposit_to_transfer function for Postgres
      19             :  * @author Christian Grothoff
      20             :  */
      21             : #include "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_insert_deposit_to_transfer.h"
      26             : #include "pg_helper.h"
      27             : 
      28             : 
      29             : enum GNUNET_DB_QueryStatus
      30           0 : TMH_PG_insert_deposit_to_transfer (
      31             :   void *cls,
      32             :   uint64_t deposit_serial,
      33             :   const struct TALER_EXCHANGE_DepositData *dd,
      34             :   bool *wpc)
      35             : {
      36           0 :   struct PostgresClosure *pg = cls;
      37           0 :   struct GNUNET_PQ_QueryParam params[] = {
      38           0 :     GNUNET_PQ_query_param_uint64 (&deposit_serial),
      39           0 :     TALER_PQ_query_param_amount_with_currency (pg->conn,
      40             :                                                &dd->coin_contribution),
      41           0 :     GNUNET_PQ_query_param_timestamp (&dd->execution_time),
      42           0 :     GNUNET_PQ_query_param_auto_from_type (&dd->exchange_sig),
      43           0 :     GNUNET_PQ_query_param_auto_from_type (&dd->exchange_pub),
      44           0 :     GNUNET_PQ_query_param_auto_from_type (&dd->wtid),
      45             :     GNUNET_PQ_query_param_end
      46             :   };
      47             :   bool conflict;
      48             :   bool no_exchange_pub;
      49           0 :   struct GNUNET_PQ_ResultSpec rs[] = {
      50           0 :     GNUNET_PQ_result_spec_bool ("out_wire_pending_cleared",
      51             :                                 wpc),
      52           0 :     GNUNET_PQ_result_spec_bool ("out_conflict",
      53             :                                 &conflict),
      54           0 :     GNUNET_PQ_result_spec_bool ("out_no_exchange_pub",
      55             :                                 &no_exchange_pub),
      56             :     GNUNET_PQ_result_spec_end
      57             :   };
      58             :   enum GNUNET_DB_QueryStatus qs;
      59             : 
      60           0 :   *wpc = false;
      61           0 :   PREPARE (pg,
      62             :            "insert_deposit_to_transfer",
      63             :            "SELECT"
      64             :            "  out_wire_pending_cleared"
      65             :            " ,out_conflict"
      66             :            " ,out_no_exchange_pub"
      67             :            " FROM merchant_insert_deposit_to_transfer"
      68             :            " ($1,$2,$3,$4,$5,$6);");
      69           0 :   qs = GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
      70             :                                                  "insert_deposit_to_transfer",
      71             :                                                  params,
      72             :                                                  rs);
      73           0 :   if (qs <= 0)
      74           0 :     return qs;
      75           0 :   if (no_exchange_pub)
      76           0 :     GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
      77             :                 "Exchange public key unknown (bug!?)\n");
      78           0 :   if (*wpc)
      79           0 :     GNUNET_log (GNUNET_ERROR_TYPE_INFO,
      80             :                 "Wire pending flag cleared (good!)\n");
      81           0 :   if (conflict)
      82           0 :     return GNUNET_DB_STATUS_SUCCESS_NO_RESULTS;
      83           0 :   return qs;
      84             : }

Generated by: LCOV version 1.16