From b7000379ed2c7ca31aeb4561a0ffc1c4bf9405c7 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 30 Dec 2022 13:45:36 +0100 Subject: [PATCH] -add prototypes --- src/exchangedb/pg_insert_aml_decision.h | 26 +++++++++++++++++ src/exchangedb/pg_insert_aml_officer.h | 22 +++++++++++++++ src/exchangedb/pg_insert_kyc_attributes.h | 27 ++++++++++++++++++ src/exchangedb/pg_lookup_aml_officer.h | 22 +++++++++++++++ src/exchangedb/pg_select_aml_history.h | 17 +++++++++++ src/exchangedb/pg_select_aml_process.h | 21 ++++++++++++++ src/exchangedb/pg_select_kyc_attributes.h | 16 +++++++++++ .../pg_select_similar_kyc_attributes.h | 17 +++++++++++ src/exchangedb/pg_trigger_aml_process.h | 16 +++++++++++ src/exchangedb/pg_update_aml_officer.h | 22 +++++++++++++++ src/exchangedb/pg_update_kyc_attributes.h | 28 +++++++++++++++++++ src/include/taler_exchangedb_plugin.h | 2 +- 12 files changed, 235 insertions(+), 1 deletion(-) diff --git a/src/exchangedb/pg_insert_aml_decision.h b/src/exchangedb/pg_insert_aml_decision.h index e5123a7aa..205c1c74b 100644 --- a/src/exchangedb/pg_insert_aml_decision.h +++ b/src/exchangedb/pg_insert_aml_decision.h @@ -26,4 +26,30 @@ #include "taler_exchangedb_plugin.h" +/** + * Insert an AML decision. Inserts into AML history and insert or updates AML + * status. + * + * @param cls closure + * @param h_payto account for which the attribute data is stored + * @param new_threshold new monthly threshold that would trigger an AML check + * @param new_status AML decision status + * @param decision_time when was the decision made + * @param justification human-readable text justifying the decision + * @param decider_pub public key of the staff member + * @param decider_sig signature of the staff member + * @return database transaction status + */ +enum GNUNET_DB_QueryStatus +TEH_PG_insert_aml_decision ( + void *cls, + const struct TALER_PaytoHashP *h_payto, + const struct TALER_Amount *new_threshold, + enum TALER_AmlDecisionState new_status, + struct GNUNET_TIME_Absolute decision_time, + const char *justification, + const struct TALER_AmlOfficerPublicKeyP *decider_pub, + const struct TALER_AmlOfficerSignatureP *decider_sig); + + #endif diff --git a/src/exchangedb/pg_insert_aml_officer.h b/src/exchangedb/pg_insert_aml_officer.h index 62a442ac9..be034d9ff 100644 --- a/src/exchangedb/pg_insert_aml_officer.h +++ b/src/exchangedb/pg_insert_aml_officer.h @@ -26,4 +26,26 @@ #include "taler_exchangedb_plugin.h" +/** + * Insert AML staff record. + * + * @param cls closure + * @param decider_pub public key of the staff member + * @param master_sig offline signature affirming the AML officer + * @param decider_name full name of the staff member + * @param is_active true to enable, false to set as inactive + * @param read_only true to set read-only access + * @param last_change when was the change made effective + * @return database transaction status + */ +enum GNUNET_DB_QueryStatus +TEH_PG_insert_aml_officer ( + void *cls, + const struct TALER_AmlOfficerPublicKeyP *decider_pub, + const struct TALER_MasterSignatureP *master_sig, + const char *decider_name, + bool is_active, + bool read_only, + struct GNUNET_TIME_Absolute last_change); + #endif diff --git a/src/exchangedb/pg_insert_kyc_attributes.h b/src/exchangedb/pg_insert_kyc_attributes.h index 343fe22d3..8ee307d7d 100644 --- a/src/exchangedb/pg_insert_kyc_attributes.h +++ b/src/exchangedb/pg_insert_kyc_attributes.h @@ -26,4 +26,31 @@ #include "taler_exchangedb_plugin.h" +/** + * Store KYC attribute data. + * + * @param cls closure + * @param h_payto account for which the attribute data is stored + * @param kyc_prox key for similarity search + * @param provider_section provider that must be checked + * @param birthdate birthdate of user, in format YYYY-MM-DD; can be NULL; + * digits can be 0 if exact day, month or year are unknown + * @param collection_time when was the data collected + * @param expiration_time when does the data expire + * @param enc_attributes_size number of bytes in @a enc_attributes + * @param enc_attributes encrypted attribute data + * @return database transaction status + */ +enum GNUNET_DB_QueryStatus +TEH_PG_insert_kyc_attributes ( + void *cls, + const struct TALER_PaytoHashP *h_payto, + const struct GNUNET_ShortHashCode *kyc_prox, + const char *provider_section, + const char *birthdate, + struct GNUNET_TIME_Timestamp collection_time, + struct GNUNET_TIME_Timestamp expiration_time, + size_t enc_attributes_size, + const void *enc_attributes); + #endif diff --git a/src/exchangedb/pg_lookup_aml_officer.h b/src/exchangedb/pg_lookup_aml_officer.h index 5819ef4b8..161d2e7e7 100644 --- a/src/exchangedb/pg_lookup_aml_officer.h +++ b/src/exchangedb/pg_lookup_aml_officer.h @@ -26,4 +26,26 @@ #include "taler_exchangedb_plugin.h" +/** + * Fetch AML staff record. + * + * @param cls closure + * @param decider_pub public key of the staff member + * @param[out] master_sig offline signature affirming the AML officer + * @param[out] decider_name full name of the staff member + * @param[out] is_active true to enable, false to set as inactive + * @param[out] read_only true to set read-only access + * @param[out] last_change when was the change made effective + * @return database transaction status + */ +enum GNUNET_DB_QueryStatus +TEH_PG_lookup_aml_officer ( + void *cls, + const struct TALER_AmlOfficerPublicKeyP *decider_pub, + struct TALER_MasterSignatureP *master_sig, + char **decider_name, + bool *is_active, + bool *read_only, + struct GNUNET_TIME_Absolute *last_change); + #endif diff --git a/src/exchangedb/pg_select_aml_history.h b/src/exchangedb/pg_select_aml_history.h index db117bb0a..78569947f 100644 --- a/src/exchangedb/pg_select_aml_history.h +++ b/src/exchangedb/pg_select_aml_history.h @@ -26,4 +26,21 @@ #include "taler_exchangedb_plugin.h" +/** + * Lookup AML decision history for a particular account. + * + * @param cls closure + * @param h_payto which account should we return the AML decision history for + * @param cb callback to invoke on each match + * @param cb_cls closure for @a cb + * @return database transaction status + */ +enum GNUNET_DB_QueryStatus +TEH_PG_select_aml_history ( + void *cls, + const struct TALER_PaytoHashP *h_payto, + TALER_EXCHANGEDB_AmlHistoryCallback cb, + void *cb_cls); + + #endif diff --git a/src/exchangedb/pg_select_aml_process.h b/src/exchangedb/pg_select_aml_process.h index c8655c249..019f58b26 100644 --- a/src/exchangedb/pg_select_aml_process.h +++ b/src/exchangedb/pg_select_aml_process.h @@ -26,4 +26,25 @@ #include "taler_exchangedb_plugin.h" +/** + * Lookup AML decisions that have a particular state. + * + * @param cls closure + * @param decision which decision states to filter by + * @param row_off offset to start from + * @param forward true to go forward in time, false to go backwards + * @param cb callback to invoke on each match + * @param cb_cls closure for @a cb + * @return database transaction status + */ +enum GNUNET_DB_QueryStatus +TEH_PG_select_aml_process ( + void *cls, + enum TALER_AmlDecisionState decision, + uint64_t row_off, + bool forward, + TALER_EXCHANGEDB_AmlStatusCallback cb, + void *cb_cls); + + #endif diff --git a/src/exchangedb/pg_select_kyc_attributes.h b/src/exchangedb/pg_select_kyc_attributes.h index 09f297bf3..7458aefe8 100644 --- a/src/exchangedb/pg_select_kyc_attributes.h +++ b/src/exchangedb/pg_select_kyc_attributes.h @@ -26,4 +26,20 @@ #include "taler_exchangedb_plugin.h" +/** + * Lookup KYC attribute data for a specific account. + * + * @param cls closure + * @param h_payto account for which the attribute data is stored + * @param cb callback to invoke on each match + * @param cb_cls closure for @a cb + * @return database transaction status + */ +enum GNUNET_DB_QueryStatus +TEH_PG_select_kyc_attributes ( + void *cls, + const struct TALER_PaytoHashP *h_payto, + TALER_EXCHANGEDB_AttributeCallback cb, + void *cb_cls); + #endif diff --git a/src/exchangedb/pg_select_similar_kyc_attributes.h b/src/exchangedb/pg_select_similar_kyc_attributes.h index a264da385..b32433711 100644 --- a/src/exchangedb/pg_select_similar_kyc_attributes.h +++ b/src/exchangedb/pg_select_similar_kyc_attributes.h @@ -26,4 +26,21 @@ #include "taler_exchangedb_plugin.h" +/** + * Lookup KYC attribute data for a specific account. + * + * @param cls closure + * @param h_payto account for which the attribute data is stored + * @param cb callback to invoke on each match + * @param cb_cls closure for @a cb + * @return database transaction status + */ +enum GNUNET_DB_QueryStatus +TEH_PG_select_kyc_attributes ( + void *cls, + const struct TALER_PaytoHashP *h_payto, + TALER_EXCHANGEDB_AttributeCallback cb, + void *cb_cls); + + #endif diff --git a/src/exchangedb/pg_trigger_aml_process.h b/src/exchangedb/pg_trigger_aml_process.h index 45bc0496b..2283571af 100644 --- a/src/exchangedb/pg_trigger_aml_process.h +++ b/src/exchangedb/pg_trigger_aml_process.h @@ -26,4 +26,20 @@ #include "taler_exchangedb_plugin.h" +/** + * Trigger AML process, an account has crossed the threshold. Inserts or + * updates the AML status. + * + * @param cls closure + * @param h_payto account for which the attribute data is stored + * @param threshold_crossed existing threshold that was crossed + * @return database transaction status + */ +enum GNUNET_DB_QueryStatus +TEH_PG_trigger_aml_process ( + void *cls, + const struct TALER_PaytoHashP *h_payto, + const struct TALER_Amount *threshold_crossed); + + #endif diff --git a/src/exchangedb/pg_update_aml_officer.h b/src/exchangedb/pg_update_aml_officer.h index 9e53dd506..8e3592395 100644 --- a/src/exchangedb/pg_update_aml_officer.h +++ b/src/exchangedb/pg_update_aml_officer.h @@ -26,4 +26,26 @@ #include "taler_exchangedb_plugin.h" +/** + * Update AML staff record. + * + * @param cls closure + * @param decider_pub public key of the staff member + * @param master_sig offline signature affirming the AML officer + * @param decider_name full name of the staff member + * @param is_active true to enable, false to set as inactive + * @param read_only true to set read-only access + * @param last_change when was the change made effective + * @return database transaction status + */ +enum GNUNET_DB_QueryStatus +TEH_PG_update_aml_officer ( + void *cls, + const struct TALER_AmlOfficerPublicKeyP *decider_pub, + const struct TALER_MasterSignatureP *master_sig, + const char *decider_name, + bool is_active, + bool read_only, + struct GNUNET_TIME_Absolute last_change); + #endif diff --git a/src/exchangedb/pg_update_kyc_attributes.h b/src/exchangedb/pg_update_kyc_attributes.h index 252d27686..5d17eb7fa 100644 --- a/src/exchangedb/pg_update_kyc_attributes.h +++ b/src/exchangedb/pg_update_kyc_attributes.h @@ -26,4 +26,32 @@ #include "taler_exchangedb_plugin.h" +/** + * Update KYC attribute data. + * + * @param cls closure + * @param h_payto account for which the attribute data is stored + * @param kyc_prox key for similarity search + * @param provider_section provider that must be checked + * @param birthdate birthdate of user, in format YYYY-MM-DD; can be NULL; + * digits can be 0 if exact day, month or year are unknown + * @param collection_time when was the data collected + * @param expiration_time when does the data expire + * @param enc_attributes_size number of bytes in @a enc_attributes + * @param enc_attributes encrypted attribute data + * @return database transaction status + */ +enum GNUNET_DB_QueryStatus +TEH_PG_update_kyc_attributes ( + void *cls, + const struct TALER_PaytoHashP *h_payto, + const struct GNUNET_ShortHashCode *kyc_prox, + const char *provider_section, + const char *birthdate, + struct GNUNET_TIME_Timestamp collection_time, + struct GNUNET_TIME_Timestamp expiration_time, + size_t enc_attributes_size, + const void *enc_attributes); + + #endif diff --git a/src/include/taler_exchangedb_plugin.h b/src/include/taler_exchangedb_plugin.h index bba593553..92907c5fb 100644 --- a/src/include/taler_exchangedb_plugin.h +++ b/src/include/taler_exchangedb_plugin.h @@ -6690,7 +6690,7 @@ struct TALER_EXCHANGEDB_Plugin * @return database transaction status */ enum GNUNET_DB_QueryStatus - (*select_aml_processes)( + (*select_aml_process)( void *cls, enum TALER_AmlDecisionState decision, uint64_t row_off,