diff options
Diffstat (limited to 'src/lib/exchange_api_management_set_wire_fee.c')
-rw-r--r-- | src/lib/exchange_api_management_set_wire_fee.c | 44 |
1 files changed, 29 insertions, 15 deletions
diff --git a/src/lib/exchange_api_management_set_wire_fee.c b/src/lib/exchange_api_management_set_wire_fee.c index 5951b6e20..aaeae21f4 100644 --- a/src/lib/exchange_api_management_set_wire_fee.c +++ b/src/lib/exchange_api_management_set_wire_fee.c @@ -79,9 +79,9 @@ handle_set_wire_fee_finished (void *cls, { struct TALER_EXCHANGE_ManagementSetWireFeeHandle *swfh = cls; const json_t *json = response; - struct TALER_EXCHANGE_HttpResponse hr = { - .http_status = (unsigned int) response_code, - .reply = json + struct TALER_EXCHANGE_ManagementSetWireFeeResponse swr = { + .hr.http_status = (unsigned int) response_code, + .hr.reply = json }; swfh->job = NULL; @@ -90,32 +90,47 @@ handle_set_wire_fee_finished (void *cls, case MHD_HTTP_NO_CONTENT: break; case MHD_HTTP_FORBIDDEN: - hr.ec = TALER_JSON_get_error_code (json); - hr.hint = TALER_JSON_get_error_hint (json); + swr.hr.ec = TALER_JSON_get_error_code (json); + swr.hr.hint = TALER_JSON_get_error_hint (json); + break; + case MHD_HTTP_NOT_FOUND: + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Server did not find handler at `%s'. Did you configure the correct exchange base URL?\n", + swfh->url); + if (NULL != json) + { + swr.hr.ec = TALER_JSON_get_error_code (json); + swr.hr.hint = TALER_JSON_get_error_hint (json); + } + else + { + swr.hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE; + swr.hr.hint = TALER_ErrorCode_get_hint (swr.hr.ec); + } break; case MHD_HTTP_CONFLICT: - hr.ec = TALER_JSON_get_error_code (json); - hr.hint = TALER_JSON_get_error_hint (json); + swr.hr.ec = TALER_JSON_get_error_code (json); + swr.hr.hint = TALER_JSON_get_error_hint (json); break; case MHD_HTTP_PRECONDITION_FAILED: - hr.ec = TALER_JSON_get_error_code (json); - hr.hint = TALER_JSON_get_error_hint (json); + swr.hr.ec = TALER_JSON_get_error_code (json); + swr.hr.hint = TALER_JSON_get_error_hint (json); break; default: /* unexpected response code */ GNUNET_break_op (0); - hr.ec = TALER_JSON_get_error_code (json); - hr.hint = TALER_JSON_get_error_hint (json); + swr.hr.ec = TALER_JSON_get_error_code (json); + swr.hr.hint = TALER_JSON_get_error_hint (json); GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Unexpected response code %u/%d for exchange management set wire fee\n", (unsigned int) response_code, - (int) hr.ec); + (int) swr.hr.ec); break; } if (NULL != swfh->cb) { swfh->cb (swfh->cb_cls, - &hr); + &swr); swfh->cb = NULL; } TALER_EXCHANGE_management_set_wire_fees_cancel (swfh); @@ -163,8 +178,6 @@ TALER_EXCHANGE_management_set_wire_fees ( validity_end), TALER_JSON_pack_amount ("closing_fee", &fees->closing), - TALER_JSON_pack_amount ("wad_fee", - &fees->wad), TALER_JSON_pack_amount ("wire_fee", &fees->wire)); eh = TALER_EXCHANGE_curl_easy_get_ (swfh->url); @@ -179,6 +192,7 @@ TALER_EXCHANGE_management_set_wire_fees ( curl_easy_cleanup (eh); json_decref (body); GNUNET_free (swfh->url); + GNUNET_free (swfh); return NULL; } json_decref (body); |