commit 366269596329bb44987b3da25d62a2d4081e4d70 parent 14569a5703997c14771117da6078f0bd8d8a74df Author: Christian Grothoff <christian@grothoff.org> Date: Mon, 19 Apr 2021 17:45:01 +0200 fix infinite supply handling: Database can only represent INT64_MAX, not UINT64_MAX Diffstat:
4 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/backend/taler-merchant-httpd_private-get-products-ID.c b/src/backend/taler-merchant-httpd_private-get-products-ID.c @@ -76,7 +76,7 @@ TMH_private_get_products_ID (const struct TMH_RequestHandler *rh, "taxes", pd.taxes, "total_stock", - (UINT64_MAX == pd.total_stock) + (INT64_MAX == pd.total_stock) ? (json_int_t) -1 : (json_int_t) pd.total_stock, /* end of first group of 5 */ diff --git a/src/backend/taler-merchant-httpd_private-patch-products-ID.c b/src/backend/taler-merchant-httpd_private-patch-products-ID.c @@ -163,7 +163,7 @@ TMH_private_patch_products_ID (const struct TMH_RequestHandler *rh, NULL); } if (-1 == total_stock) - pd.total_stock = UINT64_MAX; + pd.total_stock = INT64_MAX; else pd.total_stock = (uint64_t) total_stock; if (NULL != json_object_get (hc->request_body, diff --git a/src/backend/taler-merchant-httpd_private-post-products.c b/src/backend/taler-merchant-httpd_private-post-products.c @@ -132,7 +132,7 @@ TMH_private_post_products (const struct TMH_RequestHandler *rh, NULL); } if (-1 == total_stock) - pd.total_stock = UINT64_MAX; + pd.total_stock = INT64_MAX; else pd.total_stock = (uint64_t) total_stock; diff --git a/src/testing/Makefile.am b/src/testing/Makefile.am @@ -10,6 +10,7 @@ endif check_SCRIPTS = \ test-merchant-walletharness.sh \ test_merchant_instance_response.sh \ + test_merchant_product_creation.sh \ test_merchant_order_creation.sh lib_LTLIBRARIES = \