diff options
Diffstat (limited to 'src/testing/testing_api_cmd_bank_check.c')
-rw-r--r-- | src/testing/testing_api_cmd_bank_check.c | 86 |
1 files changed, 40 insertions, 46 deletions
diff --git a/src/testing/testing_api_cmd_bank_check.c b/src/testing/testing_api_cmd_bank_check.c index ed4cde461..77d120e09 100644 --- a/src/testing/testing_api_cmd_bank_check.c +++ b/src/testing/testing_api_cmd_bank_check.c @@ -1,6 +1,6 @@ /* This file is part of TALER - Copyright (C) 2018-2020 Taler Systems SA + Copyright (C) 2018-2022 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 @@ -91,26 +91,48 @@ check_bank_transfer_run (void *cls, struct TALER_Amount amount; char *debit_account; char *credit_account; - const char **exchange_base_url; - const char **debit_payto; - const char **credit_payto; + const char *exchange_base_url; + const char *debit_payto; + const char *credit_payto; + struct TALER_FAKEBANK_Handle *fakebank; (void) cmd; + { + const struct TALER_TESTING_Command *fakebank_cmd; + + fakebank_cmd + = TALER_TESTING_interpreter_get_command (is, + "fakebank"); + if (NULL == fakebank_cmd) + { + GNUNET_break (0); + TALER_TESTING_interpreter_fail (is); + return; + } + if (GNUNET_OK != + TALER_TESTING_get_trait_fakebank (fakebank_cmd, + &fakebank)) + { + GNUNET_break (0); + TALER_TESTING_interpreter_fail (is); + return; + } + } if (NULL == bcs->deposit_reference) { TALER_LOG_INFO ("Deposit reference NOT given\n"); - debit_payto = &bcs->debit_payto; - credit_payto = &bcs->credit_payto; - exchange_base_url = &bcs->exchange_base_url; + debit_payto = bcs->debit_payto; + credit_payto = bcs->credit_payto; + exchange_base_url = bcs->exchange_base_url; if (GNUNET_OK != TALER_string_to_amount (bcs->amount, &amount)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Failed to parse amount `%s' at %u\n", + "Failed to parse amount `%s' at %s\n", bcs->amount, - is->ip); + TALER_TESTING_interpreter_get_current_label (is)); TALER_TESTING_interpreter_fail (is); return; } @@ -145,27 +167,22 @@ check_bank_transfer_run (void *cls, TALER_TESTING_FAIL (is); amount = *amount_ptr; } - - - debit_account = TALER_xtalerbank_account_from_payto (*debit_payto); - credit_account = TALER_xtalerbank_account_from_payto (*credit_payto); - + 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_payto, debit_account); - GNUNET_log (GNUNET_ERROR_TYPE_INFO, "converted credit_payto (%s) to credit_account (%s)\n", - *credit_payto, + credit_payto, credit_account); - if (GNUNET_OK != - TALER_FAKEBANK_check_debit (is->fakebank, + TALER_FAKEBANK_check_debit (fakebank, &amount, debit_account, credit_account, - *exchange_base_url, + exchange_base_url, &bcs->wtid)) { GNUNET_break (0); @@ -217,7 +234,7 @@ check_bank_transfer_traits (void *cls, struct TALER_TESTING_Trait traits[] = { TALER_TESTING_make_trait_wtid (wtid_ptr), TALER_TESTING_make_trait_exchange_url ( - &bcs->exchange_base_url), + bcs->exchange_base_url), TALER_TESTING_trait_end () }; @@ -228,19 +245,6 @@ check_bank_transfer_traits (void *cls, } -/** - * Make a "bank check" CMD. It checks whether a - * particular wire transfer has been made or not. - * - * @param label the command label. - * @param exchange_base_url base url of the exchange involved in - * the wire transfer. - * @param amount the amount expected to be transferred. - * @param debit_payto the account that gave money. - * @param credit_payto the account that received money. - * - * @return the command - */ struct TALER_TESTING_Command TALER_TESTING_cmd_check_bank_transfer (const char *label, const char *exchange_base_url, @@ -270,19 +274,9 @@ TALER_TESTING_cmd_check_bank_transfer (const char *label, } -/** - * Define a "bank check" CMD that takes the input - * data from another CMD that offers it. - * - * @param label command label. - * @param deposit_reference reference to a CMD that is - * able to provide the "check bank transfer" operation - * input data. - * @return the command. - */ struct TALER_TESTING_Command -TALER_TESTING_cmd_check_bank_transfer_with_ref - (const char *label, +TALER_TESTING_cmd_check_bank_transfer_with_ref ( + const char *label, const char *deposit_reference) { struct BankCheckState *bcs; |