diff options
author | Florian Dold <florian.dold@gmail.com> | 2020-01-17 01:23:32 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2020-01-17 01:23:32 +0100 |
commit | 6faf6fc732afe58a5da71dd442ede78cdbd7c495 (patch) | |
tree | c3f8cc519f5a4bc14b7a361ff168b2b19095392d /src/lib | |
parent | c677720e7b5c6a228159044e35ac12554e9c280b (diff) | |
download | exchange-6faf6fc732afe58a5da71dd442ede78cdbd7c495.tar.xz |
payto fixes WIP
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/test_auditor_api.conf | 1 | ||||
-rw-r--r-- | src/lib/test_bank_api.c | 2 | ||||
-rw-r--r-- | src/lib/test_bank_api.conf | 5 | ||||
-rw-r--r-- | src/lib/testing_api_helpers_bank.c | 29 |
4 files changed, 32 insertions, 5 deletions
diff --git a/src/lib/test_auditor_api.conf b/src/lib/test_auditor_api.conf index 5c6ee031f..8133ce481 100644 --- a/src/lib/test_auditor_api.conf +++ b/src/lib/test_auditor_api.conf @@ -71,6 +71,7 @@ METHOD = x-taler-bank [account-2] # What is the bank account (with the "Taler Bank" demo system)? URL = "payto://x-taler-bank/localhost:8082/2" +FAKEBANK_PORT = 8082 # This is the response we give out for the /wire request. It provides # wallets with the bank information for transfers to the exchange. diff --git a/src/lib/test_bank_api.c b/src/lib/test_bank_api.c index 5ebf76370..f47123975 100644 --- a/src/lib/test_bank_api.c +++ b/src/lib/test_bank_api.c @@ -140,7 +140,7 @@ main (int argc, TALER_LOG_DEBUG ("Running against the Fakebank.\n"); if (GNUNET_OK != TALER_TESTING_prepare_fakebank (CONFIG_FILE, - "account-1", + "account-2", &bc)) { GNUNET_break (0); diff --git a/src/lib/test_bank_api.conf b/src/lib/test_bank_api.conf index 906b95fc5..97fe09c98 100644 --- a/src/lib/test_bank_api.conf +++ b/src/lib/test_bank_api.conf @@ -1,8 +1,9 @@ [taler] currency = KUDOS -[account-1] -URL = payto://x-taler-bank/localhost:8081/1 +[account-2] +URL = payto://x-taler-bank/localhost:8081/2 +FAKEBANK_PORT = 8081 [bank] SERVE = http diff --git a/src/lib/testing_api_helpers_bank.c b/src/lib/testing_api_helpers_bank.c index f0ba9f99f..342137c9c 100644 --- a/src/lib/testing_api_helpers_bank.c +++ b/src/lib/testing_api_helpers_bank.c @@ -380,11 +380,30 @@ TALER_TESTING_prepare_fakebank (const char *config_filename, { struct GNUNET_CONFIGURATION_Handle *cfg; char *payto_url; + uint16_t fakebank_port; cfg = GNUNET_CONFIGURATION_create (); if (GNUNET_OK != GNUNET_CONFIGURATION_load (cfg, config_filename)) return GNUNET_SYSERR; + + if (GNUNET_OK != + TALER_BANK_auth_parse_cfg (cfg, + "account-" EXCHANGE_ACCOUNT_NAME, + &bc->exchange_auth)) + { + GNUNET_break (0); + GNUNET_CONFIGURATION_destroy (cfg); + return GNUNET_SYSERR; + } + + 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, "Fakebank port from config: %u\n", + (unsigned int) fakebank_port); + if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (cfg, config_section, @@ -418,10 +437,16 @@ TALER_TESTING_prepare_fakebank (const char *config_filename, GNUNET_free (payto_url); return GNUNET_SYSERR; } - bc->exchange_account_url - = TALER_xtalerbank_account_url_from_payto (payto_url); + GNUNET_asprintf (&bc->exchange_account_url, + "http://localhost:%u/%s/", + fakebank_port, + EXCHANGE_ACCOUNT_NAME); 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"); |