iterate_wire_transfers.h (5806B)
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 src/include/exchange-database/iterate_wire_transfers.h 18 * @brief implementation of the iterate_wire_transfers function for Postgres 19 * @author Christian Grothoff 20 */ 21 #ifndef EXCHANGE_DATABASE_ITERATE_WIRE_TRANSFERS_H 22 #define EXCHANGE_DATABASE_ITERATE_WIRE_TRANSFERS_H 23 24 #include "taler/taler_util.h" 25 #include "taler/taler_json_lib.h" 26 #include "exchangedb_lib.h" 27 28 29 /** 30 * Function called with the results of the lookup of the 31 * transaction data associated with a wire transfer identifier. 32 * 33 * @param cls closure 34 * @param rowid which row in the table is the information from (for diagnostics) 35 * @param merchant_pub public key of the merchant (should be same for all callbacks with the same @e cls) 36 * @param account_payto_uri which account did the transfer go to? 37 * @param h_payto hash over @a account_payto_uri as it is in the DB 38 * @param exchange_payto_uri which of the exchange's own accounts was debited; 39 * `full_payto` is NULL if the exchange did not record this (transfers 40 * made before the database tracked it) 41 * @param exec_time execution time of the wire transfer (should be same for all callbacks with the same @e cls) 42 * @param h_contract_terms which proposal was this payment about 43 * @param denom_pub denomination of @a coin_pub 44 * @param coin_pub which public key was this payment about 45 * @param coin_value amount contributed by this coin in total (with fee) 46 * @param coin_fee applicable fee for this coin 47 */ 48 #ifndef TALER_EXCHANGEDB_AGGREGATION_DATA_RESULT_CLOSURE 49 /** 50 * Type of the closure for #TALER_EXCHANGEDB_AggregationDataCallback. 51 */ 52 #define TALER_EXCHANGEDB_AGGREGATION_DATA_RESULT_CLOSURE void 53 #endif 54 typedef void 55 (*TALER_EXCHANGEDB_AggregationDataCallback)( 56 TALER_EXCHANGEDB_AGGREGATION_DATA_RESULT_CLOSURE *cls, 57 uint64_t rowid, 58 const struct TALER_MerchantPublicKeyP *merchant_pub, 59 const struct TALER_FullPayto account_payto_uri, 60 const struct TALER_FullPaytoHashP *h_payto, 61 const struct TALER_FullPayto exchange_payto_uri, 62 struct GNUNET_TIME_Timestamp exec_time, 63 const struct TALER_PrivateContractHashP *h_contract_terms, 64 const struct TALER_DenominationPublicKey *denom_pub, 65 const struct TALER_CoinSpendPublicKeyP *coin_pub, 66 const struct TALER_Amount *coin_value, 67 const struct TALER_Amount *coin_fee); 68 69 70 /* Callback typedefs */ 71 /** 72 * Function called with the results of the lookup of the 73 * transaction data associated with a wire transfer identifier. 74 * 75 * @param cls closure 76 * @param rowid which row in the table is the information from (for diagnostics) 77 * @param merchant_pub public key of the merchant (should be same for all callbacks with the same @e cls) 78 * @param account_payto_uri which account did the transfer go to? 79 * @param h_payto hash over @a account_payto_uri as it is in the DB 80 * @param exchange_payto_uri which of the exchange's own accounts was debited; 81 * `full_payto` is NULL if the exchange did not record this (transfers 82 * made before the database tracked it) 83 * @param exec_time execution time of the wire transfer (should be same for all callbacks with the same @e cls) 84 * @param h_contract_terms which proposal was this payment about 85 * @param denom_pub denomination of @a coin_pub 86 * @param coin_pub which public key was this payment about 87 * @param coin_value amount contributed by this coin in total (with fee) 88 * @param coin_fee applicable fee for this coin 89 */ 90 typedef void 91 (*TALER_EXCHANGEDB_AggregationDataCallback)( 92 TALER_EXCHANGEDB_AGGREGATION_DATA_RESULT_CLOSURE *cls, 93 uint64_t rowid, 94 const struct TALER_MerchantPublicKeyP *merchant_pub, 95 const struct TALER_FullPayto account_payto_uri, 96 const struct TALER_FullPaytoHashP *h_payto, 97 const struct TALER_FullPayto exchange_payto_uri, 98 struct GNUNET_TIME_Timestamp exec_time, 99 const struct TALER_PrivateContractHashP *h_contract_terms, 100 const struct TALER_DenominationPublicKey *denom_pub, 101 const struct TALER_CoinSpendPublicKeyP *coin_pub, 102 const struct TALER_Amount *coin_value, 103 const struct TALER_Amount *coin_fee); 104 105 /** 106 * Lookup the list of Taler transactions that were aggregated 107 * into a wire transfer by the respective @a wtid. 108 * 109 * Primary test table: `aggregation_tracking` (see test_aggregation_tracking.c). 110 * 111 * @param pg the database context 112 * @param wtid the raw wire transfer identifier we used 113 * @param cb function to call on each transaction found 114 * @param cb_cls closure for @a cb 115 * @return query status of the transaction 116 */ 117 enum GNUNET_DB_QueryStatus 118 TALER_EXCHANGEDB_iterate_wire_transfers (struct 119 TALER_EXCHANGEDB_PostgresContext * 120 pg, 121 const struct 122 TALER_WireTransferIdentifierRawP * 123 wtid, 124 TALER_EXCHANGEDB_AggregationDataCallback 125 cb, 126 TALER_EXCHANGEDB_AGGREGATION_DATA_RESULT_CLOSURE 127 *cb_cls); 128 129 #endif