From 77bab625607514a628dfda101e55c7d57f6b623d Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Tue, 9 Nov 2021 22:52:01 +0100 Subject: -fixes for test --- src/curl/curl.c | 5 +---- src/exchange/taler-exchange-httpd_kyc-check.c | 30 ++++++++++++++++++++++++--- src/lib/exchange_api_kyc_wallet.c | 9 ++++---- src/testing/test_kyc_api.c | 2 -- src/testing/testing_api_cmd_kyc_wallet_get.c | 4 ++-- 5 files changed, 35 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/curl/curl.c b/src/curl/curl.c index e9a2d5612..424c41fd6 100644 --- a/src/curl/curl.c +++ b/src/curl/curl.c @@ -1,6 +1,6 @@ /* This file is part of TALER - Copyright (C) 2019-2020 Taler Systems SA + Copyright (C) 2019-2021 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 @@ -24,9 +24,6 @@ #include "platform.h" #include "taler_curl_lib.h" -// FIXME-workaround: without this, we somehow sometimes forget the header -// that indicates compression and then the exchange 400s us! -#undef TALER_CURL_COMPRESS_BODIES #if TALER_CURL_COMPRESS_BODIES #include diff --git a/src/exchange/taler-exchange-httpd_kyc-check.c b/src/exchange/taler-exchange-httpd_kyc-check.c index 5964da501..79e85ca00 100644 --- a/src/exchange/taler-exchange-httpd_kyc-check.c +++ b/src/exchange/taler-exchange-httpd_kyc-check.c @@ -119,7 +119,31 @@ TEH_handler_kyc_check ( TALER_EC_GENERIC_PARAMETER_MALFORMED, "payment_target_uuid"); } - /* FIXME: write long polling logic ... */ + { + const char *ts; + + ts = MHD_lookup_connection_value (rc->connection, + MHD_GET_ARGUMENT_KIND, + "timeout_ms"); + if (NULL != ts) + { + unsigned long long tms; + + if (1 != + sscanf (ts, + "%llu%c", + &tms, + &dummy)) + { + GNUNET_break_op (0); + return TALER_MHD_reply_with_error (rc->connection, + MHD_HTTP_BAD_REQUEST, + TALER_EC_GENERIC_PARAMETER_MALFORMED, + "timeout_ms"); + } + /* FIXME: write long polling logic ... */ + } + } { const char *hps; @@ -176,8 +200,8 @@ TEH_handler_kyc_check ( { GNUNET_break_op (0); return TALER_MHD_reply_with_error (rc->connection, - MHD_HTTP_FORBIDDEN, - 42, /* FIXME: EC! */ + MHD_HTTP_UNAUTHORIZED, + TALER_EC_EXCHANGE_KYC_CHECK_AUTHORIZATION_FAILED, "h_payto"); } if (! kcc.kyc.ok) diff --git a/src/lib/exchange_api_kyc_wallet.c b/src/lib/exchange_api_kyc_wallet.c index e919b562e..4a41fd598 100644 --- a/src/lib/exchange_api_kyc_wallet.c +++ b/src/lib/exchange_api_kyc_wallet.c @@ -209,10 +209,11 @@ TALER_EXCHANGE_kyc_wallet (struct TALER_EXCHANGE_Handle *exchange, return NULL; } json_decref (req); - kwh->job = GNUNET_CURL_job_add (ctx, - eh, - &handle_kyc_wallet_finished, - kwh); + kwh->job = GNUNET_CURL_job_add2 (ctx, + eh, + kwh->ctx.headers, + &handle_kyc_wallet_finished, + kwh); return kwh; } diff --git a/src/testing/test_kyc_api.c b/src/testing/test_kyc_api.c index 48464e2f6..f90932b01 100644 --- a/src/testing/test_kyc_api.c +++ b/src/testing/test_kyc_api.c @@ -226,10 +226,8 @@ run (void *cls, track), TALER_TESTING_cmd_batch ("withdraw-kyc", withdraw_kyc), -#if 0 TALER_TESTING_cmd_batch ("wallet-kyc", wallet_kyc), -#endif TALER_TESTING_cmd_end () }; diff --git a/src/testing/testing_api_cmd_kyc_wallet_get.c b/src/testing/testing_api_cmd_kyc_wallet_get.c index e487f6285..91ad09ff9 100644 --- a/src/testing/testing_api_cmd_kyc_wallet_get.c +++ b/src/testing/testing_api_cmd_kyc_wallet_get.c @@ -167,11 +167,11 @@ wallet_kyc_run (void *cls, { GNUNET_CRYPTO_eddsa_key_create (&kwg->reserve_priv.eddsa_priv); } + GNUNET_CRYPTO_eddsa_key_get_public (&kwg->reserve_priv.eddsa_priv, + &kwg->reserve_pub.eddsa_pub); kwg->reserve_payto_uri = TALER_payto_from_reserve (TALER_EXCHANGE_get_base_url (is->exchange), &kwg->reserve_pub); - GNUNET_CRYPTO_eddsa_key_get_public (&kwg->reserve_priv.eddsa_priv, - &kwg->reserve_pub.eddsa_pub); kwg->kwh = TALER_EXCHANGE_kyc_wallet (is->exchange, &kwg->reserve_priv, &wallet_kyc_cb, -- cgit v1.2.3