get_expired_reserves.h (2621B)
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 get_expired_reserves.h 18 * @brief implementation of the get_expired_reserves function 19 * @author Christian Grothoff 20 */ 21 #ifndef EXCHANGE_DATABASE_GET_EXPIRED_RESERVES_H 22 #define EXCHANGE_DATABASE_GET_EXPIRED_RESERVES_H 23 24 #include "taler/taler_util.h" 25 #include "taler/taler_json_lib.h" 26 #include "exchangedb_lib.h" 27 28 29 /* Callback typedefs */ 30 /** 31 * Function called with details about expired reserves. 32 * 33 * @param cls closure 34 * @param reserve_pub public key of the reserve 35 * @param left amount left in the reserve 36 * @param account_details information about the reserve's bank account, in payto://-format 37 * @param expiration_date when did the reserve expire 38 * @param close_request_row row that caused the reserve 39 * to be closed, 0 if it expired without request 40 * @return #GNUNET_OK on success, 41 * #GNUNET_NO to retry 42 * #GNUNET_SYSERR on hard failures (exit) 43 */ 44 typedef enum GNUNET_GenericReturnValue 45 (*TALER_EXCHANGEDB_ReserveExpiredCallback)( 46 void *cls, 47 const struct TALER_ReservePublicKeyP *reserve_pub, 48 const struct TALER_Amount *left, 49 const struct TALER_FullPayto account_details, 50 struct GNUNET_TIME_Timestamp expiration_date, 51 uint64_t close_request_row); 52 53 /** 54 * Obtain information about expired reserves and their 55 * remaining balances. 56 * 57 * @param pg the database context 58 * @param now timestamp based on which we decide expiration 59 * @param rec function to call on expired reserves 60 * @param rec_cls closure for @a rec 61 * @return transaction status 62 */ 63 enum GNUNET_DB_QueryStatus 64 TALER_EXCHANGEDB_get_expired_reserves (struct TALER_EXCHANGEDB_PostgresContext * 65 pg, 66 struct GNUNET_TIME_Timestamp now, 67 TALER_EXCHANGEDB_ReserveExpiredCallback 68 rec, 69 void *rec_cls); 70 71 #endif