select_refunds_by_coin.h (3394B)
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 #ifndef TALER_EXCHANGEDB_REFUND_COIN_RESULT_CLOSURE 38 /** 39 * Type of the closure for #TALER_EXCHANGEDB_RefundCoinCallback. 40 */ 41 #define TALER_EXCHANGEDB_REFUND_COIN_RESULT_CLOSURE void 42 #endif 43 typedef enum GNUNET_GenericReturnValue 44 (*TALER_EXCHANGEDB_RefundCoinCallback)( 45 TALER_EXCHANGEDB_REFUND_COIN_RESULT_CLOSURE *cls, 46 const struct TALER_Amount *amount_with_fee); 47 48 49 /* Callback typedefs */ 50 /** 51 * Callback invoked with information about refunds applicable 52 * to a particular coin and contract. 53 * 54 * @param cls closure 55 * @param amount_with_fee amount being refunded 56 * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop 57 */ 58 typedef enum GNUNET_GenericReturnValue 59 (*TALER_EXCHANGEDB_RefundCoinCallback)( 60 TALER_EXCHANGEDB_REFUND_COIN_RESULT_CLOSURE *cls, 61 const struct TALER_Amount *amount_with_fee); 62 63 /** 64 * Select refunds by @a coin_pub, @a merchant_pub and @a h_contract. 65 * 66 * @param pg the database context 67 * @param coin_pub coin to get refunds for 68 * @param merchant_pub merchant to get refunds for 69 * @param h_contract contract (hash) to get refunds for 70 * @param cb function to call for each refund found 71 * @param cb_cls closure for @a cb 72 * @return query result status 73 */ 74 enum GNUNET_DB_QueryStatus 75 TALER_EXCHANGEDB_select_refunds_by_coin (struct 76 TALER_EXCHANGEDB_PostgresContext *pg, 77 const struct 78 TALER_CoinSpendPublicKeyP * 79 coin_pub, 80 const struct TALER_MerchantPublicKeyP * 81 merchant_pub, 82 const struct 83 TALER_PrivateContractHashP * 84 h_contract, 85 TALER_EXCHANGEDB_RefundCoinCallback cb, 86 TALER_EXCHANGEDB_REFUND_COIN_RESULT_CLOSURE 87 *cb_cls); 88 89 #endif