diff options
author | Christian Grothoff <christian@grothoff.org> | 2022-05-30 19:31:49 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2022-05-30 19:31:49 +0200 |
commit | d55b093de8d5a39d7796ca68a4990ee4e9669c16 (patch) | |
tree | 0692bf465a54d05a78cd63a2b992e1f3902834f5 /src/lib | |
parent | ab4aa4dcfd3477971b3fb0c81a4caffff953c145 (diff) | |
download | exchange-d55b093de8d5a39d7796ca68a4990ee4e9669c16.tar.xz |
-fix reserve history, include in tests
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/exchange_api_common.c | 5 | ||||
-rw-r--r-- | src/lib/exchange_api_reserves_history.c | 35 |
2 files changed, 28 insertions, 12 deletions
diff --git a/src/lib/exchange_api_common.c b/src/lib/exchange_api_common.c index 92bfee6e4..cfab9a305 100644 --- a/src/lib/exchange_api_common.c +++ b/src/lib/exchange_api_common.c @@ -476,8 +476,6 @@ parse_history (struct TALER_EXCHANGE_ReserveHistoryEntry *rh, struct GNUNET_JSON_Specification history_spec[] = { GNUNET_JSON_spec_fixed_auto ("reserve_sig", &rh->details.history_details.reserve_sig), - TALER_JSON_spec_amount_any ("history_fee", - &rh->amount), GNUNET_JSON_spec_timestamp ("request_timestamp", &rh->details.history_details.request_timestamp), GNUNET_JSON_spec_end () @@ -578,6 +576,9 @@ TALER_EXCHANGE_parse_reserve_history ( NULL, NULL)) { GNUNET_break_op (0); + json_dumpf (transaction, + stderr, + JSON_INDENT (2)); return GNUNET_SYSERR; } rh->amount = amount; diff --git a/src/lib/exchange_api_reserves_history.c b/src/lib/exchange_api_reserves_history.c index 2925b0253..1d3891c2e 100644 --- a/src/lib/exchange_api_reserves_history.c +++ b/src/lib/exchange_api_reserves_history.c @@ -110,10 +110,6 @@ handle_reserves_history_ok (struct TALER_EXCHANGE_ReservesHistoryHandle *rsh, struct GNUNET_JSON_Specification spec[] = { TALER_JSON_spec_amount_any ("balance", &rs.details.ok.balance), - GNUNET_JSON_spec_bool ("kyc_passed", - &rs.details.ok.kyc_ok), - GNUNET_JSON_spec_bool ("kyc_required", - &rs.details.ok.kyc_required), GNUNET_JSON_spec_json ("history", &history), GNUNET_JSON_spec_end () @@ -197,6 +193,7 @@ handle_reserves_history_finished (void *cls, handle_reserves_history_ok (rsh, j)) { + GNUNET_break_op (0); rs.hr.http_status = 0; rs.hr.ec = TALER_EC_GENERIC_REPLY_MALFORMED; } @@ -221,6 +218,11 @@ handle_reserves_history_finished (void *cls, rs.hr.ec = TALER_JSON_get_error_code (j); rs.hr.hint = TALER_JSON_get_error_hint (j); break; + case MHD_HTTP_CONFLICT: + /* Insufficient balance to inquire for reserve history */ + rs.hr.ec = TALER_JSON_get_error_code (j); + rs.hr.hint = TALER_JSON_get_error_hint (j); + break; case MHD_HTTP_INTERNAL_SERVER_ERROR: /* Server had an internal issue; we should retry, but this API leaves this to the application */ @@ -306,10 +308,22 @@ TALER_EXCHANGE_reserves_history ( return NULL; } keys = TALER_EXCHANGE_get_keys (exchange); - GNUNET_assert (NULL != keys); + if (NULL == keys) + { + GNUNET_break (0); + GNUNET_free (rsh->url); + GNUNET_free (rsh); + return NULL; + } gf = TALER_EXCHANGE_get_global_fee (keys, rsh->ts); - GNUNET_assert (NULL != gf); + if (NULL == gf) + { + GNUNET_break_op (0); + GNUNET_free (rsh->url); + GNUNET_free (rsh); + return NULL; + } TALER_wallet_reserve_history_sign (rsh->ts, &gf->fees.history, reserve_priv, @@ -336,10 +350,11 @@ TALER_EXCHANGE_reserves_history ( json_decref (history_obj); } ctx = TEAH_handle_to_context (exchange); - rsh->job = GNUNET_CURL_job_add (ctx, - eh, - &handle_reserves_history_finished, - rsh); + rsh->job = GNUNET_CURL_job_add2 (ctx, + eh, + rsh->post_ctx.headers, + &handle_reserves_history_finished, + rsh); return rsh; } |