select_kyc_accounts.h (4323B)
1 /* 2 This file is part of TALER 3 Copyright (C) 2025 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_kyc_accounts.h 18 * @brief implementation of the select_kyc_accounts function for Postgres 19 * @author Christian Grothoff 20 */ 21 #ifndef EXCHANGE_DATABASE_SELECT_KYC_ACCOUNTS_H 22 #define EXCHANGE_DATABASE_SELECT_KYC_ACCOUNTS_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 account summary information. 31 * 32 * @param cls closure 33 * @param row_id current row in AML status table 34 * @param h_payto account for which the attribute data is stored 35 * @param open_time when was the account opened formally, 36 * GNUNET_TIME_UNIT_FOREVER_TS if it was never opened 37 * @param close_time when was the account formally closed, 38 * GNUNET_TIME_UNIT_ZERO_TS if it was never closed 39 * @param comments comments on the account 40 * @param high_risk is this a high-risk business relationship 41 * @param to_investigate TRUE if this account should be investigated 42 * @param payto the payto URI of the account 43 */ 44 typedef void 45 (*TALER_EXCHANGEDB_AmlAccountListCallback)( 46 void *cls, 47 uint64_t row_id, 48 const struct TALER_NormalizedPaytoHashP *h_payto, 49 struct GNUNET_TIME_Timestamp open_time, 50 struct GNUNET_TIME_Timestamp close_time, 51 const char *comments, 52 bool high_risk, 53 bool to_investigate, 54 struct TALER_FullPayto payto); 55 56 57 /* Callback typedefs */ 58 /** 59 * Return account summary information. 60 * 61 * @param cls closure 62 * @param row_id current row in AML status table 63 * @param h_payto account for which the attribute data is stored 64 * @param open_time when was the account opened formally, 65 * GNUNET_TIME_UNIT_FOREVER_TS if it was never opened 66 * @param close_time when was the account formally closed, 67 * GNUNET_TIME_UNIT_ZERO_TS if it was never closed 68 * @param comments comments on the account 69 * @param high_risk is this a high-risk business relationship 70 * @param to_investigate TRUE if this account should be investigated 71 * @param payto the payto URI of the account 72 */ 73 typedef void 74 (*TALER_EXCHANGEDB_AmlAccountListCallback)( 75 void *cls, 76 uint64_t row_id, 77 const struct TALER_NormalizedPaytoHashP *h_payto, 78 struct GNUNET_TIME_Timestamp open_time, 79 struct GNUNET_TIME_Timestamp close_time, 80 const char *comments, 81 bool high_risk, 82 bool to_investigate, 83 struct TALER_FullPayto payto); 84 85 /** 86 * List accounts managed by the exchange (for AML/KYC). 87 * 88 * @param pg the database context 89 * @param investigation_only filter by investigation state 90 * @param open_only filter for only open accounts 91 * @param high_risk_only filter for only high-risk accounts 92 * @param offset row to start from 93 * @param limit how many records to return (negative 94 * to go back in time, positive to go forward) 95 * @param cb callback to invoke on each match 96 * @param cb_cls closure for @a cb 97 * @return database transaction status 98 */ 99 enum GNUNET_DB_QueryStatus 100 TALER_EXCHANGEDB_select_kyc_accounts (struct TALER_EXCHANGEDB_PostgresContext * 101 pg, 102 enum TALER_EXCHANGE_YesNoAll 103 investigation_only, 104 enum TALER_EXCHANGE_YesNoAll open_only, 105 enum TALER_EXCHANGE_YesNoAll 106 high_risk_only, 107 uint64_t offset, 108 int64_t limit, 109 TALER_EXCHANGEDB_AmlAccountListCallback cb 110 , 111 void *cb_cls); 112 113 114 #endif