complete /deposit-confirmation test command
This commit is contained in:
parent
5f365133cd
commit
bbbb0986c6
@ -43,6 +43,12 @@ struct DepositConfirmationState
|
|||||||
*/
|
*/
|
||||||
const char *deposit_reference;
|
const char *deposit_reference;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* What is the deposited amount without the fee (i.e. the
|
||||||
|
* amount we expect in the deposit confirmation)?
|
||||||
|
*/
|
||||||
|
const char *amount_without_fee;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Which coin of the @e deposit_reference should we confirm.
|
* Which coin of the @e deposit_reference should we confirm.
|
||||||
*/
|
*/
|
||||||
@ -185,14 +191,14 @@ deposit_confirmation_run (void *cls,
|
|||||||
{
|
{
|
||||||
struct DepositConfirmationState *dcs = cls;
|
struct DepositConfirmationState *dcs = cls;
|
||||||
const struct TALER_TESTING_Command *deposit_cmd;
|
const struct TALER_TESTING_Command *deposit_cmd;
|
||||||
struct TALER_TESTING_Command *this_cmd;
|
|
||||||
struct GNUNET_HashCode h_wire;
|
struct GNUNET_HashCode h_wire;
|
||||||
struct GNUNET_HashCode h_contract_terms;
|
struct GNUNET_HashCode h_contract_terms;
|
||||||
struct GNUNET_TIME_Absolute timestamp;
|
struct GNUNET_TIME_Absolute timestamp;
|
||||||
struct GNUNET_TIME_Absolute refund_deadline;
|
struct GNUNET_TIME_Absolute refund_deadline;
|
||||||
const struct TALER_Amount *amount_without_fee;
|
struct TALER_Amount amount_without_fee;
|
||||||
struct TALER_CoinSpendPublicKeyP coin_pub;
|
struct TALER_CoinSpendPublicKeyP coin_pub;
|
||||||
const struct TALER_MerchantPublicKeyP *merchant_pub;
|
const struct GNUNET_CRYPTO_EddsaPrivateKey *merchant_priv;
|
||||||
|
struct TALER_MerchantPublicKeyP merchant_pub;
|
||||||
const struct TALER_ExchangePublicKeyP *exchange_pub;
|
const struct TALER_ExchangePublicKeyP *exchange_pub;
|
||||||
const struct TALER_ExchangeSignatureP *exchange_sig;
|
const struct TALER_ExchangeSignatureP *exchange_sig;
|
||||||
const json_t *wire_details;
|
const json_t *wire_details;
|
||||||
@ -200,9 +206,9 @@ deposit_confirmation_run (void *cls,
|
|||||||
const struct TALER_CoinSpendPrivateKeyP *coin_priv;
|
const struct TALER_CoinSpendPrivateKeyP *coin_priv;
|
||||||
const struct TALER_EXCHANGE_Keys *keys;
|
const struct TALER_EXCHANGE_Keys *keys;
|
||||||
const struct TALER_EXCHANGE_SigningPublicKey *spk;
|
const struct TALER_EXCHANGE_SigningPublicKey *spk;
|
||||||
|
const char *contract_terms_s;
|
||||||
|
|
||||||
dcs->is = is;
|
dcs->is = is;
|
||||||
this_cmd = &is->commands[is->ip]; // use this_cmd->label for logging!
|
|
||||||
GNUNET_assert (NULL != dcs->deposit_reference);
|
GNUNET_assert (NULL != dcs->deposit_reference);
|
||||||
deposit_cmd
|
deposit_cmd
|
||||||
= TALER_TESTING_interpreter_lookup_command (is,
|
= TALER_TESTING_interpreter_lookup_command (is,
|
||||||
@ -214,7 +220,6 @@ deposit_confirmation_run (void *cls,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GNUNET_assert (GNUNET_OK ==
|
GNUNET_assert (GNUNET_OK ==
|
||||||
TALER_TESTING_get_trait_exchange_pub (deposit_cmd,
|
TALER_TESTING_get_trait_exchange_pub (deposit_cmd,
|
||||||
dcs->coin_index,
|
dcs->coin_index,
|
||||||
@ -228,14 +233,18 @@ deposit_confirmation_run (void *cls,
|
|||||||
spk = TALER_EXCHANGE_get_exchange_signing_key_info (keys,
|
spk = TALER_EXCHANGE_get_exchange_signing_key_info (keys,
|
||||||
exchange_pub);
|
exchange_pub);
|
||||||
|
|
||||||
#if 0
|
|
||||||
GNUNET_assert (GNUNET_OK ==
|
GNUNET_assert (GNUNET_OK ==
|
||||||
TALER_TESTING_get_trait_contract_terms (deposit_cmd,
|
TALER_TESTING_get_trait_contract_terms (deposit_cmd,
|
||||||
dcs->coin_index,
|
dcs->coin_index,
|
||||||
&contract_terms));
|
&contract_terms_s));
|
||||||
|
contract_terms = json_loads (contract_terms_s,
|
||||||
|
JSON_REJECT_DUPLICATES,
|
||||||
|
NULL);
|
||||||
|
/* Very unlikely to fail */
|
||||||
|
GNUNET_assert (NULL != contract_terms);
|
||||||
TALER_JSON_hash (contract_terms,
|
TALER_JSON_hash (contract_terms,
|
||||||
&h_contract_terms);
|
&h_contract_terms);
|
||||||
#endif
|
json_decref (contract_terms);
|
||||||
GNUNET_assert (GNUNET_OK ==
|
GNUNET_assert (GNUNET_OK ==
|
||||||
TALER_TESTING_get_trait_wire_details (deposit_cmd,
|
TALER_TESTING_get_trait_wire_details (deposit_cmd,
|
||||||
dcs->coin_index,
|
dcs->coin_index,
|
||||||
@ -249,6 +258,15 @@ deposit_confirmation_run (void *cls,
|
|||||||
&coin_priv));
|
&coin_priv));
|
||||||
GNUNET_CRYPTO_eddsa_key_get_public (&coin_priv->eddsa_priv,
|
GNUNET_CRYPTO_eddsa_key_get_public (&coin_priv->eddsa_priv,
|
||||||
&coin_pub.eddsa_pub);
|
&coin_pub.eddsa_pub);
|
||||||
|
GNUNET_assert (GNUNET_OK ==
|
||||||
|
TALER_TESTING_get_trait_peer_key (deposit_cmd,
|
||||||
|
dcs->coin_index,
|
||||||
|
&merchant_priv));
|
||||||
|
GNUNET_CRYPTO_eddsa_key_get_public (merchant_priv,
|
||||||
|
&merchant_pub.eddsa_pub);
|
||||||
|
GNUNET_assert (GNUNET_OK ==
|
||||||
|
TALER_string_to_amount (dcs->amount_without_fee,
|
||||||
|
&amount_without_fee));
|
||||||
|
|
||||||
dcs->dc = TALER_AUDITOR_deposit_confirmation
|
dcs->dc = TALER_AUDITOR_deposit_confirmation
|
||||||
(dcs->auditor,
|
(dcs->auditor,
|
||||||
@ -256,9 +274,9 @@ deposit_confirmation_run (void *cls,
|
|||||||
&h_contract_terms,
|
&h_contract_terms,
|
||||||
timestamp,
|
timestamp,
|
||||||
refund_deadline,
|
refund_deadline,
|
||||||
amount_without_fee,
|
&amount_without_fee,
|
||||||
&coin_pub,
|
&coin_pub,
|
||||||
merchant_pub,
|
&merchant_pub,
|
||||||
exchange_pub,
|
exchange_pub,
|
||||||
exchange_sig,
|
exchange_sig,
|
||||||
&keys->master_pub,
|
&keys->master_pub,
|
||||||
@ -343,8 +361,8 @@ deposit_confirmation_traits (void *cls,
|
|||||||
* coins, this parameter selects which one in that array.
|
* coins, this parameter selects which one in that array.
|
||||||
* This value is currently ignored, as only one-coin
|
* This value is currently ignored, as only one-coin
|
||||||
* deposits are implemented.
|
* deposits are implemented.
|
||||||
|
* @param amount_without_fee deposited amount without the fee
|
||||||
* @param expected_response_code expected HTTP response code.
|
* @param expected_response_code expected HTTP response code.
|
||||||
*
|
|
||||||
* @return the command.
|
* @return the command.
|
||||||
*/
|
*/
|
||||||
struct TALER_TESTING_Command
|
struct TALER_TESTING_Command
|
||||||
@ -353,6 +371,7 @@ TALER_TESTING_cmd_deposit_confirmation
|
|||||||
struct TALER_AUDITOR_Handle *auditor,
|
struct TALER_AUDITOR_Handle *auditor,
|
||||||
const char *deposit_reference,
|
const char *deposit_reference,
|
||||||
unsigned int coin_index,
|
unsigned int coin_index,
|
||||||
|
const char *amount_without_fee,
|
||||||
unsigned int expected_response_code)
|
unsigned int expected_response_code)
|
||||||
{
|
{
|
||||||
struct TALER_TESTING_Command cmd = {0}; /* need explicit zeroing..*/
|
struct TALER_TESTING_Command cmd = {0}; /* need explicit zeroing..*/
|
||||||
@ -362,6 +381,7 @@ TALER_TESTING_cmd_deposit_confirmation
|
|||||||
dcs->auditor = auditor;
|
dcs->auditor = auditor;
|
||||||
dcs->deposit_reference = deposit_reference;
|
dcs->deposit_reference = deposit_reference;
|
||||||
dcs->coin_index = coin_index;
|
dcs->coin_index = coin_index;
|
||||||
|
dcs->amount_without_fee = amount_without_fee;
|
||||||
dcs->expected_response_code = expected_response_code;
|
dcs->expected_response_code = expected_response_code;
|
||||||
|
|
||||||
cmd.cls = dcs;
|
cmd.cls = dcs;
|
||||||
|
@ -489,6 +489,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,
|
||||||
|
ds->amount),
|
||||||
TALER_TESTING_trait_end ()
|
TALER_TESTING_trait_end ()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -70,8 +70,8 @@ TALER_TESTING_cmd_exec_wire_auditor (const char *label,
|
|||||||
* coins, this parameter selects which one in that array.
|
* coins, this parameter selects which one in that array.
|
||||||
* This value is currently ignored, as only one-coin
|
* This value is currently ignored, as only one-coin
|
||||||
* deposits are implemented.
|
* deposits are implemented.
|
||||||
|
* @param amount_without_fee deposited amount without the fee
|
||||||
* @param expected_response_code expected HTTP response code.
|
* @param expected_response_code expected HTTP response code.
|
||||||
*
|
|
||||||
* @return the command.
|
* @return the command.
|
||||||
*/
|
*/
|
||||||
struct TALER_TESTING_Command
|
struct TALER_TESTING_Command
|
||||||
@ -80,6 +80,7 @@ TALER_TESTING_cmd_deposit_confirmation
|
|||||||
struct TALER_AUDITOR_Handle *auditor,
|
struct TALER_AUDITOR_Handle *auditor,
|
||||||
const char *deposit_reference,
|
const char *deposit_reference,
|
||||||
unsigned int coin_index,
|
unsigned int coin_index,
|
||||||
|
const char *amount_without_fee,
|
||||||
unsigned int expected_response_code);
|
unsigned int expected_response_code);
|
||||||
|
|
||||||
|
|
||||||
|
@ -1937,7 +1937,6 @@ TALER_TESTING_make_trait_wire_details
|
|||||||
* @param index (tipically zero) which key to return if there
|
* @param index (tipically zero) which key to return if there
|
||||||
* are multiple on offer.
|
* are multiple on offer.
|
||||||
* @param priv[out] set to the key coming from @a cmd.
|
* @param priv[out] set to the key coming from @a cmd.
|
||||||
*
|
|
||||||
* @return #GNUNET_OK on success.
|
* @return #GNUNET_OK on success.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
@ -1945,6 +1944,8 @@ TALER_TESTING_get_trait_peer_key
|
|||||||
(const struct TALER_TESTING_Command *cmd,
|
(const struct TALER_TESTING_Command *cmd,
|
||||||
unsigned int index,
|
unsigned int index,
|
||||||
const struct GNUNET_CRYPTO_EddsaPrivateKey **priv);
|
const struct GNUNET_CRYPTO_EddsaPrivateKey **priv);
|
||||||
|
// FIXME: private get_trait_merchant_priv instead, rather have
|
||||||
|
// more traits with precise types than this!
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1960,6 +1961,8 @@ struct TALER_TESTING_Trait
|
|||||||
TALER_TESTING_make_trait_peer_key
|
TALER_TESTING_make_trait_peer_key
|
||||||
(unsigned int index,
|
(unsigned int index,
|
||||||
const struct GNUNET_CRYPTO_EddsaPrivateKey *priv);
|
const struct GNUNET_CRYPTO_EddsaPrivateKey *priv);
|
||||||
|
// FIXME: private get_trait_merchant_priv instead, rather have
|
||||||
|
// more traits with precise types than this!
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user