fix #6939 in exchange
This commit is contained in:
parent
325b60989f
commit
42decef957
@ -108,7 +108,7 @@ static mode_t unixpath_mode;
|
|||||||
/**
|
/**
|
||||||
* Our currency.
|
* Our currency.
|
||||||
*/
|
*/
|
||||||
static char *currency;
|
char *TAH_currency;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pipe used for signaling reloading of our key state.
|
* Pipe used for signaling reloading of our key state.
|
||||||
@ -325,7 +325,7 @@ handle_version (struct TAH_RequestHandler *rh,
|
|||||||
{
|
{
|
||||||
ver = json_pack ("{s:s, s:s, s:o}",
|
ver = json_pack ("{s:s, s:s, s:o}",
|
||||||
"version", AUDITOR_PROTOCOL_VERSION,
|
"version", AUDITOR_PROTOCOL_VERSION,
|
||||||
"currency", currency,
|
"currency", TAH_currency,
|
||||||
"auditor_public_key", GNUNET_JSON_from_data_auto (
|
"auditor_public_key", GNUNET_JSON_from_data_auto (
|
||||||
&auditor_pub));
|
&auditor_pub));
|
||||||
}
|
}
|
||||||
@ -461,7 +461,7 @@ auditor_serve_process_config (void)
|
|||||||
}
|
}
|
||||||
if (GNUNET_OK !=
|
if (GNUNET_OK !=
|
||||||
TALER_config_get_currency (cfg,
|
TALER_config_get_currency (cfg,
|
||||||
¤cy))
|
&TAH_currency))
|
||||||
{
|
{
|
||||||
return GNUNET_SYSERR;
|
return GNUNET_SYSERR;
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,10 @@ extern struct TALER_AUDITORDB_Plugin *TAH_plugin;
|
|||||||
*/
|
*/
|
||||||
extern struct TALER_EXCHANGEDB_Plugin *TAH_eplugin;
|
extern struct TALER_EXCHANGEDB_Plugin *TAH_eplugin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Our currency.
|
||||||
|
*/
|
||||||
|
extern char *TAH_currency;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Struct describing an URL and the handler for it.
|
* @brief Struct describing an URL and the handler for it.
|
||||||
|
@ -259,21 +259,35 @@ TAH_DEPOSIT_CONFIRMATION_handler (struct TAH_RequestHandler *rh,
|
|||||||
struct TALER_AUDITORDB_DepositConfirmation dc;
|
struct TALER_AUDITORDB_DepositConfirmation dc;
|
||||||
struct TALER_AUDITORDB_ExchangeSigningKey es;
|
struct TALER_AUDITORDB_ExchangeSigningKey es;
|
||||||
struct GNUNET_JSON_Specification spec[] = {
|
struct GNUNET_JSON_Specification spec[] = {
|
||||||
GNUNET_JSON_spec_fixed_auto ("h_contract_terms", &dc.h_contract_terms),
|
GNUNET_JSON_spec_fixed_auto ("h_contract_terms",
|
||||||
GNUNET_JSON_spec_fixed_auto ("h_wire", &dc.h_wire),
|
&dc.h_contract_terms),
|
||||||
|
GNUNET_JSON_spec_fixed_auto ("h_wire",
|
||||||
|
&dc.h_wire),
|
||||||
TALER_JSON_spec_absolute_time ("exchange_timestamp",
|
TALER_JSON_spec_absolute_time ("exchange_timestamp",
|
||||||
&dc.exchange_timestamp),
|
&dc.exchange_timestamp),
|
||||||
TALER_JSON_spec_absolute_time ("refund_deadline", &dc.refund_deadline),
|
TALER_JSON_spec_absolute_time ("refund_deadline",
|
||||||
TALER_JSON_spec_amount ("amount_without_fee", &dc.amount_without_fee),
|
&dc.refund_deadline),
|
||||||
GNUNET_JSON_spec_fixed_auto ("coin_pub", &dc.coin_pub),
|
TALER_JSON_spec_amount ("amount_without_fee",
|
||||||
GNUNET_JSON_spec_fixed_auto ("merchant_pub", &dc.merchant),
|
TAH_currency,
|
||||||
GNUNET_JSON_spec_fixed_auto ("exchange_sig", &dc.exchange_sig),
|
&dc.amount_without_fee),
|
||||||
GNUNET_JSON_spec_fixed_auto ("exchange_pub", &dc.exchange_pub),
|
GNUNET_JSON_spec_fixed_auto ("coin_pub",
|
||||||
GNUNET_JSON_spec_fixed_auto ("master_pub", &es.master_public_key),
|
&dc.coin_pub),
|
||||||
TALER_JSON_spec_absolute_time ("ep_start", &es.ep_start),
|
GNUNET_JSON_spec_fixed_auto ("merchant_pub",
|
||||||
TALER_JSON_spec_absolute_time ("ep_expire", &es.ep_expire),
|
&dc.merchant),
|
||||||
TALER_JSON_spec_absolute_time ("ep_end", &es.ep_end),
|
GNUNET_JSON_spec_fixed_auto ("exchange_sig",
|
||||||
GNUNET_JSON_spec_fixed_auto ("master_sig", &es.master_sig),
|
&dc.exchange_sig),
|
||||||
|
GNUNET_JSON_spec_fixed_auto ("exchange_pub",
|
||||||
|
&dc.exchange_pub),
|
||||||
|
GNUNET_JSON_spec_fixed_auto ("master_pub",
|
||||||
|
&es.master_public_key),
|
||||||
|
TALER_JSON_spec_absolute_time ("ep_start",
|
||||||
|
&es.ep_start),
|
||||||
|
TALER_JSON_spec_absolute_time ("ep_expire",
|
||||||
|
&es.ep_expire),
|
||||||
|
TALER_JSON_spec_absolute_time ("ep_end",
|
||||||
|
&es.ep_end),
|
||||||
|
GNUNET_JSON_spec_fixed_auto ("master_sig",
|
||||||
|
&es.master_sig),
|
||||||
GNUNET_JSON_spec_end ()
|
GNUNET_JSON_spec_end ()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -88,8 +88,8 @@ parse_account_history (struct TALER_BANK_CreditHistoryHandle *hh,
|
|||||||
struct TALER_BANK_CreditDetails td;
|
struct TALER_BANK_CreditDetails td;
|
||||||
uint64_t row_id;
|
uint64_t row_id;
|
||||||
struct GNUNET_JSON_Specification hist_spec[] = {
|
struct GNUNET_JSON_Specification hist_spec[] = {
|
||||||
TALER_JSON_spec_amount ("amount",
|
TALER_JSON_spec_amount_any ("amount",
|
||||||
&td.amount),
|
&td.amount),
|
||||||
TALER_JSON_spec_absolute_time ("date",
|
TALER_JSON_spec_absolute_time ("date",
|
||||||
&td.execution_date),
|
&td.execution_date),
|
||||||
GNUNET_JSON_spec_uint64 ("row_id",
|
GNUNET_JSON_spec_uint64 ("row_id",
|
||||||
|
@ -88,8 +88,8 @@ parse_account_history (struct TALER_BANK_DebitHistoryHandle *hh,
|
|||||||
struct TALER_BANK_DebitDetails td;
|
struct TALER_BANK_DebitDetails td;
|
||||||
uint64_t row_id;
|
uint64_t row_id;
|
||||||
struct GNUNET_JSON_Specification hist_spec[] = {
|
struct GNUNET_JSON_Specification hist_spec[] = {
|
||||||
TALER_JSON_spec_amount ("amount",
|
TALER_JSON_spec_amount_any ("amount",
|
||||||
&td.amount),
|
&td.amount),
|
||||||
TALER_JSON_spec_absolute_time ("date",
|
TALER_JSON_spec_absolute_time ("date",
|
||||||
&td.execution_date),
|
&td.execution_date),
|
||||||
GNUNET_JSON_spec_uint64 ("row_id",
|
GNUNET_JSON_spec_uint64 ("row_id",
|
||||||
|
@ -1027,6 +1027,7 @@ handle_admin_add_incoming (struct TALER_FAKEBANK_Handle *h,
|
|||||||
GNUNET_JSON_spec_string ("debit_account",
|
GNUNET_JSON_spec_string ("debit_account",
|
||||||
&debit_account),
|
&debit_account),
|
||||||
TALER_JSON_spec_amount ("amount",
|
TALER_JSON_spec_amount ("amount",
|
||||||
|
h->currency,
|
||||||
&amount),
|
&amount),
|
||||||
GNUNET_JSON_spec_end ()
|
GNUNET_JSON_spec_end ()
|
||||||
};
|
};
|
||||||
@ -1148,6 +1149,7 @@ handle_transfer (struct TALER_FAKEBANK_Handle *h,
|
|||||||
GNUNET_JSON_spec_fixed_auto ("request_uid",
|
GNUNET_JSON_spec_fixed_auto ("request_uid",
|
||||||
&uuid),
|
&uuid),
|
||||||
TALER_JSON_spec_amount ("amount",
|
TALER_JSON_spec_amount ("amount",
|
||||||
|
h->currency,
|
||||||
&amount),
|
&amount),
|
||||||
GNUNET_JSON_spec_string ("exchange_base_url",
|
GNUNET_JSON_spec_string ("exchange_base_url",
|
||||||
&base_url),
|
&base_url),
|
||||||
|
@ -98,6 +98,11 @@ static json_t *in;
|
|||||||
*/
|
*/
|
||||||
static json_t *out;
|
static json_t *out;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Currency supported by this auditor.
|
||||||
|
*/
|
||||||
|
static char *currency;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A subcommand supported by this program.
|
* A subcommand supported by this program.
|
||||||
@ -749,14 +754,19 @@ show_denomkeys (const json_t *denomkeys)
|
|||||||
GNUNET_JSON_spec_rsa_public_key ("denom_pub",
|
GNUNET_JSON_spec_rsa_public_key ("denom_pub",
|
||||||
&denom_pub.rsa_public_key),
|
&denom_pub.rsa_public_key),
|
||||||
TALER_JSON_spec_amount ("value",
|
TALER_JSON_spec_amount ("value",
|
||||||
|
currency,
|
||||||
&coin_value),
|
&coin_value),
|
||||||
TALER_JSON_spec_amount ("fee_withdraw",
|
TALER_JSON_spec_amount ("fee_withdraw",
|
||||||
|
currency,
|
||||||
&fee_withdraw),
|
&fee_withdraw),
|
||||||
TALER_JSON_spec_amount ("fee_deposit",
|
TALER_JSON_spec_amount ("fee_deposit",
|
||||||
|
currency,
|
||||||
&fee_deposit),
|
&fee_deposit),
|
||||||
TALER_JSON_spec_amount ("fee_refresh",
|
TALER_JSON_spec_amount ("fee_refresh",
|
||||||
|
currency,
|
||||||
&fee_refresh),
|
&fee_refresh),
|
||||||
TALER_JSON_spec_amount ("fee_refund",
|
TALER_JSON_spec_amount ("fee_refund",
|
||||||
|
currency,
|
||||||
&fee_refund),
|
&fee_refund),
|
||||||
GNUNET_JSON_spec_absolute_time ("stamp_start",
|
GNUNET_JSON_spec_absolute_time ("stamp_start",
|
||||||
&stamp_start),
|
&stamp_start),
|
||||||
@ -1044,14 +1054,19 @@ sign_denomkeys (const json_t *denomkeys)
|
|||||||
GNUNET_JSON_spec_rsa_public_key ("denom_pub",
|
GNUNET_JSON_spec_rsa_public_key ("denom_pub",
|
||||||
&denom_pub.rsa_public_key),
|
&denom_pub.rsa_public_key),
|
||||||
TALER_JSON_spec_amount ("value",
|
TALER_JSON_spec_amount ("value",
|
||||||
|
currency,
|
||||||
&coin_value),
|
&coin_value),
|
||||||
TALER_JSON_spec_amount ("fee_withdraw",
|
TALER_JSON_spec_amount ("fee_withdraw",
|
||||||
|
currency,
|
||||||
&fee_withdraw),
|
&fee_withdraw),
|
||||||
TALER_JSON_spec_amount ("fee_deposit",
|
TALER_JSON_spec_amount ("fee_deposit",
|
||||||
|
currency,
|
||||||
&fee_deposit),
|
&fee_deposit),
|
||||||
TALER_JSON_spec_amount ("fee_refresh",
|
TALER_JSON_spec_amount ("fee_refresh",
|
||||||
|
currency,
|
||||||
&fee_refresh),
|
&fee_refresh),
|
||||||
TALER_JSON_spec_amount ("fee_refund",
|
TALER_JSON_spec_amount ("fee_refund",
|
||||||
|
currency,
|
||||||
&fee_refund),
|
&fee_refund),
|
||||||
GNUNET_JSON_spec_absolute_time ("stamp_start",
|
GNUNET_JSON_spec_absolute_time ("stamp_start",
|
||||||
&stamp_start),
|
&stamp_start),
|
||||||
@ -1346,6 +1361,13 @@ run (void *cls,
|
|||||||
const struct GNUNET_CONFIGURATION_Handle *cfg)
|
const struct GNUNET_CONFIGURATION_Handle *cfg)
|
||||||
{
|
{
|
||||||
kcfg = cfg;
|
kcfg = cfg;
|
||||||
|
if (GNUNET_OK !=
|
||||||
|
TALER_config_get_currency (kcfg,
|
||||||
|
¤cy))
|
||||||
|
{
|
||||||
|
global_ret = 1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (GNUNET_OK !=
|
if (GNUNET_OK !=
|
||||||
GNUNET_CONFIGURATION_get_value_string (kcfg,
|
GNUNET_CONFIGURATION_get_value_string (kcfg,
|
||||||
"auditor",
|
"auditor",
|
||||||
|
@ -134,6 +134,11 @@ static json_t *in;
|
|||||||
*/
|
*/
|
||||||
static json_t *out;
|
static json_t *out;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Currency we have configured.
|
||||||
|
*/
|
||||||
|
static char *currency;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A subcommand supported by this program.
|
* A subcommand supported by this program.
|
||||||
@ -1424,8 +1429,10 @@ upload_wire_fee (const char *exchange_url,
|
|||||||
GNUNET_JSON_spec_string ("wire_method",
|
GNUNET_JSON_spec_string ("wire_method",
|
||||||
&wire_method),
|
&wire_method),
|
||||||
TALER_JSON_spec_amount ("wire_fee",
|
TALER_JSON_spec_amount ("wire_fee",
|
||||||
|
currency,
|
||||||
&wire_fee),
|
&wire_fee),
|
||||||
TALER_JSON_spec_amount ("closing_fee",
|
TALER_JSON_spec_amount ("closing_fee",
|
||||||
|
currency,
|
||||||
&closing_fee),
|
&closing_fee),
|
||||||
GNUNET_JSON_spec_absolute_time ("start_time",
|
GNUNET_JSON_spec_absolute_time ("start_time",
|
||||||
&start_time),
|
&start_time),
|
||||||
@ -2590,14 +2597,19 @@ show_denomkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub,
|
|||||||
GNUNET_JSON_spec_rsa_public_key ("denom_pub",
|
GNUNET_JSON_spec_rsa_public_key ("denom_pub",
|
||||||
&denom_pub.rsa_public_key),
|
&denom_pub.rsa_public_key),
|
||||||
TALER_JSON_spec_amount ("value",
|
TALER_JSON_spec_amount ("value",
|
||||||
|
currency,
|
||||||
&coin_value),
|
&coin_value),
|
||||||
TALER_JSON_spec_amount ("fee_withdraw",
|
TALER_JSON_spec_amount ("fee_withdraw",
|
||||||
|
currency,
|
||||||
&fee_withdraw),
|
&fee_withdraw),
|
||||||
TALER_JSON_spec_amount ("fee_deposit",
|
TALER_JSON_spec_amount ("fee_deposit",
|
||||||
|
currency,
|
||||||
&fee_deposit),
|
&fee_deposit),
|
||||||
TALER_JSON_spec_amount ("fee_refresh",
|
TALER_JSON_spec_amount ("fee_refresh",
|
||||||
|
currency,
|
||||||
&fee_refresh),
|
&fee_refresh),
|
||||||
TALER_JSON_spec_amount ("fee_refund",
|
TALER_JSON_spec_amount ("fee_refund",
|
||||||
|
currency,
|
||||||
&fee_refund),
|
&fee_refund),
|
||||||
GNUNET_JSON_spec_absolute_time ("stamp_start",
|
GNUNET_JSON_spec_absolute_time ("stamp_start",
|
||||||
&stamp_start),
|
&stamp_start),
|
||||||
@ -3004,14 +3016,19 @@ sign_denomkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub,
|
|||||||
GNUNET_JSON_spec_rsa_public_key ("denom_pub",
|
GNUNET_JSON_spec_rsa_public_key ("denom_pub",
|
||||||
&denom_pub.rsa_public_key),
|
&denom_pub.rsa_public_key),
|
||||||
TALER_JSON_spec_amount ("value",
|
TALER_JSON_spec_amount ("value",
|
||||||
|
currency,
|
||||||
&coin_value),
|
&coin_value),
|
||||||
TALER_JSON_spec_amount ("fee_withdraw",
|
TALER_JSON_spec_amount ("fee_withdraw",
|
||||||
|
currency,
|
||||||
&fee_withdraw),
|
&fee_withdraw),
|
||||||
TALER_JSON_spec_amount ("fee_deposit",
|
TALER_JSON_spec_amount ("fee_deposit",
|
||||||
|
currency,
|
||||||
&fee_deposit),
|
&fee_deposit),
|
||||||
TALER_JSON_spec_amount ("fee_refresh",
|
TALER_JSON_spec_amount ("fee_refresh",
|
||||||
|
currency,
|
||||||
&fee_refresh),
|
&fee_refresh),
|
||||||
TALER_JSON_spec_amount ("fee_refund",
|
TALER_JSON_spec_amount ("fee_refund",
|
||||||
|
currency,
|
||||||
&fee_refund),
|
&fee_refund),
|
||||||
GNUNET_JSON_spec_absolute_time ("stamp_start",
|
GNUNET_JSON_spec_absolute_time ("stamp_start",
|
||||||
&stamp_start),
|
&stamp_start),
|
||||||
@ -3385,6 +3402,13 @@ run (void *cls,
|
|||||||
const struct GNUNET_CONFIGURATION_Handle *cfg)
|
const struct GNUNET_CONFIGURATION_Handle *cfg)
|
||||||
{
|
{
|
||||||
kcfg = cfg;
|
kcfg = cfg;
|
||||||
|
if (GNUNET_OK !=
|
||||||
|
TALER_config_get_currency (kcfg,
|
||||||
|
¤cy))
|
||||||
|
{
|
||||||
|
global_ret = 1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
ctx = GNUNET_CURL_init (&GNUNET_CURL_gnunet_scheduler_reschedule,
|
ctx = GNUNET_CURL_init (&GNUNET_CURL_gnunet_scheduler_reschedule,
|
||||||
&rc);
|
&rc);
|
||||||
rc = GNUNET_CURL_gnunet_rc_create (ctx);
|
rc = GNUNET_CURL_gnunet_rc_create (ctx);
|
||||||
|
@ -332,6 +332,7 @@ TEH_handler_deposit (struct MHD_Connection *connection,
|
|||||||
struct GNUNET_JSON_Specification spec[] = {
|
struct GNUNET_JSON_Specification spec[] = {
|
||||||
GNUNET_JSON_spec_json ("wire", &wire),
|
GNUNET_JSON_spec_json ("wire", &wire),
|
||||||
TALER_JSON_spec_amount ("contribution",
|
TALER_JSON_spec_amount ("contribution",
|
||||||
|
TEH_currency,
|
||||||
&deposit.amount_with_fee),
|
&deposit.amount_with_fee),
|
||||||
GNUNET_JSON_spec_fixed_auto ("denom_pub_hash",
|
GNUNET_JSON_spec_fixed_auto ("denom_pub_hash",
|
||||||
&deposit.coin.denom_pub_hash),
|
&deposit.coin.denom_pub_hash),
|
||||||
@ -488,17 +489,6 @@ TEH_handler_deposit (struct MHD_Connection *connection,
|
|||||||
}
|
}
|
||||||
|
|
||||||
deposit.deposit_fee = dk->meta.fee_deposit;
|
deposit.deposit_fee = dk->meta.fee_deposit;
|
||||||
if (GNUNET_YES !=
|
|
||||||
TALER_amount_cmp_currency (&deposit.amount_with_fee,
|
|
||||||
&deposit.deposit_fee) )
|
|
||||||
{
|
|
||||||
GNUNET_break_op (0);
|
|
||||||
GNUNET_JSON_parse_free (spec);
|
|
||||||
return TALER_MHD_reply_with_error (connection,
|
|
||||||
MHD_HTTP_BAD_REQUEST,
|
|
||||||
TALER_EC_GENERIC_CURRENCY_MISMATCH,
|
|
||||||
deposit.deposit_fee.currency);
|
|
||||||
}
|
|
||||||
/* check coin signature */
|
/* check coin signature */
|
||||||
if (GNUNET_YES !=
|
if (GNUNET_YES !=
|
||||||
TALER_test_coin_valid (&deposit.coin,
|
TALER_test_coin_valid (&deposit.coin,
|
||||||
|
@ -180,8 +180,10 @@ TEH_handler_management_post_wire_fees (
|
|||||||
TALER_JSON_spec_absolute_time ("fee_end",
|
TALER_JSON_spec_absolute_time ("fee_end",
|
||||||
&afc.end_time),
|
&afc.end_time),
|
||||||
TALER_JSON_spec_amount ("closing_fee",
|
TALER_JSON_spec_amount ("closing_fee",
|
||||||
|
TEH_currency,
|
||||||
&afc.closing_fee),
|
&afc.closing_fee),
|
||||||
TALER_JSON_spec_amount ("wire_fee",
|
TALER_JSON_spec_amount ("wire_fee",
|
||||||
|
TEH_currency,
|
||||||
&afc.wire_fee),
|
&afc.wire_fee),
|
||||||
GNUNET_JSON_spec_end ()
|
GNUNET_JSON_spec_end ()
|
||||||
};
|
};
|
||||||
@ -200,28 +202,6 @@ TEH_handler_management_post_wire_fees (
|
|||||||
return MHD_YES; /* failure */
|
return MHD_YES; /* failure */
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GNUNET_OK !=
|
|
||||||
TALER_amount_cmp_currency (&afc.closing_fee,
|
|
||||||
&afc.wire_fee))
|
|
||||||
{
|
|
||||||
/* currencies of the two fees must be identical */
|
|
||||||
GNUNET_break_op (0);
|
|
||||||
return TALER_MHD_reply_with_error (connection,
|
|
||||||
MHD_HTTP_BAD_REQUEST,
|
|
||||||
TALER_EC_GENERIC_CURRENCY_MISMATCH,
|
|
||||||
NULL);
|
|
||||||
}
|
|
||||||
if (0 !=
|
|
||||||
strcasecmp (afc.wire_fee.currency,
|
|
||||||
TEH_currency))
|
|
||||||
{
|
|
||||||
/* currency does not match exchange's currency */
|
|
||||||
return TALER_MHD_reply_with_error (connection,
|
|
||||||
MHD_HTTP_PRECONDITION_FAILED,
|
|
||||||
TALER_EC_GENERIC_CURRENCY_MISMATCH,
|
|
||||||
TEH_currency);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GNUNET_OK !=
|
if (GNUNET_OK !=
|
||||||
TALER_exchange_offline_wire_fee_verify (
|
TALER_exchange_offline_wire_fee_verify (
|
||||||
afc.wire_method,
|
afc.wire_method,
|
||||||
|
@ -554,18 +554,6 @@ check_for_denomination_key (struct MHD_Connection *connection,
|
|||||||
|
|
||||||
rmc->coin_refresh_fee = dk->meta.fee_refresh;
|
rmc->coin_refresh_fee = dk->meta.fee_refresh;
|
||||||
rmc->coin_value = dk->meta.value;
|
rmc->coin_value = dk->meta.value;
|
||||||
/* check client used sane currency */
|
|
||||||
if (GNUNET_YES !=
|
|
||||||
TALER_amount_cmp_currency (&rmc->refresh_session.amount_with_fee,
|
|
||||||
&rmc->coin_value) )
|
|
||||||
{
|
|
||||||
GNUNET_break_op (0);
|
|
||||||
return TALER_MHD_reply_with_error (
|
|
||||||
connection,
|
|
||||||
MHD_HTTP_BAD_REQUEST,
|
|
||||||
TALER_EC_GENERIC_CURRENCY_MISMATCH,
|
|
||||||
rmc->refresh_session.amount_with_fee.currency);
|
|
||||||
}
|
|
||||||
/* check coin is actually properly signed */
|
/* check coin is actually properly signed */
|
||||||
if (GNUNET_OK !=
|
if (GNUNET_OK !=
|
||||||
TALER_test_coin_valid (&rmc->refresh_session.coin,
|
TALER_test_coin_valid (&rmc->refresh_session.coin,
|
||||||
@ -621,6 +609,7 @@ TEH_handler_melt (struct MHD_Connection *connection,
|
|||||||
GNUNET_JSON_spec_fixed_auto ("confirm_sig",
|
GNUNET_JSON_spec_fixed_auto ("confirm_sig",
|
||||||
&rmc.refresh_session.coin_sig),
|
&rmc.refresh_session.coin_sig),
|
||||||
TALER_JSON_spec_amount ("value_with_fee",
|
TALER_JSON_spec_amount ("value_with_fee",
|
||||||
|
TEH_currency,
|
||||||
&rmc.refresh_session.amount_with_fee),
|
&rmc.refresh_session.amount_with_fee),
|
||||||
GNUNET_JSON_spec_fixed_auto ("rc",
|
GNUNET_JSON_spec_fixed_auto ("rc",
|
||||||
&rmc.refresh_session.rc),
|
&rmc.refresh_session.rc),
|
||||||
|
@ -312,21 +312,6 @@ refund_transaction (void *cls,
|
|||||||
return GNUNET_DB_STATUS_HARD_ERROR;
|
return GNUNET_DB_STATUS_HARD_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check currency is compatible */
|
|
||||||
if (GNUNET_YES !=
|
|
||||||
TALER_amount_cmp_currency (&refund->details.refund_amount,
|
|
||||||
&deposit_total))
|
|
||||||
{
|
|
||||||
GNUNET_break_op (0); /* currency mismatch */
|
|
||||||
TEH_plugin->free_coin_transaction_list (TEH_plugin->cls,
|
|
||||||
tlx);
|
|
||||||
*mhd_ret = TALER_MHD_reply_with_error (connection,
|
|
||||||
MHD_HTTP_BAD_REQUEST,
|
|
||||||
TALER_EC_GENERIC_CURRENCY_MISMATCH,
|
|
||||||
deposit_total.currency);
|
|
||||||
return GNUNET_DB_STATUS_HARD_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* check total refund amount is sufficiently low */
|
/* check total refund amount is sufficiently low */
|
||||||
if (refund_found)
|
if (refund_found)
|
||||||
GNUNET_break (0 <=
|
GNUNET_break (0 <=
|
||||||
@ -505,6 +490,7 @@ TEH_handler_refund (struct MHD_Connection *connection,
|
|||||||
};
|
};
|
||||||
struct GNUNET_JSON_Specification spec[] = {
|
struct GNUNET_JSON_Specification spec[] = {
|
||||||
TALER_JSON_spec_amount ("refund_amount",
|
TALER_JSON_spec_amount ("refund_amount",
|
||||||
|
TEH_currency,
|
||||||
&refund.details.refund_amount),
|
&refund.details.refund_amount),
|
||||||
GNUNET_JSON_spec_fixed_auto ("h_contract_terms",
|
GNUNET_JSON_spec_fixed_auto ("h_contract_terms",
|
||||||
&refund.details.h_contract_terms),
|
&refund.details.h_contract_terms),
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
This file is part of TALER
|
This file is part of TALER
|
||||||
Copyright (C) 2014, 2015, 2016 Taler Systems SA
|
Copyright (C) 2014, 2015, 2016, 2021 Taler Systems SA
|
||||||
|
|
||||||
TALER is free software; you can redistribute it and/or modify it under the
|
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
|
terms of the GNU General Public License as published by the Free Software
|
||||||
@ -59,33 +59,70 @@ TALER_JSON_from_amount_nbo (const struct TALER_AmountNBO *amount);
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Provide specification to parse given JSON object to an amount.
|
* Provide specification to parse given JSON object to an amount.
|
||||||
|
* The @a currency must be a valid pointer while the
|
||||||
|
* parsing is done, a copy is not made.
|
||||||
*
|
*
|
||||||
* @param name name of the amount field in the JSON
|
* @param name name of the amount field in the JSON
|
||||||
|
* @param currency the currency the amount must be in
|
||||||
* @param[out] r_amount where the amount has to be written
|
* @param[out] r_amount where the amount has to be written
|
||||||
|
* @return spec for parsing an amount
|
||||||
*/
|
*/
|
||||||
struct GNUNET_JSON_Specification
|
struct GNUNET_JSON_Specification
|
||||||
TALER_JSON_spec_amount (const char *name,
|
TALER_JSON_spec_amount (const char *name,
|
||||||
|
const char *currency,
|
||||||
struct TALER_Amount *r_amount);
|
struct TALER_Amount *r_amount);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provide specification to parse given JSON object to an amount
|
* Provide specification to parse given JSON object to an amount
|
||||||
* in network byte order.
|
* in network byte order.
|
||||||
|
* The @a currency must be a valid pointer while the
|
||||||
|
* parsing is done, a copy is not made.
|
||||||
*
|
*
|
||||||
* @param name name of the amount field in the JSON
|
* @param name name of the amount field in the JSON
|
||||||
|
* @param currency the currency the amount must be in
|
||||||
* @param[out] r_amount where the amount has to be written
|
* @param[out] r_amount where the amount has to be written
|
||||||
|
* @return spec for parsing an amount
|
||||||
*/
|
*/
|
||||||
struct GNUNET_JSON_Specification
|
struct GNUNET_JSON_Specification
|
||||||
TALER_JSON_spec_amount_nbo (const char *name,
|
TALER_JSON_spec_amount_nbo (const char *name,
|
||||||
|
const char *currency,
|
||||||
struct TALER_AmountNBO *r_amount);
|
struct TALER_AmountNBO *r_amount);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provide specification to parse given JSON object to an amount
|
||||||
|
* in any currency.
|
||||||
|
*
|
||||||
|
* @param name name of the amount field in the JSON
|
||||||
|
* @param[out] r_amount where the amount has to be written
|
||||||
|
* @return spec for parsing an amount
|
||||||
|
*/
|
||||||
|
struct GNUNET_JSON_Specification
|
||||||
|
TALER_JSON_spec_amount_any (const char *name,
|
||||||
|
struct TALER_Amount *r_amount);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provide specification to parse given JSON object to an amount
|
||||||
|
* in any currency in network byte order.
|
||||||
|
*
|
||||||
|
* @param name name of the amount field in the JSON
|
||||||
|
* @param[out] r_amount where the amount has to be written
|
||||||
|
* @return spec for parsing an amount
|
||||||
|
*/
|
||||||
|
struct GNUNET_JSON_Specification
|
||||||
|
TALER_JSON_spec_amount_any_nbo (const char *name,
|
||||||
|
struct TALER_AmountNBO *r_amount);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provide specification to parse given JSON object to an absolute time.
|
* Provide specification to parse given JSON object to an absolute time.
|
||||||
* The absolute time value is expected to be already rounded.
|
* The absolute time value is expected to be already rounded.
|
||||||
*
|
*
|
||||||
* @param name name of the time field in the JSON
|
* @param name name of the time field in the JSON
|
||||||
* @param[out] r_time where the time has to be written
|
* @param[out] r_time where the time has to be written
|
||||||
|
* @return spec for parsing an absolute time
|
||||||
*/
|
*/
|
||||||
struct GNUNET_JSON_Specification
|
struct GNUNET_JSON_Specification
|
||||||
TALER_JSON_spec_absolute_time (const char *name,
|
TALER_JSON_spec_absolute_time (const char *name,
|
||||||
@ -99,6 +136,7 @@ TALER_JSON_spec_absolute_time (const char *name,
|
|||||||
*
|
*
|
||||||
* @param name name of the time field in the JSON
|
* @param name name of the time field in the JSON
|
||||||
* @param[out] r_time where the time has to be written
|
* @param[out] r_time where the time has to be written
|
||||||
|
* @return spec for parsing an absolute time
|
||||||
*/
|
*/
|
||||||
struct GNUNET_JSON_Specification
|
struct GNUNET_JSON_Specification
|
||||||
TALER_JSON_spec_absolute_time_nbo (const char *name,
|
TALER_JSON_spec_absolute_time_nbo (const char *name,
|
||||||
@ -111,6 +149,7 @@ TALER_JSON_spec_absolute_time_nbo (const char *name,
|
|||||||
*
|
*
|
||||||
* @param name name of the time field in the JSON
|
* @param name name of the time field in the JSON
|
||||||
* @param[out] r_time where the time has to be written
|
* @param[out] r_time where the time has to be written
|
||||||
|
* @return spec for parsing a relative time
|
||||||
*/
|
*/
|
||||||
struct GNUNET_JSON_Specification
|
struct GNUNET_JSON_Specification
|
||||||
TALER_JSON_spec_relative_time (const char *name,
|
TALER_JSON_spec_relative_time (const char *name,
|
||||||
|
@ -55,7 +55,7 @@ TALER_JSON_from_amount_nbo (const struct TALER_AmountNBO *amount)
|
|||||||
/**
|
/**
|
||||||
* Parse given JSON object to Amount
|
* Parse given JSON object to Amount
|
||||||
*
|
*
|
||||||
* @param cls closure, NULL
|
* @param cls closure, expected currency, or NULL
|
||||||
* @param root the json object representing data
|
* @param root the json object representing data
|
||||||
* @param[out] spec where to write the data
|
* @param[out] spec where to write the data
|
||||||
* @return #GNUNET_OK upon successful parsing; #GNUNET_SYSERR upon error
|
* @return #GNUNET_OK upon successful parsing; #GNUNET_SYSERR upon error
|
||||||
@ -65,6 +65,7 @@ parse_amount (void *cls,
|
|||||||
json_t *root,
|
json_t *root,
|
||||||
struct GNUNET_JSON_Specification *spec)
|
struct GNUNET_JSON_Specification *spec)
|
||||||
{
|
{
|
||||||
|
const char *currency = cls;
|
||||||
struct TALER_Amount *r_amount = spec->ptr;
|
struct TALER_Amount *r_amount = spec->ptr;
|
||||||
|
|
||||||
(void) cls;
|
(void) cls;
|
||||||
@ -80,13 +81,41 @@ parse_amount (void *cls,
|
|||||||
GNUNET_break_op (0);
|
GNUNET_break_op (0);
|
||||||
return GNUNET_SYSERR;
|
return GNUNET_SYSERR;
|
||||||
}
|
}
|
||||||
|
if ( (NULL != currency) &&
|
||||||
|
(0 !=
|
||||||
|
strcasecmp (currency,
|
||||||
|
r_amount->currency)) )
|
||||||
|
{
|
||||||
|
GNUNET_break_op (0);
|
||||||
|
return GNUNET_SYSERR;
|
||||||
|
}
|
||||||
return GNUNET_OK;
|
return GNUNET_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
struct GNUNET_JSON_Specification
|
struct GNUNET_JSON_Specification
|
||||||
TALER_JSON_spec_amount (const char *name,
|
TALER_JSON_spec_amount (const char *name,
|
||||||
|
const char *currency,
|
||||||
struct TALER_Amount *r_amount)
|
struct TALER_Amount *r_amount)
|
||||||
|
{
|
||||||
|
struct GNUNET_JSON_Specification ret = {
|
||||||
|
.parser = &parse_amount,
|
||||||
|
.cleaner = NULL,
|
||||||
|
.cls = (void *) currency,
|
||||||
|
.field = name,
|
||||||
|
.ptr = r_amount,
|
||||||
|
.ptr_size = 0,
|
||||||
|
.size_ptr = NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
GNUNET_assert (NULL != currency);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
struct GNUNET_JSON_Specification
|
||||||
|
TALER_JSON_spec_amount_any (const char *name,
|
||||||
|
struct TALER_Amount *r_amount)
|
||||||
{
|
{
|
||||||
struct GNUNET_JSON_Specification ret = {
|
struct GNUNET_JSON_Specification ret = {
|
||||||
.parser = &parse_amount,
|
.parser = &parse_amount,
|
||||||
@ -97,6 +126,7 @@ TALER_JSON_spec_amount (const char *name,
|
|||||||
.ptr_size = 0,
|
.ptr_size = 0,
|
||||||
.size_ptr = NULL
|
.size_ptr = NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,6 +144,7 @@ parse_amount_nbo (void *cls,
|
|||||||
json_t *root,
|
json_t *root,
|
||||||
struct GNUNET_JSON_Specification *spec)
|
struct GNUNET_JSON_Specification *spec)
|
||||||
{
|
{
|
||||||
|
const char *currency = cls;
|
||||||
struct TALER_AmountNBO *r_amount = spec->ptr;
|
struct TALER_AmountNBO *r_amount = spec->ptr;
|
||||||
const char *sv;
|
const char *sv;
|
||||||
|
|
||||||
@ -134,13 +165,41 @@ parse_amount_nbo (void *cls,
|
|||||||
GNUNET_break_op (0);
|
GNUNET_break_op (0);
|
||||||
return GNUNET_SYSERR;
|
return GNUNET_SYSERR;
|
||||||
}
|
}
|
||||||
|
if ( (NULL != currency) &&
|
||||||
|
(0 !=
|
||||||
|
strcasecmp (currency,
|
||||||
|
r_amount->currency)) )
|
||||||
|
{
|
||||||
|
GNUNET_break_op (0);
|
||||||
|
return GNUNET_SYSERR;
|
||||||
|
}
|
||||||
return GNUNET_OK;
|
return GNUNET_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
struct GNUNET_JSON_Specification
|
struct GNUNET_JSON_Specification
|
||||||
TALER_JSON_spec_amount_nbo (const char *name,
|
TALER_JSON_spec_amount_nbo (const char *name,
|
||||||
|
const char *currency,
|
||||||
struct TALER_AmountNBO *r_amount)
|
struct TALER_AmountNBO *r_amount)
|
||||||
|
{
|
||||||
|
struct GNUNET_JSON_Specification ret = {
|
||||||
|
.parser = &parse_amount_nbo,
|
||||||
|
.cleaner = NULL,
|
||||||
|
.cls = (void *) currency,
|
||||||
|
.field = name,
|
||||||
|
.ptr = r_amount,
|
||||||
|
.ptr_size = 0,
|
||||||
|
.size_ptr = NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
GNUNET_assert (NULL != currency);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
struct GNUNET_JSON_Specification
|
||||||
|
TALER_JSON_spec_amount_any_nbo (const char *name,
|
||||||
|
struct TALER_AmountNBO *r_amount)
|
||||||
{
|
{
|
||||||
struct GNUNET_JSON_Specification ret = {
|
struct GNUNET_JSON_Specification ret = {
|
||||||
.parser = &parse_amount_nbo,
|
.parser = &parse_amount_nbo,
|
||||||
@ -151,6 +210,7 @@ TALER_JSON_spec_amount_nbo (const char *name,
|
|||||||
.ptr_size = 0,
|
.ptr_size = 0,
|
||||||
.size_ptr = NULL
|
.size_ptr = NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +36,9 @@ test_amount (void)
|
|||||||
struct TALER_Amount a1;
|
struct TALER_Amount a1;
|
||||||
struct TALER_Amount a2;
|
struct TALER_Amount a2;
|
||||||
struct GNUNET_JSON_Specification spec[] = {
|
struct GNUNET_JSON_Specification spec[] = {
|
||||||
TALER_JSON_spec_amount ("amount", &a2),
|
TALER_JSON_spec_amount ("amount",
|
||||||
|
"EUR",
|
||||||
|
&a2),
|
||||||
GNUNET_JSON_spec_end ()
|
GNUNET_JSON_spec_end ()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -73,8 +73,8 @@ TALER_EXCHANGE_parse_reserve_history (
|
|||||||
struct GNUNET_JSON_Specification hist_spec[] = {
|
struct GNUNET_JSON_Specification hist_spec[] = {
|
||||||
GNUNET_JSON_spec_string ("type",
|
GNUNET_JSON_spec_string ("type",
|
||||||
&type),
|
&type),
|
||||||
TALER_JSON_spec_amount ("amount",
|
TALER_JSON_spec_amount_any ("amount",
|
||||||
&amount),
|
&amount),
|
||||||
/* 'wire' and 'signature' are optional depending on 'type'! */
|
/* 'wire' and 'signature' are optional depending on 'type'! */
|
||||||
GNUNET_JSON_spec_end ()
|
GNUNET_JSON_spec_end ()
|
||||||
};
|
};
|
||||||
@ -145,8 +145,8 @@ TALER_EXCHANGE_parse_reserve_history (
|
|||||||
struct GNUNET_JSON_Specification withdraw_spec[] = {
|
struct GNUNET_JSON_Specification withdraw_spec[] = {
|
||||||
GNUNET_JSON_spec_fixed_auto ("reserve_sig",
|
GNUNET_JSON_spec_fixed_auto ("reserve_sig",
|
||||||
&sig),
|
&sig),
|
||||||
TALER_JSON_spec_amount ("withdraw_fee",
|
TALER_JSON_spec_amount_any ("withdraw_fee",
|
||||||
&withdraw_fee),
|
&withdraw_fee),
|
||||||
GNUNET_JSON_spec_fixed_auto ("h_denom_pub",
|
GNUNET_JSON_spec_fixed_auto ("h_denom_pub",
|
||||||
&withdraw_purpose.h_denomination_pub),
|
&withdraw_purpose.h_denomination_pub),
|
||||||
GNUNET_JSON_spec_fixed_auto ("h_coin_envelope",
|
GNUNET_JSON_spec_fixed_auto ("h_coin_envelope",
|
||||||
@ -321,8 +321,8 @@ TALER_EXCHANGE_parse_reserve_history (
|
|||||||
&rh->details.close_details.exchange_sig),
|
&rh->details.close_details.exchange_sig),
|
||||||
GNUNET_JSON_spec_fixed_auto ("exchange_pub",
|
GNUNET_JSON_spec_fixed_auto ("exchange_pub",
|
||||||
&rh->details.close_details.exchange_pub),
|
&rh->details.close_details.exchange_pub),
|
||||||
TALER_JSON_spec_amount_nbo ("closing_fee",
|
TALER_JSON_spec_amount_any_nbo ("closing_fee",
|
||||||
&rcc.closing_fee),
|
&rcc.closing_fee),
|
||||||
TALER_JSON_spec_absolute_time_nbo ("timestamp",
|
TALER_JSON_spec_absolute_time_nbo ("timestamp",
|
||||||
&rcc.timestamp),
|
&rcc.timestamp),
|
||||||
GNUNET_JSON_spec_end ()
|
GNUNET_JSON_spec_end ()
|
||||||
@ -482,8 +482,8 @@ TALER_EXCHANGE_verify_coin_history (
|
|||||||
struct TALER_Amount amount;
|
struct TALER_Amount amount;
|
||||||
const char *type;
|
const char *type;
|
||||||
struct GNUNET_JSON_Specification spec_glob[] = {
|
struct GNUNET_JSON_Specification spec_glob[] = {
|
||||||
TALER_JSON_spec_amount ("amount",
|
TALER_JSON_spec_amount_any ("amount",
|
||||||
&amount),
|
&amount),
|
||||||
GNUNET_JSON_spec_string ("type",
|
GNUNET_JSON_spec_string ("type",
|
||||||
&type),
|
&type),
|
||||||
GNUNET_JSON_spec_end ()
|
GNUNET_JSON_spec_end ()
|
||||||
@ -529,8 +529,8 @@ TALER_EXCHANGE_verify_coin_history (
|
|||||||
&dr.wallet_timestamp),
|
&dr.wallet_timestamp),
|
||||||
TALER_JSON_spec_absolute_time_nbo ("refund_deadline",
|
TALER_JSON_spec_absolute_time_nbo ("refund_deadline",
|
||||||
&dr.refund_deadline),
|
&dr.refund_deadline),
|
||||||
TALER_JSON_spec_amount_nbo ("deposit_fee",
|
TALER_JSON_spec_amount_any_nbo ("deposit_fee",
|
||||||
&dr.deposit_fee),
|
&dr.deposit_fee),
|
||||||
GNUNET_JSON_spec_fixed_auto ("merchant_pub",
|
GNUNET_JSON_spec_fixed_auto ("merchant_pub",
|
||||||
&dr.merchant),
|
&dr.merchant),
|
||||||
GNUNET_JSON_spec_end ()
|
GNUNET_JSON_spec_end ()
|
||||||
@ -586,8 +586,8 @@ TALER_EXCHANGE_verify_coin_history (
|
|||||||
&rm.rc),
|
&rm.rc),
|
||||||
GNUNET_JSON_spec_fixed_auto ("h_denom_pub",
|
GNUNET_JSON_spec_fixed_auto ("h_denom_pub",
|
||||||
&rm.h_denom_pub),
|
&rm.h_denom_pub),
|
||||||
TALER_JSON_spec_amount_nbo ("melt_fee",
|
TALER_JSON_spec_amount_any_nbo ("melt_fee",
|
||||||
&rm.melt_fee),
|
&rm.melt_fee),
|
||||||
GNUNET_JSON_spec_end ()
|
GNUNET_JSON_spec_end ()
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -644,8 +644,8 @@ TALER_EXCHANGE_verify_coin_history (
|
|||||||
.coin_pub = *coin_pub
|
.coin_pub = *coin_pub
|
||||||
};
|
};
|
||||||
struct GNUNET_JSON_Specification spec[] = {
|
struct GNUNET_JSON_Specification spec[] = {
|
||||||
TALER_JSON_spec_amount ("refund_fee",
|
TALER_JSON_spec_amount_any ("refund_fee",
|
||||||
&refund_fee),
|
&refund_fee),
|
||||||
GNUNET_JSON_spec_fixed_auto ("merchant_sig",
|
GNUNET_JSON_spec_fixed_auto ("merchant_sig",
|
||||||
&sig),
|
&sig),
|
||||||
GNUNET_JSON_spec_fixed_auto ("h_contract_terms",
|
GNUNET_JSON_spec_fixed_auto ("h_contract_terms",
|
||||||
@ -728,8 +728,8 @@ TALER_EXCHANGE_verify_coin_history (
|
|||||||
struct TALER_ExchangeSignatureP exchange_sig;
|
struct TALER_ExchangeSignatureP exchange_sig;
|
||||||
struct TALER_CoinSpendSignatureP coin_sig;
|
struct TALER_CoinSpendSignatureP coin_sig;
|
||||||
struct GNUNET_JSON_Specification spec[] = {
|
struct GNUNET_JSON_Specification spec[] = {
|
||||||
TALER_JSON_spec_amount_nbo ("amount",
|
TALER_JSON_spec_amount_any_nbo ("amount",
|
||||||
&pc.recoup_amount),
|
&pc.recoup_amount),
|
||||||
GNUNET_JSON_spec_fixed_auto ("exchange_sig",
|
GNUNET_JSON_spec_fixed_auto ("exchange_sig",
|
||||||
&exchange_sig),
|
&exchange_sig),
|
||||||
GNUNET_JSON_spec_fixed_auto ("exchange_pub",
|
GNUNET_JSON_spec_fixed_auto ("exchange_pub",
|
||||||
@ -796,8 +796,8 @@ TALER_EXCHANGE_verify_coin_history (
|
|||||||
struct TALER_ExchangeSignatureP exchange_sig;
|
struct TALER_ExchangeSignatureP exchange_sig;
|
||||||
struct TALER_CoinSpendSignatureP coin_sig;
|
struct TALER_CoinSpendSignatureP coin_sig;
|
||||||
struct GNUNET_JSON_Specification spec[] = {
|
struct GNUNET_JSON_Specification spec[] = {
|
||||||
TALER_JSON_spec_amount_nbo ("amount",
|
TALER_JSON_spec_amount_any_nbo ("amount",
|
||||||
&pc.recoup_amount),
|
&pc.recoup_amount),
|
||||||
GNUNET_JSON_spec_fixed_auto ("exchange_sig",
|
GNUNET_JSON_spec_fixed_auto ("exchange_sig",
|
||||||
&exchange_sig),
|
&exchange_sig),
|
||||||
GNUNET_JSON_spec_fixed_auto ("exchange_pub",
|
GNUNET_JSON_spec_fixed_auto ("exchange_pub",
|
||||||
@ -859,8 +859,8 @@ TALER_EXCHANGE_verify_coin_history (
|
|||||||
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[] = {
|
||||||
TALER_JSON_spec_amount_nbo ("amount",
|
TALER_JSON_spec_amount_any_nbo ("amount",
|
||||||
&pc.recoup_amount),
|
&pc.recoup_amount),
|
||||||
GNUNET_JSON_spec_fixed_auto ("exchange_sig",
|
GNUNET_JSON_spec_fixed_auto ("exchange_sig",
|
||||||
&exchange_sig),
|
&exchange_sig),
|
||||||
GNUNET_JSON_spec_fixed_auto ("exchange_pub",
|
GNUNET_JSON_spec_fixed_auto ("exchange_pub",
|
||||||
|
@ -150,7 +150,7 @@ handle_deposit_wtid_finished (void *cls,
|
|||||||
struct GNUNET_JSON_Specification spec[] = {
|
struct GNUNET_JSON_Specification spec[] = {
|
||||||
GNUNET_JSON_spec_fixed_auto ("wtid", &dwh->depconf.wtid),
|
GNUNET_JSON_spec_fixed_auto ("wtid", &dwh->depconf.wtid),
|
||||||
TALER_JSON_spec_absolute_time ("execution_time", &dd.execution_time),
|
TALER_JSON_spec_absolute_time ("execution_time", &dd.execution_time),
|
||||||
TALER_JSON_spec_amount ("coin_contribution", &dd.coin_contribution),
|
TALER_JSON_spec_amount_any ("coin_contribution", &dd.coin_contribution),
|
||||||
GNUNET_JSON_spec_fixed_auto ("exchange_sig", &dd.exchange_sig),
|
GNUNET_JSON_spec_fixed_auto ("exchange_sig", &dd.exchange_sig),
|
||||||
GNUNET_JSON_spec_fixed_auto ("exchange_pub", &dd.exchange_pub),
|
GNUNET_JSON_spec_fixed_auto ("exchange_pub", &dd.exchange_pub),
|
||||||
GNUNET_JSON_spec_end ()
|
GNUNET_JSON_spec_end ()
|
||||||
|
@ -335,16 +335,16 @@ parse_json_denomkey (struct TALER_EXCHANGE_DenomPublicKey *denom_key,
|
|||||||
&denom_key->valid_from),
|
&denom_key->valid_from),
|
||||||
TALER_JSON_spec_absolute_time ("stamp_expire_legal",
|
TALER_JSON_spec_absolute_time ("stamp_expire_legal",
|
||||||
&denom_key->expire_legal),
|
&denom_key->expire_legal),
|
||||||
TALER_JSON_spec_amount ("value",
|
TALER_JSON_spec_amount_any ("value",
|
||||||
&denom_key->value),
|
&denom_key->value),
|
||||||
TALER_JSON_spec_amount ("fee_withdraw",
|
TALER_JSON_spec_amount_any ("fee_withdraw",
|
||||||
&denom_key->fee_withdraw),
|
&denom_key->fee_withdraw),
|
||||||
TALER_JSON_spec_amount ("fee_deposit",
|
TALER_JSON_spec_amount_any ("fee_deposit",
|
||||||
&denom_key->fee_deposit),
|
&denom_key->fee_deposit),
|
||||||
TALER_JSON_spec_amount ("fee_refresh",
|
TALER_JSON_spec_amount_any ("fee_refresh",
|
||||||
&denom_key->fee_refresh),
|
&denom_key->fee_refresh),
|
||||||
TALER_JSON_spec_amount ("fee_refund",
|
TALER_JSON_spec_amount_any ("fee_refund",
|
||||||
&denom_key->fee_refund),
|
&denom_key->fee_refund),
|
||||||
GNUNET_JSON_spec_rsa_public_key ("denom_pub",
|
GNUNET_JSON_spec_rsa_public_key ("denom_pub",
|
||||||
&denom_key->key.rsa_public_key),
|
&denom_key->key.rsa_public_key),
|
||||||
GNUNET_JSON_spec_end ()
|
GNUNET_JSON_spec_end ()
|
||||||
|
@ -169,8 +169,8 @@ handle_ok (struct TALER_EXCHANGE_ManagementGetKeysHandle *gh,
|
|||||||
= &fk.denom_keys[i];
|
= &fk.denom_keys[i];
|
||||||
const char *section_name;
|
const char *section_name;
|
||||||
struct GNUNET_JSON_Specification spec[] = {
|
struct GNUNET_JSON_Specification spec[] = {
|
||||||
TALER_JSON_spec_amount ("value",
|
TALER_JSON_spec_amount_any ("value",
|
||||||
&denom_key->value),
|
&denom_key->value),
|
||||||
TALER_JSON_spec_absolute_time ("stamp_start",
|
TALER_JSON_spec_absolute_time ("stamp_start",
|
||||||
&denom_key->valid_from),
|
&denom_key->valid_from),
|
||||||
TALER_JSON_spec_absolute_time ("stamp_expire_withdraw",
|
TALER_JSON_spec_absolute_time ("stamp_expire_withdraw",
|
||||||
@ -181,14 +181,14 @@ handle_ok (struct TALER_EXCHANGE_ManagementGetKeysHandle *gh,
|
|||||||
&denom_key->expire_legal),
|
&denom_key->expire_legal),
|
||||||
GNUNET_JSON_spec_rsa_public_key ("denom_pub",
|
GNUNET_JSON_spec_rsa_public_key ("denom_pub",
|
||||||
&denom_key->key.rsa_public_key),
|
&denom_key->key.rsa_public_key),
|
||||||
TALER_JSON_spec_amount ("fee_withdraw",
|
TALER_JSON_spec_amount_any ("fee_withdraw",
|
||||||
&denom_key->fee_withdraw),
|
&denom_key->fee_withdraw),
|
||||||
TALER_JSON_spec_amount ("fee_deposit",
|
TALER_JSON_spec_amount_any ("fee_deposit",
|
||||||
&denom_key->fee_deposit),
|
&denom_key->fee_deposit),
|
||||||
TALER_JSON_spec_amount ("fee_refresh",
|
TALER_JSON_spec_amount_any ("fee_refresh",
|
||||||
&denom_key->fee_refresh),
|
&denom_key->fee_refresh),
|
||||||
TALER_JSON_spec_amount ("fee_refund",
|
TALER_JSON_spec_amount_any ("fee_refund",
|
||||||
&denom_key->fee_refund),
|
&denom_key->fee_refund),
|
||||||
GNUNET_JSON_spec_fixed_auto ("denom_secmod_sig",
|
GNUNET_JSON_spec_fixed_auto ("denom_secmod_sig",
|
||||||
&denom_key->denom_secmod_sig),
|
&denom_key->denom_secmod_sig),
|
||||||
GNUNET_JSON_spec_string ("section_name",
|
GNUNET_JSON_spec_string ("section_name",
|
||||||
|
@ -220,8 +220,8 @@ verify_melt_signature_spend_conflict (struct TALER_EXCHANGE_MeltHandle *mh,
|
|||||||
struct GNUNET_JSON_Specification spec[] = {
|
struct GNUNET_JSON_Specification spec[] = {
|
||||||
GNUNET_JSON_spec_json ("history", &history),
|
GNUNET_JSON_spec_json ("history", &history),
|
||||||
GNUNET_JSON_spec_fixed_auto ("coin_pub", &coin_pub),
|
GNUNET_JSON_spec_fixed_auto ("coin_pub", &coin_pub),
|
||||||
TALER_JSON_spec_amount ("original_value", &original_value),
|
TALER_JSON_spec_amount_any ("original_value", &original_value),
|
||||||
TALER_JSON_spec_amount ("requested_value", &melt_value_with_fee),
|
TALER_JSON_spec_amount_any ("requested_value", &melt_value_with_fee),
|
||||||
GNUNET_JSON_spec_end ()
|
GNUNET_JSON_spec_end ()
|
||||||
};
|
};
|
||||||
const struct MeltedCoin *mc;
|
const struct MeltedCoin *mc;
|
||||||
|
@ -176,8 +176,8 @@ verify_conflict_history_ok (struct TALER_EXCHANGE_RefundHandle *rh,
|
|||||||
struct TALER_Amount amount;
|
struct TALER_Amount amount;
|
||||||
const char *type;
|
const char *type;
|
||||||
struct GNUNET_JSON_Specification spec_glob[] = {
|
struct GNUNET_JSON_Specification spec_glob[] = {
|
||||||
TALER_JSON_spec_amount ("amount",
|
TALER_JSON_spec_amount_any ("amount",
|
||||||
&amount),
|
&amount),
|
||||||
GNUNET_JSON_spec_string ("type",
|
GNUNET_JSON_spec_string ("type",
|
||||||
&type),
|
&type),
|
||||||
GNUNET_JSON_spec_end ()
|
GNUNET_JSON_spec_end ()
|
||||||
@ -215,8 +215,8 @@ verify_conflict_history_ok (struct TALER_EXCHANGE_RefundHandle *rh,
|
|||||||
&dr.wallet_timestamp),
|
&dr.wallet_timestamp),
|
||||||
TALER_JSON_spec_absolute_time_nbo ("refund_deadline",
|
TALER_JSON_spec_absolute_time_nbo ("refund_deadline",
|
||||||
&dr.refund_deadline),
|
&dr.refund_deadline),
|
||||||
TALER_JSON_spec_amount_nbo ("deposit_fee",
|
TALER_JSON_spec_amount_any_nbo ("deposit_fee",
|
||||||
&dr.deposit_fee),
|
&dr.deposit_fee),
|
||||||
GNUNET_JSON_spec_fixed_auto ("merchant_pub",
|
GNUNET_JSON_spec_fixed_auto ("merchant_pub",
|
||||||
&dr.merchant),
|
&dr.merchant),
|
||||||
GNUNET_JSON_spec_end ()
|
GNUNET_JSON_spec_end ()
|
||||||
@ -283,8 +283,8 @@ verify_conflict_history_ok (struct TALER_EXCHANGE_RefundHandle *rh,
|
|||||||
.coin_pub = rh->depconf.coin_pub
|
.coin_pub = rh->depconf.coin_pub
|
||||||
};
|
};
|
||||||
struct GNUNET_JSON_Specification spec[] = {
|
struct GNUNET_JSON_Specification spec[] = {
|
||||||
TALER_JSON_spec_amount ("refund_fee",
|
TALER_JSON_spec_amount_any ("refund_fee",
|
||||||
&refund_fee),
|
&refund_fee),
|
||||||
GNUNET_JSON_spec_fixed_auto ("merchant_sig",
|
GNUNET_JSON_spec_fixed_auto ("merchant_sig",
|
||||||
&sig),
|
&sig),
|
||||||
GNUNET_JSON_spec_fixed_auto ("h_contract_terms",
|
GNUNET_JSON_spec_fixed_auto ("h_contract_terms",
|
||||||
@ -452,12 +452,12 @@ verify_failed_dependency_ok (struct TALER_EXCHANGE_RefundHandle *rh,
|
|||||||
};
|
};
|
||||||
uint64_t rtransaction_id;
|
uint64_t rtransaction_id;
|
||||||
struct GNUNET_JSON_Specification spec[] = {
|
struct GNUNET_JSON_Specification spec[] = {
|
||||||
TALER_JSON_spec_amount ("amount",
|
TALER_JSON_spec_amount_any ("amount",
|
||||||
&amount),
|
&amount),
|
||||||
GNUNET_JSON_spec_string ("type",
|
GNUNET_JSON_spec_string ("type",
|
||||||
&type),
|
&type),
|
||||||
TALER_JSON_spec_amount ("refund_fee",
|
TALER_JSON_spec_amount_any ("refund_fee",
|
||||||
&refund_fee),
|
&refund_fee),
|
||||||
GNUNET_JSON_spec_fixed_auto ("merchant_sig",
|
GNUNET_JSON_spec_fixed_auto ("merchant_sig",
|
||||||
&sig),
|
&sig),
|
||||||
GNUNET_JSON_spec_fixed_auto ("h_contract_terms",
|
GNUNET_JSON_spec_fixed_auto ("h_contract_terms",
|
||||||
|
@ -88,7 +88,7 @@ handle_reserves_get_ok (struct TALER_EXCHANGE_ReservesGetHandle *rgh,
|
|||||||
struct TALER_Amount balance;
|
struct TALER_Amount balance;
|
||||||
struct TALER_Amount balance_from_history;
|
struct TALER_Amount balance_from_history;
|
||||||
struct GNUNET_JSON_Specification spec[] = {
|
struct GNUNET_JSON_Specification spec[] = {
|
||||||
TALER_JSON_spec_amount ("balance", &balance),
|
TALER_JSON_spec_amount_any ("balance", &balance),
|
||||||
GNUNET_JSON_spec_end ()
|
GNUNET_JSON_spec_end ()
|
||||||
};
|
};
|
||||||
struct TALER_EXCHANGE_HttpResponse hr = {
|
struct TALER_EXCHANGE_HttpResponse hr = {
|
||||||
|
@ -89,8 +89,8 @@ check_transfers_get_response_ok (
|
|||||||
struct TALER_Amount total_expected;
|
struct TALER_Amount total_expected;
|
||||||
struct TALER_MerchantPublicKeyP merchant_pub;
|
struct TALER_MerchantPublicKeyP merchant_pub;
|
||||||
struct GNUNET_JSON_Specification spec[] = {
|
struct GNUNET_JSON_Specification spec[] = {
|
||||||
TALER_JSON_spec_amount ("total", &td.total_amount),
|
TALER_JSON_spec_amount_any ("total", &td.total_amount),
|
||||||
TALER_JSON_spec_amount ("wire_fee", &td.wire_fee),
|
TALER_JSON_spec_amount_any ("wire_fee", &td.wire_fee),
|
||||||
GNUNET_JSON_spec_fixed_auto ("merchant_pub", &merchant_pub),
|
GNUNET_JSON_spec_fixed_auto ("merchant_pub", &merchant_pub),
|
||||||
GNUNET_JSON_spec_fixed_auto ("h_wire", &td.h_wire),
|
GNUNET_JSON_spec_fixed_auto ("h_wire", &td.h_wire),
|
||||||
TALER_JSON_spec_absolute_time ("execution_time", &td.execution_time),
|
TALER_JSON_spec_absolute_time ("execution_time", &td.execution_time),
|
||||||
@ -146,8 +146,8 @@ check_transfers_get_response_ok (
|
|||||||
GNUNET_JSON_spec_fixed_auto ("h_contract_terms",
|
GNUNET_JSON_spec_fixed_auto ("h_contract_terms",
|
||||||
&detail->h_contract_terms),
|
&detail->h_contract_terms),
|
||||||
GNUNET_JSON_spec_fixed_auto ("coin_pub", &detail->coin_pub),
|
GNUNET_JSON_spec_fixed_auto ("coin_pub", &detail->coin_pub),
|
||||||
TALER_JSON_spec_amount ("deposit_value", &detail->coin_value),
|
TALER_JSON_spec_amount_any ("deposit_value", &detail->coin_value),
|
||||||
TALER_JSON_spec_amount ("deposit_fee", &detail->coin_fee),
|
TALER_JSON_spec_amount_any ("deposit_fee", &detail->coin_fee),
|
||||||
GNUNET_JSON_spec_end ()
|
GNUNET_JSON_spec_end ()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -143,10 +143,10 @@ parse_fees (json_t *fees)
|
|||||||
struct GNUNET_JSON_Specification spec[] = {
|
struct GNUNET_JSON_Specification spec[] = {
|
||||||
GNUNET_JSON_spec_fixed_auto ("sig",
|
GNUNET_JSON_spec_fixed_auto ("sig",
|
||||||
&wa->master_sig),
|
&wa->master_sig),
|
||||||
TALER_JSON_spec_amount ("wire_fee",
|
TALER_JSON_spec_amount_any ("wire_fee",
|
||||||
&wa->wire_fee),
|
&wa->wire_fee),
|
||||||
TALER_JSON_spec_amount ("closing_fee",
|
TALER_JSON_spec_amount_any ("closing_fee",
|
||||||
&wa->closing_fee),
|
&wa->closing_fee),
|
||||||
TALER_JSON_spec_absolute_time ("start_date",
|
TALER_JSON_spec_absolute_time ("start_date",
|
||||||
&wa->start_date),
|
&wa->start_date),
|
||||||
TALER_JSON_spec_absolute_time ("end_date",
|
TALER_JSON_spec_absolute_time ("end_date",
|
||||||
|
@ -152,7 +152,7 @@ reserve_withdraw_payment_required (
|
|||||||
json_t *history;
|
json_t *history;
|
||||||
size_t len;
|
size_t len;
|
||||||
struct GNUNET_JSON_Specification spec[] = {
|
struct GNUNET_JSON_Specification spec[] = {
|
||||||
TALER_JSON_spec_amount ("balance", &balance),
|
TALER_JSON_spec_amount_any ("balance", &balance),
|
||||||
GNUNET_JSON_spec_end ()
|
GNUNET_JSON_spec_end ()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user