exchange

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

select_recoup_refresh_above_serial_id.h (4742B)


      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_refresh_above_serial_id.h
     18  * @brief implementation of the select_recoup_refresh_above_serial_id function for Postgres
     19  * @author Christian Grothoff
     20  */
     21 #ifndef EXCHANGE_DATABASE_SELECT_RECOUP_REFRESH_ABOVE_SERIAL_ID_H
     22 #define EXCHANGE_DATABASE_SELECT_RECOUP_REFRESH_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 on refreshed coins the exchange has to
     31  * perform.
     32  *
     33  * @param cls closure
     34  * @param rowid row identifier used to uniquely identify the recoup operation
     35  * @param timestamp when did we receive the recoup request
     36  * @param amount how much should be added back to the old coin
     37  * @param old_coin_pub original coin that was refreshed to create @a coin
     38  * @param old_denom_pub_hash hash of public key of @a old_coin_pub
     39  * @param coin public information about the fresh coin
     40  * @param denom_pub denomination key of @a coin
     41  * @param coin_sig signature with @e coin_pub of type #TALER_SIGNATURE_WALLET_COIN_RECOUP
     42  * @param coin_blind blinding factor used to blind the coin
     43  * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop
     44  */
     45 typedef enum GNUNET_GenericReturnValue
     46 (*TALER_EXCHANGEDB_RecoupRefreshCallback)(
     47   void *cls,
     48   uint64_t rowid,
     49   struct GNUNET_TIME_Timestamp timestamp,
     50   const struct TALER_Amount *amount,
     51   const struct TALER_CoinSpendPublicKeyP *old_coin_pub,
     52   const struct TALER_DenominationHashP *old_denom_pub_hash,
     53   const struct TALER_CoinPublicInfo *coin,
     54   const struct TALER_DenominationPublicKey *denom_pub,
     55   const struct TALER_CoinSpendSignatureP *coin_sig,
     56   const union GNUNET_CRYPTO_BlindingSecretP *coin_blind);
     57 
     58 
     59 /* Callback typedefs */
     60 /**
     61  * Function called about recoups on refreshed coins the exchange has to
     62  * perform.
     63  *
     64  * @param cls closure
     65  * @param rowid row identifier used to uniquely identify the recoup operation
     66  * @param timestamp when did we receive the recoup request
     67  * @param amount how much should be added back to the old coin
     68  * @param old_coin_pub original coin that was refreshed to create @a coin
     69  * @param old_denom_pub_hash hash of public key of @a old_coin_pub
     70  * @param coin public information about the fresh coin
     71  * @param denom_pub denomination key of @a coin
     72  * @param coin_sig signature with @e coin_pub of type #TALER_SIGNATURE_WALLET_COIN_RECOUP
     73  * @param coin_blind blinding factor used to blind the coin
     74  * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop
     75  */
     76 typedef enum GNUNET_GenericReturnValue
     77 (*TALER_EXCHANGEDB_RecoupRefreshCallback)(
     78   void *cls,
     79   uint64_t rowid,
     80   struct GNUNET_TIME_Timestamp timestamp,
     81   const struct TALER_Amount *amount,
     82   const struct TALER_CoinSpendPublicKeyP *old_coin_pub,
     83   const struct TALER_DenominationHashP *old_denom_pub_hash,
     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 received for
     91  * refreshed coins, 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_refresh_above_serial_id (struct
    101                                                         TALER_EXCHANGEDB_PostgresContext
    102                                                         *
    103                                                         pg,
    104                                                         uint64_t serial_id,
    105                                                         TALER_EXCHANGEDB_RecoupRefreshCallback
    106                                                         cb,
    107                                                         void *cb_cls);
    108 
    109 #endif