diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/exchangedb/0003-aml_history.sql | 1 | ||||
-rw-r--r-- | src/exchangedb/pg_insert_aml_decision.c | 31 | ||||
-rw-r--r-- | src/exchangedb/pg_insert_aml_officer.c | 27 | ||||
-rw-r--r-- | src/exchangedb/pg_insert_kyc_attributes.c | 32 | ||||
-rw-r--r-- | src/exchangedb/pg_insert_wire.c | 7 | ||||
-rw-r--r-- | src/exchangedb/pg_update_aml_officer.c | 25 | ||||
-rw-r--r-- | src/exchangedb/pg_update_kyc_attributes.c | 29 |
7 files changed, 138 insertions, 14 deletions
diff --git a/src/exchangedb/0003-aml_history.sql b/src/exchangedb/0003-aml_history.sql index d3650f6c6..c2ab532da 100644 --- a/src/exchangedb/0003-aml_history.sql +++ b/src/exchangedb/0003-aml_history.sql @@ -114,6 +114,7 @@ BEGIN ); END $$; +-- FIXME: also have INSERT on AML decisions to update AML status! INSERT INTO exchange_tables (name diff --git a/src/exchangedb/pg_insert_aml_decision.c b/src/exchangedb/pg_insert_aml_decision.c index 25ad4c56c..94f30275a 100644 --- a/src/exchangedb/pg_insert_aml_decision.c +++ b/src/exchangedb/pg_insert_aml_decision.c @@ -37,6 +37,33 @@ TEH_PG_insert_aml_decision ( const struct TALER_AmlOfficerPublicKeyP *decider_pub, const struct TALER_AmlOfficerSignatureP *decider_sig) { - GNUNET_break (0); // FIXME: not implemeted! - return GNUNET_DB_STATUS_HARD_ERROR; + struct PostgresClosure *pg = cls; + uint32_t ns = (uint32_t) new_status; + struct GNUNET_PQ_QueryParam params[] = { + GNUNET_PQ_query_param_auto_from_type (h_payto), + TALER_PQ_query_param_amount (new_threshold), + GNUNET_PQ_query_param_uint32 (&ns), + GNUNET_PQ_query_param_timestamp (&decision_time), + GNUNET_PQ_query_param_string (justification), + GNUNET_PQ_query_param_auto_from_type (decider_pub), + GNUNET_PQ_query_param_auto_from_type (decider_sig), + GNUNET_PQ_query_param_end + }; + + PREPARE (pg, + "insert_aml_decision", + "INSERT INTO aml_history " + "(h_payto" + ",new_threshold_val" + ",new_threshold_frac" + ",new_status" + ",decision_time" + ",justification" + ",decider_pub" + ",decider_sig" + ") VALUES " + "($1, $2, $3, $4, $5, $6, $7, $8);"); + return GNUNET_PQ_eval_prepared_non_select (pg->conn, + "insert_aml_decision", + params); } diff --git a/src/exchangedb/pg_insert_aml_officer.c b/src/exchangedb/pg_insert_aml_officer.c index 89b7ffae1..fc2cadef2 100644 --- a/src/exchangedb/pg_insert_aml_officer.c +++ b/src/exchangedb/pg_insert_aml_officer.c @@ -36,6 +36,29 @@ TEH_PG_insert_aml_officer ( bool read_only, struct GNUNET_TIME_Absolute last_change) { - GNUNET_break (0); // FIXME: not implemeted! - return GNUNET_DB_STATUS_HARD_ERROR; + 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, + "insert_aml_staff", + "INSERT INTO aml_staff " + "(decider_pub" + ",master_sig" + ",decider_name" + ",is_active" + ",read_only" + ",last_change" + ") VALUES " + "($1, $2, $3, $4, $5, $6);"); + return GNUNET_PQ_eval_prepared_non_select (pg->conn, + "insert_aml_staff", + params); } diff --git a/src/exchangedb/pg_insert_kyc_attributes.c b/src/exchangedb/pg_insert_kyc_attributes.c index 5714e2aa7..fd90950fd 100644 --- a/src/exchangedb/pg_insert_kyc_attributes.c +++ b/src/exchangedb/pg_insert_kyc_attributes.c @@ -38,6 +38,34 @@ TEH_PG_insert_kyc_attributes ( size_t enc_attributes_size, const void *enc_attributes) { - GNUNET_break (0); // FIXME: not implemeted! - return GNUNET_DB_STATUS_HARD_ERROR; + struct PostgresClosure *pg = cls; + struct GNUNET_PQ_QueryParam params[] = { + GNUNET_PQ_query_param_auto_from_type (h_payto), + GNUNET_PQ_query_param_auto_from_type (kyc_prox), + GNUNET_PQ_query_param_string (provider_section), + (NULL == birthdate) + ? GNUNET_PQ_query_param_null () + : GNUNET_PQ_query_param_string (birthdate), + GNUNET_PQ_query_param_timestamp (&collection_time), + GNUNET_PQ_query_param_timestamp (&expiration_time), + GNUNET_PQ_query_param_fixed_size (enc_attributes, + enc_attributes_size), + GNUNET_PQ_query_param_end + }; + + PREPARE (pg, + "insert_kyc_attributes", + "INSERT INTO kyc_attributes " + "(h_payto" + ",kyc_prox" + ",provider" + ",birthdate" + ",collection_time" + ",expiration_time" + ",encrypted_attributes" + ") VALUES " + "($1, $2, $3, $4, $5, $6, $7);"); + return GNUNET_PQ_eval_prepared_non_select (pg->conn, + "insert_kyc_attributes", + params); } diff --git a/src/exchangedb/pg_insert_wire.c b/src/exchangedb/pg_insert_wire.c index 646bce94e..75323b6fc 100644 --- a/src/exchangedb/pg_insert_wire.c +++ b/src/exchangedb/pg_insert_wire.c @@ -28,9 +28,9 @@ enum GNUNET_DB_QueryStatus TEH_PG_insert_wire (void *cls, - const char *payto_uri, - struct GNUNET_TIME_Timestamp start_date, - const struct TALER_MasterSignatureP *master_sig) + const char *payto_uri, + struct GNUNET_TIME_Timestamp start_date, + const struct TALER_MasterSignatureP *master_sig) { struct PostgresClosure *pg = cls; struct GNUNET_PQ_QueryParam params[] = { @@ -40,7 +40,6 @@ TEH_PG_insert_wire (void *cls, GNUNET_PQ_query_param_end }; - /* used in #postgres_insert_wire() */ PREPARE (pg, "insert_wire", "INSERT INTO wire_accounts " diff --git a/src/exchangedb/pg_update_aml_officer.c b/src/exchangedb/pg_update_aml_officer.c index aca58f0c7..f756e6e2c 100644 --- a/src/exchangedb/pg_update_aml_officer.c +++ b/src/exchangedb/pg_update_aml_officer.c @@ -36,6 +36,27 @@ TEH_PG_update_aml_officer ( bool read_only, struct GNUNET_TIME_Absolute last_change) { - GNUNET_break (0); // FIXME: not implemeted! - return GNUNET_DB_STATUS_HARD_ERROR; + 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_timestamp (&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;"); + return GNUNET_PQ_eval_prepared_non_select (pg->conn, + "update_aml_staff", + params); } diff --git a/src/exchangedb/pg_update_kyc_attributes.c b/src/exchangedb/pg_update_kyc_attributes.c index 8f0c6fd3c..f77eb2bfc 100644 --- a/src/exchangedb/pg_update_kyc_attributes.c +++ b/src/exchangedb/pg_update_kyc_attributes.c @@ -38,6 +38,31 @@ TEH_PG_update_kyc_attributes ( size_t enc_attributes_size, const void *enc_attributes) { - GNUNET_break (0); // FIXME: not implemeted! - return GNUNET_DB_STATUS_HARD_ERROR; + struct PostgresClosure *pg = cls; + struct GNUNET_PQ_QueryParam params[] = { + GNUNET_PQ_query_param_auto_from_type (h_payto), + GNUNET_PQ_query_param_auto_from_type (kyc_prox), + GNUNET_PQ_query_param_string (provider_section), + (NULL == birthdate) + ? GNUNET_PQ_query_param_null () + : GNUNET_PQ_query_param_string (birthdate), + GNUNET_PQ_query_param_timestamp (&collection_time), + GNUNET_PQ_query_param_timestamp (&expiration_time), + GNUNET_PQ_query_param_fixed_size (enc_attributes, + enc_attributes_size), + GNUNET_PQ_query_param_end + }; + + PREPARE (pg, + "update_kyc_attributes", + "UPDATE kyc_attributes SET " + " kyc_prox=$2" + ",birthdate=$4" + ",collection_time=$5" + ",expiration_time=$6" + ",encrypted_attributes=$7" + " WHERE h_payto=$1 AND provider_section=$3;"); + return GNUNET_PQ_eval_prepared_non_select (pg->conn, + "update_kyc_attributes", + params); } |