summaryrefslogtreecommitdiff
path: root/src/backend/taler-merchant-httpd_private-get-products-ID.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-07-21 15:29:48 +0200
committerChristian Grothoff <christian@grothoff.org>2021-07-21 15:29:52 +0200
commit4c184f7e685817b565013c3afb2a5c30ecf10161 (patch)
treea4a6b777fc929b0e0017f887bcd80fcd441e094d /src/backend/taler-merchant-httpd_private-get-products-ID.c
parent1e257c787a4344f242fd941dbfcdb957c7be4ba0 (diff)
downloadmerchant-4c184f7e685817b565013c3afb2a5c30ecf10161.tar.gz
merchant-4c184f7e685817b565013c3afb2a5c30ecf10161.tar.bz2
merchant-4c184f7e685817b565013c3afb2a5c30ecf10161.zip
-fix bugs, FTBFS
Diffstat (limited to 'src/backend/taler-merchant-httpd_private-get-products-ID.c')
-rw-r--r--src/backend/taler-merchant-httpd_private-get-products-ID.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/src/backend/taler-merchant-httpd_private-get-products-ID.c b/src/backend/taler-merchant-httpd_private-get-products-ID.c
index 1fdabc8f..32be4d7c 100644
--- a/src/backend/taler-merchant-httpd_private-get-products-ID.c
+++ b/src/backend/taler-merchant-httpd_private-get-products-ID.c
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- (C) 2019, 2020 Taler Systems SA
+ (C) 2019, 2020, 2021 Taler Systems SA
TALER is free software; you can redistribute it and/or modify it under the
terms of the GNU Affero General Public License as published by the Free Software
@@ -51,28 +51,32 @@ TMH_private_get_products_ID (const struct TMH_RequestHandler *rh,
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_INTERNAL_SERVER_ERROR,
TALER_EC_GENERIC_DB_FETCH_FAILED,
- NULL);
+ "lookup_product");
}
- else if (0 == qs)
+ if (0 == qs)
{
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_NOT_FOUND,
TALER_EC_MERCHANT_GENERIC_PRODUCT_UNKNOWN,
- NULL);
+ hc->infix);
}
{
json_t *reply;
MHD_RESULT ret;
reply = json_pack (
- "{s:s, s:s, s:o, s:o, s:I,"
- " s:I, s:I, s:o, s:o, s:s}",
+ "{s:s, s:o, s:s, s:o, s:o,"
+ " s:o, s:I, s:I, s:I, s:o}",
"description",
pd.description,
+ "description_i18n",
+ pd.description_i18n,
"unit",
pd.unit,
"price",
TALER_JSON_from_amount (&pd.price),
+ "image",
+ pd.image,
"taxes",
pd.taxes,
"total_stock",
@@ -84,18 +88,16 @@ TMH_private_get_products_ID (const struct TMH_RequestHandler *rh,
(json_int_t) pd.total_sold,
"total_lost",
(json_int_t) pd.total_lost,
- "description_i18n",
- pd.description_i18n,
"address",
- pd.address,
- "image",
- pd.image);
+ pd.address);
GNUNET_free (pd.description);
GNUNET_free (pd.unit);
if (0 != pd.next_restock.abs_value_us)
- json_object_set_new (reply,
- "next_restock",
- GNUNET_JSON_from_time_abs (pd.next_restock));
+ GNUNET_assert (0 ==
+ json_object_set_new (
+ reply,
+ "next_restock",
+ GNUNET_JSON_from_time_abs (pd.next_restock)));
ret = TALER_MHD_reply_json (connection,
reply,
MHD_HTTP_OK);