exchange

Base system with REST service to issue digital coins, run by the payment service provider
Log | Files | Refs | Submodules | README | LICENSE

do_withdraw.h (2856B)


      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/exchange-database/do_withdraw.h
     18  * @brief implementation of the do_withdraw function for Postgres
     19  * @author Özgür Kesim
     20  */
     21 #ifndef EXCHANGE_DATABASE_DO_WITHDRAW_H
     22 #define EXCHANGE_DATABASE_DO_WITHDRAW_H
     23 
     24 #include "taler/taler_util.h"
     25 #include "exchangedb_lib.h"
     26 #include "exchange-database/free_reserve_history.h"
     27 
     28 /**
     29  * Perform reserve update as part of an age-withdraw operation, checking for
     30  * sufficient balance and fulfillment of age requirements. Finally persisting
     31  * the withdrawal details.
     32  *
     33  * @param pg the database context
     34  * @param withdraw the withdraw data
     35  * @param now the timestamp of the withdraw
     36  * @param[out] balance_ok set to true if the balance was sufficient
     37  * @param[out] reserve_balance set to original balance of the reserve
     38  * @param[out] age_ok set to true if age requirements were met
     39  * @param[out] allowed_maximum_age if @e age_ok is FALSE, this is set to the allowed maximum age
     40  * @param[out] reserve_birthday if @e age_ok is FALSE, this is set to the reserve's birthday
     41  * @param[out] idempotent set to true if an entry already exists for the given h_planchets and reserve_pub
     42  * @param[out] noreveal_index if @e idempotent is true, set to the noreveal_index in the existing record
     43  * @param[out] nonce_reuse set to true if the blinding_seed has been found in the table for a different withdraw
     44  * @return 0 if no reserve was found, 1 if a reserve was found, else the query execution status
     45  */
     46 enum GNUNET_DB_QueryStatus
     47 TALER_EXCHANGEDB_do_withdraw (struct TALER_EXCHANGEDB_PostgresContext *pg,
     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