clean up string traits"
This commit is contained in:
parent
27911aaa17
commit
6b0c121fc9
@ -2055,36 +2055,7 @@ TALER_TESTING_make_trait_wtid (unsigned int index,
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Offer amount in a trait.
|
* Offer HTTP url in a trait.
|
||||||
*
|
|
||||||
* @param index which amount is to be offered,
|
|
||||||
* in case multiple are offered.
|
|
||||||
* @param amount the amount to offer.
|
|
||||||
* @return the trait.
|
|
||||||
*/
|
|
||||||
struct TALER_TESTING_Trait
|
|
||||||
TALER_TESTING_make_trait_amount (unsigned int index,
|
|
||||||
const char *amount);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Obtain an amount from @a cmd.
|
|
||||||
*
|
|
||||||
* @param cmd command to extract the amount from.
|
|
||||||
* @param index which amount is to be picked, in case
|
|
||||||
* multiple are offered.
|
|
||||||
* @param amount[out] where to write the wire details.
|
|
||||||
*
|
|
||||||
* @return #GNUNET_OK on success.
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
TALER_TESTING_get_trait_amount (const struct TALER_TESTING_Command *cmd,
|
|
||||||
unsigned int index,
|
|
||||||
const char **amount);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Offer url in a trait.
|
|
||||||
*
|
*
|
||||||
* @param index which url is to be picked,
|
* @param index which url is to be picked,
|
||||||
* in case multiple are offered.
|
* in case multiple are offered.
|
||||||
@ -2097,7 +2068,7 @@ TALER_TESTING_make_trait_url (unsigned int index,
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Obtain a url from @a cmd.
|
* Obtain a HTTP url from @a cmd.
|
||||||
*
|
*
|
||||||
* @param cmd command to extract the url from.
|
* @param cmd command to extract the url from.
|
||||||
* @param index which url is to be picked, in case
|
* @param index which url is to be picked, in case
|
||||||
@ -2111,6 +2082,34 @@ TALER_TESTING_get_trait_url (const struct TALER_TESTING_Command *cmd,
|
|||||||
const char **url);
|
const char **url);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Offer PAYTO url in a trait.
|
||||||
|
*
|
||||||
|
* @param index which url is to be picked,
|
||||||
|
* in case multiple are offered.
|
||||||
|
* @param url the url to offer.
|
||||||
|
* @return the trait.
|
||||||
|
*/
|
||||||
|
struct TALER_TESTING_Trait
|
||||||
|
TALER_TESTING_make_trait_payto (unsigned int index,
|
||||||
|
const char *url);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Obtain a PAYTO url from @a cmd.
|
||||||
|
*
|
||||||
|
* @param cmd command to extract the url from.
|
||||||
|
* @param index which url is to be picked, in case
|
||||||
|
* multiple are offered.
|
||||||
|
* @param url[out] where to write the url.
|
||||||
|
* @return #GNUNET_OK on success.
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
TALER_TESTING_get_trait_payto (const struct TALER_TESTING_Command *cmd,
|
||||||
|
unsigned int index,
|
||||||
|
const char **url);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Obtain a order id from @a cmd.
|
* Obtain a order id from @a cmd.
|
||||||
*
|
*
|
||||||
@ -2169,37 +2168,6 @@ TALER_TESTING_make_trait_amount_obj (unsigned int index,
|
|||||||
const struct TALER_Amount *amount);
|
const struct TALER_Amount *amount);
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Offer a "reject" CMD reference.
|
|
||||||
*
|
|
||||||
* @param index which reference is to be offered,
|
|
||||||
* in case multiple are offered.
|
|
||||||
* @param rejected_reference the reference to offer.
|
|
||||||
*
|
|
||||||
* @return the trait.
|
|
||||||
*/
|
|
||||||
struct TALER_TESTING_Trait
|
|
||||||
TALER_TESTING_make_trait_rejected (unsigned int index,
|
|
||||||
const char *rejected);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Obtain the reference to a "reject" CMD. Usually offered
|
|
||||||
* by _rejected_ bank transfers.
|
|
||||||
*
|
|
||||||
* @param cmd command to extract the reference from.
|
|
||||||
* @param index which reference is to be picked, in case
|
|
||||||
* multiple are offered.
|
|
||||||
* @param rejected_reference[out] where to write the reference.
|
|
||||||
*
|
|
||||||
* @return #GNUNET_OK on success.
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
TALER_TESTING_get_trait_rejected (const struct TALER_TESTING_Command *cmd,
|
|
||||||
unsigned int index,
|
|
||||||
const char **rejected_reference);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Offer a command in a trait.
|
* Offer a command in a trait.
|
||||||
*
|
*
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
This file is part of TALER
|
This file is part of TALER
|
||||||
Copyright (C) 2018 Taler Systems SA
|
Copyright (C) 2018-2020 Taler Systems SA
|
||||||
|
|
||||||
TALER is free software; you can redistribute it and/or modify it
|
TALER is free software; you can redistribute it and/or modify it
|
||||||
under the terms of the GNU General Public License as published by
|
under the terms of the GNU General Public License as published by
|
||||||
@ -16,13 +16,11 @@
|
|||||||
License along with TALER; see the file COPYING. If not, see
|
License along with TALER; see the file COPYING. If not, see
|
||||||
<http://www.gnu.org/licenses/>
|
<http://www.gnu.org/licenses/>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file exchange-lib/testing_api_cmd_deposit.c
|
* @file exchange-lib/testing_api_cmd_deposit.c
|
||||||
* @brief command for testing /deposit.
|
* @brief command for testing /deposit.
|
||||||
* @author Marcello Stanisci
|
* @author Marcello Stanisci
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
#include "taler_json_lib.h"
|
#include "taler_json_lib.h"
|
||||||
#include <gnunet/gnunet_curl_lib.h>
|
#include <gnunet/gnunet_curl_lib.h>
|
||||||
@ -41,7 +39,7 @@ struct DepositState
|
|||||||
/**
|
/**
|
||||||
* Amount to deposit.
|
* Amount to deposit.
|
||||||
*/
|
*/
|
||||||
const char *amount;
|
struct TALER_Amount amount;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reference to any command that is able to provide a coin.
|
* Reference to any command that is able to provide a coin.
|
||||||
@ -243,7 +241,6 @@ deposit_run (void *cls,
|
|||||||
{
|
{
|
||||||
struct DepositState *ds = cls;
|
struct DepositState *ds = cls;
|
||||||
const struct TALER_TESTING_Command *coin_cmd;
|
const struct TALER_TESTING_Command *coin_cmd;
|
||||||
struct TALER_TESTING_Command *this_cmd;
|
|
||||||
const struct TALER_CoinSpendPrivateKeyP *coin_priv;
|
const struct TALER_CoinSpendPrivateKeyP *coin_priv;
|
||||||
struct TALER_CoinSpendPublicKeyP coin_pub;
|
struct TALER_CoinSpendPublicKeyP coin_pub;
|
||||||
const struct TALER_EXCHANGE_DenomPublicKey *denom_pub;
|
const struct TALER_EXCHANGE_DenomPublicKey *denom_pub;
|
||||||
@ -253,11 +250,8 @@ deposit_run (void *cls,
|
|||||||
struct GNUNET_CRYPTO_EddsaPrivateKey *merchant_priv;
|
struct GNUNET_CRYPTO_EddsaPrivateKey *merchant_priv;
|
||||||
struct TALER_MerchantPublicKeyP merchant_pub;
|
struct TALER_MerchantPublicKeyP merchant_pub;
|
||||||
struct GNUNET_HashCode h_contract_terms;
|
struct GNUNET_HashCode h_contract_terms;
|
||||||
struct TALER_Amount amount;
|
|
||||||
|
|
||||||
ds->is = is;
|
ds->is = is;
|
||||||
this_cmd = &is->commands[is->ip];
|
|
||||||
|
|
||||||
GNUNET_assert (ds->coin_reference);
|
GNUNET_assert (ds->coin_reference);
|
||||||
coin_cmd = TALER_TESTING_interpreter_lookup_command
|
coin_cmd = TALER_TESTING_interpreter_lookup_command
|
||||||
(is,
|
(is,
|
||||||
@ -287,16 +281,6 @@ deposit_run (void *cls,
|
|||||||
== TALER_TESTING_get_trait_denom_sig (coin_cmd,
|
== TALER_TESTING_get_trait_denom_sig (coin_cmd,
|
||||||
ds->coin_index,
|
ds->coin_index,
|
||||||
&denom_pub_sig));
|
&denom_pub_sig));
|
||||||
if (GNUNET_OK !=
|
|
||||||
TALER_string_to_amount (ds->amount,
|
|
||||||
&amount))
|
|
||||||
{
|
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
|
|
||||||
"Failed to parse amount `%s' at '%u/%s'\n",
|
|
||||||
ds->amount, is->ip, this_cmd->label);
|
|
||||||
TALER_TESTING_interpreter_fail (is);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
GNUNET_assert (GNUNET_OK ==
|
GNUNET_assert (GNUNET_OK ==
|
||||||
TALER_JSON_hash (ds->contract_terms,
|
TALER_JSON_hash (ds->contract_terms,
|
||||||
@ -345,9 +329,10 @@ deposit_run (void *cls,
|
|||||||
dr.timestamp = GNUNET_TIME_absolute_hton (ds->timestamp);
|
dr.timestamp = GNUNET_TIME_absolute_hton (ds->timestamp);
|
||||||
dr.refund_deadline = GNUNET_TIME_absolute_hton
|
dr.refund_deadline = GNUNET_TIME_absolute_hton
|
||||||
(ds->refund_deadline);
|
(ds->refund_deadline);
|
||||||
TALER_amount_hton (&dr.amount_with_fee, &amount);
|
TALER_amount_hton (&dr.amount_with_fee,
|
||||||
TALER_amount_hton
|
&ds->amount);
|
||||||
(&dr.deposit_fee, &denom_pub->fee_deposit);
|
TALER_amount_hton (&dr.deposit_fee,
|
||||||
|
&denom_pub->fee_deposit);
|
||||||
dr.merchant = merchant_pub;
|
dr.merchant = merchant_pub;
|
||||||
dr.coin_pub = coin_pub;
|
dr.coin_pub = coin_pub;
|
||||||
GNUNET_assert (GNUNET_OK == GNUNET_CRYPTO_eddsa_sign
|
GNUNET_assert (GNUNET_OK == GNUNET_CRYPTO_eddsa_sign
|
||||||
@ -355,9 +340,8 @@ deposit_run (void *cls,
|
|||||||
&dr.purpose,
|
&dr.purpose,
|
||||||
&coin_sig.eddsa_signature));
|
&coin_sig.eddsa_signature));
|
||||||
}
|
}
|
||||||
ds->dh = TALER_EXCHANGE_deposit
|
ds->dh = TALER_EXCHANGE_deposit (is->exchange,
|
||||||
(is->exchange,
|
&ds->amount,
|
||||||
&amount,
|
|
||||||
wire_deadline,
|
wire_deadline,
|
||||||
ds->wire_details,
|
ds->wire_details,
|
||||||
&h_contract_terms,
|
&h_contract_terms,
|
||||||
@ -472,8 +456,8 @@ deposit_traits (void *cls,
|
|||||||
ds->contract_terms),
|
ds->contract_terms),
|
||||||
TALER_TESTING_make_trait_peer_key (0,
|
TALER_TESTING_make_trait_peer_key (0,
|
||||||
&ds->merchant_priv.eddsa_priv),
|
&ds->merchant_priv.eddsa_priv),
|
||||||
TALER_TESTING_make_trait_amount (0,
|
TALER_TESTING_make_trait_amount_obj (0,
|
||||||
ds->amount),
|
&ds->amount),
|
||||||
TALER_TESTING_trait_end ()
|
TALER_TESTING_trait_end ()
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -551,9 +535,11 @@ TALER_TESTING_cmd_deposit
|
|||||||
"refund_deadline",
|
"refund_deadline",
|
||||||
GNUNET_JSON_from_time_abs (ds->refund_deadline));
|
GNUNET_JSON_from_time_abs (ds->refund_deadline));
|
||||||
}
|
}
|
||||||
ds->amount = amount;
|
GNUNET_assert (GNUNET_OK ==
|
||||||
|
TALER_string_to_amount (amount,
|
||||||
|
&ds->amount));
|
||||||
ds->expected_response_code = expected_response_code;
|
ds->expected_response_code = expected_response_code;
|
||||||
|
{
|
||||||
struct TALER_TESTING_Command cmd = {
|
struct TALER_TESTING_Command cmd = {
|
||||||
.cls = ds,
|
.cls = ds,
|
||||||
.label = label,
|
.label = label,
|
||||||
@ -563,6 +549,7 @@ TALER_TESTING_cmd_deposit
|
|||||||
};
|
};
|
||||||
|
|
||||||
return cmd;
|
return cmd;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -624,8 +624,7 @@ track_transfer_cb
|
|||||||
if (NULL != tts->total_amount_reference)
|
if (NULL != tts->total_amount_reference)
|
||||||
{
|
{
|
||||||
const struct TALER_TESTING_Command *total_amount_cmd;
|
const struct TALER_TESTING_Command *total_amount_cmd;
|
||||||
const char *total_amount_from_reference_str;
|
const struct TALER_Amount *total_amount_from_reference;
|
||||||
struct TALER_Amount total_amount_from_reference;
|
|
||||||
|
|
||||||
if (NULL == (total_amount_cmd
|
if (NULL == (total_amount_cmd
|
||||||
= TALER_TESTING_interpreter_lookup_command
|
= TALER_TESTING_interpreter_lookup_command
|
||||||
@ -636,20 +635,18 @@ track_transfer_cb
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GNUNET_OK != TALER_TESTING_get_trait_amount
|
if (GNUNET_OK !=
|
||||||
(total_amount_cmd, 0, &total_amount_from_reference_str))
|
TALER_TESTING_get_trait_amount_obj (total_amount_cmd,
|
||||||
|
0,
|
||||||
|
&total_amount_from_reference))
|
||||||
{
|
{
|
||||||
GNUNET_break (0);
|
GNUNET_break (0);
|
||||||
TALER_TESTING_interpreter_fail (is);
|
TALER_TESTING_interpreter_fail (is);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GNUNET_assert (GNUNET_OK == TALER_string_to_amount
|
|
||||||
(total_amount_from_reference_str,
|
|
||||||
&total_amount_from_reference));
|
|
||||||
|
|
||||||
if (0 != TALER_amount_cmp (total_amount,
|
if (0 != TALER_amount_cmp (total_amount,
|
||||||
&total_amount_from_reference))
|
total_amount_from_reference))
|
||||||
{
|
{
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
|
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
|
||||||
"Amount missmath to command %s\n",
|
"Amount missmath to command %s\n",
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
License along with TALER; see the file COPYING. If not, see
|
License along with TALER; see the file COPYING. If not, see
|
||||||
<http://www.gnu.org/licenses/>
|
<http://www.gnu.org/licenses/>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file exchange-lib/testing_api_trait_amount.c
|
* @file exchange-lib/testing_api_trait_amount.c
|
||||||
* @brief offer amounts as traits.
|
* @brief offer amounts as traits.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
This file is part of TALER
|
This file is part of TALER
|
||||||
Copyright (C) 2018 Taler Systems SA
|
Copyright (C) 2018-2020 Taler Systems SA
|
||||||
|
|
||||||
TALER is free software; you can redistribute it and/or modify it
|
TALER is free software; you can redistribute it and/or modify it
|
||||||
under the terms of the GNU General Public License as published
|
under the terms of the GNU General Public License as published
|
||||||
@ -16,11 +16,11 @@
|
|||||||
License along with TALER; see the file COPYING. If not, see
|
License along with TALER; see the file COPYING. If not, see
|
||||||
<http://www.gnu.org/licenses/>
|
<http://www.gnu.org/licenses/>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file exchange-lib/testing_api_trait_string.c
|
* @file lib/testing_api_trait_string.c
|
||||||
* @brief offers strings traits.
|
* @brief offers strings traits.
|
||||||
* @author Marcello Stanisci
|
* @author Marcello Stanisci
|
||||||
|
* @author Christian Grothoff
|
||||||
*/
|
*/
|
||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
#include "taler_json_lib.h"
|
#include "taler_json_lib.h"
|
||||||
@ -29,12 +29,31 @@
|
|||||||
#include "taler_signatures.h"
|
#include "taler_signatures.h"
|
||||||
#include "taler_testing_lib.h"
|
#include "taler_testing_lib.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* FIXME: use json-t instead?
|
||||||
|
*/
|
||||||
#define TALER_TESTING_TRAIT_CONTRACT_TERMS "contract-terms"
|
#define TALER_TESTING_TRAIT_CONTRACT_TERMS "contract-terms"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Some string. Avoid, use something more precise!
|
||||||
|
*/
|
||||||
#define TALER_TESTING_TRAIT_STRING "string"
|
#define TALER_TESTING_TRAIT_STRING "string"
|
||||||
#define TALER_TESTING_TRAIT_AMOUNT "amount"
|
|
||||||
|
/**
|
||||||
|
* An HTTP-URL.
|
||||||
|
*/
|
||||||
#define TALER_TESTING_TRAIT_URL "url"
|
#define TALER_TESTING_TRAIT_URL "url"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A PAYTO-URL.
|
||||||
|
*/
|
||||||
|
#define TALER_TESTING_TRAIT_PAYTO "payto"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* String identifying an order.
|
||||||
|
*/
|
||||||
#define TALER_TESTING_TRAIT_ORDER_ID "order-id"
|
#define TALER_TESTING_TRAIT_ORDER_ID "order-id"
|
||||||
#define TALER_TESTING_TRAIT_REJECTED "rejected"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Obtain contract terms from @a cmd.
|
* Obtain contract terms from @a cmd.
|
||||||
@ -125,53 +144,7 @@ TALER_TESTING_make_trait_string
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Obtain an amount from @a cmd.
|
* Obtain a HTTP url from @a cmd.
|
||||||
*
|
|
||||||
* @param cmd command to extract the amount from.
|
|
||||||
* @param index which amount is to be picked, in case
|
|
||||||
* multiple are offered.
|
|
||||||
* @param amount[out] where to write the wire details.
|
|
||||||
*
|
|
||||||
* @return #GNUNET_OK on success.
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
TALER_TESTING_get_trait_amount
|
|
||||||
(const struct TALER_TESTING_Command *cmd,
|
|
||||||
unsigned int index,
|
|
||||||
const char **amount)
|
|
||||||
{
|
|
||||||
return cmd->traits (cmd->cls,
|
|
||||||
(const void **) amount,
|
|
||||||
TALER_TESTING_TRAIT_AMOUNT,
|
|
||||||
index);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Offer amount in a trait.
|
|
||||||
*
|
|
||||||
* @param index which amount is to be offered,
|
|
||||||
* in case multiple are offered.
|
|
||||||
* @param amount the amount to offer.
|
|
||||||
*
|
|
||||||
* @return the trait.
|
|
||||||
*/
|
|
||||||
struct TALER_TESTING_Trait
|
|
||||||
TALER_TESTING_make_trait_amount
|
|
||||||
(unsigned int index,
|
|
||||||
const char *amount)
|
|
||||||
{
|
|
||||||
struct TALER_TESTING_Trait ret = {
|
|
||||||
.index = index,
|
|
||||||
.trait_name = TALER_TESTING_TRAIT_AMOUNT,
|
|
||||||
.ptr = (const void *) amount
|
|
||||||
};
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Obtain a url from @a cmd.
|
|
||||||
*
|
*
|
||||||
* @param cmd command to extract the url from.
|
* @param cmd command to extract the url from.
|
||||||
* @param index which url is to be picked, in case
|
* @param index which url is to be picked, in case
|
||||||
@ -194,7 +167,7 @@ TALER_TESTING_get_trait_url
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Offer url in a trait.
|
* Offer HTTP url in a trait.
|
||||||
*
|
*
|
||||||
* @param index which url is to be picked,
|
* @param index which url is to be picked,
|
||||||
* in case multiple are offered.
|
* in case multiple are offered.
|
||||||
@ -212,6 +185,11 @@ TALER_TESTING_make_trait_url
|
|||||||
.trait_name = TALER_TESTING_TRAIT_URL,
|
.trait_name = TALER_TESTING_TRAIT_URL,
|
||||||
.ptr = (const void *) url
|
.ptr = (const void *) url
|
||||||
};
|
};
|
||||||
|
|
||||||
|
GNUNET_assert (0 != strncasecmp (url,
|
||||||
|
"payto://",
|
||||||
|
strlen ("payto://")));
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -263,48 +241,49 @@ TALER_TESTING_make_trait_order_id
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Obtain the reference to a "reject" CMD. Usually offered
|
* Obtain a PAYTO-url from @a cmd.
|
||||||
* by _rejected_ bank transfers.
|
|
||||||
*
|
*
|
||||||
* @param cmd command to extract the reference from.
|
* @param cmd command to extract the url from.
|
||||||
* @param index which reference is to be picked, in case
|
* @param index which url is to be picked, in case
|
||||||
* multiple are offered.
|
* multiple are offered.
|
||||||
* @param rejected_reference[out] where to write the reference.
|
* @param url[out] where to write the url.
|
||||||
*
|
|
||||||
* @return #GNUNET_OK on success.
|
* @return #GNUNET_OK on success.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
TALER_TESTING_get_trait_rejected
|
TALER_TESTING_get_trait_payto
|
||||||
(const struct TALER_TESTING_Command *cmd,
|
(const struct TALER_TESTING_Command *cmd,
|
||||||
unsigned int index,
|
unsigned int index,
|
||||||
const char **rejected_reference)
|
const char **url)
|
||||||
{
|
{
|
||||||
return cmd->traits (cmd->cls,
|
return cmd->traits (cmd->cls,
|
||||||
(const void **) rejected_reference,
|
(const void **) url,
|
||||||
TALER_TESTING_TRAIT_REJECTED,
|
TALER_TESTING_TRAIT_PAYTO,
|
||||||
index);
|
index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Offer a "reject" CMD reference.
|
* Offer a "payto" URL reference.
|
||||||
*
|
*
|
||||||
* @param index which reference is to be offered,
|
* @param index which reference is to be offered,
|
||||||
* in case multiple are offered.
|
* in case multiple are offered.
|
||||||
* @param rejected_reference the reference to offer.
|
* @param payto the payto URL
|
||||||
*
|
|
||||||
* @return the trait.
|
* @return the trait.
|
||||||
*/
|
*/
|
||||||
struct TALER_TESTING_Trait
|
struct TALER_TESTING_Trait
|
||||||
TALER_TESTING_make_trait_rejected
|
TALER_TESTING_make_trait_payto
|
||||||
(unsigned int index,
|
(unsigned int index,
|
||||||
const char *rejected)
|
const char *payto)
|
||||||
{
|
{
|
||||||
struct TALER_TESTING_Trait ret = {
|
struct TALER_TESTING_Trait ret = {
|
||||||
.index = index,
|
.index = index,
|
||||||
.trait_name = TALER_TESTING_TRAIT_REJECTED,
|
.trait_name = TALER_TESTING_TRAIT_PAYTO,
|
||||||
.ptr = (const void *) rejected
|
.ptr = (const void *) payto
|
||||||
};
|
};
|
||||||
|
|
||||||
|
GNUNET_assert (0 == strncasecmp (payto,
|
||||||
|
"payto://",
|
||||||
|
strlen ("payto://")));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user