diff options
18 files changed, 112 insertions, 67 deletions
diff --git a/src/backend/merchant.conf b/src/backend/merchant.conf index 3475fc9e..1ac3a2c5 100644 --- a/src/backend/merchant.conf +++ b/src/backend/merchant.conf @@ -57,7 +57,7 @@ CONFIG = postgres:///talermerchant [merchant-instance-default] KEYFILE = ${TALER_DATA_HOME}/merchant/merchant.priv -[account-default] +# [account-merchant] # payto://-URL of the merchant's bank account. Required. # URL = payto://x-taler-bank/bank/42 @@ -65,16 +65,16 @@ KEYFILE = ${TALER_DATA_HOME}/merchant/merchant.priv # File where this account's salted wire address is provided. # File does not have to exist, will be generated from # BANK_URL if it is missing. File must match BANK_URL. -WIRE_RESPONSE = ${TALER_CONFIG_HOME}/merchant/accounts/default.json +#WIRE_RESPONSE = ${TALER_CONFIG_HOME}/merchant/accounts/default.json # Can this address be used in previous offers for # instance "default"? Must be set to YES if ACTIVE_default is YES. # Note that "default" here must match the instance's section name. # The same account may be enabled/active in multiple instances. -ENABLE_default = YES +#ENABLE_default = YES # Should this address be used in offers we create right now for # instance "default"? # Inactive addresses (NO) will be supported for legacy contracts # but not used for new contracts. -ACTIVE_default = YES +#ACTIVE_default = YES diff --git a/src/backend/taler-merchant-httpd.c b/src/backend/taler-merchant-httpd.c index 43047895..7119af56 100644 --- a/src/backend/taler-merchant-httpd.c +++ b/src/backend/taler-merchant-httpd.c @@ -713,12 +713,12 @@ wireformat_iterator_cb (void *cls, if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (iic->config, section, - "BANK_JSON_FILENAME", + "WIRE_RESPONSE", &fn)) { GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, section, - "BANK_JSON_FILENAME"); + "WIRE_RESPONSE"); GNUNET_free (payto); iic->ret = GNUNET_SYSERR; return; @@ -1153,6 +1153,19 @@ run (void *cls, "WARNING", NULL)); if (GNUNET_SYSERR == + GNUNET_CONFIGURATION_get_value_string (config, + "taler", + "CURRENCY", + &TMH_currency)) + { + GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, + "taler", + "CURRENCY"); + GNUNET_SCHEDULER_shutdown (); + return; + } + + if (GNUNET_SYSERR == TMH_EXCHANGES_init (config)) { GNUNET_SCHEDULER_shutdown (); @@ -1182,19 +1195,6 @@ run (void *cls, } if (GNUNET_SYSERR == - GNUNET_CONFIGURATION_get_value_string (config, - "taler", - "CURRENCY", - &TMH_currency)) - { - GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, - "taler", - "CURRENCY"); - GNUNET_SCHEDULER_shutdown (); - return; - } - - if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_time (config, "merchant", "WIRE_TRANSFER_DELAY", diff --git a/src/lib/test_merchant_api.c b/src/lib/test_merchant_api.c index 61b8f2ab..b8a8e365 100644 --- a/src/lib/test_merchant_api.c +++ b/src/lib/test_merchant_api.c @@ -35,7 +35,7 @@ /** * URL under which the merchant is reachable during the testcase. */ -#define MERCHANT_URL "http://localhost:8082" +#define MERCHANT_URL "http://localhost:8080" /** * URL under which the exchange is reachable during the testcase. @@ -3737,7 +3737,6 @@ interpreter_run (void *cls) "taler-exchange-wirewatch", "taler-exchange-wirewatch", "-c", "test_merchant_api.conf", - "-t", "test", /* use Taler's bank/fakebank */ "-T", /* exit when done */ (0 == once ? "-r" : NULL), NULL); diff --git a/src/lib/test_merchant_api.conf b/src/lib/test_merchant_api.conf index 29264102..dd3cbdba 100644 --- a/src/lib/test_merchant_api.conf +++ b/src/lib/test_merchant_api.conf @@ -19,7 +19,7 @@ INSTANCES = default tor [merchant] # Which port do we run the backend on? (HTTP server) -PORT = 8082 +PORT = 8080 # How quickly do we want the exchange to send us our money? # Used only if the frontend does not specify a value. @@ -39,7 +39,6 @@ DEFAULT_MAX_DEPOSIT_FEE = EUR:0.10 [merchantdb-postgres] CONFIG = postgres:///talercheck - # Different instances operated by this merchant: [instance-default] KEYFILE = ${TALER_CONFIG_HOME}/merchant/default.priv @@ -131,6 +130,8 @@ URL = http://taler.ezb.eu/ # This is the important bit: the signing key of the auditor. PUBLIC_KEY = 9QXF7XY7E9VPV47B5Z806NDFSX2VJ79SVHHD29QEQ3BG31ANHZ60 +# Which currency is this auditor trusted for? +CURRENCY = EUR ################################################### @@ -153,6 +154,8 @@ BASE_URL = "http://localhost:8081/" [exchangedb-postgres] CONFIG = "postgres:///talercheck" +[auditordb-postgres] +CONFIG = postgres:///talercheck # Account of the EXCHANGE [account-exchange] diff --git a/src/lib/test_merchant_api_home/.config/taler/exchange/account-2.json b/src/lib/test_merchant_api_home/.config/taler/exchange/account-2.json new file mode 100644 index 00000000..ec23adee --- /dev/null +++ b/src/lib/test_merchant_api_home/.config/taler/exchange/account-2.json @@ -0,0 +1,5 @@ +{ + "url": "payto://x-taler-bank/localhost:8082/2", + "salt": "AX69JV6JVW31AHK24RFH5907T1MVTB901TQD7E9ATFKVM1J734MN62GA3TMSRMCYKJPB7A7G2R5S658216EVM90CNNM7V7V2K6BDR3R", + "master_sig": "C9NT2J22X2Q33FH8GT04ASQSDB60TGZQP61J0D2HDJ52J4X0N7T5K2ZGPTYKGF48XA729CJ8BZ84E006DK15691XXFRF0THNMQSZP0G" +}
\ No newline at end of file diff --git a/src/lib/test_merchant_api_home/.config/taler/merchant/account-3.json b/src/lib/test_merchant_api_home/.config/taler/merchant/account-3.json new file mode 100644 index 00000000..2b8a81d6 --- /dev/null +++ b/src/lib/test_merchant_api_home/.config/taler/merchant/account-3.json @@ -0,0 +1 @@ +{"salt":"NEHC5SP52WZRSZR8CTE3SV2JSZX2C1XFSA75YNRT6YJARRR2ERM32PMTHP16CT6TV7G2CX7T3J28YFP0PJP1PAMAQVT6J76RF3AE34R","url":"payto://x-taler-bank/localhost:8082/3"}
\ No newline at end of file diff --git a/src/lib/test_merchant_api_home/.config/taler/merchant/default.priv b/src/lib/test_merchant_api_home/.config/taler/merchant/default.priv new file mode 100644 index 00000000..8299ad28 --- /dev/null +++ b/src/lib/test_merchant_api_home/.config/taler/merchant/default.priv @@ -0,0 +1 @@ +~~j&i4qlBM:ƾOߪ#
\ No newline at end of file diff --git a/src/lib/test_merchant_api_home/.config/taler/merchant/dtip.priv b/src/lib/test_merchant_api_home/.config/taler/merchant/dtip.priv new file mode 100644 index 00000000..ff3842bb --- /dev/null +++ b/src/lib/test_merchant_api_home/.config/taler/merchant/dtip.priv @@ -0,0 +1 @@ +47%Tҟ\v}"hP!.
\ No newline at end of file diff --git a/src/lib/test_merchant_api_home/.config/taler/merchant/reserve/dtip.priv b/src/lib/test_merchant_api_home/.config/taler/merchant/reserve/dtip.priv Binary files differnew file mode 100644 index 00000000..c586db18 --- /dev/null +++ b/src/lib/test_merchant_api_home/.config/taler/merchant/reserve/dtip.priv diff --git a/src/lib/test_merchant_api_home/.config/taler/merchant/reserve/tip.priv b/src/lib/test_merchant_api_home/.config/taler/merchant/reserve/tip.priv new file mode 100644 index 00000000..5ee3bce0 --- /dev/null +++ b/src/lib/test_merchant_api_home/.config/taler/merchant/reserve/tip.priv @@ -0,0 +1 @@ +V<gJΰXc;Ki"
\ No newline at end of file diff --git a/src/lib/test_merchant_api_home/.config/taler/merchant/tip.priv b/src/lib/test_merchant_api_home/.config/taler/merchant/tip.priv new file mode 100644 index 00000000..ba920729 --- /dev/null +++ b/src/lib/test_merchant_api_home/.config/taler/merchant/tip.priv @@ -0,0 +1 @@ +-ylx;b~2.l8Pĕb
\ No newline at end of file diff --git a/src/lib/test_merchant_api_home/.config/taler/merchant/tor.priv b/src/lib/test_merchant_api_home/.config/taler/merchant/tor.priv new file mode 100644 index 00000000..5d94c717 --- /dev/null +++ b/src/lib/test_merchant_api_home/.config/taler/merchant/tor.priv @@ -0,0 +1 @@ +d\2ȈaK#+Nf/FslG
\ No newline at end of file diff --git a/src/lib/test_merchant_api_home/.local/share/taler/merchant/merchant.priv b/src/lib/test_merchant_api_home/.local/share/taler/merchant/merchant.priv new file mode 100644 index 00000000..fd6e5f7f --- /dev/null +++ b/src/lib/test_merchant_api_home/.local/share/taler/merchant/merchant.priv @@ -0,0 +1 @@ +,Y%FF<R9ϳ5v\k46
\ No newline at end of file diff --git a/src/lib/test_merchant_api_new.c b/src/lib/test_merchant_api_new.c index e25f8881..de1dc09f 100644 --- a/src/lib/test_merchant_api_new.c +++ b/src/lib/test_merchant_api_new.c @@ -165,7 +165,7 @@ run (void *cls, TALER_TESTING_cmd_check_bank_transfer ("check_bank_transfer-2", - "http://localhost:8081/", + EXCHANGE_URL, "EUR:10.02", USER_ACCOUNT_NO, EXCHANGE_ACCOUNT_NO), TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-1", @@ -322,12 +322,12 @@ run (void *cls, TALER_TESTING_cmd_check_bank_transfer ("check_bank_transfer-2", - "http://localhost:8081/", + EXCHANGE_URL, "EUR:1", 63, 2), TALER_TESTING_cmd_check_bank_transfer ("check_bank_transfer-2", - "http://localhost:8081/", + EXCHANGE_URL, "EUR:4.01", 63, 2), TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-2", @@ -349,7 +349,7 @@ run (void *cls, TALER_TESTING_cmd_check_bank_transfer ("check_bank_transfer-498c", - "http://localhost:8081/", + EXCHANGE_URL, "EUR:4.98", 2, 62), TALER_TESTING_cmd_check_bank_empty ("check_bank_empty-2"), @@ -393,7 +393,7 @@ run (void *cls, TALER_TESTING_cmd_check_bank_transfer ("check_bank_transfer-498c-2", - "http://localhost:8081/", + EXCHANGE_URL, "EUR:4.98", EXCHANGE_ACCOUNT_NO, USER_ACCOUNT_NO), @@ -484,7 +484,7 @@ run (void *cls, TALER_TESTING_cmd_check_bank_transfer ("check_bank_transfer-tip-1", - "http://localhost:8081/", + EXCHANGE_URL, "EUR:20.04", USER_ACCOUNT_NO, EXCHANGE_ACCOUNT_NO), TALER_TESTING_cmd_tip_authorize ("authorize-tip-1", @@ -632,7 +632,7 @@ run (void *cls, CMD_EXEC_AGGREGATOR ("aggregator-tip-1"), TALER_TESTING_cmd_check_bank_transfer ("check_bank_transfer-tip-498c", - "http://localhost:8081/", + EXCHANGE_URL, "EUR:4.98", EXCHANGE_ACCOUNT_NO, USER_ACCOUNT_NO), TALER_TESTING_cmd_check_bank_empty ("check_bank_empty-at-tips"), @@ -652,7 +652,7 @@ run (void *cls, TALER_TESTING_cmd_check_bank_transfer ("check_bank_transfer-10", - "http://localhost:8081/", + EXCHANGE_URL, "EUR:10.02", USER_ACCOUNT_NO, EXCHANGE_ACCOUNT_NO), TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-10a", @@ -717,7 +717,7 @@ run (void *cls, TALER_TESTING_cmd_check_bank_transfer ("check_bank_transfer-9.97-10", - "http://localhost:8081/", + EXCHANGE_URL, "EUR:9.97", EXCHANGE_ACCOUNT_NO, USER_ACCOUNT_NO), @@ -732,7 +732,7 @@ run (void *cls, TALER_TESTING_cmd_check_bank_transfer ("check_bank_transfer-11", - "http://localhost:8081/", + EXCHANGE_URL, "EUR:10.02", USER_ACCOUNT_NO, EXCHANGE_ACCOUNT_NO), TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-11a", @@ -830,16 +830,14 @@ main (int argc, if (NULL == (fakebank_url = TALER_TESTING_prepare_fakebank (CONFIG_FILE, - "account-2"))) + "account-exchange"))) return 77; - if (NULL == - (merchant_url = TALER_TESTING_prepare_merchant (CONFIG_FILE))) + (merchant_url = TALER_TESTING_prepare_merchant (CONFIG_FILE))) return 77; TALER_TESTING_cleanup_files (CONFIG_FILE); - switch (TALER_TESTING_prepare_exchange (CONFIG_FILE, &exchange_url)) { diff --git a/src/lib/test_merchant_api_proxy_merchant.conf b/src/lib/test_merchant_api_proxy_merchant.conf index 706ac297..065d384e 100644 --- a/src/lib/test_merchant_api_proxy_merchant.conf +++ b/src/lib/test_merchant_api_proxy_merchant.conf @@ -11,7 +11,7 @@ HTTP_PORT = 8889 # HTTP Destination for twister, so the real # merchant URL. Note: no trailing '/'! -DESTINATION_BASE_URL = "http://localhost:8082" +DESTINATION_BASE_URL = "http://localhost:8080" # Control port for TCP # PORT = 8889 diff --git a/src/lib/test_merchant_api_twisted.c b/src/lib/test_merchant_api_twisted.c index 5a336444..3fc5b808 100644 --- a/src/lib/test_merchant_api_twisted.c +++ b/src/lib/test_merchant_api_twisted.c @@ -476,7 +476,7 @@ run (void *cls, TALER_TESTING_cmd_check_bank_transfer ("check_bank_transfer-2", - "http://localhost:8081/", + EXCHANGE_URL, "EUR:2.02", USER_ACCOUNT_NO, EXCHANGE_ACCOUNT_NO), TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-1", @@ -589,7 +589,7 @@ run (void *cls, TALER_TESTING_cmd_check_bank_transfer ("check_bank_transfer-abort-1", - "http://localhost:8081/", + EXCHANGE_URL, "EUR:1.01", USER_ACCOUNT_NO, EXCHANGE_ACCOUNT_NO), TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-abort-1", @@ -812,12 +812,12 @@ main (int argc, /* These environment variables get in the way... */ unsetenv ("XDG_DATA_HOME"); unsetenv ("XDG_CONFIG_HOME"); - GNUNET_log_setup ("test-merchant-api-new-twisted", + GNUNET_log_setup ("test-merchant-api-twisted", "DEBUG", NULL); if (NULL == (fakebank_url = TALER_TESTING_prepare_fakebank (CONFIG_FILE, - "account-1"))) + "account-exchange"))) return 77; if (NULL == (merchant_url = TALER_TESTING_prepare_merchant diff --git a/src/lib/test_merchant_api_twisted.conf b/src/lib/test_merchant_api_twisted.conf index 32d79290..f08fc122 100644 --- a/src/lib/test_merchant_api_twisted.conf +++ b/src/lib/test_merchant_api_twisted.conf @@ -4,3 +4,9 @@ [exchange-kudos] # must target the twister's http port. URL = http://localhost:8888/ + +# merchant: 8080 +# exchange: 8081 +# bank: 8082 +# twisted-merchant: 8888 +# twisted-control: 8889 diff --git a/src/lib/testing_api_helpers.c b/src/lib/testing_api_helpers.c index bca193c5..4213dbc8 100644 --- a/src/lib/testing_api_helpers.c +++ b/src/lib/testing_api_helpers.c @@ -43,8 +43,30 @@ struct GNUNET_OS_Process * TALER_TESTING_run_merchant (const char *config_filename) { + struct GNUNET_CONFIGURATION_Handle *cfg; struct GNUNET_OS_Process *merchant_proc; unsigned int iter; + unsigned long long port; + char *wget_cmd; + + cfg = GNUNET_CONFIGURATION_create (); + if (GNUNET_OK != + GNUNET_CONFIGURATION_load (cfg, + config_filename)) + MERCHANT_FAIL (); + if (GNUNET_OK != + GNUNET_CONFIGURATION_get_value_number (cfg, + "merchant", + "PORT", + &port)) + { + GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, + "merchant", + "PORT"); + GNUNET_CONFIGURATION_destroy (cfg); + MERCHANT_FAIL (); + } + GNUNET_CONFIGURATION_destroy (cfg); merchant_proc = GNUNET_OS_start_process (GNUNET_NO, @@ -57,6 +79,11 @@ TALER_TESTING_run_merchant (const char *config_filename) if (NULL == merchant_proc) MERCHANT_FAIL (); + GNUNET_asprintf (&wget_cmd, + "wget -q -t 1 -T 1 http://127.0.0.1:%llu/" + " -o /dev/null -O /dev/null", + port); + /* give child time to start and bind against the socket */ fprintf (stderr, "Waiting for `taler-merchant-httpd' to be ready\n"); @@ -65,9 +92,8 @@ TALER_TESTING_run_merchant (const char *config_filename) { if (10 == iter) { - fprintf ( - stderr, - "Failed to launch `taler-merchant-httpd' (or `wget')\n"); + fprintf (stderr, + "Failed to launch `taler-merchant-httpd' (or `wget')\n"); GNUNET_OS_process_kill (merchant_proc, SIGTERM); GNUNET_OS_process_wait (merchant_proc); @@ -78,9 +104,8 @@ TALER_TESTING_run_merchant (const char *config_filename) sleep (1); iter++; } - while (0 != system ( - "wget -q -t 1 -T 1 http://127.0.0.1:8082/" \ - " -o /dev/null -O /dev/null")); + while (0 != system (wget_cmd)); + GNUNET_free (wget_cmd); fprintf (stderr, "\n"); return merchant_proc; @@ -99,7 +124,6 @@ TALER_TESTING_run_merchant (const char *config_filename) char * TALER_TESTING_prepare_merchant (const char *config_filename) { - struct GNUNET_CONFIGURATION_Handle *cfg; unsigned long long port; struct GNUNET_OS_Process *dbinit_proc; @@ -108,14 +132,15 @@ TALER_TESTING_prepare_merchant (const char *config_filename) char *base_url; cfg = GNUNET_CONFIGURATION_create (); - - if (GNUNET_OK != GNUNET_CONFIGURATION_load - (cfg, config_filename)) + if (GNUNET_OK != + GNUNET_CONFIGURATION_load (cfg, + config_filename)) MERCHANT_FAIL (); - - if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number - (cfg, "merchant", - "PORT", &port)) + if (GNUNET_OK != + GNUNET_CONFIGURATION_get_value_number (cfg, + "merchant", + "PORT", + &port)) { GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, "merchant", @@ -126,8 +151,9 @@ TALER_TESTING_prepare_merchant (const char *config_filename) GNUNET_CONFIGURATION_destroy (cfg); - if (GNUNET_OK != GNUNET_NETWORK_test_port_free - (IPPROTO_TCP, (uint16_t) port)) + if (GNUNET_OK != + GNUNET_NETWORK_test_port_free (IPPROTO_TCP, + (uint16_t) port)) { fprintf (stderr, "Required port %llu not available, skipping.\n", @@ -137,14 +163,14 @@ TALER_TESTING_prepare_merchant (const char *config_filename) /* DB preparation */ if (NULL == - (dbinit_proc = GNUNET_OS_start_process ( - GNUNET_NO, - GNUNET_OS_INHERIT_STD_ALL, - NULL, NULL, NULL, - "taler-merchant-dbinit", - "taler-merchant-dbinit", - "-c", "test_merchant_api.conf", - "-r", NULL))) + (dbinit_proc = GNUNET_OS_start_process (GNUNET_NO, + GNUNET_OS_INHERIT_STD_ALL, + NULL, NULL, NULL, + "taler-merchant-dbinit", + "taler-merchant-dbinit", + "-c", "test_merchant_api.conf", + "-r", + NULL))) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to run taler-merchant-dbinit." @@ -175,9 +201,10 @@ TALER_TESTING_prepare_merchant (const char *config_filename) " `taler-merchant-dbinit'!\n"); MERCHANT_FAIL (); } - GNUNET_OS_process_destroy (dbinit_proc); + + GNUNET_asprintf (&base_url, "http://localhost:%llu/", port); |