diff options
Diffstat (limited to 'src/exchangedb')
-rw-r--r-- | src/exchangedb/Makefile.am | 2 | ||||
-rw-r--r-- | src/exchangedb/exchange_do_insert_aml_decision.sql | 8 | ||||
-rw-r--r-- | src/exchangedb/pg_select_aml_history.c | 19 | ||||
-rw-r--r-- | src/exchangedb/pg_test_aml_officer.c (renamed from src/exchangedb/pg_update_aml_officer.c) | 34 | ||||
-rw-r--r-- | src/exchangedb/pg_test_aml_officer.h (renamed from src/exchangedb/pg_update_aml_officer.h) | 20 | ||||
-rw-r--r-- | src/exchangedb/plugin_exchangedb_postgres.c | 6 |
6 files changed, 31 insertions, 58 deletions
diff --git a/src/exchangedb/Makefile.am b/src/exchangedb/Makefile.am index 8ea9a4123..e8ef104e1 100644 --- a/src/exchangedb/Makefile.am +++ b/src/exchangedb/Makefile.am @@ -136,7 +136,7 @@ libtaler_plugin_exchangedb_postgres_la_SOURCES = \ pg_select_similar_kyc_attributes.h pg_select_similar_kyc_attributes.c \ pg_select_kyc_attributes.h pg_select_kyc_attributes.c \ pg_insert_aml_officer.h pg_insert_aml_officer.c \ - pg_update_aml_officer.h pg_update_aml_officer.c \ + pg_test_aml_officer.h pg_test_aml_officer.c \ pg_lookup_aml_officer.h pg_lookup_aml_officer.c \ pg_trigger_aml_process.h pg_trigger_aml_process.c \ pg_select_aml_process.h pg_select_aml_process.c \ diff --git a/src/exchangedb/exchange_do_insert_aml_decision.sql b/src/exchangedb/exchange_do_insert_aml_decision.sql index b3f77c8c4..ef3e60048 100644 --- a/src/exchangedb/exchange_do_insert_aml_decision.sql +++ b/src/exchangedb/exchange_do_insert_aml_decision.sql @@ -56,8 +56,8 @@ THEN RETURN; END IF; UPDATE exchange.aml_status - SET threshold_val=in_threshold_val - ,threshold_frac=in_threshold_frac + SET threshold_val=in_new_threshold_val + ,threshold_frac=in_new_threshold_frac ,status=in_new_status WHERE h_payto=in_h_payto; ASSERT FOUND, 'cannot have AML decision history but no AML status'; @@ -70,8 +70,8 @@ ELSE ,status) VALUES (in_h_payto - ,in_threshold_val - ,in_threshold_frac + ,in_new_threshold_val + ,in_new_threshold_frac ,in_new_status); END IF; diff --git a/src/exchangedb/pg_select_aml_history.c b/src/exchangedb/pg_select_aml_history.c index ac7fe5842..c54a3ef0c 100644 --- a/src/exchangedb/pg_select_aml_history.c +++ b/src/exchangedb/pg_select_aml_history.c @@ -138,18 +138,13 @@ TEH_PG_select_aml_history ( PREPARE (pg, "lookup_aml_history", "SELECT" - " aggregation_serial_id" - ",deposits.h_contract_terms" - ",payto_uri" - ",wire_targets.wire_target_h_payto" - ",kc.coin_pub" - ",deposits.merchant_pub" - ",wire_out.execution_date" - ",deposits.amount_with_fee_val" - ",deposits.amount_with_fee_frac" - ",denom.fee_deposit_val" - ",denom.fee_deposit_frac" - ",denom.denom_pub" + " new_threshold_val" + ",new_threshold_frac" + ",new_status" + ",decision_time" + ",justification" + ",decider_pub" + ",decider_sig" " FROM aml_history" " WHERE h_payto=$1;"); qs = GNUNET_PQ_eval_prepared_multi_select (pg->conn, diff --git a/src/exchangedb/pg_update_aml_officer.c b/src/exchangedb/pg_test_aml_officer.c index 2f5b0ff90..b00828244 100644 --- a/src/exchangedb/pg_update_aml_officer.c +++ b/src/exchangedb/pg_test_aml_officer.c @@ -14,49 +14,35 @@ TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> */ /** - * @file exchangedb/pg_update_aml_officer.c - * @brief Implementation of the update_aml_officer function for Postgres + * @file exchangedb/pg_test_aml_officer.c + * @brief Implementation of the test_aml_officer function for Postgres * @author Christian Grothoff */ #include "platform.h" #include "taler_error_codes.h" #include "taler_dbevents.h" #include "taler_pq_lib.h" -#include "pg_update_aml_officer.h" +#include "pg_test_aml_officer.h" #include "pg_helper.h" enum GNUNET_DB_QueryStatus -TEH_PG_update_aml_officer ( +TEH_PG_test_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) + const struct TALER_AmlOfficerPublicKeyP *decider_pub) { struct PostgresClosure *pg = cls; struct GNUNET_PQ_QueryParam params[] = { GNUNET_PQ_query_param_auto_from_type (decider_pub), - GNUNET_PQ_query_param_auto_from_type (master_sig), - GNUNET_PQ_query_param_string (decider_name), - GNUNET_PQ_query_param_bool (is_active), - GNUNET_PQ_query_param_bool (read_only), - GNUNET_PQ_query_param_absolute_time (&last_change), GNUNET_PQ_query_param_end }; PREPARE (pg, - "update_aml_staff", - "UPDATE aml_staff SET " - " master_sig=$2" - ",decider_name=$3" - ",is_active=$4" - ",read_only=$5" - ",last_change=$6" - " WHERE decider_pub=$1 AND last_change < $6;"); + "test_aml_staff", + "SELECT 1 FROM aml_staff" + " WHERE decider_pub=$1" + " AND is_active;"); return GNUNET_PQ_eval_prepared_non_select (pg->conn, - "update_aml_staff", + "test_aml_staff", params); } diff --git a/src/exchangedb/pg_update_aml_officer.h b/src/exchangedb/pg_test_aml_officer.h index 8e3592395..9cecd6f03 100644 --- a/src/exchangedb/pg_update_aml_officer.h +++ b/src/exchangedb/pg_test_aml_officer.h @@ -27,25 +27,17 @@ /** - * Update AML staff record. + * Test if the given AML staff member is active + * (at least read-only). * * @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 + * @return database transaction status, if member is unknown or not active, 1 if member is active */ enum GNUNET_DB_QueryStatus -TEH_PG_update_aml_officer ( +TEH_PG_test_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); + const struct TALER_AmlOfficerPublicKeyP *decider_pub); + #endif diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c index cd5773a05..a6e932211 100644 --- a/src/exchangedb/plugin_exchangedb_postgres.c +++ b/src/exchangedb/plugin_exchangedb_postgres.c @@ -210,7 +210,7 @@ #include "pg_select_similar_kyc_attributes.h" #include "pg_select_kyc_attributes.h" #include "pg_insert_aml_officer.h" -#include "pg_update_aml_officer.h" +#include "pg_test_aml_officer.h" #include "pg_lookup_aml_officer.h" #include "pg_trigger_aml_process.h" #include "pg_select_aml_process.h" @@ -761,8 +761,8 @@ libtaler_plugin_exchangedb_postgres_init (void *cls) = &TEH_PG_select_kyc_attributes; plugin->insert_aml_officer = &TEH_PG_insert_aml_officer; - plugin->update_aml_officer - = &TEH_PG_update_aml_officer; + plugin->test_aml_officer + = &TEH_PG_test_aml_officer; plugin->lookup_aml_officer = &TEH_PG_lookup_aml_officer; plugin->trigger_aml_process |