diff options
Diffstat (limited to 'src/lib/merchant_api_get_orders.c')
-rw-r--r-- | src/lib/merchant_api_get_orders.c | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/src/lib/merchant_api_get_orders.c b/src/lib/merchant_api_get_orders.c index 5bad47e0..966ecb15 100644 --- a/src/lib/merchant_api_get_orders.c +++ b/src/lib/merchant_api_get_orders.c @@ -148,10 +148,10 @@ handle_get_orders_finished (void *cls, { case MHD_HTTP_OK: { - json_t *orders; + const json_t *orders; struct GNUNET_JSON_Specification spec[] = { - GNUNET_JSON_spec_json ("orders", - &orders), + GNUNET_JSON_spec_array_const ("orders", + &orders), GNUNET_JSON_spec_end () }; @@ -162,23 +162,18 @@ handle_get_orders_finished (void *cls, { ogr.hr.http_status = 0; ogr.hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE; + break; } - else + if (GNUNET_OK == + parse_orders (orders, + &ogr, + ogh)) { - if ( (! json_is_array (orders)) || - (GNUNET_OK == - parse_orders (orders, - &ogr, - ogh)) ) - { - GNUNET_JSON_parse_free (spec); - TALER_MERCHANT_orders_get_cancel (ogh); - return; - } - ogr.hr.http_status = 0; - ogr.hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE; + TALER_MERCHANT_orders_get_cancel (ogh); + return; } - GNUNET_JSON_parse_free (spec); + ogr.hr.http_status = 0; + ogr.hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE; break; } case MHD_HTTP_UNAUTHORIZED: |