summaryrefslogtreecommitdiff
path: root/src/lib/exchange_api_management_set_global_fee.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/exchange_api_management_set_global_fee.c')
-rw-r--r--src/lib/exchange_api_management_set_global_fee.c47
1 files changed, 29 insertions, 18 deletions
diff --git a/src/lib/exchange_api_management_set_global_fee.c b/src/lib/exchange_api_management_set_global_fee.c
index b600c8cbe..f6282a812 100644
--- a/src/lib/exchange_api_management_set_global_fee.c
+++ b/src/lib/exchange_api_management_set_global_fee.c
@@ -79,9 +79,9 @@ handle_set_global_fee_finished (void *cls,
{
struct TALER_EXCHANGE_ManagementSetGlobalFeeHandle *sgfh = cls;
const json_t *json = response;
- struct TALER_EXCHANGE_HttpResponse hr = {
- .http_status = (unsigned int) response_code,
- .reply = json
+ struct TALER_EXCHANGE_ManagementSetGlobalFeeResponse sfr = {
+ .hr.http_status = (unsigned int) response_code,
+ .hr.reply = json
};
sgfh->job = NULL;
@@ -90,32 +90,47 @@ handle_set_global_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);
+ sfr.hr.ec = TALER_JSON_get_error_code (json);
+ sfr.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",
+ sgfh->url);
+ if (NULL != json)
+ {
+ sfr.hr.ec = TALER_JSON_get_error_code (json);
+ sfr.hr.hint = TALER_JSON_get_error_hint (json);
+ }
+ else
+ {
+ sfr.hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE;
+ sfr.hr.hint = TALER_ErrorCode_get_hint (sfr.hr.ec);
+ }
break;
case MHD_HTTP_CONFLICT:
- hr.ec = TALER_JSON_get_error_code (json);
- hr.hint = TALER_JSON_get_error_hint (json);
+ sfr.hr.ec = TALER_JSON_get_error_code (json);
+ sfr.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);
+ sfr.hr.ec = TALER_JSON_get_error_code (json);
+ sfr.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);
+ sfr.hr.ec = TALER_JSON_get_error_code (json);
+ sfr.hr.hint = TALER_JSON_get_error_hint (json);
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Unexpected response code %u/%d for exchange management set global fee\n",
(unsigned int) response_code,
- (int) hr.ec);
+ (int) sfr.hr.ec);
break;
}
if (NULL != sgfh->cb)
{
sgfh->cb (sgfh->cb_cls,
- &hr);
+ &sfr);
sgfh->cb = NULL;
}
TALER_EXCHANGE_management_set_global_fees_cancel (sgfh);
@@ -130,7 +145,6 @@ TALER_EXCHANGE_management_set_global_fees (
struct GNUNET_TIME_Timestamp validity_end,
const struct TALER_GlobalFeeSet *fees,
struct GNUNET_TIME_Relative purse_timeout,
- struct GNUNET_TIME_Relative kyc_timeout,
struct GNUNET_TIME_Relative history_expiration,
uint32_t purse_account_limit,
const struct TALER_MasterSignatureP *master_sig,
@@ -164,16 +178,12 @@ TALER_EXCHANGE_management_set_global_fees (
validity_end),
TALER_JSON_pack_amount ("history_fee",
&fees->history),
- TALER_JSON_pack_amount ("kyc_fee",
- &fees->kyc),
TALER_JSON_pack_amount ("account_fee",
&fees->account),
TALER_JSON_pack_amount ("purse_fee",
&fees->purse),
GNUNET_JSON_pack_time_rel ("purse_timeout",
purse_timeout),
- GNUNET_JSON_pack_time_rel ("kyc_timeout",
- kyc_timeout),
GNUNET_JSON_pack_time_rel ("history_expiration",
history_expiration),
GNUNET_JSON_pack_uint64 ("purse_account_limit",
@@ -190,6 +200,7 @@ TALER_EXCHANGE_management_set_global_fees (
curl_easy_cleanup (eh);
json_decref (body);
GNUNET_free (sgfh->url);
+ GNUNET_free (sgfh);
return NULL;
}
json_decref (body);