restructure configuration, move bank account credentials from exchange-account-XXX to exchange-accountcredentials-XXX
This commit is contained in:
parent
06676e72cb
commit
ba3f70390a
@ -73,6 +73,8 @@ CURRENCY_ROUND_UNIT = TESTKUDOS:0.01
|
|||||||
PAYTO_URI = payto://x-taler-bank/localhost/Exchange
|
PAYTO_URI = payto://x-taler-bank/localhost/Exchange
|
||||||
enable_debit = yes
|
enable_debit = yes
|
||||||
enable_credit = yes
|
enable_credit = yes
|
||||||
|
|
||||||
|
[exchange-accountcredentials-1]
|
||||||
WIRE_GATEWAY_URL = "http://localhost:8082/taler-wire-gateway/Exchange/"
|
WIRE_GATEWAY_URL = "http://localhost:8082/taler-wire-gateway/Exchange/"
|
||||||
WIRE_GATEWAY_AUTH_METHOD = basic
|
WIRE_GATEWAY_AUTH_METHOD = basic
|
||||||
USERNAME = Exchange
|
USERNAME = Exchange
|
||||||
|
@ -68,14 +68,9 @@ struct WireAccount
|
|||||||
struct WireAccount *prev;
|
struct WireAccount *prev;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Authentication data for the account.
|
* Account details.
|
||||||
*/
|
*/
|
||||||
struct TALER_BANK_AuthenticationData auth;
|
const struct TALER_EXCHANGEDB_AccountInfo *ai;
|
||||||
|
|
||||||
/**
|
|
||||||
* Name of the section that configures this account.
|
|
||||||
*/
|
|
||||||
char *section_name;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Active wire request for the transaction history.
|
* Active wire request for the transaction history.
|
||||||
@ -107,16 +102,6 @@ struct WireAccount
|
|||||||
*/
|
*/
|
||||||
uint64_t out_wire_off;
|
uint64_t out_wire_off;
|
||||||
|
|
||||||
/**
|
|
||||||
* We should check for inbound transactions to this account.
|
|
||||||
*/
|
|
||||||
int watch_credit;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* We should check for outbound transactions from this account.
|
|
||||||
*/
|
|
||||||
int watch_debit;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return value when we got this account's progress point.
|
* Return value when we got this account's progress point.
|
||||||
*/
|
*/
|
||||||
@ -573,8 +558,6 @@ do_shutdown (void *cls)
|
|||||||
GNUNET_CONTAINER_DLL_remove (wa_head,
|
GNUNET_CONTAINER_DLL_remove (wa_head,
|
||||||
wa_tail,
|
wa_tail,
|
||||||
wa);
|
wa);
|
||||||
TALER_BANK_auth_free (&wa->auth);
|
|
||||||
GNUNET_free (wa->section_name);
|
|
||||||
GNUNET_free (wa);
|
GNUNET_free (wa);
|
||||||
}
|
}
|
||||||
if (NULL != ctx)
|
if (NULL != ctx)
|
||||||
@ -587,6 +570,8 @@ do_shutdown (void *cls)
|
|||||||
GNUNET_CURL_gnunet_rc_destroy (rc);
|
GNUNET_CURL_gnunet_rc_destroy (rc);
|
||||||
rc = NULL;
|
rc = NULL;
|
||||||
}
|
}
|
||||||
|
TALER_EXCHANGEDB_unload_accounts ();
|
||||||
|
TALER_ARL_cfg = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -688,28 +673,28 @@ commit (enum GNUNET_DB_QueryStatus qs)
|
|||||||
NULL != wa;
|
NULL != wa;
|
||||||
wa = wa->next)
|
wa = wa->next)
|
||||||
{
|
{
|
||||||
GNUNET_assert (0 ==
|
GNUNET_assert (
|
||||||
json_array_append_new (
|
0 ==
|
||||||
report_account_progress,
|
json_array_append_new (
|
||||||
GNUNET_JSON_PACK (
|
report_account_progress,
|
||||||
GNUNET_JSON_pack_string ("account",
|
GNUNET_JSON_PACK (
|
||||||
wa->section_name),
|
GNUNET_JSON_pack_string ("account",
|
||||||
GNUNET_JSON_pack_uint64 ("start_reserve_in",
|
wa->ai->section_name),
|
||||||
wa->start_pp.
|
GNUNET_JSON_pack_uint64 ("start_reserve_in",
|
||||||
last_reserve_in_serial_id),
|
wa->start_pp.last_reserve_in_serial_id),
|
||||||
GNUNET_JSON_pack_uint64 ("end_reserve_in",
|
GNUNET_JSON_pack_uint64 ("end_reserve_in",
|
||||||
wa->pp.last_reserve_in_serial_id),
|
wa->pp.last_reserve_in_serial_id),
|
||||||
GNUNET_JSON_pack_uint64 ("start_wire_out",
|
GNUNET_JSON_pack_uint64 ("start_wire_out",
|
||||||
wa->start_pp.
|
wa->start_pp.
|
||||||
last_wire_out_serial_id),
|
last_wire_out_serial_id),
|
||||||
GNUNET_JSON_pack_uint64 ("end_wire_out",
|
GNUNET_JSON_pack_uint64 ("end_wire_out",
|
||||||
wa->pp.last_wire_out_serial_id))));
|
wa->pp.last_wire_out_serial_id))));
|
||||||
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == wa->qsx)
|
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == wa->qsx)
|
||||||
qs = TALER_ARL_adb->update_wire_auditor_account_progress (
|
qs = TALER_ARL_adb->update_wire_auditor_account_progress (
|
||||||
TALER_ARL_adb->cls,
|
TALER_ARL_adb->cls,
|
||||||
TALER_ARL_asession,
|
TALER_ARL_asession,
|
||||||
&TALER_ARL_master_pub,
|
&TALER_ARL_master_pub,
|
||||||
wa->section_name,
|
wa->ai->section_name,
|
||||||
&wa->pp,
|
&wa->pp,
|
||||||
wa->in_wire_off,
|
wa->in_wire_off,
|
||||||
wa->out_wire_off);
|
wa->out_wire_off);
|
||||||
@ -718,7 +703,7 @@ commit (enum GNUNET_DB_QueryStatus qs)
|
|||||||
TALER_ARL_adb->cls,
|
TALER_ARL_adb->cls,
|
||||||
TALER_ARL_asession,
|
TALER_ARL_asession,
|
||||||
&TALER_ARL_master_pub,
|
&TALER_ARL_master_pub,
|
||||||
wa->section_name,
|
wa->ai->section_name,
|
||||||
&wa->pp,
|
&wa->pp,
|
||||||
wa->in_wire_off,
|
wa->in_wire_off,
|
||||||
wa->out_wire_off);
|
wa->out_wire_off);
|
||||||
@ -893,7 +878,7 @@ check_for_required_transfers (void)
|
|||||||
if (0 > qs)
|
if (0 > qs)
|
||||||
{
|
{
|
||||||
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
|
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
|
||||||
global_ret = 1;
|
global_ret = EXIT_FAILURE;
|
||||||
GNUNET_SCHEDULER_shutdown ();
|
GNUNET_SCHEDULER_shutdown ();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1016,7 +1001,7 @@ wire_out_cb (void *cls,
|
|||||||
GNUNET_JSON_pack_string ("diagnostic",
|
GNUNET_JSON_pack_string ("diagnostic",
|
||||||
"wire transfer not made (yet?)"),
|
"wire transfer not made (yet?)"),
|
||||||
GNUNET_JSON_pack_string ("account_section",
|
GNUNET_JSON_pack_string ("account_section",
|
||||||
wa->section_name)));
|
wa->ai->section_name)));
|
||||||
TALER_ARL_amount_add (&total_bad_amount_out_minus,
|
TALER_ARL_amount_add (&total_bad_amount_out_minus,
|
||||||
&total_bad_amount_out_minus,
|
&total_bad_amount_out_minus,
|
||||||
amount);
|
amount);
|
||||||
@ -1050,7 +1035,7 @@ wire_out_cb (void *cls,
|
|||||||
GNUNET_JSON_pack_string ("target",
|
GNUNET_JSON_pack_string ("target",
|
||||||
payto_uri),
|
payto_uri),
|
||||||
GNUNET_JSON_pack_string ("account_section",
|
GNUNET_JSON_pack_string ("account_section",
|
||||||
wa->section_name)));
|
wa->ai->section_name)));
|
||||||
TALER_ARL_amount_add (&total_bad_amount_out_plus,
|
TALER_ARL_amount_add (&total_bad_amount_out_plus,
|
||||||
&total_bad_amount_out_plus,
|
&total_bad_amount_out_plus,
|
||||||
&roi->details.amount);
|
&roi->details.amount);
|
||||||
@ -1072,7 +1057,7 @@ wire_out_cb (void *cls,
|
|||||||
roi->details.
|
roi->details.
|
||||||
credit_account_url),
|
credit_account_url),
|
||||||
GNUNET_JSON_pack_string ("account_section",
|
GNUNET_JSON_pack_string ("account_section",
|
||||||
wa->section_name)));
|
wa->ai->section_name)));
|
||||||
TALER_ARL_amount_add (&total_bad_amount_out_minus,
|
TALER_ARL_amount_add (&total_bad_amount_out_minus,
|
||||||
&total_bad_amount_out_minus,
|
&total_bad_amount_out_minus,
|
||||||
amount);
|
amount);
|
||||||
@ -1099,7 +1084,7 @@ wire_out_cb (void *cls,
|
|||||||
GNUNET_JSON_pack_string ("diagnostic",
|
GNUNET_JSON_pack_string ("diagnostic",
|
||||||
"wire amount does not match"),
|
"wire amount does not match"),
|
||||||
GNUNET_JSON_pack_string ("account_section",
|
GNUNET_JSON_pack_string ("account_section",
|
||||||
wa->section_name)));
|
wa->ai->section_name)));
|
||||||
if (0 < TALER_amount_cmp (amount,
|
if (0 < TALER_amount_cmp (amount,
|
||||||
&roi->details.amount))
|
&roi->details.amount))
|
||||||
{
|
{
|
||||||
@ -1156,9 +1141,9 @@ struct CheckMatchContext
|
|||||||
const struct ReserveOutInfo *roi;
|
const struct ReserveOutInfo *roi;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set to #GNUNET_YES if we found a match.
|
* Set to true if we found a match.
|
||||||
*/
|
*/
|
||||||
int found;
|
bool found;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -1188,7 +1173,7 @@ check_rc_matches (void *cls,
|
|||||||
rc->rowid,
|
rc->rowid,
|
||||||
rc->execution_date,
|
rc->execution_date,
|
||||||
ctx->roi->details.execution_date);
|
ctx->roi->details.execution_date);
|
||||||
ctx->found = GNUNET_YES;
|
ctx->found = true;
|
||||||
free_rc (NULL,
|
free_rc (NULL,
|
||||||
key,
|
key,
|
||||||
rc);
|
rc);
|
||||||
@ -1218,7 +1203,7 @@ complain_out_not_found (void *cls,
|
|||||||
struct GNUNET_HashCode rkey;
|
struct GNUNET_HashCode rkey;
|
||||||
struct CheckMatchContext ctx = {
|
struct CheckMatchContext ctx = {
|
||||||
.roi = roi,
|
.roi = roi,
|
||||||
.found = GNUNET_NO
|
.found = false
|
||||||
};
|
};
|
||||||
|
|
||||||
(void) key;
|
(void) key;
|
||||||
@ -1229,7 +1214,7 @@ complain_out_not_found (void *cls,
|
|||||||
&rkey,
|
&rkey,
|
||||||
&check_rc_matches,
|
&check_rc_matches,
|
||||||
&ctx);
|
&ctx);
|
||||||
if (GNUNET_YES == ctx.found)
|
if (ctx.found)
|
||||||
return GNUNET_OK;
|
return GNUNET_OK;
|
||||||
TALER_ARL_report (report_wire_out_inconsistencies,
|
TALER_ARL_report (report_wire_out_inconsistencies,
|
||||||
GNUNET_JSON_PACK (
|
GNUNET_JSON_PACK (
|
||||||
@ -1245,7 +1230,7 @@ complain_out_not_found (void *cls,
|
|||||||
roi->details.
|
roi->details.
|
||||||
execution_date),
|
execution_date),
|
||||||
GNUNET_JSON_pack_string ("account_section",
|
GNUNET_JSON_pack_string ("account_section",
|
||||||
wa->section_name),
|
wa->ai->section_name),
|
||||||
GNUNET_JSON_pack_string ("diagnostic",
|
GNUNET_JSON_pack_string ("diagnostic",
|
||||||
"justification for wire transfer not found")));
|
"justification for wire transfer not found")));
|
||||||
TALER_ARL_amount_add (&total_bad_amount_out_plus,
|
TALER_ARL_amount_add (&total_bad_amount_out_plus,
|
||||||
@ -1279,18 +1264,18 @@ check_exchange_wire_out (struct WireAccount *wa)
|
|||||||
|
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
||||||
"Analyzing exchange's wire OUT table for account `%s'\n",
|
"Analyzing exchange's wire OUT table for account `%s'\n",
|
||||||
wa->section_name);
|
wa->ai->section_name);
|
||||||
qs = TALER_ARL_edb->select_wire_out_above_serial_id_by_account (
|
qs = TALER_ARL_edb->select_wire_out_above_serial_id_by_account (
|
||||||
TALER_ARL_edb->cls,
|
TALER_ARL_edb->cls,
|
||||||
TALER_ARL_esession,
|
TALER_ARL_esession,
|
||||||
wa->section_name,
|
wa->ai->section_name,
|
||||||
wa->pp.last_wire_out_serial_id,
|
wa->pp.last_wire_out_serial_id,
|
||||||
&wire_out_cb,
|
&wire_out_cb,
|
||||||
wa);
|
wa);
|
||||||
if (0 > qs)
|
if (0 > qs)
|
||||||
{
|
{
|
||||||
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
|
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
|
||||||
global_ret = 1;
|
global_ret = EXIT_FAILURE;
|
||||||
GNUNET_SCHEDULER_shutdown ();
|
GNUNET_SCHEDULER_shutdown ();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1338,11 +1323,11 @@ history_debit_cb (void *cls,
|
|||||||
{
|
{
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
|
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
|
||||||
"Error fetching debit history of account %s: %u/%u!\n",
|
"Error fetching debit history of account %s: %u/%u!\n",
|
||||||
wa->section_name,
|
wa->ai->section_name,
|
||||||
http_status_code,
|
http_status_code,
|
||||||
(unsigned int) ec);
|
(unsigned int) ec);
|
||||||
commit (GNUNET_DB_STATUS_HARD_ERROR);
|
commit (GNUNET_DB_STATUS_HARD_ERROR);
|
||||||
global_ret = 1;
|
global_ret = EXIT_FAILURE;
|
||||||
GNUNET_SCHEDULER_shutdown ();
|
GNUNET_SCHEDULER_shutdown ();
|
||||||
return GNUNET_SYSERR;
|
return GNUNET_SYSERR;
|
||||||
}
|
}
|
||||||
@ -1412,7 +1397,7 @@ process_debits (void *cls)
|
|||||||
|
|
||||||
/* skip accounts where DEBIT is not enabled */
|
/* skip accounts where DEBIT is not enabled */
|
||||||
while ( (NULL != wa) &&
|
while ( (NULL != wa) &&
|
||||||
(GNUNET_NO == wa->watch_debit) )
|
(GNUNET_NO == wa->ai->debit_enabled) )
|
||||||
wa = wa->next;
|
wa = wa->next;
|
||||||
if (NULL == wa)
|
if (NULL == wa)
|
||||||
{
|
{
|
||||||
@ -1423,10 +1408,10 @@ process_debits (void *cls)
|
|||||||
}
|
}
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
||||||
"Checking bank DEBIT records of account `%s'\n",
|
"Checking bank DEBIT records of account `%s'\n",
|
||||||
wa->section_name);
|
wa->ai->section_name);
|
||||||
GNUNET_assert (NULL == wa->dhh);
|
GNUNET_assert (NULL == wa->dhh);
|
||||||
wa->dhh = TALER_BANK_debit_history (ctx,
|
wa->dhh = TALER_BANK_debit_history (ctx,
|
||||||
&wa->auth,
|
wa->ai->auth,
|
||||||
wa->out_wire_off,
|
wa->out_wire_off,
|
||||||
INT64_MAX,
|
INT64_MAX,
|
||||||
&history_debit_cb,
|
&history_debit_cb,
|
||||||
@ -1435,9 +1420,9 @@ process_debits (void *cls)
|
|||||||
{
|
{
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
|
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
|
||||||
"Failed to obtain bank transaction history for `%s'\n",
|
"Failed to obtain bank transaction history for `%s'\n",
|
||||||
wa->section_name);
|
wa->ai->section_name);
|
||||||
commit (GNUNET_DB_STATUS_HARD_ERROR);
|
commit (GNUNET_DB_STATUS_HARD_ERROR);
|
||||||
global_ret = 1;
|
global_ret = EXIT_FAILURE;
|
||||||
GNUNET_SCHEDULER_shutdown ();
|
GNUNET_SCHEDULER_shutdown ();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1577,7 +1562,7 @@ complain_in_not_found (void *cls,
|
|||||||
rii->details.
|
rii->details.
|
||||||
execution_date),
|
execution_date),
|
||||||
GNUNET_JSON_pack_string ("account",
|
GNUNET_JSON_pack_string ("account",
|
||||||
wa->section_name),
|
wa->ai->section_name),
|
||||||
GNUNET_JSON_pack_string ("diagnostic",
|
GNUNET_JSON_pack_string ("diagnostic",
|
||||||
"incoming wire transfer claimed by exchange not found")));
|
"incoming wire transfer claimed by exchange not found")));
|
||||||
TALER_ARL_amount_add (&total_bad_amount_in_minus,
|
TALER_ARL_amount_add (&total_bad_amount_in_minus,
|
||||||
@ -1629,19 +1614,19 @@ history_credit_cb (void *cls,
|
|||||||
if (TALER_EC_NONE != ec)
|
if (TALER_EC_NONE != ec)
|
||||||
{
|
{
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
|
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
|
||||||
"Error fetching credit history of account %s: %u/%u!\n",
|
"Error fetching credit history of account %s: %u/%s!\n",
|
||||||
wa->section_name,
|
wa->ai->section_name,
|
||||||
http_status,
|
http_status,
|
||||||
(unsigned int) ec);
|
TALER_ErrorCode_get_hint (ec));
|
||||||
commit (GNUNET_DB_STATUS_HARD_ERROR);
|
commit (GNUNET_DB_STATUS_HARD_ERROR);
|
||||||
global_ret = 1;
|
global_ret = EXIT_FAILURE;
|
||||||
GNUNET_SCHEDULER_shutdown ();
|
GNUNET_SCHEDULER_shutdown ();
|
||||||
return GNUNET_SYSERR;
|
return GNUNET_SYSERR;
|
||||||
}
|
}
|
||||||
/* end of operation */
|
/* end of operation */
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
||||||
"Reconciling CREDIT processing of account `%s'\n",
|
"Reconciling CREDIT processing of account `%s'\n",
|
||||||
wa->section_name);
|
wa->ai->section_name);
|
||||||
GNUNET_CONTAINER_multihashmap_iterate (in_map,
|
GNUNET_CONTAINER_multihashmap_iterate (in_map,
|
||||||
&complain_in_not_found,
|
&complain_in_not_found,
|
||||||
wa);
|
wa);
|
||||||
@ -1825,7 +1810,7 @@ process_credits (void *cls)
|
|||||||
|
|
||||||
/* skip accounts where CREDIT is not enabled */
|
/* skip accounts where CREDIT is not enabled */
|
||||||
while ( (NULL != wa) &&
|
while ( (NULL != wa) &&
|
||||||
(GNUNET_NO == wa->watch_credit) )
|
(GNUNET_NO == wa->ai->credit_enabled) )
|
||||||
wa = wa->next;
|
wa = wa->next;
|
||||||
if (NULL == wa)
|
if (NULL == wa)
|
||||||
{
|
{
|
||||||
@ -1835,27 +1820,27 @@ process_credits (void *cls)
|
|||||||
}
|
}
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
||||||
"Analyzing exchange's wire IN table for account `%s'\n",
|
"Analyzing exchange's wire IN table for account `%s'\n",
|
||||||
wa->section_name);
|
wa->ai->section_name);
|
||||||
qs = TALER_ARL_edb->select_reserves_in_above_serial_id_by_account (
|
qs = TALER_ARL_edb->select_reserves_in_above_serial_id_by_account (
|
||||||
TALER_ARL_edb->cls,
|
TALER_ARL_edb->cls,
|
||||||
TALER_ARL_esession,
|
TALER_ARL_esession,
|
||||||
wa->section_name,
|
wa->ai->section_name,
|
||||||
wa->pp.last_reserve_in_serial_id,
|
wa->pp.last_reserve_in_serial_id,
|
||||||
&reserve_in_cb,
|
&reserve_in_cb,
|
||||||
wa);
|
wa);
|
||||||
if (0 > qs)
|
if (0 > qs)
|
||||||
{
|
{
|
||||||
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
|
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
|
||||||
global_ret = 1;
|
global_ret = EXIT_FAILURE;
|
||||||
GNUNET_SCHEDULER_shutdown ();
|
GNUNET_SCHEDULER_shutdown ();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
|
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
|
||||||
"Starting bank CREDIT history of account `%s'\n",
|
"Starting bank CREDIT history of account `%s'\n",
|
||||||
wa->section_name);
|
wa->ai->section_name);
|
||||||
wa->chh = TALER_BANK_credit_history (ctx,
|
wa->chh = TALER_BANK_credit_history (ctx,
|
||||||
&wa->auth,
|
wa->ai->auth,
|
||||||
wa->in_wire_off,
|
wa->in_wire_off,
|
||||||
INT64_MAX,
|
INT64_MAX,
|
||||||
&history_credit_cb,
|
&history_credit_cb,
|
||||||
@ -1865,7 +1850,7 @@ process_credits (void *cls)
|
|||||||
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
|
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
|
||||||
"Failed to obtain bank transaction history\n");
|
"Failed to obtain bank transaction history\n");
|
||||||
commit (GNUNET_DB_STATUS_HARD_ERROR);
|
commit (GNUNET_DB_STATUS_HARD_ERROR);
|
||||||
global_ret = 1;
|
global_ret = EXIT_FAILURE;
|
||||||
GNUNET_SCHEDULER_shutdown ();
|
GNUNET_SCHEDULER_shutdown ();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -2005,7 +1990,7 @@ begin_transaction (void)
|
|||||||
TALER_ARL_adb->cls,
|
TALER_ARL_adb->cls,
|
||||||
TALER_ARL_asession,
|
TALER_ARL_asession,
|
||||||
&TALER_ARL_master_pub,
|
&TALER_ARL_master_pub,
|
||||||
wa->section_name,
|
wa->ai->section_name,
|
||||||
&wa->pp,
|
&wa->pp,
|
||||||
&wa->in_wire_off,
|
&wa->in_wire_off,
|
||||||
&wa->out_wire_off);
|
&wa->out_wire_off);
|
||||||
@ -2074,31 +2059,14 @@ process_account_cb (void *cls,
|
|||||||
struct WireAccount *wa;
|
struct WireAccount *wa;
|
||||||
|
|
||||||
(void) cls;
|
(void) cls;
|
||||||
if ( (GNUNET_NO == ai->debit_enabled) &&
|
if ( (! ai->debit_enabled) &&
|
||||||
(GNUNET_NO == ai->credit_enabled) )
|
(! ai->credit_enabled) )
|
||||||
return; /* not an active exchange account */
|
return; /* not an active exchange account */
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
||||||
"Found exchange account `%s'\n",
|
"Found exchange account `%s'\n",
|
||||||
ai->section_name);
|
ai->section_name);
|
||||||
wa = GNUNET_new (struct WireAccount);
|
wa = GNUNET_new (struct WireAccount);
|
||||||
wa->section_name = GNUNET_strdup (ai->section_name);
|
wa->ai = ai;
|
||||||
wa->watch_debit = ai->debit_enabled;
|
|
||||||
wa->watch_credit = ai->credit_enabled;
|
|
||||||
if (GNUNET_OK !=
|
|
||||||
TALER_BANK_auth_parse_cfg (TALER_ARL_cfg,
|
|
||||||
ai->section_name,
|
|
||||||
&wa->auth))
|
|
||||||
{
|
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
|
|
||||||
"Failed to access bank account `%s'\n",
|
|
||||||
wa->section_name);
|
|
||||||
GNUNET_break (0);
|
|
||||||
GNUNET_free (wa->section_name);
|
|
||||||
GNUNET_free (wa);
|
|
||||||
global_ret = 1;
|
|
||||||
GNUNET_SCHEDULER_shutdown ();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
GNUNET_CONTAINER_DLL_insert (wa_head,
|
GNUNET_CONTAINER_DLL_insert (wa_head,
|
||||||
wa_tail,
|
wa_tail,
|
||||||
wa);
|
wa);
|
||||||
@ -2127,7 +2095,7 @@ run (void *cls,
|
|||||||
if (GNUNET_OK !=
|
if (GNUNET_OK !=
|
||||||
TALER_ARL_init (c))
|
TALER_ARL_init (c))
|
||||||
{
|
{
|
||||||
global_ret = 1;
|
global_ret = EXIT_FAILURE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (GNUNET_OK !=
|
if (GNUNET_OK !=
|
||||||
@ -2136,7 +2104,7 @@ run (void *cls,
|
|||||||
"TINY_AMOUNT",
|
"TINY_AMOUNT",
|
||||||
&tiny_amount))
|
&tiny_amount))
|
||||||
{
|
{
|
||||||
global_ret = 1;
|
global_ret = EXIT_NOTCONFIGURED;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
GNUNET_SCHEDULER_add_shutdown (&do_shutdown,
|
GNUNET_SCHEDULER_add_shutdown (&do_shutdown,
|
||||||
@ -2147,6 +2115,7 @@ run (void *cls,
|
|||||||
if (NULL == ctx)
|
if (NULL == ctx)
|
||||||
{
|
{
|
||||||
GNUNET_break (0);
|
GNUNET_break (0);
|
||||||
|
global_ret = EXIT_FAILURE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
reserve_closures = GNUNET_CONTAINER_multihashmap_create (1024,
|
reserve_closures = GNUNET_CONTAINER_multihashmap_create (1024,
|
||||||
@ -2198,13 +2167,24 @@ run (void *cls,
|
|||||||
GNUNET_assert (GNUNET_OK ==
|
GNUNET_assert (GNUNET_OK ==
|
||||||
TALER_amount_set_zero (TALER_ARL_currency,
|
TALER_amount_set_zero (TALER_ARL_currency,
|
||||||
&zero));
|
&zero));
|
||||||
TALER_EXCHANGEDB_find_accounts (TALER_ARL_cfg,
|
if (GNUNET_OK !=
|
||||||
&process_account_cb,
|
TALER_EXCHANGEDB_load_accounts (TALER_ARL_cfg,
|
||||||
|
TALER_EXCHANGEDB_ALO_DEBIT
|
||||||
|
| TALER_EXCHANGEDB_ALO_CREDIT
|
||||||
|
| TALER_EXCHANGEDB_ALO_AUTHDATA))
|
||||||
|
{
|
||||||
|
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
|
||||||
|
"No bank accounts configured\n");
|
||||||
|
global_ret = EXIT_NOTCONFIGURED;
|
||||||
|
GNUNET_SCHEDULER_shutdown ();
|
||||||
|
}
|
||||||
|
TALER_EXCHANGEDB_find_accounts (&process_account_cb,
|
||||||
NULL);
|
NULL);
|
||||||
if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS !=
|
if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS !=
|
||||||
begin_transaction ())
|
begin_transaction ())
|
||||||
{
|
{
|
||||||
global_ret = 1;
|
GNUNET_break (0);
|
||||||
|
global_ret = EXIT_FAILURE;
|
||||||
GNUNET_SCHEDULER_shutdown ();
|
GNUNET_SCHEDULER_shutdown ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2246,7 +2226,7 @@ main (int argc,
|
|||||||
if (GNUNET_OK !=
|
if (GNUNET_OK !=
|
||||||
GNUNET_STRINGS_get_utf8_args (argc, argv,
|
GNUNET_STRINGS_get_utf8_args (argc, argv,
|
||||||
&argc, &argv))
|
&argc, &argv))
|
||||||
return 4;
|
return EXIT_INVALIDARGUMENT;
|
||||||
ret = GNUNET_PROGRAM_run (
|
ret = GNUNET_PROGRAM_run (
|
||||||
argc,
|
argc,
|
||||||
argv,
|
argv,
|
||||||
@ -2258,9 +2238,9 @@ main (int argc,
|
|||||||
NULL);
|
NULL);
|
||||||
GNUNET_free_nz ((void *) argv);
|
GNUNET_free_nz ((void *) argv);
|
||||||
if (GNUNET_SYSERR == ret)
|
if (GNUNET_SYSERR == ret)
|
||||||
return 3;
|
return EXIT_INVALIDARGUMENT;
|
||||||
if (GNUNET_NO == ret)
|
if (GNUNET_NO == ret)
|
||||||
return 0;
|
return EXIT_SUCCESS;
|
||||||
return global_ret;
|
return global_ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,6 +7,8 @@ BASE_URL = http://localhost:8083/
|
|||||||
PAYTO_URI = payto://x-taler-bank/localhost/Exchange
|
PAYTO_URI = payto://x-taler-bank/localhost/Exchange
|
||||||
enable_debit = yes
|
enable_debit = yes
|
||||||
enable_credit = yes
|
enable_credit = yes
|
||||||
|
|
||||||
|
[exchange-accountcredentials-1]
|
||||||
WIRE_GATEWAY_URL = "http://localhost:8082/taler-wire-gateway/Exchange/"
|
WIRE_GATEWAY_URL = "http://localhost:8082/taler-wire-gateway/Exchange/"
|
||||||
WIRE_GATEWAY_AUTH_METHOD = basic
|
WIRE_GATEWAY_AUTH_METHOD = basic
|
||||||
USERNAME = Exchange
|
USERNAME = Exchange
|
||||||
|
@ -56,6 +56,10 @@ USER_PAYTO_URI = payto://x-taler-bank/localhost:8082/42
|
|||||||
[exchange-account-2]
|
[exchange-account-2]
|
||||||
# What is the payto://-URL of the exchange (to generate wire response)
|
# What is the payto://-URL of the exchange (to generate wire response)
|
||||||
PAYTO_URI = "payto://x-taler-bank/localhost:8082/Exchange"
|
PAYTO_URI = "payto://x-taler-bank/localhost:8082/Exchange"
|
||||||
|
enable_debit = YES
|
||||||
|
enable_credit = YES
|
||||||
|
|
||||||
|
[exchange-accountcredentials-2]
|
||||||
# What is the bank account (with the "Taler Bank" demo system)? Must end with "/".
|
# What is the bank account (with the "Taler Bank" demo system)? Must end with "/".
|
||||||
WIRE_GATEWAY_URL = http://localhost:8082/Exchange/
|
WIRE_GATEWAY_URL = http://localhost:8082/Exchange/
|
||||||
# Authentication information for basic authentication
|
# Authentication information for basic authentication
|
||||||
@ -63,8 +67,6 @@ WIRE_GATEWAY_AUTH_METHOD = "basic"
|
|||||||
username = Exchange
|
username = Exchange
|
||||||
password = x
|
password = x
|
||||||
|
|
||||||
enable_debit = YES
|
|
||||||
enable_credit = YES
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -56,6 +56,10 @@ USER_PAYTO_URI = payto://x-taler-bank/localhost:8082/42
|
|||||||
[exchange-account-2]
|
[exchange-account-2]
|
||||||
# What is the payto://-URL of the exchange (to generate wire response)
|
# What is the payto://-URL of the exchange (to generate wire response)
|
||||||
PAYTO_URI = "payto://x-taler-bank/localhost:8082/Exchange"
|
PAYTO_URI = "payto://x-taler-bank/localhost:8082/Exchange"
|
||||||
|
enable_debit = YES
|
||||||
|
enable_credit = YES
|
||||||
|
|
||||||
|
[exchange-accountcredentials-2]
|
||||||
# What is the bank account (with the "Taler Bank" demo system)? Must end with "/".
|
# What is the bank account (with the "Taler Bank" demo system)? Must end with "/".
|
||||||
WIRE_GATEWAY_URL = http://localhost:8082/taler-wire-gateway/Exchange/
|
WIRE_GATEWAY_URL = http://localhost:8082/taler-wire-gateway/Exchange/
|
||||||
# Authentication information for basic authentication
|
# Authentication information for basic authentication
|
||||||
@ -63,8 +67,6 @@ WIRE_GATEWAY_AUTH_METHOD = "basic"
|
|||||||
username = Exchange
|
username = Exchange
|
||||||
password = x
|
password = x
|
||||||
|
|
||||||
enable_debit = YES
|
|
||||||
enable_credit = YES
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
This file is part of TALER
|
This file is part of TALER
|
||||||
Copyright (C) 2016-2020 Taler Systems SA
|
Copyright (C) 2016-2021 Taler Systems SA
|
||||||
|
|
||||||
TALER is free software; you can redistribute it and/or modify it under the
|
TALER is free software; you can redistribute it and/or modify it under the
|
||||||
terms of the GNU Affero General Public License as published by the Free Software
|
terms of the GNU Affero General Public License as published by the Free Software
|
||||||
@ -87,7 +87,7 @@ struct AggregationUnit
|
|||||||
* Exchange wire account to be used for the preparation and
|
* Exchange wire account to be used for the preparation and
|
||||||
* eventual execution of the aggregate wire transfer.
|
* eventual execution of the aggregate wire transfer.
|
||||||
*/
|
*/
|
||||||
struct TALER_EXCHANGEDB_WireAccount *wa;
|
const struct TALER_EXCHANGEDB_AccountInfo *wa;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Database session for all of our transactions.
|
* Database session for all of our transactions.
|
||||||
@ -262,7 +262,8 @@ parse_wirewatch_config (void)
|
|||||||
return GNUNET_SYSERR;
|
return GNUNET_SYSERR;
|
||||||
}
|
}
|
||||||
if (GNUNET_OK !=
|
if (GNUNET_OK !=
|
||||||
TALER_EXCHANGEDB_load_accounts (cfg))
|
TALER_EXCHANGEDB_load_accounts (cfg,
|
||||||
|
TALER_EXCHANGEDB_ALO_DEBIT))
|
||||||
{
|
{
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
|
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
|
||||||
"No wire accounts configured for debit!\n");
|
"No wire accounts configured for debit!\n");
|
||||||
|
@ -158,7 +158,8 @@ parse_wirewatch_config (void)
|
|||||||
return GNUNET_SYSERR;
|
return GNUNET_SYSERR;
|
||||||
}
|
}
|
||||||
if (GNUNET_OK !=
|
if (GNUNET_OK !=
|
||||||
TALER_EXCHANGEDB_load_accounts (cfg))
|
TALER_EXCHANGEDB_load_accounts (cfg,
|
||||||
|
TALER_EXCHANGEDB_ALO_DEBIT))
|
||||||
{
|
{
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
|
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
|
||||||
"No wire accounts configured for debit!\n");
|
"No wire accounts configured for debit!\n");
|
||||||
@ -236,7 +237,7 @@ expired_reserve_cb (void *cls,
|
|||||||
struct TALER_Amount closing_fee;
|
struct TALER_Amount closing_fee;
|
||||||
int ret;
|
int ret;
|
||||||
enum GNUNET_DB_QueryStatus qs;
|
enum GNUNET_DB_QueryStatus qs;
|
||||||
struct TALER_EXCHANGEDB_WireAccount *wa;
|
const struct TALER_EXCHANGEDB_AccountInfo *wa;
|
||||||
|
|
||||||
/* NOTE: potential optimization: use custom SQL API to not
|
/* NOTE: potential optimization: use custom SQL API to not
|
||||||
fetch this: */
|
fetch this: */
|
||||||
|
@ -50,7 +50,7 @@ struct WirePrepareData
|
|||||||
/**
|
/**
|
||||||
* Wire account used for this preparation.
|
* Wire account used for this preparation.
|
||||||
*/
|
*/
|
||||||
struct TALER_EXCHANGEDB_WireAccount *wa;
|
const struct TALER_EXCHANGEDB_AccountInfo *wa;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Row ID of the transfer.
|
* Row ID of the transfer.
|
||||||
@ -179,7 +179,9 @@ parse_wirewatch_config (void)
|
|||||||
return GNUNET_SYSERR;
|
return GNUNET_SYSERR;
|
||||||
}
|
}
|
||||||
if (GNUNET_OK !=
|
if (GNUNET_OK !=
|
||||||
TALER_EXCHANGEDB_load_accounts (cfg))
|
TALER_EXCHANGEDB_load_accounts (cfg,
|
||||||
|
TALER_EXCHANGEDB_ALO_DEBIT
|
||||||
|
| TALER_EXCHANGEDB_ALO_AUTHDATA))
|
||||||
{
|
{
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
|
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
|
||||||
"No wire accounts configured for debit!\n");
|
"No wire accounts configured for debit!\n");
|
||||||
@ -353,7 +355,7 @@ wire_prepare_cb (void *cls,
|
|||||||
const char *buf,
|
const char *buf,
|
||||||
size_t buf_size)
|
size_t buf_size)
|
||||||
{
|
{
|
||||||
struct TALER_EXCHANGEDB_WireAccount *wa;
|
const struct TALER_EXCHANGEDB_AccountInfo *wa;
|
||||||
|
|
||||||
(void) cls;
|
(void) cls;
|
||||||
if ( (NULL == wire_method) ||
|
if ( (NULL == wire_method) ||
|
||||||
@ -382,7 +384,7 @@ wire_prepare_cb (void *cls,
|
|||||||
}
|
}
|
||||||
wa = wpd->wa;
|
wa = wpd->wa;
|
||||||
wpd->eh = TALER_BANK_transfer (ctx,
|
wpd->eh = TALER_BANK_transfer (ctx,
|
||||||
&wa->auth,
|
wa->auth,
|
||||||
buf,
|
buf,
|
||||||
buf_size,
|
buf_size,
|
||||||
&wire_confirm_cb,
|
&wire_confirm_cb,
|
||||||
|
@ -52,9 +52,9 @@ struct WireAccount
|
|||||||
struct WireAccount *prev;
|
struct WireAccount *prev;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Name of the section that configures this account.
|
* Information about this account.
|
||||||
*/
|
*/
|
||||||
char *section_name;
|
const struct TALER_EXCHANGEDB_AccountInfo *ai;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Database session we are using for the current transaction.
|
* Database session we are using for the current transaction.
|
||||||
@ -66,11 +66,6 @@ struct WireAccount
|
|||||||
*/
|
*/
|
||||||
struct TALER_BANK_CreditHistoryHandle *hh;
|
struct TALER_BANK_CreditHistoryHandle *hh;
|
||||||
|
|
||||||
/**
|
|
||||||
* Authentication data.
|
|
||||||
*/
|
|
||||||
struct TALER_BANK_AuthenticationData auth;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Until when is processing this wire plugin delayed?
|
* Until when is processing this wire plugin delayed?
|
||||||
*/
|
*/
|
||||||
@ -233,8 +228,6 @@ shutdown_task (void *cls)
|
|||||||
GNUNET_CONTAINER_DLL_remove (wa_head,
|
GNUNET_CONTAINER_DLL_remove (wa_head,
|
||||||
wa_tail,
|
wa_tail,
|
||||||
wa);
|
wa);
|
||||||
TALER_BANK_auth_free (&wa->auth);
|
|
||||||
GNUNET_free (wa->section_name);
|
|
||||||
GNUNET_free (wa->job_name);
|
GNUNET_free (wa->job_name);
|
||||||
GNUNET_free (wa);
|
GNUNET_free (wa);
|
||||||
}
|
}
|
||||||
@ -258,6 +251,8 @@ shutdown_task (void *cls)
|
|||||||
}
|
}
|
||||||
TALER_EXCHANGEDB_plugin_unload (db_plugin);
|
TALER_EXCHANGEDB_plugin_unload (db_plugin);
|
||||||
db_plugin = NULL;
|
db_plugin = NULL;
|
||||||
|
TALER_EXCHANGEDB_unload_accounts ();
|
||||||
|
cfg = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -275,21 +270,10 @@ add_account_cb (void *cls,
|
|||||||
struct WireAccount *wa;
|
struct WireAccount *wa;
|
||||||
|
|
||||||
(void) cls;
|
(void) cls;
|
||||||
if (GNUNET_YES != ai->credit_enabled)
|
if (! ai->credit_enabled)
|
||||||
return; /* not enabled for us, skip */
|
return; /* not enabled for us, skip */
|
||||||
wa = GNUNET_new (struct WireAccount);
|
wa = GNUNET_new (struct WireAccount);
|
||||||
if (GNUNET_OK !=
|
wa->ai = ai;
|
||||||
TALER_BANK_auth_parse_cfg (cfg,
|
|
||||||
ai->section_name,
|
|
||||||
&wa->auth))
|
|
||||||
{
|
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE,
|
|
||||||
"Failed to load account `%s'\n",
|
|
||||||
ai->section_name);
|
|
||||||
GNUNET_free (wa);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
wa->section_name = GNUNET_strdup (ai->section_name);
|
|
||||||
GNUNET_asprintf (&wa->job_name,
|
GNUNET_asprintf (&wa->job_name,
|
||||||
"wirewatch-%s",
|
"wirewatch-%s",
|
||||||
ai->section_name);
|
ai->section_name);
|
||||||
@ -325,20 +309,24 @@ exchange_serve_process_config (void)
|
|||||||
if (NULL ==
|
if (NULL ==
|
||||||
(db_plugin = TALER_EXCHANGEDB_plugin_load (cfg)))
|
(db_plugin = TALER_EXCHANGEDB_plugin_load (cfg)))
|
||||||
{
|
{
|
||||||
fprintf (stderr,
|
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
|
||||||
"Failed to initialize DB subsystem\n");
|
"Failed to initialize DB subsystem\n");
|
||||||
return GNUNET_SYSERR;
|
return GNUNET_SYSERR;
|
||||||
}
|
}
|
||||||
TALER_EXCHANGEDB_find_accounts (cfg,
|
if (GNUNET_OK !=
|
||||||
&add_account_cb,
|
TALER_EXCHANGEDB_load_accounts (cfg,
|
||||||
NULL);
|
TALER_EXCHANGEDB_ALO_CREDIT
|
||||||
if (NULL == wa_head)
|
| TALER_EXCHANGEDB_ALO_AUTHDATA))
|
||||||
{
|
{
|
||||||
fprintf (stderr,
|
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
|
||||||
"No wire accounts configured for credit!\n");
|
"No wire accounts configured for credit!\n");
|
||||||
TALER_EXCHANGEDB_plugin_unload (db_plugin);
|
TALER_EXCHANGEDB_plugin_unload (db_plugin);
|
||||||
|
db_plugin = NULL;
|
||||||
return GNUNET_SYSERR;
|
return GNUNET_SYSERR;
|
||||||
}
|
}
|
||||||
|
TALER_EXCHANGEDB_find_accounts (&add_account_cb,
|
||||||
|
NULL);
|
||||||
|
GNUNET_assert (NULL != wa_head);
|
||||||
return GNUNET_OK;
|
return GNUNET_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -558,7 +546,7 @@ history_cb (void *cls,
|
|||||||
&details->amount,
|
&details->amount,
|
||||||
details->execution_date,
|
details->execution_date,
|
||||||
details->debit_account_url,
|
details->debit_account_url,
|
||||||
wa->section_name,
|
wa->ai->section_name,
|
||||||
serial_id);
|
serial_id);
|
||||||
switch (qs)
|
switch (qs)
|
||||||
{
|
{
|
||||||
@ -683,7 +671,7 @@ find_transfers (void *cls)
|
|||||||
GNUNET_assert (NULL == wa_pos->hh);
|
GNUNET_assert (NULL == wa_pos->hh);
|
||||||
wa_pos->latest_row_off = wa_pos->batch_start;
|
wa_pos->latest_row_off = wa_pos->batch_start;
|
||||||
wa_pos->hh = TALER_BANK_credit_history (ctx,
|
wa_pos->hh = TALER_BANK_credit_history (ctx,
|
||||||
&wa_pos->auth,
|
wa_pos->ai->auth,
|
||||||
wa_pos->batch_start,
|
wa_pos->batch_start,
|
||||||
limit,
|
limit,
|
||||||
&history_cb,
|
&history_cb,
|
||||||
|
@ -62,6 +62,8 @@ CONFIG = "postgres:///talercheck"
|
|||||||
PAYTO_URI = "payto://x-taler-bank/localhost:8082/3"
|
PAYTO_URI = "payto://x-taler-bank/localhost:8082/3"
|
||||||
ENABLE_DEBIT = YES
|
ENABLE_DEBIT = YES
|
||||||
ENABLE_CREDIT = YES
|
ENABLE_CREDIT = YES
|
||||||
|
|
||||||
|
[exchange-accountcredentials-1]
|
||||||
WIRE_GATEWAY_AUTH_METHOD = basic
|
WIRE_GATEWAY_AUTH_METHOD = basic
|
||||||
USERNAME = Exchange
|
USERNAME = Exchange
|
||||||
PASSWORD = x
|
PASSWORD = x
|
||||||
|
@ -64,6 +64,8 @@ CONFIG = "postgres:///talercheck"
|
|||||||
PAYTO_URI = "payto://x-taler-bank/localhost:8082/3"
|
PAYTO_URI = "payto://x-taler-bank/localhost:8082/3"
|
||||||
ENABLE_DEBIT = YES
|
ENABLE_DEBIT = YES
|
||||||
ENABLE_CREDIT = YES
|
ENABLE_CREDIT = YES
|
||||||
|
|
||||||
|
[exchange-accountcredentials-1]
|
||||||
TALER_BANK_AUTH_METHOD = NONE
|
TALER_BANK_AUTH_METHOD = NONE
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
This file is part of TALER
|
This file is part of TALER
|
||||||
Copyright (C) 2018 Taler Systems SA
|
Copyright (C) 2018-2021 Taler Systems SA
|
||||||
|
|
||||||
TALER is free software; you can redistribute it and/or modify it under the
|
TALER is free software; you can redistribute it and/or modify it under the
|
||||||
terms of the GNU General Public License as published by the Free Software
|
terms of the GNU General Public License as published by the Free Software
|
||||||
@ -23,150 +23,76 @@
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Head of list of wire accounts of the exchange.
|
* Information we keep for each supported account of the exchange.
|
||||||
*/
|
*/
|
||||||
static struct TALER_EXCHANGEDB_WireAccount *wa_head;
|
struct WireAccount
|
||||||
|
|
||||||
/**
|
|
||||||
* Tail of list of wire accounts of the exchange.
|
|
||||||
*/
|
|
||||||
static struct TALER_EXCHANGEDB_WireAccount *wa_tail;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Closure of #check_for_account.
|
|
||||||
*/
|
|
||||||
struct FindAccountContext
|
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Configuration we are using.
|
* Accounts are kept in a DLL.
|
||||||
*/
|
*/
|
||||||
const struct GNUNET_CONFIGURATION_Handle *cfg;
|
struct WireAccount *next;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Callback to invoke.
|
* Plugins are kept in a DLL.
|
||||||
*/
|
*/
|
||||||
TALER_EXCHANGEDB_AccountCallback cb;
|
struct WireAccount *prev;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Closure for @e cb.
|
* Externally visible account information.
|
||||||
*/
|
*/
|
||||||
void *cb_cls;
|
struct TALER_EXCHANGEDB_AccountInfo ai;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set to #GNUNET_SYSERR if the configuration is invalid.
|
* Authentication data. Only parsed if
|
||||||
|
* #TALER_EXCHANGEDB_ALO_AUTHDATA was set.
|
||||||
*/
|
*/
|
||||||
int res;
|
struct TALER_BANK_AuthenticationData auth;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Name of the section that configures this account.
|
||||||
|
*/
|
||||||
|
char *section_name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Name of the wire method underlying the account.
|
||||||
|
*/
|
||||||
|
char *method;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if @a section begins with "exchange-account-", and if so if the
|
* Head of list of wire accounts of the exchange.
|
||||||
* "PAYTO_URI" is given. If not, a warning is printed, otherwise we also check
|
|
||||||
* if "ENABLE_CREDIT" or "ENABLE_DEBIT" options are set to "YES" and then call
|
|
||||||
* the callback in @a cls with all of the information gathered.
|
|
||||||
*
|
|
||||||
* @param cls our `struct FindAccountContext`
|
|
||||||
* @param section name of a section in the configuration
|
|
||||||
*/
|
*/
|
||||||
static void
|
static struct WireAccount *wa_head;
|
||||||
check_for_account (void *cls,
|
|
||||||
const char *section)
|
|
||||||
{
|
|
||||||
struct FindAccountContext *ctx = cls;
|
|
||||||
char *method;
|
|
||||||
char *payto_uri;
|
|
||||||
|
|
||||||
if (0 != strncasecmp (section,
|
|
||||||
"exchange-account-",
|
|
||||||
strlen ("exchange-account-")))
|
|
||||||
return;
|
|
||||||
if (GNUNET_OK !=
|
|
||||||
GNUNET_CONFIGURATION_get_value_string (ctx->cfg,
|
|
||||||
section,
|
|
||||||
"PAYTO_URI",
|
|
||||||
&payto_uri))
|
|
||||||
{
|
|
||||||
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_WARNING,
|
|
||||||
section,
|
|
||||||
"PAYTO_URI");
|
|
||||||
ctx->res = GNUNET_SYSERR;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
method = TALER_payto_get_method (payto_uri);
|
|
||||||
if (NULL == method)
|
|
||||||
{
|
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
|
|
||||||
"payto URI in config ([%s]/PAYTO_URI) malformed\n",
|
|
||||||
section);
|
|
||||||
ctx->res = GNUNET_SYSERR;
|
|
||||||
GNUNET_free (payto_uri);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
struct TALER_EXCHANGEDB_AccountInfo ai = {
|
|
||||||
.section_name = section,
|
|
||||||
.method = method,
|
|
||||||
.debit_enabled = (GNUNET_YES ==
|
|
||||||
GNUNET_CONFIGURATION_get_value_yesno (
|
|
||||||
ctx->cfg,
|
|
||||||
section,
|
|
||||||
"ENABLE_DEBIT")),
|
|
||||||
.credit_enabled = (GNUNET_YES ==
|
|
||||||
GNUNET_CONFIGURATION_get_value_yesno (ctx->cfg,
|
|
||||||
section,
|
|
||||||
"ENABLE_CREDIT"))
|
|
||||||
};
|
|
||||||
|
|
||||||
ctx->cb (ctx->cb_cls,
|
|
||||||
&ai);
|
|
||||||
}
|
|
||||||
GNUNET_free (payto_uri);
|
|
||||||
GNUNET_free (method);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse the configuration to find account information.
|
* Tail of list of wire accounts of the exchange.
|
||||||
*
|
|
||||||
* @param cfg configuration to use
|
|
||||||
* @param cb callback to invoke
|
|
||||||
* @param cb_cls closure for @a cb
|
|
||||||
* @return #GNUNET_OK if the configuration seems valid, #GNUNET_SYSERR if not
|
|
||||||
*/
|
*/
|
||||||
int
|
static struct WireAccount *wa_tail;
|
||||||
TALER_EXCHANGEDB_find_accounts (const struct GNUNET_CONFIGURATION_Handle *cfg,
|
|
||||||
TALER_EXCHANGEDB_AccountCallback cb,
|
|
||||||
|
void
|
||||||
|
TALER_EXCHANGEDB_find_accounts (TALER_EXCHANGEDB_AccountCallback cb,
|
||||||
void *cb_cls)
|
void *cb_cls)
|
||||||
{
|
{
|
||||||
struct FindAccountContext ctx = {
|
for (struct WireAccount *wa = wa_head;
|
||||||
.cfg = cfg,
|
NULL != wa;
|
||||||
.cb = cb,
|
wa = wa->next)
|
||||||
.cb_cls = cb_cls,
|
cb (cb_cls,
|
||||||
.res = GNUNET_OK
|
&wa->ai);
|
||||||
};
|
|
||||||
|
|
||||||
GNUNET_CONFIGURATION_iterate_sections (cfg,
|
|
||||||
&check_for_account,
|
|
||||||
&ctx);
|
|
||||||
return ctx.res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
const struct TALER_EXCHANGEDB_AccountInfo *
|
||||||
* Find the wire plugin for the given payto:// URL
|
|
||||||
*
|
|
||||||
* @param method wire method we need an account for
|
|
||||||
* @return NULL on error
|
|
||||||
*/
|
|
||||||
struct TALER_EXCHANGEDB_WireAccount *
|
|
||||||
TALER_EXCHANGEDB_find_account_by_method (const char *method)
|
TALER_EXCHANGEDB_find_account_by_method (const char *method)
|
||||||
{
|
{
|
||||||
for (struct TALER_EXCHANGEDB_WireAccount *wa = wa_head; NULL != wa; wa =
|
for (struct WireAccount *wa = wa_head;
|
||||||
wa->next)
|
NULL != wa;
|
||||||
|
wa = wa->next)
|
||||||
if (0 == strcmp (method,
|
if (0 == strcmp (method,
|
||||||
wa->method))
|
wa->method))
|
||||||
return wa;
|
return &wa->ai;
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
|
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
|
||||||
"No wire account known for method `%s'\n",
|
"No wire account known for method `%s'\n",
|
||||||
method);
|
method);
|
||||||
@ -174,17 +100,11 @@ TALER_EXCHANGEDB_find_account_by_method (const char *method)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
const struct TALER_EXCHANGEDB_AccountInfo *
|
||||||
* Find the wire plugin for the given payto:// URL
|
|
||||||
*
|
|
||||||
* @param url wire address we need an account for
|
|
||||||
* @return NULL on error
|
|
||||||
*/
|
|
||||||
struct TALER_EXCHANGEDB_WireAccount *
|
|
||||||
TALER_EXCHANGEDB_find_account_by_payto_uri (const char *url)
|
TALER_EXCHANGEDB_find_account_by_payto_uri (const char *url)
|
||||||
{
|
{
|
||||||
char *method;
|
char *method;
|
||||||
struct TALER_EXCHANGEDB_WireAccount *wa;
|
const struct TALER_EXCHANGEDB_AccountInfo *ai;
|
||||||
|
|
||||||
method = TALER_payto_get_method (url);
|
method = TALER_payto_get_method (url);
|
||||||
if (NULL == method)
|
if (NULL == method)
|
||||||
@ -194,107 +114,177 @@ TALER_EXCHANGEDB_find_account_by_payto_uri (const char *url)
|
|||||||
url);
|
url);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
wa = TALER_EXCHANGEDB_find_account_by_method (method);
|
ai = TALER_EXCHANGEDB_find_account_by_method (method);
|
||||||
GNUNET_free (method);
|
GNUNET_free (method);
|
||||||
return wa;
|
return ai;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Closure for #add_account_cb().
|
||||||
|
*/
|
||||||
|
struct LoaderContext
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Configuration to use.
|
||||||
|
*/
|
||||||
|
const struct GNUNET_CONFIGURATION_Handle *cfg;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* true if we are to load the authentication data
|
||||||
|
* for the access to the bank account.
|
||||||
|
*/
|
||||||
|
bool load_auth_data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load accounts enabled for CREDIT.
|
||||||
|
*/
|
||||||
|
bool credit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load accounts enabled for DEBIT.
|
||||||
|
*/
|
||||||
|
bool debit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loader status (set by callback).
|
||||||
|
*/
|
||||||
|
enum GNUNET_GenericReturnValue res;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function called with information about a wire account. Adds
|
* Function called with information about a wire account. Adds
|
||||||
* the account to our list.
|
* the account to our list.
|
||||||
*
|
*
|
||||||
* @param cls closure, a `struct GNUNET_CONFIGURATION_Handle`
|
* @param cls closure, a `struct LoaderContext`
|
||||||
* @param ai account information
|
* @param ai account information
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
add_account_cb (void *cls,
|
add_account_cb (void *cls,
|
||||||
const struct TALER_EXCHANGEDB_AccountInfo *ai)
|
const char *section)
|
||||||
{
|
{
|
||||||
const struct GNUNET_CONFIGURATION_Handle *cfg = cls;
|
struct LoaderContext *lc = cls;
|
||||||
struct TALER_EXCHANGEDB_WireAccount *wa;
|
const struct GNUNET_CONFIGURATION_Handle *cfg = lc->cfg;
|
||||||
|
struct WireAccount *wa;
|
||||||
char *payto_uri;
|
char *payto_uri;
|
||||||
|
char *method;
|
||||||
|
bool debit;
|
||||||
|
bool credit;
|
||||||
|
|
||||||
(void) cls;
|
if (0 != strncasecmp (section,
|
||||||
if (GNUNET_YES != ai->debit_enabled)
|
"exchange-account-",
|
||||||
|
strlen ("exchange-account-")))
|
||||||
|
return;
|
||||||
|
|
||||||
|
debit = (GNUNET_YES ==
|
||||||
|
GNUNET_CONFIGURATION_get_value_yesno (lc->cfg,
|
||||||
|
section,
|
||||||
|
"ENABLE_DEBIT"));
|
||||||
|
credit = (GNUNET_YES ==
|
||||||
|
GNUNET_CONFIGURATION_get_value_yesno (lc->cfg,
|
||||||
|
section,
|
||||||
|
"ENABLE_CREDIT"));
|
||||||
|
if (! ( ( (debit) &&
|
||||||
|
(lc->debit) ) ||
|
||||||
|
( (credit) &&
|
||||||
|
(lc->credit) ) ) )
|
||||||
return; /* not enabled for us, skip */
|
return; /* not enabled for us, skip */
|
||||||
wa = GNUNET_new (struct TALER_EXCHANGEDB_WireAccount);
|
|
||||||
if (GNUNET_OK !=
|
if (GNUNET_OK !=
|
||||||
GNUNET_CONFIGURATION_get_value_string (cfg,
|
GNUNET_CONFIGURATION_get_value_string (cfg,
|
||||||
ai->section_name,
|
section,
|
||||||
"PAYTO_URI",
|
"PAYTO_URI",
|
||||||
&payto_uri))
|
&payto_uri))
|
||||||
{
|
{
|
||||||
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
|
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_WARNING,
|
||||||
ai->section_name,
|
section,
|
||||||
"PAYTO_URI");
|
"PAYTO_URI");
|
||||||
GNUNET_free (wa);
|
lc->res = GNUNET_SYSERR;
|
||||||
return;
|
|
||||||
}
|
|
||||||
wa->method = TALER_payto_get_method (payto_uri);
|
|
||||||
if (NULL == wa->method)
|
|
||||||
{
|
|
||||||
GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
|
|
||||||
ai->section_name,
|
|
||||||
"PAYTO_URI",
|
|
||||||
"could not obtain wire method from URI");
|
|
||||||
GNUNET_free (wa);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
method = TALER_payto_get_method (payto_uri);
|
||||||
GNUNET_free (payto_uri);
|
GNUNET_free (payto_uri);
|
||||||
if (GNUNET_OK !=
|
if (NULL == method)
|
||||||
TALER_BANK_auth_parse_cfg (cfg,
|
|
||||||
ai->section_name,
|
|
||||||
&wa->auth))
|
|
||||||
{
|
{
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE,
|
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
|
||||||
"Failed to load exchange account `%s'\n",
|
"payto URI in config ([%s]/PAYTO_URI) malformed\n",
|
||||||
ai->section_name);
|
section);
|
||||||
GNUNET_free (wa->method);
|
lc->res = GNUNET_SYSERR;
|
||||||
GNUNET_free (wa);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
wa->section_name = GNUNET_strdup (ai->section_name);
|
wa = GNUNET_new (struct WireAccount);
|
||||||
|
wa->section_name = GNUNET_strdup (section);
|
||||||
|
wa->method = method;
|
||||||
|
wa->ai.debit_enabled = debit;
|
||||||
|
wa->ai.credit_enabled = credit;
|
||||||
|
wa->ai.auth = NULL;
|
||||||
|
wa->ai.section_name = wa->section_name;
|
||||||
|
wa->ai.method = wa->method;
|
||||||
|
if (lc->load_auth_data)
|
||||||
|
{
|
||||||
|
char *csn;
|
||||||
|
|
||||||
|
GNUNET_asprintf (&csn,
|
||||||
|
"exchange-accountcredentials-%s",
|
||||||
|
§ion[strlen ("exchange-account-")]);
|
||||||
|
if (GNUNET_OK !=
|
||||||
|
TALER_BANK_auth_parse_cfg (cfg,
|
||||||
|
csn,
|
||||||
|
&wa->auth))
|
||||||
|
{
|
||||||
|
GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE,
|
||||||
|
"Failed to load exchange account credentials from section `%s'\n",
|
||||||
|
csn);
|
||||||
|
GNUNET_free (csn);
|
||||||
|
GNUNET_free (wa->section_name);
|
||||||
|
GNUNET_free (wa->method);
|
||||||
|
GNUNET_free (wa);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
wa->ai.auth = &wa->auth;
|
||||||
|
GNUNET_free (csn);
|
||||||
|
}
|
||||||
GNUNET_CONTAINER_DLL_insert (wa_head,
|
GNUNET_CONTAINER_DLL_insert (wa_head,
|
||||||
wa_tail,
|
wa_tail,
|
||||||
wa);
|
wa);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
enum GNUNET_GenericReturnValue
|
||||||
* Load account information opf the exchange from
|
TALER_EXCHANGEDB_load_accounts (
|
||||||
* @a cfg.
|
const struct GNUNET_CONFIGURATION_Handle *cfg,
|
||||||
*
|
enum TALER_EXCHANGEDB_AccountLoaderOptions options)
|
||||||
* @param cfg configuration to load from
|
|
||||||
* @return #GNUNET_OK on success, #GNUNET_NO if no accounts are configured
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
TALER_EXCHANGEDB_load_accounts (const struct GNUNET_CONFIGURATION_Handle *cfg)
|
|
||||||
{
|
{
|
||||||
TALER_EXCHANGEDB_find_accounts (cfg,
|
struct LoaderContext lc = {
|
||||||
&add_account_cb,
|
.cfg = cfg,
|
||||||
(void *) cfg);
|
.debit = 0 != (options & TALER_EXCHANGEDB_ALO_DEBIT),
|
||||||
|
.credit = 0 != (options & TALER_EXCHANGEDB_ALO_CREDIT),
|
||||||
|
.load_auth_data = 0 != (options & TALER_EXCHANGEDB_ALO_AUTHDATA),
|
||||||
|
};
|
||||||
|
|
||||||
|
GNUNET_CONFIGURATION_iterate_sections (cfg,
|
||||||
|
&add_account_cb,
|
||||||
|
&lc);
|
||||||
|
if (GNUNET_SYSERR == lc.res)
|
||||||
|
return GNUNET_SYSERR;
|
||||||
if (NULL == wa_head)
|
if (NULL == wa_head)
|
||||||
return GNUNET_NO;
|
return GNUNET_NO;
|
||||||
return GNUNET_OK;
|
return GNUNET_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free resources allocated by
|
|
||||||
* #TALER_EXCHANGEDB_load_accounts().
|
|
||||||
*/
|
|
||||||
void
|
void
|
||||||
TALER_EXCHANGEDB_unload_accounts (void)
|
TALER_EXCHANGEDB_unload_accounts (void)
|
||||||
{
|
{
|
||||||
struct TALER_EXCHANGEDB_WireAccount *wa;
|
struct WireAccount *wa;
|
||||||
|
|
||||||
while (NULL != (wa = wa_head))
|
while (NULL != (wa = wa_head))
|
||||||
{
|
{
|
||||||
GNUNET_CONTAINER_DLL_remove (wa_head,
|
GNUNET_CONTAINER_DLL_remove (wa_head,
|
||||||
wa_tail,
|
wa_tail,
|
||||||
wa);
|
wa);
|
||||||
TALER_BANK_auth_free (&wa->auth);
|
if (NULL != wa->ai.auth)
|
||||||
|
TALER_BANK_auth_free (&wa->auth);
|
||||||
GNUNET_free (wa->section_name);
|
GNUNET_free (wa->section_name);
|
||||||
GNUNET_free (wa->method);
|
GNUNET_free (wa->method);
|
||||||
GNUNET_free (wa);
|
GNUNET_free (wa);
|
||||||
|
@ -52,6 +52,12 @@ TALER_EXCHANGEDB_plugin_unload (struct TALER_EXCHANGEDB_Plugin *plugin);
|
|||||||
*/
|
*/
|
||||||
struct TALER_EXCHANGEDB_AccountInfo
|
struct TALER_EXCHANGEDB_AccountInfo
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Authentication data. Only parsed if
|
||||||
|
* #TALER_EXCHANGEDB_ALO_AUTHDATA was set.
|
||||||
|
*/
|
||||||
|
const struct TALER_BANK_AuthenticationData *auth;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Section in the configuration file that specifies the
|
* Section in the configuration file that specifies the
|
||||||
* account. Must start with "exchange-account-".
|
* account. Must start with "exchange-account-".
|
||||||
@ -64,46 +70,21 @@ struct TALER_EXCHANGEDB_AccountInfo
|
|||||||
const char *method;
|
const char *method;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* #GNUNET_YES if this account is enabed to be debited
|
* true if this account is enabed to be debited
|
||||||
* by the taler-exchange-aggregator.
|
* by the taler-exchange-aggregator.
|
||||||
*/
|
*/
|
||||||
int debit_enabled;
|
bool debit_enabled;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* #GNUNET_YES if this account is enabed to be credited by wallets
|
* true if this account is enabed to be credited by wallets
|
||||||
* and needs to be watched by the taler-exchange-wirewatch.
|
* and needs to be watched by the taler-exchange-wirewatch.
|
||||||
* Also, the account will only be included in /wire if credit
|
* Also, the account will only be included in /wire if credit
|
||||||
* is enabled.
|
* is enabled.
|
||||||
*/
|
*/
|
||||||
int credit_enabled;
|
bool credit_enabled;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function called with information about a wire account.
|
|
||||||
*
|
|
||||||
* @param cls closure
|
|
||||||
* @param ai account information
|
|
||||||
*/
|
|
||||||
typedef void
|
|
||||||
(*TALER_EXCHANGEDB_AccountCallback)(
|
|
||||||
void *cls,
|
|
||||||
const struct TALER_EXCHANGEDB_AccountInfo *ai);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Parse the configuration to find account information.
|
|
||||||
*
|
|
||||||
* @param cfg configuration to use
|
|
||||||
* @param cb callback to invoke
|
|
||||||
* @param cb_cls closure for @a cb
|
|
||||||
* @return #GNUNET_OK if the configuration seems valid, #GNUNET_SYSERR if not
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
TALER_EXCHANGEDB_find_accounts (const struct GNUNET_CONFIGURATION_Handle *cfg,
|
|
||||||
TALER_EXCHANGEDB_AccountCallback cb,
|
|
||||||
void *cb_cls);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculate the total value of all transactions performed.
|
* Calculate the total value of all transactions performed.
|
||||||
* Stores @a off plus the cost of all transactions in @a tl
|
* Stores @a off plus the cost of all transactions in @a tl
|
||||||
@ -121,39 +102,28 @@ TALER_EXCHANGEDB_calculate_transaction_list_totals (
|
|||||||
struct TALER_Amount *ret);
|
struct TALER_Amount *ret);
|
||||||
|
|
||||||
|
|
||||||
/* ***************** convenience functions ******** */
|
/**
|
||||||
|
* Function called with information about a wire account.
|
||||||
|
*
|
||||||
|
* @param cls closure
|
||||||
|
* @param ai account information
|
||||||
|
*/
|
||||||
|
typedef void
|
||||||
|
(*TALER_EXCHANGEDB_AccountCallback)(
|
||||||
|
void *cls,
|
||||||
|
const struct TALER_EXCHANGEDB_AccountInfo *ai);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Information we keep for each supported account of the exchange.
|
* Return information about all accounts that
|
||||||
|
* were loaded by #TALER_EXCHANGEDB_load_accounts().
|
||||||
|
*
|
||||||
|
* @param cb callback to invoke
|
||||||
|
* @param cb_cls closure for @a cb
|
||||||
*/
|
*/
|
||||||
struct TALER_EXCHANGEDB_WireAccount
|
void
|
||||||
{
|
TALER_EXCHANGEDB_find_accounts (TALER_EXCHANGEDB_AccountCallback cb,
|
||||||
/**
|
void *cb_cls);
|
||||||
* Accounts are kept in a DLL.
|
|
||||||
*/
|
|
||||||
struct TALER_EXCHANGEDB_WireAccount *next;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Plugins are kept in a DLL.
|
|
||||||
*/
|
|
||||||
struct TALER_EXCHANGEDB_WireAccount *prev;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Authentication data.
|
|
||||||
*/
|
|
||||||
struct TALER_BANK_AuthenticationData auth;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Name of the section that configures this account.
|
|
||||||
*/
|
|
||||||
char *section_name;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Name of the wire method underlying the account.
|
|
||||||
*/
|
|
||||||
char *method;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -164,7 +134,7 @@ struct TALER_EXCHANGEDB_WireAccount
|
|||||||
* @param method wire method we need an account for
|
* @param method wire method we need an account for
|
||||||
* @return NULL on error
|
* @return NULL on error
|
||||||
*/
|
*/
|
||||||
struct TALER_EXCHANGEDB_WireAccount *
|
const struct TALER_EXCHANGEDB_AccountInfo *
|
||||||
TALER_EXCHANGEDB_find_account_by_method (const char *method);
|
TALER_EXCHANGEDB_find_account_by_method (const char *method);
|
||||||
|
|
||||||
|
|
||||||
@ -176,19 +146,48 @@ TALER_EXCHANGEDB_find_account_by_method (const char *method);
|
|||||||
* @param url wire address we need an account for
|
* @param url wire address we need an account for
|
||||||
* @return NULL on error
|
* @return NULL on error
|
||||||
*/
|
*/
|
||||||
struct TALER_EXCHANGEDB_WireAccount *
|
const struct TALER_EXCHANGEDB_AccountInfo *
|
||||||
TALER_EXCHANGEDB_find_account_by_payto_uri (const char *url);
|
TALER_EXCHANGEDB_find_account_by_payto_uri (const char *url);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Options for #TALER_EXCHANGEDB_load_accounts()
|
||||||
|
*/
|
||||||
|
enum TALER_EXCHANGEDB_AccountLoaderOptions
|
||||||
|
{
|
||||||
|
TALER_EXCHANGEDB_ALO_NONE = 0,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load accounts enabled for DEBITs.
|
||||||
|
*/
|
||||||
|
TALER_EXCHANGEDB_ALO_DEBIT = 1,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load accounts enabled for CREDITs.
|
||||||
|
*/
|
||||||
|
TALER_EXCHANGEDB_ALO_CREDIT = 2,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load authentication data from the
|
||||||
|
* "taler-accountcredentials-" section
|
||||||
|
* to access the account at the bank.
|
||||||
|
*/
|
||||||
|
TALER_EXCHANGEDB_ALO_AUTHDATA = 4
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load account information opf the exchange from
|
* Load account information opf the exchange from
|
||||||
* @a cfg.
|
* @a cfg.
|
||||||
*
|
*
|
||||||
* @param cfg configuration to load from
|
* @param cfg configuration to load from
|
||||||
|
* @param options loader options
|
||||||
* @return #GNUNET_OK on success, #GNUNET_NO if no accounts are configured
|
* @return #GNUNET_OK on success, #GNUNET_NO if no accounts are configured
|
||||||
*/
|
*/
|
||||||
int
|
enum GNUNET_GenericReturnValue
|
||||||
TALER_EXCHANGEDB_load_accounts (const struct GNUNET_CONFIGURATION_Handle *cfg);
|
TALER_EXCHANGEDB_load_accounts (
|
||||||
|
const struct GNUNET_CONFIGURATION_Handle *cfg,
|
||||||
|
enum TALER_EXCHANGEDB_AccountLoaderOptions options);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -70,13 +70,15 @@ LEGAL_RESERVE_EXPIRATION_TIME = 7 years
|
|||||||
|
|
||||||
# What is the account URL?
|
# What is the account URL?
|
||||||
PAYTO_URI = "payto://x-taler-bank/localhost/2"
|
PAYTO_URI = "payto://x-taler-bank/localhost/2"
|
||||||
|
ENABLE_DEBIT = YES
|
||||||
|
ENABLE_CREDIT = YES
|
||||||
|
|
||||||
|
[exchange-accountcredentials-1]
|
||||||
WIRE_GATEWAY_URL = "http://localhost:8082/2/"
|
WIRE_GATEWAY_URL = "http://localhost:8082/2/"
|
||||||
WIRE_GATEWAY_AUTH_METHOD = basic
|
WIRE_GATEWAY_AUTH_METHOD = basic
|
||||||
USERNAME = Exchange
|
USERNAME = Exchange
|
||||||
PASSWORD = x
|
PASSWORD = x
|
||||||
ENABLE_DEBIT = YES
|
|
||||||
ENABLE_CREDIT = YES
|
|
||||||
TALER_BANK_AUTH_METHOD = NONE
|
|
||||||
|
|
||||||
[bank]
|
[bank]
|
||||||
HTTP_PORT = 8082
|
HTTP_PORT = 8082
|
||||||
|
@ -56,17 +56,16 @@ BASE_URL = "http://localhost:8083/"
|
|||||||
PORT = 8083
|
PORT = 8083
|
||||||
|
|
||||||
[exchange-account-1]
|
[exchange-account-1]
|
||||||
|
|
||||||
# What is the account URL?
|
# What is the account URL?
|
||||||
PAYTO_URI = "payto://x-taler-bank/localhost/2"
|
PAYTO_URI = "payto://x-taler-bank/localhost/2"
|
||||||
|
ENABLE_DEBIT = YES
|
||||||
|
ENABLE_CREDIT = YES
|
||||||
|
|
||||||
|
[exchange-accountcredentials-1]
|
||||||
WIRE_GATEWAY_URL = "http://localhost:8082/2/"
|
WIRE_GATEWAY_URL = "http://localhost:8082/2/"
|
||||||
WIRE_GATEWAY_AUTH_METHOD = basic
|
WIRE_GATEWAY_AUTH_METHOD = basic
|
||||||
USERNAME = Exchange
|
USERNAME = Exchange
|
||||||
PASSWORD = x
|
PASSWORD = x
|
||||||
PLUGIN = "taler_bank"
|
|
||||||
ENABLE_DEBIT = YES
|
|
||||||
ENABLE_CREDIT = YES
|
|
||||||
TALER_BANK_AUTH_METHOD = NONE
|
|
||||||
|
|
||||||
[bank]
|
[bank]
|
||||||
HTTP_PORT = 8082
|
HTTP_PORT = 8082
|
||||||
|
@ -57,6 +57,8 @@ CONFIG = "postgres:///talercheck"
|
|||||||
[exchange-account-1]
|
[exchange-account-1]
|
||||||
# What is the URL of our account?
|
# What is the URL of our account?
|
||||||
PAYTO_URI = "payto://x-taler-bank/localhost/42"
|
PAYTO_URI = "payto://x-taler-bank/localhost/42"
|
||||||
|
|
||||||
|
[exchange-accountcredentials-1]
|
||||||
WIRE_GATEWAY_URL = "http://localhost:8082/42/"
|
WIRE_GATEWAY_URL = "http://localhost:8082/42/"
|
||||||
|
|
||||||
[bank]
|
[bank]
|
||||||
@ -66,17 +68,18 @@ HTTP_PORT = 8082
|
|||||||
|
|
||||||
[exchange-account-2]
|
[exchange-account-2]
|
||||||
# What is the bank account (with the "Taler Bank" demo system)?
|
# What is the bank account (with the "Taler Bank" demo system)?
|
||||||
WIRE_GATEWAY_URL = "http://localhost:8082/2/"
|
|
||||||
PAYTO_URI = "payto://x-taler-bank/localhost/2"
|
PAYTO_URI = "payto://x-taler-bank/localhost/2"
|
||||||
|
ENABLE_DEBIT = YES
|
||||||
|
ENABLE_CREDIT = YES
|
||||||
|
|
||||||
# Authentication information for basic authentication
|
# Authentication information for basic authentication
|
||||||
|
[exchange-accountcredentials-2]
|
||||||
|
WIRE_GATEWAY_URL = "http://localhost:8082/2/"
|
||||||
WIRE_GATEWAY_AUTH_METHOD = "basic"
|
WIRE_GATEWAY_AUTH_METHOD = "basic"
|
||||||
USERNAME = user
|
USERNAME = user
|
||||||
PASSWORD = pass
|
PASSWORD = pass
|
||||||
|
|
||||||
ENABLE_DEBIT = YES
|
|
||||||
|
|
||||||
ENABLE_CREDIT = YES
|
|
||||||
|
|
||||||
|
|
||||||
# Sections starting with "coin_" specify which denominations
|
# Sections starting with "coin_" specify which denominations
|
||||||
|
@ -216,10 +216,11 @@ main (int argc,
|
|||||||
TALER_LOG_DEBUG ("Running with Nexus.\n");
|
TALER_LOG_DEBUG ("Running with Nexus.\n");
|
||||||
with_libeufin = GNUNET_YES;
|
with_libeufin = GNUNET_YES;
|
||||||
cfgfile = CONFIG_FILE_NEXUS;
|
cfgfile = CONFIG_FILE_NEXUS;
|
||||||
if (GNUNET_OK != TALER_TESTING_prepare_nexus (CONFIG_FILE_NEXUS,
|
if (GNUNET_OK !=
|
||||||
GNUNET_YES,
|
TALER_TESTING_prepare_nexus (CONFIG_FILE_NEXUS,
|
||||||
"exchange-account-2",
|
GNUNET_YES,
|
||||||
&bc))
|
"exchange-account-2",
|
||||||
|
&bc))
|
||||||
{
|
{
|
||||||
GNUNET_break (0);
|
GNUNET_break (0);
|
||||||
return 77;
|
return 77;
|
||||||
|
@ -5,6 +5,8 @@ currency = KUDOS
|
|||||||
|
|
||||||
[exchange-account-2]
|
[exchange-account-2]
|
||||||
PAYTO_URI = payto://x-taler-bank/localhost/2
|
PAYTO_URI = payto://x-taler-bank/localhost/2
|
||||||
|
|
||||||
|
[exchange-accountcredentials-2]
|
||||||
WIRE_GATEWAY_URL = "http://localhost:8081/2/"
|
WIRE_GATEWAY_URL = "http://localhost:8081/2/"
|
||||||
WIRE_GATEWAY_AUTH_METHOD = basic
|
WIRE_GATEWAY_AUTH_METHOD = basic
|
||||||
USERNAME = Exchange
|
USERNAME = Exchange
|
||||||
|
@ -5,7 +5,8 @@ currency = KUDOS
|
|||||||
|
|
||||||
[exchange-account-2]
|
[exchange-account-2]
|
||||||
PAYTO_URI = payto://iban/BIC/ES9121000418450200051332?receiver-name=Exchange
|
PAYTO_URI = payto://iban/BIC/ES9121000418450200051332?receiver-name=Exchange
|
||||||
METHOD = iban
|
|
||||||
|
[exchange-accountcredentials-2]
|
||||||
WIRE_GATEWAY_URL = http://localhost:5001/facades/my-facade/taler/
|
WIRE_GATEWAY_URL = http://localhost:5001/facades/my-facade/taler/
|
||||||
WIRE_GATEWAY_AUTH_METHOD = basic
|
WIRE_GATEWAY_AUTH_METHOD = basic
|
||||||
# the exchange authenticates as the 'admin' user,
|
# the exchange authenticates as the 'admin' user,
|
||||||
|
@ -5,7 +5,8 @@ currency = KUDOS
|
|||||||
|
|
||||||
[exchange-account-2]
|
[exchange-account-2]
|
||||||
PAYTO_URI = payto://x-taler-bank/localhost/Exchange
|
PAYTO_URI = payto://x-taler-bank/localhost/Exchange
|
||||||
METHOD = x-taler-bank
|
|
||||||
|
[exchange-accountcredentials-2]
|
||||||
WIRE_GATEWAY_URL = "http://localhost:8081/taler-wire-gateway/Exchange/"
|
WIRE_GATEWAY_URL = "http://localhost:8081/taler-wire-gateway/Exchange/"
|
||||||
WIRE_GATEWAY_AUTH_METHOD = basic
|
WIRE_GATEWAY_AUTH_METHOD = basic
|
||||||
USERNAME = Exchange
|
USERNAME = Exchange
|
||||||
|
@ -18,31 +18,26 @@ UNIXPATH = /tmp/taler-service-twister.sock
|
|||||||
UNIX_MATCH_UID = NO
|
UNIX_MATCH_UID = NO
|
||||||
UNIX_MATCH_GID = YES
|
UNIX_MATCH_GID = YES
|
||||||
|
|
||||||
|
|
||||||
[auditor]
|
[auditor]
|
||||||
BASE_URL = "http://localhost:8083/"
|
BASE_URL = "http://localhost:8083/"
|
||||||
|
|
||||||
[taler]
|
[taler]
|
||||||
currency = KUDOS
|
currency = KUDOS
|
||||||
|
|
||||||
|
|
||||||
[bank]
|
[bank]
|
||||||
serve = http
|
serve = http
|
||||||
http_port = 8081
|
http_port = 8081
|
||||||
database = postgres:///talercheck
|
database = postgres:///talercheck
|
||||||
|
|
||||||
|
|
||||||
[exchange-account-1]
|
[exchange-account-1]
|
||||||
PAYTO_URI = payto://x-taler-bank/localhost/1
|
PAYTO_URI = payto://x-taler-bank/localhost/1
|
||||||
|
|
||||||
|
|
||||||
[exchange-account-2]
|
[exchange-account-2]
|
||||||
PAYTO_URI = payto://x-taler-bank/localhost/Exchange
|
PAYTO_URI = payto://x-taler-bank/localhost/Exchange
|
||||||
|
|
||||||
|
[exchange-accountcredentials-2]
|
||||||
WIRE_GATEWAY_URL = "http://localhost:8888/taler-wire-gateway/Exchange/"
|
WIRE_GATEWAY_URL = "http://localhost:8888/taler-wire-gateway/Exchange/"
|
||||||
WIRE_GATEWAY_AUTH_METHOD = basic
|
WIRE_GATEWAY_AUTH_METHOD = basic
|
||||||
USERNAME = Exchange
|
USERNAME = Exchange
|
||||||
PASSWORD = x
|
PASSWORD = x
|
||||||
|
|
||||||
|
|
||||||
[bank]
|
|
||||||
HTTP_PORT = 8081
|
|
||||||
|
@ -57,18 +57,22 @@ CONFIG = "postgres:///talercheck"
|
|||||||
[exchange-account-1]
|
[exchange-account-1]
|
||||||
# What is the URL of our account?
|
# What is the URL of our account?
|
||||||
PAYTO_URI = "payto://x-taler-bank/localhost/42"
|
PAYTO_URI = "payto://x-taler-bank/localhost/42"
|
||||||
WIRE_GATEWAY_URL = "http://localhost:9081/42/"
|
|
||||||
# ENABLE_CREDIT = YES
|
# ENABLE_CREDIT = YES
|
||||||
|
|
||||||
|
[exchange-accountcredentials-1]
|
||||||
|
WIRE_GATEWAY_URL = "http://localhost:9081/42/"
|
||||||
|
|
||||||
[exchange-account-2]
|
[exchange-account-2]
|
||||||
# What is the bank account (with the "Taler Bank" demo system)?
|
# What is the bank account (with the "Taler Bank" demo system)?
|
||||||
PAYTO_URI = "payto://x-taler-bank/localhost/2"
|
PAYTO_URI = "payto://x-taler-bank/localhost/2"
|
||||||
|
ENABLE_DEBIT = YES
|
||||||
|
ENABLE_CREDIT = YES
|
||||||
|
|
||||||
|
[exchange-accountcredentials-2]
|
||||||
WIRE_GATEWAY_AUTH_METHOD = basic
|
WIRE_GATEWAY_AUTH_METHOD = basic
|
||||||
USERNAME = Exchange
|
USERNAME = Exchange
|
||||||
PASSWORD = x
|
PASSWORD = x
|
||||||
WIRE_GATEWAY_URL = "http://localhost:9081/2/"
|
WIRE_GATEWAY_URL = "http://localhost:9081/2/"
|
||||||
ENABLE_DEBIT = YES
|
|
||||||
ENABLE_CREDIT = YES
|
|
||||||
|
|
||||||
[bank]
|
[bank]
|
||||||
HTTP_PORT = 9081
|
HTTP_PORT = 9081
|
||||||
|
@ -57,18 +57,22 @@ CONFIG = "postgres:///talercheck"
|
|||||||
|
|
||||||
[exchange-account-1]
|
[exchange-account-1]
|
||||||
PAYTO_URI = payto://x-taler-bank/localhost/42
|
PAYTO_URI = payto://x-taler-bank/localhost/42
|
||||||
|
|
||||||
|
[exchange-accountcredentials-1]
|
||||||
WIRE_GATEWAY_URL = "http://localhost:9082/42/"
|
WIRE_GATEWAY_URL = "http://localhost:9082/42/"
|
||||||
|
|
||||||
[exchange-account-2]
|
[exchange-account-2]
|
||||||
PAYTO_URI = payto://x-taler-bank/localhost/2
|
PAYTO_URI = payto://x-taler-bank/localhost/2
|
||||||
|
ENABLE_DEBIT = YES
|
||||||
|
ENABLE_CREDIT = YES
|
||||||
|
|
||||||
|
[exchange-accountcredentials-2]
|
||||||
WIRE_GATEWAY_URL = "http://localhost:9082/2/"
|
WIRE_GATEWAY_URL = "http://localhost:9082/2/"
|
||||||
|
|
||||||
# Authentication information for basic authentication
|
# Authentication information for basic authentication
|
||||||
TALER_BANK_AUTH_METHOD = "basic"
|
TALER_BANK_AUTH_METHOD = "basic"
|
||||||
USERNAME = user
|
USERNAME = user
|
||||||
PASSWORD = pass
|
PASSWORD = pass
|
||||||
ENABLE_DEBIT = YES
|
|
||||||
ENABLE_CREDIT = YES
|
|
||||||
|
|
||||||
[bank]
|
[bank]
|
||||||
HTTP_PORT=8082
|
HTTP_PORT=8082
|
||||||
|
@ -49,17 +49,21 @@ CONFIG = "postgres:///talercheck"
|
|||||||
[exchange-account-1]
|
[exchange-account-1]
|
||||||
# What is the URL of our account?
|
# What is the URL of our account?
|
||||||
PAYTO_URI = "payto://x-taler-bank/localhost/42"
|
PAYTO_URI = "payto://x-taler-bank/localhost/42"
|
||||||
|
|
||||||
|
[exchange-accountcredentials-1]
|
||||||
WIRE_GATEWAY_URL = "http://localhost:9081/42/"
|
WIRE_GATEWAY_URL = "http://localhost:9081/42/"
|
||||||
WIRE_GATEWAY_AUTH_METHOD = NONE
|
WIRE_GATEWAY_AUTH_METHOD = NONE
|
||||||
|
|
||||||
[exchange-account-2]
|
[exchange-account-2]
|
||||||
PAYTO_URI = payto://x-taler-bank/localhost/2
|
PAYTO_URI = payto://x-taler-bank/localhost/2
|
||||||
|
ENABLE_DEBIT = YES
|
||||||
|
ENABLE_CREDIT = YES
|
||||||
|
|
||||||
|
[exchange-accountcredentials-2]
|
||||||
WIRE_GATEWAY_URL = "http://localhost:8082/2/"
|
WIRE_GATEWAY_URL = "http://localhost:8082/2/"
|
||||||
WIRE_GATEWAY_AUTH_METHOD = BASIC
|
WIRE_GATEWAY_AUTH_METHOD = BASIC
|
||||||
USERNAME = user
|
USERNAME = user
|
||||||
PASSWORD = pass
|
PASSWORD = pass
|
||||||
ENABLE_DEBIT = YES
|
|
||||||
ENABLE_CREDIT = YES
|
|
||||||
|
|
||||||
[bank]
|
[bank]
|
||||||
HTTP_PORT = 8082
|
HTTP_PORT = 8082
|
||||||
|
@ -292,10 +292,14 @@ TALER_TESTING_prepare_nexus (const char *config_filename,
|
|||||||
char *database = NULL; // silence compiler
|
char *database = NULL; // silence compiler
|
||||||
char *exchange_payto_uri;
|
char *exchange_payto_uri;
|
||||||
|
|
||||||
|
GNUNET_assert (0 ==
|
||||||
|
strncasecmp (config_section,
|
||||||
|
"exchange-account-",
|
||||||
|
strlen ("exchange-account-")));
|
||||||
cfg = GNUNET_CONFIGURATION_create ();
|
cfg = GNUNET_CONFIGURATION_create ();
|
||||||
|
|
||||||
if (GNUNET_OK !=
|
if (GNUNET_OK !=
|
||||||
GNUNET_CONFIGURATION_load (cfg, config_filename))
|
GNUNET_CONFIGURATION_load (cfg,
|
||||||
|
config_filename))
|
||||||
{
|
{
|
||||||
GNUNET_CONFIGURATION_destroy (cfg);
|
GNUNET_CONFIGURATION_destroy (cfg);
|
||||||
GNUNET_break (0);
|
GNUNET_break (0);
|
||||||
@ -357,14 +361,25 @@ TALER_TESTING_prepare_nexus (const char *config_filename,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GNUNET_OK !=
|
|
||||||
TALER_BANK_auth_parse_cfg (cfg,
|
|
||||||
config_section,
|
|
||||||
&bc->exchange_auth))
|
|
||||||
{
|
{
|
||||||
GNUNET_break (0);
|
char *csn;
|
||||||
GNUNET_CONFIGURATION_destroy (cfg);
|
|
||||||
return GNUNET_SYSERR;
|
GNUNET_asprintf (&csn,
|
||||||
|
"exchange-accountcredentials-%s",
|
||||||
|
&config_section[strlen ("exchange-account-")]);
|
||||||
|
|
||||||
|
|
||||||
|
if (GNUNET_OK !=
|
||||||
|
TALER_BANK_auth_parse_cfg (cfg,
|
||||||
|
csn,
|
||||||
|
&bc->exchange_auth))
|
||||||
|
{
|
||||||
|
GNUNET_break (0);
|
||||||
|
GNUNET_CONFIGURATION_destroy (cfg);
|
||||||
|
GNUNET_free (csn);
|
||||||
|
return GNUNET_SYSERR;
|
||||||
|
}
|
||||||
|
GNUNET_free (csn);
|
||||||
}
|
}
|
||||||
GNUNET_CONFIGURATION_destroy (cfg);
|
GNUNET_CONFIGURATION_destroy (cfg);
|
||||||
bc->exchange_payto = exchange_payto_uri;
|
bc->exchange_payto = exchange_payto_uri;
|
||||||
@ -400,10 +415,15 @@ TALER_TESTING_prepare_bank (const char *config_filename,
|
|||||||
char *database;
|
char *database;
|
||||||
char *exchange_payto_uri;
|
char *exchange_payto_uri;
|
||||||
|
|
||||||
|
GNUNET_assert (0 ==
|
||||||
|
strncasecmp (config_section,
|
||||||
|
"exchange-account-",
|
||||||
|
strlen ("exchange-account-")));
|
||||||
cfg = GNUNET_CONFIGURATION_create ();
|
cfg = GNUNET_CONFIGURATION_create ();
|
||||||
|
|
||||||
if (GNUNET_OK !=
|
if (GNUNET_OK !=
|
||||||
GNUNET_CONFIGURATION_load (cfg, config_filename))
|
GNUNET_CONFIGURATION_load (cfg,
|
||||||
|
config_filename))
|
||||||
{
|
{
|
||||||
GNUNET_CONFIGURATION_destroy (cfg);
|
GNUNET_CONFIGURATION_destroy (cfg);
|
||||||
GNUNET_break (0);
|
GNUNET_break (0);
|
||||||
@ -522,14 +542,24 @@ TALER_TESTING_prepare_bank (const char *config_filename,
|
|||||||
}
|
}
|
||||||
GNUNET_OS_process_destroy (dbreset_proc);
|
GNUNET_OS_process_destroy (dbreset_proc);
|
||||||
}
|
}
|
||||||
if (GNUNET_OK !=
|
|
||||||
TALER_BANK_auth_parse_cfg (cfg,
|
|
||||||
config_section,
|
|
||||||
&bc->exchange_auth))
|
|
||||||
{
|
{
|
||||||
GNUNET_break (0);
|
char *csn;
|
||||||
GNUNET_CONFIGURATION_destroy (cfg);
|
|
||||||
return GNUNET_SYSERR;
|
GNUNET_asprintf (&csn,
|
||||||
|
"exchange-accountcredentials-%s",
|
||||||
|
&config_section[strlen ("exchange-account-")]);
|
||||||
|
|
||||||
|
if (GNUNET_OK !=
|
||||||
|
TALER_BANK_auth_parse_cfg (cfg,
|
||||||
|
csn,
|
||||||
|
&bc->exchange_auth))
|
||||||
|
{
|
||||||
|
GNUNET_break (0);
|
||||||
|
GNUNET_free (csn);
|
||||||
|
GNUNET_CONFIGURATION_destroy (cfg);
|
||||||
|
return GNUNET_SYSERR;
|
||||||
|
}
|
||||||
|
GNUNET_free (csn);
|
||||||
}
|
}
|
||||||
GNUNET_CONFIGURATION_destroy (cfg);
|
GNUNET_CONFIGURATION_destroy (cfg);
|
||||||
bc->exchange_payto = exchange_payto_uri;
|
bc->exchange_payto = exchange_payto_uri;
|
||||||
|
Loading…
Reference in New Issue
Block a user