exchange

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

iterate_aml_history_above_serial_id.h (4048B)


      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_aml_history_above_serial_id.h
     18  * @brief implementation of the iterate_aml_history_above_serial_id function for Postgres
     19  * @author Christian Grothoff
     20  */
     21 #ifndef EXCHANGE_DATABASE_ITERATE_AML_HISTORY_ABOVE_SERIAL_ID_H
     22 #define EXCHANGE_DATABASE_ITERATE_AML_HISTORY_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_AML_DECISION_RESULT_CLOSURE
     30 /**
     31  * Type of the closure for #TALER_EXCHANGEDB_AmlDecisionCallback.
     32  */
     33 #define TALER_EXCHANGEDB_AML_DECISION_RESULT_CLOSURE void
     34 #endif
     35 
     36 /* Callback typedefs */
     37 /**
     38  * Function called with an AML decision made by an AML officer, with
     39  * everything the officer's signature covers.
     40  *
     41  * @param cls closure
     42  * @param rowid unique serial ID of the entry in aml_history
     43  * @param h_payto normalized payto hash of the account the decision is about
     44  * @param justification human-readable justification given
     45  * @param decider_pub public key of the officer who decided, NULL if the
     46  *        exchange did not record one
     47  * @param decider_sig the officer's signature, NULL if the exchange did not
     48  *        record one
     49  * @param decision_time when the decision was taken, as claimed
     50  * @param jproperties new account properties, NULL for none
     51  * @param jnew_rules new KYC rules for the account, NULL if the exchange did
     52  *        not record any (which no honest decision lacks)
     53  * @param new_measure_name measure to apply immediately, NULL for none
     54  * @param to_investigate whether AML staff should investigate the account
     55  * @param attributes_expiration when the attributes set with the decision
     56  *        expire, zero if the decision set no attributes
     57  * @param h_attributes hash of the attributes set with the decision, NULL if
     58  *        the decision set none.  The attributes themselves are stored only
     59  *        encrypted, so this hash is all an auditor can check against.
     60  * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop
     61  */
     62 typedef enum GNUNET_GenericReturnValue
     63 (*TALER_EXCHANGEDB_AmlDecisionCallback)(
     64   TALER_EXCHANGEDB_AML_DECISION_RESULT_CLOSURE *cls,
     65   uint64_t rowid,
     66   const struct TALER_NormalizedPaytoHashP *h_payto,
     67   const char *justification,
     68   const struct TALER_AmlOfficerPublicKeyP *decider_pub,
     69   const struct TALER_AmlOfficerSignatureP *decider_sig,
     70   struct GNUNET_TIME_Timestamp decision_time,
     71   const json_t *jproperties,
     72   const json_t *jnew_rules,
     73   const char *new_measure_name,
     74   bool to_investigate,
     75   struct GNUNET_TIME_Timestamp attributes_expiration,
     76   const struct GNUNET_HashCode *h_attributes);
     77 
     78 
     79 /**
     80  * Select AML decisions from aml_history above @a serial_id in monotonically
     81  * increasing order, joined with everything else the officer signed over.
     82  *
     83  * @param pg the database context
     84  * @param serial_id lowest serial ID to include (the row itself is returned,
     85  *        so callers resuming from a progress point pass last seen + 1)
     86  * @param cb function to call on each result
     87  * @param cb_cls closure for @a cb
     88  * @return transaction status code
     89  */
     90 enum GNUNET_DB_QueryStatus
     91 TALER_EXCHANGEDB_iterate_aml_history_above_serial_id (
     92   struct TALER_EXCHANGEDB_PostgresContext *pg,
     93   uint64_t serial_id,
     94   TALER_EXCHANGEDB_AmlDecisionCallback cb,
     95   TALER_EXCHANGEDB_AML_DECISION_RESULT_CLOSURE *cb_cls);
     96 
     97 #endif