add required payto URI traits
This commit is contained in:
parent
98c30bee88
commit
6ffb32aaab
@ -61,6 +61,11 @@ struct TrackTransactionState
|
|||||||
*/
|
*/
|
||||||
const char *transaction_reference;
|
const char *transaction_reference;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Payto URI of the merchant receiving the deposit.
|
||||||
|
*/
|
||||||
|
char *merchant_payto_uri;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Index of the coin involved in the transaction. Recall:
|
* Index of the coin involved in the transaction. Recall:
|
||||||
* at the exchange, the tracking is done _per coin_.
|
* at the exchange, the tracking is done _per coin_.
|
||||||
@ -222,7 +227,9 @@ track_transaction_run (void *cls,
|
|||||||
TALER_TESTING_interpreter_fail (tts->is);
|
TALER_TESTING_interpreter_fail (tts->is);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
tts->merchant_payto_uri
|
||||||
|
= GNUNET_strdup (json_string_value (json_object_get (wire_details,
|
||||||
|
"payto_uri")));
|
||||||
if (GNUNET_OK !=
|
if (GNUNET_OK !=
|
||||||
TALER_TESTING_get_trait_contract_terms (transaction_cmd,
|
TALER_TESTING_get_trait_contract_terms (transaction_cmd,
|
||||||
&contract_terms))
|
&contract_terms))
|
||||||
@ -291,6 +298,7 @@ track_transaction_cleanup (void *cls,
|
|||||||
TALER_EXCHANGE_deposits_get_cancel (tts->tth);
|
TALER_EXCHANGE_deposits_get_cancel (tts->tth);
|
||||||
tts->tth = NULL;
|
tts->tth = NULL;
|
||||||
}
|
}
|
||||||
|
GNUNET_free (tts->merchant_payto_uri);
|
||||||
GNUNET_free (tts);
|
GNUNET_free (tts);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -314,6 +322,8 @@ track_transaction_traits (void *cls,
|
|||||||
struct TALER_TESTING_Trait traits[] = {
|
struct TALER_TESTING_Trait traits[] = {
|
||||||
TALER_TESTING_make_trait_wtid (&tts->wtid),
|
TALER_TESTING_make_trait_wtid (&tts->wtid),
|
||||||
TALER_TESTING_make_trait_payment_target_uuid (&tts->kyc_uuid),
|
TALER_TESTING_make_trait_payment_target_uuid (&tts->kyc_uuid),
|
||||||
|
TALER_TESTING_make_trait_payto_uri (
|
||||||
|
(const char **) &tts->merchant_payto_uri),
|
||||||
TALER_TESTING_trait_end ()
|
TALER_TESTING_trait_end ()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -43,6 +43,11 @@ struct KycWalletGetState
|
|||||||
*/
|
*/
|
||||||
struct TALER_ReservePublicKeyP reserve_pub;
|
struct TALER_ReservePublicKeyP reserve_pub;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Payto URI of the reserve of the wallet.
|
||||||
|
*/
|
||||||
|
char *reserve_payto_uri;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Command to get a reserve private key from.
|
* Command to get a reserve private key from.
|
||||||
*/
|
*/
|
||||||
@ -161,6 +166,9 @@ wallet_kyc_run (void *cls,
|
|||||||
{
|
{
|
||||||
GNUNET_CRYPTO_eddsa_key_create (&kwg->reserve_priv.eddsa_priv);
|
GNUNET_CRYPTO_eddsa_key_create (&kwg->reserve_priv.eddsa_priv);
|
||||||
}
|
}
|
||||||
|
kwg->reserve_payto_uri
|
||||||
|
= TALER_payto_from_reserve (TALER_EXCHANGE_get_base_url (is->exchange),
|
||||||
|
&kwg->reserve_pub);
|
||||||
GNUNET_CRYPTO_eddsa_key_get_public (&kwg->reserve_priv.eddsa_priv,
|
GNUNET_CRYPTO_eddsa_key_get_public (&kwg->reserve_priv.eddsa_priv,
|
||||||
&kwg->reserve_pub.eddsa_pub);
|
&kwg->reserve_pub.eddsa_pub);
|
||||||
kwg->kwh = TALER_EXCHANGE_kyc_wallet (is->exchange,
|
kwg->kwh = TALER_EXCHANGE_kyc_wallet (is->exchange,
|
||||||
@ -193,6 +201,7 @@ wallet_kyc_cleanup (void *cls,
|
|||||||
TALER_EXCHANGE_kyc_wallet_cancel (kwg->kwh);
|
TALER_EXCHANGE_kyc_wallet_cancel (kwg->kwh);
|
||||||
kwg->kwh = NULL;
|
kwg->kwh = NULL;
|
||||||
}
|
}
|
||||||
|
GNUNET_free (kwg->reserve_payto_uri);
|
||||||
GNUNET_free (kwg);
|
GNUNET_free (kwg);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -217,6 +226,8 @@ wallet_kyc_traits (void *cls,
|
|||||||
TALER_TESTING_make_trait_reserve_priv (&kwg->reserve_priv),
|
TALER_TESTING_make_trait_reserve_priv (&kwg->reserve_priv),
|
||||||
TALER_TESTING_make_trait_reserve_pub (&kwg->reserve_pub),
|
TALER_TESTING_make_trait_reserve_pub (&kwg->reserve_pub),
|
||||||
TALER_TESTING_make_trait_payment_target_uuid (&kwg->kyc_uuid),
|
TALER_TESTING_make_trait_payment_target_uuid (&kwg->kyc_uuid),
|
||||||
|
TALER_TESTING_make_trait_payto_uri (
|
||||||
|
(const char **) &kwg->reserve_payto_uri),
|
||||||
TALER_TESTING_trait_end ()
|
TALER_TESTING_trait_end ()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -84,6 +84,21 @@ struct WithdrawState
|
|||||||
*/
|
*/
|
||||||
char *exchange_url;
|
char *exchange_url;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* URI if the reserve we are withdrawing from.
|
||||||
|
*/
|
||||||
|
char *reserve_payto_uri;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Private key of the reserve we are withdrawing from.
|
||||||
|
*/
|
||||||
|
struct TALER_ReservePrivateKeyP reserve_priv;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Public key of the reserve we are withdrawing from.
|
||||||
|
*/
|
||||||
|
struct TALER_ReservePublicKeyP reserve_pub;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interpreter state (during command).
|
* Interpreter state (during command).
|
||||||
*/
|
*/
|
||||||
@ -361,6 +376,15 @@ withdraw_run (void *cls,
|
|||||||
TALER_TESTING_interpreter_fail (is);
|
TALER_TESTING_interpreter_fail (is);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (NULL == ws->exchange_url)
|
||||||
|
ws->exchange_url
|
||||||
|
= GNUNET_strdup (TALER_EXCHANGE_get_base_url (ws->is->exchange));
|
||||||
|
ws->reserve_priv = *rp;
|
||||||
|
GNUNET_CRYPTO_eddsa_key_get_public (&ws->reserve_priv.eddsa_priv,
|
||||||
|
&ws->reserve_pub.eddsa_pub);
|
||||||
|
ws->reserve_payto_uri
|
||||||
|
= TALER_payto_from_reserve (ws->exchange_url,
|
||||||
|
&ws->reserve_pub);
|
||||||
if (NULL == ws->reuse_coin_key_ref)
|
if (NULL == ws->reuse_coin_key_ref)
|
||||||
{
|
{
|
||||||
TALER_planchet_setup_random (&ws->ps);
|
TALER_planchet_setup_random (&ws->ps);
|
||||||
@ -463,6 +487,7 @@ withdraw_cleanup (void *cls,
|
|||||||
ws->pk = NULL;
|
ws->pk = NULL;
|
||||||
}
|
}
|
||||||
GNUNET_free (ws->exchange_url);
|
GNUNET_free (ws->exchange_url);
|
||||||
|
GNUNET_free (ws->reserve_payto_uri);
|
||||||
GNUNET_free (ws);
|
GNUNET_free (ws);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -484,69 +509,34 @@ withdraw_traits (void *cls,
|
|||||||
unsigned int index)
|
unsigned int index)
|
||||||
{
|
{
|
||||||
struct WithdrawState *ws = cls;
|
struct WithdrawState *ws = cls;
|
||||||
const struct TALER_TESTING_Command *reserve_cmd;
|
struct TALER_TESTING_Trait traits[] = {
|
||||||
const struct TALER_ReservePrivateKeyP *reserve_priv;
|
/* history entry MUST be first due to response code logic below! */
|
||||||
const struct TALER_ReservePublicKeyP *reserve_pub;
|
TALER_TESTING_make_trait_reserve_history (&ws->reserve_history),
|
||||||
|
TALER_TESTING_make_trait_coin_priv (0 /* only one coin */,
|
||||||
|
&ws->ps.coin_priv),
|
||||||
|
TALER_TESTING_make_trait_blinding_key (0 /* only one coin */,
|
||||||
|
&ws->ps.blinding_key),
|
||||||
|
TALER_TESTING_make_trait_denom_pub (0 /* only one coin */,
|
||||||
|
ws->pk),
|
||||||
|
TALER_TESTING_make_trait_denom_sig (0 /* only one coin */,
|
||||||
|
&ws->sig),
|
||||||
|
TALER_TESTING_make_trait_reserve_priv (&ws->reserve_priv),
|
||||||
|
TALER_TESTING_make_trait_reserve_pub (&ws->reserve_pub),
|
||||||
|
TALER_TESTING_make_trait_amount (&ws->amount),
|
||||||
|
TALER_TESTING_make_trait_payment_target_uuid (&ws->kyc_uuid),
|
||||||
|
TALER_TESTING_make_trait_payto_uri (
|
||||||
|
(const char **) &ws->reserve_payto_uri),
|
||||||
|
TALER_TESTING_make_trait_exchange_url (
|
||||||
|
(const char **) &ws->exchange_url),
|
||||||
|
TALER_TESTING_trait_end ()
|
||||||
|
};
|
||||||
|
|
||||||
/* We offer the reserve key where these coins were withdrawn
|
return TALER_TESTING_get_trait ((ws->expected_response_code == MHD_HTTP_OK)
|
||||||
* from. */
|
|
||||||
reserve_cmd = TALER_TESTING_interpreter_lookup_command (ws->is,
|
|
||||||
ws->reserve_reference);
|
|
||||||
|
|
||||||
if (NULL == reserve_cmd)
|
|
||||||
{
|
|
||||||
GNUNET_break (0);
|
|
||||||
TALER_TESTING_interpreter_fail (ws->is);
|
|
||||||
return GNUNET_SYSERR;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GNUNET_OK !=
|
|
||||||
TALER_TESTING_get_trait_reserve_priv (reserve_cmd,
|
|
||||||
&reserve_priv))
|
|
||||||
{
|
|
||||||
GNUNET_break (0);
|
|
||||||
TALER_TESTING_interpreter_fail (ws->is);
|
|
||||||
return GNUNET_SYSERR;
|
|
||||||
}
|
|
||||||
if (GNUNET_OK !=
|
|
||||||
TALER_TESTING_get_trait_reserve_pub (reserve_cmd,
|
|
||||||
&reserve_pub))
|
|
||||||
{
|
|
||||||
GNUNET_break (0);
|
|
||||||
TALER_TESTING_interpreter_fail (ws->is);
|
|
||||||
return GNUNET_SYSERR;
|
|
||||||
}
|
|
||||||
if (NULL == ws->exchange_url)
|
|
||||||
ws->exchange_url
|
|
||||||
= GNUNET_strdup (TALER_EXCHANGE_get_base_url (ws->is->exchange));
|
|
||||||
{
|
|
||||||
struct TALER_TESTING_Trait traits[] = {
|
|
||||||
/* history entry MUST be first due to response code logic below! */
|
|
||||||
TALER_TESTING_make_trait_reserve_history (&ws->reserve_history),
|
|
||||||
TALER_TESTING_make_trait_coin_priv (0 /* only one coin */,
|
|
||||||
&ws->ps.coin_priv),
|
|
||||||
TALER_TESTING_make_trait_blinding_key (0 /* only one coin */,
|
|
||||||
&ws->ps.blinding_key),
|
|
||||||
TALER_TESTING_make_trait_denom_pub (0 /* only one coin */,
|
|
||||||
ws->pk),
|
|
||||||
TALER_TESTING_make_trait_denom_sig (0 /* only one coin */,
|
|
||||||
&ws->sig),
|
|
||||||
TALER_TESTING_make_trait_reserve_priv (reserve_priv),
|
|
||||||
TALER_TESTING_make_trait_reserve_pub (reserve_pub),
|
|
||||||
TALER_TESTING_make_trait_amount (&ws->amount),
|
|
||||||
TALER_TESTING_make_trait_payment_target_uuid (&ws->kyc_uuid),
|
|
||||||
TALER_TESTING_make_trait_exchange_url (
|
|
||||||
(const char **) &ws->exchange_url),
|
|
||||||
TALER_TESTING_trait_end ()
|
|
||||||
};
|
|
||||||
|
|
||||||
return TALER_TESTING_get_trait ((ws->expected_response_code == MHD_HTTP_OK)
|
|
||||||
? &traits[0] /* we have reserve history */
|
? &traits[0] /* we have reserve history */
|
||||||
: &traits[1],/* skip reserve history */
|
: &traits[1],/* skip reserve history */
|
||||||
ret,
|
ret,
|
||||||
trait,
|
trait,
|
||||||
index);
|
index);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user