From b5cba3251053c22bf1df46282f1dd0a4c46f6a38 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Tue, 1 Mar 2016 15:35:04 +0100 Subject: renaming mint->exchange --- .../exchange-template/config/exchange-common.conf | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 contrib/exchange-template/config/exchange-common.conf (limited to 'contrib/exchange-template/config/exchange-common.conf') diff --git a/contrib/exchange-template/config/exchange-common.conf b/contrib/exchange-template/config/exchange-common.conf new file mode 100644 index 000000000..cb34ddcd9 --- /dev/null +++ b/contrib/exchange-template/config/exchange-common.conf @@ -0,0 +1,28 @@ +[exchange] +# Currency supported by the exchange (can only be one) +CURRENCY = EUR + +# Wire format supported by the exchange, case-insensitive. +# Examples for formats include 'test' for testing and 'sepa' (for EU IBAN). +WIREFORMAT = SEPA + +# HTTP port the exchange listens to +PORT = 4241 + +# Master public key used to sign the exchange's various keys +MASTER_PUBLIC_KEY = NEGTF62MNGVPZNW19V7S3CRS9D7K04MAHDGX3N6WY2NXREN26J80 + +# How to access our database +DB = postgres + +TESTRUN = YES + +[exchangedb-postgres] + +DB_CONN_STR = "postgres:///talercheck" + +[exchange-wire-sepa] +SEPA_RESPONSE_FILE = "sepa.json" + +[exchange-wire-test] +REDIRECT_URL = "http://test/" -- cgit v1.2.3 From f746efecf78e06f56ad7193591574d374c19958a Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Tue, 1 Mar 2016 16:10:41 +0100 Subject: rename section from exchange-wire- to wire- --- contrib/exchange-template/config/exchange-common.conf | 7 ++++--- src/exchange/taler-exchange-httpd_wire.c | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'contrib/exchange-template/config/exchange-common.conf') diff --git a/contrib/exchange-template/config/exchange-common.conf b/contrib/exchange-template/config/exchange-common.conf index cb34ddcd9..5214fd816 100644 --- a/contrib/exchange-template/config/exchange-common.conf +++ b/contrib/exchange-template/config/exchange-common.conf @@ -15,14 +15,15 @@ MASTER_PUBLIC_KEY = NEGTF62MNGVPZNW19V7S3CRS9D7K04MAHDGX3N6WY2NXREN26J80 # How to access our database DB = postgres +# Is this for testing, or for real? TESTRUN = YES [exchangedb-postgres] - DB_CONN_STR = "postgres:///talercheck" -[exchange-wire-sepa] +[wire-sepa] SEPA_RESPONSE_FILE = "sepa.json" -[exchange-wire-test] +[wire-test] REDIRECT_URL = "http://test/" +BANK_URI = "http://bank/ diff --git a/src/exchange/taler-exchange-httpd_wire.c b/src/exchange/taler-exchange-httpd_wire.c index ba763b64d..faf018b99 100644 --- a/src/exchange/taler-exchange-httpd_wire.c +++ b/src/exchange/taler-exchange-httpd_wire.c @@ -104,7 +104,7 @@ TMH_WIRE_handler_wire_test (struct TMH_RequestHandler *rh, } if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (cfg, - "exchange-wire-test", + "wire-test", "REDIRECT_URL", &wire_test_redirect)) { @@ -168,7 +168,7 @@ TMH_WIRE_handler_wire_sepa (struct TMH_RequestHandler *rh, /* Fetch reply */ if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (cfg, - "exchange-wire-sepa", + "wire-sepa", "SEPA_RESPONSE_FILE", &sepa_wire_file)) { -- cgit v1.2.3 From d06fb4d8182e5213e6d59cf0c5fe2c8d4c4cef36 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 4 Mar 2016 11:43:11 +0100 Subject: towards returning account numbers in /wire/test --- .../exchange-template/config/exchange-common.conf | 4 +-- .../test-exchange-home/config/exchange-common.conf | 2 +- src/exchange/taler-exchange-httpd_wire.c | 37 ++++++++++++++-------- src/wire/plugin_wire_test.c | 6 ++-- 4 files changed, 30 insertions(+), 19 deletions(-) (limited to 'contrib/exchange-template/config/exchange-common.conf') 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); -- cgit v1.2.3 From 9bc96506bb6441467c6558f5252e803c4292c9fe Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 1 Apr 2016 17:32:10 +0200 Subject: update man pages and templates to use current options --- .../exchange-template/config/exchange-common.conf | 16 ++++++++++++---- doc/taler.conf.5 | 16 +++++++++------- .../test-exchange-home/config/exchange-common.conf | 21 +++++++++++++-------- src/exchange-lib/test_exchange_api.c | 1 + .../test-exchange-home/config/exchange-common.conf | 12 +++++++++--- src/wire/plugin_wire_test.c | 21 +++++++++++---------- 6 files changed, 55 insertions(+), 32 deletions(-) (limited to 'contrib/exchange-template/config/exchange-common.conf') diff --git a/contrib/exchange-template/config/exchange-common.conf b/contrib/exchange-template/config/exchange-common.conf index 26bf4ff94..eddde3c32 100644 --- a/contrib/exchange-template/config/exchange-common.conf +++ b/contrib/exchange-template/config/exchange-common.conf @@ -21,15 +21,23 @@ TESTRUN = YES [exchangedb-postgres] DB_CONN_STR = "postgres:///talercheck" -[wire-sepa] +[wire-incoming-sepa] SEPA_RESPONSE_FILE = "sepa.json" -[wire-test] +[wire-outgoing-sepa] +SEPA_RESPONSE_FILE = "sepa.json" + + +[wire-incoming-test] # 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 +BANK_ACCOUNT_NUMBER = 2 + +[wire-outgoing-test] +# What is the main website of the bank? +BANK_URI = "https://bank/" # From which account at the 'bank' should outgoing # wire transfers be made? -BANK_ACCOUNT_NO_OUTGOING = 2 +BANK_ACCOUNT_NUMBER = 2 diff --git a/doc/taler.conf.5 b/doc/taler.conf.5 index f9d9d6312..e4c7083d6 100644 --- a/doc/taler.conf.5 +++ b/doc/taler.conf.5 @@ -28,20 +28,23 @@ The following options are from the "[exchange]" section and used by most exchang .SH WIRE transfer details -The following options must be in section "[exchange-wire-test]": +The following options must be in section "[wire\-incoming\-test]" and "[wire\-outgoing\-test]": -.IP REDIRECT_URL - URL to redirect /wire/test to. Should contain a Web form the user can use to charge his wallet with coins in a "test" currency for testing. If this option is not provided, /wire/test will return "501 NOT IMPLEMENTED". +.IP BANK_URI + URL of the Taler bank. -The following options must be in section "[exchange-wire-sepa]": +.IP BANK_ACCOUNT_NUMBER + Number of the bank account of the exchange. + +The following options must be in section "[wire\-incoming\-sepa]" and "[wire\-outgoing\-sepa]": .IP SEPA_RESPONSE_FILE - Filename with the JSON body for the /wire/sepa response, signed using the exchange's long-term offline master key. If this option is not provided, /wire/test will return "501 NOT IMPLEMENTED". Use "taler-exchange-sepa" to create the SEPA_RESPONSE_FILE. + Filename with the JSON body for the /wire response, signed using the exchange\'s long-term offline master key. Use taler\-exchange\-sepa to create the SEPA_RESPONSE_FILE. .SH Postgres database options -The following options must be in section "[exchangedb-postgres]": +The following options must be in section "[exchangedb\-postgres]": .IP DB_CONN_STR How to access the database, i.e. "postgres:///taler" to use the "taler" database. Testcases use "talercheck". @@ -86,4 +89,3 @@ Report bugs by using Mantis or by sending electronic .SH "SEE ALSO" \fBtaler\-exchange\-httpd\fP(1), \fBtaler\-exchange\-keyup\fP(1), \fBtaler\-exchange\-reservemod\fP(1), \fBtaler\-exchange\-dbinit\fP(1), \fBtaler\-exchange\-sepa(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 89b7f5182..97947f111 100644 --- a/src/exchange-lib/test-exchange-home/config/exchange-common.conf +++ b/src/exchange-lib/test-exchange-home/config/exchange-common.conf @@ -22,15 +22,20 @@ TESTRUN = YES [exchangedb-postgres] DB_CONN_STR = "postgres:///talercheck" -[wire-sepa] +[wire-incoming-sepa] SEPA_RESPONSE_FILE = "test-exchange-home/sepa.json" -[wire-test] +[wire-incoming-sepa] +SEPA_RESPONSE_FILE = "test-exchange-home/sepa.json" + +[wire-incoming-test] +# What is the main website of the bank? +BANK_URI = "http://localhost/" +# Into which account at the 'bank' should (incoming) wire transfers be made? +BANK_ACCOUNT_NUMBER = 2 + +[wire-outgoing-test] # What is the main website of the bank? BANK_URI = "http://localhost/" -# 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 +# Into which account at the 'bank' should (incoming) wire transfers be made? +BANK_ACCOUNT_NUMBER = 2 diff --git a/src/exchange-lib/test_exchange_api.c b/src/exchange-lib/test_exchange_api.c index 6eae08f4d..bfe54d507 100644 --- a/src/exchange-lib/test_exchange_api.c +++ b/src/exchange-lib/test_exchange_api.c @@ -1227,6 +1227,7 @@ wire_cb (void *cls, struct InterpreterState *is = cls; struct Command *cmd = &is->commands[is->ip]; + cmd->details.wire.wh = NULL; if (cmd->expected_response_code != http_status) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, diff --git a/src/exchange/test-exchange-home/config/exchange-common.conf b/src/exchange/test-exchange-home/config/exchange-common.conf index e4ff2a4d6..4078cbee5 100644 --- a/src/exchange/test-exchange-home/config/exchange-common.conf +++ b/src/exchange/test-exchange-home/config/exchange-common.conf @@ -22,12 +22,18 @@ TESTRUN = YES [exchangedb-postgres] DB_CONN_STR = "postgres:///talercheck" -[wire-test] + +[wire-incoming-test] # What is the main website of the bank? BANK_URI = "http://localhost:8082/" # Into which account at the 'bank' should incoming # wire transfers be made? -BANK_ACCOUNT_NO_INCOMING = 2 +BANK_ACCOUNT_NUMBER = 2 + +[wire-outgoing-test] +# What is the main website of the bank? +BANK_URI = "http://localhost:8082/" + # From which account at the 'bank' should outgoing # wire transfers be made? -BANK_ACCOUNT_NO_OUTGOING = 3 +BANK_ACCOUNT_NUMBER = 3 diff --git a/src/wire/plugin_wire_test.c b/src/wire/plugin_wire_test.c index a03f8127d..888501afb 100644 --- a/src/wire/plugin_wire_test.c +++ b/src/wire/plugin_wire_test.c @@ -44,9 +44,10 @@ struct TestClosure char *currency; /** - * Number of the account that the exchange has at the bank. + * Number of the account that the exchange has at the bank for outgoing + * transfers. */ - unsigned long long exchange_account_no; + unsigned long long exchange_account_outgoing_no; /** * Handle to the bank task, or NULL. @@ -576,7 +577,7 @@ test_execute_wire_transfer (void *cls, eh->aaih = TALER_BANK_admin_add_incoming (tc->bank, &bf.wtid, &amount, - (uint64_t) tc->exchange_account_no, + (uint64_t) tc->exchange_account_outgoing_no, (uint64_t) account_no, &execute_cb, eh); @@ -632,25 +633,25 @@ libtaler_plugin_wire_test_init (void *cls) { if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (cfg, - "wire-test", + "wire-outgoing-test", "BANK_URI", &uri)) { GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, - "wire-test", + "wire-outgoing-test", "BANK_URI"); GNUNET_free (tc); return NULL; } if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (cfg, - "wire-test", - "BANK_ACCOUNT_NO_OUTGOING", - &tc->exchange_account_no)) + "wire-outgoing-test", + "BANK_ACCOUNT_NUMBER", + &tc->exchange_account_outgoing_no)) { GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, - "wire-test", - "BANK_ACCOUNT_NO_OUTGOING"); + "wire-incoming-test", + "BANK_ACCOUNT_NUMBER"); GNUNET_free (uri); GNUNET_free (tc); return NULL; -- cgit v1.2.3