[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-merchant] 02/03: work on #6525
From: |
gnunet |
Subject: |
[taler-merchant] 02/03: work on #6525 |
Date: |
Sun, 25 Oct 2020 19:17:26 +0100 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository merchant.
commit 1a1760c6fe08d3cf132b2bf7a45f9c9fe53a6ef2
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sun Oct 25 19:13:19 2020 +0100
work on #6525
---
.../taler-merchant-httpd_private-post-products.c | 29 +++-------------------
1 file changed, 4 insertions(+), 25 deletions(-)
diff --git a/src/backend/taler-merchant-httpd_private-post-products.c
b/src/backend/taler-merchant-httpd_private-post-products.c
index 3a35b9e..e77690b 100644
--- a/src/backend/taler-merchant-httpd_private-post-products.c
+++ b/src/backend/taler-merchant-httpd_private-post-products.c
@@ -74,7 +74,7 @@ TMH_private_post_products (const struct TMH_RequestHandler
*rh,
struct TMH_HandlerContext *hc)
{
struct TMH_MerchantInstance *mi = hc->instance;
- struct TALER_MERCHANTDB_ProductDetails pd;
+ struct TALER_MERCHANTDB_ProductDetails pd = { 0 };
const char *product_id;
int64_t total_stock;
enum GNUNET_DB_QueryStatus qs;
@@ -85,6 +85,9 @@ TMH_private_post_products (const struct TMH_RequestHandler
*rh,
(const char **) &pd.description),
GNUNET_JSON_spec_json ("description_i18n",
&pd.description_i18n),
+ GNUNET_JSON_spec_mark_optional (
+ TALER_JSON_spec_absolute_time ("next_restock",
+ &pd.next_restock)),
GNUNET_JSON_spec_string ("unit",
(const char **) &pd.unit),
TALER_JSON_spec_amount ("price",
@@ -109,8 +112,6 @@ TMH_private_post_products (const struct TMH_RequestHandler
*rh,
res = TALER_MHD_parse_json_data (connection,
hc->request_body,
spec);
- pd.total_sold = 0;
- pd.total_lost = 0;
if (GNUNET_OK != res)
return (GNUNET_NO == res)
? MHD_YES
@@ -121,28 +122,6 @@ TMH_private_post_products (const struct TMH_RequestHandler
*rh,
pd.total_stock = UINT64_MAX;
else
pd.total_stock = (uint64_t) total_stock;
- if (NULL != json_object_get (hc->request_body,
- "next_restock"))
- {
- enum GNUNET_GenericReturnValue res;
- struct GNUNET_JSON_Specification spec[] = {
- TALER_JSON_spec_absolute_time ("next_restock",
- &pd.next_restock),
- GNUNET_JSON_spec_end ()
- };
-
- res = TALER_MHD_parse_json_data (connection,
- hc->request_body,
- spec);
- if (GNUNET_OK != res)
- return (GNUNET_NO == res)
- ? MHD_YES
- : MHD_NO;
- }
- else
- {
- pd.next_restock.abs_value_us = 0;
- }
for (unsigned int i = 0; i<MAX_RETRIES; i++)
{
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.