gnunet-svn
[Top][All Lists]
Advanced

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

[taler-exchange] branch master updated: add subcommand to sign global fe


From: gnunet
Subject: [taler-exchange] branch master updated: add subcommand to sign global fees in tests
Date: Sat, 23 Apr 2022 20:02:35 +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 b7a4fd40 add subcommand to sign global fees in tests
b7a4fd40 is described below

commit b7a4fd401e0a90e309b1be66714b2a0c932f2813
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sat Apr 23 20:02:28 2022 +0200

    add subcommand to sign global fees in tests
---
 src/include/taler_testing_lib.h                    |  31 +++++-
 src/testing/Makefile.am                            |   3 +-
 src/testing/test_exchange_p2p.c                    |  12 ++-
 ... => testing_api_cmd_offline_sign_global_fees.c} | 110 ++++++++++++++++-----
 ....c => testing_api_cmd_offline_sign_wire_fees.c} |   2 +-
 5 files changed, 130 insertions(+), 28 deletions(-)

diff --git a/src/include/taler_testing_lib.h b/src/include/taler_testing_lib.h
index 3d7ba372..a1fa8c16 100644
--- a/src/include/taler_testing_lib.h
+++ b/src/include/taler_testing_lib.h
@@ -2245,7 +2245,7 @@ TALER_TESTING_cmd_exec_offline_sign_keys (const char 
*label,
 
 
 /**
- * Sign a wire fee.
+ * Sign a wire fee structure.
  *
  * @param label command label.
  * @param config_filename configuration filename.
@@ -2262,6 +2262,35 @@ TALER_TESTING_cmd_exec_offline_sign_fees (const char 
*label,
                                           const char *wad_fee);
 
 
+/**
+ * Sign global fee structure.
+ *
+ * @param label command label.
+ * @param config_filename configuration filename.
+ * @param history_fee the history fee to charge (for the current year)
+ * @param kyc_fee the KYC fee to charge (for the current year)
+ * @param account_fee the account fee to charge (for the current year)
+ * @param purse_fee the purse fee to charge (for the current year)
+ * @param purse_timeout when do purses time out
+ * @param kyc_timeout when does the KYC time out
+ * @param history_expiration when does an account history expire
+ * @param num_purses number of (free) active purses per account
+ * @return the command
+ */
+struct TALER_TESTING_Command
+TALER_TESTING_cmd_exec_offline_sign_global_fees (
+  const char *label,
+  const char *config_filename,
+  const char *history_fee,
+  const char *kyc_fee,
+  const char *account_fee,
+  const char *purse_fee,
+  struct GNUNET_TIME_Relative purse_timeout,
+  struct GNUNET_TIME_Relative kyc_timeout,
+  struct GNUNET_TIME_Relative history_expiration,
+  unsigned int num_purses);
+
+
 /**
  * Revoke an exchange denomination key.
  *
diff --git a/src/testing/Makefile.am b/src/testing/Makefile.am
index f15577be..b985dd28 100644
--- a/src/testing/Makefile.am
+++ b/src/testing/Makefile.am
@@ -68,7 +68,8 @@ libtalertesting_la_SOURCES = \
   testing_api_cmd_kyc_proof.c \
   testing_api_cmd_kyc_wallet_get.c \
   testing_api_cmd_oauth.c \
-  testing_api_cmd_offline_sign_fees.c \
+  testing_api_cmd_offline_sign_global_fees.c \
+  testing_api_cmd_offline_sign_wire_fees.c \
   testing_api_cmd_offline_sign_keys.c \
   testing_api_cmd_offline_sign_extensions.c \
   testing_api_cmd_purse_create_deposit.c \
diff --git a/src/testing/test_exchange_p2p.c b/src/testing/test_exchange_p2p.c
index 930ff2be..b16b2f0a 100644
--- a/src/testing/test_exchange_p2p.c
+++ b/src/testing/test_exchange_p2p.c
@@ -186,11 +186,21 @@ run (void *cls,
                                 false),
     TALER_TESTING_cmd_exec_offline_sign_keys ("offline-sign-future-keys",
                                               config_file),
-    TALER_TESTING_cmd_exec_offline_sign_fees ("offline-sign-fees",
+    TALER_TESTING_cmd_exec_offline_sign_fees ("offline-sign-wire-fees",
                                               config_file,
                                               "EUR:0.01",
                                               "EUR:0.01",
                                               "EUR:0.01"),
+    TALER_TESTING_cmd_exec_offline_sign_global_fees 
("offline-sign-global-fees",
+                                                     config_file,
+                                                     "EUR:0.01",
+                                                     "EUR:0.01",
+                                                     "EUR:0.01",
+                                                     "EUR:0.01",
+                                                     GNUNET_TIME_UNIT_MINUTES,
+                                                     GNUNET_TIME_UNIT_MINUTES,
+                                                     GNUNET_TIME_UNIT_DAYS,
+                                                     1),
     TALER_TESTING_cmd_check_keys_pull_all_keys ("refetch /keys",
                                                 1),
     TALER_TESTING_cmd_batch ("withdraw",
diff --git a/src/testing/testing_api_cmd_offline_sign_fees.c 
b/src/testing/testing_api_cmd_offline_sign_global_fees.c
similarity index 60%
copy from src/testing/testing_api_cmd_offline_sign_fees.c
copy to src/testing/testing_api_cmd_offline_sign_global_fees.c
index 8cf9fffe..7c903225 100644
--- a/src/testing/testing_api_cmd_offline_sign_fees.c
+++ b/src/testing/testing_api_cmd_offline_sign_global_fees.c
@@ -1,6 +1,6 @@
 /*
   This file is part of TALER
-  Copyright (C) 2020 Taler Systems SA
+  Copyright (C) 2022 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
@@ -18,8 +18,8 @@
 */
 
 /**
- * @file testing/testing_api_cmd_offline_sign_fees.c
- * @brief run the taler-exchange-offline command to download, sign and upload 
wire fees
+ * @file testing/testing_api_cmd_offline_sign_global_fees.c
+ * @brief run the taler-exchange-offline command to download, sign and upload 
global fees
  * @author Marcello Stanisci
  * @author Christian Grothoff
  */
@@ -47,20 +47,44 @@ struct OfflineSignState
   const char *config_filename;
 
   /**
-   * The wire fee to sign.
+   * The history fee to sign.
    */
-  const char *wire_fee_s;
+  const char *history_fee_s;
 
   /**
-   * The wad fee to sign.
+   * The KYC fee to sign.
    */
-  const char *wad_fee_s;
+  const char *kyc_fee_s;
 
   /**
-   * The closing fee to sign.
+   * The account fee to sign.
    */
-  const char *closing_fee_s;
+  const char *account_fee_s;
 
+  /**
+   * The purse fee to sign.
+   */
+  const char *purse_fee_s;
+
+  /**
+   * When MUST purses time out?
+   */
+  struct GNUNET_TIME_Relative purse_timeout;
+
+  /**
+   * How long does a user have to complete the KYC?
+   */
+  struct GNUNET_TIME_Relative kyc_timeout;
+
+  /**
+   * How long do we keep the history?
+   */
+  struct GNUNET_TIME_Relative history_expiration;
+
+  /**
+   * Number of (free) purses per account.
+   */
+  unsigned int num_purses;
 };
 
 
@@ -77,7 +101,30 @@ offlinesign_run (void *cls,
                  struct TALER_TESTING_Interpreter *is)
 {
   struct OfflineSignState *ks = cls;
-
+  char num_purses[12];
+  char history_expiration[32];
+  char purse_timeout[32];
+  char kyc_timeout[32];
+
+  GNUNET_snprintf (num_purses,
+                   sizeof (num_purses),
+                   "%u",
+                   ks->num_purses);
+  GNUNET_snprintf (history_expiration,
+                   sizeof (history_expiration),
+                   "%s",
+                   GNUNET_TIME_relative2s (ks->history_expiration,
+                                           false));
+  GNUNET_snprintf (purse_timeout,
+                   sizeof (purse_timeout),
+                   "%s",
+                   GNUNET_TIME_relative2s (ks->purse_timeout,
+                                           false));
+  GNUNET_snprintf (kyc_timeout,
+                   sizeof (kyc_timeout),
+                   "%s",
+                   GNUNET_TIME_relative2s (ks->kyc_timeout,
+                                           false));
   ks->offlinesign_proc
     = GNUNET_OS_start_process (
         GNUNET_OS_INHERIT_STD_ALL,
@@ -86,12 +133,16 @@ offlinesign_run (void *cls,
         "taler-exchange-offline",
         "-c", ks->config_filename,
         "-L", "INFO",
-        "wire-fee",
+        "global-fee",
         "now",
-        "x-taler-bank",
-        ks->wire_fee_s,
-        ks->closing_fee_s,
-        ks->wad_fee_s,
+        ks->history_fee_s,
+        ks->kyc_fee_s,
+        ks->account_fee_s,
+        ks->purse_fee_s,
+        purse_timeout,
+        kyc_timeout,
+        history_expiration,
+        num_purses,
         "upload",
         NULL);
   if (NULL == ks->offlinesign_proc)
@@ -160,19 +211,30 @@ offlinesign_traits (void *cls,
 
 
 struct TALER_TESTING_Command
-TALER_TESTING_cmd_exec_offline_sign_fees (const char *label,
-                                          const char *config_filename,
-                                          const char *wire_fee,
-                                          const char *closing_fee,
-                                          const char *wad_fee)
+TALER_TESTING_cmd_exec_offline_sign_global_fees (
+  const char *label,
+  const char *config_filename,
+  const char *history_fee,
+  const char *kyc_fee,
+  const char *account_fee,
+  const char *purse_fee,
+  struct GNUNET_TIME_Relative purse_timeout,
+  struct GNUNET_TIME_Relative kyc_timeout,
+  struct GNUNET_TIME_Relative history_expiration,
+  unsigned int num_purses)
 {
   struct OfflineSignState *ks;
 
   ks = GNUNET_new (struct OfflineSignState);
   ks->config_filename = config_filename;
-  ks->wire_fee_s = wire_fee;
-  ks->wad_fee_s = wad_fee;
-  ks->closing_fee_s = closing_fee;
+  ks->history_fee_s = history_fee;
+  ks->kyc_fee_s = kyc_fee;
+  ks->account_fee_s = account_fee;
+  ks->purse_fee_s = purse_fee;
+  ks->purse_timeout = purse_timeout;
+  ks->kyc_timeout = kyc_timeout;
+  ks->history_expiration = history_expiration;
+  ks->num_purses = num_purses;
   {
     struct TALER_TESTING_Command cmd = {
       .cls = ks,
@@ -187,4 +249,4 @@ TALER_TESTING_cmd_exec_offline_sign_fees (const char *label,
 }
 
 
-/* end of testing_api_cmd_exec_offline_sign_fees.c */
+/* end of testing_api_cmd_exec_offline_sign_global_fees.c */
diff --git a/src/testing/testing_api_cmd_offline_sign_fees.c 
b/src/testing/testing_api_cmd_offline_sign_wire_fees.c
similarity index 98%
rename from src/testing/testing_api_cmd_offline_sign_fees.c
rename to src/testing/testing_api_cmd_offline_sign_wire_fees.c
index 8cf9fffe..55746ebc 100644
--- a/src/testing/testing_api_cmd_offline_sign_fees.c
+++ b/src/testing/testing_api_cmd_offline_sign_wire_fees.c
@@ -18,7 +18,7 @@
 */
 
 /**
- * @file testing/testing_api_cmd_offline_sign_fees.c
+ * @file testing/testing_api_cmd_offline_sign_wire_fees.c
  * @brief run the taler-exchange-offline command to download, sign and upload 
wire fees
  * @author Marcello Stanisci
  * @author Christian Grothoff

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