exchange

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

lookup_kyc_history.h (4460B)


      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/lookup_kyc_history.h
     18  * @brief implementation of the lookup_kyc_history function for Postgres
     19  * @author Christian Grothoff
     20  */
     21 #ifndef EXCHANGE_DATABASE_LOOKUP_KYC_HISTORY_H
     22 #define EXCHANGE_DATABASE_LOOKUP_KYC_HISTORY_H
     23 
     24 #include "taler/taler_util.h"
     25 #include "taler/taler_json_lib.h"
     26 #include "exchangedb_lib.h"
     27 
     28 
     29 /**
     30  * Function called with historic KYC events of an
     31  * account.
     32  *
     33  * @param cls closure
     34  * @param provider_name name of the KYC provider
     35  * @param finished did the KYC process finish
     36  * @param error_code error code from the KYC process
     37  * @param error_message error message from the KYC process,
     38  *    or NULL for none
     39  * @param provider_user_id user ID at the provider
     40  *    or NULL for none
     41  * @param provider_legitimization_id legitimization process ID at the provider
     42  *    or NULL for none
     43  * @param collection_time when was the data collected
     44  * @param expiration_time when does the collected data expire
     45  * @param encrypted_attributes_len number of bytes in @a encrypted_attributes
     46  * @param encrypted_attributes encrypted KYC attributes
     47  */
     48 #ifndef TALER_EXCHANGEDB_KYC_HISTORY_RESULT_CLOSURE
     49 /**
     50  * Type of the closure for #TALER_EXCHANGEDB_KycHistoryCallback.
     51  */
     52 #define TALER_EXCHANGEDB_KYC_HISTORY_RESULT_CLOSURE void
     53 #endif
     54 typedef void
     55 (*TALER_EXCHANGEDB_KycHistoryCallback) (
     56   TALER_EXCHANGEDB_KYC_HISTORY_RESULT_CLOSURE *cls,
     57   const char *provider_name,
     58   bool finished,
     59   enum TALER_ErrorCode error_code,
     60   const char *error_message,
     61   const char *provider_user_id,
     62   const char *provider_legitimization_id,
     63   struct GNUNET_TIME_Timestamp collection_time,
     64   struct GNUNET_TIME_Absolute expiration_time,
     65   size_t encrypted_attributes_len,
     66   const void *encrypted_attributes);
     67 
     68 
     69 /* Callback typedefs */
     70 /**
     71  * Function called with historic KYC events of an
     72  * account.
     73  *
     74  * @param cls closure
     75  * @param provider_name name of the KYC provider
     76  * @param finished did the KYC process finish
     77  * @param error_code error code from the KYC process
     78  * @param error_message error message from the KYC process,
     79  *    or NULL for none
     80  * @param provider_user_id user ID at the provider
     81  *    or NULL for none
     82  * @param provider_legitimization_id legitimization process ID at the provider
     83  *    or NULL for none
     84  * @param collection_time when was the data collected
     85  * @param expiration_time when does the collected data expire
     86  * @param encrypted_attributes_len number of bytes in @a encrypted_attributes
     87  * @param encrypted_attributes encrypted KYC attributes
     88  */
     89 typedef void
     90 (*TALER_EXCHANGEDB_KycHistoryCallback) (
     91   TALER_EXCHANGEDB_KYC_HISTORY_RESULT_CLOSURE *cls,
     92   const char *provider_name,
     93   bool finished,
     94   enum TALER_ErrorCode error_code,
     95   const char *error_message,
     96   const char *provider_user_id,
     97   const char *provider_legitimization_id,
     98   struct GNUNET_TIME_Timestamp collection_time,
     99   struct GNUNET_TIME_Absolute expiration_time,
    100   size_t encrypted_attributes_len,
    101   const void *encrypted_attributes);
    102 
    103 /**
    104  * Lookup KYC history for an account identified via
    105  * @a h_payto.
    106  *
    107  * @param pg the database context
    108  * @param h_payto hash of account to lookup history for
    109  * @param cb function to call on results
    110  * @param cb_cls closure for @a cb
    111  * @return database transaction status
    112  */
    113 enum GNUNET_DB_QueryStatus
    114 TALER_EXCHANGEDB_lookup_kyc_history (struct TALER_EXCHANGEDB_PostgresContext *pg
    115                                      ,
    116                                      const struct TALER_NormalizedPaytoHashP *
    117                                      h_payto,
    118                                      TALER_EXCHANGEDB_KycHistoryCallback cb,
    119                                      TALER_EXCHANGEDB_KYC_HISTORY_RESULT_CLOSURE
    120                                      *cb_cls);
    121 
    122 #endif