select_aml_decisions.h (4944B)
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/taler/exchange-database/select_aml_decisions.h 18 * @brief implementation of the select_aml_decisions function for Postgres 19 * @author Christian Grothoff 20 */ 21 #ifndef EXCHANGE_DATABASE_SELECT_AML_DECISIONS_H 22 #define EXCHANGE_DATABASE_SELECT_AML_DECISIONS_H 23 24 #include "taler/taler_util.h" 25 #include "taler/taler_json_lib.h" 26 #include "taler/taler_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 h_payto account for which the attribute data is stored 36 * @param decision_time when was the decision taken 37 * @param expiration_time when will the rules expire 38 * @param jproperties properties set for the account, 39 * NULL if no properties were set 40 * @param to_investigate true if AML staff should look at the account 41 * @param is_active true if this is the currently active decision about the account 42 * @param is_wallet true if the @a h_payto is for a Taler wallet 43 * @param payto payto URI of the account the decision is about 44 * @param account_rules current active rules for the account 45 */ 46 typedef void 47 (*TALER_EXCHANGEDB_AmlDecisionCallback)( 48 void *cls, 49 uint64_t row_id, 50 const char *justification, 51 const struct TALER_NormalizedPaytoHashP *h_payto, 52 struct GNUNET_TIME_Timestamp decision_time, 53 struct GNUNET_TIME_Absolute expiration_time, 54 const json_t *jproperties, 55 bool to_investigate, 56 bool is_active, 57 bool is_wallet, 58 struct TALER_FullPayto payto, 59 const json_t *account_rules); 60 61 62 /* Callback typedefs */ 63 /** 64 * Return AML decision information. 65 * 66 * @param cls closure 67 * @param row_id current row in legitimization outcomes table 68 * @param justification human-readable reason for the decision, NULL if none is available 69 * @param h_payto account for which the attribute data is stored 70 * @param decision_time when was the decision taken 71 * @param expiration_time when will the rules expire 72 * @param jproperties properties set for the account, 73 * NULL if no properties were set 74 * @param to_investigate true if AML staff should look at the account 75 * @param is_active true if this is the currently active decision about the account 76 * @param is_wallet true if the @a h_payto is for a Taler wallet 77 * @param payto payto URI of the account the decision is about 78 * @param account_rules current active rules for the account 79 */ 80 typedef void 81 (*TALER_EXCHANGEDB_AmlDecisionCallback)( 82 void *cls, 83 uint64_t row_id, 84 const char *justification, 85 const struct TALER_NormalizedPaytoHashP *h_payto, 86 struct GNUNET_TIME_Timestamp decision_time, 87 struct GNUNET_TIME_Absolute expiration_time, 88 const json_t *jproperties, 89 bool to_investigate, 90 bool is_active, 91 bool is_wallet, 92 struct TALER_FullPayto payto, 93 const json_t *account_rules); 94 95 /** 96 * Lookup AML decisions that have a particular state. 97 * 98 * @param pg the database context 99 * @param h_payto which account should we return the AML decision history for, NULL to return all accounts 100 * @param investigation_only filter by investigation state 101 * @param active_only filter for only active states 102 * @param offset row to start from 103 * @param limit how many records to return (negative 104 * to go back in time, positive to go forward) 105 * @param cb callback to invoke on each match 106 * @param cb_cls closure for @a cb 107 * @return database transaction status 108 */ 109 enum GNUNET_DB_QueryStatus 110 TALER_EXCHANGEDB_select_aml_decisions (struct TALER_EXCHANGEDB_PostgresContext * 111 pg, 112 const struct TALER_NormalizedPaytoHashP * 113 h_payto, 114 enum TALER_EXCHANGE_YesNoAll 115 investigation_only 116 , 117 enum TALER_EXCHANGE_YesNoAll active_only, 118 uint64_t offset, 119 int64_t limit, 120 TALER_EXCHANGEDB_AmlDecisionCallback cb, 121 void *cb_cls); 122 123 #endif