diff options
Diffstat (limited to 'src/testing/test_merchant_api.c')
-rw-r--r-- | src/testing/test_merchant_api.c | 221 |
1 files changed, 17 insertions, 204 deletions
diff --git a/src/testing/test_merchant_api.c b/src/testing/test_merchant_api.c index 2a51c29f..5610b987 100644 --- a/src/testing/test_merchant_api.c +++ b/src/testing/test_merchant_api.c @@ -66,10 +66,6 @@ static char *config_file; */ #define EXCHANGE_URL "http://localhost:8081/" -static const char *pickup_amounts_1[] = {"EUR:5", NULL}; - -static const char *pickup_amounts_2[] = {"EUR:0.01", NULL}; - /** * Payto URI of the customer (payer). */ @@ -216,11 +212,11 @@ run (void *cls, "default", MHD_HTTP_NO_CONTENT), TALER_TESTING_cmd_merchant_post_account ( - "instance-create-default-account", - merchant_url, - PAYTO_I1, - NULL, NULL, - MHD_HTTP_OK), + "instance-create-default-account", + merchant_url, + PAYTO_I1, + NULL, NULL, + MHD_HTTP_OK), TALER_TESTING_cmd_merchant_kyc_get ("instance-create-kyc-0", merchant_url, NULL, @@ -937,11 +933,11 @@ run (void *cls, "i1a", MHD_HTTP_NO_CONTENT), TALER_TESTING_cmd_merchant_post_account ( - "instance-create-i1a-account", - merchant_url_i1a, - PAYTO_I1, - NULL, NULL, - MHD_HTTP_OK), + "instance-create-i1a-account", + merchant_url_i1a, + PAYTO_I1, + NULL, NULL, + MHD_HTTP_OK), TALER_TESTING_cmd_merchant_get_product ("get-nx-product-i1a-1", merchant_url_i1a, "nx-product", @@ -1029,187 +1025,6 @@ run (void *cls, TALER_TESTING_cmd_end () }; - struct TALER_TESTING_Command reward[] = { - TALER_TESTING_cmd_merchant_post_reserves ("create-reserve-reward-1", - merchant_url, - "EUR:20.04", - EXCHANGE_URL, - "x-taler-bank", - MHD_HTTP_OK), - TALER_TESTING_cmd_admin_add_incoming_with_ref ( - "create-reserve-reward-1-exch", - "EUR:20.04", - &cred.ba, - payer_payto, - "create-reserve-reward-1", - MHD_HTTP_OK), - /* We need to wait until the merchant re-tries fetching the - reserve from the exchange. */ - cmd_exec_wirewatch ("wirewatch-3"), - TALER_TESTING_cmd_sleep ("reward-sleep", 3), - TALER_TESTING_cmd_reward_authorize ("authorize-reward-1", - merchant_url, - EXCHANGE_URL, - MHD_HTTP_OK, - "reward 1", - "EUR:5.01"), - TALER_TESTING_cmd_reward_authorize_from_reserve ("authorize-reward-2", - merchant_url, - EXCHANGE_URL, - "create-reserve-reward-1-exch", - MHD_HTTP_OK, - "reward 2", - "EUR:5.01"), - TALER_TESTING_cmd_wallet_get_reward ("get-reward-1", - merchant_url, - "authorize-reward-1", - MHD_HTTP_OK), - TALER_TESTING_cmd_merchant_get_reward ("merchant-get-reward-1", - merchant_url, - "authorize-reward-1", - MHD_HTTP_OK), - TALER_TESTING_cmd_get_rewards ("get-rewards-1", - merchant_url, - MHD_HTTP_OK, - "authorize-reward-2", - "authorize-reward-1", - NULL), - TALER_TESTING_cmd_get_rewards2 ("get-rewards-1-asc", - merchant_url, - 0, - 20, - MHD_HTTP_OK, - "authorize-reward-1", - "authorize-reward-2", - NULL), - TALER_TESTING_cmd_get_rewards2 ("get-rewards-1-asc-offset", - merchant_url, - 1, - 20, - MHD_HTTP_OK, - "authorize-reward-2", - NULL), - TALER_TESTING_cmd_merchant_get_reserves ("get-reserves-1", - merchant_url, - MHD_HTTP_OK, - "create-reserve-reward-1-exch", - NULL), - TALER_TESTING_cmd_merchant_get_reserve ("get-reserve-1", - merchant_url, - MHD_HTTP_OK, - "create-reserve-reward-1-exch"), - TALER_TESTING_cmd_merchant_get_reserve_with_rewards ("get-reserve-2", - merchant_url, - MHD_HTTP_OK, - "create-reserve-reward-1-exch", - "authorize-reward-1", - "authorize-reward-2", - NULL), - TALER_TESTING_cmd_reward_pickup ("pickup-reward-1", - merchant_url, - MHD_HTTP_OK, - "authorize-reward-1", - pickup_amounts_1), - TALER_TESTING_cmd_wallet_get_reward2 ("query-reward-2", - merchant_url, - "authorize-reward-1", - "EUR:0.01", - MHD_HTTP_OK), - TALER_TESTING_cmd_reward_pickup ("pickup-reward-2", - merchant_url, - MHD_HTTP_OK, - "authorize-reward-2", - pickup_amounts_1), - - TALER_TESTING_cmd_reward_pickup_with_ec ("pickup-reward-3-too-much", - merchant_url, - MHD_HTTP_BAD_REQUEST, - "authorize-reward-1", - pickup_amounts_1, - TALER_EC_MERCHANT_REWARD_PICKUP_AMOUNT_EXCEEDS_REWARD_REMAINING), - - TALER_TESTING_cmd_reward_pickup ("pickup-reward-4", - merchant_url, - MHD_HTTP_OK, - "authorize-reward-1", - pickup_amounts_2), - TALER_TESTING_cmd_merchant_get_reward_with_pickups ("merchant-get-reward-2", - merchant_url, - "authorize-reward-1", - MHD_HTTP_OK, - "pickup-reward-1", - "pickup-reward-4", - NULL), - - /* This command tests the authorization of reward - * against a reserve that does not exist. This is - * implemented by passing a "reward instance" that - * specifies a reserve key that was never used to - * actually create a reserve. */ - TALER_TESTING_cmd_merchant_post_reserves_fake ( - "create-reserve-reward-2-fake"), - TALER_TESTING_cmd_reward_authorize_from_reserve_with_ec ( - "authorize-reward-null", - merchant_url, - EXCHANGE_URL, - "create-reserve-reward-2-fake", - MHD_HTTP_NOT_FOUND, - "reward 3", - "EUR:5.01", - TALER_EC_MERCHANT_PRIVATE_POST_REWARD_AUTHORIZE_RESERVE_NOT_FOUND), - - /* Test reserve with insufficient funds */ - TALER_TESTING_cmd_merchant_post_reserves ("create-reserve-reward-2", - merchant_url, - "EUR:1.04", - EXCHANGE_URL, - "x-taler-bank", - MHD_HTTP_OK), - TALER_TESTING_cmd_admin_add_incoming_with_ref ( - "create-reserve-reward-2-exch", - "EUR:1.04", - &cred.ba, - payer_payto, - "create-reserve-reward-2", - MHD_HTTP_OK), - cmd_exec_wirewatch ("wirewatch-4"), - TALER_TESTING_cmd_reward_authorize_from_reserve_with_ec ( - "authorize-reward-insufficient-funds", - merchant_url, - EXCHANGE_URL, - "create-reserve-reward-2", - MHD_HTTP_PRECONDITION_FAILED, - "reward 4", - "EUR:5.01", - TALER_EC_MERCHANT_PRIVATE_POST_REWARD_AUTHORIZE_INSUFFICIENT_FUNDS), - TALER_TESTING_cmd_reward_authorize_fake ("fake-reward-authorization"), - TALER_TESTING_cmd_reward_pickup_with_ec ("pickup-non-existent-id", - merchant_url, - MHD_HTTP_NOT_FOUND, - "fake-reward-authorization", - pickup_amounts_1, - TALER_EC_MERCHANT_GENERIC_REWARD_ID_UNKNOWN), - TALER_TESTING_cmd_merchant_get_reserves ("get-reserves-2", - merchant_url, - MHD_HTTP_OK, - "create-reserve-reward-1", - "create-reserve-reward-2", - NULL), - TALER_TESTING_cmd_merchant_delete_reserve ("delete-reserve-reward-1", - merchant_url, - "create-reserve-reward-1", - MHD_HTTP_NO_CONTENT), - TALER_TESTING_cmd_merchant_purge_reserve ("delete-reserve-reward-2", - merchant_url, - "create-reserve-reward-1", - MHD_HTTP_NO_CONTENT), - TALER_TESTING_cmd_merchant_purge_reserve ("delete-reserve-reward-3", - merchant_url, - "create-reserve-reward-1", - MHD_HTTP_NOT_FOUND), - TALER_TESTING_cmd_end () - }; - struct TALER_TESTING_Command pay_again[] = { cmd_transfer_to_exchange ("create-reserve-20", "EUR:20.04"), @@ -1434,7 +1249,7 @@ run (void *cls, merchant_url, "otp-dev", "my OTP device", - "otp-key", + "FEE4P2J", TALER_MCA_WITH_PRICE, 0, MHD_HTTP_NO_CONTENT), @@ -1454,7 +1269,7 @@ run (void *cls, merchant_url, "template-amount", "a different template with an amount", - NULL, + NULL, GNUNET_JSON_PACK ( GNUNET_JSON_pack_uint64 ("minimum_age", 0), GNUNET_JSON_pack_time_rel ("pay_duration", @@ -1693,11 +1508,11 @@ run (void *cls, "default", MHD_HTTP_NO_CONTENT), TALER_TESTING_cmd_merchant_post_account ( - "instance-create-default-account", - merchant_url, - PAYTO_I1, - NULL, NULL, - MHD_HTTP_OK), + "instance-create-default-account", + merchant_url, + PAYTO_I1, + NULL, NULL, + MHD_HTTP_OK), TALER_TESTING_cmd_merchant_post_instances ("instance-create-i1", merchant_url, "i1", @@ -1937,8 +1752,6 @@ run (void *cls, pay_abort), TALER_TESTING_cmd_batch ("refund", refund), - TALER_TESTING_cmd_batch ("reward", - reward), TALER_TESTING_cmd_batch ("templates", templates), TALER_TESTING_cmd_batch ("webhooks", |