merchant

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

commit 972e9098215a28f45e8542b0f34b79aa42096f0e
parent 9fe3318563f3ca02147b80d66f8f49e1f7d04353
Author: Christian Grothoff <christian@grothoff.org>
Date:   Wed, 14 Apr 2021 14:40:16 +0200

fix #6844

Diffstat:
Msrc/backend/taler-merchant-httpd_private-post-orders.c | 6++++--
Msrc/backend/taler-merchant-httpd_private-post-products.c | 12++++++++++++
Msrc/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 @@ -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 @@ -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 @@ -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