commit 9b045f89fe1ff3baf6cb99ff01abdefa5d91203e
parent 43d8acb894f758250ac757af65b72892a212515d
Author: Christian Grothoff <christian@grothoff.org>
Date: Fri, 13 Sep 2024 11:09:40 +0200
-nicer SQL
Diffstat:
2 files changed, 29 insertions(+), 19 deletions(-)
diff --git a/src/backend/taler-merchant-httpd_private-get-instances-ID-kyc.c b/src/backend/taler-merchant-httpd_private-get-instances-ID-kyc.c
@@ -40,13 +40,13 @@
* How long should clients cache a KYC failure response?
*/
#define EXPIRATION_KYC_FAILURE GNUNET_TIME_relative_multiply ( \
- GNUNET_TIME_UNIT_MINUTES, 5)
+ GNUNET_TIME_UNIT_MINUTES, 5)
/**
* How long should clients cache a KYC success response?
*/
#define EXPIRATION_KYC_SUCCESS GNUNET_TIME_relative_multiply ( \
- GNUNET_TIME_UNIT_HOURS, 1)
+ GNUNET_TIME_UNIT_HOURS, 1)
/**
@@ -647,7 +647,6 @@ determine_eligible_accounts (
/* For all accounts of the exchange */
for (unsigned int i = 0; i<keys->accounts_len; i++)
{
- /* FIXME: move into convenience function in libtalerexchange? See also taler-merchant-kyccheck.c! */
const struct TALER_EXCHANGE_WireAccount *account
= &keys->accounts[i];
const char *exchange_account_payto
@@ -953,6 +952,11 @@ get_instances_ID_kyc (
GNUNET_break (0 ==
json_array_clear (kc->kycs_data));
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Checking KYC status for %s (%d/%s)\n",
+ mi->settings.id,
+ kc->have_h_wire,
+ kc->exchange_url);
qs = TMH_db->account_kyc_get_status (
TMH_db->cls,
mi->settings.id,
@@ -962,6 +966,9 @@ get_instances_ID_kyc (
kc->exchange_url,
&kyc_status_cb,
kc);
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Got status %d\n",
+ (int) qs);
if (qs < 0)
{
/* Database error */
diff --git a/src/backenddb/pg_account_kyc_get_status.c b/src/backenddb/pg_account_kyc_get_status.c
@@ -67,6 +67,9 @@ kyc_status_cb (void *cls,
{
struct KycStatusContext *ksc = cls;
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Got %u KYC records\n",
+ num_results);
for (unsigned int i = 0; i < num_results; i++)
{
struct TALER_MerchantWireHashP h_wire;
@@ -170,26 +173,26 @@ TMH_PG_account_kyc_get_status (
PREPARE (pg,
"lookup_kyc_status",
"SELECT"
- " h_wire"
- ",payto_uri"
- ",exchange_url"
- ",kyc_timestamp"
- ",kyc_ok"
- ",access_token"
- ",exchange_http_status"
- ",exchange_ec_code"
- ",aml_review"
- ",jaccount_limits"
- " FROM merchant_instances"
- " JOIN merchant_accounts"
+ " ma.h_wire"
+ ",ma.payto_uri"
+ ",mk.exchange_url"
+ ",mk.kyc_timestamp"
+ ",mk.kyc_ok"
+ ",mk.access_token"
+ ",mk.exchange_http_status"
+ ",mk.exchange_ec_code"
+ ",mk.aml_review"
+ ",mk.jaccount_limits"
+ " FROM merchant_instances mi"
+ " JOIN merchant_accounts ma"
" USING (merchant_serial)"
- " JOIN merchant_kyc"
+ " JOIN merchant_kyc mk"
" USING (account_serial)"
- " WHERE (merchant_instances.merchant_id=$1)"
+ " WHERE (mi.merchant_id=$1)"
" AND ( ($2::TEXT IS NULL)"
- " OR (exchange_url=$2) )"
+ " OR (mk.exchange_url=$2) )"
" AND ( ($3::BYTEA IS NULL)"
- " OR (h_wire=$3) );");
+ " OR (ma.h_wire=$3) );");
qs = GNUNET_PQ_eval_prepared_multi_select (
pg->conn,
"lookup_kyc_status",