summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--contrib/exchange-template/config/exchange-common.conf11
-rw-r--r--src/exchange-lib/exchange_api_wire.c20
-rw-r--r--src/exchange-lib/test-exchange-home/config/exchange-common.conf9
-rw-r--r--src/exchange-lib/test_exchange_api.c4
-rw-r--r--src/exchange/taler-exchange-httpd_wire.c38
-rw-r--r--src/wire/plugin_wire_test.c8
6 files changed, 66 insertions, 24 deletions
diff --git a/contrib/exchange-template/config/exchange-common.conf b/contrib/exchange-template/config/exchange-common.conf
index d1df222fe..26bf4ff94 100644
--- a/contrib/exchange-template/config/exchange-common.conf
+++ b/contrib/exchange-template/config/exchange-common.conf
@@ -25,6 +25,11 @@ DB_CONN_STR = "postgres:///talercheck"
SEPA_RESPONSE_FILE = "sepa.json"
[wire-test]
-REDIRECT_URL = "http://test/"
-BANK_URI = "http://bank/"
-BANK_ACCOUNT_NO = 2
+# What is the main website of the bank?
+BANK_URI = "https://bank/"
+# Into which account at the 'bank' should incoming
+# wire transfers be made?
+BANK_ACCOUNT_NO_INCOMING = 2
+# From which account at the 'bank' should outgoing
+# wire transfers be made?
+BANK_ACCOUNT_NO_OUTGOING = 2
diff --git a/src/exchange-lib/exchange_api_wire.c b/src/exchange-lib/exchange_api_wire.c
index fd40230c7..f01c5000b 100644
--- a/src/exchange-lib/exchange_api_wire.c
+++ b/src/exchange-lib/exchange_api_wire.c
@@ -84,6 +84,25 @@ struct TALER_EXCHANGE_WireHandle
/**
* Verify that the signature on the "200 OK" response
+ * for /wire/test from the exchange is valid.
+ * Accepts everything.
+ *
+ * @param wh wire handle
+ * @param json json reply with the signature
+ * @return #GNUNET_SYSERR if @a json is invalid,
+ * #GNUNET_NO if the method is unknown,
+ * #GNUNET_OK if the json is valid
+ */
+static int
+verify_wire_test_signature_ok (const struct TALER_EXCHANGE_WireHandle *wh,
+ json_t *json)
+{
+ return GNUNET_OK;
+}
+
+
+/**
+ * Verify that the signature on the "200 OK" response
* for /wire/sepa from the exchange is valid.
*
* @param wh wire handle
@@ -182,6 +201,7 @@ verify_wire_method_signature_ok (const struct TALER_EXCHANGE_WireHandle *wh,
int (*handler)(const struct TALER_EXCHANGE_WireHandle *wh,
json_t *json);
} handlers[] = {
+ { "test", &verify_wire_test_signature_ok },
{ "sepa", &verify_wire_sepa_signature_ok },
{ NULL, NULL }
};
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 806046588..89b7f5182 100644
--- a/src/exchange-lib/test-exchange-home/config/exchange-common.conf
+++ b/src/exchange-lib/test-exchange-home/config/exchange-common.conf
@@ -26,6 +26,11 @@ DB_CONN_STR = "postgres:///talercheck"
SEPA_RESPONSE_FILE = "test-exchange-home/sepa.json"
[wire-test]
-REDIRECT_URL = "http://www.taler.net/"
+# What is the main website of the bank?
BANK_URI = "http://localhost/"
-BANK_ACCOUNT_NO = 2
+# Into which account at the 'bank' should incoming
+# wire transfers be made?
+BANK_ACCOUNT_NO_INCOMING = 2
+# From which account at the 'bank' should outgoing
+# wire transfers be made?
+BANK_ACCOUNT_NO_OUTGOING = 2 \ No newline at end of file
diff --git a/src/exchange-lib/test_exchange_api.c b/src/exchange-lib/test_exchange_api.c
index 80e2c6add..890e80756 100644
--- a/src/exchange-lib/test_exchange_api.c
+++ b/src/exchange-lib/test_exchange_api.c
@@ -2328,8 +2328,8 @@ run (void *cls,
#if WIRE_TEST
{ .oc = OC_WIRE,
.label = "wire-test",
- /* /wire/test replies with a 302 redirect */
- .expected_response_code = MHD_HTTP_FOUND,
+ /* /wire/test replies with a 200 OK */
+ .expected_response_code = MHD_HTTP_OK,
.details.wire.format = "test" },
#endif
#if WIRE_SEPA
diff --git a/src/exchange/taler-exchange-httpd_wire.c b/src/exchange/taler-exchange-httpd_wire.c
index faf018b99..cec041762 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,33 @@ 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_NO_INCOMING",
+ &account_number))
+ {
+ /* oopsie, configuration error */
+ MHD_destroy_response (response);
+ GNUNET_free (bank_uri);
+ return TMH_RESPONSE_reply_internal_error (connection,
+ "BANK_ACCOUNT_NO_INCOMING 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 9503e1ca5..1d19edf57 100644
--- a/src/wire/plugin_wire_test.c
+++ b/src/wire/plugin_wire_test.c
@@ -548,24 +548,24 @@ 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);
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_number (cfg,
"wire-test",
- "BANK_ACCOUNT_NO",
+ "BANK_ACCOUNT_NO_OUTGOING",
&tc->exchange_account_no))
{
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
"wire-test",
- "BANK_ACCOUNT_NO");
+ "BANK_ACCOUNT_NO_OUTGOING");
GNUNET_free (uri);
GNUNET_free (tc);
return NULL;