merchant

Merchant backend to process payments, run by merchants
Log | Files | Refs | Submodules | README | LICENSE

update_deposit_confirmation_status.c (2673B)


      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 src/backenddb/update_deposit_confirmation_status.c
     18  * @brief Implementation of the update_deposit_confirmation_status 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 "merchant-database/update_deposit_confirmation_status.h"
     26 #include "helper.h"
     27 
     28 
     29 enum GNUNET_DB_QueryStatus
     30 TALER_MERCHANTDB_update_deposit_confirmation_status (struct TALER_MERCHANTDB_PostgresContext *pg,
     31                                                      uint64_t deposit_serial,
     32                                                      bool retry_needed,
     33                                                      struct GNUNET_TIME_Timestamp retry_time,
     34                                                      uint32_t last_http_status,
     35                                                      enum TALER_ErrorCode last_ec,
     36                                                      const char *last_detail)
     37 {
     38   uint32_t ec32 = (uint32_t) last_ec;
     39   struct GNUNET_PQ_QueryParam params[] = {
     40     GNUNET_PQ_query_param_uint64 (&deposit_serial),
     41     GNUNET_PQ_query_param_bool (retry_needed),
     42     GNUNET_PQ_query_param_timestamp (&retry_time),
     43     GNUNET_PQ_query_param_uint32 (&last_http_status),
     44     GNUNET_PQ_query_param_uint32 (&ec32),
     45     NULL == last_detail
     46     ? GNUNET_PQ_query_param_null ()
     47     : GNUNET_PQ_query_param_string (last_detail),
     48     GNUNET_PQ_query_param_end
     49   };
     50 
     51   check_connection (pg);
     52   PREPARE (pg,
     53            "update_deposit_confirmation_status",
     54            "UPDATE merchant_deposits SET"
     55            " settlement_retry_needed=$2"
     56            ",settlement_retry_time=$3"
     57            ",settlement_last_http_status=$4"
     58            ",settlement_last_ec=$5"
     59            ",settlement_last_detail=$6"
     60            " WHERE deposit_serial=$1;");
     61   return GNUNET_PQ_eval_prepared_non_select (
     62     pg->conn,
     63     "update_deposit_confirmation_status",
     64     params);
     65 }