diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-04-20 01:50:26 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-04-20 01:50:26 +0200 |
commit | f693e25793f9e8f75b80b11b066ed209e8aa4c1c (patch) | |
tree | 07bd275d003080389d67ed142b7673bab469c40f /src | |
parent | 1d8da4bf8442e4864e877a665c876d0cd5e03de8 (diff) |
introduce refund fee
Diffstat (limited to 'src')
-rw-r--r-- | src/bank-lib/test_bank_api.c | 3 | ||||
-rw-r--r-- | src/exchange-lib/exchange_api_handle.c | 26 | ||||
-rw-r--r-- | src/exchange-lib/test_exchange_api.conf | 5 | ||||
-rw-r--r-- | src/exchange-tools/coins.conf | 1 | ||||
-rw-r--r-- | src/exchange-tools/taler-auditor-sign.c | 6 | ||||
-rw-r--r-- | src/exchange-tools/taler-exchange-keyup.c | 27 | ||||
-rw-r--r-- | src/exchange/taler-exchange-httpd_keystate.c | 9 | ||||
-rw-r--r-- | src/exchange/test_taler_exchange_aggregator.c | 3 | ||||
-rw-r--r-- | src/exchange/test_taler_exchange_httpd.conf | 3 | ||||
-rw-r--r-- | src/exchangedb/perf_taler_exchangedb.c | 3 | ||||
-rw-r--r-- | src/exchangedb/perf_taler_exchangedb_init.c | 4 | ||||
-rw-r--r-- | src/exchangedb/perf_taler_exchangedb_init.h | 25 | ||||
-rw-r--r-- | src/exchangedb/plugin_exchangedb_postgres.c | 20 | ||||
-rw-r--r-- | src/exchangedb/test_exchangedb.c | 25 | ||||
-rw-r--r-- | src/include/taler_exchange_service.h | 7 | ||||
-rw-r--r-- | src/include/taler_signatures.h | 13 |
16 files changed, 138 insertions, 42 deletions
diff --git a/src/bank-lib/test_bank_api.c b/src/bank-lib/test_bank_api.c index 1b695f457..fe02fb8e5 100644 --- a/src/bank-lib/test_bank_api.c +++ b/src/bank-lib/test_bank_api.c @@ -520,7 +520,8 @@ main (int argc, NULL, NULL, NULL, "taler-bank-manage", "taler-bank-manage", - "serve-http", "--port", "8081", + "serve-http", + "--port", "8081", NULL); if (NULL == bankd) { diff --git a/src/exchange-lib/exchange_api_handle.c b/src/exchange-lib/exchange_api_handle.c index bd4746565..47658052d 100644 --- a/src/exchange-lib/exchange_api_handle.c +++ b/src/exchange-lib/exchange_api_handle.c @@ -253,29 +253,32 @@ parse_json_denomkey (struct TALER_EXCHANGE_DenomPublicKey *denom_key, struct TALER_Amount fee_withdraw; struct TALER_Amount fee_deposit; struct TALER_Amount fee_refresh; + struct TALER_Amount fee_refund; struct TALER_DenominationKeyValidityPS denom_key_issue; struct GNUNET_CRYPTO_RsaPublicKey *pk; struct GNUNET_CRYPTO_EddsaSignature sig; struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_fixed_auto ("master_sig", - &sig), + &sig), GNUNET_JSON_spec_absolute_time ("stamp_expire_deposit", - &deposit_valid_until), + &deposit_valid_until), GNUNET_JSON_spec_absolute_time ("stamp_expire_withdraw", - &withdraw_valid_until), + &withdraw_valid_until), GNUNET_JSON_spec_absolute_time ("stamp_start", - &valid_from), + &valid_from), GNUNET_JSON_spec_absolute_time ("stamp_expire_legal", - &expire_legal), + &expire_legal), TALER_JSON_spec_amount ("value", - &value), + &value), TALER_JSON_spec_amount ("fee_withdraw", - &fee_withdraw), + &fee_withdraw), TALER_JSON_spec_amount ("fee_deposit", - &fee_deposit), + &fee_deposit), TALER_JSON_spec_amount ("fee_refresh", - &fee_refresh), + &fee_refresh), + TALER_JSON_spec_amount ("fee_refund", + &fee_refund), GNUNET_JSON_spec_rsa_public_key ("denom_pub", &pk), GNUNET_JSON_spec_end() @@ -309,6 +312,8 @@ parse_json_denomkey (struct TALER_EXCHANGE_DenomPublicKey *denom_key, &fee_deposit); TALER_amount_hton (&denom_key_issue.fee_refresh, &fee_refresh); + TALER_amount_hton (&denom_key_issue.fee_refund, + &fee_refund); EXITIF (GNUNET_SYSERR == GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_MASTER_DENOMINATION_KEY_VALIDITY, &denom_key_issue.purpose, @@ -327,6 +332,7 @@ parse_json_denomkey (struct TALER_EXCHANGE_DenomPublicKey *denom_key, denom_key->fee_withdraw = fee_withdraw; denom_key->fee_deposit = fee_deposit; denom_key->fee_refresh = fee_refresh; + denom_key->fee_refund = fee_refund; return GNUNET_OK; EXITIF_exit: @@ -435,6 +441,8 @@ parse_json_auditor (struct TALER_EXCHANGE_AuditorInformation *auditor, &dk->fee_deposit); TALER_amount_hton (&kv.fee_refresh, &dk->fee_refresh); + TALER_amount_hton (&kv.fee_refund, + &dk->fee_refund); kv.denom_hash = dk->h_key; if (GNUNET_OK != GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_AUDITOR_EXCHANGE_KEYS, diff --git a/src/exchange-lib/test_exchange_api.conf b/src/exchange-lib/test_exchange_api.conf index 281ac7361..e7d849bc3 100644 --- a/src/exchange-lib/test_exchange_api.conf +++ b/src/exchange-lib/test_exchange_api.conf @@ -48,6 +48,7 @@ duration_legal = 3 years fee_withdraw = EUR:0.00 fee_deposit = EUR:0.00 fee_refresh = EUR:0.01 +fee_refund = EUR:0.01 rsa_keysize = 1024 [coin_eur_ct_10] @@ -59,6 +60,7 @@ duration_legal = 3 years fee_withdraw = EUR:0.01 fee_deposit = EUR:0.01 fee_refresh = EUR:0.03 +fee_refund = EUR:0.01 rsa_keysize = 1024 [coin_eur_1] @@ -70,6 +72,7 @@ duration_legal = 3 years fee_withdraw = EUR:0.01 fee_deposit = EUR:0.01 fee_refresh = EUR:0.03 +fee_refund = EUR:0.01 rsa_keysize = 1024 [coin_eur_5] @@ -81,6 +84,7 @@ duration_legal = 3 years fee_withdraw = EUR:0.01 fee_deposit = EUR:0.01 fee_refresh = EUR:0.03 +fee_refund = EUR:0.01 rsa_keysize = 1024 [coin_eur_10] @@ -92,4 +96,5 @@ duration_legal = 3 years fee_withdraw = EUR:0.01 fee_deposit = EUR:0.01 fee_refresh = EUR:0.03 +fee_refund = EUR:0.01 rsa_keysize = 1024 diff --git a/src/exchange-tools/coins.conf b/src/exchange-tools/coins.conf index 90bf7064c..a0a160773 100644 --- a/src/exchange-tools/coins.conf +++ b/src/exchange-tools/coins.conf @@ -22,4 +22,5 @@ # fee_withdraw = EUR:0.00 # fee_deposit = EUR:0.00 # fee_refresh = EUR:0.01 +# fee_refund = EUR:0.01 # rsa_keysize = 1024 diff --git a/src/exchange-tools/taler-auditor-sign.c b/src/exchange-tools/taler-auditor-sign.c index d5a3a9403..71c80f5ee 100644 --- a/src/exchange-tools/taler-auditor-sign.c +++ b/src/exchange-tools/taler-auditor-sign.c @@ -103,6 +103,12 @@ print_dk (const struct TALER_DenominationKeyValidityPS *dk) "Refresh fee: %s\n", s = TALER_amount_to_string (&a)); GNUNET_free (s); + TALER_amount_ntoh (&a, + &dk->fee_refund); + fprintf (stdout, + "Refund fee: %s\n", + s = TALER_amount_to_string (&a)); + GNUNET_free (s); fprintf (stdout, "Validity start time: %s\n", diff --git a/src/exchange-tools/taler-exchange-keyup.c b/src/exchange-tools/taler-exchange-keyup.c index 312b4010e..0cd9a30ca 100644 --- a/src/exchange-tools/taler-exchange-keyup.c +++ b/src/exchange-tools/taler-exchange-keyup.c @@ -79,6 +79,11 @@ struct CoinTypeNBOP struct TALER_AmountNBO fee_refresh; /** + * What is the fee charged for refunds? + */ + struct TALER_AmountNBO fee_refund; + + /** * Key size in NBO. */ uint32_t rsa_keysize; @@ -141,6 +146,11 @@ struct CoinTypeParams struct TALER_Amount fee_refresh; /** + * What is the fee charged for refunds? + */ + struct TALER_Amount fee_refund; + + /** * Time at which this coin is supposed to become valid. */ struct GNUNET_TIME_Absolute anchor; @@ -261,6 +271,8 @@ hash_coin_type (const struct CoinTypeParams *p, &p->fee_deposit); TALER_amount_hton (&p_nbo.fee_refresh, &p->fee_refresh); + TALER_amount_hton (&p_nbo.fee_refund, + &p->fee_refund); p_nbo.rsa_keysize = htonl (p->rsa_keysize); GNUNET_CRYPTO_hash (&p_nbo, sizeof (struct CoinTypeNBOP), @@ -707,6 +719,17 @@ get_cointype_params (const char *ct, "fee_refresh"); return GNUNET_SYSERR; } + if (GNUNET_OK != + TALER_config_get_denom (kcfg, + ct, + "fee_refund", + ¶ms->fee_refund)) + { + GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, + ct, + "fee_refund"); + return GNUNET_SYSERR; + } dir = get_cointype_dir (params); get_anchor (dir, @@ -756,6 +779,8 @@ create_denomkey_issue (const struct CoinTypeParams *params, ¶ms->fee_deposit); TALER_amount_hton (&dki->issue.properties.fee_refresh, ¶ms->fee_refresh); + TALER_amount_hton (&dki->issue.properties.fee_refund, + ¶ms->fee_refund); dki->issue.properties.purpose.purpose = htonl (TALER_SIGNATURE_MASTER_DENOMINATION_KEY_VALIDITY); dki->issue.properties.purpose.size @@ -776,7 +801,7 @@ create_denomkey_issue (const struct CoinTypeParams *params, */ static void exchange_keys_update_cointype (void *cls, - const char *coin_alias) + const char *coin_alias) { int *ret = cls; struct CoinTypeParams p; diff --git a/src/exchange/taler-exchange-httpd_keystate.c b/src/exchange/taler-exchange-httpd_keystate.c index c9db50895..e16d3a62e 100644 --- a/src/exchange/taler-exchange-httpd_keystate.c +++ b/src/exchange/taler-exchange-httpd_keystate.c @@ -133,6 +133,7 @@ denom_key_issue_to_json (const struct TALER_DenominationPublicKey *pk, struct TALER_Amount fee_withdraw; struct TALER_Amount fee_deposit; struct TALER_Amount fee_refresh; + struct TALER_Amount fee_refund; TALER_amount_ntoh (&value, &dki->properties.value); @@ -142,8 +143,10 @@ denom_key_issue_to_json (const struct TALER_DenominationPublicKey *pk, &dki->properties.fee_deposit); TALER_amount_ntoh (&fee_refresh, &dki->properties.fee_refresh); + TALER_amount_ntoh (&fee_refund, + &dki->properties.fee_refund); return - json_pack ("{s:o, s:o, s:o, s:o, s:o, s:o, s:o, s:o, s:o, s:o}", + json_pack ("{s:o, s:o, s:o, s:o, s:o, s:o, s:o, s:o, s:o, s:o, s:o}", "master_sig", GNUNET_JSON_from_data (&dki->signature, sizeof (struct GNUNET_CRYPTO_EddsaSignature)), @@ -164,7 +167,9 @@ denom_key_issue_to_json (const struct TALER_DenominationPublicKey *pk, "fee_deposit", TALER_JSON_from_amount (&fee_deposit), "fee_refresh", - TALER_JSON_from_amount (&fee_refresh)); + TALER_JSON_from_amount (&fee_refresh), + "fee_refund", + TALER_JSON_from_amount (&fee_refund)); } diff --git a/src/exchange/test_taler_exchange_aggregator.c b/src/exchange/test_taler_exchange_aggregator.c index 54d63a461..e4ca89c77 100644 --- a/src/exchange/test_taler_exchange_aggregator.c +++ b/src/exchange/test_taler_exchange_aggregator.c @@ -359,6 +359,9 @@ fake_issue (struct TALER_EXCHANGEDB_DenominationKeyInformationP *issue) GNUNET_assert (GNUNET_OK == TALER_string_to_amount_nbo ("EUR:0.1", &issue->properties.fee_refresh)); + GNUNET_assert (GNUNET_OK == + TALER_string_to_amount_nbo ("EUR:0.1", + &issue->properties.fee_refund)); } diff --git a/src/exchange/test_taler_exchange_httpd.conf b/src/exchange/test_taler_exchange_httpd.conf index 5b49c0824..612d9f4d4 100644 --- a/src/exchange/test_taler_exchange_httpd.conf +++ b/src/exchange/test_taler_exchange_httpd.conf @@ -50,6 +50,7 @@ duration_legal = 3 years fee_withdraw = EUR:0.00 fee_deposit = EUR:0.00 fee_refresh = EUR:0.01 +fee_refund = EUR:0.01 rsa_keysize = 1024 [coin_eur_ct_10] @@ -61,6 +62,7 @@ duration_legal = 3 years fee_withdraw = EUR:0.01 fee_deposit = EUR:0.01 fee_refresh = EUR:0.03 +fee_refund = EUR:0.01 rsa_keysize = 1024 [coin_eur_1] @@ -72,4 +74,5 @@ duration_legal = 3 years fee_withdraw = EUR:0.01 fee_deposit = EUR:0.01 fee_refresh = EUR:0.03 +fee_refund = EUR:0.01 rsa_keysize = 1024 diff --git a/src/exchangedb/perf_taler_exchangedb.c b/src/exchangedb/perf_taler_exchangedb.c index 6ff7f5331..bac8f4cb8 100644 --- a/src/exchangedb/perf_taler_exchangedb.c +++ b/src/exchangedb/perf_taler_exchangedb.c @@ -1,6 +1,6 @@ /* This file is part of TALER - Copyright (C) 2014, 2015 GNUnet e.V. + Copyright (C) 2014, 2015, 2016 Inria and GNUnet e.V. TALER is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -17,6 +17,7 @@ * @file exchangedb/perf_taler_exchangedb.c * @brief Exchange database performance analysis * @author Nicolas Fournier + * @author Christian Grothoff */ #include "platform.h" #include "perf_taler_exchangedb_interpreter.h" diff --git a/src/exchangedb/perf_taler_exchangedb_init.c b/src/exchangedb/perf_taler_exchangedb_init.c index 516f3ea58..67ac56c77 100644 --- a/src/exchangedb/perf_taler_exchangedb_init.c +++ b/src/exchangedb/perf_taler_exchangedb_init.c @@ -1,6 +1,6 @@ /* This file is part of TALER - Copyright (C) 2014, 2015 GNUnet e.V. + Copyright (C) 2014, 2015, 2016 Inria & GNUnet e.V. TALER is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -17,6 +17,7 @@ * @file exchangedb/perf_taler_exchangedb_init.c * @brief Interpreter library for exchange database performance analysis * @author Nicolas Fournier + * @author Christian Grothoff */ #include "platform.h" #include "perf_taler_exchangedb_init.h" @@ -75,6 +76,7 @@ PERF_TALER_EXCHANGEDB_denomination_init () TALER_amount_hton (&properties.fee_withdraw, &amount); TALER_amount_hton (&properties.fee_deposit, &amount); TALER_amount_hton (&properties.fee_refresh, &amount); + TALER_amount_hton (&properties.fee_refund, &amount); GNUNET_CRYPTO_rsa_public_key_hash (denom_pub.rsa_public_key, &properties.denom_hash); issue.properties = properties; diff --git a/src/exchangedb/perf_taler_exchangedb_init.h b/src/exchangedb/perf_taler_exchangedb_init.h index 0ff074108..2021023a1 100644 --- a/src/exchangedb/perf_taler_exchangedb_init.h +++ b/src/exchangedb/perf_taler_exchangedb_init.h @@ -79,8 +79,7 @@ PERF_TALER_EXCHANGEDB_denomination_init (void); * @return a copy of @a deposit; NULL if error */ struct TALER_EXCHANGEDB_DenominationKeyIssueInformation * -PERF_TALER_EXCHANGEDB_denomination_copy ( - const struct TALER_EXCHANGEDB_DenominationKeyIssueInformation *dki); +PERF_TALER_EXCHANGEDB_denomination_copy (const struct TALER_EXCHANGEDB_DenominationKeyIssueInformation *dki); /** @@ -88,8 +87,7 @@ PERF_TALER_EXCHANGEDB_denomination_copy ( * @param dki pointer to the struct to free */ int -PERF_TALER_EXCHANGEDB_denomination_free ( - struct TALER_EXCHANGEDB_DenominationKeyIssueInformation *dki); +PERF_TALER_EXCHANGEDB_denomination_free (struct TALER_EXCHANGEDB_DenominationKeyIssueInformation *dki); /** @@ -122,8 +120,7 @@ PERF_TALER_EXCHANGEDB_reserve_free (struct PERF_TALER_EXCHANGEDB_Reserve *reserv * @param dki the denomination key used to sign the key */ struct TALER_EXCHANGEDB_Deposit * -PERF_TALER_EXCHANGEDB_deposit_init ( - const struct PERF_TALER_EXCHANGEDB_Coin *coin); +PERF_TALER_EXCHANGEDB_deposit_init (const struct PERF_TALER_EXCHANGEDB_Coin *coin); /** @@ -150,9 +147,8 @@ PERF_TALER_EXCHANGEDB_deposit_free (struct TALER_EXCHANGEDB_Deposit *deposit); * @return a randomly generated CollectableBlindcoin */ struct PERF_TALER_EXCHANGEDB_Coin * -PERF_TALER_EXCHANGEDB_coin_init ( - const struct TALER_EXCHANGEDB_DenominationKeyIssueInformation *dki, - const struct PERF_TALER_EXCHANGEDB_Reserve *reserve); +PERF_TALER_EXCHANGEDB_coin_init (const struct TALER_EXCHANGEDB_DenominationKeyIssueInformation *dki, + const struct PERF_TALER_EXCHANGEDB_Reserve *reserve); /** @@ -161,8 +157,7 @@ PERF_TALER_EXCHANGEDB_coin_init ( * @return a copy of coin; NULL if error */ struct PERF_TALER_EXCHANGEDB_Coin * -PERF_TALER_EXCHANGEDB_coin_copy ( - const struct PERF_TALER_EXCHANGEDB_Coin *coin); +PERF_TALER_EXCHANGEDB_coin_copy (const struct PERF_TALER_EXCHANGEDB_Coin *coin); /** @@ -170,8 +165,7 @@ PERF_TALER_EXCHANGEDB_coin_copy ( * @param coin pointer to the structure to free */ int -PERF_TALER_EXCHANGEDB_coin_free ( - struct PERF_TALER_EXCHANGEDB_Coin *coin); +PERF_TALER_EXCHANGEDB_coin_free (struct PERF_TALER_EXCHANGEDB_Coin *coin); /** @@ -186,15 +180,14 @@ PERF_TALER_EXCHANGEDB_refresh_session_init (void); */ int PERF_TALER_EXCHANGEDB_refresh_session_copy (struct TALER_EXCHANGEDB_RefreshSession *session, - struct TALER_EXCHANGEDB_RefreshSession *copy); + struct TALER_EXCHANGEDB_RefreshSession *copy); /** * Frees memory of a refresh_session */ int -PERF_TALER_EXCHANGEDB_refresh_session_free ( - struct TALER_EXCHANGEDB_RefreshSession *refresh_session); +PERF_TALER_EXCHANGEDB_refresh_session_free (struct TALER_EXCHANGEDB_RefreshSession *refresh_session); /** diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c index 092aebc48..d69fa7d61 100644 --- a/src/exchangedb/plugin_exchangedb_postgres.c +++ b/src/exchangedb/plugin_exchangedb_postgres.c @@ -272,6 +272,9 @@ postgres_create_tables (void *cls, ",fee_refresh_val INT8 NOT NULL" ",fee_refresh_frac INT4 NOT NULL" ",fee_refresh_curr VARCHAR("TALER_CURRENCY_LEN_STR") NOT NULL" + ",fee_refund_val INT8 NOT NULL" + ",fee_refund_frac INT4 NOT NULL" + ",fee_refund_curr VARCHAR("TALER_CURRENCY_LEN_STR") NOT NULL" ")"); /* reserves table is for summarization of a reserve. It is updated when new funds are added and existing funds are withdrawn. The 'expiration_date' @@ -544,10 +547,14 @@ postgres_prepare (PGconn *db_conn) ",fee_refresh_val" ",fee_refresh_frac" ",fee_refresh_curr" /* must match coin_curr */ + ",fee_refund_val" + ",fee_refund_frac" + ",fee_refund_curr" /* must match coin_curr */ ") VALUES " "($1, $2, $3, $4, $5, $6, $7, $8, $9, $10," - " $11, $12, $13, $14, $15, $16, $17, $18, $19);", - 19, NULL); + " $11, $12, $13, $14, $15, $16, $17, $18," + " $19, $20, $21, $22);", + 22, NULL); /* Used in #postgres_get_denomination_info() */ PREPARE ("denomination_get", @@ -570,6 +577,9 @@ postgres_prepare (PGconn *db_conn) ",fee_refresh_val" ",fee_refresh_frac" ",fee_refresh_curr" /* must match coin_curr */ + ",fee_refund_val" + ",fee_refund_frac" + ",fee_refund_curr" /* must match coin_curr */ " FROM denominations" " WHERE pub=$1;", 1, NULL); @@ -1378,6 +1388,7 @@ postgres_insert_denomination_info (void *cls, TALER_PQ_query_param_amount_nbo (&issue->properties.fee_withdraw), TALER_PQ_query_param_amount_nbo (&issue->properties.fee_deposit), TALER_PQ_query_param_amount_nbo (&issue->properties.fee_refresh), + TALER_PQ_query_param_amount_nbo (&issue->properties.fee_refund), GNUNET_PQ_query_param_end }; /* check fees match coin currency */ @@ -1390,6 +1401,9 @@ postgres_insert_denomination_info (void *cls, GNUNET_assert (GNUNET_YES == TALER_amount_cmp_currency_nbo (&issue->properties.value, &issue->properties.fee_refresh)); + GNUNET_assert (GNUNET_YES == + TALER_amount_cmp_currency_nbo (&issue->properties.value, + &issue->properties.fee_refund)); result = GNUNET_PQ_exec_prepared (session->conn, "denomination_insert", @@ -1476,6 +1490,8 @@ postgres_get_denomination_info (void *cls, &issue->properties.fee_deposit), TALER_PQ_result_spec_amount_nbo ("fee_refresh", &issue->properties.fee_refresh), + TALER_PQ_result_spec_amount_nbo ("fee_refund", + &issue->properties.fee_refund), GNUNET_PQ_result_spec_end }; diff --git a/src/exchangedb/test_exchangedb.c b/src/exchangedb/test_exchangedb.c index f2c473fd9..3bb9b9f2c 100644 --- a/src/exchangedb/test_exchangedb.c +++ b/src/exchangedb/test_exchangedb.c @@ -16,7 +16,8 @@ /** * @file exchangedb/test_exchangedb.c * @brief test cases for DB interaction functions - * @author Sree Harsha Totakura <sreeharsha@totakura.in> + * @author Sree Harsha Totakura + * @author Christian Grothoff */ #include "platform.h" #include "taler_exchangedb_lib.h" @@ -114,7 +115,8 @@ create_denom_key_pair (unsigned int size, const struct TALER_Amount *value, const struct TALER_Amount *fee_withdraw, const struct TALER_Amount *fee_deposit, - const struct TALER_Amount *fee_refresh) + const struct TALER_Amount *fee_refresh, + const struct TALER_Amount *fee_refund) { struct DenomKeyPair *dkp; struct TALER_EXCHANGEDB_DenominationKeyIssueInformation dki; @@ -147,6 +149,7 @@ create_denom_key_pair (unsigned int size, TALER_amount_hton (&dki.issue.properties.fee_withdraw, fee_withdraw); TALER_amount_hton (&dki.issue.properties.fee_deposit, fee_deposit); TALER_amount_hton (&dki.issue.properties.fee_refresh, fee_refresh); + TALER_amount_hton (&dki.issue.properties.fee_refund, fee_refund); GNUNET_CRYPTO_rsa_public_key_hash (dkp->pub.rsa_public_key, &dki.issue.properties.denom_hash); if (GNUNET_OK != @@ -166,11 +169,11 @@ static struct TALER_Amount value; static struct TALER_Amount fee_withdraw; static struct TALER_Amount fee_deposit; static struct TALER_Amount fee_refresh; +static struct TALER_Amount fee_refund; static struct TALER_Amount amount_with_fee; static void -free_refresh_commit_coins_array(struct TALER_EXCHANGEDB_RefreshCommitCoin - *commit_coins, +free_refresh_commit_coins_array(struct TALER_EXCHANGEDB_RefreshCommitCoin *commit_coins, unsigned int size) { unsigned int cnt; @@ -205,7 +208,7 @@ test_refresh_commit_coins (struct TALER_EXCHANGEDB_Session *session, uint16_t cnc_index; int ret; - #define COIN_ENC_MAX_SIZE 512 +#define COIN_ENC_MAX_SIZE 512 ret = GNUNET_SYSERR; ret_commit_coins = NULL; commit_coins = GNUNET_new_array (MELT_NEW_COINS, @@ -331,7 +334,8 @@ test_melting (struct TALER_EXCHANGEDB_Session *session) &value, &fee_withdraw, &fee_deposit, - &fee_refresh); + &fee_refresh, + &fee_refund); /* create MELT_OLD_COINS number of refresh melts */ melts = GNUNET_new_array (MELT_OLD_COINS, struct TALER_EXCHANGEDB_RefreshMelt); for (cnt=0; cnt < MELT_OLD_COINS; cnt++) @@ -394,7 +398,8 @@ test_melting (struct TALER_EXCHANGEDB_Session *session) &value, &fee_withdraw, &fee_deposit, - &fee_refresh); + &fee_refresh, + &fee_refund); new_denom_pubs[cnt]=new_dkp[cnt]->pub; } FAILIF (GNUNET_OK != plugin->insert_refresh_order (plugin->cls, @@ -684,6 +689,9 @@ run (void *cls) TALER_string_to_amount (CURRENCY ":0.000010", &fee_refresh)); GNUNET_assert (GNUNET_OK == + TALER_string_to_amount (CURRENCY ":0.000010", + &fee_refund)); + GNUNET_assert (GNUNET_OK == TALER_string_to_amount (CURRENCY ":1.000010", &amount_with_fee)); @@ -723,7 +731,8 @@ run (void *cls) &value, &fee_withdraw, &fee_deposit, - &fee_refresh); + &fee_refresh, + &fee_refund); RND_BLK(&cbc.h_coin_envelope); RND_BLK(&cbc.reserve_sig); cbc.denom_pub = dkp->pub; diff --git a/src/include/taler_exchange_service.h b/src/include/taler_exchange_service.h index e52e94d9a..ffd420586 100644 --- a/src/include/taler_exchange_service.h +++ b/src/include/taler_exchange_service.h @@ -122,9 +122,14 @@ struct TALER_EXCHANGE_DenomPublicKey struct TALER_Amount fee_deposit; /** - *The applicable fee to melt/refresh a coin of this denomination + * The applicable fee to melt/refresh a coin of this denomination */ struct TALER_Amount fee_refresh; + + /** + * The applicable fee to refund a coin of this denomination + */ + struct TALER_Amount fee_refund; }; diff --git a/src/include/taler_signatures.h b/src/include/taler_signatures.h index bd892e793..154e11610 100644 --- a/src/include/taler_signatures.h +++ b/src/include/taler_signatures.h @@ -640,6 +640,13 @@ struct TALER_DenominationKeyValidityPS struct TALER_AmountNBO fee_refresh; /** + * The fee the exchange charges when a coin of this type is refunded. + * (can be zero). Note that refund fees are charged to the customer; + * if a refund is given, the deposit fee is also refunded. + */ + struct TALER_AmountNBO fee_refund; + + /** * Hash code of the denomination public key. (Used to avoid having * the variable-size RSA key in this struct.) */ @@ -736,6 +743,12 @@ struct TALER_ExchangeKeyValidityPS struct TALER_AmountNBO fee_refresh; /** + * The fee the exchange charges when a coin of this type is refreshed. + * (can be zero). + */ + struct TALER_AmountNBO fee_refund; + + /** * Hash code of the denomination public key. (Used to avoid having * the variable-size RSA key in this struct.) */ |