diff options
Diffstat (limited to 'src/exchange/taler-exchange-httpd_management_wire_fees.c')
-rw-r--r-- | src/exchange/taler-exchange-httpd_management_wire_fees.c | 56 |
1 files changed, 23 insertions, 33 deletions
diff --git a/src/exchange/taler-exchange-httpd_management_wire_fees.c b/src/exchange/taler-exchange-httpd_management_wire_fees.c index 4272a2d06..cb87592a5 100644 --- a/src/exchange/taler-exchange-httpd_management_wire_fees.c +++ b/src/exchange/taler-exchange-httpd_management_wire_fees.c @@ -1,6 +1,6 @@ /* This file is part of TALER - Copyright (C) 2020 Taler Systems SA + Copyright (C) 2020, 2021, 2022 Taler Systems SA TALER is free software; you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software @@ -29,7 +29,7 @@ #include "taler_signatures.h" #include "taler-exchange-httpd_management.h" #include "taler-exchange-httpd_responses.h" -#include "taler-exchange-httpd_wire.h" +#include "taler-exchange-httpd_keys.h" /** @@ -50,22 +50,17 @@ struct AddFeeContext /** * Starting period. */ - struct GNUNET_TIME_Absolute start_time; + struct GNUNET_TIME_Timestamp start_time; /** * End of period. */ - struct GNUNET_TIME_Absolute end_time; + struct GNUNET_TIME_Timestamp end_time; /** - * Wire fee amount. + * Wire fee amounts. */ - struct TALER_Amount wire_fee; - - /** - * Closing fee amount. - */ - struct TALER_Amount closing_fee; + struct TALER_WireFeeSet fees; }; @@ -91,16 +86,14 @@ add_fee (void *cls, { struct AddFeeContext *afc = cls; enum GNUNET_DB_QueryStatus qs; - struct TALER_Amount wire_fee; - struct TALER_Amount closing_fee; + struct TALER_WireFeeSet fees; qs = TEH_plugin->lookup_wire_fee_by_time ( TEH_plugin->cls, afc->wire_method, afc->start_time, afc->end_time, - &wire_fee, - &closing_fee); + &fees); if (qs < 0) { if (GNUNET_DB_STATUS_SOFT_ERROR == qs) @@ -115,13 +108,10 @@ add_fee (void *cls, if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS != qs) { if ( (GNUNET_OK == - TALER_amount_is_valid (&wire_fee)) && - (0 == - TALER_amount_cmp (&wire_fee, - &afc->wire_fee)) && + TALER_amount_is_valid (&fees.wire)) && (0 == - TALER_amount_cmp (&closing_fee, - &afc->closing_fee)) ) + TALER_wire_fee_set_cmp (&fees, + &afc->fees)) ) { /* this will trigger the 'success' response */ return GNUNET_DB_STATUS_SUCCESS_NO_RESULTS; @@ -142,8 +132,7 @@ add_fee (void *cls, afc->wire_method, afc->start_time, afc->end_time, - &afc->wire_fee, - &afc->closing_fee, + &afc->fees, &afc->master_sig); if (qs < 0) { @@ -171,16 +160,16 @@ TEH_handler_management_post_wire_fees ( &afc.master_sig), GNUNET_JSON_spec_string ("wire_method", &afc.wire_method), - TALER_JSON_spec_absolute_time ("fee_start", - &afc.start_time), - TALER_JSON_spec_absolute_time ("fee_end", - &afc.end_time), - TALER_JSON_spec_amount ("closing_fee", - TEH_currency, - &afc.closing_fee), + GNUNET_JSON_spec_timestamp ("fee_start", + &afc.start_time), + GNUNET_JSON_spec_timestamp ("fee_end", + &afc.end_time), TALER_JSON_spec_amount ("wire_fee", TEH_currency, - &afc.wire_fee), + &afc.fees.wire), + TALER_JSON_spec_amount ("closing_fee", + TEH_currency, + &afc.fees.closing), GNUNET_JSON_spec_end () }; @@ -196,13 +185,13 @@ TEH_handler_management_post_wire_fees ( return MHD_YES; /* failure */ } + TEH_METRICS_num_verifications[TEH_MT_SIGNATURE_EDDSA]++; if (GNUNET_OK != TALER_exchange_offline_wire_fee_verify ( afc.wire_method, afc.start_time, afc.end_time, - &afc.wire_fee, - &afc.closing_fee, + &afc.fees, &TEH_master_public_key, &afc.master_sig)) { @@ -221,6 +210,7 @@ TEH_handler_management_post_wire_fees ( res = TEH_DB_run_transaction (connection, "add wire fee", + TEH_MT_REQUEST_OTHER, &ret, &add_fee, &afc); |