From 2ee33e3cbcc5432d9a017e8484a882635de6d6d5 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sat, 11 Jan 2020 23:06:10 +0100 Subject: [PATCH] remove exchange-url argument from /admin/add/incoming --- src/bank-lib/test_bank_api.c | 47 ++++++++++++++------- src/benchmark/taler-exchange-benchmark.c | 3 +- src/include/taler_testing_lib.h | 18 +------- src/lib/testing_api_cmd_fakebank_transfer.c | 28 ++---------- 4 files changed, 37 insertions(+), 59 deletions(-) diff --git a/src/bank-lib/test_bank_api.c b/src/bank-lib/test_bank_api.c index 087e44848..d577bff95 100644 --- a/src/bank-lib/test_bank_api.c +++ b/src/bank-lib/test_bank_api.c @@ -42,8 +42,19 @@ /** * Fakebank URL. */ + static char *bank_url; +/** + * Account URL. + */ +static char *account_url; + +/** + * payto://-URL of another account. + */ +static char *payto_url; + /** * Handle to the Py-bank daemon. */ @@ -85,25 +96,18 @@ static void run (void *cls, struct TALER_TESTING_Interpreter *is) { - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "Bank serves at `%s'\n", - bank_url); - extern struct TALER_BANK_AuthenticationData AUTHS[]; struct TALER_TESTING_Command commands[] = { - TALER_TESTING_cmd_bank_history ("history-0", - bank_url, - TALER_TESTING_BANK_ACCOUNT_NUMBER, - TALER_BANK_DIRECTION_BOTH, - GNUNET_YES, + TALER_TESTING_cmd_bank_credits ("history-0", + account_url, NULL, 1), - /* WARNING: old API has expected http response code among - * the parameters, although it was always set as '200 OK' */ - TRANSFER ("debit-1", - "KUDOS:5.01", - TALER_TESTING_EXCHANGE_ACCOUNT_NUMBER, - TALER_TESTING_BANK_ACCOUNT_NUMBER, - "subject 1"), + TALER_TESTING_cmd_fakebank_transfer ("debit-1", + "KUDOS:5.01", + account_url, + payto_url, + NULL, + NULL, + "subject 1"), TALER_TESTING_cmd_bank_history ("history-1c", bank_url, TALER_TESTING_BANK_ACCOUNT_NUMBER, @@ -168,6 +172,17 @@ run (void *cls, TALER_TESTING_cmd_end () }; + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "Bank serves at `%s'\n", + bank_url); + GNUNET_asprintf (&account_url, + "%s/%s", + base_url, + "alice"); + GNUNET_asprintf (&payto_url, + "payto://x-taler-bank/%s/%s", + base_url, + "bob"); if (GNUNET_YES == WITH_FAKEBANK) TALER_TESTING_run_with_fakebank (is, commands, diff --git a/src/benchmark/taler-exchange-benchmark.c b/src/benchmark/taler-exchange-benchmark.c index b931c3c90..3f687f00e 100644 --- a/src/benchmark/taler-exchange-benchmark.c +++ b/src/benchmark/taler-exchange-benchmark.c @@ -65,8 +65,7 @@ enum BenchmarkError x_taler_bank.account_base_url, \ exchange_payto_url, \ "dummy_user", \ - "dummy_password", \ - "http://example.com/")) + "dummy_password")) /** diff --git a/src/include/taler_testing_lib.h b/src/include/taler_testing_lib.h index 33f070701..4b1c19376 100644 --- a/src/include/taler_testing_lib.h +++ b/src/include/taler_testing_lib.h @@ -722,10 +722,6 @@ TALER_TESTING_setup_with_auditor_and_exchange (TALER_TESTING_Main main_cb, * @param auth_username username identifying the @a * debit_account_no at the bank. * @param auth_password password for @a auth_username. - * @param exchange_url which exchange is involved in this transfer. - * This data is used for tracking purposes (FIXME: explain - * _how_). - * * @return the command. */ struct TALER_TESTING_Command @@ -734,8 +730,7 @@ TALER_TESTING_cmd_fakebank_transfer (const char *label, const char *account_base_url, const char *payto_credit_account, const char *auth_username, - const char *auth_password, - const char *exchange_url); + const char *auth_password); /** @@ -754,9 +749,6 @@ TALER_TESTING_cmd_fakebank_transfer (const char *label, * @param auth_password password for @a auth_username. * @param ref reference to a command that can offer a reserve * private key. - * @param exchange_url the exchage involved in the transfer, - * tipically receiving the money in order to fuel a reserve. - * * @return the command. */ struct TALER_TESTING_Command @@ -767,8 +759,7 @@ TALER_TESTING_cmd_fakebank_transfer_with_ref (const char *label, const char *auth_username, const char *auth_password, - const char *ref, - const char *exchange_url); + const char *ref); /** @@ -790,11 +781,7 @@ TALER_TESTING_cmd_fakebank_transfer_with_ref (const char *label, * instance, the configuration file will provide the private * key of the tipping reserve. This data will then used to * construct the wire transfer subject line. - * @param exchange_url which exchange is involved in this transfer. - * This data is used for tracking purposes (FIXME: explain - * _how_). * @param config_filename configuration file to use. - * * @return the command. */ struct TALER_TESTING_Command @@ -806,7 +793,6 @@ TALER_TESTING_cmd_fakebank_transfer_with_instance (const char *label, const char *auth_username, const char *auth_password, const char *instance, - const char *exchange_url, const char *config_filename); diff --git a/src/lib/testing_api_cmd_fakebank_transfer.c b/src/lib/testing_api_cmd_fakebank_transfer.c index e212fd31f..4b81e9dc8 100644 --- a/src/lib/testing_api_cmd_fakebank_transfer.c +++ b/src/lib/testing_api_cmd_fakebank_transfer.c @@ -16,10 +16,9 @@ License along with TALER; see the file COPYING. If not, see */ - /** * @file exchange-lib/testing_api_cmd_fakebank_transfer.c - * @brief implementation of a fakebank wire transfer command + * @brief implementation of a bank /admin/add/incoming command * @author Christian Grothoff * @author Marcello Stanisci */ @@ -101,14 +100,6 @@ struct FakebankTransferState */ struct GNUNET_TIME_Absolute timestamp; - /** - * Exchange URL. This value is fed to the bank when requesting - * the wire transfer; note: the bank needs it because a merchant - * might want to know which exchange performed a wire transfer to - * them, just by looking at bank records. - */ - const char *exchange_url; - /** * Merchant instance. Sometimes used to get the tip reserve * private key by reading the appropriate config section. @@ -416,7 +407,6 @@ fakebank_transfer_traits (void *cls, { struct FakebankTransferState *fts = cls; struct TALER_TESTING_Trait traits[] = { - TALER_TESTING_make_trait_url (0, fts->exchange_url), TALER_TESTING_make_trait_url (1, fts->debit_url), TALER_TESTING_MAKE_TRAIT_ROW_ID (&fts->serial_id), TALER_TESTING_MAKE_TRAIT_CREDIT_ACCOUNT (fts->payto_credit_account), @@ -450,7 +440,6 @@ fakebank_transfer_traits (void *cls, * @param auth_username username identifying the @a * debit_account_no at the bank. * @param auth_password password for @a auth_username. - * @param exchange_url which exchange is involved in this transfer. * @return the command. */ struct TALER_TESTING_Command @@ -460,8 +449,7 @@ TALER_TESTING_cmd_fakebank_transfer const char *account_base_url, const char *payto_credit_account, const char *auth_username, - const char *auth_password, - const char *exchange_url) + const char *auth_password) { struct FakebankTransferState *fts; @@ -470,7 +458,6 @@ TALER_TESTING_cmd_fakebank_transfer fts->payto_credit_account = payto_credit_account; fts->auth_username = auth_username; fts->auth_password = auth_password; - fts->exchange_url = exchange_url; if (GNUNET_OK != TALER_string_to_amount (amount, &fts->amount)) @@ -514,9 +501,6 @@ TALER_TESTING_cmd_fakebank_transfer * @param auth_password password for @a auth_username. * @param ref reference to a command that can offer a reserve * private key. - * @param exchange_url the exchage involved in the transfer, - * tipically receiving the money in order to fuel a reserve. - * * @return the command. */ struct TALER_TESTING_Command @@ -527,8 +511,7 @@ TALER_TESTING_cmd_fakebank_transfer_with_ref const char *payto_credit_account, const char *auth_username, const char *auth_password, - const char *ref, - const char *exchange_url) + const char *ref) { struct FakebankTransferState *fts; @@ -538,7 +521,6 @@ TALER_TESTING_cmd_fakebank_transfer_with_ref fts->auth_username = auth_username; fts->auth_password = auth_password; fts->reserve_reference = ref; - fts->exchange_url = exchange_url; if (GNUNET_OK != TALER_string_to_amount (amount, &fts->amount)) @@ -587,9 +569,7 @@ TALER_TESTING_cmd_fakebank_transfer_with_ref * instance, the configuration file will provide the private * key of the tipping reserve. This data will then used to * construct the wire transfer subject line. - * @param exchange_url which exchange is involved in this transfer. * @param config_filename configuration file to use. - * * @return the command. */ struct TALER_TESTING_Command @@ -601,7 +581,6 @@ TALER_TESTING_cmd_fakebank_transfer_with_instance const char *auth_username, const char *auth_password, const char *instance, - const char *exchange_url, const char *config_filename) { struct FakebankTransferState *fts; @@ -612,7 +591,6 @@ TALER_TESTING_cmd_fakebank_transfer_with_instance fts->auth_username = auth_username; fts->auth_password = auth_password; fts->instance = instance; - fts->exchange_url = exchange_url; fts->config_filename = config_filename; if (GNUNET_OK != TALER_string_to_amount (amount,