lookup_pending_deposits.h (3195B)
1 /* 2 This file is part of TALER 3 Copyright (C) 2023 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/lookup_pending_deposits.h 18 * @brief implementation of the lookup_pending_deposits function for Postgres 19 * @author Christian Grothoff 20 */ 21 #ifndef MERCHANT_DATABASE_LOOKUP_PENDING_DEPOSITS_H 22 #define MERCHANT_DATABASE_LOOKUP_PENDING_DEPOSITS_H 23 24 #include <taler/taler_util.h> 25 #include <taler/taler_json_lib.h> 26 #include "merchantdb_lib.h" 27 28 29 struct TALER_MERCHANTDB_PostgresContext; 30 /* Callback typedefs */ 31 /** 32 * Callback for results from `lookup_pending_deposits`. 33 * 34 * @param cls NULL 35 * @param deposit_serial identifies the deposit operation 36 * @param wire_deadline when is the wire due 37 * @param retry_time when to next try the exchange again 38 * @param h_contract_terms hash of the contract terms 39 * @param merchant_priv private key of the merchant 40 * @param instance_id name of the instance 41 * @param h_wire hash of the merchant's wire account into 42 * @param amount_with_fee amount the exchange will deposit for this coin 43 * @param deposit_fee fee the exchange will charge for this coin which the deposit was made 44 * @param coin_pub public key of the deposited coin 45 */ 46 typedef void 47 (*TALER_MERCHANTDB_PendingDepositsCallback) ( 48 void *cls, 49 uint64_t deposit_serial, 50 struct GNUNET_TIME_Absolute wire_deadline, 51 struct GNUNET_TIME_Absolute retry_time, 52 const struct TALER_PrivateContractHashP *h_contract_terms, 53 const struct TALER_MerchantPrivateKeyP *merchant_priv, 54 const char *instance_id, 55 const struct TALER_MerchantWireHashP *h_wire, 56 const struct TALER_Amount *amount_with_fee, 57 const struct TALER_Amount *deposit_fee, 58 const struct TALER_CoinSpendPublicKeyP *coin_pub); 59 60 /** 61 * Lookup deposits that are finished and awaiting a wire transfer. 62 * 63 * @param pg database context 64 * @param exchange_url exchange to filter deposits by 65 * @param limit maximum number of deposits to return 66 * @param allow_future true to allow deposits with wire deadline in the future 67 * @param cb function to call with deposit data 68 * @param cb_cls closure for @a cb 69 * @return transaction status 70 */ 71 enum GNUNET_DB_QueryStatus 72 TALER_MERCHANTDB_lookup_pending_deposits (struct TALER_MERCHANTDB_PostgresContext *pg, 73 const char *exchange_url, 74 uint64_t limit, 75 bool allow_future, 76 TALER_MERCHANTDB_PendingDepositsCallback cb, 77 void *cb_cls); 78 79 80 #endif