gnunet-svn
[Top][All Lists]
Advanced

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

[taler-exchange] branch master updated: migrate to new bank API


From: gnunet
Subject: [taler-exchange] branch master updated: migrate to new bank API
Date: Thu, 21 Sep 2023 12:54:08 +0200

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 9f8dd896 migrate to new bank API
9f8dd896 is described below

commit 9f8dd896b3e8027f2020201fd9835543401f6eba
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Thu Sep 21 12:54:03 2023 +0200

    migrate to new bank API
---
 src/auditor/batch.conf                             |   2 +-
 src/auditor/generate-auditor-basedb.conf           |   2 +-
 src/auditor/revoke-basedb.conf                     |   2 +-
 src/bank-lib/bank_api_admin.c                      |   2 +-
 src/bank-lib/fakebank.c                            |  91 +---
 src/bank-lib/fakebank_bank.c                       | 501 ++++++++++++++++-----
 .../fakebank_bank_post_accounts_withdrawals.c      |   2 +-
 src/bank-lib/fakebank_tbr_get_history.c            |   2 +-
 src/bank-lib/taler-exchange-wire-gateway-client.c  |   2 +-
 src/bank-lib/test_bank.sh                          |   8 +-
 src/benchmark/bank-benchmark-cs.conf               |   2 +-
 src/benchmark/bank-benchmark-rsa.conf              |   2 +-
 src/benchmark/benchmark-common.conf                |   4 +-
 src/benchmark/benchmark-cs.conf                    |   2 +-
 src/benchmark/benchmark-rsa.conf                   |   2 +-
 src/exchange/test_taler_exchange_httpd.conf        |   2 +-
 src/exchangedb/pg_do_purse_merge.c                 |   1 -
 src/testing/taler-unified-setup.sh                 |   6 +-
 .../test-taler-exchange-aggregator-postgres.conf   |   2 +-
 .../test-taler-exchange-wirewatch-postgres.conf    |   2 +-
 src/testing/test_bank_api_fakebank.conf            |   2 +-
 src/testing/test_bank_api_nexus.conf               |   2 +-
 src/testing/test_bank_api_twisted.c                |   4 +-
 src/testing/test_exchange_api.conf                 |   4 +-
 src/testing/test_exchange_api_age_restriction.conf |   4 +-
 .../test_exchange_api_keys_cherry_picking.conf     |   4 +-
 26 files changed, 432 insertions(+), 227 deletions(-)

diff --git a/src/auditor/batch.conf b/src/auditor/batch.conf
index bdbef4b1..cd8c64b8 100644
--- a/src/auditor/batch.conf
+++ b/src/auditor/batch.conf
@@ -121,7 +121,7 @@ PAYTO_URI = payto://x-taler-bank/localhost/42
 PASSWORD = x
 USERNAME = Exchange
 WIRE_GATEWAY_AUTH_METHOD = basic
-WIRE_GATEWAY_URL = http://localhost:8082/taler-wire-gateway/Exchange/
+WIRE_GATEWAY_URL = http://localhost:8082/accounts/Exchange/taler-wire-gateway/
 
 [exchange-account-1]
 enable_credit = yes
diff --git a/src/auditor/generate-auditor-basedb.conf 
b/src/auditor/generate-auditor-basedb.conf
index 72156a7c..f718886d 100644
--- a/src/auditor/generate-auditor-basedb.conf
+++ b/src/auditor/generate-auditor-basedb.conf
@@ -23,7 +23,7 @@ ENABLE_DEBIT = YES
 ENABLE_CREDIT = YES
 
 [exchange-accountcredentials-1]
-WIRE_GATEWAY_URL = 
http://localhost:8082/facades/test-facade/taler-wire-gateway/
+WIRE_GATEWAY_URL = http://localhost:8082/accounts/exchange/taler-wire-gateway/
 WIRE_GATEWAY_AUTH_METHOD = basic
 USERNAME = exchange
 PASSWORD = x
diff --git a/src/auditor/revoke-basedb.conf b/src/auditor/revoke-basedb.conf
index eaa8a472..706f9734 100644
--- a/src/auditor/revoke-basedb.conf
+++ b/src/auditor/revoke-basedb.conf
@@ -9,7 +9,7 @@ enable_debit = yes
 enable_credit = yes
 
 [exchange-accountcredentials-1]
-WIRE_GATEWAY_URL = 
"http://localhost:8082/facades/test-facade/taler-wire-gateway/";
+WIRE_GATEWAY_URL = 
"http://localhost:8082/accounts/exchange/taler-wire-gateway/";
 WIRE_GATEWAY_AUTH_METHOD = basic
 USERNAME = exchange
 PASSWORD = x
diff --git a/src/bank-lib/bank_api_admin.c b/src/bank-lib/bank_api_admin.c
index 47d8a5c6..f12ab6ee 100644
--- a/src/bank-lib/bank_api_admin.c
+++ b/src/bank-lib/bank_api_admin.c
@@ -1,6 +1,6 @@
 /*
   This file is part of TALER
-  Copyright (C) 2015--2020 Taler Systems SA
+  Copyright (C) 2015--2023 Taler Systems SA
 
   TALER is free software; you can redistribute it and/or modify it under the
   terms of the GNU General Public License as published by the Free Software
diff --git a/src/bank-lib/fakebank.c b/src/bank-lib/fakebank.c
index 84669557..12302be7 100644
--- a/src/bank-lib/fakebank.c
+++ b/src/bank-lib/fakebank.c
@@ -35,8 +35,6 @@
 #include "fakebank_bank.h"
 #include "fakebank_common_lp.h"
 #include "fakebank_tbi.h"
-#include "fakebank_tbr.h"
-#include "fakebank_twg.h"
 
 
 /**
@@ -96,16 +94,13 @@ handle_mhd_request (void *cls,
                     void **con_cls)
 {
   struct TALER_FAKEBANK_Handle *h = cls;
-  char *account = NULL;
-  char *end;
-  MHD_RESULT ret;
 
   (void) version;
   if (0 == strncmp (url,
-                    "/taler-bank-integration/",
-                    strlen ("/taler-bank-integration/")))
+                    "/taler-integration/",
+                    strlen ("/taler-integration/")))
   {
-    url += strlen ("/taler-bank-integration");
+    url += strlen ("/taler-integration");
     return TALER_FAKEBANK_tbi_main_ (h,
                                      connection,
                                      url,
@@ -114,79 +109,13 @@ handle_mhd_request (void *cls,
                                      upload_data_size,
                                      con_cls);
   }
-  if (0 == strncmp (url,
-                    "/taler-bank-access/",
-                    strlen ("/taler-bank-access/")))
-  {
-    url += strlen ("/taler-bank-access");
-    return TALER_FAKEBANK_bank_main_ (h,
-                                      connection,
-                                      url,
-                                      method,
-                                      upload_data,
-                                      upload_data_size,
-                                      con_cls);
-  }
-  /* Next is duplication to be more libeufin-like: */
-  if (0 == strncmp (url,
-                    "/access-api/",
-                    strlen ("/access-api/")))
-  {
-    url += strlen ("/access-api");
-    return TALER_FAKEBANK_bank_main_ (h,
-                                      connection,
-                                      url,
-                                      method,
-                                      upload_data,
-                                      upload_data_size,
-                                      con_cls);
-  }
-  if (0 == strncmp (url,
-                    "/anastasis-api/",
-                    strlen ("/anastasis-api/")))
-  {
-    url += strlen ("/anastasis-api");
-    if ( (strlen (url) > 1) &&
-         (NULL != (end = strchr (url + 1, '/'))) )
-    {
-      account = GNUNET_strndup (url + 1,
-                                end - url - 1);
-      url = end;
-    }
-    return TALER_FAKEBANK_tbr_main_ (h,
-                                     connection,
-                                     account,
-                                     url,
-                                     method,
-                                     upload_data,
-                                     upload_data_size,
-                                     con_cls);
-  }
-
-  if (0 == strncmp (url,
-                    "/taler-wire-gateway/",
-                    strlen ("/taler-wire-gateway/")))
-    url += strlen ("/taler-wire-gateway");
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-              "Handling request for `%s'\n",
-              url);
-  if ( (strlen (url) > 1) &&
-       (NULL != (end = strchr (url + 1, '/'))) )
-  {
-    account = GNUNET_strndup (url + 1,
-                              end - url - 1);
-    url = end;
-  }
-  ret = TALER_FAKEBANK_twg_main_ (h,
-                                  connection,
-                                  account,
-                                  url,
-                                  method,
-                                  upload_data,
-                                  upload_data_size,
-                                  con_cls);
-  GNUNET_free (account);
-  return ret;
+  return TALER_FAKEBANK_bank_main_ (h,
+                                    connection,
+                                    url,
+                                    method,
+                                    upload_data,
+                                    upload_data_size,
+                                    con_cls);
 }
 
 
diff --git a/src/bank-lib/fakebank_bank.c b/src/bank-lib/fakebank_bank.c
index ede148a4..c55e9efc 100644
--- a/src/bank-lib/fakebank_bank.c
+++ b/src/bank-lib/fakebank_bank.c
@@ -28,6 +28,8 @@
 #include <gnunet/gnunet_mhd_compat.h>
 #include "fakebank.h"
 #include "fakebank_bank.h"
+#include "fakebank_tbr.h"
+#include "fakebank_twg.h"
 #include "fakebank_bank_get_accounts.h"
 #include "fakebank_bank_get_accounts_withdrawals.h"
 #include "fakebank_bank_get_root.h"
@@ -50,11 +52,23 @@ TALER_FAKEBANK_bank_main_ (
   if (0 == strcasecmp (method,
                        MHD_HTTP_METHOD_HEAD))
     method = MHD_HTTP_METHOD_GET;
+
+  if ( (0 == strcmp (url,
+                     "/")) &&
+       (0 == strcasecmp (method,
+                         MHD_HTTP_METHOD_GET)) )
+  {
+    /* GET / */
+    return TALER_FAKEBANK_bank_get_root_ (h,
+                                          connection);
+  }
+
   if ( (0 == strcmp (url,
                      "/config")) &&
        (0 == strcasecmp (method,
                          MHD_HTTP_METHOD_GET)) )
   {
+    /* GET /config */
     return TALER_MHD_REPLY_JSON_PACK (
       connection,
       MHD_HTTP_OK,
@@ -63,162 +77,423 @@ TALER_FAKEBANK_bank_main_ (
       GNUNET_JSON_pack_string ("currency",
                                h->currency),
       GNUNET_JSON_pack_string ("name",
-                               "taler-bank-access"));
+                               "libeufin-bank" /* FIXME: spec!? */));
   }
+
   if ( (0 == strcmp (url,
                      "/public-accounts")) &&
        (0 == strcasecmp (method,
                          MHD_HTTP_METHOD_GET)) )
   {
+    /* GET /public-accounts */
     return TALER_MHD_REPLY_JSON_PACK (
       connection,
       MHD_HTTP_OK,
       GNUNET_JSON_pack_array_steal ("public_accounts",
                                     json_array ()));
   }
-  if ( (0 == strncmp (url,
-                      "/accounts/",
-                      strlen ("/accounts/"))) &&
+
+  /* account registration API */
+  if ( (0 == strcmp (url,
+                     "/accounts")) &&
        (0 == strcasecmp (method,
                          MHD_HTTP_METHOD_POST)) )
+  {
+    /* POST /accounts */
+    return TALER_FAKEBANK_bank_testing_register_ (h,
+                                                  connection,
+                                                  upload_data,
+                                                  upload_data_size,
+                                                  con_cls);
+  }
+
+  if ( (0 == strcmp (url,
+                     "/accounts")) &&
+       (0 == strcasecmp (method,
+                         MHD_HTTP_METHOD_GET)) )
+  {
+    /* GET /accounts */
+    GNUNET_break (0); /* not implemented */
+    return TALER_MHD_reply_with_error (
+      connection,
+      MHD_HTTP_NOT_IMPLEMENTED,
+      TALER_EC_GENERIC_CLIENT_INTERNAL_ERROR,
+      url);
+  }
+
+  if ( (0 == strcmp (url,
+                     "/cashout-rate")) &&
+       (0 == strcasecmp (method,
+                         MHD_HTTP_METHOD_GET)) )
+  {
+    /* GET /cashout-rate */
+    GNUNET_break (0); /* not implemented */
+    return TALER_MHD_reply_with_error (
+      connection,
+      MHD_HTTP_NOT_IMPLEMENTED,
+      TALER_EC_GENERIC_CLIENT_INTERNAL_ERROR,
+      url);
+  }
+
+  if ( (0 == strcmp (url,
+                     "/cashouts")) &&
+       (0 == strcasecmp (method,
+                         MHD_HTTP_METHOD_GET)) )
+  {
+    /* GET /cashouts */
+    GNUNET_break (0); /* not implemented */
+    return TALER_MHD_reply_with_error (
+      connection,
+      MHD_HTTP_NOT_IMPLEMENTED,
+      TALER_EC_GENERIC_CLIENT_INTERNAL_ERROR,
+      url);
+  }
+
+
+  if (0 == strncmp (url,
+                    "/accounts/",
+                    strlen ("/accounts/")))
   {
     const char *acc_name = &url[strlen ("/accounts/")];
     const char *end_acc = strchr (acc_name,
                                   '/');
-    char *acc;
-    MHD_RESULT ret;
 
-    if ( (NULL == end_acc) ||
-         (0 != strncmp (end_acc,
-                        "/withdrawals",
-                        strlen ("/withdrawals"))) )
+    if ( (NULL != end_acc) &&
+         (0 == strncmp (end_acc,
+                        "/taler-wire-gateway/",
+                        strlen ("/taler-wire-gateway/"))) )
+    {
+      /* $METHOD /accounts/$ACCOUNT/taler-wire-gateway/ */
+      char *acc;
+      MHD_RESULT ret;
+
+      acc = GNUNET_strndup (acc_name,
+                            end_acc - acc_name);
+      end_acc += strlen ("/taler-wire-gateway");
+      ret = TALER_FAKEBANK_twg_main_ (h,
+                                      connection,
+                                      acc,
+                                      end_acc,
+                                      method,
+                                      upload_data,
+                                      upload_data_size,
+                                      con_cls);
+      GNUNET_free (acc);
+      return ret;
+    }
+
+    if ( (NULL != end_acc) &&
+         (0 == strncmp (end_acc,
+                        "/taler-revenue/",
+                        strlen ("/taler-revenue/"))) )
+    {
+      /* $METHOD /accounts/$ACCOUNT/taler-revenue/ */
+      char *acc;
+      MHD_RESULT ret;
+
+      acc = GNUNET_strndup (acc_name,
+                            end_acc - acc_name);
+      end_acc += strlen ("/taler-revenue");
+      ret = TALER_FAKEBANK_tbr_main_ (h,
+                                      connection,
+                                      acc,
+                                      end_acc,
+                                      method,
+                                      upload_data,
+                                      upload_data_size,
+                                      con_cls);
+      GNUNET_free (acc);
+      return ret;
+    }
+
+    if ( (NULL == end_acc) &&
+         (0 == strcasecmp (method,
+                           MHD_HTTP_METHOD_GET)) )
     {
+      /* GET /accounts/$ACCOUNT */
+      return TALER_FAKEBANK_bank_get_accounts_ (h,
+                                                connection,
+                                                acc_name);
+    }
+
+    if ( (NULL == end_acc) &&
+         (0 == strcasecmp (method,
+                           MHD_HTTP_METHOD_PATCH)) )
+    {
+      /* PATCH /accounts/$USERNAME */
+      GNUNET_break (0); /* not implemented */
+      return TALER_MHD_reply_with_error (
+        connection,
+        MHD_HTTP_NOT_IMPLEMENTED,
+        TALER_EC_GENERIC_CLIENT_INTERNAL_ERROR,
+        url);
+    }
+
+    if ( (NULL == end_acc) &&
+         (0 == strcasecmp (method,
+                           MHD_HTTP_METHOD_DELETE)) )
+    {
+      /* DELETE /accounts/$USERNAME */
+      GNUNET_break (0); /* not implemented */
+      return TALER_MHD_reply_with_error (
+        connection,
+        MHD_HTTP_NOT_IMPLEMENTED,
+        TALER_EC_GENERIC_CLIENT_INTERNAL_ERROR,
+        url);
+    }
+
+    if ( (NULL == end_acc) &&
+         (0 == strcmp ("/auth",
+                       end_acc)) &&
+         (0 == strcasecmp (method,
+                           MHD_HTTP_METHOD_PATCH)) )
+    {
+      /* PATCH /accounts/$USERNAME/auth */
+      GNUNET_break (0); /* not implemented */
+      return TALER_MHD_reply_with_error (
+        connection,
+        MHD_HTTP_NOT_IMPLEMENTED,
+        TALER_EC_GENERIC_CLIENT_INTERNAL_ERROR,
+        url);
+    }
+
+    if ( (NULL != end_acc) &&
+         (0 == strcasecmp (method,
+                           MHD_HTTP_METHOD_GET)) )
+    {
+      /* GET /accounts/$ACCOUNT/+ */
+
+      if (0 == strcmp (end_acc,
+                       "/transactions"))
+      {
+        /* GET /accounts/$USERNAME/transactions */
+        GNUNET_break (0); /* not implemented */
+        return TALER_MHD_reply_with_error (
+          connection,
+          MHD_HTTP_NOT_IMPLEMENTED,
+          TALER_EC_GENERIC_CLIENT_INTERNAL_ERROR,
+          url);
+      }
+      if (0 == strncmp (end_acc,
+                        "/transactions/",
+                        strlen ("/transactions/")))
+      {
+        /* GET /accounts/$USERNAME/transactions/$TID */
+        GNUNET_break (0); /* not implemented */
+        return TALER_MHD_reply_with_error (
+          connection,
+          MHD_HTTP_NOT_IMPLEMENTED,
+          TALER_EC_GENERIC_CLIENT_INTERNAL_ERROR,
+          url);
+      }
+      if (0 == strcmp (end_acc,
+                       "/withdrawals"))
+      {
+        /* GET /accounts/$USERNAME/withdrawals */
+        GNUNET_break (0); /* not implemented */
+        return TALER_MHD_reply_with_error (
+          connection,
+          MHD_HTTP_NOT_IMPLEMENTED,
+          TALER_EC_GENERIC_CLIENT_INTERNAL_ERROR,
+          url);
+      }
+      if (0 == strncmp (end_acc,
+                        "/withdrawals/",
+                        strlen ("/withdrawals/")))
+      {
+        /* GET /accounts/$ACCOUNT/withdrawals/$WID */
+        const char *wid;
+        char *acc;
+        MHD_RESULT ret;
+
+        acc = GNUNET_strndup (acc_name,
+                              end_acc - acc_name);
+        wid = &end_acc[strlen ("/withdrawals/")];
+        ret = TALER_FAKEBANK_bank_get_accounts_withdrawals_ (h,
+                                                             connection,
+                                                             acc,
+                                                             wid);
+        GNUNET_free (acc);
+        return ret;
+      }
+      if (0 == strcmp (end_acc,
+                       "/cashouts"))
+      {
+        /* GET /accounts/$USERNAME/cashouts */
+        GNUNET_break (0); /* not implemented */
+        return TALER_MHD_reply_with_error (
+          connection,
+          MHD_HTTP_NOT_IMPLEMENTED,
+          TALER_EC_GENERIC_CLIENT_INTERNAL_ERROR,
+          url);
+      }
+      if (0 == strncmp (end_acc,
+                        "/cashouts/",
+                        strlen ("/cashouts/")))
+      {
+        /* GET /accounts/$USERNAME/cashouts/$CID */
+        GNUNET_break (0); /* not implemented */
+        return TALER_MHD_reply_with_error (
+          connection,
+          MHD_HTTP_NOT_IMPLEMENTED,
+          TALER_EC_GENERIC_CLIENT_INTERNAL_ERROR,
+          url);
+      }
+
+
       GNUNET_break_op (0);
       return TALER_MHD_reply_with_error (connection,
                                          MHD_HTTP_NOT_FOUND,
                                          TALER_EC_GENERIC_ENDPOINT_UNKNOWN,
                                          acc_name);
     }
-    acc = GNUNET_strndup (acc_name,
-                          end_acc - acc_name);
-    end_acc += strlen ("/withdrawals");
-    if ('/' == *end_acc)
+
+    if ( (NULL != end_acc) &&
+         (0 == strcasecmp (method,
+                           MHD_HTTP_METHOD_POST)) )
     {
-      const char *wid = end_acc + 1;
-      const char *opid = strchr (wid,
-                                 '/');
-      char *wi;
-
-      if ( (NULL == opid) ||
-           ( (0 != strcmp (opid,
-                           "/abort")) &&
-             (0 != strcmp (opid,
-                           "/confirm")) ) )
+      /* POST /accounts/$ACCOUNT/+ */
+      char *acc;
+
+      acc = GNUNET_strndup (acc_name,
+                            end_acc - acc_name);
+      if (0 == strcmp (end_acc,
+                       "/cashouts"))
       {
-        GNUNET_break_op (0);
+        /* POST /accounts/$USERNAME/cashouts */
+        GNUNET_break (0); /* not implemented */
         GNUNET_free (acc);
-        return TALER_MHD_reply_with_error (connection,
-                                           MHD_HTTP_NOT_FOUND,
-                                           TALER_EC_GENERIC_ENDPOINT_UNKNOWN,
-                                           acc_name);
+        return TALER_MHD_reply_with_error (
+          connection,
+          MHD_HTTP_NOT_IMPLEMENTED,
+          TALER_EC_GENERIC_CLIENT_INTERNAL_ERROR,
+          url);
+      }
+      if (0 == strncmp (end_acc,
+                        "/cashouts/",
+                        strlen ("/cashouts/")))
+      {
+        /* POST /accounts/$USERNAME/cashouts/+ */
+        const char *cid = end_acc + strlen ("/cashouts/");
+        const char *opid = strchr (cid,
+                                   '/');
+        char *ci;
+
+        if (NULL == opid)
+        {
+          /* POST /accounts/$ACCOUNT/cashouts/$CID (not defined) */
+          GNUNET_break_op (0);
+          GNUNET_free (acc);
+          return TALER_MHD_reply_with_error (connection,
+                                             MHD_HTTP_NOT_FOUND,
+                                             TALER_EC_GENERIC_ENDPOINT_UNKNOWN,
+                                             acc_name);
+        }
+        ci = GNUNET_strndup (cid,
+                             opid - cid);
+        if (0 == strcmp (opid,
+                         "/abort"))
+        {
+          GNUNET_break (0); /* not implemented */
+          GNUNET_free (ci);
+          GNUNET_free (acc);
+          return TALER_MHD_reply_with_error (
+            connection,
+            MHD_HTTP_NOT_IMPLEMENTED,
+            TALER_EC_GENERIC_CLIENT_INTERNAL_ERROR,
+            url);
+        }
+        if (0 == strcmp (opid,
+                         "/confirm"))
+        {
+          GNUNET_break (0); /* not implemented */
+          GNUNET_free (ci);
+          GNUNET_free (acc);
+          return TALER_MHD_reply_with_error (
+            connection,
+            MHD_HTTP_NOT_IMPLEMENTED,
+            TALER_EC_GENERIC_CLIENT_INTERNAL_ERROR,
+            url);
+        }
       }
-      wi = GNUNET_strndup (wid,
-                           opid - wid);
-      if (0 == strcmp (opid,
-                       "/abort"))
+
+      if (0 == strcmp (end_acc,
+                       "/withdrawals"))
       {
-        ret = TALER_FAKEBANK_bank_withdrawals_abort_ (h,
-                                                      connection,
-                                                      acc,
-                                                      wi);
-        GNUNET_free (wi);
+        /* POST /accounts/$ACCOUNT/withdrawals */
+        MHD_RESULT ret;
+
+        ret = TALER_FAKEBANK_bank_post_account_withdrawals_ (
+          h,
+          connection,
+          acc,
+          upload_data,
+          upload_data_size,
+          con_cls);
         GNUNET_free (acc);
         return ret;
       }
-      if (0 == strcmp (opid,
-                       "/confirm"))
+
+      if (0 == strncmp (end_acc,
+                        "/withdrawals/",
+                        strlen ("/withdrawals/")))
       {
-        ret = TALER_FAKEBANK_bank_withdrawals_confirm_ (h,
+        /* POST /accounts/$ACCOUNT/withdrawals/$WID* */
+        const char *wid = end_acc + strlen ("/withdrawals/");
+        const char *opid = strchr (wid,
+                                   '/');
+        char *wi;
+
+        if (NULL == opid)
+        {
+          /* POST /accounts/$ACCOUNT/withdrawals/$WID (not defined) */
+          GNUNET_break_op (0);
+          GNUNET_free (acc);
+          return TALER_MHD_reply_with_error (connection,
+                                             MHD_HTTP_NOT_FOUND,
+                                             TALER_EC_GENERIC_ENDPOINT_UNKNOWN,
+                                             acc_name);
+        }
+        wi = GNUNET_strndup (wid,
+                             opid - wid);
+        if (0 == strcmp (opid,
+                         "/abort"))
+        {
+          /* POST /accounts/$ACCOUNT/withdrawals/$WID/abort */
+          MHD_RESULT ret;
+
+          ret = TALER_FAKEBANK_bank_withdrawals_abort_ (h,
                                                         connection,
                                                         acc,
                                                         wi);
-        GNUNET_free (wi);
-        GNUNET_free (acc);
-        return ret;
-      }
-      GNUNET_assert (0);
-    }
-    ret = TALER_FAKEBANK_bank_post_account_withdrawals_ (
-      h,
-      connection,
-      acc,
-      upload_data,
-      upload_data_size,
-      con_cls);
-    GNUNET_free (acc);
-    return ret;
-  }
-
-  if ( (0 == strncmp (url,
-                      "/accounts/",
-                      strlen ("/accounts/"))) &&
-       (0 == strcasecmp (method,
-                         MHD_HTTP_METHOD_GET)) )
-  {
-    const char *acc_name = &url[strlen ("/accounts/")];
-    const char *end_acc = strchr (acc_name,
-                                  '/');
-    const char *wid;
-    char *acc;
-    MHD_RESULT ret;
+          GNUNET_free (wi);
+          GNUNET_free (acc);
+          return ret;
+        }
+        if (0 == strcmp (opid,
+                         "/confirm"))
+        {
+          /* POST /accounts/$ACCOUNT/withdrawals/$WID/confirm */
+          MHD_RESULT ret;
 
-    if (NULL == end_acc)
-    {
-      return TALER_FAKEBANK_bank_get_accounts_ (h,
-                                                connection,
-                                                acc_name);
-    }
-    if (0 != strncmp (end_acc,
-                      "/withdrawals/",
-                      strlen ("/withdrawals/")))
-    {
-      GNUNET_break_op (0);
-      return TALER_MHD_reply_with_error (connection,
-                                         MHD_HTTP_NOT_FOUND,
-                                         TALER_EC_GENERIC_ENDPOINT_UNKNOWN,
-                                         acc_name);
+          ret = TALER_FAKEBANK_bank_withdrawals_confirm_ (h,
+                                                          connection,
+                                                          acc,
+                                                          wi);
+          GNUNET_free (wi);
+          GNUNET_free (acc);
+          return ret;
+        }
+      }
     }
-    acc = GNUNET_strndup (acc_name,
-                          end_acc - acc_name);
-    wid = &end_acc[strlen ("/withdrawals/")];
-    ret = TALER_FAKEBANK_bank_get_accounts_withdrawals_ (h,
-                                                         connection,
-                                                         acc,
-                                                         wid);
-    GNUNET_free (acc);
-    return ret;
   }
-  /* FIXME: implement transactions API: 1.12.2 */
 
-  /* registration API */
-  if ( (0 == strcmp (url,
-                     "/testing/register")) &&
-       (0 == strcasecmp (method,
-                         MHD_HTTP_METHOD_POST)) )
-  {
-    return TALER_FAKEBANK_bank_testing_register_ (h,
-                                                  connection,
-                                                  upload_data,
-                                                  upload_data_size,
-                                                  con_cls);
-  }
+  GNUNET_break_op (0);
   TALER_LOG_ERROR ("Breaking URL: %s %s\n",
                    method,
                    url);
-  GNUNET_break_op (0);
-  return TALER_MHD_reply_with_error (
-    connection,
-    MHD_HTTP_NOT_FOUND,
-    TALER_EC_GENERIC_ENDPOINT_UNKNOWN,
-    url);
+  return TALER_MHD_reply_with_error (connection,
+                                     MHD_HTTP_NOT_FOUND,
+                                     TALER_EC_GENERIC_ENDPOINT_UNKNOWN,
+                                     url);
 }
diff --git a/src/bank-lib/fakebank_bank_post_accounts_withdrawals.c 
b/src/bank-lib/fakebank_bank_post_accounts_withdrawals.c
index f05faf14..10a241fa 100644
--- a/src/bank-lib/fakebank_bank_post_accounts_withdrawals.c
+++ b/src/bank-lib/fakebank_bank_post_accounts_withdrawals.c
@@ -93,7 +93,7 @@ do_post_account_withdrawals (
     wopids = GNUNET_STRINGS_data_to_string_alloc (&wo->wopid,
                                                   sizeof (wo->wopid));
     GNUNET_asprintf (&uri,
-                     "taler+http://withdraw/%s:%u/taler-bank-integration/%s";,
+                     "taler+http://withdraw/%s:%u/taler-integration/%s";,
                      h->hostname,
                      (unsigned int) h->port,
                      wopids);
diff --git a/src/bank-lib/fakebank_tbr_get_history.c 
b/src/bank-lib/fakebank_tbr_get_history.c
index 3a7bfa45..59efd8ea 100644
--- a/src/bank-lib/fakebank_tbr_get_history.c
+++ b/src/bank-lib/fakebank_tbr_get_history.c
@@ -71,7 +71,7 @@ TALER_FAKEBANK_tbr_get_history_incoming (
     cc->ctx = hc;
 
     GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                "Handling /history/incoming connection %p\n",
+                "Handling /accounts/$USERNAME/taler-revenue/history/incoming 
request %p\n",
                 connection);
     if (GNUNET_OK !=
         (ret = TALER_FAKEBANK_common_parse_history_args (h,
diff --git a/src/bank-lib/taler-exchange-wire-gateway-client.c 
b/src/bank-lib/taler-exchange-wire-gateway-client.c
index 0d4bba00..b20a5fd3 100644
--- a/src/bank-lib/taler-exchange-wire-gateway-client.c
+++ b/src/bank-lib/taler-exchange-wire-gateway-client.c
@@ -1,6 +1,6 @@
 /*
   This file is part of TALER
-  Copyright (C) 2017-2021 Taler Systems SA
+  Copyright (C) 2017-2023 Taler Systems SA
 
   TALER is free software; you can redistribute it and/or modify it under the
   terms of the GNU General Public License as published by the Free Software
diff --git a/src/bank-lib/test_bank.sh b/src/bank-lib/test_bank.sh
index 686f78dd..5ee2bd83 100755
--- a/src/bank-lib/test_bank.sh
+++ b/src/bank-lib/test_bank.sh
@@ -57,7 +57,7 @@ echo "OK"
 echo -n "Making wire transfer to exchange ..."
 
 taler-exchange-wire-gateway-client \
-    -b http://localhost:8899/exchange/ \
+    -b http://localhost:8899/accounts/exchange/taler-wire-gateway/ \
     -S 0ZSX8SH0M30KHX8K3Y1DAMVGDQV82XEF9DG1HC4QMQ3QWYT4AF00 \
     -D payto://x-taler-bank/localhost:8899/user?receiver-name=user \
     -a TESTKUDOS:4 > /dev/null
@@ -66,7 +66,7 @@ echo " OK"
 echo -n "Requesting exchange incoming transaction list ..."
 
 ./taler-exchange-wire-gateway-client \
-    -b http://localhost:8899/exchange/ \
+    -b http://localhost:8899/accounts/exchange/taler-wire-gateway/ \
     -i \
     | grep TESTKUDOS:4 \
     > /dev/null
@@ -76,7 +76,7 @@ echo " OK"
 echo -n "Making wire transfer from exchange..."
 
 ./taler-exchange-wire-gateway-client \
-    -b http://localhost:8899/exchange/ \
+    -b http://localhost:8899/accounts/exchange/taler-wire-gateway/ \
     -S 0ZSX8SH0M30KHX8K3Y1DAMVGDQV82XEF9DG1HC4QMQ3QWYT4AF00 \
     -C payto://x-taler-bank/localhost:8899/merchant?receiver-name=merchant \
     -a TESTKUDOS:2 \
@@ -87,7 +87,7 @@ echo " OK"
 echo -n "Requesting exchange's outgoing transaction list..."
 
 ./taler-exchange-wire-gateway-client \
-    -b http://localhost:8899/exchange/ \
+    -b http://localhost:8899/accounts/exchange/taler-wire-gateway/ \
     -o \
     | grep TESTKUDOS:2 \
     > /dev/null
diff --git a/src/benchmark/bank-benchmark-cs.conf 
b/src/benchmark/bank-benchmark-cs.conf
index d1d75d74..06906c8f 100644
--- a/src/benchmark/bank-benchmark-cs.conf
+++ b/src/benchmark/bank-benchmark-cs.conf
@@ -10,7 +10,7 @@ ENABLE_CREDIT = YES
 
 [exchange-accountcredentials-2]
 # What is the bank account (with the "Taler Bank" demo system)? Must end with 
"/".
-WIRE_GATEWAY_URL = http://localhost:8082/Exchange/
+WIRE_GATEWAY_URL = http://localhost:8082/accounts/Exchange/taler-wire-gateway/
 # Authentication information for basic authentication
 WIRE_GATEWAY_AUTH_METHOD = "basic"
 USERNAME = Exchange
diff --git a/src/benchmark/bank-benchmark-rsa.conf 
b/src/benchmark/bank-benchmark-rsa.conf
index d1d75d74..06906c8f 100644
--- a/src/benchmark/bank-benchmark-rsa.conf
+++ b/src/benchmark/bank-benchmark-rsa.conf
@@ -10,7 +10,7 @@ ENABLE_CREDIT = YES
 
 [exchange-accountcredentials-2]
 # What is the bank account (with the "Taler Bank" demo system)? Must end with 
"/".
-WIRE_GATEWAY_URL = http://localhost:8082/Exchange/
+WIRE_GATEWAY_URL = http://localhost:8082/accounts/Exchange/taler-wire-gateway/
 # Authentication information for basic authentication
 WIRE_GATEWAY_AUTH_METHOD = "basic"
 USERNAME = Exchange
diff --git a/src/benchmark/benchmark-common.conf 
b/src/benchmark/benchmark-common.conf
index 3a11ea31..cf907509 100644
--- a/src/benchmark/benchmark-common.conf
+++ b/src/benchmark/benchmark-common.conf
@@ -42,7 +42,7 @@ ENABLE_CREDIT = YES
 
 [exchange-accountcredentials-1]
 WIRE_GATEWAY_AUTH_METHOD = none
-WIRE_GATEWAY_URL = "http://localhost:8082/42/";
+WIRE_GATEWAY_URL = "http://localhost:8082/accounts/42/taler-wire-gateway/";
 
 # account-2 is suitable for libeufin
 [exchange-account-2]
@@ -54,7 +54,7 @@ PAYTO_URI = 
payto://iban/SANDBOXX/DE033310?receiver-name=Exchange+Company
 WIRE_GATEWAY_AUTH_METHOD = basic
 USERNAME = exchange
 PASSWORD = x
-WIRE_GATEWAY_URL = 
"http://localhost:8082/facades/test-facade/taler-wire-gateway/";
+WIRE_GATEWAY_URL = 
"http://localhost:8082/accounts/exchange/taler-wire-gateway/";
 
 
 # Trust local exchange for "EUR" currency
diff --git a/src/benchmark/benchmark-cs.conf b/src/benchmark/benchmark-cs.conf
index db44e4d1..7f660ad3 100644
--- a/src/benchmark/benchmark-cs.conf
+++ b/src/benchmark/benchmark-cs.conf
@@ -10,7 +10,7 @@ ENABLE_DEBIT = YES
 ENABLE_CREDIT = YES
 
 [exchange-accountcredentials-test]
-WIRE_GATEWAY_URL = http://localhost:8082/Exchange/
+WIRE_GATEWAY_URL = http://localhost:8082/accounts/Exchange/taler-wire-gateway/
 WIRE_GATEWAY_AUTH_METHOD = "basic"
 USERNAME = Exchange
 PASSWORD = x
diff --git a/src/benchmark/benchmark-rsa.conf b/src/benchmark/benchmark-rsa.conf
index bd4a90cf..a6c1512e 100644
--- a/src/benchmark/benchmark-rsa.conf
+++ b/src/benchmark/benchmark-rsa.conf
@@ -10,7 +10,7 @@ ENABLE_DEBIT = YES
 ENABLE_CREDIT = YES
 
 [exchange-accountcredentials-test]
-WIRE_GATEWAY_URL = http://localhost:8082/Exchange/
+WIRE_GATEWAY_URL = http://localhost:8082/accounts/Exchange/taler-wire-gateway/
 WIRE_GATEWAY_AUTH_METHOD = "basic"
 USERNAME = Exchange
 PASSWORD = x
diff --git a/src/exchange/test_taler_exchange_httpd.conf 
b/src/exchange/test_taler_exchange_httpd.conf
index 80cf6230..7e7ff8b4 100644
--- a/src/exchange/test_taler_exchange_httpd.conf
+++ b/src/exchange/test_taler_exchange_httpd.conf
@@ -69,7 +69,7 @@ ENABLE_CREDIT = YES
 WIRE_GATEWAY_AUTH_METHOD = basic
 USERNAME = Exchange
 PASSWORD = x
-WIRE_GATEWAY_URL = "http://localhost:8082/3/";
+WIRE_GATEWAY_URL = "http://localhost:8082/accounts/3/taler-wire-gateway/";
 
 # Coins for the tests.
 [coin_eur_ct_1_rsa]
diff --git a/src/exchangedb/pg_do_purse_merge.c 
b/src/exchangedb/pg_do_purse_merge.c
index 5d11b056..5a174ed0 100644
--- a/src/exchangedb/pg_do_purse_merge.c
+++ b/src/exchangedb/pg_do_purse_merge.c
@@ -75,7 +75,6 @@ TEH_PG_do_purse_merge (
                       &h_payto);
     GNUNET_free (payto_uri);
   }
-  /* Used in #postgres_do_purse_merge() */
   PREPARE (pg,
            "call_purse_merge",
            "SELECT"
diff --git a/src/testing/taler-unified-setup.sh 
b/src/testing/taler-unified-setup.sh
index e57fbc30..eba90391 100755
--- a/src/testing/taler-unified-setup.sh
+++ b/src/testing/taler-unified-setup.sh
@@ -233,14 +233,16 @@ register_sandbox_account() {
 }
 
 register_fakebank_account() {
-    BODY='{"username":"'"$1"'","password":"'"$2"'"}'
+    # FIXME: may need to pass 'is_taler_exchange' here
+    # in the future to get exchange facade from libeufin!
+    BODY='{"username":"'"$1"'","password":"'"$2"'","name":"'"$1"'"}'
     wget \
         --post-data="$BODY" \
         --header='Content-type: application/json' \
         --tries=3 \
         --waitretry=1 \
         --timeout=30 \
-        "http://localhost:$BANK_PORT/taler-bank-access/testing/register"; \
+        "http://localhost:$BANK_PORT/accounts"; \
         -o /dev/null \
         -O /dev/null \
         >/dev/null
diff --git a/src/testing/test-taler-exchange-aggregator-postgres.conf 
b/src/testing/test-taler-exchange-aggregator-postgres.conf
index e9f7f487..c9dcbf43 100644
--- a/src/testing/test-taler-exchange-aggregator-postgres.conf
+++ b/src/testing/test-taler-exchange-aggregator-postgres.conf
@@ -44,7 +44,7 @@ ENABLE_DEBIT = YES
 ENABLE_CREDIT = YES
 
 [exchange-accountcredentials-1]
-WIRE_GATEWAY_URL = "http://localhost:8082/2/";
+WIRE_GATEWAY_URL = "http://localhost:8082/accounts/2/taler-wire-gateway/";
 WIRE_GATEWAY_AUTH_METHOD = basic
 USERNAME = Exchange
 PASSWORD = x
diff --git a/src/testing/test-taler-exchange-wirewatch-postgres.conf 
b/src/testing/test-taler-exchange-wirewatch-postgres.conf
index a00aa97f..79d0825f 100644
--- a/src/testing/test-taler-exchange-wirewatch-postgres.conf
+++ b/src/testing/test-taler-exchange-wirewatch-postgres.conf
@@ -43,7 +43,7 @@ ENABLE_DEBIT = YES
 ENABLE_CREDIT = YES
 
 [exchange-accountcredentials-1]
-WIRE_GATEWAY_URL = "http://localhost:8082/2/";
+WIRE_GATEWAY_URL = "http://localhost:8082/accounts/2/taler-wire-gateway/";
 WIRE_GATEWAY_AUTH_METHOD = basic
 USERNAME = Exchange
 PASSWORD = x
diff --git a/src/testing/test_bank_api_fakebank.conf 
b/src/testing/test_bank_api_fakebank.conf
index ad7671d1..cd056c66 100644
--- a/src/testing/test_bank_api_fakebank.conf
+++ b/src/testing/test_bank_api_fakebank.conf
@@ -8,7 +8,7 @@ PAYTO_URI = 
"payto://x-taler-bank/localhost:8082/1?receiver-name=1"
 PAYTO_URI = "payto://x-taler-bank/localhost:8082/2?receiver-name=2"
 
 [exchange-accountcredentials-2]
-WIRE_GATEWAY_URL = "http://localhost:8082/2/";
+WIRE_GATEWAY_URL = "http://localhost:8082/accounts/2/taler-wire-gateway/";
 WIRE_GATEWAY_AUTH_METHOD = basic
 USERNAME = Exchange
 PASSWORD = x
diff --git a/src/testing/test_bank_api_nexus.conf 
b/src/testing/test_bank_api_nexus.conf
index 5ca6808e..e20a33a9 100644
--- a/src/testing/test_bank_api_nexus.conf
+++ b/src/testing/test_bank_api_nexus.conf
@@ -5,7 +5,7 @@
 PAYTO_URI = payto://iban/BIC/ES9121000418450200051332?receiver-name=Exchange
 
 [exchange-accountcredentials-2]
-WIRE_GATEWAY_URL = 
http://localhost:8082/facades/test-facade/taler-wire-gateway/
+WIRE_GATEWAY_URL = http://localhost:8082/accounts/exchange/taler-wire-gateway/
 WIRE_GATEWAY_AUTH_METHOD = basic
 USERNAME = exchange
 PASSWORD = x
diff --git a/src/testing/test_bank_api_twisted.c 
b/src/testing/test_bank_api_twisted.c
index 3ac63a5f..21ae5642 100644
--- a/src/testing/test_bank_api_twisted.c
+++ b/src/testing/test_bank_api_twisted.c
@@ -94,12 +94,12 @@ run (void *cls,
   {
   case TALER_TESTING_BS_FAKEBANK:
     exchange_auth_twisted.wire_gateway_url
-      = "http://localhost:8888/2/";;
+      = "http://localhost:8888/accounts/2/taler-wire-gateway/";;
     systype = "-f";
     break;
   case TALER_TESTING_BS_IBAN:
     exchange_auth_twisted.wire_gateway_url
-      = "http://localhost:8888/taler-wire-gateway/Exchange/";;
+      = "http://localhost:8888/accounts/Exchange/taler-wire-gateway/";;
     systype = "-ns";
     break;
   }
diff --git a/src/testing/test_exchange_api.conf 
b/src/testing/test_exchange_api.conf
index f2447041..ebd3d67a 100644
--- a/src/testing/test_exchange_api.conf
+++ b/src/testing/test_exchange_api.conf
@@ -52,7 +52,7 @@ ENABLE_CREDIT = YES
 
 [exchange-accountcredentials-1]
 WIRE_GATEWAY_AUTH_METHOD = none
-WIRE_GATEWAY_URL = "http://localhost:8082/2/";
+WIRE_GATEWAY_URL = "http://localhost:8082/accounts/2/taler-wire-gateway/";
 
 [exchange-account-2]
 PAYTO_URI = "payto://x-taler-bank/localhost/2?receiver-name=2"
@@ -63,7 +63,7 @@ ENABLE_CREDIT = YES
 WIRE_GATEWAY_AUTH_METHOD = basic
 USERNAME = Exchange
 PASSWORD = x
-WIRE_GATEWAY_URL = "http://localhost:8082/2/";
+WIRE_GATEWAY_URL = "http://localhost:8082/accounts/2/taler-wire-gateway/";
 
 
 [kyc-provider-test-oauth2]
diff --git a/src/testing/test_exchange_api_age_restriction.conf 
b/src/testing/test_exchange_api_age_restriction.conf
index 12bf45c3..cd60781d 100644
--- a/src/testing/test_exchange_api_age_restriction.conf
+++ b/src/testing/test_exchange_api_age_restriction.conf
@@ -52,7 +52,7 @@ ENABLE_CREDIT = YES
 
 [exchange-accountcredentials-1]
 WIRE_GATEWAY_AUTH_METHOD = none
-WIRE_GATEWAY_URL = "http://localhost:8082/42/";
+WIRE_GATEWAY_URL = "http://localhost:8082/accounts/42/taler-wire-gateway/";
 
 [exchange-account-2]
 PAYTO_URI = "payto://x-taler-bank/localhost/2?receiver-name=2"
@@ -63,7 +63,7 @@ ENABLE_CREDIT = YES
 WIRE_GATEWAY_AUTH_METHOD = basic
 USERNAME = Exchange
 PASSWORD = x
-WIRE_GATEWAY_URL = "http://localhost:8082/2/";
+WIRE_GATEWAY_URL = "http://localhost:8082/accounts/2/taler-wire-gateway/";
 
 
 [kyc-provider-test-oauth2]
diff --git a/src/testing/test_exchange_api_keys_cherry_picking.conf 
b/src/testing/test_exchange_api_keys_cherry_picking.conf
index fafb747d..56951c16 100644
--- a/src/testing/test_exchange_api_keys_cherry_picking.conf
+++ b/src/testing/test_exchange_api_keys_cherry_picking.conf
@@ -32,7 +32,7 @@ ENABLE_DEBIT = YES
 ENABLE_CREDIT = YES
 
 [exchange-accountcredentials-1]
-WIRE_GATEWAY_URL = "http://localhost:9082/42/";
+WIRE_GATEWAY_URL = "http://localhost:9082/accounts/42/taler-wire-gateway/";
 
 [exchange-account-2]
 PAYTO_URI = "payto://x-taler-bank/localhost/2?receiver-name=2"
@@ -40,7 +40,7 @@ ENABLE_DEBIT = YES
 ENABLE_CREDIT = YES
 
 [exchange-accountcredentials-2]
-WIRE_GATEWAY_URL = "http://localhost:9082/2/";
+WIRE_GATEWAY_URL = "http://localhost:9082/accounts/2/taler-wire-gateway/";
 WIRE_GATEWAY_AUTH_METHOD = basic
 USERNAME = Exchange
 PASSWORD = x

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