diff options
author | Christian Grothoff <christian@grothoff.org> | 2024-02-24 13:13:31 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2024-02-24 13:13:31 +0100 |
commit | a84dbc0e60adbc27f4f98a024c469dd51df8f817 (patch) | |
tree | d72418611e5e675ccdf0b7f3f996c6190200701e /src/testing/test_merchant_api.c | |
parent | bfb86da296a788d4b96ac55fd9b06c58e34cd98e (diff) |
add (working) test for repurchase detection
Diffstat (limited to 'src/testing/test_merchant_api.c')
-rw-r--r-- | src/testing/test_merchant_api.c | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/src/testing/test_merchant_api.c b/src/testing/test_merchant_api.c index 5610b987..cff12442 100644 --- a/src/testing/test_merchant_api.c +++ b/src/testing/test_merchant_api.c @@ -1477,7 +1477,86 @@ run (void *cls, MHD_HTTP_NO_CONTENT), TALER_TESTING_cmd_end () }; + struct TALER_TESTING_Command repurchase[] = { + cmd_transfer_to_exchange ( + "create-reserve-30x", + "EUR:30.06"), + cmd_exec_wirewatch ( + "wirewatch-30x"), + TALER_TESTING_cmd_check_bank_admin_transfer ( + "check_bank_transfer-30x", + "EUR:30.06", + payer_payto, + exchange_payto, + "create-reserve-30x"), + TALER_TESTING_cmd_withdraw_amount ( + "withdraw-coin-rep", + "create-reserve-30x", + "EUR:5", + 0, + MHD_HTTP_OK), + TALER_TESTING_cmd_merchant_post_orders3 ( + "post-order-repurchase-original", + cred.cfg, + merchant_url, + MHD_HTTP_OK, + GNUNET_TIME_relative_to_timestamp (GNUNET_TIME_UNIT_MINUTES), + GNUNET_TIME_UNIT_FOREVER_TS, + "https://fulfillment.example.com/", + "EUR:1.0"), + TALER_TESTING_cmd_merchant_pay_order ( + "repurchase-pay-first", + merchant_url, + MHD_HTTP_OK, + "post-order-repurchase-original", + "withdraw-coin-rep", + "EUR:1.00", + "EUR:0.99", + "repurchase-session"), + TALER_TESTING_cmd_merchant_get_order3 ( + "repurchase-check-primary-payment", + merchant_url, + "post-order-repurchase-original", + TALER_MERCHANT_OSC_PAID, + "repurchase-session", + NULL, + MHD_HTTP_OK), + TALER_TESTING_cmd_merchant_get_order3 ( + "repurchase-check-primary-payment-bad-binding", + merchant_url, + "post-order-repurchase-original", + TALER_MERCHANT_OSC_CLAIMED, /* someone else has it! */ + "wrong-session", + NULL, + MHD_HTTP_OK), + TALER_TESTING_cmd_merchant_post_orders3 ( + "post-order-repurchase-secondary", + cred.cfg, + merchant_url, + MHD_HTTP_OK, + GNUNET_TIME_relative_to_timestamp (GNUNET_TIME_UNIT_MINUTES), + GNUNET_TIME_UNIT_FOREVER_TS, + "https://fulfillment.example.com/", + "EUR:1.0"), + TALER_TESTING_cmd_merchant_get_order3 ( + "repurchase-check-secondary-payment", + merchant_url, + "post-order-repurchase-secondary", + TALER_MERCHANT_OSC_UNPAID, + "repurchase-session", + NULL, + MHD_HTTP_OK), + TALER_TESTING_cmd_merchant_get_order3 ( + "repurchase-check-secondary-payment", + merchant_url, + "post-order-repurchase-secondary", + TALER_MERCHANT_OSC_UNPAID, + "repurchase-session", + "post-order-repurchase-original", + MHD_HTTP_OK), + TALER_TESTING_cmd_end () + }; struct TALER_TESTING_Command commands[] = { /* general setup */ @@ -1742,6 +1821,7 @@ run (void *cls, merchant_url, "product-2", MHD_HTTP_CONFLICT), +#if 1 TALER_TESTING_cmd_batch ("pay", pay), TALER_TESTING_cmd_batch ("double-spending", @@ -1758,6 +1838,9 @@ run (void *cls, webhooks), TALER_TESTING_cmd_batch ("auth", auth), +#endif + TALER_TESTING_cmd_batch ("repurchase", + repurchase), /** * End the suite. */ |