anastasis-db_record_auth_iban_payment.c (2827B)
1 /* 2 This file is part of Anastasis 3 Copyright (C) 2020-2022 Anastasis SARL 4 5 Anastasis is free software; you can redistribute it and/or modify it under the 6 terms of the GNU Affero General Public License as published by the Free Software 7 Foundation; either version 3, or (at your option) any later version. 8 9 Anastasis 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 Affero General Public License for more details. 12 13 You should have received a copy of the GNU Affero General Public License along with 14 Anastasis; see the file COPYING.GPL. If not, see <http://www.gnu.org/licenses/> 15 */ 16 /** 17 * @file stasis/anastasis-db_record_auth_iban_payment.c 18 * @brief Anastasis database: record auth iban payment 19 * @author Christian Grothoff 20 */ 21 #include "platform.h" 22 #include "anastasis-db_pg.h" 23 #include "anastasis/anastasis-database/record_auth_iban_payment.h" 24 #include "anastasis/anastasis-database/transaction.h" 25 #include "anastasis/anastasis-database/preflight.h" 26 #include <taler/taler_pq_lib.h> 27 28 29 /** 30 * Store inbound IBAN payment made for authentication. 31 * 32 * @param wire_reference unique identifier inside LibEuFin/Nexus 33 * @param wire_subject subject of the wire transfer 34 * @param amount how much was transferred 35 * @param debit_account account that was debited 36 * @param credit_account Anastasis operator account credited 37 * @param execution_date when was the transfer made 38 * @return transaction status 39 */ 40 enum GNUNET_DB_QueryStatus 41 ANASTASIS_DB_record_auth_iban_payment ( 42 uint64_t wire_reference, 43 const char *wire_subject, 44 const struct TALER_Amount *amount, 45 const char *debit_account, 46 const char *credit_account, 47 struct GNUNET_TIME_Timestamp execution_date) 48 { 49 struct GNUNET_PQ_QueryParam params[] = { 50 GNUNET_PQ_query_param_uint64 (&wire_reference), 51 GNUNET_PQ_query_param_string (wire_subject), 52 TALER_PQ_query_param_amount (pg->conn, 53 amount), 54 GNUNET_PQ_query_param_string (debit_account), 55 GNUNET_PQ_query_param_string (credit_account), 56 GNUNET_PQ_query_param_timestamp (&execution_date), 57 GNUNET_PQ_query_param_end 58 }; 59 60 PREPARE ("store_auth_iban_payment_details", 61 "INSERT INTO anastasis_auth_iban_in " 62 "(wire_reference" 63 ",wire_subject" 64 ",credit" 65 ",debit_account_details" 66 ",credit_account_details" 67 ",execution_date" 68 ") VALUES " 69 "($1, $2, $3, $4, $5, $6);"); 70 return GNUNET_PQ_eval_prepared_non_select (pg->conn, 71 "store_auth_iban_payment_details", 72 params); 73 } 74 75 76 /* end of anastasis-db_record_auth_iban_payment.c */