aboutsummaryrefslogtreecommitdiff
path: root/src/bank-lib
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-01-15 11:14:11 +0100
committerChristian Grothoff <christian@grothoff.org>2020-01-15 11:14:11 +0100
commit3fa213e41e82a93f8f5c5cd59b599ff78d0acc3a (patch)
tree6e208ac8cfaa376782d9703088e1029c94520d86 /src/bank-lib
parentb1b0465f5424d4386fafc4af53fcf420ac68ca78 (diff)
fix test issues
Diffstat (limited to 'src/bank-lib')
-rw-r--r--src/bank-lib/bank_api_admin.c7
-rw-r--r--src/bank-lib/fakebank.c55
2 files changed, 42 insertions, 20 deletions
diff --git a/src/bank-lib/bank_api_admin.c b/src/bank-lib/bank_api_admin.c
index 2b6e45f45..6e4d937c5 100644
--- a/src/bank-lib/bank_api_admin.c
+++ b/src/bank-lib/bank_api_admin.c
@@ -209,9 +209,10 @@ TALER_BANK_admin_add_incoming (struct GNUNET_CURL_Context *ctx,
aai->cb_cls = res_cb_cls;
aai->request_url = TALER_BANK_path_to_url_ (account_base_url,
"/admin/add-incoming");
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Requesting administrative transaction at `%s'\n",
- aai->request_url);
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Requesting administrative transaction at `%s' for reserve %s\n",
+ aai->request_url,
+ TALER_B2S (reserve_pub));
aai->post_ctx.headers = curl_slist_append
(aai->post_ctx.headers,
"Content-Type: application/json");
diff --git a/src/bank-lib/fakebank.c b/src/bank-lib/fakebank.c
index b99b78816..b12b04378 100644
--- a/src/bank-lib/fakebank.c
+++ b/src/bank-lib/fakebank.c
@@ -888,9 +888,9 @@ parse_history_common_args (struct MHD_Connection *connection,
* @return MHD result code
*/
static int
-handle_credit_history (struct TALER_FAKEBANK_Handle *h,
- struct MHD_Connection *connection,
- const char *account)
+handle_debit_history (struct TALER_FAKEBANK_Handle *h,
+ struct MHD_Connection *connection,
+ const char *account)
{
struct HistoryArgs ha;
struct Transaction *pos;
@@ -939,7 +939,7 @@ handle_credit_history (struct TALER_FAKEBANK_Handle *h,
while ( (0 != ha.delta) &&
(NULL != pos) )
{
- if ( (0 == strcasecmp (pos->credit_account,
+ if ( (0 == strcasecmp (pos->debit_account,
account)) &&
(T_DEBIT == pos->type) )
{
@@ -972,6 +972,14 @@ handle_credit_history (struct TALER_FAKEBANK_Handle *h,
else
ha.delta++;
}
+ else
+ {
+ fprintf (stderr,
+ "Skipping transaction %s->%s: only care about %s\n",
+ pos->debit_account,
+ pos->credit_account,
+ account);
+ }
if (ha.delta > 0)
pos = pos->prev;
else
@@ -994,9 +1002,9 @@ handle_credit_history (struct TALER_FAKEBANK_Handle *h,
* @return MHD result code
*/
static int
-handle_debit_history (struct TALER_FAKEBANK_Handle *h,
- struct MHD_Connection *connection,
- const char *account)
+handle_credit_history (struct TALER_FAKEBANK_Handle *h,
+ struct MHD_Connection *connection,
+ const char *account)
{
struct HistoryArgs ha;
struct Transaction *pos;
@@ -1009,7 +1017,6 @@ handle_debit_history (struct TALER_FAKEBANK_Handle *h,
GNUNET_break (0);
return MHD_NO;
}
-
if (! ha.have_start)
{
pos = (0 > ha.delta)
@@ -1045,7 +1052,7 @@ handle_debit_history (struct TALER_FAKEBANK_Handle *h,
while ( (0 != ha.delta) &&
(NULL != pos) )
{
- if ( (0 == strcasecmp (pos->debit_account,
+ if ( (0 == strcasecmp (pos->credit_account,
account)) &&
(T_CREDIT == pos->type) )
{
@@ -1057,14 +1064,20 @@ handle_debit_history (struct TALER_FAKEBANK_Handle *h,
pos->credit_account);
debit_payto = TALER_payto_xtalerbank_make (h->my_baseurl,
account);
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Returning transaction %s->%s (%s)\n",
+ debit_payto,
+ credit_payto,
+ TALER_B2S (&pos->subject));
trans = json_pack
- ("{s:I, s:o, s:o, s:s, s:s, s:s}",
+ ("{s:I, s:o, s:o, s:s, s:s, s:o}",
"row_id", (json_int_t) pos->row_id,
"date", GNUNET_JSON_from_time_abs (pos->date),
"amount", TALER_JSON_from_amount (&pos->amount),
"credit_account", credit_payto,
"debit_account", debit_payto,
- "reserve_pub", pos->subject /* we "know" it is OK */);
+ "reserve_pub", GNUNET_JSON_from_data_auto (
+ &pos->subject.credit));
GNUNET_free (credit_payto);
GNUNET_free (debit_payto);
GNUNET_assert (0 ==
@@ -1075,6 +1088,14 @@ handle_debit_history (struct TALER_FAKEBANK_Handle *h,
else
ha.delta++;
}
+ else
+ {
+ fprintf (stderr,
+ "Skipping transaction %s->%s: only care about %s\n",
+ pos->debit_account,
+ pos->credit_account,
+ account);
+ }
if (ha.delta > 0)
pos = pos->prev;
else
@@ -1148,17 +1169,17 @@ serve (struct TALER_FAKEBANK_Handle *h,
(NULL != account) &&
(0 == strcasecmp (method,
MHD_HTTP_METHOD_GET)) )
- return handle_debit_history (h,
- connection,
- account);
+ return handle_credit_history (h,
+ connection,
+ account);
if ( (0 == strcmp (url,
"/history/outgoing")) &&
(NULL != account) &&
(0 == strcasecmp (method,
MHD_HTTP_METHOD_GET)) )
- return handle_credit_history (h,
- connection,
- account);
+ return handle_debit_history (h,
+ connection,
+ account);
/* Unexpected URL path, just close the connection. */
/* we're rather impolite here, but it's a testcase. */