aboutsummaryrefslogtreecommitdiff
path: root/src/bank-lib/bank_api_credit.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-01-13 22:01:45 +0100
committerChristian Grothoff <christian@grothoff.org>2020-01-13 22:01:45 +0100
commit7b1909bc99690999d06767cfe6d9947e83974174 (patch)
treeb71ebd088d7018b864f180f8f7e1ac659c86ea7a /src/bank-lib/bank_api_credit.c
parent2d16cddfd9f3d58f696313b8c2decb9da0e9cf7a (diff)
make fakebank and banklib match specifified new API
Diffstat (limited to 'src/bank-lib/bank_api_credit.c')
-rw-r--r--src/bank-lib/bank_api_credit.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/src/bank-lib/bank_api_credit.c b/src/bank-lib/bank_api_credit.c
index ed0a1e2a7..4bb6e7cb2 100644
--- a/src/bank-lib/bank_api_credit.c
+++ b/src/bank-lib/bank_api_credit.c
@@ -17,8 +17,8 @@
see <http://www.gnu.org/licenses/>
*/
/**
- * @file bank-lib/bank_api_history.c
- * @brief Implementation of the /history[-range]
+ * @file bank-lib/bank_api_credit.c
+ * @brief Implementation of the /history/incoming
* requests of the bank's HTTP API.
* @author Christian Grothoff
* @author Marcello Stanisci
@@ -78,7 +78,7 @@ parse_account_history (struct TALER_BANK_CreditHistoryHandle *hh,
json_t *history_array;
if (NULL == (history_array = json_object_get (history,
- "data")))
+ "incoming_transactions")))
{
GNUNET_break_op (0);
return GNUNET_SYSERR;
@@ -101,8 +101,10 @@ parse_account_history (struct TALER_BANK_CreditHistoryHandle *hh,
&row_id),
GNUNET_JSON_spec_fixed_auto ("reserve_pub",
&td.reserve_pub),
- GNUNET_JSON_spec_string ("counterpart",
- &td.account_url),
+ GNUNET_JSON_spec_string ("debit_account",
+ &td.debit_account_url),
+ GNUNET_JSON_spec_string ("credit_account",
+ &td.credit_account_url),
GNUNET_JSON_spec_end ()
};
json_t *transaction = json_array_get (history_array,
@@ -250,13 +252,16 @@ TALER_BANK_credit_history (struct GNUNET_CURL_Context *ctx,
return NULL;
}
- if (UINT64_MAX == start_row)
+ if ( ( (UINT64_MAX == start_row) &&
+ (0 > num_results) ) ||
+ ( (0 == start_row) &&
+ (0 < num_results) ) )
GNUNET_asprintf (&url,
- "/history&delta=%lld",
+ "/history/incoming?delta=%lld",
(long long) num_results);
else
GNUNET_asprintf (&url,
- "/history&delta=%lld&start=%llu",
+ "/history/incoming?delta=%lld&start=%llu",
(long long) num_results,
start_row);
hh = GNUNET_new (struct TALER_BANK_CreditHistoryHandle);
@@ -265,7 +270,9 @@ TALER_BANK_credit_history (struct GNUNET_CURL_Context *ctx,
hh->bank_base_url = GNUNET_strdup (bank_base_url);
hh->request_url = TALER_BANK_path_to_url_ (bank_base_url,
url);
-
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Requesting history at `%s'\n",
+ hh->request_url);
eh = curl_easy_init ();
if ( (GNUNET_OK !=
TALER_BANK_setup_auth_ (eh,