.argument field was never used, simplify logic
This commit is contained in:
parent
01e8e930dc
commit
1ec2cb59b4
@ -67,23 +67,6 @@ struct TALER_BANK_HistoryHandle
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represent a URL argument+value pair.
|
|
||||||
*/
|
|
||||||
struct HistoryArgumentURL
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Name of the URL argument.
|
|
||||||
*/
|
|
||||||
char argument[20];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Value of the URL argument.
|
|
||||||
*/
|
|
||||||
char value[20];
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse history given in JSON format and invoke the callback on each item.
|
* Parse history given in JSON format and invoke the callback on each item.
|
||||||
*
|
*
|
||||||
@ -320,34 +303,29 @@ put_history_job (struct GNUNET_CURL_Context *ctx,
|
|||||||
* Convert fixed value 'direction' into string.
|
* Convert fixed value 'direction' into string.
|
||||||
*
|
*
|
||||||
* @param direction the value to convert.
|
* @param direction the value to convert.
|
||||||
* @return string representation of @a direction. When length
|
* @return string representation of @a direction. NULL on error
|
||||||
* is zero, an error occurred.
|
|
||||||
*/
|
*/
|
||||||
static struct HistoryArgumentURL
|
static const char *
|
||||||
conv_direction (enum TALER_BANK_Direction direction)
|
conv_direction (enum TALER_BANK_Direction direction)
|
||||||
{
|
{
|
||||||
struct HistoryArgumentURL ret;
|
|
||||||
|
|
||||||
if (TALER_BANK_DIRECTION_NONE == direction)
|
if (TALER_BANK_DIRECTION_NONE == direction)
|
||||||
{
|
{
|
||||||
/* Should just never happen. */
|
/* Should just never happen. */
|
||||||
GNUNET_assert (0);
|
GNUNET_break (0);
|
||||||
return ret;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TALER_BANK_DIRECTION_BOTH ==
|
if (TALER_BANK_DIRECTION_BOTH ==
|
||||||
(TALER_BANK_DIRECTION_BOTH & direction))
|
(TALER_BANK_DIRECTION_BOTH & direction))
|
||||||
strcpy (&ret.value[0],
|
return "both";
|
||||||
"both");
|
|
||||||
else if (TALER_BANK_DIRECTION_CREDIT ==
|
else if (TALER_BANK_DIRECTION_CREDIT ==
|
||||||
(TALER_BANK_DIRECTION_CREDIT & direction))
|
(TALER_BANK_DIRECTION_CREDIT & direction))
|
||||||
strcpy (&ret.value[0],
|
return "credit";
|
||||||
"credit");
|
|
||||||
else if (TALER_BANK_DIRECTION_DEBIT ==
|
else if (TALER_BANK_DIRECTION_DEBIT ==
|
||||||
(TALER_BANK_DIRECTION_BOTH & direction)) /*why use 'both' flag?*/
|
(TALER_BANK_DIRECTION_BOTH & direction)) /*why use 'both' flag?*/
|
||||||
strcpy (&ret.value[0],
|
return "debit";
|
||||||
"debit");
|
/* Should just never happen. */
|
||||||
return ret;
|
GNUNET_break (0);
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -356,26 +334,18 @@ conv_direction (enum TALER_BANK_Direction direction)
|
|||||||
* of the "cancel" argument.
|
* of the "cancel" argument.
|
||||||
*
|
*
|
||||||
* @param direction the value to convert.
|
* @param direction the value to convert.
|
||||||
* @return string representation of @a direction. When length
|
* @return string representation of @a direction
|
||||||
* is zero, an error occurred.
|
|
||||||
*/
|
*/
|
||||||
static struct HistoryArgumentURL
|
static const char *
|
||||||
conv_cancel (enum TALER_BANK_Direction direction)
|
conv_cancel (enum TALER_BANK_Direction direction)
|
||||||
{
|
{
|
||||||
struct HistoryArgumentURL ret;
|
|
||||||
|
|
||||||
if (TALER_BANK_DIRECTION_CANCEL ==
|
if (TALER_BANK_DIRECTION_CANCEL ==
|
||||||
(TALER_BANK_DIRECTION_CANCEL & direction))
|
(TALER_BANK_DIRECTION_CANCEL & direction))
|
||||||
GNUNET_snprintf (ret.value,
|
return "show";
|
||||||
sizeof (ret.value),
|
return "omit";
|
||||||
"show");
|
|
||||||
else
|
|
||||||
GNUNET_snprintf (ret.value,
|
|
||||||
sizeof (ret.value),
|
|
||||||
"omit");
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Request the wire transfer history of a bank account,
|
* Request the wire transfer history of a bank account,
|
||||||
* using time stamps to narrow the results.
|
* using time stamps to narrow the results.
|
||||||
@ -421,8 +391,8 @@ TALER_BANK_history_range (struct GNUNET_CURL_Context *ctx,
|
|||||||
(unsigned long long) account_number,
|
(unsigned long long) account_number,
|
||||||
start_date.abs_value_us / 1000LL / 1000LL,
|
start_date.abs_value_us / 1000LL / 1000LL,
|
||||||
end_date.abs_value_us / 1000LL / 1000LL,
|
end_date.abs_value_us / 1000LL / 1000LL,
|
||||||
conv_direction (direction).value,
|
conv_direction (direction),
|
||||||
conv_cancel (direction).value,
|
conv_cancel (direction),
|
||||||
(GNUNET_YES == ascending) ? "ascending" : "descending");
|
(GNUNET_YES == ascending) ? "ascending" : "descending");
|
||||||
|
|
||||||
hh = put_history_job (ctx,
|
hh = put_history_job (ctx,
|
||||||
@ -489,16 +459,16 @@ TALER_BANK_history (struct GNUNET_CURL_Context *ctx,
|
|||||||
"/history?auth=basic&account_number=%llu&delta=%lld&direction=%s&cancelled=%s&ordering=%s",
|
"/history?auth=basic&account_number=%llu&delta=%lld&direction=%s&cancelled=%s&ordering=%s",
|
||||||
(unsigned long long) account_number,
|
(unsigned long long) account_number,
|
||||||
(long long) num_results,
|
(long long) num_results,
|
||||||
conv_direction (direction).value,
|
conv_direction (direction),
|
||||||
conv_cancel (direction).value,
|
conv_cancel (direction),
|
||||||
(GNUNET_YES == ascending) ? "ascending" : "descending");
|
(GNUNET_YES == ascending) ? "ascending" : "descending");
|
||||||
else
|
else
|
||||||
GNUNET_asprintf (&url,
|
GNUNET_asprintf (&url,
|
||||||
"/history?auth=basic&account_number=%llu&delta=%lld&direction=%s&cancelled=%s&ordering=%s&start=%llu",
|
"/history?auth=basic&account_number=%llu&delta=%lld&direction=%s&cancelled=%s&ordering=%s&start=%llu",
|
||||||
(unsigned long long) account_number,
|
(unsigned long long) account_number,
|
||||||
(long long) num_results,
|
(long long) num_results,
|
||||||
conv_direction (direction).value,
|
conv_direction (direction),
|
||||||
conv_cancel (direction).value,
|
conv_cancel (direction),
|
||||||
(GNUNET_YES == ascending) ? "ascending" : "descending",
|
(GNUNET_YES == ascending) ? "ascending" : "descending",
|
||||||
start_row);
|
start_row);
|
||||||
hh = put_history_job (ctx,
|
hh = put_history_job (ctx,
|
||||||
|
Loading…
Reference in New Issue
Block a user