select_refunds_above_serial_id.h (4847B)
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_above_serial_id.h 18 * @brief implementation of the select_refunds_above_serial_id function for Postgres 19 * @author Christian Grothoff 20 */ 21 #ifndef EXCHANGE_DATABASE_SELECT_REFUNDS_ABOVE_SERIAL_ID_H 22 #define EXCHANGE_DATABASE_SELECT_REFUNDS_ABOVE_SERIAL_ID_H 23 24 #include "taler/taler_util.h" 25 #include "exchangedb_lib.h" 26 #include "exchange-database/do_refund.h" 27 28 29 /** 30 * Function called with details about coins that were refunding, 31 * with the goal of auditing the refund's execution. 32 * 33 * @param cls closure 34 * @param rowid unique serial ID for the refund in our DB 35 * @param denom_pub denomination public key of @a coin_pub 36 * @param coin_pub public key of the coin 37 * @param merchant_pub public key of the merchant 38 * @param merchant_sig signature of the merchant 39 * @param h_contract_terms hash of the proposal data known to merchant and customer 40 * @param rtransaction_id refund transaction ID chosen by the merchant 41 * @param full_refund true if the refunds total up to the entire value of the deposit 42 * @param amount_with_fee amount that was deposited including fee 43 * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop 44 */ 45 #ifndef TALER_EXCHANGEDB_REFUND_RESULT_CLOSURE 46 /** 47 * Type of the closure for #TALER_EXCHANGEDB_RefundCallback. 48 */ 49 #define TALER_EXCHANGEDB_REFUND_RESULT_CLOSURE void 50 #endif 51 typedef enum GNUNET_GenericReturnValue 52 (*TALER_EXCHANGEDB_RefundCallback)( 53 TALER_EXCHANGEDB_REFUND_RESULT_CLOSURE *cls, 54 uint64_t rowid, 55 const struct TALER_DenominationPublicKey *denom_pub, 56 const struct TALER_CoinSpendPublicKeyP *coin_pub, 57 const struct TALER_MerchantPublicKeyP *merchant_pub, 58 const struct TALER_MerchantSignatureP *merchant_sig, 59 const struct TALER_PrivateContractHashP *h_contract_terms, 60 uint64_t rtransaction_id, 61 bool full_refund, 62 const struct TALER_Amount *amount_with_fee); 63 64 65 /* Callback typedefs */ 66 /** 67 * Function called with details about coins that were refunding, 68 * with the goal of auditing the refund's execution. 69 * 70 * @param cls closure 71 * @param rowid unique serial ID for the refund in our DB 72 * @param denom_pub denomination public key of @a coin_pub 73 * @param coin_pub public key of the coin 74 * @param merchant_pub public key of the merchant 75 * @param merchant_sig signature of the merchant 76 * @param h_contract_terms hash of the proposal data known to merchant and customer 77 * @param rtransaction_id refund transaction ID chosen by the merchant 78 * @param full_refund true if the refunds total up to the entire value of the deposit 79 * @param amount_with_fee amount that was deposited including fee 80 * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop 81 */ 82 typedef enum GNUNET_GenericReturnValue 83 (*TALER_EXCHANGEDB_RefundCallback)( 84 TALER_EXCHANGEDB_REFUND_RESULT_CLOSURE *cls, 85 uint64_t rowid, 86 const struct TALER_DenominationPublicKey *denom_pub, 87 const struct TALER_CoinSpendPublicKeyP *coin_pub, 88 const struct TALER_MerchantPublicKeyP *merchant_pub, 89 const struct TALER_MerchantSignatureP *merchant_sig, 90 const struct TALER_PrivateContractHashP *h_contract_terms, 91 uint64_t rtransaction_id, 92 bool full_refund, 93 const struct TALER_Amount *amount_with_fee); 94 95 /** 96 * Select refunds above @a serial_id in monotonically increasing 97 * order. 98 * 99 * @param pg the database context 100 * @param serial_id highest serial ID to exclude (select strictly larger) 101 * @param cb function to call on each result 102 * @param cb_cls closure for @a cb 103 * @return transaction status code 104 */ 105 enum GNUNET_DB_QueryStatus 106 TALER_EXCHANGEDB_select_refunds_above_serial_id (struct 107 TALER_EXCHANGEDB_PostgresContext 108 * 109 pg, 110 uint64_t serial_id, 111 TALER_EXCHANGEDB_RefundCallback 112 cb, 113 TALER_EXCHANGEDB_REFUND_RESULT_CLOSURE 114 *cb_cls); 115 116 #endif