summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2023-07-10 10:37:25 +0200
committerChristian Grothoff <christian@grothoff.org>2023-07-10 10:37:25 +0200
commit3ebb5281bc62ca6231f6131e0601471d9ef03b8b (patch)
tree28037cedcb8383e5b32c8d11ae527612efb0609c /src/lib
parentc4b27ca9b9a5ef4291257e4a8b8f4bac56720b89 (diff)
downloadmerchant-3ebb5281bc62ca6231f6131e0601471d9ef03b8b.tar.gz
merchant-3ebb5281bc62ca6231f6131e0601471d9ef03b8b.tar.bz2
merchant-3ebb5281bc62ca6231f6131e0601471d9ef03b8b.zip
tip -> reward
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/Makefile.am12
-rw-r--r--src/lib/merchant_api_get_config.c2
-rw-r--r--src/lib/merchant_api_get_reserve.c38
-rw-r--r--src/lib/merchant_api_get_rewards.c (renamed from src/lib/merchant_api_get_tips.c)86
-rw-r--r--src/lib/merchant_api_merchant_get_reward.c (renamed from src/lib/merchant_api_merchant_get_tip.c)60
-rw-r--r--src/lib/merchant_api_reward_authorize.c (renamed from src/lib/merchant_api_tip_authorize.c)80
-rw-r--r--src/lib/merchant_api_reward_pickup.c (renamed from src/lib/merchant_api_tip_pickup.c)74
-rw-r--r--src/lib/merchant_api_reward_pickup2.c (renamed from src/lib/merchant_api_tip_pickup2.c)68
-rw-r--r--src/lib/merchant_api_wallet_get_reward.c (renamed from src/lib/merchant_api_wallet_get_tip.c)56
9 files changed, 238 insertions, 238 deletions
diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am
index e59bd432..a696f3ea 100644
--- a/src/lib/Makefile.am
+++ b/src/lib/Makefile.am
@@ -33,7 +33,7 @@ libtalermerchant_la_SOURCES = \
merchant_api_get_products.c \
merchant_api_get_reserve.c \
merchant_api_get_reserves.c \
- merchant_api_get_tips.c \
+ merchant_api_get_rewards.c \
merchant_api_get_transfers.c \
merchant_api_get_template.c \
merchant_api_get_templates.c \
@@ -41,7 +41,7 @@ libtalermerchant_la_SOURCES = \
merchant_api_get_webhooks.c \
merchant_api_lock_product.c \
merchant_api_merchant_get_order.c \
- merchant_api_merchant_get_tip.c \
+ merchant_api_merchant_get_reward.c \
merchant_api_patch_instance.c \
merchant_api_patch_order_forget.c \
merchant_api_patch_product.c \
@@ -62,10 +62,10 @@ libtalermerchant_la_SOURCES = \
merchant_api_post_templates.c \
merchant_api_post_using_templates.c \
merchant_api_post_webhooks.c \
- merchant_api_tip_authorize.c \
- merchant_api_tip_pickup.c \
- merchant_api_tip_pickup2.c \
- merchant_api_wallet_get_tip.c \
+ merchant_api_reward_authorize.c \
+ merchant_api_reward_pickup.c \
+ merchant_api_reward_pickup2.c \
+ merchant_api_wallet_get_reward.c \
merchant_api_wallet_get_order.c \
merchant_api_wallet_post_order_refund.c
diff --git a/src/lib/merchant_api_get_config.c b/src/lib/merchant_api_get_config.c
index b6023bdb..8eddf9d7 100644
--- a/src/lib/merchant_api_get_config.c
+++ b/src/lib/merchant_api_get_config.c
@@ -34,7 +34,7 @@
* Which version of the Taler protocol is implemented
* by this library? Used to determine compatibility.
*/
-#define MERCHANT_PROTOCOL_CURRENT 4
+#define MERCHANT_PROTOCOL_CURRENT 5
/**
* How many configs are we backwards compatible with?
diff --git a/src/lib/merchant_api_get_reserve.c b/src/lib/merchant_api_get_reserve.c
index b1c32cef..355008b0 100644
--- a/src/lib/merchant_api_get_reserve.c
+++ b/src/lib/merchant_api_get_reserve.c
@@ -96,7 +96,7 @@ handle_reserve_get_finished (void *cls,
{
struct TALER_MERCHANT_ReserveSummary *rs
= &rgr.details.ok.rs;
- const json_t *tips = NULL;
+ const json_t *rewards = NULL;
const json_t *accounts = NULL;
unsigned int accounts_len;
struct GNUNET_JSON_Specification spec[] = {
@@ -107,8 +107,8 @@ handle_reserve_get_finished (void *cls,
GNUNET_JSON_spec_bool ("active",
&rgr.details.ok.active),
GNUNET_JSON_spec_mark_optional (
- GNUNET_JSON_spec_array_const ("tips",
- &tips),
+ GNUNET_JSON_spec_array_const ("rewards",
+ &rewards),
NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_array_const ("accounts",
@@ -134,7 +134,7 @@ handle_reserve_get_finished (void *cls,
GNUNET_JSON_spec_end ()
};
struct TALER_EXCHANGE_WireAccount *was = NULL;
- struct TALER_MERCHANT_TipDetails *tds = NULL;
+ struct TALER_MERCHANT_RewardDetails *tds = NULL;
if (GNUNET_OK !=
GNUNET_JSON_parse (json,
@@ -169,20 +169,20 @@ handle_reserve_get_finished (void *cls,
}
} /* end 'have accounts' */
- if (NULL != tips)
+ if (NULL != rewards)
{
- size_t tds_length = json_array_size (tips);
+ size_t tds_length = json_array_size (rewards);
bool ok = true;
- json_t *tip;
+ json_t *reward;
unsigned int i;
tds = GNUNET_new_array (tds_length,
- struct TALER_MERCHANT_TipDetails);
- json_array_foreach (tips, i, tip) {
- struct TALER_MERCHANT_TipDetails *td = &tds[i];
+ struct TALER_MERCHANT_RewardDetails);
+ json_array_foreach (rewards, i, reward) {
+ struct TALER_MERCHANT_RewardDetails *td = &tds[i];
struct GNUNET_JSON_Specification ispec[] = {
- GNUNET_JSON_spec_fixed_auto ("tip_id",
- &td->tip_id),
+ GNUNET_JSON_spec_fixed_auto ("reward_id",
+ &td->reward_id),
TALER_JSON_spec_amount_any ("total_amount",
&td->amount),
GNUNET_JSON_spec_string ("reason",
@@ -191,7 +191,7 @@ handle_reserve_get_finished (void *cls,
};
if (GNUNET_OK !=
- GNUNET_JSON_parse (tip,
+ GNUNET_JSON_parse (reward,
ispec,
NULL, NULL))
{
@@ -208,10 +208,10 @@ handle_reserve_get_finished (void *cls,
}
else
{
- rgr.details.ok.tips = tds;
- rgr.details.ok.tips_length = tds_length;
+ rgr.details.ok.rewards = tds;
+ rgr.details.ok.rewards_length = tds_length;
}
- } /* end 'have tips' */
+ } /* end 'have rewards' */
rgh->cb (rgh->cb_cls,
&rgr);
@@ -258,7 +258,7 @@ struct TALER_MERCHANT_ReserveGetHandle *
TALER_MERCHANT_reserve_get (struct GNUNET_CURL_Context *ctx,
const char *backend_url,
const struct TALER_ReservePublicKeyP *reserve_pub,
- bool fetch_tips,
+ bool fetch_rewards,
TALER_MERCHANT_ReserveGetCallback cb,
void *cb_cls)
{
@@ -285,8 +285,8 @@ TALER_MERCHANT_reserve_get (struct GNUNET_CURL_Context *ctx,
res_str);
rgh->url = TALER_url_join (backend_url,
arg_str,
- "tips",
- fetch_tips ? "yes" : "no",
+ "rewards",
+ fetch_rewards ? "yes" : "no",
NULL);
}
if (NULL == rgh->url)
diff --git a/src/lib/merchant_api_get_tips.c b/src/lib/merchant_api_get_rewards.c
index 4103c071..96ec4d34 100644
--- a/src/lib/merchant_api_get_tips.c
+++ b/src/lib/merchant_api_get_rewards.c
@@ -15,8 +15,8 @@
<http://www.gnu.org/licenses/>
*/
/**
- * @file merchant_api_get_tips.c
- * @brief Implementation of the GET /private/tips request of the merchant's HTTP API
+ * @file merchant_api_get_rewards.c
+ * @brief Implementation of the GET /private/rewards request of the merchant's HTTP API
* @author Jonathan Buchanan
*/
#include "platform.h"
@@ -32,9 +32,9 @@
/**
- * Handle for a GET /private/tips operation.
+ * Handle for a GET /private/rewards operation.
*/
-struct TALER_MERCHANT_TipsGetHandle
+struct TALER_MERCHANT_RewardsGetHandle
{
/**
* The url for this request.
@@ -49,7 +49,7 @@ struct TALER_MERCHANT_TipsGetHandle
/**
* Function to call with the result.
*/
- TALER_MERCHANT_TipsGetCallback cb;
+ TALER_MERCHANT_RewardsGetCallback cb;
/**
* Closure for @a cb.
@@ -65,32 +65,32 @@ struct TALER_MERCHANT_TipsGetHandle
/**
- * Parse tip information from @a ia.
+ * Parse reward information from @a ia.
*
- * @param ia JSON array (or NULL!) tip order data
+ * @param ia JSON array (or NULL!) reward order data
* @param[in] tgr response to complete
* @param tgh operation handle
* @return #GNUNET_OK on success
*/
static enum GNUNET_GenericReturnValue
-parse_tips (const json_t *ia,
- struct TALER_MERCHANT_TipsGetResponse *tgr,
- struct TALER_MERCHANT_TipsGetHandle *tgh)
+parse_rewards (const json_t *ia,
+ struct TALER_MERCHANT_RewardsGetResponse *tgr,
+ struct TALER_MERCHANT_RewardsGetHandle *tgh)
{
unsigned int tes_len = json_array_size (ia);
- struct TALER_MERCHANT_TipEntry tes[GNUNET_NZL (tes_len)];
+ struct TALER_MERCHANT_RewardEntry tes[GNUNET_NZL (tes_len)];
size_t index;
json_t *value;
json_array_foreach (ia, index, value) {
- struct TALER_MERCHANT_TipEntry *ie = &tes[index];
+ struct TALER_MERCHANT_RewardEntry *ie = &tes[index];
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_uint64 ("row_id",
&ie->row_id),
- GNUNET_JSON_spec_fixed_auto ("tip_id",
- &ie->tip_id),
- TALER_JSON_spec_amount_any ("tip_amount",
- &ie->tip_amount),
+ GNUNET_JSON_spec_fixed_auto ("reward_id",
+ &ie->reward_id),
+ TALER_JSON_spec_amount_any ("reward_amount",
+ &ie->reward_amount),
GNUNET_JSON_spec_end ()
};
@@ -103,8 +103,8 @@ parse_tips (const json_t *ia,
return GNUNET_SYSERR;
}
}
- tgr->details.ok.tips_length = tes_len;
- tgr->details.ok.tips = tes;
+ tgr->details.ok.rewards_length = tes_len;
+ tgr->details.ok.rewards = tes;
tgh->cb (tgh->cb_cls,
tgr);
tgh->cb = NULL; /* just to be sure */
@@ -114,36 +114,36 @@ parse_tips (const json_t *ia,
/**
* Function called when we're done processing the
- * HTTP GET /private/tips request.
+ * HTTP GET /private/rewards request.
*
- * @param cls the `struct TALER_MERCHANT_TipsGetHandle`
+ * @param cls the `struct TALER_MERCHANT_RewardsGetHandle`
* @param response_code HTTP response code, 0 on error
* @param response response body, NULL if not in JSON
*/
static void
-handle_get_tips_finished (void *cls,
+handle_get_rewards_finished (void *cls,
long response_code,
const void *response)
{
- struct TALER_MERCHANT_TipsGetHandle *tgh = cls;
+ struct TALER_MERCHANT_RewardsGetHandle *tgh = cls;
const json_t *json = response;
- struct TALER_MERCHANT_TipsGetResponse tgr = {
+ struct TALER_MERCHANT_RewardsGetResponse tgr = {
.hr.http_status = (unsigned int) response_code,
.hr.reply = json
};
tgh->job = NULL;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Got /private/tips response with status code %u\n",
+ "Got /private/rewards response with status code %u\n",
(unsigned int) response_code);
switch (response_code)
{
case MHD_HTTP_OK:
{
- const json_t *tips;
+ const json_t *rewards;
struct GNUNET_JSON_Specification spec[] = {
- GNUNET_JSON_spec_array_const ("tips",
- &tips),
+ GNUNET_JSON_spec_array_const ("rewards",
+ &rewards),
GNUNET_JSON_spec_end ()
};
@@ -157,11 +157,11 @@ handle_get_tips_finished (void *cls,
break;
}
if (GNUNET_OK ==
- parse_tips (tips,
+ parse_rewards (rewards,
&tgr,
tgh))
{
- TALER_MERCHANT_tips_get_cancel (tgh);
+ TALER_MERCHANT_rewards_get_cancel (tgh);
return;
}
tgr.hr.http_status = 0;
@@ -185,18 +185,18 @@ handle_get_tips_finished (void *cls,
}
tgh->cb (tgh->cb_cls,
&tgr);
- TALER_MERCHANT_tips_get_cancel (tgh);
+ TALER_MERCHANT_rewards_get_cancel (tgh);
}
-struct TALER_MERCHANT_TipsGetHandle *
-TALER_MERCHANT_tips_get (
+struct TALER_MERCHANT_RewardsGetHandle *
+TALER_MERCHANT_rewards_get (
struct GNUNET_CURL_Context *ctx,
const char *backend_url,
- TALER_MERCHANT_TipsGetCallback cb,
+ TALER_MERCHANT_RewardsGetCallback cb,
void *cb_cls)
{
- return TALER_MERCHANT_tips_get2 (ctx,
+ return TALER_MERCHANT_rewards_get2 (ctx,
backend_url,
TALER_EXCHANGE_YNA_NO,
-20,
@@ -206,16 +206,16 @@ TALER_MERCHANT_tips_get (
}
-struct TALER_MERCHANT_TipsGetHandle *
-TALER_MERCHANT_tips_get2 (struct GNUNET_CURL_Context *ctx,
+struct TALER_MERCHANT_RewardsGetHandle *
+TALER_MERCHANT_rewards_get2 (struct GNUNET_CURL_Context *ctx,
const char *backend_url,
enum TALER_EXCHANGE_YesNoAll expired,
int64_t limit,
uint64_t offset,
- TALER_MERCHANT_TipsGetCallback cb,
+ TALER_MERCHANT_RewardsGetCallback cb,
void *cb_cls)
{
- struct TALER_MERCHANT_TipsGetHandle *tgh;
+ struct TALER_MERCHANT_RewardsGetHandle *tgh;
CURL *eh;
GNUNET_assert (NULL != backend_url);
@@ -224,7 +224,7 @@ TALER_MERCHANT_tips_get2 (struct GNUNET_CURL_Context *ctx,
GNUNET_break (0);
return NULL;
}
- tgh = GNUNET_new (struct TALER_MERCHANT_TipsGetHandle);
+ tgh = GNUNET_new (struct TALER_MERCHANT_RewardsGetHandle);
tgh->ctx = ctx;
tgh->cb = cb;
tgh->cb_cls = cb_cls;
@@ -249,7 +249,7 @@ TALER_MERCHANT_tips_get2 (struct GNUNET_CURL_Context *ctx,
"%llu",
(unsigned long long) offset);
tgh->url = TALER_url_join (backend_url,
- "private/tips",
+ "private/rewards",
"expired",
(TALER_EXCHANGE_YNA_ALL != expired)
? TALER_yna_to_string (expired)
@@ -271,15 +271,15 @@ TALER_MERCHANT_tips_get2 (struct GNUNET_CURL_Context *ctx,
eh = TALER_MERCHANT_curl_easy_get_ (tgh->url);
tgh->job = GNUNET_CURL_job_add (ctx,
eh,
- &handle_get_tips_finished,
+ &handle_get_rewards_finished,
tgh);
return tgh;
}
void
-TALER_MERCHANT_tips_get_cancel (
- struct TALER_MERCHANT_TipsGetHandle *tgh)
+TALER_MERCHANT_rewards_get_cancel (
+ struct TALER_MERCHANT_RewardsGetHandle *tgh)
{
if (NULL != tgh->job)
GNUNET_CURL_job_cancel (tgh->job);
diff --git a/src/lib/merchant_api_merchant_get_tip.c b/src/lib/merchant_api_merchant_get_reward.c
index 59c4b588..ba7306c0 100644
--- a/src/lib/merchant_api_merchant_get_tip.c
+++ b/src/lib/merchant_api_merchant_get_reward.c
@@ -15,8 +15,8 @@
<http://www.gnu.org/licenses/>
*/
/**
- * @file merchant_api_merchant_get_tip.c
- * @brief Implementation of the GET /private/tips/$TIP_ID request of the merchant's HTTP API
+ * @file merchant_api_merchant_get_reward.c
+ * @brief Implementation of the GET /private/rewards/$REWARD_ID request of the merchant's HTTP API
* @author Jonathan Buchanan
*/
#include "platform.h"
@@ -32,7 +32,7 @@
#include <taler/taler_signatures.h>
-struct TALER_MERCHANT_TipMerchantGetHandle
+struct TALER_MERCHANT_RewardMerchantGetHandle
{
/**
* The url for this request.
@@ -47,7 +47,7 @@ struct TALER_MERCHANT_TipMerchantGetHandle
/**
* Function to call with the result.
*/
- TALER_MERCHANT_TipMerchantGetCallback cb;
+ TALER_MERCHANT_RewardMerchantGetCallback cb;
/**
* Closure for @a cb.
@@ -63,8 +63,8 @@ struct TALER_MERCHANT_TipMerchantGetHandle
static enum GNUNET_GenericReturnValue
parse_pickups (const json_t *pa,
- struct TALER_MERCHANT_TipStatusResponse *tsr,
- struct TALER_MERCHANT_TipMerchantGetHandle *tgh)
+ struct TALER_MERCHANT_RewardStatusResponse *tsr,
+ struct TALER_MERCHANT_RewardMerchantGetHandle *tgh)
{
unsigned int pa_len = json_array_size (pa);
struct TALER_MERCHANT_PickupDetail pickups[pa_len];
@@ -104,26 +104,26 @@ parse_pickups (const json_t *pa,
/**
* Function called when we're done processing the
- * GET /private/tips/$TIP_ID request.
+ * GET /private/rewards/$REWARD_ID request.
*
- * @param cls the `struct TALER_MERCHANT_TipMerchantGetHandle`
+ * @param cls the `struct TALER_MERCHANT_RewardMerchantGetHandle`
* @param response_code HTTP response code, 0 on error
* @param response response body, NULL if not in JSON
*/
static void
-handle_merchant_tip_get_finished (void *cls,
+handle_merchant_reward_get_finished (void *cls,
long response_code,
const void *response)
{
- struct TALER_MERCHANT_TipMerchantGetHandle *tgh = cls;
+ struct TALER_MERCHANT_RewardMerchantGetHandle *tgh = cls;
const json_t *json = response;
- struct TALER_MERCHANT_TipStatusResponse tsr = {
+ struct TALER_MERCHANT_RewardStatusResponse tsr = {
.hr.http_status = (unsigned int) response_code,
.hr.reply = json
};
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Got /private/tips/$TIP_ID response with status code %u\n",
+ "Got /private/rewards/$REWARD_ID response with status code %u\n",
(unsigned int) response_code);
tgh->job = NULL;
switch (response_code)
@@ -160,7 +160,7 @@ handle_merchant_tip_get_finished (void *cls,
{
tgh->cb (tgh->cb_cls,
&tsr);
- TALER_MERCHANT_merchant_tip_get_cancel (tgh);
+ TALER_MERCHANT_merchant_reward_get_cancel (tgh);
return;
}
if (GNUNET_OK ==
@@ -169,7 +169,7 @@ handle_merchant_tip_get_finished (void *cls,
tgh))
{
GNUNET_JSON_parse_free (spec);
- TALER_MERCHANT_merchant_tip_get_cancel (tgh);
+ TALER_MERCHANT_merchant_reward_get_cancel (tgh);
return;
}
tsr.hr.http_status = 0;
@@ -184,7 +184,7 @@ handle_merchant_tip_get_finished (void *cls,
/* Nothing really to verify, merchant says we need to authenticate. */
break;
case MHD_HTTP_NOT_FOUND:
- /* legal, can happen if instance or tip reserve is unknown */
+ /* legal, can happen if instance or reward reserve is unknown */
tsr.hr.ec = TALER_JSON_get_error_code (json);
tsr.hr.hint = TALER_JSON_get_error_hint (json);
break;
@@ -208,43 +208,43 @@ handle_merchant_tip_get_finished (void *cls,
}
tgh->cb (tgh->cb_cls,
&tsr);
- TALER_MERCHANT_merchant_tip_get_cancel (tgh);
+ TALER_MERCHANT_merchant_reward_get_cancel (tgh);
}
-struct TALER_MERCHANT_TipMerchantGetHandle *
-TALER_MERCHANT_merchant_tip_get (struct GNUNET_CURL_Context *ctx,
+struct TALER_MERCHANT_RewardMerchantGetHandle *
+TALER_MERCHANT_merchant_reward_get (struct GNUNET_CURL_Context *ctx,
const char *backend_url,
- const struct TALER_TipIdentifierP *tip_id,
+ const struct TALER_RewardIdentifierP *reward_id,
const struct TALER_Amount *min_pick_up,
struct GNUNET_TIME_Relative lp_timeout,
bool pickups,
- TALER_MERCHANT_TipMerchantGetCallback cb,
+ TALER_MERCHANT_RewardMerchantGetCallback cb,
void *cb_cls)
{
- struct TALER_MERCHANT_TipMerchantGetHandle *tgh;
+ struct TALER_MERCHANT_RewardMerchantGetHandle *tgh;
CURL *eh;
GNUNET_assert (NULL != backend_url);
- tgh = GNUNET_new (struct TALER_MERCHANT_TipMerchantGetHandle);
+ tgh = GNUNET_new (struct TALER_MERCHANT_RewardMerchantGetHandle);
tgh->ctx = ctx;
tgh->cb = cb;
tgh->cb_cls = cb_cls;
{
- char res_str[sizeof (*tip_id) * 2];
+ char res_str[sizeof (*reward_id) * 2];
char arg_str[sizeof (res_str) + 48];
char timeout_str[32];
char *end;
- end = GNUNET_STRINGS_data_to_string (tip_id,
- sizeof (*tip_id),
+ end = GNUNET_STRINGS_data_to_string (reward_id,
+ sizeof (*reward_id),
res_str,
sizeof (res_str));
*end = '\0';
GNUNET_snprintf (arg_str,
sizeof (arg_str),
- "private/tips/%s",
+ "private/rewards/%s",
res_str);
GNUNET_snprintf (timeout_str,
sizeof (timeout_str),
@@ -279,15 +279,15 @@ TALER_MERCHANT_merchant_tip_get (struct GNUNET_CURL_Context *ctx,
eh = TALER_MERCHANT_curl_easy_get_ (tgh->url);
tgh->job = GNUNET_CURL_job_add (ctx,
eh,
- &handle_merchant_tip_get_finished,
+ &handle_merchant_reward_get_finished,
tgh);
return tgh;
}
void
-TALER_MERCHANT_merchant_tip_get_cancel (
- struct TALER_MERCHANT_TipMerchantGetHandle *tgh)
+TALER_MERCHANT_merchant_reward_get_cancel (
+ struct TALER_MERCHANT_RewardMerchantGetHandle *tgh)
{
if (NULL != tgh->job)
{
@@ -299,4 +299,4 @@ TALER_MERCHANT_merchant_tip_get_cancel (
}
-/* end of merchant_api_merchant_get_tip.c */
+/* end of merchant_api_merchant_get_reward.c */
diff --git a/src/lib/merchant_api_tip_authorize.c b/src/lib/merchant_api_reward_authorize.c
index 317023ac..b250031b 100644
--- a/src/lib/merchant_api_tip_authorize.c
+++ b/src/lib/merchant_api_reward_authorize.c
@@ -15,8 +15,8 @@
<http://www.gnu.org/licenses/>
*/
/**
- * @file merchant_api_tip_authorize.c
- * @brief Implementation of the /tip-authorize request of the merchant's HTTP API
+ * @file merchant_api_reward_authorize.c
+ * @brief Implementation of the /reward-authorize request of the merchant's HTTP API
* @author Marcello Stanisci
* @author Christian Grothoff
*/
@@ -35,9 +35,9 @@
/**
- * @brief A handle for tip authorizations.
+ * @brief A handle for reward authorizations.
*/
-struct TALER_MERCHANT_TipAuthorizeHandle
+struct TALER_MERCHANT_RewardAuthorizeHandle
{
/**
@@ -53,7 +53,7 @@ struct TALER_MERCHANT_TipAuthorizeHandle
/**
* Function to call with the result.
*/
- TALER_MERCHANT_TipAuthorizeCallback cb;
+ TALER_MERCHANT_RewardAuthorizeCallback cb;
/**
* Closure for @a cb.
@@ -82,23 +82,23 @@ struct TALER_MERCHANT_TipAuthorizeHandle
* @return #GNUNET_OK if response is valid
*/
static enum GNUNET_GenericReturnValue
-check_ok (struct TALER_MERCHANT_TipAuthorizeHandle *tao,
+check_ok (struct TALER_MERCHANT_RewardAuthorizeHandle *tao,
const json_t *json)
{
- const char *tip_status_url;
- struct TALER_MERCHANT_TipAuthorizeResponse tar = {
+ const char *reward_status_url;
+ struct TALER_MERCHANT_RewardAuthorizeResponse tar = {
.hr.http_status = MHD_HTTP_OK,
.hr.reply = json
};
struct GNUNET_JSON_Specification spec[] = {
- GNUNET_JSON_spec_string ("tip_status_url",
- &tip_status_url),
- GNUNET_JSON_spec_string ("taler_tip_uri",
- &tar.details.ok.tip_uri),
- GNUNET_JSON_spec_timestamp ("tip_expiration",
- &tar.details.ok.tip_expiration),
- GNUNET_JSON_spec_fixed_auto ("tip_id",
- &tar.details.ok.tip_id),
+ GNUNET_JSON_spec_string ("reward_status_url",
+ &reward_status_url),
+ GNUNET_JSON_spec_string ("taler_reward_uri",
+ &tar.details.ok.reward_uri),
+ GNUNET_JSON_spec_timestamp ("reward_expiration",
+ &tar.details.ok.reward_expiration),
+ GNUNET_JSON_spec_fixed_auto ("reward_id",
+ &tar.details.ok.reward_id),
GNUNET_JSON_spec_end ()
};
@@ -128,20 +128,20 @@ check_ok (struct TALER_MERCHANT_TipAuthorizeHandle *tao,
/**
* Function called when we're done processing the
- * HTTP /reservers/$TIP_ID/tip-authorize request.
+ * HTTP /reservers/$REWARD_ID/reward-authorize request.
*
- * @param cls the `struct TALER_MERCHANT_TipAuthorizeHandle`
+ * @param cls the `struct TALER_MERCHANT_RewardAuthorizeHandle`
* @param response_code HTTP response code, 0 on error
* @param response response body, NULL if not in JSON
*/
static void
-handle_tip_authorize_finished (void *cls,
+handle_reward_authorize_finished (void *cls,
long response_code,
const void *response)
{
- struct TALER_MERCHANT_TipAuthorizeHandle *tao = cls;
+ struct TALER_MERCHANT_RewardAuthorizeHandle *tao = cls;
const json_t *json = response;
- struct TALER_MERCHANT_TipAuthorizeResponse tar = {
+ struct TALER_MERCHANT_RewardAuthorizeResponse tar = {
.hr.http_status = (unsigned int) response_code,
.hr.reply = json
};
@@ -154,7 +154,7 @@ handle_tip_authorize_finished (void *cls,
check_ok (tao,
json))
{
- TALER_MERCHANT_tip_authorize_cancel (tao);
+ TALER_MERCHANT_reward_authorize_cancel (tao);
return;
}
GNUNET_break_op (0);
@@ -204,26 +204,26 @@ handle_tip_authorize_finished (void *cls,
if (NULL != tao->cb)
tao->cb (tao->cb_cls,
&tar);
- TALER_MERCHANT_tip_authorize_cancel (tao);
+ TALER_MERCHANT_reward_authorize_cancel (tao);
}
-struct TALER_MERCHANT_TipAuthorizeHandle *
-TALER_MERCHANT_tip_authorize2 (
+struct TALER_MERCHANT_RewardAuthorizeHandle *
+TALER_MERCHANT_reward_authorize2 (
struct GNUNET_CURL_Context *ctx,
const char *backend_url,
const struct TALER_ReservePublicKeyP *reserve_pub,
const char *next_url,
const struct TALER_Amount *amount,
const char *justification,
- TALER_MERCHANT_TipAuthorizeCallback authorize_cb,
+ TALER_MERCHANT_RewardAuthorizeCallback authorize_cb,
void *authorize_cb_cls)
{
- struct TALER_MERCHANT_TipAuthorizeHandle *tao;
+ struct TALER_MERCHANT_RewardAuthorizeHandle *tao;
CURL *eh;
json_t *te_obj;
- tao = GNUNET_new (struct TALER_MERCHANT_TipAuthorizeHandle);
+ tao = GNUNET_new (struct TALER_MERCHANT_RewardAuthorizeHandle);
tao->ctx = ctx;
tao->cb = authorize_cb;
tao->cb_cls = authorize_cb_cls;
@@ -240,7 +240,7 @@ TALER_MERCHANT_tip_authorize2 (
*end = '\0';
GNUNET_snprintf (arg_str,
sizeof (arg_str),
- "private/reserves/%s/authorize-tip",
+ "private/reserves/%s/authorize-reward",
res_str);
tao->url = TALER_url_join (backend_url,
arg_str,
@@ -286,32 +286,32 @@ TALER_MERCHANT_tip_authorize2 (
tao->job = GNUNET_CURL_job_add2 (ctx,
eh,
tao->post_ctx.headers,
- &handle_tip_authorize_finished,
+ &handle_reward_authorize_finished,
tao);
return tao;
}
-struct TALER_MERCHANT_TipAuthorizeHandle *
-TALER_MERCHANT_tip_authorize (struct GNUNET_CURL_Context *ctx,
+struct TALER_MERCHANT_RewardAuthorizeHandle *
+TALER_MERCHANT_reward_authorize (struct GNUNET_CURL_Context *ctx,
const char *backend_url,
const char *next_url,
const struct TALER_Amount *amount,
const char *justification,
- TALER_MERCHANT_TipAuthorizeCallback authorize_cb,
+ TALER_MERCHANT_RewardAuthorizeCallback authorize_cb,
void *authorize_cb_cls)
{
- struct TALER_MERCHANT_TipAuthorizeHandle *tao;
+ struct TALER_MERCHANT_RewardAuthorizeHandle *tao;
CURL *eh;
json_t *te_obj;
- tao = GNUNET_new (struct TALER_MERCHANT_TipAuthorizeHandle);
+ tao = GNUNET_new (struct TALER_MERCHANT_RewardAuthorizeHandle);
tao->ctx = ctx;
tao->cb = authorize_cb;
tao->cb_cls = authorize_cb_cls;
tao->url = TALER_url_join (backend_url,
- "private/tips",
+ "private/rewards",
NULL);
if (NULL == tao->url)
{
@@ -347,15 +347,15 @@ TALER_MERCHANT_tip_authorize (struct GNUNET_CURL_Context *ctx,
tao->job = GNUNET_CURL_job_add2 (ctx,
eh,
tao->post_ctx.headers,
- &handle_tip_authorize_finished,
+ &handle_reward_authorize_finished,
tao);
return tao;
}
void
-TALER_MERCHANT_tip_authorize_cancel (
- struct TALER_MERCHANT_TipAuthorizeHandle *tao)
+TALER_MERCHANT_reward_authorize_cancel (
+ struct TALER_MERCHANT_RewardAuthorizeHandle *tao)
{
if (NULL != tao->job)
{
@@ -368,4 +368,4 @@ TALER_MERCHANT_tip_authorize_cancel (
}
-/* end of merchant_api_tip_authorize.c */
+/* end of merchant_api_reward_authorize.c */
diff --git a/src/lib/merchant_api_tip_pickup.c b/src/lib/merchant_api_reward_pickup.c
index eb0e3fb3..1d884d48 100644
--- a/src/lib/merchant_api_tip_pickup.c
+++ b/src/lib/merchant_api_reward_pickup.c
@@ -15,8 +15,8 @@
<http://www.gnu.org/licenses/>
*/
/**
- * @file merchant_api_tip_pickup.c
- * @brief Implementation of the /tip-pickup request of the merchant's HTTP API
+ * @file merchant_api_reward_pickup.c
+ * @brief Implementation of the /reward-pickup request of the merchant's HTTP API
* @author Marcello Stanisci
* @author Christian Grothoff
*/
@@ -64,9 +64,9 @@ struct PlanchetData
struct TALER_EXCHANGE_CsRWithdrawHandle *csr;
/**
- * Handle for the /tip-pickup operation we are part of.
+ * Handle for the /reward-pickup operation we are part of.
*/
- struct TALER_MERCHANT_TipPickupHandle *tp;
+ struct TALER_MERCHANT_RewardPickupHandle *tp;
/**
* Offset of this entry in the array.
@@ -76,15 +76,15 @@ struct PlanchetData
/**
- * Handle for a /tip-pickup operation.
+ * Handle for a /reward-pickup operation.
*/
-struct TALER_MERCHANT_TipPickupHandle
+struct TALER_MERCHANT_RewardPickupHandle
{
/**
* Function to call with the result.
*/
- TALER_MERCHANT_TipPickupCallback cb;
+ TALER_MERCHANT_RewardPickupCallback cb;
/**
* Closure for @a cb.
@@ -94,7 +94,7 @@ struct TALER_MERCHANT_TipPickupHandle
/**
* Handle for the actual (internal) withdraw operation.
*/
- struct TALER_MERCHANT_TipPickup2Handle *tpo2;
+ struct TALER_MERCHANT_RewardPickup2Handle *tpo2;
/**
* Array of length @e num_planchets.
@@ -117,9 +117,9 @@ struct TALER_MERCHANT_TipPickupHandle
char *backend_url;
/**
- * ID of the tip we are picking up.
+ * ID of the reward we are picking up.
*/
- struct TALER_TipIdentifierP tip_id;
+ struct TALER_RewardIdentifierP reward_id;
/**
* Number of planchets/coins used for this operation.
@@ -141,7 +141,7 @@ struct TALER_MERCHANT_TipPickupHandle
* @param ec reason for the failure
*/
static void
-fail_pickup (struct TALER_MERCHANT_TipPickupHandle *tp,
+fail_pickup (struct TALER_MERCHANT_RewardPickupHandle *tp,
enum TALER_ErrorCode ec)
{
struct TALER_MERCHANT_PickupDetails pd = {
@@ -150,22 +150,22 @@ fail_pickup (struct TALER_MERCHANT_TipPickupHandle *tp,
tp->cb (tp->cb_cls,
&pd);
- TALER_MERCHANT_tip_pickup_cancel (tp);
+ TALER_MERCHANT_reward_pickup_cancel (tp);
}
/**
- * Callback for a /tip-pickup request. Returns the result of the operation.
+ * Callback for a /reward-pickup request. Returns the result of the operation.
* Note that the client MUST still do the unblinding of the @a blind_sigs.
*
- * @param cls closure, a `struct TALER_MERCHANT_TipPickupHandle *`
+ * @param cls closure, a `struct TALER_MERCHANT_RewardPickupHandle *`
* @param tpr response details
*/
static void
pickup_done_cb (void *cls,
- const struct TALER_MERCHANT_TipPickup2Response *tpr)
+ const struct TALER_MERCHANT_RewardPickup2Response *tpr)
{
- struct TALER_MERCHANT_TipPickupHandle *tp = cls;
+ struct TALER_MERCHANT_RewardPickupHandle *tp = cls;
struct TALER_MERCHANT_PickupDetails pd = {
.hr = tpr->hr
};
@@ -175,7 +175,7 @@ pickup_done_cb (void *cls,
{
tp->cb (tp->cb_cls,
&pd);
- TALER_MERCHANT_tip_pickup_cancel (tp);
+ TALER_MERCHANT_reward_pickup_cancel (tp);
return;
}
{
@@ -206,7 +206,7 @@ pickup_done_cb (void *cls,
}
if (GNUNET_OK != ok)
{
- pd.hr.ec = TALER_EC_MERCHANT_TIP_PICKUP_UNBLIND_FAILURE;
+ pd.hr.ec = TALER_EC_MERCHANT_REWARD_PICKUP_UNBLIND_FAILURE;
}
else
{
@@ -216,7 +216,7 @@ pickup_done_cb (void *cls,
tp->cb (tp->cb_cls,
&pd);
}
- TALER_MERCHANT_tip_pickup_cancel (tp);
+ TALER_MERCHANT_reward_pickup_cancel (tp);
}
@@ -226,7 +226,7 @@ pickup_done_cb (void *cls,
* @param[in,out] tp operation to continue
*/
static void
-pickup_post_csr (struct TALER_MERCHANT_TipPickupHandle *tp)
+pickup_post_csr (struct TALER_MERCHANT_RewardPickupHandle *tp)
{
struct TALER_PlanchetDetail details[tp->num_planchets];
@@ -263,9 +263,9 @@ pickup_post_csr (struct TALER_MERCHANT_TipPickupHandle *tp)
return;
}
}
- tp->tpo2 = TALER_MERCHANT_tip_pickup2 (tp->ctx,
+ tp->tpo2 = TALER_MERCHANT_reward_pickup2 (tp->ctx,
tp->backend_url,
- &tp->tip_id,
+ &tp->reward_id,
tp->num_planchets,
details,
&pickup_done_cb,
@@ -286,7 +286,7 @@ pickup_post_csr (struct TALER_MERCHANT_TipPickupHandle *tp)
* Callbacks of this type are used to serve the result of submitting a
* CS R request to a exchange.
*
- * @param cls a `struct TALER_MERCHANT_TipPickupHandle`
+ * @param cls a `struct TALER_MERCHANT_RewardPickupHandle`
* @param csrr response details
*/
static void
@@ -294,7 +294,7 @@ csr_cb (void *cls,
const struct TALER_EXCHANGE_CsRWithdrawResponse *csrr)
{
struct PlanchetData *pd = cls;
- struct TALER_MERCHANT_TipPickupHandle *tp = pd->tp;
+ struct TALER_MERCHANT_RewardPickupHandle *tp = pd->tp;
pd->csr = NULL;
tp->csr_active--;
@@ -319,37 +319,37 @@ csr_cb (void *cls,
tp->cb (tp->cb_cls,
&pd);
- TALER_MERCHANT_tip_pickup_cancel (tp);
+ TALER_MERCHANT_reward_pickup_cancel (tp);
return;
}
}
}
-struct TALER_MERCHANT_TipPickupHandle *
-TALER_MERCHANT_tip_pickup (
+struct TALER_MERCHANT_RewardPickupHandle *
+TALER_MERCHANT_reward_pickup (
struct GNUNET_CURL_Context *ctx,
const char *exchange_url,
const char *backend_url,
- const struct TALER_TipIdentifierP *tip_id,
+ const struct TALER_RewardIdentifierP *reward_id,
unsigned int num_planchets,
const struct TALER_MERCHANT_PlanchetData pds[static num_planchets],
- TALER_MERCHANT_TipPickupCallback pickup_cb,
+ TALER_MERCHANT_RewardPickupCallback pickup_cb,
void *pickup_cb_cls)
{
- struct TALER_MERCHANT_TipPickupHandle *tp;
+ struct TALER_MERCHANT_RewardPickupHandle *tp;
if (0 == num_planchets)
{
GNUNET_break (0);
return NULL;
}
- tp = GNUNET_new (struct TALER_MERCHANT_TipPickupHandle);
+ tp = GNUNET_new (struct TALER_MERCHANT_RewardPickupHandle);
tp->cb = pickup_cb;
tp->cb_cls = pickup_cb_cls;
tp->ctx = ctx;
tp->backend_url = GNUNET_strdup (backend_url);
- tp->tip_id = *tip_id;
+ tp->reward_id = *reward_id;
tp->num_planchets = num_planchets;
tp->planchets = GNUNET_new_array (num_planchets,
struct PlanchetData);
@@ -386,7 +386,7 @@ TALER_MERCHANT_tip_pickup (
if (NULL == pd->csr)
{
GNUNET_break (0);
- TALER_MERCHANT_tip_pickup_cancel (tp);
+ TALER_MERCHANT_reward_pickup_cancel (tp);
return NULL;
}
tp->csr_active++;
@@ -394,7 +394,7 @@ TALER_MERCHANT_tip_pickup (
}
default:
GNUNET_break (0);
- TALER_MERCHANT_tip_pickup_cancel (tp);
+ TALER_MERCHANT_reward_pickup_cancel (tp);
return NULL;
}
}
@@ -408,7 +408,7 @@ TALER_MERCHANT_tip_pickup (
void
-TALER_MERCHANT_tip_pickup_cancel (struct TALER_MERCHANT_TipPickupHandle *tp)
+TALER_MERCHANT_reward_pickup_cancel (struct TALER_MERCHANT_RewardPickupHandle *tp)
{
for (unsigned int i = 0; i<tp->num_planchets; i++)
{
@@ -428,7 +428,7 @@ TALER_MERCHANT_tip_pickup_cancel (struct TALER_MERCHANT_TipPickupHandle *tp)
0);
if (NULL != tp->tpo2)
{
- TALER_MERCHANT_tip_pickup2_cancel (tp->tpo2);
+ TALER_MERCHANT_reward_pickup2_cancel (tp->tpo2);
tp->tpo2 = NULL;
}
GNUNET_free (tp->backend_url);
@@ -437,4 +437,4 @@ TALER_MERCHANT_tip_pickup_cancel (struct TALER_MERCHANT_TipPickupHandle *tp)
}
-/* end of merchant_api_tip_pickup.c */
+/* end of merchant_api_reward_pickup.c */
diff --git a/src/lib/merchant_api_tip_pickup2.c b/src/lib/merchant_api_reward_pickup2.c
index 74e183ab..397f1a2b 100644
--- a/src/lib/merchant_api_tip_pickup2.c
+++ b/src/lib/merchant_api_reward_pickup2.c
@@ -15,8 +15,8 @@
<http://www.gnu.org/licenses/>
*/
/**
- * @file merchant_api_tip_pickup2.c
- * @brief Implementation of the /tip-pickup request of the merchant's HTTP API
+ * @file merchant_api_reward_pickup2.c
+ * @brief Implementation of the /reward-pickup request of the merchant's HTTP API
* @author Marcello Stanisci
* @author Christian Grothoff
*/
@@ -37,7 +37,7 @@
/**
* @brief A handle for tracking transactions.
*/
-struct TALER_MERCHANT_TipPickup2Handle
+struct TALER_MERCHANT_RewardPickup2Handle
{
/**
@@ -58,7 +58,7 @@ struct TALER_MERCHANT_TipPickup2Handle
/**
* Function to call with the result.
*/
- TALER_MERCHANT_TipPickup2Callback cb;
+ TALER_MERCHANT_RewardPickup2Callback cb;
/**
* Closure for @a cb.
@@ -88,8 +88,8 @@ struct TALER_MERCHANT_TipPickup2Handle
* @return #GNUNET_OK if response is valid
*/
static enum GNUNET_GenericReturnValue
-check_ok (struct TALER_MERCHANT_TipPickup2Handle *tpo,
- struct TALER_MERCHANT_TipPickup2Response *tpr,
+check_ok (struct TALER_MERCHANT_RewardPickup2Handle *tpo,
+ struct TALER_MERCHANT_RewardPickup2Response *tpr,
const json_t *json)
{
const json_t *ja;
@@ -154,18 +154,18 @@ check_ok (struct TALER_MERCHANT_TipPickup2Handle *tpo,
* Function called when we're done processing the
* HTTP /track/transaction request.
*
- * @param cls the `struct TALER_MERCHANT_TipPickupHandle`
+ * @param cls the `struct TALER_MERCHANT_RewardPickupHandle`
* @param response_code HTTP response code, 0 on error
* @param response response body, NULL if not in JSON
*/
static void
-handle_tip_pickup_finished (void *cls,
+handle_reward_pickup_finished (void *cls,
long response_code,
const void *response)
{
- struct TALER_MERCHANT_TipPickup2Handle *tpo = cls;
+ struct TALER_MERCHANT_RewardPickup2Handle *tpo = cls;
const json_t *json = response;
- struct TALER_MERCHANT_TipPickup2Response tpr = {
+ struct TALER_MERCHANT_RewardPickup2Response tpr = {
.hr.http_status = (unsigned int) response_code,
.hr.reply = json
};
@@ -186,19 +186,19 @@ handle_tip_pickup_finished (void *cls,
}
break;
case MHD_HTTP_BAD_REQUEST:
- /* Can happen if we pickup an amount that exceeds the tip... */
+ /* Can happen if we pickup an amount that exceeds the reward... */
tpr.hr.ec = TALER_JSON_get_error_code (json);
tpr.hr.hint = TALER_JSON_get_error_hint (json);
- GNUNET_break (TALER_EC_MERCHANT_TIP_PICKUP_AMOUNT_EXCEEDS_TIP_REMAINING ==
+ GNUNET_break (TALER_EC_MERCHANT_REWARD_PICKUP_AMOUNT_EXCEEDS_REWARD_REMAINING ==
tpr.hr.ec);
break;
case MHD_HTTP_CONFLICT:
- /* legal, can happen if we pickup a tip twice... */
+ /* legal, can happen if we pickup a reward twice... */
tpr.hr.ec = TALER_JSON_get_error_code (json);
tpr.hr.hint = TALER_JSON_get_error_hint (json);
break;
case MHD_HTTP_NOT_FOUND:
- /* legal, can happen if tip ID is unknown */
+ /* legal, can happen if reward ID is unknown */
tpr.hr.ec = TALER_JSON_get_error_code (json);
tpr.hr.hint = TALER_JSON_get_error_hint (json);
break;
@@ -226,21 +226,21 @@ handle_tip_pickup_finished (void *cls,
&tpr);
tpo->cb = NULL;
}
- TALER_MERCHANT_tip_pickup2_cancel (tpo);
+ TALER_MERCHANT_reward_pickup2_cancel (tpo);
}
-struct TALER_MERCHANT_TipPickup2Handle *
-TALER_MERCHANT_tip_pickup2 (
+struct TALER_MERCHANT_RewardPickup2Handle *
+TALER_MERCHANT_reward_pickup2 (
struct GNUNET_CURL_Context *ctx,
const char *backend_url,
- const struct TALER_TipIdentifierP *tip_id,
+ const struct TALER_RewardIdentifierP *reward_id,
unsigned int num_planchets,
const struct TALER_PlanchetDetail planchets[static num_planchets],
- TALER_MERCHANT_TipPickup2Callback pickup_cb,
+ TALER_MERCHANT_RewardPickup2Callback pickup_cb,
void *pickup_cb_cls)
{
- struct TALER_MERCHANT_TipPickup2Handle *tpo;
+ struct TALER_MERCHANT_RewardPickup2Handle *tpo;
CURL *eh;
json_t *pa;
json_t *tp_obj;
@@ -274,26 +274,26 @@ TALER_MERCHANT_tip_pickup2 (
tp_obj = GNUNET_JSON_PACK (
GNUNET_JSON_pack_array_steal ("planchets",
pa));
- tpo = GNUNET_new (struct TALER_MERCHANT_TipPickup2Handle);
+ tpo = GNUNET_new (struct TALER_MERCHANT_RewardPickup2Handle);
tpo->num_planchets = num_planchets;
tpo->ctx = ctx;
tpo->cb = pickup_cb;
tpo->cb_cls = pickup_cb_cls;
{
- char tip_str[sizeof (*tip_id) * 2];
- char arg_str[sizeof (tip_str) + 32];
+ char reward_str[sizeof (*reward_id) * 2];
+ char arg_str[sizeof (reward_str) + 32];
char *end;
- end = GNUNET_STRINGS_data_to_string (tip_id,
- sizeof (*tip_id),
- tip_str,
- sizeof (tip_str));
+ end = GNUNET_STRINGS_data_to_string (reward_id,
+ sizeof (*reward_id),
+ reward_str,
+ sizeof (reward_str));
*end = '\0';
GNUNET_snprintf (arg_str,
sizeof (arg_str),
- "tips/%s/pickup",
- tip_str);
+ "rewards/%s/pickup",
+ reward_str);
tpo->url = TALER_url_join (backend_url,
arg_str,
NULL);
@@ -326,11 +326,11 @@ TALER_MERCHANT_tip_pickup2 (
tpo->job = GNUNET_CURL_job_add2 (ctx,
eh,
tpo->post_ctx.headers,
- &handle_tip_pickup_finished,
+ &handle_reward_pickup_finished,
tpo);
if (NULL == tpo->job)
{
- TALER_MERCHANT_tip_pickup2_cancel (tpo);
+ TALER_MERCHANT_reward_pickup2_cancel (tpo);
return NULL;
}
return tpo;
@@ -338,8 +338,8 @@ TALER_MERCHANT_tip_pickup2 (
void
-TALER_MERCHANT_tip_pickup2_cancel (
- struct TALER_MERCHANT_TipPickup2Handle *tpo)
+TALER_MERCHANT_reward_pickup2_cancel (
+ struct TALER_MERCHANT_RewardPickup2Handle *tpo)
{
if (NULL != tpo->job)
{
@@ -352,4 +352,4 @@ TALER_MERCHANT_tip_pickup2_cancel (
}
-/* end of merchant_api_tip_pickup2.c */
+/* end of merchant_api_reward_pickup2.c */
diff --git a/src/lib/merchant_api_wallet_get_tip.c b/src/lib/merchant_api_wallet_get_reward.c
index ee931d13..f548d692 100644
--- a/src/lib/merchant_api_wallet_get_tip.c
+++ b/src/lib/merchant_api_wallet_get_reward.c
@@ -15,8 +15,8 @@
<http://www.gnu.org/licenses/>
*/
/**
- * @file merchant_api_wallet_get_tip.c
- * @brief Implementation of the GET /tips/$TIP_ID request of the merchant's HTTP API
+ * @file merchant_api_wallet_get_reward.c
+ * @brief Implementation of the GET /rewards/$REWARD_ID request of the merchant's HTTP API
* @author Florian Dold
*/
#include "platform.h"
@@ -33,9 +33,9 @@
/**
- * @brief A handle for tracking /tip-get operations
+ * @brief A handle for tracking /reward-get operations
*/
-struct TALER_MERCHANT_TipWalletGetHandle
+struct TALER_MERCHANT_RewardWalletGetHandle
{
/**
* The url for this request.
@@ -50,7 +50,7 @@ struct TALER_MERCHANT_TipWalletGetHandle
/**
* Function to call with the result.
*/
- TALER_MERCHANT_TipWalletGetCallback cb;
+ TALER_MERCHANT_RewardWalletGetCallback cb;
/**
* Closure for @a cb.
@@ -69,24 +69,24 @@ struct TALER_MERCHANT_TipWalletGetHandle
* Function called when we're done processing the
* HTTP /track/transaction request.
*
- * @param cls the `struct TALER_MERCHANT_TipGetHandle`
+ * @param cls the `struct TALER_MERCHANT_RewardGetHandle`
* @param response_code HTTP response code, 0 on error
* @param response response body, NULL if not in JSON
*/
static void
-handle_wallet_tip_get_finished (void *cls,
+handle_wallet_reward_get_finished (void *cls,
long response_code,
const void *response)
{
- struct TALER_MERCHANT_TipWalletGetHandle *tgh = cls;
+ struct TALER_MERCHANT_RewardWalletGetHandle *tgh = cls;
const json_t *json = response;
- struct TALER_MERCHANT_TipWalletGetResponse wgr = {
+ struct TALER_MERCHANT_RewardWalletGetResponse wgr = {
.hr.http_status = (unsigned int) response_code,
.hr.reply = json
};
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Got /tip/$TIP_ID response with status code %u\n",
+ "Got /reward/$REWARD_ID response with status code %u\n",
(unsigned int) response_code);
tgh->job = NULL;
@@ -101,7 +101,7 @@ handle_wallet_tip_get_finished (void *cls,
&wgr.details.ok.exchange_url),
GNUNET_JSON_spec_string ("next_url",
&wgr.details.ok.next_url),
- TALER_JSON_spec_amount_any ("tip_amount",
+ TALER_JSON_spec_amount_any ("reward_amount",
&wgr.details.ok.amount_remaining),
GNUNET_JSON_spec_end ()
};
@@ -118,7 +118,7 @@ handle_wallet_tip_get_finished (void *cls,
}
tgh->cb (tgh->cb_cls,
&wgr);
- TALER_MERCHANT_wallet_tip_get_cancel (tgh);
+ TALER_MERCHANT_wallet_reward_get_cancel (tgh);
return;
}
case MHD_HTTP_INTERNAL_SERVER_ERROR:
@@ -128,7 +128,7 @@ handle_wallet_tip_get_finished (void *cls,
wgr.hr.hint = TALER_JSON_get_error_hint (json);
break;
case MHD_HTTP_NOT_FOUND:
- /* legal, can happen if instance or tip reserve is unknown */
+ /* legal, can happen if instance or reward reserve is unknown */
wgr.hr.ec = TALER_JSON_get_error_code (json);
wgr.hr.hint = TALER_JSON_get_error_hint (json);
break;
@@ -146,37 +146,37 @@ handle_wallet_tip_get_finished (void *cls,
}
tgh->cb (tgh->cb_cls,
&wgr);
- TALER_MERCHANT_wallet_tip_get_cancel (tgh);
+ TALER_MERCHANT_wallet_reward_get_cancel (tgh);
}
-struct TALER_MERCHANT_TipWalletGetHandle *
-TALER_MERCHANT_wallet_tip_get (struct GNUNET_CURL_Context *ctx,
+struct TALER_MERCHANT_RewardWalletGetHandle *
+TALER_MERCHANT_wallet_reward_get (struct GNUNET_CURL_Context *ctx,
const char *backend_url,
- const struct TALER_TipIdentifierP *tip_id,
- TALER_MERCHANT_TipWalletGetCallback cb,
+ const struct TALER_RewardIdentifierP *reward_id,
+ TALER_MERCHANT_RewardWalletGetCallback cb,
void *cb_cls)
{
- struct TALER_MERCHANT_TipWalletGetHandle *tgh;
+ struct TALER_MERCHANT_RewardWalletGetHandle *tgh;
CURL *eh;
- tgh = GNUNET_new (struct TALER_MERCHANT_TipWalletGetHandle);
+ tgh = GNUNET_new (struct TALER_MERCHANT_RewardWalletGetHandle);
tgh->ctx = ctx;
tgh->cb = cb;
tgh->cb_cls = cb_cls;
{
- char res_str[sizeof (*tip_id) * 2];
+ char res_str[sizeof (*reward_id) * 2];
char arg_str[sizeof (res_str) + 48];
char *end;
- end = GNUNET_STRINGS_data_to_string (tip_id,
- sizeof (*tip_id),
+ end = GNUNET_STRINGS_data_to_string (reward_id,
+ sizeof (*reward_id),
res_str,
sizeof (res_str));
*end = '\0';
GNUNET_snprintf (arg_str,
sizeof (arg_str),
- "tips/%s",
+ "rewards/%s",
res_str);
tgh->url = TALER_url_join (backend_url,
arg_str,
@@ -197,15 +197,15 @@ TALER_MERCHANT_wallet_tip_get (struct GNUNET_CURL_Context *ctx,
eh = TALER_MERCHANT_curl_easy_get_ (tgh->url);
tgh->job = GNUNET_CURL_job_add (ctx,
eh,
- &handle_wallet_tip_get_finished,
+ &handle_wallet_reward_get_finished,
tgh);
return tgh;
}
void
-TALER_MERCHANT_wallet_tip_get_cancel (
- struct TALER_MERCHANT_TipWalletGetHandle *tgh)
+TALER_MERCHANT_wallet_reward_get_cancel (
+ struct TALER_MERCHANT_RewardWalletGetHandle *tgh)
{
if (NULL != tgh->job)
{
@@ -217,4 +217,4 @@ TALER_MERCHANT_wallet_tip_get_cancel (
}
-/* end of merchant_api_wallet_get_tip.c */
+/* end of merchant_api_wallet_get_reward.c */