-more work on global_fees
This commit is contained in:
parent
5fa977cc05
commit
57470e4c08
@ -659,12 +659,30 @@ irbt_cb_table_global_fee (struct PostgresClosure *pg,
|
|||||||
const struct TALER_EXCHANGEDB_TableData *td)
|
const struct TALER_EXCHANGEDB_TableData *td)
|
||||||
{
|
{
|
||||||
struct GNUNET_PQ_QueryParam params[] = {
|
struct GNUNET_PQ_QueryParam params[] = {
|
||||||
GNUNET_PQ_query_param_uint64 (&td->serial),
|
GNUNET_PQ_query_param_uint64 (
|
||||||
GNUNET_PQ_query_param_timestamp (&td->details.global_fee.start_date),
|
&td->serial),
|
||||||
GNUNET_PQ_query_param_timestamp (&td->details.global_fee.end_date),
|
GNUNET_PQ_query_param_timestamp (
|
||||||
TALER_PQ_query_param_amount (&td->details.global_fee.fees.history),
|
&td->details.global_fee.start_date),
|
||||||
TALER_PQ_query_param_amount (&td->details.global_fee.fees.kyc),
|
GNUNET_PQ_query_param_timestamp (
|
||||||
GNUNET_PQ_query_param_auto_from_type (&td->details.wire_fee.master_sig),
|
&td->details.global_fee.end_date),
|
||||||
|
TALER_PQ_query_param_amount (
|
||||||
|
&td->details.global_fee.fees.history),
|
||||||
|
TALER_PQ_query_param_amount (
|
||||||
|
&td->details.global_fee.fees.kyc),
|
||||||
|
TALER_PQ_query_param_amount (
|
||||||
|
&td->details.global_fee.fees.account),
|
||||||
|
TALER_PQ_query_param_amount (
|
||||||
|
&td->details.global_fee.fees.purse),
|
||||||
|
GNUNET_PQ_query_param_relative_time (
|
||||||
|
&td->details.global_fee.purse_timeout),
|
||||||
|
GNUNET_PQ_query_param_relative_time (
|
||||||
|
&td->details.global_fee.kyc_timeout),
|
||||||
|
GNUNET_PQ_query_param_relative_time (
|
||||||
|
&td->details.global_fee.history_expiration),
|
||||||
|
GNUNET_PQ_query_param_uint32 (
|
||||||
|
&td->details.global_fee.purse_account_limit),
|
||||||
|
GNUNET_PQ_query_param_auto_from_type (
|
||||||
|
&td->details.global_fee.master_sig),
|
||||||
GNUNET_PQ_query_param_end
|
GNUNET_PQ_query_param_end
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1220,17 +1220,41 @@ lrbt_cb_table_global_fee (void *cls,
|
|||||||
for (unsigned int i = 0; i<num_results; i++)
|
for (unsigned int i = 0; i<num_results; i++)
|
||||||
{
|
{
|
||||||
struct GNUNET_PQ_ResultSpec rs[] = {
|
struct GNUNET_PQ_ResultSpec rs[] = {
|
||||||
GNUNET_PQ_result_spec_uint64 ("serial",
|
GNUNET_PQ_result_spec_uint64 (
|
||||||
|
"serial",
|
||||||
&td.serial),
|
&td.serial),
|
||||||
GNUNET_PQ_result_spec_timestamp ("start_date",
|
GNUNET_PQ_result_spec_timestamp (
|
||||||
|
"start_date",
|
||||||
&td.details.global_fee.start_date),
|
&td.details.global_fee.start_date),
|
||||||
GNUNET_PQ_result_spec_timestamp ("end_date",
|
GNUNET_PQ_result_spec_timestamp (
|
||||||
|
"end_date",
|
||||||
&td.details.global_fee.end_date),
|
&td.details.global_fee.end_date),
|
||||||
TALER_PQ_RESULT_SPEC_AMOUNT ("history_fee",
|
TALER_PQ_RESULT_SPEC_AMOUNT (
|
||||||
|
"history_fee",
|
||||||
&td.details.global_fee.fees.history),
|
&td.details.global_fee.fees.history),
|
||||||
TALER_PQ_RESULT_SPEC_AMOUNT ("kyc_fee",
|
TALER_PQ_RESULT_SPEC_AMOUNT (
|
||||||
|
"kyc_fee",
|
||||||
&td.details.global_fee.fees.kyc),
|
&td.details.global_fee.fees.kyc),
|
||||||
GNUNET_PQ_result_spec_auto_from_type ("master_sig",
|
TALER_PQ_RESULT_SPEC_AMOUNT (
|
||||||
|
"account_fee",
|
||||||
|
&td.details.global_fee.fees.account),
|
||||||
|
TALER_PQ_RESULT_SPEC_AMOUNT (
|
||||||
|
"purse_fee",
|
||||||
|
&td.details.global_fee.fees.purse),
|
||||||
|
GNUNET_PQ_result_spec_relative_time (
|
||||||
|
"purse_timeout",
|
||||||
|
&td.details.global_fee.purse_timeout),
|
||||||
|
GNUNET_PQ_result_spec_relative_time (
|
||||||
|
"kyc_timeout",
|
||||||
|
&td.details.global_fee.kyc_timeout),
|
||||||
|
GNUNET_PQ_result_spec_relative_time (
|
||||||
|
"history_expiration",
|
||||||
|
&td.details.global_fee.history_expiration),
|
||||||
|
GNUNET_PQ_result_spec_uint32 (
|
||||||
|
"purse_account_limit",
|
||||||
|
&td.details.global_fee.purse_account_limit),
|
||||||
|
GNUNET_PQ_result_spec_auto_from_type (
|
||||||
|
"master_sig",
|
||||||
&td.details.global_fee.master_sig),
|
&td.details.global_fee.master_sig),
|
||||||
GNUNET_PQ_result_spec_end
|
GNUNET_PQ_result_spec_end
|
||||||
};
|
};
|
||||||
|
@ -2115,6 +2115,14 @@ prepare_statements (struct PostgresClosure *pg)
|
|||||||
" ORDER BY wire_fee_serial DESC"
|
" ORDER BY wire_fee_serial DESC"
|
||||||
" LIMIT 1;",
|
" LIMIT 1;",
|
||||||
0),
|
0),
|
||||||
|
GNUNET_PQ_make_prepare (
|
||||||
|
"select_serial_by_table_global_fee",
|
||||||
|
"SELECT"
|
||||||
|
" global_fee_serial AS serial"
|
||||||
|
" FROM global_fee"
|
||||||
|
" ORDER BY global_fee_serial DESC"
|
||||||
|
" LIMIT 1;",
|
||||||
|
0),
|
||||||
GNUNET_PQ_make_prepare (
|
GNUNET_PQ_make_prepare (
|
||||||
"select_serial_by_table_recoup",
|
"select_serial_by_table_recoup",
|
||||||
"SELECT"
|
"SELECT"
|
||||||
@ -2436,6 +2444,29 @@ prepare_statements (struct PostgresClosure *pg)
|
|||||||
" WHERE wire_fee_serial > $1"
|
" WHERE wire_fee_serial > $1"
|
||||||
" ORDER BY wire_fee_serial ASC;",
|
" ORDER BY wire_fee_serial ASC;",
|
||||||
1),
|
1),
|
||||||
|
GNUNET_PQ_make_prepare (
|
||||||
|
"select_above_serial_by_table_global_fee",
|
||||||
|
"SELECT"
|
||||||
|
" global_fee_serial AS serial"
|
||||||
|
",start_date"
|
||||||
|
",end_date"
|
||||||
|
",history_fee_val"
|
||||||
|
",history_fee_frac"
|
||||||
|
",kyc_fee_val"
|
||||||
|
",kyc_fee_frac"
|
||||||
|
",account_fee_val"
|
||||||
|
",account_fee_frac"
|
||||||
|
",purse_fee_val"
|
||||||
|
",purse_fee_frac"
|
||||||
|
",purse_timeout"
|
||||||
|
",kyc_timeout"
|
||||||
|
",history_expiration"
|
||||||
|
",purse_account_limit"
|
||||||
|
",master_sig"
|
||||||
|
" FROM global_fee"
|
||||||
|
" WHERE global_fee_serial > $1"
|
||||||
|
" ORDER BY global_fee_serial ASC;",
|
||||||
|
1),
|
||||||
GNUNET_PQ_make_prepare (
|
GNUNET_PQ_make_prepare (
|
||||||
"select_above_serial_by_table_recoup",
|
"select_above_serial_by_table_recoup",
|
||||||
"SELECT"
|
"SELECT"
|
||||||
@ -2727,6 +2758,28 @@ prepare_statements (struct PostgresClosure *pg)
|
|||||||
") VALUES "
|
") VALUES "
|
||||||
"($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11);",
|
"($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11);",
|
||||||
11),
|
11),
|
||||||
|
GNUNET_PQ_make_prepare (
|
||||||
|
"insert_into_table_global_fee",
|
||||||
|
"INSERT INTO global_fee"
|
||||||
|
"(global_fee_serial"
|
||||||
|
",start_date"
|
||||||
|
",end_date"
|
||||||
|
",history_fee_val"
|
||||||
|
",history_fee_frac"
|
||||||
|
",kyc_fee_val"
|
||||||
|
",kyc_fee_frac"
|
||||||
|
",account_fee_val"
|
||||||
|
",account_fee_frac"
|
||||||
|
",purse_fee_val"
|
||||||
|
",purse_fee_frac"
|
||||||
|
",purse_timeout"
|
||||||
|
",kyc_timeout"
|
||||||
|
",history_expiration"
|
||||||
|
",purse_account_limit"
|
||||||
|
",master_sig"
|
||||||
|
") VALUES "
|
||||||
|
"($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16);",
|
||||||
|
16),
|
||||||
GNUNET_PQ_make_prepare (
|
GNUNET_PQ_make_prepare (
|
||||||
"insert_into_table_recoup",
|
"insert_into_table_recoup",
|
||||||
"INSERT INTO recoup"
|
"INSERT INTO recoup"
|
||||||
|
@ -394,6 +394,10 @@ struct TALER_EXCHANGEDB_TableData
|
|||||||
struct GNUNET_TIME_Timestamp start_date;
|
struct GNUNET_TIME_Timestamp start_date;
|
||||||
struct GNUNET_TIME_Timestamp end_date;
|
struct GNUNET_TIME_Timestamp end_date;
|
||||||
struct TALER_GlobalFeeSet fees;
|
struct TALER_GlobalFeeSet fees;
|
||||||
|
struct GNUNET_TIME_Relative purse_timeout;
|
||||||
|
struct GNUNET_TIME_Relative kyc_timeout;
|
||||||
|
struct GNUNET_TIME_Relative history_expiration;
|
||||||
|
uint32_t purse_account_limit;
|
||||||
struct TALER_MasterSignatureP master_sig;
|
struct TALER_MasterSignatureP master_sig;
|
||||||
} global_fee;
|
} global_fee;
|
||||||
|
|
||||||
@ -1927,6 +1931,10 @@ typedef void
|
|||||||
*
|
*
|
||||||
* @param cls closure
|
* @param cls closure
|
||||||
* @param fees the global fees we charge
|
* @param fees the global fees we charge
|
||||||
|
* @param purse_timeout when do purses time out
|
||||||
|
* @param kyc_timeout when do reserves without KYC time out
|
||||||
|
* @param history_expiration how long are account histories preserved
|
||||||
|
* @param purse_account_limit how many purses are free per account
|
||||||
* @param start_date from when are these fees valid (start date)
|
* @param start_date from when are these fees valid (start date)
|
||||||
* @param end_date until when are these fees valid (end date, exclusive)
|
* @param end_date until when are these fees valid (end date, exclusive)
|
||||||
* @param master_sig master key signature affirming that this is the correct
|
* @param master_sig master key signature affirming that this is the correct
|
||||||
@ -1936,6 +1944,10 @@ typedef void
|
|||||||
(*TALER_EXCHANGEDB_GlobalFeeCallback)(
|
(*TALER_EXCHANGEDB_GlobalFeeCallback)(
|
||||||
void *cls,
|
void *cls,
|
||||||
const struct TALER_GlobalFeeSet *fees,
|
const struct TALER_GlobalFeeSet *fees,
|
||||||
|
struct GNUNET_TIME_Relative purse_timeout,
|
||||||
|
struct GNUNET_TIME_Relative kyc_timeout,
|
||||||
|
struct GNUNET_TIME_Relative history_expiration,
|
||||||
|
uint32_t purse_account_limit,
|
||||||
struct GNUNET_TIME_Timestamp start_date,
|
struct GNUNET_TIME_Timestamp start_date,
|
||||||
struct GNUNET_TIME_Timestamp end_date,
|
struct GNUNET_TIME_Timestamp end_date,
|
||||||
const struct TALER_MasterSignatureP *master_sig);
|
const struct TALER_MasterSignatureP *master_sig);
|
||||||
@ -3301,6 +3313,10 @@ struct TALER_EXCHANGEDB_Plugin
|
|||||||
* @param start_date when does the fee go into effect
|
* @param start_date when does the fee go into effect
|
||||||
* @param end_date when does the fee end being valid
|
* @param end_date when does the fee end being valid
|
||||||
* @param fees how high is are the global fees
|
* @param fees how high is are the global fees
|
||||||
|
* @param purse_timeout when do purses time out
|
||||||
|
* @param kyc_timeout when do reserves without KYC time out
|
||||||
|
* @param history_expiration how long are account histories preserved
|
||||||
|
* @param purse_account_limit how many purses are free per account
|
||||||
* @param master_sig signature over the above by the exchange master key
|
* @param master_sig signature over the above by the exchange master key
|
||||||
* @return transaction status code
|
* @return transaction status code
|
||||||
*/
|
*/
|
||||||
@ -3309,6 +3325,11 @@ struct TALER_EXCHANGEDB_Plugin
|
|||||||
struct GNUNET_TIME_Timestamp start_date,
|
struct GNUNET_TIME_Timestamp start_date,
|
||||||
struct GNUNET_TIME_Timestamp end_date,
|
struct GNUNET_TIME_Timestamp end_date,
|
||||||
const struct TALER_GlobalFeeSet *fees,
|
const struct TALER_GlobalFeeSet *fees,
|
||||||
|
struct GNUNET_TIME_Relative purse_timeout,
|
||||||
|
struct GNUNET_TIME_Relative kyc_timeout,
|
||||||
|
struct GNUNET_TIME_Relative history_expiration,
|
||||||
|
uint32_t purse_account_limit,
|
||||||
|
|
||||||
const struct TALER_MasterSignatureP *master_sig);
|
const struct TALER_MasterSignatureP *master_sig);
|
||||||
|
|
||||||
|
|
||||||
@ -3342,16 +3363,23 @@ struct TALER_EXCHANGEDB_Plugin
|
|||||||
* @param[out] start_date when does the fee go into effect
|
* @param[out] start_date when does the fee go into effect
|
||||||
* @param[out] end_date when does the fee end being valid
|
* @param[out] end_date when does the fee end being valid
|
||||||
* @param[out] fees how high are the global fees
|
* @param[out] fees how high are the global fees
|
||||||
|
* @param[out] purse_timeout when do purses time out
|
||||||
|
* @param[out] kyc_timeout when do reserves without KYC time out
|
||||||
|
* @param[out] history_expiration how long are account histories preserved
|
||||||
|
* @param[out] purse_account_limit how many purses are free per account
|
||||||
* @param[out] master_sig signature over the above by the exchange master key
|
* @param[out] master_sig signature over the above by the exchange master key
|
||||||
* @return query status of the transaction
|
* @return query status of the transaction
|
||||||
*/
|
*/
|
||||||
enum GNUNET_DB_QueryStatus
|
enum GNUNET_DB_QueryStatus
|
||||||
(*get_global_fee)(void *cls,
|
(*get_global_fee)(void *cls,
|
||||||
const char *type,
|
|
||||||
struct GNUNET_TIME_Timestamp date,
|
struct GNUNET_TIME_Timestamp date,
|
||||||
struct GNUNET_TIME_Timestamp *start_date,
|
struct GNUNET_TIME_Timestamp *start_date,
|
||||||
struct GNUNET_TIME_Timestamp *end_date,
|
struct GNUNET_TIME_Timestamp *end_date,
|
||||||
struct TALER_GlobalFeeSet *fees,
|
struct TALER_GlobalFeeSet *fees,
|
||||||
|
struct GNUNET_TIME_Relative *purse_timeout,
|
||||||
|
struct GNUNET_TIME_Relative *kyc_timeout,
|
||||||
|
struct GNUNET_TIME_Relative *history_expiration,
|
||||||
|
uint32_t *purse_account_limit,
|
||||||
struct TALER_MasterSignatureP *master_sig);
|
struct TALER_MasterSignatureP *master_sig);
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user