merchant

Merchant backend to process payments, run by merchants
Log | Files | Refs | Submodules | README | LICENSE

commit 4087bfb43d20c2e7ffb553ce3823f497b307647d
parent 778176a664c9ecf96073ffbc2e1823a4366fd37a
Author: Christian Grothoff <christian@grothoff.org>
Date:   Fri, 16 Apr 2021 23:40:19 +0200

add missing currency check, fix test to use string for image

Diffstat:
Msrc/backend/taler-merchant-httpd_private-patch-products-ID.c | 11+++++++++++
Msrc/backend/taler-merchant-httpd_private-post-products.c | 1-
Msrc/lib/merchant_api_post_instance_auth.c | 2+-
Msrc/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 @@ -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 @@ -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 @@ -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 @@ -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" ]