pg_do_withdraw.h (2525B)
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 exchangedb/pg_do_withdraw.h 18 * @brief implementation of the do_withdraw function for Postgres 19 * @author Özgür Kesim 20 */ 21 #ifndef PG_DO_WITHDRAW_H 22 #define PG_DO_WITHDRAW_H 23 24 #include "taler/taler_util.h" 25 #include "taler/taler_json_lib.h" 26 #include "taler/taler_exchangedb_plugin.h" 27 /** 28 * Perform reserve update as part of an age-withdraw operation, checking for 29 * sufficient balance and fulfillment of age requirements. Finally persisting 30 * the withdrawal details. 31 * 32 * @param cls the `struct PostgresClosure` with the plugin-specific state 33 * @param withdraw the withdraw data 34 * @param now the timestamp of the withdraw 35 * @param[out] balance_ok set to true if the balance was sufficient 36 * @param[out] reserve_balance set to original balance of the reserve 37 * @param[out] age_ok set to true if age requirements were met 38 * @param[out] allowed_maximum_age if @e age_ok is FALSE, this is set to the allowed maximum age 39 * @param[out] reserve_birthday if @e age_ok is FALSE, this is set to the reserve's birthday 40 * @param[out] idempotent set to true if an entry already exists for the given h_planchets and reserve_pub 41 * @param[out] noreveal_index if @e idempotent is true, set to the noreveal_index in the existing record 42 * @param[out] nonce_reuse set to true if the blinding_seed has been found in the table for a different withdraw 43 * @return 0 if no reserve was found, 1 if a reserve was found, else the query execution status 44 */ 45 enum GNUNET_DB_QueryStatus 46 TEH_PG_do_withdraw ( 47 void *cls, 48 const struct TALER_EXCHANGEDB_Withdraw *withdraw, 49 const struct GNUNET_TIME_Timestamp *now, 50 bool *balance_ok, 51 struct TALER_Amount *reserve_balance, 52 bool *age_ok, 53 uint16_t *allowed_maximum_age, 54 uint32_t *reserve_birthday, 55 bool *idempotent, 56 uint16_t *noreveal_index, 57 bool *nonce_reuse); 58 59 #endif