exchange

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

select_purse_deposits_by_purse.h (4036B)


      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_purse_deposits_by_purse.h
     18  * @brief implementation of the select_purse_deposits_by_purse function for Postgres
     19  * @author Christian Grothoff
     20  */
     21 #ifndef EXCHANGE_DATABASE_SELECT_PURSE_DEPOSITS_BY_PURSE_H
     22 #define EXCHANGE_DATABASE_SELECT_PURSE_DEPOSITS_BY_PURSE_H
     23 
     24 #include "taler/taler_util.h"
     25 #include "taler/taler_json_lib.h"
     26 #include "exchangedb_lib.h"
     27 
     28 
     29 /**
     30  * Function called with details about purse refunds that have been made, with
     31  * the goal of auditing the purse refund's execution.
     32  *
     33  * @param cls closure
     34  * @param rowid row of the refund event
     35  * @param amount_with_fee amount of the deposit into the purse
     36  * @param coin_pub coin that is to be refunded the @a given amount_with_fee
     37  * @param denom_pub denomination of @a coin_pub
     38  * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop
     39  */
     40 #ifndef TALER_EXCHANGEDB_PURSE_REFUND_COIN_RESULT_CLOSURE
     41 /**
     42  * Type of the closure for #TALER_EXCHANGEDB_PurseRefundCoinCallback.
     43  */
     44 #define TALER_EXCHANGEDB_PURSE_REFUND_COIN_RESULT_CLOSURE void
     45 #endif
     46 typedef enum GNUNET_GenericReturnValue
     47 (*TALER_EXCHANGEDB_PurseRefundCoinCallback)(
     48   TALER_EXCHANGEDB_PURSE_REFUND_COIN_RESULT_CLOSURE *cls,
     49   uint64_t rowid,
     50   const struct TALER_Amount *amount_with_fee,
     51   const struct TALER_CoinSpendPublicKeyP *coin_pub,
     52   const struct TALER_DenominationPublicKey *denom_pub);
     53 
     54 
     55 /* Callback typedefs */
     56 /**
     57  * Function called with details about purse refunds that have been made, with
     58  * the goal of auditing the purse refund's execution.
     59  *
     60  * @param cls closure
     61  * @param rowid row of the refund event
     62  * @param amount_with_fee amount of the deposit into the purse
     63  * @param coin_pub coin that is to be refunded the @a given amount_with_fee
     64  * @param denom_pub denomination of @a coin_pub
     65  * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop
     66  */
     67 typedef enum GNUNET_GenericReturnValue
     68 (*TALER_EXCHANGEDB_PurseRefundCoinCallback)(
     69   TALER_EXCHANGEDB_PURSE_REFUND_COIN_RESULT_CLOSURE *cls,
     70   uint64_t rowid,
     71   const struct TALER_Amount *amount_with_fee,
     72   const struct TALER_CoinSpendPublicKeyP *coin_pub,
     73   const struct TALER_DenominationPublicKey *denom_pub);
     74 
     75 /**
     76  * Select coin affected by purse refund.
     77  *
     78  * @param pg the database context
     79  * @param purse_pub purse that was refunded
     80  * @param cb function to call on each result
     81  * @param cb_cls closure for @a cb
     82  * @return transaction status code
     83  */
     84 enum GNUNET_DB_QueryStatus
     85 TALER_TALER_EXCHANGEDB_select_purse_deposits_by_purse (struct
     86                                                        TALER_EXCHANGEDB_PostgresContext
     87                                                        *
     88                                                        pg,
     89                                                        const struct
     90                                                        TALER_PurseContractPublicKeyP
     91                                                        *
     92                                                        purse_pub,
     93                                                        TALER_EXCHANGEDB_PurseRefundCoinCallback
     94                                                        cb,
     95                                                        TALER_EXCHANGEDB_PURSE_REFUND_COIN_RESULT_CLOSURE
     96                                                        *cb_cls);
     97 
     98 #endif