exchange

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

select_reserve_closed_above_serial_id.h (4876B)


      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 select_reserve_closed_above_serial_id.h
     18  * @brief implementation of the select_reserve_closed_above_serial_id function
     19  * @author Christian Grothoff
     20  */
     21 #ifndef EXCHANGE_DATABASE_SELECT_RESERVE_CLOSED_ABOVE_SERIAL_ID_H
     22 #define EXCHANGE_DATABASE_SELECT_RESERVE_CLOSED_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 reserve closing operations
     31  * the aggregator triggered.
     32  *
     33  * @param cls closure
     34  * @param rowid row identifier used to uniquely identify the reserve closing operation
     35  * @param execution_date when did we execute the close operation
     36  * @param amount_with_fee how much did we debit the reserve
     37  * @param closing_fee how much did we charge for closing the reserve
     38  * @param reserve_pub public key of the reserve
     39  * @param receiver_account where did we send the funds, in payto://-format
     40  * @param wtid identifier used for the wire transfer
     41  * @param close_request_row row with the responsible close
     42  *            request, 0 if regular expiration triggered close
     43  * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop
     44  */
     45 #ifndef TALER_EXCHANGEDB_RESERVE_CLOSED_RESULT_CLOSURE
     46 /**
     47  * Type of the closure for #TALER_EXCHANGEDB_ReserveClosedCallback.
     48  */
     49 #define TALER_EXCHANGEDB_RESERVE_CLOSED_RESULT_CLOSURE void
     50 #endif
     51 typedef enum GNUNET_GenericReturnValue
     52 (*TALER_EXCHANGEDB_ReserveClosedCallback)(
     53   TALER_EXCHANGEDB_RESERVE_CLOSED_RESULT_CLOSURE *cls,
     54   uint64_t rowid,
     55   struct GNUNET_TIME_Timestamp execution_date,
     56   const struct TALER_Amount *amount_with_fee,
     57   const struct TALER_Amount *closing_fee,
     58   const struct TALER_ReservePublicKeyP *reserve_pub,
     59   const struct TALER_FullPayto receiver_account,
     60   const struct TALER_WireTransferIdentifierRawP *wtid,
     61   uint64_t close_request_row);
     62 
     63 
     64 /* Callback typedefs */
     65 /**
     66  * Function called about reserve closing operations
     67  * the aggregator triggered.
     68  *
     69  * @param cls closure
     70  * @param rowid row identifier used to uniquely identify the reserve closing operation
     71  * @param execution_date when did we execute the close operation
     72  * @param amount_with_fee how much did we debit the reserve
     73  * @param closing_fee how much did we charge for closing the reserve
     74  * @param reserve_pub public key of the reserve
     75  * @param receiver_account where did we send the funds, in payto://-format
     76  * @param wtid identifier used for the wire transfer
     77  * @param close_request_row row with the responsible close
     78  *            request, 0 if regular expiration triggered close
     79  * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop
     80  */
     81 typedef enum GNUNET_GenericReturnValue
     82 (*TALER_EXCHANGEDB_ReserveClosedCallback)(
     83   TALER_EXCHANGEDB_RESERVE_CLOSED_RESULT_CLOSURE *cls,
     84   uint64_t rowid,
     85   struct GNUNET_TIME_Timestamp execution_date,
     86   const struct TALER_Amount *amount_with_fee,
     87   const struct TALER_Amount *closing_fee,
     88   const struct TALER_ReservePublicKeyP *reserve_pub,
     89   const struct TALER_FullPayto receiver_account,
     90   const struct TALER_WireTransferIdentifierRawP *wtid,
     91   uint64_t close_request_row);
     92 
     93 /**
     94  * Function called to select reserve close operations the aggregator
     95  * triggered, ordered by serial ID (monotonically increasing).
     96  *
     97  * @param pg the database context
     98  * @param serial_id lowest serial ID to include (select larger or equal)
     99  * @param cb function to call for ONE unfinished item
    100  * @param cb_cls closure for @a cb
    101  * @return transaction status code
    102  */
    103 enum GNUNET_DB_QueryStatus
    104 TALER_EXCHANGEDB_select_reserve_closed_above_serial_id (struct
    105                                                         TALER_EXCHANGEDB_PostgresContext
    106                                                         *
    107                                                         pg,
    108                                                         uint64_t serial_id,
    109                                                         TALER_EXCHANGEDB_ReserveClosedCallback
    110                                                         cb,
    111                                                         TALER_EXCHANGEDB_RESERVE_CLOSED_RESULT_CLOSURE
    112                                                         *cb_cls);
    113 
    114 
    115 #endif