introducing closing fee

This commit is contained in:
Christian Grothoff 2017-04-17 14:01:55 +02:00
parent 5a321621f4
commit 164c125528
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
9 changed files with 96 additions and 3 deletions

View File

@ -332,6 +332,8 @@ parse_json_fees (struct TALER_EXCHANGE_WireAggregateFees *af,
&af->master_sig),
TALER_JSON_spec_amount ("wire_fee",
&af->wire_fee),
TALER_JSON_spec_amount ("closing_fee",
&af->closing_fee),
GNUNET_JSON_spec_absolute_time ("start_date",
&af->start_date),
GNUNET_JSON_spec_absolute_time ("end_date",
@ -376,6 +378,8 @@ check_sig (const struct TALER_EXCHANGE_WireAggregateFees *af,
wp.end_date = GNUNET_TIME_absolute_hton (af->end_date);
TALER_amount_hton (&wp.wire_fee,
&af->wire_fee);
TALER_amount_hton (&wp.closing_fee,
&af->closing_fee);
return GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_MASTER_WIRE_FEES,
&wp.purpose,
&af->master_sig.eddsa_signature,

View File

@ -43,6 +43,17 @@ WIRE-FEE-2024 = EUR:0.01
WIRE-FEE-2025 = EUR:0.01
WIRE-FEE-2026 = EUR:0.01
CLOSING-FEE-2017 = EUR:0.01
CLOSING-FEE-2018 = EUR:0.01
CLOSING-FEE-2019 = EUR:0.01
CLOSING-FEE-2020 = EUR:0.01
CLOSING-FEE-2021 = EUR:0.01
CLOSING-FEE-2022 = EUR:0.01
CLOSING-FEE-2023 = EUR:0.01
CLOSING-FEE-2024 = EUR:0.01
CLOSING-FEE-2025 = EUR:0.01
CLOSING-FEE-2026 = EUR:0.01
[exchange-wire-incoming-sepa]
# This is the response we give out for the /wire request. It provides
# wallets with the bank information for transfers to the exchange.
@ -65,6 +76,16 @@ WIRE-FEE-2024 = EUR:0.01
WIRE-FEE-2025 = EUR:0.01
WIRE-FEE-2026 = EUR:0.01
CLOSING-FEE-2017 = EUR:0.01
CLOSING-FEE-2018 = EUR:0.01
CLOSING-FEE-2019 = EUR:0.01
CLOSING-FEE-2020 = EUR:0.01
CLOSING-FEE-2021 = EUR:0.01
CLOSING-FEE-2022 = EUR:0.01
CLOSING-FEE-2023 = EUR:0.01
CLOSING-FEE-2024 = EUR:0.01
CLOSING-FEE-2025 = EUR:0.01
CLOSING-FEE-2026 = EUR:0.01
[exchange-wire-incoming-test]
# This is the response we give out for the /wire request. It provides

View File

@ -949,6 +949,8 @@ create_wire_fee_for_method (void *cls,
af = GNUNET_new (struct TALER_EXCHANGEDB_AggregateFees);
af->start_date = start_date;
af->end_date = end_date;
/* handle wire fee */
GNUNET_asprintf (&opt,
"wire-fee-%u",
year);
@ -980,6 +982,40 @@ create_wire_fee_for_method (void *cls,
break;
}
GNUNET_free (amounts);
/* handle closing fee */
GNUNET_asprintf (&opt,
"closing-fee-%u",
year);
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_string (kcfg,
section,
opt,
&amounts))
{
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
section,
opt);
*ret = GNUNET_SYSERR;
GNUNET_free (opt);
break;
}
if (GNUNET_OK !=
TALER_string_to_amount (amounts,
&af->closing_fee))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Invalid amount `%s' specified in `%s' under `%s'\n",
amounts,
wiremethod,
opt);
*ret = GNUNET_SYSERR;
GNUNET_free (amounts);
GNUNET_free (opt);
break;
}
GNUNET_free (amounts);
GNUNET_free (opt);
sign_af (af,
wiremethod,

View File

@ -56,8 +56,9 @@ fees_to_json (struct TALER_EXCHANGEDB_AggregateFees *af)
}
if (0 !=
json_array_append_new (a,
json_pack ("{s:o, s:o, s:o, s:o}",
json_pack ("{s:o, s:o, s:o, s:o, s:o}",
"wire_fee", TALER_JSON_from_amount (&af->wire_fee),
"closing_fee", TALER_JSON_from_amount (&af->closing_fee),
"start_date", GNUNET_JSON_from_time_abs (af->start_date),
"end_date", GNUNET_JSON_from_time_abs (af->end_date),
"sig", GNUNET_JSON_from_data_auto (&af->master_sig))))

View File

@ -42,6 +42,17 @@ WIRE-FEE-2024 = EUR:0.01
WIRE-FEE-2025 = EUR:0.01
WIRE-FEE-2026 = EUR:0.01
CLOSING-FEE-2017 = EUR:0.01
CLOSING-FEE-2018 = EUR:0.01
CLOSING-FEE-2019 = EUR:0.01
CLOSING-FEE-2020 = EUR:0.01
CLOSING-FEE-2021 = EUR:0.01
CLOSING-FEE-2022 = EUR:0.01
CLOSING-FEE-2023 = EUR:0.01
CLOSING-FEE-2024 = EUR:0.01
CLOSING-FEE-2025 = EUR:0.01
CLOSING-FEE-2026 = EUR:0.01
[exchange-wire-outgoing-test]
# What is the main website of the bank?

View File

@ -62,6 +62,8 @@ wd2af (const struct TALER_WireFeeDiskP *wd)
af->end_date = GNUNET_TIME_absolute_ntoh (wd->wf.end_date);
TALER_amount_ntoh (&af->wire_fee,
&wd->wf.wire_fee);
TALER_amount_ntoh (&af->closing_fee,
&wd->wf.closing_fee);
af->master_sig = wd->master_sig;
return af;
}
@ -162,6 +164,8 @@ TALER_EXCHANGEDB_fees_2_wf (const char *wireplugin,
wf->end_date = GNUNET_TIME_absolute_hton (af->end_date);
TALER_amount_hton (&wf->wire_fee,
&af->wire_fee);
TALER_amount_hton (&wf->closing_fee,
&af->closing_fee);
}

View File

@ -351,10 +351,16 @@ struct TALER_EXCHANGE_WireAggregateFees
struct TALER_EXCHANGE_WireAggregateFees *next;
/**
* Fee to be paid.
* Fee to be paid whenever the exchange wires funds to the merchant.
*/
struct TALER_Amount wire_fee;
/**
* Fee to be paid when the exchange closes a reserve and wires funds
* back to a customer.
*/
struct TALER_Amount closing_fee;
/**
* Time when this fee goes into effect (inclusive)
*/

View File

@ -332,10 +332,15 @@ struct TALER_EXCHANGEDB_AggregateFees
struct TALER_EXCHANGEDB_AggregateFees *next;
/**
* Fee to be paid.
* Fee to be paid for wire transfers to a merchant.
*/
struct TALER_Amount wire_fee;
/**
* Fee to be paid when we close a reserve and send funds back.
*/
struct TALER_Amount closing_fee;
/**
* Time when this fee goes into effect (inclusive)
*/

View File

@ -938,6 +938,11 @@ struct TALER_MasterWireFeePS
*/
struct TALER_AmountNBO wire_fee;
/**
* Closing fee charged when we wire back funds of a reserve.
*/
struct TALER_AmountNBO closing_fee;
};