exchange

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

iterate_legitimization_outcomes_above_serial_id.h (3850B)


      1 /*
      2    This file is part of TALER
      3    Copyright (C) 2026 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/iterate_legitimization_outcomes_above_serial_id.h
     18  * @brief implementation of the iterate_legitimization_outcomes_above_serial_id function for Postgres
     19  * @author Christian Grothoff
     20  */
     21 #ifndef EXCHANGE_DATABASE_ITERATE_LEGITIMIZATION_OUTCOMES_ABOVE_SERIAL_ID_H
     22 #define EXCHANGE_DATABASE_ITERATE_LEGITIMIZATION_OUTCOMES_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 #ifndef TALER_EXCHANGEDB_LEGITIMIZATION_OUTCOME_RESULT_CLOSURE
     30 /**
     31  * Type of the closure for #TALER_EXCHANGEDB_LegitimizationOutcomeCallback.
     32  */
     33 #define TALER_EXCHANGEDB_LEGITIMIZATION_OUTCOME_RESULT_CLOSURE void
     34 #endif
     35 
     36 /* Callback typedefs */
     37 /**
     38  * Function called with a legitimization outcome, together with the three
     39  * things that could have brought it about.  The flags are facts about the
     40  * database, not a verdict: which combinations of them an honest exchange can
     41  * produce is for the caller to decide.
     42  *
     43  * @param cls closure
     44  * @param rowid unique serial ID of the entry in legitimization_outcomes
     45  * @param h_payto normalized payto hash of the account the outcome is about
     46  * @param decision_time when the outcome was decided, as claimed
     47  * @param expiration_time when the outcome expires and its successor measure
     48  *        is due
     49  * @param has_aml_decision true if an `aml_history` row points at this
     50  *        outcome, that is, an AML officer signed it
     51  * @param has_legitimization_process true if the account had a legitimization
     52  *        process that had started by @a decision_time, that is, the outcome
     53  *        could be an AML program's verdict on a check the customer went
     54  *        through
     55  * @param has_expired_predecessor true if an earlier outcome for the same
     56  *        account had expired by @a decision_time, that is, the outcome could
     57  *        be the successor measure that expiry called for
     58  * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop
     59  */
     60 typedef enum GNUNET_GenericReturnValue
     61 (*TALER_EXCHANGEDB_LegitimizationOutcomeCallback)(
     62   TALER_EXCHANGEDB_LEGITIMIZATION_OUTCOME_RESULT_CLOSURE *cls,
     63   uint64_t rowid,
     64   const struct TALER_NormalizedPaytoHashP *h_payto,
     65   struct GNUNET_TIME_Timestamp decision_time,
     66   struct GNUNET_TIME_Timestamp expiration_time,
     67   bool has_aml_decision,
     68   bool has_legitimization_process,
     69   bool has_expired_predecessor);
     70 
     71 
     72 /**
     73  * Select legitimization outcomes above @a serial_id in monotonically
     74  * increasing order, each with flags saying what in the database could
     75  * account for it.
     76  *
     77  * @param pg the database context
     78  * @param serial_id lowest serial ID to include (the row itself is returned,
     79  *        so callers resuming from a progress point pass last seen + 1)
     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_EXCHANGEDB_iterate_legitimization_outcomes_above_serial_id (
     86   struct TALER_EXCHANGEDB_PostgresContext *pg,
     87   uint64_t serial_id,
     88   TALER_EXCHANGEDB_LegitimizationOutcomeCallback cb,
     89   TALER_EXCHANGEDB_LEGITIMIZATION_OUTCOME_RESULT_CLOSURE *cb_cls);
     90 
     91 #endif