aboutsummaryrefslogtreecommitdiff
path: root/src/exchange-lib
diff options
context:
space:
mode:
authorMarcello Stanisci <stanisci.m@gmail.com>2018-12-18 17:35:23 +0100
committerMarcello Stanisci <stanisci.m@gmail.com>2018-12-18 17:35:23 +0100
commit93ff2d93cc76ab0d42a1730d79437a89145d6b2a (patch)
treeccece9fe25b771ea3ec237278413ad0a61b59943 /src/exchange-lib
parente634c877e34952d951438eaafd40e43c291a64fa (diff)
/withdraw: #5284.
Diffstat (limited to 'src/exchange-lib')
-rw-r--r--src/exchange-lib/test_exchange_api_new.c13
-rw-r--r--src/exchange-lib/test_exchange_api_twisted.c2
-rw-r--r--src/exchange-lib/testing_api_cmd_withdraw.c54
3 files changed, 23 insertions, 46 deletions
diff --git a/src/exchange-lib/test_exchange_api_new.c b/src/exchange-lib/test_exchange_api_new.c
index 199aaadd4..bcbdb5ea4 100644
--- a/src/exchange-lib/test_exchange_api_new.c
+++ b/src/exchange-lib/test_exchange_api_new.c
@@ -193,7 +193,6 @@ run (void *cls,
* Withdraw EUR:5.
*/
TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-1",
- is->exchange,
"create-reserve-1",
"EUR:5",
MHD_HTTP_OK),
@@ -224,7 +223,6 @@ run (void *cls,
* Try to overdraw.
*/
TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-2",
- is->exchange,
"create-reserve-1",
"EUR:5",
MHD_HTTP_FORBIDDEN),
@@ -290,7 +288,6 @@ run (void *cls,
*/
TALER_TESTING_cmd_withdraw_amount
("refresh-withdraw-coin-1",
- is->exchange,
"refresh-create-reserve-1",
"EUR:5",
MHD_HTTP_OK),
@@ -484,7 +481,6 @@ run (void *cls,
TALER_TESTING_cmd_withdraw_amount
("withdraw-coin-unaggregated",
- is->exchange,
"create-reserve-unaggregated",
"EUR:5",
MHD_HTTP_OK),
@@ -529,7 +525,6 @@ run (void *cls,
/* Withdraw a 5 EUR coin, at fee of 1 ct */
TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-r1",
- is->exchange,
"create-reserve-r1",
"EUR:5",
MHD_HTTP_OK),
@@ -626,7 +621,6 @@ run (void *cls,
CMD_EXEC_WIREWATCH ("wirewatch-rb"),
TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-rb",
- is->exchange,
"create-reserve-rb",
"EUR:5",
MHD_HTTP_OK),
@@ -681,7 +675,6 @@ run (void *cls,
/* Withdraw a 5 EUR coin, at fee of 1 ct */
TALER_TESTING_cmd_withdraw_amount ("payback-withdraw-coin-1",
- is->exchange,
"payback-create-reserve-1",
"EUR:5",
MHD_HTTP_OK),
@@ -705,7 +698,6 @@ run (void *cls,
/* Re-withdraw from this reserve */
TALER_TESTING_cmd_withdraw_amount ("payback-withdraw-coin-2",
- is->exchange,
"payback-create-reserve-1",
"EUR:1",
MHD_HTTP_OK),
@@ -716,7 +708,6 @@ run (void *cls,
*/
TALER_TESTING_cmd_withdraw_amount
("payback-withdraw-coin-2-over",
- is->exchange,
"payback-create-reserve-1",
"EUR:10",
MHD_HTTP_FORBIDDEN),
@@ -750,7 +741,6 @@ run (void *cls,
TALER_TESTING_cmd_withdraw_amount
("expired-withdraw",
- is->exchange,
"short-lived-reserve",
"EUR:1",
MHD_HTTP_FORBIDDEN),
@@ -784,14 +774,12 @@ run (void *cls,
/* Withdraw a 1 EUR coin, at fee of 1 ct */
TALER_TESTING_cmd_withdraw_amount ("payback-withdraw-coin-2a",
- is->exchange,
"payback-create-reserve-2",
"EUR:1",
MHD_HTTP_OK),
/* Withdraw a 1 EUR coin, at fee of 1 ct */
TALER_TESTING_cmd_withdraw_amount ("payback-withdraw-coin-2b",
- is->exchange,
"payback-create-reserve-2",
"EUR:1",
MHD_HTTP_OK),
@@ -851,7 +839,6 @@ run (void *cls,
TALER_TESTING_cmd_withdraw_amount
("payback-withdraw-coin-3-revoked",
- is->exchange,
"payback-create-reserve-3",
"EUR:1",
MHD_HTTP_NOT_FOUND),
diff --git a/src/exchange-lib/test_exchange_api_twisted.c b/src/exchange-lib/test_exchange_api_twisted.c
index fa850afe6..1c5300586 100644
--- a/src/exchange-lib/test_exchange_api_twisted.c
+++ b/src/exchange-lib/test_exchange_api_twisted.c
@@ -167,7 +167,6 @@ run (void *cls,
*/
TALER_TESTING_cmd_withdraw_amount
("refresh-withdraw-coin",
- is->exchange,
"refresh-create-reserve",
"EUR:5",
MHD_HTTP_OK),
@@ -226,7 +225,6 @@ run (void *cls,
TALER_TESTING_cmd_withdraw_amount
("withdraw-coin-r1",
- is->exchange,
"create-reserve-r1",
"EUR:5",
MHD_HTTP_OK),
diff --git a/src/exchange-lib/testing_api_cmd_withdraw.c b/src/exchange-lib/testing_api_cmd_withdraw.c
index 61730c526..b42a54585 100644
--- a/src/exchange-lib/testing_api_cmd_withdraw.c
+++ b/src/exchange-lib/testing_api_cmd_withdraw.c
@@ -59,12 +59,7 @@ struct WithdrawState
const struct TALER_EXCHANGE_DenomPublicKey *pk;
/**
- * Exchange we should use for the withdrawal.
- */
- struct TALER_EXCHANGE_Handle *exchange;
-
- /**
- * Exchange base URL.
+ * Exchange base URL. Only used as offered trait.
*/
char *exchange_url;
@@ -110,7 +105,6 @@ struct WithdrawState
* enable retries?
*/
int do_retry;
-
};
@@ -268,13 +262,24 @@ withdraw_run (void *cls,
}
TALER_planchet_setup_random (&ws->ps);
ws->is = is;
- ws->wsh
- = TALER_EXCHANGE_reserve_withdraw (ws->exchange,
- ws->pk,
- rp,
- &ws->ps,
- &reserve_withdraw_cb,
- ws);
+
+ ws->pk = TALER_TESTING_find_pk
+ (TALER_EXCHANGE_get_keys (is->exchange),
+ &ws->amount);
+ if (NULL == ws->pk)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Failed to determine denomination key at %s\n",
+ cmd->label);
+ GNUNET_assert (0);
+ }
+
+ ws->wsh = TALER_EXCHANGE_reserve_withdraw (is->exchange,
+ ws->pk,
+ rp,
+ &ws->ps,
+ &reserve_withdraw_cb,
+ ws);
if (NULL == ws->wsh)
{
GNUNET_break (0);
@@ -361,6 +366,9 @@ withdraw_traits (void *cls,
return GNUNET_SYSERR;
}
+ ws->exchange_url = GNUNET_strdup
+ (TALER_EXCHANGE_get_base_url (ws->is->exchange));
+
struct TALER_TESTING_Trait traits[] = {
TALER_TESTING_make_trait_coin_priv (0 /* only one coin */,
&ws->ps.coin_priv),
@@ -391,7 +399,6 @@ withdraw_traits (void *cls,
* the desired amount as string.
*
* @param label command label.
- * @param exchange handle to the exchange.
* @param amount how much we withdraw.
* @param expected_response_code which HTTP response code
* we expect from the exchange.
@@ -401,7 +408,6 @@ withdraw_traits (void *cls,
struct TALER_TESTING_Command
TALER_TESTING_cmd_withdraw_amount
(const char *label,
- struct TALER_EXCHANGE_Handle *exchange,
const char *reserve_reference,
const char *amount,
unsigned int expected_response_code)
@@ -422,19 +428,8 @@ TALER_TESTING_cmd_withdraw_amount
label);
GNUNET_assert (0);
}
- ws->pk = TALER_TESTING_find_pk
- (TALER_EXCHANGE_get_keys (exchange),
- &ws->amount);
- if (NULL == ws->pk)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Failed to determine denomination key at %s\n",
- label);
- GNUNET_assert (0);
- }
+
ws->expected_response_code = expected_response_code;
- ws->exchange = exchange;
- ws->exchange_url = TEAH_path_to_url (exchange, "/");
cmd.cls = ws;
cmd.label = label;
@@ -461,7 +456,6 @@ TALER_TESTING_cmd_withdraw_amount
struct TALER_TESTING_Command
TALER_TESTING_cmd_withdraw_denomination
(const char *label,
- struct TALER_EXCHANGE_Handle *exchange,
const char *reserve_reference,
const struct TALER_EXCHANGE_DenomPublicKey *dk,
unsigned int expected_response_code)
@@ -480,8 +474,6 @@ TALER_TESTING_cmd_withdraw_denomination
ws->reserve_reference = reserve_reference;
ws->pk = dk;
ws->expected_response_code = expected_response_code;
- ws->exchange = exchange;
- ws->exchange_url = TEAH_path_to_url (exchange, "/");
cmd.cls = ws;
cmd.label = label;