exchange

Base system with REST service to issue digital coins, run by the payment service provider
Log | Files | Refs | Submodules | README | LICENSE

select_kyc_accounts.h (4696B)


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