complete_legitimization_process_start.c (3107B)
1 /* 2 This file is part of TALER 3 Copyright (C) 2026 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/complete_legitimization_process_start.c 18 * @brief conditionally complete external KYC process initiation 19 */ 20 #include "taler/taler_pq_lib.h" 21 #include "exchange-database/complete_legitimization_process_start.h" 22 #include "helper.h" 23 24 25 enum GNUNET_DB_QueryStatus 26 TALER_EXCHANGEDB_complete_legitimization_process_start ( 27 struct TALER_EXCHANGEDB_PostgresContext *pg, 28 uint64_t process_row, 29 struct GNUNET_TIME_Absolute expected_start_time, 30 const char *provider_name, 31 const struct TALER_NormalizedPaytoHashP *h_payto, 32 const char *provider_account_id, 33 const char *provider_legitimization_id, 34 const char *redirect_url, 35 struct GNUNET_TIME_Absolute process_expiration, 36 enum TALER_ErrorCode ec, 37 const char *error_message_hint, 38 bool finished) 39 { 40 uint32_t ec32 = (uint32_t) ec; 41 struct GNUNET_PQ_QueryParam params[] = { 42 GNUNET_PQ_query_param_uint64 (&process_row), 43 GNUNET_PQ_query_param_absolute_time (&expected_start_time), 44 GNUNET_PQ_query_param_string (provider_name), 45 GNUNET_PQ_query_param_auto_from_type (h_payto), 46 (NULL != provider_account_id) 47 ? GNUNET_PQ_query_param_string (provider_account_id) 48 : GNUNET_PQ_query_param_null (), 49 (NULL != provider_legitimization_id) 50 ? GNUNET_PQ_query_param_string (provider_legitimization_id) 51 : GNUNET_PQ_query_param_null (), 52 (NULL != redirect_url) 53 ? GNUNET_PQ_query_param_string (redirect_url) 54 : GNUNET_PQ_query_param_null (), 55 GNUNET_PQ_query_param_absolute_time (&process_expiration), 56 GNUNET_PQ_query_param_uint32 (&ec32), 57 (NULL != error_message_hint) 58 ? GNUNET_PQ_query_param_string (error_message_hint) 59 : GNUNET_PQ_query_param_null (), 60 GNUNET_PQ_query_param_bool (finished), 61 GNUNET_PQ_query_param_end 62 }; 63 64 PREPARE (pg, 65 "complete_legitimization_process_start", 66 "UPDATE legitimization_processes" 67 " SET provider_user_id=$5" 68 " ,provider_legitimization_id=$6" 69 " ,redirect_url=$7" 70 " ,process_expiration_time=$8" 71 " ,error_code=$9" 72 " ,error_message=$10" 73 " ,finished=$11" 74 " WHERE legitimization_process_serial_id=$1" 75 " AND start_time=$2" 76 " AND provider_name=$3" 77 " AND h_payto=$4;"); 78 return GNUNET_PQ_eval_prepared_non_select ( 79 pg->conn, 80 "complete_legitimization_process_start", 81 params); 82 }