From 7b25787a4b8ac0a0b3cbc2174ba3cac9c564346a Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 30 May 2022 16:31:24 +0200 Subject: -generate 404 on non-existing accounts for fakebank, use payto://-URIs with receiver-name in tests --- src/auditor/taler-auditor.in | 15 ++- src/auditor/taler-helper-auditor-wire.c | 22 +++- src/bank-lib/fakebank.c | 121 ++++++++++++++++++--- src/bank-lib/test_bank.sh | 7 +- src/exchange/taler-exchange-wirewatch.c | 5 +- src/include/taler_testing_lib.h | 2 +- src/include/taler_util.h | 10 ++ src/testing/Makefile.am | 32 +----- .../test-taler-exchange-aggregator-postgres.conf | 2 +- .../test-taler-exchange-wirewatch-postgres.conf | 2 +- src/testing/test_auditor_api-cs.conf | 4 +- src/testing/test_auditor_api-rsa.conf | 4 +- src/testing/test_auditor_api.c | 2 +- src/testing/test_bank_api_fakebank.conf | 2 +- src/testing/test_bank_api_fakebank_twisted.conf | 4 +- src/testing/test_bank_api_pybank.conf | 21 ---- src/testing/test_bank_api_pybank_twisted.conf | 43 -------- src/testing/test_exchange_api-cs.conf | 4 +- src/testing/test_exchange_api-rsa.conf | 4 +- src/testing/test_exchange_api.c | 2 +- .../test_exchange_api_keys_cherry_picking-cs.conf | 4 +- .../test_exchange_api_keys_cherry_picking-rsa.conf | 4 +- .../test_exchange_api_keys_cherry_picking.c | 2 +- .../test_exchange_api_overlapping_keys_bug.c | 2 +- src/testing/test_exchange_api_revocation.c | 2 +- src/testing/test_exchange_api_twisted-cs.conf | 4 +- src/testing/test_exchange_api_twisted-rsa.conf | 4 +- src/testing/test_exchange_api_twisted.c | 2 +- src/testing/test_exchange_management_api.c | 14 +-- src/testing/test_exchange_p2p.c | 2 +- src/testing/test_kyc_api.c | 2 +- src/testing/test_kyc_api.conf | 4 +- src/testing/test_taler_exchange_aggregator.c | 6 +- src/testing/test_taler_exchange_wirewatch.c | 2 +- src/testing/testing_api_cmd_auditor_exec_auditor.c | 1 + .../testing_api_cmd_bank_admin_add_incoming.c | 9 +- src/testing/testing_api_cmd_bank_history_credit.c | 20 +++- src/testing/testing_api_cmd_bank_history_debit.c | 18 ++- src/testing/testing_api_cmd_batch_withdraw.c | 6 +- src/testing/testing_api_cmd_exec_closer.c | 3 +- src/testing/testing_api_cmd_insert_deposit.c | 3 +- src/testing/testing_api_cmd_purse_deposit.c | 3 +- src/testing/testing_api_cmd_purse_merge.c | 3 +- src/testing/testing_api_cmd_recoup.c | 3 +- src/testing/testing_api_cmd_reserve_history.c | 60 +++++----- src/testing/testing_api_cmd_reserve_status.c | 52 +++++---- src/testing/testing_api_cmd_withdraw.c | 3 +- src/testing/testing_api_helpers_bank.c | 8 +- src/util/payto.c | 22 +++- 49 files changed, 331 insertions(+), 245 deletions(-) delete mode 100644 src/testing/test_bank_api_pybank.conf delete mode 100644 src/testing/test_bank_api_pybank_twisted.conf diff --git a/src/auditor/taler-auditor.in b/src/auditor/taler-auditor.in index c8ea6b0c9..6a8e88daa 100644 --- a/src/auditor/taler-auditor.in +++ b/src/auditor/taler-auditor.in @@ -11,6 +11,7 @@ Arguments mandatory for long options are also mandatory for short options. -h, --help print this help -i, --internal perform checks only applicable for exchange-internal audits + -I, --ignore-not-found ignore problems with the exchange bank account not existing -L, --log=LOGLEVEL configure logging to use LOGLEVEL -l, --logfile=FILENAME configure logging to write logs to FILENAME -m, --exchange-key=KEY public key of the exchange (Crockford base32 @@ -28,7 +29,7 @@ EOF function optcheck { -TEMP=`getopt -o c:hiL:l:m:T:v --long config:,help,internal,log:,logfile:exchange-key:,timetravel:,version -n 'taler-auditor' -- "$@"` +TEMP=`getopt -o c:hiIL:l:m:T:v --long config:,help,internal,ignore-not-found,log:,logfile:exchange-key:,timetravel:,version -n 'taler-auditor' -- "$@"` if [ $? != 0 ] ; then @@ -43,6 +44,7 @@ DEBUG=false MEMORY= DEBUGFILE= JAVA_MISC_OPT= +INF= while true; do case "$1" in -c | --config ) shift 2 ;; @@ -51,6 +53,7 @@ while true; do exit 0 ;; -i | --internal ) shift ;; + -I | --ignore-not-found ) INF="-I"; shift ;; -L | --log ) shift 2;; -l | --logfile ) shift ;; -m | --exchange-key ) shift 2 ;; @@ -74,16 +77,20 @@ done } # End of function 'optcheck' - optcheck "$@" +# Remove "-I" from $@ if present, store result in $ARGS. +ARGS=("$@") +ARGS=(${ARGS[@]/$INF}) DIR=`mktemp -d reportXXXXXX` -for n in aggregation coins deposits reserves wire +for n in aggregation coins deposits reserves do - taler-helper-auditor-$n "$@" > ${DIR}/$n.json + taler-helper-auditor-$n ${ARGS[*]} > ${DIR}/$n.json done +taler-helper-auditor-wire $INF ${ARGS[*]} > ${DIR}/wire.json + taler-helper-auditor-render.py \ ${DIR}/aggregation.json \ ${DIR}/coins.json \ diff --git a/src/auditor/taler-helper-auditor-wire.c b/src/auditor/taler-helper-auditor-wire.c index 274344ff6..2cc70a940 100644 --- a/src/auditor/taler-helper-auditor-wire.c +++ b/src/auditor/taler-helper-auditor-wire.c @@ -304,6 +304,12 @@ static struct GNUNET_CURL_RescheduleContext *rc; */ static int internal_checks; +/** + * Should we ignore if the bank does not know our bank + * account? + */ +static int ignore_account_404; + /* ***************************** Shutdown **************************** */ /** @@ -1166,7 +1172,7 @@ check_rc_matches (void *cls, * @param value the `struct ReserveOutInfo` to report * @return #GNUNET_OK */ -static int +static enum GNUNET_GenericReturnValue complain_out_not_found (void *cls, const struct GNUNET_HashCode *key, void *value) @@ -1275,7 +1281,7 @@ check_exchange_wire_out (struct WireAccount *wa) * @param json original response in JSON format * @return #GNUNET_OK to continue, #GNUNET_SYSERR to abort iteration */ -static int +static enum GNUNET_GenericReturnValue history_debit_cb (void *cls, unsigned int http_status_code, enum TALER_ErrorCode ec, @@ -1291,7 +1297,9 @@ history_debit_cb (void *cls, if (NULL == details) { wa->dhh = NULL; - if (TALER_EC_NONE != ec) + if ( (TALER_EC_NONE != ec) && + ( (! ignore_account_404) || + (MHD_HTTP_NOT_FOUND != http_status_code) ) ) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Error fetching debit history of account %s: %u/%u!\n", @@ -1584,7 +1592,9 @@ history_credit_cb (void *cls, if (NULL == details) { wa->chh = NULL; - if (TALER_EC_NONE != ec) + if ( (TALER_EC_NONE != ec) && + ( (! ignore_account_404) || + (MHD_HTTP_NOT_FOUND != http_status) ) ) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Error fetching credit history of account %s: %u/%s!\n", @@ -2177,6 +2187,10 @@ main (int argc, "internal", "perform checks only applicable for exchange-internal audits", &internal_checks), + GNUNET_GETOPT_option_flag ('I', + "ignore-not-found", + "continue, even if the bank account of the exchange was not found", + &ignore_account_404), GNUNET_GETOPT_option_base32_auto ('m', "exchange-key", "KEY", diff --git a/src/bank-lib/fakebank.c b/src/bank-lib/fakebank.c index 624b4069a..2e066c02c 100644 --- a/src/bank-lib/fakebank.c +++ b/src/bank-lib/fakebank.c @@ -159,6 +159,11 @@ struct Account */ char *account_name; + /** + * Receiver name for payto:// URIs. + */ + char *receiver_name; + /** * Current account balance. */ @@ -618,11 +623,14 @@ lp_expiration_thread (void *cls) * * @param[in,out] h bank to lookup account at * @param name account name to resolve - * @return account handle (never NULL) + * @param receiver_name receiver name in payto:// URI, + * NULL if the account must already exist + * @return account handle, NULL if account does not yet exist */ static struct Account * lookup_account (struct TALER_FAKEBANK_Handle *h, - const char *name) + const char *name, + const char *receiver_name) { struct GNUNET_HashCode hc; size_t slen; @@ -641,8 +649,15 @@ lookup_account (struct TALER_FAKEBANK_Handle *h, &hc); if (NULL == account) { + if (NULL == receiver_name) + { + GNUNET_assert (0 == + pthread_mutex_unlock (&h->accounts_lock)); + return NULL; + } account = GNUNET_new (struct Account); account->account_name = GNUNET_strdup (name); + account->receiver_name = GNUNET_strdup (receiver_name); GNUNET_assert (GNUNET_OK == TALER_amount_set_zero (h->currency, &account->balance)); @@ -724,9 +739,31 @@ TALER_FAKEBANK_check_debit (struct TALER_FAKEBANK_Handle *h, strcasecmp (want_amount->currency, h->currency)); debit_account = lookup_account (h, - want_debit); + want_debit, + NULL); credit_account = lookup_account (h, - want_credit); + want_credit, + NULL); + if (NULL == debit_account) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "I wanted: %s->%s (%s) from exchange %s (DEBIT), but debit account does not even exist!\n", + want_debit, + want_credit, + TALER_amount2s (want_amount), + exchange_base_url); + return GNUNET_SYSERR; + } + if (NULL == credit_account) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "I wanted: %s->%s (%s) from exchange %s (DEBIT), but credit account does not even exist!\n", + want_debit, + want_credit, + TALER_amount2s (want_amount), + exchange_base_url); + return GNUNET_SYSERR; + } for (struct Transaction *t = debit_account->out_tail; NULL != t; t = t->prev_out) @@ -770,9 +807,31 @@ TALER_FAKEBANK_check_credit (struct TALER_FAKEBANK_Handle *h, GNUNET_assert (0 == strcasecmp (want_amount->currency, h->currency)); debit_account = lookup_account (h, - want_debit); + want_debit, + NULL); credit_account = lookup_account (h, - want_credit); + want_credit, + NULL); + if (NULL == debit_account) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "I wanted:\n%s -> %s (%s) with subject %s (CREDIT) but debit account is unknown.\n", + want_debit, + want_credit, + TALER_amount2s (want_amount), + TALER_B2S (reserve_pub)); + return GNUNET_SYSERR; + } + if (NULL == credit_account) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "I wanted:\n%s -> %s (%s) with subject %s (CREDIT) but credit account is unknown.\n", + want_debit, + want_credit, + TALER_amount2s (want_amount), + TALER_B2S (reserve_pub)); + return GNUNET_SYSERR; + } for (struct Transaction *t = credit_account->in_tail; NULL != t; t = t->prev_in) @@ -1012,8 +1071,10 @@ make_transfer ( url_len = strlen (exchange_base_url); GNUNET_assert (url_len < MAX_URL_LEN); debit_acc = lookup_account (h, + debit_account, debit_account); credit_acc = lookup_account (h, + credit_account, credit_account); if (NULL != request_uid) { @@ -1132,10 +1193,11 @@ make_admin_transfer ( credit_account, strlen ("payto://"))); debit_acc = lookup_account (h, + debit_account, debit_account); credit_acc = lookup_account (h, + credit_account, credit_account); - GNUNET_assert (0 == pthread_mutex_lock (&h->rpubs_lock)); t = GNUNET_CONTAINER_multipeermap_get (h->rpubs, @@ -1217,6 +1279,7 @@ free_account (void *cls, (void) key; GNUNET_assert (NULL == account->lp_head); GNUNET_free (account->account_name); + GNUNET_free (account->receiver_name); GNUNET_free (account); return GNUNET_OK; } @@ -1567,7 +1630,7 @@ handle_transfer (struct TALER_FAKEBANK_Handle *h, return (GNUNET_NO == ret) ? MHD_YES : MHD_NO; } { - int ret; + enum GNUNET_GenericReturnValue ret; credit = TALER_xtalerbank_account_from_payto (credit_account); if (NULL == credit) @@ -1961,10 +2024,19 @@ handle_debit_history (struct TALER_FAKEBANK_Handle *h, if (&special_ptr == *con_cls) ha.lp_timeout = GNUNET_TIME_UNIT_ZERO; acc = lookup_account (h, - account); + account, + NULL); + if (NULL == acc) + { + return TALER_MHD_reply_with_error (connection, + MHD_HTTP_NOT_FOUND, + TALER_EC_BANK_UNKNOWN_ACCOUNT, + account); + } GNUNET_asprintf (&debit_payto, - "payto://x-taler-bank/localhost/%s", - account); + "payto://x-taler-bank/localhost/%s?receiver-name=%s", + account, + acc->receiver_name); history = json_array (); if (NULL == history) { @@ -2085,8 +2157,10 @@ handle_debit_history (struct TALER_FAKEBANK_Handle *h, continue; } GNUNET_asprintf (&credit_payto, - "payto://x-taler-bank/localhost/%s", - pos->credit_account->account_name); + "payto://x-taler-bank/localhost/%s?receiver-name=%s", + pos->credit_account->account_name, + pos->credit_account->receiver_name); + trans = GNUNET_JSON_PACK ( GNUNET_JSON_pack_uint64 ("row_id", pos->row_id), @@ -2180,12 +2254,22 @@ handle_credit_history (struct TALER_FAKEBANK_Handle *h, ha.lp_timeout = GNUNET_TIME_UNIT_ZERO; *con_cls = &special_ptr; acc = lookup_account (h, - account); + account, + NULL); + if (NULL == acc) + { + return TALER_MHD_reply_with_error (connection, + MHD_HTTP_NOT_FOUND, + TALER_EC_BANK_UNKNOWN_ACCOUNT, + account); + } history = json_array (); GNUNET_assert (NULL != history); GNUNET_asprintf (&credit_payto, - "payto://x-taler-bank/localhost/%s", - account); + "payto://x-taler-bank/localhost/%s?receiver-name=%s", + account, + acc->receiver_name); + GNUNET_assert (0 == pthread_mutex_lock (&h->big_lock)); if (! ha.have_start) @@ -2289,8 +2373,9 @@ handle_credit_history (struct TALER_FAKEBANK_Handle *h, continue; } GNUNET_asprintf (&debit_payto, - "payto://x-taler-bank/localhost/%s", - pos->debit_account->account_name); + "payto://x-taler-bank/localhost/%s?receiver-name=%s", + pos->debit_account->account_name, + pos->debit_account->receiver_name); trans = GNUNET_JSON_PACK ( GNUNET_JSON_pack_uint64 ("row_id", pos->row_id), diff --git a/src/bank-lib/test_bank.sh b/src/bank-lib/test_bank.sh index 46be326b4..ab76d2bad 100755 --- a/src/bank-lib/test_bank.sh +++ b/src/bank-lib/test_bank.sh @@ -49,7 +49,7 @@ echo -n "Making wire transfer to exchange ..." taler-exchange-wire-gateway-client \ -b http://localhost:8899/exchange/ \ -S 0ZSX8SH0M30KHX8K3Y1DAMVGDQV82XEF9DG1HC4QMQ3QWYT4AF00 \ - -D payto://x-taler-bank/localhost:8899/user \ + -D payto://x-taler-bank/localhost:8899/user?receiver-name=user \ -a TESTKUDOS:4 > /dev/null echo " OK" @@ -64,8 +64,9 @@ echo -n "Making wire transfer from exchange..." ./taler-exchange-wire-gateway-client \ -b http://localhost:8899/exchange/ \ -S 0ZSX8SH0M30KHX8K3Y1DAMVGDQV82XEF9DG1HC4QMQ3QWYT4AF00 \ - -C payto://x-taler-bank/localhost:8899/merchant \ - -a TESTKUDOS:2 > /dev/null + -C payto://x-taler-bank/localhost:8899/merchant?receiver-name=merchant \ + -a TESTKUDOS:2 \ + -L DEBUG > /dev/null echo " OK" diff --git a/src/exchange/taler-exchange-wirewatch.c b/src/exchange/taler-exchange-wirewatch.c index 342068cad..c69ce1ac8 100644 --- a/src/exchange/taler-exchange-wirewatch.c +++ b/src/exchange/taler-exchange-wirewatch.c @@ -623,8 +623,9 @@ history_cb (void *cls, if (NULL == details) { wa->hh = NULL; - if ( (TALER_EC_NONE != ec) || - (MHD_HTTP_OK != http_status) ) + if ( (MHD_HTTP_NO_CONTENT != http_status) && + ( (TALER_EC_NONE != ec) || + (MHD_HTTP_OK != http_status) ) ) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Error fetching history: %s (%u)\n", diff --git a/src/include/taler_testing_lib.h b/src/include/taler_testing_lib.h index 157eaae3c..1781e0280 100644 --- a/src/include/taler_testing_lib.h +++ b/src/include/taler_testing_lib.h @@ -2756,7 +2756,6 @@ TALER_TESTING_get_trait (const struct TALER_TESTING_Trait *traits, op (contract_terms, const json_t) \ op (wire_details, const json_t) \ op (exchange_keys, const json_t) \ - op (reserve_history, const struct TALER_EXCHANGE_ReserveHistoryEntry) \ op (exchange_url, const char *) \ op (exchange_bank_account_url, const char *) \ op (taler_uri, const char *) \ @@ -2791,6 +2790,7 @@ TALER_TESTING_get_trait (const struct TALER_TESTING_Trait *traits, op (age_commitment, const struct TALER_AgeCommitment) \ op (age_commitment_proof, const struct TALER_AgeCommitmentProof) \ op (h_age_commitment, const struct TALER_AgeCommitmentHash) \ + op (reserve_history, const struct TALER_EXCHANGE_ReserveHistoryEntry) \ op (planchet_secrets, const struct TALER_PlanchetMasterSecretP) \ op (exchange_wd_value, const struct TALER_ExchangeWithdrawValues) \ op (coin_priv, const struct TALER_CoinSpendPrivateKeyP) \ diff --git a/src/include/taler_util.h b/src/include/taler_util.h index ee17557a4..607d76724 100644 --- a/src/include/taler_util.h +++ b/src/include/taler_util.h @@ -385,6 +385,16 @@ char * TALER_xtalerbank_account_from_payto (const char *payto); +/** + * Obtain the receiver name from a payto URL. + * + * @param payto an x-taler-bank payto URL + * @return only the receiver name from the @a payto URL, NULL if not an x-taler-bank payto URL + */ +char * +TALER_payto_get_receiver_name (const char *payto); + + /** * Extract the subject value from the URI parameters. * diff --git a/src/testing/Makefile.am b/src/testing/Makefile.am index ab72d9729..fefb7c984 100644 --- a/src/testing/Makefile.am +++ b/src/testing/Makefile.am @@ -139,7 +139,6 @@ check_PROGRAMS = \ test_auditor_api_version_rsa \ test_auditor_api_version_cs \ test_bank_api_with_fakebank \ - test_bank_api_with_pybank \ test_bank_api_with_nexus \ test_exchange_api_cs \ test_exchange_api_rsa \ @@ -158,8 +157,7 @@ if HAVE_TWISTER check_PROGRAMS += \ test_exchange_api_twisted_cs \ test_exchange_api_twisted_rsa \ - test_bank_api_with_fakebank_twisted \ - test_bank_api_with_pybank_twisted + test_bank_api_with_fakebank_twisted endif @@ -246,15 +244,6 @@ test_bank_api_with_fakebank_LDADD = \ $(top_builddir)/src/bank-lib/libtalerbank.la \ $(XLIB) -test_bank_api_with_pybank_SOURCES = \ - test_bank_api.c -test_bank_api_with_pybank_LDADD = \ - libtalertesting.la \ - $(top_builddir)/src/lib/libtalerexchange.la \ - -lgnunetutil \ - $(top_builddir)/src/bank-lib/libtalerbank.la \ - $(XLIB) - test_exchange_api_cs_SOURCES = \ test_exchange_api.c test_exchange_api_cs_LDADD = \ @@ -523,23 +512,6 @@ test_bank_api_with_fakebank_twisted_LDADD = \ -ljansson \ $(XLIB) -test_bank_api_with_pybank_twisted_SOURCES = \ - test_bank_api_twisted.c -test_bank_api_with_pybank_twisted_LDADD = \ - libtalertesting.la \ - $(top_builddir)/src/bank-lib/libtalerbank.la \ - $(top_builddir)/src/bank-lib/libtalerfakebank.la \ - $(top_builddir)/src/lib/libtalerexchange.la \ - $(top_builddir)/src/json/libtalerjson.la \ - libtalertwistertesting.la \ - -lgnunettesting \ - -lgnunetjson \ - -lgnunetcurl \ - -lgnunetutil \ - -ljansson \ - $(XLIB) - - test_kyc_api_SOURCES = \ test_kyc_api.c test_kyc_api_LDADD = \ @@ -565,8 +537,6 @@ EXTRA_DIST = \ test_auditor_api_expire_reserve_now-rsa.conf \ test_bank_api_fakebank.conf \ test_bank_api_fakebank_twisted.conf \ - test_bank_api_pybank.conf \ - test_bank_api_pybank_twisted.conf \ test_exchange_api_home/.config/taler/account-2.json \ test_exchange_api_home/.local/share/taler/exchange-offline/master.priv \ test_exchange_api_home/.local/share/taler/exchange/offline-keys/master.priv \ diff --git a/src/testing/test-taler-exchange-aggregator-postgres.conf b/src/testing/test-taler-exchange-aggregator-postgres.conf index dfa017d0d..d3c6c4f2f 100644 --- a/src/testing/test-taler-exchange-aggregator-postgres.conf +++ b/src/testing/test-taler-exchange-aggregator-postgres.conf @@ -69,7 +69,7 @@ LEGAL_RESERVE_EXPIRATION_TIME = 7 years [exchange-account-1] # What is the account URL? -PAYTO_URI = "payto://x-taler-bank/localhost/2" +PAYTO_URI = "payto://x-taler-bank/localhost/2?receiver-name=2" ENABLE_DEBIT = YES ENABLE_CREDIT = YES diff --git a/src/testing/test-taler-exchange-wirewatch-postgres.conf b/src/testing/test-taler-exchange-wirewatch-postgres.conf index fda1acd77..ae8ba2329 100644 --- a/src/testing/test-taler-exchange-wirewatch-postgres.conf +++ b/src/testing/test-taler-exchange-wirewatch-postgres.conf @@ -57,7 +57,7 @@ PORT = 8083 [exchange-account-1] # What is the account URL? -PAYTO_URI = "payto://x-taler-bank/localhost/2" +PAYTO_URI = "payto://x-taler-bank/localhost/2?receiver-name=2" ENABLE_DEBIT = YES ENABLE_CREDIT = YES diff --git a/src/testing/test_auditor_api-cs.conf b/src/testing/test_auditor_api-cs.conf index 3a9092451..cfd1fa6cc 100644 --- a/src/testing/test_auditor_api-cs.conf +++ b/src/testing/test_auditor_api-cs.conf @@ -56,7 +56,7 @@ CONFIG = "postgres:///talercheck" # payto://-format. [exchange-account-1] # What is the URL of our account? -PAYTO_URI = "payto://x-taler-bank/localhost/42" +PAYTO_URI = "payto://x-taler-bank/localhost/42?receiver-name=42" [exchange-accountcredentials-1] WIRE_GATEWAY_URL = "http://localhost:8082/42/" @@ -68,7 +68,7 @@ HTTP_PORT = 8082 [exchange-account-2] # What is the bank account (with the "Taler Bank" demo system)? -PAYTO_URI = "payto://x-taler-bank/localhost/2" +PAYTO_URI = "payto://x-taler-bank/localhost/2?receiver-name=2" ENABLE_DEBIT = YES ENABLE_CREDIT = YES diff --git a/src/testing/test_auditor_api-rsa.conf b/src/testing/test_auditor_api-rsa.conf index e226abb26..577d9057a 100644 --- a/src/testing/test_auditor_api-rsa.conf +++ b/src/testing/test_auditor_api-rsa.conf @@ -57,7 +57,7 @@ CONFIG = "postgres:///talercheck" # payto://-format. [exchange-account-1] # What is the URL of our account? -PAYTO_URI = "payto://x-taler-bank/localhost/42" +PAYTO_URI = "payto://x-taler-bank/localhost/42?receiver-name=42" [exchange-accountcredentials-1] WIRE_GATEWAY_URL = "http://localhost:8082/42/" @@ -69,7 +69,7 @@ HTTP_PORT = 8082 [exchange-account-2] # What is the bank account (with the "Taler Bank" demo system)? -PAYTO_URI = "payto://x-taler-bank/localhost/2" +PAYTO_URI = "payto://x-taler-bank/localhost/2?receiver-name=2" ENABLE_DEBIT = YES ENABLE_CREDIT = YES diff --git a/src/testing/test_auditor_api.c b/src/testing/test_auditor_api.c index e103697e5..305d31a09 100644 --- a/src/testing/test_auditor_api.c +++ b/src/testing/test_auditor_api.c @@ -657,7 +657,7 @@ run (void *cls, MHD_HTTP_NO_CONTENT, false), TALER_TESTING_cmd_wire_add ("add-wire-account", - "payto://x-taler-bank/localhost/2", + "payto://x-taler-bank/localhost/2?receiver-name=2", MHD_HTTP_NO_CONTENT, false), TALER_TESTING_cmd_exec_offline_sign_keys ("offline-sign-future-keys", diff --git a/src/testing/test_bank_api_fakebank.conf b/src/testing/test_bank_api_fakebank.conf index b97423987..1e5a4d18e 100644 --- a/src/testing/test_bank_api_fakebank.conf +++ b/src/testing/test_bank_api_fakebank.conf @@ -4,7 +4,7 @@ currency = KUDOS [exchange-account-2] -PAYTO_URI = payto://x-taler-bank/localhost/2 +PAYTO_URI = "payto://x-taler-bank/localhost/2?receiver-name=2" [exchange-accountcredentials-2] WIRE_GATEWAY_URL = "http://localhost:8081/2/" diff --git a/src/testing/test_bank_api_fakebank_twisted.conf b/src/testing/test_bank_api_fakebank_twisted.conf index 4dab123a7..6d316c141 100644 --- a/src/testing/test_bank_api_fakebank_twisted.conf +++ b/src/testing/test_bank_api_fakebank_twisted.conf @@ -28,10 +28,10 @@ http_port = 8081 database = postgres:///talercheck [exchange-account-1] -PAYTO_URI = payto://x-taler-bank/localhost:8081/1 +PAYTO_URI = "payto://x-taler-bank/localhost:8081/1?receiver-name=1" [exchange-account-2] -PAYTO_URI = payto://x-taler-bank/localhost:8081/2 +PAYTO_URI = "payto://x-taler-bank/localhost:8081/2?receiver-name=2" [auditor] BASE_URL = "http://localhost:8083/" diff --git a/src/testing/test_bank_api_pybank.conf b/src/testing/test_bank_api_pybank.conf deleted file mode 100644 index 6603ba8a5..000000000 --- a/src/testing/test_bank_api_pybank.conf +++ /dev/null @@ -1,21 +0,0 @@ -# This file is in the public domain. - -[taler] -currency = KUDOS - -[exchange-account-2] -PAYTO_URI = payto://x-taler-bank/localhost/Exchange - -[exchange-accountcredentials-2] -WIRE_GATEWAY_URL = "http://localhost:8081/taler-wire-gateway/Exchange/" -WIRE_GATEWAY_AUTH_METHOD = basic -USERNAME = Exchange -PASSWORD = x - -[bank] -SERVE = http -HTTP_PORT = 8081 -DATABASE = postgres:///talercheck - -[auditor] -BASE_URL = "http://localhost:8083/" diff --git a/src/testing/test_bank_api_pybank_twisted.conf b/src/testing/test_bank_api_pybank_twisted.conf deleted file mode 100644 index d89cf0469..000000000 --- a/src/testing/test_bank_api_pybank_twisted.conf +++ /dev/null @@ -1,43 +0,0 @@ -[twister] -# HTTP listen port for twister -HTTP_PORT = 8888 -SERVE = tcp - -# HTTP Destination for twister. The test-Webserver needs -# to listen on the port used here. Note: no trailing '/'! -DESTINATION_BASE_URL = "http://localhost:8081" - -# Control port for TCP -# PORT = 8889 -HOSTNAME = localhost -ACCEPT_FROM = 127.0.0.1; -ACCEPT_FROM6 = ::1; - -# Control port for UNIX -UNIXPATH = /tmp/taler-service-twister.sock -UNIX_MATCH_UID = NO -UNIX_MATCH_GID = YES - -[auditor] -BASE_URL = "http://localhost:8083/" - -[taler] -currency = KUDOS - -[bank] -serve = http -http_port = 8081 -database = postgres:///talercheck - -[exchange-account-1] -PAYTO_URI = payto://x-taler-bank/localhost/1 - - -[exchange-account-2] -PAYTO_URI = payto://x-taler-bank/localhost/Exchange - -[exchange-accountcredentials-2] -WIRE_GATEWAY_URL = "http://localhost:8888/taler-wire-gateway/Exchange/" -WIRE_GATEWAY_AUTH_METHOD = basic -USERNAME = Exchange -PASSWORD = x diff --git a/src/testing/test_exchange_api-cs.conf b/src/testing/test_exchange_api-cs.conf index 204718120..9485a724d 100644 --- a/src/testing/test_exchange_api-cs.conf +++ b/src/testing/test_exchange_api-cs.conf @@ -64,7 +64,7 @@ CONFIG = "postgres:///talercheck" # payto://-format. [exchange-account-1] # What is the URL of our account? -PAYTO_URI = "payto://x-taler-bank/localhost/42" +PAYTO_URI = "payto://x-taler-bank/localhost/42?receiver-name=42" # ENABLE_CREDIT = YES [exchange-accountcredentials-1] @@ -72,7 +72,7 @@ WIRE_GATEWAY_URL = "http://localhost:9081/42/" [exchange-account-2] # What is the bank account (with the "Taler Bank" demo system)? -PAYTO_URI = "payto://x-taler-bank/localhost/2" +PAYTO_URI = "payto://x-taler-bank/localhost/2?receiver-name=2" ENABLE_DEBIT = YES ENABLE_CREDIT = YES diff --git a/src/testing/test_exchange_api-rsa.conf b/src/testing/test_exchange_api-rsa.conf index be0e4bade..bd27d560f 100644 --- a/src/testing/test_exchange_api-rsa.conf +++ b/src/testing/test_exchange_api-rsa.conf @@ -65,7 +65,7 @@ CONFIG = "postgres:///talercheck" # payto://-format. [exchange-account-1] # What is the URL of our account? -PAYTO_URI = "payto://x-taler-bank/localhost/42" +PAYTO_URI = "payto://x-taler-bank/localhost/42?receiver-name=42" # ENABLE_CREDIT = YES [exchange-accountcredentials-1] @@ -73,7 +73,7 @@ WIRE_GATEWAY_URL = "http://localhost:9081/42/" [exchange-account-2] # What is the bank account (with the "Taler Bank" demo system)? -PAYTO_URI = "payto://x-taler-bank/localhost/2" +PAYTO_URI = "payto://x-taler-bank/localhost/2?receiver-name=2" ENABLE_DEBIT = YES ENABLE_CREDIT = YES diff --git a/src/testing/test_exchange_api.c b/src/testing/test_exchange_api.c index da323ca51..54cc0e7fd 100644 --- a/src/testing/test_exchange_api.c +++ b/src/testing/test_exchange_api.c @@ -1170,7 +1170,7 @@ run (void *cls, TALER_TESTING_cmd_exec_offline_sign_extensions ("offline-sign-extensions", config_file), TALER_TESTING_cmd_wire_add ("add-wire-account", - "payto://x-taler-bank/localhost/2", + "payto://x-taler-bank/localhost/2?receiver-name=2", MHD_HTTP_NO_CONTENT, false), TALER_TESTING_cmd_exec_offline_sign_keys ("offline-sign-future-keys", diff --git a/src/testing/test_exchange_api_keys_cherry_picking-cs.conf b/src/testing/test_exchange_api_keys_cherry_picking-cs.conf index 8967d6c0a..751850cb2 100644 --- a/src/testing/test_exchange_api_keys_cherry_picking-cs.conf +++ b/src/testing/test_exchange_api_keys_cherry_picking-cs.conf @@ -56,13 +56,13 @@ CONFIG = "postgres:///talercheck" CONFIG = "postgres:///talercheck" [exchange-account-1] -PAYTO_URI = payto://x-taler-bank/localhost/42 +PAYTO_URI = "payto://x-taler-bank/localhost/42?receiver-name=42" [exchange-accountcredentials-1] WIRE_GATEWAY_URL = "http://localhost:9082/42/" [exchange-account-2] -PAYTO_URI = payto://x-taler-bank/localhost/2 +PAYTO_URI = "payto://x-taler-bank/localhost/2?receiver-name=2" ENABLE_DEBIT = YES ENABLE_CREDIT = YES diff --git a/src/testing/test_exchange_api_keys_cherry_picking-rsa.conf b/src/testing/test_exchange_api_keys_cherry_picking-rsa.conf index e616738f0..b9ad30549 100644 --- a/src/testing/test_exchange_api_keys_cherry_picking-rsa.conf +++ b/src/testing/test_exchange_api_keys_cherry_picking-rsa.conf @@ -56,13 +56,13 @@ CONFIG = "postgres:///talercheck" CONFIG = "postgres:///talercheck" [exchange-account-1] -PAYTO_URI = payto://x-taler-bank/localhost/42 +PAYTO_URI = "payto://x-taler-bank/localhost/42?receiver-name=42" [exchange-accountcredentials-1] WIRE_GATEWAY_URL = "http://localhost:9082/42/" [exchange-account-2] -PAYTO_URI = payto://x-taler-bank/localhost/2 +PAYTO_URI = "payto://x-taler-bank/localhost/2?receiver-name=2" ENABLE_DEBIT = YES ENABLE_CREDIT = YES diff --git a/src/testing/test_exchange_api_keys_cherry_picking.c b/src/testing/test_exchange_api_keys_cherry_picking.c index 25bdad06d..4ad2d7207 100644 --- a/src/testing/test_exchange_api_keys_cherry_picking.c +++ b/src/testing/test_exchange_api_keys_cherry_picking.c @@ -63,7 +63,7 @@ run (void *cls, MHD_HTTP_NO_CONTENT, false), TALER_TESTING_cmd_wire_add ("add-wire-account", - "payto://x-taler-bank/localhost/2", + "payto://x-taler-bank/localhost/2?receiver-name=2", MHD_HTTP_NO_CONTENT, false), TALER_TESTING_cmd_exec_offline_sign_fees ("offline-sign-fees", diff --git a/src/testing/test_exchange_api_overlapping_keys_bug.c b/src/testing/test_exchange_api_overlapping_keys_bug.c index 54c552236..1314bdf54 100644 --- a/src/testing/test_exchange_api_overlapping_keys_bug.c +++ b/src/testing/test_exchange_api_overlapping_keys_bug.c @@ -64,7 +64,7 @@ run (void *cls, MHD_HTTP_NO_CONTENT, false), TALER_TESTING_cmd_wire_add ("add-wire-account", - "payto://x-taler-bank/localhost/2", + "payto://x-taler-bank/localhost/2?receiver-name=2", MHD_HTTP_NO_CONTENT, false), TALER_TESTING_cmd_exec_offline_sign_keys ("offline-sign-future-keys", diff --git a/src/testing/test_exchange_api_revocation.c b/src/testing/test_exchange_api_revocation.c index bb3dcc06e..33a92551d 100644 --- a/src/testing/test_exchange_api_revocation.c +++ b/src/testing/test_exchange_api_revocation.c @@ -67,7 +67,7 @@ run (void *cls, MHD_HTTP_NO_CONTENT, false), TALER_TESTING_cmd_wire_add ("add-wire-account", - "payto://x-taler-bank/localhost/2", + "payto://x-taler-bank/localhost/2?receiver-name=2", MHD_HTTP_NO_CONTENT, false), TALER_TESTING_cmd_exec_offline_sign_keys ("offline-sign-future-keys", diff --git a/src/testing/test_exchange_api_twisted-cs.conf b/src/testing/test_exchange_api_twisted-cs.conf index 7d2afb9cb..abb88a742 100644 --- a/src/testing/test_exchange_api_twisted-cs.conf +++ b/src/testing/test_exchange_api_twisted-cs.conf @@ -48,14 +48,14 @@ CONFIG = "postgres:///talercheck" [exchange-account-1] # What is the URL of our account? -PAYTO_URI = "payto://x-taler-bank/localhost/42" +PAYTO_URI = "payto://x-taler-bank/localhost/42?receiver-name=42" [exchange-accountcredentials-1] WIRE_GATEWAY_URL = "http://localhost:9081/42/" WIRE_GATEWAY_AUTH_METHOD = NONE [exchange-account-2] -PAYTO_URI = payto://x-taler-bank/localhost/2 +PAYTO_URI = "payto://x-taler-bank/localhost/2?receiver-name=2" ENABLE_DEBIT = YES ENABLE_CREDIT = YES diff --git a/src/testing/test_exchange_api_twisted-rsa.conf b/src/testing/test_exchange_api_twisted-rsa.conf index 077d49c16..847d9e1ce 100644 --- a/src/testing/test_exchange_api_twisted-rsa.conf +++ b/src/testing/test_exchange_api_twisted-rsa.conf @@ -48,14 +48,14 @@ CONFIG = "postgres:///talercheck" [exchange-account-1] # What is the URL of our account? -PAYTO_URI = "payto://x-taler-bank/localhost/42" +PAYTO_URI = "payto://x-taler-bank/localhost/42?receiver-name=42" [exchange-accountcredentials-1] WIRE_GATEWAY_URL = "http://localhost:9081/42/" WIRE_GATEWAY_AUTH_METHOD = NONE [exchange-account-2] -PAYTO_URI = payto://x-taler-bank/localhost/2 +PAYTO_URI = "payto://x-taler-bank/localhost/2?receiver-name=2" ENABLE_DEBIT = YES ENABLE_CREDIT = YES diff --git a/src/testing/test_exchange_api_twisted.c b/src/testing/test_exchange_api_twisted.c index f8cfa64b7..0fb35b45d 100644 --- a/src/testing/test_exchange_api_twisted.c +++ b/src/testing/test_exchange_api_twisted.c @@ -243,7 +243,7 @@ run (void *cls, struct TALER_TESTING_Command commands[] = { TALER_TESTING_cmd_wire_add ("add-wire-account", - "payto://x-taler-bank/localhost/2", + "payto://x-taler-bank/localhost/2?receiver-name=2", MHD_HTTP_NO_CONTENT, false), TALER_TESTING_cmd_exec_offline_sign_keys ("offline-sign-future-keys", diff --git a/src/testing/test_exchange_management_api.c b/src/testing/test_exchange_management_api.c index 9fe5cf595..2bf0af3bd 100644 --- a/src/testing/test_exchange_management_api.c +++ b/src/testing/test_exchange_management_api.c @@ -117,31 +117,31 @@ run (void *cls, MHD_HTTP_NO_CONTENT, false), TALER_TESTING_cmd_wire_add ("add-wire-account", - "payto://x-taler-bank/localhost/42", + "payto://x-taler-bank/localhost/42?receiver-name=42", MHD_HTTP_NO_CONTENT, false), TALER_TESTING_cmd_wire_add ("add-wire-account-idempotent", - "payto://x-taler-bank/localhost/42", + "payto://x-taler-bank/localhost/42?receiver-name=42", MHD_HTTP_NO_CONTENT, false), TALER_TESTING_cmd_wire_add ("add-wire-account-another", - "payto://x-taler-bank/localhost/43", + "payto://x-taler-bank/localhost/43?receiver-name=43", MHD_HTTP_NO_CONTENT, false), TALER_TESTING_cmd_wire_add ("add-wire-account-bad-signature", - "payto://x-taler-bank/localhost/44", + "payto://x-taler-bank/localhost/44?receiver-name=44", MHD_HTTP_FORBIDDEN, true), TALER_TESTING_cmd_wire_del ("del-wire-account-not-found", - "payto://x-taler-bank/localhost/44", + "payto://x-taler-bank/localhost/44?receiver-name=44", MHD_HTTP_NOT_FOUND, false), TALER_TESTING_cmd_wire_del ("del-wire-account-bad-signature", - "payto://x-taler-bank/localhost/43", + "payto://x-taler-bank/localhost/43?receiver-name=43", MHD_HTTP_FORBIDDEN, true), TALER_TESTING_cmd_wire_del ("del-wire-account-ok", - "payto://x-taler-bank/localhost/43", + "payto://x-taler-bank/localhost/43?receiver-name=43", MHD_HTTP_NO_CONTENT, false), TALER_TESTING_cmd_exec_offline_sign_keys ("download-future-keys", diff --git a/src/testing/test_exchange_p2p.c b/src/testing/test_exchange_p2p.c index 3b11d04c5..647c56c8f 100644 --- a/src/testing/test_exchange_p2p.c +++ b/src/testing/test_exchange_p2p.c @@ -365,7 +365,7 @@ run (void *cls, TALER_TESTING_cmd_exec_offline_sign_extensions ("offline-sign-extensions", config_file), TALER_TESTING_cmd_wire_add ("add-wire-account", - "payto://x-taler-bank/localhost/2", + "payto://x-taler-bank/localhost/2?receiver-name=2", MHD_HTTP_NO_CONTENT, false), TALER_TESTING_cmd_exec_offline_sign_fees ("offline-sign-wire-fees", diff --git a/src/testing/test_kyc_api.c b/src/testing/test_kyc_api.c index 669101d88..13244993b 100644 --- a/src/testing/test_kyc_api.c +++ b/src/testing/test_kyc_api.c @@ -216,7 +216,7 @@ run (void *cls, MHD_HTTP_NO_CONTENT, false), TALER_TESTING_cmd_wire_add ("add-wire-account", - "payto://x-taler-bank/localhost/2", + "payto://x-taler-bank/localhost/2?receiver-name=2", MHD_HTTP_NO_CONTENT, false), TALER_TESTING_cmd_exec_offline_sign_keys ("offline-sign-future-keys", diff --git a/src/testing/test_kyc_api.conf b/src/testing/test_kyc_api.conf index 539c59ec1..09e7cdc7e 100644 --- a/src/testing/test_kyc_api.conf +++ b/src/testing/test_kyc_api.conf @@ -74,7 +74,7 @@ CONFIG = "postgres:///talercheck" # payto://-format. [exchange-account-1] # What is the URL of our account? -PAYTO_URI = "payto://x-taler-bank/localhost/42" +PAYTO_URI = "payto://x-taler-bank/localhost/42?receiver-name=42" [exchange-accountcredentials-1] WIRE_GATEWAY_URL = "http://localhost:8082/42/" @@ -86,7 +86,7 @@ HTTP_PORT = 8082 [exchange-account-2] # What is the bank account (with the "Taler Bank" demo system)? -PAYTO_URI = "payto://x-taler-bank/localhost/2" +PAYTO_URI = "payto://x-taler-bank/localhost/2?receiver-name=2" ENABLE_DEBIT = YES ENABLE_CREDIT = YES diff --git a/src/testing/test_taler_exchange_aggregator.c b/src/testing/test_taler_exchange_aggregator.c index ce0c73404..d42d59762 100644 --- a/src/testing/test_taler_exchange_aggregator.c +++ b/src/testing/test_taler_exchange_aggregator.c @@ -187,17 +187,17 @@ run (void *cls, ec.exchange_url, "EUR:0.89", bc.exchange_payto, - "payto://x-taler-bank/localhost/4"), + "payto://x-taler-bank/localhost/4?receiver-name=4"), TALER_TESTING_cmd_check_bank_transfer ("expect-deposit-3b", ec.exchange_url, "EUR:0.89", bc.exchange_payto, - "payto://x-taler-bank/localhost/4"), + "payto://x-taler-bank/localhost/4?receiver-name=4"), TALER_TESTING_cmd_check_bank_transfer ("expect-deposit-3c", ec.exchange_url, "EUR:0.89", bc.exchange_payto, - "payto://x-taler-bank/localhost/5"), + "payto://x-taler-bank/localhost/5?receiver-name=5"), TALER_TESTING_cmd_check_bank_empty ("expect-empty-transactions-after-3"), /* checking that aggregator waits for the deadline. */ diff --git a/src/testing/test_taler_exchange_wirewatch.c b/src/testing/test_taler_exchange_wirewatch.c index ad5151e2d..d62ca55e4 100644 --- a/src/testing/test_taler_exchange_wirewatch.c +++ b/src/testing/test_taler_exchange_wirewatch.c @@ -91,7 +91,7 @@ run (void *cls, MHD_HTTP_NO_CONTENT, false), TALER_TESTING_cmd_wire_add ("add-wire-account", - "payto://x-taler-bank/localhost/2", + "payto://x-taler-bank/localhost/2?receiver-name=2", MHD_HTTP_NO_CONTENT, false), TALER_TESTING_cmd_exec_offline_sign_keys ("offline-sign-future-keys", diff --git a/src/testing/testing_api_cmd_auditor_exec_auditor.c b/src/testing/testing_api_cmd_auditor_exec_auditor.c index 8ec128c01..588be43d8 100644 --- a/src/testing/testing_api_cmd_auditor_exec_auditor.c +++ b/src/testing/testing_api_cmd_auditor_exec_auditor.c @@ -68,6 +68,7 @@ auditor_run (void *cls, "taler-auditor", "taler-auditor", "-c", ks->config_filename, + "-I", NULL); if (NULL == ks->auditor_proc) { diff --git a/src/testing/testing_api_cmd_bank_admin_add_incoming.c b/src/testing/testing_api_cmd_bank_admin_add_incoming.c index 07ee4068b..28d251a4f 100644 --- a/src/testing/testing_api_cmd_bank_admin_add_incoming.c +++ b/src/testing/testing_api_cmd_bank_admin_add_incoming.c @@ -433,10 +433,12 @@ admin_add_incoming_traits (void *cls, TALER_TESTING_make_trait_exchange_bank_account_url ( &fts->exchange_credit_url), TALER_TESTING_make_trait_amount (&fts->amount), - TALER_TESTING_make_trait_timestamp (0, &fts->timestamp), + TALER_TESTING_make_trait_timestamp (0, + &fts->timestamp), TALER_TESTING_make_trait_reserve_priv (&fts->reserve_priv), TALER_TESTING_make_trait_reserve_pub (&fts->reserve_pub), - TALER_TESTING_make_trait_reserve_history (&fts->reserve_history), + TALER_TESTING_make_trait_reserve_history (0, + &fts->reserve_history), TALER_TESTING_trait_end () }; @@ -457,7 +459,8 @@ admin_add_incoming_traits (void *cls, TALER_TESTING_make_trait_amount (&fts->amount), TALER_TESTING_make_trait_timestamp (0, &fts->timestamp), TALER_TESTING_make_trait_reserve_pub (&fts->reserve_pub), - TALER_TESTING_make_trait_reserve_history (&fts->reserve_history), + TALER_TESTING_make_trait_reserve_history (0, + &fts->reserve_history), TALER_TESTING_trait_end () }; diff --git a/src/testing/testing_api_cmd_bank_history_credit.c b/src/testing/testing_api_cmd_bank_history_credit.c index a7ad40a43..62bc47e11 100644 --- a/src/testing/testing_api_cmd_bank_history_credit.c +++ b/src/testing/testing_api_cmd_bank_history_credit.c @@ -311,7 +311,7 @@ build_history (struct TALER_TESTING_Interpreter *is, * @param details the expected transaction details. * @return #GNUNET_OK if the transaction is what we expect. */ -static int +static enum GNUNET_GenericReturnValue check_result (struct History *h, unsigned int total, unsigned int off, @@ -389,6 +389,13 @@ history_cb (void *cls, if (NULL == details) { hs->hh = NULL; + if ( (MHD_HTTP_NOT_FOUND == http_status) && + (0 == hs->total) ) + { + /* not found is OK for empty history */ + TALER_TESTING_interpreter_next (is); + return GNUNET_OK; + } if ( (hs->results_obtained != hs->total) || (hs->failed) || (MHD_HTTP_NO_CONTENT != http_status) ) @@ -422,10 +429,11 @@ history_cb (void *cls, } /* check current element */ - if (GNUNET_OK != check_result (hs->h, - hs->total, - hs->results_obtained, - details)) + if (GNUNET_OK != + check_result (hs->h, + hs->total, + hs->results_obtained, + details)) { char *acc; @@ -439,6 +447,8 @@ history_cb (void *cls, if (NULL != acc) free (acc); hs->failed = true; + hs->hh = NULL; + TALER_TESTING_interpreter_fail (is); return GNUNET_SYSERR; } hs->results_obtained++; diff --git a/src/testing/testing_api_cmd_bank_history_debit.c b/src/testing/testing_api_cmd_bank_history_debit.c index a1dee81e1..cb3f68097 100644 --- a/src/testing/testing_api_cmd_bank_history_debit.c +++ b/src/testing/testing_api_cmd_bank_history_debit.c @@ -391,6 +391,13 @@ history_cb (void *cls, if (NULL == details) { hs->hh = NULL; + if ( (MHD_HTTP_NOT_FOUND == http_status) && + (0 == hs->total) ) + { + /* not found is OK for empty history */ + TALER_TESTING_interpreter_next (is); + return GNUNET_OK; + } if ( (hs->results_obtained != hs->total) || (GNUNET_YES == hs->failed) || (MHD_HTTP_NO_CONTENT != http_status) ) @@ -424,10 +431,11 @@ history_cb (void *cls, } /* check current element */ - if (GNUNET_OK != check_result (hs->h, - hs->total, - hs->results_obtained, - details)) + if (GNUNET_OK != + check_result (hs->h, + hs->total, + hs->results_obtained, + details)) { char *acc; @@ -441,6 +449,8 @@ history_cb (void *cls, if (NULL != acc) free (acc); hs->failed = GNUNET_YES; + hs->hh = NULL; + TALER_TESTING_interpreter_fail (is); return GNUNET_SYSERR; } hs->results_obtained++; diff --git a/src/testing/testing_api_cmd_batch_withdraw.c b/src/testing/testing_api_cmd_batch_withdraw.c index 5e480f12b..f135f5def 100644 --- a/src/testing/testing_api_cmd_batch_withdraw.c +++ b/src/testing/testing_api_cmd_batch_withdraw.c @@ -87,8 +87,6 @@ struct CoinState /** * Reserve history entry that corresponds to this coin. * Will be of type #TALER_EXCHANGE_RTT_WITHDRAWAL. - * - * FIXME: how to export one per coin? */ struct TALER_EXCHANGE_ReserveHistoryEntry reserve_history; @@ -401,8 +399,8 @@ batch_withdraw_traits (void *cls, struct CoinState *cs = &ws->coins[index]; struct TALER_TESTING_Trait traits[] = { /* history entry MUST be first due to response code logic below! */ - // FIXME: bug! - TALER_TESTING_make_trait_reserve_history (&cs->reserve_history), + TALER_TESTING_make_trait_reserve_history (index, + &cs->reserve_history), TALER_TESTING_make_trait_coin_priv (index, &cs->coin_priv), TALER_TESTING_make_trait_planchet_secrets (index, diff --git a/src/testing/testing_api_cmd_exec_closer.c b/src/testing/testing_api_cmd_exec_closer.c index 57346f333..75eab2d9f 100644 --- a/src/testing/testing_api_cmd_exec_closer.c +++ b/src/testing/testing_api_cmd_exec_closer.c @@ -169,7 +169,8 @@ closer_traits (void *cls, struct TALER_TESTING_Trait xtraits[] = { TALER_TESTING_make_trait_process (&as->closer_proc), TALER_TESTING_make_trait_reserve_pub (&as->reserve_pub), - TALER_TESTING_make_trait_reserve_history (&as->reserve_history), + TALER_TESTING_make_trait_reserve_history (0, + &as->reserve_history), TALER_TESTING_trait_end () }; diff --git a/src/testing/testing_api_cmd_insert_deposit.c b/src/testing/testing_api_cmd_insert_deposit.c index 33e6cdcef..a82caa730 100644 --- a/src/testing/testing_api_cmd_insert_deposit.c +++ b/src/testing/testing_api_cmd_insert_deposit.c @@ -230,7 +230,8 @@ insert_deposit_run (void *cls, TALER_blinded_denom_sig_free (&bds); } GNUNET_asprintf (&deposit.receiver_wire_account, - "payto://x-taler-bank/localhost/%s", + "payto://x-taler-bank/localhost/%s?receiver-name=%s", + ids->merchant_account, ids->merchant_account); memset (&deposit.wire_salt, 46, diff --git a/src/testing/testing_api_cmd_purse_deposit.c b/src/testing/testing_api_cmd_purse_deposit.c index 1c6dcdd9b..fa1b900da 100644 --- a/src/testing/testing_api_cmd_purse_deposit.c +++ b/src/testing/testing_api_cmd_purse_deposit.c @@ -396,7 +396,8 @@ deposit_traits (void *cls, struct PurseDepositState *ds = cls; struct TALER_TESTING_Trait traits[] = { /* history entry MUST be first due to response code logic below! */ - TALER_TESTING_make_trait_reserve_history (&ds->reserve_history), + TALER_TESTING_make_trait_reserve_history (0, + &ds->reserve_history), TALER_TESTING_make_trait_reserve_pub (&ds->reserve_pub), TALER_TESTING_make_trait_purse_pub (&ds->purse_pub), TALER_TESTING_trait_end () diff --git a/src/testing/testing_api_cmd_purse_merge.c b/src/testing/testing_api_cmd_purse_merge.c index 50e0ac1bc..68cd5ea57 100644 --- a/src/testing/testing_api_cmd_purse_merge.c +++ b/src/testing/testing_api_cmd_purse_merge.c @@ -350,7 +350,8 @@ merge_traits (void *cls, struct PurseMergeState *ds = cls; struct TALER_TESTING_Trait traits[] = { /* history entry MUST be first due to response code logic below! */ - TALER_TESTING_make_trait_reserve_history (&ds->reserve_history), + TALER_TESTING_make_trait_reserve_history (0, + &ds->reserve_history), TALER_TESTING_make_trait_reserve_pub (&ds->reserve_pub), TALER_TESTING_make_trait_timestamp (0, &ds->merge_timestamp), diff --git a/src/testing/testing_api_cmd_recoup.c b/src/testing/testing_api_cmd_recoup.c index 1a8290206..ed8c7eed7 100644 --- a/src/testing/testing_api_cmd_recoup.c +++ b/src/testing/testing_api_cmd_recoup.c @@ -328,7 +328,8 @@ recoup_traits (void *cls, { struct TALER_TESTING_Trait traits[] = { TALER_TESTING_make_trait_reserve_pub (&ps->reserve_pub), - TALER_TESTING_make_trait_reserve_history (&ps->reserve_history), + TALER_TESTING_make_trait_reserve_history (0, + &ps->reserve_history), TALER_TESTING_trait_end () }; diff --git a/src/testing/testing_api_cmd_reserve_history.c b/src/testing/testing_api_cmd_reserve_history.c index 6cee5af15..e63cca868 100644 --- a/src/testing/testing_api_cmd_reserve_history.c +++ b/src/testing/testing_api_cmd_reserve_history.c @@ -95,7 +95,7 @@ analyze_command (const struct TALER_ReservePublicKeyP *reserve_pub, const struct TALER_TESTING_Command *cmd, unsigned int history_length, const struct TALER_EXCHANGE_ReserveHistoryEntry *history, - int *found) + bool *found) { if (TALER_TESTING_cmd_is_batch (cmd)) { @@ -134,7 +134,6 @@ analyze_command (const struct TALER_ReservePublicKeyP *reserve_pub, else { const struct TALER_ReservePublicKeyP *rp; - const struct TALER_EXCHANGE_ReserveHistoryEntry *he; if (GNUNET_OK != TALER_TESTING_get_trait_reserve_pub (cmd, @@ -144,32 +143,40 @@ analyze_command (const struct TALER_ReservePublicKeyP *reserve_pub, GNUNET_memcmp (rp, reserve_pub)) return GNUNET_OK; /* command affects some _other_ reserve */ - if (GNUNET_OK != - TALER_TESTING_get_trait_reserve_history (cmd, - &he)) - { - /* NOTE: only for debugging... */ - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Command `%s' has the reserve_pub trait, but does not reserve history trait\n", - cmd->label); - return GNUNET_OK; /* command does nothing for reserves */ - } - for (unsigned int i = 0; ilabel); + return GNUNET_OK; /* command does nothing for reserves */ } + for (unsigned int i = 0; ilabel, + j); + return GNUNET_SYSERR; } - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Command `%s' reserve history entry not found\n", - cmd->label); - return GNUNET_SYSERR; } } @@ -237,7 +244,7 @@ reserve_history_cb (void *cls, return; } { - int found[rs->details.ok.history_len]; + bool found[rs->details.ok.history_len]; memset (found, 0, @@ -342,7 +349,8 @@ history_traits (void *cls, struct HistoryState *hs = cls; struct TALER_TESTING_Trait traits[] = { /* history entry MUST be first due to response code logic below! */ - TALER_TESTING_make_trait_reserve_history (&hs->reserve_history), + TALER_TESTING_make_trait_reserve_history (0, + &hs->reserve_history), TALER_TESTING_trait_end () }; diff --git a/src/testing/testing_api_cmd_reserve_status.c b/src/testing/testing_api_cmd_reserve_status.c index 1d104cc3e..9abd99f0b 100644 --- a/src/testing/testing_api_cmd_reserve_status.c +++ b/src/testing/testing_api_cmd_reserve_status.c @@ -126,7 +126,6 @@ analyze_command (const struct TALER_ReservePublicKeyP *reserve_pub, else { const struct TALER_ReservePublicKeyP *rp; - const struct TALER_EXCHANGE_ReserveHistoryEntry *he; if (GNUNET_OK != TALER_TESTING_get_trait_reserve_pub (cmd, @@ -136,32 +135,39 @@ analyze_command (const struct TALER_ReservePublicKeyP *reserve_pub, GNUNET_memcmp (rp, reserve_pub)) return GNUNET_OK; /* command affects some _other_ reserve */ - if (GNUNET_OK != - TALER_TESTING_get_trait_reserve_history (cmd, - &he)) - { - /* NOTE: only for debugging... */ - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Command `%s' has the reserve_pub trait, but does not reserve history trait\n", - cmd->label); - return GNUNET_OK; /* command does nothing for reserves */ - } - for (unsigned int i = 0; ilabel); + return GNUNET_OK; /* command does nothing for reserves */ + } + for (unsigned int i = 0; ilabel, + j); + return GNUNET_SYSERR; } - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Command `%s' reserve history entry not found\n", - cmd->label); - return GNUNET_SYSERR; } } diff --git a/src/testing/testing_api_cmd_withdraw.c b/src/testing/testing_api_cmd_withdraw.c index 7b287da3f..019c08de4 100644 --- a/src/testing/testing_api_cmd_withdraw.c +++ b/src/testing/testing_api_cmd_withdraw.c @@ -521,7 +521,8 @@ withdraw_traits (void *cls, struct WithdrawState *ws = cls; struct TALER_TESTING_Trait traits[] = { /* history entry MUST be first due to response code logic below! */ - TALER_TESTING_make_trait_reserve_history (&ws->reserve_history), + TALER_TESTING_make_trait_reserve_history (0, + &ws->reserve_history), TALER_TESTING_make_trait_coin_priv (0 /* only one coin */, &ws->coin_priv), TALER_TESTING_make_trait_planchet_secret (&ws->ps), diff --git a/src/testing/testing_api_helpers_bank.c b/src/testing/testing_api_helpers_bank.c index 0d8017e65..1ec2050a2 100644 --- a/src/testing/testing_api_helpers_bank.c +++ b/src/testing/testing_api_helpers_bank.c @@ -563,8 +563,8 @@ TALER_TESTING_prepare_bank (const char *config_filename, } GNUNET_CONFIGURATION_destroy (cfg); bc->exchange_payto = exchange_payto_uri; - bc->user42_payto = "payto://x-taler-bank/localhost/42"; - bc->user43_payto = "payto://x-taler-bank/localhost/43"; + bc->user42_payto = "payto://x-taler-bank/localhost/42?receiver-name=42"; + bc->user43_payto = "payto://x-taler-bank/localhost/43?receiver-name=43"; GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Using pybank %s on port %u\n", bc->exchange_auth.wire_gateway_url, @@ -655,8 +655,8 @@ TALER_TESTING_prepare_fakebank (const char *config_filename, * don't have any auth. */ bc->exchange_auth.method = TALER_BANK_AUTH_NONE; bc->exchange_payto = exchange_payto_uri; - bc->user42_payto = "payto://x-taler-bank/localhost/42"; - bc->user43_payto = "payto://x-taler-bank/localhost/43"; + bc->user42_payto = "payto://x-taler-bank/localhost/42?receiver-name=42"; + bc->user43_payto = "payto://x-taler-bank/localhost/43?receiver-name=43"; GNUNET_log (GNUNET_ERROR_TYPE_INFO, "exchange payto: %s\n", bc->exchange_payto); GNUNET_log (GNUNET_ERROR_TYPE_INFO, "user42_payto: %s\n", diff --git a/src/util/payto.c b/src/util/payto.c index 442107a0f..ceceecf52 100644 --- a/src/util/payto.c +++ b/src/util/payto.c @@ -1,6 +1,6 @@ /* This file is part of TALER - Copyright (C) 2019-2021 Taler Systems SA + Copyright (C) 2019-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 published by the Free Software @@ -233,6 +233,26 @@ TALER_payto_validate (const char *payto_uri) } +char * +TALER_payto_get_receiver_name (const char *payto) +{ + char *err; + + err = TALER_payto_validate (payto); + if (NULL != err) + { + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, + "Invalid payto://-URI `%s': %s\n", + payto, + err); + GNUNET_free (err); + return NULL; + } + return payto_get_key (payto, + "receiver-name="); +} + + void TALER_payto_hash (const char *payto, struct TALER_PaytoHashP *h_payto) -- cgit v1.2.3