summaryrefslogtreecommitdiff
path: root/src/testing
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2022-06-06 19:42:46 +0200
committerChristian Grothoff <christian@grothoff.org>2022-06-06 19:43:06 +0200
commit89d4f6430956129d9bfb29551fc2fa1c5c147676 (patch)
tree81bc1888abd15b01e18071615416f591a6a40b3f /src/testing
parent2d1e2b3e9992652ab1ff2e7b8a34a511779d04dd (diff)
downloadmerchant-89d4f6430956129d9bfb29551fc2fa1c5c147676.tar.gz
merchant-89d4f6430956129d9bfb29551fc2fa1c5c147676.tar.bz2
merchant-89d4f6430956129d9bfb29551fc2fa1c5c147676.zip
fix backend double-pay issue (#7244)
Diffstat (limited to 'src/testing')
-rw-r--r--src/testing/test_merchant_api.c36
-rw-r--r--src/testing/testing_api_cmd_delete_order.c1
-rw-r--r--src/testing/testing_api_cmd_pay_order.c21
3 files changed, 37 insertions, 21 deletions
diff --git a/src/testing/test_merchant_api.c b/src/testing/test_merchant_api.c
index 27129066..c73e025e 100644
--- a/src/testing/test_merchant_api.c
+++ b/src/testing/test_merchant_api.c
@@ -1162,26 +1162,36 @@ run (void *cls,
};
struct TALER_TESTING_Command pay_again[] = {
- cmd_transfer_to_exchange ("create-reserve-10",
- "EUR:10.02"),
- cmd_exec_wirewatch ("wirewatch-10"),
+ cmd_transfer_to_exchange ("create-reserve-20",
+ "EUR:20.04"),
+ cmd_exec_wirewatch ("wirewatch-20"),
TALER_TESTING_cmd_check_bank_admin_transfer ("check_bank_transfer-10",
- "EUR:10.02",
+ "EUR:20.04",
payer_payto,
exchange_payto,
- "create-reserve-10"),
+ "create-reserve-20"),
TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-10a",
- "create-reserve-10",
+ "create-reserve-20",
"EUR:5",
0,
MHD_HTTP_OK),
TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-10b",
- "create-reserve-10",
+ "create-reserve-20",
+ "EUR:5",
+ 0,
+ MHD_HTTP_OK),
+ TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-10c",
+ "create-reserve-20",
+ "EUR:5",
+ 0,
+ MHD_HTTP_OK),
+ TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-10d",
+ "create-reserve-20",
"EUR:5",
0,
MHD_HTTP_OK),
- TALER_TESTING_cmd_status ("withdraw-status-10",
- "create-reserve-10",
+ TALER_TESTING_cmd_status ("withdraw-status-20",
+ "create-reserve-20",
"EUR:0",
MHD_HTTP_OK),
TALER_TESTING_cmd_merchant_post_orders ("create-proposal-10",
@@ -1207,6 +1217,14 @@ run (void *cls,
"EUR:5",
"EUR:4.99",
NULL),
+ TALER_TESTING_cmd_merchant_pay_order ("pay-too-much-10",
+ merchant_url,
+ MHD_HTTP_CONFLICT,
+ "create-proposal-10",
+ "withdraw-coin-10c;withdraw-coin-10d",
+ "EUR:5",
+ "EUR:4.99",
+ NULL),
CMD_EXEC_AGGREGATOR ("run-aggregator-10"),
TALER_TESTING_cmd_check_bank_transfer ("check_bank_transfer-9.97-10",
EXCHANGE_URL,
diff --git a/src/testing/testing_api_cmd_delete_order.c b/src/testing/testing_api_cmd_delete_order.c
index d5d8b283..586b348c 100644
--- a/src/testing/testing_api_cmd_delete_order.c
+++ b/src/testing/testing_api_cmd_delete_order.c
@@ -124,6 +124,7 @@ delete_order_run (void *cls,
dos->odh = TALER_MERCHANT_order_delete (is->ctx,
dos->merchant_url,
dos->order_id,
+ false, /* TODO: support testing force... */
&delete_order_cb,
dos);
GNUNET_assert (NULL != dos->odh);
diff --git a/src/testing/testing_api_cmd_pay_order.c b/src/testing/testing_api_cmd_pay_order.c
index be2649c0..61a43b9e 100644
--- a/src/testing/testing_api_cmd_pay_order.c
+++ b/src/testing/testing_api_cmd_pay_order.c
@@ -184,8 +184,8 @@ build_coins (struct TALER_MERCHANT_PayCoin **pc,
&denom_value));
GNUNET_assert (GNUNET_OK ==
TALER_TESTING_get_trait_h_age_commitment (coin_cmd,
- 0,
- &h_age_commitment));
+ 0,
+ &h_age_commitment));
icoin->coin_priv = *coin_priv;
icoin->denom_pub = denom_pub->key;
icoin->denom_sig = *denom_sig;
@@ -218,30 +218,27 @@ build_coins (struct TALER_MERCHANT_PayCoin **pc,
* HTTP response code matches our expectation.
*
* @param cls closure with the interpreter state
- * @param hr HTTP response
- * @param merchant_sig signature affirming payment,
- * NULL on errors
+ * @param pr HTTP response
*/
static void
pay_cb (void *cls,
- const struct TALER_MERCHANT_HttpResponse *hr,
- const struct TALER_MerchantSignatureP *merchant_sig)
+ const struct TALER_MERCHANT_PayResponse *pr)
{
struct PayState *ps = cls;
ps->oph = NULL;
- if (ps->http_status != hr->http_status)
+ if (ps->http_status != pr->hr.http_status)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Unexpected response code %u (%d) to command %s\n",
- hr->http_status,
- (int) hr->ec,
+ pr->hr.http_status,
+ (int) pr->hr.ec,
TALER_TESTING_interpreter_get_current_label (ps->is));
TALER_TESTING_FAIL (ps->is);
}
- if (MHD_HTTP_OK == hr->http_status)
+ if (MHD_HTTP_OK == pr->hr.http_status)
{
- ps->merchant_sig = *merchant_sig;
+ ps->merchant_sig = pr->details.success.merchant_sig;
}
TALER_TESTING_interpreter_next (ps->is);
}