gnunet-svn
[Top][All Lists]
Advanced

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

[taler-anastasis] branch master updated: Adapted changes from sync


From: gnunet
Subject: [taler-anastasis] branch master updated: Adapted changes from sync
Date: Mon, 17 Feb 2020 15:06:51 +0100

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

dennis-neufeld pushed a commit to branch master
in repository anastasis.

The following commit(s) were added to refs/heads/master by this push:
     new bc1edda  Adapted changes from sync
bc1edda is described below

commit bc1eddafa5c8b8f6cab50001a8cfbdb62df33104
Author: Dennis Neufeld <address@hidden>
AuthorDate: Mon Feb 17 14:06:38 2020 +0000

    Adapted changes from sync
---
 src/lib/test_anastasis_api.c           | 167 ++++++++++-----------------------
 src/lib/test_anastasis_api.conf        |  78 ++-------------
 src/lib/testing_api_helpers.c          |   1 -
 src/stasis/plugin_anastasis_postgres.c |   1 +
 4 files changed, 60 insertions(+), 187 deletions(-)

diff --git a/src/lib/test_anastasis_api.c b/src/lib/test_anastasis_api.c
index c04ca38..64c7fe5 100644
--- a/src/lib/test_anastasis_api.c
+++ b/src/lib/test_anastasis_api.c
@@ -50,83 +50,79 @@
  */
 #define EXCHANGE_URL "http://localhost:8081/";
 
-/**
- * URL of the fakebank.
- */
-static char *fakebank_url;
 
 /**
- * Merchant base URL.
+ * Account number of the exchange at the bank.
  */
-static char *merchant_url;
+#define EXCHANGE_ACCOUNT_NAME "2"
 
 /**
- * Anastasis base URL.
+ * Account number of some user.
  */
-static char *anastasis_url;
+#define USER_ACCOUNT_NAME "62"
 
 /**
- * Exchange base URL.
+ * Account number used by the merchant
  */
-static char *exchange_url;
+#define MERCHANT_ACCOUNT_NAME "3"
 
 /**
- * Auditor base URL; only used to fix FTBFS.
+ * Configuration of the bank.
  */
-static char *auditor_url;
+static struct TALER_TESTING_BankConfiguration bc;
 
 /**
- * Merchant process.
+ * Configuration of the exchange.
  */
-static struct GNUNET_OS_Process *merchantd;
+static struct TALER_TESTING_ExchangeConfiguration ec;
 
 /**
- * Anastasis process.
+ * Payto URI of the customer (payer).
  */
-static struct GNUNET_OS_Process *anastasisd;
+static char *payer_payto;
 
 /**
- * Account number of the exchange at the bank.
+ * Payto URI of the exchange (escrow account).
  */
-#define EXCHANGE_ACCOUNT_NO 2
+static char *exchange_payto;
 
 /**
- * Account number of some user.
+ * Payto URI of the merchant (receiver).
  */
-#define USER_ACCOUNT_NO 62
+static char *merchant_payto;
 
 /**
- * Account number used by the merchant
+ * Merchant base URL.
  */
-#define MERCHANT_ACCOUNT_NO 3
+static char *merchant_url;
 
 /**
- * User name. Never checked by fakebank.
+ * Anastasis base URL.
  */
-#define USER_LOGIN_NAME "user42"
+static char *anastasis_url;
 
 /**
- * User password. Never checked by fakebank.
+ * Merchant process.
  */
-#define USER_LOGIN_PASS "pass42"
+static struct GNUNET_OS_Process *merchantd;
 
 /**
- * Execute the taler-exchange-wirewatch command with
- * our configuration file.
- *
- * @param label label to use for the command.
+ * Anastasis process.
  */
-#define CMD_EXEC_WIREWATCH(label) \
-  TALER_TESTING_cmd_exec_wirewatch (label, CONFIG_FILE)
+static struct GNUNET_OS_Process *anastasisd;
 
 /**
- * Execute the taler-exchange-aggregator command with
+ * Execute the taler-exchange-wirewatch command with
  * our configuration file.
  *
  * @param label label to use for the command.
  */
-#define CMD_EXEC_AGGREGATOR(label) \
-  TALER_TESTING_cmd_exec_aggregator (label, CONFIG_FILE)
+static struct TALER_TESTING_Command
+cmd_exec_wirewatch (char *label)
+{
+  return TALER_TESTING_cmd_exec_wirewatch (label,
+                                           CONFIG_FILE);
+}
 
 /**
  * Run wire transfer of funds from some user's account to the
@@ -136,80 +132,16 @@ static struct GNUNET_OS_Process *anastasisd;
  * @param amount amount to transfer, i.e. "EUR:1"
  * @param url exchange_url
  */
-#define CMD_TRANSFER_TO_EXCHANGE(label,amount) \
-  TALER_TESTING_cmd_fakebank_transfer (label, amount, \
-                                       fakebank_url, USER_ACCOUNT_NO, \
-                                       EXCHANGE_ACCOUNT_NO, \
-                                       USER_LOGIN_NAME, USER_LOGIN_PASS, \
-                                       EXCHANGE_URL)
-
-/**
- * Run wire transfer of funds from some user's account to the
- * exchange.
- *
- * @param label label to use for the command.
- * @param amount amount to transfer, i.e. "EUR:1"
- */
-#define CMD_TRANSFER_TO_EXCHANGE_SUBJECT(label,amount,subject) \
-  TALER_TESTING_cmd_fakebank_transfer_with_subject \
-    (label, amount, fakebank_url, USER_ACCOUNT_NO, \
-    EXCHANGE_ACCOUNT_NO, USER_LOGIN_NAME, USER_LOGIN_PASS, \
-    subject)
-
-
-static struct GNUNET_CONTAINER_MultiHashMap *interned_strings;
-
-static const char *
-intern (const char *str)
+static struct TALER_TESTING_Command
+cmd_transfer_to_exchange (const char *label,
+                          const char *amount)
 {
-  struct GNUNET_HashCode hash;
-  const char *hs;
-
-  if (NULL == interned_strings)
-    interned_strings = GNUNET_CONTAINER_multihashmap_create (32, GNUNET_NO);
-  GNUNET_assert (NULL != interned_strings);
-  GNUNET_CRYPTO_hash (str, strlen (str), &hash);
-  hs = GNUNET_CONTAINER_multihashmap_get (interned_strings, &hash);
-  if (NULL != hs)
-    return hs;
-  hs = GNUNET_strdup (str);
-  GNUNET_assert (GNUNET_OK == GNUNET_CONTAINER_multihashmap_put (
-                   interned_strings,
-                   &hash,
-                   (void *) hs,
-                   GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
-  return hs;
+  return TALER_TESTING_cmd_admin_add_incoming (label,
+                                               amount,
+                                               &bc.exchange_auth,
+                                               payer_payto);
 }
 
-
-#define BUF_SZ 512
-
-static const char *
-merchant_url_internal (const char *instance_id)
-{
-  char buf[BUF_SZ];
-  if (NULL == instance_id)
-    GNUNET_assert (0 < snprintf (buf, BUF_SZ, "%s", merchant_url));
-  else
-    GNUNET_assert (0 < snprintf (buf, BUF_SZ, "%sinstances/%s/", merchant_url,
-                                 instance_id));
-  return intern (buf);
-}
-
-
-static const char *
-merchant_url_external (const char *instance_id)
-{
-  char buf[BUF_SZ];
-  if (NULL == instance_id)
-    GNUNET_assert (0 < snprintf (buf, BUF_SZ, "%spublic/", merchant_url));
-  else
-    GNUNET_assert (0 < snprintf (buf, BUF_SZ, "%spublic/instances/%s/",
-                                 merchant_url, instance_id));
-  return intern (buf);
-}
-
-
 /**
  * Main function that will tell the interpreter what commands to
  * run.
@@ -224,13 +156,13 @@ run (void *cls,
     /**
      * Move money to the exchange's bank account.
      */
-    CMD_TRANSFER_TO_EXCHANGE ("create-reserve-1",
+    cmd_transfer_to_exchange ("create-reserve-1",
                               "EUR:10.02"),
     /**
      * Make a reserve exist, according to the previous
      * transfer.
      */
-    CMD_EXEC_WIREWATCH ("wirewatch-1"),
+    cmd_exec_wirewatch ("wirewatch-1"),
     TALER_TESTING_cmd_withdraw_amount
       ("withdraw-coin-1",
       "create-reserve-1",
@@ -253,8 +185,6 @@ run (void *cls,
     TALER_TESTING_cmd_end ()
   };
 
-
-
   struct TALER_TESTING_Command policy[] = {
 
     // FIXME: Code for policy handling
@@ -336,7 +266,7 @@ run (void *cls,
 
   TALER_TESTING_run_with_fakebank (is,
                                    commands,
-                                   fakebank_url);
+                                   bc.exchange_auth.wire_gateway_url);
 }
 
 
@@ -352,12 +282,14 @@ main (int argc,
   GNUNET_log_setup ("test-anastasis-api",
                     "DEBUG",
                     NULL);
-  if (NULL ==
-      (fakebank_url = TALER_TESTING_prepare_fakebank
-                        (CONFIG_FILE,
-                        "account-exchange")))
+  if (GNUNET_OK !=
+      TALER_TESTING_prepare_fakebank (CONFIG_FILE,
+                                      "exchange-account-exchange",
+                                      &bc))
     return 77;
-
+  payer_payto = ("payto://x-taler-bank/localhost/" USER_ACCOUNT_NAME);
+  exchange_payto = ("payto://x-taler-bank/localhost/" EXCHANGE_ACCOUNT_NAME);
+  merchant_payto = ("payto://x-taler-bank/localhost/" MERCHANT_ACCOUNT_NAME);
   if (NULL ==
       (merchant_url = TALER_TESTING_prepare_merchant (CONFIG_FILE)))
     return 77;
@@ -369,8 +301,7 @@ main (int argc,
   TALER_TESTING_cleanup_files (CONFIG_FILE);
 
   switch (TALER_TESTING_prepare_exchange (CONFIG_FILE,
-                                          &auditor_url,
-                                          &exchange_url))
+                                          &ec))
   {
   case GNUNET_SYSERR:
     GNUNET_break (0);
diff --git a/src/lib/test_anastasis_api.conf b/src/lib/test_anastasis_api.conf
index c0cf0be..4418c7d 100644
--- a/src/lib/test_anastasis_api.conf
+++ b/src/lib/test_anastasis_api.conf
@@ -16,13 +16,16 @@ TALER_CACHE_HOME = $TALER_HOME/.cache/taler/
 [taler]
 # What currency do we use?
 CURRENCY = EUR
+CURRENCY_ROUND_UNIT = EUR:0.01
+
+[bank]
+HTTP_PORT = 8082
 
 ##########################################
 # Configuration for Anastasis #
 ##########################################
 
 [anastasis]
-
 PORT = 8086
 
 DB = postgres
@@ -78,78 +81,22 @@ CONFIG = postgres:///talercheck
 KEYFILE = ${TALER_CONFIG_HOME}/merchant/default.priv
 NAME = Kudos Inc.
 
-[instance-tor]
-KEYFILE = ${TALER_CONFIG_HOME}/merchant/tor.priv
-NAME = The Tor Project
-
-
-[instance-tip]
-KEYFILE = ${TALER_CONFIG_HOME}/merchant/tip.priv
-TIP_EXCHANGE = http://localhost:8081/
-TIP_RESERVE_PRIV_FILENAME = ${TALER_CONFIG_HOME}/merchant/reserve/tip.priv
-NAME = Test Tipping Merchant
-
-
-[instance-dtip]
-KEYFILE = ${TALER_CONFIG_HOME}/merchant/dtip.priv
-TIP_EXCHANGE = http://localhost:8081/
-TIP_RESERVE_PRIV_FILENAME = ${TALER_CONFIG_HOME}/merchant/reserve/dtip.priv
-NAME = Test Tipping Merchant 2
-
-[instance-nulltip]
-KEYFILE = ${TALER_CONFIG_HOME}/merchant/nulltip.priv
-TIP_EXCHANGE = http://localhost:8081/
-# This key will NEVER be used to create a reserve, so
-# as to check tip authorization against a non-reserve
-# key.
-TIP_RESERVE_PRIV_FILENAME = ${TALER_CONFIG_HOME}/merchant/reserve/nulltip.priv
-NAME = Test Null-Tipping Merchant
-
 # Account of the MERCHANT
-[account-merchant]
+[merchant-account-merchant]
 # What is the merchant's bank account?
-URL = "payto://x-taler-bank/localhost:8082/3"
+PAYTO_URI = "payto://x-taler-bank/localhost:8082/3"
 
 # This is the *salted* response we give out for /contract requests.
 # File is generated on first use, no need for merchants to generate
 # the salt!
 WIRE_RESPONSE = ${TALER_CONFIG_HOME}/merchant/account-3.json
 
-# Which wire plugin should we used to access the account?
-# (use to validate payto://-URL and for back office)
-PLUGIN = taler_bank
-
-# Authentication information for basic authentication
-TALER_BANK_AUTH_METHOD = "basic"
-USERNAME = user
-PASSWORD = pass
-
 # Accept payments to this account in instance-default
 HONOR_default = YES
 
-# Accept payments to this account in instance-tor
-HONOR_tor = YES
-
-# Accept payments to this account in instance-tip
-HONOR_tip = YES
-
-# Accept payments to this account in instance-dtip
-HONOR_dtip = YES
-
-HONOR_nulltip = YES
-
 # Advertise in new contracts of instance-default
 ACTIVE_default = YES
 
-# Advertise in new contracts of instance-default
-ACTIVE_tor = YES
-
-# Advertise in new contracts of instance-default
-ACTIVE_tip = YES
-
-# Advertise in new contracts of instance-default
-ACTIVE_nulltip = YES
-
 # Sections starting with "exchange-" specify trusted exchanges
 # (by the merchant)
 [exchange-kudos]
@@ -220,21 +167,16 @@ CONFIG = "postgres:///talercheck"
 CONFIG = "postgres:///talercheck"
 
 # Account of the EXCHANGE
-[account-exchange]
+[exchange-account-exchange]
 # What is the exchange's bank account (with the "Taler Bank" demo system)?
-URL = "payto://x-taler-bank/localhost:8082/2"
+PAYTO_URI = "payto://x-taler-bank/localhost:8082/2"
 
 # This is the response we give out for the /wire request.  It provides
 # wallets with the bank information for transfers to the exchange.
 WIRE_RESPONSE = ${TALER_CONFIG_HOME}/exchange/account-2.json
 
-# Which wire plugin should we used to access the account?
-PLUGIN = taler_bank
-
-# Authentication information for basic authentication
-TALER_BANK_AUTH_METHOD = "basic"
-USERNAME = user
-PASSWORD = pass
+WIRE_GATEWAY_URL = "http://localhost:8082/2/";
+WIRE_GATEWAY_AUTH_METHOD = NONE
 
 ENABLE_DEBIT = YES
 ENABLE_CREDIT = YES
diff --git a/src/lib/testing_api_helpers.c b/src/lib/testing_api_helpers.c
index 973aac3..89f435e 100644
--- a/src/lib/testing_api_helpers.c
+++ b/src/lib/testing_api_helpers.c
@@ -62,7 +62,6 @@ TALER_TESTING_run_anastasis (const char *config_filename,
 
   GNUNET_asprintf (&wget_cmd,
                    "wget -q -t 1 -T 1"
-                   " --header='Authorization: ApiKey sandbox'"
                    " %s"
                    " -o /dev/null -O /dev/null",
                    anastasis_url);
diff --git a/src/stasis/plugin_anastasis_postgres.c 
b/src/stasis/plugin_anastasis_postgres.c
index bc8228c..b2677a8 100644
--- a/src/stasis/plugin_anastasis_postgres.c
+++ b/src/stasis/plugin_anastasis_postgres.c
@@ -1511,6 +1511,7 @@ libanastasis_plugin_db_postgres_init (void *cls)
   pg->cfg = cfg;
   pg->conn = GNUNET_PQ_connect_with_cfg (cfg,
                                          "anastasisdb-postgres",
+                                         NULL,
                                          es,
                                          ps);
   if (NULL == pg->conn)

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

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