select_all_donau_instances.h (3046B)
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/include/merchant-database/select_all_donau_instances.h 18 * @brief implementation of the select_donau_instance function for Postgres 19 * @author Bohdan Potuzhnyi 20 * @author Vlada Svirsh 21 */ 22 #ifndef MERCHANT_DATABASE_SELECT_ALL_DONAU_INSTANCES_H 23 #define MERCHANT_DATABASE_SELECT_ALL_DONAU_INSTANCES_H 24 25 #include <taler/taler_util.h> 26 #include <taler/taler_json_lib.h> 27 #include "donau/donau_util.h" 28 #include "merchantdb_lib.h" 29 30 31 /** 32 * Callback function typically used by `select_donau_instances` to handle 33 * the details of each Donau instance retrieved from the database. 34 * 35 * @param cls Closure to pass additional context or data to the callback function. 36 * @param donau_instance_serial Serial number of the Donau instance in the merchant database. 37 * @param donau_url The URL of the Donau instance. 38 * @param charity_name The name of the charity associated with the Donau instance. 39 * @param charity_pub_key Pointer to the charity's public key used for cryptographic operations. 40 * @param charity_id The unique identifier for the charity within the Donau instance. 41 * @param charity_max_per_year Maximum allowed donations to the charity for the current year. 42 * @param charity_receipts_to_date Total donations received by the charity so far in the current year. 43 * @param current_year The year for which the donation data is being tracked. 44 * @param donau_keys_json JSON object containing additional key-related information for the Donau instance, NULL if not (yet) available. 45 */ 46 typedef void 47 (*TALER_MERCHANTDB_DonauInstanceCallback)( 48 void *cls, 49 uint64_t donau_instance_serial, 50 const char *donau_url, 51 const char *charity_name, 52 const struct DONAU_CharityPublicKeyP *charity_pub_key, 53 uint64_t charity_id, 54 const struct TALER_Amount *charity_max_per_year, 55 const struct TALER_Amount *charity_receipts_to_date, 56 int64_t current_year, 57 const json_t *donau_keys_json 58 ); 59 60 /** 61 * Select all Donau instances from the database, regardless 62 * of instance or key status. 63 * 64 * @param pg database context 65 * @param cb callback function to call with each result 66 * @param cb_cls closure for the callback 67 * @return status of the PG 68 */ 69 enum GNUNET_DB_QueryStatus 70 TALER_MERCHANTDB_select_all_donau_instances ( 71 struct TALER_MERCHANTDB_PostgresContext *pg, 72 TALER_MERCHANTDB_DonauInstanceCallback cb, 73 void *cb_cls); 74 75 #endif