aboutsummaryrefslogtreecommitdiff
path: root/src/reducer/anastasis_api_redux.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/reducer/anastasis_api_redux.c')
-rw-r--r--src/reducer/anastasis_api_redux.c100
1 files changed, 52 insertions, 48 deletions
diff --git a/src/reducer/anastasis_api_redux.c b/src/reducer/anastasis_api_redux.c
index eb7e362..7b7e5d5 100644
--- a/src/reducer/anastasis_api_redux.c
+++ b/src/reducer/anastasis_api_redux.c
@@ -287,10 +287,14 @@ ANASTASIS_redux_fail_ (ANASTASIS_ActionCallback cb,
287{ 287{
288 json_t *estate; 288 json_t *estate;
289 289
290 estate = json_pack ("{s:s?, s:I, s:s}", 290 estate = GNUNET_JSON_PACK (
291 "detail", detail, 291 GNUNET_JSON_pack_allow_null (
292 "code", (json_int_t) ec, 292 GNUNET_JSON_pack_string ("detail",
293 "hint", TALER_ErrorCode_get_hint (ec)); 293 detail)),
294 GNUNET_JSON_pack_uint64 ("code",
295 ec),
296 GNUNET_JSON_pack_string ("hint",
297 TALER_ErrorCode_get_hint (ec)));
294 cb (cb_cls, 298 cb (cb_cls,
295 ec, 299 ec,
296 estate); 300 estate);
@@ -473,11 +477,11 @@ notify_waiting (struct ConfigRequest *cr)
473 477
474 if (TALER_EC_NONE != cr->ec) 478 if (TALER_EC_NONE != cr->ec)
475 { 479 {
476 prov = json_pack ("{s:I, s:I}", 480 prov = GNUNET_JSON_PACK (
477 "error_code", 481 GNUNET_JSON_pack_uint64 ("error_code",
478 (json_int_t) cr->ec, 482 cr->ec),
479 "http_status", 483 GNUNET_JSON_pack_uint64 ("http_status",
480 (json_int_t) cr->http_status); 484 cr->http_status));
481 } 485 }
482 else 486 else
483 { 487 {
@@ -488,38 +492,35 @@ notify_waiting (struct ConfigRequest *cr)
488 for (unsigned int i = 0; i<cr->methods_length; i++) 492 for (unsigned int i = 0; i<cr->methods_length; i++)
489 { 493 {
490 struct AuthorizationMethodConfig *method = &cr->methods[i]; 494 struct AuthorizationMethodConfig *method = &cr->methods[i];
491 json_t *mj = json_pack ("{s:s, s:o}", 495 json_t *mj = GNUNET_JSON_PACK (
492 "type", 496 GNUNET_JSON_pack_string ("type",
493 method->type, 497 method->type),
494 "usage_fee", 498 TALER_JSON_pack_amount ("usage_fee",
495 TALER_JSON_from_amount (&method->usage_fee)); 499 &method->usage_fee));
496 500
497 GNUNET_assert (NULL != mj);
498 GNUNET_assert (0 == 501 GNUNET_assert (0 ==
499 json_array_append_new (methods_list, 502 json_array_append_new (methods_list,
500 mj)); 503 mj));
501 } 504 }
502 prov = json_pack ("{s:o, s:o, s:o, s:o, s:s," 505 prov = GNUNET_JSON_PACK (
503 " s:s, s:I, s:o, s:I}", 506 GNUNET_JSON_pack_array_steal ("methods",
504 "methods", 507 methods_list),
505 methods_list, 508 TALER_JSON_pack_amount ("annual_fee",
506 "annual_fee", 509 &cr->annual_fee),
507 TALER_JSON_from_amount (&cr->annual_fee), 510 TALER_JSON_pack_amount ("truth_upload_fee",
508 "truth_upload_fee", 511 &cr->truth_upload_fee),
509 TALER_JSON_from_amount (&cr->truth_upload_fee), 512 TALER_JSON_pack_amount ("liability_limit",
510 "liability_limit", 513 &cr->liability_limit),
511 TALER_JSON_from_amount (&cr->liability_limit), 514 GNUNET_JSON_pack_string ("currency",
512 "currency", 515 cr->currency),
513 cr->currency, 516 GNUNET_JSON_pack_string ("business_name",
514 /* 6 */ 517 cr->business_name),
515 "business_name", 518 GNUNET_JSON_pack_uint64 ("storage_limit_in_megabytes",
516 cr->business_name, 519 cr->storage_limit_in_megabytes),
517 "storage_limit_in_megabytes", 520 GNUNET_JSON_pack_data_auto ("salt",
518 (json_int_t) cr->storage_limit_in_megabytes, 521 &cr->salt),
519 "salt", 522 GNUNET_JSON_pack_uint64 ("http_status",
520 GNUNET_JSON_from_data_auto (&cr->salt), 523 cr->http_status));
521 "http_status",
522 (json_int_t) cr->http_status);
523 } 524 }
524 GNUNET_assert (0 == 525 GNUNET_assert (0 ==
525 json_object_set_new (provider_list, 526 json_object_set_new (provider_list,
@@ -1682,9 +1683,9 @@ ANASTASIS_REDUX_load_continents_ ()
1682 } 1683 }
1683 if (NULL == ex) 1684 if (NULL == ex)
1684 { 1685 {
1685 ex = json_pack ("{s:O}", 1686 ex = GNUNET_JSON_PACK (
1686 "name", 1687 GNUNET_JSON_pack_object_incref ("name",
1687 continent); 1688 (json_t *) continent));
1688 GNUNET_assert (0 == 1689 GNUNET_assert (0 ==
1689 json_array_append_new (continents, 1690 json_array_append_new (continents,
1690 ex)); 1691 ex));
@@ -1708,23 +1709,26 @@ ANASTASIS_REDUX_load_continents_ ()
1708 if (NULL == name_ex) 1709 if (NULL == name_ex)
1709 { 1710 {
1710 name_ex = json_object (); 1711 name_ex = json_object ();
1711 json_object_set_new (ex, 1712 GNUNET_assert (NULL != name_ex);
1712 "name_i18n", 1713 GNUNET_assert (0 ==
1713 name_ex); 1714 json_object_set_new (ex,
1715 "name_i18n",
1716 name_ex));
1714 } 1717 }
1715 if (NULL == json_object_get (name_ex, 1718 if (NULL == json_object_get (name_ex,
1716 lang)) 1719 lang))
1717 { 1720 {
1718 json_object_set (name_ex, 1721 GNUNET_assert (0 ==
1719 lang, 1722 json_object_set (name_ex,
1720 trans); 1723 lang,
1724 trans));
1721 } 1725 }
1722 } 1726 }
1723 } 1727 }
1724 } 1728 }
1725 } 1729 }
1726 } 1730 }
1727 return json_pack ("{s:o}", 1731 return GNUNET_JSON_PACK (
1728 "continents", 1732 GNUNET_JSON_pack_array_steal ("continents",
1729 continents); 1733 continents));
1730} 1734}