aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/exchange/taler-exchange-httpd_kyc-check.c4
-rw-r--r--src/exchangedb/exchange-0005.sql.in1
-rw-r--r--src/exchangedb/exchange_do_create_tables.sql4
-rw-r--r--src/exchangedb/pg_create_tables.c2
-rw-r--r--src/exchangedb/pg_lookup_kyc_requirement_by_row.c10
-rw-r--r--src/exchangedb/pg_reserves_get_origin.c4
-rw-r--r--src/exchangedb/procedures.sql.in2
-rw-r--r--src/lib/exchange_api_kyc_check.c3
8 files changed, 22 insertions, 8 deletions
diff --git a/src/exchange/taler-exchange-httpd_kyc-check.c b/src/exchange/taler-exchange-httpd_kyc-check.c
index 61b4eb974..22447ebac 100644
--- a/src/exchange/taler-exchange-httpd_kyc-check.c
+++ b/src/exchange/taler-exchange-httpd_kyc-check.c
@@ -263,6 +263,9 @@ TEH_handler_kyc_check (
{
enum GNUNET_DB_QueryStatus qs;
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Looking up KYC requirements by row %llu\n",
+ (unsigned long long) kyp->requirement_row);
qs = TEH_plugin->lookup_kyc_requirement_by_row (
TEH_plugin->cls,
kyp->requirement_row,
@@ -301,6 +304,7 @@ TEH_handler_kyc_check (
jrules = NULL;
if (GNUNET_is_zero (&account_pub))
{
+ GNUNET_break_op (0);
return TALER_MHD_reply_with_error (
rc->connection,
MHD_HTTP_CONFLICT,
diff --git a/src/exchangedb/exchange-0005.sql.in b/src/exchangedb/exchange-0005.sql.in
index af02951ec..4b2f89750 100644
--- a/src/exchangedb/exchange-0005.sql.in
+++ b/src/exchangedb/exchange-0005.sql.in
@@ -27,6 +27,7 @@ SET search_path TO exchange;
#include "0005-aml_history.sql"
#include "0005-kyc_events.sql"
#include "0005-kycauths_in.sql"
+#include "0005-reserves_in.sql"
-- drops:
#include "0005-aml_status.sql"
diff --git a/src/exchangedb/exchange_do_create_tables.sql b/src/exchangedb/exchange_do_create_tables.sql
index 58d28ca14..2a007be6b 100644
--- a/src/exchangedb/exchange_do_create_tables.sql
+++ b/src/exchangedb/exchange_do_create_tables.sql
@@ -19,7 +19,7 @@
---------------------------------------------------------------------------
-CREATE OR REPLACE FUNCTION do_create_tables(
+CREATE OR REPLACE FUNCTION exchange_do_create_tables(
num_partitions INTEGER
-- NULL: no partitions, add foreign constraints
-- 0: no partitions, no foreign constraints
@@ -188,5 +188,5 @@ BEGIN
END LOOP; -- create/alter/drop actions
END $$;
-COMMENT ON FUNCTION do_create_tables
+COMMENT ON FUNCTION exchange_do_create_tables
IS 'Creates all tables for the given number of partitions that need creating. Does NOT support sharding.';
diff --git a/src/exchangedb/pg_create_tables.c b/src/exchangedb/pg_create_tables.c
index 35c344e79..8788f0018 100644
--- a/src/exchangedb/pg_create_tables.c
+++ b/src/exchangedb/pg_create_tables.c
@@ -64,7 +64,7 @@ TEH_PG_create_tables (void *cls,
PREPARE (pg,
"create_tables",
"SELECT"
- " exchange.do_create_tables"
+ " exchange_do_create_tables"
" ($1::INTEGER);");
pg->conn = tconn;
if (0 >
diff --git a/src/exchangedb/pg_lookup_kyc_requirement_by_row.c b/src/exchangedb/pg_lookup_kyc_requirement_by_row.c
index 7bdaf2de6..457d8c963 100644
--- a/src/exchangedb/pg_lookup_kyc_requirement_by_row.c
+++ b/src/exchangedb/pg_lookup_kyc_requirement_by_row.c
@@ -52,14 +52,18 @@ TEH_PG_lookup_kyc_requirement_by_row (
TALER_PQ_result_spec_json ("jrules",
jrules),
NULL),
- GNUNET_PQ_result_spec_bool ("aml_review",
- aml_review),
+ GNUNET_PQ_result_spec_allow_null (
+ /* can be NULL due to LEFT JOIN */
+ GNUNET_PQ_result_spec_bool ("aml_review",
+ aml_review),
+ NULL),
GNUNET_PQ_result_spec_bool ("kyc_required",
kyc_required),
GNUNET_PQ_result_spec_end
};
*jrules = NULL;
+ *aml_review = false;
memset (account_pub,
0,
sizeof (*account_pub));
@@ -75,7 +79,7 @@ TEH_PG_lookup_kyc_requirement_by_row (
" JOIN wire_targets wt"
" USING (access_token)"
" LEFT JOIN legitimization_outcomes lo"
- " USING (h_payto)"
+ " ON (wt.wire_target_h_payto = lo.h_payto)"
" WHERE legitimization_measure_serial_id=$1;");
return GNUNET_PQ_eval_prepared_singleton_select (
pg->conn,
diff --git a/src/exchangedb/pg_reserves_get_origin.c b/src/exchangedb/pg_reserves_get_origin.c
index 2b185cabb..81049c883 100644
--- a/src/exchangedb/pg_reserves_get_origin.c
+++ b/src/exchangedb/pg_reserves_get_origin.c
@@ -53,7 +53,9 @@ TEH_PG_reserves_get_origin (
"SELECT"
" wire_source_h_payto"
",payto_uri"
- " FROM reserves_in"
+ " FROM reserves_in rt"
+ " JOIN wire_targets wt"
+ " ON (rt.wire_source_h_payto = wt.wire_target_h_payto)"
" WHERE reserve_pub=$1");
return GNUNET_PQ_eval_prepared_singleton_select (
pg->conn,
diff --git a/src/exchangedb/procedures.sql.in b/src/exchangedb/procedures.sql.in
index c1ffc9ad6..1c8f05b24 100644
--- a/src/exchangedb/procedures.sql.in
+++ b/src/exchangedb/procedures.sql.in
@@ -50,6 +50,6 @@ SET search_path TO exchange;
#include "exchange_do_get_link_data.sql"
#include "exchange_do_batch_coin_known.sql"
#include "exchange_do_kycauth_in_insert.sql"
-#include "exchange_do_trigger_kcy_rule_for_account.sql"
+#include "exchange_do_trigger_kyc_rule_for_account.sql"
COMMIT;
diff --git a/src/lib/exchange_api_kyc_check.c b/src/lib/exchange_api_kyc_check.c
index b3b04008b..5ecc30d5c 100644
--- a/src/lib/exchange_api_kyc_check.c
+++ b/src/lib/exchange_api_kyc_check.c
@@ -204,6 +204,9 @@ handle_kyc_check_finished (void *cls,
case MHD_HTTP_NOT_FOUND:
ks.hr.ec = TALER_JSON_get_error_code (j);
break;
+ case MHD_HTTP_CONFLICT:
+ ks.hr.ec = TALER_JSON_get_error_code (j);
+ break;
case MHD_HTTP_INTERNAL_SERVER_ERROR:
ks.hr.ec = TALER_JSON_get_error_code (j);
/* Server had an internal issue; we should retry, but this API