aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2024-09-11 22:51:12 +0200
committerChristian Grothoff <christian@grothoff.org>2024-09-11 22:51:12 +0200
commitb3c5db363adea7434bc87737f930f053e03d868e (patch)
treeb8a72758b2db91128320cd9115a8894e0325ba67
parent6a7717aff159eb7734f4962b375ccee5c8b246d9 (diff)
downloadexchange-b3c5db363adea7434bc87737f930f053e03d868e.tar.xz
fix incorrect setting of bad_kyc_auth
-rw-r--r--src/exchange/taler-exchange-httpd_common_kyc.c13
-rw-r--r--src/exchangedb/exchange_do_trigger_kyc_rule_for_account.sql20
2 files changed, 33 insertions, 0 deletions
diff --git a/src/exchange/taler-exchange-httpd_common_kyc.c b/src/exchange/taler-exchange-httpd_common_kyc.c
index d54b40529..c28dbb601 100644
--- a/src/exchange/taler-exchange-httpd_common_kyc.c
+++ b/src/exchange/taler-exchange-httpd_common_kyc.c
@@ -1515,6 +1515,12 @@ run_check (
case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
break;
}
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "trigger_kyc_rule_for_account on %d/%d returned %llu/%d\n",
+ lch->have_account_pub,
+ lch->have_merchant_pub,
+ (unsigned long long) lch->lcr.kyc.requirement_row,
+ lch->lcr.bad_kyc_auth);
/* return success! */
lch->async_task
= GNUNET_SCHEDULER_add_now (
@@ -1839,6 +1845,13 @@ legitimization_check_run (
TALER_KYCLOGIC_rule2priority (requirement),
&lch->lcr.kyc.requirement_row,
&lch->lcr.bad_kyc_auth);
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "trigger_kyc_rule_for_account on %d/%d returned %d/%llu/%d\n",
+ lch->have_account_pub,
+ lch->have_merchant_pub,
+ (int) qs,
+ (unsigned long long) lch->lcr.kyc.requirement_row,
+ lch->lcr.bad_kyc_auth);
json_decref (jmeasures);
}
if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
diff --git a/src/exchangedb/exchange_do_trigger_kyc_rule_for_account.sql b/src/exchangedb/exchange_do_trigger_kyc_rule_for_account.sql
index 4ddf57952..414ac51ff 100644
--- a/src/exchangedb/exchange_do_trigger_kyc_rule_for_account.sql
+++ b/src/exchangedb/exchange_do_trigger_kyc_rule_for_account.sql
@@ -33,10 +33,12 @@ DECLARE
my_rec RECORD;
my_access_token BYTEA;
my_account_pub BYTEA;
+ my_reserve_pub BYTEA;
BEGIN
-- Note: in_payto_uri is allowed to be NULL *if*
-- in_h_payto is already in wire_targets
+
SELECT
access_token
,target_pub
@@ -68,6 +70,24 @@ ELSE
out_bad_kyc_auth=TRUE;
END IF;
+IF out_bad_kyc_auth
+THEN
+ -- Check most recent reserve_in wire transfer, we also
+ -- allow that reserve public key for authentication!
+ SELECT reserve_pub
+ INTO my_reserve_pub
+ FROM reserves_in
+ WHERE wire_source_h_payto=in_h_payto
+ ORDER BY execution_date DESC
+ LIMIT 1;
+ IF FOUND
+ THEN
+ IF in_merchant_pub = my_reserve_pub
+ THEN
+ out_bad_kyc_auth = FALSE;
+ END IF;
+ END IF;
+END IF;
-- First check if a perfectly equivalent legi measure
-- already exists, to avoid creating tons of duplicates.
UPDATE legitimization_measures