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