gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [taler-exchange] 01/03: offering amount _objects_ as traits


From: gnunet
Subject: [GNUnet-SVN] [taler-exchange] 01/03: offering amount _objects_ as traits (a string version of it was already implemented). "Withdraw" command uses it.
Date: Fri, 16 Feb 2018 17:01:59 +0100

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

marcello pushed a commit to branch master
in repository exchange.

commit 513a22c34404d87c0fba1f6054ef049553e19d6e
Author: Marcello Stanisci <address@hidden>
AuthorDate: Fri Feb 16 10:57:23 2018 +0100

    offering amount _objects_ as traits (a string version of
    it was already implemented).  "Withdraw" command uses it.
---
 src/exchange-lib/Makefile.am                      |  3 +-
 src/exchange-lib/testing_api_cmd_withdraw.c       |  5 ++++
 src/exchange-lib/testing_api_trait_blinding_key.c | 30 +++++++++++--------
 src/exchange-lib/testing_api_trait_denom_sig.c    | 36 +++++++++++++----------
 src/include/taler_testing_lib.h                   | 23 +++++++++++++++
 5 files changed, 68 insertions(+), 29 deletions(-)

diff --git a/src/exchange-lib/Makefile.am b/src/exchange-lib/Makefile.am
index cf80a1d..dee17b2 100644
--- a/src/exchange-lib/Makefile.am
+++ b/src/exchange-lib/Makefile.am
@@ -67,7 +67,8 @@ libtalertesting_la_SOURCES = \
   testing_api_trait_fresh_coin.c \
   testing_api_trait_string.c \
   testing_api_trait_key_peer.c \
-  testing_api_trait_wtid.c
+  testing_api_trait_wtid.c \
+  testing_api_trait_amount.c
 
 libtalertesting_la_LIBADD = \
   $(top_builddir)/src/json/libtalerjson.la \
diff --git a/src/exchange-lib/testing_api_cmd_withdraw.c 
b/src/exchange-lib/testing_api_cmd_withdraw.c
index eb3bc8a..07dad69 100644
--- a/src/exchange-lib/testing_api_cmd_withdraw.c
+++ b/src/exchange-lib/testing_api_cmd_withdraw.c
@@ -286,6 +286,11 @@ withdraw_traits (void *cls,
                                         &ws->sig),
     TALER_TESTING_make_trait_reserve_priv (0,
                                            reserve_priv),
+    TALER_TESTING_make_trait_amount_obj (0,
+                                         &ws->amount),
+    TALER_TESTING_make_trait_url (
+      0, MAH_path_to_url (ws->exchange, "/")),
+
     TALER_TESTING_trait_end ()
   };
 
diff --git a/src/exchange-lib/testing_api_trait_blinding_key.c 
b/src/exchange-lib/testing_api_trait_blinding_key.c
index c9415ca..23eb7ac 100644
--- a/src/exchange-lib/testing_api_trait_blinding_key.c
+++ b/src/exchange-lib/testing_api_trait_blinding_key.c
@@ -2,16 +2,18 @@
   This file is part of TALER
   Copyright (C) 2018 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
-  Foundation; either version 3, or (at your option) any later version.
+  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 Foundation; either version 3, or (at your
+  option) any later version.
 
-  TALER is distributed in the hope that it will be useful, but WITHOUT ANY
-  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-  A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+  TALER is distributed in the hope that it will be useful, but
+  WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
 
-  You should have received a copy of the GNU General Public License along with
-  TALER; see the file COPYING.  If not, see
+  You should have received a copy of the GNU General Public
+  License along with TALER; see the file COPYING.  If not, see
   <http://www.gnu.org/licenses/>
 */
 /**
@@ -39,9 +41,10 @@
  * @return #GNUNET_OK on success
  */
 int
-TALER_TESTING_get_trait_blinding_key (const struct TALER_TESTING_Command *cmd,
-                                      unsigned int index,
-                                      struct TALER_DenominationBlindingKeyP 
**blinding_key)
+TALER_TESTING_get_trait_blinding_key (
+  const struct TALER_TESTING_Command *cmd,
+  unsigned int index,
+  struct TALER_DenominationBlindingKeyP **blinding_key)
 {
   return cmd->traits (cmd->cls,
                       (void **) blinding_key,
@@ -51,8 +54,9 @@ TALER_TESTING_get_trait_blinding_key (const struct 
TALER_TESTING_Command *cmd,
 
 
 struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_blinding_key (unsigned int index,
-                                       const struct 
TALER_DenominationBlindingKeyP *blinding_key)
+TALER_TESTING_make_trait_blinding_key (
+  unsigned int index,
+  const struct TALER_DenominationBlindingKeyP *blinding_key)
 {
   struct TALER_TESTING_Trait ret = {
     .index = index,
diff --git a/src/exchange-lib/testing_api_trait_denom_sig.c 
b/src/exchange-lib/testing_api_trait_denom_sig.c
index 9578277..e50a3ba 100644
--- a/src/exchange-lib/testing_api_trait_denom_sig.c
+++ b/src/exchange-lib/testing_api_trait_denom_sig.c
@@ -2,21 +2,24 @@
   This file is part of TALER
   Copyright (C) 2018 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
-  Foundation; either version 3, or (at your option) any later version.
+  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 Foundation; either version 3,
+  or (at your option) any later version.
 
-  TALER is distributed in the hope that it will be useful, but WITHOUT ANY
-  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-  A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+  TALER is distributed in the hope that it will be useful, but
+  WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
 
-  You should have received a copy of the GNU General Public License along with
-  TALER; see the file COPYING.  If not, see
+  You should have received a copy of the GNU General Public
+  License along with TALER; see the file COPYING.  If not, see
   <http://www.gnu.org/licenses/>
 */
+
 /**
  * @file exchange-lib/testing_api_trait_denom_sig.c
- * @brief main interpreter loop for testcases
+ * @brief offer denomination signatures as traits
  * @author Christian Grothoff
  * @author Marcello Stanisci
  */
@@ -34,14 +37,16 @@
  * Obtain a denomination signature from a @a cmd.
  *
  * @param cmd command to extract trait from
- * @param selector which signature to pick if @a cmd has multiple on offer
+ * @param selector which signature to pick if @a cmd has multiple
+ *        on offer
  * @param denom_sig[out] set to the signature
  * @return #GNUNET_OK on success
  */
 int
-TALER_TESTING_get_trait_denom_sig (const struct TALER_TESTING_Command *cmd,
-                                   unsigned int index,
-                                   struct TALER_DenominationSignature 
**denom_sig)
+TALER_TESTING_get_trait_denom_sig (
+  const struct TALER_TESTING_Command *cmd,
+  unsigned int index,
+  struct TALER_DenominationSignature **denom_sig)
 {
   return cmd->traits (cmd->cls,
                       (void **) denom_sig,
@@ -51,8 +56,9 @@ TALER_TESTING_get_trait_denom_sig (const struct 
TALER_TESTING_Command *cmd,
 
 
 struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_denom_sig (unsigned int index,
-                                    const struct TALER_DenominationSignature 
*denom_sig)
+TALER_TESTING_make_trait_denom_sig (
+  unsigned int index,
+  const struct TALER_DenominationSignature *denom_sig)
 {
   struct TALER_TESTING_Trait ret = {
     .index = index,
diff --git a/src/include/taler_testing_lib.h b/src/include/taler_testing_lib.h
index 8979033..f7af833 100644
--- a/src/include/taler_testing_lib.h
+++ b/src/include/taler_testing_lib.h
@@ -1309,4 +1309,27 @@ TALER_TESTING_make_trait_order_id
   (unsigned int index,
    const char *order_id);
 
+
+/**
+ * Obtain an amount from a @a cmd.
+ *
+ * @param cmd command to extract trait from
+ * @param selector which amount to pick if @a cmd has multiple
+ *        on offer
+ * @param amount[out] set to the amount
+ * @return #GNUNET_OK on success
+ */
+int
+TALER_TESTING_get_trait_amount_obj (
+  const struct TALER_TESTING_Command *cmd,
+  unsigned int index,
+  struct TALER_Amount **amount);
+
+
+struct TALER_TESTING_Trait
+TALER_TESTING_make_trait_amount_obj (
+  unsigned int index,
+  const struct TALER_Amount *amount);
+
+
 #endif

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



reply via email to

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