second pass on responses: indentation cleanup and CSE
This commit is contained in:
parent
a2bfd9f6b5
commit
b5f62c8060
@ -91,33 +91,28 @@ TEH_RESPONSE_compile_transaction_history (
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (0 !=
|
if (0 !=
|
||||||
json_array_append_new (history,
|
json_array_append_new (
|
||||||
|
history,
|
||||||
json_pack (
|
json_pack (
|
||||||
"{s:s, s:o, s:o, s:o, s:o, s:o, s:o, s:o, s:o}",
|
"{s:s, s:o, s:o, s:o, s:o, s:o, s:o, s:o, s:o}",
|
||||||
"type", "DEPOSIT",
|
"type",
|
||||||
"amount", TALER_JSON_from_amount (
|
"DEPOSIT",
|
||||||
&deposit->amount_with_fee),
|
"amount",
|
||||||
|
TALER_JSON_from_amount (&deposit->amount_with_fee),
|
||||||
"deposit_fee",
|
"deposit_fee",
|
||||||
TALER_JSON_from_amount (
|
TALER_JSON_from_amount (&deposit->deposit_fee),
|
||||||
&deposit->deposit_fee),
|
|
||||||
"timestamp",
|
"timestamp",
|
||||||
GNUNET_JSON_from_time_abs (
|
GNUNET_JSON_from_time_abs (deposit->timestamp),
|
||||||
deposit->timestamp),
|
|
||||||
"refund_deadline",
|
"refund_deadline",
|
||||||
GNUNET_JSON_from_time_abs (
|
GNUNET_JSON_from_time_abs (deposit->refund_deadline),
|
||||||
deposit->refund_deadline),
|
|
||||||
"merchant_pub",
|
"merchant_pub",
|
||||||
GNUNET_JSON_from_data_auto (
|
GNUNET_JSON_from_data_auto (&deposit->merchant_pub),
|
||||||
&deposit->merchant_pub),
|
|
||||||
"h_contract_terms",
|
"h_contract_terms",
|
||||||
GNUNET_JSON_from_data_auto (
|
GNUNET_JSON_from_data_auto (&deposit->h_contract_terms),
|
||||||
&deposit->h_contract_terms),
|
|
||||||
"h_wire",
|
"h_wire",
|
||||||
GNUNET_JSON_from_data_auto (
|
GNUNET_JSON_from_data_auto (&deposit->h_wire),
|
||||||
&deposit->h_wire),
|
|
||||||
"coin_sig",
|
"coin_sig",
|
||||||
GNUNET_JSON_from_data_auto (
|
GNUNET_JSON_from_data_auto (&deposit->csig))))
|
||||||
&deposit->csig))))
|
|
||||||
{
|
{
|
||||||
GNUNET_break (0);
|
GNUNET_break (0);
|
||||||
json_decref (history);
|
json_decref (history);
|
||||||
@ -154,19 +149,19 @@ TEH_RESPONSE_compile_transaction_history (
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (0 !=
|
if (0 !=
|
||||||
json_array_append_new (history,
|
json_array_append_new (
|
||||||
|
history,
|
||||||
json_pack ("{s:s, s:o, s:o, s:o, s:o}",
|
json_pack ("{s:s, s:o, s:o, s:o, s:o}",
|
||||||
"type", "MELT",
|
"type",
|
||||||
"amount", TALER_JSON_from_amount (
|
"MELT",
|
||||||
&melt->amount_with_fee),
|
"amount",
|
||||||
|
TALER_JSON_from_amount (&melt->amount_with_fee),
|
||||||
"melt_fee",
|
"melt_fee",
|
||||||
TALER_JSON_from_amount (
|
TALER_JSON_from_amount (&melt->melt_fee),
|
||||||
&melt->melt_fee),
|
"rc",
|
||||||
"rc", GNUNET_JSON_from_data_auto (
|
GNUNET_JSON_from_data_auto (&melt->rc),
|
||||||
&melt->rc),
|
|
||||||
"coin_sig",
|
"coin_sig",
|
||||||
GNUNET_JSON_from_data_auto (
|
GNUNET_JSON_from_data_auto (&melt->coin_sig))))
|
||||||
&melt->coin_sig))))
|
|
||||||
{
|
{
|
||||||
GNUNET_break (0);
|
GNUNET_break (0);
|
||||||
json_decref (history);
|
json_decref (history);
|
||||||
@ -215,26 +210,24 @@ TEH_RESPONSE_compile_transaction_history (
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (0 !=
|
if (0 !=
|
||||||
json_array_append_new (history,
|
json_array_append_new (
|
||||||
|
history,
|
||||||
json_pack (
|
json_pack (
|
||||||
"{s:s, s:o, s:o, s:o, s:o, s:I, s:o}",
|
"{s:s, s:o, s:o, s:o, s:o, s:I, s:o}",
|
||||||
"type", "REFUND",
|
"type",
|
||||||
"amount", TALER_JSON_from_amount (
|
"REFUND",
|
||||||
&value),
|
"amount",
|
||||||
|
TALER_JSON_from_amount (&value),
|
||||||
"refund_fee",
|
"refund_fee",
|
||||||
TALER_JSON_from_amount (
|
TALER_JSON_from_amount (&refund->refund_fee),
|
||||||
&refund->refund_fee),
|
|
||||||
"h_contract_terms",
|
"h_contract_terms",
|
||||||
GNUNET_JSON_from_data_auto (
|
GNUNET_JSON_from_data_auto (&refund->h_contract_terms),
|
||||||
&refund->h_contract_terms),
|
|
||||||
"merchant_pub",
|
"merchant_pub",
|
||||||
GNUNET_JSON_from_data_auto (
|
GNUNET_JSON_from_data_auto (&refund->merchant_pub),
|
||||||
&refund->merchant_pub),
|
|
||||||
"rtransaction_id",
|
"rtransaction_id",
|
||||||
(json_int_t) refund->rtransaction_id,
|
(json_int_t) refund->rtransaction_id,
|
||||||
"merchant_sig",
|
"merchant_sig",
|
||||||
GNUNET_JSON_from_data_auto (
|
GNUNET_JSON_from_data_auto (&refund->merchant_sig))))
|
||||||
&refund->merchant_sig))))
|
|
||||||
{
|
{
|
||||||
GNUNET_break (0);
|
GNUNET_break (0);
|
||||||
json_decref (history);
|
json_decref (history);
|
||||||
@ -274,23 +267,21 @@ TEH_RESPONSE_compile_transaction_history (
|
|||||||
check or do anything with it anyway if it doesn't), it seems
|
check or do anything with it anyway if it doesn't), it seems
|
||||||
strictly unnecessary. *///
|
strictly unnecessary. *///
|
||||||
if (0 !=
|
if (0 !=
|
||||||
json_array_append_new (history,
|
json_array_append_new (
|
||||||
|
history,
|
||||||
json_pack ("{s:s, s:o, s:o, s:o, s:o, s:o}",
|
json_pack ("{s:s, s:o, s:o, s:o, s:o, s:o}",
|
||||||
"type", "OLD-COIN-RECOUP",
|
"type",
|
||||||
"amount", TALER_JSON_from_amount (
|
"OLD-COIN-RECOUP",
|
||||||
&pr->value),
|
"amount",
|
||||||
|
TALER_JSON_from_amount (&pr->value),
|
||||||
"exchange_sig",
|
"exchange_sig",
|
||||||
GNUNET_JSON_from_data_auto (
|
GNUNET_JSON_from_data_auto (&esig),
|
||||||
&esig),
|
|
||||||
"exchange_pub",
|
"exchange_pub",
|
||||||
GNUNET_JSON_from_data_auto (
|
GNUNET_JSON_from_data_auto (&epub),
|
||||||
&epub),
|
|
||||||
"coin_pub",
|
"coin_pub",
|
||||||
GNUNET_JSON_from_data_auto (
|
GNUNET_JSON_from_data_auto (&pr->coin.coin_pub),
|
||||||
&pr->coin.coin_pub),
|
|
||||||
"timestamp",
|
"timestamp",
|
||||||
GNUNET_JSON_from_time_abs (
|
GNUNET_JSON_from_time_abs (pr->timestamp))))
|
||||||
pr->timestamp))))
|
|
||||||
{
|
{
|
||||||
GNUNET_break (0);
|
GNUNET_break (0);
|
||||||
json_decref (history);
|
json_decref (history);
|
||||||
@ -324,23 +315,21 @@ TEH_RESPONSE_compile_transaction_history (
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (0 !=
|
if (0 !=
|
||||||
json_array_append_new (history,
|
json_array_append_new (
|
||||||
|
history,
|
||||||
json_pack ("{s:s, s:o, s:o, s:o, s:o, s:o}",
|
json_pack ("{s:s, s:o, s:o, s:o, s:o, s:o}",
|
||||||
"type", "RECOUP",
|
"type",
|
||||||
"amount", TALER_JSON_from_amount (
|
"RECOUP",
|
||||||
&recoup->value),
|
"amount",
|
||||||
|
TALER_JSON_from_amount (&recoup->value),
|
||||||
"exchange_sig",
|
"exchange_sig",
|
||||||
GNUNET_JSON_from_data_auto (
|
GNUNET_JSON_from_data_auto (&esig),
|
||||||
&esig),
|
|
||||||
"exchange_pub",
|
"exchange_pub",
|
||||||
GNUNET_JSON_from_data_auto (
|
GNUNET_JSON_from_data_auto (&epub),
|
||||||
&epub),
|
|
||||||
"reserve_pub",
|
"reserve_pub",
|
||||||
GNUNET_JSON_from_data_auto (
|
GNUNET_JSON_from_data_auto (&recoup->reserve_pub),
|
||||||
&recoup->reserve_pub),
|
|
||||||
"timestamp",
|
"timestamp",
|
||||||
GNUNET_JSON_from_time_abs (
|
GNUNET_JSON_from_time_abs (recoup->timestamp))))
|
||||||
recoup->timestamp))))
|
|
||||||
{
|
{
|
||||||
GNUNET_break (0);
|
GNUNET_break (0);
|
||||||
json_decref (history);
|
json_decref (history);
|
||||||
@ -380,23 +369,21 @@ TEH_RESPONSE_compile_transaction_history (
|
|||||||
check or do anything with it anyway if it doesn't), it seems
|
check or do anything with it anyway if it doesn't), it seems
|
||||||
strictly unnecessary. *///
|
strictly unnecessary. *///
|
||||||
if (0 !=
|
if (0 !=
|
||||||
json_array_append_new (history,
|
json_array_append_new (
|
||||||
|
history,
|
||||||
json_pack ("{s:s, s:o, s:o, s:o, s:o, s:o}",
|
json_pack ("{s:s, s:o, s:o, s:o, s:o, s:o}",
|
||||||
"type", "RECOUP-REFRESH",
|
"type",
|
||||||
"amount", TALER_JSON_from_amount (
|
"RECOUP-REFRESH",
|
||||||
&pr->value),
|
"amount",
|
||||||
|
TALER_JSON_from_amount (&pr->value),
|
||||||
"exchange_sig",
|
"exchange_sig",
|
||||||
GNUNET_JSON_from_data_auto (
|
GNUNET_JSON_from_data_auto (&esig),
|
||||||
&esig),
|
|
||||||
"exchange_pub",
|
"exchange_pub",
|
||||||
GNUNET_JSON_from_data_auto (
|
GNUNET_JSON_from_data_auto (&epub),
|
||||||
&epub),
|
|
||||||
"old_coin_pub",
|
"old_coin_pub",
|
||||||
GNUNET_JSON_from_data_auto (
|
GNUNET_JSON_from_data_auto (&pr->old_coin_pub),
|
||||||
&pr->old_coin_pub),
|
|
||||||
"timestamp",
|
"timestamp",
|
||||||
GNUNET_JSON_from_time_abs (
|
GNUNET_JSON_from_time_abs (pr->timestamp))))
|
||||||
pr->timestamp))))
|
|
||||||
{
|
{
|
||||||
GNUNET_break (0);
|
GNUNET_break (0);
|
||||||
json_decref (history);
|
json_decref (history);
|
||||||
@ -486,49 +473,52 @@ TEH_RESPONSE_compile_reserve_history (
|
|||||||
switch (pos->type)
|
switch (pos->type)
|
||||||
{
|
{
|
||||||
case TALER_EXCHANGEDB_RO_BANK_TO_EXCHANGE:
|
case TALER_EXCHANGEDB_RO_BANK_TO_EXCHANGE:
|
||||||
|
{
|
||||||
|
const struct TALER_EXCHANGEDB_BankTransfer *bank =
|
||||||
|
pos->details.bank;
|
||||||
if (0 == (IA_DEPOSIT & init))
|
if (0 == (IA_DEPOSIT & init))
|
||||||
{
|
{
|
||||||
deposit_total = pos->details.bank->amount;
|
deposit_total = bank->amount;
|
||||||
init |= IA_DEPOSIT;
|
init |= IA_DEPOSIT;
|
||||||
}
|
}
|
||||||
else if (GNUNET_OK !=
|
else if (GNUNET_OK !=
|
||||||
TALER_amount_add (&deposit_total,
|
TALER_amount_add (&deposit_total,
|
||||||
&deposit_total,
|
&deposit_total,
|
||||||
&pos->details.bank->amount))
|
&bank->amount))
|
||||||
{
|
{
|
||||||
GNUNET_break (0);
|
GNUNET_break (0);
|
||||||
json_decref (json_history);
|
json_decref (json_history);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (0 !=
|
if (0 !=
|
||||||
json_array_append_new (json_history,
|
json_array_append_new (
|
||||||
|
json_history,
|
||||||
json_pack ("{s:s, s:o, s:s, s:o, s:o}",
|
json_pack ("{s:s, s:o, s:s, s:o, s:o}",
|
||||||
"type", "DEPOSIT",
|
"type",
|
||||||
|
"DEPOSIT",
|
||||||
"timestamp",
|
"timestamp",
|
||||||
GNUNET_JSON_from_time_abs (
|
GNUNET_JSON_from_time_abs (bank->execution_date),
|
||||||
pos->details.bank->execution_date),
|
|
||||||
"sender_account_url",
|
"sender_account_url",
|
||||||
pos->details.bank->
|
bank->sender_account_details,
|
||||||
sender_account_details,
|
|
||||||
"wire_reference",
|
"wire_reference",
|
||||||
GNUNET_JSON_from_data (
|
GNUNET_JSON_from_data (bank->wire_reference,
|
||||||
pos->details.bank->wire_reference,
|
|
||||||
pos
|
|
||||||
->details.
|
|
||||||
bank->wire_reference_size),
|
bank->wire_reference_size),
|
||||||
"amount", TALER_JSON_from_amount (
|
"amount",
|
||||||
&pos->details.bank->amount))))
|
TALER_JSON_from_amount (&bank->amount))))
|
||||||
{
|
{
|
||||||
GNUNET_break (0);
|
GNUNET_break (0);
|
||||||
json_decref (json_history);
|
json_decref (json_history);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case TALER_EXCHANGEDB_RO_WITHDRAW_COIN:
|
case TALER_EXCHANGEDB_RO_WITHDRAW_COIN:
|
||||||
{
|
{
|
||||||
|
const struct TALER_EXCHANGEDB_CollectableBlindcoin *withdraw
|
||||||
|
= pos->details.withdraw;
|
||||||
struct TALER_Amount value;
|
struct TALER_Amount value;
|
||||||
|
|
||||||
value = pos->details.withdraw->amount_with_fee;
|
value = withdraw->amount_with_fee;
|
||||||
if (0 == (IA_WITHDRAW & init))
|
if (0 == (IA_WITHDRAW & init))
|
||||||
{
|
{
|
||||||
withdraw_total = value;
|
withdraw_total = value;
|
||||||
@ -547,27 +537,22 @@ TEH_RESPONSE_compile_reserve_history (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (0 !=
|
if (0 !=
|
||||||
json_array_append_new (json_history,
|
json_array_append_new (
|
||||||
|
json_history,
|
||||||
json_pack ("{s:s, s:o, s:o, s:o, s:o, s:o}",
|
json_pack ("{s:s, s:o, s:o, s:o, s:o, s:o}",
|
||||||
"type", "WITHDRAW",
|
"type",
|
||||||
|
"WITHDRAW",
|
||||||
"reserve_sig",
|
"reserve_sig",
|
||||||
GNUNET_JSON_from_data_auto (
|
GNUNET_JSON_from_data_auto (&withdraw->reserve_sig),
|
||||||
&pos->details.withdraw->
|
|
||||||
reserve_sig),
|
|
||||||
"h_coin_envelope",
|
"h_coin_envelope",
|
||||||
GNUNET_JSON_from_data_auto (
|
GNUNET_JSON_from_data_auto (
|
||||||
&pos->details.withdraw->
|
&withdraw->h_coin_envelope),
|
||||||
h_coin_envelope),
|
|
||||||
"h_denom_pub",
|
"h_denom_pub",
|
||||||
GNUNET_JSON_from_data_auto (
|
GNUNET_JSON_from_data_auto (&withdraw->denom_pub_hash),
|
||||||
&pos->details.withdraw->
|
|
||||||
denom_pub_hash),
|
|
||||||
"withdraw_fee",
|
"withdraw_fee",
|
||||||
TALER_JSON_from_amount (
|
TALER_JSON_from_amount (&withdraw->withdraw_fee),
|
||||||
&pos->details.withdraw->
|
"amount",
|
||||||
withdraw_fee),
|
TALER_JSON_from_amount (&value))))
|
||||||
"amount", TALER_JSON_from_amount (
|
|
||||||
&value))))
|
|
||||||
{
|
{
|
||||||
GNUNET_break (0);
|
GNUNET_break (0);
|
||||||
json_decref (json_history);
|
json_decref (json_history);
|
||||||
@ -577,11 +562,11 @@ TEH_RESPONSE_compile_reserve_history (
|
|||||||
break;
|
break;
|
||||||
case TALER_EXCHANGEDB_RO_RECOUP_COIN:
|
case TALER_EXCHANGEDB_RO_RECOUP_COIN:
|
||||||
{
|
{
|
||||||
const struct TALER_EXCHANGEDB_Recoup *recoup;
|
const struct TALER_EXCHANGEDB_Recoup *recoup
|
||||||
|
= pos->details.recoup;
|
||||||
struct TALER_ExchangePublicKeyP pub;
|
struct TALER_ExchangePublicKeyP pub;
|
||||||
struct TALER_ExchangeSignatureP sig;
|
struct TALER_ExchangeSignatureP sig;
|
||||||
|
|
||||||
recoup = pos->details.recoup;
|
|
||||||
if (0 == (IA_DEPOSIT & init))
|
if (0 == (IA_DEPOSIT & init))
|
||||||
{
|
{
|
||||||
deposit_total = recoup->value;
|
deposit_total = recoup->value;
|
||||||
@ -643,11 +628,13 @@ TEH_RESPONSE_compile_reserve_history (
|
|||||||
break;
|
break;
|
||||||
case TALER_EXCHANGEDB_RO_EXCHANGE_TO_BANK:
|
case TALER_EXCHANGEDB_RO_EXCHANGE_TO_BANK:
|
||||||
{
|
{
|
||||||
|
const struct TALER_EXCHANGEDB_ClosingTransfer *closing =
|
||||||
|
pos->details.closing;
|
||||||
struct TALER_ExchangePublicKeyP pub;
|
struct TALER_ExchangePublicKeyP pub;
|
||||||
struct TALER_ExchangeSignatureP sig;
|
struct TALER_ExchangeSignatureP sig;
|
||||||
struct TALER_Amount value;
|
struct TALER_Amount value;
|
||||||
|
|
||||||
value = pos->details.closing->amount;
|
value = closing->amount;
|
||||||
if (0 == (IA_WITHDRAW & init))
|
if (0 == (IA_WITHDRAW & init))
|
||||||
{
|
{
|
||||||
withdraw_total = value;
|
withdraw_total = value;
|
||||||
@ -669,20 +656,17 @@ TEH_RESPONSE_compile_reserve_history (
|
|||||||
struct TALER_ReserveCloseConfirmationPS rcc = {
|
struct TALER_ReserveCloseConfirmationPS rcc = {
|
||||||
.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_RESERVE_CLOSED),
|
.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_RESERVE_CLOSED),
|
||||||
.purpose.size = htonl (sizeof (rcc)),
|
.purpose.size = htonl (sizeof (rcc)),
|
||||||
.timestamp = GNUNET_TIME_absolute_hton (
|
.timestamp = GNUNET_TIME_absolute_hton (closing->execution_date),
|
||||||
pos->details.closing->execution_date),
|
|
||||||
.reserve_pub = pos->details.closing->reserve_pub,
|
.reserve_pub = pos->details.closing->reserve_pub,
|
||||||
.wtid = pos->details.closing->wtid
|
.wtid = closing->wtid
|
||||||
};
|
};
|
||||||
|
|
||||||
TALER_amount_hton (&rcc.closing_amount,
|
TALER_amount_hton (&rcc.closing_amount,
|
||||||
&value);
|
&value);
|
||||||
TALER_amount_hton (&rcc.closing_fee,
|
TALER_amount_hton (&rcc.closing_fee,
|
||||||
&pos->details.closing->closing_fee);
|
&closing->closing_fee);
|
||||||
GNUNET_CRYPTO_hash (pos->details.closing->receiver_account_details,
|
GNUNET_CRYPTO_hash (closing->receiver_account_details,
|
||||||
strlen (
|
strlen (closing->receiver_account_details) + 1,
|
||||||
pos->details.closing->receiver_account_details)
|
|
||||||
+ 1,
|
|
||||||
&rcc.h_wire);
|
&rcc.h_wire);
|
||||||
if (GNUNET_OK !=
|
if (GNUNET_OK !=
|
||||||
TEH_KS_sign (&rcc.purpose,
|
TEH_KS_sign (&rcc.purpose,
|
||||||
@ -695,28 +679,26 @@ TEH_RESPONSE_compile_reserve_history (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (0 !=
|
if (0 !=
|
||||||
json_array_append_new (json_history,
|
json_array_append_new (
|
||||||
|
json_history,
|
||||||
json_pack (
|
json_pack (
|
||||||
"{s:s, s:s, s:o, s:o, s:o, s:o, s:o, s:o}",
|
"{s:s, s:s, s:o, s:o, s:o, s:o, s:o, s:o}",
|
||||||
"type", "CLOSING",
|
"type",
|
||||||
|
"CLOSING",
|
||||||
"receiver_account_details",
|
"receiver_account_details",
|
||||||
pos->details.closing->
|
closing->receiver_account_details,
|
||||||
receiver_account_details,
|
|
||||||
"wtid",
|
"wtid",
|
||||||
GNUNET_JSON_from_data_auto (
|
GNUNET_JSON_from_data_auto (&closing->wtid),
|
||||||
&pos->details.closing->wtid),
|
|
||||||
"exchange_pub",
|
"exchange_pub",
|
||||||
GNUNET_JSON_from_data_auto (&pub),
|
GNUNET_JSON_from_data_auto (&pub),
|
||||||
"exchange_sig",
|
"exchange_sig",
|
||||||
GNUNET_JSON_from_data_auto (&sig),
|
GNUNET_JSON_from_data_auto (&sig),
|
||||||
"timestamp",
|
"timestamp",
|
||||||
GNUNET_JSON_from_time_abs (
|
GNUNET_JSON_from_time_abs (closing->execution_date),
|
||||||
pos->details.closing->execution_date),
|
"amount",
|
||||||
"amount", TALER_JSON_from_amount (
|
TALER_JSON_from_amount (&value),
|
||||||
&value),
|
|
||||||
"closing_fee",
|
"closing_fee",
|
||||||
TALER_JSON_from_amount (
|
TALER_JSON_from_amount (&closing->closing_fee))))
|
||||||
&pos->details.closing->closing_fee))))
|
|
||||||
{
|
{
|
||||||
GNUNET_break (0);
|
GNUNET_break (0);
|
||||||
json_decref (json_history);
|
json_decref (json_history);
|
||||||
|
Loading…
Reference in New Issue
Block a user