summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2020-01-17 02:23:38 +0100
committerFlorian Dold <florian.dold@gmail.com>2020-01-17 02:23:48 +0100
commitcc862fb2795aefed25b1a7b4d1dcac750f648f1b (patch)
tree57e9833ea521dd72b8202ed6649991aa4bdab054 /src
parent8ea2af444feec46e9086bb6c410762b18c7252fe (diff)
downloadexchange-cc862fb2795aefed25b1a7b4d1dcac750f648f1b.tar.gz
exchange-cc862fb2795aefed25b1a7b4d1dcac750f648f1b.tar.bz2
exchange-cc862fb2795aefed25b1a7b4d1dcac750f648f1b.zip
payto fixes WIP
Diffstat (limited to 'src')
-rw-r--r--src/auditor/taler-wire-auditor.c3
-rw-r--r--src/bank-lib/bank_api_parse.c25
-rw-r--r--src/bank-lib/fakebank.c6
-rw-r--r--src/exchange/taler-exchange-httpd_validation.c6
-rw-r--r--src/include/taler_bank_service.h5
-rw-r--r--src/lib/test_auditor_api.conf13
-rw-r--r--src/lib/test_exchange_api_home/.config/taler/account-2.json5
-rw-r--r--src/lib/testing_api_cmd_bank_admin_check.c4
-rw-r--r--src/lib/testing_api_cmd_bank_check.c7
-rw-r--r--src/lib/testing_api_helpers_bank.c65
10 files changed, 57 insertions, 82 deletions
diff --git a/src/auditor/taler-wire-auditor.c b/src/auditor/taler-wire-auditor.c
index 8ea2b2fd0..75bd83e53 100644
--- a/src/auditor/taler-wire-auditor.c
+++ b/src/auditor/taler-wire-auditor.c
@@ -1438,8 +1438,7 @@ process_debits (void *cls)
wa->section_name);
GNUNET_assert (NULL == wa->dhh);
wa->dhh = TALER_BANK_debit_history (ctx,
- wa->account.details.x_taler_bank.
- account_base_url,
+ wa->auth.wire_gateway_url,
&wa->auth,
wa->out_wire_off,
INT64_MAX,
diff --git a/src/bank-lib/bank_api_parse.c b/src/bank-lib/bank_api_parse.c
index 5423d01b7..384019542 100644
--- a/src/bank-lib/bank_api_parse.c
+++ b/src/bank-lib/bank_api_parse.c
@@ -98,27 +98,6 @@ TALER_BANK_auth_parse_cfg (const struct GNUNET_CONFIGURATION_Handle *cfg,
{ NULL, TALER_BANK_AUTH_NONE }
};
char *method;
- unsigned long long fakebank_port;
-
- if (GNUNET_OK ==
- GNUNET_CONFIGURATION_get_value_number (cfg,
- section,
- "FAKEBANK_PORT",
- &fakebank_port))
- {
- auth->method = TALER_BANK_AUTH_FAKEBANK;
- auth->details.fakebank.fb_port = (uint16_t) fakebank_port;
- // FIXME: we should not hardcode exchange account number "2"
- GNUNET_asprintf (&auth->wire_gateway_url,
- "http://localhost:%u/2/",
- (unsigned int) fakebank_port);
-
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Using fakebank %s on port %u\n",
- auth->wire_gateway_url,
- (unsigned int) fakebank_port);
- return GNUNET_OK;
- }
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_string (cfg,
@@ -187,8 +166,6 @@ TALER_BANK_auth_parse_cfg (const struct GNUNET_CONFIGURATION_Handle *cfg,
auth->method = TALER_BANK_AUTH_BASIC;
GNUNET_free (method);
return GNUNET_OK;
- case TALER_BANK_AUTH_FAKEBANK:
- GNUNET_assert (0);
}
}
}
@@ -222,8 +199,6 @@ TALER_BANK_auth_free (struct TALER_BANK_AuthenticationData *auth)
auth->details.basic.password = NULL;
}
break;
- case TALER_BANK_AUTH_FAKEBANK:
- break;
}
GNUNET_free (auth->wire_gateway_url);
}
diff --git a/src/bank-lib/fakebank.c b/src/bank-lib/fakebank.c
index 15b21ba39..fbd554aef 100644
--- a/src/bank-lib/fakebank.c
+++ b/src/bank-lib/fakebank.c
@@ -315,9 +315,9 @@ TALER_FAKEBANK_check_credit (struct TALER_FAKEBANK_Handle *h,
"Did not find matching transaction!\nI have:\n");
check_log (h);
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "I wanted:\n%llu -> %llu (%s) with subject %s (CREDIT)\n",
- (unsigned long long) want_debit,
- (unsigned long long) want_credit,
+ "I wanted:\n%s -> %s (%s) with subject %s (CREDIT)\n",
+ want_debit,
+ want_credit,
TALER_amount2s (want_amount),
TALER_B2S (reserve_pub));
return GNUNET_SYSERR;
diff --git a/src/exchange/taler-exchange-httpd_validation.c b/src/exchange/taler-exchange-httpd_validation.c
index 29c57d89e..0ca127eb2 100644
--- a/src/exchange/taler-exchange-httpd_validation.c
+++ b/src/exchange/taler-exchange-httpd_validation.c
@@ -114,8 +114,10 @@ load_account (void *cls,
ai->payto_url))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "URL in Wire response file `%s' does not match URL in configuration!\n",
- ai->wire_response_filename);
+ "URL in Wire response file `%s' does not match URL in configuration (%s vs %s)!\n",
+ ai->wire_response_filename,
+ url,
+ ai->payto_url);
json_decref (wire_s);
GNUNET_free (url);
*ret = GNUNET_SYSERR;
diff --git a/src/include/taler_bank_service.h b/src/include/taler_bank_service.h
index c9843f2fc..09406add0 100644
--- a/src/include/taler_bank_service.h
+++ b/src/include/taler_bank_service.h
@@ -43,11 +43,6 @@ enum TALER_BANK_AuthenticationMethod
* Basic authentication with cleartext username and password.
*/
TALER_BANK_AUTH_BASIC,
-
- /**
- * The authentication data refers to a fakebank.
- */
- TALER_BANK_AUTH_FAKEBANK,
};
diff --git a/src/lib/test_auditor_api.conf b/src/lib/test_auditor_api.conf
index 8133ce481..7bb57c3a9 100644
--- a/src/lib/test_auditor_api.conf
+++ b/src/lib/test_auditor_api.conf
@@ -59,19 +59,24 @@ CONFIG = "postgres:///talercheck"
# advertised in /wire.
[account-1]
# What is the URL of our account?
-URL = "payto://x-taler-bank/localhost:8082/42"
+URL = "payto://x-taler-bank/localhost/42"
+WIRE_GATEWAY_URL = "http://localhost:8082/42/"
# This is the response we give out for the /wire request. It provides
# wallets with the bank information for transfers to the exchange.
WIRE_RESPONSE = ${TALER_CONFIG_HOME}/account-1.json
+
# Which wire plugin should we used to access the account?
METHOD = x-taler-bank
+[bank]
+HTTP_PORT = 8082
+
# ENABLE_CREDIT = YES
[account-2]
# What is the bank account (with the "Taler Bank" demo system)?
-URL = "payto://x-taler-bank/localhost:8082/2"
-FAKEBANK_PORT = 8082
+WIRE_GATEWAY_URL = "http://localhost:8082/2/"
+URL = "payto://x-taler-bank/localhost/2"
# This is the response we give out for the /wire request. It provides
# wallets with the bank information for transfers to the exchange.
@@ -81,7 +86,7 @@ WIRE_RESPONSE = ${TALER_CONFIG_HOME}/account-2.json
METHOD = x-taler-bank
# Authentication information for basic authentication
-TALER_BANK_AUTH_METHOD = "basic"
+WIRE_GATEWAY_AUTH_METHOD = "basic"
USERNAME = user
PASSWORD = pass
diff --git a/src/lib/test_exchange_api_home/.config/taler/account-2.json b/src/lib/test_exchange_api_home/.config/taler/account-2.json
index e63710448..f39677eff 100644
--- a/src/lib/test_exchange_api_home/.config/taler/account-2.json
+++ b/src/lib/test_exchange_api_home/.config/taler/account-2.json
@@ -1,5 +1,4 @@
{
- "url": "payto://x-taler-bank/localhost:8082/2",
- "master_sig": "2MNAYBN0Q5VEJKFBGH2SRJQSV3QXA81FPXMFF5Y5YQQW1MRTDGJTZX35XHMCZFZ9SN9Q4TQ6MNM8EX7GPPD2MP8Q528A1D8RK7N9J38",
- "master_pub": "98NJW3CQHZQGQXTY3K85K531XKPAPAVV4Q5V8PYYRR00NJGZWNVG"
+ "url": "payto://x-taler-bank/localhost/2",
+ "master_sig": "HEWC1XDS0QZ53YQR451VRKD4N968NXWGZXS30HJ59MJ0PESACK1ZYPYCAT15P08WD58C7D7F6EVN26D59JKA75XEBDQCM8VYFETK82R"
} \ No newline at end of file
diff --git a/src/lib/testing_api_cmd_bank_admin_check.c b/src/lib/testing_api_cmd_bank_admin_check.c
index 4090b6e37..c63a1b4aa 100644
--- a/src/lib/testing_api_cmd_bank_admin_check.c
+++ b/src/lib/testing_api_cmd_bank_admin_check.c
@@ -119,6 +119,10 @@ check_bank_admin_transfer_run (void *cls,
}
debit_account = TALER_xtalerbank_account_from_payto (debit_payto);
credit_account = TALER_xtalerbank_account_from_payto (credit_payto);
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "converted debit_payto (%s) to debit_account (%s)\n",
+ debit_payto,
+ debit_account);
if (GNUNET_OK !=
TALER_FAKEBANK_check_credit (is->fakebank,
&amount,
diff --git a/src/lib/testing_api_cmd_bank_check.c b/src/lib/testing_api_cmd_bank_check.c
index c06477a1e..78526cdd2 100644
--- a/src/lib/testing_api_cmd_bank_check.c
+++ b/src/lib/testing_api_cmd_bank_check.c
@@ -149,8 +149,15 @@ check_bank_transfer_run (void *cls,
&exchange_base_url));
}
+
debit_account = TALER_xtalerbank_account_from_payto (debit_payto);
credit_account = TALER_xtalerbank_account_from_payto (credit_payto);
+
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "converted debit_payto (%s) to debit_account (%s)\n",
+ debit_payto,
+ debit_account);
+
if (GNUNET_OK !=
TALER_FAKEBANK_check_debit (is->fakebank,
&amount,
diff --git a/src/lib/testing_api_helpers_bank.c b/src/lib/testing_api_helpers_bank.c
index 342137c9c..c3dd97639 100644
--- a/src/lib/testing_api_helpers_bank.c
+++ b/src/lib/testing_api_helpers_bank.c
@@ -379,8 +379,7 @@ TALER_TESTING_prepare_fakebank (const char *config_filename,
struct TALER_TESTING_BankConfiguration *bc)
{
struct GNUNET_CONFIGURATION_Handle *cfg;
- char *payto_url;
- uint16_t fakebank_port;
+ unsigned long long fakebank_port;
cfg = GNUNET_CONFIGURATION_create ();
if (GNUNET_OK != GNUNET_CONFIGURATION_load (cfg,
@@ -388,53 +387,38 @@ TALER_TESTING_prepare_fakebank (const char *config_filename,
return GNUNET_SYSERR;
if (GNUNET_OK !=
- TALER_BANK_auth_parse_cfg (cfg,
- "account-" EXCHANGE_ACCOUNT_NAME,
- &bc->exchange_auth))
+ GNUNET_CONFIGURATION_get_value_number (cfg,
+ "BANK",
+ "HTTP_PORT",
+ &fakebank_port))
{
- GNUNET_break (0);
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_WARNING,
+ "BANK",
+ "HTTP_PORT");
GNUNET_CONFIGURATION_destroy (cfg);
return GNUNET_SYSERR;
}
+ bc->exchange_auth.method = TALER_BANK_AUTH_NONE;
+ // FIXME: we should not hardcode exchange account number "2"
+ GNUNET_asprintf (&bc->exchange_auth.wire_gateway_url,
+ "http://localhost:%u/2/",
+ (unsigned int) fakebank_port);
- GNUNET_assert (TALER_BANK_AUTH_FAKEBANK == bc->exchange_auth.method);
-
- fakebank_port = bc->exchange_auth.details.fakebank.fb_port;
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Using fakebank %s on port %u\n",
+ bc->exchange_auth.wire_gateway_url,
+ (unsigned int) fakebank_port);
GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Fakebank port from config: %u\n",
(unsigned int) fakebank_port);
- if (GNUNET_OK !=
- GNUNET_CONFIGURATION_get_value_string (cfg,
- config_section,
- "URL",
- &payto_url))
- {
- GNUNET_log_config_missing (GNUNET_ERROR_TYPE_WARNING,
- config_section,
- "URL");
- GNUNET_CONFIGURATION_destroy (cfg);
- return GNUNET_SYSERR;
- }
GNUNET_CONFIGURATION_destroy (cfg);
- bc->bank_url
- = TALER_xtalerbank_base_url_from_payto (payto_url);
- if (NULL == bc->bank_url)
- {
- GNUNET_log_config_invalid
- (GNUNET_ERROR_TYPE_WARNING,
- config_section,
- "URL",
- "expected `x-taler-bank' payto://-URL");
- GNUNET_free (payto_url);
- return GNUNET_SYSERR;
- }
+ bc->bank_url = bc->exchange_auth.wire_gateway_url;
if (GNUNET_OK !=
TALER_TESTING_url_port_free (bc->bank_url))
{
GNUNET_free (bc->bank_url);
bc->bank_url = NULL;
- GNUNET_free (payto_url);
return GNUNET_SYSERR;
}
GNUNET_asprintf (&bc->exchange_account_url,
@@ -444,13 +428,18 @@ TALER_TESTING_prepare_fakebank (const char *config_filename,
GNUNET_assert (NULL != bc->exchange_account_url);
GNUNET_log (GNUNET_ERROR_TYPE_INFO, "fakebank account URL: %s\n",
bc->exchange_account_url);
- GNUNET_free (payto_url);
/* Now we know it's the fake bank, for purpose of authentication, we
* don't have any auth. */
bc->exchange_auth.method = TALER_BANK_AUTH_NONE;
- bc->exchange_payto = TALER_payto_xtalerbank_make (bc->bank_url, "2");
- bc->user42_payto = TALER_payto_xtalerbank_make (bc->bank_url, "42");
- bc->user43_payto = TALER_payto_xtalerbank_make (bc->bank_url, "43");
+ bc->exchange_payto = "payto://x-taler-bank/localhost/2";
+ bc->user42_payto = "payto://x-taler-bank/localhost/42";
+ bc->user43_payto = "payto://x-taler-bank/localhost/43";
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO, "exchange payto: %s\n",
+ bc->exchange_payto);
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO, "user42_payto: %s\n",
+ bc->user42_payto);
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO, "user42_payto: %s\n",
+ bc->user43_payto);
return GNUNET_OK;
}