gnunet-svn
[Top][All Lists]
Advanced

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

[taler-merchant] branch master updated: add missing currency check, fix


From: gnunet
Subject: [taler-merchant] branch master updated: add missing currency check, fix test to use string for image
Date: Fri, 16 Apr 2021 23:40:23 +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 4087bfb4 add missing currency check, fix test to use string for image
4087bfb4 is described below

commit 4087bfb43d20c2e7ffb553ce3823f497b307647d
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Fri Apr 16 23:40:19 2021 +0200

    add missing currency check, fix test to use string for image
---
 src/backend/taler-merchant-httpd_private-patch-products-ID.c | 11 +++++++++++
 src/backend/taler-merchant-httpd_private-post-products.c     |  1 -
 src/lib/merchant_api_post_instance_auth.c                    |  2 +-
 src/testing/test_merchant_order_creation.sh                  |  2 +-
 4 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/src/backend/taler-merchant-httpd_private-patch-products-ID.c 
b/src/backend/taler-merchant-httpd_private-patch-products-ID.c
index d1ae5c7d..8f7f6243 100644
--- a/src/backend/taler-merchant-httpd_private-patch-products-ID.c
+++ b/src/backend/taler-merchant-httpd_private-patch-products-ID.c
@@ -151,6 +151,17 @@ TMH_private_patch_products_ID (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
diff --git a/src/backend/taler-merchant-httpd_private-post-products.c 
b/src/backend/taler-merchant-httpd_private-post-products.c
index 9387a657..6239a653 100644
--- a/src/backend/taler-merchant-httpd_private-post-products.c
+++ b/src/backend/taler-merchant-httpd_private-post-products.c
@@ -131,7 +131,6 @@ TMH_private_post_products (const struct TMH_RequestHandler 
*rh,
                                        TALER_EC_GENERIC_CURRENCY_MISMATCH,
                                        NULL);
   }
-
   if (-1 == total_stock)
     pd.total_stock = UINT64_MAX;
   else
diff --git a/src/lib/merchant_api_post_instance_auth.c 
b/src/lib/merchant_api_post_instance_auth.c
index 1111deb5..d16bd2cd 100644
--- a/src/lib/merchant_api_post_instance_auth.c
+++ b/src/lib/merchant_api_post_instance_auth.c
@@ -207,7 +207,7 @@ TALER_MERCHANT_instance_auth_post (
     GNUNET_assert (CURLE_OK ==
                    curl_easy_setopt (eh,
                                      CURLOPT_CUSTOMREQUEST,
-                                     MHD_HTTP_METHOD_POST)); // FIXME: POST?
+                                     MHD_HTTP_METHOD_POST));
     iaph->job = GNUNET_CURL_job_add (ctx,
                                      eh,
                                      &handle_post_instance_auth_finished,
diff --git a/src/testing/test_merchant_order_creation.sh 
b/src/testing/test_merchant_order_creation.sh
index b6e4260e..c865b98c 100755
--- a/src/testing/test_merchant_order_creation.sh
+++ b/src/testing/test_merchant_order_creation.sh
@@ -106,7 +106,7 @@ echo "OK"
 
 
 STATUS=$(curl 'http://localhost:9966/instances/default/private/products' \
-    -d '{"product_id":"1","description":"product with id 1 and price 
:15","price":"USD:15","total_stock":1,"description_i18n":{},"unit":"","image":{},"taxes":[],"address":{},"next_restock":{"t_ms":"never"}}'
 \
+    -d '{"product_id":"1","description":"product with id 1 and price 
:15","price":"USD:15","total_stock":1,"description_i18n":{},"unit":"","image":"","taxes":[],"address":{},"next_restock":{"t_ms":"never"}}'
 \
     -w "%{http_code}" -s -o /dev/null)
 
 if [ "$STATUS" != "409" ]

-- 
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]