diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-03-04 11:43:11 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-03-04 11:43:11 +0100 |
commit | d06fb4d8182e5213e6d59cf0c5fe2c8d4c4cef36 (patch) | |
tree | 6cdef1b3831df96bd69d72bb09f2dfd16b6e1444 | |
parent | 77cd82c34fa8fc14583c8ebf5b197c5ed42ee01d (diff) | |
download | exchange-d06fb4d8182e5213e6d59cf0c5fe2c8d4c4cef36.tar.xz |
towards returning account numbers in /wire/test
-rw-r--r-- | contrib/exchange-template/config/exchange-common.conf | 4 | ||||
-rw-r--r-- | src/exchange-lib/test-exchange-home/config/exchange-common.conf | 2 | ||||
-rw-r--r-- | src/exchange/taler-exchange-httpd_wire.c | 37 | ||||
-rw-r--r-- | src/wire/plugin_wire_test.c | 6 |
4 files changed, 30 insertions, 19 deletions
diff --git a/contrib/exchange-template/config/exchange-common.conf b/contrib/exchange-template/config/exchange-common.conf index 5214fd816..183ae47ad 100644 --- a/contrib/exchange-template/config/exchange-common.conf +++ b/contrib/exchange-template/config/exchange-common.conf @@ -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 diff --git a/src/exchange-lib/test-exchange-home/config/exchange-common.conf b/src/exchange-lib/test-exchange-home/config/exchange-common.conf index 9e46fcb3b..35711a8f3 100644 --- a/src/exchange-lib/test-exchange-home/config/exchange-common.conf +++ b/src/exchange-lib/test-exchange-home/config/exchange-common.conf @@ -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 diff --git a/src/exchange/taler-exchange-httpd_wire.c b/src/exchange/taler-exchange-httpd_wire.c index faf018b99..0d1e3f3f1 100644 --- a/src/exchange/taler-exchange-httpd_wire.c +++ b/src/exchange/taler-exchange-httpd_wire.c @@ -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; } diff --git a/src/wire/plugin_wire_test.c b/src/wire/plugin_wire_test.c index 2f679bbaa..98d9281ce 100644 --- a/src/wire/plugin_wire_test.c +++ b/src/wire/plugin_wire_test.c @@ -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); |