aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarcello Stanisci <stanisci.m@gmail.com>2018-02-16 10:57:23 +0100
committerMarcello Stanisci <stanisci.m@gmail.com>2018-02-16 10:57:23 +0100
commit513a22c34404d87c0fba1f6054ef049553e19d6e (patch)
treebaf95b8fd5bb054648877a7be3bde24feb24ad44 /src
parent63109b69105930654889f5a5641989b29c92f467 (diff)
offering amount _objects_ as traits (a string version of
it was already implemented). "Withdraw" command uses it.
Diffstat (limited to 'src')
-rw-r--r--src/exchange-lib/Makefile.am3
-rw-r--r--src/exchange-lib/testing_api_cmd_withdraw.c5
-rw-r--r--src/exchange-lib/testing_api_trait_blinding_key.c30
-rw-r--r--src/exchange-lib/testing_api_trait_denom_sig.c36
-rw-r--r--src/include/taler_testing_lib.h23
5 files changed, 68 insertions, 29 deletions
diff --git a/src/exchange-lib/Makefile.am b/src/exchange-lib/Makefile.am
index cf80a1d42..dee17b2e2 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 eb3bc8a6b..07dad69eb 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 c9415cae9..23eb7acc1 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 9578277ce..e50a3ba8a 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 897903303..f7af83311 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