insert_aggregation_deferral.h (2680B)
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 src/include/exchange-database/insert_aggregation_deferral.h 18 * @brief implementation of the insert_aggregation_deferral function for Postgres 19 * @author Christian Grothoff 20 */ 21 #ifndef EXCHANGE_DATABASE_INSERT_AGGREGATION_DEFERRAL_H 22 #define EXCHANGE_DATABASE_INSERT_AGGREGATION_DEFERRAL_H 23 24 #include "taler/taler_util.h" 25 #include "exchangedb_lib.h" 26 27 /** 28 * Record why the aggregator did not execute the wire transfer @a wtid that it 29 * had already decided on. Appends to `aggregation_deferrals`, which unlike 30 * `aggregation_transient` is replicated to the auditor, so that an external 31 * auditor sees the exchange's own account of what it is withholding and why 32 * instead of having to infer it. 33 * 34 * The row is tied to the deposit of the aggregate that is last to reach its 35 * wire deadline, so that garbage collecting the deposits also removes this 36 * claim about them. It is therefore an error to call this before the 37 * `aggregation_tracking` rows for @a wtid have been written; the statement 38 * inserts nothing in that case. 39 * 40 * Primary test table: `aggregation_deferrals` (see test_aggregation_deferrals.c). 41 * 42 * @param pg the database context 43 * @param wtid the wire transfer that was not executed 44 * @param h_payto destination that was not paid 45 * @param amount total that was withheld 46 * @param reason why the transfer was not made 47 * @param kyc_requirement_row legitimization measure that has to be satisfied 48 * first, or 0 if @a reason is not #TALER_EXCHANGEDB_DR_KYC 49 * @param deferral_time when the decision was made 50 * @return transaction status 51 */ 52 enum GNUNET_DB_QueryStatus 53 TALER_EXCHANGEDB_insert_aggregation_deferral ( 54 struct TALER_EXCHANGEDB_PostgresContext *pg, 55 const struct TALER_WireTransferIdentifierRawP *wtid, 56 const struct TALER_FullPaytoHashP *h_payto, 57 const struct TALER_Amount *amount, 58 enum TALER_EXCHANGEDB_DeferralReason reason, 59 uint64_t kyc_requirement_row, 60 struct GNUNET_TIME_Timestamp deferral_time); 61 62 #endif