merchant

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

commit 1c42a82671cbc792a47d4ae7b86aee339dee2041
parent 44ef77be8ce3ae7bb89f3c10a4f864981f1d0481
Author: Christian Blättler <blatc2@bfh.ch>
Date:   Thu,  6 Jun 2024 09:15:40 +0200

add test for double-spending a token

Diffstat:
Msrc/lib/merchant_api_post_order_pay.c | 5-----
Msrc/testing/test_merchant_api.c | 27++++++++++++++++++++++++---
Msrc/testing/testing_api_cmd_pay_order.c | 2+-
3 files changed, 25 insertions(+), 9 deletions(-)

diff --git a/src/lib/merchant_api_post_order_pay.c b/src/lib/merchant_api_post_order_pay.c @@ -396,11 +396,6 @@ TALER_MERCHANT_order_pay_frontend ( struct TALER_Amount total_fee; struct TALER_Amount total_amount; - if (0 == num_coins) - { - GNUNET_break (0); - return NULL; - } j_coins = json_array (); GNUNET_assert (NULL != j_coins); for (unsigned int i = 0; i<num_coins; i++) diff --git a/src/testing/test_merchant_api.c b/src/testing/test_merchant_api.c @@ -1729,9 +1729,30 @@ run (void *cls, merchant_url, MHD_HTTP_OK, "create-order-with-input-and-output", - "withdraw-coin-2", - "EUR:5", - "EUR:4.99", + "", + "EUR:0", + "EUR:0", + NULL, + 0, + "pay-order-with-output"), + TALER_TESTING_cmd_merchant_post_orders_choices ("create-another-order-with-input-and-output", + cred.cfg, + merchant_url, + MHD_HTTP_OK, + "create-tokenfamily", + 1, + 1, + "5-input-output-2", + GNUNET_TIME_UNIT_ZERO_TS, + GNUNET_TIME_UNIT_FOREVER_TS, + "EUR:0.0"), + TALER_TESTING_cmd_merchant_pay_order_choices ("double-spend-token", + merchant_url, + MHD_HTTP_CONFLICT, + "create-another-order-with-input-and-output", + "", + "EUR:0", + "EUR:0", NULL, 0, "pay-order-with-output"), diff --git a/src/testing/testing_api_cmd_pay_order.c b/src/testing/testing_api_cmd_pay_order.c @@ -300,7 +300,7 @@ build_coins (struct TALER_MERCHANT_PayCoin **pc, /* Token syntax is "LABEL[/NUMBER]" */ ctok = strchr (token, '/'); - // TODO: Check why this is not used? + // TODO: Check why ci variable is parsed but not used? ci = 0; if (NULL != ctok) {