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