exchange

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

select_recoup_above_serial_id.h (4560B)


      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_recoup_above_serial_id.h
     18  * @brief implementation of the select_recoup_above_serial_id function for Postgres
     19  * @author Christian Grothoff
     20  */
     21 #ifndef EXCHANGE_DATABASE_SELECT_RECOUP_ABOVE_SERIAL_ID_H
     22 #define EXCHANGE_DATABASE_SELECT_RECOUP_ABOVE_SERIAL_ID_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 about recoups the exchange has to perform.
     31  *
     32  * @param cls closure
     33  * @param rowid row identifier used to uniquely identify the recoup operation
     34  * @param timestamp when did we receive the recoup request
     35  * @param amount how much should be added back to the reserve
     36  * @param reserve_pub public key of the reserve
     37  * @param coin public information about the coin
     38  * @param denom_pub denomination key of @a coin
     39  * @param coin_sig signature with @e coin_pub of type #TALER_SIGNATURE_WALLET_COIN_RECOUP
     40  * @param coin_blind blinding factor used to blind the coin
     41  * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop
     42  */
     43 #ifndef TALER_EXCHANGEDB_RECOUP_RESULT_CLOSURE
     44 /**
     45  * Type of the closure for #TALER_EXCHANGEDB_RecoupCallback.
     46  */
     47 #define TALER_EXCHANGEDB_RECOUP_RESULT_CLOSURE void
     48 #endif
     49 typedef enum GNUNET_GenericReturnValue
     50 (*TALER_EXCHANGEDB_RecoupCallback)(
     51   TALER_EXCHANGEDB_RECOUP_RESULT_CLOSURE *cls,
     52   uint64_t rowid,
     53   struct GNUNET_TIME_Timestamp timestamp,
     54   const struct TALER_Amount *amount,
     55   const struct TALER_ReservePublicKeyP *reserve_pub,
     56   const struct TALER_CoinPublicInfo *coin,
     57   const struct TALER_DenominationPublicKey *denom_pub,
     58   const struct TALER_CoinSpendSignatureP *coin_sig,
     59   const union GNUNET_CRYPTO_BlindingSecretP *coin_blind);
     60 
     61 
     62 /* Callback typedefs */
     63 /**
     64  * Function called about recoups the exchange has to perform.
     65  *
     66  * @param cls closure
     67  * @param rowid row identifier used to uniquely identify the recoup operation
     68  * @param timestamp when did we receive the recoup request
     69  * @param amount how much should be added back to the reserve
     70  * @param reserve_pub public key of the reserve
     71  * @param coin public information about the coin
     72  * @param denom_pub denomination key of @a coin
     73  * @param coin_sig signature with @e coin_pub of type #TALER_SIGNATURE_WALLET_COIN_RECOUP
     74  * @param coin_blind blinding factor used to blind the coin
     75  * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop
     76  */
     77 typedef enum GNUNET_GenericReturnValue
     78 (*TALER_EXCHANGEDB_RecoupCallback)(
     79   TALER_EXCHANGEDB_RECOUP_RESULT_CLOSURE *cls,
     80   uint64_t rowid,
     81   struct GNUNET_TIME_Timestamp timestamp,
     82   const struct TALER_Amount *amount,
     83   const struct TALER_ReservePublicKeyP *reserve_pub,
     84   const struct TALER_CoinPublicInfo *coin,
     85   const struct TALER_DenominationPublicKey *denom_pub,
     86   const struct TALER_CoinSpendSignatureP *coin_sig,
     87   const union GNUNET_CRYPTO_BlindingSecretP *coin_blind);
     88 
     89 /**
     90  * Function called to select recoup requests the exchange
     91  * received, ordered by serial ID (monotonically increasing).
     92  *
     93  * @param pg the database context
     94  * @param serial_id lowest serial ID to include (select larger or equal)
     95  * @param cb function to call for ONE unfinished item
     96  * @param cb_cls closure for @a cb
     97  * @return transaction status code
     98  */
     99 enum GNUNET_DB_QueryStatus
    100 TALER_EXCHANGEDB_select_recoup_above_serial_id (struct
    101                                                 TALER_EXCHANGEDB_PostgresContext
    102                                                 *pg
    103                                                 ,
    104                                                 uint64_t serial_id,
    105                                                 TALER_EXCHANGEDB_RecoupCallback
    106                                                 cb,
    107                                                 TALER_EXCHANGEDB_RECOUP_RESULT_CLOSURE
    108                                                 *cb_cls);
    109 
    110 #endif