diff options
author | Christian Grothoff <christian@grothoff.org> | 2021-04-14 14:40:16 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2021-04-14 14:40:16 +0200 |
commit | 972e9098215a28f45e8542b0f34b79aa42096f0e (patch) | |
tree | 63c0d96e2d1db61f13c73f1f06ccf19dce37d2a9 | |
parent | 9fe3318563f3ca02147b80d66f8f49e1f7d04353 (diff) |
fix #6844
-rw-r--r-- | src/backend/taler-merchant-httpd_private-post-orders.c | 6 | ||||
-rw-r--r-- | src/backend/taler-merchant-httpd_private-post-products.c | 12 | ||||
-rw-r--r-- | 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 |