payback -> recoup stranglers

This commit is contained in:
Christian Grothoff 2020-01-18 23:49:37 +01:00
parent 6e17a847e8
commit db669ee495
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
40 changed files with 1958 additions and 1854 deletions

View File

@ -77,8 +77,8 @@ In that time, the auditor processed the following table ranges:
& {{ data.end_ppr_reserve_in_serial_id }} \\ \hline & {{ data.end_ppr_reserve_in_serial_id }} \\ \hline
Reserves Out (withdraw) & {{ data.start_ppr_reserve_out_serial_id }} Reserves Out (withdraw) & {{ data.start_ppr_reserve_out_serial_id }}
& {{ data.end_ppr_reserve_out_serial_id }} \\ \hline & {{ data.end_ppr_reserve_out_serial_id }} \\ \hline
Reserves Payback & {{ data.start_ppr_reserve_payback_serial_id }} Reserves Recoup & {{ data.start_ppr_reserve_recoup_serial_id }}
& {{ data.end_ppr_reserve_payback_serial_id }} \\ \hline & {{ data.end_ppr_reserve_recoup_serial_id }} \\ \hline
Reserves Close & {{ data.start_ppr_reserve_close_serial_id }} Reserves Close & {{ data.start_ppr_reserve_close_serial_id }}
& {{ data.end_ppr_reserve_close_serial_id }} \\ \hline & {{ data.end_ppr_reserve_close_serial_id }} \\ \hline
Aggregation & {{ data.start_ppa_wire_out_serial_id }} Aggregation & {{ data.start_ppa_wire_out_serial_id }}
@ -91,10 +91,10 @@ In that time, the auditor processed the following table ranges:
& {{ data.end_ppc_melt_serial_id }} \\ \hline & {{ data.end_ppc_melt_serial_id }} \\ \hline
Coin refund & {{ data.start_ppc_refund_serial_id }} Coin refund & {{ data.start_ppc_refund_serial_id }}
& {{ data.end_ppc_refund_serial_id }} \\ \hline & {{ data.end_ppc_refund_serial_id }} \\ \hline
Coin payback & {{ data.start_ppc_payback_serial_id }} Coin recoup & {{ data.start_ppc_recoup_serial_id }}
& {{ data.end_ppc_payback_serial_id }} \\ \hline & {{ data.end_ppc_recoup_serial_id }} \\ \hline
Coin payback refresh & {{ data.start_ppc_payback_refresh_serial_id }} Coin recoup refresh & {{ data.start_ppc_recoup_refresh_serial_id }}
& {{ data.end_ppc_payback_refresh_serial_id }} \\ & {{ data.end_ppc_recoup_refresh_serial_id }} \\
\end{tabular} \end{tabular}
\end{center} \end{center}
\caption{Serial number ranges of the tables processed by the audit.} \caption{Serial number ranges of the tables processed by the audit.}
@ -143,12 +143,12 @@ The active operational risk stands at
{\bf {{ data.total_active_risk }}}. {\bf {{ data.total_active_risk }}}.
\noindent \noindent
Loss (actualized risk from paybacks) is Loss (actualized risk from recoups) is
{\bf {{ data.total_payback_loss }}}. {\bf {{ data.total_recoup_loss }}}.
\noindent \noindent
Paybacks of non-revoked coins are at Recoups of non-revoked coins are at
{\bf {{ data.total_irregular_paybacks }}}. {\bf {{ data.total_irregular_recoups }}}.
\section{Income} \section{Income}
@ -612,8 +612,8 @@ step failed. This is the reserve public key for ``withdraw''
operations, the coin public key for ``deposit'' and ``melt'' operations, the coin public key for ``deposit'' and ``melt''
operations, the merchant's public key for ``melt'' operations, operations, the merchant's public key for ``melt'' operations,
the (hash of the) denomination public key for the (hash of the) denomination public key for
``payback-verify'' and ``deposit-verify'' operations, and the master ``recoup-verify'' and ``deposit-verify'' operations, and the master
public key for ``payback-master'' operations. public key for ``recoup-master'' operations.
% Table generation tested by testcase #4/#5/#6/#7/#13 in test-auditor.sh % Table generation tested by testcase #4/#5/#6/#7/#13 in test-auditor.sh

Binary file not shown.

View File

@ -1 +1 @@
GWHMRJBZJTCWCGNGQZ0JD9Q7BG0X8VXCC1YZKGQPZ8CXCYSA7WA0 0RT5D836NMF314QVZDSRMXX74SEPJZBSVQWF1JGBKAGGC473FJ8G

File diff suppressed because it is too large Load Diff

View File

@ -314,14 +314,14 @@ static struct TALER_Amount total_escrow_balance;
static struct TALER_Amount total_risk; static struct TALER_Amount total_risk;
/** /**
* Actualized risk (= loss) from paybacks. * Actualized risk (= loss) from recoups.
*/ */
static struct TALER_Amount total_payback_loss; static struct TALER_Amount total_recoup_loss;
/** /**
* Paybacks we made on denominations that were not revoked (!?). * Recoups we made on denominations that were not revoked (!?).
*/ */
static struct TALER_Amount total_irregular_paybacks; static struct TALER_Amount total_irregular_recoups;
/** /**
* Total withdraw fees earned. * Total withdraw fees earned.
@ -1265,33 +1265,33 @@ handle_reserve_out (void *cls,
* *
* @param cls our `struct ReserveContext` * @param cls our `struct ReserveContext`
* @param rowid unique serial ID for the refresh session in our DB * @param rowid unique serial ID for the refresh session in our DB
* @param timestamp when did we receive the payback request * @param timestamp when did we receive the recoup request
* @param amount how much should be added back to the reserve * @param amount how much should be added back to the reserve
* @param reserve_pub public key of the reserve * @param reserve_pub public key of the reserve
* @param coin public information about the coin, denomination signature is * @param coin public information about the coin, denomination signature is
* already verified in #check_payback() * already verified in #check_recoup()
* @param denom_pub public key of the denomionation of @a coin * @param denom_pub public key of the denomionation of @a coin
* @param coin_sig signature with @e coin_pub of type #TALER_SIGNATURE_WALLET_COIN_PAYBACK * @param coin_sig signature with @e coin_pub of type #TALER_SIGNATURE_WALLET_COIN_RECOUP
* @param coin_blind blinding factor used to blind the coin * @param coin_blind blinding factor used to blind the coin
* @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop
*/ */
static int static int
handle_payback_by_reserve (void *cls, handle_recoup_by_reserve (void *cls,
uint64_t rowid, uint64_t rowid,
struct GNUNET_TIME_Absolute timestamp, struct GNUNET_TIME_Absolute timestamp,
const struct TALER_Amount *amount, const struct TALER_Amount *amount,
const struct TALER_ReservePublicKeyP *reserve_pub, const struct TALER_ReservePublicKeyP *reserve_pub,
const struct TALER_CoinPublicInfo *coin, const struct TALER_CoinPublicInfo *coin,
const struct TALER_DenominationPublicKey *denom_pub, const struct TALER_DenominationPublicKey *denom_pub,
const struct TALER_CoinSpendSignatureP *coin_sig, const struct TALER_CoinSpendSignatureP *coin_sig,
const struct const struct
TALER_DenominationBlindingKeyP *coin_blind) TALER_DenominationBlindingKeyP *coin_blind)
{ {
struct ReserveContext *rc = cls; struct ReserveContext *rc = cls;
struct GNUNET_HashCode key; struct GNUNET_HashCode key;
struct ReserveSummary *rs; struct ReserveSummary *rs;
struct GNUNET_TIME_Absolute expiry; struct GNUNET_TIME_Absolute expiry;
struct TALER_PaybackRequestPS pr; struct TALER_RecoupRequestPS pr;
struct TALER_MasterSignatureP msig; struct TALER_MasterSignatureP msig;
uint64_t rev_rowid; uint64_t rev_rowid;
enum GNUNET_DB_QueryStatus qs; enum GNUNET_DB_QueryStatus qs;
@ -1299,24 +1299,24 @@ handle_payback_by_reserve (void *cls,
(void) denom_pub; (void) denom_pub;
/* should be monotonically increasing */ /* should be monotonically increasing */
GNUNET_assert (rowid >= ppr.last_reserve_payback_serial_id); GNUNET_assert (rowid >= ppr.last_reserve_recoup_serial_id);
ppr.last_reserve_payback_serial_id = rowid + 1; ppr.last_reserve_recoup_serial_id = rowid + 1;
/* We know that denom_pub matches denom_pub_hash because this /* We know that denom_pub matches denom_pub_hash because this
is how the SQL statement joined the tables. */ is how the SQL statement joined the tables. */
pr.h_denom_pub = coin->denom_pub_hash; pr.h_denom_pub = coin->denom_pub_hash;
pr.purpose.purpose = htonl (TALER_SIGNATURE_WALLET_COIN_PAYBACK); pr.purpose.purpose = htonl (TALER_SIGNATURE_WALLET_COIN_RECOUP);
pr.purpose.size = htonl (sizeof (pr)); pr.purpose.size = htonl (sizeof (pr));
pr.coin_pub = coin->coin_pub; pr.coin_pub = coin->coin_pub;
pr.coin_blind = *coin_blind; pr.coin_blind = *coin_blind;
if (GNUNET_OK != if (GNUNET_OK !=
GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_WALLET_COIN_PAYBACK, GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_WALLET_COIN_RECOUP,
&pr.purpose, &pr.purpose,
&coin_sig->eddsa_signature, &coin_sig->eddsa_signature,
&coin->coin_pub.eddsa_pub)) &coin->coin_pub.eddsa_pub))
{ {
report (report_bad_sig_losses, report (report_bad_sig_losses,
json_pack ("{s:s, s:I, s:o, s:o}", json_pack ("{s:s, s:I, s:o, s:o}",
"operation", "payback", "operation", "recoup",
"row", (json_int_t) rowid, "row", (json_int_t) rowid,
"loss", TALER_JSON_from_amount (amount), "loss", TALER_JSON_from_amount (amount),
"key_pub", GNUNET_JSON_from_data_auto ( "key_pub", GNUNET_JSON_from_data_auto (
@ -1327,7 +1327,7 @@ handle_payback_by_reserve (void *cls,
amount)); amount));
} }
/* check that the coin was eligible for payback!*/ /* check that the coin was eligible for recoup!*/
rev = GNUNET_CONTAINER_multihashmap_get (rc->revoked, rev = GNUNET_CONTAINER_multihashmap_get (rc->revoked,
&pr.h_denom_pub); &pr.h_denom_pub);
if (NULL == rev) if (NULL == rev)
@ -1345,12 +1345,12 @@ handle_payback_by_reserve (void *cls,
} }
if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs) if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
{ {
report_row_inconsistency ("payback", report_row_inconsistency ("recoup",
rowid, rowid,
"denomination key not in revocation set"); "denomination key not in revocation set");
GNUNET_break (GNUNET_OK == GNUNET_break (GNUNET_OK ==
TALER_amount_add (&total_irregular_paybacks, TALER_amount_add (&total_irregular_recoups,
&total_irregular_paybacks, &total_irregular_recoups,
amount)); amount));
} }
else else
@ -1391,7 +1391,7 @@ handle_payback_by_reserve (void *cls,
{ {
report (report_bad_sig_losses, report (report_bad_sig_losses,
json_pack ("{s:s, s:I, s:o, s:o}", json_pack ("{s:s, s:I, s:o, s:o}",
"operation", "payback-master", "operation", "recoup-master",
"row", (json_int_t) rev_rowid, "row", (json_int_t) rev_rowid,
"loss", TALER_JSON_from_amount (amount), "loss", TALER_JSON_from_amount (amount),
"key_pub", GNUNET_JSON_from_data_auto (&master_pub))); "key_pub", GNUNET_JSON_from_data_auto (&master_pub)));
@ -1439,7 +1439,7 @@ handle_payback_by_reserve (void *cls,
amount)); amount));
} }
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Additional /payback value to for reserve `%s' of %s\n", "Additional /recoup value to for reserve `%s' of %s\n",
TALER_B2S (reserve_pub), TALER_B2S (reserve_pub),
TALER_amount2s (amount)); TALER_amount2s (amount));
expiry = GNUNET_TIME_absolute_add (timestamp, expiry = GNUNET_TIME_absolute_add (timestamp,
@ -1917,7 +1917,7 @@ analyze_reserves (void *cls)
_ ("Resuming reserve audit at %llu/%llu/%llu/%llu\n"), _ ("Resuming reserve audit at %llu/%llu/%llu/%llu\n"),
(unsigned long long) ppr.last_reserve_in_serial_id, (unsigned long long) ppr.last_reserve_in_serial_id,
(unsigned long long) ppr.last_reserve_out_serial_id, (unsigned long long) ppr.last_reserve_out_serial_id,
(unsigned long long) ppr.last_reserve_payback_serial_id, (unsigned long long) ppr.last_reserve_recoup_serial_id,
(unsigned long long) ppr.last_reserve_close_serial_id); (unsigned long long) ppr.last_reserve_close_serial_id);
} }
rc.qs = GNUNET_DB_STATUS_SUCCESS_ONE_RESULT; rc.qs = GNUNET_DB_STATUS_SUCCESS_ONE_RESULT;
@ -1956,11 +1956,11 @@ analyze_reserves (void *cls)
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
return qs; return qs;
} }
qs = edb->select_payback_above_serial_id (edb->cls, qs = edb->select_recoup_above_serial_id (edb->cls,
esession, esession,
ppr.last_reserve_payback_serial_id, ppr.last_reserve_recoup_serial_id,
&handle_payback_by_reserve, &handle_recoup_by_reserve,
&rc); &rc);
if (qs < 0) if (qs < 0)
{ {
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
@ -2031,7 +2031,7 @@ analyze_reserves (void *cls)
_ ("Concluded reserve audit step at %llu/%llu/%llu/%llu\n"), _ ("Concluded reserve audit step at %llu/%llu/%llu/%llu\n"),
(unsigned long long) ppr.last_reserve_in_serial_id, (unsigned long long) ppr.last_reserve_in_serial_id,
(unsigned long long) ppr.last_reserve_out_serial_id, (unsigned long long) ppr.last_reserve_out_serial_id,
(unsigned long long) ppr.last_reserve_payback_serial_id, (unsigned long long) ppr.last_reserve_recoup_serial_id,
(unsigned long long) ppr.last_reserve_close_serial_id); (unsigned long long) ppr.last_reserve_close_serial_id);
return GNUNET_DB_STATUS_SUCCESS_ONE_RESULT; return GNUNET_DB_STATUS_SUCCESS_ONE_RESULT;
} }
@ -2361,8 +2361,8 @@ check_transaction_history_for_deposit (const struct
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
break; break;
case TALER_EXCHANGEDB_TT_OLD_COIN_PAYBACK: case TALER_EXCHANGEDB_TT_OLD_COIN_RECOUP:
amount_with_fee = &tl->details.old_coin_payback->value; amount_with_fee = &tl->details.old_coin_recoup->value;
if (GNUNET_OK != if (GNUNET_OK !=
TALER_amount_add (&refunds, TALER_amount_add (&refunds,
&refunds, &refunds,
@ -2372,8 +2372,8 @@ check_transaction_history_for_deposit (const struct
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
break; break;
case TALER_EXCHANGEDB_TT_PAYBACK: case TALER_EXCHANGEDB_TT_RECOUP:
amount_with_fee = &tl->details.payback->value; amount_with_fee = &tl->details.recoup->value;
if (GNUNET_OK != if (GNUNET_OK !=
TALER_amount_add (&expenditures, TALER_amount_add (&expenditures,
&expenditures, &expenditures,
@ -2383,8 +2383,8 @@ check_transaction_history_for_deposit (const struct
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
break; break;
case TALER_EXCHANGEDB_TT_PAYBACK_REFRESH: case TALER_EXCHANGEDB_TT_RECOUP_REFRESH:
amount_with_fee = &tl->details.payback_refresh->value; amount_with_fee = &tl->details.recoup_refresh->value;
if (GNUNET_OK != if (GNUNET_OK !=
TALER_amount_add (&expenditures, TALER_amount_add (&expenditures,
&expenditures, &expenditures,
@ -2408,8 +2408,8 @@ check_transaction_history_for_deposit (const struct
deposit_fee)); deposit_fee));
} }
/* Calculate total balance change, i.e. expenditures (payback, deposit, refresh) /* Calculate total balance change, i.e. expenditures (recoup, deposit, refresh)
minus refunds (refunds, payback-to-old) */ minus refunds (refunds, recoup-to-old) */
if (GNUNET_SYSERR == if (GNUNET_SYSERR ==
TALER_amount_subtract (&spent, TALER_amount_subtract (&spent,
&expenditures, &expenditures,
@ -3120,9 +3120,9 @@ struct DenominationSummary
struct TALER_Amount denom_risk; struct TALER_Amount denom_risk;
/** /**
* Total value of coins subjected to payback with this denomination key. * Total value of coins subjected to recoup with this denomination key.
*/ */
struct TALER_Amount denom_payback; struct TALER_Amount denom_recoup;
/** /**
* How many coins (not their amount!) of this denomination * How many coins (not their amount!) of this denomination
@ -3199,7 +3199,7 @@ init_denomination (const struct GNUNET_HashCode *denom_hash,
&ds->denom_balance, &ds->denom_balance,
&ds->denom_loss, &ds->denom_loss,
&ds->denom_risk, &ds->denom_risk,
&ds->denom_payback, &ds->denom_recoup,
&ds->num_issued); &ds->num_issued);
if (0 > qs) if (0 > qs)
{ {
@ -3261,7 +3261,7 @@ init_denomination (const struct GNUNET_HashCode *denom_hash,
&ds->denom_risk)); &ds->denom_risk));
GNUNET_assert (GNUNET_OK == GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (currency, TALER_amount_get_zero (currency,
&ds->denom_payback)); &ds->denom_recoup));
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Starting balance for denomination `%s' is %s\n", "Starting balance for denomination `%s' is %s\n",
GNUNET_h2s (denom_hash), GNUNET_h2s (denom_hash),
@ -3379,7 +3379,7 @@ sync_denomination (void *cls,
denom_hash, denom_hash,
expire_deposit, expire_deposit,
&ds->denom_balance, &ds->denom_balance,
&ds->denom_payback))) &ds->denom_recoup)))
{ {
/* Failed to store profits? Bad database */ /* Failed to store profits? Bad database */
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
@ -3429,7 +3429,7 @@ sync_denomination (void *cls,
&ds->denom_balance, &ds->denom_balance,
&ds->denom_loss, &ds->denom_loss,
&ds->denom_risk, &ds->denom_risk,
&ds->denom_payback, &ds->denom_recoup,
ds->num_issued); ds->num_issued);
else else
qs = adb->insert_denomination_balance (adb->cls, qs = adb->insert_denomination_balance (adb->cls,
@ -3438,7 +3438,7 @@ sync_denomination (void *cls,
&ds->denom_balance, &ds->denom_balance,
&ds->denom_loss, &ds->denom_loss,
&ds->denom_risk, &ds->denom_risk,
&ds->denom_payback, &ds->denom_recoup,
ds->num_issued); ds->num_issued);
} }
} }
@ -4417,28 +4417,28 @@ refund_cb (void *cls,
/** /**
* Check that the payback operation was properly initiated by a coin * Check that the recoup operation was properly initiated by a coin
* and update the denomination's losses accordingly. * and update the denomination's losses accordingly.
* *
* @param cc the context with details about the coin * @param cc the context with details about the coin
* @param rowid row identifier used to uniquely identify the payback operation * @param rowid row identifier used to uniquely identify the recoup operation
* @param amount how much should be added back to the reserve * @param amount how much should be added back to the reserve
* @param coin public information about the coin * @param coin public information about the coin
* @param denom_pub public key of the denomionation of @a coin * @param denom_pub public key of the denomionation of @a coin
* @param coin_sig signature with @e coin_pub of type #TALER_SIGNATURE_WALLET_COIN_PAYBACK * @param coin_sig signature with @e coin_pub of type #TALER_SIGNATURE_WALLET_COIN_RECOUP
* @param coin_blind blinding factor used to blind the coin * @param coin_blind blinding factor used to blind the coin
* @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop
*/ */
static int static int
check_payback (struct CoinContext *cc, check_recoup (struct CoinContext *cc,
uint64_t rowid, uint64_t rowid,
const struct TALER_Amount *amount, const struct TALER_Amount *amount,
const struct TALER_CoinPublicInfo *coin, const struct TALER_CoinPublicInfo *coin,
const struct TALER_DenominationPublicKey *denom_pub, const struct TALER_DenominationPublicKey *denom_pub,
const struct TALER_CoinSpendSignatureP *coin_sig, const struct TALER_CoinSpendSignatureP *coin_sig,
const struct TALER_DenominationBlindingKeyP *coin_blind) const struct TALER_DenominationBlindingKeyP *coin_blind)
{ {
struct TALER_PaybackRequestPS pr; struct TALER_RecoupRequestPS pr;
struct DenominationSummary *ds; struct DenominationSummary *ds;
enum GNUNET_DB_QueryStatus qs; enum GNUNET_DB_QueryStatus qs;
const struct TALER_DenominationKeyValidityPS *issue; const struct TALER_DenominationKeyValidityPS *issue;
@ -4449,7 +4449,7 @@ check_payback (struct CoinContext *cc,
{ {
report (report_bad_sig_losses, report (report_bad_sig_losses,
json_pack ("{s:s, s:I, s:o, s:o}", json_pack ("{s:s, s:I, s:o, s:o}",
"operation", "payback", "operation", "recoup",
"row", (json_int_t) rowid, "row", (json_int_t) rowid,
"loss", TALER_JSON_from_amount (amount), "loss", TALER_JSON_from_amount (amount),
"key_pub", GNUNET_JSON_from_data_auto ( "key_pub", GNUNET_JSON_from_data_auto (
@ -4464,7 +4464,7 @@ check_payback (struct CoinContext *cc,
&pr.h_denom_pub); &pr.h_denom_pub);
if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs) if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
{ {
report_row_inconsistency ("payback", report_row_inconsistency ("recoup",
rowid, rowid,
"denomination key not found (foreign key constraint violated)"); "denomination key not found (foreign key constraint violated)");
cc->qs = GNUNET_DB_STATUS_HARD_ERROR; cc->qs = GNUNET_DB_STATUS_HARD_ERROR;
@ -4478,19 +4478,19 @@ check_payback (struct CoinContext *cc,
cc->qs = qs; cc->qs = qs;
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
pr.purpose.purpose = htonl (TALER_SIGNATURE_WALLET_COIN_PAYBACK); pr.purpose.purpose = htonl (TALER_SIGNATURE_WALLET_COIN_RECOUP);
pr.purpose.size = htonl (sizeof (pr)); pr.purpose.size = htonl (sizeof (pr));
pr.coin_pub = coin->coin_pub; pr.coin_pub = coin->coin_pub;
pr.coin_blind = *coin_blind; pr.coin_blind = *coin_blind;
if (GNUNET_OK != if (GNUNET_OK !=
GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_WALLET_COIN_PAYBACK, GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_WALLET_COIN_RECOUP,
&pr.purpose, &pr.purpose,
&coin_sig->eddsa_signature, &coin_sig->eddsa_signature,
&coin->coin_pub.eddsa_pub)) &coin->coin_pub.eddsa_pub))
{ {
report (report_bad_sig_losses, report (report_bad_sig_losses,
json_pack ("{s:s, s:I, s:o, s:o}", json_pack ("{s:s, s:I, s:o, s:o}",
"operation", "payback", "operation", "recoup",
"row", (json_int_t) rowid, "row", (json_int_t) rowid,
"loss", TALER_JSON_from_amount (amount), "loss", TALER_JSON_from_amount (amount),
"coin_pub", GNUNET_JSON_from_data_auto ( "coin_pub", GNUNET_JSON_from_data_auto (
@ -4506,103 +4506,103 @@ check_payback (struct CoinContext *cc,
&issue->denom_hash); &issue->denom_hash);
if (GNUNET_NO == ds->was_revoked) if (GNUNET_NO == ds->was_revoked)
{ {
/* Woopsie, we allowed payback on non-revoked denomination!? */ /* Woopsie, we allowed recoup on non-revoked denomination!? */
report (report_bad_sig_losses, report (report_bad_sig_losses,
json_pack ("{s:s, s:I, s:o, s:o}", json_pack ("{s:s, s:I, s:o, s:o}",
"operation", "payback (denomination not revoked)", "operation", "recoup (denomination not revoked)",
"row", (json_int_t) rowid, "row", (json_int_t) rowid,
"loss", TALER_JSON_from_amount (amount), "loss", TALER_JSON_from_amount (amount),
"coin_pub", GNUNET_JSON_from_data_auto ( "coin_pub", GNUNET_JSON_from_data_auto (
&coin->coin_pub))); &coin->coin_pub)));
} }
GNUNET_break (GNUNET_OK == GNUNET_break (GNUNET_OK ==
TALER_amount_add (&ds->denom_payback, TALER_amount_add (&ds->denom_recoup,
&ds->denom_payback, &ds->denom_recoup,
amount)); amount));
GNUNET_break (GNUNET_OK == GNUNET_break (GNUNET_OK ==
TALER_amount_add (&total_payback_loss, TALER_amount_add (&total_recoup_loss,
&total_payback_loss, &total_recoup_loss,
amount)); amount));
return GNUNET_OK; return GNUNET_OK;
} }
/** /**
* Function called about paybacks the exchange has to perform. * Function called about recoups the exchange has to perform.
* *
* @param cls a `struct CoinContext *` * @param cls a `struct CoinContext *`
* @param rowid row identifier used to uniquely identify the payback operation * @param rowid row identifier used to uniquely identify the recoup operation
* @param timestamp when did we receive the payback request * @param timestamp when did we receive the recoup request
* @param amount how much should be added back to the reserve * @param amount how much should be added back to the reserve
* @param reserve_pub public key of the reserve * @param reserve_pub public key of the reserve
* @param coin public information about the coin * @param coin public information about the coin
* @param denom_pub denomination public key of @a coin * @param denom_pub denomination public key of @a coin
* @param coin_sig signature with @e coin_pub of type #TALER_SIGNATURE_WALLET_COIN_PAYBACK * @param coin_sig signature with @e coin_pub of type #TALER_SIGNATURE_WALLET_COIN_RECOUP
* @param coin_blind blinding factor used to blind the coin * @param coin_blind blinding factor used to blind the coin
* @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop
*/ */
static int static int
payback_cb (void *cls, recoup_cb (void *cls,
uint64_t rowid, uint64_t rowid,
struct GNUNET_TIME_Absolute timestamp, struct GNUNET_TIME_Absolute timestamp,
const struct TALER_Amount *amount, const struct TALER_Amount *amount,
const struct TALER_ReservePublicKeyP *reserve_pub, const struct TALER_ReservePublicKeyP *reserve_pub,
const struct TALER_CoinPublicInfo *coin, const struct TALER_CoinPublicInfo *coin,
const struct TALER_DenominationPublicKey *denom_pub, const struct TALER_DenominationPublicKey *denom_pub,
const struct TALER_CoinSpendSignatureP *coin_sig, const struct TALER_CoinSpendSignatureP *coin_sig,
const struct TALER_DenominationBlindingKeyP *coin_blind) const struct TALER_DenominationBlindingKeyP *coin_blind)
{ {
struct CoinContext *cc = cls; struct CoinContext *cc = cls;
(void) timestamp; (void) timestamp;
(void) reserve_pub; (void) reserve_pub;
return check_payback (cc, return check_recoup (cc,
rowid, rowid,
amount, amount,
coin, coin,
denom_pub, denom_pub,
coin_sig, coin_sig,
coin_blind); coin_blind);
} }
/** /**
* Function called about paybacks on refreshed coins the exchange has to * Function called about recoups on refreshed coins the exchange has to
* perform. * perform.
* *
* @param cls a `struct CoinContext *` * @param cls a `struct CoinContext *`
* @param rowid row identifier used to uniquely identify the payback operation * @param rowid row identifier used to uniquely identify the recoup operation
* @param timestamp when did we receive the payback request * @param timestamp when did we receive the recoup request
* @param amount how much should be added back to the reserve * @param amount how much should be added back to the reserve
* @param old_coin_pub original coin that was refreshed to create @a coin * @param old_coin_pub original coin that was refreshed to create @a coin
* @param coin public information about the coin * @param coin public information about the coin
* @param denom_pub denomination public key of @a coin * @param denom_pub denomination public key of @a coin
* @param coin_sig signature with @e coin_pub of type #TALER_SIGNATURE_WALLET_COIN_PAYBACK * @param coin_sig signature with @e coin_pub of type #TALER_SIGNATURE_WALLET_COIN_RECOUP
* @param coin_blind blinding factor used to blind the coin * @param coin_blind blinding factor used to blind the coin
* @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop
*/ */
static int static int
payback_refresh_cb (void *cls, recoup_refresh_cb (void *cls,
uint64_t rowid, uint64_t rowid,
struct GNUNET_TIME_Absolute timestamp, struct GNUNET_TIME_Absolute timestamp,
const struct TALER_Amount *amount, const struct TALER_Amount *amount,
const struct TALER_CoinSpendPublicKeyP *old_coin_pub, const struct TALER_CoinSpendPublicKeyP *old_coin_pub,
const struct TALER_CoinPublicInfo *coin, const struct TALER_CoinPublicInfo *coin,
const struct TALER_DenominationPublicKey *denom_pub, const struct TALER_DenominationPublicKey *denom_pub,
const struct TALER_CoinSpendSignatureP *coin_sig, const struct TALER_CoinSpendSignatureP *coin_sig,
const struct TALER_DenominationBlindingKeyP *coin_blind) const struct TALER_DenominationBlindingKeyP *coin_blind)
{ {
struct CoinContext *cc = cls; struct CoinContext *cc = cls;
(void) timestamp; (void) timestamp;
(void) old_coin_pub; (void) old_coin_pub;
return check_payback (cc, return check_recoup (cc,
rowid, rowid,
amount, amount,
coin, coin,
denom_pub, denom_pub,
coin_sig, coin_sig,
coin_blind); coin_blind);
} }
@ -4647,7 +4647,7 @@ analyze_coins (void *cls)
(unsigned long long) ppc.last_melt_serial_id, (unsigned long long) ppc.last_melt_serial_id,
(unsigned long long) ppc.last_refund_serial_id, (unsigned long long) ppc.last_refund_serial_id,
(unsigned long long) ppc.last_withdraw_serial_id, (unsigned long long) ppc.last_withdraw_serial_id,
(unsigned long long) ppc.last_payback_refresh_serial_id); (unsigned long long) ppc.last_recoup_refresh_serial_id);
} }
/* setup 'cc' */ /* setup 'cc' */
@ -4662,8 +4662,8 @@ analyze_coins (void *cls)
&total_melt_fee_income, &total_melt_fee_income,
&total_refund_fee_income, &total_refund_fee_income,
&total_risk, &total_risk,
&total_payback_loss, &total_recoup_loss,
&total_irregular_paybacks); &total_irregular_recoups);
if (0 > qsx) if (0 > qsx)
{ {
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qsx); GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qsx);
@ -4719,24 +4719,24 @@ analyze_coins (void *cls)
return qs; return qs;
} }
/* process paybacks */ /* process recoups */
if (0 > if (0 >
(qs = edb->select_payback_above_serial_id (edb->cls, (qs = edb->select_recoup_above_serial_id (edb->cls,
esession, esession,
ppc.last_payback_serial_id, ppc.last_recoup_serial_id,
&payback_cb, &recoup_cb,
&cc))) &cc)))
{ {
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
return qs; return qs;
} }
if (0 > if (0 >
(qs = edb->select_payback_refresh_above_serial_id (edb->cls, (qs = edb->select_recoup_refresh_above_serial_id (edb->cls,
esession, esession,
ppc. ppc.
last_payback_refresh_serial_id, last_recoup_refresh_serial_id,
&payback_refresh_cb, &recoup_refresh_cb,
&cc))) &cc)))
{ {
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
return qs; return qs;
@ -4762,8 +4762,8 @@ analyze_coins (void *cls)
&total_melt_fee_income, &total_melt_fee_income,
&total_refund_fee_income, &total_refund_fee_income,
&total_risk, &total_risk,
&total_payback_loss, &total_recoup_loss,
&total_irregular_paybacks); &total_irregular_recoups);
else else
qs = adb->insert_balance_summary (adb->cls, qs = adb->insert_balance_summary (adb->cls,
asession, asession,
@ -4773,8 +4773,8 @@ analyze_coins (void *cls)
&total_melt_fee_income, &total_melt_fee_income,
&total_refund_fee_income, &total_refund_fee_income,
&total_risk, &total_risk,
&total_payback_loss, &total_recoup_loss,
&total_irregular_paybacks); &total_irregular_recoups);
if (0 >= qs) if (0 >= qs)
{ {
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
@ -4804,7 +4804,7 @@ analyze_coins (void *cls)
(unsigned long long) ppc.last_melt_serial_id, (unsigned long long) ppc.last_melt_serial_id,
(unsigned long long) ppc.last_refund_serial_id, (unsigned long long) ppc.last_refund_serial_id,
(unsigned long long) ppc.last_withdraw_serial_id, (unsigned long long) ppc.last_withdraw_serial_id,
(unsigned long long) ppc.last_payback_refresh_serial_id); (unsigned long long) ppc.last_recoup_refresh_serial_id);
return qs; return qs;
} }
@ -5359,10 +5359,10 @@ run (void *cls,
&total_risk)); &total_risk));
GNUNET_assert (GNUNET_OK == GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (currency, TALER_amount_get_zero (currency,
&total_payback_loss)); &total_recoup_loss));
GNUNET_assert (GNUNET_OK == GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (currency, TALER_amount_get_zero (currency,
&total_irregular_paybacks)); &total_irregular_recoups));
GNUNET_assert (GNUNET_OK == GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (currency, TALER_amount_get_zero (currency,
&total_withdraw_fee_income)); &total_withdraw_fee_income));
@ -5577,8 +5577,8 @@ run (void *cls,
"missing_deposit_confirmation_total", "missing_deposit_confirmation_total",
TALER_JSON_from_amount ( TALER_JSON_from_amount (
&total_missed_deposit_confirmations), &total_missed_deposit_confirmations),
"total_payback_loss", "total_recoup_loss",
TALER_JSON_from_amount (&total_payback_loss), TALER_JSON_from_amount (&total_recoup_loss),
/* Tested in test-auditor.sh #18 */ /* Tested in test-auditor.sh #18 */
"emergencies_by_count", "emergencies_by_count",
report_emergencies_by_count, report_emergencies_by_count,
@ -5598,8 +5598,8 @@ run (void *cls,
(json_int_t) ppr_start.last_reserve_in_serial_id, (json_int_t) ppr_start.last_reserve_in_serial_id,
"start_ppr_reserve_out_serial_id", "start_ppr_reserve_out_serial_id",
(json_int_t) ppr_start.last_reserve_out_serial_id, (json_int_t) ppr_start.last_reserve_out_serial_id,
"start_ppr_reserve_payback_serial_id", "start_ppr_reserve_recoup_serial_id",
(json_int_t) ppr_start.last_reserve_payback_serial_id, (json_int_t) ppr_start.last_reserve_recoup_serial_id,
"start_ppr_reserve_close_serial_id", "start_ppr_reserve_close_serial_id",
(json_int_t) ppr_start.last_reserve_close_serial_id, (json_int_t) ppr_start.last_reserve_close_serial_id,
/* block */ /* block */
@ -5607,8 +5607,8 @@ run (void *cls,
(json_int_t) ppr.last_reserve_in_serial_id, (json_int_t) ppr.last_reserve_in_serial_id,
"end_ppr_reserve_out_serial_id", "end_ppr_reserve_out_serial_id",
(json_int_t) ppr.last_reserve_out_serial_id, (json_int_t) ppr.last_reserve_out_serial_id,
"end_ppr_reserve_payback_serial_id", "end_ppr_reserve_recoup_serial_id",
(json_int_t) ppr.last_reserve_payback_serial_id, (json_int_t) ppr.last_reserve_recoup_serial_id,
"end_ppr_reserve_close_serial_id", "end_ppr_reserve_close_serial_id",
(json_int_t) ppr.last_reserve_close_serial_id, (json_int_t) ppr.last_reserve_close_serial_id,
"start_ppa_wire_out_serial_id", "start_ppa_wire_out_serial_id",
@ -5625,10 +5625,10 @@ run (void *cls,
"start_ppc_refund_serial_id", "start_ppc_refund_serial_id",
(json_int_t) ppc_start.last_refund_serial_id, (json_int_t) ppc_start.last_refund_serial_id,
/* block */ /* block */
"start_ppc_payback_serial_id", "start_ppc_recoup_serial_id",
(json_int_t) ppc_start.last_payback_serial_id, (json_int_t) ppc_start.last_recoup_serial_id,
"start_ppc_payback_refresh_serial_id", "start_ppc_recoup_refresh_serial_id",
(json_int_t) ppc_start.last_payback_refresh_serial_id, (json_int_t) ppc_start.last_recoup_refresh_serial_id,
"end_ppc_withdraw_serial_id", "end_ppc_withdraw_serial_id",
(json_int_t) ppc.last_withdraw_serial_id, (json_int_t) ppc.last_withdraw_serial_id,
"end_ppc_deposit_serial_id", "end_ppc_deposit_serial_id",
@ -5638,18 +5638,18 @@ run (void *cls,
/* block */ /* block */
"end_ppc_refund_serial_id", "end_ppc_refund_serial_id",
(json_int_t) ppc.last_refund_serial_id, (json_int_t) ppc.last_refund_serial_id,
"end_ppc_payback_serial_id", "end_ppc_recoup_serial_id",
(json_int_t) ppc.last_payback_serial_id, (json_int_t) ppc.last_recoup_serial_id,
"end_ppc_payback_refresh_serial_id", "end_ppc_recoup_refresh_serial_id",
(json_int_t) ppc.last_payback_refresh_serial_id, (json_int_t) ppc.last_recoup_refresh_serial_id,
"auditor_start_time", json_string ( "auditor_start_time", json_string (
GNUNET_STRINGS_absolute_time_to_string (start_time)), GNUNET_STRINGS_absolute_time_to_string (start_time)),
"auditor_end_time", json_string ( "auditor_end_time", json_string (
GNUNET_STRINGS_absolute_time_to_string ( GNUNET_STRINGS_absolute_time_to_string (
GNUNET_TIME_absolute_get ())), GNUNET_TIME_absolute_get ())),
/* block */ /* block */
"total_irregular_paybacks", "total_irregular_recoups",
TALER_JSON_from_amount (&total_irregular_paybacks) TALER_JSON_from_amount (&total_irregular_recoups)
); );
GNUNET_break (NULL != report); GNUNET_break (NULL != report);
json_dumpf (report, json_dumpf (report,

View File

@ -65,7 +65,7 @@ CREATE TABLE IF NOT EXISTS auditor_progress_reserve
(master_pub BYTEA CONSTRAINT master_pub_ref REFERENCES auditor_exchanges(master_pub) ON DELETE CASCADE (master_pub BYTEA CONSTRAINT master_pub_ref REFERENCES auditor_exchanges(master_pub) ON DELETE CASCADE
,last_reserve_in_serial_id INT8 NOT NULL DEFAULT 0 ,last_reserve_in_serial_id INT8 NOT NULL DEFAULT 0
,last_reserve_out_serial_id INT8 NOT NULL DEFAULT 0 ,last_reserve_out_serial_id INT8 NOT NULL DEFAULT 0
,last_reserve_payback_serial_id INT8 NOT NULL DEFAULT 0 ,last_reserve_recoup_serial_id INT8 NOT NULL DEFAULT 0
,last_reserve_close_serial_id INT8 NOT NULL DEFAULT 0 ,last_reserve_close_serial_id INT8 NOT NULL DEFAULT 0
); );
CREATE TABLE IF NOT EXISTS auditor_progress_aggregation CREATE TABLE IF NOT EXISTS auditor_progress_aggregation
@ -82,8 +82,8 @@ CREATE TABLE IF NOT EXISTS auditor_progress_coin
,last_deposit_serial_id INT8 NOT NULL DEFAULT 0 ,last_deposit_serial_id INT8 NOT NULL DEFAULT 0
,last_melt_serial_id INT8 NOT NULL DEFAULT 0 ,last_melt_serial_id INT8 NOT NULL DEFAULT 0
,last_refund_serial_id INT8 NOT NULL DEFAULT 0 ,last_refund_serial_id INT8 NOT NULL DEFAULT 0
,last_payback_serial_id INT8 NOT NULL DEFAULT 0 ,last_recoup_serial_id INT8 NOT NULL DEFAULT 0
,last_payback_refresh_serial_id INT8 NOT NULL DEFAULT 0 ,last_recoup_refresh_serial_id INT8 NOT NULL DEFAULT 0
); );
CREATE TABLE IF NOT EXISTS wire_auditor_account_progress CREATE TABLE IF NOT EXISTS wire_auditor_account_progress
(master_pub BYTEA CONSTRAINT master_pub_ref REFERENCES auditor_exchanges(master_pub) ON DELETE CASCADE (master_pub BYTEA CONSTRAINT master_pub_ref REFERENCES auditor_exchanges(master_pub) ON DELETE CASCADE
@ -149,8 +149,8 @@ CREATE TABLE IF NOT EXISTS auditor_denomination_pending
,num_issued INT8 NOT NULL ,num_issued INT8 NOT NULL
,denom_risk_val INT8 NOT NULL ,denom_risk_val INT8 NOT NULL
,denom_risk_frac INT4 NOT NULL ,denom_risk_frac INT4 NOT NULL
,payback_loss_val INT8 NOT NULL ,recoup_loss_val INT8 NOT NULL
,payback_loss_frac INT4 NOT NULL ,recoup_loss_frac INT4 NOT NULL
); );
-- Table with the sum of the outstanding coins from -- Table with the sum of the outstanding coins from
-- auditor_denomination_pending (denom_pubs must belong to the -- auditor_denomination_pending (denom_pubs must belong to the
@ -172,8 +172,8 @@ CREATE TABLE IF NOT EXISTS auditor_balance_summary
,risk_frac INT4 NOT NULL ,risk_frac INT4 NOT NULL
,loss_val INT8 NOT NULL ,loss_val INT8 NOT NULL
,loss_frac INT4 NOT NULL ,loss_frac INT4 NOT NULL
,irregular_payback_val INT8 NOT NULL ,irregular_recoup_val INT8 NOT NULL
,irregular_payback_frac INT4 NOT NULL ,irregular_recoup_frac INT4 NOT NULL
); );
-- Table with historic profits; basically, when a denom_pub has -- Table with historic profits; basically, when a denom_pub has
-- expired and everything associated with it is garbage collected, -- expired and everything associated with it is garbage collected,

View File

@ -307,7 +307,7 @@ postgres_get_session (void *cls)
"UPDATE auditor_progress_reserve SET " "UPDATE auditor_progress_reserve SET "
" last_reserve_in_serial_id=$1" " last_reserve_in_serial_id=$1"
",last_reserve_out_serial_id=$2" ",last_reserve_out_serial_id=$2"
",last_reserve_payback_serial_id=$3" ",last_reserve_recoup_serial_id=$3"
",last_reserve_close_serial_id=$4" ",last_reserve_close_serial_id=$4"
" WHERE master_pub=$5", " WHERE master_pub=$5",
5), 5),
@ -316,7 +316,7 @@ postgres_get_session (void *cls)
"SELECT" "SELECT"
" last_reserve_in_serial_id" " last_reserve_in_serial_id"
",last_reserve_out_serial_id" ",last_reserve_out_serial_id"
",last_reserve_payback_serial_id" ",last_reserve_recoup_serial_id"
",last_reserve_close_serial_id" ",last_reserve_close_serial_id"
" FROM auditor_progress_reserve" " FROM auditor_progress_reserve"
" WHERE master_pub=$1;", " WHERE master_pub=$1;",
@ -327,7 +327,7 @@ postgres_get_session (void *cls)
"(master_pub" "(master_pub"
",last_reserve_in_serial_id" ",last_reserve_in_serial_id"
",last_reserve_out_serial_id" ",last_reserve_out_serial_id"
",last_reserve_payback_serial_id" ",last_reserve_recoup_serial_id"
",last_reserve_close_serial_id" ",last_reserve_close_serial_id"
") VALUES ($1,$2,$3,$4,$5);", ") VALUES ($1,$2,$3,$4,$5);",
5), 5),
@ -378,8 +378,8 @@ postgres_get_session (void *cls)
",last_deposit_serial_id=$2" ",last_deposit_serial_id=$2"
",last_melt_serial_id=$3" ",last_melt_serial_id=$3"
",last_refund_serial_id=$4" ",last_refund_serial_id=$4"
",last_payback_serial_id=$5" ",last_recoup_serial_id=$5"
",last_payback_refresh_serial_id=$6" ",last_recoup_refresh_serial_id=$6"
" WHERE master_pub=$7", " WHERE master_pub=$7",
7), 7),
/* Used in #postgres_get_auditor_progress_coin() */ /* Used in #postgres_get_auditor_progress_coin() */
@ -389,8 +389,8 @@ postgres_get_session (void *cls)
",last_deposit_serial_id" ",last_deposit_serial_id"
",last_melt_serial_id" ",last_melt_serial_id"
",last_refund_serial_id" ",last_refund_serial_id"
",last_payback_serial_id" ",last_recoup_serial_id"
",last_payback_refresh_serial_id" ",last_recoup_refresh_serial_id"
" FROM auditor_progress_coin" " FROM auditor_progress_coin"
" WHERE master_pub=$1;", " WHERE master_pub=$1;",
1), 1),
@ -402,8 +402,8 @@ postgres_get_session (void *cls)
",last_deposit_serial_id" ",last_deposit_serial_id"
",last_melt_serial_id" ",last_melt_serial_id"
",last_refund_serial_id" ",last_refund_serial_id"
",last_payback_serial_id" ",last_recoup_serial_id"
",last_payback_refresh_serial_id" ",last_recoup_refresh_serial_id"
") VALUES ($1,$2,$3,$4,$5,$6,$7);", ") VALUES ($1,$2,$3,$4,$5,$6,$7);",
7), 7),
/* Used in #postgres_insert_wire_auditor_account_progress() */ /* Used in #postgres_insert_wire_auditor_account_progress() */
@ -564,8 +564,8 @@ postgres_get_session (void *cls)
",num_issued" ",num_issued"
",denom_risk_val" ",denom_risk_val"
",denom_risk_frac" ",denom_risk_frac"
",payback_loss_val" ",recoup_loss_val"
",payback_loss_frac" ",recoup_loss_frac"
") VALUES (" ") VALUES ("
"$1,$2,$3,$4,$5,$6,$7,$8,$9,$10" "$1,$2,$3,$4,$5,$6,$7,$8,$9,$10"
");", ");",
@ -580,8 +580,8 @@ postgres_get_session (void *cls)
",num_issued=$5" ",num_issued=$5"
",denom_risk_val=$6" ",denom_risk_val=$6"
",denom_risk_frac=$7" ",denom_risk_frac=$7"
",payback_loss_val=$8" ",recoup_loss_val=$8"
",payback_loss_frac=$9" ",recoup_loss_frac=$9"
" WHERE denom_pub_hash=$10", " WHERE denom_pub_hash=$10",
10), 10),
/* Used in #postgres_get_denomination_balance() */ /* Used in #postgres_get_denomination_balance() */
@ -594,8 +594,8 @@ postgres_get_session (void *cls)
",num_issued" ",num_issued"
",denom_risk_val" ",denom_risk_val"
",denom_risk_frac" ",denom_risk_frac"
",payback_loss_val" ",recoup_loss_val"
",payback_loss_frac" ",recoup_loss_frac"
" FROM auditor_denomination_pending" " FROM auditor_denomination_pending"
" WHERE denom_pub_hash=$1", " WHERE denom_pub_hash=$1",
1), 1),
@ -615,8 +615,8 @@ postgres_get_session (void *cls)
",risk_frac" ",risk_frac"
",loss_val" ",loss_val"
",loss_frac" ",loss_frac"
",irregular_payback_val" ",irregular_recoup_val"
",irregular_payback_frac" ",irregular_recoup_frac"
") VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10," ") VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,"
" $11,$12,$13,$14,$15);", " $11,$12,$13,$14,$15);",
15), 15),
@ -635,8 +635,8 @@ postgres_get_session (void *cls)
",risk_frac=$10" ",risk_frac=$10"
",loss_val=$11" ",loss_val=$11"
",loss_frac=$12" ",loss_frac=$12"
",irregular_payback_val=$13" ",irregular_recoup_val=$13"
",irregular_payback_frac=$14" ",irregular_recoup_frac=$14"
" WHERE master_pub=$15;", " WHERE master_pub=$15;",
15), 15),
/* Used in #postgres_get_balance_summary() */ /* Used in #postgres_get_balance_summary() */
@ -654,8 +654,8 @@ postgres_get_session (void *cls)
",risk_frac" ",risk_frac"
",loss_val" ",loss_val"
",loss_frac" ",loss_frac"
",irregular_payback_val" ",irregular_recoup_val"
",irregular_payback_frac" ",irregular_recoup_frac"
" FROM auditor_balance_summary" " FROM auditor_balance_summary"
" WHERE master_pub=$1;", " WHERE master_pub=$1;",
1), 1),
@ -1503,7 +1503,7 @@ postgres_insert_auditor_progress_reserve (void *cls,
GNUNET_PQ_query_param_auto_from_type (master_pub), GNUNET_PQ_query_param_auto_from_type (master_pub),
GNUNET_PQ_query_param_uint64 (&ppr->last_reserve_in_serial_id), GNUNET_PQ_query_param_uint64 (&ppr->last_reserve_in_serial_id),
GNUNET_PQ_query_param_uint64 (&ppr->last_reserve_out_serial_id), GNUNET_PQ_query_param_uint64 (&ppr->last_reserve_out_serial_id),
GNUNET_PQ_query_param_uint64 (&ppr->last_reserve_payback_serial_id), GNUNET_PQ_query_param_uint64 (&ppr->last_reserve_recoup_serial_id),
GNUNET_PQ_query_param_uint64 (&ppr->last_reserve_close_serial_id), GNUNET_PQ_query_param_uint64 (&ppr->last_reserve_close_serial_id),
GNUNET_PQ_query_param_end GNUNET_PQ_query_param_end
}; };
@ -1538,7 +1538,7 @@ postgres_update_auditor_progress_reserve (void *cls,
struct GNUNET_PQ_QueryParam params[] = { struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_uint64 (&ppr->last_reserve_in_serial_id), GNUNET_PQ_query_param_uint64 (&ppr->last_reserve_in_serial_id),
GNUNET_PQ_query_param_uint64 (&ppr->last_reserve_out_serial_id), GNUNET_PQ_query_param_uint64 (&ppr->last_reserve_out_serial_id),
GNUNET_PQ_query_param_uint64 (&ppr->last_reserve_payback_serial_id), GNUNET_PQ_query_param_uint64 (&ppr->last_reserve_recoup_serial_id),
GNUNET_PQ_query_param_uint64 (&ppr->last_reserve_close_serial_id), GNUNET_PQ_query_param_uint64 (&ppr->last_reserve_close_serial_id),
GNUNET_PQ_query_param_auto_from_type (master_pub), GNUNET_PQ_query_param_auto_from_type (master_pub),
GNUNET_PQ_query_param_end GNUNET_PQ_query_param_end
@ -1577,8 +1577,8 @@ postgres_get_auditor_progress_reserve (void *cls,
&ppr->last_reserve_in_serial_id), &ppr->last_reserve_in_serial_id),
GNUNET_PQ_result_spec_uint64 ("last_reserve_out_serial_id", GNUNET_PQ_result_spec_uint64 ("last_reserve_out_serial_id",
&ppr->last_reserve_out_serial_id), &ppr->last_reserve_out_serial_id),
GNUNET_PQ_result_spec_uint64 ("last_reserve_payback_serial_id", GNUNET_PQ_result_spec_uint64 ("last_reserve_recoup_serial_id",
&ppr->last_reserve_payback_serial_id), &ppr->last_reserve_recoup_serial_id),
GNUNET_PQ_result_spec_uint64 ("last_reserve_close_serial_id", GNUNET_PQ_result_spec_uint64 ("last_reserve_close_serial_id",
&ppr->last_reserve_close_serial_id), &ppr->last_reserve_close_serial_id),
GNUNET_PQ_result_spec_end GNUNET_PQ_result_spec_end
@ -1828,8 +1828,8 @@ postgres_insert_auditor_progress_coin (void *cls,
GNUNET_PQ_query_param_uint64 (&ppc->last_deposit_serial_id), GNUNET_PQ_query_param_uint64 (&ppc->last_deposit_serial_id),
GNUNET_PQ_query_param_uint64 (&ppc->last_melt_serial_id), GNUNET_PQ_query_param_uint64 (&ppc->last_melt_serial_id),
GNUNET_PQ_query_param_uint64 (&ppc->last_refund_serial_id), GNUNET_PQ_query_param_uint64 (&ppc->last_refund_serial_id),
GNUNET_PQ_query_param_uint64 (&ppc->last_payback_serial_id), GNUNET_PQ_query_param_uint64 (&ppc->last_recoup_serial_id),
GNUNET_PQ_query_param_uint64 (&ppc->last_payback_refresh_serial_id), GNUNET_PQ_query_param_uint64 (&ppc->last_recoup_refresh_serial_id),
GNUNET_PQ_query_param_end GNUNET_PQ_query_param_end
}; };
@ -1863,8 +1863,8 @@ postgres_update_auditor_progress_coin (void *cls,
GNUNET_PQ_query_param_uint64 (&ppc->last_deposit_serial_id), GNUNET_PQ_query_param_uint64 (&ppc->last_deposit_serial_id),
GNUNET_PQ_query_param_uint64 (&ppc->last_melt_serial_id), GNUNET_PQ_query_param_uint64 (&ppc->last_melt_serial_id),
GNUNET_PQ_query_param_uint64 (&ppc->last_refund_serial_id), GNUNET_PQ_query_param_uint64 (&ppc->last_refund_serial_id),
GNUNET_PQ_query_param_uint64 (&ppc->last_payback_serial_id), GNUNET_PQ_query_param_uint64 (&ppc->last_recoup_serial_id),
GNUNET_PQ_query_param_uint64 (&ppc->last_payback_refresh_serial_id), GNUNET_PQ_query_param_uint64 (&ppc->last_recoup_refresh_serial_id),
GNUNET_PQ_query_param_auto_from_type (master_pub), GNUNET_PQ_query_param_auto_from_type (master_pub),
GNUNET_PQ_query_param_end GNUNET_PQ_query_param_end
}; };
@ -1906,10 +1906,10 @@ postgres_get_auditor_progress_coin (void *cls,
&ppc->last_melt_serial_id), &ppc->last_melt_serial_id),
GNUNET_PQ_result_spec_uint64 ("last_refund_serial_id", GNUNET_PQ_result_spec_uint64 ("last_refund_serial_id",
&ppc->last_refund_serial_id), &ppc->last_refund_serial_id),
GNUNET_PQ_result_spec_uint64 ("last_payback_serial_id", GNUNET_PQ_result_spec_uint64 ("last_recoup_serial_id",
&ppc->last_payback_serial_id), &ppc->last_recoup_serial_id),
GNUNET_PQ_result_spec_uint64 ("last_payback_refresh_serial_id", GNUNET_PQ_result_spec_uint64 ("last_recoup_refresh_serial_id",
&ppc->last_payback_refresh_serial_id), &ppc->last_recoup_refresh_serial_id),
GNUNET_PQ_result_spec_end GNUNET_PQ_result_spec_end
}; };
@ -2541,7 +2541,7 @@ postgres_get_wire_fee_summary (void *cls,
* @param denom_balance value of coins outstanding with this denomination key * @param denom_balance value of coins outstanding with this denomination key
* @param denom_loss value of coins redeemed that were not outstanding (effectively, negative @a denom_balance) * @param denom_loss value of coins redeemed that were not outstanding (effectively, negative @a denom_balance)
* @param denom_risk value of coins issued with this denomination key * @param denom_risk value of coins issued with this denomination key
* @param payback_loss losses from payback (if this denomination was revoked) * @param recoup_loss losses from recoup (if this denomination was revoked)
* @param num_issued how many coins of this denomination did the exchange blind-sign * @param num_issued how many coins of this denomination did the exchange blind-sign
* @return transaction status code * @return transaction status code
*/ */
@ -2553,7 +2553,7 @@ postgres_insert_denomination_balance (void *cls,
const struct TALER_Amount *denom_balance, const struct TALER_Amount *denom_balance,
const struct TALER_Amount *denom_loss, const struct TALER_Amount *denom_loss,
const struct TALER_Amount *denom_risk, const struct TALER_Amount *denom_risk,
const struct TALER_Amount *payback_loss, const struct TALER_Amount *recoup_loss,
uint64_t num_issued) uint64_t num_issued)
{ {
struct GNUNET_PQ_QueryParam params[] = { struct GNUNET_PQ_QueryParam params[] = {
@ -2562,7 +2562,7 @@ postgres_insert_denomination_balance (void *cls,
TALER_PQ_query_param_amount (denom_loss), TALER_PQ_query_param_amount (denom_loss),
GNUNET_PQ_query_param_uint64 (&num_issued), GNUNET_PQ_query_param_uint64 (&num_issued),
TALER_PQ_query_param_amount (denom_risk), TALER_PQ_query_param_amount (denom_risk),
TALER_PQ_query_param_amount (payback_loss), TALER_PQ_query_param_amount (recoup_loss),
GNUNET_PQ_query_param_end GNUNET_PQ_query_param_end
}; };
@ -2583,7 +2583,7 @@ postgres_insert_denomination_balance (void *cls,
* @param denom_balance value of coins outstanding with this denomination key * @param denom_balance value of coins outstanding with this denomination key
* @param denom_loss value of coins redeemed that were not outstanding (effectively, negative @a denom_balance) * @param denom_loss value of coins redeemed that were not outstanding (effectively, negative @a denom_balance)
* @param denom_risk value of coins issued with this denomination key * @param denom_risk value of coins issued with this denomination key
* @param payback_loss losses from payback (if this denomination was revoked) * @param recoup_loss losses from recoup (if this denomination was revoked)
* @param num_issued how many coins of this denomination did the exchange blind-sign * @param num_issued how many coins of this denomination did the exchange blind-sign
* @return transaction status code * @return transaction status code
*/ */
@ -2595,7 +2595,7 @@ postgres_update_denomination_balance (void *cls,
const struct TALER_Amount *denom_balance, const struct TALER_Amount *denom_balance,
const struct TALER_Amount *denom_loss, const struct TALER_Amount *denom_loss,
const struct TALER_Amount *denom_risk, const struct TALER_Amount *denom_risk,
const struct TALER_Amount *payback_loss, const struct TALER_Amount *recoup_loss,
uint64_t num_issued) uint64_t num_issued)
{ {
struct GNUNET_PQ_QueryParam params[] = { struct GNUNET_PQ_QueryParam params[] = {
@ -2603,7 +2603,7 @@ postgres_update_denomination_balance (void *cls,
TALER_PQ_query_param_amount (denom_loss), TALER_PQ_query_param_amount (denom_loss),
GNUNET_PQ_query_param_uint64 (&num_issued), GNUNET_PQ_query_param_uint64 (&num_issued),
TALER_PQ_query_param_amount (denom_risk), TALER_PQ_query_param_amount (denom_risk),
TALER_PQ_query_param_amount (payback_loss), TALER_PQ_query_param_amount (recoup_loss),
GNUNET_PQ_query_param_auto_from_type (denom_pub_hash), GNUNET_PQ_query_param_auto_from_type (denom_pub_hash),
GNUNET_PQ_query_param_end GNUNET_PQ_query_param_end
}; };
@ -2624,7 +2624,7 @@ postgres_update_denomination_balance (void *cls,
* @param[out] denom_balance value of coins outstanding with this denomination key * @param[out] denom_balance value of coins outstanding with this denomination key
* @param[out] denom_risk value of coins issued with this denomination key * @param[out] denom_risk value of coins issued with this denomination key
* @param[out] denom_loss value of coins redeemed that were not outstanding (effectively, negative @a denom_balance) * @param[out] denom_loss value of coins redeemed that were not outstanding (effectively, negative @a denom_balance)
* @param[out] payback_loss losses from payback (if this denomination was revoked) * @param[out] recoup_loss losses from recoup (if this denomination was revoked)
* @param[out] num_issued how many coins of this denomination did the exchange blind-sign * @param[out] num_issued how many coins of this denomination did the exchange blind-sign
* @return transaction status code * @return transaction status code
*/ */
@ -2635,7 +2635,7 @@ postgres_get_denomination_balance (void *cls,
struct TALER_Amount *denom_balance, struct TALER_Amount *denom_balance,
struct TALER_Amount *denom_loss, struct TALER_Amount *denom_loss,
struct TALER_Amount *denom_risk, struct TALER_Amount *denom_risk,
struct TALER_Amount *payback_loss, struct TALER_Amount *recoup_loss,
uint64_t *num_issued) uint64_t *num_issued)
{ {
struct PostgresClosure *pg = cls; struct PostgresClosure *pg = cls;
@ -2647,7 +2647,7 @@ postgres_get_denomination_balance (void *cls,
TALER_PQ_RESULT_SPEC_AMOUNT ("denom_balance", denom_balance), TALER_PQ_RESULT_SPEC_AMOUNT ("denom_balance", denom_balance),
TALER_PQ_RESULT_SPEC_AMOUNT ("denom_loss", denom_loss), TALER_PQ_RESULT_SPEC_AMOUNT ("denom_loss", denom_loss),
TALER_PQ_RESULT_SPEC_AMOUNT ("denom_risk", denom_risk), TALER_PQ_RESULT_SPEC_AMOUNT ("denom_risk", denom_risk),
TALER_PQ_RESULT_SPEC_AMOUNT ("payback_loss", payback_loss), TALER_PQ_RESULT_SPEC_AMOUNT ("recoup_loss", recoup_loss),
GNUNET_PQ_result_spec_uint64 ("num_issued", num_issued), GNUNET_PQ_result_spec_uint64 ("num_issued", num_issued),
GNUNET_PQ_result_spec_end GNUNET_PQ_result_spec_end
}; };
@ -2672,8 +2672,8 @@ postgres_get_denomination_balance (void *cls,
* @param melt_fee_balance total melt fees collected for this DK * @param melt_fee_balance total melt fees collected for this DK
* @param refund_fee_balance total refund fees collected for this DK * @param refund_fee_balance total refund fees collected for this DK
* @param risk maximum risk exposure of the exchange * @param risk maximum risk exposure of the exchange
* @param loss materialized @a risk from payback * @param loss materialized @a risk from recoup
* @param irregular_payback paybacks on non-revoked coins * @param irregular_recoup recoups on non-revoked coins
* @return transaction status code * @return transaction status code
*/ */
static enum GNUNET_DB_QueryStatus static enum GNUNET_DB_QueryStatus
@ -2687,7 +2687,7 @@ postgres_insert_balance_summary (void *cls,
const struct TALER_Amount *refund_fee_balance, const struct TALER_Amount *refund_fee_balance,
const struct TALER_Amount *risk, const struct TALER_Amount *risk,
const struct TALER_Amount *loss, const struct TALER_Amount *loss,
const struct TALER_Amount *irregular_payback) const struct TALER_Amount *irregular_recoup)
{ {
struct GNUNET_PQ_QueryParam params[] = { struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (master_pub), GNUNET_PQ_query_param_auto_from_type (master_pub),
@ -2697,7 +2697,7 @@ postgres_insert_balance_summary (void *cls,
TALER_PQ_query_param_amount (refund_fee_balance), TALER_PQ_query_param_amount (refund_fee_balance),
TALER_PQ_query_param_amount (risk), TALER_PQ_query_param_amount (risk),
TALER_PQ_query_param_amount (loss), TALER_PQ_query_param_amount (loss),
TALER_PQ_query_param_amount (irregular_payback), TALER_PQ_query_param_amount (irregular_recoup),
GNUNET_PQ_query_param_end GNUNET_PQ_query_param_end
}; };
@ -2731,8 +2731,8 @@ postgres_insert_balance_summary (void *cls,
* @param melt_fee_balance total melt fees collected for this DK * @param melt_fee_balance total melt fees collected for this DK
* @param refund_fee_balance total refund fees collected for this DK * @param refund_fee_balance total refund fees collected for this DK
* @param risk maximum risk exposure of the exchange * @param risk maximum risk exposure of the exchange
* @param loss materialized @a risk from payback * @param loss materialized @a risk from recoup
* @param irregular_payback paybacks made on non-revoked coins * @param irregular_recoup recoups made on non-revoked coins
* @return transaction status code * @return transaction status code
*/ */
static enum GNUNET_DB_QueryStatus static enum GNUNET_DB_QueryStatus
@ -2746,7 +2746,7 @@ postgres_update_balance_summary (void *cls,
const struct TALER_Amount *refund_fee_balance, const struct TALER_Amount *refund_fee_balance,
const struct TALER_Amount *risk, const struct TALER_Amount *risk,
const struct TALER_Amount *loss, const struct TALER_Amount *loss,
const struct TALER_Amount *irregular_payback) const struct TALER_Amount *irregular_recoup)
{ {
struct GNUNET_PQ_QueryParam params[] = { struct GNUNET_PQ_QueryParam params[] = {
TALER_PQ_query_param_amount (denom_balance), TALER_PQ_query_param_amount (denom_balance),
@ -2755,7 +2755,7 @@ postgres_update_balance_summary (void *cls,
TALER_PQ_query_param_amount (refund_fee_balance), TALER_PQ_query_param_amount (refund_fee_balance),
TALER_PQ_query_param_amount (risk), TALER_PQ_query_param_amount (risk),
TALER_PQ_query_param_amount (loss), TALER_PQ_query_param_amount (loss),
TALER_PQ_query_param_amount (irregular_payback), TALER_PQ_query_param_amount (irregular_recoup),
GNUNET_PQ_query_param_auto_from_type (master_pub), GNUNET_PQ_query_param_auto_from_type (master_pub),
GNUNET_PQ_query_param_end GNUNET_PQ_query_param_end
}; };
@ -2778,8 +2778,8 @@ postgres_update_balance_summary (void *cls,
* @param[out] melt_fee_balance total melt fees collected for this DK * @param[out] melt_fee_balance total melt fees collected for this DK
* @param[out] refund_fee_balance total refund fees collected for this DK * @param[out] refund_fee_balance total refund fees collected for this DK
* @param[out] risk maximum risk exposure of the exchange * @param[out] risk maximum risk exposure of the exchange
* @param[out] loss losses from payback (on revoked denominations) * @param[out] loss losses from recoup (on revoked denominations)
* @param[out] irregular_payback paybacks on NOT revoked denominations * @param[out] irregular_recoup recoups on NOT revoked denominations
* @return transaction status code * @return transaction status code
*/ */
static enum GNUNET_DB_QueryStatus static enum GNUNET_DB_QueryStatus
@ -2792,7 +2792,7 @@ postgres_get_balance_summary (void *cls,
struct TALER_Amount *refund_fee_balance, struct TALER_Amount *refund_fee_balance,
struct TALER_Amount *risk, struct TALER_Amount *risk,
struct TALER_Amount *loss, struct TALER_Amount *loss,
struct TALER_Amount *irregular_payback) struct TALER_Amount *irregular_recoup)
{ {
struct PostgresClosure *pg = cls; struct PostgresClosure *pg = cls;
struct GNUNET_PQ_QueryParam params[] = { struct GNUNET_PQ_QueryParam params[] = {
@ -2806,7 +2806,7 @@ postgres_get_balance_summary (void *cls,
TALER_PQ_RESULT_SPEC_AMOUNT ("refund_fee_balance", refund_fee_balance), TALER_PQ_RESULT_SPEC_AMOUNT ("refund_fee_balance", refund_fee_balance),
TALER_PQ_RESULT_SPEC_AMOUNT ("risk", risk), TALER_PQ_RESULT_SPEC_AMOUNT ("risk", risk),
TALER_PQ_RESULT_SPEC_AMOUNT ("loss", loss), TALER_PQ_RESULT_SPEC_AMOUNT ("loss", loss),
TALER_PQ_RESULT_SPEC_AMOUNT ("irregular_payback", irregular_payback), TALER_PQ_RESULT_SPEC_AMOUNT ("irregular_recoup", irregular_recoup),
GNUNET_PQ_result_spec_end GNUNET_PQ_result_spec_end
}; };

View File

@ -1133,7 +1133,7 @@ create_wire_fees ()
/** /**
* Revoke the denomination key matching @a hc and request /payback to be * Revoke the denomination key matching @a hc and request /recoup to be
* initiated. * initiated.
* *
* @param hc denomination key hash to revoke * @param hc denomination key hash to revoke
@ -1443,7 +1443,7 @@ main (int argc,
GNUNET_GETOPT_option_base32_auto ('r', GNUNET_GETOPT_option_base32_auto ('r',
"revoke", "revoke",
"DKH", "DKH",
"revoke denomination key hash (DKH) and request wallets to initiate /payback", "revoke denomination key hash (DKH) and request wallets to initiate /recoup",
&revoke_dkh), &revoke_dkh),
GNUNET_GETOPT_option_absolute_time ('t', GNUNET_GETOPT_option_absolute_time ('t',
"time", "time",

View File

@ -54,7 +54,7 @@ taler_exchange_httpd_SOURCES = \
taler-exchange-httpd_deposit.c taler-exchange-httpd_deposit.h \ taler-exchange-httpd_deposit.c taler-exchange-httpd_deposit.h \
taler-exchange-httpd_keystate.c taler-exchange-httpd_keystate.h \ taler-exchange-httpd_keystate.c taler-exchange-httpd_keystate.h \
taler-exchange-httpd_mhd.c taler-exchange-httpd_mhd.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_link.c taler-exchange-httpd_refresh_link.h \
taler-exchange-httpd_refresh_melt.c taler-exchange-httpd_refresh_melt.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 \ taler-exchange-httpd_refresh_reveal.c taler-exchange-httpd_refresh_reveal.h \

View File

@ -32,7 +32,7 @@
#include "taler-exchange-httpd_refund.h" #include "taler-exchange-httpd_refund.h"
#include "taler-exchange-httpd_reserve_status.h" #include "taler-exchange-httpd_reserve_status.h"
#include "taler-exchange-httpd_reserve_withdraw.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_link.h"
#include "taler-exchange-httpd_refresh_melt.h" #include "taler-exchange-httpd_refresh_melt.h"
#include "taler-exchange-httpd_refresh_reveal.h" #include "taler-exchange-httpd_refresh_reveal.h"
@ -341,9 +341,9 @@ handle_mhd_request (void *cls,
"Only POST is allowed", 0, "Only POST is allowed", 0,
&TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED }, &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, NULL, 0,
&TEH_PAYBACK_handler_payback, MHD_HTTP_OK }, &TEH_RECOUP_handler_recoup, MHD_HTTP_OK },
{ "/refresh/link", NULL, "text/plain", { "/refresh/link", NULL, "text/plain",
"Only GET is allowed", 0, "Only GET is allowed", 0,
&TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED }, &TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED },

View File

@ -182,7 +182,7 @@ deposit_transaction (void *cls,
/* Start with fee for THIS transaction */ /* Start with fee for THIS transaction */
spent = deposit->amount_with_fee; 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 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. */ pub of a revoked coin (aka a zombie), then ONLY refresh is allowed. */
qs = TEH_plugin->get_coin_transactions (TEH_plugin->cls, qs = TEH_plugin->get_coin_transactions (TEH_plugin->cls,

View File

@ -230,7 +230,7 @@ struct ResponseFactoryContext
* always returns the full list (cherry picking does not apply * always returns the full list (cherry picking does not apply
* for key revocations, as we cannot sort those by issue date). * 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 * 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 static void
destroy_response_factory (struct ResponseFactoryContext *rfc) destroy_response_factory (struct ResponseFactoryContext *rfc)
{ {
if (NULL != rfc->payback_array) if (NULL != rfc->recoup_array)
{ {
json_decref (rfc->payback_array); json_decref (rfc->recoup_array);
rfc->payback_array = NULL; rfc->recoup_array = NULL;
} }
if (NULL != rfc->sign_keys_array) if (NULL != rfc->sign_keys_array)
{ {
@ -912,7 +912,7 @@ revocations_iter (void *cls,
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
GNUNET_assert (0 == GNUNET_assert (0 ==
json_array_append_new (rfc->payback_array, json_array_append_new (rfc->recoup_array,
GNUNET_JSON_from_data_auto ( GNUNET_JSON_from_data_auto (
denom_hash))); denom_hash)));
return GNUNET_OK; 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", GNUNET_JSON_from_time_rel (
reserve_closing_delay), reserve_closing_delay),
"signkeys", rfc->sign_keys_array, "signkeys", rfc->sign_keys_array,
"payback", rfc->payback_array, "recoup", rfc->recoup_array,
/* 6-10 */ /* 6-10 */
"denoms", rbc.denom_keys_array, "denoms", rbc.denom_keys_array,
"auditors", rbc.auditors_array, "auditors", rbc.auditors_array,
@ -1660,8 +1660,8 @@ make_fresh_key_state (struct GNUNET_TIME_Absolute now)
memset (&rfc, memset (&rfc,
0, 0,
sizeof (rfc)); sizeof (rfc));
rfc.payback_array = json_array (); rfc.recoup_array = json_array ();
if (NULL == rfc.payback_array) if (NULL == rfc.recoup_array)
{ {
GNUNET_break (0); GNUNET_break (0);
return NULL; return NULL;
@ -1670,7 +1670,7 @@ make_fresh_key_state (struct GNUNET_TIME_Absolute now)
if (NULL == rfc.sign_keys_array) if (NULL == rfc.sign_keys_array)
{ {
GNUNET_break (0); GNUNET_break (0);
json_decref (rfc.payback_array); json_decref (rfc.recoup_array);
return NULL; return NULL;
} }
@ -1689,7 +1689,7 @@ make_fresh_key_state (struct GNUNET_TIME_Absolute now)
"Loading keys from `%s'\n", "Loading keys from `%s'\n",
TEH_exchange_directory); TEH_exchange_directory);
/* Initialize the 'denomkey_map' and the 'revoked_map' and /* Initialize the 'denomkey_map' and the 'revoked_map' and
'rfc.payback_array' */ 'rfc.recoup_array' */
if (-1 == if (-1 ==
TALER_EXCHANGEDB_denomination_keys_iterate (TEH_exchange_directory, TALER_EXCHANGEDB_denomination_keys_iterate (TEH_exchange_directory,
&reload_keys_denom_iter, &reload_keys_denom_iter,
@ -1700,7 +1700,7 @@ make_fresh_key_state (struct GNUNET_TIME_Absolute now)
TEH_exchange_directory); TEH_exchange_directory);
key_state->refcnt = 1; key_state->refcnt = 1;
ks_release (key_state); ks_release (key_state);
json_decref (rfc.payback_array); json_decref (rfc.recoup_array);
json_decref (rfc.sign_keys_array); json_decref (rfc.sign_keys_array);
return NULL; return NULL;
} }
@ -1726,7 +1726,7 @@ make_fresh_key_state (struct GNUNET_TIME_Absolute now)
TEH_exchange_directory); TEH_exchange_directory);
key_state->refcnt = 1; key_state->refcnt = 1;
ks_release (key_state); ks_release (key_state);
json_decref (rfc.payback_array); json_decref (rfc.recoup_array);
json_decref (rfc.sign_keys_array); json_decref (rfc.sign_keys_array);
return NULL; return NULL;
} }
@ -1982,7 +1982,7 @@ TEH_KS_denomination_key_lookup_by_hash (const struct
struct GNUNET_TIME_Absolute now; struct GNUNET_TIME_Absolute now;
const struct GNUNET_CONTAINER_MultiHashMap *map; 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; key_state->denomkey_map;
dki = GNUNET_CONTAINER_multihashmap_get (map, dki = GNUNET_CONTAINER_multihashmap_get (map,
denom_pub_hash); denom_pub_hash);
@ -1994,11 +1994,11 @@ TEH_KS_denomination_key_lookup_by_hash (const struct
*hc = MHD_HTTP_NOT_FOUND; *hc = MHD_HTTP_NOT_FOUND;
switch (use) switch (use)
{ {
case TEH_KS_DKU_PAYBACK: case TEH_KS_DKU_RECOUP:
*ec = TALER_EC_PAYBACK_DENOMINATION_KEY_UNKNOWN; *ec = TALER_EC_RECOUP_DENOMINATION_KEY_UNKNOWN;
break; break;
case TEH_KS_DKU_ZOMBIE: case TEH_KS_DKU_ZOMBIE:
*ec = TALER_EC_REFRESH_PAYBACK_DENOMINATION_KEY_NOT_FOUND; *ec = TALER_EC_REFRESH_RECOUP_DENOMINATION_KEY_NOT_FOUND;
break; break;
case TEH_KS_DKU_WITHDRAW: case TEH_KS_DKU_WITHDRAW:
*ec = TALER_EC_WITHDRAW_DENOMINATION_KEY_NOT_FOUND; *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; *hc = MHD_HTTP_PRECONDITION_FAILED;
switch (use) switch (use)
{ {
case TEH_KS_DKU_PAYBACK: case TEH_KS_DKU_RECOUP:
*ec = TALER_EC_PAYBACK_DENOMINATION_VALIDITY_IN_FUTURE; *ec = TALER_EC_RECOUP_DENOMINATION_VALIDITY_IN_FUTURE;
break; break;
case TEH_KS_DKU_ZOMBIE: case TEH_KS_DKU_ZOMBIE:
*ec = TALER_EC_REFRESH_PAYBACK_DENOMINATION_VALIDITY_IN_FUTURE; *ec = TALER_EC_REFRESH_RECOUP_DENOMINATION_VALIDITY_IN_FUTURE;
break; break;
case TEH_KS_DKU_WITHDRAW: case TEH_KS_DKU_WITHDRAW:
*ec = TALER_EC_WITHDRAW_VALIDITY_IN_FUTURE; *ec = TALER_EC_WITHDRAW_VALIDITY_IN_FUTURE;
@ -2072,15 +2072,15 @@ TEH_KS_denomination_key_lookup_by_hash (const struct
return NULL; return NULL;
} }
break; break;
case TEH_KS_DKU_PAYBACK: case TEH_KS_DKU_RECOUP:
if (now.abs_value_us > if (now.abs_value_us >
GNUNET_TIME_absolute_ntoh ( GNUNET_TIME_absolute_ntoh (
dki->issue.properties.expire_deposit).abs_value_us) dki->issue.properties.expire_deposit).abs_value_us)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_INFO, 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)); GNUNET_h2s (denom_pub_hash));
*ec = TALER_EC_REFRESH_PAYBACK_DENOMINATION_EXPIRED; *ec = TALER_EC_REFRESH_RECOUP_DENOMINATION_EXPIRED;
*hc = MHD_HTTP_GONE; *hc = MHD_HTTP_GONE;
return NULL; return NULL;
} }

View File

@ -110,14 +110,14 @@ enum TEH_KS_DenominationKeyUse
TEH_KS_DKU_DEPOSIT, 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 * 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 TEH_KS_DKU_ZOMBIE

View File

@ -14,8 +14,8 @@
TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/ */
/** /**
* @file taler-exchange-httpd_payback.c * @file taler-exchange-httpd_recoup.c
* @brief Handle /payback requests; parses the POST and JSON and * @brief Handle /recoup requests; parses the POST and JSON and
* verifies the coin signature before handing things off * verifies the coin signature before handing things off
* to the database. * to the database.
* @author Christian Grothoff * @author Christian Grothoff
@ -28,38 +28,38 @@
#include <pthread.h> #include <pthread.h>
#include "taler_json_lib.h" #include "taler_json_lib.h"
#include "taler_mhd_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_responses.h"
#include "taler-exchange-httpd_keystate.h" #include "taler-exchange-httpd_keystate.h"
#include "taler-exchange-httpd_validation.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 connection connection to the client
* @param coin_pub coin for which we are processing the payback request * @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 payback * @param old_coin_pub public key of the old coin that will receive the recoup
* @param amount the amount we will wire back * @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 * @return MHD result code
*/ */
static int static int
reply_payback_refresh_success (struct MHD_Connection *connection, reply_recoup_refresh_success (struct MHD_Connection *connection,
const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct const struct
TALER_CoinSpendPublicKeyP *old_coin_pub, TALER_CoinSpendPublicKeyP *old_coin_pub,
const struct TALER_Amount *amount, const struct TALER_Amount *amount,
struct GNUNET_TIME_Absolute timestamp) struct GNUNET_TIME_Absolute timestamp)
{ {
struct TALER_PaybackRefreshConfirmationPS pc; struct TALER_RecoupRefreshConfirmationPS pc;
struct TALER_ExchangePublicKeyP pub; struct TALER_ExchangePublicKeyP pub;
struct TALER_ExchangeSignatureP sig; struct TALER_ExchangeSignatureP sig;
pc.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_PAYBACK_REFRESH); pc.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_RECOUP_REFRESH);
pc.purpose.size = htonl (sizeof (struct TALER_PaybackRefreshConfirmationPS)); pc.purpose.size = htonl (sizeof (struct TALER_RecoupRefreshConfirmationPS));
pc.timestamp = GNUNET_TIME_absolute_hton (timestamp); pc.timestamp = GNUNET_TIME_absolute_hton (timestamp);
TALER_amount_hton (&pc.payback_amount, TALER_amount_hton (&pc.recoup_amount,
amount); amount);
pc.coin_pub = *coin_pub; pc.coin_pub = *coin_pub;
pc.old_coin_pub = *old_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 connection connection to the client
* @param coin_pub coin for which we are processing the payback request * @param coin_pub coin for which we are processing the recoup request
* @param reserve_pub public key of the reserve that will receive the payback * @param reserve_pub public key of the reserve that will receive the recoup
* @param amount the amount we will wire back * @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 * @return MHD result code
*/ */
static int static int
reply_payback_success (struct MHD_Connection *connection, reply_recoup_success (struct MHD_Connection *connection,
const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_ReservePublicKeyP *reserve_pub, const struct TALER_ReservePublicKeyP *reserve_pub,
const struct TALER_Amount *amount, const struct TALER_Amount *amount,
struct GNUNET_TIME_Absolute timestamp) struct GNUNET_TIME_Absolute timestamp)
{ {
struct TALER_PaybackConfirmationPS pc; struct TALER_RecoupConfirmationPS pc;
struct TALER_ExchangePublicKeyP pub; struct TALER_ExchangePublicKeyP pub;
struct TALER_ExchangeSignatureP sig; struct TALER_ExchangeSignatureP sig;
pc.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_PAYBACK); pc.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_RECOUP);
pc.purpose.size = htonl (sizeof (struct TALER_PaybackConfirmationPS)); pc.purpose.size = htonl (sizeof (struct TALER_RecoupConfirmationPS));
pc.timestamp = GNUNET_TIME_absolute_hton (timestamp); pc.timestamp = GNUNET_TIME_absolute_hton (timestamp);
TALER_amount_hton (&pc.payback_amount, TALER_amount_hton (&pc.recoup_amount,
amount); amount);
pc.coin_pub = *coin_pub; pc.coin_pub = *coin_pub;
pc.reserve_pub = *reserve_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. * Hash of the blinded coin.
@ -170,32 +170,32 @@ struct PaybackContext
const struct TALER_DenominationBlindingKeyP *coin_bks; const struct TALER_DenominationBlindingKeyP *coin_bks;
/** /**
* Signature of the coin requesting payback. * Signature of the coin requesting recoup.
*/ */
const struct TALER_CoinSpendSignatureP *coin_sig; const struct TALER_CoinSpendSignatureP *coin_sig;
union union
{ {
/** /**
* Set by #payback_transaction() to the reserve that will * Set by #recoup_transaction() to the reserve that will
* receive the payback, if #refreshed is #GNUNET_NO. * receive the recoup, if #refreshed is #GNUNET_NO.
*/ */
struct TALER_ReservePublicKeyP reserve_pub; struct TALER_ReservePublicKeyP reserve_pub;
/** /**
* Set by #payback_transaction() to the old coin that will * Set by #recoup_transaction() to the old coin that will
* receive the payback, if #refreshed is #GNUNET_YES. * receive the recoup, if #refreshed is #GNUNET_YES.
*/ */
struct TALER_CoinSpendPublicKeyP old_coin_pub; struct TALER_CoinSpendPublicKeyP old_coin_pub;
} target; } 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; 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. * was accepted.
*/ */
struct GNUNET_TIME_Absolute now; 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 * already been checked. The database must now check that the coin is
* not (double) spent, and execute the transaction. * 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 * it returns the soft error code, the function MAY be called again to
* retry and MUST not queue a MHD response. * 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 connection MHD request which triggered the transaction
* @param session database session to use * @param session database session to use
* @param[out] mhd_ret set to MHD response status for @a connection, * @param[out] mhd_ret set to MHD response status for @a connection,
@ -227,17 +227,17 @@ struct PaybackContext
* @return transaction status code * @return transaction status code
*/ */
static enum GNUNET_DB_QueryStatus static enum GNUNET_DB_QueryStatus
payback_transaction (void *cls, recoup_transaction (void *cls,
struct MHD_Connection *connection, struct MHD_Connection *connection,
struct TALER_EXCHANGEDB_Session *session, struct TALER_EXCHANGEDB_Session *session,
int *mhd_ret) int *mhd_ret)
{ {
struct PaybackContext *pc = cls; struct RecoupContext *pc = cls;
struct TALER_EXCHANGEDB_TransactionList *tl; struct TALER_EXCHANGEDB_TransactionList *tl;
struct TALER_Amount spent; struct TALER_Amount spent;
enum GNUNET_DB_QueryStatus qs; 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 */ reserve / account the money should go */
if (pc->refreshed) if (pc->refreshed)
{ {
@ -252,7 +252,7 @@ payback_transaction (void *cls,
GNUNET_break (0); GNUNET_break (0);
*mhd_ret = TALER_MHD_reply_with_error (connection, *mhd_ret = TALER_MHD_reply_with_error (connection,
MHD_HTTP_INTERNAL_SERVER_ERROR, 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"); "failed to fetch old coin of blind coin");
} }
return qs; return qs;
@ -271,7 +271,7 @@ payback_transaction (void *cls,
GNUNET_break (0); GNUNET_break (0);
*mhd_ret = TALER_MHD_reply_with_error (connection, *mhd_ret = TALER_MHD_reply_with_error (connection,
MHD_HTTP_INTERNAL_SERVER_ERROR, MHD_HTTP_INTERNAL_SERVER_ERROR,
TALER_EC_PAYBACK_DB_FETCH_FAILED, TALER_EC_RECOUP_DB_FETCH_FAILED,
"failed to fetch reserve of blinded coin"); "failed to fetch reserve of blinded coin");
} }
return qs; return qs;
@ -280,16 +280,16 @@ payback_transaction (void *cls,
if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs) if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_INFO, 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)); GNUNET_h2s (&pc->h_blind));
*mhd_ret = TALER_MHD_reply_with_error (connection, *mhd_ret = TALER_MHD_reply_with_error (connection,
MHD_HTTP_NOT_FOUND, MHD_HTTP_NOT_FOUND,
TALER_EC_PAYBACK_WITHDRAW_NOT_FOUND, TALER_EC_RECOUP_WITHDRAW_NOT_FOUND,
"blind coin unknown"); "blind coin unknown");
return GNUNET_DB_STATUS_HARD_ERROR; 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, qs = TEH_plugin->get_coin_transactions (TEH_plugin->cls,
session, session,
&pc->coin->coin_pub, &pc->coin->coin_pub,
@ -302,7 +302,7 @@ payback_transaction (void *cls,
GNUNET_break (0); GNUNET_break (0);
*mhd_ret = TALER_MHD_reply_with_error (connection, *mhd_ret = TALER_MHD_reply_with_error (connection,
MHD_HTTP_INTERNAL_SERVER_ERROR, MHD_HTTP_INTERNAL_SERVER_ERROR,
TALER_EC_PAYBACK_DB_FETCH_FAILED, TALER_EC_RECOUP_DB_FETCH_FAILED,
"failed to fetch old coin transaction history"); "failed to fetch old coin transaction history");
} }
return qs; return qs;
@ -321,7 +321,7 @@ payback_transaction (void *cls,
tl); tl);
*mhd_ret = TALER_MHD_reply_with_error (connection, *mhd_ret = TALER_MHD_reply_with_error (connection,
MHD_HTTP_INTERNAL_SERVER_ERROR, MHD_HTTP_INTERNAL_SERVER_ERROR,
TALER_EC_PAYBACK_HISTORY_DB_ERROR, TALER_EC_RECOUP_HISTORY_DB_ERROR,
"failed to calculate old coin transaction history"); "failed to calculate old coin transaction history");
return GNUNET_DB_STATUS_HARD_ERROR; return GNUNET_DB_STATUS_HARD_ERROR;
} }
@ -335,7 +335,7 @@ payback_transaction (void *cls,
tl); tl);
*mhd_ret = TALER_MHD_reply_with_error (connection, *mhd_ret = TALER_MHD_reply_with_error (connection,
MHD_HTTP_INTERNAL_SERVER_ERROR, MHD_HTTP_INTERNAL_SERVER_ERROR,
TALER_EC_PAYBACK_COIN_BALANCE_NEGATIVE, TALER_EC_RECOUP_COIN_BALANCE_NEGATIVE,
"calculated negative old coin balance"); "calculated negative old coin balance");
return GNUNET_DB_STATUS_HARD_ERROR; return GNUNET_DB_STATUS_HARD_ERROR;
} }
@ -345,7 +345,7 @@ payback_transaction (void *cls,
TEH_plugin->rollback (TEH_plugin->cls, TEH_plugin->rollback (TEH_plugin->cls,
session); session);
*mhd_ret = TEH_RESPONSE_reply_coin_insufficient_funds (connection, *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, &pc->coin->coin_pub,
tl); tl);
TEH_plugin->free_coin_transaction_list (TEH_plugin->cls, TEH_plugin->free_coin_transaction_list (TEH_plugin->cls,
@ -357,39 +357,39 @@ payback_transaction (void *cls,
pc->now = GNUNET_TIME_absolute_get (); pc->now = GNUNET_TIME_absolute_get ();
(void) GNUNET_TIME_round_abs (&pc->now); (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) if (pc->refreshed)
{ {
qs = TEH_plugin->insert_payback_refresh_request (TEH_plugin->cls, qs = TEH_plugin->insert_recoup_refresh_request (TEH_plugin->cls,
session, session,
pc->coin, pc->coin,
pc->coin_sig, pc->coin_sig,
pc->coin_bks, pc->coin_bks,
&pc->amount, &pc->amount,
&pc->h_blind, &pc->h_blind,
pc->now); pc->now);
} }
else else
{ {
qs = TEH_plugin->insert_payback_request (TEH_plugin->cls, qs = TEH_plugin->insert_recoup_request (TEH_plugin->cls,
session, session,
&pc->target.reserve_pub, &pc->target.reserve_pub,
pc->coin, pc->coin,
pc->coin_sig, pc->coin_sig,
pc->coin_bks, pc->coin_bks,
&pc->amount, &pc->amount,
&pc->h_blind, &pc->h_blind,
pc->now); pc->now);
} }
if (0 > qs) if (0 > qs)
{ {
if (GNUNET_DB_STATUS_HARD_ERROR == 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_ret = TALER_MHD_reply_with_error (connection,
MHD_HTTP_INTERNAL_SERVER_ERROR, MHD_HTTP_INTERNAL_SERVER_ERROR,
TALER_EC_PAYBACK_DB_PUT_FAILED, TALER_EC_RECOUP_DB_PUT_FAILED,
"failed to persist payback data"); "failed to persist recoup data");
} }
return qs; 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 * 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 * Note that we need the DB to check the fee structure, so this is not
* done here. * done here.
* *
@ -412,23 +412,23 @@ payback_transaction (void *cls,
* @return MHD result code * @return MHD result code
*/ */
static int static int
verify_and_execute_payback (struct MHD_Connection *connection, verify_and_execute_recoup (struct MHD_Connection *connection,
const struct TALER_CoinPublicInfo *coin, const struct TALER_CoinPublicInfo *coin,
const struct const struct
TALER_DenominationBlindingKeyP *coin_bks, TALER_DenominationBlindingKeyP *coin_bks,
const struct TALER_CoinSpendSignatureP *coin_sig, const struct TALER_CoinSpendSignatureP *coin_sig,
int refreshed) int refreshed)
{ {
struct PaybackContext pc; struct RecoupContext pc;
const struct TALER_EXCHANGEDB_DenominationKeyIssueInformation *dki; const struct TALER_EXCHANGEDB_DenominationKeyIssueInformation *dki;
struct TALER_PaybackRequestPS pr; struct TALER_RecoupRequestPS pr;
struct GNUNET_HashCode c_hash; struct GNUNET_HashCode c_hash;
char *coin_ev; char *coin_ev;
size_t coin_ev_size; size_t coin_ev_size;
enum TALER_ErrorCode ec; enum TALER_ErrorCode ec;
unsigned int hc; 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; 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, dki = TEH_KS_denomination_key_lookup_by_hash (key_state,
&coin->denom_pub_hash, &coin->denom_pub_hash,
TEH_KS_DKU_PAYBACK, TEH_KS_DKU_RECOUP,
&ec, &ec,
&hc); &hc);
if (NULL == dki) if (NULL == dki)
{ {
TEH_KS_release (key_state); TEH_KS_release (key_state);
TALER_LOG_WARNING ( 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, return TALER_MHD_reply_with_error (connection,
hc, hc,
ec, ec,
"denomination not allowing payback"); "denomination not allowing recoup");
} }
TALER_amount_ntoh (&pc.value, TALER_amount_ntoh (&pc.value,
&dki->issue.properties.value); &dki->issue.properties.value);
@ -464,32 +464,32 @@ verify_and_execute_payback (struct MHD_Connection *connection,
TALER_test_coin_valid (coin, TALER_test_coin_valid (coin,
&dki->denom_pub)) &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); TEH_KS_release (key_state);
return TALER_MHD_reply_with_error (connection, return TALER_MHD_reply_with_error (connection,
MHD_HTTP_FORBIDDEN, MHD_HTTP_FORBIDDEN,
TALER_EC_PAYBACK_DENOMINATION_SIGNATURE_INVALID, TALER_EC_RECOUP_DENOMINATION_SIGNATURE_INVALID,
"denom_sig"); "denom_sig");
} }
/* check payback request signature */ /* check recoup request signature */
pr.purpose.purpose = htonl (TALER_SIGNATURE_WALLET_COIN_PAYBACK); pr.purpose.purpose = htonl (TALER_SIGNATURE_WALLET_COIN_RECOUP);
pr.purpose.size = htonl (sizeof (struct TALER_PaybackRequestPS)); pr.purpose.size = htonl (sizeof (struct TALER_RecoupRequestPS));
pr.coin_pub = coin->coin_pub; pr.coin_pub = coin->coin_pub;
pr.h_denom_pub = dki->issue.properties.denom_hash; pr.h_denom_pub = dki->issue.properties.denom_hash;
pr.coin_blind = *coin_bks; pr.coin_blind = *coin_bks;
if (GNUNET_OK != if (GNUNET_OK !=
GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_WALLET_COIN_PAYBACK, GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_WALLET_COIN_RECOUP,
&pr.purpose, &pr.purpose,
&coin_sig->eddsa_signature, &coin_sig->eddsa_signature,
&coin->coin_pub.eddsa_pub)) &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); TEH_KS_release (key_state);
return TALER_MHD_reply_with_error (connection, return TALER_MHD_reply_with_error (connection,
MHD_HTTP_FORBIDDEN, MHD_HTTP_FORBIDDEN,
TALER_EC_PAYBACK_SIGNATURE_INVALID, TALER_EC_RECOUP_SIGNATURE_INVALID,
"coin_sig"); "coin_sig");
} }
GNUNET_CRYPTO_hash (&coin->coin_pub.eddsa_pub, 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); TEH_KS_release (key_state);
return TALER_MHD_reply_with_error (connection, return TALER_MHD_reply_with_error (connection,
MHD_HTTP_INTERNAL_SERVER_ERROR, MHD_HTTP_INTERNAL_SERVER_ERROR,
TALER_EC_PAYBACK_BLINDING_FAILED, TALER_EC_RECOUP_BLINDING_FAILED,
"coin_bks"); "coin_bks");
} }
TEH_KS_release (key_state); TEH_KS_release (key_state);
@ -525,7 +525,7 @@ verify_and_execute_payback (struct MHD_Connection *connection,
kcc.connection = connection; kcc.connection = connection;
if (GNUNET_OK != if (GNUNET_OK !=
TEH_DB_run_transaction (connection, TEH_DB_run_transaction (connection,
"know coin for payback", "know coin for recoup",
&mhd_ret, &mhd_ret,
&TEH_DB_know_coin_transaction, &TEH_DB_know_coin_transaction,
&kcc)) &kcc))
@ -541,29 +541,29 @@ verify_and_execute_payback (struct MHD_Connection *connection,
if (GNUNET_OK != if (GNUNET_OK !=
TEH_DB_run_transaction (connection, TEH_DB_run_transaction (connection,
"run payback", "run recoup",
&mhd_ret, &mhd_ret,
&payback_transaction, &recoup_transaction,
&pc)) &pc))
return mhd_ret; return mhd_ret;
} }
return (refreshed) return (refreshed)
? reply_payback_refresh_success (connection, ? reply_recoup_refresh_success (connection,
&coin->coin_pub, &coin->coin_pub,
&pc.target.old_coin_pub, &pc.target.old_coin_pub,
&pc.amount, &pc.amount,
pc.now) pc.now)
: reply_payback_success (connection, : reply_recoup_success (connection,
&coin->coin_pub, &coin->coin_pub,
&pc.target.reserve_pub, &pc.target.reserve_pub,
&pc.amount, &pc.amount,
pc.now); pc.now);
} }
/** /**
* Handle a "/payback" request. Parses the JSON, and, if successful, * Handle a "/recoup" request. Parses the JSON, and, if successful,
* passes the JSON data to #verify_and_execute_payback() to * passes the JSON data to #verify_and_execute_recoup() to
* further check the details of the operation specified. If * further check the details of the operation specified. If
* everything checks out, this will ultimately lead to the "/refund" * everything checks out, this will ultimately lead to the "/refund"
* being executed, or rejected. * being executed, or rejected.
@ -576,11 +576,11 @@ verify_and_execute_payback (struct MHD_Connection *connection,
* @return MHD result code * @return MHD result code
*/ */
int int
TEH_PAYBACK_handler_payback (struct TEH_RequestHandler *rh, TEH_RECOUP_handler_recoup (struct TEH_RequestHandler *rh,
struct MHD_Connection *connection, struct MHD_Connection *connection,
void **connection_cls, void **connection_cls,
const char *upload_data, const char *upload_data,
size_t *upload_data_size) size_t *upload_data_size)
{ {
json_t *json; json_t *json;
int res; int res;
@ -623,14 +623,14 @@ TEH_PAYBACK_handler_payback (struct TEH_RequestHandler *rh,
return MHD_NO; /* hard failure */ return MHD_NO; /* hard failure */
if (GNUNET_NO == res) if (GNUNET_NO == res)
return MHD_YES; /* failure */ return MHD_YES; /* failure */
res = verify_and_execute_payback (connection, res = verify_and_execute_recoup (connection,
&coin, &coin,
&coin_bks, &coin_bks,
&coin_sig, &coin_sig,
refreshed); refreshed);
GNUNET_JSON_parse_free (spec); GNUNET_JSON_parse_free (spec);
return res; return res;
} }
/* end of taler-exchange-httpd_payback.c */ /* end of taler-exchange-httpd_recoup.c */

View File

@ -14,12 +14,12 @@
TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/ */
/** /**
* @file taler-exchange-httpd_payback.h * @file taler-exchange-httpd_recoup.h
* @brief Handle /payback requests * @brief Handle /recoup requests
* @author Christian Grothoff * @author Christian Grothoff
*/ */
#ifndef TALER_EXCHANGE_HTTPD_PAYBACK_H #ifndef TALER_EXCHANGE_HTTPD_RECOUP_H
#define TALER_EXCHANGE_HTTPD_PAYBACK_H #define TALER_EXCHANGE_HTTPD_RECOUP_H
#include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_util_lib.h>
#include <microhttpd.h> #include <microhttpd.h>
@ -27,8 +27,8 @@
/** /**
* Handle a "/payback" request. Parses the JSON, and, if successful, * Handle a "/recoup" request. Parses the JSON, and, if successful,
* passes the JSON data to #verify_and_execute_payback() to * passes the JSON data to #verify_and_execute_recoup() to
* further check the details of the operation specified. If * further check the details of the operation specified. If
* everything checks out, this will ultimately lead to the "/refund" * everything checks out, this will ultimately lead to the "/refund"
* being executed, or rejected. * being executed, or rejected.
@ -41,11 +41,11 @@
* @return MHD result code * @return MHD result code
*/ */
int int
TEH_PAYBACK_handler_payback (struct TEH_RequestHandler *rh, TEH_RECOUP_handler_recoup (struct TEH_RequestHandler *rh,
struct MHD_Connection *connection, struct MHD_Connection *connection,
void **connection_cls, void **connection_cls,
const char *upload_data, const char *upload_data,
size_t *upload_data_size); size_t *upload_data_size);
#endif #endif

View File

@ -156,7 +156,7 @@ struct RefreshMeltContext
/** /**
* Set to #GNUNET_YES if this coin's denomination was revoked and the operation * Set to #GNUNET_YES if this coin's denomination was revoked and the operation
* is thus only allowed for zombie coins where the transaction * 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; int zombie_required;
@ -186,7 +186,7 @@ refresh_check_melt (struct MHD_Connection *connection,
/* Start with cost of this melt transaction */ /* Start with cost of this melt transaction */
spent = rmc->refresh_session.amount_with_fee; 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 */ we might be a zombie coin */
qs = TEH_plugin->get_coin_transactions (TEH_plugin->cls, qs = TEH_plugin->get_coin_transactions (TEH_plugin->cls,
session, session,
@ -208,7 +208,7 @@ refresh_check_melt (struct MHD_Connection *connection,
NULL != tp; NULL != tp;
tp = tp->next) 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! */ rmc->zombie_required = GNUNET_NO; /* was satisfied! */
break; break;
@ -471,7 +471,7 @@ check_for_denomination_key (struct MHD_Connection *connection,
dki = TEH_KS_denomination_key_lookup_by_hash (key_state, dki = TEH_KS_denomination_key_lookup_by_hash (key_state,
&rmc->refresh_session.coin. &rmc->refresh_session.coin.
denom_pub_hash, denom_pub_hash,
TEH_KS_DKU_PAYBACK, TEH_KS_DKU_RECOUP,
&ec, &ec,
&hc); &hc);
if (NULL != dki) if (NULL != dki)
@ -504,7 +504,7 @@ check_for_denomination_key (struct MHD_Connection *connection,
} }
/* Consider the case that the denomination expired for deposits, /* 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. */ and we should thus allow the refresh during the legal period. */
if (NULL == dki) if (NULL == dki)
{ {

View File

@ -263,14 +263,14 @@ refund_transaction (void *cls,
} }
} }
break; break;
case TALER_EXCHANGEDB_TT_OLD_COIN_PAYBACK: case TALER_EXCHANGEDB_TT_OLD_COIN_RECOUP:
/* Paybacks cannot be refunded, ignore here */ /* Recoups cannot be refunded, ignore here */
break; break;
case TALER_EXCHANGEDB_TT_PAYBACK: case TALER_EXCHANGEDB_TT_RECOUP:
/* Paybacks cannot be refunded, ignore here */ /* Recoups cannot be refunded, ignore here */
break; break;
case TALER_EXCHANGEDB_TT_PAYBACK_REFRESH: case TALER_EXCHANGEDB_TT_RECOUP_REFRESH:
/* Paybacks cannot be refunded, ignore here */ /* Recoups cannot be refunded, ignore here */
break; break;
} }
} }

View File

@ -249,19 +249,19 @@ TEH_RESPONSE_compile_transaction_history (const struct
} }
} }
break; break;
case TALER_EXCHANGEDB_TT_OLD_COIN_PAYBACK: case TALER_EXCHANGEDB_TT_OLD_COIN_RECOUP:
{ {
struct TALER_EXCHANGEDB_PaybackRefreshListEntry *pr = struct TALER_EXCHANGEDB_RecoupRefreshListEntry *pr =
pos->details.old_coin_payback; pos->details.old_coin_recoup;
struct TALER_PaybackRefreshConfirmationPS pc; struct TALER_RecoupRefreshConfirmationPS pc;
struct TALER_ExchangePublicKeyP epub; struct TALER_ExchangePublicKeyP epub;
struct TALER_ExchangeSignatureP esig; struct TALER_ExchangeSignatureP esig;
pc.purpose.purpose = htonl ( pc.purpose.purpose = htonl (
TALER_SIGNATURE_EXCHANGE_CONFIRM_PAYBACK_REFRESH); TALER_SIGNATURE_EXCHANGE_CONFIRM_RECOUP_REFRESH);
pc.purpose.size = htonl (sizeof (pc)); pc.purpose.size = htonl (sizeof (pc));
pc.timestamp = GNUNET_TIME_absolute_hton (pr->timestamp); pc.timestamp = GNUNET_TIME_absolute_hton (pr->timestamp);
TALER_amount_hton (&pc.payback_amount, TALER_amount_hton (&pc.recoup_amount,
&pr->value); &pr->value);
pc.coin_pub = *coin_pub; pc.coin_pub = *coin_pub;
pc.old_coin_pub = pr->old_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 != strictly unnecessary. */if (0 !=
json_array_append_new (history, json_array_append_new (history,
json_pack ("{s:s, s:o, s:o, s:o, s:o, s:o}", 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 ( "amount", TALER_JSON_from_amount (
&pr->value), &pr->value),
"exchange_sig", "exchange_sig",
@ -303,21 +303,21 @@ TEH_RESPONSE_compile_transaction_history (const struct
} }
break; break;
} }
case TALER_EXCHANGEDB_TT_PAYBACK: case TALER_EXCHANGEDB_TT_RECOUP:
{ {
const struct TALER_EXCHANGEDB_PaybackListEntry *payback = const struct TALER_EXCHANGEDB_RecoupListEntry *recoup =
pos->details.payback; pos->details.recoup;
struct TALER_PaybackConfirmationPS pc; struct TALER_RecoupConfirmationPS pc;
struct TALER_ExchangePublicKeyP epub; struct TALER_ExchangePublicKeyP epub;
struct TALER_ExchangeSignatureP esig; 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.purpose.size = htonl (sizeof (pc));
pc.timestamp = GNUNET_TIME_absolute_hton (payback->timestamp); pc.timestamp = GNUNET_TIME_absolute_hton (recoup->timestamp);
TALER_amount_hton (&pc.payback_amount, TALER_amount_hton (&pc.recoup_amount,
&payback->value); &recoup->value);
pc.coin_pub = *coin_pub; pc.coin_pub = *coin_pub;
pc.reserve_pub = payback->reserve_pub; pc.reserve_pub = recoup->reserve_pub;
if (GNUNET_OK != if (GNUNET_OK !=
TEH_KS_sign (&pc.purpose, TEH_KS_sign (&pc.purpose,
&epub, &epub,
@ -330,9 +330,9 @@ TEH_RESPONSE_compile_transaction_history (const struct
if (0 != if (0 !=
json_array_append_new (history, json_array_append_new (history,
json_pack ("{s:s, s:o, s:o, s:o, s:o, s:o}", json_pack ("{s:s, s:o, s:o, s:o, s:o, s:o}",
"type", "PAYBACK", "type", "RECOUP",
"amount", TALER_JSON_from_amount ( "amount", TALER_JSON_from_amount (
&payback->value), &recoup->value),
"exchange_sig", "exchange_sig",
GNUNET_JSON_from_data_auto ( GNUNET_JSON_from_data_auto (
&esig), &esig),
@ -341,10 +341,10 @@ TEH_RESPONSE_compile_transaction_history (const struct
&epub), &epub),
"reserve_pub", "reserve_pub",
GNUNET_JSON_from_data_auto ( GNUNET_JSON_from_data_auto (
&payback->reserve_pub), &recoup->reserve_pub),
"timestamp", "timestamp",
GNUNET_JSON_from_time_abs ( GNUNET_JSON_from_time_abs (
payback->timestamp)))) recoup->timestamp))))
{ {
GNUNET_break (0); GNUNET_break (0);
json_decref (history); json_decref (history);
@ -352,19 +352,19 @@ TEH_RESPONSE_compile_transaction_history (const struct
} }
} }
break; break;
case TALER_EXCHANGEDB_TT_PAYBACK_REFRESH: case TALER_EXCHANGEDB_TT_RECOUP_REFRESH:
{ {
struct TALER_EXCHANGEDB_PaybackRefreshListEntry *pr = struct TALER_EXCHANGEDB_RecoupRefreshListEntry *pr =
pos->details.payback_refresh; pos->details.recoup_refresh;
struct TALER_PaybackRefreshConfirmationPS pc; struct TALER_RecoupRefreshConfirmationPS pc;
struct TALER_ExchangePublicKeyP epub; struct TALER_ExchangePublicKeyP epub;
struct TALER_ExchangeSignatureP esig; struct TALER_ExchangeSignatureP esig;
pc.purpose.purpose = htonl ( pc.purpose.purpose = htonl (
TALER_SIGNATURE_EXCHANGE_CONFIRM_PAYBACK_REFRESH); TALER_SIGNATURE_EXCHANGE_CONFIRM_RECOUP_REFRESH);
pc.purpose.size = htonl (sizeof (pc)); pc.purpose.size = htonl (sizeof (pc));
pc.timestamp = GNUNET_TIME_absolute_hton (pr->timestamp); pc.timestamp = GNUNET_TIME_absolute_hton (pr->timestamp);
TALER_amount_hton (&pc.payback_amount, TALER_amount_hton (&pc.recoup_amount,
&pr->value); &pr->value);
pc.coin_pub = *coin_pub; pc.coin_pub = *coin_pub;
pc.old_coin_pub = pr->old_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 != strictly unnecessary. */if (0 !=
json_array_append_new (history, json_array_append_new (history,
json_pack ("{s:s, s:o, s:o, s:o, s:o, s:o}", 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 ( "amount", TALER_JSON_from_amount (
&pr->value), &pr->value),
"exchange_sig", "exchange_sig",
@ -566,33 +566,33 @@ TEH_RESPONSE_compile_reserve_history (const struct
} }
} }
break; break;
case TALER_EXCHANGEDB_RO_PAYBACK_COIN: case TALER_EXCHANGEDB_RO_RECOUP_COIN:
{ {
const struct TALER_EXCHANGEDB_Payback *payback; const struct TALER_EXCHANGEDB_Recoup *recoup;
struct TALER_PaybackConfirmationPS pc; struct TALER_RecoupConfirmationPS pc;
struct TALER_ExchangePublicKeyP pub; struct TALER_ExchangePublicKeyP pub;
struct TALER_ExchangeSignatureP sig; struct TALER_ExchangeSignatureP sig;
payback = pos->details.payback; recoup = pos->details.recoup;
if (0 == (1 & ret)) if (0 == (1 & ret))
deposit_total = payback->value; deposit_total = recoup->value;
else if (GNUNET_OK != else if (GNUNET_OK !=
TALER_amount_add (&deposit_total, TALER_amount_add (&deposit_total,
&deposit_total, &deposit_total,
&payback->value)) &recoup->value))
{ {
GNUNET_break (0); GNUNET_break (0);
json_decref (json_history); json_decref (json_history);
return NULL; return NULL;
} }
ret |= 1; ret |= 1;
pc.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_PAYBACK); pc.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_RECOUP);
pc.purpose.size = htonl (sizeof (struct TALER_PaybackConfirmationPS)); pc.purpose.size = htonl (sizeof (struct TALER_RecoupConfirmationPS));
pc.timestamp = GNUNET_TIME_absolute_hton (payback->timestamp); pc.timestamp = GNUNET_TIME_absolute_hton (recoup->timestamp);
TALER_amount_hton (&pc.payback_amount, TALER_amount_hton (&pc.recoup_amount,
&payback->value); &recoup->value);
pc.coin_pub = payback->coin.coin_pub; pc.coin_pub = recoup->coin.coin_pub;
pc.reserve_pub = payback->reserve_pub; pc.reserve_pub = recoup->reserve_pub;
if (GNUNET_OK != if (GNUNET_OK !=
TEH_KS_sign (&pc.purpose, TEH_KS_sign (&pc.purpose,
&pub, &pub,
@ -606,19 +606,19 @@ TEH_RESPONSE_compile_reserve_history (const struct
if (0 != if (0 !=
json_array_append_new (json_history, json_array_append_new (json_history,
json_pack ("{s:s, s:o, s:o, s:o, s:o, s:o}", json_pack ("{s:s, s:o, s:o, s:o, s:o, s:o}",
"type", "PAYBACK", "type", "RECOUP",
"exchange_pub", "exchange_pub",
GNUNET_JSON_from_data_auto (&pub), GNUNET_JSON_from_data_auto (&pub),
"exchange_sig", "exchange_sig",
GNUNET_JSON_from_data_auto (&sig), GNUNET_JSON_from_data_auto (&sig),
"timestamp", "timestamp",
GNUNET_JSON_from_time_abs ( GNUNET_JSON_from_time_abs (
payback->timestamp), recoup->timestamp),
"amount", TALER_JSON_from_amount ( "amount", TALER_JSON_from_amount (
&payback->value), &recoup->value),
"coin_pub", "coin_pub",
GNUNET_JSON_from_data_auto ( GNUNET_JSON_from_data_auto (
&payback->coin.coin_pub)))) &recoup->coin.coin_pub))))
{ {
GNUNET_break (0); GNUNET_break (0);
json_decref (json_history); json_decref (json_history);

View File

@ -305,10 +305,10 @@ CREATE TABLE IF NOT EXISTS wire_fee
CREATE INDEX wire_fee_gc_index CREATE INDEX wire_fee_gc_index
ON wire_fee ON wire_fee
(end_date); (end_date);
-- Table for /payback information -- Table for /recoup information
-- Do not cascade on the coin_pub, as we may keep the coin alive! */ -- Do not cascade on the coin_pub, as we may keep the coin alive! */
CREATE TABLE IF NOT EXISTS payback CREATE TABLE IF NOT EXISTS recoup
(payback_uuid BIGSERIAL UNIQUE (recoup_uuid BIGSERIAL UNIQUE
,coin_pub BYTEA NOT NULL REFERENCES known_coins (coin_pub) ,coin_pub BYTEA NOT NULL REFERENCES known_coins (coin_pub)
,coin_sig BYTEA NOT NULL CHECK(LENGTH(coin_sig)=64) ,coin_sig BYTEA NOT NULL CHECK(LENGTH(coin_sig)=64)
,coin_blind BYTEA NOT NULL CHECK(LENGTH(coin_blind)=32) ,coin_blind BYTEA NOT NULL CHECK(LENGTH(coin_blind)=32)
@ -317,21 +317,21 @@ CREATE TABLE IF NOT EXISTS payback
,timestamp INT8 NOT NULL ,timestamp INT8 NOT NULL
,h_blind_ev BYTEA NOT NULL REFERENCES reserves_out (h_blind_ev) ON DELETE CASCADE ,h_blind_ev BYTEA NOT NULL REFERENCES reserves_out (h_blind_ev) ON DELETE CASCADE
); );
CREATE INDEX payback_by_coin_index CREATE INDEX recoup_by_coin_index
ON payback ON recoup
(coin_pub); (coin_pub);
CREATE INDEX payback_by_h_blind_ev CREATE INDEX recoup_by_h_blind_ev
ON payback ON recoup
(h_blind_ev); (h_blind_ev);
CREATE INDEX payback_for_by_reserve CREATE INDEX recoup_for_by_reserve
ON payback ON recoup
(coin_pub (coin_pub
,h_blind_ev ,h_blind_ev
); );
-- Table for /payback-refresh information -- Table for /recoup-refresh information
-- Do not cascade on the coin_pub, as we may keep the coin alive! */ -- Do not cascade on the coin_pub, as we may keep the coin alive! */
CREATE TABLE IF NOT EXISTS payback_refresh CREATE TABLE IF NOT EXISTS recoup_refresh
(payback_refresh_uuid BIGSERIAL UNIQUE (recoup_refresh_uuid BIGSERIAL UNIQUE
,coin_pub BYTEA NOT NULL REFERENCES known_coins (coin_pub) ,coin_pub BYTEA NOT NULL REFERENCES known_coins (coin_pub)
,coin_sig BYTEA NOT NULL CHECK(LENGTH(coin_sig)=64) ,coin_sig BYTEA NOT NULL CHECK(LENGTH(coin_sig)=64)
,coin_blind BYTEA NOT NULL CHECK(LENGTH(coin_blind)=32) ,coin_blind BYTEA NOT NULL CHECK(LENGTH(coin_blind)=32)
@ -340,14 +340,14 @@ CREATE TABLE IF NOT EXISTS payback_refresh
,timestamp INT8 NOT NULL ,timestamp INT8 NOT NULL
,h_blind_ev BYTEA NOT NULL REFERENCES refresh_revealed_coins (h_coin_ev) ON DELETE CASCADE ,h_blind_ev BYTEA NOT NULL REFERENCES refresh_revealed_coins (h_coin_ev) ON DELETE CASCADE
); );
CREATE INDEX payback_refresh_by_coin_index CREATE INDEX recoup_refresh_by_coin_index
ON payback_refresh ON recoup_refresh
(coin_pub); (coin_pub);
CREATE INDEX payback_refresh_by_h_blind_ev CREATE INDEX recoup_refresh_by_h_blind_ev
ON payback_refresh ON recoup_refresh
(h_blind_ev); (h_blind_ev);
CREATE INDEX payback_refresh_for_by_reserve CREATE INDEX recoup_refresh_for_by_reserve
ON payback_refresh ON recoup_refresh
(coin_pub (coin_pub
,h_blind_ev ,h_blind_ev
); );

View File

@ -50,7 +50,7 @@ GNUNET_NETWORK_STRUCT_END
/** /**
* Mark the given denomination key as revoked and request the wallets * Mark the given denomination key as revoked and request the wallets
* to initiate /payback. * to initiate /recoup.
* *
* @param revocation_dir where to write the revocation certificate * @param revocation_dir where to write the revocation certificate
* @param denom_hash hash of the denomination key to revoke * @param denom_hash hash of the denomination key to revoke

View File

@ -93,34 +93,34 @@ TALER_EXCHANGEDB_calculate_transaction_list_totals (struct
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
break; break;
case TALER_EXCHANGEDB_TT_OLD_COIN_PAYBACK: case TALER_EXCHANGEDB_TT_OLD_COIN_RECOUP:
/* refunded += pos->value */ /* refunded += pos->value */
if (GNUNET_OK != if (GNUNET_OK !=
TALER_amount_add (&refunded, TALER_amount_add (&refunded,
&refunded, &refunded,
&pos->details.old_coin_payback->value)) &pos->details.old_coin_recoup->value))
{ {
GNUNET_break (0); GNUNET_break (0);
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
break; break;
case TALER_EXCHANGEDB_TT_PAYBACK: case TALER_EXCHANGEDB_TT_RECOUP:
/* spent += pos->value */ /* spent += pos->value */
if (GNUNET_OK != if (GNUNET_OK !=
TALER_amount_add (&spent, TALER_amount_add (&spent,
&spent, &spent,
&pos->details.payback->value)) &pos->details.recoup->value))
{ {
GNUNET_break (0); GNUNET_break (0);
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
break; break;
case TALER_EXCHANGEDB_TT_PAYBACK_REFRESH: case TALER_EXCHANGEDB_TT_RECOUP_REFRESH:
/* spent += pos->value */ /* spent += pos->value */
if (GNUNET_OK != if (GNUNET_OK !=
TALER_amount_add (&spent, TALER_amount_add (&spent,
&spent, &spent,
&pos->details.payback_refresh->value)) &pos->details.recoup_refresh->value))
{ {
GNUNET_break (0); GNUNET_break (0);
return GNUNET_SYSERR; return GNUNET_SYSERR;

View File

@ -32,7 +32,7 @@ common_free_reserve_history (void *cls,
{ {
struct TALER_EXCHANGEDB_BankTransfer *bt; struct TALER_EXCHANGEDB_BankTransfer *bt;
struct TALER_EXCHANGEDB_CollectableBlindcoin *cbc; struct TALER_EXCHANGEDB_CollectableBlindcoin *cbc;
struct TALER_EXCHANGEDB_Payback *payback; struct TALER_EXCHANGEDB_Recoup *recoup;
struct TALER_EXCHANGEDB_ReserveHistory *backref; struct TALER_EXCHANGEDB_ReserveHistory *backref;
struct TALER_EXCHANGEDB_ClosingTransfer *closing; struct TALER_EXCHANGEDB_ClosingTransfer *closing;
@ -52,10 +52,10 @@ common_free_reserve_history (void *cls,
GNUNET_CRYPTO_rsa_signature_free (cbc->sig.rsa_signature); GNUNET_CRYPTO_rsa_signature_free (cbc->sig.rsa_signature);
GNUNET_free (cbc); GNUNET_free (cbc);
break; break;
case TALER_EXCHANGEDB_RO_PAYBACK_COIN: case TALER_EXCHANGEDB_RO_RECOUP_COIN:
payback = rh->details.payback; recoup = rh->details.recoup;
GNUNET_CRYPTO_rsa_signature_free (payback->coin.denom_sig.rsa_signature); GNUNET_CRYPTO_rsa_signature_free (recoup->coin.denom_sig.rsa_signature);
GNUNET_free (payback); GNUNET_free (recoup);
break; break;
case TALER_EXCHANGEDB_RO_EXCHANGE_TO_BANK: case TALER_EXCHANGEDB_RO_EXCHANGE_TO_BANK:
closing = rh->details.closing; closing = rh->details.closing;
@ -97,23 +97,23 @@ common_free_coin_transaction_list (void *cls,
case TALER_EXCHANGEDB_TT_REFRESH_MELT: case TALER_EXCHANGEDB_TT_REFRESH_MELT:
GNUNET_free (list->details.melt); GNUNET_free (list->details.melt);
break; break;
case TALER_EXCHANGEDB_TT_OLD_COIN_PAYBACK: case TALER_EXCHANGEDB_TT_OLD_COIN_RECOUP:
if (NULL != list->details.payback_refresh->coin.denom_sig.rsa_signature) if (NULL != list->details.recoup_refresh->coin.denom_sig.rsa_signature)
GNUNET_CRYPTO_rsa_signature_free ( GNUNET_CRYPTO_rsa_signature_free (
list->details.payback_refresh->coin.denom_sig.rsa_signature); list->details.recoup_refresh->coin.denom_sig.rsa_signature);
GNUNET_free (list->details.old_coin_payback); GNUNET_free (list->details.old_coin_recoup);
break; break;
case TALER_EXCHANGEDB_TT_REFUND: case TALER_EXCHANGEDB_TT_REFUND:
GNUNET_free (list->details.refund); GNUNET_free (list->details.refund);
break; break;
case TALER_EXCHANGEDB_TT_PAYBACK: case TALER_EXCHANGEDB_TT_RECOUP:
GNUNET_free (list->details.payback); GNUNET_free (list->details.recoup);
break; break;
case TALER_EXCHANGEDB_TT_PAYBACK_REFRESH: case TALER_EXCHANGEDB_TT_RECOUP_REFRESH:
if (NULL != list->details.payback_refresh->coin.denom_sig.rsa_signature) if (NULL != list->details.recoup_refresh->coin.denom_sig.rsa_signature)
GNUNET_CRYPTO_rsa_signature_free ( GNUNET_CRYPTO_rsa_signature_free (
list->details.payback_refresh->coin.denom_sig.rsa_signature); list->details.recoup_refresh->coin.denom_sig.rsa_signature);
GNUNET_free (list->details.payback_refresh); GNUNET_free (list->details.recoup_refresh);
break; break;
} }
GNUNET_free (list); GNUNET_free (list);

View File

@ -1134,10 +1134,10 @@ postgres_get_session (void *cls)
" WHERE wireout_uuid>=$1 AND exchange_account_section=$2" " WHERE wireout_uuid>=$1 AND exchange_account_section=$2"
" ORDER BY wireout_uuid ASC;", " ORDER BY wireout_uuid ASC;",
2), 2),
/* Used in #postgres_insert_payback_request() to store payback /* Used in #postgres_insert_recoup_request() to store recoup
information */ information */
GNUNET_PQ_make_prepare ("payback_insert", GNUNET_PQ_make_prepare ("recoup_insert",
"INSERT INTO payback " "INSERT INTO recoup "
"(coin_pub" "(coin_pub"
",coin_sig" ",coin_sig"
",coin_blind" ",coin_blind"
@ -1148,10 +1148,10 @@ postgres_get_session (void *cls)
") VALUES " ") VALUES "
"($1, $2, $3, $4, $5, $6, $7);", "($1, $2, $3, $4, $5, $6, $7);",
7), 7),
/* Used in #postgres_insert_payback_request() to store payback-refresh /* Used in #postgres_insert_recoup_request() to store recoup-refresh
information */ information */
GNUNET_PQ_make_prepare ("payback_refresh_insert", GNUNET_PQ_make_prepare ("recoup_refresh_insert",
"INSERT INTO payback_refresh " "INSERT INTO recoup_refresh "
"(coin_pub" "(coin_pub"
",coin_sig" ",coin_sig"
",coin_blind" ",coin_blind"
@ -1162,10 +1162,10 @@ postgres_get_session (void *cls)
") VALUES " ") VALUES "
"($1, $2, $3, $4, $5, $6, $7);", "($1, $2, $3, $4, $5, $6, $7);",
7), 7),
/* Used in #postgres_select_payback_above_serial_id() to obtain payback transactions */ /* Used in #postgres_select_recoup_above_serial_id() to obtain recoup transactions */
GNUNET_PQ_make_prepare ("payback_get_incr", GNUNET_PQ_make_prepare ("recoup_get_incr",
"SELECT" "SELECT"
" payback_uuid" " recoup_uuid"
",timestamp" ",timestamp"
",ro.reserve_pub" ",ro.reserve_pub"
",coin_pub" ",coin_pub"
@ -1177,21 +1177,21 @@ postgres_get_session (void *cls)
",coins.denom_sig" ",coins.denom_sig"
",amount_val" ",amount_val"
",amount_frac" ",amount_frac"
" FROM payback" " FROM recoup"
" JOIN known_coins coins" " JOIN known_coins coins"
" USING (coin_pub)" " USING (coin_pub)"
" JOIN reserves_out ro" " JOIN reserves_out ro"
" USING (h_blind_ev)" " USING (h_blind_ev)"
" JOIN denominations denoms" " JOIN denominations denoms"
" ON (coins.denom_pub_hash = denoms.denom_pub_hash)" " ON (coins.denom_pub_hash = denoms.denom_pub_hash)"
" WHERE payback_uuid>=$1" " WHERE recoup_uuid>=$1"
" ORDER BY payback_uuid ASC;", " ORDER BY recoup_uuid ASC;",
1), 1),
/* Used in #postgres_select_payback_refresh_above_serial_id() to obtain /* Used in #postgres_select_recoup_refresh_above_serial_id() to obtain
payback-refresh transactions */ recoup-refresh transactions */
GNUNET_PQ_make_prepare ("payback_refresh_get_incr", GNUNET_PQ_make_prepare ("recoup_refresh_get_incr",
"SELECT" "SELECT"
" payback_refresh_uuid" " recoup_refresh_uuid"
",timestamp" ",timestamp"
",rc.old_coin_pub" ",rc.old_coin_pub"
",coin_pub" ",coin_pub"
@ -1203,7 +1203,7 @@ postgres_get_session (void *cls)
",coins.denom_sig" ",coins.denom_sig"
",amount_val" ",amount_val"
",amount_frac" ",amount_frac"
" FROM payback_refresh" " FROM recoup_refresh"
" JOIN refresh_revealed_coins rrc" " JOIN refresh_revealed_coins rrc"
" ON (rrc.coin_ev = h_blind_ev)" " ON (rrc.coin_ev = h_blind_ev)"
" JOIN refresh_commitments rc" " JOIN refresh_commitments rc"
@ -1212,8 +1212,8 @@ postgres_get_session (void *cls)
" USING (coin_pub)" " USING (coin_pub)"
" JOIN denominations denoms" " JOIN denominations denoms"
" ON (coins.denom_pub_hash = denoms.denom_pub_hash)" " ON (coins.denom_pub_hash = denoms.denom_pub_hash)"
" WHERE payback_refresh_uuid>=$1" " WHERE recoup_refresh_uuid>=$1"
" ORDER BY payback_refresh_uuid ASC;", " ORDER BY recoup_refresh_uuid ASC;",
1), 1),
/* Used in #postgres_select_reserve_closed_above_serial_id() to /* Used in #postgres_select_reserve_closed_above_serial_id() to
obtain information about closed reserves */ obtain information about closed reserves */
@ -1232,9 +1232,9 @@ postgres_get_session (void *cls)
" WHERE close_uuid>=$1" " WHERE close_uuid>=$1"
" ORDER BY close_uuid ASC;", " ORDER BY close_uuid ASC;",
1), 1),
/* Used in #postgres_get_reserve_history() to obtain payback transactions /* Used in #postgres_get_reserve_history() to obtain recoup transactions
for a reserve */ for a reserve */
GNUNET_PQ_make_prepare ("payback_by_reserve", GNUNET_PQ_make_prepare ("recoup_by_reserve",
"SELECT" "SELECT"
" coin_pub" " coin_pub"
",coin_sig" ",coin_sig"
@ -1244,7 +1244,7 @@ postgres_get_session (void *cls)
",timestamp" ",timestamp"
",coins.denom_pub_hash" ",coins.denom_pub_hash"
",coins.denom_sig" ",coins.denom_sig"
" FROM payback" " FROM recoup"
" JOIN known_coins coins" " JOIN known_coins coins"
" USING (coin_pub)" " USING (coin_pub)"
" JOIN reserves_out ro" " JOIN reserves_out ro"
@ -1252,9 +1252,9 @@ postgres_get_session (void *cls)
" WHERE ro.reserve_pub=$1" " WHERE ro.reserve_pub=$1"
" FOR UPDATE;", " FOR UPDATE;",
1), 1),
/* Used in #postgres_get_coin_transactions() to obtain payback transactions /* Used in #postgres_get_coin_transactions() to obtain recoup transactions
affecting old coins of refreshed coins */ affecting old coins of refreshed coins */
GNUNET_PQ_make_prepare ("payback_by_old_coin", GNUNET_PQ_make_prepare ("recoup_by_old_coin",
"SELECT" "SELECT"
" coin_pub" " coin_pub"
",coin_sig" ",coin_sig"
@ -1264,8 +1264,8 @@ postgres_get_session (void *cls)
",timestamp" ",timestamp"
",coins.denom_pub_hash" ",coins.denom_pub_hash"
",coins.denom_sig" ",coins.denom_sig"
",payback_refresh_uuid" ",recoup_refresh_uuid"
" FROM payback_refresh" " FROM recoup_refresh"
" JOIN known_coins coins" " JOIN known_coins coins"
" USING (coin_pub)" " USING (coin_pub)"
" WHERE h_blind_ev IN" " WHERE h_blind_ev IN"
@ -1305,9 +1305,9 @@ postgres_get_session (void *cls)
" ORDER BY expiration_date ASC" " ORDER BY expiration_date ASC"
" LIMIT 1;", " LIMIT 1;",
1), 1),
/* Used in #postgres_get_coin_transactions() to obtain payback transactions /* Used in #postgres_get_coin_transactions() to obtain recoup transactions
for a coin */ for a coin */
GNUNET_PQ_make_prepare ("payback_by_coin", GNUNET_PQ_make_prepare ("recoup_by_coin",
"SELECT" "SELECT"
" ro.reserve_pub" " ro.reserve_pub"
",coin_sig" ",coin_sig"
@ -1315,16 +1315,16 @@ postgres_get_session (void *cls)
",amount_val" ",amount_val"
",amount_frac" ",amount_frac"
",timestamp" ",timestamp"
",payback_uuid" ",recoup_uuid"
" FROM payback" " FROM recoup"
" JOIN reserves_out ro" " JOIN reserves_out ro"
" USING (h_blind_ev)" " USING (h_blind_ev)"
" WHERE payback.coin_pub=$1" " WHERE recoup.coin_pub=$1"
" FOR UPDATE;", " FOR UPDATE;",
1), 1),
/* Used in #postgres_get_coin_transactions() to obtain payback transactions /* Used in #postgres_get_coin_transactions() to obtain recoup transactions
for a refreshed coin */ for a refreshed coin */
GNUNET_PQ_make_prepare ("payback_by_refreshed_coin", GNUNET_PQ_make_prepare ("recoup_by_refreshed_coin",
"SELECT" "SELECT"
" rc.old_coin_pub" " rc.old_coin_pub"
",coin_sig" ",coin_sig"
@ -1334,8 +1334,8 @@ postgres_get_session (void *cls)
",timestamp" ",timestamp"
",coins.denom_pub_hash" ",coins.denom_pub_hash"
",coins.denom_sig" ",coins.denom_sig"
",payback_refresh_uuid" ",recoup_refresh_uuid"
" FROM payback_refresh" " FROM recoup_refresh"
" JOIN refresh_revealed_coins rrc" " JOIN refresh_revealed_coins rrc"
" ON (rrc.coin_ev = h_blind_ev)" " ON (rrc.coin_ev = h_blind_ev)"
" JOIN refresh_commitments rc" " JOIN refresh_commitments rc"
@ -2335,42 +2335,42 @@ add_withdraw_coin (void *cls,
/** /**
* Add paybacks to result set for #postgres_get_reserve_history. * Add recoups to result set for #postgres_get_reserve_history.
* *
* @param cls a `struct ReserveHistoryContext *` * @param cls a `struct ReserveHistoryContext *`
* @param result SQL result * @param result SQL result
* @param num_results number of rows in @a result * @param num_results number of rows in @a result
*/ */
static void static void
add_payback (void *cls, add_recoup (void *cls,
PGresult *result, PGresult *result,
unsigned int num_results) unsigned int num_results)
{ {
struct ReserveHistoryContext *rhc = cls; struct ReserveHistoryContext *rhc = cls;
struct PostgresClosure *pg = rhc->pg; struct PostgresClosure *pg = rhc->pg;
while (0 < num_results) while (0 < num_results)
{ {
struct TALER_EXCHANGEDB_Payback *payback; struct TALER_EXCHANGEDB_Recoup *recoup;
struct TALER_EXCHANGEDB_ReserveHistory *tail; struct TALER_EXCHANGEDB_ReserveHistory *tail;
payback = GNUNET_new (struct TALER_EXCHANGEDB_Payback); recoup = GNUNET_new (struct TALER_EXCHANGEDB_Recoup);
{ {
struct GNUNET_PQ_ResultSpec rs[] = { struct GNUNET_PQ_ResultSpec rs[] = {
TALER_PQ_RESULT_SPEC_AMOUNT ("amount", TALER_PQ_RESULT_SPEC_AMOUNT ("amount",
&payback->value), &recoup->value),
GNUNET_PQ_result_spec_auto_from_type ("coin_pub", GNUNET_PQ_result_spec_auto_from_type ("coin_pub",
&payback->coin.coin_pub), &recoup->coin.coin_pub),
GNUNET_PQ_result_spec_auto_from_type ("coin_blind", GNUNET_PQ_result_spec_auto_from_type ("coin_blind",
&payback->coin_blind), &recoup->coin_blind),
GNUNET_PQ_result_spec_auto_from_type ("coin_sig", GNUNET_PQ_result_spec_auto_from_type ("coin_sig",
&payback->coin_sig), &recoup->coin_sig),
TALER_PQ_result_spec_absolute_time ("timestamp", TALER_PQ_result_spec_absolute_time ("timestamp",
&payback->timestamp), &recoup->timestamp),
GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash", GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash",
&payback->coin.denom_pub_hash), &recoup->coin.denom_pub_hash),
GNUNET_PQ_result_spec_rsa_signature ("denom_sig", GNUNET_PQ_result_spec_rsa_signature ("denom_sig",
&payback->coin.denom_sig. &recoup->coin.denom_sig.
rsa_signature), rsa_signature),
GNUNET_PQ_result_spec_end GNUNET_PQ_result_spec_end
}; };
@ -2381,15 +2381,15 @@ add_payback (void *cls,
--num_results)) --num_results))
{ {
GNUNET_break (0); GNUNET_break (0);
GNUNET_free (payback); GNUNET_free (recoup);
rhc->status = GNUNET_SYSERR; rhc->status = GNUNET_SYSERR;
return; return;
} }
} }
payback->reserve_pub = *rhc->reserve_pub; recoup->reserve_pub = *rhc->reserve_pub;
tail = append_rh (rhc); tail = append_rh (rhc);
tail->type = TALER_EXCHANGEDB_RO_PAYBACK_COIN; tail->type = TALER_EXCHANGEDB_RO_RECOUP_COIN;
tail->details.payback = payback; tail->details.recoup = recoup;
} /* end of 'while (0 < rows)' */ } /* end of 'while (0 < rows)' */
} }
@ -2485,9 +2485,9 @@ postgres_get_reserve_history (void *cls,
/** #TALER_EXCHANGEDB_RO_WITHDRAW_COIN */ /** #TALER_EXCHANGEDB_RO_WITHDRAW_COIN */
{ "get_reserves_out", { "get_reserves_out",
&add_withdraw_coin }, &add_withdraw_coin },
/** #TALER_EXCHANGEDB_RO_PAYBACK_COIN */ /** #TALER_EXCHANGEDB_RO_RECOUP_COIN */
{ "payback_by_reserve", { "recoup_by_reserve",
&add_payback }, &add_recoup },
/** #TALER_EXCHANGEDB_RO_EXCHANGE_TO_BANK */ /** #TALER_EXCHANGEDB_RO_EXCHANGE_TO_BANK */
{ "close_by_reserve", { "close_by_reserve",
&add_exchange_to_bank }, &add_exchange_to_bank },
@ -4179,38 +4179,38 @@ add_coin_refund (void *cls,
* @param num_results the number of results in @a result * @param num_results the number of results in @a result
*/ */
static void static void
add_old_coin_payback (void *cls, add_old_coin_recoup (void *cls,
PGresult *result, PGresult *result,
unsigned int num_results) unsigned int num_results)
{ {
struct CoinHistoryContext *chc = cls; struct CoinHistoryContext *chc = cls;
struct PostgresClosure *pg = chc->pg; struct PostgresClosure *pg = chc->pg;
for (unsigned int i = 0; i<num_results; i++) for (unsigned int i = 0; i<num_results; i++)
{ {
struct TALER_EXCHANGEDB_PaybackRefreshListEntry *payback; struct TALER_EXCHANGEDB_RecoupRefreshListEntry *recoup;
struct TALER_EXCHANGEDB_TransactionList *tl; struct TALER_EXCHANGEDB_TransactionList *tl;
uint64_t serial_id; uint64_t serial_id;
payback = GNUNET_new (struct TALER_EXCHANGEDB_PaybackRefreshListEntry); recoup = GNUNET_new (struct TALER_EXCHANGEDB_RecoupRefreshListEntry);
{ {
struct GNUNET_PQ_ResultSpec rs[] = { struct GNUNET_PQ_ResultSpec rs[] = {
GNUNET_PQ_result_spec_auto_from_type ("coin_pub", GNUNET_PQ_result_spec_auto_from_type ("coin_pub",
&payback->coin.coin_pub), &recoup->coin.coin_pub),
GNUNET_PQ_result_spec_auto_from_type ("coin_sig", GNUNET_PQ_result_spec_auto_from_type ("coin_sig",
&payback->coin_sig), &recoup->coin_sig),
GNUNET_PQ_result_spec_auto_from_type ("coin_blind", GNUNET_PQ_result_spec_auto_from_type ("coin_blind",
&payback->coin_blind), &recoup->coin_blind),
TALER_PQ_RESULT_SPEC_AMOUNT ("amount", TALER_PQ_RESULT_SPEC_AMOUNT ("amount",
&payback->value), &recoup->value),
TALER_PQ_result_spec_absolute_time ("timestamp", TALER_PQ_result_spec_absolute_time ("timestamp",
&payback->timestamp), &recoup->timestamp),
GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash", GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash",
&payback->coin.denom_pub_hash), &recoup->coin.denom_pub_hash),
GNUNET_PQ_result_spec_rsa_signature ("denom_sig", GNUNET_PQ_result_spec_rsa_signature ("denom_sig",
&payback->coin.denom_sig. &recoup->coin.denom_sig.
rsa_signature), rsa_signature),
GNUNET_PQ_result_spec_uint64 ("payback_refresh_uuid", GNUNET_PQ_result_spec_uint64 ("recoup_refresh_uuid",
&serial_id), &serial_id),
GNUNET_PQ_result_spec_end GNUNET_PQ_result_spec_end
}; };
@ -4221,16 +4221,16 @@ add_old_coin_payback (void *cls,
i)) i))
{ {
GNUNET_break (0); GNUNET_break (0);
GNUNET_free (payback); GNUNET_free (recoup);
chc->status = GNUNET_DB_STATUS_HARD_ERROR; chc->status = GNUNET_DB_STATUS_HARD_ERROR;
return; return;
} }
payback->old_coin_pub = *chc->coin_pub; recoup->old_coin_pub = *chc->coin_pub;
} }
tl = GNUNET_new (struct TALER_EXCHANGEDB_TransactionList); tl = GNUNET_new (struct TALER_EXCHANGEDB_TransactionList);
tl->next = chc->head; tl->next = chc->head;
tl->type = TALER_EXCHANGEDB_TT_OLD_COIN_PAYBACK; tl->type = TALER_EXCHANGEDB_TT_OLD_COIN_RECOUP;
tl->details.old_coin_payback = payback; tl->details.old_coin_recoup = recoup;
tl->serial_id = serial_id; tl->serial_id = serial_id;
chc->head = tl; chc->head = tl;
} }
@ -4246,33 +4246,33 @@ add_old_coin_payback (void *cls,
* @param num_results the number of results in @a result * @param num_results the number of results in @a result
*/ */
static void static void
add_coin_payback (void *cls, add_coin_recoup (void *cls,
PGresult *result, PGresult *result,
unsigned int num_results) unsigned int num_results)
{ {
struct CoinHistoryContext *chc = cls; struct CoinHistoryContext *chc = cls;
struct PostgresClosure *pg = chc->pg; struct PostgresClosure *pg = chc->pg;
for (unsigned int i = 0; i<num_results; i++) for (unsigned int i = 0; i<num_results; i++)
{ {
struct TALER_EXCHANGEDB_PaybackListEntry *payback; struct TALER_EXCHANGEDB_RecoupListEntry *recoup;
struct TALER_EXCHANGEDB_TransactionList *tl; struct TALER_EXCHANGEDB_TransactionList *tl;
uint64_t serial_id; uint64_t serial_id;
payback = GNUNET_new (struct TALER_EXCHANGEDB_PaybackListEntry); recoup = GNUNET_new (struct TALER_EXCHANGEDB_RecoupListEntry);
{ {
struct GNUNET_PQ_ResultSpec rs[] = { struct GNUNET_PQ_ResultSpec rs[] = {
GNUNET_PQ_result_spec_auto_from_type ("reserve_pub", GNUNET_PQ_result_spec_auto_from_type ("reserve_pub",
&payback->reserve_pub), &recoup->reserve_pub),
GNUNET_PQ_result_spec_auto_from_type ("coin_sig", GNUNET_PQ_result_spec_auto_from_type ("coin_sig",
&payback->coin_sig), &recoup->coin_sig),
GNUNET_PQ_result_spec_auto_from_type ("coin_blind", GNUNET_PQ_result_spec_auto_from_type ("coin_blind",
&payback->coin_blind), &recoup->coin_blind),
TALER_PQ_RESULT_SPEC_AMOUNT ("amount", TALER_PQ_RESULT_SPEC_AMOUNT ("amount",
&payback->value), &recoup->value),
TALER_PQ_result_spec_absolute_time ("timestamp", TALER_PQ_result_spec_absolute_time ("timestamp",
&payback->timestamp), &recoup->timestamp),
GNUNET_PQ_result_spec_uint64 ("payback_uuid", GNUNET_PQ_result_spec_uint64 ("recoup_uuid",
&serial_id), &serial_id),
GNUNET_PQ_result_spec_end GNUNET_PQ_result_spec_end
}; };
@ -4283,15 +4283,15 @@ add_coin_payback (void *cls,
i)) i))
{ {
GNUNET_break (0); GNUNET_break (0);
GNUNET_free (payback); GNUNET_free (recoup);
chc->status = GNUNET_DB_STATUS_HARD_ERROR; chc->status = GNUNET_DB_STATUS_HARD_ERROR;
return; return;
} }
} }
tl = GNUNET_new (struct TALER_EXCHANGEDB_TransactionList); tl = GNUNET_new (struct TALER_EXCHANGEDB_TransactionList);
tl->next = chc->head; tl->next = chc->head;
tl->type = TALER_EXCHANGEDB_TT_PAYBACK; tl->type = TALER_EXCHANGEDB_TT_RECOUP;
tl->details.payback = payback; tl->details.recoup = recoup;
tl->serial_id = serial_id; tl->serial_id = serial_id;
chc->head = tl; chc->head = tl;
} }
@ -4307,38 +4307,38 @@ add_coin_payback (void *cls,
* @param num_results the number of results in @a result * @param num_results the number of results in @a result
*/ */
static void static void
add_coin_payback_refresh (void *cls, add_coin_recoup_refresh (void *cls,
PGresult *result, PGresult *result,
unsigned int num_results) unsigned int num_results)
{ {
struct CoinHistoryContext *chc = cls; struct CoinHistoryContext *chc = cls;
struct PostgresClosure *pg = chc->pg; struct PostgresClosure *pg = chc->pg;
for (unsigned int i = 0; i<num_results; i++) for (unsigned int i = 0; i<num_results; i++)
{ {
struct TALER_EXCHANGEDB_PaybackRefreshListEntry *payback; struct TALER_EXCHANGEDB_RecoupRefreshListEntry *recoup;
struct TALER_EXCHANGEDB_TransactionList *tl; struct TALER_EXCHANGEDB_TransactionList *tl;
uint64_t serial_id; uint64_t serial_id;
payback = GNUNET_new (struct TALER_EXCHANGEDB_PaybackRefreshListEntry); recoup = GNUNET_new (struct TALER_EXCHANGEDB_RecoupRefreshListEntry);
{ {
struct GNUNET_PQ_ResultSpec rs[] = { struct GNUNET_PQ_ResultSpec rs[] = {
GNUNET_PQ_result_spec_auto_from_type ("old_coin_pub", GNUNET_PQ_result_spec_auto_from_type ("old_coin_pub",
&payback->old_coin_pub), &recoup->old_coin_pub),
GNUNET_PQ_result_spec_auto_from_type ("coin_sig", GNUNET_PQ_result_spec_auto_from_type ("coin_sig",
&payback->coin_sig), &recoup->coin_sig),
GNUNET_PQ_result_spec_auto_from_type ("coin_blind", GNUNET_PQ_result_spec_auto_from_type ("coin_blind",
&payback->coin_blind), &recoup->coin_blind),
TALER_PQ_RESULT_SPEC_AMOUNT ("amount", TALER_PQ_RESULT_SPEC_AMOUNT ("amount",
&payback->value), &recoup->value),
TALER_PQ_result_spec_absolute_time ("timestamp", TALER_PQ_result_spec_absolute_time ("timestamp",
&payback->timestamp), &recoup->timestamp),
GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash", GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash",
&payback->coin.denom_pub_hash), &recoup->coin.denom_pub_hash),
GNUNET_PQ_result_spec_rsa_signature ("denom_sig", GNUNET_PQ_result_spec_rsa_signature ("denom_sig",
&payback->coin.denom_sig. &recoup->coin.denom_sig.
rsa_signature), rsa_signature),
GNUNET_PQ_result_spec_uint64 ("payback_refresh_uuid", GNUNET_PQ_result_spec_uint64 ("recoup_refresh_uuid",
&serial_id), &serial_id),
GNUNET_PQ_result_spec_end GNUNET_PQ_result_spec_end
}; };
@ -4349,16 +4349,16 @@ add_coin_payback_refresh (void *cls,
i)) i))
{ {
GNUNET_break (0); GNUNET_break (0);
GNUNET_free (payback); GNUNET_free (recoup);
chc->status = GNUNET_DB_STATUS_HARD_ERROR; chc->status = GNUNET_DB_STATUS_HARD_ERROR;
return; return;
} }
payback->coin.coin_pub = *chc->coin_pub; recoup->coin.coin_pub = *chc->coin_pub;
} }
tl = GNUNET_new (struct TALER_EXCHANGEDB_TransactionList); tl = GNUNET_new (struct TALER_EXCHANGEDB_TransactionList);
tl->next = chc->head; tl->next = chc->head;
tl->type = TALER_EXCHANGEDB_TT_PAYBACK_REFRESH; tl->type = TALER_EXCHANGEDB_TT_RECOUP_REFRESH;
tl->details.payback_refresh = payback; tl->details.recoup_refresh = recoup;
tl->serial_id = serial_id; tl->serial_id = serial_id;
chc->head = tl; chc->head = tl;
} }
@ -4384,12 +4384,12 @@ struct Work
/** /**
* Compile a list of all (historic) transactions performed with the given coin * Compile a list of all (historic) transactions performed with the given coin
* (/refresh/melt, /deposit, /refund and /payback operations). * (/refresh/melt, /deposit, /refund and /recoup operations).
* *
* @param cls the `struct PostgresClosure` with the plugin-specific state * @param cls the `struct PostgresClosure` with the plugin-specific state
* @param session database connection * @param session database connection
* @param coin_pub coin to investigate * @param coin_pub coin to investigate
* @param include_payback should payback transactions be included in the @a tlp * @param include_recoup should recoup transactions be included in the @a tlp
* @param[out] tlp set to list of transactions, NULL if coin is fresh * @param[out] tlp set to list of transactions, NULL if coin is fresh
* @return database transaction status * @return database transaction status
*/ */
@ -4398,7 +4398,7 @@ postgres_get_coin_transactions (void *cls,
struct TALER_EXCHANGEDB_Session *session, struct TALER_EXCHANGEDB_Session *session,
const struct const struct
TALER_CoinSpendPublicKeyP *coin_pub, TALER_CoinSpendPublicKeyP *coin_pub,
int include_payback, int include_recoup,
struct TALER_EXCHANGEDB_TransactionList **tlp) struct TALER_EXCHANGEDB_TransactionList **tlp)
{ {
struct PostgresClosure *pg = cls; struct PostgresClosure *pg = cls;
@ -4424,15 +4424,15 @@ postgres_get_coin_transactions (void *cls,
/** #TALER_EXCHANGEDB_TT_REFUND */ /** #TALER_EXCHANGEDB_TT_REFUND */
{ "get_refunds_by_coin", { "get_refunds_by_coin",
&add_coin_refund }, &add_coin_refund },
/** #TALER_EXCHANGEDB_TT_OLD_COIN_PAYBACK */ /** #TALER_EXCHANGEDB_TT_OLD_COIN_RECOUP */
{ "payback_by_old_coin", { "recoup_by_old_coin",
&add_old_coin_payback }, &add_old_coin_recoup },
/** #TALER_EXCHANGEDB_TT_PAYBACK */ /** #TALER_EXCHANGEDB_TT_RECOUP */
{ "payback_by_coin", { "recoup_by_coin",
&add_coin_payback }, &add_coin_recoup },
/** #TALER_EXCHANGEDB_TT_PAYBACK_REFRESH */ /** #TALER_EXCHANGEDB_TT_RECOUP_REFRESH */
{ "payback_by_refreshed_coin", { "recoup_by_refreshed_coin",
&add_coin_payback_refresh }, &add_coin_recoup_refresh },
{ NULL, NULL } { NULL, NULL }
}; };
struct CoinHistoryContext chc; struct CoinHistoryContext chc;
@ -4443,7 +4443,7 @@ postgres_get_coin_transactions (void *cls,
enum GNUNET_DB_QueryStatus qs; enum GNUNET_DB_QueryStatus qs;
const struct Work *work; const struct Work *work;
work = (GNUNET_YES == include_payback) ? work_wp : work_op; work = (GNUNET_YES == include_recoup) ? work_wp : work_op;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Getting transactions for coin %s\n", "Getting transactions for coin %s\n",
TALER_B2S (coin_pub)); TALER_B2S (coin_pub));
@ -5367,7 +5367,7 @@ postgres_gc (void *cls)
params_ancient_time)) ) params_ancient_time)) )
ret = GNUNET_SYSERR; ret = GNUNET_SYSERR;
/* This one may fail due to foreign key constraints from /* This one may fail due to foreign key constraints from
payback and reserves_out tables to known_coins; these recoup and reserves_out tables to known_coins; these
are NOT using 'ON DROP CASCADE' and might keep denomination are NOT using 'ON DROP CASCADE' and might keep denomination
keys alive for a bit longer, thus causing this statement keys alive for a bit longer, thus causing this statement
to fail. */(void) GNUNET_PQ_eval_prepared_non_select (conn, to fail. */(void) GNUNET_PQ_eval_prepared_non_select (conn,
@ -6312,15 +6312,15 @@ postgres_select_wire_out_above_serial_id_by_account (void *cls,
/** /**
* Closure for #payback_serial_helper_cb(). * Closure for #recoup_serial_helper_cb().
*/ */
struct PaybackSerialContext struct RecoupSerialContext
{ {
/** /**
* Callback to call. * Callback to call.
*/ */
TALER_EXCHANGEDB_PaybackCallback cb; TALER_EXCHANGEDB_RecoupCallback cb;
/** /**
* Closure for @e cb. * Closure for @e cb.
@ -6343,16 +6343,16 @@ struct PaybackSerialContext
* Helper function to be called with the results of a SELECT statement * Helper function to be called with the results of a SELECT statement
* that has returned @a num_results results. * that has returned @a num_results results.
* *
* @param cls closure of type `struct PaybackSerialContext` * @param cls closure of type `struct RecoupSerialContext`
* @param result the postgres result * @param result the postgres result
* @param num_results the number of results in @a result * @param num_results the number of results in @a result
*/ */
static void static void
payback_serial_helper_cb (void *cls, recoup_serial_helper_cb (void *cls,
PGresult *result, PGresult *result,
unsigned int num_results) unsigned int num_results)
{ {
struct PaybackSerialContext *psc = cls; struct RecoupSerialContext *psc = cls;
struct PostgresClosure *pg = psc->pg; struct PostgresClosure *pg = psc->pg;
for (unsigned int i = 0; i<num_results; i++) for (unsigned int i = 0; i<num_results; i++)
@ -6367,7 +6367,7 @@ payback_serial_helper_cb (void *cls,
struct GNUNET_HashCode h_blind_ev; struct GNUNET_HashCode h_blind_ev;
struct GNUNET_TIME_Absolute timestamp; struct GNUNET_TIME_Absolute timestamp;
struct GNUNET_PQ_ResultSpec rs[] = { struct GNUNET_PQ_ResultSpec rs[] = {
GNUNET_PQ_result_spec_uint64 ("payback_uuid", GNUNET_PQ_result_spec_uint64 ("recoup_uuid",
&rowid), &rowid),
TALER_PQ_result_spec_absolute_time ("timestamp", TALER_PQ_result_spec_absolute_time ("timestamp",
&timestamp), &timestamp),
@ -6419,7 +6419,7 @@ payback_serial_helper_cb (void *cls,
/** /**
* Function called to select payback requests the exchange * Function called to select recoup requests the exchange
* received, ordered by serial ID (monotonically increasing). * received, ordered by serial ID (monotonically increasing).
* *
* @param cls closure * @param cls closure
@ -6430,19 +6430,19 @@ payback_serial_helper_cb (void *cls,
* @return transaction status code * @return transaction status code
*/ */
static enum GNUNET_DB_QueryStatus static enum GNUNET_DB_QueryStatus
postgres_select_payback_above_serial_id (void *cls, postgres_select_recoup_above_serial_id (void *cls,
struct TALER_EXCHANGEDB_Session * struct TALER_EXCHANGEDB_Session *
session, session,
uint64_t serial_id, uint64_t serial_id,
TALER_EXCHANGEDB_PaybackCallback cb, TALER_EXCHANGEDB_RecoupCallback cb,
void *cb_cls) void *cb_cls)
{ {
struct PostgresClosure *pg = cls; struct PostgresClosure *pg = cls;
struct GNUNET_PQ_QueryParam params[] = { struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_uint64 (&serial_id), GNUNET_PQ_query_param_uint64 (&serial_id),
GNUNET_PQ_query_param_end GNUNET_PQ_query_param_end
}; };
struct PaybackSerialContext psc = { struct RecoupSerialContext psc = {
.cb = cb, .cb = cb,
.cb_cls = cb_cls, .cb_cls = cb_cls,
.pg = pg, .pg = pg,
@ -6451,9 +6451,9 @@ postgres_select_payback_above_serial_id (void *cls,
enum GNUNET_DB_QueryStatus qs; enum GNUNET_DB_QueryStatus qs;
qs = GNUNET_PQ_eval_prepared_multi_select (session->conn, qs = GNUNET_PQ_eval_prepared_multi_select (session->conn,
"payback_get_incr", "recoup_get_incr",
params, params,
&payback_serial_helper_cb, &recoup_serial_helper_cb,
&psc); &psc);
if (GNUNET_OK != psc.status) if (GNUNET_OK != psc.status)
return GNUNET_DB_STATUS_HARD_ERROR; return GNUNET_DB_STATUS_HARD_ERROR;
@ -6462,15 +6462,15 @@ postgres_select_payback_above_serial_id (void *cls,
/** /**
* Closure for #payback_refresh_serial_helper_cb(). * Closure for #recoup_refresh_serial_helper_cb().
*/ */
struct PaybackRefreshSerialContext struct RecoupRefreshSerialContext
{ {
/** /**
* Callback to call. * Callback to call.
*/ */
TALER_EXCHANGEDB_PaybackRefreshCallback cb; TALER_EXCHANGEDB_RecoupRefreshCallback cb;
/** /**
* Closure for @e cb. * Closure for @e cb.
@ -6493,16 +6493,16 @@ struct PaybackRefreshSerialContext
* Helper function to be called with the results of a SELECT statement * Helper function to be called with the results of a SELECT statement
* that has returned @a num_results results. * that has returned @a num_results results.
* *
* @param cls closure of type `struct PaybackRefreshSerialContext` * @param cls closure of type `struct RecoupRefreshSerialContext`
* @param result the postgres result * @param result the postgres result
* @param num_results the number of results in @a result * @param num_results the number of results in @a result
*/ */
static void static void
payback_refresh_serial_helper_cb (void *cls, recoup_refresh_serial_helper_cb (void *cls,
PGresult *result, PGresult *result,
unsigned int num_results) unsigned int num_results)
{ {
struct PaybackRefreshSerialContext *psc = cls; struct RecoupRefreshSerialContext *psc = cls;
struct PostgresClosure *pg = psc->pg; struct PostgresClosure *pg = psc->pg;
for (unsigned int i = 0; i<num_results; i++) for (unsigned int i = 0; i<num_results; i++)
@ -6517,7 +6517,7 @@ payback_refresh_serial_helper_cb (void *cls,
struct GNUNET_HashCode h_blind_ev; struct GNUNET_HashCode h_blind_ev;
struct GNUNET_TIME_Absolute timestamp; struct GNUNET_TIME_Absolute timestamp;
struct GNUNET_PQ_ResultSpec rs[] = { struct GNUNET_PQ_ResultSpec rs[] = {
GNUNET_PQ_result_spec_uint64 ("payback_uuid", GNUNET_PQ_result_spec_uint64 ("recoup_uuid",
&rowid), &rowid),
TALER_PQ_result_spec_absolute_time ("timestamp", TALER_PQ_result_spec_absolute_time ("timestamp",
&timestamp), &timestamp),
@ -6569,7 +6569,7 @@ payback_refresh_serial_helper_cb (void *cls,
/** /**
* Function called to select payback requests the exchange received for * Function called to select recoup requests the exchange received for
* refreshed coins, ordered by serial ID (monotonically increasing). * refreshed coins, ordered by serial ID (monotonically increasing).
* *
* @param cls closure * @param cls closure
@ -6580,20 +6580,20 @@ payback_refresh_serial_helper_cb (void *cls,
* @return transaction status code * @return transaction status code
*/ */
static enum GNUNET_DB_QueryStatus static enum GNUNET_DB_QueryStatus
postgres_select_payback_refresh_above_serial_id (void *cls, postgres_select_recoup_refresh_above_serial_id (void *cls,
struct TALER_EXCHANGEDB_Session struct TALER_EXCHANGEDB_Session
*session, *session,
uint64_t serial_id, uint64_t serial_id,
TALER_EXCHANGEDB_PaybackRefreshCallback TALER_EXCHANGEDB_RecoupRefreshCallback
cb, cb,
void *cb_cls) void *cb_cls)
{ {
struct PostgresClosure *pg = cls; struct PostgresClosure *pg = cls;
struct GNUNET_PQ_QueryParam params[] = { struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_uint64 (&serial_id), GNUNET_PQ_query_param_uint64 (&serial_id),
GNUNET_PQ_query_param_end GNUNET_PQ_query_param_end
}; };
struct PaybackRefreshSerialContext psc = { struct RecoupRefreshSerialContext psc = {
.cb = cb, .cb = cb,
.cb_cls = cb_cls, .cb_cls = cb_cls,
.pg = pg, .pg = pg,
@ -6602,9 +6602,9 @@ postgres_select_payback_refresh_above_serial_id (void *cls,
enum GNUNET_DB_QueryStatus qs; enum GNUNET_DB_QueryStatus qs;
qs = GNUNET_PQ_eval_prepared_multi_select (session->conn, qs = GNUNET_PQ_eval_prepared_multi_select (session->conn,
"payback_refresh_get_incr", "recoup_refresh_get_incr",
params, params,
&payback_refresh_serial_helper_cb, &recoup_refresh_serial_helper_cb,
&psc); &psc);
if (GNUNET_OK != psc.status) if (GNUNET_OK != psc.status)
return GNUNET_DB_STATUS_HARD_ERROR; return GNUNET_DB_STATUS_HARD_ERROR;
@ -6753,7 +6753,7 @@ postgres_select_reserve_closed_above_serial_id (void *cls,
/** /**
* Function called to add a request for an emergency payback for a * Function called to add a request for an emergency recoup for a
* coin. The funds are to be added back to the reserve. The function * coin. The funds are to be added back to the reserve. The function
* should return the @a deadline by which the exchange will trigger a * should return the @a deadline by which the exchange will trigger a
* wire transfer back to the customer's account for the reserve. * wire transfer back to the customer's account for the reserve.
@ -6762,7 +6762,7 @@ postgres_select_reserve_closed_above_serial_id (void *cls,
* @param session database connection * @param session database connection
* @param reserve_pub public key of the reserve that is being refunded * @param reserve_pub public key of the reserve that is being refunded
* @param coin information about the coin * @param coin information about the coin
* @param coin_sig signature of the coin of type #TALER_SIGNATURE_WALLET_COIN_PAYBACK * @param coin_sig signature of the coin of type #TALER_SIGNATURE_WALLET_COIN_RECOUP
* @param coin_blind blinding key of the coin * @param coin_blind blinding key of the coin
* @param amount total amount to be paid back * @param amount total amount to be paid back
* @param h_blind_ev hash of the blinded coin's envelope (must match reserves_out entry) * @param h_blind_ev hash of the blinded coin's envelope (must match reserves_out entry)
@ -6770,18 +6770,18 @@ postgres_select_reserve_closed_above_serial_id (void *cls,
* @return transaction result status * @return transaction result status
*/ */
static enum GNUNET_DB_QueryStatus static enum GNUNET_DB_QueryStatus
postgres_insert_payback_request (void *cls, postgres_insert_recoup_request (void *cls,
struct TALER_EXCHANGEDB_Session *session, struct TALER_EXCHANGEDB_Session *session,
const struct const struct
TALER_ReservePublicKeyP *reserve_pub, TALER_ReservePublicKeyP *reserve_pub,
const struct TALER_CoinPublicInfo *coin, const struct TALER_CoinPublicInfo *coin,
const struct const struct
TALER_CoinSpendSignatureP *coin_sig, TALER_CoinSpendSignatureP *coin_sig,
const struct const struct
TALER_DenominationBlindingKeyP *coin_blind, TALER_DenominationBlindingKeyP *coin_blind,
const struct TALER_Amount *amount, const struct TALER_Amount *amount,
const struct GNUNET_HashCode *h_blind_ev, const struct GNUNET_HashCode *h_blind_ev,
struct GNUNET_TIME_Absolute timestamp) struct GNUNET_TIME_Absolute timestamp)
{ {
struct PostgresClosure *pg = cls; struct PostgresClosure *pg = cls;
struct GNUNET_TIME_Absolute expiry; struct GNUNET_TIME_Absolute expiry;
@ -6797,9 +6797,9 @@ postgres_insert_payback_request (void *cls,
}; };
enum GNUNET_DB_QueryStatus qs; enum GNUNET_DB_QueryStatus qs;
/* now store actual payback information */ /* now store actual recoup information */
qs = GNUNET_PQ_eval_prepared_non_select (session->conn, qs = GNUNET_PQ_eval_prepared_non_select (session->conn,
"payback_insert", "recoup_insert",
params); params);
if (0 > qs) if (0 > qs)
{ {
@ -6848,15 +6848,15 @@ postgres_insert_payback_request (void *cls,
/** /**
* Function called to add a request for an emergency payback for a * Function called to add a request for an emergency recoup for a
* refreshed coin. The funds are to be added back to the original coin * refreshed coin. The funds are to be added back to the original coin
* (which is implied via @a h_blind_ev, see the prepared statement * (which is implied via @a h_blind_ev, see the prepared statement
* "payback_by_old_coin" used in #postgres_get_coin_transactions()). * "recoup_by_old_coin" used in #postgres_get_coin_transactions()).
* *
* @param cls closure * @param cls closure
* @param session database connection * @param session database connection
* @param coin public information about the refreshed coin * @param coin public information about the refreshed coin
* @param coin_sig signature of the coin of type #TALER_SIGNATURE_WALLET_COIN_PAYBACK * @param coin_sig signature of the coin of type #TALER_SIGNATURE_WALLET_COIN_RECOUP
* @param coin_blind blinding key of the coin * @param coin_blind blinding key of the coin
* @param h_blind_ev blinded envelope, as calculated by the exchange * @param h_blind_ev blinded envelope, as calculated by the exchange
* @param amount total amount to be paid back * @param amount total amount to be paid back
@ -6865,20 +6865,20 @@ postgres_insert_payback_request (void *cls,
* @return transaction result status * @return transaction result status
*/ */
static enum GNUNET_DB_QueryStatus static enum GNUNET_DB_QueryStatus
postgres_insert_payback_refresh_request (void *cls, postgres_insert_recoup_refresh_request (void *cls,
struct TALER_EXCHANGEDB_Session * struct TALER_EXCHANGEDB_Session *
session, session,
const struct const struct
TALER_CoinPublicInfo *coin, TALER_CoinPublicInfo *coin,
const struct const struct
TALER_CoinSpendSignatureP *coin_sig, TALER_CoinSpendSignatureP *coin_sig,
const struct const struct
TALER_DenominationBlindingKeyP * TALER_DenominationBlindingKeyP *
coin_blind, coin_blind,
const struct TALER_Amount *amount, const struct TALER_Amount *amount,
const struct const struct
GNUNET_HashCode *h_blind_ev, GNUNET_HashCode *h_blind_ev,
struct GNUNET_TIME_Absolute timestamp) struct GNUNET_TIME_Absolute timestamp)
{ {
struct GNUNET_PQ_QueryParam params[] = { struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (&coin->coin_pub), GNUNET_PQ_query_param_auto_from_type (&coin->coin_pub),
@ -6892,9 +6892,9 @@ postgres_insert_payback_refresh_request (void *cls,
enum GNUNET_DB_QueryStatus qs; enum GNUNET_DB_QueryStatus qs;
(void) cls; (void) cls;
/* now store actual payback information */ /* now store actual recoup information */
qs = GNUNET_PQ_eval_prepared_non_select (session->conn, qs = GNUNET_PQ_eval_prepared_non_select (session->conn,
"payback_refresh_insert", "recoup_refresh_insert",
params); params);
if (0 > qs) if (0 > qs)
{ {
@ -7342,16 +7342,16 @@ libtaler_plugin_exchangedb_postgres_init (void *cls)
= &postgres_select_wire_out_above_serial_id; = &postgres_select_wire_out_above_serial_id;
plugin->select_wire_out_above_serial_id_by_account plugin->select_wire_out_above_serial_id_by_account
= &postgres_select_wire_out_above_serial_id_by_account; = &postgres_select_wire_out_above_serial_id_by_account;
plugin->select_payback_above_serial_id plugin->select_recoup_above_serial_id
= &postgres_select_payback_above_serial_id; = &postgres_select_recoup_above_serial_id;
plugin->select_payback_refresh_above_serial_id plugin->select_recoup_refresh_above_serial_id
= &postgres_select_payback_refresh_above_serial_id; = &postgres_select_recoup_refresh_above_serial_id;
plugin->select_reserve_closed_above_serial_id plugin->select_reserve_closed_above_serial_id
= &postgres_select_reserve_closed_above_serial_id; = &postgres_select_reserve_closed_above_serial_id;
plugin->insert_payback_request plugin->insert_recoup_request
= &postgres_insert_payback_request; = &postgres_insert_recoup_request;
plugin->insert_payback_refresh_request plugin->insert_recoup_refresh_request
= &postgres_insert_payback_refresh_request; = &postgres_insert_recoup_refresh_request;
plugin->get_reserve_by_h_blind plugin->get_reserve_by_h_blind
= &postgres_get_reserve_by_h_blind; = &postgres_get_reserve_by_h_blind;
plugin->get_old_coin_by_h_blind plugin->get_old_coin_by_h_blind

View File

@ -1309,28 +1309,28 @@ drop:
/** /**
* Function called about paybacks the exchange has to perform. * Function called about recoups the exchange has to perform.
* *
* @param cls closure with the expected value for @a coin_blind * @param cls closure with the expected value for @a coin_blind
* @param rowid row identifier used to uniquely identify the payback operation * @param rowid row identifier used to uniquely identify the recoup operation
* @param timestamp when did we receive the payback request * @param timestamp when did we receive the recoup request
* @param amount how much should be added back to the reserve * @param amount how much should be added back to the reserve
* @param reserve_pub public key of the reserve * @param reserve_pub public key of the reserve
* @param coin public information about the coin * @param coin public information about the coin
* @param coin_sig signature with @e coin_pub of type #TALER_SIGNATURE_WALLET_COIN_PAYBACK * @param coin_sig signature with @e coin_pub of type #TALER_SIGNATURE_WALLET_COIN_RECOUP
* @param coin_blind blinding factor used to blind the coin * @param coin_blind blinding factor used to blind the coin
* @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop
*/ */
static int static int
payback_cb (void *cls, recoup_cb (void *cls,
uint64_t rowid, uint64_t rowid,
struct GNUNET_TIME_Absolute timestamp, struct GNUNET_TIME_Absolute timestamp,
const struct TALER_Amount *amount, const struct TALER_Amount *amount,
const struct TALER_ReservePublicKeyP *reserve_pub, const struct TALER_ReservePublicKeyP *reserve_pub,
const struct TALER_CoinPublicInfo *coin, const struct TALER_CoinPublicInfo *coin,
const struct TALER_DenominationPublicKey *denom_pub, const struct TALER_DenominationPublicKey *denom_pub,
const struct TALER_CoinSpendSignatureP *coin_sig, const struct TALER_CoinSpendSignatureP *coin_sig,
const struct TALER_DenominationBlindingKeyP *coin_blind) const struct TALER_DenominationBlindingKeyP *coin_blind)
{ {
const struct TALER_DenominationBlindingKeyP *cb = cls; const struct TALER_DenominationBlindingKeyP *cb = cls;
@ -1504,11 +1504,11 @@ run (void *cls)
/* test DB is empty */ /* test DB is empty */
FAILIF (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS != FAILIF (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS !=
plugin->select_payback_above_serial_id (plugin->cls, plugin->select_recoup_above_serial_id (plugin->cls,
session, session,
0, 0,
&payback_cb, &recoup_cb,
NULL)); NULL));
RND_BLK (&reserve_pub); RND_BLK (&reserve_pub);
GNUNET_assert (GNUNET_OK == GNUNET_assert (GNUNET_OK ==
TALER_string_to_amount (CURRENCY ":1.000010", TALER_string_to_amount (CURRENCY ":1.000010",
@ -1656,21 +1656,21 @@ run (void *cls)
session, session,
&deposit.coin)); &deposit.coin));
FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
plugin->insert_payback_request (plugin->cls, plugin->insert_recoup_request (plugin->cls,
session, session,
&reserve_pub, &reserve_pub,
&deposit.coin, &deposit.coin,
&coin_sig, &coin_sig,
&coin_blind, &coin_blind,
&value, &value,
&cbc.h_coin_envelope, &cbc.h_coin_envelope,
deadline)); deadline));
FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
plugin->select_payback_above_serial_id (plugin->cls, plugin->select_recoup_above_serial_id (plugin->cls,
session, session,
0, 0,
&payback_cb, &recoup_cb,
&coin_blind)); &coin_blind));
GNUNET_assert (GNUNET_OK == GNUNET_assert (GNUNET_OK ==
TALER_amount_add (&amount_with_fee, TALER_amount_add (&amount_with_fee,
@ -1729,23 +1729,23 @@ run (void *cls)
&cbc.h_coin_envelope, &cbc.h_coin_envelope,
sizeof (cbc.h_coin_envelope))); sizeof (cbc.h_coin_envelope)));
break; break;
case TALER_EXCHANGEDB_RO_PAYBACK_COIN: case TALER_EXCHANGEDB_RO_RECOUP_COIN:
{ {
struct TALER_EXCHANGEDB_Payback *payback = rh_head->details.payback; struct TALER_EXCHANGEDB_Recoup *recoup = rh_head->details.recoup;
FAILIF (0 != memcmp (&payback->coin_sig, FAILIF (0 != memcmp (&recoup->coin_sig,
&coin_sig, &coin_sig,
sizeof (coin_sig))); sizeof (coin_sig)));
FAILIF (0 != memcmp (&payback->coin_blind, FAILIF (0 != memcmp (&recoup->coin_blind,
&coin_blind, &coin_blind,
sizeof (coin_blind))); sizeof (coin_blind)));
FAILIF (0 != memcmp (&payback->reserve_pub, FAILIF (0 != memcmp (&recoup->reserve_pub,
&reserve_pub, &reserve_pub,
sizeof (reserve_pub))); sizeof (reserve_pub)));
FAILIF (0 != memcmp (&payback->coin.coin_pub, FAILIF (0 != memcmp (&recoup->coin.coin_pub,
&deposit.coin.coin_pub, &deposit.coin.coin_pub,
sizeof (deposit.coin.coin_pub))); sizeof (deposit.coin.coin_pub)));
FAILIF (0 != TALER_amount_cmp (&payback->value, FAILIF (0 != TALER_amount_cmp (&recoup->value,
&value)); &value));
} }
break; break;
@ -1954,7 +1954,7 @@ run (void *cls)
&check_refund_cb, &check_refund_cb,
&refund)); &refund));
/* test payback / revocation */ /* test recoup / revocation */
RND_BLK (&master_sig); RND_BLK (&master_sig);
FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
plugin->insert_denomination_revocation (plugin->cls, plugin->insert_denomination_revocation (plugin->cls,
@ -2001,15 +2001,15 @@ run (void *cls)
RND_BLK (&coin_sig); RND_BLK (&coin_sig);
RND_BLK (&coin_blind); RND_BLK (&coin_blind);
FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
plugin->insert_payback_request (plugin->cls, plugin->insert_recoup_request (plugin->cls,
session, session,
&reserve_pub, &reserve_pub,
&deposit.coin, &deposit.coin,
&coin_sig, &coin_sig,
&coin_blind, &coin_blind,
&value, &value,
&cbc.h_coin_envelope, &cbc.h_coin_envelope,
deadline)); deadline));
auditor_row_cnt = 0; auditor_row_cnt = 0;
FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
@ -2094,18 +2094,18 @@ run (void *cls)
matched |= 4; matched |= 4;
break; break;
} }
case TALER_EXCHANGEDB_TT_PAYBACK: case TALER_EXCHANGEDB_TT_RECOUP:
{ {
struct TALER_EXCHANGEDB_PaybackListEntry *payback = struct TALER_EXCHANGEDB_RecoupListEntry *recoup =
tlp->details.payback; tlp->details.recoup;
FAILIF (0 != GNUNET_memcmp (&payback->coin_sig, FAILIF (0 != GNUNET_memcmp (&recoup->coin_sig,
&coin_sig)); &coin_sig));
FAILIF (0 != GNUNET_memcmp (&payback->coin_blind, FAILIF (0 != GNUNET_memcmp (&recoup->coin_blind,
&coin_blind)); &coin_blind));
FAILIF (0 != GNUNET_memcmp (&payback->reserve_pub, FAILIF (0 != GNUNET_memcmp (&recoup->reserve_pub,
&reserve_pub)); &reserve_pub));
FAILIF (0 != TALER_amount_cmp (&payback->value, FAILIF (0 != TALER_amount_cmp (&recoup->value,
&value)); &value));
matched |= 8; matched |= 8;
break; break;

View File

@ -176,10 +176,10 @@ struct TALER_AUDITORDB_ProgressPointReserve
uint64_t last_reserve_out_serial_id; uint64_t last_reserve_out_serial_id;
/** /**
* serial ID of the last payback entry the auditor processed when * serial ID of the last recoup entry the auditor processed when
* considering reserves. * considering reserves.
*/ */
uint64_t last_reserve_payback_serial_id; uint64_t last_reserve_recoup_serial_id;
/** /**
* serial ID of the last reserve_close * serial ID of the last reserve_close
@ -246,14 +246,14 @@ struct TALER_AUDITORDB_ProgressPointCoin
uint64_t last_refund_serial_id; uint64_t last_refund_serial_id;
/** /**
* Serial ID of the last payback operation the auditor processed. * Serial ID of the last recoup operation the auditor processed.
*/ */
uint64_t last_payback_serial_id; uint64_t last_recoup_serial_id;
/** /**
* Serial ID of the last payback-of-refresh operation the auditor processed. * Serial ID of the last recoup-of-refresh operation the auditor processed.
*/ */
uint64_t last_payback_refresh_serial_id; uint64_t last_recoup_refresh_serial_id;
}; };
@ -1211,7 +1211,7 @@ struct TALER_AUDITORDB_Plugin
* @param denom_balance value of coins outstanding with this denomination key * @param denom_balance value of coins outstanding with this denomination key
* @param denom_loss value of coins redeemed that were not outstanding (effectively, negative @a denom_balance) * @param denom_loss value of coins redeemed that were not outstanding (effectively, negative @a denom_balance)
* @param denom_risk value of coins issued with this denomination key * @param denom_risk value of coins issued with this denomination key
* @param denom_payback value of coins paid back if this denomination key was revoked * @param denom_recoup value of coins paid back if this denomination key was revoked
* @param num_issued how many coins of this denomination did the exchange blind-sign * @param num_issued how many coins of this denomination did the exchange blind-sign
* @return transaction status code * @return transaction status code
*/ */
@ -1222,7 +1222,7 @@ struct TALER_AUDITORDB_Plugin
const struct TALER_Amount *denom_balance, const struct TALER_Amount *denom_balance,
const struct TALER_Amount *denom_loss, const struct TALER_Amount *denom_loss,
const struct TALER_Amount *denom_risk, const struct TALER_Amount *denom_risk,
const struct TALER_Amount *payback_loss, const struct TALER_Amount *recoup_loss,
uint64_t num_issued); uint64_t num_issued);
@ -1236,7 +1236,7 @@ struct TALER_AUDITORDB_Plugin
* @param denom_balance value of coins outstanding with this denomination key * @param denom_balance value of coins outstanding with this denomination key
* @param denom_loss value of coins redeemed that were not outstanding (effectively, negative @a denom_balance) * @param denom_loss value of coins redeemed that were not outstanding (effectively, negative @a denom_balance)
* @param denom_risk value of coins issued with this denomination key * @param denom_risk value of coins issued with this denomination key
* @param denom_payback value of coins paid back if this denomination key was revoked * @param denom_recoup value of coins paid back if this denomination key was revoked
* @param num_issued how many coins of this denomination did the exchange blind-sign * @param num_issued how many coins of this denomination did the exchange blind-sign
* @return transaction status code * @return transaction status code
*/ */
@ -1247,7 +1247,7 @@ struct TALER_AUDITORDB_Plugin
const struct TALER_Amount *denom_balance, const struct TALER_Amount *denom_balance,
const struct TALER_Amount *denom_loss, const struct TALER_Amount *denom_loss,
const struct TALER_Amount *denom_risk, const struct TALER_Amount *denom_risk,
const struct TALER_Amount *payback_loss, const struct TALER_Amount *recoup_loss,
uint64_t num_issued); uint64_t num_issued);
@ -1260,7 +1260,7 @@ struct TALER_AUDITORDB_Plugin
* @param[out] denom_balance value of coins outstanding with this denomination key * @param[out] denom_balance value of coins outstanding with this denomination key
* @param[out] denom_loss value of coins redeemed that were not outstanding (effectively, negative @a denom_balance) * @param[out] denom_loss value of coins redeemed that were not outstanding (effectively, negative @a denom_balance)
* @param[out] denom_risk value of coins issued with this denomination key * @param[out] denom_risk value of coins issued with this denomination key
* @param[out] denom_payback value of coins paid back if this denomination key was revoked * @param[out] denom_recoup value of coins paid back if this denomination key was revoked
* @param[out] num_issued how many coins of this denomination did the exchange blind-sign * @param[out] num_issued how many coins of this denomination did the exchange blind-sign
* @return transaction status code * @return transaction status code
*/ */
@ -1271,7 +1271,7 @@ struct TALER_AUDITORDB_Plugin
struct TALER_Amount *denom_balance, struct TALER_Amount *denom_balance,
struct TALER_Amount *denom_loss, struct TALER_Amount *denom_loss,
struct TALER_Amount *denom_risk, struct TALER_Amount *denom_risk,
struct TALER_Amount *payback_loss, struct TALER_Amount *recoup_loss,
uint64_t *num_issued); uint64_t *num_issued);
@ -1301,8 +1301,8 @@ struct TALER_AUDITORDB_Plugin
* @param melt_fee_balance total melt fees collected for this DK * @param melt_fee_balance total melt fees collected for this DK
* @param refund_fee_balance total refund fees collected for this DK * @param refund_fee_balance total refund fees collected for this DK
* @param risk maximum risk exposure of the exchange * @param risk maximum risk exposure of the exchange
* @param payback_loss actual losses from payback (actualized @a risk) * @param recoup_loss actual losses from recoup (actualized @a risk)
* @param irregular_paybacks paybacks made of non-revoked coins (reduces * @param irregular_recoups recoups made of non-revoked coins (reduces
* risk, but should never happen) * risk, but should never happen)
* @return transaction status code * @return transaction status code
*/ */
@ -1315,8 +1315,8 @@ struct TALER_AUDITORDB_Plugin
const struct TALER_Amount *melt_fee_balance, const struct TALER_Amount *melt_fee_balance,
const struct TALER_Amount *refund_fee_balance, const struct TALER_Amount *refund_fee_balance,
const struct TALER_Amount *risk, const struct TALER_Amount *risk,
const struct TALER_Amount *payback_loss, const struct TALER_Amount *recoup_loss,
const struct TALER_Amount *irregular_paybacks); const struct TALER_Amount *irregular_recoups);
/** /**
@ -1331,8 +1331,8 @@ struct TALER_AUDITORDB_Plugin
* @param melt_fee_balance total melt fees collected for this DK * @param melt_fee_balance total melt fees collected for this DK
* @param refund_fee_balance total refund fees collected for this DK * @param refund_fee_balance total refund fees collected for this DK
* @param risk maximum risk exposure of the exchange * @param risk maximum risk exposure of the exchange
* @param payback_loss actual losses from payback (actualized @a risk) * @param recoup_loss actual losses from recoup (actualized @a risk)
* @param irregular_paybacks paybacks made of non-revoked coins (reduces * @param irregular_recoups recoups made of non-revoked coins (reduces
* risk, but should never happen) * risk, but should never happen)
* @return transaction status code * @return transaction status code
*/ */
@ -1345,8 +1345,8 @@ struct TALER_AUDITORDB_Plugin
const struct TALER_Amount *melt_fee_balance, const struct TALER_Amount *melt_fee_balance,
const struct TALER_Amount *refund_fee_balance, const struct TALER_Amount *refund_fee_balance,
const struct TALER_Amount *risk, const struct TALER_Amount *risk,
const struct TALER_Amount *payback_loss, const struct TALER_Amount *recoup_loss,
const struct TALER_Amount *irregular_paybacks); const struct TALER_Amount *irregular_recoups);
/** /**
@ -1360,8 +1360,8 @@ struct TALER_AUDITORDB_Plugin
* @param[out] melt_fee_balance total melt fees collected for this DK * @param[out] melt_fee_balance total melt fees collected for this DK
* @param[out] refund_fee_balance total refund fees collected for this DK * @param[out] refund_fee_balance total refund fees collected for this DK
* @param[out] risk maximum risk exposure of the exchange * @param[out] risk maximum risk exposure of the exchange
* @param[out] payback_loss actual losses from payback (actualized @a risk) * @param[out] recoup_loss actual losses from recoup (actualized @a risk)
* @param[out] irregular_paybacks paybacks made of non-revoked coins (reduces * @param[out] irregular_recoups recoups made of non-revoked coins (reduces
* risk, but should never happen) * risk, but should never happen)
* @return transaction status code * @return transaction status code
*/ */
@ -1374,8 +1374,8 @@ struct TALER_AUDITORDB_Plugin
struct TALER_Amount *melt_fee_balance, struct TALER_Amount *melt_fee_balance,
struct TALER_Amount *refund_fee_balance, struct TALER_Amount *refund_fee_balance,
struct TALER_Amount *risk, struct TALER_Amount *risk,
struct TALER_Amount *payback_loss, struct TALER_Amount *recoup_loss,
struct TALER_Amount *irregular_payback); struct TALER_Amount *irregular_recoup);
/** /**
@ -1390,7 +1390,7 @@ struct TALER_AUDITORDB_Plugin
* @param revenue_balance what was the total profit made from * @param revenue_balance what was the total profit made from
* deposit fees, melting fees, refresh fees * deposit fees, melting fees, refresh fees
* and coins that were never returned? * and coins that were never returned?
* @param payback_loss_balance total losses from paybacks of revoked denominations * @param recoup_loss_balance total losses from recoups of revoked denominations
* @return transaction status code * @return transaction status code
*/ */
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
@ -1403,7 +1403,7 @@ struct TALER_AUDITORDB_Plugin
revenue_timestamp, revenue_timestamp,
const struct TALER_Amount *revenue_balance, const struct TALER_Amount *revenue_balance,
const struct const struct
TALER_Amount *payback_loss_balance); TALER_Amount *recoup_loss_balance);
/** /**

View File

@ -148,7 +148,7 @@ enum TALER_ErrorCode
/** /**
* The exchange failed to obtain the transaction history of the given * The exchange failed to obtain the transaction history of the given
* coin from the database while generating an insufficient funds * coin from the database while generating an insufficient funds
* errors. This can happen during /deposit or /payback requests. This * errors. This can happen during /deposit or /recoup requests. This
* response is provided with HTTP status code * response is provided with HTTP status code
* MHD_HTTP_INTERNAL_SERVER_ERROR. * MHD_HTTP_INTERNAL_SERVER_ERROR.
*/ */
@ -505,7 +505,7 @@ enum TALER_ErrorCode
/** /**
* The denomination of the given coin has past its expiration date and * The denomination of the given coin has past its expiration date and
* it is also not a valid zombie (that is, was not refreshed with the * it is also not a valid zombie (that is, was not refreshed with the
* fresh coin being subjected to payback). * fresh coin being subjected to recoup).
*/ */
TALER_EC_REFRESH_MELT_COIN_EXPIRED_NO_ZOMBIE = 1309, TALER_EC_REFRESH_MELT_COIN_EXPIRED_NO_ZOMBIE = 1309,
@ -514,19 +514,19 @@ enum TALER_ErrorCode
* sign the melted zombie coin. This response is provided with HTTP * sign the melted zombie coin. This response is provided with HTTP
* status code MHD_HTTP_NOT_FOUND. * status code MHD_HTTP_NOT_FOUND.
*/ */
TALER_EC_REFRESH_PAYBACK_DENOMINATION_KEY_NOT_FOUND = 1351, TALER_EC_REFRESH_RECOUP_DENOMINATION_KEY_NOT_FOUND = 1351,
/** /**
* Validity period of the denomination key is in the future. Returned * Validity period of the denomination key is in the future. Returned
* with an HTTP status of #MHD_HTTP_PRECONDITION_FAILED. * with an HTTP status of #MHD_HTTP_PRECONDITION_FAILED.
*/ */
TALER_EC_REFRESH_PAYBACK_DENOMINATION_VALIDITY_IN_FUTURE = 1352, TALER_EC_REFRESH_RECOUP_DENOMINATION_VALIDITY_IN_FUTURE = 1352,
/** /**
* Denomination key of the coin is past the deposit deadline. * Denomination key of the coin is past the deposit deadline.
* Returned with an HTTP status of #MHD_HTTP_GONE. * Returned with an HTTP status of #MHD_HTTP_GONE.
*/ */
TALER_EC_REFRESH_PAYBACK_DENOMINATION_EXPIRED = 1353, TALER_EC_REFRESH_RECOUP_DENOMINATION_EXPIRED = 1353,
/** /**
* Denomination key of the coin is past the deposit deadline. * Denomination key of the coin is past the deposit deadline.
@ -841,79 +841,79 @@ enum TALER_ErrorCode
TALER_EC_TRACK_TRANSACTION_MERCHANT_SIGNATURE_INVALID = 1804, TALER_EC_TRACK_TRANSACTION_MERCHANT_SIGNATURE_INVALID = 1804,
/** /**
* The given denomination key is not in the "payback" set of the * The given denomination key is not in the "recoup" set of the
* exchange right now. This response is provided with an HTTP status * exchange right now. This response is provided with an HTTP status
* code of MHD_HTTP_NOT_FOUND. * code of MHD_HTTP_NOT_FOUND.
*/ */
TALER_EC_PAYBACK_DENOMINATION_KEY_UNKNOWN = 1850, TALER_EC_RECOUP_DENOMINATION_KEY_UNKNOWN = 1850,
/** /**
* The given coin signature is invalid for the request. This response * The given coin signature is invalid for the request. This response
* is provided with an HTTP status code of MHD_HTTP_FORBIDDEN. * is provided with an HTTP status code of MHD_HTTP_FORBIDDEN.
*/ */
TALER_EC_PAYBACK_SIGNATURE_INVALID = 1851, TALER_EC_RECOUP_SIGNATURE_INVALID = 1851,
/** /**
* The signature of the denomination key over the coin is not valid. * The signature of the denomination key over the coin is not valid.
* This response is provided with HTTP status code * This response is provided with HTTP status code
* MHD_HTTP_BAD_REQUEST. * MHD_HTTP_BAD_REQUEST.
*/ */
TALER_EC_PAYBACK_DENOMINATION_SIGNATURE_INVALID = 1852, TALER_EC_RECOUP_DENOMINATION_SIGNATURE_INVALID = 1852,
/** /**
* The exchange failed to access its own database about reserves. This * The exchange failed to access its own database about reserves. This
* response is provided with HTTP status code * response is provided with HTTP status code
* MHD_HTTP_INTERNAL_SERVER_ERROR. * MHD_HTTP_INTERNAL_SERVER_ERROR.
*/ */
TALER_EC_PAYBACK_DB_FETCH_FAILED = 1853, TALER_EC_RECOUP_DB_FETCH_FAILED = 1853,
/** /**
* The exchange could not find the corresponding withdraw operation. * The exchange could not find the corresponding withdraw operation.
* The request is denied. This response is provided with an HTTP * The request is denied. This response is provided with an HTTP
* status code of MHD_HTTP_NOT_FOUND. * status code of MHD_HTTP_NOT_FOUND.
*/ */
TALER_EC_PAYBACK_WITHDRAW_NOT_FOUND = 1854, TALER_EC_RECOUP_WITHDRAW_NOT_FOUND = 1854,
/** /**
* The exchange obtained an internally inconsistent transaction * The exchange obtained an internally inconsistent transaction
* history for the given coin. This response is provided with HTTP * history for the given coin. This response is provided with HTTP
* status code MHD_HTTP_INTERNAL_SERVER_ERROR. * status code MHD_HTTP_INTERNAL_SERVER_ERROR.
*/ */
TALER_EC_PAYBACK_HISTORY_DB_ERROR = 1855, TALER_EC_RECOUP_HISTORY_DB_ERROR = 1855,
/** /**
* The exchange failed to store information about the payback to be * The exchange failed to store information about the recoup to be
* performed in the database. This response is provided with HTTP * performed in the database. This response is provided with HTTP
* status code MHD_HTTP_INTERNAL_SERVER_ERROR. * status code MHD_HTTP_INTERNAL_SERVER_ERROR.
*/ */
TALER_EC_PAYBACK_DB_PUT_FAILED = 1856, TALER_EC_RECOUP_DB_PUT_FAILED = 1856,
/** /**
* The coin's remaining balance is zero. The request is denied. This * The coin's remaining balance is zero. The request is denied. This
* response is provided with an HTTP status code of * response is provided with an HTTP status code of
* MHD_HTTP_FORBIDDEN. * MHD_HTTP_FORBIDDEN.
*/ */
TALER_EC_PAYBACK_COIN_BALANCE_ZERO = 1857, TALER_EC_RECOUP_COIN_BALANCE_ZERO = 1857,
/** /**
* The exchange failed to reproduce the coin's blinding. This response * The exchange failed to reproduce the coin's blinding. This response
* is provided with an HTTP status code of * is provided with an HTTP status code of
* MHD_HTTP_INTERNAL_SERVER_ERROR. * MHD_HTTP_INTERNAL_SERVER_ERROR.
*/ */
TALER_EC_PAYBACK_BLINDING_FAILED = 1858, TALER_EC_RECOUP_BLINDING_FAILED = 1858,
/** /**
* The coin's remaining balance is zero. The request is denied. This * The coin's remaining balance is zero. The request is denied. This
* response is provided with an HTTP status code of * response is provided with an HTTP status code of
* MHD_HTTP_INTERNAL_SERVER_ERROR * MHD_HTTP_INTERNAL_SERVER_ERROR
*/ */
TALER_EC_PAYBACK_COIN_BALANCE_NEGATIVE = 1859, TALER_EC_RECOUP_COIN_BALANCE_NEGATIVE = 1859,
/** /**
* Validity period of the denomination key is in the future. Returned * Validity period of the denomination key is in the future. Returned
* with an HTTP status of #MHD_HTTP_PRECONDITION_FAILED. * with an HTTP status of #MHD_HTTP_PRECONDITION_FAILED.
*/ */
TALER_EC_PAYBACK_DENOMINATION_VALIDITY_IN_FUTURE = 1860, TALER_EC_RECOUP_DENOMINATION_VALIDITY_IN_FUTURE = 1860,
/** /**
* The "have" parameter was not a natural number. This reponse is * The "have" parameter was not a natural number. This reponse is

View File

@ -965,9 +965,9 @@ enum TALER_EXCHANGE_ReserveTransactionType
TALER_EXCHANGE_RTT_WITHDRAWAL, TALER_EXCHANGE_RTT_WITHDRAWAL,
/** /**
* /payback operation. * /recoup operation.
*/ */
TALER_EXCHANGE_RTT_PAYBACK, TALER_EXCHANGE_RTT_RECOUP,
/** /**
* Reserve closed operation. * Reserve closed operation.
@ -1034,8 +1034,8 @@ struct TALER_EXCHANGE_ReserveHistory
json_t *out_authorization_sig; json_t *out_authorization_sig;
/** /**
* Information provided if the reserve was filled via /payback. * Information provided if the reserve was filled via /recoup.
* @e type is #TALER_EXCHANGE_RTT_PAYBACK. * @e type is #TALER_EXCHANGE_RTT_RECOUP.
*/ */
struct struct
{ {
@ -1047,7 +1047,7 @@ struct TALER_EXCHANGE_ReserveHistory
/** /**
* Signature of the coin of type * Signature of the coin of type
* #TALER_SIGNATURE_EXCHANGE_CONFIRM_PAYBACK. * #TALER_SIGNATURE_EXCHANGE_CONFIRM_RECOUP.
*/ */
struct TALER_ExchangeSignatureP exchange_sig; struct TALER_ExchangeSignatureP exchange_sig;
@ -1057,11 +1057,11 @@ struct TALER_EXCHANGE_ReserveHistory
struct TALER_ExchangePublicKeyP exchange_pub; struct TALER_ExchangePublicKeyP exchange_pub;
/** /**
* When did the /payback operation happen? * When did the /recoup operation happen?
*/ */
struct GNUNET_TIME_Absolute timestamp; struct GNUNET_TIME_Absolute timestamp;
} payback_details; } recoup_details;
/** /**
* Information about a close operation of the reserve. * Information about a close operation of the reserve.
@ -1722,13 +1722,13 @@ TALER_EXCHANGE_verify_coin_history (const struct
struct TALER_Amount *total); struct TALER_Amount *total);
/* ********************* /payback *********************** */ /* ********************* /recoup *********************** */
/** /**
* @brief A /payback Handle * @brief A /recoup Handle
*/ */
struct TALER_EXCHANGE_PaybackHandle; struct TALER_EXCHANGE_RecoupHandle;
/** /**
@ -1745,27 +1745,27 @@ struct TALER_EXCHANGE_PaybackHandle;
* @param ec taler-specific error code, #TALER_EC_NONE on success * @param ec taler-specific error code, #TALER_EC_NONE on success
* @param amount amount the exchange will wire back for this coin, * @param amount amount the exchange will wire back for this coin,
* on error the total balance remaining, or NULL * on error the total balance remaining, or NULL
* @param timestamp what time did the exchange receive the /payback request * @param timestamp what time did the exchange receive the /recoup request
* @param reserve_pub public key of the reserve receiving the payback, NULL if refreshed or on error * @param reserve_pub public key of the reserve receiving the recoup, NULL if refreshed or on error
* @param old_coin_pub public key of the dirty coin, NULL if not refreshed or on error * @param old_coin_pub public key of the dirty coin, NULL if not refreshed or on error
* @param full_response full response from the exchange (for logging, in case of errors) * @param full_response full response from the exchange (for logging, in case of errors)
*/ */
typedef void typedef void
(*TALER_EXCHANGE_PaybackResultCallback) (void *cls, (*TALER_EXCHANGE_RecoupResultCallback) (void *cls,
unsigned int http_status, unsigned int http_status,
enum TALER_ErrorCode ec, enum TALER_ErrorCode ec,
const struct TALER_Amount *amount, const struct TALER_Amount *amount,
struct GNUNET_TIME_Absolute timestamp, struct GNUNET_TIME_Absolute timestamp,
const struct const struct
TALER_ReservePublicKeyP *reserve_pub, TALER_ReservePublicKeyP *reserve_pub,
const struct const struct
TALER_CoinSpendPublicKeyP *old_coin_pub, TALER_CoinSpendPublicKeyP *old_coin_pub,
const json_t *full_response); const json_t *full_response);
/** /**
* Ask the exchange to pay back a coin due to the exchange triggering * Ask the exchange to pay back a coin due to the exchange triggering
* the emergency payback protocol for a given denomination. The value * the emergency recoup protocol for a given denomination. The value
* of the coin will be refunded to the original customer (without fees). * of the coin will be refunded to the original customer (without fees).
* *
* @param exchange the exchange handle; the exchange must be ready to operate * @param exchange the exchange handle; the exchange must be ready to operate
@ -1773,30 +1773,30 @@ typedef void
* @param denom_sig signature over the coin by the exchange using @a pk * @param denom_sig signature over the coin by the exchange using @a pk
* @param ps secret internals of the original planchet * @param ps secret internals of the original planchet
* @param was_refreshed #GNUNET_YES if the coin in @a ps was refreshed * @param was_refreshed #GNUNET_YES if the coin in @a ps was refreshed
* @param payback_cb the callback to call when the final result for this request is available * @param recoup_cb the callback to call when the final result for this request is available
* @param payback_cb_cls closure for @a payback_cb * @param recoup_cb_cls closure for @a recoup_cb
* @return NULL * @return NULL
* if the inputs are invalid (i.e. denomination key not with this exchange). * if the inputs are invalid (i.e. denomination key not with this exchange).
* In this case, the callback is not called. * In this case, the callback is not called.
*/ */
struct TALER_EXCHANGE_PaybackHandle * struct TALER_EXCHANGE_RecoupHandle *
TALER_EXCHANGE_payback (struct TALER_EXCHANGE_Handle *exchange, TALER_EXCHANGE_recoup (struct TALER_EXCHANGE_Handle *exchange,
const struct TALER_EXCHANGE_DenomPublicKey *pk, const struct TALER_EXCHANGE_DenomPublicKey *pk,
const struct TALER_DenominationSignature *denom_sig, const struct TALER_DenominationSignature *denom_sig,
const struct TALER_PlanchetSecretsP *ps, const struct TALER_PlanchetSecretsP *ps,
int was_refreshed, int was_refreshed,
TALER_EXCHANGE_PaybackResultCallback payback_cb, TALER_EXCHANGE_RecoupResultCallback recoup_cb,
void *payback_cb_cls); void *recoup_cb_cls);
/** /**
* Cancel a payback request. This function cannot be used on a * Cancel a recoup request. This function cannot be used on a
* request handle if the callback was already invoked. * request handle if the callback was already invoked.
* *
* @param ph the payback handle * @param ph the recoup handle
*/ */
void void
TALER_EXCHANGE_payback_cancel (struct TALER_EXCHANGE_PaybackHandle *ph); TALER_EXCHANGE_recoup_cancel (struct TALER_EXCHANGE_RecoupHandle *ph);
#endif /* _TALER_EXCHANGE_SERVICE_H */ #endif /* _TALER_EXCHANGE_SERVICE_H */

View File

@ -169,7 +169,7 @@ TALER_EXCHANGEDB_revocations_iterate (const char *revocation_dir,
/** /**
* Mark the given denomination key as revoked and request the wallets * Mark the given denomination key as revoked and request the wallets
* to initiate /payback. * to initiate /recoup.
* *
* @param revocation_dir where to write the revocation certificate * @param revocation_dir where to write the revocation certificate
* @param denom_hash hash of the denomination key to revoke * @param denom_hash hash of the denomination key to revoke

View File

@ -275,10 +275,10 @@ struct TALER_EXCHANGEDB_CollectableBlindcoin
/** /**
* Information the exchange records about a /payback request * Information the exchange records about a /recoup request
* in a reserve history. * in a reserve history.
*/ */
struct TALER_EXCHANGEDB_Payback struct TALER_EXCHANGEDB_Recoup
{ {
/** /**
@ -294,7 +294,7 @@ struct TALER_EXCHANGEDB_Payback
/** /**
* Signature of the coin of type * Signature of the coin of type
* #TALER_SIGNATURE_WALLET_COIN_PAYBACK. * #TALER_SIGNATURE_WALLET_COIN_RECOUP.
*/ */
struct TALER_CoinSpendSignatureP coin_sig; struct TALER_CoinSpendSignatureP coin_sig;
@ -309,7 +309,7 @@ struct TALER_EXCHANGEDB_Payback
struct TALER_Amount value; struct TALER_Amount value;
/** /**
* When did the /payback operation happen? * When did the /recoup operation happen?
*/ */
struct GNUNET_TIME_Absolute timestamp; struct GNUNET_TIME_Absolute timestamp;
@ -317,10 +317,10 @@ struct TALER_EXCHANGEDB_Payback
/** /**
* Information the exchange records about a /payback request * Information the exchange records about a /recoup request
* in a coin history. * in a coin history.
*/ */
struct TALER_EXCHANGEDB_PaybackListEntry struct TALER_EXCHANGEDB_RecoupListEntry
{ {
/** /**
@ -331,7 +331,7 @@ struct TALER_EXCHANGEDB_PaybackListEntry
/** /**
* Signature of the coin of type * Signature of the coin of type
* #TALER_SIGNATURE_WALLET_COIN_PAYBACK. * #TALER_SIGNATURE_WALLET_COIN_RECOUP.
*/ */
struct TALER_CoinSpendSignatureP coin_sig; struct TALER_CoinSpendSignatureP coin_sig;
@ -346,7 +346,7 @@ struct TALER_EXCHANGEDB_PaybackListEntry
struct TALER_Amount value; struct TALER_Amount value;
/** /**
* When did the /payback operation happen? * When did the /recoup operation happen?
*/ */
struct GNUNET_TIME_Absolute timestamp; struct GNUNET_TIME_Absolute timestamp;
@ -354,10 +354,10 @@ struct TALER_EXCHANGEDB_PaybackListEntry
/** /**
* Information the exchange records about a /payback-refresh request in * Information the exchange records about a /recoup-refresh request in
* a coin transaction history. * a coin transaction history.
*/ */
struct TALER_EXCHANGEDB_PaybackRefreshListEntry struct TALER_EXCHANGEDB_RecoupRefreshListEntry
{ {
/** /**
@ -374,7 +374,7 @@ struct TALER_EXCHANGEDB_PaybackRefreshListEntry
/** /**
* Signature of the coin of type * Signature of the coin of type
* #TALER_SIGNATURE_WALLET_COIN_PAYBACK. * #TALER_SIGNATURE_WALLET_COIN_RECOUP.
*/ */
struct TALER_CoinSpendSignatureP coin_sig; struct TALER_CoinSpendSignatureP coin_sig;
@ -389,7 +389,7 @@ struct TALER_EXCHANGEDB_PaybackRefreshListEntry
struct TALER_Amount value; struct TALER_Amount value;
/** /**
* When did the /payback operation happen? * When did the /recoup operation happen?
*/ */
struct GNUNET_TIME_Absolute timestamp; struct GNUNET_TIME_Absolute timestamp;
@ -413,9 +413,9 @@ enum TALER_EXCHANGEDB_ReserveOperation
TALER_EXCHANGEDB_RO_WITHDRAW_COIN = 1, TALER_EXCHANGEDB_RO_WITHDRAW_COIN = 1,
/** /**
* A coin was returned to the reserve using /payback. * A coin was returned to the reserve using /recoup.
*/ */
TALER_EXCHANGEDB_RO_PAYBACK_COIN = 2, TALER_EXCHANGEDB_RO_RECOUP_COIN = 2,
/** /**
* The exchange send inactive funds back from the reserve to the * The exchange send inactive funds back from the reserve to the
@ -463,9 +463,9 @@ struct TALER_EXCHANGEDB_ReserveHistory
struct TALER_EXCHANGEDB_CollectableBlindcoin *withdraw; struct TALER_EXCHANGEDB_CollectableBlindcoin *withdraw;
/** /**
* Details about a /payback operation. * Details about a /recoup operation.
*/ */
struct TALER_EXCHANGEDB_Payback *payback; struct TALER_EXCHANGEDB_Recoup *recoup;
/** /**
* Details about a bank transfer from the exchange (reserve * Details about a bank transfer from the exchange (reserve
@ -875,19 +875,19 @@ enum TALER_EXCHANGEDB_TransactionType
TALER_EXCHANGEDB_TT_REFUND = 2, TALER_EXCHANGEDB_TT_REFUND = 2,
/** /**
* /payback-refresh operation (on the old coin, adding to the old coin's value) * /recoup-refresh operation (on the old coin, adding to the old coin's value)
*/ */
TALER_EXCHANGEDB_TT_OLD_COIN_PAYBACK = 3, TALER_EXCHANGEDB_TT_OLD_COIN_RECOUP = 3,
/** /**
* /payback operation. * /recoup operation.
*/ */
TALER_EXCHANGEDB_TT_PAYBACK = 4, TALER_EXCHANGEDB_TT_RECOUP = 4,
/** /**
* /payback-refresh operation (on the new coin, eliminating its value) * /recoup-refresh operation (on the new coin, eliminating its value)
*/ */
TALER_EXCHANGEDB_TT_PAYBACK_REFRESH = 5 TALER_EXCHANGEDB_TT_RECOUP_REFRESH = 5
}; };
@ -938,24 +938,24 @@ struct TALER_EXCHANGEDB_TransactionList
struct TALER_EXCHANGEDB_RefundListEntry *refund; struct TALER_EXCHANGEDB_RefundListEntry *refund;
/** /**
* Details if transaction was a /payback-refund operation where * Details if transaction was a /recoup-refund operation where
* this coin was the OLD coin. * this coin was the OLD coin.
* (#TALER_EXCHANGEDB_TT_OLD_COIN_PAYBACK). * (#TALER_EXCHANGEDB_TT_OLD_COIN_RECOUP).
*/ */
struct TALER_EXCHANGEDB_PaybackRefreshListEntry *old_coin_payback; struct TALER_EXCHANGEDB_RecoupRefreshListEntry *old_coin_recoup;
/** /**
* Details if transaction was a /payback operation. * Details if transaction was a /recoup operation.
* (#TALER_EXCHANGEDB_TT_PAYBACK) * (#TALER_EXCHANGEDB_TT_RECOUP)
*/ */
struct TALER_EXCHANGEDB_PaybackListEntry *payback; struct TALER_EXCHANGEDB_RecoupListEntry *recoup;
/** /**
* Details if transaction was a /payback-refund operation where * Details if transaction was a /recoup-refund operation where
* this coin was the REFRESHED coin. * this coin was the REFRESHED coin.
* (#TALER_EXCHANGEDB_TT_PAYBACK_REFRESH) * (#TALER_EXCHANGEDB_TT_RECOUP_REFRESH)
*/ */
struct TALER_EXCHANGEDB_PaybackRefreshListEntry *payback_refresh; struct TALER_EXCHANGEDB_RecoupRefreshListEntry *recoup_refresh;
} details; } details;
@ -1373,67 +1373,67 @@ typedef int
/** /**
* Function called about paybacks the exchange has to perform. * Function called about recoups the exchange has to perform.
* *
* @param cls closure * @param cls closure
* @param rowid row identifier used to uniquely identify the payback operation * @param rowid row identifier used to uniquely identify the recoup operation
* @param timestamp when did we receive the payback request * @param timestamp when did we receive the recoup request
* @param amount how much should be added back to the reserve * @param amount how much should be added back to the reserve
* @param reserve_pub public key of the reserve * @param reserve_pub public key of the reserve
* @param coin public information about the coin * @param coin public information about the coin
* @param coin_sig signature with @e coin_pub of type #TALER_SIGNATURE_WALLET_COIN_PAYBACK * @param coin_sig signature with @e coin_pub of type #TALER_SIGNATURE_WALLET_COIN_RECOUP
* @param coin_blind blinding factor used to blind the coin * @param coin_blind blinding factor used to blind the coin
* @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop
*/ */
typedef int typedef int
(*TALER_EXCHANGEDB_PaybackCallback)(void *cls, (*TALER_EXCHANGEDB_RecoupCallback)(void *cls,
uint64_t rowid, uint64_t rowid,
struct GNUNET_TIME_Absolute timestamp, struct GNUNET_TIME_Absolute timestamp,
const struct TALER_Amount *amount, const struct TALER_Amount *amount,
const struct const struct
TALER_ReservePublicKeyP *reserve_pub, TALER_ReservePublicKeyP *reserve_pub,
const struct TALER_CoinPublicInfo *coin, const struct TALER_CoinPublicInfo *coin,
const struct const struct
TALER_DenominationPublicKey *denom_pub, TALER_DenominationPublicKey *denom_pub,
const struct const struct
TALER_CoinSpendSignatureP *coin_sig, TALER_CoinSpendSignatureP *coin_sig,
const struct const struct
TALER_DenominationBlindingKeyP *coin_blind); TALER_DenominationBlindingKeyP *coin_blind);
/** /**
* Function called about paybacks on refreshed coins the exchange has to * Function called about recoups on refreshed coins the exchange has to
* perform. * perform.
* *
* @param cls closure * @param cls closure
* @param rowid row identifier used to uniquely identify the payback operation * @param rowid row identifier used to uniquely identify the recoup operation
* @param timestamp when did we receive the payback request * @param timestamp when did we receive the recoup request
* @param amount how much should be added back to the reserve * @param amount how much should be added back to the reserve
* @param old_coin_pub original coin that was refreshed to create @a coin * @param old_coin_pub original coin that was refreshed to create @a coin
* @param coin public information about the coin * @param coin public information about the coin
* @param coin_sig signature with @e coin_pub of type #TALER_SIGNATURE_WALLET_COIN_PAYBACK * @param coin_sig signature with @e coin_pub of type #TALER_SIGNATURE_WALLET_COIN_RECOUP
* @param coin_blind blinding factor used to blind the coin * @param coin_blind blinding factor used to blind the coin
* @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop
*/ */
typedef int typedef int
(*TALER_EXCHANGEDB_PaybackRefreshCallback)(void *cls, (*TALER_EXCHANGEDB_RecoupRefreshCallback)(void *cls,
uint64_t rowid, uint64_t rowid,
struct GNUNET_TIME_Absolute struct GNUNET_TIME_Absolute
timestamp, timestamp,
const struct TALER_Amount *amount, const struct TALER_Amount *amount,
const struct const struct
TALER_CoinSpendPublicKeyP * TALER_CoinSpendPublicKeyP *
old_coin_pub, old_coin_pub,
const struct const struct
TALER_CoinPublicInfo *coin, TALER_CoinPublicInfo *coin,
const struct const struct
TALER_DenominationPublicKey * TALER_DenominationPublicKey *
denom_pub, denom_pub,
const struct const struct
TALER_CoinSpendSignatureP *coin_sig, TALER_CoinSpendSignatureP *coin_sig,
const struct const struct
TALER_DenominationBlindingKeyP * TALER_DenominationBlindingKeyP *
coin_blind); coin_blind);
/** /**
@ -1487,32 +1487,32 @@ typedef enum GNUNET_DB_QueryStatus
/** /**
* Function called with information justifying an aggregate payback. * Function called with information justifying an aggregate recoup.
* (usually implemented by the auditor when verifying losses from paybacks). * (usually implemented by the auditor when verifying losses from recoups).
* *
* @param cls closure * @param cls closure
* @param rowid row identifier used to uniquely identify the payback operation * @param rowid row identifier used to uniquely identify the recoup operation
* @param coin information about the coin * @param coin information about the coin
* @param coin_sig signature of the coin of type #TALER_SIGNATURE_WALLET_COIN_PAYBACK * @param coin_sig signature of the coin of type #TALER_SIGNATURE_WALLET_COIN_RECOUP
* @param coin_blind blinding key of the coin * @param coin_blind blinding key of the coin
* @param h_blind_ev blinded envelope, as calculated by the exchange * @param h_blind_ev blinded envelope, as calculated by the exchange
* @param amount total amount to be paid back * @param amount total amount to be paid back
*/ */
typedef void typedef void
(*TALER_EXCHANGEDB_PaybackJustificationCallback)(void *cls, (*TALER_EXCHANGEDB_RecoupJustificationCallback)(void *cls,
uint64_t rowid, uint64_t rowid,
const struct const struct
TALER_CoinPublicInfo *coin, TALER_CoinPublicInfo *coin,
const struct const struct
TALER_CoinSpendSignatureP * TALER_CoinSpendSignatureP *
coin_sig, coin_sig,
const struct const struct
TALER_DenominationBlindingKeyP TALER_DenominationBlindingKeyP
*coin_blind, *coin_blind,
const struct const struct
GNUNET_HashCode *h_blinded_ev, GNUNET_HashCode *h_blinded_ev,
const struct const struct
TALER_Amount *amount); TALER_Amount *amount);
/** /**
@ -2192,7 +2192,7 @@ struct TALER_EXCHANGEDB_Plugin
* @param cls the @e cls of this struct with the plugin-specific state * @param cls the @e cls of this struct with the plugin-specific state
* @param session database connection * @param session database connection
* @param coin_pub coin to investigate * @param coin_pub coin to investigate
* @param include_payback include payback transactions of the coin? * @param include_recoup include recoup transactions of the coin?
* @param[out] tlp set to list of transactions, NULL if coin is fresh * @param[out] tlp set to list of transactions, NULL if coin is fresh
* @return database transaction status * @return database transaction status
*/ */
@ -2200,7 +2200,7 @@ struct TALER_EXCHANGEDB_Plugin
(*get_coin_transactions)(void *cls, (*get_coin_transactions)(void *cls,
struct TALER_EXCHANGEDB_Session *session, struct TALER_EXCHANGEDB_Session *session,
const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_CoinSpendPublicKeyP *coin_pub,
int include_payback, int include_recoup,
struct TALER_EXCHANGEDB_TransactionList **tlp); struct TALER_EXCHANGEDB_TransactionList **tlp);
@ -2630,7 +2630,7 @@ struct TALER_EXCHANGEDB_Plugin
/** /**
* Function called to select payback requests the exchange * Function called to select recoup requests the exchange
* received, ordered by serial ID (monotonically increasing). * received, ordered by serial ID (monotonically increasing).
* *
* @param cls closure * @param cls closure
@ -2641,15 +2641,15 @@ struct TALER_EXCHANGEDB_Plugin
* @return transaction status code * @return transaction status code
*/ */
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
(*select_payback_above_serial_id)(void *cls, (*select_recoup_above_serial_id)(void *cls,
struct TALER_EXCHANGEDB_Session *session, struct TALER_EXCHANGEDB_Session *session,
uint64_t serial_id, uint64_t serial_id,
TALER_EXCHANGEDB_PaybackCallback cb, TALER_EXCHANGEDB_RecoupCallback cb,
void *cb_cls); void *cb_cls);
/** /**
* Function called to select payback requests the exchange received for * Function called to select recoup requests the exchange received for
* refreshed coins, ordered by serial ID (monotonically increasing). * refreshed coins, ordered by serial ID (monotonically increasing).
* *
* @param cls closure * @param cls closure
@ -2660,13 +2660,13 @@ struct TALER_EXCHANGEDB_Plugin
* @return transaction status code * @return transaction status code
*/ */
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
(*select_payback_refresh_above_serial_id)(void *cls, (*select_recoup_refresh_above_serial_id)(void *cls,
struct TALER_EXCHANGEDB_Session * struct TALER_EXCHANGEDB_Session *
session, session,
uint64_t serial_id, uint64_t serial_id,
TALER_EXCHANGEDB_PaybackRefreshCallback TALER_EXCHANGEDB_RecoupRefreshCallback
cb, cb,
void *cb_cls); void *cb_cls);
/** /**
@ -2691,14 +2691,14 @@ struct TALER_EXCHANGEDB_Plugin
/** /**
* Function called to add a request for an emergency payback for a * Function called to add a request for an emergency recoup for a
* coin. The funds are to be added back to the reserve. * coin. The funds are to be added back to the reserve.
* *
* @param cls closure * @param cls closure
* @param session database connection * @param session database connection
* @param reserve_pub public key of the reserve that is being refunded * @param reserve_pub public key of the reserve that is being refunded
* @param coin public information about a coin * @param coin public information about a coin
* @param coin_sig signature of the coin of type #TALER_SIGNATURE_WALLET_COIN_PAYBACK * @param coin_sig signature of the coin of type #TALER_SIGNATURE_WALLET_COIN_RECOUP
* @param coin_blind blinding key of the coin * @param coin_blind blinding key of the coin
* @param h_blind_ev blinded envelope, as calculated by the exchange * @param h_blind_ev blinded envelope, as calculated by the exchange
* @param amount total amount to be paid back * @param amount total amount to be paid back
@ -2707,26 +2707,26 @@ struct TALER_EXCHANGEDB_Plugin
* @return transaction result status * @return transaction result status
*/ */
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
(*insert_payback_request)(void *cls, (*insert_recoup_request)(void *cls,
struct TALER_EXCHANGEDB_Session *session, struct TALER_EXCHANGEDB_Session *session,
const struct TALER_ReservePublicKeyP *reserve_pub, const struct TALER_ReservePublicKeyP *reserve_pub,
const struct TALER_CoinPublicInfo *coin, const struct TALER_CoinPublicInfo *coin,
const struct TALER_CoinSpendSignatureP *coin_sig, const struct TALER_CoinSpendSignatureP *coin_sig,
const struct const struct
TALER_DenominationBlindingKeyP *coin_blind, TALER_DenominationBlindingKeyP *coin_blind,
const struct TALER_Amount *amount, const struct TALER_Amount *amount,
const struct GNUNET_HashCode *h_blind_ev, const struct GNUNET_HashCode *h_blind_ev,
struct GNUNET_TIME_Absolute timestamp); struct GNUNET_TIME_Absolute timestamp);
/** /**
* Function called to add a request for an emergency payback for a * Function called to add a request for an emergency recoup for a
* refreshed coin. The funds are to be added back to the original coin. * refreshed coin. The funds are to be added back to the original coin.
* *
* @param cls closure * @param cls closure
* @param session database connection * @param session database connection
* @param coin public information about the refreshed coin * @param coin public information about the refreshed coin
* @param coin_sig signature of the coin of type #TALER_SIGNATURE_WALLET_COIN_PAYBACK * @param coin_sig signature of the coin of type #TALER_SIGNATURE_WALLET_COIN_RECOUP
* @param coin_blind blinding key of the coin * @param coin_blind blinding key of the coin
* @param h_blind_ev blinded envelope, as calculated by the exchange * @param h_blind_ev blinded envelope, as calculated by the exchange
* @param amount total amount to be paid back * @param amount total amount to be paid back
@ -2735,16 +2735,16 @@ struct TALER_EXCHANGEDB_Plugin
* @return transaction result status * @return transaction result status
*/ */
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
(*insert_payback_refresh_request)(void *cls, (*insert_recoup_refresh_request)(void *cls,
struct TALER_EXCHANGEDB_Session *session, struct TALER_EXCHANGEDB_Session *session,
const struct TALER_CoinPublicInfo *coin, const struct TALER_CoinPublicInfo *coin,
const struct const struct
TALER_CoinSpendSignatureP *coin_sig, TALER_CoinSpendSignatureP *coin_sig,
const struct const struct
TALER_DenominationBlindingKeyP *coin_blind, TALER_DenominationBlindingKeyP *coin_blind,
const struct TALER_Amount *amount, const struct TALER_Amount *amount,
const struct GNUNET_HashCode *h_blind_ev, const struct GNUNET_HashCode *h_blind_ev,
struct GNUNET_TIME_Absolute timestamp); struct GNUNET_TIME_Absolute timestamp);
/** /**

View File

@ -115,9 +115,9 @@
#define TALER_SIGNATURE_EXCHANGE_CONFIRM_REFUND 1038 #define TALER_SIGNATURE_EXCHANGE_CONFIRM_REFUND 1038
/** /**
* Signature where the Exchange confirms a payback. * Signature where the Exchange confirms a recoup.
*/ */
#define TALER_SIGNATURE_EXCHANGE_CONFIRM_PAYBACK 1039 #define TALER_SIGNATURE_EXCHANGE_CONFIRM_RECOUP 1039
/** /**
* Signature where the Exchange confirms it closed a reserve. * Signature where the Exchange confirms it closed a reserve.
@ -125,9 +125,9 @@
#define TALER_SIGNATURE_EXCHANGE_RESERVE_CLOSED 1040 #define TALER_SIGNATURE_EXCHANGE_RESERVE_CLOSED 1040
/** /**
* Signature where the Exchange confirms a payback-refresh operation. * Signature where the Exchange confirms a recoup-refresh operation.
*/ */
#define TALER_SIGNATURE_EXCHANGE_CONFIRM_PAYBACK_REFRESH 1041 #define TALER_SIGNATURE_EXCHANGE_CONFIRM_RECOUP_REFRESH 1041
/**********************/ /**********************/
@ -205,9 +205,9 @@
#define TALER_SIGNATURE_WALLET_COIN_MELT 1202 #define TALER_SIGNATURE_WALLET_COIN_MELT 1202
/** /**
* Signature using a coin key requesting payback. * Signature using a coin key requesting recoup.
*/ */
#define TALER_SIGNATURE_WALLET_COIN_PAYBACK 1203 #define TALER_SIGNATURE_WALLET_COIN_RECOUP 1203
/** /**
* Signature using a coin key authenticating link data. * Signature using a coin key authenticating link data.
@ -1223,13 +1223,13 @@ struct TALER_ConfirmWirePS
/** /**
* Signed data to request that a coin should be refunded as part of * Signed data to request that a coin should be refunded as part of
* the "emergency" /payback protocol. The refund will go back to the bank * the "emergency" /recoup protocol. The refund will go back to the bank
* account that created the reserve. * account that created the reserve.
*/ */
struct TALER_PaybackRequestPS struct TALER_RecoupRequestPS
{ {
/** /**
* Purpose is #TALER_SIGNATURE_WALLET_COIN_PAYBACK * Purpose is #TALER_SIGNATURE_WALLET_COIN_RECOUP
*/ */
struct GNUNET_CRYPTO_EccSignaturePurpose purpose; struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
@ -1252,20 +1252,20 @@ struct TALER_PaybackRequestPS
/** /**
* Response by which the exchange affirms that it will * Response by which the exchange affirms that it will
* refund a coin as part of the emergency /payback * refund a coin as part of the emergency /recoup
* protocol. The payback will go back to the bank * protocol. The recoup will go back to the bank
* account that created the reserve. * account that created the reserve.
*/ */
struct TALER_PaybackConfirmationPS struct TALER_RecoupConfirmationPS
{ {
/** /**
* Purpose is #TALER_SIGNATURE_EXCHANGE_CONFIRM_PAYBACK * Purpose is #TALER_SIGNATURE_EXCHANGE_CONFIRM_RECOUP
*/ */
struct GNUNET_CRYPTO_EccSignaturePurpose purpose; struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
/** /**
* When did the exchange receive the payback request? * When did the exchange receive the recoup request?
* Indirectly determines when the wire transfer is (likely) * Indirectly determines when the wire transfer is (likely)
* to happen. * to happen.
*/ */
@ -1275,7 +1275,7 @@ struct TALER_PaybackConfirmationPS
* How much of the coin's value will the exchange transfer? * How much of the coin's value will the exchange transfer?
* (Needed in case the coin was partially spent.) * (Needed in case the coin was partially spent.)
*/ */
struct TALER_AmountNBO payback_amount; struct TALER_AmountNBO recoup_amount;
/** /**
* Public key of the coin. * Public key of the coin.
@ -1283,7 +1283,7 @@ struct TALER_PaybackConfirmationPS
struct TALER_CoinSpendPublicKeyP coin_pub; struct TALER_CoinSpendPublicKeyP coin_pub;
/** /**
* Public key of the reserve that will receive the payback. * Public key of the reserve that will receive the recoup.
*/ */
struct TALER_ReservePublicKeyP reserve_pub; struct TALER_ReservePublicKeyP reserve_pub;
}; };
@ -1291,19 +1291,19 @@ struct TALER_PaybackConfirmationPS
/** /**
* Response by which the exchange affirms that it will refund a refreshed coin * Response by which the exchange affirms that it will refund a refreshed coin
* as part of the emergency /payback protocol. The payback will go back to the * as part of the emergency /recoup protocol. The recoup will go back to the
* old coin's balance. * old coin's balance.
*/ */
struct TALER_PaybackRefreshConfirmationPS struct TALER_RecoupRefreshConfirmationPS
{ {
/** /**
* Purpose is #TALER_SIGNATURE_EXCHANGE_CONFIRM_PAYBACK_REFRESH * Purpose is #TALER_SIGNATURE_EXCHANGE_CONFIRM_RECOUP_REFRESH
*/ */
struct GNUNET_CRYPTO_EccSignaturePurpose purpose; struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
/** /**
* When did the exchange receive the payback request? * When did the exchange receive the recoup request?
* Indirectly determines when the wire transfer is (likely) * Indirectly determines when the wire transfer is (likely)
* to happen. * to happen.
*/ */
@ -1313,7 +1313,7 @@ struct TALER_PaybackRefreshConfirmationPS
* How much of the coin's value will the exchange transfer? * How much of the coin's value will the exchange transfer?
* (Needed in case the coin was partially spent.) * (Needed in case the coin was partially spent.)
*/ */
struct TALER_AmountNBO payback_amount; struct TALER_AmountNBO recoup_amount;
/** /**
* Public key of the refreshed coin. * Public key of the refreshed coin.
@ -1321,7 +1321,7 @@ struct TALER_PaybackRefreshConfirmationPS
struct TALER_CoinSpendPublicKeyP coin_pub; struct TALER_CoinSpendPublicKeyP coin_pub;
/** /**
* Public key of the old coin that will receive the payback. * Public key of the old coin that will receive the recoup.
*/ */
struct TALER_CoinSpendPublicKeyP old_coin_pub; struct TALER_CoinSpendPublicKeyP old_coin_pub;
}; };
@ -1355,7 +1355,7 @@ struct TALER_ReserveCloseConfirmationPS
struct TALER_AmountNBO closing_fee; struct TALER_AmountNBO closing_fee;
/** /**
* Public key of the reserve that received the payback. * Public key of the reserve that received the recoup.
*/ */
struct TALER_ReservePublicKeyP reserve_pub; struct TALER_ReservePublicKeyP reserve_pub;

View File

@ -1567,7 +1567,7 @@ TALER_TESTING_cmd_refund (const char *label,
/** /**
* Make a "payback" command. * Make a "recoup" command.
* *
* @param label the command label * @param label the command label
* @param expected_response_code expected HTTP status code * @param expected_response_code expected HTTP status code
@ -1580,11 +1580,11 @@ TALER_TESTING_cmd_refund (const char *label,
* @return the command. * @return the command.
*/ */
struct TALER_TESTING_Command struct TALER_TESTING_Command
TALER_TESTING_cmd_payback (const char *label, TALER_TESTING_cmd_recoup (const char *label,
unsigned int expected_response_code, unsigned int expected_response_code,
const char *coin_reference, const char *coin_reference,
const char *amount, const char *amount,
const char *melt_reference); const char *melt_reference);
/** /**

View File

@ -24,7 +24,7 @@ libtalerexchange_la_SOURCES = \
exchange_api_common.c \ exchange_api_common.c \
exchange_api_handle.c exchange_api_handle.h \ exchange_api_handle.c exchange_api_handle.h \
exchange_api_deposit.c \ exchange_api_deposit.c \
exchange_api_payback.c \ exchange_api_recoup.c \
exchange_api_refresh.c \ exchange_api_refresh.c \
exchange_api_refresh_link.c \ exchange_api_refresh_link.c \
exchange_api_refund.c \ exchange_api_refund.c \
@ -87,7 +87,7 @@ libtalertesting_la_SOURCES = \
testing_api_cmd_exec_wirewatch.c \ testing_api_cmd_exec_wirewatch.c \
testing_api_cmd_exec_keyup.c \ testing_api_cmd_exec_keyup.c \
testing_api_cmd_exec_auditor-sign.c \ testing_api_cmd_exec_auditor-sign.c \
testing_api_cmd_payback.c \ testing_api_cmd_recoup.c \
testing_api_cmd_refund.c \ testing_api_cmd_refund.c \
testing_api_cmd_refresh.c \ testing_api_cmd_refresh.c \
testing_api_cmd_serialize_keys.c \ testing_api_cmd_serialize_keys.c \

View File

@ -277,9 +277,9 @@ TALER_EXCHANGE_verify_coin_history (const struct
add = GNUNET_NO; add = GNUNET_NO;
} }
else if (0 == strcasecmp (type, else if (0 == strcasecmp (type,
"PAYBACK")) "RECOUP"))
{ {
struct TALER_PaybackConfirmationPS pc; struct TALER_RecoupConfirmationPS pc;
struct TALER_ExchangePublicKeyP exchange_pub; struct TALER_ExchangePublicKeyP exchange_pub;
struct TALER_ExchangeSignatureP exchange_sig; struct TALER_ExchangeSignatureP exchange_sig;
struct GNUNET_JSON_Specification spec[] = { struct GNUNET_JSON_Specification spec[] = {
@ -303,12 +303,12 @@ TALER_EXCHANGE_verify_coin_history (const struct
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
pc.purpose.size = htonl (sizeof (pc)); pc.purpose.size = htonl (sizeof (pc));
pc.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_PAYBACK); pc.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_RECOUP);
pc.coin_pub = *coin_pub; pc.coin_pub = *coin_pub;
TALER_amount_hton (&pc.payback_amount, TALER_amount_hton (&pc.recoup_amount,
&amount); &amount);
if (GNUNET_OK != if (GNUNET_OK !=
GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_EXCHANGE_CONFIRM_PAYBACK, GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_EXCHANGE_CONFIRM_RECOUP,
&pc.purpose, &pc.purpose,
&exchange_sig.eddsa_signature, &exchange_sig.eddsa_signature,
&exchange_pub.eddsa_pub)) &exchange_pub.eddsa_pub))

View File

@ -15,8 +15,8 @@
<http://www.gnu.org/licenses/> <http://www.gnu.org/licenses/>
*/ */
/** /**
* @file lib/exchange_api_payback.c * @file lib/exchange_api_recoup.c
* @brief Implementation of the /payback request of the exchange's HTTP API * @brief Implementation of the /recoup request of the exchange's HTTP API
* @author Christian Grothoff * @author Christian Grothoff
*/ */
#include "platform.h" #include "platform.h"
@ -33,9 +33,9 @@
/** /**
* @brief A Payback Handle * @brief A Recoup Handle
*/ */
struct TALER_EXCHANGE_PaybackHandle struct TALER_EXCHANGE_RecoupHandle
{ {
/** /**
@ -67,7 +67,7 @@ struct TALER_EXCHANGE_PaybackHandle
/** /**
* Function to call with the result. * Function to call with the result.
*/ */
TALER_EXCHANGE_PaybackResultCallback cb; TALER_EXCHANGE_RecoupResultCallback cb;
/** /**
* Closure for @a cb. * Closure for @a cb.
@ -92,17 +92,17 @@ struct TALER_EXCHANGE_PaybackHandle
* from the exchange is valid. If it is, call the * from the exchange is valid. If it is, call the
* callback. * callback.
* *
* @param ph payback handle * @param ph recoup handle
* @param json json reply with the signature * @param json json reply with the signature
* @return #GNUNET_OK if the signature is valid and we called the callback; * @return #GNUNET_OK if the signature is valid and we called the callback;
* #GNUNET_SYSERR if not (callback must still be called) * #GNUNET_SYSERR if not (callback must still be called)
*/ */
static int static int
verify_payback_signature_ok (const struct TALER_EXCHANGE_PaybackHandle *ph, verify_recoup_signature_ok (const struct TALER_EXCHANGE_RecoupHandle *ph,
const json_t *json) const json_t *json)
{ {
struct TALER_PaybackConfirmationPS pc; struct TALER_RecoupConfirmationPS pc;
struct TALER_PaybackRefreshConfirmationPS pr; struct TALER_RecoupRefreshConfirmationPS pr;
struct TALER_ExchangePublicKeyP exchange_pub; struct TALER_ExchangePublicKeyP exchange_pub;
struct TALER_ExchangeSignatureP exchange_sig; struct TALER_ExchangeSignatureP exchange_sig;
struct TALER_Amount amount; struct TALER_Amount amount;
@ -144,15 +144,15 @@ verify_payback_signature_ok (const struct TALER_EXCHANGE_PaybackHandle *ph,
if (ph->was_refreshed) if (ph->was_refreshed)
{ {
pr.purpose.purpose = htonl ( pr.purpose.purpose = htonl (
TALER_SIGNATURE_EXCHANGE_CONFIRM_PAYBACK_REFRESH); TALER_SIGNATURE_EXCHANGE_CONFIRM_RECOUP_REFRESH);
pr.purpose.size = htonl (sizeof (pr)); pr.purpose.size = htonl (sizeof (pr));
pr.timestamp = GNUNET_TIME_absolute_hton (timestamp); pr.timestamp = GNUNET_TIME_absolute_hton (timestamp);
TALER_amount_hton (&pr.payback_amount, TALER_amount_hton (&pr.recoup_amount,
&amount); &amount);
pr.coin_pub = ph->coin_pub; pr.coin_pub = ph->coin_pub;
if (GNUNET_OK != if (GNUNET_OK !=
GNUNET_CRYPTO_eddsa_verify ( GNUNET_CRYPTO_eddsa_verify (
TALER_SIGNATURE_EXCHANGE_CONFIRM_PAYBACK_REFRESH, TALER_SIGNATURE_EXCHANGE_CONFIRM_RECOUP_REFRESH,
&pr.purpose, &pr.purpose,
&exchange_sig.eddsa_signature, &exchange_sig.eddsa_signature,
&exchange_pub.eddsa_pub)) &exchange_pub.eddsa_pub))
@ -163,14 +163,14 @@ verify_payback_signature_ok (const struct TALER_EXCHANGE_PaybackHandle *ph,
} }
else else
{ {
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.purpose.size = htonl (sizeof (pc));
pc.timestamp = GNUNET_TIME_absolute_hton (timestamp); pc.timestamp = GNUNET_TIME_absolute_hton (timestamp);
TALER_amount_hton (&pc.payback_amount, TALER_amount_hton (&pc.recoup_amount,
&amount); &amount);
pc.coin_pub = ph->coin_pub; pc.coin_pub = ph->coin_pub;
if (GNUNET_OK != if (GNUNET_OK !=
GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_EXCHANGE_CONFIRM_PAYBACK, GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_EXCHANGE_CONFIRM_RECOUP,
&pc.purpose, &pc.purpose,
&exchange_sig.eddsa_signature, &exchange_sig.eddsa_signature,
&exchange_pub.eddsa_pub)) &exchange_pub.eddsa_pub))
@ -193,18 +193,18 @@ verify_payback_signature_ok (const struct TALER_EXCHANGE_PaybackHandle *ph,
/** /**
* Function called when we're done processing the * Function called when we're done processing the
* HTTP /payback request. * HTTP /recoup request.
* *
* @param cls the `struct TALER_EXCHANGE_PaybackHandle` * @param cls the `struct TALER_EXCHANGE_RecoupHandle`
* @param response_code HTTP response code, 0 on error * @param response_code HTTP response code, 0 on error
* @param response parsed JSON result, NULL on error * @param response parsed JSON result, NULL on error
*/ */
static void static void
handle_payback_finished (void *cls, handle_recoup_finished (void *cls,
long response_code, long response_code,
const void *response) const void *response)
{ {
struct TALER_EXCHANGE_PaybackHandle *ph = cls; struct TALER_EXCHANGE_RecoupHandle *ph = cls;
const json_t *j = response; const json_t *j = response;
ph->job = NULL; ph->job = NULL;
@ -214,14 +214,14 @@ handle_payback_finished (void *cls,
break; break;
case MHD_HTTP_OK: case MHD_HTTP_OK:
if (GNUNET_OK != if (GNUNET_OK !=
verify_payback_signature_ok (ph, verify_recoup_signature_ok (ph,
j)) j))
{ {
GNUNET_break_op (0); GNUNET_break_op (0);
response_code = 0; response_code = 0;
break; break;
} }
TALER_EXCHANGE_payback_cancel (ph); TALER_EXCHANGE_recoup_cancel (ph);
return; return;
case MHD_HTTP_BAD_REQUEST: case MHD_HTTP_BAD_REQUEST:
/* This should never happen, either us or the exchange is buggy /* This should never happen, either us or the exchange is buggy
@ -255,7 +255,7 @@ handle_payback_finished (void *cls,
NULL, NULL,
NULL, NULL,
j); j);
TALER_EXCHANGE_payback_cancel (ph); TALER_EXCHANGE_recoup_cancel (ph);
return; return;
} }
case MHD_HTTP_FORBIDDEN: case MHD_HTTP_FORBIDDEN:
@ -292,13 +292,13 @@ handle_payback_finished (void *cls,
NULL, NULL,
NULL, NULL,
j); j);
TALER_EXCHANGE_payback_cancel (ph); TALER_EXCHANGE_recoup_cancel (ph);
} }
/** /**
* Ask the exchange to pay back a coin due to the exchange triggering * Ask the exchange to pay back a coin due to the exchange triggering
* the emergency payback protocol for a given denomination. The value * the emergency recoup protocol for a given denomination. The value
* of the coin will be refunded to the original customer (without fees). * of the coin will be refunded to the original customer (without fees).
* *
* @param exchange the exchange handle; the exchange must be ready to operate * @param exchange the exchange handle; the exchange must be ready to operate
@ -306,33 +306,33 @@ handle_payback_finished (void *cls,
* @param denom_sig signature over the coin by the exchange using @a pk * @param denom_sig signature over the coin by the exchange using @a pk
* @param ps secret internals of the original planchet * @param ps secret internals of the original planchet
* @param was_refreshed #GNUNET_YES if the coin in @a ps was refreshed * @param was_refreshed #GNUNET_YES if the coin in @a ps was refreshed
* @param payback_cb the callback to call when the final result for this request is available * @param recoup_cb the callback to call when the final result for this request is available
* @param payback_cb_cls closure for @a payback_cb * @param recoup_cb_cls closure for @a recoup_cb
* @return NULL * @return NULL
* if the inputs are invalid (i.e. denomination key not with this exchange). * if the inputs are invalid (i.e. denomination key not with this exchange).
* In this case, the callback is not called. * In this case, the callback is not called.
*/ */
struct TALER_EXCHANGE_PaybackHandle * struct TALER_EXCHANGE_RecoupHandle *
TALER_EXCHANGE_payback (struct TALER_EXCHANGE_Handle *exchange, TALER_EXCHANGE_recoup (struct TALER_EXCHANGE_Handle *exchange,
const struct TALER_EXCHANGE_DenomPublicKey *pk, const struct TALER_EXCHANGE_DenomPublicKey *pk,
const struct TALER_DenominationSignature *denom_sig, const struct TALER_DenominationSignature *denom_sig,
const struct TALER_PlanchetSecretsP *ps, const struct TALER_PlanchetSecretsP *ps,
int was_refreshed, int was_refreshed,
TALER_EXCHANGE_PaybackResultCallback payback_cb, TALER_EXCHANGE_RecoupResultCallback recoup_cb,
void *payback_cb_cls) void *recoup_cb_cls)
{ {
struct TALER_EXCHANGE_PaybackHandle *ph; struct TALER_EXCHANGE_RecoupHandle *ph;
struct GNUNET_CURL_Context *ctx; struct GNUNET_CURL_Context *ctx;
struct TALER_PaybackRequestPS pr; struct TALER_RecoupRequestPS pr;
struct TALER_CoinSpendSignatureP coin_sig; struct TALER_CoinSpendSignatureP coin_sig;
struct GNUNET_HashCode h_denom_pub; struct GNUNET_HashCode h_denom_pub;
json_t *payback_obj; json_t *recoup_obj;
CURL *eh; CURL *eh;
GNUNET_assert (GNUNET_YES == GNUNET_assert (GNUNET_YES ==
TEAH_handle_is_ready (exchange)); TEAH_handle_is_ready (exchange));
pr.purpose.purpose = htonl (TALER_SIGNATURE_WALLET_COIN_PAYBACK); pr.purpose.purpose = htonl (TALER_SIGNATURE_WALLET_COIN_RECOUP);
pr.purpose.size = htonl (sizeof (struct TALER_PaybackRequestPS)); pr.purpose.size = htonl (sizeof (struct TALER_RecoupRequestPS));
GNUNET_CRYPTO_eddsa_key_get_public (&ps->coin_priv.eddsa_priv, GNUNET_CRYPTO_eddsa_key_get_public (&ps->coin_priv.eddsa_priv,
&pr.coin_pub.eddsa_pub); &pr.coin_pub.eddsa_pub);
GNUNET_CRYPTO_rsa_public_key_hash (pk->key.rsa_public_key, GNUNET_CRYPTO_rsa_public_key_hash (pk->key.rsa_public_key,
@ -344,70 +344,70 @@ TALER_EXCHANGE_payback (struct TALER_EXCHANGE_Handle *exchange,
&pr.purpose, &pr.purpose,
&coin_sig.eddsa_signature)); &coin_sig.eddsa_signature));
payback_obj = json_pack ("{s:o, s:o," /* denom pub/sig */ recoup_obj = json_pack ("{s:o, s:o," /* denom pub/sig */
" s:o, s:o," /* coin pub/sig */ " s:o, s:o," /* coin pub/sig */
" s:o, s:o}", /* coin_bks */ " s:o, s:o}", /* coin_bks */
"denom_pub_hash", GNUNET_JSON_from_data_auto ( "denom_pub_hash", GNUNET_JSON_from_data_auto (
&h_denom_pub), &h_denom_pub),
"denom_sig", GNUNET_JSON_from_rsa_signature ( "denom_sig", GNUNET_JSON_from_rsa_signature (
denom_sig->rsa_signature), denom_sig->rsa_signature),
"coin_pub", GNUNET_JSON_from_data_auto ( "coin_pub", GNUNET_JSON_from_data_auto (
&pr.coin_pub), &pr.coin_pub),
"coin_sig", GNUNET_JSON_from_data_auto (&coin_sig), "coin_sig", GNUNET_JSON_from_data_auto (&coin_sig),
"coin_blind_key_secret", GNUNET_JSON_from_data_auto ( "coin_blind_key_secret", GNUNET_JSON_from_data_auto (
&ps->blinding_key), &ps->blinding_key),
"refreshed", json_boolean (was_refreshed) "refreshed", json_boolean (was_refreshed)
); );
if (NULL == payback_obj) if (NULL == recoup_obj)
{ {
GNUNET_break (0); GNUNET_break (0);
return NULL; return NULL;
} }
ph = GNUNET_new (struct TALER_EXCHANGE_PaybackHandle); ph = GNUNET_new (struct TALER_EXCHANGE_RecoupHandle);
ph->coin_pub = pr.coin_pub; ph->coin_pub = pr.coin_pub;
ph->exchange = exchange; ph->exchange = exchange;
ph->pk = *pk; ph->pk = *pk;
ph->pk.key.rsa_public_key = NULL; /* zero out, as lifetime cannot be warranted */ ph->pk.key.rsa_public_key = NULL; /* zero out, as lifetime cannot be warranted */
ph->cb = payback_cb; ph->cb = recoup_cb;
ph->cb_cls = payback_cb_cls; ph->cb_cls = recoup_cb_cls;
ph->url = TEAH_path_to_url (exchange, "/payback"); ph->url = TEAH_path_to_url (exchange, "/recoup");
ph->was_refreshed = was_refreshed; ph->was_refreshed = was_refreshed;
eh = TEL_curl_easy_get (ph->url); eh = TEL_curl_easy_get (ph->url);
if (GNUNET_OK != if (GNUNET_OK !=
TALER_curl_easy_post (&ph->ctx, TALER_curl_easy_post (&ph->ctx,
eh, eh,
payback_obj)) recoup_obj))
{ {
GNUNET_break (0); GNUNET_break (0);
curl_easy_cleanup (eh); curl_easy_cleanup (eh);
json_decref (payback_obj); json_decref (recoup_obj);
GNUNET_free (ph->url); GNUNET_free (ph->url);
GNUNET_free (ph); GNUNET_free (ph);
return NULL; return NULL;
} }
json_decref (payback_obj); json_decref (recoup_obj);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"URL for payback: `%s'\n", "URL for recoup: `%s'\n",
ph->url); ph->url);
ctx = TEAH_handle_to_context (exchange); ctx = TEAH_handle_to_context (exchange);
ph->job = GNUNET_CURL_job_add2 (ctx, ph->job = GNUNET_CURL_job_add2 (ctx,
eh, eh,
ph->ctx.headers, ph->ctx.headers,
&handle_payback_finished, &handle_recoup_finished,
ph); ph);
return ph; return ph;
} }
/** /**
* Cancel a payback request. This function cannot be used on a * Cancel a recoup request. This function cannot be used on a
* request handle if the callback was already invoked. * request handle if the callback was already invoked.
* *
* @param ph the payback handle * @param ph the recoup handle
*/ */
void void
TALER_EXCHANGE_payback_cancel (struct TALER_EXCHANGE_PaybackHandle *ph) TALER_EXCHANGE_recoup_cancel (struct TALER_EXCHANGE_RecoupHandle *ph)
{ {
if (NULL != ph->job) if (NULL != ph->job)
{ {
@ -420,4 +420,4 @@ TALER_EXCHANGE_payback_cancel (struct TALER_EXCHANGE_PaybackHandle *ph)
} }
/* end of exchange_api_payback.c */ /* end of exchange_api_recoup.c */

View File

@ -284,59 +284,59 @@ parse_reserve_history (struct TALER_EXCHANGE_Handle *exchange,
/* end type==WITHDRAW */ /* end type==WITHDRAW */
} }
else if (0 == strcasecmp (type, else if (0 == strcasecmp (type,
"PAYBACK")) "RECOUP"))
{ {
struct TALER_PaybackConfirmationPS pc; struct TALER_RecoupConfirmationPS pc;
struct GNUNET_TIME_Absolute timestamp; struct GNUNET_TIME_Absolute timestamp;
const struct TALER_EXCHANGE_Keys *key_state; const struct TALER_EXCHANGE_Keys *key_state;
struct GNUNET_JSON_Specification payback_spec[] = { struct GNUNET_JSON_Specification recoup_spec[] = {
GNUNET_JSON_spec_fixed_auto ("coin_pub", GNUNET_JSON_spec_fixed_auto ("coin_pub",
&pc.coin_pub), &pc.coin_pub),
GNUNET_JSON_spec_fixed_auto ("exchange_sig", GNUNET_JSON_spec_fixed_auto ("exchange_sig",
&rhistory[off].details.payback_details. &rhistory[off].details.recoup_details.
exchange_sig), exchange_sig),
GNUNET_JSON_spec_fixed_auto ("exchange_pub", GNUNET_JSON_spec_fixed_auto ("exchange_pub",
&rhistory[off].details.payback_details. &rhistory[off].details.recoup_details.
exchange_pub), exchange_pub),
GNUNET_JSON_spec_absolute_time_nbo ("timestamp", GNUNET_JSON_spec_absolute_time_nbo ("timestamp",
&pc.timestamp), &pc.timestamp),
GNUNET_JSON_spec_end () GNUNET_JSON_spec_end ()
}; };
rhistory[off].type = TALER_EXCHANGE_RTT_PAYBACK; rhistory[off].type = TALER_EXCHANGE_RTT_RECOUP;
rhistory[off].amount = amount; rhistory[off].amount = amount;
if (GNUNET_OK != if (GNUNET_OK !=
GNUNET_JSON_parse (transaction, GNUNET_JSON_parse (transaction,
payback_spec, recoup_spec,
NULL, NULL)) NULL, NULL))
{ {
GNUNET_break_op (0); GNUNET_break_op (0);
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
rhistory[off].details.payback_details.coin_pub = pc.coin_pub; rhistory[off].details.recoup_details.coin_pub = pc.coin_pub;
TALER_amount_hton (&pc.payback_amount, TALER_amount_hton (&pc.recoup_amount,
&amount); &amount);
pc.purpose.size = htonl (sizeof (pc)); pc.purpose.size = htonl (sizeof (pc));
pc.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_PAYBACK); pc.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_RECOUP);
pc.reserve_pub = *reserve_pub; pc.reserve_pub = *reserve_pub;
timestamp = GNUNET_TIME_absolute_ntoh (pc.timestamp); timestamp = GNUNET_TIME_absolute_ntoh (pc.timestamp);
rhistory[off].details.payback_details.timestamp = timestamp; rhistory[off].details.recoup_details.timestamp = timestamp;
key_state = TALER_EXCHANGE_get_keys (exchange); key_state = TALER_EXCHANGE_get_keys (exchange);
if (GNUNET_OK != if (GNUNET_OK !=
TALER_EXCHANGE_test_signing_key (key_state, TALER_EXCHANGE_test_signing_key (key_state,
&rhistory[off].details. &rhistory[off].details.
payback_details.exchange_pub)) recoup_details.exchange_pub))
{ {
GNUNET_break_op (0); GNUNET_break_op (0);
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
if (GNUNET_OK != if (GNUNET_OK !=
GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_EXCHANGE_CONFIRM_PAYBACK, GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_EXCHANGE_CONFIRM_RECOUP,
&pc.purpose, &pc.purpose,
&rhistory[off].details.payback_details. &rhistory[off].details.recoup_details.
exchange_sig.eddsa_signature, exchange_sig.eddsa_signature,
&rhistory[off].details.payback_details. &rhistory[off].details.recoup_details.
exchange_pub.eddsa_pub)) exchange_pub.eddsa_pub))
{ {
GNUNET_break_op (0); GNUNET_break_op (0);
@ -351,7 +351,7 @@ parse_reserve_history (struct TALER_EXCHANGE_Handle *exchange,
GNUNET_break_op (0); GNUNET_break_op (0);
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
/* end type==PAYBACK */ /* end type==RECOUP */
} }
else if (0 == strcasecmp (type, else if (0 == strcasecmp (type,
"CLOSING")) "CLOSING"))
@ -475,7 +475,7 @@ free_rhistory (struct TALER_EXCHANGE_ReserveHistory *rhistory,
break; break;
case TALER_EXCHANGE_RTT_WITHDRAWAL: case TALER_EXCHANGE_RTT_WITHDRAWAL:
break; break;
case TALER_EXCHANGE_RTT_PAYBACK: case TALER_EXCHANGE_RTT_RECOUP:
break; break;
case TALER_EXCHANGE_RTT_CLOSE: case TALER_EXCHANGE_RTT_CLOSE:
// should we free "receiver_account_details" ? // should we free "receiver_account_details" ?

View File

@ -382,12 +382,12 @@ run (void *cls,
TALER_TESTING_cmd_end () TALER_TESTING_cmd_end ()
}; };
struct TALER_TESTING_Command payback[] = { struct TALER_TESTING_Command recoup[] = {
/** /**
* Fill reserve with EUR:5.01, as withdraw fee is 1 ct per * Fill reserve with EUR:5.01, as withdraw fee is 1 ct per
* config. * config.
*/ */
CMD_TRANSFER_TO_EXCHANGE ("payback-create-reserve-1", CMD_TRANSFER_TO_EXCHANGE ("recoup-create-reserve-1",
"EUR:5.01"), "EUR:5.01"),
/** /**
* Run wire-watch to trigger the reserve creation. * Run wire-watch to trigger the reserve creation.
@ -396,24 +396,24 @@ run (void *cls,
/** /**
* Withdraw a 5 EUR coin, at fee of 1 ct * Withdraw a 5 EUR coin, at fee of 1 ct
*/ */
TALER_TESTING_cmd_withdraw_amount ("payback-withdraw-coin-1", TALER_TESTING_cmd_withdraw_amount ("recoup-withdraw-coin-1",
"payback-create-reserve-1", "recoup-create-reserve-1",
"EUR:5", "EUR:5",
MHD_HTTP_OK), MHD_HTTP_OK),
TALER_TESTING_cmd_revoke ("revoke-1", TALER_TESTING_cmd_revoke ("revoke-1",
MHD_HTTP_OK, MHD_HTTP_OK,
"payback-withdraw-coin-1", "recoup-withdraw-coin-1",
CONFIG_FILE), CONFIG_FILE),
TALER_TESTING_cmd_payback ("payback-1", TALER_TESTING_cmd_recoup ("recoup-1",
MHD_HTTP_OK, MHD_HTTP_OK,
"payback-withdraw-coin-1", "recoup-withdraw-coin-1",
"EUR:5", "EUR:5",
NULL), NULL),
/** /**
* Re-withdraw from this reserve * Re-withdraw from this reserve
*/ */
TALER_TESTING_cmd_withdraw_amount ("payback-withdraw-coin-2", TALER_TESTING_cmd_withdraw_amount ("recoup-withdraw-coin-2",
"payback-create-reserve-1", "recoup-create-reserve-1",
"EUR:1", "EUR:1",
MHD_HTTP_OK), MHD_HTTP_OK),
/** /**
@ -432,7 +432,7 @@ run (void *cls,
* then have the rest paid back. Check deposit of other coin * then have the rest paid back. Check deposit of other coin
* fails. (Do not use EUR:5 here as the EUR:5 coin was * fails. (Do not use EUR:5 here as the EUR:5 coin was
* revoked and we did not bother to create a new one...) * revoked and we did not bother to create a new one...)
*/CMD_TRANSFER_TO_EXCHANGE ("payback-create-reserve-2", */CMD_TRANSFER_TO_EXCHANGE ("recoup-create-reserve-2",
"EUR:2.02"), "EUR:2.02"),
/** /**
* Make previous command effective. * Make previous command effective.
@ -441,19 +441,19 @@ run (void *cls,
/** /**
* Withdraw a 1 EUR coin, at fee of 1 ct * Withdraw a 1 EUR coin, at fee of 1 ct
*/ */
TALER_TESTING_cmd_withdraw_amount ("payback-withdraw-coin-2a", TALER_TESTING_cmd_withdraw_amount ("recoup-withdraw-coin-2a",
"payback-create-reserve-2", "recoup-create-reserve-2",
"EUR:1", "EUR:1",
MHD_HTTP_OK), MHD_HTTP_OK),
/** /**
* Withdraw a 1 EUR coin, at fee of 1 ct * Withdraw a 1 EUR coin, at fee of 1 ct
*/ */
TALER_TESTING_cmd_withdraw_amount ("payback-withdraw-coin-2b", TALER_TESTING_cmd_withdraw_amount ("recoup-withdraw-coin-2b",
"payback-create-reserve-2", "recoup-create-reserve-2",
"EUR:1", "EUR:1",
MHD_HTTP_OK), MHD_HTTP_OK),
TALER_TESTING_cmd_deposit ("payback-deposit-partial", TALER_TESTING_cmd_deposit ("recoup-deposit-partial",
"payback-withdraw-coin-2a", "recoup-withdraw-coin-2a",
0, 0,
bc.user42_payto, bc.user42_payto,
"{\"items\":[{\"name\":\"more ice cream\",\"value\":1}]}", "{\"items\":[{\"name\":\"more ice cream\",\"value\":1}]}",
@ -462,13 +462,13 @@ run (void *cls,
MHD_HTTP_OK), MHD_HTTP_OK),
TALER_TESTING_cmd_revoke ("revoke-2", TALER_TESTING_cmd_revoke ("revoke-2",
MHD_HTTP_OK, MHD_HTTP_OK,
"payback-withdraw-coin-2a", "recoup-withdraw-coin-2a",
CONFIG_FILE), CONFIG_FILE),
TALER_TESTING_cmd_payback ("payback-2", TALER_TESTING_cmd_recoup ("recoup-2",
MHD_HTTP_OK, MHD_HTTP_OK,
"payback-withdraw-coin-2a", "recoup-withdraw-coin-2a",
"EUR:0.5", "EUR:0.5",
NULL), NULL),
TALER_TESTING_cmd_end () TALER_TESTING_cmd_end ()
}; };
@ -647,8 +647,8 @@ run (void *cls,
unaggregation), unaggregation),
TALER_TESTING_cmd_batch ("refund", TALER_TESTING_cmd_batch ("refund",
refund), refund),
TALER_TESTING_cmd_batch ("payback", TALER_TESTING_cmd_batch ("recoup",
payback), recoup),
CMD_RUN_AUDITOR ("normal-auditor"), CMD_RUN_AUDITOR ("normal-auditor"),
CMD_RUN_WIRE_AUDITOR ("normal-wire-auditor"), CMD_RUN_WIRE_AUDITOR ("normal-wire-auditor"),
TALER_TESTING_cmd_end () TALER_TESTING_cmd_end ()

View File

@ -553,58 +553,58 @@ run (void *cls,
TALER_TESTING_cmd_end () TALER_TESTING_cmd_end ()
}; };
struct TALER_TESTING_Command payback[] = { struct TALER_TESTING_Command recoup[] = {
/** /**
* Fill reserve with EUR:5.01, as withdraw fee is 1 ct per * Fill reserve with EUR:5.01, as withdraw fee is 1 ct per
* config. * config.
*/ */
CMD_TRANSFER_TO_EXCHANGE ("payback-create-reserve-1", CMD_TRANSFER_TO_EXCHANGE ("recoup-create-reserve-1",
"EUR:5.01"), "EUR:5.01"),
TALER_TESTING_cmd_check_bank_admin_transfer ("payback-create-reserve-1", TALER_TESTING_cmd_check_bank_admin_transfer ("recoup-create-reserve-1",
"EUR:5.01", "EUR:5.01",
bc.user42_payto, bc.user42_payto,
bc.exchange_payto, bc.exchange_payto,
"payback-create-reserve-1"), "recoup-create-reserve-1"),
/** /**
* Run wire-watch to trigger the reserve creation. * Run wire-watch to trigger the reserve creation.
*/ */
CMD_EXEC_WIREWATCH ("wirewatch-4"), CMD_EXEC_WIREWATCH ("wirewatch-4"),
/* Withdraw a 5 EUR coin, at fee of 1 ct */ /* Withdraw a 5 EUR coin, at fee of 1 ct */
TALER_TESTING_cmd_withdraw_amount ("payback-withdraw-coin-1", TALER_TESTING_cmd_withdraw_amount ("recoup-withdraw-coin-1",
"payback-create-reserve-1", "recoup-create-reserve-1",
"EUR:5", "EUR:5",
MHD_HTTP_OK), MHD_HTTP_OK),
/* Make coin invalid */ /* Make coin invalid */
TALER_TESTING_cmd_revoke ("revoke-0-EUR:5", TALER_TESTING_cmd_revoke ("revoke-0-EUR:5",
MHD_HTTP_OK, MHD_HTTP_OK,
"payback-withdraw-coin-1", "recoup-withdraw-coin-1",
CONFIG_FILE), CONFIG_FILE),
/* Refund coin to bank account */ /* Refund coin to bank account */
TALER_TESTING_cmd_payback ("payback-1", TALER_TESTING_cmd_recoup ("recoup-1",
MHD_HTTP_OK, MHD_HTTP_OK,
"payback-withdraw-coin-1", "recoup-withdraw-coin-1",
"EUR:5", "EUR:5",
NULL), NULL),
/* Check the money is back with the reserve */ /* Check the money is back with the reserve */
TALER_TESTING_cmd_status ("payback-reserve-status-1", TALER_TESTING_cmd_status ("recoup-reserve-status-1",
"payback-create-reserve-1", "recoup-create-reserve-1",
"EUR:5.0", "EUR:5.0",
MHD_HTTP_OK), MHD_HTTP_OK),
/* Re-withdraw from this reserve */ /* Re-withdraw from this reserve */
TALER_TESTING_cmd_withdraw_amount ("payback-withdraw-coin-2", TALER_TESTING_cmd_withdraw_amount ("recoup-withdraw-coin-2",
"payback-create-reserve-1", "recoup-create-reserve-1",
"EUR:1", "EUR:1",
MHD_HTTP_OK), MHD_HTTP_OK),
/** /**
* This withdrawal will test the logic to create a "payback" * This withdrawal will test the logic to create a "recoup"
* element to insert into the reserve's history. * element to insert into the reserve's history.
*/ */
TALER_TESTING_cmd_withdraw_amount ("payback-withdraw-coin-2-over", TALER_TESTING_cmd_withdraw_amount ("recoup-withdraw-coin-2-over",
"payback-create-reserve-1", "recoup-create-reserve-1",
"EUR:10", "EUR:10",
MHD_HTTP_CONFLICT), MHD_HTTP_CONFLICT),
TALER_TESTING_cmd_status ("payback-reserve-status-2", TALER_TESTING_cmd_status ("recoup-reserve-status-2",
"payback-create-reserve-1", "recoup-create-reserve-1",
"EUR:3.99", "EUR:3.99",
MHD_HTTP_OK), MHD_HTTP_OK),
@ -642,27 +642,27 @@ run (void *cls,
* then have the rest paid back. Check deposit of other coin * then have the rest paid back. Check deposit of other coin
* fails. Do not use EUR:5 here as the EUR:5 coin was * fails. Do not use EUR:5 here as the EUR:5 coin was
* revoked and we did not bother to create a new one... */// * revoked and we did not bother to create a new one... *///
CMD_TRANSFER_TO_EXCHANGE ("payback-create-reserve-2", CMD_TRANSFER_TO_EXCHANGE ("recoup-create-reserve-2",
"EUR:2.02"), "EUR:2.02"),
TALER_TESTING_cmd_check_bank_admin_transfer ("ck-payback-create-reserve-2", TALER_TESTING_cmd_check_bank_admin_transfer ("ck-recoup-create-reserve-2",
"EUR:2.02", "EUR:2.02",
bc.user42_payto, bc.user42_payto,
bc.exchange_payto, bc.exchange_payto,
"payback-create-reserve-2"), "recoup-create-reserve-2"),
/* Make previous command effective. */ /* Make previous command effective. */
CMD_EXEC_WIREWATCH ("wirewatch-5"), CMD_EXEC_WIREWATCH ("wirewatch-5"),
/* Withdraw a 1 EUR coin, at fee of 1 ct */ /* Withdraw a 1 EUR coin, at fee of 1 ct */
TALER_TESTING_cmd_withdraw_amount ("payback-withdraw-coin-2a", TALER_TESTING_cmd_withdraw_amount ("recoup-withdraw-coin-2a",
"payback-create-reserve-2", "recoup-create-reserve-2",
"EUR:1", "EUR:1",
MHD_HTTP_OK), MHD_HTTP_OK),
/* Withdraw a 1 EUR coin, at fee of 1 ct */ /* Withdraw a 1 EUR coin, at fee of 1 ct */
TALER_TESTING_cmd_withdraw_amount ("payback-withdraw-coin-2b", TALER_TESTING_cmd_withdraw_amount ("recoup-withdraw-coin-2b",
"payback-create-reserve-2", "recoup-create-reserve-2",
"EUR:1", "EUR:1",
MHD_HTTP_OK), MHD_HTTP_OK),
TALER_TESTING_cmd_deposit ("payback-deposit-partial", TALER_TESTING_cmd_deposit ("recoup-deposit-partial",
"payback-withdraw-coin-2a", "recoup-withdraw-coin-2a",
0, 0,
bc.user42_payto, bc.user42_payto,
"{\"items\":[{\"name\":\"more ice cream\",\"value\":1}]}", "{\"items\":[{\"name\":\"more ice cream\",\"value\":1}]}",
@ -671,32 +671,32 @@ run (void *cls,
MHD_HTTP_OK), MHD_HTTP_OK),
TALER_TESTING_cmd_revoke ("revoke-1-EUR:1", TALER_TESTING_cmd_revoke ("revoke-1-EUR:1",
MHD_HTTP_OK, MHD_HTTP_OK,
"payback-withdraw-coin-2a", "recoup-withdraw-coin-2a",
CONFIG_FILE), CONFIG_FILE),
TALER_TESTING_cmd_payback ("payback-2", TALER_TESTING_cmd_recoup ("recoup-2",
MHD_HTTP_OK, MHD_HTTP_OK,
"payback-withdraw-coin-2a", "recoup-withdraw-coin-2a",
"EUR:0.5", "EUR:0.5",
NULL), NULL),
TALER_TESTING_cmd_payback ("payback-2b", TALER_TESTING_cmd_recoup ("recoup-2b",
MHD_HTTP_CONFLICT, MHD_HTTP_CONFLICT,
"payback-withdraw-coin-2a", "recoup-withdraw-coin-2a",
"EUR:0.5", "EUR:0.5",
NULL), NULL),
TALER_TESTING_cmd_deposit ("payback-deposit-revoked", TALER_TESTING_cmd_deposit ("recoup-deposit-revoked",
"payback-withdraw-coin-2b", "recoup-withdraw-coin-2b",
0, 0,
bc.user42_payto, bc.user42_payto,
"{\"items\":[{\"name\":\"more ice cream\",\"value\":1}]}", "{\"items\":[{\"name\":\"more ice cream\",\"value\":1}]}",
GNUNET_TIME_UNIT_ZERO, GNUNET_TIME_UNIT_ZERO,
"EUR:1", "EUR:1",
MHD_HTTP_NOT_FOUND), MHD_HTTP_NOT_FOUND),
/* Test deposit fails after payback, with proof in payback */ /* Test deposit fails after recoup, with proof in recoup */
/* Note that, the exchange will never return the coin's transaction /* Note that, the exchange will never return the coin's transaction
* history with payback data, as we get a 404 on the DK! */ * history with recoup data, as we get a 404 on the DK! */
TALER_TESTING_cmd_deposit ("payback-deposit-partial-after-payback", TALER_TESTING_cmd_deposit ("recoup-deposit-partial-after-recoup",
"payback-withdraw-coin-2a", "recoup-withdraw-coin-2a",
0, 0,
bc.user42_payto, bc.user42_payto,
"{\"items\":[{\"name\":\"extra ice cream\",\"value\":1}]}", "{\"items\":[{\"name\":\"extra ice cream\",\"value\":1}]}",
@ -704,17 +704,17 @@ run (void *cls,
"EUR:0.5", "EUR:0.5",
MHD_HTTP_NOT_FOUND), MHD_HTTP_NOT_FOUND),
/* Test that revoked coins cannot be withdrawn */ /* Test that revoked coins cannot be withdrawn */
CMD_TRANSFER_TO_EXCHANGE ("payback-create-reserve-3", CMD_TRANSFER_TO_EXCHANGE ("recoup-create-reserve-3",
"EUR:1.01"), "EUR:1.01"),
TALER_TESTING_cmd_check_bank_admin_transfer ( TALER_TESTING_cmd_check_bank_admin_transfer (
"check-payback-create-reserve-3", "check-recoup-create-reserve-3",
"EUR:1.01", "EUR:1.01",
bc.user42_payto, bc.user42_payto,
bc.exchange_payto, bc.exchange_payto,
"payback-create-reserve-3"), "recoup-create-reserve-3"),
CMD_EXEC_WIREWATCH ("wirewatch-6"), CMD_EXEC_WIREWATCH ("wirewatch-6"),
TALER_TESTING_cmd_withdraw_amount ("payback-withdraw-coin-3-revoked", TALER_TESTING_cmd_withdraw_amount ("recoup-withdraw-coin-3-revoked",
"payback-create-reserve-3", "recoup-create-reserve-3",
"EUR:1", "EUR:1",
MHD_HTTP_NOT_FOUND), MHD_HTTP_NOT_FOUND),
/* check that we are empty before the rejection test */ /* check that we are empty before the rejection test */
@ -767,8 +767,8 @@ run (void *cls,
unaggregation), unaggregation),
TALER_TESTING_cmd_batch ("refund", TALER_TESTING_cmd_batch ("refund",
refund), refund),
TALER_TESTING_cmd_batch ("payback", TALER_TESTING_cmd_batch ("recoup",
payback), recoup),
TALER_TESTING_cmd_batch ("reserve-open-close", TALER_TESTING_cmd_batch ("reserve-open-close",
reserve_open_close), reserve_open_close),
/* End the suite. */ /* End the suite. */

View File

@ -114,22 +114,22 @@ run (void *cls,
"refresh-melt-1", "refresh-melt-1",
CONFIG_FILE), CONFIG_FILE),
/* Refund coin to original coin */ /* Refund coin to original coin */
TALER_TESTING_cmd_payback ("payback-1a", TALER_TESTING_cmd_recoup ("recoup-1a",
MHD_HTTP_OK, MHD_HTTP_OK,
"refresh-reveal-1#0", "refresh-reveal-1#0",
"EUR:1", "EUR:1",
"refresh-melt-1"), "refresh-melt-1"),
TALER_TESTING_cmd_payback ("payback-1b", TALER_TESTING_cmd_recoup ("recoup-1b",
MHD_HTTP_OK, MHD_HTTP_OK,
"refresh-reveal-1#1", "refresh-reveal-1#1",
"EUR:1", "EUR:1",
"refresh-melt-1"), "refresh-melt-1"),
TALER_TESTING_cmd_payback ("payback-1c", TALER_TESTING_cmd_recoup ("recoup-1c",
MHD_HTTP_OK, MHD_HTTP_OK,
"refresh-reveal-1#2", "refresh-reveal-1#2",
"EUR:1", "EUR:1",
"refresh-melt-1"), "refresh-melt-1"),
/* Now we have EUR:3.83 EUR back after 3x EUR:1 in paybacks */ /* Now we have EUR:3.83 EUR back after 3x EUR:1 in recoups */
/* Melt original coin AGAIN, but only create one 0.1 EUR coin; /* Melt original coin AGAIN, but only create one 0.1 EUR coin;
This costs EUR:0.03 in refresh and EUR:01 in withdraw fees, This costs EUR:0.03 in refresh and EUR:01 in withdraw fees,
leaving EUR:3.69. */ leaving EUR:3.69. */
@ -155,20 +155,20 @@ run (void *cls,
"withdraw-revocation-coin-1", "withdraw-revocation-coin-1",
CONFIG_FILE), CONFIG_FILE),
/* Refund coin EUR:0.1 to original coin, creating zombie! */ /* Refund coin EUR:0.1 to original coin, creating zombie! */
TALER_TESTING_cmd_payback ("payback-2", TALER_TESTING_cmd_recoup ("recoup-2",
MHD_HTTP_OK, MHD_HTTP_OK,
"refresh-reveal-2", "refresh-reveal-2",
"EUR:0.1", "EUR:0.1",
"refresh-melt-2"), "refresh-melt-2"),
/* Due to payback, original coin is now at EUR:3.79 */ /* Due to recoup, original coin is now at EUR:3.79 */
/* Refund original (now zombie) coin to reserve */ /* Refund original (now zombie) coin to reserve */
TALER_TESTING_cmd_payback ("payback-3", TALER_TESTING_cmd_recoup ("recoup-3",
MHD_HTTP_OK, MHD_HTTP_OK,
"withdraw-revocation-coin-1", "withdraw-revocation-coin-1",
"EUR:3.79", "EUR:3.79",
NULL), NULL),
/* Check the money is back with the reserve */ /* Check the money is back with the reserve */
TALER_TESTING_cmd_status ("payback-reserve-status-1", TALER_TESTING_cmd_status ("recoup-reserve-status-1",
"create-reserve-1", "create-reserve-1",
"EUR:3.79", "EUR:3.79",
MHD_HTTP_OK), MHD_HTTP_OK),

View File

@ -17,8 +17,8 @@
<http://www.gnu.org/licenses/> <http://www.gnu.org/licenses/>
*/ */
/** /**
* @file lib/testing_api_cmd_payback.c * @file lib/testing_api_cmd_recoup.c
* @brief Implement the /revoke and /payback test commands. * @brief Implement the /revoke and /recoup test commands.
* @author Marcello Stanisci * @author Marcello Stanisci
*/ */
#include "platform.h" #include "platform.h"
@ -69,7 +69,7 @@ struct RevokeState
/** /**
* State for a "pay back" CMD. * State for a "pay back" CMD.
*/ */
struct PaybackState struct RecoupState
{ {
/** /**
* Expected HTTP status code. * Expected HTTP status code.
@ -95,7 +95,7 @@ struct PaybackState
/** /**
* Handle to the ongoing operation. * Handle to the ongoing operation.
*/ */
struct TALER_EXCHANGE_PaybackHandle *ph; struct TALER_EXCHANGE_RecoupHandle *ph;
/** /**
* NULL if coin was not refreshed, otherwise reference * NULL if coin was not refreshed, otherwise reference
@ -151,7 +151,7 @@ parse_coin_reference (const char *coin_reference,
/** /**
* Check the result of the payback request: checks whether * Check the result of the recoup request: checks whether
* the HTTP response code is good, and that the coin that * the HTTP response code is good, and that the coin that
* was paid back belonged to the right reserve. * was paid back belonged to the right reserve.
* *
@ -160,22 +160,22 @@ parse_coin_reference (const char *coin_reference,
* @param ec taler-specific error code. * @param ec taler-specific error code.
* @param amount amount the exchange will wire back for this coin. * @param amount amount the exchange will wire back for this coin.
* @param timestamp what time did the exchange receive the * @param timestamp what time did the exchange receive the
* /payback request * /recoup request
* @param reserve_pub public key of the reserve receiving the payback, NULL if refreshed or on error * @param reserve_pub public key of the reserve receiving the recoup, NULL if refreshed or on error
* @param old_coin_pub public key of the dirty coin, NULL if not refreshed or on error * @param old_coin_pub public key of the dirty coin, NULL if not refreshed or on error
* @param full_response raw response from the exchange. * @param full_response raw response from the exchange.
*/ */
static void static void
payback_cb (void *cls, recoup_cb (void *cls,
unsigned int http_status, unsigned int http_status,
enum TALER_ErrorCode ec, enum TALER_ErrorCode ec,
const struct TALER_Amount *amount, const struct TALER_Amount *amount,
struct GNUNET_TIME_Absolute timestamp, struct GNUNET_TIME_Absolute timestamp,
const struct TALER_ReservePublicKeyP *reserve_pub, const struct TALER_ReservePublicKeyP *reserve_pub,
const struct TALER_CoinSpendPublicKeyP *old_coin_pub, const struct TALER_CoinSpendPublicKeyP *old_coin_pub,
const json_t *full_response) const json_t *full_response)
{ {
struct PaybackState *ps = cls; struct RecoupState *ps = cls;
struct TALER_TESTING_Interpreter *is = ps->is; struct TALER_TESTING_Interpreter *is = ps->is;
struct TALER_TESTING_Command *cmd = &is->commands[is->ip]; struct TALER_TESTING_Command *cmd = &is->commands[is->ip];
const struct TALER_TESTING_Command *reserve_cmd; const struct TALER_TESTING_Command *reserve_cmd;
@ -321,11 +321,11 @@ payback_cb (void *cls,
* @param is the interpreter state. * @param is the interpreter state.
*/ */
static void static void
payback_run (void *cls, recoup_run (void *cls,
const struct TALER_TESTING_Command *cmd, const struct TALER_TESTING_Command *cmd,
struct TALER_TESTING_Interpreter *is) struct TALER_TESTING_Interpreter *is)
{ {
struct PaybackState *ps = cls; struct RecoupState *ps = cls;
const struct TALER_TESTING_Command *coin_cmd; const struct TALER_TESTING_Command *coin_cmd;
const struct TALER_CoinSpendPrivateKeyP *coin_priv; const struct TALER_CoinSpendPrivateKeyP *coin_priv;
const struct TALER_DenominationBlindingKeyP *blinding_key; const struct TALER_DenominationBlindingKeyP *blinding_key;
@ -394,13 +394,13 @@ payback_run (void *cls,
"Trying to get '%s..' paid back\n", "Trying to get '%s..' paid back\n",
TALER_B2S (&denom_pub->h_key)); TALER_B2S (&denom_pub->h_key));
ps->ph = TALER_EXCHANGE_payback (is->exchange, ps->ph = TALER_EXCHANGE_recoup (is->exchange,
denom_pub, denom_pub,
coin_sig, coin_sig,
&planchet, &planchet,
NULL != ps->melt_reference, NULL != ps->melt_reference,
payback_cb, recoup_cb,
ps); ps);
GNUNET_assert (NULL != ps->ph); GNUNET_assert (NULL != ps->ph);
} }
@ -431,20 +431,20 @@ revoke_cleanup (void *cls,
/** /**
* Cleanup the "payback" CMD state, and possibly cancel * Cleanup the "recoup" CMD state, and possibly cancel
* a pending operation thereof. * a pending operation thereof.
* *
* @param cls closure. * @param cls closure.
* @param cmd the command which is being cleaned up. * @param cmd the command which is being cleaned up.
*/ */
static void static void
payback_cleanup (void *cls, recoup_cleanup (void *cls,
const struct TALER_TESTING_Command *cmd) const struct TALER_TESTING_Command *cmd)
{ {
struct PaybackState *ps = cls; struct RecoupState *ps = cls;
if (NULL != ps->ph) if (NULL != ps->ph)
{ {
TALER_EXCHANGE_payback_cancel (ps->ph); TALER_EXCHANGE_recoup_cancel (ps->ph);
ps->ph = NULL; ps->ph = NULL;
} }
GNUNET_free (ps); GNUNET_free (ps);
@ -546,7 +546,7 @@ revoke_run (void *cls,
/** /**
* Make a "payback" command. * Make a "recoup" command.
* *
* @param label the command label * @param label the command label
* @param expected_response_code expected HTTP status code * @param expected_response_code expected HTTP status code
@ -557,15 +557,15 @@ revoke_run (void *cls,
* @return the command. * @return the command.
*/ */
struct TALER_TESTING_Command struct TALER_TESTING_Command
TALER_TESTING_cmd_payback (const char *label, TALER_TESTING_cmd_recoup (const char *label,
unsigned int expected_response_code, unsigned int expected_response_code,
const char *coin_reference, const char *coin_reference,
const char *amount, const char *amount,
const char *melt_reference) const char *melt_reference)
{ {
struct PaybackState *ps; struct RecoupState *ps;
ps = GNUNET_new (struct PaybackState); ps = GNUNET_new (struct RecoupState);
ps->expected_response_code = expected_response_code; ps->expected_response_code = expected_response_code;
ps->coin_reference = coin_reference; ps->coin_reference = coin_reference;
ps->amount = amount; ps->amount = amount;
@ -574,8 +574,8 @@ TALER_TESTING_cmd_payback (const char *label,
struct TALER_TESTING_Command cmd = { struct TALER_TESTING_Command cmd = {
.cls = ps, .cls = ps,
.label = label, .label = label,
.run = &payback_run, .run = &recoup_run,
.cleanup = &payback_cleanup .cleanup = &recoup_cleanup
}; };
return cmd; return cmd;

View File

@ -56,7 +56,7 @@ struct TALER_TESTING_FreshCoinData
struct TALER_CoinSpendPrivateKeyP coin_priv; struct TALER_CoinSpendPrivateKeyP coin_priv;
/** /**
* The blinding key (needed for payback operations). * The blinding key (needed for recoup operations).
*/ */
struct TALER_DenominationBlindingKeyP blinding_key; struct TALER_DenominationBlindingKeyP blinding_key;