gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-merchant] branch master updated: stay with simple strings, i18n n


From: gnunet
Subject: [taler-merchant] branch master updated: stay with simple strings, i18n now to be solved in backwards-compatible way (reverting previous i18n patch)
Date: Tue, 03 Mar 2020 09:31:40 +0100

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository merchant.

The following commit(s) were added to refs/heads/master by this push:
     new 892a3da  stay with simple strings, i18n now to be solved in 
backwards-compatible way (reverting previous i18n patch)
892a3da is described below

commit 892a3dac2ed4303fb58016b7170bd9f00c9e6b6b
Author: Christian Grothoff <address@hidden>
AuthorDate: Tue Mar 3 09:31:38 2020 +0100

    stay with simple strings, i18n now to be solved in backwards-compatible way 
(reverting previous i18n patch)
---
 src/backend/taler-merchant-httpd_order.c | 32 +++++++++++++++++++++++++-------
 1 file changed, 25 insertions(+), 7 deletions(-)

diff --git a/src/backend/taler-merchant-httpd_order.c 
b/src/backend/taler-merchant-httpd_order.c
index c873be9..67da89c 100644
--- a/src/backend/taler-merchant-httpd_order.c
+++ b/src/backend/taler-merchant-httpd_order.c
@@ -68,16 +68,34 @@ check_products (json_t *products)
     return GNUNET_SYSERR;
   }
   json_array_foreach (products, index, value) {
-
-    if (NULL == json_object_get (value,
-                                 "description"))
+    const char *description;
+    const char *error_name;
+    unsigned int error_line;
+    int res;
+    struct GNUNET_JSON_Specification spec[] = {
+      GNUNET_JSON_spec_string ("description", &description),
+      /* FIXME: there are other fields in the product specification
+         that are currently not labeled as optional. Maybe check
+        those as well, or make them truly optional. */
+      GNUNET_JSON_spec_end ()
+    };
+
+    /* extract fields we need to sign separately */
+    res = GNUNET_JSON_parse (value,
+                             spec,
+                             &error_name,
+                             &error_line);
+    if (GNUNET_OK != res)
     {
       GNUNET_break (0);
       GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                  "Product description parsing failed at product #%u\n",
-                  (unsigned int) index);
+                  "Product description parsing failed at #%u: %s:%u\n",
+                  (unsigned int) index,
+                  error_name,
+                  error_line);
       return GNUNET_SYSERR;
     }
+    GNUNET_JSON_parse_free (spec);
   }
   return GNUNET_OK;
 }
@@ -195,7 +213,7 @@ proposal_put (struct MHD_Connection *connection,
   int res;
   struct TALER_Amount total;
   const char *order_id;
-  json_t *summary;
+  const char *summary;
   const char *fulfillment_url;
   json_t *products;
   json_t *merchant;
@@ -206,7 +224,7 @@ proposal_put (struct MHD_Connection *connection,
   struct GNUNET_JSON_Specification spec[] = {
     TALER_JSON_spec_amount ("amount", &total),
     GNUNET_JSON_spec_string ("order_id", &order_id),
-    GNUNET_JSON_spec_json ("summary", &summary),
+    GNUNET_JSON_spec_string ("summary", &summary),
     GNUNET_JSON_spec_string ("fulfillment_url",
                              &fulfillment_url),
     /**

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]