exchange

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

iterate_aml_decisions.h (6499B)


      1 /*
      2    This file is part of TALER
      3    Copyright (C) 2024 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_decisions.h
     18  * @brief implementation of the iterate_aml_decisions function for Postgres
     19  * @author Christian Grothoff
     20  */
     21 #ifndef EXCHANGE_DATABASE_ITERATE_AML_DECISIONS_H
     22 #define EXCHANGE_DATABASE_ITERATE_AML_DECISIONS_H
     23 
     24 #include "taler/taler_util.h"
     25 #include "taler/taler_json_lib.h"
     26 #include "exchangedb_lib.h"
     27 
     28 
     29 /**
     30  * Return AML decision information.
     31  *
     32  * @param cls closure
     33  * @param row_id current row in legitimization outcomes table
     34  * @param justification human-readable reason for the decision, NULL if none is available
     35  * @param new_measures names of measures requested immediately, NULL if none
     36  * @param decider_pub public key of the deciding AML officer, NULL for automated outcomes
     37  * @param decider_name name of the deciding AML officer at decision time, NULL if unavailable
     38  * @param kyc_attributes_rowid row of submitted attributes linked to the decision, NULL if none
     39  * @param h_payto account for which the attribute data is stored
     40  * @param decision_time when was the decision taken
     41  * @param expiration_time when will the rules expire
     42  * @param jproperties properties set for the account,
     43  *    NULL if no properties were set
     44  * @param to_investigate true if AML staff should look at the account
     45  * @param is_active true if this is the currently active decision about the account
     46  * @param is_wallet true if the @a h_payto is for a Taler wallet
     47  * @param payto payto URI of the account the decision is about
     48  * @param account_rules current active rules for the account
     49  */
     50 #ifndef TALER_EXCHANGEDB_AML_DECISION_RESULT_CLOSURE
     51 /**
     52  * Type of the closure for #TALER_EXCHANGEDB_AmlDecisionCallback.
     53  */
     54 #define TALER_EXCHANGEDB_AML_DECISION_RESULT_CLOSURE void
     55 #endif
     56 typedef void
     57 (*TALER_EXCHANGEDB_AmlDecisionCallback)(
     58   TALER_EXCHANGEDB_AML_DECISION_RESULT_CLOSURE *cls,
     59   uint64_t row_id,
     60   const char *justification,
     61   const char *new_measures,
     62   const struct TALER_AmlOfficerPublicKeyP *decider_pub,
     63   const char *decider_name,
     64   const uint64_t *kyc_attributes_rowid,
     65   const struct TALER_NormalizedPaytoHashP *h_payto,
     66   struct GNUNET_TIME_Timestamp decision_time,
     67   struct GNUNET_TIME_Absolute expiration_time,
     68   const json_t *jproperties,
     69   bool to_investigate,
     70   bool is_active,
     71   bool is_wallet,
     72   struct TALER_FullPayto payto,
     73   const json_t *account_rules);
     74 
     75 
     76 /* Callback typedefs */
     77 /**
     78  * Return AML decision information.
     79  *
     80  * @param cls closure
     81  * @param row_id current row in legitimization outcomes table
     82  * @param justification human-readable reason for the decision, NULL if none is available
     83  * @param new_measures names of measures requested immediately, NULL if none
     84  * @param decider_pub public key of the deciding AML officer, NULL for automated outcomes
     85  * @param decider_name name of the deciding AML officer at decision time, NULL if unavailable
     86  * @param kyc_attributes_rowid row of submitted attributes linked to the decision, NULL if none
     87  * @param h_payto account for which the attribute data is stored
     88  * @param decision_time when was the decision taken
     89  * @param expiration_time when will the rules expire
     90  * @param jproperties properties set for the account,
     91  *    NULL if no properties were set
     92  * @param to_investigate true if AML staff should look at the account
     93  * @param is_active true if this is the currently active decision about the account
     94  * @param is_wallet true if the @a h_payto is for a Taler wallet
     95  * @param payto payto URI of the account the decision is about
     96  * @param account_rules current active rules for the account
     97  */
     98 typedef void
     99 (*TALER_EXCHANGEDB_AmlDecisionCallback)(
    100   TALER_EXCHANGEDB_AML_DECISION_RESULT_CLOSURE *cls,
    101   uint64_t row_id,
    102   const char *justification,
    103   const char *new_measures,
    104   const struct TALER_AmlOfficerPublicKeyP *decider_pub,
    105   const char *decider_name,
    106   const uint64_t *kyc_attributes_rowid,
    107   const struct TALER_NormalizedPaytoHashP *h_payto,
    108   struct GNUNET_TIME_Timestamp decision_time,
    109   struct GNUNET_TIME_Absolute expiration_time,
    110   const json_t *jproperties,
    111   bool to_investigate,
    112   bool is_active,
    113   bool is_wallet,
    114   struct TALER_FullPayto payto,
    115   const json_t *account_rules);
    116 
    117 /**
    118  * Lookup AML decisions that have a particular state.
    119  *
    120  * Primary test table: `aml_history` (see test_aml_history.c).
    121  *
    122  * @param pg the database context
    123  * @param h_payto which account should we return the AML decision history for, NULL to return all accounts
    124  * @param investigation_only filter by investigation state
    125  * @param active_only filter for only active states
    126  * @param offset row to start from
    127  * @param limit how many records to return (negative
    128  *        to go back in time, positive to go forward)
    129  * @param cb callback to invoke on each match
    130  * @param cb_cls closure for @a cb
    131  * @return database transaction status
    132  */
    133 enum GNUNET_DB_QueryStatus
    134 TALER_EXCHANGEDB_iterate_aml_decisions (struct
    135                                         TALER_EXCHANGEDB_PostgresContext *
    136                                         pg,
    137                                         const struct
    138                                         TALER_NormalizedPaytoHashP *
    139                                         h_payto,
    140                                         enum TALER_EXCHANGE_YesNoAll
    141                                         investigation_only
    142                                         ,
    143                                         enum TALER_EXCHANGE_YesNoAll active_only
    144                                         ,
    145                                         uint64_t offset,
    146                                         int64_t limit,
    147                                         TALER_EXCHANGEDB_AmlDecisionCallback cb,
    148                                         TALER_EXCHANGEDB_AML_DECISION_RESULT_CLOSURE
    149                                         *cb_cls);
    150 
    151 #endif