summaryrefslogtreecommitdiff
path: root/src/testing
diff options
context:
space:
mode:
Diffstat (limited to 'src/testing')
-rw-r--r--src/testing/Makefile.am10
-rw-r--r--src/testing/test_kyc_api.c2
-rw-r--r--src/testing/test_merchant_api.c272
-rw-r--r--src/testing/test_merchant_api_home/taler/exchange-secmod-cs/keys/coin_eur_1/1687974704bin32 -> 0 bytes
-rw-r--r--src/testing/test_merchant_api_home/taler/exchange-secmod-cs/keys/coin_eur_5/16879747042
-rw-r--r--src/testing/test_merchant_api_home/taler/exchange-secmod-cs/keys/coin_eur_ct_1/16879747041
-rw-r--r--src/testing/test_merchant_api_home/taler/exchange-secmod-cs/keys/coin_eur_ct_10/1687974704bin32 -> 0 bytes
-rw-r--r--src/testing/test_merchant_api_twisted.c17
-rw-r--r--src/testing/testing_api_cmd_get_reserve.c80
-rw-r--r--src/testing/testing_api_cmd_get_rewards.c (renamed from src/testing/testing_api_cmd_get_tips.c)163
-rw-r--r--src/testing/testing_api_cmd_merchant_get_reward.c (renamed from src/testing/testing_api_cmd_merchant_get_tip.c)123
-rw-r--r--src/testing/testing_api_cmd_reward_authorize.c (renamed from src/testing/testing_api_cmd_tip_authorize.c)214
-rw-r--r--src/testing/testing_api_cmd_reward_pickup.c (renamed from src/testing/testing_api_cmd_tip_pickup.c)120
-rw-r--r--src/testing/testing_api_cmd_wallet_get_reward.c (renamed from src/testing/testing_api_cmd_wallet_get_tip.c)121
14 files changed, 558 insertions, 567 deletions
diff --git a/src/testing/Makefile.am b/src/testing/Makefile.am
index 153b0e1f..f2b19c83 100644
--- a/src/testing/Makefile.am
+++ b/src/testing/Makefile.am
@@ -41,7 +41,7 @@ libtalermerchanttesting_la_SOURCES = \
testing_api_cmd_get_products.c \
testing_api_cmd_get_reserve.c \
testing_api_cmd_get_reserves.c \
- testing_api_cmd_get_tips.c \
+ testing_api_cmd_get_rewards.c \
testing_api_cmd_get_transfers.c \
testing_api_cmd_get_templates.c \
testing_api_cmd_get_template.c \
@@ -60,7 +60,7 @@ libtalermerchanttesting_la_SOURCES = \
testing_api_cmd_lock_product.c \
testing_api_cmd_instance_auth.c \
testing_api_cmd_merchant_get_order.c \
- testing_api_cmd_merchant_get_tip.c \
+ testing_api_cmd_merchant_get_reward.c \
testing_api_cmd_pay_order.c \
testing_api_cmd_post_account.c \
testing_api_cmd_post_instances.c \
@@ -77,11 +77,11 @@ libtalermerchanttesting_la_SOURCES = \
testing_api_cmd_patch_template.c \
testing_api_cmd_patch_webhook.c \
testing_api_cmd_refund_order.c \
- testing_api_cmd_tip_authorize.c \
- testing_api_cmd_tip_pickup.c \
+ testing_api_cmd_reward_authorize.c \
+ testing_api_cmd_reward_pickup.c \
testing_api_cmd_tme.c \
testing_api_cmd_wallet_get_order.c \
- testing_api_cmd_wallet_get_tip.c \
+ testing_api_cmd_wallet_get_reward.c \
testing_api_cmd_wallet_post_orders_refund.c \
testing_api_cmd_webhook.c \
testing_api_cmd_testserver.c \
diff --git a/src/testing/test_kyc_api.c b/src/testing/test_kyc_api.c
index 6a6407eb..c93455e4 100644
--- a/src/testing/test_kyc_api.c
+++ b/src/testing/test_kyc_api.c
@@ -387,11 +387,11 @@ run (void *cls,
NULL),
TALER_TESTING_cmd_get_exchange ("get-exchange",
cred.cfg,
+ NULL,
true,
true),
TALER_TESTING_cmd_oauth ("start-oauth-service",
6666),
- // FIXME: TALER_TESTING_cmd_check_keys_pull_all_keys ("refetch /keys"),
TALER_TESTING_cmd_merchant_post_instances ("instance-create-default-setup",
merchant_url,
"default",
diff --git a/src/testing/test_merchant_api.c b/src/testing/test_merchant_api.c
index 7dc8a309..ac5af67c 100644
--- a/src/testing/test_merchant_api.c
+++ b/src/testing/test_merchant_api.c
@@ -1022,179 +1022,183 @@ run (void *cls,
TALER_TESTING_cmd_end ()
};
- struct TALER_TESTING_Command tip[] = {
- TALER_TESTING_cmd_merchant_post_reserves ("create-reserve-tip-1",
+ 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-tip-1-exch",
- "EUR:20.04",
- &cred.ba,
- payer_payto,
- "create-reserve-tip-1",
- 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 ("tip-sleep", 3),
- TALER_TESTING_cmd_tip_authorize ("authorize-tip-1",
- merchant_url,
- EXCHANGE_URL,
- MHD_HTTP_OK,
- "tip 1",
- "EUR:5.01"),
- TALER_TESTING_cmd_tip_authorize_from_reserve ("authorize-tip-2",
- merchant_url,
- EXCHANGE_URL,
- "create-reserve-tip-1-exch",
- MHD_HTTP_OK,
- "tip 2",
- "EUR:5.01"),
- TALER_TESTING_cmd_wallet_get_tip ("get-tip-1",
- merchant_url,
- "authorize-tip-1",
- MHD_HTTP_OK),
- TALER_TESTING_cmd_merchant_get_tip ("merchant-get-tip-1",
+ TALER_TESTING_cmd_sleep ("reward-sleep", 3),
+ TALER_TESTING_cmd_reward_authorize ("authorize-reward-1",
merchant_url,
- "authorize-tip-1",
- MHD_HTTP_OK),
- TALER_TESTING_cmd_get_tips ("get-tips-1",
- merchant_url,
- MHD_HTTP_OK,
- "authorize-tip-2",
- "authorize-tip-1",
- NULL),
- TALER_TESTING_cmd_get_tips2 ("get-tips-1-asc",
- merchant_url,
- 0,
- 20,
- MHD_HTTP_OK,
- "authorize-tip-1",
- "authorize-tip-2",
- NULL),
- TALER_TESTING_cmd_get_tips2 ("get-tips-1-asc-offset",
- merchant_url,
- 1,
- 20,
- MHD_HTTP_OK,
- "authorize-tip-2",
- NULL),
+ 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-tip-1-exch",
+ "create-reserve-reward-1-exch",
NULL),
TALER_TESTING_cmd_merchant_get_reserve ("get-reserve-1",
merchant_url,
MHD_HTTP_OK,
- "create-reserve-tip-1-exch"),
- TALER_TESTING_cmd_merchant_get_reserve_with_tips ("get-reserve-2",
- merchant_url,
- MHD_HTTP_OK,
- "create-reserve-tip-1-exch",
- "authorize-tip-1",
- "authorize-tip-2",
- NULL),
- TALER_TESTING_cmd_tip_pickup ("pickup-tip-1",
- merchant_url,
- MHD_HTTP_OK,
- "authorize-tip-1",
- pickup_amounts_1),
- TALER_TESTING_cmd_wallet_get_tip2 ("query-tip-2",
- merchant_url,
- "authorize-tip-1",
- "EUR:0.01",
- MHD_HTTP_OK),
- TALER_TESTING_cmd_tip_pickup ("pickup-tip-2",
- merchant_url,
- MHD_HTTP_OK,
- "authorize-tip-2",
- pickup_amounts_1),
-
- TALER_TESTING_cmd_tip_pickup_with_ec ("pickup-tip-3-too-much",
+ "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,
- MHD_HTTP_BAD_REQUEST,
- "authorize-tip-1",
- pickup_amounts_1,
- TALER_EC_MERCHANT_TIP_PICKUP_AMOUNT_EXCEEDS_TIP_REMAINING),
+ "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_tip_pickup ("pickup-tip-4",
- merchant_url,
- MHD_HTTP_OK,
- "authorize-tip-1",
- pickup_amounts_2),
- TALER_TESTING_cmd_merchant_get_tip_with_pickups ("merchant-get-tip-2",
- merchant_url,
- "authorize-tip-1",
- MHD_HTTP_OK,
- "pickup-tip-1",
- "pickup-tip-4",
- NULL),
+ 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 tip
+ /* This command tests the authorization of reward
* against a reserve that does not exist. This is
- * implemented by passing a "tip instance" that
+ * 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-tip-2-fake"),
- TALER_TESTING_cmd_tip_authorize_from_reserve_with_ec ("authorize-tip-null",
- merchant_url,
- EXCHANGE_URL,
- "create-reserve-tip-2-fake",
- MHD_HTTP_NOT_FOUND,
- "tip 3",
- "EUR:5.01",
- TALER_EC_MERCHANT_PRIVATE_POST_TIP_AUTHORIZE_RESERVE_NOT_FOUND),
+ * 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-tip-2",
+ 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-tip-2-exch",
- "EUR:1.04",
- &cred.ba,
- payer_payto,
- "create-reserve-tip-2",
- 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_tip_authorize_from_reserve_with_ec (
- "authorize-tip-insufficient-funds",
+ TALER_TESTING_cmd_reward_authorize_from_reserve_with_ec (
+ "authorize-reward-insufficient-funds",
merchant_url,
EXCHANGE_URL,
- "create-reserve-tip-2",
+ "create-reserve-reward-2",
MHD_HTTP_PRECONDITION_FAILED,
- "tip 4",
+ "reward 4",
"EUR:5.01",
- TALER_EC_MERCHANT_PRIVATE_POST_TIP_AUTHORIZE_INSUFFICIENT_FUNDS),
- TALER_TESTING_cmd_tip_authorize_fake ("fake-tip-authorization"),
- TALER_TESTING_cmd_tip_pickup_with_ec ("pickup-non-existent-id",
- merchant_url,
- MHD_HTTP_NOT_FOUND,
- "fake-tip-authorization",
- pickup_amounts_1,
- TALER_EC_MERCHANT_GENERIC_TIP_ID_UNKNOWN),
+ 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-tip-1",
- "create-reserve-tip-2",
+ "create-reserve-reward-1",
+ "create-reserve-reward-2",
NULL),
- TALER_TESTING_cmd_merchant_delete_reserve ("delete-reserve-tip-1",
+ TALER_TESTING_cmd_merchant_delete_reserve ("delete-reserve-reward-1",
merchant_url,
- "create-reserve-tip-1",
+ "create-reserve-reward-1",
MHD_HTTP_NO_CONTENT),
- TALER_TESTING_cmd_merchant_purge_reserve ("delete-reserve-tip-2",
+ TALER_TESTING_cmd_merchant_purge_reserve ("delete-reserve-reward-2",
merchant_url,
- "create-reserve-tip-1",
+ "create-reserve-reward-1",
MHD_HTTP_NO_CONTENT),
- TALER_TESTING_cmd_merchant_purge_reserve ("delete-reserve-tip-3",
+ TALER_TESTING_cmd_merchant_purge_reserve ("delete-reserve-reward-3",
merchant_url,
- "create-reserve-tip-1",
+ "create-reserve-reward-1",
MHD_HTTP_NOT_FOUND),
TALER_TESTING_cmd_end ()
};
@@ -1644,9 +1648,9 @@ run (void *cls,
NULL),
TALER_TESTING_cmd_get_exchange ("get-exchange",
cred.cfg,
+ NULL,
true,
true),
- // FIXME: TALER_TESTING_cmd_check_keys_pull_all_keys ("refetch /keys"),
TALER_TESTING_cmd_batch ("orders-id",
get_private_order_id),
TALER_TESTING_cmd_config ("config",
@@ -1976,8 +1980,8 @@ run (void *cls,
pay_abort),
TALER_TESTING_cmd_batch ("refund",
refund),
- TALER_TESTING_cmd_batch ("tip",
- tip),
+ TALER_TESTING_cmd_batch ("reward",
+ reward),
TALER_TESTING_cmd_batch ("templates",
templates),
TALER_TESTING_cmd_batch ("webhooks",
diff --git a/src/testing/test_merchant_api_home/taler/exchange-secmod-cs/keys/coin_eur_1/1687974704 b/src/testing/test_merchant_api_home/taler/exchange-secmod-cs/keys/coin_eur_1/1687974704
deleted file mode 100644
index 05650114..00000000
--- a/src/testing/test_merchant_api_home/taler/exchange-secmod-cs/keys/coin_eur_1/1687974704
+++ /dev/null
Binary files differ
diff --git a/src/testing/test_merchant_api_home/taler/exchange-secmod-cs/keys/coin_eur_5/1687974704 b/src/testing/test_merchant_api_home/taler/exchange-secmod-cs/keys/coin_eur_5/1687974704
deleted file mode 100644
index 118f8367..00000000
--- a/src/testing/test_merchant_api_home/taler/exchange-secmod-cs/keys/coin_eur_5/1687974704
+++ /dev/null
@@ -1,2 +0,0 @@
-Y $]P9cѠH"<Y
- \ No newline at end of file
diff --git a/src/testing/test_merchant_api_home/taler/exchange-secmod-cs/keys/coin_eur_ct_1/1687974704 b/src/testing/test_merchant_api_home/taler/exchange-secmod-cs/keys/coin_eur_ct_1/1687974704
deleted file mode 100644
index 82fb3db9..00000000
--- a/src/testing/test_merchant_api_home/taler/exchange-secmod-cs/keys/coin_eur_ct_1/1687974704
+++ /dev/null
@@ -1 +0,0 @@
-QM&K1ܵʥ 6Dɫ<i \ No newline at end of file
diff --git a/src/testing/test_merchant_api_home/taler/exchange-secmod-cs/keys/coin_eur_ct_10/1687974704 b/src/testing/test_merchant_api_home/taler/exchange-secmod-cs/keys/coin_eur_ct_10/1687974704
deleted file mode 100644
index 4350d164..00000000
--- a/src/testing/test_merchant_api_home/taler/exchange-secmod-cs/keys/coin_eur_ct_10/1687974704
+++ /dev/null
Binary files differ
diff --git a/src/testing/test_merchant_api_twisted.c b/src/testing/test_merchant_api_twisted.c
index 7d917136..36a90980 100644
--- a/src/testing/test_merchant_api_twisted.c
+++ b/src/testing/test_merchant_api_twisted.c
@@ -331,24 +331,9 @@ run (void *cls,
NULL),
TALER_TESTING_cmd_get_exchange ("get-exchange",
cred.cfg,
+ NULL,
true,
true),
-#if 0
- TALER_TESTING_cmd_auditor_add ("add-auditor-OK",
- MHD_HTTP_NO_CONTENT,
- false),
- TALER_TESTING_cmd_wire_add ("add-wire-account",
- "payto://x-taler-bank/localhost/2",
- MHD_HTTP_NO_CONTENT,
- false),
- TALER_TESTING_cmd_exec_offline_sign_keys ("offline-sign-future-keys",
- config_file),
- TALER_TESTING_cmd_exec_offline_sign_fees ("offline-sign-fees",
- config_file,
- "EUR:0.01",
- "EUR:0.01"),
-#endif
- // FIXME: TALER_TESTING_cmd_check_keys_pull_all_keys ("refetch /keys"),
TALER_TESTING_cmd_merchant_post_instances ("instance-create-default",
twister_merchant_url,
"default",
diff --git a/src/testing/testing_api_cmd_get_reserve.c b/src/testing/testing_api_cmd_get_reserve.c
index 8d724c0f..e9589dbb 100644
--- a/src/testing/testing_api_cmd_get_reserve.c
+++ b/src/testing/testing_api_cmd_get_reserve.c
@@ -57,19 +57,19 @@ struct GetReserveState
unsigned int http_status;
/**
- * Fetch tips
+ * Fetch rewards
*/
- bool fetch_tips;
+ bool fetch_rewards;
/**
- * Length of @e tips.
+ * Length of @e rewards.
*/
- unsigned int tips_length;
+ unsigned int rewards_length;
/**
- * The list of references to tips.
+ * The list of references to rewards.
*/
- const char **tips;
+ const char **rewards;
};
@@ -119,35 +119,36 @@ get_reserve_cb (void *cls,
}
}
{
- unsigned int tips_length = rgr->details.ok.tips_length;
- const struct TALER_MERCHANT_TipDetails *tips = rgr->details.ok.tips;
+ unsigned int rewards_length = rgr->details.ok.rewards_length;
+ const struct TALER_MERCHANT_RewardDetails *rewards =
+ rgr->details.ok.rewards;
- if (tips_length != grs->tips_length)
+ if (rewards_length != grs->rewards_length)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Number of tips authorized does not match\n");
+ "Number of rewards authorized does not match\n");
TALER_TESTING_interpreter_fail (grs->is);
return;
}
- for (unsigned int i = 0; i < tips_length; ++i)
+ for (unsigned int i = 0; i < rewards_length; ++i)
{
- const struct TALER_TESTING_Command *tip_cmd;
+ const struct TALER_TESTING_Command *reward_cmd;
- tip_cmd = TALER_TESTING_interpreter_lookup_command (grs->is,
- grs->tips[i]);
+ reward_cmd = TALER_TESTING_interpreter_lookup_command (grs->is,
+ grs->rewards[i]);
{
- const struct TALER_TipIdentifierP *tip_id;
+ const struct TALER_RewardIdentifierP *reward_id;
if (GNUNET_OK !=
- TALER_TESTING_get_trait_tip_id (tip_cmd,
- &tip_id))
+ TALER_TESTING_get_trait_reward_id (reward_cmd,
+ &reward_id))
TALER_TESTING_interpreter_fail (grs->is);
- if (0 != GNUNET_memcmp (&tips[i].tip_id,
- tip_id))
+ if (0 != GNUNET_memcmp (&rewards[i].reward_id,
+ reward_id))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Reserve tip id does not match\n");
+ "Reserve reward id does not match\n");
TALER_TESTING_interpreter_fail (grs->is);
return;
}
@@ -156,18 +157,18 @@ get_reserve_cb (void *cls,
const struct TALER_Amount *total_amount;
if (GNUNET_OK !=
- TALER_TESTING_get_trait_amount (tip_cmd,
+ TALER_TESTING_get_trait_amount (reward_cmd,
&total_amount))
TALER_TESTING_interpreter_fail (grs->is);
if ((GNUNET_OK !=
- TALER_amount_cmp_currency (&tips[i].amount,
+ TALER_amount_cmp_currency (&rewards[i].amount,
total_amount)) ||
- (0 != TALER_amount_cmp (&tips[i].amount,
+ (0 != TALER_amount_cmp (&rewards[i].amount,
total_amount)))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Reserve tip amount does not match\n");
+ "Reserve reward amount does not match\n");
TALER_TESTING_interpreter_fail (grs->is);
return;
}
@@ -176,15 +177,15 @@ get_reserve_cb (void *cls,
const char *reason;
if (GNUNET_OK !=
- TALER_TESTING_get_trait_reason (tip_cmd,
+ TALER_TESTING_get_trait_reason (reward_cmd,
&reason))
TALER_TESTING_interpreter_fail (grs->is);
- if (0 != strcmp (tips[i].reason,
+ if (0 != strcmp (rewards[i].reason,
reason))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Reserve tip reason does not match\n");
+ "Reserve reward reason does not match\n");
TALER_TESTING_interpreter_fail (grs->is);
return;
}
@@ -229,7 +230,7 @@ get_reserve_run (void *cls,
is),
grs->merchant_url,
reserve_pub,
- grs->fetch_tips,
+ grs->fetch_rewards,
&get_reserve_cb,
grs);
@@ -256,8 +257,8 @@ get_reserve_cleanup (void *cls,
"GET /private/reserve/$RESERVE_PUB operation did not complete\n");
TALER_MERCHANT_reserve_get_cancel (grs->rgh);
}
- GNUNET_array_grow (grs->tips,
- grs->tips_length,
+ GNUNET_array_grow (grs->rewards,
+ grs->rewards_length,
0);
GNUNET_free (grs);
}
@@ -275,7 +276,7 @@ TALER_TESTING_cmd_merchant_get_reserve (const char *label,
grs->merchant_url = merchant_url;
grs->http_status = http_status;
grs->reserve_reference = reserve_reference;
- grs->fetch_tips = false;
+ grs->fetch_rewards = false;
{
struct TALER_TESTING_Command cmd = {
.cls = grs,
@@ -290,11 +291,12 @@ TALER_TESTING_cmd_merchant_get_reserve (const char *label,
struct TALER_TESTING_Command
-TALER_TESTING_cmd_merchant_get_reserve_with_tips (const char *label,
- const char *merchant_url,
- unsigned int http_status,
- const char *reserve_reference,
- ...)
+TALER_TESTING_cmd_merchant_get_reserve_with_rewards (const char *label,
+ const char *merchant_url,
+ unsigned int http_status,
+ const char *
+ reserve_reference,
+ ...)
{
struct GetReserveState *grs;
@@ -302,7 +304,7 @@ TALER_TESTING_cmd_merchant_get_reserve_with_tips (const char *label,
grs->merchant_url = merchant_url;
grs->http_status = http_status;
grs->reserve_reference = reserve_reference;
- grs->fetch_tips = true;
+ grs->fetch_rewards = true;
{
const char *clabel;
va_list ap;
@@ -310,8 +312,8 @@ TALER_TESTING_cmd_merchant_get_reserve_with_tips (const char *label,
va_start (ap, reserve_reference);
while (NULL != (clabel = va_arg (ap, const char *)))
{
- GNUNET_array_append (grs->tips,
- grs->tips_length,
+ GNUNET_array_append (grs->rewards,
+ grs->rewards_length,
clabel);
}
va_end (ap);
diff --git a/src/testing/testing_api_cmd_get_tips.c b/src/testing/testing_api_cmd_get_rewards.c
index 8f06481a..4bc72f79 100644
--- a/src/testing/testing_api_cmd_get_tips.c
+++ b/src/testing/testing_api_cmd_get_rewards.c
@@ -17,8 +17,8 @@
<http://www.gnu.org/licenses/>
*/
/**
- * @file testing_api_cmd_get_tips.c
- * @brief command to test GET /private/tips
+ * @file testing_api_cmd_get_rewards.c
+ * @brief command to test GET /private/rewards
* @author Jonathan Buchanan
*/
#include "platform.h"
@@ -29,15 +29,15 @@
/**
- * State of a "GET tips" CMD.
+ * State of a "GET rewards" CMD.
*/
-struct GetTipsState
+struct GetRewardsState
{
/**
- * Handle for a "GET tips" request.
+ * Handle for a "GET rewards" request.
*/
- struct TALER_MERCHANT_TipsGetHandle *tgh;
+ struct TALER_MERCHANT_RewardsGetHandle *tgh;
/**
* The interpreter state.
@@ -65,28 +65,28 @@ struct GetTipsState
unsigned int http_status;
/**
- * Length of @e tips.
+ * Length of @e rewards.
*/
- unsigned int tips_length;
+ unsigned int rewards_length;
/**
- * References to tips that we expect to be found.
+ * References to rewards that we expect to be found.
*/
- const char **tips;
+ const char **rewards;
};
/**
- * Callback for a GET /private/tips operation.
+ * Callback for a GET /private/rewards operation.
*
* @param cls closure for this function
* @param tgr response details
*/
static void
-get_tips_cb (void *cls,
- const struct TALER_MERCHANT_TipsGetResponse *tgr)
+get_rewards_cb (void *cls,
+ const struct TALER_MERCHANT_RewardsGetResponse *tgr)
{
- struct GetTipsState *gts = cls;
+ struct GetRewardsState *gts = cls;
gts->tgh = NULL;
if (gts->http_status != tgr->hr.http_status)
@@ -102,64 +102,64 @@ get_tips_cb (void *cls,
switch (tgr->hr.http_status)
{
case MHD_HTTP_OK:
- if (tgr->details.ok.tips_length != gts->tips_length)
+ if (tgr->details.ok.rewards_length != gts->rewards_length)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Tips length does not match\n");
+ "Rewards length does not match\n");
TALER_TESTING_interpreter_fail (gts->is);
return;
}
- for (unsigned int i = 0; i < tgr->details.ok.tips_length; ++i)
+ for (unsigned int i = 0; i < tgr->details.ok.rewards_length; ++i)
{
- const struct TALER_MERCHANT_TipEntry *tip
- = &tgr->details.ok.tips[i];
- const struct TALER_TESTING_Command *tip_cmd;
+ const struct TALER_MERCHANT_RewardEntry *reward
+ = &tgr->details.ok.rewards[i];
+ const struct TALER_TESTING_Command *reward_cmd;
- tip_cmd = TALER_TESTING_interpreter_lookup_command (
+ reward_cmd = TALER_TESTING_interpreter_lookup_command (
gts->is,
- gts->tips[i]);
+ gts->rewards[i]);
{
- const struct TALER_TipIdentifierP *tip_id;
+ const struct TALER_RewardIdentifierP *reward_id;
if (GNUNET_OK !=
- TALER_TESTING_get_trait_tip_id (tip_cmd,
- &tip_id))
+ TALER_TESTING_get_trait_reward_id (reward_cmd,
+ &reward_id))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Could not fetch tip id\n");
+ "Could not fetch reward id\n");
TALER_TESTING_interpreter_fail (gts->is);
return;
}
- if (0 != GNUNET_memcmp (tip_id,
- &tip->tip_id))
+ if (0 != GNUNET_memcmp (reward_id,
+ &reward->reward_id))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Tip id does not match\n");
+ "Reward id does not match\n");
TALER_TESTING_interpreter_fail (gts->is);
return;
}
}
{
- const struct TALER_Amount *tip_amount;
+ const struct TALER_Amount *reward_amount;
if (GNUNET_OK !=
- TALER_TESTING_get_trait_amount (tip_cmd,
- &tip_amount))
+ TALER_TESTING_get_trait_amount (reward_cmd,
+ &reward_amount))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Could not fetch tip amount\n");
+ "Could not fetch reward amount\n");
TALER_TESTING_interpreter_fail (gts->is);
return;
}
if ( (GNUNET_OK !=
- TALER_amount_cmp_currency (tip_amount,
- &tip->tip_amount)) ||
+ TALER_amount_cmp_currency (reward_amount,
+ &reward->reward_amount)) ||
(0 !=
- TALER_amount_cmp (tip_amount,
- &tip->tip_amount)) )
+ TALER_amount_cmp (reward_amount,
+ &reward->reward_amount)) )
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Tip amount does not match\n");
+ "Reward amount does not match\n");
TALER_TESTING_interpreter_fail (gts->is);
return;
}
@@ -175,67 +175,68 @@ get_tips_cb (void *cls,
/**
- * Run the "GET /private/tips" CMD.
+ * Run the "GET /private/rewards" CMD.
*
* @param cls closure.
* @param cmd command being run now.
* @param is interpreter state.
*/
static void
-get_tips_run (void *cls,
- const struct TALER_TESTING_Command *cmd,
- struct TALER_TESTING_Interpreter *is)
+get_rewards_run (void *cls,
+ const struct TALER_TESTING_Command *cmd,
+ struct TALER_TESTING_Interpreter *is)
{
- struct GetTipsState *gts = cls;
+ struct GetRewardsState *gts = cls;
gts->is = is;
- gts->tgh = TALER_MERCHANT_tips_get2 (TALER_TESTING_interpreter_get_context (is),
- gts->merchant_url,
- TALER_EXCHANGE_YNA_NO,
- gts->limit,
- gts->offset,
- &get_tips_cb,
- gts);
+ gts->tgh = TALER_MERCHANT_rewards_get2 (
+ TALER_TESTING_interpreter_get_context (is),
+ gts->merchant_url,
+ TALER_EXCHANGE_YNA_NO,
+ gts->limit,
+ gts->offset,
+ &get_rewards_cb,
+ gts);
GNUNET_assert (NULL != gts->tgh);
}
/**
- * Free the state of a "GET tips" CMD, and possibly
+ * Free the state of a "GET rewards" CMD, and possibly
* cancel a pending operation thereof.
*
* @param cls closure.
* @param cmd command being run.
*/
static void
-get_tips_cleanup (void *cls,
- const struct TALER_TESTING_Command *cmd)
+get_rewards_cleanup (void *cls,
+ const struct TALER_TESTING_Command *cmd)
{
- struct GetTipsState *gts = cls;
+ struct GetRewardsState *gts = cls;
if (NULL != gts->tgh)
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "GET /private/tips operation did not complete\n");
- TALER_MERCHANT_tips_get_cancel (gts->tgh);
+ "GET /private/rewards operation did not complete\n");
+ TALER_MERCHANT_rewards_get_cancel (gts->tgh);
}
- GNUNET_array_grow (gts->tips,
- gts->tips_length,
+ GNUNET_array_grow (gts->rewards,
+ gts->rewards_length,
0);
GNUNET_free (gts);
}
struct TALER_TESTING_Command
-TALER_TESTING_cmd_get_tips (const char *label,
- const char *merchant_url,
- unsigned int http_status,
- ...)
+TALER_TESTING_cmd_get_rewards (const char *label,
+ const char *merchant_url,
+ unsigned int http_status,
+ ...)
{
- struct GetTipsState *gts;
+ struct GetRewardsState *gts;
- gts = GNUNET_new (struct GetTipsState);
+ gts = GNUNET_new (struct GetRewardsState);
gts->merchant_url = merchant_url;
gts->offset = INT64_MAX;
gts->limit = -20;
@@ -247,8 +248,8 @@ TALER_TESTING_cmd_get_tips (const char *label,
va_start (ap, http_status);
while (NULL != (clabel = va_arg (ap, const char *)))
{
- GNUNET_array_append (gts->tips,
- gts->tips_length,
+ GNUNET_array_append (gts->rewards,
+ gts->rewards_length,
clabel);
}
va_end (ap);
@@ -257,8 +258,8 @@ TALER_TESTING_cmd_get_tips (const char *label,
struct TALER_TESTING_Command cmd = {
.cls = gts,
.label = label,
- .run = &get_tips_run,
- .cleanup = &get_tips_cleanup
+ .run = &get_rewards_run,
+ .cleanup = &get_rewards_cleanup
};
return cmd;
@@ -267,16 +268,16 @@ TALER_TESTING_cmd_get_tips (const char *label,
struct TALER_TESTING_Command
-TALER_TESTING_cmd_get_tips2 (const char *label,
- const char *merchant_url,
- uint64_t offset,
- int64_t limit,
- unsigned int http_status,
- ...)
+TALER_TESTING_cmd_get_rewards2 (const char *label,
+ const char *merchant_url,
+ uint64_t offset,
+ int64_t limit,
+ unsigned int http_status,
+ ...)
{
- struct GetTipsState *gts;
+ struct GetRewardsState *gts;
- gts = GNUNET_new (struct GetTipsState);
+ gts = GNUNET_new (struct GetRewardsState);
gts->merchant_url = merchant_url;
gts->offset = offset;
gts->limit = limit;
@@ -288,8 +289,8 @@ TALER_TESTING_cmd_get_tips2 (const char *label,
va_start (ap, http_status);
while (NULL != (clabel = va_arg (ap, const char *)))
{
- GNUNET_array_append (gts->tips,
- gts->tips_length,
+ GNUNET_array_append (gts->rewards,
+ gts->rewards_length,
clabel);
}
va_end (ap);
@@ -298,8 +299,8 @@ TALER_TESTING_cmd_get_tips2 (const char *label,
struct TALER_TESTING_Command cmd = {
.cls = gts,
.label = label,
- .run = &get_tips_run,
- .cleanup = &get_tips_cleanup
+ .run = &get_rewards_run,
+ .cleanup = &get_rewards_cleanup
};
return cmd;
@@ -307,4 +308,4 @@ TALER_TESTING_cmd_get_tips2 (const char *label,
}
-/* end of testing_api_cmd_get_tips.c */
+/* end of testing_api_cmd_get_rewards.c */
diff --git a/src/testing/testing_api_cmd_merchant_get_tip.c b/src/testing/testing_api_cmd_merchant_get_reward.c
index 26fc4b4d..1c8b5c00 100644
--- a/src/testing/testing_api_cmd_merchant_get_tip.c
+++ b/src/testing/testing_api_cmd_merchant_get_reward.c
@@ -17,8 +17,8 @@
<http://www.gnu.org/licenses/>
*/
/**
- * @file testing_api_cmd_merchant_get_tip.c
- * @brief command to test GET /private/tips/$TIP_ID.
+ * @file testing_api_cmd_merchant_get_reward.c
+ * @brief command to test GET /private/rewards/$REWARD_ID.
* @author Jonathan Buchanan
*/
#include "platform.h"
@@ -28,9 +28,9 @@
#include "taler_merchant_testing_lib.h"
/**
- * State for a GET /private/tips/$TIP_ID CMD.
+ * State for a GET /private/rewards/$REWARD_ID CMD.
*/
-struct MerchantTipGetState
+struct MerchantRewardGetState
{
/**
@@ -54,14 +54,14 @@ struct MerchantTipGetState
unsigned int pickups_length;
/**
- * The NULL-terminated list of pickup commands associated with the tip.
+ * The NULL-terminated list of pickup commands associated with the reward.
*/
const char **pickups;
/**
- * The handle to the current GET /tips/$TIP_ID request.
+ * The handle to the current GET /rewards/$REWARD_ID request.
*/
- struct TALER_MERCHANT_TipMerchantGetHandle *tgh;
+ struct TALER_MERCHANT_RewardMerchantGetHandle *tgh;
/**
* The interpreter state.
@@ -69,28 +69,29 @@ struct MerchantTipGetState
struct TALER_TESTING_Interpreter *is;
/**
- * Reference to a command that created a tip.
+ * Reference to a command that created a reward.
*/
- const char *tip_reference;
+ const char *reward_reference;
};
/**
- * Callback for a GET /private/tips/$TIP_ID operation.
+ * Callback for a GET /private/rewards/$REWARD_ID operation.
*
* @param cls closure for this function
* @param tsr response
*/
static void
-merchant_get_tip_cb (void *cls,
- const struct TALER_MERCHANT_TipStatusResponse *tsr)
+merchant_get_reward_cb (void *cls,
+ const struct TALER_MERCHANT_RewardStatusResponse *tsr)
{
- struct MerchantTipGetState *gts = cls;
+ struct MerchantRewardGetState *gts = cls;
const struct TALER_TESTING_Command *authorize_cmd;
struct TALER_Amount expected_total_picked_up;
authorize_cmd = TALER_TESTING_interpreter_lookup_command (gts->is,
- gts->tip_reference);
+ gts->
+ reward_reference);
gts->tgh = NULL;
if (gts->http_status != tsr->hr.http_status)
@@ -124,7 +125,7 @@ merchant_get_tip_cb (void *cls,
initial_amount)))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Tip authorized amount does not match\n");
+ "Reward authorized amount does not match\n");
TALER_TESTING_interpreter_fail (gts->is);
return;
}
@@ -140,25 +141,25 @@ merchant_get_tip_cb (void *cls,
justification))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Tip authorized reason does not match\n");
+ "Reward authorized reason does not match\n");
TALER_TESTING_interpreter_fail (gts->is);
return;
}
}
{
- const struct GNUNET_TIME_Timestamp *tip_expiration;
+ const struct GNUNET_TIME_Timestamp *reward_expiration;
if (GNUNET_OK !=
TALER_TESTING_get_trait_timestamp (authorize_cmd,
0,
- &tip_expiration))
+ &reward_expiration))
TALER_TESTING_FAIL (gts->is);
- if (GNUNET_TIME_timestamp_cmp (*tip_expiration,
+ if (GNUNET_TIME_timestamp_cmp (*reward_expiration,
!=,
tsr->details.ok.expiration))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Tip authorized expiration does not match\n");
+ "Reward authorized expiration does not match\n");
TALER_TESTING_interpreter_fail (gts->is);
return;
}
@@ -227,7 +228,7 @@ merchant_get_tip_cb (void *cls,
&tsr->details.ok.total_picked_up)) )
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Tip picked up amount does not match\n");
+ "Reward picked up amount does not match\n");
TALER_TESTING_interpreter_fail (gts->is);
return;
}
@@ -242,60 +243,60 @@ merchant_get_tip_cb (void *cls,
/**
- * Run the "GET tip" CMD.
+ * Run the "GET reward" CMD.
*
* @param cls closure.
* @param cmd command being run now.
* @param is interpreter state.
*/
static void
-merchant_get_tip_run (void *cls,
- const struct TALER_TESTING_Command *cmd,
- struct TALER_TESTING_Interpreter *is)
+merchant_get_reward_run (void *cls,
+ const struct TALER_TESTING_Command *cmd,
+ struct TALER_TESTING_Interpreter *is)
{
- struct MerchantTipGetState *tgs = cls;
- const struct TALER_TESTING_Command *tip_cmd;
- const struct TALER_TipIdentifierP *tip_id;
+ struct MerchantRewardGetState *tgs = cls;
+ const struct TALER_TESTING_Command *reward_cmd;
+ const struct TALER_RewardIdentifierP *reward_id;
- tip_cmd = TALER_TESTING_interpreter_lookup_command (is,
- tgs->tip_reference);
+ reward_cmd = TALER_TESTING_interpreter_lookup_command (is,
+ tgs->reward_reference);
if (GNUNET_OK !=
- TALER_TESTING_get_trait_tip_id (tip_cmd,
- &tip_id))
+ TALER_TESTING_get_trait_reward_id (reward_cmd,
+ &reward_id))
TALER_TESTING_FAIL (is);
tgs->is = is;
- tgs->tgh = TALER_MERCHANT_merchant_tip_get (
+ tgs->tgh = TALER_MERCHANT_merchant_reward_get (
TALER_TESTING_interpreter_get_context (is),
tgs->merchant_url,
- tip_id,
+ reward_id,
NULL,
GNUNET_TIME_UNIT_ZERO,
tgs->fetch_pickups,
- &merchant_get_tip_cb,
+ &merchant_get_reward_cb,
tgs);
GNUNET_assert (NULL != tgs->tgh);
}
/**
-* Free the state of a "GET tip" CMD, and possibly
+* Free the state of a "GET reward" CMD, and possibly
* cancel a pending operation thereof.
*
* @param cls closure.
* @param cmd command being run.
*/
static void
-merchant_get_tip_cleanup (void *cls,
- const struct TALER_TESTING_Command *cmd)
+merchant_get_reward_cleanup (void *cls,
+ const struct TALER_TESTING_Command *cmd)
{
- struct MerchantTipGetState *tgs = cls;
+ struct MerchantRewardGetState *tgs = cls;
if (NULL != tgs->tgh)
{
- TALER_LOG_WARNING ("Get tip operation did not complete\n");
- TALER_MERCHANT_merchant_tip_get_cancel (tgs->tgh);
+ TALER_LOG_WARNING ("Get reward operation did not complete\n");
+ TALER_MERCHANT_merchant_reward_get_cancel (tgs->tgh);
}
GNUNET_array_grow (tgs->pickups,
tgs->pickups_length,
@@ -305,23 +306,23 @@ merchant_get_tip_cleanup (void *cls,
struct TALER_TESTING_Command
-TALER_TESTING_cmd_merchant_get_tip (const char *label,
- const char *merchant_url,
- const char *tip_reference,
- unsigned int http_status)
+TALER_TESTING_cmd_merchant_get_reward (const char *label,
+ const char *merchant_url,
+ const char *reward_reference,
+ unsigned int http_status)
{
- struct MerchantTipGetState *tgs;
+ struct MerchantRewardGetState *tgs;
- tgs = GNUNET_new (struct MerchantTipGetState);
+ tgs = GNUNET_new (struct MerchantRewardGetState);
tgs->merchant_url = merchant_url;
- tgs->tip_reference = tip_reference;
+ tgs->reward_reference = reward_reference;
tgs->http_status = http_status;
{
struct TALER_TESTING_Command cmd = {
.cls = tgs,
.label = label,
- .run = &merchant_get_tip_run,
- .cleanup = &merchant_get_tip_cleanup
+ .run = &merchant_get_reward_run,
+ .cleanup = &merchant_get_reward_cleanup
};
return cmd;
@@ -330,17 +331,17 @@ TALER_TESTING_cmd_merchant_get_tip (const char *label,
struct TALER_TESTING_Command
-TALER_TESTING_cmd_merchant_get_tip_with_pickups (const char *label,
- const char *merchant_url,
- const char *tip_reference,
- unsigned int http_status,
- ...)
+TALER_TESTING_cmd_merchant_get_reward_with_pickups (const char *label,
+ const char *merchant_url,
+ const char *reward_reference,
+ unsigned int http_status,
+ ...)
{
- struct MerchantTipGetState *tgs;
+ struct MerchantRewardGetState *tgs;
- tgs = GNUNET_new (struct MerchantTipGetState);
+ tgs = GNUNET_new (struct MerchantRewardGetState);
tgs->merchant_url = merchant_url;
- tgs->tip_reference = tip_reference;
+ tgs->reward_reference = reward_reference;
tgs->fetch_pickups = true;
tgs->http_status = http_status;
{
@@ -360,8 +361,8 @@ TALER_TESTING_cmd_merchant_get_tip_with_pickups (const char *label,
struct TALER_TESTING_Command cmd = {
.cls = tgs,
.label = label,
- .run = &merchant_get_tip_run,
- .cleanup = &merchant_get_tip_cleanup
+ .run = &merchant_get_reward_run,
+ .cleanup = &merchant_get_reward_cleanup
};
return cmd;
@@ -369,4 +370,4 @@ TALER_TESTING_cmd_merchant_get_tip_with_pickups (const char *label,
}
-/* end of testing_api_cmd_merchant_get_tip.c */
+/* end of testing_api_cmd_merchant_get_reward.c */
diff --git a/src/testing/testing_api_cmd_tip_authorize.c b/src/testing/testing_api_cmd_reward_authorize.c
index b9a03388..9fe73659 100644
--- a/src/testing/testing_api_cmd_tip_authorize.c
+++ b/src/testing/testing_api_cmd_reward_authorize.c
@@ -18,8 +18,8 @@
*/
/**
- * @file testing_api_cmd_tip_authorize.c
- * @brief command to test the tipping.
+ * @file testing_api_cmd_reward_authorize.c
+ * @brief command to test the rewardping.
* @author Marcello Stanisci
*/
@@ -31,9 +31,9 @@
/**
- * State for a /tip-authorize CMD.
+ * State for a /reward-authorize CMD.
*/
-struct TipAuthorizeState
+struct RewardAuthorizeState
{
/**
@@ -47,19 +47,19 @@ struct TipAuthorizeState
unsigned int http_status;
/**
- * Reference to the reserv to authorize the tip
+ * Reference to the reserv to authorize the reward
* from (if NULL, the merchant decides).
*/
const char *reserve_reference;
/**
* Human-readable justification for the
- * tip authorization carried on by this CMD.
+ * reward authorization carried on by this CMD.
*/
const char *justification;
/**
- * Amount that should be authorized for tipping.
+ * Amount that should be authorized for rewardping.
*/
struct TALER_Amount amount;
@@ -69,24 +69,24 @@ struct TipAuthorizeState
enum TALER_ErrorCode expected_ec;
/**
- * Tip taler:// URI.
+ * Reward taler:// URI.
*/
- char *tip_uri;
+ char *reward_uri;
/**
- * The tip id; set when the CMD succeeds.
+ * The reward id; set when the CMD succeeds.
*/
- struct TALER_TipIdentifierP tip_id;
+ struct TALER_RewardIdentifierP reward_id;
/**
- * Expiration date for this tip.
+ * Expiration date for this reward.
*/
- struct GNUNET_TIME_Timestamp tip_expiration;
+ struct GNUNET_TIME_Timestamp reward_expiration;
/**
- * Handle to the on-going /tip-authorize request.
+ * Handle to the on-going /reward-authorize request.
*/
- struct TALER_MERCHANT_TipAuthorizeHandle *tao;
+ struct TALER_MERCHANT_RewardAuthorizeHandle *tao;
/**
* The interpreter state.
@@ -114,25 +114,25 @@ struct TipAuthorizeState
/**
* Run the main logic of talking to the merchant.
*
- * @param cls a `struct TipAuthorizeState`.
+ * @param cls a `struct RewardAuthorizeState`.
*/
static void
do_retry (void *cls);
/**
- * Callback for a /tip-authorize request. Set into the state
- * what was returned from the backend (@a tip_id and @a
- * tip_expiration).
+ * Callback for a /reward-authorize request. Set into the state
+ * what was returned from the backend (@a reward_id and @a
+ * reward_expiration).
*
* @param cls closure
* @param tar response we got
*/
static void
-tip_authorize_cb (void *cls,
- const struct TALER_MERCHANT_TipAuthorizeResponse *tar)
+reward_authorize_cb (void *cls,
+ const struct TALER_MERCHANT_RewardAuthorizeResponse *tar)
{
- struct TipAuthorizeState *tas = cls;
+ struct RewardAuthorizeState *tas = cls;
tas->tao = NULL;
if (tas->http_status != tar->hr.http_status)
@@ -174,16 +174,16 @@ tip_authorize_cb (void *cls,
if ( (MHD_HTTP_OK == tar->hr.http_status) &&
(TALER_EC_NONE == tar->hr.ec) )
{
- tas->tip_uri = GNUNET_strdup (tar->details.ok.tip_uri);
- tas->tip_id = tar->details.ok.tip_id;
- tas->tip_expiration = tar->details.ok.tip_expiration;
+ tas->reward_uri = GNUNET_strdup (tar->details.ok.reward_uri);
+ tas->reward_id = tar->details.ok.reward_id;
+ tas->reward_expiration = tar->details.ok.reward_expiration;
}
TALER_TESTING_interpreter_next (tas->is);
}
/**
- * Offers information from the /tip-authorize CMD state to other
+ * Offers information from the /reward-authorize CMD state to other
* commands.
*
* @param cls closure
@@ -193,18 +193,18 @@ tip_authorize_cb (void *cls,
* @return #GNUNET_OK on success
*/
static enum GNUNET_GenericReturnValue
-tip_authorize_traits (void *cls,
- const void **ret,
- const char *trait,
- unsigned int index)
+reward_authorize_traits (void *cls,
+ const void **ret,
+ const char *trait,
+ unsigned int index)
{
- struct TipAuthorizeState *tas = cls;
+ struct RewardAuthorizeState *tas = cls;
struct TALER_TESTING_Trait traits[] = {
- TALER_TESTING_make_trait_tip_id (&tas->tip_id),
+ TALER_TESTING_make_trait_reward_id (&tas->reward_id),
TALER_TESTING_make_trait_amount (&tas->amount),
TALER_TESTING_make_trait_reason (tas->justification),
TALER_TESTING_make_trait_timestamp (0,
- &tas->tip_expiration),
+ &tas->reward_expiration),
TALER_TESTING_trait_end (),
};
@@ -216,18 +216,18 @@ tip_authorize_traits (void *cls,
/**
- * Runs the /tip-authorize CMD
+ * Runs the /reward-authorize CMD
*
* @param cls closure
* @param cmd the CMD representing _this_ command
* @param is interpreter state
*/
static void
-tip_authorize_run (void *cls,
- const struct TALER_TESTING_Command *cmd,
- struct TALER_TESTING_Interpreter *is)
+reward_authorize_run (void *cls,
+ const struct TALER_TESTING_Command *cmd,
+ struct TALER_TESTING_Interpreter *is)
{
- struct TipAuthorizeState *tas = cls;
+ struct RewardAuthorizeState *tas = cls;
tas->retries_left = 16;
tas->is = is;
@@ -239,18 +239,18 @@ tip_authorize_run (void *cls,
static void
do_retry (void *cls)
{
- struct TipAuthorizeState *tas = cls;
+ struct RewardAuthorizeState *tas = cls;
tas->retry_task = NULL;
if (NULL == tas->reserve_reference)
{
- tas->tao = TALER_MERCHANT_tip_authorize (
+ tas->tao = TALER_MERCHANT_reward_authorize (
TALER_TESTING_interpreter_get_context (tas->is),
tas->merchant_url,
"http://merchant.com/pickup",
&tas->amount,
tas->justification,
- &tip_authorize_cb,
+ &reward_authorize_cb,
tas);
}
else
@@ -264,14 +264,14 @@ do_retry (void *cls)
GNUNET_assert (GNUNET_OK ==
TALER_TESTING_get_trait_reserve_pub (reserve_cmd,
&reserve_pub));
- tas->tao = TALER_MERCHANT_tip_authorize2 (
+ tas->tao = TALER_MERCHANT_reward_authorize2 (
TALER_TESTING_interpreter_get_context (tas->is),
tas->merchant_url,
reserve_pub,
"http://merchant.com/pickup",
&tas->amount,
tas->justification,
- &tip_authorize_cb,
+ &reward_authorize_cb,
tas);
}
GNUNET_assert (NULL != tas->tao);
@@ -279,68 +279,68 @@ do_retry (void *cls)
/**
- * Run the /tip-authorize CMD, the "fake" version of it.
+ * Run the /reward-authorize CMD, the "fake" version of it.
*
* @param cls closure
* @param cmd the CMD representing _this_ command
* @param is interpreter state *
*/
static void
-tip_authorize_fake_run (void *cls,
- const struct TALER_TESTING_Command *cmd,
- struct TALER_TESTING_Interpreter *is)
+reward_authorize_fake_run (void *cls,
+ const struct TALER_TESTING_Command *cmd,
+ struct TALER_TESTING_Interpreter *is)
{
- struct TipAuthorizeState *tas = cls;
+ struct RewardAuthorizeState *tas = cls;
- /* Make up a tip id. */
+ /* Make up a reward id. */
GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
- &tas->tip_id,
- sizeof (struct TALER_TipIdentifierP));
+ &tas->reward_id,
+ sizeof (struct TALER_RewardIdentifierP));
TALER_TESTING_interpreter_next (is);
}
/**
- * Free the state from a /tip-authorize CMD, and possibly
+ * Free the state from a /reward-authorize CMD, and possibly
* cancel any pending operation.
*
* @param cls closure
- * @param cmd the /tip-authorize CMD that is about to be freed.
+ * @param cmd the /reward-authorize CMD that is about to be freed.
*/
static void
-tip_authorize_cleanup (void *cls,
- const struct TALER_TESTING_Command *cmd)
+reward_authorize_cleanup (void *cls,
+ const struct TALER_TESTING_Command *cmd)
{
- struct TipAuthorizeState *tas = cls;
+ struct RewardAuthorizeState *tas = cls;
if (NULL != tas->tao)
{
- TALER_LOG_WARNING ("Tip-autorize operation"
+ TALER_LOG_WARNING ("Reward-autorize operation"
" did not complete\n");
- TALER_MERCHANT_tip_authorize_cancel (tas->tao);
+ TALER_MERCHANT_reward_authorize_cancel (tas->tao);
}
if (NULL != tas->retry_task)
{
GNUNET_SCHEDULER_cancel (tas->retry_task);
tas->retry_task = NULL;
}
- GNUNET_free (tas->tip_uri);
+ GNUNET_free (tas->reward_uri);
GNUNET_free (tas);
}
struct TALER_TESTING_Command
-TALER_TESTING_cmd_tip_authorize_with_ec (const char *label,
- const char *merchant_url,
- const char *exchange_url,
- unsigned int http_status,
- const char *justification,
- const char *amount,
- enum TALER_ErrorCode ec)
+TALER_TESTING_cmd_reward_authorize_with_ec (const char *label,
+ const char *merchant_url,
+ const char *exchange_url,
+ unsigned int http_status,
+ const char *justification,
+ const char *amount,
+ enum TALER_ErrorCode ec)
{
- struct TipAuthorizeState *tas;
+ struct RewardAuthorizeState *tas;
- tas = GNUNET_new (struct TipAuthorizeState);
+ tas = GNUNET_new (struct RewardAuthorizeState);
tas->merchant_url = merchant_url;
tas->justification = justification;
tas->http_status = http_status;
@@ -352,9 +352,9 @@ TALER_TESTING_cmd_tip_authorize_with_ec (const char *label,
struct TALER_TESTING_Command cmd = {
.label = label,
.cls = tas,
- .run = &tip_authorize_run,
- .cleanup = &tip_authorize_cleanup,
- .traits = &tip_authorize_traits
+ .run = &reward_authorize_run,
+ .cleanup = &reward_authorize_cleanup,
+ .traits = &reward_authorize_traits
};
return cmd;
@@ -363,7 +363,7 @@ TALER_TESTING_cmd_tip_authorize_with_ec (const char *label,
struct TALER_TESTING_Command
-TALER_TESTING_cmd_tip_authorize_from_reserve_with_ec (
+TALER_TESTING_cmd_reward_authorize_from_reserve_with_ec (
const char *label,
const char *merchant_url,
const char *exchange_url,
@@ -373,9 +373,9 @@ TALER_TESTING_cmd_tip_authorize_from_reserve_with_ec (
const char *amount,
enum TALER_ErrorCode ec)
{
- struct TipAuthorizeState *tas;
+ struct RewardAuthorizeState *tas;
- tas = GNUNET_new (struct TipAuthorizeState);
+ tas = GNUNET_new (struct RewardAuthorizeState);
tas->merchant_url = merchant_url;
tas->justification = justification;
tas->http_status = http_status;
@@ -388,9 +388,9 @@ TALER_TESTING_cmd_tip_authorize_from_reserve_with_ec (
struct TALER_TESTING_Command cmd = {
.label = label,
.cls = tas,
- .run = &tip_authorize_run,
- .cleanup = &tip_authorize_cleanup,
- .traits = &tip_authorize_traits
+ .run = &reward_authorize_run,
+ .cleanup = &reward_authorize_cleanup,
+ .traits = &reward_authorize_traits
};
return cmd;
@@ -399,16 +399,16 @@ TALER_TESTING_cmd_tip_authorize_from_reserve_with_ec (
struct TALER_TESTING_Command
-TALER_TESTING_cmd_tip_authorize (const char *label,
- const char *merchant_url,
- const char *exchange_url,
- unsigned int http_status,
- const char *justification,
- const char *amount)
+TALER_TESTING_cmd_reward_authorize (const char *label,
+ const char *merchant_url,
+ const char *exchange_url,
+ unsigned int http_status,
+ const char *justification,
+ const char *amount)
{
- struct TipAuthorizeState *tas;
+ struct RewardAuthorizeState *tas;
- tas = GNUNET_new (struct TipAuthorizeState);
+ tas = GNUNET_new (struct RewardAuthorizeState);
tas->merchant_url = merchant_url;
tas->justification = justification;
tas->http_status = http_status;
@@ -419,9 +419,9 @@ TALER_TESTING_cmd_tip_authorize (const char *label,
struct TALER_TESTING_Command cmd = {
.label = label,
.cls = tas,
- .run = &tip_authorize_run,
- .cleanup = &tip_authorize_cleanup,
- .traits = &tip_authorize_traits
+ .run = &reward_authorize_run,
+ .cleanup = &reward_authorize_cleanup,
+ .traits = &reward_authorize_traits
};
return cmd;
@@ -430,17 +430,17 @@ TALER_TESTING_cmd_tip_authorize (const char *label,
struct TALER_TESTING_Command
-TALER_TESTING_cmd_tip_authorize_from_reserve (const char *label,
- const char *merchant_url,
- const char *exchange_url,
- const char *reserve_reference,
- unsigned int http_status,
- const char *justification,
- const char *amount)
+TALER_TESTING_cmd_reward_authorize_from_reserve (const char *label,
+ const char *merchant_url,
+ const char *exchange_url,
+ const char *reserve_reference,
+ unsigned int http_status,
+ const char *justification,
+ const char *amount)
{
- struct TipAuthorizeState *tas;
+ struct RewardAuthorizeState *tas;
- tas = GNUNET_new (struct TipAuthorizeState);
+ tas = GNUNET_new (struct RewardAuthorizeState);
tas->merchant_url = merchant_url;
tas->reserve_reference = reserve_reference;
tas->justification = justification;
@@ -452,9 +452,9 @@ TALER_TESTING_cmd_tip_authorize_from_reserve (const char *label,
struct TALER_TESTING_Command cmd = {
.label = label,
.cls = tas,
- .run = &tip_authorize_run,
- .cleanup = &tip_authorize_cleanup,
- .traits = &tip_authorize_traits
+ .run = &reward_authorize_run,
+ .cleanup = &reward_authorize_cleanup,
+ .traits = &reward_authorize_traits
};
return cmd;
@@ -463,18 +463,18 @@ TALER_TESTING_cmd_tip_authorize_from_reserve (const char *label,
struct TALER_TESTING_Command
-TALER_TESTING_cmd_tip_authorize_fake (const char *label)
+TALER_TESTING_cmd_reward_authorize_fake (const char *label)
{
- struct TipAuthorizeState *tas;
+ struct RewardAuthorizeState *tas;
- tas = GNUNET_new (struct TipAuthorizeState);
+ tas = GNUNET_new (struct RewardAuthorizeState);
{
struct TALER_TESTING_Command cmd = {
.label = label,
.cls = tas,
- .run = &tip_authorize_fake_run,
- .cleanup = &tip_authorize_cleanup,
- .traits = &tip_authorize_traits
+ .run = &reward_authorize_fake_run,
+ .cleanup = &reward_authorize_cleanup,
+ .traits = &reward_authorize_traits
};
return cmd;
@@ -482,4 +482,4 @@ TALER_TESTING_cmd_tip_authorize_fake (const char *label)
}
-/* end of testing_api_cmd_tip_authorize.c */
+/* end of testing_api_cmd_reward_authorize.c */
diff --git a/src/testing/testing_api_cmd_tip_pickup.c b/src/testing/testing_api_cmd_reward_pickup.c
index acca1eb7..a030b78c 100644
--- a/src/testing/testing_api_cmd_tip_pickup.c
+++ b/src/testing/testing_api_cmd_reward_pickup.c
@@ -18,8 +18,8 @@
*/
/**
- * @file testing_api_cmd_tip_pickup.c
- * @brief command to test the tipping.
+ * @file testing_api_cmd_reward_pickup.c
+ * @brief command to test picking up a reward.
* @author Marcello Stanisci
*/
#include "platform.h"
@@ -29,9 +29,9 @@
#include "taler_merchant_testing_lib.h"
/**
- * State for a /tip-pickup CMD.
+ * State for a /reward-pickup CMD.
*/
-struct TipPickupState
+struct RewardPickupState
{
/**
* Merchant base URL.
@@ -49,8 +49,8 @@ struct TipPickupState
unsigned int http_status;
/**
- * Reference to a /tip/authorize CMD. This will be used to
- * get the tip id to make the request with.
+ * Reference to a /reward/authorize CMD. This will be used to
+ * get the reward id to make the request with.
*/
const char *authorize_reference;
@@ -62,9 +62,9 @@ struct TipPickupState
const char *replay_reference;
/**
- * Handle to a on-going /tip/pickup request.
+ * Handle to a on-going /reward/pickup request.
*/
- struct TALER_MERCHANT_TipPickupHandle *tpo;
+ struct TALER_MERCHANT_RewardPickupHandle *tpo;
/**
* The interpreter state.
@@ -74,7 +74,7 @@ struct TipPickupState
/**
* An array of string-defined amounts that indicates
* which denominations are going to be used to receive
- * tips.
+ * rewards.
*/
const char **amounts;
@@ -102,12 +102,12 @@ struct TipPickupState
/**
* Set (by the interpreter) to an array of @a num_coins
- * details on coins created from the (successful) tip operation.
+ * details on coins created from the (successful) reward operation.
*/
struct TALER_EXCHANGE_PrivateCoinDetails *pcds;
/**
- * How many coins are involved in the tipping operation.
+ * How many coins are involved in the rewardping operation.
*/
uint32_t num_coins;
@@ -120,7 +120,7 @@ struct TipPickupState
/**
- * Callback for a /tip-pickup request, it mainly checks if
+ * Callback for a /reward-pickup request, it mainly checks if
* values returned from the backend are as expected, and if so
* (and if the status was 200 OK) proceede with the withdrawal.
*
@@ -131,7 +131,7 @@ static void
pickup_cb (void *cls,
const struct TALER_MERCHANT_PickupDetails *pd)
{
- struct TipPickupState *tps = cls;
+ struct RewardPickupState *tps = cls;
tps->tpo = NULL;
if (pd->hr.http_status != tps->http_status)
@@ -172,22 +172,22 @@ pickup_cb (void *cls,
/**
- * Run a /tip-pickup CMD.
+ * Run a /reward-pickup CMD.
*
* @param cls closure
- * @param cmd the current /tip-pickup CMD.
+ * @param cmd the current /reward-pickup CMD.
* @param is interpreter state.
*/
static void
-tip_pickup_run (void *cls,
- const struct TALER_TESTING_Command *cmd,
- struct TALER_TESTING_Interpreter *is)
+reward_pickup_run (void *cls,
+ const struct TALER_TESTING_Command *cmd,
+ struct TALER_TESTING_Interpreter *is)
{
- struct TipPickupState *tps = cls;
+ struct RewardPickupState *tps = cls;
unsigned int num_planchets;
const struct TALER_TESTING_Command *replay_cmd;
const struct TALER_TESTING_Command *authorize_cmd;
- const struct TALER_TipIdentifierP *tip_id;
+ const struct TALER_RewardIdentifierP *reward_id;
tps->is = is;
tps->exchange_url = TALER_TESTING_get_exchange_url (is);
@@ -205,7 +205,7 @@ tip_pickup_run (void *cls,
{
const uint32_t *np;
- if (NULL == /* looking for "parent" tip-pickup command */
+ if (NULL == /* looking for "parent" reward-pickup command */
(replay_cmd
= TALER_TESTING_interpreter_lookup_command (is,
tps->replay_reference)) )
@@ -278,14 +278,14 @@ tip_pickup_run (void *cls,
planchets[i].ps = tps->psa[i];
}
if (GNUNET_OK !=
- TALER_TESTING_get_trait_tip_id (authorize_cmd,
- &tip_id))
+ TALER_TESTING_get_trait_reward_id (authorize_cmd,
+ &reward_id))
TALER_TESTING_FAIL (is);
- tps->tpo = TALER_MERCHANT_tip_pickup (
+ tps->tpo = TALER_MERCHANT_reward_pickup (
TALER_TESTING_interpreter_get_context (is),
TALER_TESTING_get_exchange_url (is),
tps->merchant_url,
- tip_id,
+ reward_id,
num_planchets,
planchets,
&pickup_cb,
@@ -296,17 +296,17 @@ tip_pickup_run (void *cls,
/**
- * Free a /tip-pickup CMD state, and possibly cancel a
- * pending /tip-pickup request.
+ * Free a /reward-pickup CMD state, and possibly cancel a
+ * pending /reward-pickup request.
*
* @param cls closure.
* @param cmd current CMD to be freed.
*/
static void
-tip_pickup_cleanup (void *cls,
- const struct TALER_TESTING_Command *cmd)
+reward_pickup_cleanup (void *cls,
+ const struct TALER_TESTING_Command *cmd)
{
- struct TipPickupState *tps = cls;
+ struct RewardPickupState *tps = cls;
GNUNET_free (tps->amounts_obj);
GNUNET_free (tps->dks);
@@ -319,20 +319,20 @@ tip_pickup_cleanup (void *cls,
}
if (NULL != tps->tpo)
{
- TALER_LOG_WARNING ("Tip-pickup operation did not complete\n");
- TALER_MERCHANT_tip_pickup_cancel (tps->tpo);
+ TALER_LOG_WARNING ("Reward-pickup operation did not complete\n");
+ TALER_MERCHANT_reward_pickup_cancel (tps->tpo);
}
GNUNET_free (tps);
}
static enum GNUNET_GenericReturnValue
-tip_pickup_traits (void *cls,
- const void **ret,
- const char *trait,
- unsigned int index)
+reward_pickup_traits (void *cls,
+ const void **ret,
+ const char *trait,
+ unsigned int index)
{
- struct TipPickupState *tps = cls;
+ struct RewardPickupState *tps = cls;
if (index >= tps->num_coins)
return GNUNET_SYSERR;
@@ -363,15 +363,15 @@ tip_pickup_traits (void *cls,
struct TALER_TESTING_Command
-TALER_TESTING_cmd_tip_pickup (const char *label,
- const char *merchant_url,
- unsigned int http_status,
- const char *authorize_reference,
- const char **amounts)
+TALER_TESTING_cmd_reward_pickup (const char *label,
+ const char *merchant_url,
+ unsigned int http_status,
+ const char *authorize_reference,
+ const char **amounts)
{
- struct TipPickupState *tps;
+ struct RewardPickupState *tps;
- tps = GNUNET_new (struct TipPickupState);
+ tps = GNUNET_new (struct RewardPickupState);
tps->merchant_url = merchant_url;
tps->authorize_reference = authorize_reference;
tps->amounts = amounts;
@@ -380,9 +380,9 @@ TALER_TESTING_cmd_tip_pickup (const char *label,
struct TALER_TESTING_Command cmd = {
.cls = tps,
.label = label,
- .run = &tip_pickup_run,
- .cleanup = &tip_pickup_cleanup,
- .traits = &tip_pickup_traits
+ .run = &reward_pickup_run,
+ .cleanup = &reward_pickup_cleanup,
+ .traits = &reward_pickup_traits
};
return cmd;
@@ -391,25 +391,25 @@ TALER_TESTING_cmd_tip_pickup (const char *label,
struct TALER_TESTING_Command
-TALER_TESTING_cmd_tip_pickup_with_ec (const char *label,
- const char *merchant_url,
- unsigned int http_status,
- const char *authorize_reference,
- const char **amounts,
- enum TALER_ErrorCode ec)
+TALER_TESTING_cmd_reward_pickup_with_ec (const char *label,
+ const char *merchant_url,
+ unsigned int http_status,
+ const char *authorize_reference,
+ const char **amounts,
+ enum TALER_ErrorCode ec)
{
struct TALER_TESTING_Command cmd;
- struct TipPickupState *tps;
+ struct RewardPickupState *tps;
- cmd = TALER_TESTING_cmd_tip_pickup (label,
- merchant_url,
- http_status,
- authorize_reference,
- amounts);
+ cmd = TALER_TESTING_cmd_reward_pickup (label,
+ merchant_url,
+ http_status,
+ authorize_reference,
+ amounts);
tps = cmd.cls;
tps->expected_ec = ec;
return cmd;
}
-/* end of testing_api_cmd_tip_pickup.c */
+/* end of testing_api_cmd_reward_pickup.c */
diff --git a/src/testing/testing_api_cmd_wallet_get_tip.c b/src/testing/testing_api_cmd_wallet_get_reward.c
index d934e5e8..661b31f2 100644
--- a/src/testing/testing_api_cmd_wallet_get_tip.c
+++ b/src/testing/testing_api_cmd_wallet_get_reward.c
@@ -17,8 +17,8 @@
<http://www.gnu.org/licenses/>
*/
/**
- * @file testing_api_cmd_wallet_get_tip.c
- * @brief command to test the tipping.
+ * @file testing_api_cmd_wallet_get_reward.c
+ * @brief command to test the rewardping.
* @author Marcello Stanisci
*/
#include "platform.h"
@@ -29,9 +29,9 @@
/**
- * State for a GET /tips/$TIP_ID CMD.
+ * State for a GET /rewards/$REWARD_ID CMD.
*/
-struct WalletTipGetState
+struct WalletRewardGetState
{
/**
@@ -55,9 +55,9 @@ struct WalletTipGetState
struct TALER_Amount amount_remaining;
/**
- * The handle to the current GET /tips/$TIP_ID request.
+ * The handle to the current GET /rewards/$REWARD_ID request.
*/
- struct TALER_MERCHANT_TipWalletGetHandle *tgh;
+ struct TALER_MERCHANT_RewardWalletGetHandle *tgh;
/**
* The interpreter state.
@@ -65,14 +65,14 @@ struct WalletTipGetState
struct TALER_TESTING_Interpreter *is;
/**
- * Reference to a command that created a tip.
+ * Reference to a command that created a reward.
*/
- const char *tip_reference;
+ const char *reward_reference;
};
/**
- * Callback to process a GET /tips/$TIP_ID request, it mainly
+ * Callback to process a GET /rewards/$REWARD_ID request, it mainly
* checks that what the backend returned matches the command's
* expectations.
*
@@ -80,15 +80,15 @@ struct WalletTipGetState
* @param wgr response
*/
static void
-wallet_tip_get_cb (void *cls,
- const struct TALER_MERCHANT_TipWalletGetResponse *wgr)
+wallet_reward_get_cb (void *cls,
+ const struct TALER_MERCHANT_RewardWalletGetResponse *wgr)
{
- struct WalletTipGetState *gts = cls;
- const struct TALER_TESTING_Command *tip_cmd;
+ struct WalletRewardGetState *gts = cls;
+ const struct TALER_TESTING_Command *reward_cmd;
- tip_cmd = TALER_TESTING_interpreter_lookup_command (
+ reward_cmd = TALER_TESTING_interpreter_lookup_command (
gts->is,
- gts->tip_reference);
+ gts->reward_reference);
gts->tgh = NULL;
if (gts->http_status != wgr->hr.http_status)
@@ -114,7 +114,7 @@ wallet_tip_get_cb (void *cls,
&wgr->details.ok.amount_remaining)))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Amount remaining on tip does not match\n");
+ "Amount remaining on reward does not match\n");
TALER_TESTING_interpreter_fail (gts->is);
return;
}
@@ -123,7 +123,7 @@ wallet_tip_get_cb (void *cls,
const struct GNUNET_TIME_Timestamp *expiration;
if (GNUNET_OK !=
- TALER_TESTING_get_trait_timestamp (tip_cmd,
+ TALER_TESTING_get_trait_timestamp (reward_cmd,
0,
&expiration))
TALER_TESTING_interpreter_fail (gts->is);
@@ -132,7 +132,7 @@ wallet_tip_get_cb (void *cls,
wgr->details.ok.expiration))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Tip expiration does not match\n");
+ "Reward expiration does not match\n");
TALER_TESTING_interpreter_fail (gts->is);
return;
}
@@ -147,78 +147,79 @@ wallet_tip_get_cb (void *cls,
/**
- * Run the "GET tip" CMD.
+ * Run the "GET reward" CMD.
*
* @param cls closure.
* @param cmd command being run now.
* @param is interpreter state.
*/
static void
-wallet_get_tip_run (void *cls,
- const struct TALER_TESTING_Command *cmd,
- struct TALER_TESTING_Interpreter *is)
+wallet_get_reward_run (void *cls,
+ const struct TALER_TESTING_Command *cmd,
+ struct TALER_TESTING_Interpreter *is)
{
- struct WalletTipGetState *tgs = cls;
- const struct TALER_TESTING_Command *tip_cmd;
- const struct TALER_TipIdentifierP *tip_id;
+ struct WalletRewardGetState *tgs = cls;
+ const struct TALER_TESTING_Command *reward_cmd;
+ const struct TALER_RewardIdentifierP *reward_id;
- tip_cmd = TALER_TESTING_interpreter_lookup_command (is,
- tgs->tip_reference);
+ reward_cmd = TALER_TESTING_interpreter_lookup_command (is,
+ tgs->reward_reference);
if (GNUNET_OK !=
- TALER_TESTING_get_trait_tip_id (tip_cmd,
- &tip_id))
+ TALER_TESTING_get_trait_reward_id (reward_cmd,
+ &reward_id))
TALER_TESTING_FAIL (is);
tgs->is = is;
- tgs->tgh = TALER_MERCHANT_wallet_tip_get (TALER_TESTING_interpreter_get_context (is),
- tgs->merchant_url,
- tip_id,
- &wallet_tip_get_cb,
- tgs);
+ tgs->tgh = TALER_MERCHANT_wallet_reward_get (
+ TALER_TESTING_interpreter_get_context (is),
+ tgs->merchant_url,
+ reward_id,
+ &wallet_reward_get_cb,
+ tgs);
}
/**
- * Free the state of a "GET tip" CMD, and possibly
+ * Free the state of a "GET reward" CMD, and possibly
* cancel a pending operation thereof.
*
* @param cls closure.
* @param cmd command being run.
*/
static void
-wallet_get_tip_cleanup (void *cls,
- const struct TALER_TESTING_Command *cmd)
+wallet_get_reward_cleanup (void *cls,
+ const struct TALER_TESTING_Command *cmd)
{
- struct WalletTipGetState *tgs = cls;
+ struct WalletRewardGetState *tgs = cls;
if (NULL != tgs->tgh)
{
- TALER_LOG_WARNING ("Get tip operation did not complete\n");
- TALER_MERCHANT_wallet_tip_get_cancel (tgs->tgh);
+ TALER_LOG_WARNING ("Get reward operation did not complete\n");
+ TALER_MERCHANT_wallet_reward_get_cancel (tgs->tgh);
}
GNUNET_free (tgs);
}
struct TALER_TESTING_Command
-TALER_TESTING_cmd_wallet_get_tip (const char *label,
- const char *merchant_url,
- const char *tip_reference,
- unsigned int http_status)
+TALER_TESTING_cmd_wallet_get_reward (const char *label,
+ const char *merchant_url,
+ const char *reward_reference,
+ unsigned int http_status)
{
- struct WalletTipGetState *tgs;
+ struct WalletRewardGetState *tgs;
- tgs = GNUNET_new (struct WalletTipGetState);
+ tgs = GNUNET_new (struct WalletRewardGetState);
tgs->merchant_url = merchant_url;
- tgs->tip_reference = tip_reference;
+ tgs->reward_reference = reward_reference;
tgs->http_status = http_status;
{
struct TALER_TESTING_Command cmd = {
.cls = tgs,
.label = label,
- .run = &wallet_get_tip_run,
- .cleanup = &wallet_get_tip_cleanup
+ .run = &wallet_get_reward_run,
+ .cleanup = &wallet_get_reward_cleanup
};
return cmd;
@@ -227,17 +228,17 @@ TALER_TESTING_cmd_wallet_get_tip (const char *label,
struct TALER_TESTING_Command
-TALER_TESTING_cmd_wallet_get_tip2 (const char *label,
- const char *merchant_url,
- const char *tip_reference,
- const char *amount_remaining,
- unsigned int http_status)
+TALER_TESTING_cmd_wallet_get_reward2 (const char *label,
+ const char *merchant_url,
+ const char *reward_reference,
+ const char *amount_remaining,
+ unsigned int http_status)
{
- struct WalletTipGetState *tgs;
+ struct WalletRewardGetState *tgs;
- tgs = GNUNET_new (struct WalletTipGetState);
+ tgs = GNUNET_new (struct WalletRewardGetState);
tgs->merchant_url = merchant_url;
- tgs->tip_reference = tip_reference;
+ tgs->reward_reference = reward_reference;
tgs->cmp_amounts = true;
GNUNET_assert (GNUNET_OK == TALER_string_to_amount (amount_remaining,
&tgs->amount_remaining));
@@ -246,8 +247,8 @@ TALER_TESTING_cmd_wallet_get_tip2 (const char *label,
struct TALER_TESTING_Command cmd = {
.cls = tgs,
.label = label,
- .run = &wallet_get_tip_run,
- .cleanup = &wallet_get_tip_cleanup
+ .run = &wallet_get_reward_run,
+ .cleanup = &wallet_get_reward_cleanup
};
return cmd;
@@ -255,4 +256,4 @@ TALER_TESTING_cmd_wallet_get_tip2 (const char *label,
}
-/* end of testing_api_cmd_wallet_get_tip.c */
+/* end of testing_api_cmd_wallet_get_reward.c */