diff options
author | Christian Grothoff <christian@grothoff.org> | 2020-02-03 23:35:24 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2020-02-03 23:35:24 +0100 |
commit | 81523861ed6f35f4daed167e2db2093c9e78278e (patch) | |
tree | c7b8121f59c7915c3fed6ca96b5c41abc77cd4de /src/lib | |
parent | 8539445f6b72520e82260fc5f5b0b305f9873ad5 (diff) | |
download | sync-81523861ed6f35f4daed167e2db2093c9e78278e.tar.gz sync-81523861ed6f35f4daed167e2db2093c9e78278e.tar.bz2 sync-81523861ed6f35f4daed167e2db2093c9e78278e.zip |
fix the various FTBFS issues from the 1'2020 exchange API change(s)
Diffstat (limited to 'src/lib')
13 files changed, 70 insertions, 152 deletions
diff --git a/src/lib/test_sync_api.c b/src/lib/test_sync_api.c index c65e648..d22d4db 100644 --- a/src/lib/test_sync_api.c +++ b/src/lib/test_sync_api.c @@ -1,6 +1,6 @@ /* This file is part of TALER - Copyright (C) 2014-2019 Taler Systems SA + Copyright (C) 2014-2020 Taler Systems SA TALER is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -48,64 +48,65 @@ #define EXCHANGE_URL "http://localhost:8081/" /** - * URL of the fakebank. + * Account number of the exchange at the bank. */ -static char *fakebank_url; +#define EXCHANGE_ACCOUNT_NAME "2" /** - * Merchant base URL. + * Account number of some user. */ -static char *merchant_url; +#define USER_ACCOUNT_NAME "62" /** - * Sync base URL. + * Account number used by the merchant */ -static char *sync_url; +#define MERCHANT_ACCOUNT_NAME "3" /** - * Merchant process. + * Payto URI of the customer (payer). */ -static struct GNUNET_OS_Process *merchantd; +static char *payer_payto; /** - * Sync-httpd process. + * Payto URI of the exchange (escrow account). */ -static struct GNUNET_OS_Process *syncd; +static char *exchange_payto; /** - * Exchange base URL. + * Payto URI of the merchant (receiver). */ -static char *exchange_url; +static char *merchant_payto; /** - * Auditor base URL; only used to fix FTBFS. + * Configuration of the bank. */ -static char *auditor_url; +static struct TALER_TESTING_BankConfiguration bc; /** - * Account number of the exchange at the bank. + * Configuration of the exchange. */ -#define EXCHANGE_ACCOUNT_NO 2 +static struct TALER_TESTING_ExchangeConfiguration ec; /** - * Account number of some user. + * Merchant base URL. */ -#define USER_ACCOUNT_NO 62 +static char *merchant_url; /** - * Account number used by the merchant + * Sync base URL. */ -#define MERCHANT_ACCOUNT_NO 3 +static char *sync_url; /** - * User name. Never checked by fakebank. + * Merchant process. */ -#define USER_LOGIN_NAME "user42" +static struct GNUNET_OS_Process *merchantd; /** - * User password. Never checked by fakebank. + * Sync-httpd process. */ -#define USER_LOGIN_PASS "pass42" +static struct GNUNET_OS_Process *syncd; + /** * Execute the taler-exchange-wirewatch command with @@ -113,17 +114,13 @@ static char *auditor_url; * * @param label label to use for the command. */ -#define CMD_EXEC_WIREWATCH(label) \ - TALER_TESTING_cmd_exec_wirewatch (label, CONFIG_FILE) +static struct TALER_TESTING_Command +cmd_exec_wirewatch (char *label) +{ + return TALER_TESTING_cmd_exec_wirewatch (label, + CONFIG_FILE); +} -/** - * Execute the taler-exchange-aggregator command with - * our configuration file. - * - * @param label label to use for the command. - */ -#define CMD_EXEC_AGGREGATOR(label) \ - TALER_TESTING_cmd_exec_aggregator (label, CONFIG_FILE) /** * Run wire transfer of funds from some user's account to the @@ -133,25 +130,15 @@ static char *auditor_url; * @param amount amount to transfer, i.e. "EUR:1" * @param url exchange_url */ -#define CMD_TRANSFER_TO_EXCHANGE(label,amount) \ - TALER_TESTING_cmd_fakebank_transfer (label, amount, \ - fakebank_url, USER_ACCOUNT_NO, \ - EXCHANGE_ACCOUNT_NO, \ - USER_LOGIN_NAME, USER_LOGIN_PASS, \ - EXCHANGE_URL) - -/** - * Run wire transfer of funds from some user's account to the - * exchange. - * - * @param label label to use for the command. - * @param amount amount to transfer, i.e. "EUR:1" - */ -#define CMD_TRANSFER_TO_EXCHANGE_SUBJECT(label,amount,subject) \ - TALER_TESTING_cmd_fakebank_transfer_with_subject \ - (label, amount, fakebank_url, USER_ACCOUNT_NO, \ - EXCHANGE_ACCOUNT_NO, USER_LOGIN_NAME, USER_LOGIN_PASS, \ - subject) +static struct TALER_TESTING_Command +cmd_transfer_to_exchange (const char *label, + const char *amount) +{ + return TALER_TESTING_cmd_admin_add_incoming (label, + amount, + &bc.exchange_auth, + payer_payto); +} /** @@ -168,13 +155,13 @@ run (void *cls, /** * Move money to the exchange's bank account. */ - CMD_TRANSFER_TO_EXCHANGE ("create-reserve-1", + cmd_transfer_to_exchange ("create-reserve-1", "EUR:10.02"), /** * Make a reserve exist, according to the previous * transfer. */ - CMD_EXEC_WIREWATCH ("wirewatch-1"), + cmd_exec_wirewatch ("wirewatch-1"), TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-1", "create-reserve-1", @@ -264,7 +251,7 @@ run (void *cls, TALER_TESTING_run_with_fakebank (is, commands, - fakebank_url); + bc.exchange_auth.wire_gateway_url); } @@ -280,14 +267,18 @@ main (int argc, GNUNET_log_setup ("test-sync-api", "DEBUG", NULL); - if (NULL == - (fakebank_url = TALER_TESTING_prepare_fakebank - (CONFIG_FILE, - "account-exchange"))) + if (GNUNET_OK != + TALER_TESTING_prepare_fakebank (CONFIG_FILE, + "exchange-account-exchange", + &bc)) return 77; + payer_payto = ("payto://x-taler-bank/localhost/" USER_ACCOUNT_NAME); + exchange_payto = ("payto://x-taler-bank/localhost/" EXCHANGE_ACCOUNT_NAME); + merchant_payto = ("payto://x-taler-bank/localhost/" MERCHANT_ACCOUNT_NAME); if (NULL == (merchant_url = TALER_TESTING_prepare_merchant (CONFIG_FILE))) return 77; + TALER_TESTING_cleanup_files (CONFIG_FILE); if (NULL == (sync_url = SYNC_TESTING_prepare_sync (CONFIG_FILE))) @@ -296,8 +287,7 @@ main (int argc, TALER_TESTING_cleanup_files (CONFIG_FILE); switch (TALER_TESTING_prepare_exchange (CONFIG_FILE, - &auditor_url, - &exchange_url)) + &ec)) { case GNUNET_SYSERR: GNUNET_break (0); @@ -308,11 +298,13 @@ main (int argc, case GNUNET_OK: if (NULL == (merchantd = - TALER_TESTING_run_merchant (CONFIG_FILE, merchant_url))) + TALER_TESTING_run_merchant (CONFIG_FILE, + merchant_url))) return 1; if (NULL == (syncd = - SYNC_TESTING_run_sync (CONFIG_FILE, sync_url))) + SYNC_TESTING_run_sync (CONFIG_FILE, + sync_url))) return 1; ret = TALER_TESTING_setup_with_exchange (&run, diff --git a/src/lib/test_sync_api.conf b/src/lib/test_sync_api.conf index 81eb4ee..575bcfa 100644 --- a/src/lib/test_sync_api.conf +++ b/src/lib/test_sync_api.conf @@ -16,6 +16,10 @@ TALER_CACHE_HOME = $TALER_HOME/.cache/taler/ [taler] # What currency do we use? CURRENCY = EUR +CURRENCY_ROUND_UNIT = EUR:0.01 + +[bank] +HTTP_PORT = 8082 # Sync config @@ -39,11 +43,7 @@ CONFIG = postgres:///synccheck # Configuration for the merchant backend # ########################################## -[test] -INSTANCES = default tor - [merchant] - # Which port do we run the backend on? (HTTP server) PORT = 8080 @@ -70,77 +70,22 @@ CONFIG = postgres:///talercheck KEYFILE = ${TALER_CONFIG_HOME}/merchant/default.priv NAME = Kudos Inc. -[instance-tor] -KEYFILE = ${TALER_CONFIG_HOME}/merchant/tor.priv -NAME = The Tor Project - - -[instance-tip] -KEYFILE = ${TALER_CONFIG_HOME}/merchant/tip.priv -TIP_EXCHANGE = http://localhost:8081/ -TIP_RESERVE_PRIV_FILENAME = ${TALER_CONFIG_HOME}/merchant/reserve/tip.priv -NAME = Test Tipping Merchant - - -[instance-dtip] -KEYFILE = ${TALER_CONFIG_HOME}/merchant/dtip.priv -TIP_EXCHANGE = http://localhost:8081/ -TIP_RESERVE_PRIV_FILENAME = ${TALER_CONFIG_HOME}/merchant/reserve/dtip.priv -NAME = Test Tipping Merchant 2 - -[instance-nulltip] -KEYFILE = ${TALER_CONFIG_HOME}/merchant/nulltip.priv -TIP_EXCHANGE = http://localhost:8081/ -# This key will NEVER be used to create a reserve, so -# as to check tip authorization against a non-reserve -# key. -TIP_RESERVE_PRIV_FILENAME = ${TALER_CONFIG_HOME}/merchant/reserve/nulltip.priv -NAME = Test Null-Tipping Merchant - # Account of the MERCHANT -[account-merchant] +[merchant-account-merchant] # What is the merchant's bank account? -URL = "payto://x-taler-bank/localhost:8082/3" +PAYTO_URI = "payto://x-taler-bank/localhost:8082/3" # This is the *salted* response we give out for /contract requests. # File is generated on first use, no need for merchants to generate # the salt! WIRE_RESPONSE = ${TALER_CONFIG_HOME}/merchant/account-3.json -# Which wire plugin should we used to access the account? -# (use to validate payto://-URL and for back office) -PLUGIN = taler_bank - -# Authentication information for basic authentication -TALER_BANK_AUTH_METHOD = "basic" -USERNAME = user -PASSWORD = pass - # Accept payments to this account in instance-default HONOR_default = YES -# Accept payments to this account in instance-tor -HONOR_tor = YES - -# Accept payments to this account in instance-tip -HONOR_tip = YES - -# Accept payments to this account in instance-dtip -HONOR_dtip = YES - -HONOR_nulltip = YES - # Advertise in new contracts of instance-default ACTIVE_default = YES -# Advertise in new contracts of instance-default -ACTIVE_tor = YES - -# Advertise in new contracts of instance-default -ACTIVE_tip = YES - -# Advertise in new contracts of instance-default -ACTIVE_nulltip = YES # Sections starting with "exchange-" specify trusted exchanges # (by the merchant) @@ -213,26 +158,20 @@ CONFIG = "postgres:///talercheck" CONFIG = postgres:///talercheck # Account of the EXCHANGE -[account-exchange] +[exchange-account-exchange] # What is the exchange's bank account (with the "Taler Bank" demo system)? -URL = "payto://x-taler-bank/localhost:8082/2" +PAYTO_URI = "payto://x-taler-bank/localhost:8082/2" # 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}/exchange/account-2.json -# Which wire plugin should we used to access the account? -PLUGIN = taler_bank - -# Authentication information for basic authentication -TALER_BANK_AUTH_METHOD = "basic" -USERNAME = user -PASSWORD = pass +WIRE_GATEWAY_URL = "http://localhost:8082/2/" +WIRE_GATEWAY_AUTH_METHOD = NONE ENABLE_DEBIT = YES ENABLE_CREDIT = YES - # wire fees [fees-x-taler-bank] diff --git a/src/lib/test_sync_api_home/.config/taler/exchange/account-2.json b/src/lib/test_sync_api_home/.config/taler/exchange/account-2.json index 858eca9..567fc91 100644 --- a/src/lib/test_sync_api_home/.config/taler/exchange/account-2.json +++ b/src/lib/test_sync_api_home/.config/taler/exchange/account-2.json @@ -1,5 +1,4 @@ { - "url": "payto://x-taler-bank/localhost:8082/2", - "master_sig": "AM32QB4RYMWK548PE63PJXJMWSA001TFFWTZZPSSD8HQ8JE4D5V5X8WTSYSX59ANF4YRTRMF5Q4Q12CE2KTA8KQ03CM11YDTK75SJ20", - "master_pub": "T1VVFQZZARQ1CMF4BN58EE7SKTW5AV2BS18S87ZEGYS4S29J6DNG" + "payto_uri": "payto://x-taler-bank/localhost:8082/2", + "master_sig": "AM32QB4RYMWK548PE63PJXJMWSA001TFFWTZZPSSD8HQ8JE4D5V5X8WTSYSX59ANF4YRTRMF5Q4Q12CE2KTA8KQ03CM11YDTK75SJ20" }
\ No newline at end of file diff --git a/src/lib/test_sync_api_home/.config/taler/merchant/account-3.json b/src/lib/test_sync_api_home/.config/taler/merchant/account-3.json index 2b8a81d..99513fc 100644 --- a/src/lib/test_sync_api_home/.config/taler/merchant/account-3.json +++ b/src/lib/test_sync_api_home/.config/taler/merchant/account-3.json @@ -1 +1 @@ -{"salt":"NEHC5SP52WZRSZR8CTE3SV2JSZX2C1XFSA75YNRT6YJARRR2ERM32PMTHP16CT6TV7G2CX7T3J28YFP0PJP1PAMAQVT6J76RF3AE34R","url":"payto://x-taler-bank/localhost:8082/3"}
\ No newline at end of file +{"payto_uri":"payto://x-taler-bank/localhost:8082/3","salt":"ZEK9AQD9PA1V9Z4Y3NJ9W633Z0R6BECVGRS7GRRTZ0W5X494S3FC4TX8T5N59E84JQZRGA6MZ7HB9AEX7XMKCN4SN64MDK5YDX9NYZR"}
\ No newline at end of file diff --git a/src/lib/test_sync_api_home/.config/taler/merchant/dtip.priv b/src/lib/test_sync_api_home/.config/taler/merchant/dtip.priv deleted file mode 100644 index ff3842b..0000000 --- a/src/lib/test_sync_api_home/.config/taler/merchant/dtip.priv +++ /dev/null @@ -1 +0,0 @@ -47%Tҟ\v}"hP!.
\ No newline at end of file diff --git a/src/lib/test_sync_api_home/.config/taler/merchant/nulltip.priv b/src/lib/test_sync_api_home/.config/taler/merchant/nulltip.priv deleted file mode 100644 index db695e5..0000000 --- a/src/lib/test_sync_api_home/.config/taler/merchant/nulltip.priv +++ /dev/null @@ -1,2 +0,0 @@ -by~]m~r1fcT04Q -ds
\ No newline at end of file diff --git a/src/lib/test_sync_api_home/.config/taler/merchant/reserve/dtip.priv b/src/lib/test_sync_api_home/.config/taler/merchant/reserve/dtip.priv Binary files differdeleted file mode 100644 index c586db1..0000000 --- a/src/lib/test_sync_api_home/.config/taler/merchant/reserve/dtip.priv +++ /dev/null diff --git a/src/lib/test_sync_api_home/.config/taler/merchant/reserve/nulltip.priv b/src/lib/test_sync_api_home/.config/taler/merchant/reserve/nulltip.priv deleted file mode 100644 index edf062e..0000000 --- a/src/lib/test_sync_api_home/.config/taler/merchant/reserve/nulltip.priv +++ /dev/null @@ -1 +0,0 @@ -Bu#ĜW0*~$ROpk
\ No newline at end of file diff --git a/src/lib/test_sync_api_home/.config/taler/merchant/reserve/tip.priv b/src/lib/test_sync_api_home/.config/taler/merchant/reserve/tip.priv deleted file mode 100644 index 5ee3bce..0000000 --- a/src/lib/test_sync_api_home/.config/taler/merchant/reserve/tip.priv +++ /dev/null @@ -1 +0,0 @@ -V<gJΰXc;Ki"
\ No newline at end of file diff --git a/src/lib/test_sync_api_home/.config/taler/merchant/tip.priv b/src/lib/test_sync_api_home/.config/taler/merchant/tip.priv deleted file mode 100644 index ba92072..0000000 --- a/src/lib/test_sync_api_home/.config/taler/merchant/tip.priv +++ /dev/null @@ -1 +0,0 @@ --ylx;b~2.l8Pĕb
\ No newline at end of file diff --git a/src/lib/test_sync_api_home/.config/taler/merchant/tor.priv b/src/lib/test_sync_api_home/.config/taler/merchant/tor.priv deleted file mode 100644 index 5d94c71..0000000 --- a/src/lib/test_sync_api_home/.config/taler/merchant/tor.priv +++ /dev/null @@ -1 +0,0 @@ -d\2ȈaK#+Nf/FslG
\ No newline at end of file diff --git a/src/lib/test_sync_api_home/.config/taler/merchant/wire/test.json b/src/lib/test_sync_api_home/.config/taler/merchant/wire/test.json deleted file mode 100644 index 6898b00..0000000 --- a/src/lib/test_sync_api_home/.config/taler/merchant/wire/test.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "type":"test", - "bank_url":"http://localhost:8083/", - "account_number":62 -} diff --git a/src/lib/test_sync_api_home/.local/share/taler/exchange/wirefees/x-taler-bank.fee b/src/lib/test_sync_api_home/.local/share/taler/exchange/wirefees/x-taler-bank.fee Binary files differindex 1079877..90605f1 100644 --- a/src/lib/test_sync_api_home/.local/share/taler/exchange/wirefees/x-taler-bank.fee +++ b/src/lib/test_sync_api_home/.local/share/taler/exchange/wirefees/x-taler-bank.fee |