summaryrefslogtreecommitdiff
path: root/src/exchange
diff options
context:
space:
mode:
Diffstat (limited to 'src/exchange')
-rw-r--r--src/exchange/Makefile.am2
-rw-r--r--src/exchange/taler-exchange-httpd.c6
-rw-r--r--src/exchange/taler-exchange-httpd_deposit.c2
-rw-r--r--src/exchange/taler-exchange-httpd_keystate.c44
-rw-r--r--src/exchange/taler-exchange-httpd_keystate.h8
-rw-r--r--src/exchange/taler-exchange-httpd_recoup.c (renamed from src/exchange/taler-exchange-httpd_payback.c)252
-rw-r--r--src/exchange/taler-exchange-httpd_recoup.h (renamed from src/exchange/taler-exchange-httpd_payback.h)22
-rw-r--r--src/exchange/taler-exchange-httpd_refresh_melt.c10
-rw-r--r--src/exchange/taler-exchange-httpd_refund.c12
-rw-r--r--src/exchange/taler-exchange-httpd_responses.c88
10 files changed, 223 insertions, 223 deletions
diff --git a/src/exchange/Makefile.am b/src/exchange/Makefile.am
index e26fc7688..d33b9e486 100644
--- a/src/exchange/Makefile.am
+++ b/src/exchange/Makefile.am
@@ -54,7 +54,7 @@ taler_exchange_httpd_SOURCES = \
taler-exchange-httpd_deposit.c taler-exchange-httpd_deposit.h \
taler-exchange-httpd_keystate.c taler-exchange-httpd_keystate.h \
taler-exchange-httpd_mhd.c taler-exchange-httpd_mhd.h \
- taler-exchange-httpd_payback.c taler-exchange-httpd_payback.h \
+ taler-exchange-httpd_recoup.c taler-exchange-httpd_recoup.h \
taler-exchange-httpd_refresh_link.c taler-exchange-httpd_refresh_link.h \
taler-exchange-httpd_refresh_melt.c taler-exchange-httpd_refresh_melt.h \
taler-exchange-httpd_refresh_reveal.c taler-exchange-httpd_refresh_reveal.h \
diff --git a/src/exchange/taler-exchange-httpd.c b/src/exchange/taler-exchange-httpd.c
index eb1bb79ea..a00a792c5 100644
--- a/src/exchange/taler-exchange-httpd.c
+++ b/src/exchange/taler-exchange-httpd.c
@@ -32,7 +32,7 @@
#include "taler-exchange-httpd_refund.h"
#include "taler-exchange-httpd_reserve_status.h"
#include "taler-exchange-httpd_reserve_withdraw.h"
-#include "taler-exchange-httpd_payback.h"
+#include "taler-exchange-httpd_recoup.h"
#include "taler-exchange-httpd_refresh_link.h"
#include "taler-exchange-httpd_refresh_melt.h"
#include "taler-exchange-httpd_refresh_reveal.h"
@@ -341,9 +341,9 @@ handle_mhd_request (void *cls,
"Only POST is allowed", 0,
&TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED },
- { "/payback", MHD_HTTP_METHOD_POST, "application/json",
+ { "/recoup", MHD_HTTP_METHOD_POST, "application/json",
NULL, 0,
- &TEH_PAYBACK_handler_payback, MHD_HTTP_OK },
+ &TEH_RECOUP_handler_recoup, MHD_HTTP_OK },
{ "/refresh/link", NULL, "text/plain",
"Only GET is allowed", 0,
&TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED },
diff --git a/src/exchange/taler-exchange-httpd_deposit.c b/src/exchange/taler-exchange-httpd_deposit.c
index 7dc22fd53..49b9cc2fc 100644
--- a/src/exchange/taler-exchange-httpd_deposit.c
+++ b/src/exchange/taler-exchange-httpd_deposit.c
@@ -182,7 +182,7 @@ deposit_transaction (void *cls,
/* Start with fee for THIS transaction */
spent = deposit->amount_with_fee;
- /* add cost of all previous transactions; skip PAYBACK as revoked
+ /* add cost of all previous transactions; skip RECOUP as revoked
denominations are not eligible for deposit, and if we are the old coin
pub of a revoked coin (aka a zombie), then ONLY refresh is allowed. */
qs = TEH_plugin->get_coin_transactions (TEH_plugin->cls,
diff --git a/src/exchange/taler-exchange-httpd_keystate.c b/src/exchange/taler-exchange-httpd_keystate.c
index edb832dc3..312cfa585 100644
--- a/src/exchange/taler-exchange-httpd_keystate.c
+++ b/src/exchange/taler-exchange-httpd_keystate.c
@@ -230,7 +230,7 @@ struct ResponseFactoryContext
* always returns the full list (cherry picking does not apply
* for key revocations, as we cannot sort those by issue date).
*/
- json_t *payback_array;
+ json_t *recoup_array;
/**
* JSON array with signing keys. Every response includes the full
@@ -356,10 +356,10 @@ static pthread_mutex_t internal_key_state_mutex = PTHREAD_MUTEX_INITIALIZER;
static void
destroy_response_factory (struct ResponseFactoryContext *rfc)
{
- if (NULL != rfc->payback_array)
+ if (NULL != rfc->recoup_array)
{
- json_decref (rfc->payback_array);
- rfc->payback_array = NULL;
+ json_decref (rfc->recoup_array);
+ rfc->recoup_array = NULL;
}
if (NULL != rfc->sign_keys_array)
{
@@ -912,7 +912,7 @@ revocations_iter (void *cls,
return GNUNET_SYSERR;
}
GNUNET_assert (0 ==
- json_array_append_new (rfc->payback_array,
+ json_array_append_new (rfc->recoup_array,
GNUNET_JSON_from_data_auto (
denom_hash)));
return GNUNET_OK;
@@ -1491,7 +1491,7 @@ build_keys_response (const struct ResponseFactoryContext *rfc,
"reserve_closing_delay", GNUNET_JSON_from_time_rel (
reserve_closing_delay),
"signkeys", rfc->sign_keys_array,
- "payback", rfc->payback_array,
+ "recoup", rfc->recoup_array,
/* 6-10 */
"denoms", rbc.denom_keys_array,
"auditors", rbc.auditors_array,
@@ -1660,8 +1660,8 @@ make_fresh_key_state (struct GNUNET_TIME_Absolute now)
memset (&rfc,
0,
sizeof (rfc));
- rfc.payback_array = json_array ();
- if (NULL == rfc.payback_array)
+ rfc.recoup_array = json_array ();
+ if (NULL == rfc.recoup_array)
{
GNUNET_break (0);
return NULL;
@@ -1670,7 +1670,7 @@ make_fresh_key_state (struct GNUNET_TIME_Absolute now)
if (NULL == rfc.sign_keys_array)
{
GNUNET_break (0);
- json_decref (rfc.payback_array);
+ json_decref (rfc.recoup_array);
return NULL;
}
@@ -1689,7 +1689,7 @@ make_fresh_key_state (struct GNUNET_TIME_Absolute now)
"Loading keys from `%s'\n",
TEH_exchange_directory);
/* Initialize the 'denomkey_map' and the 'revoked_map' and
- 'rfc.payback_array' */
+ 'rfc.recoup_array' */
if (-1 ==
TALER_EXCHANGEDB_denomination_keys_iterate (TEH_exchange_directory,
&reload_keys_denom_iter,
@@ -1700,7 +1700,7 @@ make_fresh_key_state (struct GNUNET_TIME_Absolute now)
TEH_exchange_directory);
key_state->refcnt = 1;
ks_release (key_state);
- json_decref (rfc.payback_array);
+ json_decref (rfc.recoup_array);
json_decref (rfc.sign_keys_array);
return NULL;
}
@@ -1726,7 +1726,7 @@ make_fresh_key_state (struct GNUNET_TIME_Absolute now)
TEH_exchange_directory);
key_state->refcnt = 1;
ks_release (key_state);
- json_decref (rfc.payback_array);
+ json_decref (rfc.recoup_array);
json_decref (rfc.sign_keys_array);
return NULL;
}
@@ -1982,7 +1982,7 @@ TEH_KS_denomination_key_lookup_by_hash (const struct
struct GNUNET_TIME_Absolute now;
const struct GNUNET_CONTAINER_MultiHashMap *map;
- map = (TEH_KS_DKU_PAYBACK == use) ? key_state->revoked_map :
+ map = (TEH_KS_DKU_RECOUP == use) ? key_state->revoked_map :
key_state->denomkey_map;
dki = GNUNET_CONTAINER_multihashmap_get (map,
denom_pub_hash);
@@ -1994,11 +1994,11 @@ TEH_KS_denomination_key_lookup_by_hash (const struct
*hc = MHD_HTTP_NOT_FOUND;
switch (use)
{
- case TEH_KS_DKU_PAYBACK:
- *ec = TALER_EC_PAYBACK_DENOMINATION_KEY_UNKNOWN;
+ case TEH_KS_DKU_RECOUP:
+ *ec = TALER_EC_RECOUP_DENOMINATION_KEY_UNKNOWN;
break;
case TEH_KS_DKU_ZOMBIE:
- *ec = TALER_EC_REFRESH_PAYBACK_DENOMINATION_KEY_NOT_FOUND;
+ *ec = TALER_EC_REFRESH_RECOUP_DENOMINATION_KEY_NOT_FOUND;
break;
case TEH_KS_DKU_WITHDRAW:
*ec = TALER_EC_WITHDRAW_DENOMINATION_KEY_NOT_FOUND;
@@ -2019,11 +2019,11 @@ TEH_KS_denomination_key_lookup_by_hash (const struct
*hc = MHD_HTTP_PRECONDITION_FAILED;
switch (use)
{
- case TEH_KS_DKU_PAYBACK:
- *ec = TALER_EC_PAYBACK_DENOMINATION_VALIDITY_IN_FUTURE;
+ case TEH_KS_DKU_RECOUP:
+ *ec = TALER_EC_RECOUP_DENOMINATION_VALIDITY_IN_FUTURE;
break;
case TEH_KS_DKU_ZOMBIE:
- *ec = TALER_EC_REFRESH_PAYBACK_DENOMINATION_VALIDITY_IN_FUTURE;
+ *ec = TALER_EC_REFRESH_RECOUP_DENOMINATION_VALIDITY_IN_FUTURE;
break;
case TEH_KS_DKU_WITHDRAW:
*ec = TALER_EC_WITHDRAW_VALIDITY_IN_FUTURE;
@@ -2072,15 +2072,15 @@ TEH_KS_denomination_key_lookup_by_hash (const struct
return NULL;
}
break;
- case TEH_KS_DKU_PAYBACK:
+ case TEH_KS_DKU_RECOUP:
if (now.abs_value_us >
GNUNET_TIME_absolute_ntoh (
dki->issue.properties.expire_deposit).abs_value_us)
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Not returning DKI for %s, as time to payback coin has passed\n",
+ "Not returning DKI for %s, as time to recoup coin has passed\n",
GNUNET_h2s (denom_pub_hash));
- *ec = TALER_EC_REFRESH_PAYBACK_DENOMINATION_EXPIRED;
+ *ec = TALER_EC_REFRESH_RECOUP_DENOMINATION_EXPIRED;
*hc = MHD_HTTP_GONE;
return NULL;
}
diff --git a/src/exchange/taler-exchange-httpd_keystate.h b/src/exchange/taler-exchange-httpd_keystate.h
index 004ce5014..b7e5b10fb 100644
--- a/src/exchange/taler-exchange-httpd_keystate.h
+++ b/src/exchange/taler-exchange-httpd_keystate.h
@@ -110,14 +110,14 @@ enum TEH_KS_DenominationKeyUse
TEH_KS_DKU_DEPOSIT,
/**
- * The key is to be used for a /payback operation.
+ * The key is to be used for a /recoup operation.
*/
- TEH_KS_DKU_PAYBACK,
+ TEH_KS_DKU_RECOUP,
/**
- * The key is to be used for a /refresh/payback operation,
+ * The key is to be used for a /refresh/recoup operation,
* i.e. it is an old coin that regained value from a
- * payback on a new coin derived from the old coin.
+ * recoup on a new coin derived from the old coin.
*/
TEH_KS_DKU_ZOMBIE
diff --git a/src/exchange/taler-exchange-httpd_payback.c b/src/exchange/taler-exchange-httpd_recoup.c
index 1a6a67d5d..8010d1ad4 100644
--- a/src/exchange/taler-exchange-httpd_payback.c
+++ b/src/exchange/taler-exchange-httpd_recoup.c
@@ -14,8 +14,8 @@
TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
/**
- * @file taler-exchange-httpd_payback.c
- * @brief Handle /payback requests; parses the POST and JSON and
+ * @file taler-exchange-httpd_recoup.c
+ * @brief Handle /recoup requests; parses the POST and JSON and
* verifies the coin signature before handing things off
* to the database.
* @author Christian Grothoff
@@ -28,38 +28,38 @@
#include <pthread.h>
#include "taler_json_lib.h"
#include "taler_mhd_lib.h"
-#include "taler-exchange-httpd_payback.h"
+#include "taler-exchange-httpd_recoup.h"
#include "taler-exchange-httpd_responses.h"
#include "taler-exchange-httpd_keystate.h"
#include "taler-exchange-httpd_validation.h"
/**
- * A wallet asked for /payback, return the successful response.
+ * A wallet asked for /recoup, return the successful response.
*
* @param connection connection to the client
- * @param coin_pub coin for which we are processing the payback request
- * @param old_coin_pub public key of the old coin that will receive the payback
+ * @param coin_pub coin for which we are processing the recoup request
+ * @param old_coin_pub public key of the old coin that will receive the recoup
* @param amount the amount we will wire back
- * @param timestamp when did the exchange receive the /payback request
+ * @param timestamp when did the exchange receive the /recoup request
* @return MHD result code
*/
static int
-reply_payback_refresh_success (struct MHD_Connection *connection,
- const struct TALER_CoinSpendPublicKeyP *coin_pub,
- const struct
- TALER_CoinSpendPublicKeyP *old_coin_pub,
- const struct TALER_Amount *amount,
- struct GNUNET_TIME_Absolute timestamp)
+reply_recoup_refresh_success (struct MHD_Connection *connection,
+ const struct TALER_CoinSpendPublicKeyP *coin_pub,
+ const struct
+ TALER_CoinSpendPublicKeyP *old_coin_pub,
+ const struct TALER_Amount *amount,
+ struct GNUNET_TIME_Absolute timestamp)
{
- struct TALER_PaybackRefreshConfirmationPS pc;
+ struct TALER_RecoupRefreshConfirmationPS pc;
struct TALER_ExchangePublicKeyP pub;
struct TALER_ExchangeSignatureP sig;
- pc.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_PAYBACK_REFRESH);
- pc.purpose.size = htonl (sizeof (struct TALER_PaybackRefreshConfirmationPS));
+ pc.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_RECOUP_REFRESH);
+ pc.purpose.size = htonl (sizeof (struct TALER_RecoupRefreshConfirmationPS));
pc.timestamp = GNUNET_TIME_absolute_hton (timestamp);
- TALER_amount_hton (&pc.payback_amount,
+ TALER_amount_hton (&pc.recoup_amount,
amount);
pc.coin_pub = *coin_pub;
pc.old_coin_pub = *old_coin_pub;
@@ -91,30 +91,30 @@ reply_payback_refresh_success (struct MHD_Connection *connection,
/**
- * A wallet asked for /payback, return the successful response.
+ * A wallet asked for /recoup, return the successful response.
*
* @param connection connection to the client
- * @param coin_pub coin for which we are processing the payback request
- * @param reserve_pub public key of the reserve that will receive the payback
+ * @param coin_pub coin for which we are processing the recoup request
+ * @param reserve_pub public key of the reserve that will receive the recoup
* @param amount the amount we will wire back
- * @param timestamp when did the exchange receive the /payback request
+ * @param timestamp when did the exchange receive the /recoup request
* @return MHD result code
*/
static int
-reply_payback_success (struct MHD_Connection *connection,
- const struct TALER_CoinSpendPublicKeyP *coin_pub,
- const struct TALER_ReservePublicKeyP *reserve_pub,
- const struct TALER_Amount *amount,
- struct GNUNET_TIME_Absolute timestamp)
+reply_recoup_success (struct MHD_Connection *connection,
+ const struct TALER_CoinSpendPublicKeyP *coin_pub,
+ const struct TALER_ReservePublicKeyP *reserve_pub,
+ const struct TALER_Amount *amount,
+ struct GNUNET_TIME_Absolute timestamp)
{
- struct TALER_PaybackConfirmationPS pc;
+ struct TALER_RecoupConfirmationPS pc;
struct TALER_ExchangePublicKeyP pub;
struct TALER_ExchangeSignatureP sig;
- pc.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_PAYBACK);
- pc.purpose.size = htonl (sizeof (struct TALER_PaybackConfirmationPS));
+ pc.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_RECOUP);
+ pc.purpose.size = htonl (sizeof (struct TALER_RecoupConfirmationPS));
pc.timestamp = GNUNET_TIME_absolute_hton (timestamp);
- TALER_amount_hton (&pc.payback_amount,
+ TALER_amount_hton (&pc.recoup_amount,
amount);
pc.coin_pub = *coin_pub;
pc.reserve_pub = *reserve_pub;
@@ -145,9 +145,9 @@ reply_payback_success (struct MHD_Connection *connection,
/**
- * Closure for #payback_transaction.
+ * Closure for #recoup_transaction.
*/
-struct PaybackContext
+struct RecoupContext
{
/**
* Hash of the blinded coin.
@@ -170,32 +170,32 @@ struct PaybackContext
const struct TALER_DenominationBlindingKeyP *coin_bks;
/**
- * Signature of the coin requesting payback.
+ * Signature of the coin requesting recoup.
*/
const struct TALER_CoinSpendSignatureP *coin_sig;
union
{
/**
- * Set by #payback_transaction() to the reserve that will
- * receive the payback, if #refreshed is #GNUNET_NO.
+ * Set by #recoup_transaction() to the reserve that will
+ * receive the recoup, if #refreshed is #GNUNET_NO.
*/
struct TALER_ReservePublicKeyP reserve_pub;
/**
- * Set by #payback_transaction() to the old coin that will
- * receive the payback, if #refreshed is #GNUNET_YES.
+ * Set by #recoup_transaction() to the old coin that will
+ * receive the recoup, if #refreshed is #GNUNET_YES.
*/
struct TALER_CoinSpendPublicKeyP old_coin_pub;
} target;
/**
- * Set by #payback_transaction() to the amount that will be paid back
+ * Set by #recoup_transaction() to the amount that will be paid back
*/
struct TALER_Amount amount;
/**
- * Set by #payback_transaction to the timestamp when the payback
+ * Set by #recoup_transaction to the timestamp when the recoup
* was accepted.
*/
struct GNUNET_TIME_Absolute now;
@@ -209,7 +209,7 @@ struct PaybackContext
/**
- * Execute a "/payback". The validity of the coin and signature have
+ * Execute a "/recoup". The validity of the coin and signature have
* already been checked. The database must now check that the coin is
* not (double) spent, and execute the transaction.
*
@@ -219,7 +219,7 @@ struct PaybackContext
* it returns the soft error code, the function MAY be called again to
* retry and MUST not queue a MHD response.
*
- * @param cls the `struct PaybackContext *`
+ * @param cls the `struct RecoupContext *`
* @param connection MHD request which triggered the transaction
* @param session database session to use
* @param[out] mhd_ret set to MHD response status for @a connection,
@@ -227,17 +227,17 @@ struct PaybackContext
* @return transaction status code
*/
static enum GNUNET_DB_QueryStatus
-payback_transaction (void *cls,
- struct MHD_Connection *connection,
- struct TALER_EXCHANGEDB_Session *session,
- int *mhd_ret)
+recoup_transaction (void *cls,
+ struct MHD_Connection *connection,
+ struct TALER_EXCHANGEDB_Session *session,
+ int *mhd_ret)
{
- struct PaybackContext *pc = cls;
+ struct RecoupContext *pc = cls;
struct TALER_EXCHANGEDB_TransactionList *tl;
struct TALER_Amount spent;
enum GNUNET_DB_QueryStatus qs;
- /* Check whether a payback is allowed, and if so, to which
+ /* Check whether a recoup is allowed, and if so, to which
reserve / account the money should go */
if (pc->refreshed)
{
@@ -252,7 +252,7 @@ payback_transaction (void *cls,
GNUNET_break (0);
*mhd_ret = TALER_MHD_reply_with_error (connection,
MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_PAYBACK_DB_FETCH_FAILED,
+ TALER_EC_RECOUP_DB_FETCH_FAILED,
"failed to fetch old coin of blind coin");
}
return qs;
@@ -271,7 +271,7 @@ payback_transaction (void *cls,
GNUNET_break (0);
*mhd_ret = TALER_MHD_reply_with_error (connection,
MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_PAYBACK_DB_FETCH_FAILED,
+ TALER_EC_RECOUP_DB_FETCH_FAILED,
"failed to fetch reserve of blinded coin");
}
return qs;
@@ -280,16 +280,16 @@ payback_transaction (void *cls,
if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Payback requested for unknown envelope %s\n",
+ "Recoup requested for unknown envelope %s\n",
GNUNET_h2s (&pc->h_blind));
*mhd_ret = TALER_MHD_reply_with_error (connection,
MHD_HTTP_NOT_FOUND,
- TALER_EC_PAYBACK_WITHDRAW_NOT_FOUND,
+ TALER_EC_RECOUP_WITHDRAW_NOT_FOUND,
"blind coin unknown");
return GNUNET_DB_STATUS_HARD_ERROR;
}
- /* Calculate remaining balance, including paybacks already applied. */
+ /* Calculate remaining balance, including recoups already applied. */
qs = TEH_plugin->get_coin_transactions (TEH_plugin->cls,
session,
&pc->coin->coin_pub,
@@ -302,7 +302,7 @@ payback_transaction (void *cls,
GNUNET_break (0);
*mhd_ret = TALER_MHD_reply_with_error (connection,
MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_PAYBACK_DB_FETCH_FAILED,
+ TALER_EC_RECOUP_DB_FETCH_FAILED,
"failed to fetch old coin transaction history");
}
return qs;
@@ -321,7 +321,7 @@ payback_transaction (void *cls,
tl);
*mhd_ret = TALER_MHD_reply_with_error (connection,
MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_PAYBACK_HISTORY_DB_ERROR,
+ TALER_EC_RECOUP_HISTORY_DB_ERROR,
"failed to calculate old coin transaction history");
return GNUNET_DB_STATUS_HARD_ERROR;
}
@@ -335,7 +335,7 @@ payback_transaction (void *cls,
tl);
*mhd_ret = TALER_MHD_reply_with_error (connection,
MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_PAYBACK_COIN_BALANCE_NEGATIVE,
+ TALER_EC_RECOUP_COIN_BALANCE_NEGATIVE,
"calculated negative old coin balance");
return GNUNET_DB_STATUS_HARD_ERROR;
}
@@ -345,7 +345,7 @@ payback_transaction (void *cls,
TEH_plugin->rollback (TEH_plugin->cls,
session);
*mhd_ret = TEH_RESPONSE_reply_coin_insufficient_funds (connection,
- TALER_EC_PAYBACK_COIN_BALANCE_ZERO,
+ TALER_EC_RECOUP_COIN_BALANCE_ZERO,
&pc->coin->coin_pub,
tl);
TEH_plugin->free_coin_transaction_list (TEH_plugin->cls,
@@ -357,39 +357,39 @@ payback_transaction (void *cls,
pc->now = GNUNET_TIME_absolute_get ();
(void) GNUNET_TIME_round_abs (&pc->now);
- /* add coin to list of wire transfers for payback */
+ /* add coin to list of wire transfers for recoup */
if (pc->refreshed)
{
- qs = TEH_plugin->insert_payback_refresh_request (TEH_plugin->cls,
- session,
- pc->coin,
- pc->coin_sig,
- pc->coin_bks,
- &pc->amount,
- &pc->h_blind,
- pc->now);
+ qs = TEH_plugin->insert_recoup_refresh_request (TEH_plugin->cls,
+ session,
+ pc->coin,
+ pc->coin_sig,
+ pc->coin_bks,
+ &pc->amount,
+ &pc->h_blind,
+ pc->now);
}
else
{
- qs = TEH_plugin->insert_payback_request (TEH_plugin->cls,
- session,
- &pc->target.reserve_pub,
- pc->coin,
- pc->coin_sig,
- pc->coin_bks,
- &pc->amount,
- &pc->h_blind,
- pc->now);
+ qs = TEH_plugin->insert_recoup_request (TEH_plugin->cls,
+ session,
+ &pc->target.reserve_pub,
+ pc->coin,
+ pc->coin_sig,
+ pc->coin_bks,
+ &pc->amount,
+ &pc->h_blind,
+ pc->now);
}
if (0 > qs)
{
if (GNUNET_DB_STATUS_HARD_ERROR == qs)
{
- TALER_LOG_WARNING ("Failed to store /payback information in database\n");
+ TALER_LOG_WARNING ("Failed to store /recoup information in database\n");
*mhd_ret = TALER_MHD_reply_with_error (connection,
MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_PAYBACK_DB_PUT_FAILED,
- "failed to persist payback data");
+ TALER_EC_RECOUP_DB_PUT_FAILED,
+ "failed to persist recoup data");
}
return qs;
}
@@ -398,9 +398,9 @@ payback_transaction (void *cls,
/**
- * We have parsed the JSON information about the payback request. Do
+ * We have parsed the JSON information about the recoup request. Do
* some basic sanity checks (especially that the signature on the
- * request and coin is valid) and then execute the payback operation.
+ * request and coin is valid) and then execute the recoup operation.
* Note that we need the DB to check the fee structure, so this is not
* done here.
*
@@ -412,23 +412,23 @@ payback_transaction (void *cls,
* @return MHD result code
*/
static int
-verify_and_execute_payback (struct MHD_Connection *connection,
- const struct TALER_CoinPublicInfo *coin,
- const struct
- TALER_DenominationBlindingKeyP *coin_bks,
- const struct TALER_CoinSpendSignatureP *coin_sig,
- int refreshed)
+verify_and_execute_recoup (struct MHD_Connection *connection,
+ const struct TALER_CoinPublicInfo *coin,
+ const struct
+ TALER_DenominationBlindingKeyP *coin_bks,
+ const struct TALER_CoinSpendSignatureP *coin_sig,
+ int refreshed)
{
- struct PaybackContext pc;
+ struct RecoupContext pc;
const struct TALER_EXCHANGEDB_DenominationKeyIssueInformation *dki;
- struct TALER_PaybackRequestPS pr;
+ struct TALER_RecoupRequestPS pr;
struct GNUNET_HashCode c_hash;
char *coin_ev;
size_t coin_ev_size;
enum TALER_ErrorCode ec;
unsigned int hc;
- /* check denomination exists and is in payback mode */
+ /* check denomination exists and is in recoup mode */
{
struct TEH_KS_StateHandle *key_state;
@@ -443,18 +443,18 @@ verify_and_execute_payback (struct MHD_Connection *connection,
}
dki = TEH_KS_denomination_key_lookup_by_hash (key_state,
&coin->denom_pub_hash,
- TEH_KS_DKU_PAYBACK,
+ TEH_KS_DKU_RECOUP,
&ec,
&hc);
if (NULL == dki)
{
TEH_KS_release (key_state);
TALER_LOG_WARNING (
- "Denomination key in /payback request not in payback mode\n");
+ "Denomination key in /recoup request not in recoup mode\n");
return TALER_MHD_reply_with_error (connection,
hc,
ec,
- "denomination not allowing payback");
+ "denomination not allowing recoup");
}
TALER_amount_ntoh (&pc.value,
&dki->issue.properties.value);
@@ -464,32 +464,32 @@ verify_and_execute_payback (struct MHD_Connection *connection,
TALER_test_coin_valid (coin,
&dki->denom_pub))
{
- TALER_LOG_WARNING ("Invalid coin passed for /payback\n");
+ TALER_LOG_WARNING ("Invalid coin passed for /recoup\n");
TEH_KS_release (key_state);
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_FORBIDDEN,
- TALER_EC_PAYBACK_DENOMINATION_SIGNATURE_INVALID,
+ TALER_EC_RECOUP_DENOMINATION_SIGNATURE_INVALID,
"denom_sig");
}
- /* check payback request signature */
- pr.purpose.purpose = htonl (TALER_SIGNATURE_WALLET_COIN_PAYBACK);
- pr.purpose.size = htonl (sizeof (struct TALER_PaybackRequestPS));
+ /* check recoup request signature */
+ pr.purpose.purpose = htonl (TALER_SIGNATURE_WALLET_COIN_RECOUP);
+ pr.purpose.size = htonl (sizeof (struct TALER_RecoupRequestPS));
pr.coin_pub = coin->coin_pub;
pr.h_denom_pub = dki->issue.properties.denom_hash;
pr.coin_blind = *coin_bks;
if (GNUNET_OK !=
- GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_WALLET_COIN_PAYBACK,
+ GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_WALLET_COIN_RECOUP,
&pr.purpose,
&coin_sig->eddsa_signature,
&coin->coin_pub.eddsa_pub))
{
- TALER_LOG_WARNING ("Invalid signature on /payback request\n");
+ TALER_LOG_WARNING ("Invalid signature on /recoup request\n");
TEH_KS_release (key_state);
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_FORBIDDEN,
- TALER_EC_PAYBACK_SIGNATURE_INVALID,
+ TALER_EC_RECOUP_SIGNATURE_INVALID,
"coin_sig");
}
GNUNET_CRYPTO_hash (&coin->coin_pub.eddsa_pub,
@@ -506,7 +506,7 @@ verify_and_execute_payback (struct MHD_Connection *connection,
TEH_KS_release (key_state);
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_PAYBACK_BLINDING_FAILED,
+ TALER_EC_RECOUP_BLINDING_FAILED,
"coin_bks");
}
TEH_KS_release (key_state);
@@ -525,7 +525,7 @@ verify_and_execute_payback (struct MHD_Connection *connection,
kcc.connection = connection;
if (GNUNET_OK !=
TEH_DB_run_transaction (connection,
- "know coin for payback",
+ "know coin for recoup",
&mhd_ret,
&TEH_DB_know_coin_transaction,
&kcc))
@@ -541,29 +541,29 @@ verify_and_execute_payback (struct MHD_Connection *connection,
if (GNUNET_OK !=
TEH_DB_run_transaction (connection,
- "run payback",
+ "run recoup",
&mhd_ret,
- &payback_transaction,
+ &recoup_transaction,
&pc))
return mhd_ret;
}
return (refreshed)
- ? reply_payback_refresh_success (connection,
- &coin->coin_pub,
- &pc.target.old_coin_pub,
- &pc.amount,
- pc.now)
- : reply_payback_success (connection,
- &coin->coin_pub,
- &pc.target.reserve_pub,
- &pc.amount,
- pc.now);
+ ? reply_recoup_refresh_success (connection,
+ &coin->coin_pub,
+ &pc.target.old_coin_pub,
+ &pc.amount,
+ pc.now)
+ : reply_recoup_success (connection,
+ &coin->coin_pub,
+ &pc.target.reserve_pub,
+ &pc.amount,
+ pc.now);
}
/**
- * Handle a "/payback" request. Parses the JSON, and, if successful,
- * passes the JSON data to #verify_and_execute_payback() to
+ * Handle a "/recoup" request. Parses the JSON, and, if successful,
+ * passes the JSON data to #verify_and_execute_recoup() to
* further check the details of the operation specified. If
* everything checks out, this will ultimately lead to the "/refund"
* being executed, or rejected.
@@ -576,11 +576,11 @@ verify_and_execute_payback (struct MHD_Connection *connection,
* @return MHD result code
*/
int
-TEH_PAYBACK_handler_payback (struct TEH_RequestHandler *rh,
- struct MHD_Connection *connection,
- void **connection_cls,
- const char *upload_data,
- size_t *upload_data_size)
+TEH_RECOUP_handler_recoup (struct TEH_RequestHandler *rh,
+ struct MHD_Connection *connection,
+ void **connection_cls,
+ const char *upload_data,
+ size_t *upload_data_size)
{
json_t *json;
int res;
@@ -623,14 +623,14 @@ TEH_PAYBACK_handler_payback (struct TEH_RequestHandler *rh,
return MHD_NO; /* hard failure */
if (GNUNET_NO == res)
return MHD_YES; /* failure */
- res = verify_and_execute_payback (connection,
- &coin,
- &coin_bks,
- &coin_sig,
- refreshed);
+ res = verify_and_execute_recoup (connection,
+ &coin,
+ &coin_bks,
+ &coin_sig,
+ refreshed);
GNUNET_JSON_parse_free (spec);
return res;
}
-/* end of taler-exchange-httpd_payback.c */
+/* end of taler-exchange-httpd_recoup.c */
diff --git a/src/exchange/taler-exchange-httpd_payback.h b/src/exchange/taler-exchange-httpd_recoup.h
index 9e1fde310..03b697171 100644
--- a/src/exchange/taler-exchange-httpd_payback.h
+++ b/src/exchange/taler-exchange-httpd_recoup.h
@@ -14,12 +14,12 @@
TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
/**
- * @file taler-exchange-httpd_payback.h
- * @brief Handle /payback requests
+ * @file taler-exchange-httpd_recoup.h
+ * @brief Handle /recoup requests
* @author Christian Grothoff
*/
-#ifndef TALER_EXCHANGE_HTTPD_PAYBACK_H
-#define TALER_EXCHANGE_HTTPD_PAYBACK_H
+#ifndef TALER_EXCHANGE_HTTPD_RECOUP_H
+#define TALER_EXCHANGE_HTTPD_RECOUP_H
#include <gnunet/gnunet_util_lib.h>
#include <microhttpd.h>
@@ -27,8 +27,8 @@
/**
- * Handle a "/payback" request. Parses the JSON, and, if successful,
- * passes the JSON data to #verify_and_execute_payback() to
+ * Handle a "/recoup" request. Parses the JSON, and, if successful,
+ * passes the JSON data to #verify_and_execute_recoup() to
* further check the details of the operation specified. If
* everything checks out, this will ultimately lead to the "/refund"
* being executed, or rejected.
@@ -41,11 +41,11 @@
* @return MHD result code
*/
int
-TEH_PAYBACK_handler_payback (struct TEH_RequestHandler *rh,
- struct MHD_Connection *connection,
- void **connection_cls,
- const char *upload_data,
- size_t *upload_data_size);
+TEH_RECOUP_handler_recoup (struct TEH_RequestHandler *rh,
+ struct MHD_Connection *connection,
+ void **connection_cls,
+ const char *upload_data,
+ size_t *upload_data_size);
#endif
diff --git a/src/exchange/taler-exchange-httpd_refresh_melt.c b/src/exchange/taler-exchange-httpd_refresh_melt.c
index 91ca58e5f..71200037d 100644
--- a/src/exchange/taler-exchange-httpd_refresh_melt.c
+++ b/src/exchange/taler-exchange-httpd_refresh_melt.c
@@ -156,7 +156,7 @@ struct RefreshMeltContext
/**
* Set to #GNUNET_YES if this coin's denomination was revoked and the operation
* is thus only allowed for zombie coins where the transaction
- * history includes a #TALER_EXCHANGEDB_TT_OLD_COIN_PAYBACK.
+ * history includes a #TALER_EXCHANGEDB_TT_OLD_COIN_RECOUP.
*/
int zombie_required;
@@ -186,7 +186,7 @@ refresh_check_melt (struct MHD_Connection *connection,
/* Start with cost of this melt transaction */
spent = rmc->refresh_session.amount_with_fee;
- /* add historic transaction costs of this coin, including paybacks as
+ /* add historic transaction costs of this coin, including recoups as
we might be a zombie coin */
qs = TEH_plugin->get_coin_transactions (TEH_plugin->cls,
session,
@@ -208,7 +208,7 @@ refresh_check_melt (struct MHD_Connection *connection,
NULL != tp;
tp = tp->next)
{
- if (TALER_EXCHANGEDB_TT_OLD_COIN_PAYBACK == tp->type)
+ if (TALER_EXCHANGEDB_TT_OLD_COIN_RECOUP == tp->type)
{
rmc->zombie_required = GNUNET_NO; /* was satisfied! */
break;
@@ -471,7 +471,7 @@ check_for_denomination_key (struct MHD_Connection *connection,
dki = TEH_KS_denomination_key_lookup_by_hash (key_state,
&rmc->refresh_session.coin.
denom_pub_hash,
- TEH_KS_DKU_PAYBACK,
+ TEH_KS_DKU_RECOUP,
&ec,
&hc);
if (NULL != dki)
@@ -504,7 +504,7 @@ check_for_denomination_key (struct MHD_Connection *connection,
}
/* Consider the case that the denomination expired for deposits,
- but /refresh/payback refilled the balance of the 'zombie' coin
+ but /refresh/recoup refilled the balance of the 'zombie' coin
and we should thus allow the refresh during the legal period. */
if (NULL == dki)
{
diff --git a/src/exchange/taler-exchange-httpd_refund.c b/src/exchange/taler-exchange-httpd_refund.c
index 74bfedda0..ebcd937c5 100644
--- a/src/exchange/taler-exchange-httpd_refund.c
+++ b/src/exchange/taler-exchange-httpd_refund.c
@@ -263,14 +263,14 @@ refund_transaction (void *cls,
}
}
break;
- case TALER_EXCHANGEDB_TT_OLD_COIN_PAYBACK:
- /* Paybacks cannot be refunded, ignore here */
+ case TALER_EXCHANGEDB_TT_OLD_COIN_RECOUP:
+ /* Recoups cannot be refunded, ignore here */
break;
- case TALER_EXCHANGEDB_TT_PAYBACK:
- /* Paybacks cannot be refunded, ignore here */
+ case TALER_EXCHANGEDB_TT_RECOUP:
+ /* Recoups cannot be refunded, ignore here */
break;
- case TALER_EXCHANGEDB_TT_PAYBACK_REFRESH:
- /* Paybacks cannot be refunded, ignore here */
+ case TALER_EXCHANGEDB_TT_RECOUP_REFRESH:
+ /* Recoups cannot be refunded, ignore here */
break;
}
}
diff --git a/src/exchange/taler-exchange-httpd_responses.c b/src/exchange/taler-exchange-httpd_responses.c
index d6e5c32aa..810f4d613 100644
--- a/src/exchange/taler-exchange-httpd_responses.c
+++ b/src/exchange/taler-exchange-httpd_responses.c
@@ -249,19 +249,19 @@ TEH_RESPONSE_compile_transaction_history (const struct
}
}
break;
- case TALER_EXCHANGEDB_TT_OLD_COIN_PAYBACK:
+ case TALER_EXCHANGEDB_TT_OLD_COIN_RECOUP:
{
- struct TALER_EXCHANGEDB_PaybackRefreshListEntry *pr =
- pos->details.old_coin_payback;
- struct TALER_PaybackRefreshConfirmationPS pc;
+ struct TALER_EXCHANGEDB_RecoupRefreshListEntry *pr =
+ pos->details.old_coin_recoup;
+ struct TALER_RecoupRefreshConfirmationPS pc;
struct TALER_ExchangePublicKeyP epub;
struct TALER_ExchangeSignatureP esig;
pc.purpose.purpose = htonl (
- TALER_SIGNATURE_EXCHANGE_CONFIRM_PAYBACK_REFRESH);
+ TALER_SIGNATURE_EXCHANGE_CONFIRM_RECOUP_REFRESH);
pc.purpose.size = htonl (sizeof (pc));
pc.timestamp = GNUNET_TIME_absolute_hton (pr->timestamp);
- TALER_amount_hton (&pc.payback_amount,
+ TALER_amount_hton (&pc.recoup_amount,
&pr->value);
pc.coin_pub = *coin_pub;
pc.old_coin_pub = pr->old_coin_pub;
@@ -281,7 +281,7 @@ TEH_RESPONSE_compile_transaction_history (const struct
strictly unnecessary. */if (0 !=
json_array_append_new (history,
json_pack ("{s:s, s:o, s:o, s:o, s:o, s:o}",
- "type", "OLD-COIN-PAYBACK",
+ "type", "OLD-COIN-RECOUP",
"amount", TALER_JSON_from_amount (
&pr->value),
"exchange_sig",
@@ -303,21 +303,21 @@ TEH_RESPONSE_compile_transaction_history (const struct
}
break;
}
- case TALER_EXCHANGEDB_TT_PAYBACK:
+ case TALER_EXCHANGEDB_TT_RECOUP:
{
- const struct TALER_EXCHANGEDB_PaybackListEntry *payback =
- pos->details.payback;
- struct TALER_PaybackConfirmationPS pc;
+ const struct TALER_EXCHANGEDB_RecoupListEntry *recoup =
+ pos->details.recoup;
+ struct TALER_RecoupConfirmationPS pc;
struct TALER_ExchangePublicKeyP epub;
struct TALER_ExchangeSignatureP esig;
- pc.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_PAYBACK);
+ pc.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_RECOUP);
pc.purpose.size = htonl (sizeof (pc));
- pc.timestamp = GNUNET_TIME_absolute_hton (payback->timestamp);
- TALER_amount_hton (&pc.payback_amount,
- &payback->value);
+ pc.timestamp = GNUNET_TIME_absolute_hton (recoup->timestamp);
+ TALER_amount_hton (&pc.recoup_amount,
+ &recoup->value);
pc.coin_pub = *coin_pub;
- pc.reserve_pub = payback->reserve_pub;
+ pc.reserve_pub = recoup->reserve_pub;
if (GNUNET_OK !=
TEH_KS_sign (&pc.purpose,
&epub,
@@ -330,9 +330,9 @@ TEH_RESPONSE_compile_transaction_history (const struct
if (0 !=
json_array_append_new (history,
json_pack ("{s:s, s:o, s:o, s:o, s:o, s:o}",
- "type", "PAYBACK",
+ "type", "RECOUP",
"amount", TALER_JSON_from_amount (
- &payback->value),
+ &recoup->value),
"exchange_sig",
GNUNET_JSON_from_data_auto (
&esig),
@@ -341,10 +341,10 @@ TEH_RESPONSE_compile_transaction_history (const struct
&epub),
"reserve_pub",
GNUNET_JSON_from_data_auto (
- &payback->reserve_pub),
+ &recoup->reserve_pub),
"timestamp",
GNUNET_JSON_from_time_abs (
- payback->timestamp))))
+ recoup->timestamp))))
{
GNUNET_break (0);
json_decref (history);
@@ -352,19 +352,19 @@ TEH_RESPONSE_compile_transaction_history (const struct
}
}
break;
- case TALER_EXCHANGEDB_TT_PAYBACK_REFRESH:
+ case TALER_EXCHANGEDB_TT_RECOUP_REFRESH:
{
- struct TALER_EXCHANGEDB_PaybackRefreshListEntry *pr =
- pos->details.payback_refresh;
- struct TALER_PaybackRefreshConfirmationPS pc;
+ struct TALER_EXCHANGEDB_RecoupRefreshListEntry *pr =
+ pos->details.recoup_refresh;
+ struct TALER_RecoupRefreshConfirmationPS pc;
struct TALER_ExchangePublicKeyP epub;
struct TALER_ExchangeSignatureP esig;
pc.purpose.purpose = htonl (
- TALER_SIGNATURE_EXCHANGE_CONFIRM_PAYBACK_REFRESH);
+ TALER_SIGNATURE_EXCHANGE_CONFIRM_RECOUP_REFRESH);
pc.purpose.size = htonl (sizeof (pc));
pc.timestamp = GNUNET_TIME_absolute_hton (pr->timestamp);
- TALER_amount_hton (&pc.payback_amount,
+ TALER_amount_hton (&pc.recoup_amount,
&pr->value);
pc.coin_pub = *coin_pub;
pc.old_coin_pub = pr->old_coin_pub;
@@ -384,7 +384,7 @@ TEH_RESPONSE_compile_transaction_history (const struct
strictly unnecessary. */if (0 !=
json_array_append_new (history,
json_pack ("{s:s, s:o, s:o, s:o, s:o, s:o}",
- "type", "PAYBACK-REFRESH",
+ "type", "RECOUP-REFRESH",
"amount", TALER_JSON_from_amount (
&pr->value),
"exchange_sig",
@@ -566,33 +566,33 @@ TEH_RESPONSE_compile_reserve_history (const struct
}
}
break;
- case TALER_EXCHANGEDB_RO_PAYBACK_COIN:
+ case TALER_EXCHANGEDB_RO_RECOUP_COIN:
{
- const struct TALER_EXCHANGEDB_Payback *payback;
- struct TALER_PaybackConfirmationPS pc;
+ const struct TALER_EXCHANGEDB_Recoup *recoup;
+ struct TALER_RecoupConfirmationPS pc;
struct TALER_ExchangePublicKeyP pub;
struct TALER_ExchangeSignatureP sig;
- payback = pos->details.payback;
+ recoup = pos->details.recoup;
if (0 == (1 & ret))
- deposit_total = payback->value;
+ deposit_total = recoup->value;
else if (GNUNET_OK !=
TALER_amount_add (&deposit_total,
&deposit_total,
- &payback->value))
+ &recoup->value))
{
GNUNET_break (0);
json_decref (json_history);
return NULL;
}
ret |= 1;
- pc.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_PAYBACK);
- pc.purpose.size = htonl (sizeof (struct TALER_PaybackConfirmationPS));
- pc.timestamp = GNUNET_TIME_absolute_hton (payback->timestamp);
- TALER_amount_hton (&pc.payback_amount,
- &payback->value);
- pc.coin_pub = payback->coin.coin_pub;
- pc.reserve_pub = payback->reserve_pub;
+ pc.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_RECOUP);
+ pc.purpose.size = htonl (sizeof (struct TALER_RecoupConfirmationPS));
+ pc.timestamp = GNUNET_TIME_absolute_hton (recoup->timestamp);
+ TALER_amount_hton (&pc.recoup_amount,
+ &recoup->value);
+ pc.coin_pub = recoup->coin.coin_pub;
+ pc.reserve_pub = recoup->reserve_pub;
if (GNUNET_OK !=
TEH_KS_sign (&pc.purpose,
&pub,
@@ -606,19 +606,19 @@ TEH_RESPONSE_compile_reserve_history (const struct
if (0 !=
json_array_append_new (json_history,
json_pack ("{s:s, s:o, s:o, s:o, s:o, s:o}",
- "type", "PAYBACK",
+ "type", "RECOUP",
"exchange_pub",
GNUNET_JSON_from_data_auto (&pub),
"exchange_sig",
GNUNET_JSON_from_data_auto (&sig),
"timestamp",
GNUNET_JSON_from_time_abs (
- payback->timestamp),
+ recoup->timestamp),
"amount", TALER_JSON_from_amount (
- &payback->value),
+ &recoup->value),
"coin_pub",
GNUNET_JSON_from_data_auto (
- &payback->coin.coin_pub))))
+ &recoup->coin.coin_pub))))
{
GNUNET_break (0);
json_decref (json_history);