diff options
author | Christian Grothoff <christian@grothoff.org> | 2018-04-02 14:24:45 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2018-04-02 14:29:44 +0200 |
commit | cb55c1a3af9f56a6da38e5589e72df0b70d355b1 (patch) | |
tree | 5f9a3af7d9073249f77ce56c690844a6cb27c3e7 /src/exchange-lib/testing_api_cmd_payback.c | |
parent | 7a20062bafed42f937c5388aed09042aad7014c0 (diff) | |
download | exchange-cb55c1a3af9f56a6da38e5589e72df0b70d355b1.tar.gz exchange-cb55c1a3af9f56a6da38e5589e72df0b70d355b1.tar.bz2 exchange-cb55c1a3af9f56a6da38e5589e72df0b70d355b1.zip |
Changing configuration structure to enable multiple accounts.
This change enables using multiple wire plugins at the same time.
Also, we now distinguish between the wire plugin (i.e. EBICS or
taler_bank) and the wire method (i.e. SEPA or x-taler-bank) that
the wire plugin is implementing. The "taler-bank" wire method
was renamed from "test" to "x-taler-bank".
This also changes the format of the /wire response of the exchange,
as we now need to return multiple accounts. Note that wire fees
are specified per wire method, not per wire account.
taler-exchange-keyup now automatically signs all of the /wire
responses in the location specified by the configuration.
Account identification in wire plugins was changed to use
payto://-URLs instead of method-specific JSON fields. Signing
and validation of /wire responses was moved from each wire
plugin to a generic validation method in libtalerutil (crypto)
or libtalerjson (for JSON-formatted inputs).
Convenience methods were added to generate JSON for wire accounts
(salting, signing).
Various section and option names were adjusted to streamline the
configuration and make it more consistent overall. Documentation
was updated as well.
Diffstat (limited to 'src/exchange-lib/testing_api_cmd_payback.c')
-rw-r--r-- | src/exchange-lib/testing_api_cmd_payback.c | 41 |
1 files changed, 23 insertions, 18 deletions
diff --git a/src/exchange-lib/testing_api_cmd_payback.c b/src/exchange-lib/testing_api_cmd_payback.c index 3a750e7fc..65665c9c8 100644 --- a/src/exchange-lib/testing_api_cmd_payback.c +++ b/src/exchange-lib/testing_api_cmd_payback.c @@ -31,7 +31,7 @@ struct RevokeState { - /** + /** * Expected HTTP status code. */ unsigned int expected_response_code; @@ -65,7 +65,7 @@ struct RevokeState struct PaybackState { - /** + /** * Expected HTTP status code. */ unsigned int expected_response_code; @@ -154,7 +154,7 @@ payback_cb (void *cls, TALER_TESTING_interpreter_fail (is); return; } - + if (GNUNET_OK != TALER_TESTING_get_trait_reserve_priv (reserve_cmd, 0, &reserve_priv)) { @@ -201,6 +201,7 @@ payback_cb (void *cls, TALER_TESTING_interpreter_next (is); } + /** * Run the command. * @@ -208,7 +209,7 @@ payback_cb (void *cls, * @param cmd the command to execute, a /wire one. * @param is the interpreter state. */ -void +static void payback_run (void *cls, const struct TALER_TESTING_Command *cmd, struct TALER_TESTING_Interpreter *is) @@ -230,7 +231,7 @@ payback_run (void *cls, { GNUNET_break (0); TALER_TESTING_interpreter_fail (is); - return; + return; } if (GNUNET_OK != TALER_TESTING_get_trait_coin_priv @@ -238,7 +239,7 @@ payback_run (void *cls, { GNUNET_break (0); TALER_TESTING_interpreter_fail (is); - return; + return; } if (GNUNET_OK != TALER_TESTING_get_trait_blinding_key @@ -246,7 +247,7 @@ payback_run (void *cls, { GNUNET_break (0); TALER_TESTING_interpreter_fail (is); - return; + return; } planchet.coin_priv = *coin_priv; planchet.blinding_key = *blinding_key; @@ -256,7 +257,7 @@ payback_run (void *cls, { GNUNET_break (0); TALER_TESTING_interpreter_fail (is); - return; + return; } if (GNUNET_OK != TALER_TESTING_get_trait_denom_sig @@ -264,13 +265,13 @@ payback_run (void *cls, { GNUNET_break (0); TALER_TESTING_interpreter_fail (is); - return; + return; } GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Trying to get '%s..' paid back\n", TALER_B2S (&denom_pub->h_key)); - + ps->ph = TALER_EXCHANGE_payback (ps->exchange, denom_pub, coin_sig, @@ -280,13 +281,14 @@ payback_run (void *cls, GNUNET_assert (NULL != ps->ph); } + /** * Cleanup the state. * * @param cls closure, typically a #struct WireState. * @param cmd the command which is being cleaned up. */ -void +static void revoke_cleanup (void *cls, const struct TALER_TESTING_Command *cmd) { @@ -302,17 +304,18 @@ revoke_cleanup (void *cls, rs->revoke_proc = NULL; } - GNUNET_free (rs->dhks); + GNUNET_free_non_null (rs->dhks); GNUNET_free (rs); } + /** * Cleanup the state. * * @param cls closure, typically a #struct WireState. * @param cmd the command which is being cleaned up. */ -void +static void payback_cleanup (void *cls, const struct TALER_TESTING_Command *cmd) { @@ -325,6 +328,7 @@ payback_cleanup (void *cls, GNUNET_free (ps); } + /** * Extract information from a command that is useful for other * commands. @@ -366,7 +370,7 @@ revoke_traits (void *cls, * @param cmd the command to execute, a /wire one. * @param is the interpreter state. */ -void +static void revoke_run (void *cls, const struct TALER_TESTING_Command *cmd, struct TALER_TESTING_Interpreter *is) @@ -384,7 +388,7 @@ revoke_run (void *cls, { GNUNET_break (0); TALER_TESTING_interpreter_fail (is); - return; + return; } GNUNET_assert (GNUNET_OK == TALER_TESTING_get_trait_denom_pub @@ -395,8 +399,8 @@ revoke_run (void *cls, TALER_B2S (&denom_pub->h_key)); rs->dhks = GNUNET_STRINGS_data_to_string_alloc - (&denom_pub->h_key, sizeof (struct GNUNET_HashCode)); - + (&denom_pub->h_key, sizeof (struct GNUNET_HashCode)); + rs->revoke_proc = GNUNET_OS_start_process (GNUNET_NO, GNUNET_OS_INHERIT_STD_ALL, @@ -441,7 +445,7 @@ TALER_TESTING_cmd_payback (const char *label, { struct PaybackState *ps; struct TALER_TESTING_Command cmd; - + ps = GNUNET_new (struct PaybackState); ps->expected_response_code = expected_response_code; ps->coin_reference = coin_reference; @@ -455,6 +459,7 @@ TALER_TESTING_cmd_payback (const char *label, return cmd; } + /** * Make a /revoke command. * |