insert_aml_decision.h (5575B)
1 /* 2 This file is part of TALER 3 Copyright (C) 2022, 2023 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/insert_aml_decision.h 18 * @brief implementation of the insert_aml_decision function for Postgres 19 * @author Christian Grothoff 20 */ 21 #ifndef EXCHANGE_DATABASE_INSERT_AML_DECISION_H 22 #define EXCHANGE_DATABASE_INSERT_AML_DECISION_H 23 24 #include "taler/taler_util.h" 25 #include "taler/taler_json_lib.h" 26 #include "exchangedb_lib.h" 27 28 29 /** 30 * Insert an AML decision. Inserts into AML history and insert or updates AML 31 * status. 32 * 33 * Primary test table: `aml_history` (see test_aml_history.c). 34 * 35 * @param pg the database context 36 * @param payto_uri full URI of the account, optional, 37 * can be NULL if the backend already knows the account 38 * @param h_payto account for which the attribute data is stored 39 * @param decision_time when was the decision made 40 * @param expiration_time when does the decision expire 41 * @param properties JSON object with properties to set for the account 42 * @param new_rules JSON array with new AML/KYC rules 43 * @param to_investigate true if AML staff should look more into this account 44 * @param new_measure_name name of the @a jmeasures measure that was triggered, or NULL for none 45 * @param jmeasures a JSON with LegitimizationMeasures to apply to the 46 * account, or NULL to not apply any measure right now 47 * @param justification human-readable text justifying the decision 48 * @param decider_pub public key of the staff member 49 * @param decider_sig signature of the staff member 50 * @param num_events length of the @a events array 51 * @param events array of events to trigger 52 * @param enc_attributes_size number of bytes in @a enc_attributes 53 * @param enc_attributes encrypted attribute data 54 * @param form_name name of the form from which @a enc_attributes originate, can be NULL 55 * @param attributes_hash hash of the unencrypted attribute data 56 * @param attributes_expiration_time when does the attribute data expire 57 * @param[out] invalid_officer set to TRUE if @a decider_pub is not allowed to make decisions right now 58 * @param[out] unknown_account set to TRUE if @a h_payto does not refer to a known account and @a jmeasures was given 59 * @param[out] last_date set to the previous decision time; 60 * the INSERT is not performed if @a last_date is not before @a decision_time 61 * @param[out] legitimization_measure_serial_id serial ID of the legitimization measures 62 * of the decision 63 * @param[out] is_wallet set to true if @a h_payto is for a wallet 64 * @return database transaction status; 65 * #GNUNET_DB_STATUS_SUCCESS_NO_RESULTS if the decision was refused 66 * because a decision at or after @a decision_time is already on 67 * file, in which case @a last_date is set to its time 68 */ 69 enum GNUNET_DB_QueryStatus 70 TALER_EXCHANGEDB_insert_aml_decision (struct TALER_EXCHANGEDB_PostgresContext * 71 pg, 72 const struct TALER_FullPayto payto_uri, 73 const struct TALER_NormalizedPaytoHashP * 74 h_payto 75 , 76 struct GNUNET_TIME_Timestamp decision_time 77 , 78 struct GNUNET_TIME_Timestamp 79 expiration_time, 80 const json_t *properties, 81 const json_t *new_rules, 82 bool to_investigate, 83 const char *new_measure_name, 84 const json_t *jmeasures, 85 const char *justification, 86 const struct TALER_AmlOfficerPublicKeyP * 87 decider_pub, 88 const struct TALER_AmlOfficerSignatureP * 89 decider_sig, 90 size_t num_events, 91 const char *events[static num_events], 92 const char *form_name, 93 size_t enc_attributes_size, 94 const void *enc_attributes, 95 struct GNUNET_HashCode *attributes_hash, 96 struct GNUNET_TIME_Timestamp 97 attributes_expiration_time, 98 bool *invalid_officer, 99 bool *unknown_account, 100 struct GNUNET_TIME_Timestamp *last_date, 101 uint64_t *legitimization_measure_serial_id 102 , 103 bool *is_wallet); 104 105 106 #endif