gnunet-svn
[Top][All Lists]
Advanced

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

[taler-exchange] branch master updated: -fix kyc test


From: gnunet
Subject: [taler-exchange] branch master updated: -fix kyc test
Date: Fri, 04 Mar 2022 00:30:45 +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 f9a2808e -fix kyc test
f9a2808e is described below

commit f9a2808ed02535427e4d2a8a45bcdc9777b8caf5
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Fri Mar 4 00:30:43 2022 +0100

    -fix kyc test
---
 src/exchange/taler-exchange-httpd_kyc-check.c      | 68 +++++++++++-----------
 src/exchangedb/plugin_exchangedb_postgres.c        |  8 ++-
 src/testing/test_kyc_api.c                         |  2 +-
 .../testing_api_cmd_bank_admin_add_incoming.c      |  1 +
 src/testing/testing_api_cmd_kyc_check_get.c        |  3 +
 src/testing/testing_api_cmd_kyc_proof.c            |  3 +
 6 files changed, 46 insertions(+), 39 deletions(-)

diff --git a/src/exchange/taler-exchange-httpd_kyc-check.c 
b/src/exchange/taler-exchange-httpd_kyc-check.c
index ba918686..de6ac42f 100644
--- a/src/exchange/taler-exchange-httpd_kyc-check.c
+++ b/src/exchange/taler-exchange-httpd_kyc-check.c
@@ -59,11 +59,6 @@ struct KycPoller
    */
   struct GNUNET_DB_EventHandler *eh;
 
-  /**
-   * UUID found based on @e h_payto.
-   */
-  uint64_t payment_target_uuid;
-
   /**
    * UUID being checked.
    */
@@ -80,6 +75,11 @@ struct KycPoller
    */
   struct TALER_PaytoHashP h_payto;
 
+  /**
+   * Payto URL as a string, as given to us by t
+   */
+  const char *hps;
+
   /**
    * When will this request time out?
    */
@@ -183,9 +183,6 @@ kyc_check (void *cls,
                                            "inselect_wallet_status");
     return qs;
   }
-  // FIXME: avoid duplicating this...
-  kyp->payment_target_uuid = kyp->kyc.payment_target_uuid;
-
   return qs;
 }
 
@@ -293,32 +290,28 @@ TEH_handler_kyc_check (
                                          tms));
       }
     }
+    kyp->hps = MHD_lookup_connection_value (rc->connection,
+                                            MHD_GET_ARGUMENT_KIND,
+                                            "h_payto");
+    if (NULL == kyp->hps)
     {
-      const char *hps;
-
-      hps = MHD_lookup_connection_value (rc->connection,
-                                         MHD_GET_ARGUMENT_KIND,
+      GNUNET_break_op (0);
+      return TALER_MHD_reply_with_error (rc->connection,
+                                         MHD_HTTP_BAD_REQUEST,
+                                         TALER_EC_GENERIC_PARAMETER_MISSING,
+                                         "h_payto");
+    }
+    if (GNUNET_OK !=
+        GNUNET_STRINGS_string_to_data (kyp->hps,
+                                       strlen (kyp->hps),
+                                       &kyp->h_payto,
+                                       sizeof (kyp->h_payto)))
+    {
+      GNUNET_break_op (0);
+      return TALER_MHD_reply_with_error (rc->connection,
+                                         MHD_HTTP_BAD_REQUEST,
+                                         TALER_EC_GENERIC_PARAMETER_MALFORMED,
                                          "h_payto");
-      if (NULL == hps)
-      {
-        GNUNET_break_op (0);
-        return TALER_MHD_reply_with_error (rc->connection,
-                                           MHD_HTTP_BAD_REQUEST,
-                                           TALER_EC_GENERIC_PARAMETER_MISSING,
-                                           "h_payto");
-      }
-      if (GNUNET_OK !=
-          GNUNET_STRINGS_string_to_data (hps,
-                                         strlen (hps),
-                                         &kyp->h_payto,
-                                         sizeof (kyp->h_payto)))
-      {
-        GNUNET_break_op (0);
-        return TALER_MHD_reply_with_error (rc->connection,
-                                           MHD_HTTP_BAD_REQUEST,
-                                           
TALER_EC_GENERIC_PARAMETER_MALFORMED,
-                                           "h_payto");
-      }
     }
   }
 
@@ -360,8 +353,13 @@ TEH_handler_kyc_check (
     return res;
 
   if (kyp->auth_payment_target_uuid !=
-      kyp->payment_target_uuid)
+      kyp->kyc.payment_target_uuid)
   {
+    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                "Account %llu provided, but payto %s is for %llu\n",
+                (unsigned long long) kyp->auth_payment_target_uuid,
+                kyp->hps,
+                (unsigned long long) kyp->kyc.payment_target_uuid);
     GNUNET_break_op (0);
     return TALER_MHD_reply_with_error (rc->connection,
                                        MHD_HTTP_UNAUTHORIZED,
@@ -391,9 +389,9 @@ TEH_handler_kyc_check (
 
     GNUNET_assert (TEH_KYC_OAUTH2 == TEH_kyc_config.mode);
     GNUNET_asprintf (&redirect_uri,
-                     "%s/kyc-proof/%llu",
+                     "%s/kyc-proof/%s",
                      TEH_base_url,
-                     (unsigned long long) kyp->payment_target_uuid);
+                     kyp->hps);
     redirect_uri_encoded = TALER_urlencode (redirect_uri);
     GNUNET_free (redirect_uri);
     GNUNET_asprintf (&url,
diff --git a/src/exchangedb/plugin_exchangedb_postgres.c 
b/src/exchangedb/plugin_exchangedb_postgres.c
index 53fd10e3..bdb15c4e 100644
--- a/src/exchangedb/plugin_exchangedb_postgres.c
+++ b/src/exchangedb/plugin_exchangedb_postgres.c
@@ -3970,7 +3970,7 @@ postgres_select_kyc_status (void *cls,
 {
   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 (h_payto),
     GNUNET_PQ_query_param_end
   };
   struct GNUNET_PQ_ResultSpec rs[] = {
@@ -9668,8 +9668,10 @@ postgres_get_denomination_revocation (
     GNUNET_PQ_query_param_end
   };
   struct GNUNET_PQ_ResultSpec rs[] = {
-    GNUNET_PQ_result_spec_auto_from_type ("master_sig", master_sig),
-    GNUNET_PQ_result_spec_uint64 ("denom_revocations_serial_id", rowid),
+    GNUNET_PQ_result_spec_auto_from_type ("master_sig",
+                                          master_sig),
+    GNUNET_PQ_result_spec_uint64 ("denom_revocations_serial_id",
+                                  rowid),
     GNUNET_PQ_result_spec_end
   };
 
diff --git a/src/testing/test_kyc_api.c b/src/testing/test_kyc_api.c
index ca87edd8..3a828646 100644
--- a/src/testing/test_kyc_api.c
+++ b/src/testing/test_kyc_api.c
@@ -125,7 +125,7 @@ run (void *cls,
                                        0, /* age restriction off */
                                        MHD_HTTP_ACCEPTED),
     TALER_TESTING_cmd_proof_kyc ("proof-kyc",
-                                 "withdraw-coin-1-lacking-kyc",
+                                 "create-reserve-1",
                                  "pass",
                                  "state",
                                  MHD_HTTP_SEE_OTHER),
diff --git a/src/testing/testing_api_cmd_bank_admin_add_incoming.c 
b/src/testing/testing_api_cmd_bank_admin_add_incoming.c
index 64e010ef..5b1d8b8a 100644
--- a/src/testing/testing_api_cmd_bank_admin_add_incoming.c
+++ b/src/testing/testing_api_cmd_bank_admin_add_incoming.c
@@ -427,6 +427,7 @@ admin_add_incoming_traits (void *cls,
     struct TALER_TESTING_Trait traits[] = {
       TALER_TESTING_make_trait_bank_row (&fts->serial_id),
       TALER_TESTING_make_trait_debit_payto_uri (&fts->payto_debit_account),
+      TALER_TESTING_make_trait_payto_uri (&fts->payto_debit_account),
       /* Used as a marker, content does not matter */
       TALER_TESTING_make_trait_credit_payto_uri (&void_uri),
       TALER_TESTING_make_trait_exchange_bank_account_url (
diff --git a/src/testing/testing_api_cmd_kyc_check_get.c 
b/src/testing/testing_api_cmd_kyc_check_get.c
index ffd5664a..03b2321d 100644
--- a/src/testing/testing_api_cmd_kyc_check_get.c
+++ b/src/testing/testing_api_cmd_kyc_check_get.c
@@ -157,6 +157,9 @@ check_kyc_run (void *cls,
     TALER_TESTING_interpreter_fail (kcg->is);
     return;
   }
+  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+              "Running KYC check for payto URI: %s\n",
+              *payto_uri);
   TALER_payto_hash (*payto_uri,
                     &h_payto);
   kcg->kwh = TALER_EXCHANGE_kyc_check (is->exchange,
diff --git a/src/testing/testing_api_cmd_kyc_proof.c 
b/src/testing/testing_api_cmd_kyc_proof.c
index 05c1e7cb..3ee06972 100644
--- a/src/testing/testing_api_cmd_kyc_proof.c
+++ b/src/testing/testing_api_cmd_kyc_proof.c
@@ -153,6 +153,9 @@ proof_kyc_run (void *cls,
     TALER_TESTING_interpreter_fail (kps->is);
     return;
   }
+  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+              "Triggering KYC proof for %s\n",
+              *payto_uri);
   TALER_payto_hash (*payto_uri,
                     &h_payto);
   kps->kph = TALER_EXCHANGE_kyc_proof (is->exchange,

-- 
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]