gnunet-svn
[Top][All Lists]
Advanced

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

[taler-merchant] branch master updated: fix #6844


From: gnunet
Subject: [taler-merchant] branch master updated: fix #6844
Date: Wed, 14 Apr 2021 14:40:20 +0200

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 972e9098 fix #6844
972e9098 is described below

commit 972e9098215a28f45e8542b0f34b79aa42096f0e
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Wed Apr 14 14:40:16 2021 +0200

    fix #6844
---
 src/backend/taler-merchant-httpd_private-post-orders.c   |  6 ++++--
 src/backend/taler-merchant-httpd_private-post-products.c | 12 ++++++++++++
 src/testing/Makefile.am                                  |  3 ++-
 3 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/src/backend/taler-merchant-httpd_private-post-orders.c 
b/src/backend/taler-merchant-httpd_private-post-orders.c
index 528cb9ef..9ae9a1bd 100644
--- a/src/backend/taler-merchant-httpd_private-post-orders.c
+++ b/src/backend/taler-merchant-httpd_private-post-orders.c
@@ -1153,7 +1153,7 @@ merge_inventory (struct MHD_Connection *connection,
       {
         json_t *p;
 
-        p = json_pack ("{s:s, s:o, s:s, s:o, s:o, s:o}",
+        p = json_pack ("{s:s, s:o, s:s, s:o, s:o, s:o, s:I}",
                        "description",
                        pd.description,
                        "description_i18n",
@@ -1165,7 +1165,9 @@ merge_inventory (struct MHD_Connection *connection,
                        "taxes",
                        pd.taxes,
                        "image",
-                       pd.image);
+                       pd.image,
+                       "quantity",
+                       (json_int_t) inventory_products[i].quantity);
         GNUNET_assert (NULL != p);
         GNUNET_assert (0 ==
                        json_array_append_new (np,
diff --git a/src/backend/taler-merchant-httpd_private-post-products.c 
b/src/backend/taler-merchant-httpd_private-post-products.c
index c9ce24a6..987857b4 100644
--- a/src/backend/taler-merchant-httpd_private-post-products.c
+++ b/src/backend/taler-merchant-httpd_private-post-products.c
@@ -117,12 +117,24 @@ TMH_private_post_products (const struct 
TMH_RequestHandler *rh,
              ? MHD_YES
              : MHD_NO;
   }
+  if (0 !=
+      strcasecmp (pd.price.currency,
+                  TMH_currency))
+  {
+    GNUNET_break_op (0);
+    GNUNET_JSON_parse_free (spec);
+    return TALER_MHD_reply_with_error (connection,
+                                       MHD_HTTP_CONFLICT,
+                                       TALER_EC_GENERIC_CURRENCY_MISMATCH,
+                                       NULL);
+  }
 
   if (-1 == total_stock)
     pd.total_stock = UINT64_MAX;
   else
     pd.total_stock = (uint64_t) total_stock;
 
+
   for (unsigned int i = 0; i<MAX_RETRIES; i++)
   {
     /* Test if an product of this id is known */
diff --git a/src/testing/Makefile.am b/src/testing/Makefile.am
index dac8a2e5..67d808cc 100644
--- a/src/testing/Makefile.am
+++ b/src/testing/Makefile.am
@@ -9,7 +9,8 @@ endif
 
 check_SCRIPTS = \
   test-merchant-walletharness.sh \
-  test_merchant_instance_response.sh
+  test_merchant_instance_response.sh \
+  test_merchant_order_creation.sh
 
 lib_LTLIBRARIES = \
   libtalermerchanttesting.la

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

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