iterate_kyc_accounts.h (5181B)
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/iterate_kyc_accounts.h 18 * @brief implementation of the iterate_kyc_accounts function for Postgres 19 * @author Christian Grothoff 20 */ 21 #ifndef EXCHANGE_DATABASE_ITERATE_KYC_ACCOUNTS_H 22 #define EXCHANGE_DATABASE_ITERATE_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 customer_label human-readable customer label 41 * @param high_risk is this a high-risk business relationship 42 * @param to_investigate TRUE if this account should be investigated 43 * @param payto the payto URI of the account 44 */ 45 #ifndef TALER_EXCHANGEDB_AML_ACCOUNT_LIST_RESULT_CLOSURE 46 /** 47 * Type of the closure for #TALER_EXCHANGEDB_AmlAccountListCallback. 48 */ 49 #define TALER_EXCHANGEDB_AML_ACCOUNT_LIST_RESULT_CLOSURE void 50 #endif 51 typedef void 52 (*TALER_EXCHANGEDB_AmlAccountListCallback)( 53 TALER_EXCHANGEDB_AML_ACCOUNT_LIST_RESULT_CLOSURE *cls, 54 uint64_t row_id, 55 const struct TALER_NormalizedPaytoHashP *h_payto, 56 struct GNUNET_TIME_Timestamp open_time, 57 struct GNUNET_TIME_Timestamp close_time, 58 const char *comments, 59 const char *customer_label, 60 bool high_risk, 61 bool to_investigate, 62 struct TALER_FullPayto payto); 63 64 65 /* Callback typedefs */ 66 /** 67 * Return account summary information. 68 * 69 * @param cls closure 70 * @param row_id current row in AML status table 71 * @param h_payto account for which the attribute data is stored 72 * @param open_time when was the account opened formally, 73 * GNUNET_TIME_UNIT_FOREVER_TS if it was never opened 74 * @param close_time when was the account formally closed, 75 * GNUNET_TIME_UNIT_ZERO_TS if it was never closed 76 * @param comments comments on the account 77 * @param customer_label human-readable customer label 78 * @param high_risk is this a high-risk business relationship 79 * @param to_investigate TRUE if this account should be investigated 80 * @param payto the payto URI of the account 81 */ 82 typedef void 83 (*TALER_EXCHANGEDB_AmlAccountListCallback)( 84 TALER_EXCHANGEDB_AML_ACCOUNT_LIST_RESULT_CLOSURE *cls, 85 uint64_t row_id, 86 const struct TALER_NormalizedPaytoHashP *h_payto, 87 struct GNUNET_TIME_Timestamp open_time, 88 struct GNUNET_TIME_Timestamp close_time, 89 const char *comments, 90 const char *customer_label, 91 bool high_risk, 92 bool to_investigate, 93 struct TALER_FullPayto payto); 94 95 /** 96 * List accounts managed by the exchange (for AML/KYC). 97 * 98 * Primary test table: `kyc_targets` (see test_kyc_targets.c). 99 * 100 * @param pg the database context 101 * @param h_payto account to return, NULL to return all accounts 102 * @param investigation_only filter by investigation state 103 * @param open_only filter for only open accounts 104 * @param high_risk_only filter for only high-risk accounts 105 * @param offset row to start from 106 * @param limit how many records to return (negative 107 * to go back in time, positive to go forward) 108 * @param cb callback to invoke on each match 109 * @param cb_cls closure for @a cb 110 * @return database transaction status 111 */ 112 enum GNUNET_DB_QueryStatus 113 TALER_EXCHANGEDB_iterate_kyc_accounts (struct TALER_EXCHANGEDB_PostgresContext * 114 pg, 115 const struct 116 TALER_NormalizedPaytoHashP *h_payto, 117 enum TALER_EXCHANGE_YesNoAll 118 investigation_only, 119 enum TALER_EXCHANGE_YesNoAll open_only, 120 enum TALER_EXCHANGE_YesNoAll 121 high_risk_only, 122 uint64_t offset, 123 int64_t limit, 124 TALER_EXCHANGEDB_AmlAccountListCallback 125 cb 126 , 127 TALER_EXCHANGEDB_AML_ACCOUNT_LIST_RESULT_CLOSURE 128 *cb_cls); 129 130 131 #endif