gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-exchange] branch master updated: -improve KYC error handling


From: gnunet
Subject: [taler-exchange] branch master updated: -improve KYC error handling
Date: Mon, 26 Feb 2024 21:05:33 +0100

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository exchange.

The following commit(s) were added to refs/heads/master by this push:
     new f16b094e -improve KYC error handling
f16b094e is described below

commit f16b094ed6d5e851e3cb75c68158ad08a5a1fe5e
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Mon Feb 26 21:05:31 2024 +0100

    -improve KYC error handling
---
 src/exchange/taler-exchange-httpd_kyc-check.c      | 76 +++++++++++-----------
 .../pg_get_pending_kyc_requirement_process.c       |  7 +-
 src/exchangedb/pg_update_kyc_process_by_row.c      |  4 +-
 3 files changed, 46 insertions(+), 41 deletions(-)

diff --git a/src/exchange/taler-exchange-httpd_kyc-check.c 
b/src/exchange/taler-exchange-httpd_kyc-check.c
index fe45cd5b..362c20a2 100644
--- a/src/exchange/taler-exchange-httpd_kyc-check.c
+++ b/src/exchange/taler-exchange-httpd_kyc-check.c
@@ -253,26 +253,22 @@ initiate_cb (
   {
     kyp->hint = GNUNET_strdup (error_msg_hint);
   }
-  if ( (TALER_EC_NONE != ec) &&
-       (NULL != redirect_url) )
-  {
-    qs = TEH_plugin->update_kyc_process_by_row (
-      TEH_plugin->cls,
-      kyp->process_row,
-      kyp->section_name,
-      &kyp->h_payto,
-      provider_user_id,
-      provider_legitimization_id,
-      redirect_url,
-      GNUNET_TIME_UNIT_ZERO_ABS);
-    if (qs <= 0)
-      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                  "KYC requirement update failed for %s with status %d at 
%s:%u\n",
-                  TALER_B2S (&kyp->h_payto),
-                  qs,
-                  __FILE__,
-                  __LINE__);
-  }
+  qs = TEH_plugin->update_kyc_process_by_row (
+    TEH_plugin->cls,
+    kyp->process_row,
+    kyp->section_name,
+    &kyp->h_payto,
+    provider_user_id,
+    provider_legitimization_id,
+    redirect_url,
+    GNUNET_TIME_UNIT_ZERO_ABS);
+  if (qs <= 0)
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                "KYC requirement update failed for %s with status %d at 
%s:%u\n",
+                TALER_B2S (&kyp->h_payto),
+                qs,
+                __FILE__,
+                __LINE__);
   GNUNET_assert (kyp->suspended);
   kyp->suspended = false;
   GNUNET_CONTAINER_DLL_remove (kyp_head,
@@ -410,29 +406,33 @@ kyc_check (void *cls,
                                            "insert_kyc_requirement_process");
     return GNUNET_DB_STATUS_HARD_ERROR;
   }
-  if (qs > 0)
+  if ( (qs > 0) &&
+       (NULL != redirect_url) )
   {
     kyp->kyc_url = redirect_url;
     return qs;
   }
-  qs = TEH_plugin->insert_kyc_requirement_process (
-    TEH_plugin->cls,
-    &h_payto,
-    kyp->section_name,
-    NULL,
-    NULL,
-    &kyp->process_row);
-
-  if (qs < 0)
+  if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
   {
-    if (GNUNET_DB_STATUS_SOFT_ERROR == qs)
-      return qs;
-    GNUNET_break (0);
-    *mhd_ret = TALER_MHD_reply_with_error (connection,
-                                           MHD_HTTP_INTERNAL_SERVER_ERROR,
-                                           TALER_EC_GENERIC_DB_STORE_FAILED,
-                                           "insert_kyc_requirement_process");
-    return GNUNET_DB_STATUS_HARD_ERROR;
+    /* set up new requirement process */
+    qs = TEH_plugin->insert_kyc_requirement_process (
+      TEH_plugin->cls,
+      &h_payto,
+      kyp->section_name,
+      NULL,
+      NULL,
+      &kyp->process_row);
+    if (qs < 0)
+    {
+      if (GNUNET_DB_STATUS_SOFT_ERROR == qs)
+        return qs;
+      GNUNET_break (0);
+      *mhd_ret = TALER_MHD_reply_with_error (connection,
+                                             MHD_HTTP_INTERNAL_SERVER_ERROR,
+                                             TALER_EC_GENERIC_DB_STORE_FAILED,
+                                             "insert_kyc_requirement_process");
+      return GNUNET_DB_STATUS_HARD_ERROR;
+    }
   }
   GNUNET_log (GNUNET_ERROR_TYPE_INFO,
               "Initiating KYC check with logic %s\n",
diff --git a/src/exchangedb/pg_get_pending_kyc_requirement_process.c 
b/src/exchangedb/pg_get_pending_kyc_requirement_process.c
index 2a5808ff..b9acddad 100644
--- a/src/exchangedb/pg_get_pending_kyc_requirement_process.c
+++ b/src/exchangedb/pg_get_pending_kyc_requirement_process.c
@@ -40,11 +40,14 @@ TEH_PG_get_pending_kyc_requirement_process (
     GNUNET_PQ_query_param_end
   };
   struct GNUNET_PQ_ResultSpec rs[] = {
-    GNUNET_PQ_result_spec_string ("redirect_url",
-                                  redirect_url),
+    GNUNET_PQ_result_spec_allow_null (
+      GNUNET_PQ_result_spec_string ("redirect_url",
+                                    redirect_url),
+      NULL),
     GNUNET_PQ_result_spec_end
   };
 
+  *redirect_url = NULL;
   PREPARE (pg,
            "get_pending_kyc_requirement_process",
            "SELECT"
diff --git a/src/exchangedb/pg_update_kyc_process_by_row.c 
b/src/exchangedb/pg_update_kyc_process_by_row.c
index d379ee81..c339436a 100644
--- a/src/exchangedb/pg_update_kyc_process_by_row.c
+++ b/src/exchangedb/pg_update_kyc_process_by_row.c
@@ -48,7 +48,9 @@ TEH_PG_update_kyc_process_by_row (
     (NULL != provider_legitimization_id)
     ? GNUNET_PQ_query_param_string (provider_legitimization_id)
     : GNUNET_PQ_query_param_null (),
-    GNUNET_PQ_query_param_string (redirect_url),
+    (NULL != redirect_url)
+    ? GNUNET_PQ_query_param_string (redirect_url)
+    : GNUNET_PQ_query_param_null (),
     GNUNET_PQ_query_param_absolute_time (&expiration),
     GNUNET_PQ_query_param_end
   };

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]