towards returning account numbers in /wire/test

This commit is contained in:
Christian Grothoff 2016-03-04 11:43:11 +01:00
parent 77cd82c34f
commit d06fb4d818
4 changed files with 30 additions and 19 deletions

View File

@ -25,5 +25,5 @@ DB_CONN_STR = "postgres:///talercheck"
SEPA_RESPONSE_FILE = "sepa.json" SEPA_RESPONSE_FILE = "sepa.json"
[wire-test] [wire-test]
REDIRECT_URL = "http://test/" BANK_URI = "http://bank/"
BANK_URI = "http://bank/ BANK_ACCOUNT_NUMBER = 1

View File

@ -26,5 +26,5 @@ DB_CONN_STR = "postgres:///talercheck"
SEPA_RESPONSE_FILE = "test-exchange-home/sepa.json" SEPA_RESPONSE_FILE = "test-exchange-home/sepa.json"
[wire-test] [wire-test]
REDIRECT_URL = "http://www.taler.net/"
BANK_URI = "http://localhost/" BANK_URI = "http://localhost/"
BANK_ACCOUNT_NUMBER = 1

View File

@ -1,6 +1,6 @@
/* /*
This file is part of TALER This file is part of TALER
Copyright (C) 2015 GNUnet e.V. Copyright (C) 2015, 2016 GNUnet e.V. and INRIA
TALER is free software; you can redistribute it and/or modify it under the TALER is free software; you can redistribute it and/or modify it under the
terms of the GNU Affero General Public License as published by the Free Software terms of the GNU Affero General Public License as published by the Free Software
@ -83,7 +83,8 @@ TMH_WIRE_handler_wire_test (struct TMH_RequestHandler *rh,
{ {
struct MHD_Response *response; struct MHD_Response *response;
int ret; int ret;
char *wire_test_redirect; char *bank_uri;
unsigned long long account_number;
response = MHD_create_response_from_buffer (0, NULL, response = MHD_create_response_from_buffer (0, NULL,
MHD_RESPMEM_PERSISTENT); MHD_RESPMEM_PERSISTENT);
@ -105,22 +106,32 @@ TMH_WIRE_handler_wire_test (struct TMH_RequestHandler *rh,
if (GNUNET_OK != if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_string (cfg, GNUNET_CONFIGURATION_get_value_string (cfg,
"wire-test", "wire-test",
"REDIRECT_URL", "BANK_URI",
&wire_test_redirect)) &bank_uri))
{ {
/* oopsie, configuration error */ /* oopsie, configuration error */
MHD_destroy_response (response); MHD_destroy_response (response);
return TMH_RESPONSE_reply_internal_error (connection, return TMH_RESPONSE_reply_internal_error (connection,
"REDIRECT_URL not configured"); "BANK_URI not configured");
} }
MHD_add_response_header (response, if (GNUNET_OK !=
MHD_HTTP_HEADER_LOCATION, GNUNET_CONFIGURATION_get_value_number (cfg,
wire_test_redirect); "wire-test",
GNUNET_free (wire_test_redirect); "BANK_ACCOUNT_NUMBER",
ret = MHD_queue_response (connection, &account_number))
rh->response_code, {
response); /* oopsie, configuration error */
MHD_destroy_response (response); MHD_destroy_response (response);
return TMH_RESPONSE_reply_internal_error (connection,
"BANK_URI not configured");
}
ret = TMH_RESPONSE_reply_json_pack (connection,
MHD_HTTP_OK,
"{s:s, s:I, s:s}",
"type", "test",
"account_number", (json_int_t) account_number,
"bank_uri", bank_uri);
GNUNET_free (bank_uri);
return ret; return ret;
} }

View File

@ -482,7 +482,7 @@ test_execute_wire_transfer (void *cls,
GNUNET_break (0); GNUNET_break (0);
return NULL; return NULL;
} }
eh = GNUNET_new (struct TALER_WIRE_ExecuteHandle); eh = GNUNET_new (struct TALER_WIRE_ExecuteHandle);
eh->cc = cc; eh->cc = cc;
eh->cc_cls = cc_cls; eh->cc_cls = cc_cls;
@ -542,12 +542,12 @@ libtaler_plugin_wire_test_init (void *cls)
if (GNUNET_OK != if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_string (cfg, GNUNET_CONFIGURATION_get_value_string (cfg,
"wire-test", "wire-test",
"bank_uri", "BANK_URI",
&uri)) &uri))
{ {
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
"wire-test", "wire-test",
"bank_uri"); "BANK_URI");
return NULL; return NULL;
} }
tc = GNUNET_new (struct TestClosure); tc = GNUNET_new (struct TestClosure);