offering amount _objects_ as traits (a string version of

it was already implemented).  "Withdraw" command uses it.
This commit is contained in:
Marcello Stanisci 2018-02-16 10:57:23 +01:00
parent 63109b6910
commit 513a22c344
No known key found for this signature in database
GPG Key ID: 8D526861953F4C0F
5 changed files with 68 additions and 29 deletions

View File

@ -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 \

View File

@ -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 ()
};

View File

@ -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,

View File

@ -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,

View File

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