initial fixes to test exchange/bank interfacing

This commit is contained in:
Marcello Stanisci 2017-05-09 17:35:07 +02:00
parent edf24557bf
commit 75f47e79e1
No known key found for this signature in database
GPG Key ID: 8D526861953F4C0F
3 changed files with 19 additions and 9 deletions

View File

@ -57,7 +57,8 @@ check_PROGRAMS = \
test_bank_api_with_fakebank test_bank_api_with_fakebank
TESTS = \ TESTS = \
test_bank_api_with_fakebank test_bank_api
# test_bank_api_with_fakebank
# For now, test_bank_api is known NOT to work (#5005, #4964, etc.) # For now, test_bank_api is known NOT to work (#5005, #4964, etc.)
# $(check_PROGRAMS) # $(check_PROGRAMS)

View File

@ -39,39 +39,45 @@ run (void *cls)
int *resultp = cls; int *resultp = cls;
static struct TBI_Command commands[] = static struct TBI_Command commands[] =
{ {
/* Add EUR:5.01 to account 42 */ /* Ask complete history of 'Exchange' user (number 2) */
{ .oc = TBI_OC_HISTORY, { .oc = TBI_OC_HISTORY,
.label = "history-0", .label = "history-0",
.details.history.account_number = 1, .details.history.account_number = 2,
.details.history.direction = TALER_BANK_DIRECTION_BOTH, .details.history.direction = TALER_BANK_DIRECTION_BOTH,
.details.history.start_row_ref = NULL, .details.history.start_row_ref = NULL,
.details.history.num_results = 5 }, .details.history.num_results = 5 },
# if 0
/* Move money from Exchange to Bank */
{ .oc = TBI_OC_ADMIN_ADD_INCOMING, { .oc = TBI_OC_ADMIN_ADD_INCOMING,
.label = "deposit-1", .label = "deposit-1",
.details.admin_add_incoming.exchange_base_url = "https://exchange.net/", /* bogus */ .details.admin_add_incoming.exchange_base_url = "https://exchange.net/", /* bogus */
.details.admin_add_incoming.expected_response_code = MHD_HTTP_OK, .details.admin_add_incoming.expected_response_code = MHD_HTTP_OK,
.details.admin_add_incoming.credit_account_no = 1, .details.admin_add_incoming.credit_account_no = 1,
.details.admin_add_incoming.debit_account_no = 2, .details.admin_add_incoming.debit_account_no = 2, /* Ignored */
.details.admin_add_incoming.amount = "PUDOS:5.01" }, .details.admin_add_incoming.amount = "PUDOS:5.01" },
/* Move money from Exchange to Bank */
{ .oc = TBI_OC_ADMIN_ADD_INCOMING, { .oc = TBI_OC_ADMIN_ADD_INCOMING,
.label = "deposit-2", .label = "deposit-2",
.details.admin_add_incoming.exchange_base_url = "https://exchange.net/", /* bogus */ .details.admin_add_incoming.exchange_base_url = "https://exchange.net/", /* bogus */
.details.admin_add_incoming.expected_response_code = MHD_HTTP_OK, .details.admin_add_incoming.expected_response_code = MHD_HTTP_OK,
.details.admin_add_incoming.credit_account_no = 1, .details.admin_add_incoming.credit_account_no = 1,
.details.admin_add_incoming.debit_account_no = 2, .details.admin_add_incoming.debit_account_no = 2, /* Ignored */
.details.admin_add_incoming.amount = "PUDOS:5.01" }, .details.admin_add_incoming.amount = "PUDOS:5.01" },
/* Ask Exchange's incoming history */
{ .oc = TBI_OC_HISTORY, { .oc = TBI_OC_HISTORY,
.label = "history-1c", .label = "history-1c",
.details.history.account_number = 1, .details.history.account_number = 2,
.details.history.direction = TALER_BANK_DIRECTION_CREDIT, .details.history.direction = TALER_BANK_DIRECTION_CREDIT,
.details.history.start_row_ref = NULL, .details.history.start_row_ref = NULL,
.details.history.num_results = 5 }, .details.history.num_results = 5 },
/* Ask Exchange's outgoing history, 5 records into the future?? */
{ .oc = TBI_OC_HISTORY, { .oc = TBI_OC_HISTORY,
.label = "history-2d", .label = "history-2d",
.details.history.account_number = 2, .details.history.account_number = 2,
.details.history.direction = TALER_BANK_DIRECTION_DEBIT, .details.history.direction = TALER_BANK_DIRECTION_DEBIT,
.details.history.start_row_ref = NULL, .details.history.start_row_ref = NULL,
.details.history.num_results = 5 }, .details.history.num_results = 5 },
/* Ask Exchange's outgoing history, last 5 records */
{ .oc = TBI_OC_HISTORY, { .oc = TBI_OC_HISTORY,
.label = "history-2dr", .label = "history-2dr",
.details.history.account_number = 2, .details.history.account_number = 2,
@ -84,6 +90,7 @@ run (void *cls)
.details.history.direction = TALER_BANK_DIRECTION_DEBIT, .details.history.direction = TALER_BANK_DIRECTION_DEBIT,
.details.history.start_row_ref = "deposit-1", .details.history.start_row_ref = "deposit-1",
.details.history.num_results = 5 }, .details.history.num_results = 5 },
#endif
{ .oc = TBI_OC_END } { .oc = TBI_OC_END }
}; };

View File

@ -565,8 +565,8 @@ interpreter_run (void *cls)
return; return;
} }
auth.method = TALER_BANK_AUTH_BASIC; /* or "NONE"? */ auth.method = TALER_BANK_AUTH_BASIC; /* or "NONE"? */
auth.details.basic.username = "user"; auth.details.basic.username = "Exchange";
auth.details.basic.password = "pass"; auth.details.basic.password = "x";
switch (cmd->oc) switch (cmd->oc)
{ {
case TBI_OC_END: case TBI_OC_END:
@ -609,6 +609,8 @@ interpreter_run (void *cls)
case TBI_OC_HISTORY: case TBI_OC_HISTORY:
if (NULL != cmd->details.history.start_row_ref) if (NULL != cmd->details.history.start_row_ref)
{ {
/*In case history is to be found from some other commad's
output, like from /admin/add/incoming*/
ref = find_command (is, ref = find_command (is,
cmd->details.history.start_row_ref); cmd->details.history.start_row_ref);
GNUNET_assert (NULL != ref); GNUNET_assert (NULL != ref);
@ -623,7 +625,7 @@ interpreter_run (void *cls)
rowid = UINT64_MAX; rowid = UINT64_MAX;
cmd->details.history.hh cmd->details.history.hh
= TALER_BANK_history (is->ctx, = TALER_BANK_history (is->ctx,
"http://localhost:8081", "http://localhost:8080",
&auth, &auth,
cmd->details.history.account_number, cmd->details.history.account_number,
cmd->details.history.direction, cmd->details.history.direction,