From bf8c5982a2e79f0b5198a0033dd41e9702d093f9 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 5 Apr 2020 22:05:38 +0200 Subject: make exchange API more uniform in how information is returned --- .../testing_api_cmd_auditor_deposit_confirmation.c | 61 ++++++++++------------ 1 file changed, 28 insertions(+), 33 deletions(-) (limited to 'src/testing/testing_api_cmd_auditor_deposit_confirmation.c') diff --git a/src/testing/testing_api_cmd_auditor_deposit_confirmation.c b/src/testing/testing_api_cmd_auditor_deposit_confirmation.c index 31c6e850e..247399a9d 100644 --- a/src/testing/testing_api_cmd_auditor_deposit_confirmation.c +++ b/src/testing/testing_api_cmd_auditor_deposit_confirmation.c @@ -138,34 +138,30 @@ do_retry (void *cls) * to check if the response code is acceptable. * * @param cls closure. - * @param http_status HTTP response code. - * @param ec taler-specific error code. - * @param obj raw response from the auditor. + * @param hr HTTP response details */ static void deposit_confirmation_cb (void *cls, - unsigned int http_status, - enum TALER_ErrorCode ec, - const json_t *obj) + const struct TALER_AUDITOR_HttpResponse *hr) { struct DepositConfirmationState *dcs = cls; dcs->dc = NULL; - if (dcs->expected_response_code != http_status) + if (dcs->expected_response_code != hr->http_status) { if (0 != dcs->do_retry) { dcs->do_retry--; - if ( (0 == http_status) || - (TALER_EC_DB_COMMIT_FAILED_ON_RETRY == ec) || - (MHD_HTTP_INTERNAL_SERVER_ERROR == http_status) ) + if ( (0 == hr->http_status) || + (TALER_EC_DB_COMMIT_FAILED_ON_RETRY == hr->ec) || + (MHD_HTTP_INTERNAL_SERVER_ERROR == hr->http_status) ) { GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Retrying deposit confirmation failed with %u/%d\n", - http_status, - (int) ec); + hr->http_status, + (int) hr->ec); /* on DB conflicts, do not use backoff */ - if (TALER_EC_DB_COMMIT_FAILED_ON_RETRY == ec) + if (TALER_EC_DB_COMMIT_FAILED_ON_RETRY == hr->ec) dcs->backoff = GNUNET_TIME_UNIT_ZERO; else dcs->backoff = GNUNET_TIME_randomized_backoff (dcs->backoff, @@ -179,11 +175,11 @@ deposit_confirmation_cb (void *cls, } GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Unexpected response code %u to command %s in %s:%u\n", - http_status, + hr->http_status, dcs->is->commands[dcs->is->ip].label, __FILE__, __LINE__); - json_dumpf (obj, stderr, 0); + json_dumpf (hr->reply, stderr, 0); TALER_TESTING_interpreter_fail (dcs->is); return; } @@ -310,24 +306,23 @@ deposit_confirmation_run (void *cls, refund_deadline = timestamp; } } - dcs->dc = TALER_AUDITOR_deposit_confirmation - (dcs->auditor, - &h_wire, - &h_contract_terms, - timestamp, - refund_deadline, - &amount_without_fee, - &coin_pub, - &merchant_pub, - exchange_pub, - exchange_sig, - &keys->master_pub, - spk->valid_from, - spk->valid_until, - spk->valid_legal, - &spk->master_sig, - &deposit_confirmation_cb, - dcs); + dcs->dc = TALER_AUDITOR_deposit_confirmation (dcs->auditor, + &h_wire, + &h_contract_terms, + timestamp, + refund_deadline, + &amount_without_fee, + &coin_pub, + &merchant_pub, + exchange_pub, + exchange_sig, + &keys->master_pub, + spk->valid_from, + spk->valid_until, + spk->valid_legal, + &spk->master_sig, + &deposit_confirmation_cb, + dcs); if (NULL == dcs->dc) { -- cgit v1.2.3