lookup_wire_transfer.h (5145B)
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/lookup_wire_transfer.h 18 * @brief implementation of the lookup_wire_transfer function for Postgres 19 * @author Christian Grothoff 20 */ 21 #ifndef EXCHANGE_DATABASE_LOOKUP_WIRE_TRANSFER_H 22 #define EXCHANGE_DATABASE_LOOKUP_WIRE_TRANSFER_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 exec_time execution time of the wire transfer (should be same for all callbacks with the same @e cls) 39 * @param h_contract_terms which proposal was this payment about 40 * @param denom_pub denomination of @a coin_pub 41 * @param coin_pub which public key was this payment about 42 * @param coin_value amount contributed by this coin in total (with fee) 43 * @param coin_fee applicable fee for this coin 44 */ 45 #ifndef TALER_EXCHANGEDB_AGGREGATION_DATA_RESULT_CLOSURE 46 /** 47 * Type of the closure for #TALER_EXCHANGEDB_AggregationDataCallback. 48 */ 49 #define TALER_EXCHANGEDB_AGGREGATION_DATA_RESULT_CLOSURE void 50 #endif 51 typedef void 52 (*TALER_EXCHANGEDB_AggregationDataCallback)( 53 TALER_EXCHANGEDB_AGGREGATION_DATA_RESULT_CLOSURE *cls, 54 uint64_t rowid, 55 const struct TALER_MerchantPublicKeyP *merchant_pub, 56 const struct TALER_FullPayto account_payto_uri, 57 const struct TALER_FullPaytoHashP *h_payto, 58 struct GNUNET_TIME_Timestamp exec_time, 59 const struct TALER_PrivateContractHashP *h_contract_terms, 60 const struct TALER_DenominationPublicKey *denom_pub, 61 const struct TALER_CoinSpendPublicKeyP *coin_pub, 62 const struct TALER_Amount *coin_value, 63 const struct TALER_Amount *coin_fee); 64 65 66 /* Callback typedefs */ 67 /** 68 * Function called with the results of the lookup of the 69 * transaction data associated with a wire transfer identifier. 70 * 71 * @param cls closure 72 * @param rowid which row in the table is the information from (for diagnostics) 73 * @param merchant_pub public key of the merchant (should be same for all callbacks with the same @e cls) 74 * @param account_payto_uri which account did the transfer go to? 75 * @param h_payto hash over @a account_payto_uri as it is in the DB 76 * @param exec_time execution time of the wire transfer (should be same for all callbacks with the same @e cls) 77 * @param h_contract_terms which proposal was this payment about 78 * @param denom_pub denomination of @a coin_pub 79 * @param coin_pub which public key was this payment about 80 * @param coin_value amount contributed by this coin in total (with fee) 81 * @param coin_fee applicable fee for this coin 82 */ 83 typedef void 84 (*TALER_EXCHANGEDB_AggregationDataCallback)( 85 TALER_EXCHANGEDB_AGGREGATION_DATA_RESULT_CLOSURE *cls, 86 uint64_t rowid, 87 const struct TALER_MerchantPublicKeyP *merchant_pub, 88 const struct TALER_FullPayto account_payto_uri, 89 const struct TALER_FullPaytoHashP *h_payto, 90 struct GNUNET_TIME_Timestamp exec_time, 91 const struct TALER_PrivateContractHashP *h_contract_terms, 92 const struct TALER_DenominationPublicKey *denom_pub, 93 const struct TALER_CoinSpendPublicKeyP *coin_pub, 94 const struct TALER_Amount *coin_value, 95 const struct TALER_Amount *coin_fee); 96 97 /** 98 * Lookup the list of Taler transactions that were aggregated 99 * into a wire transfer by the respective @a wtid. 100 * 101 * @param pg the database context 102 * @param wtid the raw wire transfer identifier we used 103 * @param cb function to call on each transaction found 104 * @param cb_cls closure for @a cb 105 * @return query status of the transaction 106 */ 107 enum GNUNET_DB_QueryStatus 108 TALER_EXCHANGEDB_lookup_wire_transfer (struct TALER_EXCHANGEDB_PostgresContext * 109 pg, 110 const struct 111 TALER_WireTransferIdentifierRawP * 112 wtid, 113 TALER_EXCHANGEDB_AggregationDataCallback 114 cb, 115 TALER_EXCHANGEDB_AGGREGATION_DATA_RESULT_CLOSURE 116 *cb_cls); 117 118 #endif