summaryrefslogtreecommitdiff
path: root/src/lib/testing_api_cmd_bank_history_debit.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/lib/testing_api_cmd_bank_history_debit.c
parent2d16cddfd9f3d58f696313b8c2decb9da0e9cf7a (diff)
downloadexchange-7b1909bc99690999d06767cfe6d9947e83974174.tar.gz
exchange-7b1909bc99690999d06767cfe6d9947e83974174.tar.bz2
exchange-7b1909bc99690999d06767cfe6d9947e83974174.zip
make fakebank and banklib match specifified new API
Diffstat (limited to 'src/lib/testing_api_cmd_bank_history_debit.c')
-rw-r--r--src/lib/testing_api_cmd_bank_history_debit.c70
1 files changed, 30 insertions, 40 deletions
diff --git a/src/lib/testing_api_cmd_bank_history_debit.c b/src/lib/testing_api_cmd_bank_history_debit.c
index 0b0cc40e1..ec4a323e6 100644
--- a/src/lib/testing_api_cmd_bank_history_debit.c
+++ b/src/lib/testing_api_cmd_bank_history_debit.c
@@ -170,7 +170,7 @@ print_expected (struct History *h,
TALER_amount2s (&h[i].details.amount),
(unsigned long long) h[i].row_id,
TALER_B2S (&h[i].details.wtid),
- h[i].details.account_url);
+ h[i].details.credit_account_url);
}
}
@@ -219,12 +219,10 @@ build_history (struct TALER_TESTING_Interpreter *is,
int inc;
unsigned int start;
unsigned int end;
-
- /**
- * @var turns GNUNET_YES whenever either no 'start' value was
- * given for the history query, or the given value is found
- * in the list of all the CMDs.
- */int ok;
+ /* GNUNET_YES whenever either no 'start' value was given for the history
+ * query, or the given value is found in the list of all the CMDs.
+ */
+ int ok;
const uint64_t *row_id_start = NULL;
if (NULL != hs->start_row_reference)
@@ -278,11 +276,11 @@ build_history (struct TALER_TESTING_Interpreter *is,
const char *debit_account;
const char *credit_account;
- /**
- * The following command allows us to skip over those CMDs
+ /* The following command allows us to skip over those CMDs
* that do not offer a "row_id" trait. Such skipped CMDs are
* not interesting for building a history.
- */if (GNUNET_OK != TALER_TESTING_get_trait_uint64 (pos,
+ */
+ if (GNUNET_OK != TALER_TESTING_get_trait_uint64 (pos,
0,
&row_id))
continue;
@@ -408,18 +406,16 @@ build_history (struct TALER_TESTING_Interpreter *is,
(GNUNET_OK == TALER_TESTING_GET_TRAIT_CREDIT_ACCOUNT
(pos, &credit_account));
- TALER_LOG_INFO ("Potential history bit:"
- " %s->%s; my account: %s\n",
+ TALER_LOG_INFO ("Potential history bit: %s->%s; my account: %s\n",
debit_account,
credit_account,
hs->account_url);
- /**
- * Discard transactions where the audited account played
- * _both_ the debit and the debit roles, but _only if_
- * the audit goes on both directions.. This needs more
- * explaination!
- */if (0 == strcasecmp (hs->account_url,
+ /* Discard transactions where the audited account played _both_ the debit
+ * and the debit roles, but _only if_ the audit goes on both directions..
+ * This needs more explaination!
+ */
+ if (0 == strcasecmp (hs->account_url,
debit_account))
{
GNUNET_break (0);
@@ -437,15 +433,6 @@ build_history (struct TALER_TESTING_Interpreter *is,
if (0 == strcasecmp (hs->account_url,
debit_account))
{
- h[total].url = GNUNET_strdup (credit_account);
- h[total].details.account_url = h[total].url;
- }
-
- /* This block _completes_ the information of the current item,
- * with amount / subject / exchange URL. */
- if (0 == strcasecmp (hs->account_url,
- debit_account))
- {
const struct TALER_Amount *amount;
const struct TALER_WireTransferIdentifierRawP *wtid;
const char *account_url;
@@ -460,10 +447,12 @@ build_history (struct TALER_TESTING_Interpreter *is,
TALER_TESTING_get_trait_url
(pos, 1,
&account_url));
+ h[total].url = GNUNET_strdup (credit_account);
+ h[total].details.credit_account_url = h[total].url;
h[total].details.amount = *amount;
h[total].row_id = *row_id;
h[total].details.wtid = *wtid;
- h[total].details.account_url = account_url;
+ h[total].details.debit_account_url = account_url;
TALER_LOG_INFO ("+1-bit of my history\n");
total++;
}
@@ -529,8 +518,8 @@ check_result (struct TALER_TESTING_Interpreter *is,
&details->wtid)) ||
(0 != TALER_amount_cmp (&h[off].details.amount,
&details->amount)) ||
- (0 != strcasecmp (h[off].details.account_url,
- details->account_url)) )
+ (0 != strcasecmp (h[off].details.credit_account_url,
+ details->credit_account_url)) )
{
GNUNET_break (0);
print_expected (h,
@@ -581,20 +570,12 @@ history_cb (void *cls,
struct HistoryState *hs = is->commands[is->ip].cls;
(void) row_id;
- if (MHD_HTTP_OK != http_status)
- {
- hs->hh = NULL;
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Unwanted response code from /history: %u\n",
- http_status);
- TALER_TESTING_interpreter_fail (is);
- return GNUNET_SYSERR;
- }
if (NULL == details)
{
hs->hh = NULL;
if ( (hs->results_obtained != compute_result_count (is)) ||
- (GNUNET_YES == hs->failed) )
+ (GNUNET_YES == hs->failed) ||
+ (MHD_HTTP_NO_CONTENT != http_status) )
{
uint64_t total;
struct History *h;
@@ -621,6 +602,15 @@ history_cb (void *cls,
return GNUNET_OK;
}
+ if (MHD_HTTP_OK != http_status)
+ {
+ hs->hh = NULL;
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Unwanted response code from /history: %u\n",
+ http_status);
+ TALER_TESTING_interpreter_fail (is);
+ return GNUNET_SYSERR;
+ }
/* check current element */
if (GNUNET_OK != check_result (is,
hs->results_obtained,