diff options
author | Christian Grothoff <christian@grothoff.org> | 2021-04-16 23:40:19 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2021-04-16 23:40:19 +0200 |
commit | 4087bfb43d20c2e7ffb553ce3823f497b307647d (patch) | |
tree | c41960090878e1bd7566594ddefee9e3382433a1 | |
parent | 778176a664c9ecf96073ffbc2e1823a4366fd37a (diff) |
add missing currency check, fix test to use string for image
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" ] |