gnunet-svn
[Top][All Lists]
Advanced

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

[taler-merchant] branch master updated: -address more minor FIXMEs


From: gnunet
Subject: [taler-merchant] branch master updated: -address more minor FIXMEs
Date: Thu, 02 Jan 2025 12:54:26 +0100

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

grothoff pushed a commit to branch master
in repository merchant.

The following commit(s) were added to refs/heads/master by this push:
     new b76c7763 -address more minor FIXMEs
b76c7763 is described below

commit b76c77637a0782bccafddbbccac707b2abc962c6
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Thu Jan 2 12:54:21 2025 +0100

    -address more minor FIXMEs
---
 configure.ac                                 |  4 ++--
 src/backend/taler-merchant-httpd_exchanges.c | 29 +++++--------------------
 src/backend/taler-merchant-kyccheck.c        | 26 +++++-----------------
 src/backenddb/merchantdb_helper.c            | 13 -----------
 src/backenddb/pg_select_category.c           | 13 +++++------
 src/backenddb/pg_select_category_by_name.c   | 15 ++++++-------
 src/include/taler_merchantdb_plugin.h        | 32 ----------------------------
 7 files changed, 26 insertions(+), 106 deletions(-)

diff --git a/configure.ac b/configure.ac
index bf2a645f..0be33588 100644
--- a/configure.ac
+++ b/configure.ac
@@ -277,12 +277,12 @@ AS_CASE([$with_exchange],
          CPPFLAGS="-I$with_exchange/include $CPPFLAGS $POSTGRESQL_CPPFLAGS"])
 
 AC_CHECK_HEADERS([taler/taler_exchange_service.h],
- [AC_CHECK_LIB([talerexchange], [TALER_EXCHANGE_test_account_allowed], 
libtalerexchange=1)])
+ [AC_CHECK_LIB([talerexchange], [TALER_EXCHANGE_keys_test_account_allowed], 
libtalerexchange=1)])
 AM_CONDITIONAL(HAVE_TALEREXCHANGE, test x$libtalerexchange = x1)
 AS_IF([test $libtalerexchange != 1],
   [AC_MSG_ERROR([[
 ***
-*** You need libtalerexchange >= 0.14.0 to build this program.
+*** You need libtalerexchange >= 15:0:0 to build this program.
 *** This library is part of the GNU Taler exchange, available at
 ***   https://taler.net
 *** ]])])
diff --git a/src/backend/taler-merchant-httpd_exchanges.c 
b/src/backend/taler-merchant-httpd_exchanges.c
index 75e62196..5249ff46 100644
--- a/src/backend/taler-merchant-httpd_exchanges.c
+++ b/src/backend/taler-merchant-httpd_exchanges.c
@@ -675,7 +675,7 @@ TMH_exchange_check_debit (
 {
   const struct TALER_EXCHANGE_Keys *keys = exchange->keys;
   struct TALER_NormalizedPayto np;
-  bool account_ok = false;
+  bool account_ok;
   bool have_kyc = false;
   struct TALER_Amount kyc_limit;
   bool unlimited = true;
@@ -693,30 +693,11 @@ TMH_exchange_check_debit (
                 max_amount->currency);
     return GNUNET_SYSERR;
   }
-  np = TALER_payto_normalize (wm->payto_uri);
-
-  /* For all accounts of the exchange */
-  for (unsigned int i = 0; i<keys->accounts_len; i++)
-  {
-    const struct TALER_EXCHANGE_WireAccount *account
-      = &keys->accounts[i];
 
-    if (NULL != account->conversion_url)
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                  "Exchange %s account requires currency conversion (not 
supported)\n",
-                  exchange->url);
-      continue; /* never use accounts with conversion */
-    }
-    if (GNUNET_YES !=
-        TALER_EXCHANGE_test_account_allowed (account,
-                                             false, /* debit */
-                                             np))
-      continue;
-    account_ok = true;
-    /* Check legitimization limits we have with this
-       account at this exchange, if we have any, apply them */
-  }
+  np = TALER_payto_normalize (wm->payto_uri);
+  account_ok = TALER_EXCHANGE_keys_test_account_allowed (keys,
+                                                         false,
+                                                         np);
   GNUNET_free (np.normalized_payto);
   if (keys->kyc_enabled)
   {
diff --git a/src/backend/taler-merchant-kyccheck.c 
b/src/backend/taler-merchant-kyccheck.c
index f40321fd..b945308f 100644
--- a/src/backend/taler-merchant-kyccheck.c
+++ b/src/backend/taler-merchant-kyccheck.c
@@ -715,30 +715,14 @@ is_eligible (const struct TALER_EXCHANGE_Keys *keys,
              const struct Account *a)
 {
   struct TALER_NormalizedPayto np;
+  bool ret;
 
   np = TALER_payto_normalize (a->merchant_account_uri);
-  /* 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-httpd_private-get-instances-ID-kyc.c, 
taler-merchant-httpd_exchanges (!)*/
-    const struct TALER_EXCHANGE_WireAccount *account
-      = &keys->accounts[i];
-
-    /* KYC auth transfers are never supported with conversion */
-    if (NULL != account->conversion_url)
-      continue;
-    /* filter by source account by credit_restrictions */
-    if (GNUNET_YES !=
-        TALER_EXCHANGE_test_account_allowed (account,
-                                             true, /* credit */
-                                             np))
-      continue;
-    /* exchange account is allowed, add it */
-    GNUNET_free (np.normalized_payto);
-    return true;
-  }
+  ret = TALER_EXCHANGE_keys_test_account_allowed (keys,
+                                                  true,
+                                                  np);
   GNUNET_free (np.normalized_payto);
-  return false;
+  return ret;
 }
 
 
diff --git a/src/backenddb/merchantdb_helper.c 
b/src/backenddb/merchantdb_helper.c
index 4397fb36..b09a0e69 100644
--- a/src/backenddb/merchantdb_helper.c
+++ b/src/backenddb/merchantdb_helper.c
@@ -88,19 +88,6 @@ TALER_MERCHANTDB_category_details_free (
 {
   GNUNET_free (cd->category_name);
   json_decref (cd->category_name_i18n);
-  // FIXME: also return product details
-  // for (unsigned int i = 0; i<cd->num_products; i++)
-  // {
-  //   const char* *ps
-  //     = &cd->products[i];
-
-  //   GNUNET_free (ps);
-  //   // GNUNET_free (ps->description);
-  //   // json_decref (ps->description_i18n);
-  // }
-  // GNUNET_array_grow (cd->products,
-  //                    cd->num_products,
-  //                    0);
 }
 
 
diff --git a/src/backenddb/pg_select_category.c 
b/src/backenddb/pg_select_category.c
index 58747d71..719651de 100644
--- a/src/backenddb/pg_select_category.c
+++ b/src/backenddb/pg_select_category.c
@@ -27,12 +27,13 @@
 
 
 enum GNUNET_DB_QueryStatus
-TMH_PG_select_category (void *cls,
-                        const char *instance_id,
-                        uint64_t category_id,
-                        struct TALER_MERCHANTDB_CategoryDetails *cd,
-                        size_t *num_products,
-                        char **products)
+TMH_PG_select_category (
+  void *cls,
+  const char *instance_id,
+  uint64_t category_id,
+  struct TALER_MERCHANTDB_CategoryDetails *cd,
+  size_t *num_products,
+  char **products)
 {
   struct PostgresClosure *pg = cls;
   struct GNUNET_PQ_QueryParam params[] = {
diff --git a/src/backenddb/pg_select_category_by_name.c 
b/src/backenddb/pg_select_category_by_name.c
index 9c2aa784..a7e3e7a8 100644
--- a/src/backenddb/pg_select_category_by_name.c
+++ b/src/backenddb/pg_select_category_by_name.c
@@ -27,11 +27,12 @@
 
 
 enum GNUNET_DB_QueryStatus
-TMH_PG_select_category_by_name (void *cls,
-                                const char *instance_id,
-                                const char *category_name,
-                                json_t **name_i18n,
-                                uint64_t *category_id)
+TMH_PG_select_category_by_name (
+  void *cls,
+  const char *instance_id,
+  const char *category_name,
+  json_t **name_i18n,
+  uint64_t *category_id)
 {
   struct PostgresClosure *pg = cls;
   struct GNUNET_PQ_QueryParam params[] = {
@@ -47,6 +48,7 @@ TMH_PG_select_category_by_name (void *cls,
     GNUNET_PQ_result_spec_end
   };
 
+  check_connection (pg);
   PREPARE (pg,
            "select_category_by_name",
            "SELECT"
@@ -57,9 +59,6 @@ TMH_PG_select_category_by_name (void *cls,
            "   USING (merchant_serial)"
            " WHERE mi.merchant_id=$1"
            "   AND mc.category_name=$2");
-
-
-  check_connection (pg);
   return GNUNET_PQ_eval_prepared_singleton_select (
     pg->conn,
     "select_category_by_name",
diff --git a/src/include/taler_merchantdb_plugin.h 
b/src/include/taler_merchantdb_plugin.h
index 7d78a986..104a73e3 100644
--- a/src/include/taler_merchantdb_plugin.h
+++ b/src/include/taler_merchantdb_plugin.h
@@ -522,28 +522,6 @@ typedef void
   uint64_t product_count);
 
 
-/**
- * Details about a product category.
- */
-struct TALER_MERCHANTDB_ProductSummary
-{
-  /**
-   * ID of the product.
-   */
-  char *product_id;
-
-  /**
-   * Description for the product.
-   */
-  char *description;
-
-  /**
-   * Translation of the @e description.
-   */
-  json_t *description_i18n;
-
-};
-
 /**
  * Details about a product category.
  */
@@ -560,16 +538,6 @@ struct TALER_MERCHANTDB_CategoryDetails
    */
   json_t *category_name_i18n;
 
-  /**
-   * Products in the category.
-   */
-  struct TALER_MERCHANTDB_ProductSummary *products;
-
-  /**
-   * Length of the @e products array.
-   */
-  unsigned int num_products;
-
 };
 
 

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