add testcase for #5077 (passes), start to reduce use of exchange's admin/add/incoming (#5172, more to come)
This commit is contained in:
parent
d36de3bdd6
commit
6623afa2a3
@ -86,6 +86,13 @@ struct Transaction
|
||||
* Flag set if the transfer was rejected.
|
||||
*/
|
||||
int rejected;
|
||||
|
||||
/**
|
||||
* Has this transaction been subjected to #TALER_FAKEBANK_check()
|
||||
* and should thus no longer be counted in
|
||||
* #TALER_FAKEBANK_check_empty()?
|
||||
*/
|
||||
int checked;
|
||||
};
|
||||
|
||||
|
||||
@ -150,15 +157,12 @@ TALER_FAKEBANK_check (struct TALER_FAKEBANK_Handle *h,
|
||||
(want_credit == t->credit_account) &&
|
||||
(0 == TALER_amount_cmp (want_amount,
|
||||
&t->amount)) &&
|
||||
(GNUNET_NO == t->checked) &&
|
||||
(0 == strcasecmp (exchange_base_url,
|
||||
t->exchange_base_url)) )
|
||||
{
|
||||
GNUNET_CONTAINER_DLL_remove (h->transactions_head,
|
||||
h->transactions_tail,
|
||||
t);
|
||||
*subject = t->subject;
|
||||
GNUNET_free (t->exchange_base_url);
|
||||
GNUNET_free (t);
|
||||
*subject = GNUNET_strdup (t->subject);
|
||||
t->checked = GNUNET_YES;
|
||||
return GNUNET_OK;
|
||||
}
|
||||
}
|
||||
@ -168,6 +172,8 @@ TALER_FAKEBANK_check (struct TALER_FAKEBANK_Handle *h,
|
||||
{
|
||||
char *s;
|
||||
|
||||
if (GNUNET_YES == t->checked)
|
||||
continue;
|
||||
s = TALER_amount_to_string (&t->amount);
|
||||
fprintf (stderr,
|
||||
"%llu -> %llu (%s) from %s\n",
|
||||
@ -262,12 +268,22 @@ TALER_FAKEBANK_check_empty (struct TALER_FAKEBANK_Handle *h)
|
||||
{
|
||||
struct Transaction *t;
|
||||
|
||||
if (NULL == h->transactions_head)
|
||||
t = h->transactions_head;
|
||||
while (NULL != t)
|
||||
{
|
||||
if ( (GNUNET_YES != t->checked) &&
|
||||
(GNUNET_YES != t->rejected) )
|
||||
break;
|
||||
t = t->next;
|
||||
}
|
||||
if (NULL == t)
|
||||
return GNUNET_OK;
|
||||
|
||||
fprintf (stderr,
|
||||
"Expected empty transaction set, but I have:\n");
|
||||
for (t = h->transactions_head; NULL != t; t = t->next)
|
||||
while (NULL != t)
|
||||
{
|
||||
if ( (GNUNET_YES != t->checked) &&
|
||||
(GNUNET_YES != t->rejected) )
|
||||
{
|
||||
char *s;
|
||||
|
||||
@ -280,6 +296,8 @@ TALER_FAKEBANK_check_empty (struct TALER_FAKEBANK_Handle *h)
|
||||
t->exchange_base_url);
|
||||
GNUNET_free (s);
|
||||
}
|
||||
t = t->next;
|
||||
}
|
||||
return GNUNET_SYSERR;
|
||||
}
|
||||
|
||||
@ -748,7 +766,9 @@ handle_history (struct TALER_FAKEBANK_Handle *h,
|
||||
break;
|
||||
if (NULL == pos)
|
||||
{
|
||||
GNUNET_break (0);
|
||||
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
|
||||
"Invalid range specified, transaction %llu not known!\n",
|
||||
(unsigned long long) start_number);
|
||||
return MHD_NO;
|
||||
}
|
||||
/* range is exclusive, skip the matching entry */
|
||||
|
@ -158,35 +158,6 @@ test_cancelled (struct InterpreterState *is,
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test if the /admin/add/incoming transaction at offset @a off
|
||||
* has been #TBI_OC_EXPECT_TRANSFER treated, and thus been
|
||||
* forgotten by the fakebank.
|
||||
*
|
||||
* @param is interpreter state (where we are right now)
|
||||
* @param off offset of the command to test for rejection
|
||||
* @return #GNUNET_YES if the command at @a off was cancelled
|
||||
*/
|
||||
static int
|
||||
test_deleted_by_expected (struct InterpreterState *is,
|
||||
unsigned int off)
|
||||
{
|
||||
const struct TBI_Command *cmd = &is->commands[off];
|
||||
|
||||
for (unsigned int i=0;i<is->ip;i++)
|
||||
{
|
||||
const struct TBI_Command *c = &is->commands[i];
|
||||
|
||||
if (TBI_OC_EXPECT_TRANSFER != c->oc)
|
||||
continue;
|
||||
if (0 == strcmp (c->details.expect_transfer.cmd_ref,
|
||||
cmd->label))
|
||||
return GNUNET_YES;
|
||||
}
|
||||
return GNUNET_NO;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Item in the transaction history, as reconstructed from the
|
||||
* command history.
|
||||
@ -286,10 +257,6 @@ build_history (struct InterpreterState *is,
|
||||
continue; /* skip until we find the marker */
|
||||
if (total >= cmd->details.history.num_results * inc)
|
||||
break; /* hit limit specified by command */
|
||||
if (GNUNET_YES ==
|
||||
test_deleted_by_expected (is,
|
||||
off))
|
||||
continue;
|
||||
cancelled = test_cancelled (is,
|
||||
off);
|
||||
if ( (GNUNET_YES == cancelled) &&
|
||||
@ -335,11 +302,6 @@ build_history (struct InterpreterState *is,
|
||||
continue; /* skip until we find the marker */
|
||||
if (total >= cmd->details.history.num_results * inc)
|
||||
break; /* hit limit specified by command */
|
||||
if (GNUNET_YES ==
|
||||
test_deleted_by_expected (is,
|
||||
off))
|
||||
continue;
|
||||
|
||||
if ( ( (0 != (cmd->details.history.direction & TALER_BANK_DIRECTION_CREDIT)) &&
|
||||
(cmd->details.history.account_number ==
|
||||
pos->details.admin_add_incoming.credit_account_no)) &&
|
||||
@ -787,6 +749,10 @@ interpreter_run (void *cls)
|
||||
case 2:
|
||||
auth.details.basic.username = "Exchange";
|
||||
break;
|
||||
case 3:
|
||||
auth.details.basic.username = "user3";
|
||||
auth.details.basic.password = "pass3";
|
||||
break;
|
||||
default:
|
||||
GNUNET_break (0);
|
||||
break;
|
||||
|
@ -59,6 +59,7 @@ test_exchange_api_LDADD = \
|
||||
libtalerexchange.la \
|
||||
$(LIBGCRYPT_LIBS) \
|
||||
$(top_builddir)/src/bank-lib/libtalerfakebank.la \
|
||||
$(top_builddir)/src/bank-lib/libtalerbank.la \
|
||||
$(top_builddir)/src/json/libtalerjson.la \
|
||||
$(top_builddir)/src/util/libtalerutil.la \
|
||||
-lgnunetcurl \
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "taler_json_lib.h"
|
||||
#include <gnunet/gnunet_util_lib.h>
|
||||
#include <microhttpd.h>
|
||||
#include "taler_bank_service.h"
|
||||
#include "taler_fakebank_lib.h"
|
||||
|
||||
|
||||
@ -39,6 +40,11 @@
|
||||
*/
|
||||
#define WIRE_SEPA 1
|
||||
|
||||
/**
|
||||
* Account number of the exchange at the bank.
|
||||
*/
|
||||
#define EXCHANGE_ACCOUNT_NO 2
|
||||
|
||||
/**
|
||||
* Main execution context for the main loop.
|
||||
*/
|
||||
@ -268,14 +274,31 @@ struct Command
|
||||
const char *amount;
|
||||
|
||||
/**
|
||||
* Sender account details (JSON).
|
||||
* Wire transfer subject. NULL to use public key corresponding
|
||||
* to @e reserve_priv or @e reserve_reference. Should only be
|
||||
* set manually to test invalid wire transfer subjects.
|
||||
*/
|
||||
const char *sender_details;
|
||||
const char *subject;
|
||||
|
||||
/**
|
||||
* Transfer information identifier (JSON).
|
||||
* Sender (debit) account number.
|
||||
*/
|
||||
const char *transfer_details;
|
||||
uint64_t debit_account_no;
|
||||
|
||||
/**
|
||||
* Receiver (credit) account number.
|
||||
*/
|
||||
uint64_t credit_account_no;
|
||||
|
||||
/**
|
||||
* Username to use for authentication.
|
||||
*/
|
||||
const char *auth_username;
|
||||
|
||||
/**
|
||||
* Password to use for authentication.
|
||||
*/
|
||||
const char *auth_password;
|
||||
|
||||
/**
|
||||
* Set (by the interpreter) to the reserve's private key
|
||||
@ -286,7 +309,12 @@ struct Command
|
||||
/**
|
||||
* Set to the API's handle during the operation.
|
||||
*/
|
||||
struct TALER_EXCHANGE_AdminAddIncomingHandle *aih;
|
||||
struct TALER_BANK_AdminAddIncomingHandle *aih;
|
||||
|
||||
/**
|
||||
* Set to the wire transfer's unique ID.
|
||||
*/
|
||||
uint64_t serial_id;
|
||||
|
||||
} admin_add_incoming;
|
||||
|
||||
@ -844,18 +872,21 @@ next_command (struct InterpreterState *is)
|
||||
* @param http_status HTTP response code, #MHD_HTTP_OK (200) for successful status request
|
||||
* 0 if the exchange's reply is bogus (fails to follow the protocol)
|
||||
* @param ec taler-specific error code, #TALER_EC_NONE on success
|
||||
* @param serial_id unique ID of the wire transfer
|
||||
* @param full_response full response from the exchange (for logging, in case of errors)
|
||||
*/
|
||||
static void
|
||||
add_incoming_cb (void *cls,
|
||||
unsigned int http_status,
|
||||
enum TALER_ErrorCode ec,
|
||||
uint64_t serial_id,
|
||||
const json_t *full_response)
|
||||
{
|
||||
struct InterpreterState *is = cls;
|
||||
struct Command *cmd = &is->commands[is->ip];
|
||||
|
||||
cmd->details.admin_add_incoming.aih = NULL;
|
||||
cmd->details.admin_add_incoming.serial_id = serial_id;
|
||||
if (MHD_HTTP_OK != http_status)
|
||||
{
|
||||
GNUNET_break (0);
|
||||
@ -2037,9 +2068,6 @@ interpreter_run (void *cls)
|
||||
const struct Command *ref;
|
||||
struct TALER_ReservePublicKeyP reserve_pub;
|
||||
struct TALER_Amount amount;
|
||||
struct GNUNET_TIME_Absolute execution_date;
|
||||
json_t *sender_details;
|
||||
json_t *transfer_details;
|
||||
const struct GNUNET_SCHEDULER_TaskContext *tc;
|
||||
|
||||
is->task = NULL;
|
||||
@ -2061,6 +2089,18 @@ interpreter_run (void *cls)
|
||||
GNUNET_SCHEDULER_shutdown ();
|
||||
return;
|
||||
case OC_ADMIN_ADD_INCOMING:
|
||||
{
|
||||
char *subject;
|
||||
struct TALER_BANK_AuthenticationData auth;
|
||||
|
||||
if (NULL !=
|
||||
cmd->details.admin_add_incoming.subject)
|
||||
{
|
||||
subject = GNUNET_strdup (cmd->details.admin_add_incoming.subject);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Use reserve public key as subject */
|
||||
if (NULL !=
|
||||
cmd->details.admin_add_incoming.reserve_reference)
|
||||
{
|
||||
@ -2081,6 +2121,9 @@ interpreter_run (void *cls)
|
||||
}
|
||||
GNUNET_CRYPTO_eddsa_key_get_public (&cmd->details.admin_add_incoming.reserve_priv.eddsa_priv,
|
||||
&reserve_pub.eddsa_pub);
|
||||
subject = GNUNET_STRINGS_data_to_string_alloc (&reserve_pub,
|
||||
sizeof (reserve_pub));
|
||||
}
|
||||
if (GNUNET_OK !=
|
||||
TALER_string_to_amount (cmd->details.admin_add_incoming.amount,
|
||||
&amount))
|
||||
@ -2092,50 +2135,28 @@ interpreter_run (void *cls)
|
||||
fail (is);
|
||||
return;
|
||||
}
|
||||
sender_details = json_loads (cmd->details.admin_add_incoming.sender_details,
|
||||
JSON_REJECT_DUPLICATES,
|
||||
NULL);
|
||||
if (NULL == sender_details)
|
||||
{
|
||||
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
|
||||
"Failed to parse sender details `%s' at %u\n",
|
||||
cmd->details.admin_add_incoming.sender_details,
|
||||
is->ip);
|
||||
fail (is);
|
||||
return;
|
||||
}
|
||||
transfer_details = json_loads (cmd->details.admin_add_incoming.transfer_details,
|
||||
JSON_REJECT_DUPLICATES,
|
||||
NULL);
|
||||
if (NULL == transfer_details)
|
||||
{
|
||||
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
|
||||
"Failed to parse transfer details `%s' at %u\n",
|
||||
cmd->details.admin_add_incoming.transfer_details,
|
||||
is->ip);
|
||||
fail (is);
|
||||
return;
|
||||
}
|
||||
execution_date = GNUNET_TIME_absolute_get ();
|
||||
GNUNET_TIME_round_abs (&execution_date);
|
||||
auth.method = TALER_BANK_AUTH_BASIC;
|
||||
auth.details.basic.username = (char *) cmd->details.admin_add_incoming.auth_username;
|
||||
auth.details.basic.password = (char *) cmd->details.admin_add_incoming.auth_password;
|
||||
cmd->details.admin_add_incoming.aih
|
||||
= TALER_EXCHANGE_admin_add_incoming (exchange,
|
||||
"http://localhost:18080/",
|
||||
&reserve_pub,
|
||||
= TALER_BANK_admin_add_incoming (ctx,
|
||||
"http://localhost:8082/", /* bank URL */
|
||||
&auth,
|
||||
"https://exchange.com/", /* exchange URL */
|
||||
subject,
|
||||
&amount,
|
||||
execution_date,
|
||||
sender_details,
|
||||
transfer_details,
|
||||
cmd->details.admin_add_incoming.debit_account_no,
|
||||
cmd->details.admin_add_incoming.credit_account_no,
|
||||
&add_incoming_cb,
|
||||
is);
|
||||
json_decref (sender_details);
|
||||
json_decref (transfer_details);
|
||||
GNUNET_free (subject);
|
||||
if (NULL == cmd->details.admin_add_incoming.aih)
|
||||
{
|
||||
GNUNET_break (0);
|
||||
fail (is);
|
||||
return;
|
||||
}
|
||||
}
|
||||
return;
|
||||
case OC_WITHDRAW_STATUS:
|
||||
GNUNET_assert (NULL !=
|
||||
@ -2869,7 +2890,7 @@ do_shutdown (void *cls)
|
||||
"Command %u (%s) did not complete\n",
|
||||
i,
|
||||
cmd->label);
|
||||
TALER_EXCHANGE_admin_add_incoming_cancel (cmd->details.admin_add_incoming.aih);
|
||||
TALER_BANK_admin_add_incoming_cancel (cmd->details.admin_add_incoming.aih);
|
||||
cmd->details.admin_add_incoming.aih = NULL;
|
||||
}
|
||||
break;
|
||||
@ -3009,6 +3030,22 @@ do_shutdown (void *cls)
|
||||
cmd->details.run_aggregator.child_death_task = NULL;
|
||||
}
|
||||
break;
|
||||
case OC_RUN_WIREWATCH:
|
||||
if (NULL != cmd->details.run_wirewatch.wirewatch_proc)
|
||||
{
|
||||
GNUNET_break (0 ==
|
||||
GNUNET_OS_process_kill (cmd->details.run_wirewatch.wirewatch_proc,
|
||||
SIGKILL));
|
||||
GNUNET_OS_process_wait (cmd->details.run_wirewatch.wirewatch_proc);
|
||||
GNUNET_OS_process_destroy (cmd->details.run_wirewatch.wirewatch_proc);
|
||||
cmd->details.run_wirewatch.wirewatch_proc = NULL;
|
||||
}
|
||||
if (NULL != cmd->details.run_wirewatch.child_death_task)
|
||||
{
|
||||
GNUNET_SCHEDULER_cancel (cmd->details.run_wirewatch.child_death_task);
|
||||
cmd->details.run_wirewatch.child_death_task = NULL;
|
||||
}
|
||||
break;
|
||||
case OC_CHECK_BANK_TRANSFER:
|
||||
GNUNET_free_non_null (cmd->details.check_bank_transfer.subject);
|
||||
cmd->details.check_bank_transfer.subject = NULL;
|
||||
@ -3190,9 +3227,14 @@ run (void *cls)
|
||||
{ .oc = OC_ADMIN_ADD_INCOMING,
|
||||
.label = "create-reserve-1",
|
||||
.expected_response_code = MHD_HTTP_OK,
|
||||
.details.admin_add_incoming.sender_details = "{ \"type\":\"test\", \"bank_uri\":\"http://localhost:8082/\", \"account_number\":42}",
|
||||
.details.admin_add_incoming.transfer_details = "{ \"uuid\":1 }",
|
||||
.details.admin_add_incoming.debit_account_no = 42,
|
||||
.details.admin_add_incoming.credit_account_no = EXCHANGE_ACCOUNT_NO,
|
||||
.details.admin_add_incoming.auth_username = "user42",
|
||||
.details.admin_add_incoming.auth_password = "pass42",
|
||||
.details.admin_add_incoming.amount = "EUR:5.01" },
|
||||
/* Run wirewatch to observe /admin/add/incoming */
|
||||
{ .oc = OC_RUN_WIREWATCH,
|
||||
.label = "wirewatch-1" },
|
||||
/* Withdraw a 5 EUR coin, at fee of 1 ct */
|
||||
{ .oc = OC_WITHDRAW_SIGN,
|
||||
.label = "withdraw-coin-1",
|
||||
@ -3255,9 +3297,14 @@ run (void *cls)
|
||||
{ .oc = OC_ADMIN_ADD_INCOMING,
|
||||
.label = "refresh-create-reserve-1",
|
||||
.expected_response_code = MHD_HTTP_OK,
|
||||
.details.admin_add_incoming.sender_details = "{ \"type\":\"test\", \"bank_uri\":\"http://localhost:8082/\", \"account_number\":424 }",
|
||||
.details.admin_add_incoming.transfer_details = "{ \"uuid\":2 }",
|
||||
.details.admin_add_incoming.debit_account_no = 424,
|
||||
.details.admin_add_incoming.credit_account_no = EXCHANGE_ACCOUNT_NO,
|
||||
.details.admin_add_incoming.auth_username = "user424",
|
||||
.details.admin_add_incoming.auth_password = "pass424",
|
||||
.details.admin_add_incoming.amount = "EUR:5.01" },
|
||||
/* Run wirewatch to observe /admin/add/incoming */
|
||||
{ .oc = OC_RUN_WIREWATCH,
|
||||
.label = "wirewatch-2" },
|
||||
/* Withdraw a 5 EUR coin, at fee of 1 ct */
|
||||
{ .oc = OC_WITHDRAW_SIGN,
|
||||
.label = "refresh-withdraw-coin-1",
|
||||
@ -3395,10 +3442,23 @@ run (void *cls)
|
||||
.details.check_bank_transfer.account_debit = 2,
|
||||
.details.check_bank_transfer.account_credit = 43
|
||||
},
|
||||
{ .oc = OC_CHECK_BANK_TRANSFER,
|
||||
.label = "check_bank_transfer-aai-1",
|
||||
.details.check_bank_transfer.exchange_base_url = "https://exchange.com/",
|
||||
.details.check_bank_transfer.amount = "EUR:5.01",
|
||||
.details.check_bank_transfer.account_debit = 42,
|
||||
.details.check_bank_transfer.account_credit = 2
|
||||
},
|
||||
{ .oc = OC_CHECK_BANK_TRANSFER,
|
||||
.label = "check_bank_transfer-aai-2",
|
||||
.details.check_bank_transfer.exchange_base_url = "https://exchange.com/",
|
||||
.details.check_bank_transfer.amount = "EUR:5.01",
|
||||
.details.check_bank_transfer.account_debit = 424,
|
||||
.details.check_bank_transfer.account_credit = 2
|
||||
},
|
||||
|
||||
{ .oc = OC_CHECK_BANK_TRANSFERS_EMPTY,
|
||||
.label = "check_bank_empty" },
|
||||
|
||||
{ .oc = OC_DEPOSIT_WTID,
|
||||
.label = "deposit-wtid-ok",
|
||||
.expected_response_code = MHD_HTTP_OK,
|
||||
@ -3428,9 +3488,14 @@ run (void *cls)
|
||||
{ .oc = OC_ADMIN_ADD_INCOMING,
|
||||
.label = "create-reserve-r1",
|
||||
.expected_response_code = MHD_HTTP_OK,
|
||||
.details.admin_add_incoming.sender_details = "{ \"type\":\"test\", \"bank_uri\":\"http://localhost:8082/\", \"account_number\":42 }",
|
||||
.details.admin_add_incoming.transfer_details = "{ \"uuid\":3 }",
|
||||
.details.admin_add_incoming.debit_account_no = 42,
|
||||
.details.admin_add_incoming.credit_account_no = EXCHANGE_ACCOUNT_NO,
|
||||
.details.admin_add_incoming.auth_username = "user42",
|
||||
.details.admin_add_incoming.auth_password = "pass42",
|
||||
.details.admin_add_incoming.amount = "EUR:5.01" },
|
||||
/* Run wirewatch to observe /admin/add/incoming */
|
||||
{ .oc = OC_RUN_WIREWATCH,
|
||||
.label = "wirewatch-3" },
|
||||
/* Withdraw a 5 EUR coin, at fee of 1 ct */
|
||||
{ .oc = OC_WITHDRAW_SIGN,
|
||||
.label = "withdraw-coin-r1",
|
||||
@ -3451,6 +3516,13 @@ run (void *cls)
|
||||
/* Run transfers. Should do nothing as refund deadline blocks it */
|
||||
{ .oc = OC_RUN_AGGREGATOR,
|
||||
.label = "run-aggregator-refund" },
|
||||
{ .oc = OC_CHECK_BANK_TRANSFER,
|
||||
.label = "check_bank_transfer-aai-3",
|
||||
.details.check_bank_transfer.exchange_base_url = "https://exchange.com/",
|
||||
.details.check_bank_transfer.amount = "EUR:5.01",
|
||||
.details.check_bank_transfer.account_debit = 42,
|
||||
.details.check_bank_transfer.account_credit = 2
|
||||
},
|
||||
/* check that aggregator didn't do anything, as expected */
|
||||
{ .oc = OC_CHECK_BANK_TRANSFERS_EMPTY,
|
||||
.label = "check-refund-not-run" },
|
||||
@ -3501,9 +3573,14 @@ run (void *cls)
|
||||
{ .oc = OC_ADMIN_ADD_INCOMING,
|
||||
.label = "payback-create-reserve-1",
|
||||
.expected_response_code = MHD_HTTP_OK,
|
||||
.details.admin_add_incoming.sender_details = "{ \"type\":\"test\", \"bank_uri\":\"http://localhost:8082/\", \"account_number\":42}",
|
||||
.details.admin_add_incoming.transfer_details = "{ \"uuid\":4 }",
|
||||
.details.admin_add_incoming.debit_account_no = 42,
|
||||
.details.admin_add_incoming.credit_account_no = EXCHANGE_ACCOUNT_NO,
|
||||
.details.admin_add_incoming.auth_username = "user42",
|
||||
.details.admin_add_incoming.auth_password = "pass42",
|
||||
.details.admin_add_incoming.amount = "EUR:5.01" },
|
||||
/* Run wirewatch to observe /admin/add/incoming */
|
||||
{ .oc = OC_RUN_WIREWATCH,
|
||||
.label = "wirewatch-4" },
|
||||
/* Withdraw a 5 EUR coin, at fee of 1 ct */
|
||||
{ .oc = OC_WITHDRAW_SIGN,
|
||||
.label = "payback-withdraw-coin-1",
|
||||
@ -3535,9 +3612,14 @@ run (void *cls)
|
||||
{ .oc = OC_ADMIN_ADD_INCOMING,
|
||||
.label = "payback-create-reserve-2",
|
||||
.expected_response_code = MHD_HTTP_OK,
|
||||
.details.admin_add_incoming.sender_details = "{ \"type\":\"test\", \"bank_uri\":\"http://localhost:8082/\", \"account_number\":42}",
|
||||
.details.admin_add_incoming.transfer_details = "{ \"uuid\":5 }",
|
||||
.details.admin_add_incoming.debit_account_no = 42,
|
||||
.details.admin_add_incoming.credit_account_no = EXCHANGE_ACCOUNT_NO,
|
||||
.details.admin_add_incoming.auth_username = "user42",
|
||||
.details.admin_add_incoming.auth_password = "pass42",
|
||||
.details.admin_add_incoming.amount = "EUR:2.02" },
|
||||
/* Run wirewatch to observe /admin/add/incoming */
|
||||
{ .oc = OC_RUN_WIREWATCH,
|
||||
.label = "wirewatch-5" },
|
||||
/* Withdraw a 1 EUR coin, at fee of 1 ct */
|
||||
{ .oc = OC_WITHDRAW_SIGN,
|
||||
.label = "payback-withdraw-coin-2a",
|
||||
@ -3596,15 +3678,62 @@ run (void *cls)
|
||||
{ .oc = OC_ADMIN_ADD_INCOMING,
|
||||
.label = "payback-create-reserve-3",
|
||||
.expected_response_code = MHD_HTTP_OK,
|
||||
.details.admin_add_incoming.sender_details = "{ \"type\":\"test\", \"bank_uri\":\"http://localhost:8082/\", \"account_number\":42}",
|
||||
.details.admin_add_incoming.transfer_details = "{ \"uuid\":6 }",
|
||||
.details.admin_add_incoming.debit_account_no = 42,
|
||||
.details.admin_add_incoming.credit_account_no = EXCHANGE_ACCOUNT_NO,
|
||||
.details.admin_add_incoming.auth_username = "user42",
|
||||
.details.admin_add_incoming.auth_password = "pass42",
|
||||
.details.admin_add_incoming.amount = "EUR:1.01" },
|
||||
/* Run wirewatch to observe /admin/add/incoming */
|
||||
{ .oc = OC_RUN_WIREWATCH,
|
||||
.label = "wirewatch-6" },
|
||||
{ .oc = OC_WITHDRAW_SIGN,
|
||||
.label = "payback-withdraw-coin-3-revoked",
|
||||
.expected_response_code = MHD_HTTP_NOT_FOUND,
|
||||
.details.reserve_withdraw.reserve_reference = "payback-create-reserve-3",
|
||||
.details.reserve_withdraw.amount = "EUR:1" },
|
||||
|
||||
/* check that we are empty before the rejection test */
|
||||
{ .oc = OC_CHECK_BANK_TRANSFER,
|
||||
.label = "check_bank_transfer-pr1",
|
||||
.details.check_bank_transfer.exchange_base_url = "https://exchange.com/",
|
||||
.details.check_bank_transfer.amount = "EUR:5.01",
|
||||
.details.check_bank_transfer.account_debit = 42,
|
||||
.details.check_bank_transfer.account_credit = 2
|
||||
},
|
||||
{ .oc = OC_CHECK_BANK_TRANSFER,
|
||||
.label = "check_bank_transfer-pr2",
|
||||
.details.check_bank_transfer.exchange_base_url = "https://exchange.com/",
|
||||
.details.check_bank_transfer.amount = "EUR:2.02",
|
||||
.details.check_bank_transfer.account_debit = 42,
|
||||
.details.check_bank_transfer.account_credit = 2
|
||||
},
|
||||
{ .oc = OC_CHECK_BANK_TRANSFER,
|
||||
.label = "check_bank_transfer-pr3",
|
||||
.details.check_bank_transfer.exchange_base_url = "https://exchange.com/",
|
||||
.details.check_bank_transfer.amount = "EUR:1.01",
|
||||
.details.check_bank_transfer.account_debit = 42,
|
||||
.details.check_bank_transfer.account_credit = 2
|
||||
},
|
||||
|
||||
{ .oc = OC_CHECK_BANK_TRANSFERS_EMPTY,
|
||||
.label = "check-empty-again" },
|
||||
|
||||
/* Test rejection of bogus wire transfers */
|
||||
{ .oc = OC_ADMIN_ADD_INCOMING,
|
||||
.label = "bogus-subject",
|
||||
.expected_response_code = MHD_HTTP_OK,
|
||||
.details.admin_add_incoming.subject = "not a reserve public key",
|
||||
.details.admin_add_incoming.debit_account_no = 42,
|
||||
.details.admin_add_incoming.credit_account_no = EXCHANGE_ACCOUNT_NO,
|
||||
.details.admin_add_incoming.auth_username = "user42",
|
||||
.details.admin_add_incoming.auth_password = "pass42",
|
||||
.details.admin_add_incoming.amount = "EUR:1.01" },
|
||||
/* Run wirewatch to observe rejection */
|
||||
{ .oc = OC_RUN_WIREWATCH,
|
||||
.label = "wirewatch-7" },
|
||||
{ .oc = OC_CHECK_BANK_TRANSFERS_EMPTY,
|
||||
.label = "check-empty-from-reject" },
|
||||
|
||||
|
||||
/* ************** End of payback API testing************* */
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user