exchange

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

get_open_legitimization_measure.h (2706B)


      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/get_open_legitimization_measure.h
     18  * @brief implementation of the get_open_legitimization_measure function
     19  * @author Christian Grothoff
     20  */
     21 #ifndef EXCHANGE_DATABASE_GET_OPEN_LEGITIMIZATION_MEASURE_H
     22 #define EXCHANGE_DATABASE_GET_OPEN_LEGITIMIZATION_MEASURE_H
     23 
     24 #include "taler/taler_util.h"
     25 #include "exchangedb_lib.h"
     26 
     27 
     28 /**
     29  * Find a KYC measure that the exchange imposed on @a h_payto and that has not
     30  * yet produced a decision.  Such a measure is the exchange's own explanation
     31  * for why it is not paying the account out.
     32  *
     33  * A measure counts as satisfied once some `legitimization_processes` row
     34  * refers to it *and* the account has a `legitimization_outcomes` row that was
     35  * decided no earlier than that process started.  Both halves are needed: a
     36  * process that was started and abandoned decides nothing, and an outcome that
     37  * predates the process belongs to an earlier measure.
     38  *
     39  * This deliberately uses only columns that `taler-auditor-sync` replicates, so
     40  * that an external auditor reaches the same verdict as an internal one.  In
     41  * particular it cannot look at `legitimization_measures.is_finished` or
     42  * `legitimization_processes.finished`, neither of which is replicated.
     43  *
     44  * @param pg the database context
     45  * @param h_payto normalized hash of the payto URI of the account
     46  * @param[out] legitimization_measure_serial_id set to the lowest such measure
     47  * @param[out] start_time set to when that measure was imposed; the exchange
     48  *        writes this column at full precision, so it is not a rounded
     49  *        timestamp
     50  * @return #GNUNET_DB_STATUS_SUCCESS_NO_RESULTS if every measure on the
     51  *         account was decided, including if there never was one
     52  */
     53 enum GNUNET_DB_QueryStatus
     54 TALER_EXCHANGEDB_get_open_legitimization_measure (
     55   struct TALER_EXCHANGEDB_PostgresContext *pg,
     56   const struct TALER_NormalizedPaytoHashP *h_payto,
     57   uint64_t *legitimization_measure_serial_id,
     58   struct GNUNET_TIME_Absolute *start_time);
     59 
     60 #endif