select_refunds_by_coin.h (3047B)
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/select_refunds_by_coin.h 18 * @brief implementation of the select_refunds_by_coin function for Postgres 19 * @author Christian Grothoff 20 */ 21 #ifndef EXCHANGE_DATABASE_SELECT_REFUNDS_BY_COIN_H 22 #define EXCHANGE_DATABASE_SELECT_REFUNDS_BY_COIN_H 23 24 #include "taler/taler_util.h" 25 #include "taler/taler_json_lib.h" 26 #include "exchangedb_lib.h" 27 28 29 /** 30 * Callback invoked with information about refunds applicable 31 * to a particular coin and contract. 32 * 33 * @param cls closure 34 * @param amount_with_fee amount being refunded 35 * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop 36 */ 37 typedef enum GNUNET_GenericReturnValue 38 (*TALER_EXCHANGEDB_RefundCoinCallback)( 39 void *cls, 40 const struct TALER_Amount *amount_with_fee); 41 42 43 /* Callback typedefs */ 44 /** 45 * Callback invoked with information about refunds applicable 46 * to a particular coin and contract. 47 * 48 * @param cls closure 49 * @param amount_with_fee amount being refunded 50 * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop 51 */ 52 typedef enum GNUNET_GenericReturnValue 53 (*TALER_EXCHANGEDB_RefundCoinCallback)( 54 void *cls, 55 const struct TALER_Amount *amount_with_fee); 56 57 /** 58 * Select refunds by @a coin_pub, @a merchant_pub and @a h_contract. 59 * 60 * @param pg the database context 61 * @param coin_pub coin to get refunds for 62 * @param merchant_pub merchant to get refunds for 63 * @param h_contract contract (hash) to get refunds for 64 * @param cb function to call for each refund found 65 * @param cb_cls closure for @a cb 66 * @return query result status 67 */ 68 enum GNUNET_DB_QueryStatus 69 TALER_EXCHANGEDB_select_refunds_by_coin (struct 70 TALER_EXCHANGEDB_PostgresContext *pg, 71 const struct 72 TALER_CoinSpendPublicKeyP * 73 coin_pub, 74 const struct TALER_MerchantPublicKeyP * 75 merchant_pub, 76 const struct 77 TALER_PrivateContractHashP * 78 h_contract, 79 TALER_EXCHANGEDB_RefundCoinCallback cb, 80 void *cb_cls); 81 82 #endif