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"
[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"
[wire-test]
REDIRECT_URL = "http://www.taler.net/"
BANK_URI = "http://localhost/"
BANK_ACCOUNT_NUMBER = 1

View File

@ -1,6 +1,6 @@
/*
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
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;
int ret;
char *wire_test_redirect;
char *bank_uri;
unsigned long long account_number;
response = MHD_create_response_from_buffer (0, NULL,
MHD_RESPMEM_PERSISTENT);
@ -105,22 +106,32 @@ TMH_WIRE_handler_wire_test (struct TMH_RequestHandler *rh,
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_string (cfg,
"wire-test",
"REDIRECT_URL",
&wire_test_redirect))
"BANK_URI",
&bank_uri))
{
/* oopsie, configuration error */
MHD_destroy_response (response);
return TMH_RESPONSE_reply_internal_error (connection,
"REDIRECT_URL not configured");
"BANK_URI not configured");
}
MHD_add_response_header (response,
MHD_HTTP_HEADER_LOCATION,
wire_test_redirect);
GNUNET_free (wire_test_redirect);
ret = MHD_queue_response (connection,
rh->response_code,
response);
MHD_destroy_response (response);
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_number (cfg,
"wire-test",
"BANK_ACCOUNT_NUMBER",
&account_number))
{
/* oopsie, configuration error */
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;
}

View File

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